From 5c53f0ca67a54b80e648e9e4896c348701745895 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Tue, 8 Mar 2022 18:49:01 +0000 Subject: [PATCH] Remove ImsConfigTracker#onBindInput precondition It is expected the onIntialize() is called before onBindInput(), however it's not precisely known why onBindInput() is being called prior to onIntialize(). Once possibility is it could be that onDestory() is being called and init was skipped and call made it to onBindInput(). Replacing precondition with an early return should be safe here. Fix: 223083664 Bug: 223443508 Test: atest CtsInputMethodTestCases Change-Id: I8312d98b0349fbc661b6eb0f4c47bea25ffbb2a9 --- .../android/inputmethodservice/ImsConfigurationTracker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/java/android/inputmethodservice/ImsConfigurationTracker.java b/core/java/android/inputmethodservice/ImsConfigurationTracker.java index 3c788884371b0..30ef0a2a6f7f1 100644 --- a/core/java/android/inputmethodservice/ImsConfigurationTracker.java +++ b/core/java/android/inputmethodservice/ImsConfigurationTracker.java @@ -63,8 +63,9 @@ public final class ImsConfigurationTracker { */ @MainThread public void onBindInput(@Nullable Resources resources) { - Preconditions.checkState(mInitialized, - "onBindInput can be called only after onInitialize()."); + if (!mInitialized) { + return; + } if (mLastKnownConfig == null && resources != null) { mLastKnownConfig = new Configuration(resources.getConfiguration()); }