コード例 #1
0
  @Override
  public void setPreferredNetworkType(int networkType, Message response) {
    /* Samsung modem implementation does bad things when a datacall is running
     * while switching the preferred networktype.
     */
    HandlerThread handlerThread;
    Looper looper;

    if (NeedReconnect()) {
      if (mSamsungExynos4RILHandler == null) {

        handlerThread = new HandlerThread("mSamsungExynos4RILThread");
        mSamsungExynos4RILThread = handlerThread;

        mSamsungExynos4RILThread.start();

        looper = mSamsungExynos4RILThread.getLooper();
        mSamsungExynos4RILHandler = new ConnectivityHandler(mContext, looper);
      }
      mSamsungExynos4RILHandler.setPreferedNetworkType(networkType, response);
    } else {
      if (mSamsungExynos4RILHandler != null) {
        mSamsungExynos4RILThread = null;
        mSamsungExynos4RILHandler = null;
      }
      sendPreferedNetworktype(networkType, response);
    }
  }
コード例 #2
0
  @Override
  public void setPreferredNetworkType(int networkType, Message response) {
    /* Samsung modem implementation does bad things when a datacall is running
     * while switching the preferred networktype.
     */
    ConnectivityManager cm =
        (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);

    if (cm.getMobileDataEnabled()) {
      ConnectivityHandler handler = new ConnectivityHandler(mContext);
      handler.setPreferedNetworkType(networkType, response);
    } else {
      sendPreferedNetworktype(networkType, response);
    }
  }