Loading core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -44905,7 +44905,7 @@ package android.telephony { method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle); method public boolean isWorldPhone(); method @Deprecated public void listen(android.telephony.PhoneStateListener, int); method @RequiresPermission(android.Manifest.permission.READ_BASIC_PHONE_STATE) public void purchasePremiumCapability(int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(allOf={android.Manifest.permission.READ_BASIC_PHONE_STATE, android.Manifest.permission.INTERNET}) public void purchasePremiumCapability(int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void rebootModem(); method public void registerTelephonyCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback); method public void registerTelephonyCallback(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback); Loading Loading @@ -45086,7 +45086,7 @@ package android.telephony { field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_FEATURE_NOT_SUPPORTED = 10; // 0xa field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NETWORK_NOT_AVAILABLE = 12; // 0xc field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA_SUBSCRIPTION = 14; // 0xe field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN = 5; // 0x5 field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND = 5; // 0x5 field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_PENDING_NETWORK_SETUP = 15; // 0xf field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_REQUEST_FAILED = 11; // 0xb field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_SUCCESS = 1; // 0x1 telephony/common/com/android/internal/telephony/TelephonyPermissions.java +15 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,21 @@ public final class TelephonyPermissions { } } /** * Check whether the caller (or self, if not processing an IPC) has internet permission. * @param context app context * @param message detail message * @return true if permission is granted, else false */ public static boolean checkInternetPermissionNoThrow(Context context, String message) { try { context.enforcePermission(Manifest.permission.INTERNET, Binder.getCallingPid(), Binder.getCallingUid(), message); return true; } catch (SecurityException se) { return false; } } /** * Check whether the caller (or self, if not processing an IPC) has non dangerous Loading telephony/java/android/telephony/TelephonyManager.java +11 −14 Original line number Diff line number Diff line Loading @@ -17294,8 +17294,6 @@ public class TelephonyManager { * If displaying the performance boost notification is throttled, it will be for the amount of * time specified by {@link CarrierConfigManager * #KEY_PREMIUM_CAPABILITY_NOTIFICATION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG}. * If a foreground application requests premium capabilities, the performance boost notification * will be displayed to the user regardless of the throttled status. * We will show the performance boost notification to the user up to the daily and monthly * maximum number of times specified by * {@link CarrierConfigManager#KEY_PREMIUM_CAPABILITY_MAXIMUM_DAILY_NOTIFICATION_COUNT_INT} and Loading @@ -17319,14 +17317,11 @@ public class TelephonyManager { public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS = 4; /** * Purchase premium capability failed because a foreground application requested the same * capability. The notification for the current application will be dismissed and a new * notification will be displayed to the user for the foreground application. * Subsequent attempts will return * {@link #PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS} until the foreground * application's request is completed. * Purchase premium capability failed because the requesting application is not in the * foreground. Subsequent attempts will return the same error until the requesting application * moves to the foreground. */ public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN = 5; public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND = 5; /** * Purchase premium capability failed because the user canceled the operation. Loading Loading @@ -17423,7 +17418,7 @@ public class TelephonyManager { PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED, PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED, PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS, PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN, PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND, PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_CANCELED, PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_DISABLED, PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_ERROR, Loading Loading @@ -17453,8 +17448,8 @@ public class TelephonyManager { return "ALREADY_PURCHASED"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS: return "ALREADY_IN_PROGRESS"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN: return "OVERRIDDEN"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND: return "NOT_FOREGROUND"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_CANCELED: return "USER_CANCELED"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_DISABLED: Loading Loading @@ -17491,10 +17486,12 @@ public class TelephonyManager { * @param executor The callback executor for the response. * @param callback The result of the purchase request. * One of {@link PurchasePremiumCapabilityResult}. * @throws SecurityException if the caller does not hold permission READ_BASIC_PHONE_STATE. * @throws SecurityException if the caller does not hold permissions * READ_BASIC_PHONE_STATE or INTERNET. * @see #isPremiumCapabilityAvailableForPurchase(int) to check whether the capability is valid. */ @RequiresPermission(android.Manifest.permission.READ_BASIC_PHONE_STATE) @RequiresPermission(allOf = {android.Manifest.permission.READ_BASIC_PHONE_STATE, android.Manifest.permission.INTERNET}) public void purchasePremiumCapability(@PremiumCapability int capability, @NonNull @CallbackExecutor Executor executor, @NonNull @PurchasePremiumCapabilityResult Consumer<Integer> callback) { Loading
core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -44905,7 +44905,7 @@ package android.telephony { method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle); method public boolean isWorldPhone(); method @Deprecated public void listen(android.telephony.PhoneStateListener, int); method @RequiresPermission(android.Manifest.permission.READ_BASIC_PHONE_STATE) public void purchasePremiumCapability(int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(allOf={android.Manifest.permission.READ_BASIC_PHONE_STATE, android.Manifest.permission.INTERNET}) public void purchasePremiumCapability(int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void rebootModem(); method public void registerTelephonyCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback); method public void registerTelephonyCallback(int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback); Loading Loading @@ -45086,7 +45086,7 @@ package android.telephony { field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_FEATURE_NOT_SUPPORTED = 10; // 0xa field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NETWORK_NOT_AVAILABLE = 12; // 0xc field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_DEFAULT_DATA_SUBSCRIPTION = 14; // 0xe field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN = 5; // 0x5 field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND = 5; // 0x5 field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_PENDING_NETWORK_SETUP = 15; // 0xf field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_REQUEST_FAILED = 11; // 0xb field public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_SUCCESS = 1; // 0x1
telephony/common/com/android/internal/telephony/TelephonyPermissions.java +15 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,21 @@ public final class TelephonyPermissions { } } /** * Check whether the caller (or self, if not processing an IPC) has internet permission. * @param context app context * @param message detail message * @return true if permission is granted, else false */ public static boolean checkInternetPermissionNoThrow(Context context, String message) { try { context.enforcePermission(Manifest.permission.INTERNET, Binder.getCallingPid(), Binder.getCallingUid(), message); return true; } catch (SecurityException se) { return false; } } /** * Check whether the caller (or self, if not processing an IPC) has non dangerous Loading
telephony/java/android/telephony/TelephonyManager.java +11 −14 Original line number Diff line number Diff line Loading @@ -17294,8 +17294,6 @@ public class TelephonyManager { * If displaying the performance boost notification is throttled, it will be for the amount of * time specified by {@link CarrierConfigManager * #KEY_PREMIUM_CAPABILITY_NOTIFICATION_BACKOFF_HYSTERESIS_TIME_MILLIS_LONG}. * If a foreground application requests premium capabilities, the performance boost notification * will be displayed to the user regardless of the throttled status. * We will show the performance boost notification to the user up to the daily and monthly * maximum number of times specified by * {@link CarrierConfigManager#KEY_PREMIUM_CAPABILITY_MAXIMUM_DAILY_NOTIFICATION_COUNT_INT} and Loading @@ -17319,14 +17317,11 @@ public class TelephonyManager { public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS = 4; /** * Purchase premium capability failed because a foreground application requested the same * capability. The notification for the current application will be dismissed and a new * notification will be displayed to the user for the foreground application. * Subsequent attempts will return * {@link #PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS} until the foreground * application's request is completed. * Purchase premium capability failed because the requesting application is not in the * foreground. Subsequent attempts will return the same error until the requesting application * moves to the foreground. */ public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN = 5; public static final int PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND = 5; /** * Purchase premium capability failed because the user canceled the operation. Loading Loading @@ -17423,7 +17418,7 @@ public class TelephonyManager { PURCHASE_PREMIUM_CAPABILITY_RESULT_THROTTLED, PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_PURCHASED, PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS, PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN, PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND, PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_CANCELED, PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_DISABLED, PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_ERROR, Loading Loading @@ -17453,8 +17448,8 @@ public class TelephonyManager { return "ALREADY_PURCHASED"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_ALREADY_IN_PROGRESS: return "ALREADY_IN_PROGRESS"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_OVERRIDDEN: return "OVERRIDDEN"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_NOT_FOREGROUND: return "NOT_FOREGROUND"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_CANCELED: return "USER_CANCELED"; case PURCHASE_PREMIUM_CAPABILITY_RESULT_CARRIER_DISABLED: Loading Loading @@ -17491,10 +17486,12 @@ public class TelephonyManager { * @param executor The callback executor for the response. * @param callback The result of the purchase request. * One of {@link PurchasePremiumCapabilityResult}. * @throws SecurityException if the caller does not hold permission READ_BASIC_PHONE_STATE. * @throws SecurityException if the caller does not hold permissions * READ_BASIC_PHONE_STATE or INTERNET. * @see #isPremiumCapabilityAvailableForPurchase(int) to check whether the capability is valid. */ @RequiresPermission(android.Manifest.permission.READ_BASIC_PHONE_STATE) @RequiresPermission(allOf = {android.Manifest.permission.READ_BASIC_PHONE_STATE, android.Manifest.permission.INTERNET}) public void purchasePremiumCapability(@PremiumCapability int capability, @NonNull @CallbackExecutor Executor executor, @NonNull @PurchasePremiumCapabilityResult Consumer<Integer> callback) {