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

Commit 4cfc19fd authored by Gianmarco Reverberi's avatar Gianmarco Reverberi Committed by Steve Kondik
Browse files

QS: some corrections on location tile code (1/2)

Setting moved to Secure
Useless code deleted

Change-Id: I23f615f329f790c18eb7db817c37d386c0fdd368
parent 950cfa54
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1823,11 +1823,6 @@ public final class Settings {
         */
        public static final int ADVANCED_SETTINGS_DEFAULT = 0;

        /**
         * @hide
         */
        public static final String QS_LOCATION_ADVANCED = "qs_location_advanced";

        /**
         * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead
         */
@@ -5774,6 +5769,12 @@ public final class Settings {
         */
        public static final String QS_USE_MAIN_TILES = "sysui_qs_main_tiles";

        /**
         * Whether detail view for the location tile is enabled
         * @hide
         */
        public static final String QS_LOCATION_ADVANCED = "qs_location_advanced";

        /**
         * This are the settings to be backed up.
         *
+7 −9
Original line number Diff line number Diff line
@@ -159,7 +159,8 @@ public class LocationControllerImpl extends BroadcastReceiver implements Locatio
        // setting won't be fully enabled until the user accepts the agreement.   
        // QuickSettings always runs as the owner, so specifically set the settings
        // for the current foreground user.
        return Settings.Secure.putIntForUser(cr, Settings.Secure.LOCATION_MODE, mode, currentUserId);
        return Settings.Secure.putIntForUser(cr, Settings.Secure.LOCATION_MODE,
                mode, currentUserId);
    }

    /**
@@ -171,7 +172,8 @@ public class LocationControllerImpl extends BroadcastReceiver implements Locatio
            return Settings.Secure.LOCATION_MODE_OFF;
        }
        final ContentResolver cr = mContext.getContentResolver();
        return Settings.Secure.getIntForUser(cr, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF, currentUserId);
        return Settings.Secure.getIntForUser(cr, Settings.Secure.LOCATION_MODE,
                Settings.Secure.LOCATION_MODE_OFF, currentUserId);
    }

    /**
@@ -187,15 +189,11 @@ public class LocationControllerImpl extends BroadcastReceiver implements Locatio
    }

    /**
     *
     * Check if advanced location tile is enabled in settings
     */
    public boolean isAdvancedSettingsEnabled() {
        ContentResolver resolver = mContext.getContentResolver();
        // QuickSettings always runs as the owner, so specifically retrieve the settings
        // for the current foreground user.
        int mode = Settings.Secure.getIntForUser(resolver, Settings.Secure.LOCATION_MODE,
                Settings.Secure.LOCATION_MODE_OFF, ActivityManager.getCurrentUser());
        return Settings.System.getIntForUser(resolver, Settings.System.QS_LOCATION_ADVANCED, 0, ActivityManager.getCurrentUser()) == 1;
        return Settings.Secure.getIntForUser(mContext.getContentResolver(),
                Settings.Secure.QS_LOCATION_ADVANCED, 0, ActivityManager.getCurrentUser()) == 1;
    }

    /**