Loading core/java/android/inputmethodservice/InkWindow.java +12 −0 Original line number Diff line number Diff line Loading @@ -26,13 +26,17 @@ import android.annotation.NonNull; import android.content.Context; import android.os.IBinder; import android.util.Slog; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewRootImpl; import android.view.ViewTreeObserver; import android.view.WindowManager; import com.android.internal.policy.PhoneWindow; import java.util.Objects; /** * Window of type {@code LayoutParams.TYPE_INPUT_METHOD_DIALOG} for drawing * Handwriting Ink on screen. Loading Loading @@ -185,4 +189,12 @@ final class InkWindow extends PhoneWindow { return getDecorView().getVisibility() == View.VISIBLE && mInkView != null && mInkView.isVisibleToUser(); } void dispatchHandwritingEvent(@NonNull MotionEvent event) { final View decor = getDecorView(); Objects.requireNonNull(decor); final ViewRootImpl viewRoot = decor.getViewRootImpl(); Objects.requireNonNull(viewRoot); viewRoot.enqueueInputEvent(event); } } core/java/android/inputmethodservice/InputMethodService.java +2 −2 Original line number Diff line number Diff line Loading @@ -2563,7 +2563,7 @@ public class InputMethodService extends AbstractInputMethodService { */ public void onStylusHandwritingMotionEvent(@NonNull MotionEvent motionEvent) { if (mInkWindow != null && mInkWindow.isInkViewVisible()) { mInkWindow.getDecorView().dispatchTouchEvent(motionEvent); mInkWindow.dispatchHandwritingEvent(motionEvent); } else { if (mPendingEvents == null) { mPendingEvents = new RingBuffer(MotionEvent.class, MAX_EVENTS_BUFFER); Loading @@ -2576,7 +2576,7 @@ public class InputMethodService extends AbstractInputMethodService { if (mInkWindow == null) { break; } mInkWindow.getDecorView().dispatchTouchEvent(event); mInkWindow.dispatchHandwritingEvent(event); } mPendingEvents.clear(); } Loading core/java/android/view/ViewRootImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -9272,7 +9272,7 @@ public final class ViewRootImpl implements ViewParent, } @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) void enqueueInputEvent(InputEvent event) { public void enqueueInputEvent(InputEvent event) { enqueueInputEvent(event, null, 0, false); } Loading services/core/java/com/android/server/inputmethod/HandwritingModeController.java +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.view.InputChannel; import android.view.InputEvent; import android.view.InputEventReceiver; import android.view.MotionEvent; import android.view.PointerIcon; import android.view.SurfaceControl; import android.view.View; import android.view.inputmethod.InputMethodManager; Loading Loading @@ -273,6 +274,9 @@ final class HandwritingModeController { } mHandwritingSurface.startIntercepting(imePid, imeUid); // Unset the pointer icon for the stylus in case the app had set it. InputManagerGlobal.getInstance().setPointerIconType(PointerIcon.TYPE_NOT_SPECIFIED); return new HandwritingSession(mCurrentRequestId, mHandwritingSurface.getInputChannel(), mHandwritingBuffer); } Loading Loading
core/java/android/inputmethodservice/InkWindow.java +12 −0 Original line number Diff line number Diff line Loading @@ -26,13 +26,17 @@ import android.annotation.NonNull; import android.content.Context; import android.os.IBinder; import android.util.Slog; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewRootImpl; import android.view.ViewTreeObserver; import android.view.WindowManager; import com.android.internal.policy.PhoneWindow; import java.util.Objects; /** * Window of type {@code LayoutParams.TYPE_INPUT_METHOD_DIALOG} for drawing * Handwriting Ink on screen. Loading Loading @@ -185,4 +189,12 @@ final class InkWindow extends PhoneWindow { return getDecorView().getVisibility() == View.VISIBLE && mInkView != null && mInkView.isVisibleToUser(); } void dispatchHandwritingEvent(@NonNull MotionEvent event) { final View decor = getDecorView(); Objects.requireNonNull(decor); final ViewRootImpl viewRoot = decor.getViewRootImpl(); Objects.requireNonNull(viewRoot); viewRoot.enqueueInputEvent(event); } }
core/java/android/inputmethodservice/InputMethodService.java +2 −2 Original line number Diff line number Diff line Loading @@ -2563,7 +2563,7 @@ public class InputMethodService extends AbstractInputMethodService { */ public void onStylusHandwritingMotionEvent(@NonNull MotionEvent motionEvent) { if (mInkWindow != null && mInkWindow.isInkViewVisible()) { mInkWindow.getDecorView().dispatchTouchEvent(motionEvent); mInkWindow.dispatchHandwritingEvent(motionEvent); } else { if (mPendingEvents == null) { mPendingEvents = new RingBuffer(MotionEvent.class, MAX_EVENTS_BUFFER); Loading @@ -2576,7 +2576,7 @@ public class InputMethodService extends AbstractInputMethodService { if (mInkWindow == null) { break; } mInkWindow.getDecorView().dispatchTouchEvent(event); mInkWindow.dispatchHandwritingEvent(event); } mPendingEvents.clear(); } Loading
core/java/android/view/ViewRootImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -9272,7 +9272,7 @@ public final class ViewRootImpl implements ViewParent, } @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) void enqueueInputEvent(InputEvent event) { public void enqueueInputEvent(InputEvent event) { enqueueInputEvent(event, null, 0, false); } Loading
services/core/java/com/android/server/inputmethod/HandwritingModeController.java +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.view.InputChannel; import android.view.InputEvent; import android.view.InputEventReceiver; import android.view.MotionEvent; import android.view.PointerIcon; import android.view.SurfaceControl; import android.view.View; import android.view.inputmethod.InputMethodManager; Loading Loading @@ -273,6 +274,9 @@ final class HandwritingModeController { } mHandwritingSurface.startIntercepting(imePid, imeUid); // Unset the pointer icon for the stylus in case the app had set it. InputManagerGlobal.getInstance().setPointerIconType(PointerIcon.TYPE_NOT_SPECIFIED); return new HandwritingSession(mCurrentRequestId, mHandwritingSurface.getInputChannel(), mHandwritingBuffer); } Loading