Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19c9cfb0 authored by Adnan Begovic's avatar Adnan Begovic Committed by Steve Kondik
Browse files

Move qs brightness slider setting to secure.

Change-Id: I05facd68f8f12c6347b175c3adf2d731415926d2
parent 970971d3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1248,6 +1248,7 @@ public final class Settings {
            MOVED_TO_SECURE.add(Secure.VOLUME_LINK_NOTIFICATION);
            MOVED_TO_SECURE.add(Secure.QS_TILES);
            MOVED_TO_SECURE.add(Secure.QS_USE_MAIN_TILES);
            MOVED_TO_SECURE.add(Secure.QS_SHOW_BRIGHTNESS_SLIDER);
        }

        private static final HashSet<String> MOVED_TO_GLOBAL;
@@ -2109,6 +2110,7 @@ public final class Settings {
         *
         * @hide
         */
        @Deprecated
        public static final String QS_SHOW_BRIGHTNESS_SLIDER = "qs_show_brightness_slider";

        /**
@@ -5638,6 +5640,12 @@ public final class Settings {
         */
        public static final String APP_PERFORMANCE_PROFILES_ENABLED = "app_perf_profiles_enabled";

        /** Whether to show the brightness slider in quick settings panel.
         *
         * @hide
         */
        public static final String QS_SHOW_BRIGHTNESS_SLIDER = "qs_show_brightness_slider";

        /**
         * List of QS tile names
         * @hide
+12 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 118;
    private static final int DATABASE_VERSION = 119;

    private static final String HEADSET = "_headset";
    private static final String SPEAKER = "_speaker";
@@ -1891,6 +1891,17 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 118;
        }

        if (upgradeVersion < 119) {
            String[] settingsToMove = new String[] {
                    Settings.Secure.QS_SHOW_BRIGHTNESS_SLIDER,
            };

            moveSettingsToNewTable(db, TABLE_SYSTEM, TABLE_SECURE,
                    settingsToMove, true);
            upgradeVersion = 119;
        }


        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
+3 −3
Original line number Diff line number Diff line
@@ -123,9 +123,9 @@ public class QSPanel extends ViewGroup {
     * Enable/disable brightness slider.
     */
    private boolean showBrightnessSlider() {
        boolean brightnessSliderEnabled = Settings.System.getIntForUser(
            mContext.getContentResolver(), Settings.System.QS_SHOW_BRIGHTNESS_SLIDER,
                1, UserHandle.USER_CURRENT) == 1;
        boolean brightnessSliderEnabled = Settings.Secure.getInt(
            mContext.getContentResolver(), Settings.Secure.QS_SHOW_BRIGHTNESS_SLIDER,
                1) == 1;
        ToggleSlider brightnessSlider = (ToggleSlider) findViewById(R.id.brightness_slider);
        if (brightnessSliderEnabled) {
            mBrightnessView.setVisibility(VISIBLE);