summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Parth Sane <parthsane@google.com> 2024-10-24 12:57:23 +0000
committer Parth Sane <parthsane@google.com> 2024-10-25 08:49:03 +0000
commit33e0bcb0d8237a86e23ed4f0536c3058dacef0b4 (patch)
tree8d126ad14ab8384cdd87a4d0f856948fa82b2524
parent33517b07adefba61640e395abea2da96f32d0c1d (diff)
Keep Cache implementation for Android Auto
The removal of the cache breaks android auto tests test_mapping_presubmit_cloud_auto_car_services breaks because of SELinux rules. The cache circumvents this. Test: v2/aaos-engprod/test_mapping_presubmit_cloud_auto_car_services Bug: 333854840 Flag: android.server.Flags.removeJavaServiceManagerCache Change-Id: I420e718a4d8dc6f8e17652335997c31c310a406a
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f549c7b2d303..be53130778c5 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -2874,8 +2874,12 @@ public class ActivityManagerService extends IActivityManager.Stub
// Add common services.
// IMPORTANT: Before adding services here, make sure ephemeral apps can access them too.
// Enable the check in ApplicationThread.bindApplication() to make sure.
- if (!android.server.Flags.removeJavaServiceManagerCache()) {
- addServiceToMap(mAppBindArgs, "permissionmgr");
+
+ // Removing User Service and App Ops Service from cache breaks boot for auto.
+ // Removing permissionmgr breaks tests for Android Auto due to SELinux restrictions.
+ // TODO: fix SELinux restrictions and remove caching for Android Auto.
+ if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)
+ || !android.server.Flags.removeJavaServiceManagerCache()) {
addServiceToMap(mAppBindArgs, Context.ALARM_SERVICE);
addServiceToMap(mAppBindArgs, Context.DISPLAY_SERVICE);
addServiceToMap(mAppBindArgs, Context.NETWORKMANAGEMENT_SERVICE);
@@ -2892,16 +2896,16 @@ public class ActivityManagerService extends IActivityManager.Stub
addServiceToMap(mAppBindArgs, Context.POWER_SERVICE);
addServiceToMap(mAppBindArgs, "mount");
addServiceToMap(mAppBindArgs, Context.PLATFORM_COMPAT_SERVICE);
+ addServiceToMap(mAppBindArgs, "permissionmgr");
+ addServiceToMap(mAppBindArgs, Context.APP_OPS_SERVICE);
+ addServiceToMap(mAppBindArgs, Context.USER_SERVICE);
}
// See b/79378449
// Getting the window service and package service binder from servicemanager
// is blocked for Apps. However they are necessary for apps.
- // Removing User Service and App Ops Service from cache breaks boot for auto.
// TODO: remove exception
- addServiceToMap(mAppBindArgs, Context.APP_OPS_SERVICE);
addServiceToMap(mAppBindArgs, "package");
addServiceToMap(mAppBindArgs, Context.WINDOW_SERVICE);
- addServiceToMap(mAppBindArgs, Context.USER_SERVICE);
}
return mAppBindArgs;
}