Esempio n. 1
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
      }
    }