diff options
author | Etan Cohen <etancohen@google.com> | 2014-09-26 22:35:35 -0700 |
---|---|---|
committer | Pavel Zhamaitsiak <pavelz@google.com> | 2014-12-01 23:31:17 +0000 |
commit | abbd7880cf8e29274dfc0508568fbffe9f49cad7 (patch) | |
tree | cb2f8c41e8789474dca9f8786f2f795102d6bd34 | |
parent | f348775aec349cf205f711352345c8f4e89875de (diff) | |
download | ims-abbd7880cf8e29274dfc0508568fbffe9f49cad7.tar.gz |
MSIM IMS: convert to phone ID based selection.
Bug: 18576822
Change-Id: I7e1c79fff307a5f433529213ee2670ad58080d91
-rw-r--r-- | src/java/com/android/ims/ImsManager.java | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java index 3241e18a..50d3a452 100644 --- a/src/java/com/android/ims/ImsManager.java +++ b/src/java/com/android/ims/ImsManager.java @@ -95,11 +95,11 @@ public class ImsManager { /** * Part of the ACTION_IMS_SERVICE_UP or _DOWN intents. - * A long value; the subId corresponding to the IMS service coming up or down. + * A long value; the phone ID corresponding to the IMS service coming up or down. * Internal use only. * @hide */ - public static final String EXTRA_SUBID = "android:subid"; + public static final String EXTRA_PHONE_ID = "android:phone_id"; /** * Action for the incoming call intent for the Phone app. @@ -133,7 +133,7 @@ public class ImsManager { new HashMap<Integer, ImsManager>(); private Context mContext; - private int mSubId; + private int mPhoneId; private IImsService mImsService = null; private ImsServiceDeathRecipient mDeathRecipient = new ImsServiceDeathRecipient(); // Ut interface for the supplementary service configuration @@ -148,16 +148,16 @@ public class ImsManager { * Gets a manager instance. * * @param context application context for creating the manager object - * @param subId the subscription ID for the IMS Service - * @return the manager instance corresponding to the subId + * @param phoneId the phone ID for the IMS Service + * @return the manager instance corresponding to the phoneId */ - public static ImsManager getInstance(Context context, int subId) { + public static ImsManager getInstance(Context context, int phoneId) { synchronized (sImsManagerInstances) { - if (sImsManagerInstances.containsKey(subId)) - return sImsManagerInstances.get(subId); + if (sImsManagerInstances.containsKey(phoneId)) + return sImsManagerInstances.get(phoneId); - ImsManager mgr = new ImsManager(context, subId); - sImsManagerInstances.put(subId, mgr); + ImsManager mgr = new ImsManager(context, phoneId); + sImsManagerInstances.put(phoneId, mgr); return mgr; } @@ -208,9 +208,9 @@ public class ImsManager { com.android.internal.R.bool.config_carrier_vt_available); } - private ImsManager(Context context, int subId) { + private ImsManager(Context context, int phoneId) { mContext = context; - mSubId = subId; + mPhoneId = phoneId; createImsService(true); } @@ -252,7 +252,7 @@ public class ImsManager { int result = 0; try { - result = mImsService.open(serviceClass, incomingCallPendingIntent, + result = mImsService.open(mPhoneId, serviceClass, incomingCallPendingIntent, createRegistrationListenerProxy(serviceClass, listener)); } catch (RemoteException e) { throw new ImsException("open()", e, @@ -503,7 +503,7 @@ public class ImsManager { checkAndThrowExceptionIfServiceUnavailable(); try { - IImsConfig config = mImsService.getConfigInterface(); + IImsConfig config = mImsService.getConfigInterface(mPhoneId); if (config == null) { throw new ImsException("getConfigInterface()", ImsReasonInfo.CODE_LOCAL_SERVICE_UNAVAILABLE); @@ -574,9 +574,8 @@ public class ImsManager { } } - private static String getImsServiceName(int subId) { - // TODO: MSIM implementation needs to decide on service name as a function of subId - // or value derived from subId (slot ID?) + private static String getImsServiceName(int phoneId) { + // TODO: MSIM implementation needs to decide on service name as a function of phoneId return IMS_SERVICE; } @@ -585,14 +584,14 @@ public class ImsManager { */ private void createImsService(boolean checkService) { if (checkService) { - IBinder binder = ServiceManager.checkService(getImsServiceName(mSubId)); + IBinder binder = ServiceManager.checkService(getImsServiceName(mPhoneId)); if (binder == null) { return; } } - IBinder b = ServiceManager.getService(getImsServiceName(mSubId)); + IBinder b = ServiceManager.getService(getImsServiceName(mPhoneId)); if (b != null) { try { @@ -647,7 +646,7 @@ public class ImsManager { checkAndThrowExceptionIfServiceUnavailable(); try { - mImsService.turnOnIms(); + mImsService.turnOnIms(mPhoneId); } catch (RemoteException e) { throw new ImsException("turnOnIms() ", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); } @@ -685,7 +684,7 @@ public class ImsManager { checkAndThrowExceptionIfServiceUnavailable(); try { - mImsService.turnOffIms(); + mImsService.turnOffIms(mPhoneId); } catch (RemoteException e) { throw new ImsException("turnOffIms() ", e, ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN); } @@ -704,7 +703,7 @@ public class ImsManager { if (mContext != null) { Intent intent = new Intent(ACTION_IMS_SERVICE_DOWN); - intent.putExtra(EXTRA_SUBID, mSubId); + intent.putExtra(EXTRA_PHONE_ID, mPhoneId); mContext.sendBroadcast(new Intent(intent)); } } |