summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt31
-rw-r--r--core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java23
-rw-r--r--core/java/android/view/inputmethod/DeleteGesture.java4
-rw-r--r--core/java/android/view/inputmethod/EditorInfo.java12
-rw-r--r--core/java/android/view/inputmethod/HandwritingGesture.java20
-rw-r--r--core/java/android/view/inputmethod/InsertGesture.java3
-rw-r--r--core/java/android/view/inputmethod/JoinOrSplitGesture.aidl19
-rw-r--r--core/java/android/view/inputmethod/JoinOrSplitGesture.java145
-rw-r--r--core/java/android/view/inputmethod/RemoveSpaceGesture.aidl19
-rw-r--r--core/java/android/view/inputmethod/RemoveSpaceGesture.java152
-rw-r--r--core/java/android/view/inputmethod/SelectGesture.java8
-rw-r--r--core/java/com/android/internal/inputmethod/IRemoteInputConnection.aidl8
-rw-r--r--core/java/com/android/internal/inputmethod/InputMethodDebug.java7
-rw-r--r--core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java18
14 files changed, 446 insertions, 23 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 0ab00dfa4a34..3086755c16a8 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -53160,7 +53160,9 @@ package android.view.inputmethod {
method @Nullable public String getFallbackText();
field public static final int GESTURE_TYPE_DELETE = 4; // 0x4
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 GRANULARITY_CHARACTER = 2; // 0x2
field public static final int GRANULARITY_WORD = 1; // 0x1
@@ -53501,6 +53503,35 @@ package android.view.inputmethod {
method @NonNull public android.view.inputmethod.InsertGesture.Builder setTextToInsert(@NonNull String);
}
+ public final class JoinOrSplitGesture extends android.view.inputmethod.HandwritingGesture implements android.os.Parcelable {
+ method public int describeContents();
+ method @NonNull public android.graphics.PointF getJoinOrSplitPoint();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.JoinOrSplitGesture> CREATOR;
+ }
+
+ public static final class JoinOrSplitGesture.Builder {
+ ctor public JoinOrSplitGesture.Builder();
+ method @NonNull public android.view.inputmethod.JoinOrSplitGesture build();
+ method @NonNull public android.view.inputmethod.JoinOrSplitGesture.Builder setFallbackText(@Nullable String);
+ method @NonNull public android.view.inputmethod.JoinOrSplitGesture.Builder setJoinOrSplitPoint(@NonNull android.graphics.PointF);
+ }
+
+ public final class RemoveSpaceGesture extends android.view.inputmethod.HandwritingGesture implements android.os.Parcelable {
+ method public int describeContents();
+ method @NonNull public android.graphics.PointF getEndPoint();
+ method @NonNull public android.graphics.PointF getStartPoint();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.RemoveSpaceGesture> CREATOR;
+ }
+
+ public static final class RemoveSpaceGesture.Builder {
+ ctor public RemoveSpaceGesture.Builder();
+ method @NonNull public android.view.inputmethod.RemoveSpaceGesture build();
+ method @NonNull public android.view.inputmethod.RemoveSpaceGesture.Builder setFallbackText(@Nullable String);
+ method @NonNull public android.view.inputmethod.RemoveSpaceGesture.Builder setPoints(@NonNull android.graphics.PointF, @NonNull android.graphics.PointF);
+ }
+
public final class SelectGesture extends android.view.inputmethod.HandwritingGesture implements android.os.Parcelable {
method public int describeContents();
method public int getGranularity();
diff --git a/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java b/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java
index 84c3623c1375..5ce38e9a279a 100644
--- a/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java
+++ b/core/java/android/inputmethodservice/IRemoteInputConnectionInvoker.java
@@ -33,6 +33,8 @@ import android.view.inputmethod.HandwritingGesture;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputContentInfo;
import android.view.inputmethod.InsertGesture;
+import android.view.inputmethod.JoinOrSplitGesture;
+import android.view.inputmethod.RemoveSpaceGesture;
import android.view.inputmethod.SelectGesture;
import android.view.inputmethod.SurroundingText;
import android.view.inputmethod.TextAttribute;
@@ -633,16 +635,11 @@ final class IRemoteInputConnectionInvoker {
}
/**
- * Invokes one of {@link IRemoteInputConnection#performHandwritingSelectGesture(
- * InputConnectionCommandHeader, SelectGesture, AndroidFuture)},
- * {@link IRemoteInputConnection#performHandwritingDeleteGesture(InputConnectionCommandHeader,
- * DeleteGesture, AndroidFuture)},
- * {@link IRemoteInputConnection#performHandwritingInsertGesture(InputConnectionCommandHeader,
- * InsertGesture, AndroidFuture)}
- *
- * @param {@code gesture} parameter {@link HandwritingGesture}.
- * @return {@link AndroidFuture<Integer>} that can be used to retrieve the invocation
- * result. {@link RemoteException} will be treated as an error.
+ * Invokes one of {@link IRemoteInputConnection#performHandwritingSelectGesture},
+ * {@link IRemoteInputConnection#performHandwritingDeleteGesture},
+ * {@link IRemoteInputConnection#performHandwritingInsertGesture},
+ * {@link IRemoteInputConnection#performHandwritingRemoveSpaceGesture},
+ * {@link IRemoteInputConnection#performHandwritingJoinOrSplitGesture}.
*/
@AnyThread
public void performHandwritingGesture(
@@ -664,6 +661,12 @@ final class IRemoteInputConnectionInvoker {
} else if (gesture instanceof DeleteGesture) {
mConnection.performHandwritingDeleteGesture(
createHeader(), (DeleteGesture) gesture, resultReceiver);
+ } else if (gesture instanceof RemoveSpaceGesture) {
+ mConnection.performHandwritingRemoveSpaceGesture(
+ createHeader(), (RemoveSpaceGesture) gesture, resultReceiver);
+ } else if (gesture instanceof JoinOrSplitGesture) {
+ mConnection.performHandwritingJoinOrSplitGesture(
+ createHeader(), (JoinOrSplitGesture) gesture, resultReceiver);
} else if (consumer != null && executor != null) {
executor.execute(()
-> consumer.accept(InputConnection.HANDWRITING_GESTURE_RESULT_UNSUPPORTED));
diff --git a/core/java/android/view/inputmethod/DeleteGesture.java b/core/java/android/view/inputmethod/DeleteGesture.java
index 1395578ded3c..9fadabfee512 100644
--- a/core/java/android/view/inputmethod/DeleteGesture.java
+++ b/core/java/android/view/inputmethod/DeleteGesture.java
@@ -64,7 +64,6 @@ public final class DeleteGesture extends HandwritingGesture implements Parcelabl
* Returns the deletion area {@link RectF} in screen coordinates.
*
* Getter for deletion area set with {@link DeleteGesture.Builder#setDeletionArea(RectF)}.
- * {@code null} if area was not set.
*/
@NonNull
public RectF getDeletionArea() {
@@ -145,7 +144,8 @@ public final class DeleteGesture extends HandwritingGesture implements Parcelabl
/**
* Used to make this class parcelable.
*/
- public static final @android.annotation.NonNull Creator<DeleteGesture> CREATOR =
+ @NonNull
+ public static final Creator<DeleteGesture> CREATOR =
new Creator<DeleteGesture>() {
@Override
public DeleteGesture createFromParcel(Parcel source) {
diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java
index 36b033485575..c3b32c9f1d54 100644
--- a/core/java/android/view/inputmethod/EditorInfo.java
+++ b/core/java/android/view/inputmethod/EditorInfo.java
@@ -561,6 +561,10 @@ public class EditorInfo implements InputType, Parcelable {
supportedTypes |= HandwritingGesture.GESTURE_TYPE_INSERT;
} else if (gesture.equals(DeleteGesture.class)) {
supportedTypes |= HandwritingGesture.GESTURE_TYPE_DELETE;
+ } else if (gesture.equals(RemoveSpaceGesture.class)) {
+ supportedTypes |= HandwritingGesture.GESTURE_TYPE_REMOVE_SPACE;
+ } else if (gesture.equals(JoinOrSplitGesture.class)) {
+ supportedTypes |= HandwritingGesture.GESTURE_TYPE_JOIN_OR_SPLIT;
} else {
throw new IllegalArgumentException("Unknown gesture type: " + gesture);
}
@@ -595,6 +599,14 @@ public class EditorInfo implements InputType, Parcelable {
== HandwritingGesture.GESTURE_TYPE_DELETE) {
list.add(DeleteGesture.class);
}
+ if ((mSupportedHandwritingGestureTypes & HandwritingGesture.GESTURE_TYPE_REMOVE_SPACE)
+ == HandwritingGesture.GESTURE_TYPE_REMOVE_SPACE) {
+ list.add(RemoveSpaceGesture.class);
+ }
+ if ((mSupportedHandwritingGestureTypes & HandwritingGesture.GESTURE_TYPE_JOIN_OR_SPLIT)
+ == HandwritingGesture.GESTURE_TYPE_JOIN_OR_SPLIT) {
+ list.add(JoinOrSplitGesture.class);
+ }
return list;
}
diff --git a/core/java/android/view/inputmethod/HandwritingGesture.java b/core/java/android/view/inputmethod/HandwritingGesture.java
index a65933347664..494aaaa32f57 100644
--- a/core/java/android/view/inputmethod/HandwritingGesture.java
+++ b/core/java/android/view/inputmethod/HandwritingGesture.java
@@ -99,15 +99,23 @@ public abstract class HandwritingGesture {
*/
public static final int GESTURE_TYPE_DELETE = 1 << 2;
+ /** Gesture of type {@link RemoveSpaceGesture} to remove whitespace from text. */
+ public static final int GESTURE_TYPE_REMOVE_SPACE = 1 << 3;
+
+ /** Gesture of type {@link JoinOrSplitGesture} to join or split text. */
+ public static final int GESTURE_TYPE_JOIN_OR_SPLIT = 1 << 4;
+
/**
* Type of gesture like {@link #GESTURE_TYPE_SELECT}, {@link #GESTURE_TYPE_INSERT},
* or {@link #GESTURE_TYPE_DELETE}.
*/
@IntDef(prefix = {"GESTURE_TYPE_"}, value = {
- GESTURE_TYPE_NONE,
- GESTURE_TYPE_SELECT,
- GESTURE_TYPE_INSERT,
- GESTURE_TYPE_DELETE})
+ GESTURE_TYPE_NONE,
+ GESTURE_TYPE_SELECT,
+ GESTURE_TYPE_INSERT,
+ GESTURE_TYPE_DELETE,
+ GESTURE_TYPE_REMOVE_SPACE,
+ GESTURE_TYPE_JOIN_OR_SPLIT})
@Retention(RetentionPolicy.SOURCE)
@interface GestureType{}
@@ -121,7 +129,9 @@ public abstract class HandwritingGesture {
@IntDef(flag = true, prefix = {"GESTURE_TYPE_"}, value = {
GESTURE_TYPE_SELECT,
GESTURE_TYPE_INSERT,
- GESTURE_TYPE_DELETE})
+ GESTURE_TYPE_DELETE,
+ GESTURE_TYPE_REMOVE_SPACE,
+ GESTURE_TYPE_JOIN_OR_SPLIT})
@Retention(RetentionPolicy.SOURCE)
public @interface GestureTypeFlags{}
diff --git a/core/java/android/view/inputmethod/InsertGesture.java b/core/java/android/view/inputmethod/InsertGesture.java
index cffdf35b2fb7..8b8359ea5cb2 100644
--- a/core/java/android/view/inputmethod/InsertGesture.java
+++ b/core/java/android/view/inputmethod/InsertGesture.java
@@ -124,7 +124,8 @@ public final class InsertGesture extends HandwritingGesture implements Parcelabl
/**
* Used to make this class parcelable.
*/
- public static final @android.annotation.NonNull Creator<InsertGesture> CREATOR =
+ @NonNull
+ public static final Creator<InsertGesture> CREATOR =
new Creator<InsertGesture>() {
@Override
public InsertGesture createFromParcel(Parcel source) {
diff --git a/core/java/android/view/inputmethod/JoinOrSplitGesture.aidl b/core/java/android/view/inputmethod/JoinOrSplitGesture.aidl
new file mode 100644
index 000000000000..e339b55f4c49
--- /dev/null
+++ b/core/java/android/view/inputmethod/JoinOrSplitGesture.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.inputmethod;
+
+parcelable JoinOrSplitGesture;
diff --git a/core/java/android/view/inputmethod/JoinOrSplitGesture.java b/core/java/android/view/inputmethod/JoinOrSplitGesture.java
new file mode 100644
index 000000000000..2fa80630731d
--- /dev/null
+++ b/core/java/android/view/inputmethod/JoinOrSplitGesture.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.inputmethod;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.graphics.PointF;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Objects;
+
+/**
+ * A subclass of {@link HandwritingGesture} for deleting or inserting whitespace in text. If the
+ * gesture is drawn over whitespace, then the whitespace will be deleted. Otherwise, a space will be
+ * inserted.
+ */
+public final class JoinOrSplitGesture extends HandwritingGesture implements Parcelable {
+
+ private final PointF mPoint;
+
+ private JoinOrSplitGesture(PointF point, String fallbackText) {
+ mType = GESTURE_TYPE_JOIN_OR_SPLIT;
+ mPoint = point;
+ mFallbackText = fallbackText;
+ }
+
+ private JoinOrSplitGesture(@NonNull Parcel source) {
+ mType = GESTURE_TYPE_JOIN_OR_SPLIT;
+ mPoint = source.readTypedObject(PointF.CREATOR);
+ mFallbackText = source.readString8();
+ }
+
+ /**
+ * Returns the gesture point in screen coordinates set with {@link Builder#setJoinOrSplitPoint}.
+ */
+ @NonNull
+ public PointF getJoinOrSplitPoint() {
+ return mPoint;
+ }
+
+ /** Builder for {@link JoinOrSplitGesture}. This class is not designed to be thread-safe. */
+ public static final class Builder {
+ private PointF mPoint;
+ private String mFallbackText;
+
+ /**
+ * Sets the point to apply the join or split operation in screen coordinates.
+ *
+ * <p>If the text cursor position closest to the point is inside or on the boundary of
+ * whitespace, then the whitespace will be deleted, joining the text on either side of the
+ * whitespace. If there are multiple consecutive whitespace characters, then the entire
+ * whitespace block will be deleted.
+ *
+ * <p>Otherwise, if the text cursor position closest to the point is not touching
+ * whitespace, then a space will be inserted at that position.
+ */
+ @NonNull
+ public Builder setJoinOrSplitPoint(@NonNull PointF point) {
+ mPoint = point;
+ return this;
+ }
+
+ /**
+ * Sets fallback text that will be committed at current cursor position if there is no
+ * applicable text beneath the gesture point.
+ */
+ @NonNull
+ public Builder setFallbackText(@Nullable String fallbackText) {
+ mFallbackText = fallbackText;
+ return this;
+ }
+
+ /**
+ * @return {@link JoinOrSplitGesture} using parameters in this {@link Builder}.
+ * @throws IllegalArgumentException if one or more positional parameters are not specified.
+ */
+ @NonNull
+ public JoinOrSplitGesture build() {
+ if (mPoint == null) {
+ throw new IllegalArgumentException("Point must be set.");
+ }
+ return new JoinOrSplitGesture(mPoint, mFallbackText);
+ }
+ }
+
+ /** Used to make this class parcelable. */
+ @NonNull
+ public static final Parcelable.Creator<JoinOrSplitGesture> CREATOR =
+ new Parcelable.Creator<JoinOrSplitGesture>() {
+ @Override
+ public JoinOrSplitGesture createFromParcel(Parcel source) {
+ return new JoinOrSplitGesture(source);
+ }
+
+ @Override
+ public JoinOrSplitGesture[] newArray(int size) {
+ return new JoinOrSplitGesture[size];
+ }
+ };
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mPoint, mFallbackText);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof JoinOrSplitGesture)) return false;
+ JoinOrSplitGesture that = (JoinOrSplitGesture) o;
+ return Objects.equals(mPoint, that.mPoint)
+ && Objects.equals(mFallbackText, that.mFallbackText);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Used to package this object into a {@link Parcel}.
+ *
+ * @param dest {@link Parcel} to be written
+ * @param flags flags used for parceling
+ */
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeTypedObject(mPoint, flags);
+ dest.writeString8(mFallbackText);
+ }
+}
diff --git a/core/java/android/view/inputmethod/RemoveSpaceGesture.aidl b/core/java/android/view/inputmethod/RemoveSpaceGesture.aidl
new file mode 100644
index 000000000000..7aab528b3e27
--- /dev/null
+++ b/core/java/android/view/inputmethod/RemoveSpaceGesture.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.inputmethod;
+
+parcelable RemoveSpaceGesture;
diff --git a/core/java/android/view/inputmethod/RemoveSpaceGesture.java b/core/java/android/view/inputmethod/RemoveSpaceGesture.java
new file mode 100644
index 000000000000..936f25907fbb
--- /dev/null
+++ b/core/java/android/view/inputmethod/RemoveSpaceGesture.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.inputmethod;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SuppressLint;
+import android.graphics.PointF;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Objects;
+
+/** A subclass of {@link HandwritingGesture} for removing whitespace from text. */
+public final class RemoveSpaceGesture extends HandwritingGesture implements Parcelable {
+
+ private final PointF mStartPoint;
+ private final PointF mEndPoint;
+
+ private RemoveSpaceGesture(PointF startPoint, PointF endPoint, String fallbackText) {
+ mType = GESTURE_TYPE_REMOVE_SPACE;
+ mStartPoint = startPoint;
+ mEndPoint = endPoint;
+ mFallbackText = fallbackText;
+ }
+
+ private RemoveSpaceGesture(@NonNull Parcel source) {
+ mType = GESTURE_TYPE_REMOVE_SPACE;
+ mStartPoint = source.readTypedObject(PointF.CREATOR);
+ mEndPoint = source.readTypedObject(PointF.CREATOR);
+ mFallbackText = source.readString8();
+ }
+
+ /** Returns the start point in screen coordinates set with {@link Builder#setPoints}. */
+ @NonNull
+ public PointF getStartPoint() {
+ return mStartPoint;
+ }
+
+ /** Returns the end point in screen coordinates set with {@link Builder#setPoints}. */
+ @NonNull
+ public PointF getEndPoint() {
+ return mEndPoint;
+ }
+
+ /** Builder for {@link RemoveSpaceGesture}. This class is not designed to be thread-safe. */
+ public static final class Builder {
+ private PointF mStartPoint;
+ private PointF mEndPoint;
+ private String mFallbackText;
+
+ /**
+ * Sets the start and end points in screen coordinates of the line to apply the remove space
+ * operation. All whitespace characters touched by the line joining the points will be
+ * deleted.
+ *
+ * <p>The operation will only be performed on a single line of text. If the start and end
+ * points are on different lines of text, the line will be adjusted to cover only the first
+ * line of text containing one of the points.
+ */
+ @NonNull
+ @SuppressLint("MissingGetterMatchingBuilder")
+ public Builder setPoints(@NonNull PointF startPoint, @NonNull PointF endPoint) {
+ mStartPoint = startPoint;
+ mEndPoint = endPoint;
+ return this;
+ }
+
+ /**
+ * Sets fallback text that will be committed at current cursor position if there is no
+ * whitespace beneath the gesture line.
+ */
+ @NonNull
+ public Builder setFallbackText(@Nullable String fallbackText) {
+ mFallbackText = fallbackText;
+ return this;
+ }
+
+ /**
+ * @return {@link RemoveSpaceGesture} using parameters in this {@link Builder}.
+ * @throws IllegalArgumentException if one or more positional parameters are not specified.
+ */
+ @NonNull
+ public RemoveSpaceGesture build() {
+ if (mStartPoint == null || mEndPoint == null) {
+ throw new IllegalArgumentException("Start and end points must be set.");
+ }
+ return new RemoveSpaceGesture(mStartPoint, mEndPoint, mFallbackText);
+ }
+ }
+
+ /** Used to make this class parcelable. */
+ @NonNull
+ public static final Parcelable.Creator<RemoveSpaceGesture> CREATOR =
+ new Parcelable.Creator<RemoveSpaceGesture>() {
+ @Override
+ public RemoveSpaceGesture createFromParcel(Parcel source) {
+ return new RemoveSpaceGesture(source);
+ }
+
+ @Override
+ public RemoveSpaceGesture[] newArray(int size) {
+ return new RemoveSpaceGesture[size];
+ }
+ };
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mStartPoint, mEndPoint, mFallbackText);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof RemoveSpaceGesture)) return false;
+ RemoveSpaceGesture that = (RemoveSpaceGesture) o;
+ return Objects.equals(mStartPoint, that.mStartPoint)
+ && Objects.equals(mEndPoint, that.mEndPoint)
+ && Objects.equals(mFallbackText, that.mFallbackText);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Used to package this object into a {@link Parcel}.
+ *
+ * @param dest {@link Parcel} to be written
+ * @param flags flags used for parceling
+ */
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ dest.writeTypedObject(mStartPoint, flags);
+ dest.writeTypedObject(mEndPoint, flags);
+ dest.writeString8(mFallbackText);
+ }
+}
diff --git a/core/java/android/view/inputmethod/SelectGesture.java b/core/java/android/view/inputmethod/SelectGesture.java
index 5b685176b4a3..2f02e66d4295 100644
--- a/core/java/android/view/inputmethod/SelectGesture.java
+++ b/core/java/android/view/inputmethod/SelectGesture.java
@@ -63,8 +63,7 @@ public final class SelectGesture extends HandwritingGesture implements Parcelabl
/**
* Returns the Selection area {@link RectF} in screen coordinates.
*
- * Getter for selection area set with {@link Builder#setSelectionArea(RectF)}. {@code null}
- * if area was not set.
+ * Getter for selection area set with {@link Builder#setSelectionArea(RectF)}.
*/
@NonNull
public RectF getSelectionArea() {
@@ -126,7 +125,7 @@ public final class SelectGesture extends HandwritingGesture implements Parcelabl
}
/**
- * @return {@link SelectGesture} using parameters in this {@link InsertGesture.Builder}.
+ * @return {@link SelectGesture} using parameters in this {@link Builder}.
* @throws IllegalArgumentException if one or more positional parameters are not specified.
*/
@NonNull
@@ -144,7 +143,8 @@ public final class SelectGesture extends HandwritingGesture implements Parcelabl
/**
* Used to make this class parcelable.
*/
- public static final @android.annotation.NonNull Parcelable.Creator<SelectGesture> CREATOR =
+ @NonNull
+ public static final Parcelable.Creator<SelectGesture> CREATOR =
new Parcelable.Creator<SelectGesture>() {
@Override
public SelectGesture createFromParcel(Parcel source) {
diff --git a/core/java/com/android/internal/inputmethod/IRemoteInputConnection.aidl b/core/java/com/android/internal/inputmethod/IRemoteInputConnection.aidl
index 7a219c61bafb..f456e85adff4 100644
--- a/core/java/com/android/internal/inputmethod/IRemoteInputConnection.aidl
+++ b/core/java/com/android/internal/inputmethod/IRemoteInputConnection.aidl
@@ -25,6 +25,8 @@ import android.view.inputmethod.DeleteGesture;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputContentInfo;
import android.view.inputmethod.InsertGesture;
+import android.view.inputmethod.JoinOrSplitGesture;
+import android.view.inputmethod.RemoveSpaceGesture;
import android.view.inputmethod.SelectGesture;
import android.view.inputmethod.TextAttribute;
@@ -99,6 +101,12 @@ import com.android.internal.inputmethod.InputConnectionCommandHeader;
void performHandwritingDeleteGesture(in InputConnectionCommandHeader header,
in DeleteGesture gesture, in ResultReceiver resultReceiver);
+ void performHandwritingRemoveSpaceGesture(in InputConnectionCommandHeader header,
+ in RemoveSpaceGesture gesture, in ResultReceiver resultReceiver);
+
+ void performHandwritingJoinOrSplitGesture(in InputConnectionCommandHeader header,
+ in JoinOrSplitGesture gesture, in ResultReceiver resultReceiver);
+
void setComposingRegion(in InputConnectionCommandHeader header, int start, int end);
void setComposingRegionWithTextAttribute(in InputConnectionCommandHeader header, int start,
diff --git a/core/java/com/android/internal/inputmethod/InputMethodDebug.java b/core/java/com/android/internal/inputmethod/InputMethodDebug.java
index 1852c593535b..a4a59115dcfe 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodDebug.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodDebug.java
@@ -20,7 +20,6 @@ import android.annotation.Nullable;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
-import android.view.autofill.AutofillManager;
import android.view.inputmethod.HandwritingGesture;
import java.util.StringJoiner;
@@ -277,6 +276,12 @@ public final class InputMethodDebug {
if ((gestureTypeFlags & HandwritingGesture.GESTURE_TYPE_DELETE) != 0) {
joiner.add("DELETE");
}
+ if ((gestureTypeFlags & HandwritingGesture.GESTURE_TYPE_REMOVE_SPACE) != 0) {
+ joiner.add("REMOVE_SPACE");
+ }
+ if ((gestureTypeFlags & HandwritingGesture.GESTURE_TYPE_JOIN_OR_SPLIT) != 0) {
+ joiner.add("JOIN_OR_SPLIT");
+ }
return joiner.setEmptyValue("(none)").toString();
}
diff --git a/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java b/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java
index dd173a6dfef5..6a7028d31edb 100644
--- a/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java
+++ b/core/java/com/android/internal/inputmethod/RemoteInputConnectionImpl.java
@@ -48,6 +48,8 @@ import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputContentInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InsertGesture;
+import android.view.inputmethod.JoinOrSplitGesture;
+import android.view.inputmethod.RemoveSpaceGesture;
import android.view.inputmethod.SelectGesture;
import android.view.inputmethod.TextAttribute;
import android.view.inputmethod.TextSnapshot;
@@ -997,6 +999,22 @@ public final class RemoteInputConnectionImpl extends IRemoteInputConnection.Stub
performHandwritingGestureInternal(header, gesture, resultReceiver);
}
+ @Dispatching(cancellable = true)
+ @Override
+ public void performHandwritingRemoveSpaceGesture(
+ InputConnectionCommandHeader header, RemoveSpaceGesture gesture,
+ ResultReceiver resultReceiver) {
+ performHandwritingGestureInternal(header, gesture, resultReceiver);
+ }
+
+ @Dispatching(cancellable = true)
+ @Override
+ public void performHandwritingJoinOrSplitGesture(
+ InputConnectionCommandHeader header, JoinOrSplitGesture gesture,
+ ResultReceiver resultReceiver) {
+ performHandwritingGestureInternal(header, gesture, resultReceiver);
+ }
+
private <T extends HandwritingGesture> void performHandwritingGestureInternal(
InputConnectionCommandHeader header, T gesture, ResultReceiver resultReceiver) {
dispatchWithTracing("performHandwritingGesture", () -> {