diff options
author | Suresh Koleti <skolet@codeaurora.org> | 2016-02-26 17:53:57 +0530 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-05-21 16:24:14 -0700 |
commit | 9a4f1624059a1074aa170c28f9410fce6b2a65de (patch) | |
tree | 8349b63b6dbd4cadd868fe5bc352dbf93496b4f0 /services | |
parent | 5a9abe4a1647a8397431991662d6ef90b7454c56 (diff) | |
download | frameworks_base-9a4f1624059a1074aa170c28f9410fce6b2a65de.zip frameworks_base-9a4f1624059a1074aa170c28f9410fce6b2a65de.tar.gz frameworks_base-9a4f1624059a1074aa170c28f9410fce6b2a65de.tar.bz2 |
IMS: Add support of notifyPreciseCallState for multi sim
Extend notifyPreciseCallState for multi SIM.
Change-Id: I52adcd55462d6ceae5defacbbe2cb057f4484099
CRs-Fixed: 957251
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/TelephonyRegistry.java | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 71ff6e9..5dac953 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -1248,7 +1248,41 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } broadcastPreciseCallStateChanged(ringingCallState, foregroundCallState, backgroundCallState, DisconnectCause.NOT_VALID, - PreciseDisconnectCause.NOT_VALID); + PreciseDisconnectCause.NOT_VALID, SubscriptionManager.INVALID_SUBSCRIPTION_ID); + } + + public void notifyPreciseCallStateForSubscriber(int subId, int ringingCallState, + int foregroundCallState, int backgroundCallState) { + if (!checkNotifyPermission("notifyPreciseCallStateForSubscriber()")) { + return; + } + synchronized (mRecords) { + int phoneId = SubscriptionManager.getPhoneId(subId); + if (validatePhoneId(phoneId)) { + mRingingCallState = ringingCallState; + mForegroundCallState = foregroundCallState; + mBackgroundCallState = backgroundCallState; + mPreciseCallState = new PreciseCallState(ringingCallState, foregroundCallState, + backgroundCallState, + DisconnectCause.NOT_VALID, + PreciseDisconnectCause.NOT_VALID); + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE) + && ((r.subId == subId) || + (r.subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID))) { + try { + r.callback.onPreciseCallStateChanged(mPreciseCallState); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } + } + } + } + handleRemoveListLocked(); + } + broadcastPreciseCallStateChanged(ringingCallState, foregroundCallState, backgroundCallState, + DisconnectCause.NOT_VALID, + PreciseDisconnectCause.NOT_VALID, subId); } public void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause) { @@ -1270,7 +1304,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { handleRemoveListLocked(); } broadcastPreciseCallStateChanged(mRingingCallState, mForegroundCallState, - mBackgroundCallState, disconnectCause, preciseDisconnectCause); + mBackgroundCallState, disconnectCause, preciseDisconnectCause, + SubscriptionManager.INVALID_SUBSCRIPTION_ID); } public void notifyPreciseDataConnectionFailed(String reason, String apnType, @@ -1510,13 +1545,16 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } private void broadcastPreciseCallStateChanged(int ringingCallState, int foregroundCallState, - int backgroundCallState, int disconnectCause, int preciseDisconnectCause) { + int backgroundCallState, int disconnectCause, int preciseDisconnectCause, int subId) { Intent intent = new Intent(TelephonyManager.ACTION_PRECISE_CALL_STATE_CHANGED); intent.putExtra(TelephonyManager.EXTRA_RINGING_CALL_STATE, ringingCallState); intent.putExtra(TelephonyManager.EXTRA_FOREGROUND_CALL_STATE, foregroundCallState); intent.putExtra(TelephonyManager.EXTRA_BACKGROUND_CALL_STATE, backgroundCallState); intent.putExtra(TelephonyManager.EXTRA_DISCONNECT_CAUSE, disconnectCause); intent.putExtra(TelephonyManager.EXTRA_PRECISE_DISCONNECT_CAUSE, preciseDisconnectCause); + if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { + intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); + } mContext.sendBroadcastAsUser(intent, UserHandle.ALL, android.Manifest.permission.READ_PRECISE_PHONE_STATE); } |