diff options
author | 2024-11-26 18:44:20 +0000 | |
---|---|---|
committer | 2024-12-04 22:30:24 +0000 | |
commit | 46f44cebc7f9a122a66e8b31834aaf8f8ba9a80e (patch) | |
tree | f6562132ae86d1b1c40d77c13d80e34f08461ebd /services | |
parent | c8b00c8aea04c1db4d30cfddb35b36367d3e08ca (diff) |
Fix hidden API usages to alternative API usages
After moving the code to mainline module, all interactions from
platform should be via APIs or relevant util classes cloned and
jarjar'd within the module.
This change moves such usages to existing APIs or makes a module-utils
copy of such classes to be used independantly in the module.
Flag: build.release_ondevice_intelligence_module
Bug: 376427781
Change-Id: I5bc5fa5b7e2e2ba2899b4cbba536103d66a6aa19
Diffstat (limited to 'services')
-rw-r--r-- | services/Android.bp | 30 | ||||
-rw-r--r-- | services/core/Android.bp | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/pm/ComputerEngine.java | 11 | ||||
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 5 | ||||
-rw-r--r-- | services/proguard.flags | 3 |
5 files changed, 43 insertions, 7 deletions
diff --git a/services/Android.bp b/services/Android.bp index fc0bb33e6e4e..a7cb9bb9af24 100644 --- a/services/Android.bp +++ b/services/Android.bp @@ -210,6 +210,35 @@ crashrecovery_java_defaults { }, } +soong_config_module_type { + name: "ondeviceintelligence_module_java_defaults", + module_type: "java_defaults", + config_namespace: "ANDROID", + bool_variables: [ + "release_ondevice_intelligence_module", + "release_ondevice_intelligence_platform", + ], + properties: [ + "libs", + "srcs", + "static_libs", + ], +} + +// Conditionally add ondeviceintelligence stubs library +ondeviceintelligence_module_java_defaults { + name: "ondeviceintelligence_conditionally", + soong_config_variables: { + release_ondevice_intelligence_module: { + libs: ["service-ondeviceintelligence.stubs.system_server"], + }, + release_ondevice_intelligence_platform: { + srcs: [":service-ondeviceintelligence-sources"], + static_libs: ["modules-utils-backgroundthread"], + }, + }, +} + // merge all required services into one jar // ============================================================ soong_config_module_type { @@ -236,6 +265,7 @@ system_java_library { "services_java_defaults", "art_profile_java_defaults", "services_crashrecovery_stubs_conditionally", + "ondeviceintelligence_conditionally", ], installable: true, diff --git a/services/core/Android.bp b/services/core/Android.bp index ffa259b536ec..371306f38a24 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -127,6 +127,7 @@ java_library_static { "android.hardware.power-java_shared", "latest_android_hardware_broadcastradio_java_static", "services_crashrecovery_stubs_conditionally", + "ondeviceintelligence_conditionally", ], srcs: [ ":android.hardware.tv.hdmi.connection-V1-java-source", diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java index 58b1e496f5f1..be2f58dc276c 100644 --- a/services/core/java/com/android/server/pm/ComputerEngine.java +++ b/services/core/java/com/android/server/pm/ComputerEngine.java @@ -138,7 +138,8 @@ import com.android.internal.util.CollectionUtils; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; import com.android.modules.utils.TypedXmlSerializer; -import com.android.server.ondeviceintelligence.OnDeviceIntelligenceManagerInternal; +import com.android.server.LocalManagerRegistry; +import com.android.server.ondeviceintelligence.OnDeviceIntelligenceManagerLocal; import com.android.server.pm.dex.DexManager; import com.android.server.pm.dex.PackageDexUsage; import com.android.server.pm.parsing.PackageInfoUtils; @@ -5851,10 +5852,10 @@ public class ComputerEngine implements Computer { if (isHotword) { return true; } - OnDeviceIntelligenceManagerInternal onDeviceIntelligenceManagerInternal = - mInjector.getLocalService(OnDeviceIntelligenceManagerInternal.class); - return onDeviceIntelligenceManagerInternal != null - && uid == onDeviceIntelligenceManagerInternal.getInferenceServiceUid(); + OnDeviceIntelligenceManagerLocal onDeviceIntelligenceManagerLocal = + LocalManagerRegistry.getManager(OnDeviceIntelligenceManagerLocal.class); + return onDeviceIntelligenceManagerLocal != null + && uid == onDeviceIntelligenceManagerLocal.getInferenceServiceUid(); } @Nullable diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index aa63c4a4a91f..65315af45486 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -201,7 +201,6 @@ import com.android.server.net.watchlist.NetworkWatchlistService; import com.android.server.notification.NotificationManagerService; import com.android.server.oemlock.OemLockService; import com.android.server.om.OverlayManagerService; -import com.android.server.ondeviceintelligence.OnDeviceIntelligenceManagerService; import com.android.server.os.BugreportManagerService; import com.android.server.os.DeviceIdentifiersPolicyService; import com.android.server.os.NativeTombstoneManagerService; @@ -392,6 +391,8 @@ public final class SystemServer implements Dumpable { "com.android.server.sdksandbox.SdkSandboxManagerService$Lifecycle"; private static final String AD_SERVICES_MANAGER_SERVICE_CLASS = "com.android.server.adservices.AdServicesManagerService$Lifecycle"; + private static final String ON_DEVICE_INTELLIGENCE_MANAGER_SERVICE_CLASS = + "com.android.server.ondeviceintelligence.OnDeviceIntelligenceManagerService"; private static final String ON_DEVICE_PERSONALIZATION_SYSTEM_SERVICE_CLASS = "com.android.server.ondevicepersonalization." + "OnDevicePersonalizationSystemService$Lifecycle"; @@ -3453,7 +3454,7 @@ public final class SystemServer implements Dumpable { private void startOnDeviceIntelligenceService(TimingsTraceAndSlog t) { t.traceBegin("startOnDeviceIntelligenceManagerService"); - mSystemServiceManager.startService(OnDeviceIntelligenceManagerService.class); + mSystemServiceManager.startService(ON_DEVICE_INTELLIGENCE_MANAGER_SERVICE_CLASS); t.traceEnd(); } diff --git a/services/proguard.flags b/services/proguard.flags index 977bd19a7236..0e1f68e03d7d 100644 --- a/services/proguard.flags +++ b/services/proguard.flags @@ -44,6 +44,9 @@ -keep,allowoptimization,allowaccessmodification class com.android.server.input.NativeInputManagerService$NativeImpl { *; } -keep,allowoptimization,allowaccessmodification class com.android.server.ThreadPriorityBooster { *; } +# allow invoking start-service using class name in both apex and services jar. +-keep,allowoptimization,allowaccessmodification class com.android.server.ondeviceintelligence.OnDeviceIntelligenceManagerService { *; } + # Keep all aconfig Flag class as they might be statically referenced by other packages # An merge or inlining could lead to missing dependencies that cause run time errors -keepclassmembernames class android.**.Flags, com.android.**.Flags { public *; } |