From 2d1d89fbb5fdd54579de5716cf95759f5ac239fa Mon Sep 17 00:00:00 2001 From: Kevin Han Date: Tue, 2 Feb 2021 20:29:59 -0800 Subject: [PATCH] Register AppHibernationManager in service registry Put AppHibernationManager in the system service registry so that system apps can actually use it. Bug: 175829330 Test: builds Change-Id: I62a5bf7319615c86fbffa9344047903910095f78 --- core/java/android/app/SystemServiceRegistry.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 82e48bfb61a7a..fb9b2cfbab65a 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -43,6 +43,7 @@ import android.app.usage.IUsageStatsManager; import android.app.usage.NetworkStatsManager; import android.app.usage.StorageStatsManager; import android.app.usage.UsageStatsManager; +import android.apphibernation.AppHibernationManager; import android.appwidget.AppWidgetManager; import android.bluetooth.BluetoothManager; import android.companion.CompanionDeviceManager; @@ -1343,6 +1344,13 @@ public final class SystemServiceRegistry { IBinder b = ServiceManager.getServiceOrThrow(Context.APP_INTEGRITY_SERVICE); return new AppIntegrityManager(IAppIntegrityManager.Stub.asInterface(b)); }}); + registerService(Context.APP_HIBERNATION_SERVICE, AppHibernationManager.class, + new CachedServiceFetcher() { + @Override + public AppHibernationManager createService(ContextImpl ctx) { + IBinder b = ServiceManager.getService(Context.APP_HIBERNATION_SERVICE); + return b == null ? null : new AppHibernationManager(ctx); + }}); registerService(Context.DREAM_SERVICE, DreamManager.class, new CachedServiceFetcher() { @Override