Merge "PhoneStateListener msim improvement"

This commit is contained in:
Nathan Harold
2019-05-14 19:51:47 +00:00
committed by Gerrit Code Review
4 changed files with 464 additions and 224 deletions

View File

@@ -71,5 +71,5 @@ Lcom/android/internal/telephony/IPhoneSubInfo$Stub;-><init>()V
Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallForwardingChanged(Z)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallForwardingChanged(Z)V
Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellLocation(Landroid/os/Bundle;)V Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellLocation(Landroid/os/Bundle;)V
Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataActivity(I)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;-><init>()V Lcom/android/internal/view/BaseIWindow;-><init>()V

View File

@@ -199,7 +199,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private int[] mDataConnectionNetworkType; private int[] mDataConnectionNetworkType;
private int mOtaspMode = TelephonyManager.OTASP_UNKNOWN; private int[] mOtaspMode;
private ArrayList<List<CellInfo>> mCellInfo = null; private ArrayList<List<CellInfo>> mCellInfo = null;
@@ -207,13 +207,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList; private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;
private CallQuality mCallQuality = new CallQuality(); private CallQuality[] mCallQuality;
private CallAttributes mCallAttributes = new CallAttributes(new PreciseCallState(), private CallAttributes[] mCallAttributes;
TelephonyManager.NETWORK_TYPE_UNKNOWN, new CallQuality());
// network type of the call associated with the mCallAttributes and mCallQuality // network type of the call associated with the mCallAttributes and mCallQuality
private int mCallNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; private int[] mCallNetworkType;
private int[] mSrvccState; private int[] mSrvccState;
@@ -221,19 +220,19 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private int mDefaultPhoneId = SubscriptionManager.INVALID_PHONE_INDEX; 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<ImsReasonInfo> mImsReasonInfo = null; private List<ImsReasonInfo> mImsReasonInfo = null;
private int mCallPreciseDisconnectCause = PreciseDisconnectCause.NOT_VALID; private int[] mCallPreciseDisconnectCause;
private boolean mCarrierNetworkChangeState = false; private boolean mCarrierNetworkChangeState = false;
@@ -250,8 +249,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private final LocalLog mListenLog = new LocalLog(100); private final LocalLog mListenLog = new LocalLog(100);
private PreciseDataConnectionState mPreciseDataConnectionState = private PreciseDataConnectionState[] mPreciseDataConnectionState;
new PreciseDataConnectionState();
// Nothing here yet, but putting it here in case we want to add more in the future. // 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; static final int ENFORCE_COARSE_LOCATION_PERMISSION_MASK = 0;
@@ -389,10 +387,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mMessageWaiting = new boolean[numPhones]; mMessageWaiting = new boolean[numPhones];
mCallForwarding = new boolean[numPhones]; mCallForwarding = new boolean[numPhones];
mCellLocation = new Bundle[numPhones]; mCellLocation = new Bundle[numPhones];
mCellInfo = new ArrayList<List<CellInfo>>();
mSrvccState = new int[numPhones]; mSrvccState = new int[numPhones];
mImsReasonInfo = new ArrayList<ImsReasonInfo>(); mOtaspMode = new int[numPhones];
mPhysicalChannelConfigs = new ArrayList<List<PhysicalChannelConfig>>(); 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<>(); mEmergencyNumberList = new HashMap<>();
for (int i = 0; i < numPhones; i++) { for (int i = 0; i < numPhones; i++) {
mCallState[i] = TelephonyManager.CALL_STATE_IDLE; mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
@@ -410,7 +419,19 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mCellInfo.add(i, null); mCellInfo.add(i, null);
mImsReasonInfo.add(i, null); mImsReasonInfo.add(i, null);
mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE; mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
mPhysicalChannelConfigs.add(i, new ArrayList<PhysicalChannelConfig>()); 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 // 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) { if ((events & PhoneStateListener.LISTEN_OTASP_CHANGED) != 0) {
try { try {
r.callback.onOtaspChanged(mOtaspMode); r.callback.onOtaspChanged(mOtaspMode[phoneId]);
} catch (RemoteException ex) { } catch (RemoteException ex) {
remove(r.binder); remove(r.binder);
} }
@@ -749,15 +770,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
if ((events & PhoneStateListener.LISTEN_PRECISE_CALL_STATE) != 0) { if ((events & PhoneStateListener.LISTEN_PRECISE_CALL_STATE) != 0) {
try { try {
r.callback.onPreciseCallStateChanged(mPreciseCallState); r.callback.onPreciseCallStateChanged(mPreciseCallState[phoneId]);
} catch (RemoteException ex) { } catch (RemoteException ex) {
remove(r.binder); remove(r.binder);
} }
} }
if ((events & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) { if ((events & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) {
try { try {
r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause, r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause[phoneId],
mCallPreciseDisconnectCause); mCallPreciseDisconnectCause[phoneId]);
} catch (RemoteException ex) { } catch (RemoteException ex) {
remove(r.binder); remove(r.binder);
} }
@@ -772,7 +793,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
if ((events & PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) != 0) { if ((events & PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE) != 0) {
try { try {
r.callback.onPreciseDataConnectionStateChanged( r.callback.onPreciseDataConnectionStateChanged(
mPreciseDataConnectionState); mPreciseDataConnectionState[phoneId]);
} catch (RemoteException ex) { } catch (RemoteException ex) {
remove(r.binder); remove(r.binder);
} }
@@ -854,7 +875,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) { if ((events & PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED) != 0) {
try { try {
r.callback.onCallAttributesChanged(mCallAttributes); r.callback.onCallAttributesChanged(mCallAttributes[phoneId]);
} catch (RemoteException ex) { } catch (RemoteException ex) {
remove(r.binder); remove(r.binder);
} }
@@ -1380,12 +1401,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
LinkProperties linkProperties, LinkProperties linkProperties,
NetworkCapabilities networkCapabilities, int networkType, NetworkCapabilities networkCapabilities, int networkType,
boolean roaming) { boolean roaming) {
notifyDataConnectionForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, state, notifyDataConnectionForSubscriber(SubscriptionManager.DEFAULT_PHONE_INDEX,
SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, state,
isDataAllowed, apn, apnType, linkProperties, isDataAllowed, apn, apnType, linkProperties,
networkCapabilities, networkType, roaming); 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, String apn, String apnType,
LinkProperties linkProperties, NetworkCapabilities networkCapabilities, LinkProperties linkProperties, NetworkCapabilities networkCapabilities,
int networkType, boolean roaming) { int networkType, boolean roaming) {
@@ -1398,7 +1421,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
+ "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType + "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType
+ " mRecords.size()=" + mRecords.size()); + " mRecords.size()=" + mRecords.size());
} }
int phoneId = SubscriptionManager.getPhoneId(subId);
synchronized (mRecords) { synchronized (mRecords) {
if (validatePhoneId(phoneId)) { if (validatePhoneId(phoneId)) {
// We only call the callback when the change is for default APN type. // We only call the callback when the change is for default APN type.
@@ -1413,8 +1435,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mLocalLog.log(str); mLocalLog.log(str);
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) && PhoneStateListener.LISTEN_DATA_CONNECTION_STATE)
idMatch(r.subId, subId, phoneId)) { && idMatch(r.subId, subId, phoneId)) {
try { try {
if (DBG) { if (DBG) {
log("Notify data connection state changed on sub: " + subId); log("Notify data connection state changed on sub: " + subId);
@@ -1430,15 +1452,17 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mDataConnectionState[phoneId] = state; mDataConnectionState[phoneId] = state;
mDataConnectionNetworkType[phoneId] = networkType; mDataConnectionNetworkType[phoneId] = networkType;
} }
mPreciseDataConnectionState = new PreciseDataConnectionState(state, networkType, mPreciseDataConnectionState[phoneId] = new PreciseDataConnectionState(
state, networkType,
ApnSetting.getApnTypesBitmaskFromString(apnType), apn, ApnSetting.getApnTypesBitmaskFromString(apnType), apn,
linkProperties, DataFailCause.NONE); linkProperties, DataFailCause.NONE);
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) { PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)
&& idMatch(r.subId, subId, phoneId)) {
try { try {
r.callback.onPreciseDataConnectionStateChanged( r.callback.onPreciseDataConnectionStateChanged(
mPreciseDataConnectionState); mPreciseDataConnectionState[phoneId]);
} catch (RemoteException ex) { } catch (RemoteException ex) {
mRemoveList.add(r.binder); mRemoveList.add(r.binder);
} }
@@ -1454,11 +1478,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
public void notifyDataConnectionFailed(String apnType) { public void notifyDataConnectionFailed(String apnType) {
notifyDataConnectionFailedForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, notifyDataConnectionFailedForSubscriber(SubscriptionManager.DEFAULT_PHONE_INDEX,
SubscriptionManager.DEFAULT_SUBSCRIPTION_ID,
apnType); apnType);
} }
public void notifyDataConnectionFailedForSubscriber(int subId, String apnType) { public void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType) {
if (!checkNotifyPermission("notifyDataConnectionFailed()")) { if (!checkNotifyPermission("notifyDataConnectionFailed()")) {
return; return;
} }
@@ -1467,20 +1492,25 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
+ " apnType=" + apnType); + " apnType=" + apnType);
} }
synchronized (mRecords) { synchronized (mRecords) {
mPreciseDataConnectionState = new PreciseDataConnectionState( if (validatePhoneId(phoneId)) {
TelephonyManager.DATA_UNKNOWN,TelephonyManager.NETWORK_TYPE_UNKNOWN, mPreciseDataConnectionState[phoneId] = new PreciseDataConnectionState(
ApnSetting.getApnTypesBitmaskFromString(apnType), null, null, TelephonyManager.DATA_UNKNOWN,TelephonyManager.NETWORK_TYPE_UNKNOWN,
DataFailCause.NONE); ApnSetting.getApnTypesBitmaskFromString(apnType), null, null,
for (Record r : mRecords) { DataFailCause.NONE);
if (r.matchPhoneStateListenerEvent( for (Record r : mRecords) {
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) { if (r.matchPhoneStateListenerEvent(
try { PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)
r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState); && idMatch(r.subId, subId, phoneId)) {
} catch (RemoteException ex) { try {
mRemoveList.add(r.binder); r.callback.onPreciseDataConnectionStateChanged(
mPreciseDataConnectionState[phoneId]);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
} }
} }
} }
handleRemoveListLocked(); handleRemoveListLocked();
} }
broadcastDataConnectionFailed(apnType, subId); broadcastDataConnectionFailed(apnType, subId);
@@ -1527,18 +1557,22 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
} }
public void notifyOtaspChanged(int otaspMode) { public void notifyOtaspChanged(int subId, int otaspMode) {
if (!checkNotifyPermission("notifyOtaspChanged()" )) { if (!checkNotifyPermission("notifyOtaspChanged()" )) {
return; return;
} }
int phoneId = SubscriptionManager.getPhoneId(subId);
synchronized (mRecords) { synchronized (mRecords) {
mOtaspMode = otaspMode; if (validatePhoneId(phoneId)) {
for (Record r : mRecords) { mOtaspMode[phoneId] = otaspMode;
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_OTASP_CHANGED)) { for (Record r : mRecords) {
try { if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_OTASP_CHANGED)
r.callback.onOtaspChanged(otaspMode); && idMatch(r.subId, subId, phoneId)) {
} catch (RemoteException ex) { try {
mRemoveList.add(r.binder); r.callback.onOtaspChanged(otaspMode);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
} }
} }
} }
@@ -1546,49 +1580,55 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
} }
public void notifyPreciseCallState(int ringingCallState, int foregroundCallState, public void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
int backgroundCallState, int phoneId) { int foregroundCallState, int backgroundCallState) {
if (!checkNotifyPermission("notifyPreciseCallState()")) { if (!checkNotifyPermission("notifyPreciseCallState()")) {
return; return;
} }
synchronized (mRecords) { synchronized (mRecords) {
mRingingCallState = ringingCallState; if (validatePhoneId(phoneId)) {
mForegroundCallState = foregroundCallState; mRingingCallState[phoneId] = ringingCallState;
mBackgroundCallState = backgroundCallState; mForegroundCallState[phoneId] = foregroundCallState;
mPreciseCallState = new PreciseCallState(ringingCallState, foregroundCallState, mBackgroundCallState[phoneId] = backgroundCallState;
backgroundCallState, mPreciseCallState[phoneId] = new PreciseCallState(
DisconnectCause.NOT_VALID, ringingCallState, foregroundCallState,
PreciseDisconnectCause.NOT_VALID); backgroundCallState,
boolean notifyCallAttributes = true; DisconnectCause.NOT_VALID,
if (mCallQuality == null) { PreciseDisconnectCause.NOT_VALID);
log("notifyPreciseCallState: mCallQuality is null, skipping call attributes"); boolean notifyCallAttributes = true;
notifyCallAttributes = false; if (mCallQuality == null) {
} else { log("notifyPreciseCallState: mCallQuality is null, "
// If the precise call state is no longer active, reset the call network type and + "skipping call attributes");
// call quality. notifyCallAttributes = false;
if (mPreciseCallState.getForegroundCallState() } else {
!= PreciseCallState.PRECISE_CALL_STATE_ACTIVE) { // If the precise call state is no longer active, reset the call network type
mCallNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; // and call quality.
mCallQuality = new CallQuality(); if (mPreciseCallState[phoneId].getForegroundCallState()
} != PreciseCallState.PRECISE_CALL_STATE_ACTIVE) {
mCallAttributes = new CallAttributes(mPreciseCallState, mCallNetworkType, mCallNetworkType[phoneId] = TelephonyManager.NETWORK_TYPE_UNKNOWN;
mCallQuality); mCallQuality[phoneId] = new CallQuality();
}
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)) {
try {
r.callback.onPreciseCallStateChanged(mPreciseCallState);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
} }
mCallAttributes[phoneId] = new CallAttributes(mPreciseCallState[phoneId],
mCallNetworkType[phoneId], mCallQuality[phoneId]);
} }
if (notifyCallAttributes && r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) { for (Record r : mRecords) {
try { if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_PRECISE_CALL_STATE)
r.callback.onCallAttributesChanged(mCallAttributes); && idMatch(r.subId, subId, phoneId)) {
} catch (RemoteException ex) { try {
mRemoveList.add(r.binder); 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);
}
} }
} }
} }
@@ -1598,21 +1638,24 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
backgroundCallState); backgroundCallState);
} }
public void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause) { public void notifyDisconnectCause(int phoneId, int subId, int disconnectCause,
int preciseDisconnectCause) {
if (!checkNotifyPermission("notifyDisconnectCause()")) { if (!checkNotifyPermission("notifyDisconnectCause()")) {
return; return;
} }
synchronized (mRecords) { synchronized (mRecords) {
mCallDisconnectCause = disconnectCause; if (validatePhoneId(phoneId)) {
mCallPreciseDisconnectCause = preciseDisconnectCause; mCallDisconnectCause[phoneId] = disconnectCause;
for (Record r : mRecords) { mCallPreciseDisconnectCause[phoneId] = preciseDisconnectCause;
if (r.matchPhoneStateListenerEvent(PhoneStateListener for (Record r : mRecords) {
.LISTEN_CALL_DISCONNECT_CAUSES)) { if (r.matchPhoneStateListenerEvent(PhoneStateListener
try { .LISTEN_CALL_DISCONNECT_CAUSES) && idMatch(r.subId, subId, phoneId)) {
r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause, try {
mCallPreciseDisconnectCause); r.callback.onCallDisconnectCauseChanged(mCallDisconnectCause[phoneId],
} catch (RemoteException ex) { mCallPreciseDisconnectCause[phoneId]);
mRemoveList.add(r.binder); } catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
} }
} }
} }
@@ -1648,25 +1691,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) { String apn, @DataFailCause.FailCause int failCause) {
if (!checkNotifyPermission("notifyPreciseDataConnectionFailed()")) { if (!checkNotifyPermission("notifyPreciseDataConnectionFailed()")) {
return; return;
} }
synchronized (mRecords) { synchronized (mRecords) {
mPreciseDataConnectionState = new PreciseDataConnectionState( if (validatePhoneId(phoneId)) {
TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN, mPreciseDataConnectionState[phoneId] = new PreciseDataConnectionState(
ApnSetting.getApnTypesBitmaskFromString(apnType), apn, null, failCause); TelephonyManager.DATA_UNKNOWN, TelephonyManager.NETWORK_TYPE_UNKNOWN,
for (Record r : mRecords) { ApnSetting.getApnTypesBitmaskFromString(apnType), apn, null, failCause);
if (r.matchPhoneStateListenerEvent( for (Record r : mRecords) {
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) { if (r.matchPhoneStateListenerEvent(
try { PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)
r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState); && idMatch(r.subId, subId, phoneId)) {
} catch (RemoteException ex) { try {
mRemoveList.add(r.binder); r.callback.onPreciseDataConnectionStateChanged(
mPreciseDataConnectionState[phoneId]);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
} }
} }
} }
handleRemoveListLocked(); handleRemoveListLocked();
} }
broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN, broadcastPreciseDataConnectionStateChanged(TelephonyManager.DATA_UNKNOWN,
@@ -1704,24 +1752,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")) { if (!checkNotifyPermission("notifyOemHookRawEventForSubscriber")) {
return; return;
} }
synchronized (mRecords) { synchronized (mRecords) {
for (Record r : mRecords) { if (validatePhoneId(phoneId)) {
if (VDBG) { for (Record r : mRecords) {
log("notifyOemHookRawEventForSubscriber: r=" + r + " subId=" + subId); if (VDBG) {
} log("notifyOemHookRawEventForSubscriber: r=" + r + " subId=" + subId);
if ((r.matchPhoneStateListenerEvent( }
PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT)) && if ((r.matchPhoneStateListenerEvent(
((r.subId == subId) || PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT))
(r.subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID))) { && idMatch(r.subId, subId, phoneId)) {
try { try {
r.callback.onOemHookRawEvent(rawData); r.callback.onOemHookRawEvent(rawData);
} catch (RemoteException ex) { } catch (RemoteException ex) {
mRemoveList.add(r.binder); mRemoveList.add(r.binder);
}
} }
} }
} }
@@ -1792,27 +1841,32 @@ 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()")) { if (!checkNotifyPermission("notifyRadioPowerStateChanged()")) {
return; return;
} }
if (VDBG) { if (VDBG) {
log("notifyRadioPowerStateChanged: state= " + state); log("notifyRadioPowerStateChanged: state= " + state + " subId=" + subId);
} }
synchronized (mRecords) { synchronized (mRecords) {
mRadioPowerState = state; if (validatePhoneId(phoneId)) {
mRadioPowerState = state;
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED)) { PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED)
try { && idMatch(r.subId, subId, phoneId)) {
r.callback.onRadioPowerStateChanged(state); try {
} catch (RemoteException ex) { r.callback.onRadioPowerStateChanged(state);
mRemoveList.add(r.binder); } catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
} }
} }
} }
handleRemoveListLocked(); handleRemoveListLocked();
} }
@@ -1820,60 +1874,66 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
@Override @Override
public void notifyEmergencyNumberList() { public void notifyEmergencyNumberList(int phoneId, int subId) {
if (!checkNotifyPermission("notifyEmergencyNumberList()")) { if (!checkNotifyPermission("notifyEmergencyNumberList()")) {
return; return;
} }
synchronized (mRecords) { synchronized (mRecords) {
TelephonyManager tm = (TelephonyManager) mContext.getSystemService( if (validatePhoneId(phoneId)) {
Context.TELEPHONY_SERVICE); TelephonyManager tm = (TelephonyManager) mContext.getSystemService(
mEmergencyNumberList = tm.getEmergencyNumberList(); Context.TELEPHONY_SERVICE);
mEmergencyNumberList = tm.getEmergencyNumberList();
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST)) { PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST)
try { && idMatch(r.subId, subId, phoneId)) {
r.callback.onEmergencyNumberListChanged(mEmergencyNumberList); try {
if (VDBG) { r.callback.onEmergencyNumberListChanged(mEmergencyNumberList);
log("notifyEmergencyNumberList: emergencyNumberList= " if (VDBG) {
+ mEmergencyNumberList); log("notifyEmergencyNumberList: emergencyNumberList= "
+ mEmergencyNumberList);
}
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
} }
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
} }
} }
} }
handleRemoveListLocked(); handleRemoveListLocked();
} }
} }
@Override @Override
public void notifyCallQualityChanged(CallQuality callQuality, int phoneId, public void notifyCallQualityChanged(CallQuality callQuality, int phoneId, int subId,
int callNetworkType) { int callNetworkType) {
if (!checkNotifyPermission("notifyCallQualityChanged()")) { if (!checkNotifyPermission("notifyCallQualityChanged()")) {
return; return;
} }
// merge CallQuality with PreciseCallState and network type
mCallQuality = callQuality;
mCallNetworkType = callNetworkType;
mCallAttributes = new CallAttributes(mPreciseCallState, callNetworkType, callQuality);
synchronized (mRecords) { synchronized (mRecords) {
TelephonyManager tm = (TelephonyManager) mContext.getSystemService( if (validatePhoneId(phoneId)) {
Context.TELEPHONY_SERVICE); // 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) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)) { PhoneStateListener.LISTEN_CALL_ATTRIBUTES_CHANGED)
try { && idMatch(r.subId, subId, phoneId)) {
r.callback.onCallAttributesChanged(mCallAttributes); try {
} catch (RemoteException ex) { r.callback.onCallAttributesChanged(mCallAttributes[phoneId]);
mRemoveList.add(r.binder); } catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
} }
} }
} }
handleRemoveListLocked(); handleRemoveListLocked();
} }
} }
@@ -1893,6 +1953,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("Phone Id=" + i); pw.println("Phone Id=" + i);
pw.increaseIndent(); pw.increaseIndent();
pw.println("mCallState=" + mCallState[i]); 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("mCallIncomingNumber=" + mCallIncomingNumber[i]);
pw.println("mServiceState=" + mServiceState[i]); pw.println("mServiceState=" + mServiceState[i]);
pw.println("mVoiceActivationState= " + mVoiceActivationState[i]); pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
@@ -1906,24 +1971,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mCellLocation=" + mCellLocation[i]); pw.println("mCellLocation=" + mCellLocation[i]);
pw.println("mCellInfo=" + mCellInfo.get(i)); pw.println("mCellInfo=" + mCellInfo.get(i));
pw.println("mImsCallDisconnectCause=" + mImsReasonInfo.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.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("mCarrierNetworkChangeState=" + mCarrierNetworkChangeState);
pw.println("mRingingCallState=" + mRingingCallState);
pw.println("mForegroundCallState=" + mForegroundCallState);
pw.println("mBackgroundCallState=" + mBackgroundCallState);
pw.println("mSrvccState=" + mSrvccState);
pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mPhoneCapability=" + mPhoneCapability);
pw.println("mActiveDataSubId=" + mActiveDataSubId); pw.println("mActiveDataSubId=" + mActiveDataSubId);
pw.println("mRadioPowerState=" + mRadioPowerState); pw.println("mRadioPowerState=" + mRadioPowerState);
pw.println("mEmergencyNumberList=" + mEmergencyNumberList); pw.println("mEmergencyNumberList=" + mEmergencyNumberList);
pw.println("mCallQuality=" + mCallQuality);
pw.println("mCallAttributes=" + mCallAttributes);
pw.println("mDefaultPhoneId=" + mDefaultPhoneId); pw.println("mDefaultPhoneId=" + mDefaultPhoneId);
pw.println("mDefaultSubId=" + mDefaultSubId); pw.println("mDefaultSubId=" + mDefaultSubId);

View File

@@ -60,6 +60,8 @@ public class PhoneStateListener {
/** /**
* Stop listening for updates. * Stop listening for updates.
*
* The PhoneStateListener is not tied to any subscription and unregistered for any update.
*/ */
public static final int LISTEN_NONE = 0; public static final int LISTEN_NONE = 0;
@@ -433,7 +435,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_EMERGENCY_ONLY
* @see ServiceState#STATE_IN_SERVICE * @see ServiceState#STATE_IN_SERVICE
@@ -445,7 +453,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_EMERGENCY_ONLY
* @see ServiceState#STATE_IN_SERVICE * @see ServiceState#STATE_IN_SERVICE
@@ -459,21 +473,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) { public void onMessageWaitingIndicatorChanged(boolean mwi) {
// default implementation empty // 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) { public void onCallForwardingIndicatorChanged(boolean cfi) {
// default implementation empty // 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) { public void onCellLocationChanged(CellLocation location) {
// default implementation empty // default implementation empty
@@ -482,7 +514,14 @@ public class PhoneStateListener {
/** /**
* Callback invoked when device call state changes. * Callback invoked when device call state changes.
* <p> * <p>
* Reports the state of Telephony (mobile) calls on the device. * Reports the state of Telephony (mobile) calls on the device for the registered subscription.
* <p>
* 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()}.
* <p> * <p>
* Note: The state returned here may differ from that returned by * Note: The state returned here may differ from that returned by
* {@link TelephonyManager#getCallState()}. Receivers of this callback should be aware that * {@link TelephonyManager#getCallState()}. Receivers of this callback should be aware that
@@ -500,7 +539,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_DISCONNECTED
* @see TelephonyManager#DATA_CONNECTING * @see TelephonyManager#DATA_CONNECTING
@@ -518,7 +563,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_NONE
* @see TelephonyManager#DATA_ACTIVITY_IN * @see TelephonyManager#DATA_ACTIVITY_IN
@@ -531,12 +582,13 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when network signal strengths changes. * Callback invoked when network signal strengths changes on the registered subscription.
* * Note, the registration subId comes from {@link TelephonyManager} object which registers
* @see ServiceState#STATE_EMERGENCY_ONLY * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}.
* @see ServiceState#STATE_IN_SERVICE * If this TelephonyManager object was created with
* @see ServiceState#STATE_OUT_OF_SERVICE * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the
* @see ServiceState#STATE_POWER_OFF * subId. Otherwise, this callback applies to
* {@link SubscriptionManager#getDefaultSubscriptionId()}.
*/ */
public void onSignalStrengthsChanged(SignalStrength signalStrength) { public void onSignalStrengthsChanged(SignalStrength signalStrength) {
// default implementation empty // default implementation empty
@@ -544,8 +596,15 @@ public class PhoneStateListener {
/** /**
* The Over The Air Service Provisioning (OTASP) has changed. Requires * The Over The Air Service Provisioning (OTASP) has changed on the registered subscription.
* the READ_PHONE_STATE permission. * 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 <code>OTASP_UNKNOWN=1<code> * @param otaspMode is integer <code>OTASP_UNKNOWN=1<code>
* means the value is currently unknown and the system should wait until * means the value is currently unknown and the system should wait until
* <code>OTASP_NEEDED=2<code> or <code>OTASP_NOT_NEEDED=3<code> is received before * <code>OTASP_NEEDED=2<code> or <code>OTASP_NOT_NEEDED=3<code> is received before
@@ -559,15 +618,28 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when a observed cell info has changed, * Callback invoked when a observed cell info has changed or new cells have been added
* or new cells have been added or removed. * 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. * @param cellInfo is the list of currently visible cells.
*/ */
public void onCellInfoChanged(List<CellInfo> cellInfo) { public void onCellInfoChanged(List<CellInfo> 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} * @param callState {@link PreciseCallState}
* @hide * @hide
*/ */
@@ -578,7 +650,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 disconnectCause {@link DisconnectCause}.
* @param preciseDisconnectCause {@link PreciseDisconnectCause}. * @param preciseDisconnectCause {@link PreciseDisconnectCause}.
* *
@@ -591,7 +670,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. * @param imsReasonInfo {@link ImsReasonInfo} contains details on why IMS call failed.
* *
* @hide * @hide
@@ -603,7 +689,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} * @param dataConnectionState {@link PreciseDataConnectionState}
* *
* @hide * @hide
@@ -616,7 +710,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 * @hide
*/ */
@@ -628,7 +728,15 @@ public class PhoneStateListener {
/** /**
* Callback invoked when there has been a change in the Single Radio Voice Call Continuity * 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 * @hide
*/ */
@SystemApi @SystemApi
@@ -637,7 +745,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 * @param state is the current SIM voice activation state
* @hide * @hide
*/ */
@@ -646,7 +762,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 * @param state is the current SIM data activation state
* @hide * @hide
*/ */
@@ -654,7 +778,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. * @param enabled indicates whether the current user mobile data state is enabled or disabled.
*/ */
public void onUserMobileDataStateChanged(boolean enabled) { public void onUserMobileDataStateChanged(boolean enabled) {
@@ -662,7 +793,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 * @param configs List of the current {@link PhysicalChannelConfig}s
* @hide * @hide
@@ -673,7 +811,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 * @param emergencyNumberList Map including the key as the active subscription ID
* (Note: if there is no active subscription, the key is * (Note: if there is no active subscription, the key is
@@ -688,8 +833,15 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when OEM hook raw event is received. Requires * Callback invoked when OEM hook raw event is received on the registered subscription.
* the READ_PRIVILEGED_PHONE_STATE permission. * 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. * @param rawData is the byte array of the OEM hook raw data.
* @hide * @hide
*/ */
@@ -699,8 +851,10 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when phone capability changes. Requires * Callback invoked when phone capability changes.
* the READ_PRIVILEGED_PHONE_STATE permission. * Note, this callback triggers regardless of registered subscription.
*
* Requires the READ_PRIVILEGED_PHONE_STATE permission.
* @param capability the new phone capability * @param capability the new phone capability
* @hide * @hide
*/ */
@@ -709,8 +863,10 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when active data subId changes. Requires * Callback invoked when active data subId changes.
* the READ_PHONE_STATE permission. * Note, this callback triggers regardless of registered subscription.
*
* Requires the READ_PHONE_STATE permission.
* @param subId current subscription used to setup Cellular Internet data. * @param subId current subscription used to setup Cellular Internet data.
* For example, it could be the current active opportunistic subscription in use, * For example, it could be the current active opportunistic subscription in use,
* or the subscription user selected as default data subscription in DSDS mode. * or the subscription user selected as default data subscription in DSDS mode.
@@ -720,8 +876,15 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when the call attributes changes. Requires * Callback invoked when the call attributes changes on the registered subscription.
* the READ_PRIVILEGED_PHONE_STATE permission. * 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 * @param callAttributes the call attributes
* @hide * @hide
*/ */
@@ -731,7 +894,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. * the READ_PRIVILEGED_PHONE_STATE permission.
* @param state the modem radio power state * @param state the modem radio power state
* @hide * @hide
@@ -747,6 +918,10 @@ public class PhoneStateListener {
* has been requested by an app using * has been requested by an app using
* {@link android.telephony.TelephonyManager#notifyCarrierNetworkChange(boolean)} * {@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 * @param active Whether the carrier network change is or shortly
* will be active. This value is true to indicate * will be active. This value is true to indicate
* showing alternative UI and false to stop. * showing alternative UI and false to stop.

View File

@@ -56,38 +56,41 @@ interface ITelephonyRegistry {
void notifyDataConnection(int state, boolean isDataConnectivityPossible, void notifyDataConnection(int state, boolean isDataConnectivityPossible,
String apn, String apnType, in LinkProperties linkProperties, String apn, String apnType, in LinkProperties linkProperties,
in NetworkCapabilities networkCapabilities, int networkType, boolean roaming); 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, String apn, String apnType, in LinkProperties linkProperties,
in NetworkCapabilities networkCapabilities, int networkType, boolean roaming); in NetworkCapabilities networkCapabilities, int networkType, boolean roaming);
@UnsupportedAppUsage @UnsupportedAppUsage
void notifyDataConnectionFailed(String apnType); void notifyDataConnectionFailed(String apnType);
void notifyDataConnectionFailedForSubscriber(int subId, String apnType); void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType);
void notifyCellLocation(in Bundle cellLocation); void notifyCellLocation(in Bundle cellLocation);
void notifyCellLocationForSubscriber(in int subId, 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 @UnsupportedAppUsage
void notifyCellInfo(in List<CellInfo> cellInfo); void notifyCellInfo(in List<CellInfo> cellInfo);
void notifyPhysicalChannelConfiguration(in List<PhysicalChannelConfig> configs); void notifyPhysicalChannelConfiguration(in List<PhysicalChannelConfig> configs);
void notifyPhysicalChannelConfigurationForSubscriber(in int subId, void notifyPhysicalChannelConfigurationForSubscriber(in int subId,
in List<PhysicalChannelConfig> configs); in List<PhysicalChannelConfig> configs);
void notifyPreciseCallState(int ringingCallState, int foregroundCallState, void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
int backgroundCallState, int phoneId); int foregroundCallState, int backgroundCallState);
void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause); void notifyDisconnectCause(int phoneId, int subId, int disconnectCause,
void notifyPreciseDataConnectionFailed(String apnType, String apn, int preciseDisconnectCause);
void notifyPreciseDataConnectionFailed(int phoneId, int subId, String apnType, String apn,
int failCause); int failCause);
void notifyCellInfoForSubscriber(in int subId, in List<CellInfo> cellInfo); void notifyCellInfoForSubscriber(in int subId, in List<CellInfo> cellInfo);
void notifySrvccStateChanged(in int subId, in int lteState); void notifySrvccStateChanged(in int subId, in int lteState);
void notifySimActivationStateChangedForPhoneId(in int phoneId, in int subId, void notifySimActivationStateChangedForPhoneId(in int phoneId, in int subId,
int activationState, int activationType); 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 notifySubscriptionInfoChanged();
void notifyOpportunisticSubscriptionInfoChanged(); void notifyOpportunisticSubscriptionInfoChanged();
void notifyCarrierNetworkChange(in boolean active); void notifyCarrierNetworkChange(in boolean active);
void notifyUserMobileDataStateChangedForPhoneId(in int phoneId, in int subId, in boolean state); void notifyUserMobileDataStateChangedForPhoneId(in int phoneId, in int subId, in boolean state);
void notifyPhoneCapabilityChanged(in PhoneCapability capability); void notifyPhoneCapabilityChanged(in PhoneCapability capability);
void notifyActiveDataSubIdChanged(int activeDataSubId); void notifyActiveDataSubIdChanged(int activeDataSubId);
void notifyRadioPowerStateChanged(in int state); void notifyRadioPowerStateChanged(in int phoneId, in int subId, in int state);
void notifyEmergencyNumberList(); void notifyEmergencyNumberList(in int phoneId, in int subId);
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int callNetworkType); void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int subId,
int callNetworkType);
void notifyImsDisconnectCause(int subId, in ImsReasonInfo imsReasonInfo); void notifyImsDisconnectCause(int subId, in ImsReasonInfo imsReasonInfo);
} }