Schematize Display system properties

Properties accessed across partitions are now schematized and will
become APIs to make explicit interfaces among partitions.

Bug: 117924132
Test: m -j
Change-Id: I83b40ddfcde32d8d03fae73f5c252013933c466c
This commit is contained in:
Kiyoung Kim
2018-12-20 18:36:27 +09:00
parent 95ca4bf581
commit 1a3425ed2a
6 changed files with 25 additions and 37 deletions

View File

@@ -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);
}
}