Пример #1
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;
    }
  }
Пример #2
0
 /**
  * Pick the best slot for ECC. The best slot should be radio on and in service, if not, it should
  * be on radio, else GEMINI_SIM_1.
  *
  * @param phone
  * @param number
  * @return
  */
 public static int pickBestSlotForEmergencyCall(Phone phone, String number) {
   Assert.assertNotNull(phone);
   if (GeminiUtils.isGeminiSupport()) {
     GeminiPhone gPhone = (GeminiPhone) phone;
     final int[] geminiSlots = GeminiUtils.getSlots();
     final int count = geminiSlots.length;
     boolean[] isRadioOn = new boolean[count];
     for (int i = 0; i < count; i++) {
       isRadioOn[i] = gPhone.isRadioOnGemini(geminiSlots[i]);
       int state =
           ServiceState.newFromBundle(
                   PhoneGlobals.getInstance().phoneMgrEx.getServiceState(geminiSlots[i]))
               .getState();
       if (isRadioOn[i] && state == ServiceState.STATE_IN_SERVICE) {
         // the slot is radio on & state is in service
         PhoneLog.d(
             TAG, "pickBestSlotForEmergencyCallm, radio on & in service, slot:" + geminiSlots[i]);
         return geminiSlots[i];
       }
     }
     for (int i = 0; i < count; i++) {
       if (isRadioOn[i]) {
         // the slot is radio on
         PhoneLog.d(TAG, "pickBestSlotForEmergencyCallm, radio on, slot:" + geminiSlots[i]);
         return geminiSlots[i];
       }
     }
   }
   PhoneLog.d(TAG, "pickBestSlotForEmergencyCallm, no gemini");
   return GeminiUtils.getDefaultSlot();
 }
 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();
   }
 }
Пример #4
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;
 }
Пример #5
0
 /**
  * Get the current ServiceState.
  *
  * @param phone
  * @param slotId
  * @return
  */
 public static ServiceState getServiceState(Phone phone, int slotId) {
   Assert.assertNotNull(phone);
   ServiceState serviceState = null;
   if (GeminiUtils.isGeminiSupport()) {
     PhoneLog.d(TAG, "[getServiceState], slotId = " + slotId);
     if (GeminiUtils.isValidSlot(slotId)) {
       serviceState =
           ServiceState.newFromBundle(
               PhoneGlobals.getInstance().phoneMgrEx.getServiceState(slotId));
     }
   } else {
     serviceState = phone.getServiceState();
   }
   return serviceState;
 }