diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-01-12 00:00:39 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-01-12 00:00:39 +0000 |
commit | 96a5b99b4c3aeebb9d86a4f342fa8902fd85915b (patch) | |
tree | de8a15a062336bcccceeabdafd5f638ad1a70ba2 | |
parent | 22f8409507a75faa9fe8d0d99ee4c971e4c5a15a (diff) | |
parent | e0caa3b4afaf540dd6d2943dcf59528bdf7f4145 (diff) | |
download | development-android12L-d2-s1-release.tar.gz |
Snap for 8068644 from e0caa3b4afaf540dd6d2943dcf59528bdf7f4145 to sc-d2-releaseandroid-12.1.0_r26android-12.1.0_r25android-12.1.0_r24android-12.1.0_r23android-12.1.0_r18android-12.1.0_r17android-12.1.0_r16android-12.1.0_r15android-12.1.0_r14android-12.1.0_r13android-12.1.0_r12android12L-d2-s8-releaseandroid12L-d2-s7-releaseandroid12L-d2-s6-releaseandroid12L-d2-s5-releaseandroid12L-d2-s4-releaseandroid12L-d2-s3-releaseandroid12L-d2-s2-releaseandroid12L-d2-s1-releaseandroid12L-d2-release
Change-Id: I82344b739edab4c22ab0691bfba57c1485c2bcb5
-rw-r--r-- | samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java index b76005fbf..c9f61ae48 100644 --- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java +++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java @@ -96,8 +96,17 @@ public class SoftKeyboard extends InputMethodService } /** - * Create new context object whose resources are adjusted to match the metrics of the display - * which is managed by WindowManager. + * Returns the context object whose resources are adjusted to match the metrics of the display. + * + * Note that before {@link android.os.Build.VERSION_CODES#KITKAT}, there is no way to support + * multi-display scenarios, so the context object will just return the IME context itself. + * + * With initiating multi-display APIs from {@link android.os.Build.VERSION_CODES#KITKAT}, the + * context object has to return with re-creating the display context according the metrics + * of the display in runtime. + * + * Starts from {@link android.os.Build.VERSION_CODES#S_V2}, the returning context object has + * became to IME context self since it ends up capable of updating its resources internally. * * @see {@link Context#createDisplayContext(Display)} */ @@ -106,8 +115,10 @@ public class SoftKeyboard extends InputMethodService // createDisplayContext is not available. return this; } - // TODO (b/133825283): Non-activity components Resources / DisplayMetrics update when - // moving to external display. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2) { + // IME context sources is now managed by WindowProviderService from Android 12L. + return this; + } // An issue in Q that non-activity components Resources / DisplayMetrics in // Context doesn't well updated when the IME window moving to external display. // Currently we do a workaround is to create new display context directly and re-init |