Intercept the click from inline suggestion child view.
* so that the parent view's onClick, onLongClick listeners
as well as scrolling still works
* explicitly invoke child view's onClick and onLongClick
listeners from the parent view's listeners
Test: manual verification
Bug: 150321630
Change-Id: Ie9e9b5a17fa15b502c51a2fbb6af2c09a77d567f
diff --git a/core/java/android/service/autofill/InlineSuggestionRenderService.java b/core/java/android/service/autofill/InlineSuggestionRenderService.java
index f0a72c5..7fbc309 100644
--- a/core/java/android/service/autofill/InlineSuggestionRenderService.java
+++ b/core/java/android/service/autofill/InlineSuggestionRenderService.java
@@ -97,6 +97,9 @@
host.setView(suggestionRoot, lp);
suggestionRoot.setOnClickListener((v) -> {
try {
+ if (suggestionView.hasOnClickListeners()) {
+ suggestionView.callOnClick();
+ }
callback.onClick();
} catch (RemoteException e) {
Log.w(TAG, "RemoteException calling onClick()");
@@ -105,6 +108,9 @@
suggestionRoot.setOnLongClickListener((v) -> {
try {
+ if (suggestionView.hasOnLongClickListeners()) {
+ suggestionView.performLongClick();
+ }
callback.onLongClick();
} catch (RemoteException e) {
Log.w(TAG, "RemoteException calling onLongClick()");
diff --git a/core/java/android/service/autofill/InlineSuggestionRoot.java b/core/java/android/service/autofill/InlineSuggestionRoot.java
index bdcc253..6c9d36b 100644
--- a/core/java/android/service/autofill/InlineSuggestionRoot.java
+++ b/core/java/android/service/autofill/InlineSuggestionRoot.java
@@ -52,6 +52,11 @@
}
@Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ return true;
+ }
+
+ @Override
@SuppressLint("ClickableViewAccessibility")
public boolean onTouchEvent(@NonNull MotionEvent event) {
switch (event.getActionMasked()) {