aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing-Shin Lu <lumark@google.com>2021-05-28 09:39:44 +0800
committerMing-Shin Lu <lumark@google.com>2021-05-28 10:18:03 +0800
commit407f8a3216ad1ec403ed1c3aeb7c46192eae3cd8 (patch)
tree5d5bec9ea21687e55f45f73efc526be79e54a0ab
parent685abcb913a626bce9cac9e4cab61eb51d86660f (diff)
downloadlatinime-407f8a3216ad1ec403ed1c3aeb7c46192eae3cd8.tar.gz
latinime-407f8a3216ad1ec403ed1c3aeb7c46192eae3cd8.tar.xz
latinime-407f8a3216ad1ec403ed1c3aeb7c46192eae3cd8.zip
Fix Keyboard Theme update when device orientation changed
As CL[1] introduces diplayContext to address IME service context's Resources / DisplayMetrics update when switching IME window to another display after onConfigurationChange. In LatinIME#onInitializeInterface, we only update keyboard theme context and displayContent when the displayId is changed, but overlooked even the displayId is the same, the display context's resource configuration might changed like the device orientation changd. It leads getDefaultKeyboardHeight will get wrong config_max_keyboard_height fraction value when rotating to landcape because the context resources didn't get updated. Add a check to update keyboard theme context when the current display configuation is changed accordingly. [1]: I0ed6a079af1ed90c75fee1d36d5ce3ef3c41f8ed Fix: 186507147 Test: manual as issue steps 1) Turn on auto-rotate 2) Open Settings 3) Rotating the device to landscape mode 4) Tap “Search settings", verify if the soft-keyboard shown and the size is expected. Change-Id: I288a31baf04fa2e63d6b4a14ad81b401cb36ece5
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 737bd0d3e..a99f0b48c 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -803,7 +803,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// create new display context and re-init keyboard layout with this context.
final WindowManager wm = getSystemService(WindowManager.class);
final int newDisplayId = wm.getDefaultDisplay().getDisplayId();
- if (mCurDisplayId != newDisplayId) {
+ if (mCurDisplayId != newDisplayId || !mDisplayContext.getResources().getConfiguration()
+ .equals(getResources().getConfiguration())) {
mCurDisplayId = newDisplayId;
mDisplayContext = createDisplayContext(wm.getDefaultDisplay());
mKeyboardSwitcher.updateKeyboardTheme(mDisplayContext);