Banish Theme setting to developer options
Bug: 21320576 Change-Id: I7e3fd7437409ac2dd061a36803e082eada5b30b1
This commit is contained in:
@@ -65,6 +65,14 @@
|
|||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/system_ui_settings" />
|
android:title="@string/system_ui_settings" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="night_mode"
|
||||||
|
android:title="@string/night_mode_title"
|
||||||
|
android:summary="@string/night_mode_summary"
|
||||||
|
android:persistent="false"
|
||||||
|
android:entries="@array/night_mode_entries"
|
||||||
|
android:entryValues="@array/night_mode_values" />
|
||||||
|
|
||||||
<PreferenceCategory android:key="debug_debugging_category"
|
<PreferenceCategory android:key="debug_debugging_category"
|
||||||
android:title="@string/debug_debugging_category">
|
android:title="@string/debug_debugging_category">
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
android:summary="@string/auto_brightness_summary"
|
android:summary="@string/auto_brightness_summary"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
|
<!-- Hide night mode for now
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="night_mode"
|
android:key="night_mode"
|
||||||
android:title="@string/night_mode_title"
|
android:title="@string/night_mode_title"
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
android:summary="@string/night_mode_summary"
|
android:summary="@string/night_mode_summary"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:entries="@array/night_mode_entries"
|
android:entries="@array/night_mode_entries"
|
||||||
android:entryValues="@array/night_mode_values" />
|
android:entryValues="@array/night_mode_values" /> -->
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="wallpaper"
|
android:key="wallpaper"
|
||||||
|
@@ -23,6 +23,7 @@ import android.app.AlertDialog;
|
|||||||
import android.app.AppOpsManager;
|
import android.app.AppOpsManager;
|
||||||
import android.app.AppOpsManager.PackageOps;
|
import android.app.AppOpsManager.PackageOps;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.app.UiModeManager;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.app.backup.IBackupManager;
|
import android.app.backup.IBackupManager;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
@@ -76,10 +77,8 @@ import com.android.internal.logging.MetricsLogger;
|
|||||||
import com.android.settings.fuelgauge.InactiveApps;
|
import com.android.settings.fuelgauge.InactiveApps;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
import com.android.settings.users.UserDetailsSettings;
|
|
||||||
import com.android.settings.widget.SwitchBar;
|
import com.android.settings.widget.SwitchBar;
|
||||||
|
|
||||||
import java.lang.Process;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -181,6 +180,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
|
private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
|
||||||
|
|
||||||
|
private static final String KEY_NIGHT_MODE = "night_mode";
|
||||||
|
|
||||||
private static final int RESULT_DEBUG_APP = 1000;
|
private static final int RESULT_DEBUG_APP = 1000;
|
||||||
private static final int RESULT_MOCK_LOCATION_APP = 1001;
|
private static final int RESULT_MOCK_LOCATION_APP = 1001;
|
||||||
|
|
||||||
@@ -264,6 +265,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private SwitchPreference mShowAllANRs;
|
private SwitchPreference mShowAllANRs;
|
||||||
|
|
||||||
|
private ListPreference mNightModePreference;
|
||||||
|
|
||||||
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
||||||
|
|
||||||
private final ArrayList<SwitchPreference> mResetSwitchPrefs
|
private final ArrayList<SwitchPreference> mResetSwitchPrefs
|
||||||
@@ -423,6 +426,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
mAllPrefs.add(hdcpChecking);
|
mAllPrefs.add(hdcpChecking);
|
||||||
removePreferenceForProduction(hdcpChecking);
|
removePreferenceForProduction(hdcpChecking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mNightModePreference = (ListPreference) findPreference(KEY_NIGHT_MODE);
|
||||||
|
final UiModeManager uiManager = (UiModeManager) getSystemService(
|
||||||
|
Context.UI_MODE_SERVICE);
|
||||||
|
final int currentNightMode = uiManager.getNightMode();
|
||||||
|
mNightModePreference.setValue(String.valueOf(currentNightMode));
|
||||||
|
mNightModePreference.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListPreference addListPreference(String prefKey) {
|
private ListPreference addListPreference(String prefKey) {
|
||||||
@@ -1798,6 +1808,16 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
} else if (preference == mTunerUiPref) {
|
} else if (preference == mTunerUiPref) {
|
||||||
writeTweakUi(newValue);
|
writeTweakUi(newValue);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (preference == mNightModePreference) {
|
||||||
|
try {
|
||||||
|
final int value = Integer.parseInt((String) newValue);
|
||||||
|
final UiModeManager uiManager = (UiModeManager) getSystemService(
|
||||||
|
Context.UI_MODE_SERVICE);
|
||||||
|
uiManager.setNightMode(value);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
Log.e(TAG, "could not persist night mode setting", e);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -185,12 +185,14 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
mNightModePreference = (ListPreference) findPreference(KEY_NIGHT_MODE);
|
mNightModePreference = (ListPreference) findPreference(KEY_NIGHT_MODE);
|
||||||
|
if (mNightModePreference != null) {
|
||||||
final UiModeManager uiManager = (UiModeManager) getSystemService(
|
final UiModeManager uiManager = (UiModeManager) getSystemService(
|
||||||
Context.UI_MODE_SERVICE);
|
Context.UI_MODE_SERVICE);
|
||||||
final int currentNightMode = uiManager.getNightMode();
|
final int currentNightMode = uiManager.getNightMode();
|
||||||
mNightModePreference.setValue(String.valueOf(currentNightMode));
|
mNightModePreference.setValue(String.valueOf(currentNightMode));
|
||||||
mNightModePreference.setOnPreferenceChangeListener(this);
|
mNightModePreference.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean allowAllRotations(Context context) {
|
private static boolean allowAllRotations(Context context) {
|
||||||
return Resources.getSystem().getBoolean(
|
return Resources.getSystem().getBoolean(
|
||||||
|
Reference in New Issue
Block a user