After InputMethodService migrated to WindowProviderService,
the display is initialized by getInitialDisplayId().
Therefore, we don't need updateImeDisplayId() to initialize
InputMethodService's Display anymore.
Test: atest CtsInputMethodTestCases MultiDisplaySystemDecorationTests
Bug: 149463653
Change-Id: Ia78139b5defc48c8b0354fc1e212eeb38fd71ba4
Also introduce IWindowManager#getDisplayIdToLaunchIme to make IMS
be aware of the launched display to prevent extra onConfigurationChanged
callback
Bug: 149463653
Test: atest MultiDisplaySystemDecorationTests CtsInputMethodTestCases
Test: atest ContextTest ContextIsUiContextTest
Test: manual - moving IME between 2 displays and displayArea within
display - config change received
Test: manual - the app to show IME crashed and focus is set to the
next task - no config change
Change-Id: Ie565e30ed5dd3f2cfe27355a6dded76dc3adc14b
Dont cache IME surface when IME was in fullscreen mode. This is done in
order to fix IME closing when it is used with RecyclerView. There can be
a special case where RecyclerView detaches the view holding mServedView
when IME is in fullscreen mode
While exact reason is still a mystery, short term solution is to not
cache IME when it was in fullscreen mode.
Fix: 187772544
Bug: 188818557
Bug: 167948123
Test: Manually using steps in bug
Change-Id: I1194d08a00622f1dfa232209a70dcb0797ba192b
When IME is targeting notification shade, IME will be above status bar,
and IME won't receive status bar insets anymore. The surface position of
the control of IME will be changed because IME fits status bar. If the
IME control target receives the new IME control (new surface position)
after the IME animation starts, the IME position will be stale until the
next IME animation, because the controls would be copied before playing
the insets animation.
This CL lets IME receive insets no matter what z-order IME has. So the
IME position will stay the same while it is moved above system bars, and
the IME behavior will be the same as before Android S (receiving status
bar insets while targeting notification shade).
Fix: 186178729
Test: Steps as below:
1. Make, install, and open EditTextVariations.
2. Open menu, and select Direct Reply.
3. Expand notification shade.
4. Expand the notification of EditTextVariations.
5. Click Direct Teply Test.
6. See if IME is overlapped with (button-based) navigation bar.
If no, press home button and repeat 3-6 for several times.
Change-Id: I53c64a5598f246ad577f652156903e4666a30cd9
-. Remove VoidResultCallback of applyImeVisibility.
and let it be truly asynchronous.
-. Rename this method to applyImeVisibilityAsync.
Bug: 183587528
Test: atest CtsInputMethodTestCases
Change-Id: Ica564c526223d32641a2485c0c0f3490fe4bfd39
-. Remove VoidResultCallback of notifyUserAction.
and let it be truly asynchronous.
-. Rename this method to notifyUserActionAsync.
Bug: 183587528
Test: atest CtsInputMethodTestCases
Change-Id: I384fd689b6bd1d418ff5208444fbba2c1eac6f85
-. Remove VoidResultCallback of updateStatusIcon
and let it be truly asynchronous.
-. Rename this method to updateStatusIconAsync.
Bug: 183587528
Test: atest CtsInputMethodTestCases
Change-Id: Ic7759354ec06a3293ea370ab7afe7422eb2d9356
As previously InputMethodManager#toggleSoftInput is designed to tell
InputMethodService directly through IInputMethodSession to toggle
soft-keyboard visibility, this could be happened some unexpected IME
visibility issues that when the app calling this method in the wrong
state like the app toggling IME visibility when the app is off-screen
but unexpectedly it ends up showing soft-keyboard when the IME is in
invisible state.
To minimize the app compatibility without changing the public API
surface and reducing unexpected IME visibilty been toggled behavior
especially happens when switching the apps, changed the internal IPC
protocols to call IMMS#showSoftInput or IMMS#hideSoftInput directly
according the previous IME consumer requested visibility state,
so that in IMMS side can validate to see if the token user is
still focused and ready to toggle the IME visibility to show or hide.
As the result, we deprecated toggleSoftInput and
toggleSoftInputFromWindow to state the reason as the above, and
recommand to use showSoftInput or hideSoftInputFromWindow instead,
so that framework side no longer has to call {InputMethodSessionWrapper,
InputMethodSessionImpl}#toggleSoftInput.
Bug: 182071625
Test: m checkapi doc-comment-check-docs
Test: atest KeyboardVisibilityControlTest#testToggleSoftInput
Change-Id: I390dc029e7bcc30c200926a9bfbbbd0268a1f714
-. Remove VoidResultCallback of reportFullscreenMode
and let it be truly asynchronous.
-. Rename this method to reportFullscreenModeAsync.
Bug: 183587528
Test: atest CtsInputMethodTestCases
Test: Manually verified as follows.
1. Build flame-userdebug and flash it.
2. Make sure that the screen rotation is enabled.
3. make -j SoftKeyboard
4. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
5. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
6. adb shell ime set com.example.android.softkeyboard/.SoftKeyboard
7. make -j EditTextVariations
8. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/arm64/EditTextVariations.apk
9. adb shell am start -n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
10. Make sure that the device is in the landscape mode,
and the SoftKeyboard sample IME is not yet shown.
11. adb shell dumpsys input_method | grep mFullscreenMode
Then make sure the mFullscreenMode is "false"
12. Tap the first edit field then make sure that SoftKeyboard
sample IME becomes visible in the fullscreen mode.
13. adb shell dumpsys input_method | grep mFullscreenMode
Then make sure the mFullscreenMode is "true"
14. Tap the down button on the navbar to hide the SoftKeyboard
sample IME.
15. adb shell dumpsys input_method | grep mFullscreenMode
Then make sure the mFullscreenMode is "false"
Change-Id: I92e8b0d420be3dd16cc4f3ba29e0bde5f12ab2ce
CL[1] removed setImeWindowStatatus call in showSoftInput()
since showWindow() has a call.
Howerver, the call invokes only when the IME visibility has changed.
It overlooked the case that when the screen unlocked by PIN
lock, since the focused app and IME visiblity is the same, so
the setImeWindowStatus in showWindow() doesn't invoked.
When then keyguard shown, IMMS side will invoke updateSystemUiLocked to
update navbar icon as invisible, so after the user unlocked, user won't
see the navbar icon set visible back.
As the result, we still need setImeWindowStatus called in showSoftInput
to fix this case.
[1]: I0b0750f146634d8e90e0b0ac46e9208675626d0a
Fix: 181294561
Test: manual as below steps:
0) setup PIN lock for the device
1) launch an app (e.g. Messaging) and show IME
2) turn-off the screen and unlock the screen with PIN
3) verify if the keyboard is visible and the navbar icon is visible
Change-Id: I168fda76c1c7bdcabe94f7c2550c6b5c7c41e5e0
-. Remove VoidResultCallback of reportStartInput
and let it be truly asynchronous.
-. Rename this method to reportStartInputAsync.
Bug: 183587528
Test: atest CtsInputMethodTestCases
Change-Id: Ic8e7f888f78f7c536a9228db02a8b355555d7220
Handle onConfigurationChanged() in order to prevent restarting
InputMethodService everytime. We introduce a new API attribute
"configChanges" in InputMethod(attrs.xml) which when declared
by IME, will be responsible for handling mentioned
configuration changes.
This CL re-introduces [1] with fix: Use new Configuration instance for
IMS#mLastKnownConfig and also handle followup comments.
[1] Ib94fddadb0dae648cf73a4c1642e51edebd19f50
Note: this change has no impact for devices not using DisplayAreas.
Bug: 167948419
Test: atest InputMethodServiceTest
Manually:
1. Patch Ie91e7a8e06b80864ef9409031e8543858552d70d to use dual
display area.
2. Open applications with editors on both display areas.
3. Attach a debug point for IMS#onConfigurationChanged().
4. Make sure IMS#resetStateForNewConfiguration() is not called
when IME moves between these two identical DisplayAreas
Also verify that bug 182604598 don't happen.
Change-Id: I43b6b80cdb35410554412ee1d3b0917ee3198272
-. Remove VoidResultCallback of setImeWindowStatus
and let it be asynchronous.
-. Rename function naming to setImeWindowStatusAsync.
Bug: 183587528
Test: atest CtsInputMethodTestCases
Change-Id: Ia9f19ca5ae418089ce43816dcd50487e1b1172f1
Revert "Add cts for InputMethodService configChanges"
Revert submission 13727407-167948419
Reason for revert:
Possible root cause of Bug 182604598.
Reverted Changes:
Ib94fddadb:Avoid IME restart for configChanges
Ieca327b2e:Add cts for InputMethodService configChanges
Bug: 167948419
Bug: 182604598
Test: presubmit
Change-Id: I3accc55ac65d0e2ec30c3f6023680fda27ad3e97
Handle onConfigurationChanged() in order to prevent restarting
InputMethodService everytime. We introduce a new API attribute
"configChanges" in InputMethod(attrs.xml) which when declared
by IME, will be responsible for handling mentioned
configuration changes.
This CL re-introduces [1] with fix: Use new Configuration instance for
IMS#mLastKnownConfig
[1] Iff88b768c6b06cf5cf1fe9e97ee97f8f78e6f0bd
Bug: 167948419
Test: atest InputMethodServiceTest
Manually:
1. Patch Ie91e7a8e06b80864ef9409031e8543858552d70d to use dual
display area.
2. Open applications with editors on both display areas.
3. Attach a debug point for IMS#onConfigurationChanged().
4. Make sure IMS#resetStateForNewConfiguration() is not called
when IME moves between these two identical DisplayAreas
Change-Id: Ib94fddadb0dae648cf73a4c1642e51edebd19f50
Handle onConfigurationChanged() in order to prevent restarting
InputMethodService everytime. We introduce a new API attribute
"configChanges" in InputMethod(attrs.xml) which when declared
by IME, will be responsible for handling mentioned
configuration changes.
Bug: 167948419
Test: atest InputMethodServiceTest
Manually:
1. Patch Ie91e7a8e06b80864ef9409031e8543858552d70d to use dual
display area.
2. Open applications with editors on both display areas.
3. Attach a debug point for IMS#onConfigurationChanged().
4. Make sure IMS#resetStateForNewConfiguration() is not called
when IME moves between these two identical DisplayAreas
Change-Id: Iff88b768c6b06cf5cf1fe9e97ee97f8f78e6f0bd
Followup to I5a5e73e1dec776665f28a7e2eb091b555198001b.
internalImeOptions field should be parcelable.
Fix: 157870379
Test: Manually using steps in bug
Change-Id: I12b442b8b2d8cf83aa4cc789133b42251ad2c191
As of today, IME surface is removed immidiately after its hidden.
This causes IME surface to be recreated when next time its requested,
which takes noticeable amount of time ~30ms on a typical phone [1]
In order to improve IME latency, we keep the surface in memory a little
longer.
This is ideal for use cases where IME has to move between DisplayAreas
OR when IME is closed only briefly.
While there could be other strategies to hold IME surface in memory,
timeout is simplistic and is also unaffected by IMF lifecycle, which
could vary when moving between DisplayAreas or Displays.
Bug: 167948419
Bug: 167948123
Test: atest CtsInputMethodTestCases
[1] refer design doc in bug 167947940
Change-Id: Ib062640b68164efbb647e7bf27b7f8eb5ed252dc
When an app is running in portrait orientation, regardless of
what orientation display is in, IME shouldn't use fullscreen-mode.
Setting IME_FLAG_NO_FULLSCREEN in EditorInfo makes sure IME doesn't go
fullscreen.
Bug: 157870379
Test: Manually using steps in bug
Change-Id: I5a5e73e1dec776665f28a7e2eb091b555198001b
Bug: 174932174
Test: I solemnly swear I tested this conflict resolution.
Exempt-From-Owner-Approval: refactoring with team leads buy-in
Change-Id: I9262a08ffc1ccede8e519d0eed90ed2bfcf0232c
As general background, OWNERS files expedite code reviews by helping
code authors quickly find relevant reviewers, and they also ensure
that stakeholders are involved in code changes in their areas.
Some teams under frameworks/base/ have been using OWNERS files
successfully for many years, and we're ready to expand them to cover
more areas. Here's the historical coverage statistics for the last
two years of changes before these new OWNERS changes land:
-- 56% of changes are fully covered by OWNERS
-- 17% of changes are partially covered by OWNERS
-- 25% of changes have no OWNERS coverage
Working closely with team leads, we've now identified clear OWNERS on
a per-package basis, and we're using "include" directives whenever
possible to to simplify future maintenance. With this extensive
effort, we've now improved our coverage as follows:
-- 98% of changes are fully covered by OWNERS
-- 1% of changes are partially covered by OWNERS
-- 1% of changes have no OWNERS coverage
This specific change is automatically generated by a script that
identifies relevant "include" directives.
Bug: 174932174
Test: manual
Exempt-From-Owner-Approval: refactoring with team leads buy-in
Merged-In: I3480ddf2fe7ba3dfb922b459d4da01fa17a2c813
Change-Id: I3480ddf2fe7ba3dfb922b459d4da01fa17a2c813
Revert "Verify lifecycle test when screen on/off"
Revert submission 12716106-ims_screenstate_lifecycle
Reason for revert: b/174512702
Reverted Changes:
Iba0332ed3:Verify lifecycle test when screen on/off
I8a657e75e:Let IME#onFinishInput called without dup onStartIn...
Change-Id: I16f4a34360a2f64b69978724648a9be741f140b5
This change dumps information through IME tracing for the getter methods
exposed by the InputConnection interface. The dump is done through the
ImeTracing interface and is triggered by events in the wrapper classes
used to handle InputConnection implementations corresponding to:
- different apps
- InputMethodService
The new data is available under inputConnectionCall in the clients
output proto.
Bug: 154348613
Test: flash a device
start IME tracing by calling "adb shell ime tracing start"
end IME tracing by calling "adb shell ime tracing stop"
pull generated trace files and visualize in Winscope
or start tracing directly through ADB Connect and visualize traces
Change-Id: Iabd6af1b858803030848a0ef5e7dd9ecfc562716
Also called IME#onStartInput without dup onFinishInput when screen-on,
to fix the long-standing IME input connection lifecycle issue when
device screen state changes.
Bug: 156215187
Bug: 26851566
Test: atest InputMethodStartInputLifecycleTest
Test: manual as below steps
0) Enable InputMethodService debug flag.
0-1) In Settings -> Develop options -> AppCompatibility Changes,
Select Gboard and then toggle
"FINISH_INPUT_NO_FALLBACK_CONNECTION" change.
1) Launch a app with focused a editor and show soft-input
2) When device screen turned-off, will see InputMethodService only
callbacks below logs:
CALL: doFinishInput
CALL: onFinishInputView
CALL: onFinishInput
3) When device screen turned-on, will see InputMethodService only
callbacks below logs:
CALL: onStartInput
CALL: onStartInputView
Change-Id: I8a657e75e274d842fb46b60375f6aeafeab96a59
* changes:
Log only current client data in IME tracing
Optimized workflow for IME tracing on InputMethodManagerService side
Optimized workflow for IME tracing on InputMethodService side
Optimized workflow for IME tracing on clients side
Otherwise, the fullscreen IME won't cover the entire display while
there is a hidden system bar.
Fix: 168657591
Test: 1. Steps in the bug.
2. Play WindowInsetsTests with combinations of system bar
visibilities, navigation mode, screen orientation, and display
cutout.
Merged-in: I6e7d665c55839dfbb14c8d2e5365537416f5f6c6
Change-Id: I6e7d665c55839dfbb14c8d2e5365537416f5f6c6
(cherry picked from commit 145f71182a)
Few low-hanging optimizations to improve IMF latency:
- Remove duplicate call to setImeWindowStatus when showWindow() is
called from showSoftInput() already.
- Remove redundant fancy animations preference check. IME window
animation is controlled by client.
- Cache mShowImeWithHardKeyboard early on.
- Remove rendundant removeOnComputeInternalInsetsListener() when called
from onCreate().
Refer to design doc in bug for amount of latency improvements caused by
this CL.
Bug: 167947940
Bug: 167948123
Test: atest CtsInputMethodTestCases
Change-Id: I0b0750f146634d8e90e0b0ac46e9208675626d0a
Optimized the tracing logic for the IMS information. The
InputMethodService triggers a tracing dump through the new method
triggerServiceDump, exposed by the meTracing interface. This
change was done to be able to support custom dumps from clients
and custom dumps from InputMethodService.
This change only covers the IMS information. The IMMS
information will be dumped in next changes.
Bug: 154348613
Test: start IME tracing by calling "adb shell ime tracing start"
end IME tracing by calling "adb shell ime tracing stop"
pull trace using "adb pull /data/misc/wmtrace/ime_trace_service.pb ime_trace_service.pb"
Change-Id: Icda0f82d76fb7db5b2bd8d021069b1ff15a4e15b
Having a hidden abstract method for a class that can be extended
means that public implementors cannot implement these hidden methods
posing a risk that custom implementations will not have required
abstract methods resulting in an exception.
Bug: 151134792
Test: make update-api
Change-Id: I758d12465fabc671be19bedeeceb16885de23c87
Exempt-From-Owner-Approval: large scale suppression of existing issues,
no-op in terms of behavior