Merge changes from topic "angle-developer-option-toggle1" into main am: 0481d6a318
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2794056 Change-Id: I62d88700fe6c8110dd0e70b39d6ed42a6a88fb8d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -170,9 +170,10 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
}
|
||||
|
||||
// Regardless of whether ANGLE is enabled, disable the developer option UI
|
||||
// as long as UI is not enabled via debug property.
|
||||
if (!isAngleDeveloperOptionEnabled()) {
|
||||
// Disable the developer option toggle UI if ANGLE is disabled, this means next time the
|
||||
// debug property needs to be set to true again to enable ANGLE. If ANGLE is enabled, don't
|
||||
// disable the developer option toggle UI so that it can be turned off easily.
|
||||
if (!isAngleDeveloperOptionEnabled() && !((SwitchPreference) mPreference).isChecked()) {
|
||||
mPreference.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@ import static com.android.settings.development.graphicsdriver.GraphicsDriverEnab
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@@ -472,4 +474,27 @@ public class GraphicsDriverEnableAngleAsSystemDriverControllerJUnitTest {
|
||||
SystemProperties.removeChangeCallback(propertyChangeSignal1.getCountDownJob());
|
||||
SystemProperties.removeChangeCallback(propertyChangeSignal2.getCountDownJob());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_DeveloperOptionPropertyIsFalse() {
|
||||
// Test that when debug.graphics.angle.developeroption.enable is false:
|
||||
when(mSystemPropertiesMock.getBoolean(eq(PROPERTY_DEBUG_ANGLE_DEVELOPER_OPTION),
|
||||
anyBoolean())).thenReturn(false);
|
||||
when(mSystemPropertiesMock.get(eq(PROPERTY_RO_GFX_ANGLE_SUPPORTED), any()))
|
||||
.thenReturn("true");
|
||||
|
||||
// 1. "Enable ANGLE" switch is on, the switch should be enabled.
|
||||
when(mSystemPropertiesMock.get(eq(PROPERTY_PERSISTENT_GRAPHICS_EGL), any()))
|
||||
.thenReturn(ANGLE_DRIVER_SUFFIX);
|
||||
mController.updateState(mPreference);
|
||||
assertTrue(mPreference.isChecked());
|
||||
assertTrue(mPreference.isEnabled());
|
||||
|
||||
// 2. "Enable ANGLE" switch is off, the switch should be disabled.
|
||||
when(mSystemPropertiesMock.get(eq(PROPERTY_PERSISTENT_GRAPHICS_EGL), any()))
|
||||
.thenReturn("");
|
||||
mController.updateState(mPreference);
|
||||
assertFalse(mPreference.isChecked());
|
||||
assertFalse(mPreference.isEnabled());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user