Merge "Add SystemUI Tuner Control" into mnc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index dc36fbf..afe8777 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6591,4 +6591,7 @@
<!-- Link to an apps notification settings [CHAR LIMIT=50] -->
<string name="app_notification_preferences">App notification preferences</string>
+ <!-- Turn on settings for system ui tuner [CHAR LIMIT=40] -->
+ <string name="system_ui_settings">Show SystemUI Tuner</string>
+
</resources>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index ecab700..7ab44ca 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -60,6 +60,11 @@
android:summary="@string/runningservices_settings_summary"
android:fragment="com.android.settings.applications.RunningServices" />
+ <SwitchPreference
+ android:key="tweak_ui"
+ android:persistent="false"
+ android:title="@string/system_ui_settings" />
+
<PreferenceCategory android:key="debug_debugging_category"
android:title="@string/debug_debugging_category">
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 3c964c9..4d89bf5 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -97,6 +97,9 @@
*/
public static final String PREF_SHOW = "show";
+ private static final ComponentName SYSUI_TWEAK = new ComponentName("com.android.systemui",
+ "com.android.systemui.tuner.TunerActivity");
+
private static final String ENABLE_ADB = "enable_adb";
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
private static final String ENABLE_TERMINAL = "enable_terminal";
@@ -112,6 +115,7 @@
private static final String BUGREPORT = "bugreport";
private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power";
private static final String OPENGL_TRACES_PROPERTY = "debug.egl.trace";
+ private static final String TWEAK_UI_KEY = "tweak_ui";
private static final String DEBUG_APP_KEY = "debug_app";
private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
@@ -260,6 +264,8 @@
private Dialog mAdbKeysDialog;
private boolean mUnavailable;
+ private SwitchPreference mTweakUiPref;
+
@Override
protected int getMetricsCategory() {
return MetricsLogger.DEVELOPMENT;
@@ -392,6 +398,8 @@
mAllPrefs.add(mShowAllANRs);
mResetSwitchPrefs.add(mShowAllANRs);
+ mTweakUiPref = findAndInitSwitchPref(TWEAK_UI_KEY);
+
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
@@ -593,6 +601,7 @@
updateSimulateColorSpace();
updateUseNuplayerOptions();
updateUSBAudioOptions();
+ updateTweakUi();
}
private void resetDangerousOptions() {
@@ -1069,6 +1078,21 @@
}
}
+ private void updateTweakUi() {
+ updateSwitchPreference(mTweakUiPref, getActivity().getPackageManager()
+ .getComponentEnabledSetting(SYSUI_TWEAK)
+ == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+ mTweakUiPref.setOnPreferenceChangeListener(this);
+ }
+
+ private void writeTweakUi(Object newValue) {
+ Boolean enabled = (Boolean) newValue;
+ getActivity().getPackageManager().setComponentEnabledSetting(SYSUI_TWEAK,
+ enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+ : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ }
+
private void updateUseNuplayerOptions() {
updateSwitchPreference(
mUseAwesomePlayer, SystemProperties.getBoolean(USE_AWESOMEPLAYER_PROPERTY, false));
@@ -1669,6 +1693,9 @@
} else if (preference == mSimulateColorSpace) {
writeSimulateColorSpace(newValue);
return true;
+ } else if (preference == mTweakUiPref) {
+ writeTweakUi(newValue);
+ return true;
}
return false;
}