Loading core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -42333,7 +42333,7 @@ package android.telephony { } public static interface TelephonyCallback.DisplayInfoListener { method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo); method public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo); } public static interface TelephonyCallback.EmergencyNumberListListener { core/java/android/telephony/PhoneStateListener.java +14 −7 Original line number Diff line number Diff line Loading @@ -343,9 +343,12 @@ public class PhoneStateListener { /** * Listen for display info changed event. * * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE * READ_PHONE_STATE} or that the calling app has carrier privileges (see * {@link TelephonyManager#hasCarrierPrivileges}). * For clients compiled on Android 11 SDK, requires permission: * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app has carrier * privileges (see {@link TelephonyManager#hasCarrierPrivileges}). * For clients compiled on Android 12 SDK or newer, * {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges is not required * anymore. * * @see #onDisplayInfoChanged * @deprecated Use {@link TelephonyCallback.DisplayInfoListener} instead. Loading Loading @@ -981,8 +984,12 @@ public class PhoneStateListener { * <p> The {@link TelephonyDisplayInfo} 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}). * For clients compiled on Android 11 SDK, requires permission: * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app has carrier * privileges (see {@link TelephonyManager#hasCarrierPrivileges}). * For clients compiled on Android 12 SDK or newer, * {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges is not required * anymore. * * @param telephonyDisplayInfo The display information. * @deprecated Use {@link TelephonyCallback.DisplayInfoListener} instead. Loading core/java/android/telephony/TelephonyCallback.java +0 −1 Original line number Diff line number Diff line Loading @@ -1057,7 +1057,6 @@ public class TelephonyCallback { * * @param telephonyDisplayInfo The display information. */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onDisplayInfoChanged(@NonNull TelephonyDisplayInfo telephonyDisplayInfo); } Loading services/core/java/com/android/server/TelephonyRegistry.java +9 −7 Original line number Diff line number Diff line Loading @@ -366,11 +366,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { || events.contains(TelephonyCallback.EVENT_BARRING_INFO_CHANGED); } private boolean isPhoneStatePermissionRequired(Set<Integer> events) { private boolean isPhoneStatePermissionRequired(Set<Integer> events, int targetSdk) { return events.contains(TelephonyCallback.EVENT_CALL_FORWARDING_INDICATOR_CHANGED) || events.contains(TelephonyCallback.EVENT_MESSAGE_WAITING_INDICATOR_CHANGED) || events.contains(TelephonyCallback.EVENT_EMERGENCY_NUMBER_LIST_CHANGED) || events.contains(TelephonyCallback.EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED); || events.contains(TelephonyCallback.EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED) || (targetSdk <= android.os.Build.VERSION_CODES.R ? events.contains( TelephonyCallback.EVENT_DISPLAY_INFO_CHANGED) : false); } private boolean isPrecisePhoneStatePermissionRequired(Set<Integer> events) { Loading Loading @@ -882,12 +884,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(callback.asBinder()); return; } int callerTargetSdk = TelephonyPermissions.getTargetSdk(mContext, callingPackage); // Checks permission and throws SecurityException for disallowed operations. For pre-M // apps whose runtime permission has been revoked, we return immediately to skip sending // events to the app without crashing it. if (!checkListenerPermission(events, subId, callingPackage, callingFeatureId, "listen")) { "listen", callerTargetSdk)) { return; } Loading Loading @@ -920,7 +922,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } r.phoneId = phoneId; r.eventList = events; r.targetSdk = TelephonyPermissions.getTargetSdk(mContext, callingPackage); r.targetSdk = callerTargetSdk; if (DBG) { log("listen: Register r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId); Loading Loading @@ -2876,7 +2878,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } private boolean checkListenerPermission(Set<Integer> events, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { @Nullable String callingFeatureId, String message, int targetSdk) { LocationAccessPolicy.LocationPermissionQuery.Builder locationQueryBuilder = new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) Loading Loading @@ -2912,7 +2914,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } if (isPhoneStatePermissionRequired(events)) { if (isPhoneStatePermissionRequired(events, targetSdk)) { if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState( mContext, subId, callingPackage, callingFeatureId, message)) { isPermissionCheckSuccessful = false; Loading Loading
core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -42333,7 +42333,7 @@ package android.telephony { } public static interface TelephonyCallback.DisplayInfoListener { method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo); method public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo); } public static interface TelephonyCallback.EmergencyNumberListListener {
core/java/android/telephony/PhoneStateListener.java +14 −7 Original line number Diff line number Diff line Loading @@ -343,9 +343,12 @@ public class PhoneStateListener { /** * Listen for display info changed event. * * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE * READ_PHONE_STATE} or that the calling app has carrier privileges (see * {@link TelephonyManager#hasCarrierPrivileges}). * For clients compiled on Android 11 SDK, requires permission: * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app has carrier * privileges (see {@link TelephonyManager#hasCarrierPrivileges}). * For clients compiled on Android 12 SDK or newer, * {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges is not required * anymore. * * @see #onDisplayInfoChanged * @deprecated Use {@link TelephonyCallback.DisplayInfoListener} instead. Loading Loading @@ -981,8 +984,12 @@ public class PhoneStateListener { * <p> The {@link TelephonyDisplayInfo} 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}). * For clients compiled on Android 11 SDK, requires permission: * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app has carrier * privileges (see {@link TelephonyManager#hasCarrierPrivileges}). * For clients compiled on Android 12 SDK or newer, * {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges is not required * anymore. * * @param telephonyDisplayInfo The display information. * @deprecated Use {@link TelephonyCallback.DisplayInfoListener} instead. Loading
core/java/android/telephony/TelephonyCallback.java +0 −1 Original line number Diff line number Diff line Loading @@ -1057,7 +1057,6 @@ public class TelephonyCallback { * * @param telephonyDisplayInfo The display information. */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onDisplayInfoChanged(@NonNull TelephonyDisplayInfo telephonyDisplayInfo); } Loading
services/core/java/com/android/server/TelephonyRegistry.java +9 −7 Original line number Diff line number Diff line Loading @@ -366,11 +366,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { || events.contains(TelephonyCallback.EVENT_BARRING_INFO_CHANGED); } private boolean isPhoneStatePermissionRequired(Set<Integer> events) { private boolean isPhoneStatePermissionRequired(Set<Integer> events, int targetSdk) { return events.contains(TelephonyCallback.EVENT_CALL_FORWARDING_INDICATOR_CHANGED) || events.contains(TelephonyCallback.EVENT_MESSAGE_WAITING_INDICATOR_CHANGED) || events.contains(TelephonyCallback.EVENT_EMERGENCY_NUMBER_LIST_CHANGED) || events.contains(TelephonyCallback.EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED); || events.contains(TelephonyCallback.EVENT_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGED) || (targetSdk <= android.os.Build.VERSION_CODES.R ? events.contains( TelephonyCallback.EVENT_DISPLAY_INFO_CHANGED) : false); } private boolean isPrecisePhoneStatePermissionRequired(Set<Integer> events) { Loading Loading @@ -882,12 +884,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(callback.asBinder()); return; } int callerTargetSdk = TelephonyPermissions.getTargetSdk(mContext, callingPackage); // Checks permission and throws SecurityException for disallowed operations. For pre-M // apps whose runtime permission has been revoked, we return immediately to skip sending // events to the app without crashing it. if (!checkListenerPermission(events, subId, callingPackage, callingFeatureId, "listen")) { "listen", callerTargetSdk)) { return; } Loading Loading @@ -920,7 +922,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } r.phoneId = phoneId; r.eventList = events; r.targetSdk = TelephonyPermissions.getTargetSdk(mContext, callingPackage); r.targetSdk = callerTargetSdk; if (DBG) { log("listen: Register r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId); Loading Loading @@ -2876,7 +2878,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } private boolean checkListenerPermission(Set<Integer> events, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { @Nullable String callingFeatureId, String message, int targetSdk) { LocationAccessPolicy.LocationPermissionQuery.Builder locationQueryBuilder = new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) Loading Loading @@ -2912,7 +2914,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } if (isPhoneStatePermissionRequired(events)) { if (isPhoneStatePermissionRequired(events, targetSdk)) { if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState( mContext, subId, callingPackage, callingFeatureId, message)) { isPermissionCheckSuccessful = false; Loading