Merge "Fix "Enable ANGLE" switch behavior when Developer Option Switch is off" into udc-dev am: 67c72c01cb am: f783947615 am: 1af33f713b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23360519

Change-Id: Ib0f282be3b9f96abeff70eba344e63ab1c6b8c06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yuxin Hu
2023-05-25 20:37:38 +00:00
committed by Automerger Merge Worker
5 changed files with 55 additions and 42 deletions

View File

@@ -57,7 +57,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverControllerJUnitTest {
private GraphicsDriverEnableAngleAsSystemDriverController mController;
// Signal to wait for SystemProperty values changed
private class PropertyChangeSignal {
private static class PropertyChangeSignal {
private CountDownLatch mCountDownLatch;
private Runnable mCountDownJob;
@@ -217,23 +217,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverControllerJUnitTest {
}
@Test
public void onDeveloperOptionSwitchEnabled_angleSupported_PreferenceShouldEnabled() {
when(mSystemPropertiesMock.get(eq(PROPERTY_RO_GFX_ANGLE_SUPPORTED), any()))
.thenReturn("true");
mController.onDeveloperOptionsSwitchEnabled();
assertThat(mPreference.isEnabled()).isTrue();
}
@Test
public void onDeveloperOptionSwitchEnabled_angleNotSupported_PrefenceShouldDisabled() {
when(mSystemPropertiesMock.get(eq(PROPERTY_RO_GFX_ANGLE_SUPPORTED), any()))
.thenReturn("false");
mController.onDeveloperOptionsSwitchEnabled();
assertThat(mPreference.isEnabled()).isFalse();
}
@Test
public void onDeveloperOptionSwitchDisabled_angleIsNotSystemGLESDriver() {
public void onDeveloperOptionSwitchDisabled_angleShouldNotBeSystemGLESDriver() {
// Add a callback when SystemProperty changes.
// This allows the thread to wait until
// GpuService::toggleAngleAsSystemDriver() updates the persist.graphics.egl.
@@ -242,6 +226,8 @@ public class GraphicsDriverEnableAngleAsSystemDriverControllerJUnitTest {
// Test that onDeveloperOptionSwitchDisabled,
// persist.graphics.egl updates to ""
when(mSystemPropertiesMock.get(eq(PROPERTY_RO_GFX_ANGLE_SUPPORTED), any()))
.thenReturn("true");
mController.onDeveloperOptionsSwitchDisabled();
propertyChangeSignal1.wait(100);
final String systemEGLDriver = SystemProperties.get(PROPERTY_PERSISTENT_GRAPHICS_EGL);
@@ -253,12 +239,16 @@ public class GraphicsDriverEnableAngleAsSystemDriverControllerJUnitTest {
@Test
public void onDeveloperOptionSwitchDisabled_PreferenceShouldNotBeChecked() {
when(mSystemPropertiesMock.get(eq(PROPERTY_RO_GFX_ANGLE_SUPPORTED), any()))
.thenReturn("true");
mController.onDeveloperOptionsSwitchDisabled();
assertThat(mPreference.isChecked()).isFalse();
}
@Test
public void onDeveloperOptionSwitchDisabled_PreferenceShouldDisabled() {
when(mSystemPropertiesMock.get(eq(PROPERTY_RO_GFX_ANGLE_SUPPORTED), any()))
.thenReturn("true");
mController.onDeveloperOptionsSwitchDisabled();
assertThat(mPreference.isEnabled()).isFalse();
}