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

Commit 4212416c authored by ronish's avatar ronish
Browse files

Add settings keys for QR code scanner settings

Add keys to control and read settings for enabling/disabling QR code
scanner on the lock screen. This change also enables this new setting,
by default.

Bug: 200536509
Test: N/A

Change-Id: I519b2b6b8007bd850aaee15903ee1892439cdb88
parent 75e2c74b
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -9659,6 +9659,23 @@ public final class Settings {
        @Readable
        public static final String INSTANT_APPS_ENABLED = "instant_apps_enabled";
        /**
         * Whether qr code scanner should be accessible from the lockscreen
         *
         * @hide
         */
        public static final String LOCK_SCREEN_SHOW_QR_CODE_SCANNER =
                "lock_screen_show_qr_code_scanner";
        /**
         * Whether or not to enable qr code code scanner setting to enable/disable lockscreen
         * entry point. Any value apart from null means setting needs to be enabled
         *
         * @hide
         */
        public static final String SHOW_QR_CODE_SCANNER_SETTING =
                "show_qr_code_scanner_setting";
        /**
         * Has this pairable device been paired or upgraded from a previously paired system.
         * @hide
+3 −0
Original line number Diff line number Diff line
@@ -260,6 +260,9 @@
    <!-- Default for Settings.Secure.ONE_HANDED_MODE_ACTIVATED -->
    <bool name="def_one_handed_mode_activated">false</bool>

    <!-- Default for Settings.Secure.LOCK_SCREEN_SHOW_QR_CODE_SCANNER -->
    <bool name="def_lock_screen_show_qr_code_scanner">true</bool>

    <!-- ========================================== -->
    <!-- Default values for wear specific settings. -->

+1 −0
Original line number Diff line number Diff line
@@ -191,5 +191,6 @@ public class SecureSettings {
        Settings.Secure.LOCATION_TIME_ZONE_DETECTION_ENABLED,
        Settings.Secure.LOCKSCREEN_SHOW_CONTROLS,
        Settings.Secure.LOCKSCREEN_SHOW_WALLET,
        Settings.Secure.LOCK_SCREEN_SHOW_QR_CODE_SCANNER,
    };
}
+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ public class SecureSettingsValidators {
        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.LOCK_SCREEN_SHOW_QR_CODE_SCANNER, 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);
+18 −2
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.app.backup.BackupManager;
import android.app.compat.CompatChanges;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.bluetooth.BluetoothProfile;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledSince;
import android.content.BroadcastReceiver;
@@ -3595,7 +3594,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 205;
            private static final int SETTINGS_VERSION = 206;

            private final int mUserId;

@@ -5428,6 +5427,23 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 205;
                }

                if (currentVersion == 205) {
                    // Version 205: Set the default value for QR Code Scanner Setting:
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    final Setting showQRCodeScannerOnLockScreen = secureSettings.getSettingLocked(
                            Secure.LOCK_SCREEN_SHOW_QR_CODE_SCANNER);
                    if (showQRCodeScannerOnLockScreen.isNull()) {
                        final boolean defLockScreenShowQrCodeScanner = getContext().getResources()
                                .getBoolean(R.bool.def_lock_screen_show_qr_code_scanner);
                        secureSettings.insertSettingOverrideableByRestoreLocked(
                                Secure.LOCK_SCREEN_SHOW_QR_CODE_SCANNER,
                                defLockScreenShowQrCodeScanner ? "1" : "0", null, true,
                                SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 206;
                }


                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {