From 47ca8fbf766bf355a9b4c44b2d3247e034c92ddc Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Thu, 26 Feb 2015 17:47:54 -0800 Subject: [PATCH] IMS phone instantiation: add polling on base phone creation Phone registers for notification of IMS service up and down. However, there may be a race condition which causes the phone to be created after the intents are alrady sent. Add polling in addition to listening to broadcast intent. Bug: 19447972 Change-Id: I0e12118bb11a22161cf2f389b9ca6f39442202e1 --- src/java/com/android/internal/telephony/PhoneBase.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/java/com/android/internal/telephony/PhoneBase.java b/src/java/com/android/internal/telephony/PhoneBase.java index ce69689ec..e1444ee10 100644 --- a/src/java/com/android/internal/telephony/PhoneBase.java +++ b/src/java/com/android/internal/telephony/PhoneBase.java @@ -425,7 +425,13 @@ protected PhoneBase(String name, PhoneNotifier notifier, Context context, Comman mUiccController = UiccController.getInstance(); mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null); - // Monitor IMS service + // Monitor IMS service - but first poll to see if already up (could miss + // intent) + ImsManager imsManager = ImsManager.getInstance(mContext, getPhoneId()); + if (imsManager != null && imsManager.isServiceAvailable()) { + mImsServiceReady = true; + updateImsPhone(); + } IntentFilter filter = new IntentFilter(); filter.addAction(ImsManager.ACTION_IMS_SERVICE_UP); filter.addAction(ImsManager.ACTION_IMS_SERVICE_DOWN);