Merge "Rename PREFERRED_DATA_SUBID_CHANGE to ACTIVE_DATA_SUB_CHANGE"

am: 016409b3d5

Change-Id: I2ced5079661da96b12c3359b6dc89412b585993a
This commit is contained in:
Nazanin Bakhshi
2019-03-08 10:45:20 -08:00
committed by android-build-merger
4 changed files with 31 additions and 33 deletions

View File

@@ -238,6 +238,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private PhoneCapability mPhoneCapability = null; private PhoneCapability mPhoneCapability = null;
private int mActiveDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@TelephonyManager.RadioPowerState @TelephonyManager.RadioPowerState
private int mRadioPowerState = TelephonyManager.RADIO_POWER_UNAVAILABLE; private int mRadioPowerState = TelephonyManager.RADIO_POWER_UNAVAILABLE;
@@ -258,7 +260,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
static final int ENFORCE_PHONE_STATE_PERMISSION_MASK = static final int ENFORCE_PHONE_STATE_PERMISSION_MASK =
PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR
| PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR | PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR
| PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST; | PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST
| PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE;
static final int PRECISE_PHONE_STATE_PERMISSION_MASK = static final int PRECISE_PHONE_STATE_PERMISSION_MASK =
PhoneStateListener.LISTEN_PRECISE_CALL_STATE | PhoneStateListener.LISTEN_PRECISE_CALL_STATE |
@@ -818,9 +821,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
remove(r.binder); remove(r.binder);
} }
} }
if ((events & PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE) != 0) { if ((events & PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE) != 0) {
try { try {
r.callback.onPreferredDataSubIdChanged(mPreferredDataSubId); r.callback.onActiveDataSubIdChanged(mActiveDataSubId);
} catch (RemoteException ex) { } catch (RemoteException ex) {
remove(r.binder); remove(r.binder);
} }
@@ -1740,23 +1743,23 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
} }
} }
public void notifyPreferredDataSubIdChanged(int preferredSubId) { public void notifyActiveDataSubIdChanged(int activeDataSubId) {
if (!checkNotifyPermission("notifyPreferredDataSubIdChanged()")) { if (!checkNotifyPermission("notifyActiveDataSubIdChanged()")) {
return; return;
} }
if (VDBG) { if (VDBG) {
log("notifyPreferredDataSubIdChanged: preferredSubId=" + preferredSubId); log("notifyActiveDataSubIdChanged: activeDataSubId=" + activeDataSubId);
} }
synchronized (mRecords) { synchronized (mRecords) {
mPreferredDataSubId = preferredSubId; mActiveDataSubId = activeDataSubId;
for (Record r : mRecords) { for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent( if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE)) { PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE)) {
try { try {
r.callback.onPreferredDataSubIdChanged(preferredSubId); r.callback.onActiveDataSubIdChanged(activeDataSubId);
} catch (RemoteException ex) { } catch (RemoteException ex) {
mRemoveList.add(r.binder); mRemoveList.add(r.binder);
} }
@@ -1893,7 +1896,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
pw.println("mBackgroundCallState=" + mBackgroundCallState); pw.println("mBackgroundCallState=" + mBackgroundCallState);
pw.println("mSrvccState=" + mSrvccState); pw.println("mSrvccState=" + mSrvccState);
pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mPhoneCapability=" + mPhoneCapability);
pw.println("mPreferredDataSubId=" + mPreferredDataSubId); 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("mCallQuality=" + mCallQuality);
@@ -2165,14 +2168,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null); android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
} }
if ((events & PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE) != 0) {
// It can have either READ_PHONE_STATE or READ_PRIVILEGED_PHONE_STATE.
TelephonyPermissions.checkReadPhoneState(mContext,
SubscriptionManager.INVALID_SUBSCRIPTION_ID, Binder.getCallingPid(),
Binder.getCallingUid(), callingPackage, "listen to "
+ "LISTEN_PREFERRED_DATA_SUBID_CHANGE");
}
if ((events & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) { if ((events & PhoneStateListener.LISTEN_CALL_DISCONNECT_CAUSES) != 0) {
mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRECISE_PHONE_STATE, null); android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);

View File

@@ -292,14 +292,17 @@ public class PhoneStateListener {
public static final int LISTEN_PHONE_CAPABILITY_CHANGE = 0x00200000; public static final int LISTEN_PHONE_CAPABILITY_CHANGE = 0x00200000;
/** /**
* Listen for changes to preferred data subId. * Listen for changes to active data subId. Active data subscription
* See {@link SubscriptionManager#setPreferredDataSubId(int)} * is whichever is being used for Internet data. For most of the case, it's
* for more details. * default data subscription but it could be others. For example, when data is
* switched to opportunistic subscription, that becomes the active data sub.
* *
* @see #onPreferredDataSubIdChanged * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE
* READ_PHONE_STATE}
* @see #onActiveDataSubIdChanged
* @hide * @hide
*/ */
public static final int LISTEN_PREFERRED_DATA_SUBID_CHANGE = 0x00400000; public static final int LISTEN_ACTIVE_DATA_SUBID_CHANGE = 0x00400000;
/** /**
* Listen for changes to the radio power state. * Listen for changes to the radio power state.
@@ -704,14 +707,14 @@ public class PhoneStateListener {
} }
/** /**
* Callback invoked when preferred data subId changes. Requires * Callback invoked when active data subId changes. Requires
* the READ_PRIVILEGED_PHONE_STATE permission. * the READ_PHONE_STATE permission.
* @param subId the new preferred data subId. If it's INVALID_SUBSCRIPTION_ID, * @param subId current data subId used for Internet data. It will be default data subscription
* it means it's unset and defaultDataSub is used to determine which * most cases. And it could be other subscriptions for example opportunistic
* modem is preferred. * subscription if data is switched onto it.
* @hide * @hide
*/ */
public void onPreferredDataSubIdChanged(int subId) { public void onActiveDataSubIdChanged(int subId) {
// default implementation empty // default implementation empty
} }
@@ -995,12 +998,12 @@ public class PhoneStateListener {
() -> mExecutor.execute(() -> psl.onCallAttributesChanged(callAttributes))); () -> mExecutor.execute(() -> psl.onCallAttributesChanged(callAttributes)));
} }
public void onPreferredDataSubIdChanged(int subId) { public void onActiveDataSubIdChanged(int subId) {
PhoneStateListener psl = mPhoneStateListenerWeakRef.get(); PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
if (psl == null) return; if (psl == null) return;
Binder.withCleanCallingIdentity( Binder.withCleanCallingIdentity(
() -> mExecutor.execute(() -> psl.onPreferredDataSubIdChanged(subId))); () -> mExecutor.execute(() -> psl.onActiveDataSubIdChanged(subId)));
} }
public void onImsCallDisconnectCauseChanged(ImsReasonInfo disconnectCause) { public void onImsCallDisconnectCauseChanged(ImsReasonInfo disconnectCause) {

View File

@@ -54,7 +54,7 @@ oneway interface IPhoneStateListener {
void onCarrierNetworkChange(in boolean active); void onCarrierNetworkChange(in boolean active);
void onUserMobileDataStateChanged(in boolean enabled); void onUserMobileDataStateChanged(in boolean enabled);
void onPhoneCapabilityChanged(in PhoneCapability capability); void onPhoneCapabilityChanged(in PhoneCapability capability);
void onPreferredDataSubIdChanged(in int subId); void onActiveDataSubIdChanged(in int subId);
void onRadioPowerStateChanged(in int state); void onRadioPowerStateChanged(in int state);
void onCallAttributesChanged(in CallAttributes callAttributes); void onCallAttributesChanged(in CallAttributes callAttributes);
void onEmergencyNumberListChanged(in Map emergencyNumberList); void onEmergencyNumberListChanged(in Map emergencyNumberList);

View File

@@ -85,7 +85,7 @@ interface ITelephonyRegistry {
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 notifyPreferredDataSubIdChanged(int preferredSubId); void notifyActiveDataSubIdChanged(int activeDataSubId);
void notifyRadioPowerStateChanged(in int state); void notifyRadioPowerStateChanged(in int state);
void notifyEmergencyNumberList(); void notifyEmergencyNumberList();
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int callNetworkType); void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int callNetworkType);