diff options
9 files changed, 80 insertions, 63 deletions
diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index 039f7b6a86ba..e030c6c12b4c 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -205,7 +205,7 @@ public class StatusBarManager { * * @hide */ - public static final int NAVIGATION_HINT_BACK_ALT = 1 << 0; + public static final int NAVIGATION_HINT_BACK_DISMISS_IME = 1 << 0; /** * The IME is visible. * @@ -224,7 +224,7 @@ public class StatusBarManager { * @hide */ @IntDef(flag = true, prefix = { "NAVIGATION_HINT_" }, value = { - NAVIGATION_HINT_BACK_ALT, + NAVIGATION_HINT_BACK_DISMISS_IME, NAVIGATION_HINT_IME_VISIBLE, NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE, }) @@ -1357,8 +1357,8 @@ public class StatusBarManager { @NonNull public static String navigationHintsToString(@NavigationHint int hints) { final var hintStrings = new ArrayList<String>(); - if ((hints & NAVIGATION_HINT_BACK_ALT) != 0) { - hintStrings.add("NAVIGATION_HINT_BACK_ALT"); + if ((hints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0) { + hintStrings.add("NAVIGATION_HINT_BACK_DISMISS_IME"); } if ((hints & NAVIGATION_HINT_IME_VISIBLE) != 0) { hintStrings.add("NAVIGATION_HINT_IME_VISIBLE"); diff --git a/core/java/android/inputmethodservice/NavigationBarController.java b/core/java/android/inputmethodservice/NavigationBarController.java index 8ca139fdf9b9..13352d716ffa 100644 --- a/core/java/android/inputmethodservice/NavigationBarController.java +++ b/core/java/android/inputmethodservice/NavigationBarController.java @@ -16,7 +16,7 @@ package android.inputmethodservice; -import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE; import static android.view.WindowInsets.Type.captionBar; @@ -243,7 +243,7 @@ final class NavigationBarController { if (navigationBarView != null) { // TODO(b/213337792): Support InputMethodService#setBackDisposition(). // TODO(b/213337792): Set NAVIGATION_HINT_IME_VISIBLE only when necessary. - final int hints = NAVIGATION_HINT_BACK_ALT | NAVIGATION_HINT_IME_VISIBLE + final int hints = NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE | (mShouldShowImeSwitcherWhenImeIsShown ? NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE : 0); navigationBarView.setNavigationIconHints(hints); @@ -516,7 +516,7 @@ final class NavigationBarController { if (navigationBarView != null) { // TODO(b/213337792): Support InputMethodService#setBackDisposition(). // TODO(b/213337792): Set NAVIGATION_HINT_IME_VISIBLE only when necessary. - final int hints = NAVIGATION_HINT_BACK_ALT | NAVIGATION_HINT_IME_VISIBLE + final int hints = NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE | (mShouldShowImeSwitcherWhenImeIsShown ? NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE : 0); navigationBarView.setNavigationIconHints(hints); diff --git a/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java b/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java index 5c0977115e36..4be98c46300d 100644 --- a/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java +++ b/core/java/android/inputmethodservice/navigationbar/NavigationBarView.java @@ -16,7 +16,7 @@ package android.inputmethodservice.navigationbar; -import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE; import static android.inputmethodservice.navigationbar.NavigationBarConstants.DARK_MODE_ICON_COLOR_SINGLE_TONE; import static android.inputmethodservice.navigationbar.NavigationBarConstants.LIGHT_MODE_ICON_COLOR_SINGLE_TONE; @@ -245,9 +245,10 @@ public final class NavigationBarView extends FrameLayout { } private void orientBackButton(KeyButtonDrawable drawable) { - final boolean useAltBack = (mNavigationIconHints & NAVIGATION_HINT_BACK_ALT) != 0; + final boolean isBackDismissIme = + (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0; final boolean isRtl = mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; - float degrees = useAltBack ? (isRtl ? 90 : -90) : 0; + float degrees = isBackDismissIme ? (isRtl ? 90 : -90) : 0; if (drawable.getRotation() == degrees) { return; } @@ -259,7 +260,7 @@ public final class NavigationBarView extends FrameLayout { // Animate the back button's rotation to the new degrees and only in portrait move up the // back button to line up with the other buttons - float targetY = useAltBack + float targetY = isBackDismissIme ? -dpToPx(NAVBAR_BACK_BUTTON_IME_OFFSET, getResources()) : 0; ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable, @@ -291,11 +292,12 @@ public final class NavigationBarView extends FrameLayout { if (hints == mNavigationIconHints) { return; } - final boolean newBackAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; - final boolean oldBackAlt = - (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; - if (newBackAlt != oldBackAlt) { - //onBackAltChanged(newBackAlt); + final boolean backDismissIme = + (hints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0; + final boolean oldBackDismissIme = + (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0; + if (backDismissIme != oldBackDismissIme) { + //onBackDismissImeChanged(backDismissIme); } if (DEBUG) { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java index 647603c418ee..17a1c27b029b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/navigationbar/views/NavigationBarTest.java @@ -16,7 +16,7 @@ package com.android.systemui.navigationbar.views; -import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE; import static android.inputmethodservice.InputMethodService.BACK_DISPOSITION_ADJUST_NOTHING; @@ -31,7 +31,7 @@ import static com.android.systemui.assist.AssistManager.INVOCATION_TYPE_HOME_BUT import static com.android.systemui.navigationbar.views.NavigationBar.NavBarActionEvent.NAVBAR_ASSIST_LONGPRESS; import static com.android.systemui.navigationbar.views.buttons.KeyButtonView.NavBarButtonEvent.NAVBAR_IME_SWITCHER_BUTTON_LONGPRESS; import static com.android.systemui.navigationbar.views.buttons.KeyButtonView.NavBarButtonEvent.NAVBAR_IME_SWITCHER_BUTTON_TAP; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_ALT_BACK; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISMISS_IME; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; @@ -503,7 +503,7 @@ public class NavigationBarTest extends SysuiTestCase { BACK_DISPOSITION_DEFAULT, true /* showImeSwitcher */); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_VISIBLE), eq(true)); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE), eq(true)); - verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_ALT_BACK), eq(true)); + verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_BACK_DISMISS_IME), eq(true)); } /** @@ -518,7 +518,7 @@ public class NavigationBarTest extends SysuiTestCase { BACK_DISPOSITION_DEFAULT, false /* showImeSwitcher */); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_VISIBLE), eq(true)); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE), eq(false)); - verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_ALT_BACK), eq(true)); + verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_BACK_DISMISS_IME), eq(true)); } /** @@ -536,7 +536,7 @@ public class NavigationBarTest extends SysuiTestCase { BACK_DISPOSITION_DEFAULT, true /* showImeSwitcher */); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_VISIBLE), eq(false)); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE), eq(false)); - verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_ALT_BACK), eq(false)); + verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_BACK_DISMISS_IME), eq(false)); } /** @@ -551,7 +551,7 @@ public class NavigationBarTest extends SysuiTestCase { BACK_DISPOSITION_ADJUST_NOTHING, true /* showImeSwitcher */); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_VISIBLE), eq(true)); verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE), eq(true)); - verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_IME_ALT_BACK), eq(false)); + verify(mMockSysUiState).setFlag(eq(SYSUI_STATE_BACK_DISMISS_IME), eq(false)); } @Test @@ -572,10 +572,11 @@ public class NavigationBarTest extends SysuiTestCase { BACK_DISPOSITION_DEFAULT, true); // Verify IME window state will be updated in default NavBar & external NavBar state reset. - assertEquals(NAVIGATION_HINT_BACK_ALT | NAVIGATION_HINT_IME_VISIBLE + assertEquals(NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE | NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE, defaultNavBar.getNavigationIconHints()); - assertFalse((externalNavBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0); + assertFalse((externalNavBar.getNavigationIconHints() + & NAVIGATION_HINT_BACK_DISMISS_IME) != 0); assertFalse((externalNavBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0); assertFalse((externalNavBar.getNavigationIconHints() & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0); @@ -585,10 +586,11 @@ public class NavigationBarTest extends SysuiTestCase { defaultNavBar.setImeWindowStatus(DEFAULT_DISPLAY, 0 /* vis */, BACK_DISPOSITION_DEFAULT, false); // Verify IME window state will be updated in external NavBar & default NavBar state reset. - assertEquals(NAVIGATION_HINT_BACK_ALT | NAVIGATION_HINT_IME_VISIBLE + assertEquals(NAVIGATION_HINT_BACK_DISMISS_IME | NAVIGATION_HINT_IME_VISIBLE | NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE, externalNavBar.getNavigationIconHints()); - assertFalse((defaultNavBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0); + assertFalse((defaultNavBar.getNavigationIconHints() + & NAVIGATION_HINT_BACK_DISMISS_IME) != 0); assertFalse((defaultNavBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0); assertFalse((defaultNavBar.getNavigationIconHints() & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0); @@ -607,7 +609,8 @@ public class NavigationBarTest extends SysuiTestCase { // Verify navbar altered back icon when an app is showing IME mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, IME_VISIBLE, BACK_DISPOSITION_DEFAULT, true); - assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0); + assertTrue((mNavigationBar.getNavigationIconHints() + & NAVIGATION_HINT_BACK_DISMISS_IME) != 0); assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0); assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0); @@ -617,7 +620,8 @@ public class NavigationBarTest extends SysuiTestCase { doReturn(true).when(mKeyguardStateController).isShowing(); mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, IME_VISIBLE, BACK_DISPOSITION_DEFAULT, true); - assertFalse((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0); + assertFalse((mNavigationBar.getNavigationIconHints() + & NAVIGATION_HINT_BACK_DISMISS_IME) != 0); assertFalse((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0); assertFalse((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0); @@ -628,7 +632,8 @@ public class NavigationBarTest extends SysuiTestCase { doReturn(windowInsets).when(mockShadeWindowView).getRootWindowInsets(); mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, IME_VISIBLE, BACK_DISPOSITION_DEFAULT, true); - assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0); + assertTrue((mNavigationBar.getNavigationIconHints() + & NAVIGATION_HINT_BACK_DISMISS_IME) != 0); assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_VISIBLE) != 0); assertTrue((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0); 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 32a76fb8439a..efe758ea0011 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 @@ -16,7 +16,7 @@ package com.android.systemui.shared.recents.utilities; -import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE; @@ -123,13 +123,13 @@ public class Utilities { case InputMethodService.BACK_DISPOSITION_WILL_NOT_DISMISS: case InputMethodService.BACK_DISPOSITION_WILL_DISMISS: if (isImeVisible) { - hints |= NAVIGATION_HINT_BACK_ALT; + hints |= NAVIGATION_HINT_BACK_DISMISS_IME; } else { - hints &= ~NAVIGATION_HINT_BACK_ALT; + hints &= ~NAVIGATION_HINT_BACK_DISMISS_IME; } break; case InputMethodService.BACK_DISPOSITION_ADJUST_NOTHING: - hints &= ~NAVIGATION_HINT_BACK_ALT; + hints &= ~NAVIGATION_HINT_BACK_DISMISS_IME; break; } if (isImeVisible) { diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java index 0048fd4d33d3..82ac78c6db15 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java @@ -134,8 +134,10 @@ public class QuickStepContract { public static final long SYSUI_STATE_DISABLE_GESTURE_PIP_ANIMATING = 1L << 34; // Communal hub is showing public static final long SYSUI_STATE_COMMUNAL_HUB_SHOWING = 1L << 35; - // The back button is adjusted for the IME. - public static final long SYSUI_STATE_IME_ALT_BACK = 1L << 36; + // The back button is visually adjusted to indicate that it will dismiss the IME when pressed. + // This only takes effect while the IME is visible. By default, it is set while the IME is + // visible, but may be overridden by the backDispositionMode set by the IME. + public static final long SYSUI_STATE_BACK_DISMISS_IME = 1L << 36; // Mask for SystemUiStateFlags to isolate SYSUI_STATE_AWAKE and // SYSUI_STATE_WAKEFULNESS_TRANSITION, to match WAKEFULNESS_* constants @@ -187,7 +189,7 @@ public class QuickStepContract { SYSUI_STATE_TOUCHPAD_GESTURES_DISABLED, SYSUI_STATE_DISABLE_GESTURE_PIP_ANIMATING, SYSUI_STATE_COMMUNAL_HUB_SHOWING, - SYSUI_STATE_IME_ALT_BACK, + SYSUI_STATE_BACK_DISMISS_IME, }) public @interface SystemUiStateFlags {} @@ -298,8 +300,8 @@ public class QuickStepContract { if ((flags & SYSUI_STATE_COMMUNAL_HUB_SHOWING) != 0) { str.add("communal_hub_showing"); } - if ((flags & SYSUI_STATE_IME_ALT_BACK) != 0) { - str.add("ime_alt_back"); + if ((flags & SYSUI_STATE_BACK_DISMISS_IME) != 0) { + str.add("back_dismiss_ime"); } return str.toString(); diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java index c2dacd6690a0..de35dd7b52b6 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/TaskbarDelegate.java @@ -17,7 +17,7 @@ package com.android.systemui.navigationbar; import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED; -import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; @@ -31,7 +31,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_ALT_BACK; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISMISS_IME; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN; @@ -382,8 +382,8 @@ public class TaskbarDelegate implements CommandQueue.Callbacks, (mNavigationIconHints & NAVIGATION_HINT_IME_VISIBLE) != 0) .setFlag(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE, (mNavigationIconHints & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0) - .setFlag(SYSUI_STATE_IME_ALT_BACK, - (mNavigationIconHints & NAVIGATION_HINT_BACK_ALT) != 0) + .setFlag(SYSUI_STATE_BACK_DISMISS_IME, + (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0) .setFlag(SYSUI_STATE_OVERVIEW_DISABLED, (mDisabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0) .setFlag(SYSUI_STATE_HOME_DISABLED, 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 2744f9f84ccf..f1fe2802286c 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBar.java @@ -17,7 +17,7 @@ package com.android.systemui.navigationbar.views; import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED; -import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE; import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN; @@ -44,7 +44,7 @@ import static com.android.systemui.shared.statusbar.phone.BarTransitions.Transit import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_ALT_BACK; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISMISS_IME; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN; @@ -1690,8 +1690,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements (mNavigationIconHints & NAVIGATION_HINT_IME_VISIBLE) != 0) .setFlag(SYSUI_STATE_IME_SWITCHER_BUTTON_VISIBLE, (mNavigationIconHints & NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE) != 0) - .setFlag(SYSUI_STATE_IME_ALT_BACK, - (mNavigationIconHints & NAVIGATION_HINT_BACK_ALT) != 0) + .setFlag(SYSUI_STATE_BACK_DISMISS_IME, + (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0) .setFlag(SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY, allowSystemGestureIgnoringBarVisibility()) .commitUpdate(mDisplayId); @@ -1950,11 +1950,12 @@ public class NavigationBar extends ViewController<NavigationBarView> implements } if (!isLargeScreen(mContext)) { // All IME functions handled by launcher via Sysui flags for large screen - final boolean newBackAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; - final boolean oldBackAlt = - (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; - if (newBackAlt != oldBackAlt) { - mView.onBackAltChanged(newBackAlt); + final boolean backDismissIme = + (hints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0; + final boolean oldBackDismissIme = + (mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME) != 0; + if (backDismissIme != oldBackDismissIme) { + mView.onBackDismissImeChanged(backDismissIme); } mImeVisible = (hints & NAVIGATION_HINT_IME_VISIBLE) != 0; diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java index de61d404b1e8..38f2d42c8869 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/views/NavigationBarView.java @@ -16,7 +16,7 @@ package com.android.systemui.navigationbar.views; -import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_ALT; +import static android.app.StatusBarManager.NAVIGATION_HINT_BACK_DISMISS_IME; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_VISIBLE; import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_BUTTON_VISIBLE; import static android.inputmethodservice.InputMethodService.canImeRenderGesturalNavButtons; @@ -214,7 +214,11 @@ public class NavigationBarView extends FrameLayout { } } - public void onBackAltCleared() { + /** + * Called when the back button is no longer visually adjusted to indicate that it will + * dismiss the IME when pressed. + */ + public void onBackDismissImeCleared() { ButtonDispatcher backButton = getBackButton(); // When dismissing ime during unlock, force the back button to run the same appearance @@ -503,9 +507,10 @@ public class NavigationBarView extends FrameLayout { } private void orientBackButton(KeyButtonDrawable drawable) { - final boolean useAltBack = (mNavigationIconHints & NAVIGATION_HINT_BACK_ALT) != 0; + final boolean isBackDismissIme = + (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0; final boolean isRtl = mConfiguration.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; - float degrees = useAltBack ? (isRtl ? 90 : -90) : 0; + float degrees = isBackDismissIme ? (isRtl ? 90 : -90) : 0; if (drawable.getRotation() == degrees) { return; } @@ -517,7 +522,7 @@ public class NavigationBarView extends FrameLayout { // Animate the back button's rotation to the new degrees and only in portrait move up the // back button to line up with the other buttons - float targetY = !mShowSwipeUpUi && !mIsVertical && useAltBack + float targetY = !mShowSwipeUpUi && !mIsVertical && isBackDismissIme ? - getResources().getDimension(R.dimen.navbar_back_button_ime_offset) : 0; ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable, @@ -567,15 +572,16 @@ public class NavigationBarView extends FrameLayout { } /** - * Called when the boolean value of whether to adjust the back button for the IME changed. + * Called when the state of the back button being visually adjusted to indicate that it will + * dismiss the IME when pressed has changed. * - * @param useBackAlt whether to adjust the back button for the IME. + * @param isBackDismissIme whether the back button is adjusted for IME dismissal. * * @see android.inputmethodservice.InputMethodService.BackDispositionMode */ - void onBackAltChanged(boolean useBackAlt) { - if (!useBackAlt) { - mTransitionListener.onBackAltCleared(); + void onBackDismissImeChanged(boolean isBackDismissIme) { + if (!isBackDismissIme) { + mTransitionListener.onBackDismissImeCleared(); } } @@ -599,7 +605,8 @@ public class NavigationBarView extends FrameLayout { // We have to replace or restore the back and home button icons when exiting or entering // carmode, respectively. Recents are not available in CarMode in nav bar so change // to recent icon is not required. - final boolean useAltBack = (mNavigationIconHints & NAVIGATION_HINT_BACK_ALT) != 0; + final boolean isBackDismissIme = + (mNavigationIconHints & NAVIGATION_HINT_BACK_DISMISS_IME) != 0; KeyButtonDrawable backIcon = mBackIcon; orientBackButton(backIcon); KeyButtonDrawable homeIcon = mHomeDefaultIcon; @@ -630,7 +637,7 @@ public class NavigationBarView extends FrameLayout { boolean disableHomeHandle = disableRecent && ((mDisabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0); - boolean disableBack = !useAltBack && (mEdgeBackGestureHandler.isHandlingGestures() + boolean disableBack = !isBackDismissIme && (mEdgeBackGestureHandler.isHandlingGestures() || ((mDisabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0)) || isImeRenderingNavButtons(); |