Fix "Enable ANGLE" switch behavior when Developer Option Switch is off
Fix below bugs: 1) When developer option switch is turned off, "Enable ANGLE" switch is not disabled. Fixed it in GraphicsDriverEnableAngleAsSystemDriverController::update(). 2) When user turns off developer option switch, a restart is not always mandatory. However, we should ask user to restart the device is "Enable ANGLE" is forced to change due to developer option switch turning off. Fixed it in DevelopmentSettingsDashboardFragment::onSwitchChanged(). 3) When user turns off developer option switch and the reboot dialog pops up, user can dismiss the dialog by not clicking either POSITIVE_BUTTON or NEGATIVE_BUTTON. We should enforce user to click the button and disallow the option to dimiss the dialog by touching screen areas outside the window's bounds. Fixed it in DisableDevSettingsDialogFragment.java. Did a few clean-up and in GraphicsDriverEnableAngleAsSystemDriverController.java, and updated unit test to reflect new code behavior. Bug: b/270994705 Test: m; flash and device can boot. Test: atest -c GraphicsDriverEnableAngleAsSystemDriverControllerJUnitTest Test: atest GraphicsDriverEnableAngleAsSystemDriverControllerTest Test: atest SettingsRoboTests:FreeformWindowsPreferenceControllerTest Test: atest SettingsRoboTests:DesktopModePreferenceControllerTest Change-Id: I199b2fe59b6ad948b753793254c822a293d8b40d
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user