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

Commit 20e75f17 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Controls - Use new privacy setting" into sc-dev

parents 845205c0 abc6e0c5
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -9514,6 +9514,20 @@ public final class Settings {
        public static final String POWER_MENU_LOCKED_SHOW_CONTENT =
                "power_menu_locked_show_content";
        /**
         * Whether home controls should be accessible from the lockscreen
         *
         * @hide
         */
        public static final String LOCKSCREEN_SHOW_CONTROLS = "lockscreen_show_controls";
        /**
         * Whether wallet should be accessible from the lockscreen
         *
         * @hide
         */
        public static final String LOCKSCREEN_SHOW_WALLET = "lockscreen_show_wallet";
        /**
         * Specifies whether the web action API is enabled.
         *
+2 −0
Original line number Diff line number Diff line
@@ -190,5 +190,7 @@ public class SecureSettings {
        Settings.Secure.ACCESSIBILITY_FLOATING_MENU_FADE_ENABLED,
        Settings.Secure.NOTIFICATION_BUBBLES,
        Settings.Secure.LOCATION_TIME_ZONE_DETECTION_ENABLED,
        Settings.Secure.LOCKSCREEN_SHOW_CONTROLS,
        Settings.Secure.LOCKSCREEN_SHOW_WALLET,
    };
}
+2 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.QS_TILES, TILE_LIST_VALIDATOR);
        VALIDATORS.put(Secure.CONTROLS_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.POWER_MENU_LOCKED_SHOW_CONTENT, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCKSCREEN_SHOW_CONTROLS, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.LOCKSCREEN_SHOW_WALLET, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOZE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOZE_ALWAYS_ON, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.DOZE_PICK_UP_GESTURE, BOOLEAN_VALIDATOR);
+22 −1
Original line number Diff line number Diff line
@@ -3547,7 +3547,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 202;
            private static final int SETTINGS_VERSION = 203;

            private final int mUserId;

@@ -5130,6 +5130,27 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 202;
                }

                if (currentVersion == 202) {
                    // Version 202: Power menu has been removed, and the privacy setting
                    // has been split into two for wallet and controls
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    final Setting showLockedContent = secureSettings.getSettingLocked(
                            Secure.POWER_MENU_LOCKED_SHOW_CONTENT);
                    if (!showLockedContent.isNull()) {
                        String currentValue = showLockedContent.getValue();

                        secureSettings.insertSettingOverrideableByRestoreLocked(
                                Secure.LOCKSCREEN_SHOW_CONTROLS,
                                currentValue, null /* tag */, false /* makeDefault */,
                                SettingsState.SYSTEM_PACKAGE_NAME);
                        secureSettings.insertSettingOverrideableByRestoreLocked(
                                Secure.LOCKSCREEN_SHOW_WALLET,
                                currentValue, null /* tag */, false /* makeDefault */,
                                SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 203;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {
+2 −3
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ class ControlsComponent @Inject constructor(
    private val userTracker: UserTracker,
    private val secureSettings: SecureSettings
) {

    private val contentResolver: ContentResolver
        get() = context.contentResolver

@@ -66,7 +65,7 @@ class ControlsComponent @Inject constructor(
    init {
        if (featureEnabled) {
            secureSettings.registerContentObserver(
                Settings.Secure.getUriFor(Settings.Secure.POWER_MENU_LOCKED_SHOW_CONTENT),
                Settings.Secure.getUriFor(Settings.Secure.LOCKSCREEN_SHOW_CONTROLS),
                false, /* notifyForDescendants */
                showWhileLockedObserver
            )
@@ -116,7 +115,7 @@ class ControlsComponent @Inject constructor(

    private fun updateShowWhileLocked() {
        canShowWhileLockedSetting = secureSettings.getInt(
            Settings.Secure.POWER_MENU_LOCKED_SHOW_CONTENT, 0) != 0
            Settings.Secure.LOCKSCREEN_SHOW_CONTROLS, 0) != 0
    }

    enum class Visibility {
Loading