diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-09-18 02:22:53 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-09-18 02:22:53 +0000 |
commit | a80a7ee995a1d3cf407d4a117a1cec1a39f345de (patch) | |
tree | 017c0649b10037a1541f48c9c3a47fbaf1647be5 | |
parent | 9f3d0aa822aaa6b1c49e73584be14ad3218995d8 (diff) | |
parent | 37d614d893d83ccd1af9f3b5d0969a462c6f1e1c (diff) | |
download | ims-o-mr1-iot-preview-7.tar.gz |
release-request-c7ef57d3-badc-414a-a047-fc71124a9598-for-git_oc-mr1-iot-release-4343992 snap-temp-L17700000103593829android-o-mr1-iot-release-1.0.8android-o-mr1-iot-release-1.0.7android-o-mr1-iot-release-1.0.5android-o-mr1-iot-release-1.0.4android-o-mr1-iot-release-1.0.3android-o-mr1-iot-release-1.0.2android-o-mr1-iot-release-1.0.14android-o-mr1-iot-release-1.0.13android-o-mr1-iot-release-1.0.12android-o-mr1-iot-release-1.0.10android-o-mr1-iot-release-1.0.1android-o-mr1-iot-release-1.0.0android-o-mr1-iot-preview-8android-o-mr1-iot-preview-7android-o-mr1-iot-preview-6oreo-mr1-iot-releaseo-mr1-iot-preview-8o-mr1-iot-preview-7o-mr1-iot-preview-6
Change-Id: I5693076ebadee36b3e471d1b5f2e875b5c97c3b2
-rw-r--r-- | rcs/rcsservice/src/com/android/service/ims/RcsService.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/rcs/rcsservice/src/com/android/service/ims/RcsService.java b/rcs/rcsservice/src/com/android/service/ims/RcsService.java index 53ba728..aeccb30 100644 --- a/rcs/rcsservice/src/com/android/service/ims/RcsService.java +++ b/rcs/rcsservice/src/com/android/service/ims/RcsService.java @@ -61,6 +61,8 @@ import com.android.ims.internal.IRcsPresence; import com.android.ims.RcsPresence.PublishState; import com.android.ims.internal.Logger; +import com.android.internal.telephony.IccCardConstants; +import com.android.internal.telephony.TelephonyIntents; import com.android.service.ims.RcsStackAdaptor; import com.android.service.ims.presence.PresencePublication; @@ -115,8 +117,6 @@ public class RcsService extends Service{ Settings.Global.getUriFor(Settings.Global.VT_IMS_ENABLED), false, mVtSettingObserver); - registerImsConnectionStateListener(); - mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -127,6 +127,11 @@ public class RcsService extends Service{ } else if(ImsManager.ACTION_IMS_SERVICE_DOWN.equalsIgnoreCase( intent.getAction())){ handleImsServiceDown(); + } else if(TelephonyIntents.ACTION_SIM_STATE_CHANGED.equalsIgnoreCase( + intent.getAction())) { + String stateExtra = intent.getStringExtra( + IccCardConstants.INTENT_KEY_ICC_STATE); + handleSimStateChanged(stateExtra); } } }; @@ -134,6 +139,7 @@ public class RcsService extends Service{ IntentFilter statusFilter = new IntentFilter(); statusFilter.addAction(ImsManager.ACTION_IMS_SERVICE_UP); statusFilter.addAction(ImsManager.ACTION_IMS_SERVICE_DOWN); + statusFilter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); registerReceiver(mReceiver, statusFilter); } @@ -151,6 +157,14 @@ public class RcsService extends Service{ } } + public void handleSimStateChanged(String state) { + + if(IccCardConstants.INTENT_VALUE_ICC_LOADED.equalsIgnoreCase(state)) { + // ImsManager depends on a loaded SIM to get the default Voice Registration. + registerImsConnectionStateListener(); + } + } + @Override public int onStartCommand(Intent intent, int flags, int startId) { @@ -358,8 +372,7 @@ public class RcsService extends Service{ ImsManager imsManager = ImsManager.getInstance(this, SubscriptionManager.getDefaultVoicePhoneId()); if (imsManager != null) { - imsManager.addRegistrationListener(ImsServiceClass.MMTEL, - mImsConnectionStateListener); + imsManager.addRegistrationListener(mImsConnectionStateListener); } } catch (ImsException e) { logger.error("addRegistrationListener exception=", e); |