code: @Override
      public void onConnectionFailed(ConnectionResult result) {
          timeoutHandler.removeMessages(APICLIENT_TIMEOUT_HANDLE_MSG);
  
          if (result == null) {
              HMSAgentLog.e("result is null");
              onConnectEnd(HMSAgent.AgentResultCode.RESULT_IS_NULL);
              return;
          }
  
          int errCode = result.getErrorCode();
          HMSAgentLog.d("errCode=" + errCode + " allowResolve=" + allowResolveConnectError);
  
          if(HuaweiApiAvailability.getInstance().isUserResolvableError(errCode) && allowResolveConnectError) {
              Activity activity = ActivityMgr.INST.getLastActivity();
              if (activity != null) {
                  try {
                      timeoutHandler.sendEmptyMessageDelayed(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG, APICLIENT_STARTACTIVITY_TIMEOUT);
                      Intent intent = new Intent(activity, HMSAgentActivity.class);
                      intent.putExtra(HMSAgentActivity.CONN_ERR_CODE_TAG, errCode);
                      intent.putExtra(BaseAgentActivity.EXTRA_IS_FULLSCREEN, UIUtils.isActivityFullscreen(activity));
                      activity.startActivity(intent);
                      return;
                  } catch (Exception e) {
                      HMSAgentLog.e("start HMSAgentActivity exception:" + e.getMessage());
                      timeoutHandler.removeMessages(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG);
                      onConnectEnd(HMSAgent.AgentResultCode.START_ACTIVITY_ERROR);
                      return;
                  }
              } else {
                  // 当前没有界面处理不了错误
                  HMSAgentLog.d("no activity");
                  onConnectEnd(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE);
                  return;
              }
          } else {
              //其他错误码直接透传
          }
  
          onConnectEnd(errCode);
      }
docs: 建立client到service的连接失败时调用
  
  @param result 连接结果，用于解决错误和知道什么类型的错误