diff options
| author | Sarah Chin <sarahchin@google.com> | 2020-03-03 21:01:06 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-03-03 21:01:06 +0000 |
| commit | cf66c06c3233b8bf82ae1fb6e084da99b292d108 (patch) | |
| tree | 1ed3ac33c50c737a50185f5b69b03d49e69207fb /core/java/android | |
| parent | 5dc0d90aadf3cc8a285e4609db1f19b413535692 (diff) | |
| parent | 05c4fe130136d3af002ec41bccf199d17e83b726 (diff) | |
Merge changes from topic "displayinfo"
* changes:
Move override logic from SysUI to Telephony
Added telephony display info support
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 | 18 |
2 files changed, 49 insertions, 0 deletions
diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java index 4591fafc696e..1dca7fd0e444 100644 --- a/core/java/android/telephony/PhoneStateListener.java +++ b/core/java/android/telephony/PhoneStateListener.java @@ -301,6 +301,13 @@ public class PhoneStateListener { public static final int LISTEN_USER_MOBILE_DATA_STATE = 0x00080000; /** + * Listen for display info changed event. + * + * @see #onDisplayInfoChanged + */ + public static final int LISTEN_DISPLAY_INFO_CHANGED = 0x00100000; + + /** * Listen for changes to the phone capability. * * @see #onPhoneCapabilityChanged @@ -837,6 +844,21 @@ public class PhoneStateListener { } /** + * Callback invoked when the display info has changed on the registered subscription. + * <p> The {@link DisplayInfo} contains status information shown to the user based on + * carrier policy. + * + * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling + * app has carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}). + * + * @param displayInfo The display information. + */ + @RequiresPermission((android.Manifest.permission.READ_PHONE_STATE)) + public void onDisplayInfoChanged(@NonNull DisplayInfo displayInfo) { + // default implementation empty + } + + /** * 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 @@ -1201,6 +1223,15 @@ public class PhoneStateListener { () -> psl.onUserMobileDataStateChanged(enabled))); } + public void onDisplayInfoChanged(DisplayInfo displayInfo) { + PhoneStateListener psl = mPhoneStateListenerWeakRef.get(); + if (psl == null) return; + + Binder.withCleanCallingIdentity( + () -> mExecutor.execute( + () -> psl.onDisplayInfoChanged(displayInfo))); + } + public void onOemHookRawEvent(byte[] rawData) { PhoneStateListener psl = mPhoneStateListenerWeakRef.get(); if (psl == null) return; diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java index ddc38bf6b84d..c4b4c43056b1 100644 --- a/core/java/android/telephony/TelephonyRegistryManager.java +++ b/core/java/android/telephony/TelephonyRegistryManager.java @@ -536,6 +536,24 @@ public class TelephonyRegistryManager { } /** + * Notify display info changed. + * + * @param slotIndex The SIM slot index for which display info has changed. Can be + * derived from {@code subscriptionId} except when {@code subscriptionId} is invalid, such as + * when the device is in emergency-only mode. + * @param subscriptionId Subscription id for which display network info has changed. + * @param displayInfo The display info. + */ + public void notifyDisplayInfoChanged(int slotIndex, int subscriptionId, + @NonNull DisplayInfo displayInfo) { + try { + sRegistry.notifyDisplayInfoChanged(slotIndex, subscriptionId, displayInfo); + } catch (RemoteException ex) { + // system process is dead + } + } + + /** * Notify IMS call disconnect causes which contains {@link android.telephony.ims.ImsReasonInfo}. * * @param subId for which ims call disconnect. |
