diff options
author | Ted Bauer <tedbauer@google.com> | 2024-02-08 14:21:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2024-02-08 14:21:01 +0000 |
commit | 5229cf26476b19103bffdffc9176af28123399de (patch) | |
tree | 8175727024386987debe62c1a3fb8bf55c991657 /service/java/com/android/server | |
parent | e6a5a4a92145207e3b3c1a6cc3f96a18953dab88 (diff) | |
parent | 69a31199024f510fad002c826337c87d2f7f0cfc (diff) | |
download | ConfigInfrastructure-5229cf26476b19103bffdffc9176af28123399de.tar.gz |
Merge "Only schedule a reboot the night after an OTA." into main
Diffstat (limited to 'service/java/com/android/server')
-rw-r--r-- | service/java/com/android/server/deviceconfig/DeviceConfigInit.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/service/java/com/android/server/deviceconfig/DeviceConfigInit.java b/service/java/com/android/server/deviceconfig/DeviceConfigInit.java index b1ed0d6..4a561b9 100644 --- a/service/java/com/android/server/deviceconfig/DeviceConfigInit.java +++ b/service/java/com/android/server/deviceconfig/DeviceConfigInit.java @@ -41,6 +41,12 @@ public class DeviceConfigInit { private static final String SYSTEM_EXT_FLAGS_PATH = "/system_ext/etc/aconfig_flags.pb"; private static final String VENDOR_FLAGS_PATH = "/vendor/etc/aconfig_flags.pb"; + private static final String CONFIGURATION_NAMESPACE = "configuration"; + private static final String BOOT_NOTIFICATION_FLAG = + "ConfigInfraFlags__enable_boot_notification"; + private static final String UNATTENDED_REBOOT_FLAG = + "ConfigInfraFlags__enable_unattended_reboot"; + private DeviceConfigInit() { // do not instantiate } @@ -69,7 +75,9 @@ public class DeviceConfigInit { */ @Override public void onStart() { - if (enableRebootNotification()) { + boolean notificationEnabled = + DeviceConfig.getBoolean(CONFIGURATION_NAMESPACE, BOOT_NOTIFICATION_FLAG, false); + if (notificationEnabled && enableRebootNotification()) { Map<String, Set<String>> aconfigFlags = new HashMap<>(); try { addAconfigFlagsFromFile(aconfigFlags, SYSTEM_FLAGS_PATH); @@ -89,7 +97,14 @@ public class DeviceConfigInit { notifCreator); } - if (enableUnattendedReboot()) { + boolean unattendedRebootEnabled = + DeviceConfig.getBoolean(CONFIGURATION_NAMESPACE, UNATTENDED_REBOOT_FLAG, false); + if (unattendedRebootEnabled && enableUnattendedReboot()) { + // Only schedule a reboot if this is the first boot since an OTA. + if (!getContext().getPackageManager().isDeviceUpgrading()) { + return; + } + mUnattendedRebootManager = new UnattendedRebootManager(getContext().getApplicationContext()); getContext() |