From 156147cafcc51060a012d892f3086c57b12e8813 Mon Sep 17 00:00:00 2001 From: Andrei Onea Date: Mon, 21 Dec 2020 18:21:33 +0000 Subject: [PATCH] Don't cap the targetSDK for change id's in UI Remove the upper limit for showing change id's in the developer UI. Test: atest PlatformCompatTest Test: manual check for NOTIFICATION_TRAMPOLINE_BLOCK Bug: 176071034 Change-Id: I20db4b4f8b7a2230bc0d8e1d655be1c5eb0297d1 --- .../com/android/server/compat/PlatformCompat.java | 4 +--- .../android/server/compat/PlatformCompatTest.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/compat/PlatformCompat.java b/services/core/java/com/android/server/compat/PlatformCompat.java index 2c19a2d2855c8..26a5a63df7a99 100644 --- a/services/core/java/com/android/server/compat/PlatformCompat.java +++ b/services/core/java/com/android/server/compat/PlatformCompat.java @@ -60,7 +60,6 @@ public class PlatformCompat extends IPlatformCompat.Stub { private final CompatConfig mCompatConfig; private static int sMinTargetSdk = Build.VERSION_CODES.Q; - private static int sMaxTargetSdk = Build.VERSION_CODES.R; public PlatformCompat(Context context) { mContext = context; @@ -379,8 +378,7 @@ public class PlatformCompat extends IPlatformCompat.Stub { return false; } if (change.getEnableSinceTargetSdk() > 0) { - if (change.getEnableSinceTargetSdk() < sMinTargetSdk - || change.getEnableSinceTargetSdk() > sMaxTargetSdk) { + if (change.getEnableSinceTargetSdk() < sMinTargetSdk) { return false; } } diff --git a/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java b/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java index 64014ba182d22..1d3b643ba83fc 100644 --- a/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java +++ b/services/tests/servicestests/src/com/android/server/compat/PlatformCompatTest.java @@ -107,18 +107,20 @@ public class PlatformCompatTest { mCompatConfig = CompatConfigBuilder.create(mBuildClassifier, mContext) .addEnabledChangeWithId(1L) .addDisabledChangeWithIdAndName(2L, "change2") - .addEnableAfterSdkChangeWithIdAndDescription(Build.VERSION_CODES.O, 3L, "desc") - .addEnableAfterSdkChangeWithId(Build.VERSION_CODES.P, 4L) - .addEnableAfterSdkChangeWithId(Build.VERSION_CODES.Q, 5L) - .addEnableAfterSdkChangeWithId(Build.VERSION_CODES.R, 6L) + .addEnableSinceSdkChangeWithIdAndDescription(Build.VERSION_CODES.O, 3L, "desc") + .addEnableSinceSdkChangeWithId(Build.VERSION_CODES.P, 4L) + .addEnableSinceSdkChangeWithId(Build.VERSION_CODES.Q, 5L) + .addEnableSinceSdkChangeWithId(Build.VERSION_CODES.R, 6L) .addLoggingOnlyChangeWithId(7L) .build(); mPlatformCompat = new PlatformCompat(mContext, mCompatConfig); assertThat(mPlatformCompat.listUIChanges()).asList().containsExactly( new CompatibilityChangeInfo(1L, "", -1, -1, false, false, ""), new CompatibilityChangeInfo(2L, "change2", -1, -1, true, false, ""), - new CompatibilityChangeInfo(4L, "", Build.VERSION_CODES.P, -1, false, false, ""), - new CompatibilityChangeInfo(5L, "", Build.VERSION_CODES.Q, -1, false, false, "")); + new CompatibilityChangeInfo(5L, "", /*enableAfter*/ -1, + /*enableSince*/ Build.VERSION_CODES.Q, false, false, ""), + new CompatibilityChangeInfo(6L, "", /*enableAfter*/ -1, + /*enableSince*/ Build.VERSION_CODES.R, false, false, "")); } @Test