/**
  * Record the detailed state of a network, and if it is a change from the previous state, send a
  * notification to any listeners.
  *
  * @param state the new @{code DetailedState}
  * @param reason a {@code String} indicating a reason for the state change, if one was supplied.
  *     May be {@code null}.
  * @param extraInfo optional {@code String} providing extra information about the state change
  * @param simId 0 for sim1 and 1 for sim2
  */
 public void setDetailedStateGemini(
     NetworkInfo.DetailedState state, String reason, String extraInfo, int simId) {
   if (DBG)
     log(
         "setDetailed state, old ="
             + mNetworkInfo.getDetailedState()
             + " and new state="
             + state
             + " simId is "
             + simId);
   if (state != mNetworkInfo.getDetailedState()) {
     boolean wasConnecting = (mNetworkInfo.getState() == NetworkInfo.State.CONNECTING);
     String lastReason = mNetworkInfo.getReason();
     /*
      * If a reason was supplied when the CONNECTING state was entered, and no
      * reason was supplied for entering the CONNECTED state, then retain the
      * reason that was supplied when going to CONNECTING.
      */
     if (wasConnecting
         && state == NetworkInfo.DetailedState.CONNECTED
         && reason == null
         && lastReason != null) reason = lastReason;
     mNetworkInfo.setDetailedStateGemini(state, reason, extraInfo, simId);
     Message msg = mTarget.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
     msg.sendToTarget();
   } else if (reason != null
       && (reason.equals(PhoneConstants.REASON_NO_SUCH_PDP)
           || reason.equals(Phone.REASON_APN_FAILED))
       && state == DetailedState.DISCONNECTED) {
     mNetworkInfo.setDetailedStateGemini(state, reason, extraInfo, simId);
     Message msg = mTarget.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
     msg.sendToTarget();
   }
 }
 /**
  * Record the detailed state of a network, and if it is a change from the previous state, send a
  * notification to any listeners.
  *
  * @param state the new @{code DetailedState}
  * @param reason a {@code String} indicating a reason for the state change, if one was supplied.
  *     May be {@code null}.
  * @param extraInfo optional {@code String} providing extra information about the state change
  */
 private void setDetailedState(NetworkInfo.DetailedState state, String reason, String extraInfo) {
   if (DBG)
     log("setDetailed state, old =" + mNetworkInfo.getDetailedState() + " and new state=" + state);
   if (state != mNetworkInfo.getDetailedState()) {
     boolean wasConnecting = (mNetworkInfo.getState() == NetworkInfo.State.CONNECTING);
     String lastReason = mNetworkInfo.getReason();
     /*
      * If a reason was supplied when the CONNECTING state was entered, and no
      * reason was supplied for entering the CONNECTED state, then retain the
      * reason that was supplied when going to CONNECTING.
      */
     if (wasConnecting
         && state == NetworkInfo.DetailedState.CONNECTED
         && reason == null
         && lastReason != null) reason = lastReason;
     mNetworkInfo.setDetailedState(state, reason, extraInfo);
     Message msg = mTarget.obtainMessage(EVENT_STATE_CHANGED, new NetworkInfo(mNetworkInfo));
     msg.sendToTarget();
   }
 }