public String getOperatorState() {
   if (mTelephonyManager == null) {
     return null;
   }
   if (mServiceState == null || mServiceState.getState() == ServiceState.STATE_OUT_OF_SERVICE) {
     return mContext.getString(R.string.pie_phone_status_no_service);
   }
   if (mServiceState.getState() == ServiceState.STATE_POWER_OFF) {
     return mContext.getString(R.string.pie_phone_status_airplane_mode);
   }
   if (mServiceState.isEmergencyOnly()) {
     return mContext.getString(R.string.pie_phone_status_emergency_only);
   }
   return mServiceState.getOperatorAlphaLong();
 }
Esempio n. 2
0
  private void updateServiceState(ServiceState serviceState) {
    int state = serviceState.getState();
    String display = mRes.getString(R.string.radioInfo_unknown);

    switch (state) {
      case ServiceState.STATE_IN_SERVICE:
        display = mRes.getString(R.string.radioInfo_service_in);
        break;
      case ServiceState.STATE_OUT_OF_SERVICE:
      case ServiceState.STATE_EMERGENCY_ONLY:
        display = mRes.getString(R.string.radioInfo_service_out);
        break;
      case ServiceState.STATE_POWER_OFF:
        display = mRes.getString(R.string.radioInfo_service_off);
        break;
    }

    setSummaryText(KEY_SERVICE_STATE, display);

    if (serviceState.getRoaming()) {
      setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in));
    } else {
      setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not));
    }
    setSummaryText(KEY_OPERATOR_NAME, serviceState.getOperatorAlphaLong());
  }
Esempio n. 3
0
    @Override
    public void handleMessage(Message msg) {
      Status status = mStatus.get();
      if (status == null) {
        return;
      }

      switch (msg.what) {
        case EVENT_SIGNAL_STRENGTH_CHANGED:
          status.updateSignalStrength();
          break;

        case EVENT_SERVICE_STATE_CHANGED:
          ServiceState serviceState = status.mPhoneStateReceiver.getServiceState();
          status.updateServiceState(serviceState);
          // SWISTART
          if (ServiceState.STATE_IN_SERVICE == serviceState.getState())
            sendEmptyMessageDelayed(EVENT_UPDATE_PHONE_TYPE, 5000);
          // SWISTOP
          break;

        case EVENT_UPDATE_STATS:
          status.updateTimes();
          sendEmptyMessageDelayed(EVENT_UPDATE_STATS, 1000);
          break;
          // SWISTART
        case EVENT_UPDATE_PHONE_TYPE:
          status.updatePhoneType();
          break;
          // SWISTART
      }
    }
Esempio n. 4
0
  private void updateServiceState(ServiceState serviceState) {
    int state = serviceState.getState();
    String display = mRes.getString(R.string.radioInfo_unknown);

    switch (state) {
      case ServiceState.STATE_IN_SERVICE:
        display = mRes.getString(R.string.radioInfo_service_in);
        break;
      case ServiceState.STATE_OUT_OF_SERVICE:
      case ServiceState.STATE_EMERGENCY_ONLY:
        display = mRes.getString(R.string.radioInfo_service_out);
        break;
      case ServiceState.STATE_POWER_OFF:
        display = mRes.getString(R.string.radioInfo_service_off);
        break;
    }

    setSummaryText(KEY_SERVICE_STATE, display);

    if (serviceState.getRoaming()) {
      setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in));
    } else {
      setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not));
    }
    Preference p = findPreference(KEY_OPERATOR_NAME);
    String op = serviceState.getOperatorAlphaLong();
    if (TextUtils.isEmpty(op)) {
      op = this.getResources().getString(R.string.device_info_default);
    }
    if (p != null) {
      mExt.updateServiceState(p, serviceState.getOperatorAlphaLong());
    }
  }
    public void handleMessage(Message msg) {
      switch (msg.what) {
        case EVENT_SERVICE_STATE_CHANGED:
          {
            if (DBG) Log.d(TAG, "EVENT_SERVICE_STATE_CHANGED");
            // make the initial call attempt after the radio is turned on.
            ServiceState state = (ServiceState) ((AsyncResult) msg.obj).result;
            if (DBG) Log.d(TAG, "EVENT_SERVICE_STATE_CHANGED: state = " + state);
            if (state.getState() != ServiceState.STATE_POWER_OFF) {
              EmergencyCallInfo eci = (EmergencyCallInfo) ((AsyncResult) msg.obj).userObj;
              // deregister for the service state change events.
              eci.phone.unregisterForServiceStateChanged(this);
              removeMessages(EVENT_SERVICE_STATE_CHANGED);
              eci.dialog.dismiss();

              if (DBG) Log.d(TAG, "About to (re)launch InCallScreen: " + eci.intent);
              eci.app.startActivity(eci.intent);
            }
          }
          break;

        case EVENT_TIMEOUT_EMERGENCY_CALL:
          {
            if (DBG) Log.d(TAG, "EVENT_TIMEOUT_EMERGENCY_CALL...");
            // repeated call after the timeout period.
            EmergencyCallInfo eci = (EmergencyCallInfo) msg.obj;
            eci.dialog.dismiss();

            if (DBG) Log.d(TAG, "About to (re)launch InCallScreen: " + eci.intent);
            eci.app.startActivity(eci.intent);
          }
          break;
      }
    }
