Skip to content
Commit f93769b1 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Use parentUserId when reading config_imeDrawsImeNavBar

This CL rewrites my previous CLs [1][2], which were written with an
incorrect assumption that config_imeDrawsImeNavBar was overlaid for
the entire profile group.

While SysUI's navigation mode is dynamically configurable with Runtime
Resource Overlay (RRO), it turns out that we currently configure RRO
only for the profile parent user.  This means that processes run under
other profile users continue seeing the base resource value regardless
of how RRO is configured for the profile parent user.  This is the
root cause of Bug 219604375.

To work around this limitation, this CL uses InputMethodManagerService
to monitor the value of config_imeDrawsImeNavBar for the profile
parent user then to propagate it to the IME process.  Luckily we have
already been doing a similar thing for the IME switcher visibility.
What this CL does is 1) adding a new flag to InputMethodNavButtonFlags
then 2) just using the flag sent from IMMS instead of directly reading

  config_imeDrawsImeNavBar

NavigationBarController.

Alternative solutions considered:

* Set RRO for profile users

  One of straightforward ways to address this problem is letting the
  Setting app apply the same RRO for other profile users.  However,
  this could be tricky when 1) the user changes navigation mode then
  2) sets up a new profile, because the Settings app is not an
  always-running process.  While we might be able to rely on

    com.android.settings.SettingsInitialize#onReceive()

  to do so, the profile user's state could be left in a broken state
  if that method was somehow interrupted.  To minimize the risk, we
  decided to not take this approach for T.

* Make OverlayManager be aware of profile groups

  Given how RRO is used in SysUI, it's make more sense if
  OverlayManager natively supports resource overlay for the entire
  profile group.  However, introducing such a new concept is too late
  for Android T.  We have filed Bug 221443458 to see if we can do this
  in a future version of Android.

 [1]: I3e7e1f83554444131e2765dc159617bb9e2337c7
      ff7b453c
 [2]: Id0cfa44cce5de515dc5d28254e1d41bdfc01e201
      177e4aaf

Fix: 219820813
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: Id3d6a71d8ba1bfa49131350b68aa8d3424eca381
parent 5f9f1ca5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment