summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'android-13.0.0_r16' into t13.0George Zacharia2022-12-151-4/+13
|\ | | | | | | | | | | | | | | | | | | | | Android 13.0.0 Release 16 (TQ1A.221205.011) Also included the following reverts: 1. Revert "fw/b: Import Wi-Fi standard icon [1/2]" 2. Revert "Add preference for toggling the wallpaper zooming animation" Co-authored-by: Semavi Ulusoy <doc.divxm@gmail.com> Change-Id: I9a6b51e452c28d10411712c59778bb54da5783e9
| * Refine {SHOW,HIDE}_MY_SOFT_INPUT constantsWilson Wu2022-08-101-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Naming of SoftInputShowHideReason#{SHOW,HIDE}_MY_SOFT_INPUT constants may not clear enough to indicate its semantics. Improve show/hide reasons of InputMethodService by: -. Update constants naming to {SHOW,HIDE}_SOFT_INPUT_FROM_IME. -. Introduce respective reasons to indicate different hide request cases within IME process. Bug: 224565148 Bug: 241890033 Test: presubmit Test: atest CtsInputMethodTestCases and observe logs Change-Id: I8b148e9b5ab05ff7b827c6b8fe23008ca30a8c4b Merged-In: I8b148e9b5ab05ff7b827c6b8fe23008ca30a8c4b
* | Framework: Volume key cursor controlKonsta2022-10-211-0/+33
|/ | | | | | | This feature is moved to framework so it also works with third party keyboards. Change-Id: I8e20240e7bee5351ab20bb3d701eb95a5fd3e112
* Prevent callback registration when back flag is disabledVadim Caen2022-06-201-1/+2
| | | | | | | | | | | | | | | | When the enableOnBackInvokedCallback is set to false (or not set), registering an OnBackInvokedCallback should be a no-op to avoid overriding the default compat callback. Test: Manual testing registering a callback on an app with the flag disabled and doing a back gesture. Currently we don't have test executing a back gesture so automated tests are not possible Bug: 235206960 Change-Id: I54d843f11130a78ed5a68cbe4722e601a2086ee1 Merged-In: I54d843f11130a78ed5a68cbe4722e601a2086ee1 (cherry picked from commit aa48dc3c2db92189055804878b88a51f0cf8e955)
* Fix IME callback not unregistered when IME is up during an IMM clientShan Huang2022-06-011-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | switch. This can happen when one navigates from an activity showing IME to another activity requesting to show IME. The following sequence would happen: - IMM of the current activity receives an UNBIND message with reason CLIENT_SWITCH - A new IMM is created for the new activity requesting input and requests to bind. - The new IMM requests to start input, triggering IMS#dispatchStartInputWithToken with a *new* ImeOnBackInvokedDispatcher instance than the one previously kept by IMS. Previously, the ime dispatcher instance was updated before the existing back callback was unregistered and caused the unregister call to fail. The fix is to update the dispatcher after the other logic in IMS#dispatcherStartInputWithToken (specifically, to after startInput(), which calls doFinishInput() if input is already started). Bug: 234416098 Test: atest CtsInputMethodTestCases Change-Id: Ic7a5daab8709b808343388b095b5b6ad40adc777
* Merge "Don't force nav bar shown if configured" into tm-devAlex Stetson2022-05-131-7/+6
|\
| * Don't force nav bar shown if configuredAlex Stetson2022-05-111-7/+6
| | | | | | | | | | | | | | | | | | | | | | There exists a configuration value to determine if the nav bar should be shown when the keyboard is open. The InsetsPolicy should respect this value. This value is currently used on automotive devices but doesn't necessarily need to be restricted to a particular device type. Bug: 229256359 Test: manual Change-Id: I57ea71193476cb88bba8d406d039fe08e05a6b1c
* | Fix IME callback not being re-registered on screen off / on.Shan Huang2022-05-121-1/+5
|/ | | | | | | | | | Bug:231917948 Bug:229355440 Test: atest InputMethodServiceLifecycleTest Test: atest CtsInputMethodTestCases:InputMethodServiceTest Test atest CtsInputMethodTestCases:KeyboardVisibilityControlTest Change-Id: I8dc1425aa9338b37128d308bf58fd15c39d04a88
* Migrate IME to handle back with OnBackInvokedDispatcher.Shan Huang2022-05-041-1/+69
| | | | | | | | | | | | | | We currently close the IME by having the target application forward KEYCODE_BACK to the IME process through InputMethodManager#dispatchInputEvent and having the IME handle the keycode in InputMethodService#onKeyDown. When apps opt in to OnBackInvokedDispatcher API, we will not dispatch KEYCODE_BACK to apps anymore. Thus we need to migrate IME to the new API for it to close on back invocation. This implementation forwards OnBackInvokedCallbacks from the IME process to the app process. This is necessary because all callbacks need to exist in the app process for them to be considered by hardware back keys. While back gestures go through WM to resolve callbacks from the focused window, hw keys are directly sent to the focused window's ViewRootImpl, bypassing server side back nav logic. Bug: 228358882 Test: atest CtsInputMethodTestCases:KeyboardVisibilityControlTest Test: atest CtsInputMethodTestCases:InputMethodServiceTest Test: atest CtsInputMethodTestCases Change-Id: Ie207b63b11a56c9b2173f26b734a27b13ebccc60
* Shorten IME surface caching durationTaran Singh2022-04-281-1/+2
| | | | | | | | | | | | | | | | Shorten IME surface caching so that we can avoid showing cached IME surface when IME insets have changed from the last time it was shown. Fix: 221458652 Bug: 230762351 Test: Manually using steps: 1. Go to gboard settings and enable Emoji bar 2. Open a chat in messages app 3. tap editor and make sure Insets dont change after show animation completes. Change-Id: I4c2a9c272ef0e7be7128ca64abebd3a3b7d2d7a4
* Notify IMMS synchronously on IME insets hidden.Kohsuke Yatoh2022-04-211-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, IMMS will be notified asynchronously when an IME hide animation finishes, via message dispatching through IMS (IMM#notifyImeHidden -> IMS#notifyImeHidden -> IMMS#hideMySoftInput). This creates a race condition when IMM#showSoftInput or WIC#show is called around the end of hide animation. This CL fixes the race condition by synchronously and directly calling IMMS#hideSoftInput from IMM#notifyImeHidden. Note that there is still another race condition for IMM#showSoftInput (not WIC#show) if it's called during an IME hide animation; IMM#showSoftInput ended up calling WIC#show asynchronously, but at that time the running IME hide animation may have already been finished successfully and WIC#show may fail to cancel the hide animation (then the cleanup IMM#notifyImeHidden hides the IME again disruptively). I will fix the latter issue in a separate CL. Bug: 221483132 Bug: 225674038 Test: atest InputMethodStressTest Test: atest CtsInputMethodTestCases Test: atest WindowInsetsAnimationControllerTests Change-Id: I7c71dc5a1d6b61aa79d1666f0e257e6401e4adb2 (cherry picked from commit 9065310f814d38c5d8dea5f01655b30e4996fef4) Merged-In: I7c71dc5a1d6b61aa79d1666f0e257e6401e4adb2
* Revert "Migrate InputMethodService to use OnBackInvokedDispatcher"Shan Huang2022-04-191-60/+0
| | | | | | | | | | | This reverts commit 38be9e32f161828b3a8d3f4e0046af3213350622. Reason for revert: Caused b/229642813 and b/229355440 Bug:229642813 Bug:229636388 Change-Id: I65e4f66ec2156d4e0812753d71ac82afd965fe3b
* Migrate InputMethodService to use OnBackInvokedDispatcherShan Huang2022-04-131-0/+60
| | | | | | | | | | | | | | | We currently close the IME by having the target application forward KEYCODE_BACK to the IME process through InputMethodManager#dispatchInputEvent and having the IME handle the keycode in InputMethodService#onKeyDown. When apps opt in to OnBackInvokedDispatcher API, we will not dispatch KEYCODE_BACK to apps anymore. Thus we need to migrate IME to the new API for it to close on back invocation. This CL migrates the client side IME code to register and unregister callbacks, and also updates the WM side logic to make sure IME callback priority works correctly with other application callbacks. Test: In BackTestApp home activity, Show IME -> try swipe back. Open WidgetTestActivity, show IME by clicking on EditText -> try swipe back. Test: Install Micrsoft SwiftKey. Set as primary IME. Repeat the above steps in BackTestApp and make sure IME behaves correctly. Bug: 228358882 Change-Id: Idb246cf1858a7515f6fc34a5ccde33f25f56d404
* Finish handwriting session for recents gestureTaran Singh2022-03-151-1/+10
| | | | | | | | | | | | | Finish stylus handwriting session when user swipes to recent. Bug: 223748964 Test: Manually: 1. Open an app with editor 2. swipe on editor with stylus [or emulated stylus] 3. Observe ink trail drawn on screen 4. quickly sipe to recents, ink should go away. 5. repeat steps 1-3 for swipe to home Change-Id: Id750ff55cb447247c3eca75daf37cb5aeb1d0cfa
* Merge "Introduce new IMS method for Stylus events and dispatch" into tm-devTaran Singh2022-03-101-4/+45
|\
| * Introduce new IMS method for Stylus events and dispatchTaran Singh2022-03-091-4/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of today we show the InkWindow and dispatch Stylus events without waiting. At the time of dispatch, InkWindow is not added and first stylus gesture is skipped. In order to deliver the first gesture to IME, we should wait until InkWindow is added and IME's Inking View is attached. However, waiting for it will introduce latency in the system. To counter that, we introduce a new API method to listen for Stylus MotionEvent. IME can override the API method to listen to MotionEvents sooner. By default, the stylus MotionEvents are buffered until Ink view is visible. Change-Id: I3a18067da45fd15bf0f6e377da0a82cdd6df1d41 Fix: 222081673 Test: atest StylusHandwriting
* | Enable IMS#canImeRenderGesturalNavButtons() by default (3rd try)Yohei Yukawa2022-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the third attempt to enable IMS#canImeRenderGesturalNavButtons() by default. The first attempt [1] was reverted due to Bug 217668258. The second attempt [2] was reverted due to Bug 219604375 and Bug 218322263. With this CL, the back button and IME switcher button on the navigation bar are rendered by the IME when gestural navigation mode is enabled. The new behavior can still be manually disabled as follows adb root adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons false adb reboot The only observable behavior change we are aware of is that now those buttons are included in the task screenshot in Recents. Other than that, there should be no observable behavior change. [1]: I45e511f5cfec93cdd002d23c091b4fe735b28227 793e15271306d84451733363818e83e661112d44 [2]: I39f454a2d41d7d5255b8cc4f7d9a3f7a7642b2f3 f21d2115594e36b6ee290c4642b246eb776ae3cb Fix: 215545985 Test: Manually tested with ThemedNavBarKeyboard sample 1. Build aosp_coral-userdebug and flash it 2. Enable gesture navigation mode. 3. make -j ThemedNavBarKeyboard 4. adb install -r \ $OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk 5. adb shell ime enable \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 6. adb shell ime set \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 7. Open the Dialer app 8. Tap "EXTENDED LIGHT NAVIGARION BAR" mode 9. Make sure that the navigation button color is optimized for light navigation bar. 10. Tap "STANDARD LIGHT NAVIGARION BAR" mode 11. Make sure that the navigation button color is optimized for light navigation bar. 12. Tap "FLOATING MODE" mode 13. Make sure that the navigation buttons are visible. Test: Manually verified as follows. 1. Build coral-userdebug and flash it 2. Make sure that the back button is shown on the setup wizard no matter whether the IME is shown or not. Test: Manually verified as follows. 1. Build aosp_coral-userdebug then flash it. 2. adb root 3. adb shell setprop persist.sys.ime.can_render_gestural_nav_buttons true 4. adb reboot 5. adb install -r TestDPC-normalv8001.apk 6. adb shell am start -n com.afwsamples.testdpc/.SetupManagementLaunchActivity 7. Set up work-profile 8. make -j EditTextVariations 9. adb install -r \ $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/arm64/EditTextVariations.apk 10. adb shell am start --user 0 -n \ com.android.inputmethod.tools.edittextvariations/.EditTextVariations 11. adb shell dumpsys input_method | grep mNavigation -> "mNavigationBarController={mImeDrawsImeNavBar=false, ..." 12. Enable gesture navigation 13. adb shell dumpsys input_method | grep mNavigation -> "mNavigationBarController={mImeDrawsImeNavBar=true, ..." 14. adb shell am start --user 10 -n \ com.android.inputmethod.tools.edittextvariations/.EditTextVariations 15. adb shell dumpsys input_method | grep mNavigation -> "mNavigationBarController={mImeDrawsImeNavBar=true, ..." Change-Id: Iec55ce12e8198e243cdd716ab7c52d0f3939c279
* | Introduce InputMethodNavButtonFlagsYohei Yukawa2022-03-071-10/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | This CL reworks my previous CL [1], which let InputMethodManagerService report whether the IME switcher icon needs to be shown or not to the IME process by using IInputMethod IPCs. It turns out that we need to propagate one more boolean value in order to address Bug 219820813. It'd be much clearer if we use bit flags rather than adding a new boolean parameter to each IPC method. Thus this CL rewrites my previous CL by using a bit flag defined in a newly introduced InputMethodNavButtonFlags. This is a purely mechanical refactroing. There should be no behavior change. [1]: I5de9ac0dc8670842edf66306bb4c281c77cea376 75b935a12b37ffa97447b9acd80f94a4172bf3e6 Bug: 215551357 Bug: 219820813 Test: Manually verified with for the following scenarios: * Enabling/disabling multiple IMEs * Attaching/detaching a hardware keyboard * Showing/hinding the IME switcher * Showing an IME on the lock screen Change-Id: I81cb062a08d484ec8ce5d7b2fea64ce19028f82e
* Configure handwriting window with the IME's pid and uid for ANRsPrabir Pradhan2022-03-021-1/+2
| | | | | | | | | | | | | | | | | When starting a handwriting session, update the handwriting input window so that it is configured with the IME's pid and uid. This means any ANRs that occur due to the handwriting input window will be directed to the IME process. Since oneway binder calls do not have pid information, we cannot use Binder.getCallingPid() to get the pid of the IME. Instead, we report the pid from IMS when starting handwriting. Bug: 210978621 Test: manual with custom IME, verify ANR is directed to IME. Change-Id: Ia6963eb02cad22c7f604896e6c78ed31c84e32f6 Merged-In: Ia6963eb02cad22c7f604896e6c78ed31c84e32f6 (cherry picked from commit 58df52232a31ab27fcc995c3223999ba526a8dd1)
* Merge "Revert "Enable IMS#canImeRenderGesturalNavButtons() by default (2nd ↵TreeHugger Robot2022-02-151-1/+1
|\ | | | | | | try)""
| * Revert "Enable IMS#canImeRenderGesturalNavButtons() by default (2nd try)"Yohei Yukawa2022-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f21d2115594e36b6ee290c4642b246eb776ae3cb [1]. Reason for revert: IME Nav buttons are unexpectedly invisible in the following cases. * work profile apps (Bug 219604375) * setup wizard (Bug 218322263) [1]: I39f454a2d41d7d5255b8cc4f7d9a3f7a7642b2f3 Bug: 215545985 Fix: 219604375 Test: Manually verified as follows. 1. Build aosp_coral-userdebug and flash it. 2. adb install -r TestDPC-normalv8001.apk 3. Set up work-profile 4. Enable gestural navigation mode 5. adb shell am start --user 10 -n \ com.android.documentsui/com.android.documentsui.files.FilesActivity 6. Tap the magnifier icon to show the AOSP Keyboard 7. Confirm that the back button is shown on the nav bar 8. adb shell dumpsys input_method | grep mNavigationBarController -> "No-op implementation" Change-Id: If3da8dbad0b8bd204cc4ec04f882e9248439c456
* | Remove unused InputMethod#setCurrentShowInputToken()Yohei Yukawa2022-02-141-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a clean up CL to our previous CL [1], which introduced an unused @hide method InputMethod#setCurrentShowInputToken(). Since that method has never been called, there should be no behavior change in this CL. [1]: Ia49e23dd077d264a58d28a7b8acffde54b7db187 bb0e2f753b4b6e37ab0411499c25661abfbf6553 Bug: 111084606 Bug: 192412909 Test: presubmit Change-Id: Idd607ef62c91a92006da4bf26a86338ea7224ce8
* | Remove unused InputMethod#setCurrentHideInputToken()Yohei Yukawa2022-02-141-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a clean up CL to our previous CL [1], which introduced an unused @hide method InputMethod#setCurrentHideInputToken(). Since that method has never been called, there should be no behavior change in this CL. [1]: Ia596a392eb73ae46debd097151c8c9a7edd59833 44e2ae4afc30b6a873e1536e31619db258f6cf00 Bug: 133381284 Bug: 149870112 Bug: 192412909 Test: presubmit Change-Id: I8906360dc51ad3468b9ce4c97d477ae9bcdb2e91
* | Fix IMS#onPrepareStylusHandwriting callTaran Singh2022-02-101-2/+6
| | | | | | | | | | | | | | | | | | Ensure onPrepareStylusHandwriting() is always called before onStartStylusHandwriting(). Test: manually using HandwritingIme Bug: 217957587 Change-Id: I6f1b8a93a76dbb34d3323439253a3394c05d98a8
* | Merge "Fix IMS window visibility"Adrian Roos2022-02-071-20/+11
|\ \ | |/ |/|
| * Fix IMS window visibilityAdrian Roos2022-02-031-20/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes an issue with IMS window visibility, where an unfortunate timing of removeImeSurface() and showWindow() could result in the window being hidden without resetting mDecorViewVisible. Root cause is the scheduled removeImeSurface() not being cancelled in all code paths that end up calling showWindow(). To avoid this we - consolidate calls to cancelImeSurfaceRemoval and applyVisibilityInInsetsConsumerIfNecessary into showWindow() - inline the now unnecessary doHideWindow - unconditionally call mWindow.show() in showWindow, since View.java already avoids unnecessary work if the decor visibility won't change Fixes: 203137087 Test: manual Change-Id: Iaef9efd4f1a89fe6da27fc6396b62ff3b4ca11f4
* | Enable IMS#canImeRenderGesturalNavButtons() by default (2nd try)Yohei Yukawa2022-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the second attempt to enable IMS#canImeRenderGesturalNavButtons() by default. The first attempt [1] was reverted due to Bug 217668258. With this CL, the back button and IME switcher button on the navigation bar are rendered by the IME when gestural navigation mode is enabled. The new behavior can still be manually disabled as follows adb root adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons false adb reboot The only observable behavior change we are aware of is that now those buttons are included in the task screenshot in Recents. Other than that, there should be no observable behavior change. [1]: I45e511f5cfec93cdd002d23c091b4fe735b28227 793e15271306d84451733363818e83e661112d44 Fix: 215545985 Test: Manually tested with ThemedNavBarKeyboard sample 1. Build aosp_coral-userdebug and flash it 2. Enable gesture navigation mode. 3. make -j ThemedNavBarKeyboard 4. adb install -r \ $OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk 5. adb shell ime enable \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 6. adb shell ime set \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 7. Open the Dialer app 8. Tap "EXTENDED LIGHT NAVIGARION BAR" mode 9. Make sure that the navigation button color is optimized for light navigation bar. 10. Tap "STANDARD LIGHT NAVIGARION BAR" mode 11. Make sure that the navigation button color is optimized for light navigation bar. 12. Tap "FLOATING MODE" mode 13. Make sure that the navigation buttons are visible. Test: Manually verified as follows. 1. Build coral-userdebug and flash it 2. Make sure that the back button is shown on the setup wizard. Change-Id: I39f454a2d41d7d5255b8cc4f7d9a3f7a7642b2f3
* | Revert "Enable IMS#canImeRenderGesturalNavButtons() by default"Yohei Yukawa2022-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 793e15271306d84451733363818e83e661112d44 [1]. Reason for revert: No back button on the setup wizard. [1]: I45e511f5cfec93cdd002d23c091b4fe735b28227 Bug: 215545985 Fix: 217668258 Change-Id: Iac77c5bfafc5d208a1d3f3b56f0f7ee81d51031b
* | Enable IMS#canImeRenderGesturalNavButtons() by defaultYohei Yukawa2022-02-011-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this CL, the back button and IME switcher button on the navigation bar are rendered by the IME when gestural navigation mode is enabled. The new behavior can still be manually disabled as follows adb root adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons false adb reboot The only observable behavior change we are aware of is that now those buttons are included in the task screenshot in Recents. Other than that, there should be no observable behavior change. Fix: 215545985 Test: Manually tested with ThemedNavBarKeyboard sample 1. Build aosp_coral-userdebug and flash it 2. Enable gesture navigation mode. 3. make -j ThemedNavBarKeyboard 4. adb install -r \ $OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk 5. adb shell ime enable \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 6. adb shell ime set \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 7. Open the Dialer app 8. Tap "EXTENDED LIGHT NAVIGARION BAR" mode 9. Make sure that the navigation button color is optimized for light navigation bar. 10. Tap "STANDARD LIGHT NAVIGARION BAR" mode 11. Make sure that the navigation button color is optimized for light navigation bar. 12. Tap "FLOATING MODE" mode 13. Make sure that the navigation buttons are visible. Change-Id: I45e511f5cfec93cdd002d23c091b4fe735b28227
* Introduce Window.DecorCallbackYohei Yukawa2022-01-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow up CL to my previous CL [1], which introduced a hidden callback method into Window.Callback. This CL does not change any observable behavior but consolidate that hidden callback into a newly introduced Window.DecorCallback interface. In this approach, we no longer need to worry about accidental method name collision in Window.Callback implementations classes. Here is the new callback chain. ViewRootImpl#performTraversals() -> DecorView#onSystemBarAppearanceChanged() -> Window.dispatchOnSystemBarAppearanceChanged() -> NavigationBarController.Impl#onSystemBarAppearanceChanged() [1]: I08566034bebfafff6777ce0152cd6ca1f66f6cad 678ddce11c131a8e6746fe386c40ddc8d99d01c3 Bug: 215549533 Test: Manually tested with ThemedNavBarKeyboard sample 1. Build aosp_coral-userdebug and flash it 2. adb root 3. adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons true 4. adb reboot 5. make -j ThemedNavBarKeyboard 6. adb install -r \ $OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk 7. adb shell ime enable \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 8. adb shell ime set \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 9. Open the Dialer app 10. Focus in the top edit field. 11. Tap "EXTENDED LIGHT NAVIGARION BAR" mode 12. Make sure that the navigation button color is optimized for light navigation bar. 13. Tap "STANDARD LIGHT NAVIGARION BAR" mode 14. Make sure that the navigation button color is optimized for light navigation bar. Change-Id: I5168f76dfc9526e925c565dbfa87597b5543fcdc
* Support IME switcher icon visibility updateYohei Yukawa2022-01-281-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this CL, the IME switcher icon becomes visible only when necessary, even if InputMethodService renders the back button and the IME switcher button in the gestural navigation mode. Implementation idea: InputMethodManagerService#shouldShowImeSwitcherLocked() is the source of truth about whether the IME switcher visibility should be shown or not, and it internally depends on the following conditions: A. com.android.internal.R.bool.show_ongoing_ime_switcher B. Whether the IME switcher is already shown or not. C. Whether the IME is perceptible or not. D. Whether one or more hardware keyboards are attached or not. E. Keyguard state. F. What IMEs and their subtypes are enabled. Here are what those conditions would mean for this project. * A is considered to be a per-device constant value. * B, D, and F can happen at any time outside of the IME lifecycle events such as startInput(). * C is no longer relevant if those buttons are rendered by the IME. * E is considered to be constant throughout each startInput() cycle. This CL uses the following 3 IPCs to notify when the IME switcher visibility is changing. 1. IInputMethod#initializeInternal() 2. IInputMethod#startInput() 3. IInputMethod#onShouldShowImeSwitcherWhenImeIsShownChanged() 1 and 2 will be used to provide the "initial" value to avoid potential flickers. 3 is still necessary to take care of async changes triggered by B, D, and F. Fix: 215551357 Test: Manually verified with for the following scenarios: * Enabling/disabling multiple IMEs * Attaching/detaching a hardware keyboard * Showing/hinding the IME switcher * Showing an IME on the lock screen Change-Id: I5de9ac0dc8670842edf66306bb4c281c77cea376
* Merge "Make IME extract text fields public"TreeHugger Robot2022-01-271-2/+4
|\
| * Make IME extract text fields publicTaran Singh2022-01-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | InputMethodService uses the following IDs for extract view. - R.id.inputExtractEditText - R.id.inputExtractAction - R.id.inputExtractAccessories While the first one is public, others are not. It makes sense to make all of the public so IMEs can customize it. Bug: 210777608 Test: atest InputMethodServiceTest Change-Id: I125767d67839293c0b0f40c750d0fb1bb77951e9
* | Support light navigation barYohei Yukawa2022-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to propagate the information about whether the IME is using light navigation bar or not from android.view.ViewRootImpl to android.inputmethodservice.NavigationBarController within the same process, this CL adds a new @hide method to Window.Callback as follows. ViewRootImpl#performTraversals() -> DecorView#onSystemBarAppearanceChanged() -> Window.Callback#onSystemBarAppearanceChanged() -> SoftInputWindow#onSystemBarAppearanceChanged() -> NavigationBarController#onSystemBarAppearanceChanged() Button color transition will be implemented in a subsequent CL. Bug: 215549533 Test: Manually tested with ThemedNavBarKeyboard sample 1. Build aosp_coral-userdebug and flash it 2. adb root 3. adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons true 4. adb reboot 5. make -j ThemedNavBarKeyboard 6. adb install -r \ $OUT/system/app/ThemedNavBarKeyboard/ThemedNavBarKeyboard.apk 7. adb shell ime enable \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 8. adb shell ime set \ com.example.android.themednavbarkeyboard/.ThemedNavBarKeyboard 9. Open the Dialer app 10. Focus in the top edit field. 11. Tap "EXTENDED LIGHT NAVIGARION BAR" mode 12. Make sure that the navigation button color is optimized for light navigation bar. 13. Tap "STANDARD LIGHT NAVIGARION BAR" mode 14. Make sure that the navigation button color is optimized for light navigation bar. Change-Id: I08566034bebfafff6777ce0152cd6ca1f66f6cad
* | Scribe in IMF: Early InkWindow preparation 6/NTaran Singh2022-01-261-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | Allow stylus hover events for: 1. send early signal to IME onPrepareStylusHandwriting() 2. Prepare InkWindow internally. Test: atest StylusHandwritingTest Bug: 210039666 Bug: 203086136 Change-Id: Iebbd62659cb98b3c61edfa35d5a84a1c6837eb23
* | Scribe in IMF: Stylus Spy windows Impl 5/NTaran Singh2022-01-261-9/+38
|/ | | | | | | | | | Implement Handwriting surface spy in IMF that listens and manages Stylus events. Test: atest StylusHandwritingTest Bug: 210039666 Bug: 203086136 Change-Id: I8681a33bb32f20b48cf741ba3ad2116de5db7ffa
* Minimum impl of nav buttons rendered by IMEYohei Yukawa2022-01-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the minimum implementation of rendering the back button and the IME switcher button in the InputMethodService process. Note that the feature is still disabled by default behind the flag. Newly added UI logic should be running only when the feature flag is enabled. Bug 215545985: Enable canImeRenderGesturalNavButtons() by default Here is the list of known blockers before enabling the flag. * Bug 215552600: Subscribe gesture mode change. * Bug 215551357: Show IME swicher button only when necessary. * Bug 215549533: Support light navigation bar. * Bug 215550296: Support floating IME. * Bug 215554582: Set "input_method_rounded_corner_content_padding" for each devices. Also, after enabling the flag by default, we start cleaning up newly added code under android.inputmethodservice.navigationbar. at Bug 215443343. Bug: 205803355 Test: Manually done as follows 1. Build aosp_coral-userdebug and flash it 2. Switch to gestural navigation mode. 3. adb root 4. adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons true 5. adb reboot 6. Tap any edit field to show AOSP Keyboard. 7. Confirm that the back button on the navbar works. 8. Confirm that the IME switcher button on the navbar works. Change-Id: I3e7e1f83554444131e2765dc159617bb9e2337c7
* Merge "Revert "Revert "Scribe in IMF: startStylusHandwriting & lifecycl...""TreeHugger Robot2022-01-131-1/+132
|\
| * Revert "Revert "Scribe in IMF: startStylusHandwriting & lifecycl..."Taran Singh2022-01-121-1/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert^2 "CTS for Stylus Handwriting lifecycle" 493b8d7d3b4d43e483c03b155d38057e3eacd3c9 Reason: Fix API signature related issues by making newly introduced methods in InputMethod.java default Bug: 213976598 Bug: 203086136 Test: atest StylusHandwritingTest Test: atest SignatureTest#testSignature Change-Id: Idfd5d1f84e66e3a19ef384589b4892adb91f8066
* | Merge "Add a sysprop to disable SysUI's nav buttons when IME is shown"TreeHugger Robot2022-01-131-0/+40
|\ \ | |/ |/|
| * Add a sysprop to disable SysUI's nav buttons when IME is shownYohei Yukawa2022-01-121-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL introduces a new runtime mode where the SysUI no longer renders the back button and the IME switcher button when the IME is shown, which is the first milestone to move those buttons to the IME process. To enable this mode, run the following commands: $ adb root $ adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons true $ adb reboot Keep in mind that you always need to reboot the device after changing this sysprop. Note that only AOSP-based gestural navigation mode is officially supported by this flag, which is when com.android.internal.R.integer.config_navBarInteractionMode is set to WindowManagerPolicyConstants#NAV_BAR_MODE_GESTURAL. Note that nav button rendering in the IME process is yet to be done in subsequent CLs. Hence the expected behavior right now is only one thing that the SysUI stops rendering the back button and the IME switcher button any more when the flag takes effect. The flag is treated as off by default. Hence there should be no visible behavior changes unless you manually enable it. Alternatives Considered: Instead of letting NavigationBarView directly read the sysprop, we could propagate the information from the InputMethodService to the SysUI via InputMethodPrivilegedOperations#setImeWindowStatusAsync(). This approach was abandoned because of the following reasons. * Such a complex mechanism is not necessary for production code. * There are some ad-hoc invocations of IMMS#updateSystemUiLocked(0, mBackDisposition), which makes it difficult to keep IMS and SysUI in sync. Bug: 205803355 Test: Manually done as follows 1. Build aosp_coral-userdebug and flash it 2. Tap any edit field to show AOSP Keyboard. 3. Confirm that nav buttons are rendered in 3-button nav mode 4. Switch to gestural navigation mode. 5. Confirm that nav buttons are still shown when IME is visible. 6. adb root 7. adb shell setprop \ persist.sys.ime.can_render_gestural_nav_buttons true 8. adb reboot 9. Tap any edit field to show AOSP Keyboard. 10. Confirm that nav buttons are not shown when IME is visible. 11. Switch to 3-button navigation mode. 12. Tap any edit field to show AOSP Keyboard. 13. Confirm that nav buttons are shown again when IME is visible. 14. Switch to gestural navigation mode again. 15. Confirm that nav buttons are not shown when IME is visible. Change-Id: I7a2e9f08072a97d61b78dddb144282a5728d1407
* | Merge "[RESTRICT AUTOMERGE] Attempt to fix exception in IMS"TreeHugger Robot2022-01-121-0/+7
|\ \
| * | [RESTRICT AUTOMERGE] Attempt to fix exception in IMSCharles Chen2022-01-121-0/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | IMS might throw IllegalStateException in WindowContextController#attachToWindowToken when #initializeInternal is called. A possible root cause may be #initializeInternal is called after onDestroy, which detach IMS from ImeContainer. This CL add a flag in #onDestroy to prevent #initializeInternal from being called after #onDestroy. Bug: 211062619 Test: presubmit Change-Id: Ie7814da801878a3487123fefdc9e71d0e1ed28d7
* | Merge "[IME]: Make mFullscreenArea invisble when candidate/extract frame not ↵TreeHugger Robot2022-01-121-2/+6
|\ \ | |/ |/| | | used"
| * [IME]: Make mFullscreenArea invisble when candidate/extract frame not usedMing-Shin Lu2021-12-241-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flicker happens when the app in landscape mode with focusing the search editor without enabling full-screen editText, after typing something and pressing search button, the app quickly clears the editor focus then makes the main activity focused and starts the fallback connection to enable the fullscreen mode, so that the extracted view been inflated and occcupied in mFullscreenArea, Even though the full-screen mode changed to false during hiding the keyboard, in updateExtractFrameVisibility() still makes mFullscreenArea visible and flicker until the keyboard is hidden. As the mFullscreenArea contains 2 frames: ExtractFrame & CandidateFrame, Since ExtractFrame is used when enabling the full-screen editor mode, for non-full-screen mode, we can rely on the candidate frame visiblity to see if mFullscreenArea has to set visible, in case flicker happening by unnecessary visible setting. Fix: 211085869 Test: manual as steps: 1). Set device dark theme is on. 2). Open Messages on Landscape mode > Split screen. 3). Tap Search box > input something. 4). Tap Search icon on keyboard. 5). Expect no flicker happens when hiding the keyboard after 4). Change-Id: I0d50ae68016993329e8bb84b90ec835445f3db31
* | Revert "Scribe in IMF: startStylusHandwriting & lifecycle 2/N"Josh Wu2022-01-111-132/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "CTS for Stylus Handwriting lifecycle" Revert submission 16281467-stylus-handwriting-lifecycle Reason for revert: Breaks apisignaturetests BUGID: b/213976598 Reverted Changes: I7b066c284:Scribe in IMF: startStylusHandwriting & lifecycle ... I7d672b150:CTS for Stylus Handwriting lifecycle Change-Id: Ieec94ea525fdb45cf5316b4a331c2bf9882e1083
* | Scribe in IMF: startStylusHandwriting & lifecycle 2/NTaran Singh2022-01-101-1/+132
| | | | | | | | | | | | | | | | | | Introduce InputMethodManager.startStylusHandwriting(View) API and IME lifecycle. Bug: 203086136 Test: atest StylusHandwritingTest Change-Id: I7b066c2841b713e7a00ae2ea4ca0ce04aad751c6
* | Merge SoftInputWindow#initDockWindow() into IMS#onCreate()Yohei Yukawa2021-12-271-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL merges SoftInputWindow#initDockWindow() into InputMethodService#onCreate() so that we can see what parameters are set to the IME window at a glance, rather than having to check 2 different files. The end result is expected to be the same, and in theory there should be no observable behavior change. If you are reading this commit message to look for why those parameters have been set, here are some quick links to relevant CLs. * `FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS` - DecorView#mNavigationGuard is gone [1] * `window.setDecorFitsSystemWindows(false)` - Updated InputMethodService to not inset by navigation bar if requested by automotive. [2] - Smooth out IME animation for automotive devices [3] * `setFitInsetsTypes(statusBars() | navigationBars())` - Do let IME fit invisible insets [4] * `setFitInsetsSides(Side.all() & ~Side.BOTTOM)` - Make IME fit navgation bars at left and right sides [5] * `receiveInsetsIgnoringZOrder = true` - Let IME receive insets ignoring z-order [6] [1]: I664630099b6eb3fe31675444ba94944cb0eb98b0 8f162c6e846ac99d6aac4473d7903722e9d6e54b [2]: I4faf82bdd7536bd2d049ded04034a9635d8ca0d3 7eec316f54e22237f92a2808a3a2f9356229335d [3]: I5d7b03d5c829a2679efdd06fa961d1158494e08f b0d0d7c46ab0425431912d2e03cc620be657a969 [4]: I6e7d665c55839dfbb14c8d2e5365537416f5f6c6 145f71182ab1c1e0be4f128683c97403c97d2696 [5]: I0ef3d6379a9ae52b3749154d2fdc54e9aa94a9e0 c8364e3878aa8e0f9e8dda1bd5305c5ef7eeada0 [6]: I53c64a5598f246ad577f652156903e4666a30cd9 ea491da863774457299ffd5f2534dc2ba4d3ba52 Bug: 192412909 Test: presubmit Change-Id: If0f2bac45e6752612cc11e57d2fac55626221bd1
* | Simplify SoftInputWindowYohei Yukawa2021-12-271-3/+1
|/ | | | | | | | | | | | | | | Now that SoftInputWindow is used only by InputMethodService [1], we can safely simplify SoftInputWindow. This is still mechanical refactoring. There should be no observable behavior change. [1]: 5ed8dae6bc9cca87d5f35e781f173477a2388c2e Bug: 192412909 Test: prebuilts/checkstyle/checkstyle.py -f \ frameworks/base/core/java/android/inputmethodservice/SoftInputWindow.java Change-Id: I619ae6011f5e66dba126931719569a97513eaa7e
* Merge "Consider IME_VISIBLE_IMPERCEPTIBLE as shown for taskbar purposes" ↵Tony Wickham2021-12-011-1/+10
|\ | | | | | | | | | | | | | | into sc-v2-dev am: 7aa0c3f9ee am: d7f237995c Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16323570 Change-Id: Ie92373cbe9227cd848457c55bae22c6fd3292d29