From a2fc23da7f92089ccb7231465126f7f4c6d76dcc Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Fri, 4 Feb 2022 12:50:03 -0800 Subject: [PATCH] Also require IME visibility in isImeRenderingNavButtons This is a follow up CL to my previous CL [1], which attempted to hide the back button when InputMethodService#canImeRenderGesturalNavButtons() returns true and the gestural navigation is enabled. As shown in Bug 217668258 it turns out that SysUI still needs to show the back button at least on the setup wizard. This CL aims to avoid such unexpected breakages by also requiring the IME visibility when determining isImeRenderingNavButtons. [1]: I7a2e9f08072a97d61b78dddb144282a5728d1407 a25070917a62074d3506b0ded058c3e33390c195 Fix: 217755059 Test: Manually verified as follows. 1. Build coral-userdebug and flash it. 2. adb root 3. adb setprop \ persist.sys.ime.can_render_gestural_nav_buttons true 4. adb reboot 5. Make sure that the back button is shown on the setup wizard. 6. Complete the setup wizard. 7. Tap any text input field. 8. Make sure that Gboard is shown up. 9. Make sure that the back button is shown. 10. adb shell dumpsys input_method | grep mNavigationBarController -> Make sure it's not null. Change-Id: Ib48e1e3c9033408e5eb26f0aaf957b5c62308053 --- .../com/android/systemui/navigationbar/NavigationBarView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java index 1026693972839..593b278c82785 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java @@ -774,7 +774,8 @@ public class NavigationBarView extends FrameLayout implements updateRecentsIcon(); boolean isImeRenderingNavButtons = isGesturalMode(mNavBarMode) - && mImeCanRenderGesturalNavButtons; + && mImeCanRenderGesturalNavButtons + && (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_IME_SHOWN) != 0; // Update IME button visibility, a11y and rotate button always overrides the appearance boolean disableImeSwitcher =