示例#1
0
  @Override
  protected void onResume() {
    super.onResume();

    if (mPhone != null && !Utils.isWifiOnly(getApplicationContext())) {
      mPhoneStateReceiver.registerIntent();

      updateSignalStrength();
      updateServiceState(mPhone.getServiceState());
      updateDataState();
      mTelephonyManager.listen(
          mPhoneStateListener, PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
      if (mShowLatestAreaInfo) {
        registerReceiver(
            mAreaInfoReceiver,
            new IntentFilter(CB_AREA_INFO_RECEIVED_ACTION),
            CB_AREA_INFO_SENDER_PERMISSION,
            null);
        // Ask CellBroadcastReceiver to broadcast the latest area info received
        Intent getLatestIntent = new Intent(GET_LATEST_CB_AREA_INFO_ACTION);
        sendBroadcastAsUser(getLatestIntent, UserHandle.ALL, CB_AREA_INFO_SENDER_PERMISSION);
      }
    }
    registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
    mHandler.sendEmptyMessage(EVENT_UPDATE_STATS);
  }
示例#2
0
 @Override
 public void onDataConnectionStateChanged(int state) {
   updateDataState();
   updateNetworkType();
 }