From: Todd Kennedy Date: Thu, 10 May 2018 17:26:07 +0000 (-0700) Subject: OMS: rebase settings when overlays update X-Git-Tag: android-x86-9.0-r1~37^2~12^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=94fecb94e9f869d620b79792a849d91238de9449;p=android-x86%2Fpackages-apps-Settings.git OMS: rebase settings when overlays update When an overlay package has been upgraded, OMS needs to reconcile any previous settings about the overlay with the new state of affairs. Sometimes it is possible to rebase the OMS settings on the new information [e.g. the overlay has changed categories]; sometimes the OMS settings have to be scrapped [e.g. the overlay has changed target package]. Update OMS to do The Right Thing. Bug: 78809704 Test: manual (adb shell stop, adb push specially prepared overlays, adb shell start, adb exec-out cmd overlay dump) Test: ran unit tests Test: adb install out/target/product/walleye/data/app/SettingsUnitTests/SettingsUnitTests.apk Test: adb shell am instrument -w -e class com.android.settings.display.ThemePreferenceControllerTest com.android.settings.tests.unit/android.support.test.runner.AndroidJUnitRunner Test: NOTE: 3 of 4 failures both pre and post change; looks like there are issue with the unit tests themselves Change-Id: Icd1ae633dbee5b5ca957fa6b652af6209b4b1260 --- diff --git a/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java b/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java index e618343d8d..586c448684 100644 --- a/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java +++ b/tests/unit/src/com/android/settings/display/ThemePreferenceControllerTest.java @@ -69,9 +69,9 @@ public class ThemePreferenceControllerTest { @Test public void testUpdateState() throws Exception { OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", - "", "", OverlayInfo.STATE_ENABLED, 0); + "", "", OverlayInfo.STATE_ENABLED, 0, 0, true); OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", - "", "", 0, 0); + "", "", 0, 0, 0, true); when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> { ApplicationInfo info = mock(ApplicationInfo.class); if ("com.android.Theme1".equals(inv.getArguments()[0])) { @@ -105,9 +105,9 @@ public class ThemePreferenceControllerTest { @Test public void testUpdateState_withStaticOverlay() throws Exception { OverlayInfo info1 = new OverlayInfo("com.android.Theme1", "android", - "", "", OverlayInfo.STATE_ENABLED, 0); + "", "", OverlayInfo.STATE_ENABLED, 0, 0, true); OverlayInfo info2 = new OverlayInfo("com.android.Theme2", "android", - "", "", OverlayInfo.STATE_ENABLED, 0); + "", "", OverlayInfo.STATE_ENABLED, 0, 0, true); when(mMockPackageManager.getApplicationInfo(any(), anyInt())).thenAnswer(inv -> { ApplicationInfo info = mock(ApplicationInfo.class); if ("com.android.Theme1".equals(inv.getArguments()[0])) { @@ -145,7 +145,7 @@ public class ThemePreferenceControllerTest { when(mMockPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn( new PackageInfo()); when(mMockOverlayManager.getOverlayInfosForTarget(any(), anyInt())) - .thenReturn(list(new OverlayInfo("", "", "", "", 0, 0))); + .thenReturn(list(new OverlayInfo("", "", "", "", 0, 0, 0, false))); assertThat(mPreferenceController.isAvailable()).isFalse(); } @@ -154,8 +154,8 @@ public class ThemePreferenceControllerTest { when(mMockPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn( new PackageInfo()); when(mMockOverlayManager.getOverlayInfosForTarget(any(), anyInt())) - .thenReturn(list(new OverlayInfo("", "", "", "", 0, 0), - new OverlayInfo("", "", "", "", 0, 0))); + .thenReturn(list(new OverlayInfo("", "", "", "", 0, 0, 0, true), + new OverlayInfo("", "", "", "", 0, 0, 0, true))); assertThat(mPreferenceController.isAvailable()).isTrue(); }