Commit Graph

516 Commits

Author SHA1 Message Date
TreeHugger Robot
b6e868e01d Merge "Revert "Enable IMS#canImeRenderGesturalNavButtons() by default (2nd try)"" 2022-02-15 23:02:09 +00:00
Yohei Yukawa
7522e42738 Revert "Enable IMS#canImeRenderGesturalNavButtons() by default (2nd try)"
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
2022-02-15 16:44:26 +00:00
Yohei Yukawa
e559812ca7 Merge "Remove unused InputMethod#setCurrentShowInputToken()" 2022-02-15 16:29:23 +00:00
Yohei Yukawa
99a34dabf4 Merge "Remove unused InputMethod#setCurrentHideInputToken()" 2022-02-15 16:19:42 +00:00
TreeHugger Robot
5128d9d808 Merge "Use config_imeDrawsImeNavBar" 2022-02-15 02:50:22 +00:00
Yohei Yukawa
7d2f3d98ad Remove unused InputMethod#setCurrentShowInputToken()
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
2022-02-14 12:19:09 -08:00
Yohei Yukawa
10c406e461 Remove unused InputMethod#setCurrentHideInputToken()
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
2022-02-14 12:14:57 -08:00
TreeHugger Robot
708216ab8c Merge "Recycle obtained TypedArrays" 2022-02-10 18:34:36 +00:00
Nikolas Havrikov
0ebfffb897 Recycle obtained TypedArrays
Bug: 218835043
Test: make
Change-Id: I2c19ca3b6e4773de533cceac6b5341ae964b4fd4
2022-02-10 14:50:42 +01:00
Taran Singh
ded74d352f Merge changes I53808ec2,I6f1b8a93
* changes:
  Minimal test IME with Stylus HW support
  Fix IMS#onPrepareStylusHandwriting call
2022-02-10 12:57:03 +00:00
Taran Singh
070f7b67e8 Fix IMS#onPrepareStylusHandwriting call
Ensure onPrepareStylusHandwriting() is always called before
onStartStylusHandwriting().

Test: manually using HandwritingIme
Bug: 217957587
Change-Id: I6f1b8a93a76dbb34d3323439253a3394c05d98a8
2022-02-10 04:55:49 +00:00
Yohei Yukawa
442bc2b28d Use config_imeDrawsImeNavBar
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
2022-02-09 08:29:57 -08:00
yingleiw
fb17e5ae7a Allow a11y services to enter text via the path IMEs use
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
2022-02-08 22:14:19 -08:00
Adrian Roos
ad5bd08354 Merge "Fix IMS window visibility" 2022-02-07 17:14:39 +00:00
Robin Lee
a246b947d4 Add null check for mNavigationBarFrame
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
2022-02-07 11:41:05 +00:00
Yohei Yukawa
f21d211559 Enable IMS#canImeRenderGesturalNavButtons() by default (2nd try)
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
2022-02-04 12:50:07 -08:00
Yohei Yukawa
bf122b9f94 Have both NAVIGATION_HINT_IME{,_SWITCHER}_SHOWN
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
2022-02-04 12:49:21 -08:00
Yohei Yukawa
8b70de55fa Merge "Revert "Enable IMS#canImeRenderGesturalNavButtons() by default"" 2022-02-04 00:01:55 +00:00
Yohei Yukawa
4d3ddb067c Add a missing "=" in dumpsys input_method
My previous CL [1] lacked "=" when dumping

  NavigationBarController#mShouldShowImeSwitcherWhenImeIsShown

into dumpsys.  This CL fixes that typo.

 [1]: I5de9ac0dc8670842edf66306bb4c281c77cea376
      75b935a12b

Bug: 215551357
Test: adb shell dumpsys input_method | grep NavigationBarController
Change-Id: Ifa2f5d2abcbe982b0afa5a6dad1573a86123485e
2022-02-03 11:59:37 -08:00
Yohei Yukawa
c35df2f1ec Revert "Enable IMS#canImeRenderGesturalNavButtons() by default"
This reverts commit 793e152713 [1].

Reason for revert:
No back button on the setup wizard.

 [1]: I45e511f5cfec93cdd002d23c091b4fe735b28227

