From f1a82ef0ef906444a03755b56820a679de92c14e Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Thu, 24 Feb 2022 06:32:49 -0800 Subject: Configure handwriting window with the IME's pid and uid for ANRs When starting a handwriting session, update the handwriting input window so that it is configured with the IME's pid and uid. This means any ANRs that occur due to the handwriting input window will be directed to the IME process. Since oneway binder calls do not have pid information, we cannot use Binder.getCallingPid() to get the pid of the IME. Instead, we report the pid from IMS when starting handwriting. Bug: 210978621 Test: manual with custom IME, verify ANR is directed to IME. Change-Id: Ia6963eb02cad22c7f604896e6c78ed31c84e32f6 Merged-In: Ia6963eb02cad22c7f604896e6c78ed31c84e32f6 (cherry picked from commit 58df52232a31ab27fcc995c3223999ba526a8dd1) --- core/java/android/inputmethodservice/InputMethodService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/java/android/inputmethodservice/InputMethodService.java') diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index c3e3180b6717..fbc0732affe1 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -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. -- cgit v1.2.3