Merge "Don't cap the targetSDK for change id's in UI" am: 816f4ed50f am: 073b8d2381

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1534427

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I94e081e31050fdb2b66cd3a510d68dcaf70da5fe
This commit is contained in:
Andrei-Valentin Onea
2020-12-23 13:39:19 +00:00
committed by Automerger Merge Worker
2 changed files with 9 additions and 9 deletions

View File

@@ -60,7 +60,6 @@ public class PlatformCompat extends IPlatformCompat.Stub {
private final CompatConfig mCompatConfig; private final CompatConfig mCompatConfig;
private static int sMinTargetSdk = Build.VERSION_CODES.Q; private static int sMinTargetSdk = Build.VERSION_CODES.Q;
private static int sMaxTargetSdk = Build.VERSION_CODES.R;
public PlatformCompat(Context context) { public PlatformCompat(Context context) {
mContext = context; mContext = context;
@@ -384,8 +383,7 @@ public class PlatformCompat extends IPlatformCompat.Stub {
return false; return false;
} }
if (change.getEnableSinceTargetSdk() > 0) { if (change.getEnableSinceTargetSdk() > 0) {
if (change.getEnableSinceTargetSdk() < sMinTargetSdk if (change.getEnableSinceTargetSdk() < sMinTargetSdk) {
|| change.getEnableSinceTargetSdk() > sMaxTargetSdk) {
return false; return false;
} }
} }

View File

@@ -107,18 +107,20 @@ public class PlatformCompatTest {
mCompatConfig = CompatConfigBuilder.create(mBuildClassifier, mContext) mCompatConfig = CompatConfigBuilder.create(mBuildClassifier, mContext)
.addEnabledChangeWithId(1L) .addEnabledChangeWithId(1L)
.addDisabledChangeWithIdAndName(2L, "change2") .addDisabledChangeWithIdAndName(2L, "change2")
.addEnableAfterSdkChangeWithIdAndDescription(Build.VERSION_CODES.O, 3L, "desc") .addEnableSinceSdkChangeWithIdAndDescription(Build.VERSION_CODES.O, 3L, "desc")
.addEnableAfterSdkChangeWithId(Build.VERSION_CODES.P, 4L) .addEnableSinceSdkChangeWithId(Build.VERSION_CODES.P, 4L)
.addEnableAfterSdkChangeWithId(Build.VERSION_CODES.Q, 5L) .addEnableSinceSdkChangeWithId(Build.VERSION_CODES.Q, 5L)
.addEnableAfterSdkChangeWithId(Build.VERSION_CODES.R, 6L) .addEnableSinceSdkChangeWithId(Build.VERSION_CODES.R, 6L)
.addLoggingOnlyChangeWithId(7L) .addLoggingOnlyChangeWithId(7L)
.build(); .build();
mPlatformCompat = new PlatformCompat(mContext, mCompatConfig); mPlatformCompat = new PlatformCompat(mContext, mCompatConfig);
assertThat(mPlatformCompat.listUIChanges()).asList().containsExactly( assertThat(mPlatformCompat.listUIChanges()).asList().containsExactly(
new CompatibilityChangeInfo(1L, "", -1, -1, false, false, ""), new CompatibilityChangeInfo(1L, "", -1, -1, false, false, ""),
new CompatibilityChangeInfo(2L, "change2", -1, -1, true, false, ""), new CompatibilityChangeInfo(2L, "change2", -1, -1, true, false, ""),
new CompatibilityChangeInfo(4L, "", Build.VERSION_CODES.P, -1, false, false, ""), new CompatibilityChangeInfo(5L, "", /*enableAfter*/ -1,
new CompatibilityChangeInfo(5L, "", Build.VERSION_CODES.Q, -1, false, false, "")); /*enableSince*/ Build.VERSION_CODES.Q, false, false, ""),
new CompatibilityChangeInfo(6L, "", /*enableAfter*/ -1,
/*enableSince*/ Build.VERSION_CODES.R, false, false, ""));
} }
@Test @Test