lineage-sdk: Add preference keys for back key long press customization

Change-Id: I8a5d80ef5f8aa238ad73ba034d275ea1094dffe9
This commit is contained in:
LuK1337
2021-05-03 21:10:04 +02:00
committed by Bruno Martins
parent 122825fa60
commit 44427ae3ef
3 changed files with 32 additions and 2 deletions

View File

@@ -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

View File

@@ -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" />

View File

@@ -1076,6 +1076,17 @@ public final class LineageSettings {
public static final Validator KEY_HOME_DOUBLE_TAP_ACTION_VALIDATOR =
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);