diff options
| author | 2021-02-10 22:36:41 +0000 | |
|---|---|---|
| committer | 2021-02-18 19:37:16 +0000 | |
| commit | a6a206f3acfa6ab0449e6cd93c39b6a4779df6fa (patch) | |
| tree | cf824e54f309277b5a908f2a8bcb3e273c22f2bc | |
| parent | e114b8f4980020a525471787701d3934acebf115 (diff) | |
Add REBOOT_READY broadcast
Adds a new REBOOT_READY intent
which may be sent from the system server,
indicating the device's reboot-readiness state.
This broadcast will be sent with a boolean extra,
which will provide a positive or negative signal
of whether the device is ready to reboot. This
broadcast may only be received if the REBOOT
permission is held.
Test: atest CtsRebootReadinessTestCases
Bug: 161353402
Change-Id: I70fa1c35c844189af86c519749144732ceceaaac
| -rw-r--r-- | core/api/system-current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 2 | ||||
| -rw-r--r-- | core/java/android/content/Intent.java | 26 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 3 |
4 files changed, 32 insertions, 1 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 79c8035410e3..99cbd369b595 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -2185,6 +2185,7 @@ package android.content { field public static final String ACTION_PENDING_INCIDENT_REPORTS_CHANGED = "android.intent.action.PENDING_INCIDENT_REPORTS_CHANGED"; field public static final String ACTION_PRE_BOOT_COMPLETED = "android.intent.action.PRE_BOOT_COMPLETED"; field public static final String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART"; + field public static final String ACTION_REBOOT_READY = "android.intent.action.REBOOT_READY"; field public static final String ACTION_RESOLVE_INSTANT_APP_PACKAGE = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE"; field @RequiresPermission(android.Manifest.permission.REVIEW_ACCESSIBILITY_SERVICES) public static final String ACTION_REVIEW_ACCESSIBILITY_SERVICES = "android.intent.action.REVIEW_ACCESSIBILITY_SERVICES"; field @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) public static final String ACTION_REVIEW_ONGOING_PERMISSION_USAGE = "android.intent.action.REVIEW_ONGOING_PERMISSION_USAGE"; @@ -2208,6 +2209,7 @@ package android.content { field public static final String EXTRA_INSTANT_APP_HOSTNAME = "android.intent.extra.INSTANT_APP_HOSTNAME"; field public static final String EXTRA_INSTANT_APP_SUCCESS = "android.intent.extra.INSTANT_APP_SUCCESS"; field public static final String EXTRA_INSTANT_APP_TOKEN = "android.intent.extra.INSTANT_APP_TOKEN"; + field public static final String EXTRA_IS_READY_TO_REBOOT = "android.intent.extra.IS_READY_TO_REBOOT"; field public static final String EXTRA_LONG_VERSION_CODE = "android.intent.extra.LONG_VERSION_CODE"; field public static final String EXTRA_ORIGINATING_UID = "android.intent.extra.ORIGINATING_UID"; field public static final String EXTRA_PACKAGES = "android.intent.extra.PACKAGES"; diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 10b00f245d79..838ccab85e24 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -4753,7 +4753,7 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve an - * {@link android.app.scheduling.RebootReadinessManagerService} for communicating + * {@link android.scheduling.RebootReadinessManagerService} for communicating * with the reboot readiness detector. * * @see #getSystemService(String) diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 4abd8cd7d37b..d53d20a8b192 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -4754,6 +4754,32 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_PACKAGE_NEEDS_INTEGRITY_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_INTEGRITY_VERIFICATION"; + /** + * Broadcast Action: Indicates that the device's reboot readiness has changed. + * + * <p>This broadcast will be sent with an extra that indicates whether or not the device is + * ready to reboot. + * <p> + * The receiver <em>must</em> have the {@link android.Manifest.permission#REBOOT} permission. + * <p class="note"> + * This is a protected intent that can only be sent by the system. + * + * @see #EXTRA_IS_READY_TO_REBOOT + * @hide + */ + @SystemApi + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_REBOOT_READY = "android.intent.action.REBOOT_READY"; + + /** + * A boolean extra used with {@link #ACTION_REBOOT_READY} which indicates if the + * device is ready to reboot. + * Will be {@code true} if ready to reboot, {@code false} otherwise. + * @hide + */ + @SystemApi + public static final String EXTRA_IS_READY_TO_REBOOT = "android.intent.extra.IS_READY_TO_REBOOT"; + // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Standard intent categories (see addCategory()). diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index e268fde4b66d..eec3167fd898 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -690,6 +690,9 @@ <!-- Made protected in S (was added in R) --> <protected-broadcast android:name="com.android.internal.intent.action.BUGREPORT_REQUESTED" /> + <!-- Added in S --> + <protected-broadcast android:name="android.intent.action.REBOOT_READY" /> + <!-- ====================================================================== --> <!-- RUNTIME PERMISSIONS --> <!-- ====================================================================== --> |