From 744d5a465091511cbf2633f23e8fcad8fc55a03a Mon Sep 17 00:00:00 2001 From: Gil Cukierman Date: Mon, 3 Oct 2022 21:30:10 +0000 Subject: [PATCH] Update TelephonyManager.setAllowedNetworkTypeForReason Docs Test: N/A Bug: 245322623 Change-Id: I26ca0d0cadf467b02db5f63f0ce66a72afa18fa9 --- .../java/android/telephony/TelephonyManager.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index a081bc3209216..3b376fb4c6055 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -9409,12 +9409,13 @@ public class TelephonyManager { /** * Set the allowed network types of the device and provide the reason triggering the allowed * network change. - *

Requires permission: android.Manifest.MODIFY_PHONE_STATE or + *

Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} or * that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * - * This can be called for following reasons + * This can be called for following reasons: *

    - *
  1. Allowed network types control by USER {@link #ALLOWED_NETWORK_TYPES_REASON_USER} + *
  2. Allowed network types control by USER + * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER} *
  3. Allowed network types control by carrier {@link #ALLOWED_NETWORK_TYPES_REASON_CARRIER} *
* This API will result in allowing an intersection of allowed network types for all reasons, @@ -9424,7 +9425,13 @@ public class TelephonyManager { * @param allowedNetworkTypes The bitmask of allowed network type * @throws IllegalStateException if the Telephony process is not currently available. * @throws IllegalArgumentException if invalid AllowedNetworkTypesReason is passed. - * @throws SecurityException if the caller does not have the required privileges + * @throws SecurityException if the caller does not have the required privileges or if the + * caller tries to use one of the following security-based reasons without + * {@link android.Manifest.permission#MODIFY_PHONE_STATE} permissions. + *
    + *
  1. {@code TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G}
  2. + *
  3. {@code TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER_RESTRICTIONS}
  4. + *
*/ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresFeature(