diff options
| author | Zoey Chen <zoeychen@google.com> | 2020-07-28 18:42:56 +0800 |
|---|---|---|
| committer | Zoey Chen <zoeychen@google.com> | 2020-09-02 14:43:41 +0800 |
| commit | bcdb260b5f1592066754769a3d0ddcefdfe2d471 (patch) | |
| tree | 4978ee3900511cc699a17fc077db4411ec47b5dc /core/java/android | |
| parent | e5d6841e7c23fe1f11d28a06d25394040b2aca90 (diff) | |
[5G] Implement Physical Channel Listener
To support the new listen event, use long instead of int for the new one then creat bitmask for old events.
Bug: 162300897
Test: manual - 5g testing
Change-Id: I002cb3579eb920ffc0b0a8dbf59e8d1153222411
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/telephony/PhoneStateListener.java | 31 | ||||
| -rw-r--r-- | core/java/android/telephony/TelephonyRegistryManager.java | 17 |
2 files changed, 47 insertions, 1 deletions
diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java index a6e6d057d48c..64796cd22c11 100644 --- a/core/java/android/telephony/PhoneStateListener.java +++ b/core/java/android/telephony/PhoneStateListener.java @@ -486,6 +486,16 @@ public class PhoneStateListener { @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_BARRING_INFO = 0x80000000; + /** + * Listen for changes to the physical channel configuration. + * + * @see #onPhysicalChannelConfigurationChanged + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) + public static final long LISTEN_PHYSICAL_CHANNEL_CONFIGURATION = 0x100000000L; + /* * Subscription used to listen to the phone state changes * @hide @@ -1115,6 +1125,18 @@ public class PhoneStateListener { } /** + * Callback invoked when the current physical channel configuration has changed + * + * @param configs List of the current {@link PhysicalChannelConfig}s + * @hide + */ + @SystemApi + public void onPhysicalChannelConfigurationChanged( + @NonNull List<PhysicalChannelConfig> configs) { + // default implementation empty + } + + /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. * @@ -1415,6 +1437,15 @@ public class PhoneStateListener { Binder.withCleanCallingIdentity( () -> mExecutor.execute(() -> psl.onBarringInfoChanged(barringInfo))); } + + public void onPhysicalChannelConfigurationChanged(List<PhysicalChannelConfig> configs) { + PhoneStateListener psl = mPhoneStateListenerWeakRef.get(); + if (psl == null) return; + + Binder.withCleanCallingIdentity( + () -> mExecutor.execute( + () -> psl.onPhysicalChannelConfigurationChanged(configs))); + } } diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java index a720601d81ff..6d48dc36ceb4 100644 --- a/core/java/android/telephony/TelephonyRegistryManager.java +++ b/core/java/android/telephony/TelephonyRegistryManager.java @@ -211,7 +211,7 @@ public class TelephonyRegistryManager { * @param notifyNow Whether to notify instantly */ public void listenForSubscriber(int subId, @NonNull String pkg, @NonNull String featureId, - @NonNull PhoneStateListener listener, int events, boolean notifyNow) { + @NonNull PhoneStateListener listener, long events, boolean notifyNow) { try { // subId from PhoneStateListener is deprecated Q on forward, use the subId from // TelephonyManager instance. Keep using subId from PhoneStateListener for pre-Q. @@ -754,4 +754,19 @@ public class TelephonyRegistryManager { } } + /** + * Notify {@link PhysicalChannelConfig} has changed for a specific subscription. + * + * @param subId the subId + * @param configs a list of {@link PhysicalChannelConfig}, the configs of physical channel. + */ + public void notifyPhysicalChannelConfigurationForSubscriber( + int subId, List<PhysicalChannelConfig> configs) { + try { + sRegistry.notifyPhysicalChannelConfigurationForSubscriber(subId, configs); + } catch (RemoteException ex) { + // system server crash + } + } + } |
