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

Commit fbde6672 authored by Shai Barack's avatar Shai Barack
Browse files

Intern package names in AppOpsService

This is a performance optimization that should save ~0.5MB of RAM in system_server.

Bug: 368823744
Change-Id: I09116356df145ca31dbc6049bd8e7734dfcdb24e
Flag: EXEMPT bugfix
parent 49cce06b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -619,7 +619,7 @@ public class AppOpsService extends IAppOpsService.Stub {
            this.op = op;
            this.uid = uid;
            this.uidState = uidState;
            this.packageName = packageName;
            this.packageName = packageName.intern();
            // We keep an invariant that the persistent device will always have an entry in
            // mDeviceAttributedOps.
            mDeviceAttributedOps.put(PERSISTENT_DEVICE_ID_DEFAULT,
@@ -1031,7 +1031,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            String pkgName = intent.getData().getEncodedSchemeSpecificPart();
            String pkgName = intent.getData().getEncodedSchemeSpecificPart().intern();
            int uid = intent.getIntExtra(Intent.EXTRA_UID, Process.INVALID_UID);

            if (action.equals(ACTION_PACKAGE_ADDED)
@@ -1235,7 +1235,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        Ops ops = uidState.pkgOps.get(packageName);
        if (ops == null) {
            ops = new Ops(packageName, uidState);
            uidState.pkgOps.put(packageName, ops);
            uidState.pkgOps.put(packageName.intern(), ops);
        }

        SparseIntArray packageModes =
@@ -4739,7 +4739,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                return null;
            }
            ops = new Ops(packageName, uidState);
            uidState.pkgOps.put(packageName, ops);
            uidState.pkgOps.put(packageName.intern(), ops);
        }

        if (edit) {
@@ -5076,7 +5076,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        Ops ops = uidState.pkgOps.get(pkgName);
        if (ops == null) {
            ops = new Ops(pkgName, uidState);
            uidState.pkgOps.put(pkgName, ops);
            uidState.pkgOps.put(pkgName.intern(), ops);
        }
        ops.put(op.op, op);
    }