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
This commit is contained in:
@@ -55,15 +55,20 @@ public class AndroidTestBaseUpdater extends PackageSharedLibraryUpdater {
|
||||
private static final long REMOVE_ANDROID_TEST_BASE = 133396946L;
|
||||
|
||||
private static boolean isChangeEnabled(Package pkg) {
|
||||
IPlatformCompat platformCompat = IPlatformCompat.Stub.asInterface(
|
||||
ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
|
||||
try {
|
||||
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);
|
||||
// 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);
|
||||
} 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
|
||||
|
||||
Reference in New Issue
Block a user