From 9704e048bfa2bc464dea2042201aaa09fdb7636f Mon Sep 17 00:00:00 2001 From: Sharon Su Date: Wed, 1 Mar 2023 01:19:51 +0000 Subject: [PATCH] Add two new SearcTargetEvent types to represent user action to delete or dismiss a target. Bug: 267356831 Change-Id: Id24a75ca3427e5b72612559ec63f6acc533fb3b2 Test: atest CtsSearchUiServiceTestCases --- core/api/system-current.txt | 2 ++ .../java/android/app/search/SearchTargetEvent.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 744399de8225a..e3681c09877a5 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -2363,6 +2363,8 @@ package android.app.search { method @NonNull public String getTargetId(); method @NonNull public java.util.List getTargetIds(); method public void writeToParcel(@NonNull android.os.Parcel, int); + field public static final int ACTION_DELETE = 9; // 0x9 + field public static final int ACTION_DISMISS = 10; // 0xa field public static final int ACTION_DRAGNDROP = 7; // 0x7 field public static final int ACTION_LAUNCH_KEYBOARD_FOCUS = 6; // 0x6 field public static final int ACTION_LAUNCH_TOUCH = 5; // 0x5 diff --git a/core/java/android/app/search/SearchTargetEvent.java b/core/java/android/app/search/SearchTargetEvent.java index d4915afd5ce68..e8ef9227ad054 100644 --- a/core/java/android/app/search/SearchTargetEvent.java +++ b/core/java/android/app/search/SearchTargetEvent.java @@ -50,7 +50,9 @@ public final class SearchTargetEvent implements Parcelable { ACTION_LAUNCH_TOUCH, ACTION_LAUNCH_KEYBOARD_FOCUS, ACTION_DRAGNDROP, - ACTION_SURFACE_INVISIBLE + ACTION_SURFACE_INVISIBLE, + ACTION_DELETE, + ACTION_DISMISS }) @Retention(RetentionPolicy.SOURCE) public @interface ActionType {} @@ -114,6 +116,16 @@ public final class SearchTargetEvent implements Parcelable { */ public static final int ACTION_SURFACE_INVISIBLE = 8; + /** + * Constant that defines user deleted a target. + */ + public static final int ACTION_DELETE = 9; + + /** + * Constant that defines user dismissed a target. + */ + public static final int ACTION_DISMISS = 10; + private SearchTargetEvent(@NonNull List targetIds, @Nullable String location, @ActionType int actionType,