From 4097a20b36c7a6678f2b7486d587b7c43852c2e1 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 23 Oct 2014 12:36:42 +0900 Subject: [PATCH] Fix a concurrency bug that ends up in a crash. Bug: 18085768 Change-Id: I016bec997787839526ddfc521ebb99d0c7b05189 --- .../com/android/inputmethod/latin/RichInputConnection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index be1523f63..69f0b3eb3 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -367,7 +367,9 @@ public final class RichInputConnection implements PrivateCommandPerformer { } // This never calls InputConnection#getCapsMode - in fact, it's a static method that // never blocks or initiates IPC. - return CapsModeUtils.getCapsMode(mCommittedTextBeforeComposingText, inputType, + // TODO: don't call #toString() here. Instead, all accesses to + // mCommittedTextBeforeComposingText should be done on the main thread. + return CapsModeUtils.getCapsMode(mCommittedTextBeforeComposingText.toString(), inputType, spacingAndPunctuations, hasSpaceBefore); }