This reverts commit f21d211559 [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
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
bb0e2f753b
Bug: 111084606
Bug: 192412909
Test: presubmit
Change-Id: Idd607ef62c91a92006da4bf26a86338ea7224ce8
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
Ensure onPrepareStylusHandwriting() is always called before
onStartStylusHandwriting().
Test: manually using HandwritingIme
Bug: 217957587
Change-Id: I6f1b8a93a76dbb34d3323439253a3394c05d98a8
With this CL, IME and SysUI start checking
config_imeDrawsImeNavBar [1]
instead of
config_navBarInteractionMode
when determining whether the IME should render the back and IME
switcher buttons or not.
There should be no observable behavior change as long as
config_navBarInteractionMode
is set to true when the gestural navigation is enabled.
[1]: I0651a99b6007a84be63b85b579a85af0f24bb6ec
Fix: 216118048
Test: manual
Change-Id: Ifdfd23612f6cb2bfe6ddf302e3caac1e342a8a1e
InputMethodService is the primary and a11y is the secondary.
InputMethodService is not
affected by a11y status. When the session from input method is
established, app can start input (pass input context to input method).
When an a11y session comes back, it will be passed to the app. When
InputMethodManagerService binds to/start input with
InputMethodService, it does the same to a11y services which
requested IME functionalities.
It is possible that input method can edit text before ally sessios are
established. So the EditorInfo passed to a11y could be stale.
So when an a11y session is passed to client, client will send
a notification (input method doesn't have this extra notification) for
the current selection. I think since the time for a11y session establish
shouldn't be long, and we get the current state later, it should be fine
for a11y services.
When input method is disconnected from app (client) (even for input
method switching), we cleared a11y and sessions too. When
input method request sessions, we must rerequest sessions for a11y. This
is mainly because when we unbindCurrentClientLocked(SWITCH_IME), we set
active to false for the current client. Suppose we don't want to
change the current structure of input method, an inactive client
probably should clear accessibility sessions too.
When we switch to a client which already has a session with input
method, there might be some a11y sessions with this client, and
some a11y services might be disabled or enabled while the client was
switched out. We pass unchanged a11y
sessions to client, and request sessions for newly enabled a11y services.
When an a11y service is disabled, it removes its session
from all clients in InputMethodManagerService.
Test: type word through modified "switchToInputMethod". Tested session
notification through logs. Tested client switching, input method
switching, a11y service enabled/disable, multiple a11y services,
a11y service enabled before device reboot.
Also tested work profile.
Bug: 187453053
Change-Id: Ia651a811093a939d00c081be1961e24ed3ad0356
This may not exist at this point (or at all depending on the device
configuration)
Change-Id: Ida9b5f4eadfd2620d7b74171268cf266f77f7b3d
Test: manual - bring up the keyboard on a TV
Fix: 218228687
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
793e152713
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
This is a mechanical renaming CL with no behavior change.
Somehow NAVIGATION_HINT_IME_SHOWN was set when the IME switcher needs
to be shown, not when the IME is shown. This CL aims to avoid future
confusions by also introducing
NAVIGATION_HINT_IME_SWITCHER_SHOWN
then setting NAVIGATION_HINT_IME_SHOWN when the IME is actually shown.
This CL also updates NavigationBarTest to verify those flags.
Bug: 192412909
Bug: 217755059
Test: atest SystemUITests:NavigationBarTest
Change-Id: I8bdd58d040689953072c7f384ece2bca677265e1
This reverts commit 793e152713 [1].
Reason for revert:
No back button on the setup wizard.
[1]: I45e511f5cfec93cdd002d23c091b4fe735b28227
Bug: 215545985
Fix: 217668258
Change-Id: Iac77c5bfafc5d208a1d3f3b56f0f7ee81d51031b
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
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
As discussed in Bug 201375975, the nevigation bar handling for
floating IMEs is a bit tricky.
This CL tweaks DecorView behabior only when
InputMethodService#canImeRenderGesturalNavButtons(),
is true and the IME is floating in the gestural navigation mode.
Fix: 215550296
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 "FLOATING MODE" mode
12. Make sure that the navigation buttons are visible.
Change-Id: Ia54499a3c2ac6e33e72f625eba3477fd81649d32
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
678ddce11c
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
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
With this CL, the back and IME switcher buttons on the navigation bar
have the same color transition even when they are rendered by the IME.
Note that the behavior is still behind a flag
persist.sys.ime.can_render_gestural_nav_buttons,
which is still off by default. There should be no observable changes
no matter whether the flag is enabled or disabled though.
Fix: 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 changes from light
to dark with animation.
13. Tap "EXTENDED DARK NAVIGARION BAR" mode
12. Make sure that the navigation button color changes from dark
to light with animation.
Change-Id: I41a3478a97d67b238c4424d93acbcad646aee0d2
Use explicit FloatProperty proxies for routing ObjectAnimator updates.
This prevents issues with Proguard-related shrinking/optimization for
custom class types.
Test: atest SystemUITests + manual validation of error logs
Bug: 203472868
Change-Id: Ie0889101f1063a929d2052756b1f4008f2b84a92
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
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
This is a mechanical refactoring CL so that we can avoid code
duplicate later.
Bug: 215550296
Test: Manually verified that there is no behavior change
Change-Id: I14d2c7609e156b9e627b26471d392cb47b14163b
With this CL, nav buttons rendered by InputMethodService can be
dynamically enabled or disabled when the gesture navigation mode is
updated.
Note that the feature is still disabled by default behind the flag.
Hence there should be no observable behavior changes unless the
feature is explicitly enabled with setprop.
Fix: 215552600
Test: Manually done as follows
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. Tap any edit field to show AOSP Keyboard.
6. adb shell dumpsys input_method | grep mNavigationBarController
-> Confirm mRenderGesturalNavButtons is false.
-> Confirm mNavigationBarFrame is null.
7. Switch to gestural navigation mode.
8. adb shell dumpsys input_method | grep mNavigationBarController
-> Confirm mRenderGesturalNavButtons is true.
-> Confirm mNavigationBarFrame is not null.
9. Switch to 3-button navigation mode again.
10. adb shell dumpsys input_method | grep mNavigationBarController
-> Confirm mRenderGesturalNavButtons is false.
-> Confirm mNavigationBarFrame is null.
Change-Id: Id0cfa44cce5de515dc5d28254e1d41bdfc01e201
Seems that IInputMethod#revokeSession has been defined but has never
been called since at least Android 1.5.
Let's remove it for now for simplicity.
Bug: 192412909
Test: presubmit
Change-Id: I3de8de1226ae028ac2e6bae8aeb34cd83f4c4f41
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
Now InputMethodService has been migrated to WindowProviderService.
We don't need to override isUiContext anymore.
Bug: 193247900
Test: presubmit
Change-Id: I1cb0f04aca02d0d2c623995666ce5315125a0b4a
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
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