From 1d94eb9ea5a0df475ba1acdf197a1cac173111b8 Mon Sep 17 00:00:00 2001 From: Gavin Corkery Date: Mon, 15 Feb 2021 20:23:11 +0000 Subject: [PATCH] Initialize RebootReadinessManagerService Initialize reboot readiness service from the system server. This service is started by calling into service-scheduling.jar directly. Test: Manual, add logs to check that service is correctly started. Bug: 161353402 Change-Id: I06d55ee6ee5c3dde7524cf508324fd408fb81d22 --- core/api/system-current.txt | 1 + core/java/android/app/SystemServiceRegistry.java | 2 ++ core/java/android/content/Context.java | 12 ++++++++++++ services/java/com/android/server/SystemServer.java | 10 ++++++++++ 4 files changed, 25 insertions(+) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index b261d92fead54..71c386fc20a3d 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -2120,6 +2120,7 @@ package android.content { field public static final String OEM_LOCK_SERVICE = "oem_lock"; field public static final String PERMISSION_SERVICE = "permission"; field public static final String PERSISTENT_DATA_BLOCK_SERVICE = "persistent_data_block"; + field public static final String REBOOT_READINESS_SERVICE = "reboot_readiness"; field public static final String ROLLBACK_SERVICE = "rollback"; field public static final String SEARCH_UI_SERVICE = "search_ui"; field public static final String SECURE_ELEMENT_SERVICE = "secure_element"; diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index c047fc21413d4..c47b546653b91 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -185,6 +185,7 @@ import android.permission.PermissionControllerManager; import android.permission.PermissionManager; import android.print.IPrintManager; import android.print.PrintManager; +import android.scheduling.SchedulingFrameworkInitializer; import android.security.FileIntegrityManager; import android.security.IFileIntegrityService; import android.service.oemlock.IOemLockService; @@ -1440,6 +1441,7 @@ public final class SystemServiceRegistry { MediaFrameworkPlatformInitializer.registerServiceWrappers(); MediaFrameworkInitializer.registerServiceWrappers(); RoleFrameworkInitializer.registerServiceWrappers(); + SchedulingFrameworkInitializer.registerServiceWrappers(); } finally { // If any of the above code throws, we're in a pretty bad shape and the process // will likely crash, but we'll reset it just in case there's an exception handler... diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 025d777f2053f..bd188bd002f25 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3520,6 +3520,7 @@ public abstract class Context { APPWIDGET_SERVICE, //@hide: VOICE_INTERACTION_MANAGER_SERVICE, //@hide: BACKUP_SERVICE, + REBOOT_READINESS_SERVICE, ROLLBACK_SERVICE, DROPBOX_SERVICE, //@hide: DEVICE_IDLE_CONTROLLER, @@ -4741,6 +4742,17 @@ public abstract class Context { @SystemApi public static final String ROLLBACK_SERVICE = "rollback"; + /** + * Use with {@link #getSystemService(String)} to retrieve an + * {@link android.app.scheduling.RebootReadinessManagerService} for communicating + * with the reboot readiness detector. + * + * @see #getSystemService(String) + * @hide + */ + @SystemApi + public static final String REBOOT_READINESS_SERVICE = "reboot_readiness"; + /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.os.DropBoxManager} instance for recording diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 3f47227086c98..3854f4bd75edd 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -252,6 +252,10 @@ public final class SystemServer implements Dumpable { "com.android.server.companion.CompanionDeviceManagerService"; private static final String STATS_COMPANION_APEX_PATH = "/apex/com.android.os.statsd/javalib/service-statsd.jar"; + private static final String SCHEDULING_APEX_PATH = + "/apex/com.android.scheduling/javalib/service-scheduling.jar"; + private static final String REBOOT_READINESS_LIFECYCLE_CLASS = + "com.android.server.scheduling.RebootReadinessManagerService$Lifecycle"; private static final String CONNECTIVITY_SERVICE_APEX_PATH = "/apex/com.android.tethering/javalib/service-connectivity.jar"; private static final String STATS_COMPANION_LIFECYCLE_CLASS = @@ -2446,6 +2450,12 @@ public final class SystemServer implements Dumpable { STATS_COMPANION_LIFECYCLE_CLASS, STATS_COMPANION_APEX_PATH); t.traceEnd(); + // Reboot Readiness + t.traceBegin("StartRebootReadinessManagerService"); + mSystemServiceManager.startServiceFromJar( + REBOOT_READINESS_LIFECYCLE_CLASS, SCHEDULING_APEX_PATH); + t.traceEnd(); + // Statsd pulled atoms t.traceBegin("StartStatsPullAtomService"); mSystemServiceManager.startService(STATS_PULL_ATOM_SERVICE_CLASS);