summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/app/AssistUtils.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistManager.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/assist/AssistantInvocationEvent.kt16
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java3
4 files changed, 46 insertions, 13 deletions
diff --git a/core/java/com/android/internal/app/AssistUtils.java b/core/java/com/android/internal/app/AssistUtils.java
index 22a25646c99d..c056e26e4674 100644
--- a/core/java/com/android/internal/app/AssistUtils.java
+++ b/core/java/com/android/internal/app/AssistUtils.java
@@ -40,6 +40,23 @@ public class AssistUtils {
private static final String TAG = "AssistUtils";
+ /** bundle key: how was the assistant invoked? */
+ public static final String INVOCATION_TYPE_KEY = "invocation_type";
+ /** value for INVOCATION_TYPE_KEY: no data */
+ public static final int INVOCATION_TYPE_UNKNOWN = 0;
+ /** value for INVOCATION_TYPE_KEY: on-screen swipe gesture */
+ public static final int INVOCATION_TYPE_GESTURE = 1;
+ /** value for INVOCATION_TYPE_KEY: device-specific physical gesture */
+ public static final int INVOCATION_TYPE_PHYSICAL_GESTURE = 2;
+ /** value for INVOCATION_TYPE_KEY: voice hotword */
+ public static final int INVOCATION_TYPE_VOICE = 3;
+ /** value for INVOCATION_TYPE_KEY: search bar affordance */
+ public static final int INVOCATION_TYPE_QUICK_SEARCH_BAR = 4;
+ /** value for INVOCATION_TYPE_KEY: long press on home navigation button */
+ public static final int INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS = 5;
+ /** value for INVOCATION_TYPE_KEY: long press on physical power button */
+ public static final int INVOCATION_TYPE_POWER_BUTTON_LONG_PRESS = 6;
+
private final Context mContext;
private final IVoiceInteractionManagerService mVoiceInteractionManagerService;
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index a7c1451a1d1b..b2c620d88de9 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -59,7 +59,7 @@ public class AssistManager {
*
* @param type one of INVOCATION_TYPE_GESTURE, INVOCATION_TYPE_ACTIVE_EDGE,
* INVOCATION_TYPE_VOICE, INVOCATION_TYPE_QUICK_SEARCH_BAR,
- * INVOCATION_HOME_BUTTON_LONG_PRESS
+ * INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS
* @param progress a float between 0 and 1 inclusive. 0 represents the beginning of the
* gesture; 1 represents the end.
*/
@@ -86,18 +86,27 @@ public class AssistManager {
private static final String INVOCATION_TIME_MS_KEY = "invocation_time_ms";
private static final String INVOCATION_PHONE_STATE_KEY = "invocation_phone_state";
- public static final String INVOCATION_TYPE_KEY = "invocation_type";
protected static final String ACTION_KEY = "action";
protected static final String SHOW_ASSIST_HANDLES_ACTION = "show_assist_handles";
protected static final String SET_ASSIST_GESTURE_CONSTRAINED_ACTION =
"set_assist_gesture_constrained";
protected static final String CONSTRAINED_KEY = "should_constrain";
- public static final int INVOCATION_TYPE_GESTURE = 1;
- public static final int INVOCATION_TYPE_OTHER = 2;
- public static final int INVOCATION_TYPE_VOICE = 3;
- public static final int INVOCATION_TYPE_QUICK_SEARCH_BAR = 4;
- public static final int INVOCATION_HOME_BUTTON_LONG_PRESS = 5;
+ public static final String INVOCATION_TYPE_KEY = "invocation_type";
+ public static final int INVOCATION_TYPE_UNKNOWN =
+ AssistUtils.INVOCATION_TYPE_UNKNOWN;
+ public static final int INVOCATION_TYPE_GESTURE =
+ AssistUtils.INVOCATION_TYPE_GESTURE;
+ public static final int INVOCATION_TYPE_OTHER =
+ AssistUtils.INVOCATION_TYPE_PHYSICAL_GESTURE;
+ public static final int INVOCATION_TYPE_VOICE =
+ AssistUtils.INVOCATION_TYPE_VOICE;
+ public static final int INVOCATION_TYPE_QUICK_SEARCH_BAR =
+ AssistUtils.INVOCATION_TYPE_QUICK_SEARCH_BAR;
+ public static final int INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS =
+ AssistUtils.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS;
+ public static final int INVOCATION_TYPE_POWER_BUTTON_LONG_PRESS =
+ AssistUtils.INVOCATION_TYPE_POWER_BUTTON_LONG_PRESS;
public static final int DISMISS_REASON_INVOCATION_CANCELLED = 1;
public static final int DISMISS_REASON_TAP = 2;
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistantInvocationEvent.kt b/packages/SystemUI/src/com/android/systemui/assist/AssistantInvocationEvent.kt
index fb5f1d1f725f..f57acf6fd20c 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistantInvocationEvent.kt
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistantInvocationEvent.kt
@@ -59,15 +59,18 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent
ASSISTANT_INVOCATION_START_TOUCH_GESTURE(531),
@UiEvent(doc = "Assistant invocation started by physical gesture")
- ASSISTANT_INVOCATION_START_PHYSICAL_GESTURE(532);
+ ASSISTANT_INVOCATION_START_PHYSICAL_GESTURE(532),
+
+ @UiEvent(doc = "Assistant invoked by long press on the physical power button")
+ ASSISTANT_INVOCATION_POWER_LONG_PRESS(758);
override fun getId(): Int {
return id
}
companion object {
- fun eventFromLegacyInvocationType(legacyInvocationType: Int, isInvocationComplete: Boolean)
- : AssistantInvocationEvent {
+ fun eventFromLegacyInvocationType(legacyInvocationType: Int, isInvocationComplete: Boolean):
+ AssistantInvocationEvent {
return if (isInvocationComplete) {
when (legacyInvocationType) {
AssistManager.INVOCATION_TYPE_GESTURE ->
@@ -82,9 +85,12 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent
AssistManager.INVOCATION_TYPE_QUICK_SEARCH_BAR ->
ASSISTANT_INVOCATION_QUICK_SEARCH_BAR
- AssistManager.INVOCATION_HOME_BUTTON_LONG_PRESS ->
+ AssistManager.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS ->
ASSISTANT_INVOCATION_HOME_LONG_PRESS
+ AssistManager.INVOCATION_TYPE_POWER_BUTTON_LONG_PRESS ->
+ ASSISTANT_INVOCATION_POWER_LONG_PRESS
+
else ->
ASSISTANT_INVOCATION_UNKNOWN
}
@@ -138,4 +144,4 @@ enum class AssistantInvocationEvent(private val id: Int) : UiEventLogger.UiEvent
}
}
}
-} \ No newline at end of file
+}
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
index 9d43e0c13320..51c81fa8bf25 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java
@@ -1243,7 +1243,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
mUiEventLogger.log(NavBarActionEvent.NAVBAR_ASSIST_LONGPRESS);
Bundle args = new Bundle();
args.putInt(
- AssistManager.INVOCATION_TYPE_KEY, AssistManager.INVOCATION_HOME_BUTTON_LONG_PRESS);
+ AssistManager.INVOCATION_TYPE_KEY,
+ AssistManager.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS);
mAssistManagerLazy.get().startAssist(args);
mStatusBarLazy.get().awakenDreams();