From 4b43cfbc04b8101778a28e5fbb120feb3583a304 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 1 May 2024 17:45:56 -0700 Subject: [PATCH] Add ime back button logic to the init block of NavbarButtonsViewController Fixes: 338320015 Test: Run adb shell am start -a android.intent.action.MAIN -n com.google.android.setupwizard/.SetupWizardTestActivity. Make sure the back key shows by default but hides when IME renders back arrow. Change-Id: I8baeb10d3f5b13c3bac084872d77d881c1513733 --- .../taskbar/NavbarButtonsViewController.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index d5306fb5da..3654e5f286 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -378,6 +378,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT return (flags & FLAG_DISABLE_BACK) == 0 && ((flags & FLAG_KEYGUARD_VISIBLE) == 0 || showingOnKeyguard); })); + // Hide back button in SUW if keyboard is showing (IME draws its own back). + if (mIsImeRenderingNavButtons) { + mPropertyHolders.add(new StatePropertyHolder( + mBackButtonAlpha.get(ALPHA_INDEX_SUW), + flags -> (flags & FLAG_IME_VISIBLE) == 0)); + } mPropertyHolders.add(new StatePropertyHolder(mBackButton, flags -> (flags & FLAG_IME_VISIBLE) != 0, ROTATION_DRAWABLE_PERCENT, 1f, 0f)); @@ -791,13 +797,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT if (isInSetup) { handleSetupUi(); - - // Hide back button in SUW if keyboard is showing (IME draws its own back). - if (mIsImeRenderingNavButtons) { - mPropertyHolders.add(new StatePropertyHolder( - mBackButtonAlpha.get(ALPHA_INDEX_SUW), - flags -> (flags & FLAG_IME_VISIBLE) == 0)); - } } else if (isInKidsMode) { int iconSize = res.getDimensionPixelSize( R.dimen.taskbar_icon_size_kids);