AOD: Implement long press gesture to launch assist
Bug: 37684244
Test: adb shell settings put secure doze_pulse_on_long_press 1; turn screen off, long press, verify assistant is launched
Change-Id: I87335d3c091bbb17022d79e599f46fb826039b7d
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 716990a..1e22d20 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -6515,6 +6515,12 @@
public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up";
/**
+ * Whether the device should pulse on long press gesture.
+ * @hide
+ */
+ public static final String DOZE_PULSE_ON_LONG_PRESS = "doze_pulse_on_long_press";
+
+ /**
* Whether the device should pulse on double tap gesture.
* @hide
*/
diff --git a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
index 00fa711a..76126e2 100644
--- a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
+++ b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
@@ -36,6 +36,7 @@
return pulseOnNotificationEnabled(user)
|| pulseOnPickupEnabled(user)
|| pulseOnDoubleTapEnabled(user)
+ || pulseOnLongPressEnabled(user)
|| alwaysOnEnabled(user);
}
@@ -75,6 +76,19 @@
return mContext.getResources().getString(R.string.config_dozeDoubleTapSensorType);
}
+ public String longPressSensorType() {
+ return mContext.getResources().getString(R.string.config_dozeLongPressSensorType);
+ }
+
+ public boolean pulseOnLongPressEnabled(int user) {
+ return pulseOnLongPressAvailable() && boolSettingDefaultOff(
+ Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, user);
+ }
+
+ private boolean pulseOnLongPressAvailable() {
+ return !TextUtils.isEmpty(longPressSensorType());
+ }
+
public boolean alwaysOnEnabled(int user) {
return boolSettingDefaultOn(Settings.Secure.DOZE_ALWAYS_ON, user)
&& alwaysOnAvailable();
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ab909cf..0b089bc 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1841,6 +1841,9 @@
<!-- Type of the double tap sensor. Empty if double tap is not supported. -->
<string name="config_dozeDoubleTapSensorType" translatable="false"></string>
+ <!-- Type of the long press sensor. Empty if long press is not supported. -->
+ <string name="config_dozeLongPressSensorType" translatable="false"></string>
+
<!-- Control whether the always on display mode is available. This should only be enabled on
devices where the display has be tuned to be power efficient in DOZE and/or DOZE_SUSPEND
states. -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index ad9b5af..6fbfe15 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3042,6 +3042,8 @@
<java-symbol type="array" name="config_hideWhenDisabled_packageNames" />
+ <java-symbol type="string" name="config_dozeLongPressSensorType" />
+
<java-symbol type="array" name="config_allowedGlobalInstantAppSettings" />
<java-symbol type="array" name="config_allowedSystemInstantAppSettings" />
<java-symbol type="array" name="config_allowedSecureInstantAppSettings" />
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 1599f9e..1d8b499 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -428,6 +428,7 @@
Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS,
Settings.Secure.DISPLAY_DENSITY_FORCED,
Settings.Secure.DOZE_ALWAYS_ON,
+ Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT,
Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES,