Loading services/core/java/com/android/server/TelephonyRegistry.java +35 −0 Original line number Original line Diff line number Diff line Loading @@ -213,6 +213,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { private PhoneCapability mPhoneCapability = null; private PhoneCapability mPhoneCapability = null; private int mPreferredDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private final LocalLog mLocalLog = new LocalLog(100); private final LocalLog mLocalLog = new LocalLog(100); private PreciseDataConnectionState mPreciseDataConnectionState = private PreciseDataConnectionState mPreciseDataConnectionState = Loading Loading @@ -752,6 +754,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(r.binder); remove(r.binder); } } } } if ((events & PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE) != 0) { try { r.callback.onPreferredDataSubIdChanged(mPreferredDataSubId); } catch (RemoteException ex) { remove(r.binder); } } } } } } } else { } else { Loading Loading @@ -1573,6 +1582,31 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } } } public void notifyPreferredDataSubIdChanged(int preferredSubId) { if (!checkNotifyPermission("notifyPreferredDataSubIdChanged()")) { return; } if (VDBG) { log("notifyPreferredDataSubIdChanged: preferredSubId=" + preferredSubId); } synchronized (mRecords) { mPreferredDataSubId = preferredSubId; for (Record r : mRecords) { if (r.matchPhoneStateListenerEvent( PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE)) { try { r.callback.onPreferredDataSubIdChanged(preferredSubId); } catch (RemoteException ex) { mRemoveList.add(r.binder); } } } handleRemoveListLocked(); } } @Override @Override public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { Loading Loading @@ -1610,6 +1644,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println("mBackgroundCallState=" + mBackgroundCallState); pw.println("mBackgroundCallState=" + mBackgroundCallState); pw.println("mVoLteServiceState=" + mVoLteServiceState); pw.println("mVoLteServiceState=" + mVoLteServiceState); pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mPreferredDataSubId=" + mPreferredDataSubId); pw.decreaseIndent(); pw.decreaseIndent(); Loading telephony/java/android/telephony/PhoneStateListener.java +30 −0 Original line number Original line Diff line number Diff line Loading @@ -281,6 +281,16 @@ 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. * See {@link SubscriptionManager#setPreferredData(int)} * for more details. * * @see #onPreferredDataSubIdChanged * @hide */ public static final int LISTEN_PREFERRED_DATA_SUBID_CHANGE = 0x00400000; /* /* * Subscription used to listen to the phone state changes * Subscription used to listen to the phone state changes * @hide * @hide Loading Loading @@ -407,6 +417,9 @@ public class PhoneStateListener { PhoneStateListener.this.onPhoneCapabilityChanged( PhoneStateListener.this.onPhoneCapabilityChanged( (PhoneCapability) msg.obj); (PhoneCapability) msg.obj); break; break; case LISTEN_PREFERRED_DATA_SUBID_CHANGE: PhoneStateListener.this.onPreferredDataSubIdChanged((int) msg.obj); break; } } } } }; }; Loading Loading @@ -646,6 +659,18 @@ public class PhoneStateListener { // default implementation empty // default implementation empty } } /** * 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. * @hide */ public void onPreferredDataSubIdChanged(int subId) { // default implementation empty } /** /** * Callback invoked when telephony has received notice from a carrier * Callback invoked when telephony has received notice from a carrier * app that a network action that could result in connectivity loss * app that a network action that could result in connectivity loss Loading Loading @@ -777,6 +802,11 @@ public class PhoneStateListener { public void onPhoneCapabilityChanged(PhoneCapability capability) { public void onPhoneCapabilityChanged(PhoneCapability capability) { send(LISTEN_PHONE_CAPABILITY_CHANGE, 0, 0, capability); send(LISTEN_PHONE_CAPABILITY_CHANGE, 0, 0, capability); } } public void onPreferredDataSubIdChanged(int subId) { send(LISTEN_PREFERRED_DATA_SUBID_CHANGE, 0, 0, subId); } } } /** /** Loading telephony/java/android/telephony/SubscriptionManager.java +4 −3 Original line number Original line Diff line number Diff line Loading @@ -2157,10 +2157,11 @@ public class SubscriptionManager { * It's also usually what we set up internet connection on. * It's also usually what we set up internet connection on. * * * PreferredData overwrites user setting of default data subscription. And it's used * PreferredData overwrites user setting of default data subscription. And it's used * by ANAS or carrier apps to switch primary and CBRS subscription dynamically in multi-SIM * by AlternativeNetworkAccessService or carrier apps to switch primary and CBRS * devices. * subscription dynamically in multi-SIM devices. * * * @param slotId which slot is preferred to for cellular data. * @param slotId which slot is preferred to for cellular data. If it's INVALID, it means * it's unset and defaultDataSubId is used to determine which modem is preferred. * @hide * @hide * * */ */ Loading telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -52,5 +52,6 @@ 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); } } telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -79,4 +79,5 @@ 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); } } Loading
services/core/java/com/android/server/TelephonyRegistry.java +35 −0 Original line number Original line Diff line number Diff line Loading @@ -213,6 +213,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { private PhoneCapability mPhoneCapability = null; private PhoneCapability mPhoneCapability = null; private int mPreferredDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; private final LocalLog mLocalLog = new LocalLog(100); private final LocalLog mLocalLog = new LocalLog(100); private PreciseDataConnectionState mPreciseDataConnectionState = private PreciseDataConnectionState mPreciseDataConnectionState = Loading Loading @@ -752,6 +754,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(r.binder); remove(r.binder); } } } } if ((events & PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE) != 0) { try { r.callback.onPreferredDataSubIdChanged(mPreferredDataSubId); } catch (RemoteException ex) { remove(r.binder); } } } } } } } else { } else { Loading Loading @@ -1573,6 +1582,31 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } } } public void notifyPreferredDataSubIdChanged(int preferredSubId) { if (!checkNotifyPermission("notifyPreferredDataSubIdChanged()")) { return; } if (VDBG) { log("notifyPreferredDataSubIdChanged: preferredSubId=" + preferredSubId); } synchronized (mRecords) { mPreferredDataSubId = preferredSubId; for (Record r : mRecords) { if (r.matchPhoneStateListenerEvent( PhoneStateListener.LISTEN_PREFERRED_DATA_SUBID_CHANGE)) { try { r.callback.onPreferredDataSubIdChanged(preferredSubId); } catch (RemoteException ex) { mRemoveList.add(r.binder); } } } handleRemoveListLocked(); } } @Override @Override public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { Loading Loading @@ -1610,6 +1644,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println("mBackgroundCallState=" + mBackgroundCallState); pw.println("mBackgroundCallState=" + mBackgroundCallState); pw.println("mVoLteServiceState=" + mVoLteServiceState); pw.println("mVoLteServiceState=" + mVoLteServiceState); pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mPhoneCapability=" + mPhoneCapability); pw.println("mPreferredDataSubId=" + mPreferredDataSubId); pw.decreaseIndent(); pw.decreaseIndent(); Loading
telephony/java/android/telephony/PhoneStateListener.java +30 −0 Original line number Original line Diff line number Diff line Loading @@ -281,6 +281,16 @@ 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. * See {@link SubscriptionManager#setPreferredData(int)} * for more details. * * @see #onPreferredDataSubIdChanged * @hide */ public static final int LISTEN_PREFERRED_DATA_SUBID_CHANGE = 0x00400000; /* /* * Subscription used to listen to the phone state changes * Subscription used to listen to the phone state changes * @hide * @hide Loading Loading @@ -407,6 +417,9 @@ public class PhoneStateListener { PhoneStateListener.this.onPhoneCapabilityChanged( PhoneStateListener.this.onPhoneCapabilityChanged( (PhoneCapability) msg.obj); (PhoneCapability) msg.obj); break; break; case LISTEN_PREFERRED_DATA_SUBID_CHANGE: PhoneStateListener.this.onPreferredDataSubIdChanged((int) msg.obj); break; } } } } }; }; Loading Loading @@ -646,6 +659,18 @@ public class PhoneStateListener { // default implementation empty // default implementation empty } } /** * 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. * @hide */ public void onPreferredDataSubIdChanged(int subId) { // default implementation empty } /** /** * Callback invoked when telephony has received notice from a carrier * Callback invoked when telephony has received notice from a carrier * app that a network action that could result in connectivity loss * app that a network action that could result in connectivity loss Loading Loading @@ -777,6 +802,11 @@ public class PhoneStateListener { public void onPhoneCapabilityChanged(PhoneCapability capability) { public void onPhoneCapabilityChanged(PhoneCapability capability) { send(LISTEN_PHONE_CAPABILITY_CHANGE, 0, 0, capability); send(LISTEN_PHONE_CAPABILITY_CHANGE, 0, 0, capability); } } public void onPreferredDataSubIdChanged(int subId) { send(LISTEN_PREFERRED_DATA_SUBID_CHANGE, 0, 0, subId); } } } /** /** Loading
telephony/java/android/telephony/SubscriptionManager.java +4 −3 Original line number Original line Diff line number Diff line Loading @@ -2157,10 +2157,11 @@ public class SubscriptionManager { * It's also usually what we set up internet connection on. * It's also usually what we set up internet connection on. * * * PreferredData overwrites user setting of default data subscription. And it's used * PreferredData overwrites user setting of default data subscription. And it's used * by ANAS or carrier apps to switch primary and CBRS subscription dynamically in multi-SIM * by AlternativeNetworkAccessService or carrier apps to switch primary and CBRS * devices. * subscription dynamically in multi-SIM devices. * * * @param slotId which slot is preferred to for cellular data. * @param slotId which slot is preferred to for cellular data. If it's INVALID, it means * it's unset and defaultDataSubId is used to determine which modem is preferred. * @hide * @hide * * */ */ Loading
telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -52,5 +52,6 @@ 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); } }
telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -79,4 +79,5 @@ 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); } }