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

Commit 685cbc12 authored by atrost's avatar atrost
Browse files

Don't call platformCompat on system apps.

To avoid boot time regression in tests, as compat doesn't care about
system apps.
Also fix the fallback condition to be correct.

Bug: 30188076
Bug: 142558883
Test: atest google/perf/boottime/boottime-test -v - no binder calls,
no time regression.

Change-Id: I15fd39ad7e0ed70fcd880a13cffa40d70c5bba55
parent f6fb7063
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -55,15 +55,20 @@ public class AndroidTestBaseUpdater extends PackageSharedLibraryUpdater {
    private static final long REMOVE_ANDROID_TEST_BASE = 133396946L;

    private static boolean isChangeEnabled(Package pkg) {
        // Do not ask platform compat for system apps to prevent a boot time regression in tests.
        // b/142558883.
        if (!pkg.applicationInfo.isSystemApp()) {
            IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
                    ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
            try {
            return platformCompat.isChangeEnabled(REMOVE_ANDROID_TEST_BASE, pkg.applicationInfo);
                return platformCompat.isChangeEnabled(REMOVE_ANDROID_TEST_BASE,
                        pkg.applicationInfo);
            } catch (RemoteException | NullPointerException e) {
                Log.e(TAG, "Failed to get a response from PLATFORM_COMPAT_SERVICE", e);
            }
        }
        // Fall back to previous behaviour.
        return pkg.applicationInfo.targetSdkVersion <= Build.VERSION_CODES.Q;
        return pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.Q;
    }

    @Override