From a39bb8f9c05cd96522f718427157df253470a400 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Wed, 4 Jan 2023 19:34:25 +0000 Subject: [PATCH] Limit gestureType API to testAPI GestureType is public but it doesn't need to be. Reducing visibility to testApi. Bug: 249271636 Test: atest CtsInputMethodTestCases Change-Id: I7f70dd0c0b9effc762fc0923f71d6e35e95af83f --- core/api/current.txt | 8 ------ core/api/test-current.txt | 8 ++++++ .../view/inputmethod/HandwritingGesture.java | 28 +++++++++++++++++-- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 326a8e781a602..c0607276e2f43 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -54488,14 +54488,6 @@ package android.view.inputmethod { public abstract class HandwritingGesture { method @Nullable public final String getFallbackText(); - field public static final int GESTURE_TYPE_DELETE = 4; // 0x4 - field public static final int GESTURE_TYPE_DELETE_RANGE = 64; // 0x40 - field public static final int GESTURE_TYPE_INSERT = 2; // 0x2 - field public static final int GESTURE_TYPE_JOIN_OR_SPLIT = 16; // 0x10 - field public static final int GESTURE_TYPE_NONE = 0; // 0x0 - field public static final int GESTURE_TYPE_REMOVE_SPACE = 8; // 0x8 - field public static final int GESTURE_TYPE_SELECT = 1; // 0x1 - field public static final int GESTURE_TYPE_SELECT_RANGE = 32; // 0x20 field public static final int GRANULARITY_CHARACTER = 2; // 0x2 field public static final int GRANULARITY_WORD = 1; // 0x1 } diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 550e5bcd93725..c832d37c7f0ee 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -3233,6 +3233,14 @@ package android.view.inputmethod { public abstract class HandwritingGesture { method public final int getGestureType(); + field public static final int GESTURE_TYPE_DELETE = 4; // 0x4 + field public static final int GESTURE_TYPE_DELETE_RANGE = 64; // 0x40 + field public static final int GESTURE_TYPE_INSERT = 2; // 0x2 + field public static final int GESTURE_TYPE_JOIN_OR_SPLIT = 16; // 0x10 + field public static final int GESTURE_TYPE_NONE = 0; // 0x0 + field public static final int GESTURE_TYPE_REMOVE_SPACE = 8; // 0x8 + field public static final int GESTURE_TYPE_SELECT = 1; // 0x1 + field public static final int GESTURE_TYPE_SELECT_RANGE = 32; // 0x20 } public final class InlineSuggestion implements android.os.Parcelable { diff --git a/core/java/android/view/inputmethod/HandwritingGesture.java b/core/java/android/view/inputmethod/HandwritingGesture.java index 251626941eeef..e0fc426e14679 100644 --- a/core/java/android/view/inputmethod/HandwritingGesture.java +++ b/core/java/android/view/inputmethod/HandwritingGesture.java @@ -82,38 +82,60 @@ public abstract class HandwritingGesture { @IntDef({GRANULARITY_CHARACTER, GRANULARITY_WORD}) @interface Granularity {} - /** Undefined gesture type. */ + /** + * Undefined gesture type. + * @hide + */ + @TestApi public static final int GESTURE_TYPE_NONE = 0x0000; /** * Gesture of type {@link SelectGesture} to select an area of text. + * @hide */ + @TestApi public static final int GESTURE_TYPE_SELECT = 0x0001; /** * Gesture of type {@link InsertGesture} to insert text at a designated point. + * @hide */ + @TestApi public static final int GESTURE_TYPE_INSERT = 1 << 1; /** * Gesture of type {@link DeleteGesture} to delete an area of text. + * @hide */ + @TestApi public static final int GESTURE_TYPE_DELETE = 1 << 2; - /** Gesture of type {@link RemoveSpaceGesture} to remove whitespace from text. */ + /** + * Gesture of type {@link RemoveSpaceGesture} to remove whitespace from text. + * @hide + */ + @TestApi public static final int GESTURE_TYPE_REMOVE_SPACE = 1 << 3; - /** Gesture of type {@link JoinOrSplitGesture} to join or split text. */ + /** + * Gesture of type {@link JoinOrSplitGesture} to join or split text. + * @hide + */ + @TestApi public static final int GESTURE_TYPE_JOIN_OR_SPLIT = 1 << 4; /** * Gesture of type {@link SelectRangeGesture} to select range of text. + * @hide */ + @TestApi public static final int GESTURE_TYPE_SELECT_RANGE = 1 << 5; /** * Gesture of type {@link DeleteRangeGesture} to delete range of text. + * @hide */ + @TestApi public static final int GESTURE_TYPE_DELETE_RANGE = 1 << 6; /**