From abb12ed4f2fe5843d5f23a1b3d29ade4f9da76e0 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Tue, 19 Apr 2016 18:13:44 +0900 Subject: [PATCH] Allow switching keyboard layout to null. Previously, PersistentDataStore#switchKeyboardLayout doesn't allow switching keyboard layout to null, which means default layout. As a result, when no keyboard layout is corresponding to the new subtype, previous keyboard layout continues to be used on switching subtpyes. Bug: 27750850 Change-Id: Ie5c6ef7944ade48907a5b92986578f9f40b0f499 --- .../java/com/android/server/input/PersistentDataStore.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/input/PersistentDataStore.java b/services/core/java/com/android/server/input/PersistentDataStore.java index e97aca886c030..f67e0fdee0fb7 100644 --- a/services/core/java/com/android/server/input/PersistentDataStore.java +++ b/services/core/java/com/android/server/input/PersistentDataStore.java @@ -25,6 +25,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; +import android.annotation.Nullable; import android.view.Surface; import android.hardware.input.TouchCalibration; import android.text.TextUtils; @@ -342,6 +343,7 @@ final class PersistentDataStore { "x_ymix", "x_offset", "y_xmix", "y_scale", "y_offset" }; private TouchCalibration[] mTouchCalibration = new TouchCalibration[4]; + @Nullable private String mCurrentKeyboardLayout; private List mUnassociatedKeyboardLayouts = new ArrayList<>(); private ArrayMap mKeyboardLayouts = new ArrayMap<>(); @@ -368,6 +370,7 @@ final class PersistentDataStore { } } + @Nullable public String getCurrentKeyboardLayout() { return mCurrentKeyboardLayout; } @@ -443,7 +446,7 @@ final class PersistentDataStore { public boolean switchKeyboardLayout(InputMethodSubtypeHandle imeHandle) { final String layout = mKeyboardLayouts.get(imeHandle); - if (layout != null && !TextUtils.equals(mCurrentKeyboardLayout, layout)) { + if (!TextUtils.equals(mCurrentKeyboardLayout, layout)) { mCurrentKeyboardLayout = layout; return true; }