Esempio n. 6
0
  private void handleServiceStateChanged(Intent intent) {
    /**
     * This used to handle updating EriTextWidgetProvider this routine and and listening for
     * ACTION_SERVICE_STATE_CHANGED intents could be removed. But leaving just in case it might be
     * needed in the near future.
     */

    // If service just returned, start sending out the queued messages
    ServiceState ss = ServiceState.newFromBundle(intent.getExtras());

    boolean hasService = true;
    boolean isCdma = false;
    String eriText = "";

    if (ss != null) {
      int state = ss.getState();
      switch (state) {
        case ServiceState.STATE_OUT_OF_SERVICE:
        case ServiceState.STATE_POWER_OFF:
          hasService = false;
          break;
      }
    } else {
      hasService = false;
    }
  }
 private void handleServiceStateChanged(Intent intent) {
   // If service just returned, start sending out the queued messages
   ServiceState serviceState = ServiceState.newFromBundle(intent.getExtras());
   if (serviceState.getState() == ServiceState.STATE_IN_SERVICE) {
     sendFirstQueuedMessage();
   }
 }
  /**
   * Registration point for transition into network attached.
   *
   * @param h handler to notify
   * @param what what code of message when delivered
   * @param obj in Message.obj
   */
  public void registerForNetworkAttached(Handler h, int what, Object obj) {
    Registrant r = new Registrant(h, what, obj);

    mNetworkAttachedRegistrants.add(r);
    if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
      r.notifyRegistrant();
    }
  }
 @Override
 public void onServiceStateChanged(ServiceState serviceState) {
   final boolean inAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF;
   mAirplaneState = inAirplaneMode ? ToggleAction.State.On : ToggleAction.State.Off;
   if (mAirplaneModeOn != null && mAdapter != null) {
     mAirplaneModeOn.updateState(mAirplaneState);
     mAdapter.notifyDataSetChanged();
   }
 }
 public void onServiceStateChanged(ServiceState paramServiceState) {
   bzk localbzk = b;
   if (paramServiceState.getState() == 0) {}
   for (boolean bool = true; ; bool = false) {
     a = bool;
     a.a();
     return;
   }
 }
Esempio n. 11
0
 /**
  * if slotId is valid, check the slot's service state, else check all slots' service sate.
  *
  * @return true if the slot is power off
  */
 public static boolean isSlotPowerOff(Phone phone, int slotId) {
   Assert.assertNotNull(phone);
   if (GeminiUtils.isGeminiSupport()) {
     GeminiPhone gPhone = (GeminiPhone) phone;
     if (GeminiUtils.isValidSlot(slotId)) {
       ServiceState serviceState =
           ServiceState.newFromBundle(
               PhoneGlobals.getInstance().phoneMgrEx.getServiceState(slotId));
       return serviceState.getState() == ServiceState.STATE_POWER_OFF;
     }
     int[] geminiSlots = GeminiUtils.getSlots();
     for (int gs : geminiSlots) {
       ServiceState serviceState =
           ServiceState.newFromBundle(PhoneGlobals.getInstance().phoneMgrEx.getServiceState(gs));
       if (serviceState.getState() != ServiceState.STATE_POWER_OFF) {
         return false;
       }
     }
     return true;
   }
   return phone.getServiceState().getState() == ServiceState.STATE_POWER_OFF;
 }
Esempio n. 12
0
        @Override
        public void onServiceStateChanged(ServiceState serviceState) {
          if (serviceState.getState() == ServiceState.STATE_IN_SERVICE) {
            int current_international = (Util.isInternational(SinkholeService.this) ? 1 : 0);
            Log.i(TAG, "In service international=" + current_international);

            if (last_international != current_international) {
              Log.i(TAG, "New international=" + current_international);
              last_international = current_international;

              SharedPreferences prefs =
                  PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
              if (prefs.getBoolean("national_roaming", false))
                reload(null, "service state changed", SinkholeService.this);
            }
          }
        }
