summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Taran Singh <tarandeep@google.com> 2024-01-30 19:00:26 +0000
committer Taran Singh <tarandeep@google.com> 2024-01-30 19:00:26 +0000
commitcbf70c0b66d18bf6decf0dc61ee958d3702622c3 (patch)
treee25e1096a985bf78fe477ed61c1efcaef52733cb
parentcc142cee16c3b1ee01bec66e038e01f473c38377 (diff)
Handle NPE for toolType update with hardware keyboard
When hardware keyboard is used with no active editor. Fix: 322634243 Bug: 298149197 Test: atest StylusHandwritingTest Change-Id: Ia2a9987c924566dd4001b2ef5af5e1071e3cae34
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 71698e4f4469..281ee500f741 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -1256,7 +1256,9 @@ public class InputMethodService extends AbstractInputMethodService {
private void updateEditorToolTypeInternal(int toolType) {
if (Flags.useHandwritingListenerForTooltype()) {
mLastUsedToolType = toolType;
- mInputEditorInfo.setInitialToolType(toolType);
+ if (mInputEditorInfo != null) {
+ mInputEditorInfo.setInitialToolType(toolType);
+ }
}
onUpdateEditorToolType(toolType);
}