Cutout emulation: string changes and ordering
Updates strings according to spec. Also ensures that the emulation overlays are shown in the order of their priority. Bug: 112876936 Test: Open developer options, go to "display cutout", verify strings. Change-Id: If2d05595d02a277896202ab2a6262c99508a3a17 Merged-In: If2d05595d02a277896202ab2a6262c99508a3a17
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package com.android.settings.development;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.AdditionalMatchers.aryEq;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@@ -38,6 +40,7 @@ import com.android.settings.wrapper.OverlayManagerWrapper.OverlayInfo;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.AdditionalMatchers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
@@ -46,10 +49,10 @@ import java.util.Arrays;
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class EmulateDisplayCutoutPreferenceControllerTest {
|
||||
|
||||
private static final OverlayInfo ONE_DISABLED = createFakeOverlay("emulation.one", false);
|
||||
private static final OverlayInfo ONE_ENABLED = createFakeOverlay("emulation.one", true);
|
||||
private static final OverlayInfo TWO_DISABLED = createFakeOverlay("emulation.two", false);
|
||||
private static final OverlayInfo TWO_ENABLED = createFakeOverlay("emulation.two", true);
|
||||
private static final OverlayInfo ONE_DISABLED = createFakeOverlay("emulation.one", false, 1);
|
||||
private static final OverlayInfo ONE_ENABLED = createFakeOverlay("emulation.one", true, 1);
|
||||
private static final OverlayInfo TWO_DISABLED = createFakeOverlay("emulation.two", false, 2);
|
||||
private static final OverlayInfo TWO_ENABLED = createFakeOverlay("emulation.two", true, 2);
|
||||
|
||||
@Mock
|
||||
private Context mContext;
|
||||
@@ -127,6 +130,16 @@ public class EmulateDisplayCutoutPreferenceControllerTest {
|
||||
verify(mPreference).setValueIndex(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ordered_by_priority() throws Exception {
|
||||
mockCurrentOverlays(TWO_DISABLED, ONE_DISABLED);
|
||||
|
||||
mController.updateState(null);
|
||||
|
||||
verify(mPreference).setEntryValues(
|
||||
aryEq(new String[]{"", ONE_DISABLED.packageName, TWO_DISABLED.packageName}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeveloperOptionsSwitchDisabled() throws Exception {
|
||||
mockCurrentOverlays(ONE_ENABLED, TWO_DISABLED);
|
||||
@@ -145,7 +158,8 @@ public class EmulateDisplayCutoutPreferenceControllerTest {
|
||||
mOverlayManager);
|
||||
}
|
||||
|
||||
private static OverlayInfo createFakeOverlay(String pkg, boolean enabled) {
|
||||
return new OverlayInfo(pkg, DisplayCutout.EMULATION_OVERLAY_CATEGORY, enabled);
|
||||
private static OverlayInfo createFakeOverlay(String pkg, boolean enabled, int priority) {
|
||||
return new OverlayInfo(pkg, DisplayCutout.EMULATION_OVERLAY_CATEGORY, enabled,
|
||||
priority);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user