Merge "Add support for @EnabledSince compat changes" am: 2d57867aba
am: 38747f76f3
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1455019 Change-Id: I60df429605c78749c0259f7efffab026210a4977
This commit is contained in:
committed by
Automerger Merge Worker
commit
8e111e3de3
@@ -149,13 +149,13 @@ public class PlatformCompatDashboard extends DashboardFragment {
|
|||||||
final List<CompatibilityChangeInfo> disabledChanges = new ArrayList<>();
|
final List<CompatibilityChangeInfo> disabledChanges = new ArrayList<>();
|
||||||
final Map<Integer, List<CompatibilityChangeInfo>> targetSdkChanges = new TreeMap<>();
|
final Map<Integer, List<CompatibilityChangeInfo>> targetSdkChanges = new TreeMap<>();
|
||||||
for (CompatibilityChangeInfo change : mChanges) {
|
for (CompatibilityChangeInfo change : mChanges) {
|
||||||
if (change.getEnableAfterTargetSdk() != 0) {
|
if (change.getEnableSinceTargetSdk() != 0) {
|
||||||
List<CompatibilityChangeInfo> sdkChanges;
|
List<CompatibilityChangeInfo> sdkChanges;
|
||||||
if (!targetSdkChanges.containsKey(change.getEnableAfterTargetSdk())) {
|
if (!targetSdkChanges.containsKey(change.getEnableSinceTargetSdk())) {
|
||||||
sdkChanges = new ArrayList<>();
|
sdkChanges = new ArrayList<>();
|
||||||
targetSdkChanges.put(change.getEnableAfterTargetSdk(), sdkChanges);
|
targetSdkChanges.put(change.getEnableSinceTargetSdk(), sdkChanges);
|
||||||
} else {
|
} else {
|
||||||
sdkChanges = targetSdkChanges.get(change.getEnableAfterTargetSdk());
|
sdkChanges = targetSdkChanges.get(change.getEnableSinceTargetSdk());
|
||||||
}
|
}
|
||||||
sdkChanges.add(change);
|
sdkChanges.add(change);
|
||||||
} else if (change.getDisabled()) {
|
} else if (change.getDisabled()) {
|
||||||
|
@@ -88,11 +88,14 @@ public class PlatformCompatDashboardTest {
|
|||||||
public void setUp() throws RemoteException, NameNotFoundException {
|
public void setUp() throws RemoteException, NameNotFoundException {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mChanges = new CompatibilityChangeInfo[5];
|
mChanges = new CompatibilityChangeInfo[5];
|
||||||
mChanges[0] = new CompatibilityChangeInfo(1L, "Default_Enabled", 0, false, false, "");
|
mChanges[0] = new CompatibilityChangeInfo(1L, "Default_Enabled", 0, 0, false, false, "");
|
||||||
mChanges[1] = new CompatibilityChangeInfo(2L, "Default_Disabled", 0, true, false, "");
|
mChanges[1] = new CompatibilityChangeInfo(2L, "Default_Disabled", 0, 0, true, false, "");
|
||||||
mChanges[2] = new CompatibilityChangeInfo(3L, "Enabled_After_SDK_1_1", 1, false, false, "");
|
mChanges[2] = new CompatibilityChangeInfo(3L, "Enabled_Since_SDK_1_1", -1, 1, false, false,
|
||||||
mChanges[3] = new CompatibilityChangeInfo(4L, "Enabled_After_SDK_1_2", 1, false, false, "");
|
"");
|
||||||
mChanges[4] = new CompatibilityChangeInfo(5L, "Enabled_After_SDK_2", 2, false, false, "");
|
mChanges[3] = new CompatibilityChangeInfo(4L, "Enabled_Since_SDK_1_2", -1, 1, false, false,
|
||||||
|
"");
|
||||||
|
mChanges[4] = new CompatibilityChangeInfo(5L, "Enabled_Since_SDK_2", -1, 2, false, false,
|
||||||
|
"");
|
||||||
when(mPlatformCompat.listUIChanges()).thenReturn(mChanges);
|
when(mPlatformCompat.listUIChanges()).thenReturn(mChanges);
|
||||||
when(mPlatformCompat.getOverrideValidator()).thenReturn(mOverrideValidator);
|
when(mPlatformCompat.getOverrideValidator()).thenReturn(mOverrideValidator);
|
||||||
// By default, allow any change
|
// By default, allow any change
|
||||||
@@ -204,7 +207,7 @@ public class PlatformCompatDashboardTest {
|
|||||||
List<CompatibilityChangeInfo> changesToAdd = new ArrayList<>();
|
List<CompatibilityChangeInfo> changesToAdd = new ArrayList<>();
|
||||||
for (int i = 0; i < mChanges.length; ++i) {
|
for (int i = 0; i < mChanges.length; ++i) {
|
||||||
changesToAdd.add(new CompatibilityChangeInfo(mChanges[i].getId(), mChanges[i].getName(),
|
changesToAdd.add(new CompatibilityChangeInfo(mChanges[i].getId(), mChanges[i].getName(),
|
||||||
mChanges[i].getEnableAfterTargetSdk(), mChanges[i].getDisabled(),
|
-1, mChanges[i].getEnableSinceTargetSdk(), mChanges[i].getDisabled(),
|
||||||
mChanges[i].getLoggingOnly(), mChanges[i].getDescription()));
|
mChanges[i].getLoggingOnly(), mChanges[i].getDescription()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user