summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/settings/development/ForceMSAAPreferenceController.java12
-rw-r--r--src/com/android/settings/development/RtlLayoutPreferenceController.java6
-rw-r--r--src/com/android/settings/development/ShowLayoutBoundsPreferenceController.java10
-rw-r--r--src/com/android/settings/development/qstile/DevelopmentTiles.java7
-rw-r--r--tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java12
-rw-r--r--tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java15
6 files changed, 25 insertions, 37 deletions
diff --git a/src/com/android/settings/development/ForceMSAAPreferenceController.java b/src/com/android/settings/development/ForceMSAAPreferenceController.java
index be6efca877..ce539c7939 100644
--- a/src/com/android/settings/development/ForceMSAAPreferenceController.java
+++ b/src/com/android/settings/development/ForceMSAAPreferenceController.java
@@ -17,7 +17,7 @@
package com.android.settings.development;
import android.content.Context;
-import android.os.SystemProperties;
+import android.sysprop.DisplayProperties;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -32,9 +32,6 @@ public class ForceMSAAPreferenceController extends DeveloperOptionsPreferenceCon
private static final String FORCE_MSAA_KEY = "force_msaa";
- @VisibleForTesting
- static final String MSAA_PROPERTY = "debug.egl.force_msaa";
-
public ForceMSAAPreferenceController(Context context) {
super(context);
}
@@ -47,22 +44,21 @@ public class ForceMSAAPreferenceController extends DeveloperOptionsPreferenceCon
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean isEnabled = (Boolean) newValue;
- SystemProperties.set(MSAA_PROPERTY,
- isEnabled ? Boolean.toString(true) : Boolean.toString(false));
+ DisplayProperties.debug_force_msaa(isEnabled);
SystemPropPoker.getInstance().poke();
return true;
}
@Override
public void updateState(Preference preference) {
- final boolean isEnabled = SystemProperties.getBoolean(MSAA_PROPERTY, false /* default */);
+ final boolean isEnabled = DisplayProperties.debug_force_msaa().orElse(false);
((SwitchPreference) mPreference).setChecked(isEnabled);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
- SystemProperties.set(MSAA_PROPERTY, Boolean.toString(false));
+ DisplayProperties.debug_force_msaa(false);
((SwitchPreference) mPreference).setChecked(false);
}
}
diff --git a/src/com/android/settings/development/RtlLayoutPreferenceController.java b/src/com/android/settings/development/RtlLayoutPreferenceController.java
index 97b366a5a6..913259efe1 100644
--- a/src/com/android/settings/development/RtlLayoutPreferenceController.java
+++ b/src/com/android/settings/development/RtlLayoutPreferenceController.java
@@ -17,8 +17,8 @@
package com.android.settings.development;
import android.content.Context;
-import android.os.SystemProperties;
import android.provider.Settings;
+import android.sysprop.DisplayProperties;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -79,8 +79,6 @@ public class RtlLayoutPreferenceController extends DeveloperOptionsPreferenceCon
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.DEVELOPMENT_FORCE_RTL,
isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
- SystemProperties.set(Settings.Global.DEVELOPMENT_FORCE_RTL,
- isEnabled ? Integer.toString(SETTING_VALUE_ON)
- : Integer.toString(SETTING_VALUE_OFF));
+ DisplayProperties.debug_force_rtl(isEnabled);
}
}
diff --git a/src/com/android/settings/development/ShowLayoutBoundsPreferenceController.java b/src/com/android/settings/development/ShowLayoutBoundsPreferenceController.java
index fb091b7d47..18551bf9d5 100644
--- a/src/com/android/settings/development/ShowLayoutBoundsPreferenceController.java
+++ b/src/com/android/settings/development/ShowLayoutBoundsPreferenceController.java
@@ -17,7 +17,7 @@
package com.android.settings.development;
import android.content.Context;
-import android.os.SystemProperties;
+import android.sysprop.DisplayProperties;
import android.view.View;
import androidx.preference.Preference;
@@ -44,23 +44,21 @@ public class ShowLayoutBoundsPreferenceController extends DeveloperOptionsPrefer
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean isEnabled = (Boolean) newValue;
- SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY,
- isEnabled ? Boolean.toString(true) : Boolean.toString(false));
+ DisplayProperties.debug_layout(isEnabled);
SystemPropPoker.getInstance().poke();
return true;
}
@Override
public void updateState(Preference preference) {
- final boolean isEnabled = SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY,
- false /* default */);
+ final boolean isEnabled = DisplayProperties.debug_layout().orElse(false);
((SwitchPreference) mPreference).setChecked(isEnabled);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
- SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY, Boolean.toString(false));
+ DisplayProperties.debug_layout(false);
((SwitchPreference) mPreference).setChecked(false);
}
}
diff --git a/src/com/android/settings/development/qstile/DevelopmentTiles.java b/src/com/android/settings/development/qstile/DevelopmentTiles.java
index 827705d803..849ed2fa85 100644
--- a/src/com/android/settings/development/qstile/DevelopmentTiles.java
+++ b/src/com/android/settings/development/qstile/DevelopmentTiles.java
@@ -27,6 +27,7 @@ import android.os.SystemProperties;
import android.provider.Settings;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
+import android.sysprop.DisplayProperties;
import android.util.Log;
import android.view.IWindowManager;
import android.view.ThreadedRenderer;
@@ -98,12 +99,12 @@ public abstract class DevelopmentTiles extends TileService {
@Override
protected boolean isEnabled() {
- return SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false);
+ return DisplayProperties.debug_layout().orElse(false);
}
@Override
protected void setIsEnabled(boolean isEnabled) {
- SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY, isEnabled ? "true" : "false");
+ DisplayProperties.debug_layout(isEnabled);
}
}
@@ -139,7 +140,7 @@ public abstract class DevelopmentTiles extends TileService {
protected void setIsEnabled(boolean isEnabled) {
Settings.Global.putInt(
getContentResolver(), Settings.Global.DEVELOPMENT_FORCE_RTL, isEnabled ? 1 : 0);
- SystemProperties.set(Settings.Global.DEVELOPMENT_FORCE_RTL, isEnabled ? "1" : "0");
+ DisplayProperties.debug_force_rtl(isEnabled);
LocalePicker.updateLocales(getResources().getConfiguration().getLocales());
}
}
diff --git a/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java
index 1cf58de56d..4e0e504704 100644
--- a/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java
@@ -22,7 +22,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
-import android.os.SystemProperties;
+import android.sysprop.DisplayProperties;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
@@ -60,8 +60,7 @@ public class ForceMSAAPreferenceControllerTest {
public void onPreferenceChanged_settingEnabled_turnOnForceMsaa() {
mController.onPreferenceChange(mPreference, true /* new value */);
- final boolean mode = SystemProperties
- .getBoolean(ForceMSAAPreferenceController.MSAA_PROPERTY, false /* default */);
+ final boolean mode = DisplayProperties.debug_force_msaa().orElse(false);
assertThat(mode).isTrue();
}
@@ -70,15 +69,14 @@ public class ForceMSAAPreferenceControllerTest {
public void onPreferenceChanged_settingDisabled_turnOffForceMsaa() {
mController.onPreferenceChange(mPreference, false /* new value */);
- final boolean mode = SystemProperties
- .getBoolean(ForceMSAAPreferenceController.MSAA_PROPERTY, false /* default */);
+ final boolean mode = DisplayProperties.debug_force_msaa().orElse(false);
assertThat(mode).isFalse();
}
@Test
public void updateState_settingEnabled_preferenceShouldBeChecked() {
- SystemProperties.set(ForceMSAAPreferenceController.MSAA_PROPERTY, Boolean.toString(true));
+ DisplayProperties.debug_force_msaa(true);
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
@@ -86,7 +84,7 @@ public class ForceMSAAPreferenceControllerTest {
@Test
public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
- SystemProperties.set(ForceMSAAPreferenceController.MSAA_PROPERTY, Boolean.toString(false));
+ DisplayProperties.debug_force_msaa(false);
mController.updateState(mPreference);
verify(mPreference).setChecked(false);
diff --git a/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java
index 5c5bc8bef6..8b6d65a61d 100644
--- a/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java
@@ -21,7 +21,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.os.SystemProperties;
+import android.sysprop.DisplayProperties;
import android.view.View;
import androidx.preference.PreferenceScreen;
@@ -58,8 +58,7 @@ public class ShowLayoutBoundsPreferenceControllerTest {
public void onPreferenceChanged_settingEnabled_turnOnShowLayoutBounds() {
mController.onPreferenceChange(mPreference, true /* new value */);
- final boolean mode =
- SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false /* default */);
+ final boolean mode = DisplayProperties.debug_layout().orElse(false);
assertThat(mode).isTrue();
}
@@ -68,15 +67,14 @@ public class ShowLayoutBoundsPreferenceControllerTest {
public void onPreferenceChanged_settingDisabled_turnOffShowLayoutBounds() {
mController.onPreferenceChange(mPreference, false /* new value */);
- final boolean mode =
- SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false /* default */);
+ final boolean mode = DisplayProperties.debug_layout().orElse(false);
assertThat(mode).isFalse();
}
@Test
public void updateState_settingEnabled_preferenceShouldBeChecked() {
- SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY, Boolean.toString(true));
+ DisplayProperties.debug_layout(true);
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
@@ -84,7 +82,7 @@ public class ShowLayoutBoundsPreferenceControllerTest {
@Test
public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
- SystemProperties.set(View.DEBUG_LAYOUT_PROPERTY, Boolean.toString(false));
+ DisplayProperties.debug_layout(false);
mController.updateState(mPreference);
verify(mPreference).setChecked(false);
@@ -94,8 +92,7 @@ public class ShowLayoutBoundsPreferenceControllerTest {
public void onDeveloperOptionsDisabled_shouldDisablePreference() {
mController.onDeveloperOptionsDisabled();
- final boolean mode =
- SystemProperties.getBoolean(View.DEBUG_LAYOUT_PROPERTY, false /* default */);
+ final boolean mode = DisplayProperties.debug_layout().orElse(false);
assertThat(mode).isFalse();
verify(mPreference).setEnabled(false);