Telephony: do not use hidden API

Bug: 137202333
Test: make
Change-Id: Id0177c9c82d7831d165650c96a3cdea0566a6e2f
This commit is contained in:
Meng Wang
2020-01-27 17:53:16 -08:00
parent f83559781f
commit f77ad42dc6
2 changed files with 16 additions and 15 deletions

View File

@@ -1295,17 +1295,6 @@ public final class Telephony {
public static final String ACTION_EXTERNAL_PROVIDER_CHANGE =
"android.provider.action.EXTERNAL_PROVIDER_CHANGE";
/**
* Same as {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} but it's implicit (e.g. sent to
* all apps) and requires
* {@link android.Manifest.permission#MONITOR_DEFAULT_SMS_PACKAGE} to receive.
*
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL =
"android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL";
/**
* Broadcast action: When SMS-MMS db is being created. If file-based encryption is
* supported, this broadcast indicates creation of the db in credential-encrypted

View File

@@ -666,10 +666,22 @@ public final class SmsApplication {
}
}
/**
* Broadcast action:
* Same as {@link Intent#ACTION_DEFAULT_SMS_PACKAGE_CHANGED} but it's implicit (e.g. sent to
* all apps) and requires
* {@link #PERMISSION_MONITOR_DEFAULT_SMS_PACKAGE} to receive.
*/
public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL =
"android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL";
public static final String PERMISSION_MONITOR_DEFAULT_SMS_PACKAGE =
"android.permission.MONITOR_DEFAULT_SMS_PACKAGE";
/**
* Sends broadcasts on sms app change:
* {@link Intent#ACTION_DEFAULT_SMS_PACKAGE_CHANGED}
* {@link Intents.ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL}
* {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL}
*/
public static void broadcastSmsAppChange(Context context,
UserHandle userHandle, @Nullable String oldPackage, @Nullable String newPackage) {
@@ -719,11 +731,11 @@ public final class SmsApplication {
}
// Send an implicit broadcast for the system server.
// (or anyone with MONITOR_DEFAULT_SMS_PACKAGE, really.)
// (or anyone with PERMISSION_MONITOR_DEFAULT_SMS_PACKAGE, really.)
final Intent intent =
new Intent(Intents.ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL);
new Intent(ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL);
context.sendBroadcastAsUser(intent, userHandle,
permission.MONITOR_DEFAULT_SMS_PACKAGE);
PERMISSION_MONITOR_DEFAULT_SMS_PACKAGE);
}
/**