Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 987c93ce authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Configure handwriting window with the IME's pid and uid for ANRs" into tm-dev

parents 386362eb f1a82ef0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Process;
import android.os.ResultReceiver;
import android.os.SystemClock;
import android.os.SystemProperties;
@@ -926,7 +927,7 @@ public class InputMethodService extends AbstractInputMethodService {
                mOnPreparedStylusHwCalled = true;
            }
            if (onStartStylusHandwriting()) {
                mPrivOps.onStylusHandwritingReady(requestId);
                mPrivOps.onStylusHandwritingReady(requestId, Process.myPid());
            } else {
                Log.i(TAG, "IME is not ready. Can't start Stylus Handwriting");
                // TODO(b/210039666): see if it's valuable to propagate this back to IMM.
+1 −1
Original line number Diff line number Diff line
@@ -42,6 +42,6 @@ oneway interface IInputMethodPrivilegedOperations {
    void shouldOfferSwitchingToNextInputMethod(in AndroidFuture future /* T=Boolean */);
    void notifyUserActionAsync();
    void applyImeVisibilityAsync(IBinder showOrHideInputToken, boolean setVisible);
    void onStylusHandwritingReady(int requestId);
    void onStylusHandwritingReady(int requestId, int pid);
    void finishStylusHandwriting(int requestId);
}
+3 −3
Original line number Diff line number Diff line
@@ -396,16 +396,16 @@ public final class InputMethodPrivilegedOperations {
    }

    /**
     * Calls {@link IInputMethodPrivilegedOperations#onStylusHandwritingReady()}
     * Calls {@link IInputMethodPrivilegedOperations#onStylusHandwritingReady(int, int)}
     */
    @AnyThread
    public void onStylusHandwritingReady(int requestId) {
    public void onStylusHandwritingReady(int requestId, int pid) {
        final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull();
        if (ops == null) {
            return;
        }
        try {
            ops.onStylusHandwritingReady(requestId);
            ops.onStylusHandwritingReady(requestId, pid);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+7 −6
Original line number Diff line number Diff line
@@ -82,13 +82,14 @@ final class HandwritingEventReceiverSurface {
        mIsIntercepting = false;
    }

    void startIntercepting() {
        // TODO(b/210978621): Update the spy window's PID and UID to be associated with the IME so
        //  that ANRs are correctly attributed to the IME.
        final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
    void startIntercepting(int imePid, int imeUid) {
        mWindowHandle.ownerPid = imePid;
        mWindowHandle.ownerUid = imeUid;
        mWindowHandle.inputFeatures &= ~WindowManager.LayoutParams.INPUT_FEATURE_SPY;
        t.setInputWindowInfo(mInputSurface, mWindowHandle);
        t.apply();

        new SurfaceControl.Transaction()
                .setInputWindowInfo(mInputSurface, mWindowHandle)
                .apply();
        mIsIntercepting = true;
    }

+2 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ final class HandwritingModeController {
     */
    @UiThread
    @Nullable
    HandwritingSession startHandwritingSession(int requestId) {
    HandwritingSession startHandwritingSession(int requestId, int imePid, int imeUid) {
        if (mHandwritingSurface == null) {
            Slog.e(TAG, "Cannot start handwriting session: Handwriting was not initialized.");
            return null;
@@ -160,7 +160,7 @@ final class HandwritingModeController {
            throw new IllegalStateException(
                    "Handwriting surface should not be already intercepting.");
        }
        mHandwritingSurface.startIntercepting();
        mHandwritingSurface.startIntercepting(imePid, imeUid);

        return new HandwritingSession(mCurrentRequestId, mHandwritingSurface.getInputChannel(),
                mHandwritingBuffer);
Loading