Expose resetAllCellBroadcastRanges and permission

Bug: 173335320
Test: manually verify API works from app
Change-Id: I1f8b24765d22d3e78f0cf43d04fabcd5e9fd24a3
This commit is contained in:
Jordan Liu
2020-11-30 15:00:37 -08:00
parent 801e409784
commit d5b1498fae
5 changed files with 10 additions and 12 deletions

View File

@@ -10717,6 +10717,7 @@ package android.telephony {
method public boolean disableCellBroadcastRange(int, int, int);
method public boolean enableCellBroadcastRange(int, int, int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getPremiumSmsConsent(@NonNull String);
method @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) public void resetAllCellBroadcastRanges();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPremiumSmsConsent(@NonNull String, int);
field public static final int PREMIUM_SMS_CONSENT_ALWAYS_ALLOW = 3; // 0x3

View File

@@ -1536,7 +1536,8 @@
<permission android:name="android.permission.BIND_DIRECTORY_SEARCH"
android:protectionLevel="signature|privileged" />
<!-- @SystemApi @hide Allows an application to modify cell broadcasts through the content provider.
<!-- @SystemApi @hide Allows an application to modify the cell broadcasts configuration
(i.e. enable or disable channels).
<p>Not for use by third-party applications. -->
<permission android:name="android.permission.MODIFY_CELL_BROADCASTS"
android:protectionLevel="signature|privileged" />

View File

@@ -19,6 +19,7 @@
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
<permission name="android.permission.MANAGE_USERS"/>
<permission name="android.permission.MODIFY_PHONE_STATE"/>
<permission name="android.permission.MODIFY_CELL_BROADCASTS"/>
<permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
<permission name="android.permission.RECEIVE_EMERGENCY_BROADCAST"/>
<permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>

View File

@@ -49,6 +49,7 @@ applications that come with the platform
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
<permission name="android.permission.MANAGE_USERS"/>
<permission name="android.permission.MODIFY_PHONE_STATE"/>
<permission name="android.permission.MODIFY_CELL_BROADCASTS"/>
<permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
<permission name="android.permission.RECEIVE_EMERGENCY_BROADCAST"/>
<permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>

View File

@@ -3134,26 +3134,20 @@ public final class SmsManager {
/**
* Reset all cell broadcast ranges. Previously enabled ranges will become invalid after this.
*
* @return {@code true} if succeeded, otherwise {@code false}.
*
* // TODO: Unhide the API in S.
* @hide
*/
public boolean resetAllCellBroadcastRanges() {
boolean success = false;
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS)
public void resetAllCellBroadcastRanges() {
try {
ISms iSms = getISmsService();
if (iSms != null) {
// If getSubscriptionId() returns INVALID or an inactive subscription, we will use
// the default phone internally.
success = iSms.resetAllCellBroadcastRanges(getSubscriptionId());
iSms.resetAllCellBroadcastRanges(getSubscriptionId());
}
} catch (RemoteException ex) {
// ignore it
ex.rethrowFromSystemServer();
}
return success;
}
}