Merge "Rename PREFERRED_DATA_SUBID_CHANGE to ACTIVE_DATA_SUB_CHANGE"
This commit is contained in:
@@ -238,6 +238,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
|
||||
private PhoneCapability mPhoneCapability = null;
|
||||
|
||||
private int mActiveDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||
|
||||
@TelephonyManager.RadioPowerState
|
||||
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 =
|
||||
PhoneStateListener.LISTEN_CALL_FORWARDING_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 =
|
||||
PhoneStateListener.LISTEN_PRECISE_CALL_STATE |
|
||||
@@ -818,9 +821,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
remove(r.binder);
|
||||
}
|
||||
}
|
||||
if ((events & PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE) != 0) {
|
||||
if ((events & PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE) != 0) {
|
||||
try {
|
||||
r.callback.onPreferredDataSubIdChanged(mPreferredDataSubId);
|
||||
r.callback.onActiveDataSubIdChanged(mActiveDataSubId);
|
||||
} catch (RemoteException ex) {
|
||||
remove(r.binder);
|
||||
}
|
||||
@@ -1740,23 +1743,23 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyPreferredDataSubIdChanged(int preferredSubId) {
|
||||
if (!checkNotifyPermission("notifyPreferredDataSubIdChanged()")) {
|
||||
public void notifyActiveDataSubIdChanged(int activeDataSubId) {
|
||||
if (!checkNotifyPermission("notifyActiveDataSubIdChanged()")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (VDBG) {
|
||||
log("notifyPreferredDataSubIdChanged: preferredSubId=" + preferredSubId);
|
||||
log("notifyActiveDataSubIdChanged: activeDataSubId=" + activeDataSubId);
|
||||
}
|
||||
|
||||
synchronized (mRecords) {
|
||||
mPreferredDataSubId = preferredSubId;
|
||||
mActiveDataSubId = activeDataSubId;
|
||||
|
||||
for (Record r : mRecords) {
|
||||
if (r.matchPhoneStateListenerEvent(
|
||||
PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE)) {
|
||||
PhoneStateListener.LISTEN_ACTIVE_DATA_SUBID_CHANGE)) {
|
||||
try {
|
||||
r.callback.onPreferredDataSubIdChanged(preferredSubId);
|
||||
r.callback.onActiveDataSubIdChanged(activeDataSubId);
|
||||
} catch (RemoteException ex) {
|
||||
mRemoveList.add(r.binder);
|
||||
}
|
||||
@@ -1893,7 +1896,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
pw.println("mBackgroundCallState=" + mBackgroundCallState);
|
||||
pw.println("mSrvccState=" + mSrvccState);
|
||||
pw.println("mPhoneCapability=" + mPhoneCapability);
|
||||
pw.println("mPreferredDataSubId=" + mPreferredDataSubId);
|
||||
pw.println("mActiveDataSubId=" + mActiveDataSubId);
|
||||
pw.println("mRadioPowerState=" + mRadioPowerState);
|
||||
pw.println("mEmergencyNumberList=" + mEmergencyNumberList);
|
||||
pw.println("mCallQuality=" + mCallQuality);
|
||||
@@ -2165,14 +2168,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
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) {
|
||||
mContext.enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
|
||||
|
||||
@@ -292,14 +292,17 @@ public class PhoneStateListener {
|
||||
public static final int LISTEN_PHONE_CAPABILITY_CHANGE = 0x00200000;
|
||||
|
||||
/**
|
||||
* Listen for changes to preferred data subId.
|
||||
* See {@link SubscriptionManager#setPreferredDataSubId(int)}
|
||||
* for more details.
|
||||
* Listen for changes to active data subId. Active data subscription
|
||||
* is whichever is being used for Internet data. For most of the case, it's
|
||||
* 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
|
||||
*/
|
||||
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.
|
||||
@@ -704,14 +707,14 @@ public class PhoneStateListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback invoked when preferred data subId changes. Requires
|
||||
* the READ_PRIVILEGED_PHONE_STATE permission.
|
||||
* @param subId the new preferred data subId. If it's INVALID_SUBSCRIPTION_ID,
|
||||
* it means it's unset and defaultDataSub is used to determine which
|
||||
* modem is preferred.
|
||||
* Callback invoked when active data subId changes. Requires
|
||||
* the READ_PHONE_STATE permission.
|
||||
* @param subId current data subId used for Internet data. It will be default data subscription
|
||||
* most cases. And it could be other subscriptions for example opportunistic
|
||||
* subscription if data is switched onto it.
|
||||
* @hide
|
||||
*/
|
||||
public void onPreferredDataSubIdChanged(int subId) {
|
||||
public void onActiveDataSubIdChanged(int subId) {
|
||||
// default implementation empty
|
||||
}
|
||||
|
||||
@@ -995,12 +998,12 @@ public class PhoneStateListener {
|
||||
() -> mExecutor.execute(() -> psl.onCallAttributesChanged(callAttributes)));
|
||||
}
|
||||
|
||||
public void onPreferredDataSubIdChanged(int subId) {
|
||||
public void onActiveDataSubIdChanged(int subId) {
|
||||
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
|
||||
if (psl == null) return;
|
||||
|
||||
Binder.withCleanCallingIdentity(
|
||||
() -> mExecutor.execute(() -> psl.onPreferredDataSubIdChanged(subId)));
|
||||
() -> mExecutor.execute(() -> psl.onActiveDataSubIdChanged(subId)));
|
||||
}
|
||||
|
||||
public void onImsCallDisconnectCauseChanged(ImsReasonInfo disconnectCause) {
|
||||
|
||||
@@ -54,7 +54,7 @@ oneway interface IPhoneStateListener {
|
||||
void onCarrierNetworkChange(in boolean active);
|
||||
void onUserMobileDataStateChanged(in boolean enabled);
|
||||
void onPhoneCapabilityChanged(in PhoneCapability capability);
|
||||
void onPreferredDataSubIdChanged(in int subId);
|
||||
void onActiveDataSubIdChanged(in int subId);
|
||||
void onRadioPowerStateChanged(in int state);
|
||||
void onCallAttributesChanged(in CallAttributes callAttributes);
|
||||
void onEmergencyNumberListChanged(in Map emergencyNumberList);
|
||||
|
||||
@@ -85,7 +85,7 @@ interface ITelephonyRegistry {
|
||||
void notifyCarrierNetworkChange(in boolean active);
|
||||
void notifyUserMobileDataStateChangedForPhoneId(in int phoneId, in int subId, in boolean state);
|
||||
void notifyPhoneCapabilityChanged(in PhoneCapability capability);
|
||||
void notifyPreferredDataSubIdChanged(int preferredSubId);
|
||||
void notifyActiveDataSubIdChanged(int activeDataSubId);
|
||||
void notifyRadioPowerStateChanged(in int state);
|
||||
void notifyEmergencyNumberList();
|
||||
void notifyCallQualityChanged(in CallQuality callQuality, int phoneId, int callNetworkType);
|
||||
|
||||
Reference in New Issue
Block a user