From 43ce1d62e18b1a67227dc70880ce06eb70069e0f Mon Sep 17 00:00:00 2001 From: Cosmin Băieș Date: Wed, 15 Jan 2025 16:11:23 +0100 Subject: Set IME Switcher nav hint based on IME visibility The navigationIconHints are computed in Utilities#calculateNavigationIconHints, using the given value of showImeSwitcher. This is modified before the call to be true only if showIme is also true. This change moves the modification to inside the method, to ensure consistency. Note, it wouldn't make sense to request showing the IME Switcher button when the IME itself is not visible. Flag: EXEMPT refactor Bug: 366129400 Test: atest NavigationBarTest#testSetImeWindowStatusSysuiState_ImeNotVisibleImeSwitcherButtonVisible Change-Id: Ia6a04ecd3700acf2078ae2cb4cd2412bcd7caa51 --- .../com/android/systemui/shared/recents/utilities/Utilities.java | 8 +++++--- .../src/com/android/systemui/navigationbar/TaskbarDelegate.java | 1 - .../com/android/systemui/navigationbar/views/NavigationBar.java | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java index 818e39800b0c..aee90802437b 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java @@ -107,9 +107,11 @@ public class Utilities { * Gets the updated navigation icon hints, based on the current ones and the given IME state. * * @param oldHints current navigation icon hints. - * @param backDisposition the IME back disposition mode. + * @param backDisposition the IME back disposition mode. Only takes effect if + * {@code imeShown} is {@code true}. * @param imeShown whether the IME is currently visible. - * @param showImeSwitcher whether the IME Switcher button should be shown. + * @param showImeSwitcher whether the IME Switcher button should be shown. Only takes effect if + * {@code imeShown} is {@code true}. */ @NavigationHint public static int calculateNavigationIconHints(@NavigationHint int oldHints, @@ -134,7 +136,7 @@ public class Utilities { } else { hints &= ~NAVIGATION_HINT_IME_SHOWN; } - if (showImeSwitcher) { + if (showImeSwitcher && imeShown) { hints |= NAVIGATION_HINT_IME_SWITCHER_BUTTON_SHOWN; } else { hints &= ~NAVIGATION_HINT_IME_SWITCHER_BUTTON_SHOWN; diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java index dfbf4d1fbaf4..eb15b10c416b 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java @@ -465,7 +465,6 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, // Count imperceptible changes as visible so we transition taskbar out quickly. imeShown = (vis & InputMethodService.IME_VISIBLE_IMPERCEPTIBLE) != 0; } - showImeSwitcher = imeShown && showImeSwitcher; int hints = Utilities.calculateNavigationIconHints(mNavigationIconHints, backDisposition, imeShown, showImeSwitcher); if (hints == mNavigationIconHints) { diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java index 3223d02c6a0c..f1819cd6eda9 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java @@ -1139,7 +1139,6 @@ public class NavigationBar extends ViewController implements return; } boolean imeShown = mNavBarHelper.isImeShown(vis); - showImeSwitcher = imeShown && showImeSwitcher; int hints = Utilities.calculateNavigationIconHints(mNavigationIconHints, backDisposition, imeShown, showImeSwitcher); if (hints == mNavigationIconHints) { -- cgit v1.2.3-59-g8ed1b