Loading core/java/android/service/autofill/InlineSuggestionRenderService.java +11 −9 Original line number Diff line number Diff line Loading @@ -144,22 +144,24 @@ public abstract class InlineSuggestionRenderService extends Service { final SurfaceControlViewHost host = new SurfaceControlViewHost(this, getDisplay(), hostInputToken); host.setView(suggestionRoot, lp); suggestionRoot.setOnClickListener((v) -> { // Set the suggestion view to be non-focusable so that if its background is set to a // ripple drawable, the ripple won't be shown initially. suggestionView.setFocusable(false); suggestionView.setOnClickListener((v) -> { try { if (suggestionView.hasOnClickListeners()) { suggestionView.callOnClick(); } callback.onClick(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onClick()"); } }); suggestionRoot.setOnLongClickListener((v) -> { try { if (suggestionView.hasOnLongClickListeners()) { suggestionView.performLongClick(); final View.OnLongClickListener onLongClickListener = suggestionView.getOnLongClickListener(); suggestionView.setOnLongClickListener((v) -> { if (onLongClickListener != null) { onLongClickListener.onLongClick(v); } try { callback.onLongClick(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onLongClick()"); Loading core/java/android/service/autofill/InlineSuggestionRoot.java +2 −7 Original line number Diff line number Diff line Loading @@ -51,14 +51,9 @@ public class InlineSuggestionRoot extends FrameLayout { setFocusable(false); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return true; } @Override @SuppressLint("ClickableViewAccessibility") public boolean onTouchEvent(@NonNull MotionEvent event) { public boolean dispatchTouchEvent(@NonNull MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: { mDownX = event.getX(); Loading @@ -80,6 +75,6 @@ public class InlineSuggestionRoot extends FrameLayout { } } break; } return super.onTouchEvent(event); return super.dispatchTouchEvent(event); } } core/java/android/view/View.java +10 −0 Original line number Diff line number Diff line Loading @@ -7262,6 +7262,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return (li != null && li.mOnLongClickListener != null); } /** * @return the registered {@link OnLongClickListener} if there is one, {@code null} otherwise. * @hide */ @Nullable public OnLongClickListener getOnLongClickListener() { ListenerInfo li = mListenerInfo; return (li != null) ? li.mOnLongClickListener : null; } /** * Register a callback to be invoked when this view is context clicked. If the view is not * context clickable, it becomes context clickable. Loading
core/java/android/service/autofill/InlineSuggestionRenderService.java +11 −9 Original line number Diff line number Diff line Loading @@ -144,22 +144,24 @@ public abstract class InlineSuggestionRenderService extends Service { final SurfaceControlViewHost host = new SurfaceControlViewHost(this, getDisplay(), hostInputToken); host.setView(suggestionRoot, lp); suggestionRoot.setOnClickListener((v) -> { // Set the suggestion view to be non-focusable so that if its background is set to a // ripple drawable, the ripple won't be shown initially. suggestionView.setFocusable(false); suggestionView.setOnClickListener((v) -> { try { if (suggestionView.hasOnClickListeners()) { suggestionView.callOnClick(); } callback.onClick(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onClick()"); } }); suggestionRoot.setOnLongClickListener((v) -> { try { if (suggestionView.hasOnLongClickListeners()) { suggestionView.performLongClick(); final View.OnLongClickListener onLongClickListener = suggestionView.getOnLongClickListener(); suggestionView.setOnLongClickListener((v) -> { if (onLongClickListener != null) { onLongClickListener.onLongClick(v); } try { callback.onLongClick(); } catch (RemoteException e) { Log.w(TAG, "RemoteException calling onLongClick()"); Loading
core/java/android/service/autofill/InlineSuggestionRoot.java +2 −7 Original line number Diff line number Diff line Loading @@ -51,14 +51,9 @@ public class InlineSuggestionRoot extends FrameLayout { setFocusable(false); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return true; } @Override @SuppressLint("ClickableViewAccessibility") public boolean onTouchEvent(@NonNull MotionEvent event) { public boolean dispatchTouchEvent(@NonNull MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: { mDownX = event.getX(); Loading @@ -80,6 +75,6 @@ public class InlineSuggestionRoot extends FrameLayout { } } break; } return super.onTouchEvent(event); return super.dispatchTouchEvent(event); } }
core/java/android/view/View.java +10 −0 Original line number Diff line number Diff line Loading @@ -7262,6 +7262,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return (li != null && li.mOnLongClickListener != null); } /** * @return the registered {@link OnLongClickListener} if there is one, {@code null} otherwise. * @hide */ @Nullable public OnLongClickListener getOnLongClickListener() { ListenerInfo li = mListenerInfo; return (li != null) ? li.mOnLongClickListener : null; } /** * Register a callback to be invoked when this view is context clicked. If the view is not * context clickable, it becomes context clickable.