Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 124b3d1b authored by Parth Sane's avatar Parth Sane
Browse files

Remove Service Manager Cache in Java

There is now a service manager cache that
is implemented in libbinder.

Flag: android.server.Flags.removeJavaServiceManagerCache
Bug: 333854840
Test: atest binderCacheUnitTest
Change-Id: Ie5011238a770e6cdc525910cafbb3856569d9210
parent 12eee8d5
Loading
Loading
Loading
Loading
+29 −20
Original line number Diff line number Diff line
@@ -2859,9 +2859,12 @@ public class ActivityManagerService extends IActivityManager.Stub
        if (isolated) {
            if (mIsolatedAppBindArgs == null) {
                mIsolatedAppBindArgs = new ArrayMap<>(1);
                // See b/79378449 about the following exemption.
                addServiceToMap(mIsolatedAppBindArgs, "package");
                if (!android.server.Flags.removeJavaServiceManagerCache()) {
                    addServiceToMap(mIsolatedAppBindArgs, "permissionmgr");
                }
            }
            return mIsolatedAppBindArgs;
        }
@@ -2871,9 +2874,8 @@ 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.
            addServiceToMap(mAppBindArgs, "package");
            if (!android.server.Flags.removeJavaServiceManagerCache()) {
                addServiceToMap(mAppBindArgs, "permissionmgr");
            addServiceToMap(mAppBindArgs, Context.WINDOW_SERVICE);
                addServiceToMap(mAppBindArgs, Context.ALARM_SERVICE);
                addServiceToMap(mAppBindArgs, Context.DISPLAY_SERVICE);
                addServiceToMap(mAppBindArgs, Context.NETWORKMANAGEMENT_SERVICE);
@@ -2893,6 +2895,13 @@ public class ActivityManagerService extends IActivityManager.Stub
                addServiceToMap(mAppBindArgs, "mount");
                addServiceToMap(mAppBindArgs, Context.PLATFORM_COMPAT_SERVICE);
            }
            // See b/79378449
            // Getting the window service and package service binder from servicemanager
            // is blocked for Apps. However they are necessary for apps.
            // TODO: remove exception
            addServiceToMap(mAppBindArgs, "package");
            addServiceToMap(mAppBindArgs, Context.WINDOW_SERVICE);
        }
        return mAppBindArgs;
    }
+8 −0
Original line number Diff line number Diff line
@@ -9,6 +9,14 @@ flag {
     bug: "324153471"
}

flag {
    name: "remove_java_service_manager_cache"
    namespace: "system_performance"
    description: "This flag turns off Java's Service Manager caching mechanism."
    bug: "333854840"
    is_fixed_read_only: true
}

flag {
     name: "remove_text_service"
     namespace: "wear_frameworks"