From 30f8af250315727e3cb02c3d0d2492abe6e8e341 Mon Sep 17 00:00:00 2001 From: Jiakai Zhang Date: Wed, 16 Nov 2022 18:32:57 +0000 Subject: [PATCH 1/2] Register ArtModuleServiceManager on system server initialization. Bug: 233915142 Test: adb shell pm art get-optimization-status com.google.android.youtube Change-Id: I4e410e6ca47f70959e9c56f05d51d30d66735d8d --- services/java/com/android/server/SystemServer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 433c170cfc923..6082b20c57d5f 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -55,6 +55,7 @@ import android.hardware.display.DisplayManagerInternal; import android.net.ConnectivityManager; import android.net.ConnectivityModuleConnector; import android.net.NetworkStackClient; +import android.os.ArtModuleServiceManager; import android.os.BaseBundle; import android.os.Binder; import android.os.Build; @@ -108,6 +109,7 @@ import com.android.server.am.ActivityManagerService; import com.android.server.ambientcontext.AmbientContextManagerService; import com.android.server.appbinding.AppBindingService; import com.android.server.art.ArtManagerLocal; +import com.android.server.art.ArtModuleServiceInitializer; import com.android.server.attention.AttentionManagerService; import com.android.server.audio.AudioService; import com.android.server.biometrics.AuthService; @@ -2712,6 +2714,7 @@ public final class SystemServer implements Dumpable { t.traceEnd(); t.traceBegin("ArtManagerLocal"); + ArtModuleServiceInitializer.setArtModuleServiceManager(new ArtModuleServiceManager()); LocalManagerRegistry.addManager(ArtManagerLocal.class, new ArtManagerLocal(context)); t.traceEnd(); From c39c0be88fb6d2ce34d78f19cc988079c131dd19 Mon Sep 17 00:00:00 2001 From: Jiakai Zhang Date: Wed, 16 Nov 2022 18:41:23 +0000 Subject: [PATCH 2/2] Revert "Expose ServiceManager.waitForService as system API." This reverts commit ee13e8d435ec3abe821118827226db47e1d7fe53. Reason for revert: As discussed in b/233915142, an API that can obtain an arbitrary binder should not be exposed, and mainline modules should generally follow go/android-api-guidelines#the-moduleservicemanager-pattern. Bug: 233915142 Test: Presubmit Change-Id: I67e6e177d48ed213306aa0c10f83fe3b670daf1d --- core/api/module-lib-current.txt | 1 - core/java/android/os/ServiceManager.java | 2 -- 2 files changed, 3 deletions(-) diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt index 07af1d5f1634c..b6e2d2a3e98bb 100644 --- a/core/api/module-lib-current.txt +++ b/core/api/module-lib-current.txt @@ -360,7 +360,6 @@ package android.os { method @NonNull public static String[] getDeclaredInstances(@NonNull String); method public static boolean isDeclared(@NonNull String); method @Nullable public static android.os.IBinder waitForDeclaredService(@NonNull String); - method @Nullable public static android.os.IBinder waitForService(@NonNull String); } public class StatsServiceManager { diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java index b6ff102b00b13..9ea42780981d9 100644 --- a/core/java/android/os/ServiceManager.java +++ b/core/java/android/os/ServiceManager.java @@ -278,8 +278,6 @@ public final class ServiceManager { * @return {@code null} only if there are permission problems or fatal errors. * @hide */ - @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) - @Nullable public static IBinder waitForService(@NonNull String name) { return Binder.allowBlocking(waitForServiceNative(name)); }