diff options
author | LuK1337 <priv.luk@gmail.com> | 2021-05-03 21:10:04 +0200 |
---|---|---|
committer | Bruno Martins <bgcngm@gmail.com> | 2021-05-04 13:39:13 +0200 |
commit | 44427ae3ef1f50f78ef6ac200de16affeedddb0d (patch) | |
tree | ed43eb60cbe483b25c5a01277e03fb3e91de344f | |
parent | 122825fa60afc78359a3943d86aaea750cc2e5dd (diff) |
lineage-sdk: Add preference keys for back key long press customization
Change-Id: I8a5d80ef5f8aa238ad73ba034d275ea1094dffe9
-rw-r--r-- | lineage/res/res/values/config.xml | 18 | ||||
-rw-r--r-- | lineage/res/res/values/symbols.xml | 3 | ||||
-rw-r--r-- | sdk/src/java/lineageos/providers/LineageSettings.java | 13 |
3 files changed, 32 insertions, 2 deletions
diff --git a/lineage/res/res/values/config.xml b/lineage/res/res/values/config.xml index e43f83b0..a902ce5f 100644 --- a/lineage/res/res/values/config.xml +++ b/lineage/res/res/values/config.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2015 The CyanogenMod Project - 2017-2020 The LineageOS Project + 2017-2021 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -151,6 +151,22 @@ config to 7. --> <integer name="config_deviceHardwareWakeKeys">64</integer> + <!-- Control the behavior when the user long presses the back button. + 0 - Nothing + 1 - Menu key + 2 - Recent apps view in SystemUI + 3 - Launch assist intent + 4 - Voice Search + 5 - In-app Search + 6 - Launch camera + 7 - Sleep + 8 - Last app + 9 - Toggle split screen + This needs to match the enums in + sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java. + --> + <integer name="config_longPressOnBackBehavior">0</integer> + <!-- Control the behavior when the user long presses the home button. 0 - Nothing 1 - Menu key diff --git a/lineage/res/res/values/symbols.xml b/lineage/res/res/values/symbols.xml index c3a7d85a..eb5d3387 100644 --- a/lineage/res/res/values/symbols.xml +++ b/lineage/res/res/values/symbols.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2015 The CyanogenMod Project - 2017-2018 The LineageOS Project + 2017-2021 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -104,6 +104,7 @@ <java-symbol type="integer" name="config_deviceHardwareWakeKeys" /> <!-- Device keys user-customisable behavior --> + <java-symbol type="integer" name="config_longPressOnBackBehavior" /> <java-symbol type="integer" name="config_longPressOnHomeBehavior" /> <java-symbol type="integer" name="config_doubleTapOnHomeBehavior" /> <java-symbol type="integer" name="config_longPressOnMenuBehavior" /> diff --git a/sdk/src/java/lineageos/providers/LineageSettings.java b/sdk/src/java/lineageos/providers/LineageSettings.java index e98795fa..4d5a3416 100644 --- a/sdk/src/java/lineageos/providers/LineageSettings.java +++ b/sdk/src/java/lineageos/providers/LineageSettings.java @@ -1077,6 +1077,17 @@ public final class LineageSettings { new InclusiveIntegerRangeValidator(0, 9); /** + * Action to perform when the back key is long-pressed. + * (Default can be configured via config_longPressOnBackBehavior) + * (See KEY_HOME_LONG_PRESS_ACTION for valid values) + */ + public static final String KEY_BACK_LONG_PRESS_ACTION = "key_back_long_press_action"; + + /** @hide */ + public static final Validator KEY_BACK_LONG_PRESS_ACTION_VALIDATOR = + new InclusiveIntegerRangeValidator(0, 9); + + /** * Whether to wake the screen with the back key, the value is boolean. * 0 = 0ff, 1 = on */ @@ -2149,6 +2160,7 @@ public final class LineageSettings { */ public static final String[] LEGACY_SYSTEM_SETTINGS = new String[]{ LineageSettings.System.NAV_BUTTONS, + LineageSettings.System.KEY_BACK_LONG_PRESS_ACTION, LineageSettings.System.KEY_HOME_LONG_PRESS_ACTION, LineageSettings.System.KEY_HOME_DOUBLE_TAP_ACTION, LineageSettings.System.BACK_WAKE_SCREEN, @@ -2277,6 +2289,7 @@ public final class LineageSettings { VALIDATORS.put(NAVIGATION_BAR_MENU_ARROW_KEYS, NAVIGATION_BAR_MENU_ARROW_KEYS_VALIDATOR); VALIDATORS.put(NAVIGATION_BAR_HINT, NAVIGATION_BAR_HINT_VALIDATOR); + VALIDATORS.put(KEY_BACK_LONG_PRESS_ACTION, KEY_BACK_LONG_PRESS_ACTION_VALIDATOR); VALIDATORS.put(KEY_HOME_LONG_PRESS_ACTION, KEY_HOME_LONG_PRESS_ACTION_VALIDATOR); VALIDATORS.put(KEY_HOME_DOUBLE_TAP_ACTION, KEY_HOME_DOUBLE_TAP_ACTION_VALIDATOR); VALIDATORS.put(BACK_WAKE_SCREEN, BACK_WAKE_SCREEN_VALIDATOR); |