From d9d70eaca1fa25a154a351341ee77423915bc7a1 Mon Sep 17 00:00:00 2001 From: Holly Sun Date: Tue, 5 Sep 2023 13:14:22 -0700 Subject: [PATCH 1/2] Set focus to EditText after open Toast with Meta key. Meta key is an a11y action, which is set up in platform for action `GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS`: https://source.corp.google.com/h/googleplex-android/platform/superproject/main/+/main:frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java;l=3573-3591;drc=34be95719dafc554f5ffc9ebb025e011fc81c7e9. `TouchInteractionService` is the one that implements the action: https://source.corp.google.com/h/googleplex-android/platform/superproject/main/+/main:packages/apps/Launcher3/quickstep/src/com/android/quickstep/TouchInteractionService.java;l=573;drc=b2ac210120abc4620f81e41d7a737f5f0009e5e0. `createAllAppsAction()` (where we set `INTENT_ACTION_ALL_APPS_TOGGLE`) only has this one caller. So `Launcher#toggleAllAppsFromIntent` is the exclusive path to handle a11y action. Current behavior: when "Swipe up to start search" toggle is ON, everything works fine (keyboard up and focus set); when toggle is OFF, keyboard is up but without focus set. With this change, keyboard up with focus set regardless of the toggle value. From https://docs.google.com/presentation/d/19iTRDGL-GSMfkTIXY8q2qjHQu2Fiih6CVhLqlwtV1bc/edit#slide=id.g13b39c67f16_0_108, the focus should be set for Meta key no matter what. Also, with talk-back on, the focus is also set to the input box with this change. Vide: https://drive.google.com/corp/drive/u/0/folders/1yFlq7ldP0u1i3tSVpk72FsMu7QRZaUGM Bug: 289058571 Test: manual Flag: N/A Change-Id: Ie471641f13cf9bd7d38f0e330d4f6c8c564b07b8 --- src/com/android/launcher3/Launcher.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index ffb8b8244b..038967c98f 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -144,6 +144,7 @@ import com.android.launcher3.allapps.AllAppsStore; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.allapps.BaseSearchConfig; import com.android.launcher3.allapps.DiscoveryBounce; +import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.PropertyListBuilder; import com.android.launcher3.apppairs.AppPairIcon; import com.android.launcher3.celllayout.CellPosMapper; @@ -1719,7 +1720,16 @@ public class Launcher extends StatefulActivity if (getStateManager().isInStableState(ALL_APPS)) { getStateManager().goToState(NORMAL, alreadyOnHome); } else { - showAllAppsFromIntent(alreadyOnHome); + AbstractFloatingView.closeAllOpenViews(this); + getStateManager().goToState(ALL_APPS, true /* animated */, + new AnimationSuccessListener() { + @Override + public void onAnimationSuccess(Animator animator) { + if (mAppsView.getSearchUiManager().getEditText() != null) { + mAppsView.getSearchUiManager().getEditText().requestFocus(); + } + } + }); } } From 6472119d4b3ba8c69f596e06e24f267902d8a0de Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Fri, 8 Sep 2023 14:35:34 -0700 Subject: [PATCH 2/2] Apply ForciblyShown WindowLayoutParam flags for Transient Taskbar Test: Manual Bug: 278078311 Flag: Not needed Change-Id: Ia963e45b3b4e6d928b6292b80b73394e76fe2325 --- .../taskbar/TaskbarActivityContext.java | 23 ++++++++++++++++--- .../taskbar/TaskbarStashController.java | 1 + 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 0b83a88bcc..1ef90079e6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -57,6 +57,7 @@ import android.view.Gravity; import android.view.RoundedCorner; import android.view.Surface; import android.view.View; +import android.view.WindowInsets; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.Toast; @@ -852,6 +853,21 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mWindowManager.updateViewLayout(mDragLayer, mWindowLayoutParams); } + /** + * Applies forcibly show flag to taskbar window iff transient taskbar is unstashed. + */ + public void applyForciblyShownFlagWhileTransientTaskbarUnstashed(boolean shouldForceShow) { + if (!DisplayController.isTransientTaskbar(this)) { + return; + } + if (shouldForceShow) { + mWindowLayoutParams.forciblyShownTypes |= WindowInsets.Type.navigationBars(); + } else { + mWindowLayoutParams.forciblyShownTypes &= ~WindowInsets.Type.navigationBars(); + } + notifyUpdateLayoutParams(); + } + /** * Either adds or removes {@link WindowManager.LayoutParams#FLAG_NOT_FOCUSABLE} on the taskbar * window. If we're now focusable, also move nav buttons to a separate window above IME. @@ -958,8 +974,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } } catch (NullPointerException - | ActivityNotFoundException - | SecurityException e) { + | ActivityNotFoundException + | SecurityException e) { Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT) .show(); Log.e(TAG, "Unable to launch. tag=" + info + " intent=" + intent, e); @@ -1053,6 +1069,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { /** * Called when we detect a long press in the nav region before passing the gesture slop. + * * @return Whether taskbar handled the long press, and thus should cancel the gesture. */ public boolean onLongPressToUnstashTaskbar() { @@ -1121,7 +1138,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * Called when we detect a motion down or up/cancel in the nav region while stashed. * * @param animateForward Whether to animate towards the unstashed hint state or back to stashed. - * @param forceUnstash Whether we force the unstash hint. + * @param forceUnstash Whether we force the unstash hint. */ public void startTaskbarUnstashHint(boolean animateForward, boolean forceUnstash) { // TODO(b/270395798): Clean up forceUnstash after removing long-press unstashing code. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index b5b453be82..a920dfaf6a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -1097,6 +1097,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_TRANSIENT_TASKBAR, !hasAnyFlag(FLAG_STASHED_IN_APP_AUTO)); } + mActivity.applyForciblyShownFlagWhileTransientTaskbarUnstashed(!isStashedInApp()); } private void notifyStashChange(boolean visible, boolean stashed) {