Add device key action to kill app [1/3]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: neobuddy89 <neobuddy89@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
diff --git a/lineage/res/res/values/config.xml b/lineage/res/res/values/config.xml
index 3b10870..ca47d0e 100644
--- a/lineage/res/res/values/config.xml
+++ b/lineage/res/res/values/config.xml
@@ -161,6 +161,7 @@
7 - Sleep
8 - Last app
9 - Toggle split screen
+ 10 - Close app
This needs to match the enums in
sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java.
-->
@@ -177,6 +178,7 @@
7 - Sleep
8 - Last app
9 - Toggle split screen
+ 10 - Close app
This needs to match the enums in
sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java.
-->
@@ -193,6 +195,7 @@
7 - Sleep
8 - Last app
9 - Toggle split screen
+ 10 - Close app
This needs to match the enums in
sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java.
-->
@@ -209,6 +212,7 @@
7 - Sleep
8 - Last app
9 - Toggle split screen
+ 10 - Close app
This needs to match the enums in
sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java.
-->
diff --git a/sdk/src/java/lineageos/providers/LineageSettings.java b/sdk/src/java/lineageos/providers/LineageSettings.java
index 844ef55..8c9e40a 100644
--- a/sdk/src/java/lineageos/providers/LineageSettings.java
+++ b/sdk/src/java/lineageos/providers/LineageSettings.java
@@ -1046,14 +1046,15 @@
* 7 - Action Sleep
* 8 - Last app
* 9 - Toggle split screen
- * 10 - Single hand (left)
- * 11 - Single hand (right)
+ * 10 - Close app
+ * 11 - Single hand (left)
+ * 12 - Single hand (right)
*/
public static final String KEY_HOME_LONG_PRESS_ACTION = "key_home_long_press_action";
/** @hide */
public static final Validator KEY_HOME_LONG_PRESS_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Action to perform when the home key is double-tapped.
@@ -1064,7 +1065,7 @@
/** @hide */
public static final Validator KEY_HOME_DOUBLE_TAP_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Whether to wake the screen with the back key, the value is boolean.
@@ -1113,7 +1114,7 @@
/** @hide */
public static final Validator KEY_MENU_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Action to perform when the menu key is long-pressed.
@@ -1124,7 +1125,7 @@
/** @hide */
public static final Validator KEY_MENU_LONG_PRESS_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Action to perform when the assistant (search) key is pressed. (Default is 3)
@@ -1134,7 +1135,7 @@
/** @hide */
public static final Validator KEY_ASSIST_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Action to perform when the assistant (search) key is long-pressed. (Default is 4)
@@ -1144,7 +1145,7 @@
/** @hide */
public static final Validator KEY_ASSIST_LONG_PRESS_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Action to perform when the app switch key is pressed. (Default is 2)
@@ -1154,7 +1155,7 @@
/** @hide */
public static final Validator KEY_APP_SWITCH_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Action to perform when the app switch key is long-pressed. (Default is 0)
@@ -1164,7 +1165,7 @@
/** @hide */
public static final Validator KEY_APP_SWITCH_LONG_PRESS_ACTION_VALIDATOR =
- new InclusiveIntegerRangeValidator(0, 9);
+ new InclusiveIntegerRangeValidator(0, 10);
/**
* Action to perform when the screen edge is long-swiped. (Default is 0)
diff --git a/sdk/src/java/org/lineageos/internal/util/ActionUtils.java b/sdk/src/java/org/lineageos/internal/util/ActionUtils.java
index 8abd181..dcc3f91 100644
--- a/sdk/src/java/org/lineageos/internal/util/ActionUtils.java
+++ b/sdk/src/java/org/lineageos/internal/util/ActionUtils.java
@@ -38,7 +38,6 @@
/**
* Kills the top most / most recent user application, but leaves out the launcher.
- * This is function governed by {@link Settings.Secure.KILL_APP_LONGPRESS_BACK}.
*
* @param context the current context, used to retrieve the package manager.
* @param userId the ID of the currently active user
diff --git a/sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java b/sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java
index 17d7e70..9438ca5 100644
--- a/sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java
+++ b/sdk/src/java/org/lineageos/internal/util/DeviceKeysConstants.java
@@ -36,6 +36,7 @@
SLEEP,
LAST_APP,
SPLIT_SCREEN,
+ CLOSE_APP,
SINGLE_HAND_LEFT,
SINGLE_HAND_RIGHT;