Add support for time zone notifications
Add support for time zone notifications to RulesManagerService.
This change adds new intents that are broadcast after
a time zone rules update is staged / unstaged. This will allow
another component on the device to handle notifications telling
the user to restart the device.
Bug: 69443060
Test: atest FrameworksServicesTests
Test: Manual install
Change-Id: I4fc4b5715380d84d87cdb43c05aee2f8f9c5d277
diff --git a/core/java/android/app/timezone/RulesManager.java b/core/java/android/app/timezone/RulesManager.java
index 0a38eb9..dc79256 100644
--- a/core/java/android/app/timezone/RulesManager.java
+++ b/core/java/android/app/timezone/RulesManager.java
@@ -68,6 +68,23 @@
private static final String TAG = "timezone.RulesManager";
private static final boolean DEBUG = false;
+ /**
+ * The action of the intent that the Android system will broadcast when a time zone rules update
+ * operation has been successfully staged (i.e. to be applied next reboot) or unstaged.
+ *
+ * <p>See {@link #EXTRA_OPERATION_STAGED}
+ *
+ * <p>This is a protected intent that can only be sent by the system.
+ */
+ public static final String ACTION_RULES_UPDATE_OPERATION =
+ "com.android.intent.action.timezone.RULES_UPDATE_OPERATION";
+
+ /**
+ * The key for a boolean extra for the {@link #ACTION_RULES_UPDATE_OPERATION} intent used to
+ * indicate whether the operation was a "stage" or an "unstage".
+ */
+ public static final String EXTRA_OPERATION_STAGED = "staged";
+
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = { "SUCCESS", "ERROR_" }, value = {
SUCCESS,
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index e5ba6d7..0bfeae3 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -571,6 +571,10 @@
<protected-broadcast android:name="android.media.tv.action.CHANNEL_BROWSABLE_REQUESTED" />
<protected-broadcast android:name="com.android.server.InputMethodManagerService.SHOW_INPUT_METHOD_PICKER" />
+ <!-- Time zone rules update intents fired by the system server -->
+ <protected-broadcast android:name="com.android.intent.action.timezone.RULES_UPDATE_OPERATION" />
+ <protected-broadcast android:name="com.android.intent.action.timezone.TRIGGER_RULES_UPDATE_CHECK" />
+
<!-- Made protected in P (was introduced in JB-MR2) -->
<protected-broadcast android:name="android.intent.action.GET_RESTRICTION_ENTRIES" />
<protected-broadcast android:name="android.telephony.euicc.action.OTA_STATUS_CHANGED" />