Bug: 215545985
Fix: 217668258
Change-Id: Iac77c5bfafc5d208a1d3f3b56f0f7ee81d51031b
2022-02-03 16:07:54 +00:00
Adrian Roos
92fbace14b Fix IMS window visibility
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
2022-02-03 14:08:56 +00:00
Yohei Yukawa
793e152713 Enable IMS#canImeRenderGesturalNavButtons() by default
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
2022-02-01 11:25:32 -08:00
Yohei Yukawa
c98b9c8f40 Support floating IMEs even when IMEs render the nav buttons
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
2022-01-31 18:56:59 -08:00
Yohei Yukawa
af1695a78a Introduce Window.DecorCallback
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
2022-01-31 18:56:50 -08:00
Yohei Yukawa
75b935a12b Support IME switcher icon visibility update
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
2022-01-28 10:04:32 -08:00
Yohei Yukawa
dec2c21955 Support nav button color transitions
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
2022-01-28 09:15:24 -08:00
Jared Duke
5ff99b87c5 Merge "Avoid reflection with ObjectAnimator" 2022-01-27 22:45:47 +00:00
TreeHugger Robot
b8319503a2 Merge "Make IME extract text fields public" 2022-01-27 21:56:20 +00:00
Jared Duke
912b87abee Avoid reflection with ObjectAnimator
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
2022-01-27 19:29:23 +00:00
Yohei Yukawa
678ddce11c Support light navigation bar
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
2022-01-27 10:29:33 -08:00
TreeHugger Robot
4c4cd6f670 Merge changes from topics "CAI-filters", "onPrepareStylusHandwriting"
* changes:
  Scribe in IMF: Introduce filters in CursoAnchorInfo API 7/N
  Scribe in IMF: Early InkWindow preparation 6/N
2022-01-27 10:32:06 +00:00
TreeHugger Robot
cc016b3496 Merge "Scribe in IMF: Stylus Spy windows Impl 5/N" 2022-01-27 08:33:08 +00:00
Yohei Yukawa
daeb827056 Merge "Factor out to NavigationBarController#scheduleRelayout()" 2022-01-26 21:37:16 +00:00
Taran Singh
104932e4bf Make IME extract text fields public
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
2022-01-26 20:06:15 +00:00
Taran Singh
342509f094 Scribe in IMF: Early InkWindow preparation 6/N
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
2022-01-26 15:41:27 +00:00
Taran Singh
52f330491b Scribe in IMF: Stylus Spy windows Impl 5/N
Implement Handwriting surface spy in IMF that listens
and manages Stylus events.

Test: atest StylusHandwritingTest
Bug: 210039666
Bug: 203086136
Change-Id: I8681a33bb32f20b48cf741ba3ad2116de5db7ffa
2022-01-26 15:41:24 +00:00
Charles Chen
958b56e8de Merge "Remove redundant API" 2022-01-26 08:53:35 +00:00
Yohei Yukawa
4dd61edf09 Factor out to NavigationBarController#scheduleRelayout()
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
2022-01-25 20:55:46 -08:00
Yohei Yukawa
177e4aafdb Update the IME nav UI when gesture navigation mode changes
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
2022-01-24 19:13:13 -08:00
Yohei Yukawa
dcd0264584 Merge "Minimum impl of nav buttons rendered by IME" 2022-01-24 19:00:42 +00:00
Yohei Yukawa
99cc65c470 Remove unused IInputMethod#revokeSession
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
2022-01-22 06:35:53 -08:00
Yohei Yukawa
ff7b453ca8 Minimum impl of nav buttons rendered by IME
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
2022-01-20 21:28:34 -08:00
Charles Chen
9c327699b8 Remove redundant API
Now InputMethodService has been migrated to WindowProviderService.
We don't need to override isUiContext anymore.

Bug: 193247900
Test: presubmit
Change-Id: I1cb0f04aca02d0d2c623995666ce5315125a0b4a
2022-01-14 22:24:24 +08:00
TreeHugger Robot
01d195c67c Merge "Revert "Revert "Scribe in IMF: startStylusHandwriting & lifecycl..."" 2022-01-13 16:54:42 +00:00
TreeHugger Robot
5aa8e247fd Merge "Add a sysprop to disable SysUI's nav buttons when IME is shown" 2022-01-13 05:17:48 +00:00
Taran Singh
94324080af Revert "Revert "Scribe in IMF: startStylusHandwriting & lifecycl..."
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
2022-01-12 19:23:47 +00:00
TreeHugger Robot
05c62452d9 Merge "[RESTRICT AUTOMERGE] Attempt to fix exception in IMS" 2022-01-12 07:58:25 +00:00
TreeHugger Robot
c6b5a2db45 Merge "[IME]: Make mFullscreenArea invisble when candidate/extract frame not used" 2022-01-12 04:31:09 +00:00
Charles Chen
07a7f23e36 [RESTRICT AUTOMERGE] Attempt to fix exception in IMS
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
2022-01-12 02:56:46 +00:00
Yohei Yukawa
a25070917a Add a sysprop to disable SysUI's nav buttons when IME is shown
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
2022-01-12 02:28:53 +00:00