コード例 #1
0
  private int beginDmDataConnectivity() throws IOException {

    int result =
        mConnMgr.startUsingNetworkFeature(
            ConnectivityManager.TYPE_MOBILE, MTKPhone.FEATURE_ENABLE_DM);

    Log.i(TAG.Connection, "[dm-conn]->startUsingNetworkFeature: result=" + result);

    if (result == MTKPhone.APN_ALREADY_ACTIVE) {
      Log.i(TAG.Connection, "[dm-conn]->APN_ALREADY_ACTIVE");
      ScreenLock.releaseWakeLock(mContext);
      ScreenLock.acquirePartialWakelock(mContext);
      ensureRouteToHost();
    } else if (result == MTKPhone.APN_REQUEST_STARTED) {
      Log.i(TAG.Connection, "[dm-conn]->APN_REQUEST_STARTED, waiting for intent.");
      ScreenLock.releaseWakeLock(mContext);
      ScreenLock.acquirePartialWakelock(mContext);
      // mContext.registerReceiver(mConnectivityReceiver, new
      // IntentFilter(
      // ConnectivityManager.CONNECTIVITY_ACTION));
      // mTelephonyManager=(TelephonyManager)
      // mContext.getSystemService(Service.TELEPHONY_SERVICE);
    } else if (result == MTKPhone.APN_REQUEST_FAILED) {
      Log.e(TAG.Connection, "[dm-conn]->APN_REQUEST_FAILED");
    } else {
      throw new IOException("[dm-conn]:Cannot establish DM data connectivity");
    }

    return result;
  }
コード例 #2
0
  private int beginDmDataConnectivityGemini(int simId) throws IOException {

    int result =
        MTKConnectivity.startUsingNetworkFeatureGemini(
            mConnMgr, ConnectivityManager.TYPE_MOBILE, MTKPhone.FEATURE_ENABLE_DM, simId);

    Log.i(
        TAG.Connection, "startDmDataConnectivityGemini: simId = " + simId + "\t result=" + result);

    if (result == MTKPhone.APN_ALREADY_ACTIVE) {
      Log.w(TAG.Connection, "The data connection is already exist, go ahead");
      ScreenLock.releaseWakeLock(mContext);
      ScreenLock.acquirePartialWakelock(mContext);
      ensureRouteToHost();
    } else if (result == MTKPhone.APN_REQUEST_STARTED) {
      Log.w(
          TAG.Connection, "The new data connection is started register and waiting for the intent");
      ScreenLock.releaseWakeLock(mContext);
      ScreenLock.acquirePartialWakelock(mContext);
      // mContext.registerReceiver(mConnectivityReceiver, new
      // IntentFilter(
      // ConnectivityManager.CONNECTIVITY_ACTION));
      // mContext.registerReceiver(mConnectivityReceiver, new
      // IntentFilter(DmConst.intentAction.NET_DETECT_TIMEOUT));
      // mTelephonyManager=(TelephonyManager)
      // mContext.getSystemService(Service.TELEPHONY_SERVICE);
    } else if (result == MTKPhone.APN_REQUEST_FAILED) {
      Log.e(TAG.Connection, "startUsingnetworkfeature failed");
    } else {
      throw new IOException("Cannot establish Dm Data connectivity");
    }
    return result;
  }
コード例 #3
0
 public void stopDmDataConnectivity() {
   Assert.assertFalse(
       "stopDmDataConnectivity MUST NOT be called in direct internet conn.",
       Options.UseDirectInternet);
   Log.v(TAG.Connection, "stopDmDataConnectivity");
   try {
     simId = DmCommomFun.getSimRegisterID(mContext);
     if (simId == -1) {
       Log.e(TAG.Connection, "Get Register SIM ID error in stop data connection");
       return;
     }
     if (MTKOptions.MTK_GEMINI_SUPPORT == true) {
       // begin for connectity gemini
       endDmConnectivityGemini(simId);
     } else {
       endDmDataConnectivity();
     }
     ScreenLock.releaseWakeLock(mContext);
     ScreenLock.enableKeyguard(mContext);
   } finally {
     Log.v(TAG.Connection, "stopUsingNetworkFeature end");
   }
 }