Esempio n. 13
0
    @Override
    public void onServiceStateChanged(ServiceState serviceState) {
      int state = serviceState.getState();

      switch (state) {
        case ServiceState.STATE_IN_SERVICE:
        case ServiceState.STATE_OUT_OF_SERVICE:
        case ServiceState.STATE_EMERGENCY_ONLY:
        case ServiceState.STATE_POWER_OFF:
          ContentObject co = mContentManager.addRFStateObject(state);
          if (mActivityHandler != null)
            mActivityHandler.obtainMessage(Constants.MESSAGE_RF_STATE_RECEIVED, co).sendToTarget();
          // send to device
          if (co != null) sendContentsToDevice(co);
          else deleteEmergencyOfDevice(EmergencyObject.EMERGENCY_TYPE_RF_STATE);
          break;
      }
    }
Esempio n. 14
0
 @Override
 public void onServiceStateChanged(ServiceState serviceState) {
   mServiceState = serviceState.getState();
   updateServiceState(serviceState);
 }
  @Override
  public void onServiceStateChanged(ServiceState serviceState) {
    int state = serviceState.getState();
    if (state == mPreviousState
        || (state != ServiceState.STATE_IN_SERVICE
            && mPreviousState != ServiceState.STATE_IN_SERVICE)) {
      // Only interested in state changes or transitioning into or out of "in service".
      // Otherwise just quit.
      mPreviousState = state;
      return;
    }

    if (state == ServiceState.STATE_IN_SERVICE) {
      VoicemailStatusQueryHelper voicemailStatusQueryHelper =
          new VoicemailStatusQueryHelper(mContext);
      if (voicemailStatusQueryHelper.isVoicemailSourceConfigured(mPhoneAccount)) {
        if (!voicemailStatusQueryHelper.isNotificationsChannelActive(mPhoneAccount)) {
          Log.v(TAG, "Notifications channel is active for " + mPhoneAccount.getId());
          VoicemailContract.Status.setStatus(
              mContext,
              mPhoneAccount,
              VoicemailContract.Status.CONFIGURATION_STATE_OK,
              VoicemailContract.Status.DATA_CHANNEL_STATE_OK,
              VoicemailContract.Status.NOTIFICATION_CHANNEL_STATE_OK);
          PhoneGlobals.getInstance()
              .clearMwiIndicator(PhoneUtils.getSubIdForPhoneAccountHandle(mPhoneAccount));
        }
      }

      if (OmtpVvmSourceManager.getInstance(mContext).isVvmSourceRegistered(mPhoneAccount)) {
        Log.v(TAG, "Signal returned: requesting resync for " + mPhoneAccount.getId());
        LocalLogHelper.log(TAG, "Signal returned: requesting resync for " + mPhoneAccount.getId());
        // If the source is already registered, run a full sync in case something was missed
        // while signal was down.
        Intent serviceIntent =
            OmtpVvmSyncService.getSyncIntent(
                mContext,
                OmtpVvmSyncService.SYNC_FULL_SYNC,
                mPhoneAccount,
                true /* firstAttempt */);
        mContext.startService(serviceIntent);
      } else {
        Log.v(TAG, "Signal returned: reattempting activation for " + mPhoneAccount.getId());
        LocalLogHelper.log(
            TAG, "Signal returned: reattempting activation for " + mPhoneAccount.getId());
        // Otherwise initiate an activation because this means that an OMTP source was
        // recognized but either the activation text was not successfully sent or a response
        // was not received.
        OmtpVvmCarrierConfigHelper carrierConfigHelper =
            new OmtpVvmCarrierConfigHelper(
                mContext, PhoneUtils.getSubIdForPhoneAccountHandle(mPhoneAccount));
        carrierConfigHelper.startActivation();
      }
    } else {
      Log.v(TAG, "Notifications channel is inactive for " + mPhoneAccount.getId());
      mContext.stopService(
          OmtpVvmSyncService.getSyncIntent(
              mContext, OmtpVvmSyncService.SYNC_FULL_SYNC, mPhoneAccount, true /* firstAttempt */));

      if (!OmtpVvmSourceManager.getInstance(mContext).isVvmSourceRegistered(mPhoneAccount)) {
        return;
      }

      VoicemailContract.Status.setStatus(
          mContext,
          mPhoneAccount,
          VoicemailContract.Status.CONFIGURATION_STATE_OK,
          VoicemailContract.Status.DATA_CHANNEL_STATE_NO_CONNECTION,
          VoicemailContract.Status.NOTIFICATION_CHANNEL_STATE_NO_CONNECTION);
    }
    mPreviousState = state;
  }
 @Override
 public void onServiceStateChanged(ServiceState serviceState) {
   if (serviceState.getState() == ServiceState.STATE_IN_SERVICE) {
     handleInService();
   }
 }