diff --git a/config/hiddenapi-greylist-max-p.txt b/config/hiddenapi-greylist-max-p.txt index 4c643e1c68317..141e8e669dac4 100644 --- a/config/hiddenapi-greylist-max-p.txt +++ b/config/hiddenapi-greylist-max-p.txt @@ -73,5 +73,5 @@ Lcom/android/internal/telephony/IPhoneSubInfo$Stub;->()V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallForwardingChanged(Z)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellLocation(Landroid/os/Bundle;)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataActivity(I)V -Lcom/android/internal/telephony/ITelephonyRegistry;->notifyOtaspChanged(I)V +Lcom/android/internal/telephony/ITelephonyRegistry;->notifyOtaspChanged(II)V Lcom/android/internal/view/BaseIWindow;->()V diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 225c08092b496..1a6faecaecfd6 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -201,7 +201,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { private int[] mDataConnectionNetworkType; - private int mOtaspMode = TelephonyManager.OTASP_UNKNOWN; + private int[] mOtaspMode; private ArrayList> mCellInfo = null; @@ -209,13 +209,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { private Map> mEmergencyNumberList; - private CallQuality mCallQuality = new CallQuality(); + private CallQuality[] mCallQuality; - private CallAttributes mCallAttributes = new CallAttributes(new PreciseCallState(), - TelephonyManager.NETWORK_TYPE_UNKNOWN, new CallQuality()); + private CallAttributes[] mCallAttributes; // network type of the call associated with the mCallAttributes and mCallQuality - private int mCallNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; + private int[] mCallNetworkType; private int[] mSrvccState; @@ -223,19 +222,19 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { private int mDefaultPhoneId = SubscriptionManager.INVALID_PHONE_INDEX; - private int mRingingCallState = PreciseCallState.PRECISE_CALL_STATE_IDLE; + private int[] mRingingCallState; - private int mForegroundCallState = PreciseCallState.PRECISE_CALL_STATE_IDLE; + private int[] mForegroundCallState; - private int mBackgroundCallState = PreciseCallState.PRECISE_CALL_STATE_IDLE; + private int[] mBackgroundCallState; - private PreciseCallState mPreciseCallState = new PreciseCallState(); + private PreciseCallState[] mPreciseCallState; - private int mCallDisconnectCause = DisconnectCause.NOT_VALID; + private int[] mCallDisconnectCause; private List mImsReasonInfo = null; - private int mCallPreciseDisconnectCause = PreciseDisconnectCause.NOT_VALID; + private int[] mCallPreciseDisconnectCause; private boolean mCarrierNetworkChangeState = false; @@ -250,8 +249,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { private final LocalLog mListenLog = new LocalLog(100); - private PreciseDataConnectionState mPreciseDataConnectionState = - new PreciseDataConnectionState(); + private PreciseDataConnectionState[] mPreciseDataConnectionState; // Nothing here yet, but putting it here in case we want to add more in the future. static final int ENFORCE_COARSE_LOCATION_PERMISSION_MASK = 0; @@ -389,10 +387,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { mMessageWaiting = new boolean[numPhones]; mCallForwarding = new boolean[numPhones]; mCellLocation = new Bundle[numPhones]; - mCellInfo = new ArrayList>(); mSrvccState = new int[numPhones]; - mImsReasonInfo = new ArrayList(); - mPhysicalChannelConfigs = new ArrayList>(); + mOtaspMode = new int[numPhones]; + mPreciseCallState = new PreciseCallState[numPhones]; + mForegroundCallState = new int[numPhones]; + mBackgroundCallState = new int[numPhones]; + mRingingCallState = new int[numPhones]; + mCallDisconnectCause = new int[numPhones]; + mCallPreciseDisconnectCause = new int[numPhones]; + mCallQuality = new CallQuality[numPhones]; + mCallNetworkType = new int[numPhones]; + mCallAttributes = new CallAttributes[numPhones]; + mPreciseDataConnectionState = new PreciseDataConnectionState[numPhones]; + mCellInfo = new ArrayList<>(); + mImsReasonInfo = new ArrayList<>(); + mPhysicalChannelConfigs = new ArrayList<>(); mEmergencyNumberList = new HashMap<>(); for (int i = 0; i < numPhones; i++) { mCallState[i] = TelephonyManager.CALL_STATE_IDLE; @@ -410,7 +419,19 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { mCellInfo.add(i, null); mImsReasonInfo.add(i, null); mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE; - mPhysicalChannelConfigs.add(i, new ArrayList()); + mPhysicalChannelConfigs.add(i, new ArrayList<>()); + mOtaspMode[i] = TelephonyManager.OTASP_UNKNOWN; + mCallDisconnectCause[i] = DisconnectCause.NOT_VALID; + mCallPreciseDisconnectCause[i] = PreciseDisconnectCause.NOT_VALID; + mCallQuality[i] = new CallQuality(); + mCallAttributes[i] = new CallAttributes(new PreciseCallState(), + TelephonyManager.NETWORK_TYPE_UNKNOWN, new CallQuality()); + mCallNetworkType[i] = TelephonyManager.NETWORK_TYPE_UNKNOWN; + mPreciseCallState[i] = new PreciseCallState(); + mRingingCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE; + mForegroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE; + mBackgroundCallState[i] = PreciseCallState.PRECISE_CALL_STATE_IDLE; + mPreciseDataConnectionState[i] = new PreciseDataConnectionState(); } // Note that location can be null for non-phone builds like @@ -731,7 +752,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } if ((events & PhoneStateListener.LISTEN_OTASP_CHANGED) != 0) { try { - r.callback.onOtaspChanged(mOtaspMode); + r.callback.onOtaspChanged(mOtaspMode[phoneId]); } catch (RemoteException ex) { remove(r.binder); } @@ -749,15 +770,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } if ((events & PhoneStateListener.LISTEN_PRECISE_CALL_STATE) != 0) { try { - r.callback.onPreciseCallStateChanged(mPreciseCallState); + r.callback.onPreciseCallStateChanged(mPreciseCallState[phoneId]); } catch (RemoteException ex) { remove(r.binder); } } if ((events & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) { try { - r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause, - mCallPreciseDisconnectCause); + r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause[phoneId], + mCallPreciseDisconnectCause[phoneId]); } catch (RemoteException ex) { remove(r.binder); } @@ -772,7 +793,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { if ((events & PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) != 0) { try { r.callback.onPreciseDataConnectionStateChanged( - mPreciseDataConnectionState); + mPreciseDataConnectionState[phoneId]); } catch (RemoteException ex) { remove(r.binder); } @@ -854,7 +875,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) { try { - r.callback.onCallAttributesChanged(mCallAttributes); + r.callback.onCallAttributesChanged(mCallAttributes[phoneId]); } catch (RemoteException ex) { remove(r.binder); } @@ -1392,12 +1413,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { LinkProperties linkProperties, NetworkCapabilities networkCapabilities, int networkType, boolean roaming) { - notifyDataConnectionForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, state, + notifyDataConnectionForSubscriber(SubscriptionManager.DEFAULT_PHONE_INDEX, + SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, state, isDataAllowed, apn, apnType, linkProperties, networkCapabilities, networkType, roaming); } - public void notifyDataConnectionForSubscriber(int subId, int state, boolean isDataAllowed, + public void notifyDataConnectionForSubscriber(int phoneId, int subId, int state, + boolean isDataAllowed, String apn, String apnType, LinkProperties linkProperties, NetworkCapabilities networkCapabilities, int networkType, boolean roaming) { @@ -1410,7 +1433,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { + "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType + " mRecords.size()=" + mRecords.size()); } - int phoneId = SubscriptionManager.getPhoneId(subId); synchronized (mRecords) { if (validatePhoneId(phoneId)) { // We only call the callback when the change is for default APN type. @@ -1425,8 +1447,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { mLocalLog.log(str); for (Record r : mRecords) { if (r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) && - idMatch(r.subId, subId, phoneId)) { + PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) + && idMatch(r.subId, subId, phoneId)) { try { if (DBG) { log("Notify data connection state changed on sub: " + subId); @@ -1442,15 +1464,17 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { mDataConnectionState[phoneId] = state; mDataConnectionNetworkType[phoneId] = networkType; } - mPreciseDataConnectionState = new PreciseDataConnectionState(state, networkType, + mPreciseDataConnectionState[phoneId] = new PreciseDataConnectionState( + state, networkType, ApnSetting.getApnTypesBitmaskFromString(apnType), apn, linkProperties, DataFailCause.NONE); for (Record r : mRecords) { if (r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) { + PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) + && idMatch(r.subId, subId, phoneId)) { try { r.callback.onPreciseDataConnectionStateChanged( - mPreciseDataConnectionState); + mPreciseDataConnectionState[phoneId]); } catch (RemoteException ex) { mRemoveList.add(r.binder); } @@ -1466,11 +1490,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } public void notifyDataConnectionFailed(String apnType) { - notifyDataConnectionFailedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, + notifyDataConnectionFailedForSubscriber(SubscriptionManager.DEFAULT_PHONE_INDEX, + SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, apnType); } - public void notifyDataConnectionFailedForSubscriber(int subId, String apnType) { + public void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType) { if (!checkNotifyPermission("notifyDataConnectionFailed()")) { return; } @@ -1479,20 +1504,25 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { + " apnType=" + apnType); } synchronized (mRecords) { - mPreciseDataConnectionState = new PreciseDataConnectionState( - TelephonyManager.DATA_UNKNOWN,TelephonyManager.NETWORK_TYPE_UNKNOWN, - ApnSetting.getApnTypesBitmaskFromString(apnType), null, null, - DataFailCause.NONE); - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) { - try { - r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + if (validatePhoneId(phoneId)) { + mPreciseDataConnectionState[phoneId] = new PreciseDataConnectionState( + TelephonyManager.DATA_UNKNOWN,TelephonyManager.NETWORK_TYPE_UNKNOWN, + ApnSetting.getApnTypesBitmaskFromString(apnType), null, null, + DataFailCause.NONE); + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent( + PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onPreciseDataConnectionStateChanged( + mPreciseDataConnectionState[phoneId]); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } } + handleRemoveListLocked(); } broadcastDataConnectionFailed(apnType, subId); @@ -1539,18 +1569,22 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } - public void notifyOtaspChanged(int otaspMode) { + public void notifyOtaspChanged(int subId, int otaspMode) { if (!checkNotifyPermission("notifyOtaspChanged()" )) { return; } + int phoneId = SubscriptionManager.getPhoneId(subId); synchronized (mRecords) { - mOtaspMode = otaspMode; - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_OTASP_CHANGED)) { - try { - r.callback.onOtaspChanged(otaspMode); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + if (validatePhoneId(phoneId)) { + mOtaspMode[phoneId] = otaspMode; + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_OTASP_CHANGED) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onOtaspChanged(otaspMode); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } } @@ -1558,49 +1592,55 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } - public void notifyPreciseCallState(int ringingCallState, int foregroundCallState, - int backgroundCallState, int phoneId) { + public void notifyPreciseCallState(int phoneId, int subId, int ringingCallState, + int foregroundCallState, int backgroundCallState) { if (!checkNotifyPermission("notifyPreciseCallState()")) { return; } synchronized (mRecords) { - mRingingCallState = ringingCallState; - mForegroundCallState = foregroundCallState; - mBackgroundCallState = backgroundCallState; - mPreciseCallState = new PreciseCallState(ringingCallState, foregroundCallState, - backgroundCallState, - DisconnectCause.NOT_VALID, - PreciseDisconnectCause.NOT_VALID); - boolean notifyCallAttributes = true; - if (mCallQuality == null) { - log("notifyPreciseCallState: mCallQuality is null, skipping call attributes"); - notifyCallAttributes = false; - } else { - // If the precise call state is no longer active, reset the call network type and - // call quality. - if (mPreciseCallState.getForegroundCallState() - != PreciseCallState.PRECISE_CALL_STATE_ACTIVE) { - mCallNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; - mCallQuality = new CallQuality(); - } - mCallAttributes = new CallAttributes(mPreciseCallState, mCallNetworkType, - mCallQuality); - } - - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) { - try { - r.callback.onPreciseCallStateChanged(mPreciseCallState); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + if (validatePhoneId(phoneId)) { + mRingingCallState[phoneId] = ringingCallState; + mForegroundCallState[phoneId] = foregroundCallState; + mBackgroundCallState[phoneId] = backgroundCallState; + mPreciseCallState[phoneId] = new PreciseCallState( + ringingCallState, foregroundCallState, + backgroundCallState, + DisconnectCause.NOT_VALID, + PreciseDisconnectCause.NOT_VALID); + boolean notifyCallAttributes = true; + if (mCallQuality == null) { + log("notifyPreciseCallState: mCallQuality is null, " + + "skipping call attributes"); + notifyCallAttributes = false; + } else { + // If the precise call state is no longer active, reset the call network type + // and call quality. + if (mPreciseCallState[phoneId].getForegroundCallState() + != PreciseCallState.PRECISE_CALL_STATE_ACTIVE) { + mCallNetworkType[phoneId] = TelephonyManager.NETWORK_TYPE_UNKNOWN; + mCallQuality[phoneId] = new CallQuality(); } + mCallAttributes[phoneId] = new CallAttributes(mPreciseCallState[phoneId], + mCallNetworkType[phoneId], mCallQuality[phoneId]); } - if (notifyCallAttributes && r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) { - try { - r.callback.onCallAttributesChanged(mCallAttributes); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onPreciseCallStateChanged(mPreciseCallState[phoneId]); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } + } + if (notifyCallAttributes && r.matchPhoneStateListenerEvent( + PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onCallAttributesChanged(mCallAttributes[phoneId]); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } } @@ -1610,21 +1650,24 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { backgroundCallState); } - public void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause) { + public void notifyDisconnectCause(int phoneId, int subId, int disconnectCause, + int preciseDisconnectCause) { if (!checkNotifyPermission("notifyDisconnectCause()")) { return; } synchronized (mRecords) { - mCallDisconnectCause = disconnectCause; - mCallPreciseDisconnectCause = preciseDisconnectCause; - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent(PhoneStateListener - .LISTEN_CALL_DISCONNECT_CAUSES)) { - try { - r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause, - mCallPreciseDisconnectCause); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + if (validatePhoneId(phoneId)) { + mCallDisconnectCause[phoneId] = disconnectCause; + mCallPreciseDisconnectCause[phoneId] = preciseDisconnectCause; + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent(PhoneStateListener + .LISTEN_CALL_DISCONNECT_CAUSES) && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause[phoneId], + mCallPreciseDisconnectCause[phoneId]); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } } @@ -1660,25 +1703,30 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } - public void notifyPreciseDataConnectionFailed(String apnType, + public void notifyPreciseDataConnectionFailed(int phoneId, int subId, String apnType, String apn, @DataFailCause.FailCause int failCause) { if (!checkNotifyPermission("notifyPreciseDataConnectionFailed()")) { return; } synchronized (mRecords) { - mPreciseDataConnectionState = new PreciseDataConnectionState( - TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, - ApnSetting.getApnTypesBitmaskFromString(apnType), apn, null, failCause); - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) { - try { - r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + if (validatePhoneId(phoneId)) { + mPreciseDataConnectionState[phoneId] = new PreciseDataConnectionState( + TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, + ApnSetting.getApnTypesBitmaskFromString(apnType), apn, null, failCause); + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent( + PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onPreciseDataConnectionStateChanged( + mPreciseDataConnectionState[phoneId]); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } } + handleRemoveListLocked(); } broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN, @@ -1716,24 +1764,25 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } - public void notifyOemHookRawEventForSubscriber(int subId, byte[] rawData) { + public void notifyOemHookRawEventForSubscriber(int phoneId, int subId, byte[] rawData) { if (!checkNotifyPermission("notifyOemHookRawEventForSubscriber")) { return; } synchronized (mRecords) { - for (Record r : mRecords) { - if (VDBG) { - log("notifyOemHookRawEventForSubscriber: r=" + r + " subId=" + subId); - } - if ((r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT)) && - ((r.subId == subId) || - (r.subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID))) { - try { - r.callback.onOemHookRawEvent(rawData); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + if (validatePhoneId(phoneId)) { + for (Record r : mRecords) { + if (VDBG) { + log("notifyOemHookRawEventForSubscriber: r=" + r + " subId=" + subId); + } + if ((r.matchPhoneStateListenerEvent( + PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT)) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onOemHookRawEvent(rawData); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } } @@ -1804,87 +1853,98 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } - public void notifyRadioPowerStateChanged(@TelephonyManager.RadioPowerState int state) { + public void notifyRadioPowerStateChanged(int phoneId, int subId, + @TelephonyManager.RadioPowerState int state) { if (!checkNotifyPermission("notifyRadioPowerStateChanged()")) { return; } if (VDBG) { - log("notifyRadioPowerStateChanged: state= " + state); + log("notifyRadioPowerStateChanged: state= " + state + " subId=" + subId); } synchronized (mRecords) { - mRadioPowerState = state; + if (validatePhoneId(phoneId)) { + mRadioPowerState = state; - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED)) { - try { - r.callback.onRadioPowerStateChanged(state); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent( + PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onRadioPowerStateChanged(state); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } + } handleRemoveListLocked(); } } @Override - public void notifyEmergencyNumberList() { + public void notifyEmergencyNumberList(int phoneId, int subId) { if (!checkNotifyPermission("notifyEmergencyNumberList()")) { return; } synchronized (mRecords) { - TelephonyManager tm = (TelephonyManager) mContext.getSystemService( - Context.TELEPHONY_SERVICE); - mEmergencyNumberList = tm.getEmergencyNumberList(); + if (validatePhoneId(phoneId)) { + TelephonyManager tm = (TelephonyManager) mContext.getSystemService( + Context.TELEPHONY_SERVICE); + mEmergencyNumberList = tm.getEmergencyNumberList(); - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST)) { - try { - r.callback.onEmergencyNumberListChanged(mEmergencyNumberList); - if (VDBG) { - log("notifyEmergencyNumberList: emergencyNumberList= " - + mEmergencyNumberList); + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent( + PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onEmergencyNumberListChanged(mEmergencyNumberList); + if (VDBG) { + log("notifyEmergencyNumberList: emergencyNumberList= " + + mEmergencyNumberList); + } + } catch (RemoteException ex) { + mRemoveList.add(r.binder); } - } catch (RemoteException ex) { - mRemoveList.add(r.binder); } } } + handleRemoveListLocked(); } } @Override - public void notifyCallQualityChanged(CallQuality callQuality, int phoneId, + public void notifyCallQualityChanged(CallQuality callQuality, int phoneId, int subId, int callNetworkType) { if (!checkNotifyPermission("notifyCallQualityChanged()")) { return; } - // merge CallQuality with PreciseCallState and network type - mCallQuality = callQuality; - mCallNetworkType = callNetworkType; - mCallAttributes = new CallAttributes(mPreciseCallState, callNetworkType, callQuality); - synchronized (mRecords) { - TelephonyManager tm = (TelephonyManager) mContext.getSystemService( - Context.TELEPHONY_SERVICE); + if (validatePhoneId(phoneId)) { + // merge CallQuality with PreciseCallState and network type + mCallQuality[phoneId] = callQuality; + mCallNetworkType[phoneId] = callNetworkType; + mCallAttributes[phoneId] = new CallAttributes(mPreciseCallState[phoneId], + callNetworkType, callQuality); - for (Record r : mRecords) { - if (r.matchPhoneStateListenerEvent( - PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) { - try { - r.callback.onCallAttributesChanged(mCallAttributes); - } catch (RemoteException ex) { - mRemoveList.add(r.binder); + for (Record r : mRecords) { + if (r.matchPhoneStateListenerEvent( + PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) + && idMatch(r.subId, subId, phoneId)) { + try { + r.callback.onCallAttributesChanged(mCallAttributes[phoneId]); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } } } } + handleRemoveListLocked(); } } @@ -1904,6 +1964,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println("Phone Id=" + i); pw.increaseIndent(); pw.println("mCallState=" + mCallState[i]); + pw.println("mRingingCallState=" + mRingingCallState[i]); + pw.println("mForegroundCallState=" + mForegroundCallState[i]); + pw.println("mBackgroundCallState=" + mBackgroundCallState[i]); + pw.println("mPreciseCallState=" + mPreciseCallState[i]); + pw.println("mCallDisconnectCause=" + mCallDisconnectCause[i]); pw.println("mCallIncomingNumber=" + mCallIncomingNumber[i]); pw.println("mServiceState=" + mServiceState[i]); pw.println("mVoiceActivationState= " + mVoiceActivationState[i]); @@ -1917,24 +1982,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println("mCellLocation=" + mCellLocation[i]); pw.println("mCellInfo=" + mCellInfo.get(i)); pw.println("mImsCallDisconnectCause=" + mImsReasonInfo.get(i)); + pw.println("mSrvccState=" + mSrvccState[i]); + pw.println("mOtaspMode=" + mOtaspMode[i]); + pw.println("mCallPreciseDisconnectCause=" + mCallPreciseDisconnectCause[i]); + pw.println("mCallQuality=" + mCallQuality[i]); + pw.println("mCallAttributes=" + mCallAttributes[i]); + pw.println("mCallNetworkType=" + mCallNetworkType[i]); + pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState[i]); pw.decreaseIndent(); } - pw.println("mCallNetworkType=" + mCallNetworkType); - pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState); - pw.println("mPreciseCallState=" + mPreciseCallState); - pw.println("mCallDisconnectCause=" + mCallDisconnectCause); - pw.println("mCallPreciseDisconnectCause=" + mCallPreciseDisconnectCause); pw.println("mCarrierNetworkChangeState=" + mCarrierNetworkChangeState); - pw.println("mRingingCallState=" + mRingingCallState); - pw.println("mForegroundCallState=" + mForegroundCallState); - pw.println("mBackgroundCallState=" + mBackgroundCallState); - pw.println("mSrvccState=" + mSrvccState); + pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mActiveDataSubId=" + mActiveDataSubId); pw.println("mRadioPowerState=" + mRadioPowerState); pw.println("mEmergencyNumberList=" + mEmergencyNumberList); - pw.println("mCallQuality=" + mCallQuality); - pw.println("mCallAttributes=" + mCallAttributes); pw.println("mDefaultPhoneId=" + mDefaultPhoneId); pw.println("mDefaultSubId=" + mDefaultSubId); diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index 3ce28a46a029f..271195b78c3e5 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -62,6 +62,8 @@ public class PhoneStateListener { /** * Stop listening for updates. + * + * The PhoneStateListener is not tied to any subscription and unregistered for any update. */ public static final int LISTEN_NONE = 0; @@ -444,7 +446,13 @@ public class PhoneStateListener { } /** - * Callback invoked when device service state changes. + * Callback invoked when device service state changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @see ServiceState#STATE_EMERGENCY_ONLY * @see ServiceState#STATE_IN_SERVICE @@ -456,7 +464,13 @@ public class PhoneStateListener { } /** - * Callback invoked when network signal strength changes. + * Callback invoked when network signal strength changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @see ServiceState#STATE_EMERGENCY_ONLY * @see ServiceState#STATE_IN_SERVICE @@ -470,21 +484,39 @@ public class PhoneStateListener { } /** - * Callback invoked when the message-waiting indicator changes. + * Callback invoked when the message-waiting indicator changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. */ public void onMessageWaitingIndicatorChanged(boolean mwi) { // default implementation empty } /** - * Callback invoked when the call-forwarding indicator changes. + * Callback invoked when the call-forwarding indicator changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. */ public void onCallForwardingIndicatorChanged(boolean cfi) { // default implementation empty } /** - * Callback invoked when device cell location changes. + * Callback invoked when device cell location changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. */ public void onCellLocationChanged(CellLocation location) { // default implementation empty @@ -493,7 +525,14 @@ public class PhoneStateListener { /** * Callback invoked when device call state changes. *

- * Reports the state of Telephony (mobile) calls on the device. + * Reports the state of Telephony (mobile) calls on the device for the registered subscription. + *

+ * Note: the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. *

* Note: The state returned here may differ from that returned by * {@link TelephonyManager#getCallState()}. Receivers of this callback should be aware that @@ -511,7 +550,13 @@ public class PhoneStateListener { } /** - * Callback invoked when connection state changes. + * Callback invoked when connection state changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @see TelephonyManager#DATA_DISCONNECTED * @see TelephonyManager#DATA_CONNECTING @@ -529,7 +574,13 @@ public class PhoneStateListener { } /** - * Callback invoked when data activity state changes. + * Callback invoked when data activity state changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @see TelephonyManager#DATA_ACTIVITY_NONE * @see TelephonyManager#DATA_ACTIVITY_IN @@ -542,12 +593,13 @@ public class PhoneStateListener { } /** - * Callback invoked when network signal strengths changes. - * - * @see ServiceState#STATE_EMERGENCY_ONLY - * @see ServiceState#STATE_IN_SERVICE - * @see ServiceState#STATE_OUT_OF_SERVICE - * @see ServiceState#STATE_POWER_OFF + * Callback invoked when network signal strengths changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. */ public void onSignalStrengthsChanged(SignalStrength signalStrength) { // default implementation empty @@ -555,8 +607,15 @@ public class PhoneStateListener { /** - * The Over The Air Service Provisioning (OTASP) has changed. Requires - * the READ_PHONE_STATE permission. + * The Over The Air Service Provisioning (OTASP) has changed on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * + * Requires the READ_PHONE_STATE permission. * @param otaspMode is integer OTASP_UNKNOWN=1 * means the value is currently unknown and the system should wait until * OTASP_NEEDED=2 or OTASP_NOT_NEEDED=3 is received before @@ -570,15 +629,28 @@ public class PhoneStateListener { } /** - * Callback invoked when a observed cell info has changed, - * or new cells have been added or removed. + * Callback invoked when a observed cell info has changed or new cells have been added + * or removed on the registered subscription. + * Note, the registration subId s from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @param cellInfo is the list of currently visible cells. */ public void onCellInfoChanged(List cellInfo) { } /** - * Callback invoked when precise device call state changes. + * Callback invoked when precise device call state changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * @param callState {@link PreciseCallState} * @hide */ @@ -589,7 +661,14 @@ public class PhoneStateListener { } /** - * Callback invoked when call disconnect cause changes. + * Callback invoked when call disconnect cause changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @param disconnectCause {@link DisconnectCause}. * @param preciseDisconnectCause {@link PreciseDisconnectCause}. * @@ -602,7 +681,14 @@ public class PhoneStateListener { } /** - * Callback invoked when Ims call disconnect cause changes. + * Callback invoked when Ims call disconnect cause changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @param imsReasonInfo {@link ImsReasonInfo} contains details on why IMS call failed. * * @hide @@ -614,7 +700,15 @@ public class PhoneStateListener { } /** - * Callback invoked when data connection state changes with precise information. + * Callback invoked when data connection state changes with precise information + * on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @param dataConnectionState {@link PreciseDataConnectionState} * * @hide @@ -627,7 +721,13 @@ public class PhoneStateListener { } /** - * Callback invoked when data connection state changes with precise information. + * Callback invoked when data connection real time info changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @hide */ @@ -639,7 +739,15 @@ public class PhoneStateListener { /** * Callback invoked when there has been a change in the Single Radio Voice Call Continuity - * (SRVCC) state for the currently active call. + * (SRVCC) state for the currently active call on the registered subscription. + * + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @hide */ @SystemApi @@ -648,7 +756,15 @@ public class PhoneStateListener { } /** - * Callback invoked when the SIM voice activation state has changed + * Callback invoked when the SIM voice activation state has changed on the registered + * subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @param state is the current SIM voice activation state * @hide */ @@ -657,7 +773,15 @@ public class PhoneStateListener { } /** - * Callback invoked when the SIM data activation state has changed + * Callback invoked when the SIM data activation state has changed on the registered + * subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @param state is the current SIM data activation state * @hide */ @@ -665,7 +789,14 @@ public class PhoneStateListener { } /** - * Callback invoked when the user mobile data state has changed + * Callback invoked when the user mobile data state has changed on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * * @param enabled indicates whether the current user mobile data state is enabled or disabled. */ public void onUserMobileDataStateChanged(boolean enabled) { @@ -673,7 +804,14 @@ public class PhoneStateListener { } /** - * Callback invoked when the current physical channel configuration has changed + * Callback invoked when the current physical channel configuration has changed on the + * registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @param configs List of the current {@link PhysicalChannelConfig}s * @hide @@ -684,7 +822,14 @@ public class PhoneStateListener { } /** - * Callback invoked when the current emergency number list has changed + * Callback invoked when the current emergency number list has changed on the registered + * subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. * * @param emergencyNumberList Map including the key as the active subscription ID * (Note: if there is no active subscription, the key is @@ -699,8 +844,15 @@ public class PhoneStateListener { } /** - * Callback invoked when OEM hook raw event is received. Requires - * the READ_PRIVILEGED_PHONE_STATE permission. + * Callback invoked when OEM hook raw event is received on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * + * Requires the READ_PRIVILEGED_PHONE_STATE permission. * @param rawData is the byte array of the OEM hook raw data. * @hide */ @@ -710,8 +862,10 @@ public class PhoneStateListener { } /** - * Callback invoked when phone capability changes. Requires - * the READ_PRIVILEGED_PHONE_STATE permission. + * Callback invoked when phone capability changes. + * Note, this callback triggers regardless of registered subscription. + * + * Requires the READ_PRIVILEGED_PHONE_STATE permission. * @param capability the new phone capability * @hide */ @@ -720,8 +874,10 @@ public class PhoneStateListener { } /** - * Callback invoked when active data subId changes. Requires - * the READ_PHONE_STATE permission. + * Callback invoked when active data subId changes. + * Note, this callback triggers regardless of registered subscription. + * + * Requires the READ_PHONE_STATE permission. * @param subId current subscription used to setup Cellular Internet data. * For example, it could be the current active opportunistic subscription in use, * or the subscription user selected as default data subscription in DSDS mode. @@ -731,8 +887,15 @@ public class PhoneStateListener { } /** - * Callback invoked when the call attributes changes. Requires - * the READ_PRIVILEGED_PHONE_STATE permission. + * Callback invoked when the call attributes changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * + * Requires the READ_PRIVILEGED_PHONE_STATE permission. * @param callAttributes the call attributes * @hide */ @@ -742,7 +905,15 @@ public class PhoneStateListener { } /** - * Callback invoked when modem radio power state changes. Requires + * Callback invoked when modem radio power state changes on the registered subscription. + * Note, the registration subId comes from {@link TelephonyManager} object which registers + * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}. + * If this TelephonyManager object was created with + * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the + * subId. Otherwise, this callback applies to + * {@link SubscriptionManager#getDefaultSubscriptionId()}. + * + * Requires * the READ_PRIVILEGED_PHONE_STATE permission. * @param state the modem radio power state * @hide @@ -758,6 +929,10 @@ public class PhoneStateListener { * has been requested by an app using * {@link android.telephony.TelephonyManager#notifyCarrierNetworkChange(boolean)} * + * Note, this callback is pinned to the registered subscription and will be invoked when + * the notifying carrier app has carrier privilege rule on the registered + * subscription. {@link android.telephony.TelephonyManager#hasCarrierPrivileges} + * * @param active Whether the carrier network change is or shortly * will be active. This value is true to indicate * showing alternative UI and false to stop. diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 0610c5d106c3b..f2f3c2d85fd42 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -56,38 +56,41 @@ interface ITelephonyRegistry { void notifyDataConnection(int state, boolean isDataConnectivityPossible, String apn, String apnType, in LinkProperties linkProperties, in NetworkCapabilities networkCapabilities, int networkType, boolean roaming); - void notifyDataConnectionForSubscriber(int subId, int state, boolean isDataConnectivityPossible, + void notifyDataConnectionForSubscriber(int phoneId, int subId, int state, + boolean isDataConnectivityPossible, String apn, String apnType, in LinkProperties linkProperties, in NetworkCapabilities networkCapabilities, int networkType, boolean roaming); @UnsupportedAppUsage void notifyDataConnectionFailed(String apnType); - void notifyDataConnectionFailedForSubscriber(int subId, String apnType); + void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType); void notifyCellLocation(in Bundle cellLocation); void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation); - void notifyOtaspChanged(in int otaspMode); + void notifyOtaspChanged(in int subId, in int otaspMode); @UnsupportedAppUsage void notifyCellInfo(in List cellInfo); void notifyPhysicalChannelConfiguration(in List configs); void notifyPhysicalChannelConfigurationForSubscriber(in int subId, in List configs); - void notifyPreciseCallState(int ringingCallState, int foregroundCallState, - int backgroundCallState, int phoneId); - void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause); - void notifyPreciseDataConnectionFailed(String apnType, String apn, + void notifyPreciseCallState(int phoneId, int subId, int ringingCallState, + int foregroundCallState, int backgroundCallState); + void notifyDisconnectCause(int phoneId, int subId, int disconnectCause, + int preciseDisconnectCause); + void notifyPreciseDataConnectionFailed(int phoneId, int subId, String apnType, String apn, int failCause); void notifyCellInfoForSubscriber(in int subId, in List cellInfo); void notifySrvccStateChanged(in int subId, in int lteState); void notifySimActivationStateChangedForPhoneId(in int phoneId, in int subId, int activationState, int activationType); - void notifyOemHookRawEventForSubscriber(in int subId, in byte[] rawData); + void notifyOemHookRawEventForSubscriber(in int phoneId, in int subId, in byte[] rawData); void notifySubscriptionInfoChanged(); void notifyOpportunisticSubscriptionInfoChanged(); void notifyCarrierNetworkChange(in boolean active); void notifyUserMobileDataStateChangedForPhoneId(in int phoneId, in int subId, in boolean state); void notifyPhoneCapabilityChanged(in PhoneCapability capability); void notifyActiveDataSubIdChanged(int activeDataSubId); - void notifyRadioPowerStateChanged(in int state); - void notifyEmergencyNumberList(); - void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int callNetworkType); + void notifyRadioPowerStateChanged(in int phoneId, in int subId, in int state); + void notifyEmergencyNumberList(in int phoneId, in int subId); + void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int subId, + int callNetworkType); void notifyImsDisconnectCause(int subId, in ImsReasonInfo imsReasonInfo); }