Merge "Taskbar All Apps Shortcut Menu Acccessibility Focus" into udc-dev
diff --git a/quickstep/res/values-es-rUS/strings.xml b/quickstep/res/values-es-rUS/strings.xml
index 40009fc..a522e50 100644
--- a/quickstep/res/values-es-rUS/strings.xml
+++ b/quickstep/res/values-es-rUS/strings.xml
@@ -65,7 +65,7 @@
<string name="home_gesture_intro_title" msgid="836590312858441830">"Desliza para ir a la página principal"</string>
<string name="home_gesture_intro_subtitle" msgid="2632238748497975326">"Desliza hacia arriba desde la parte inferior de la pantalla. Este gesto te llevará a la pantalla principal."</string>
<string name="home_gesture_spoken_intro_subtitle" msgid="1030987707382031750">"Desliza hacia arriba desde la parte inferior. Este gesto te llevará siempre a la pantalla principal."</string>
- <string name="home_gesture_tutorial_title" msgid="3126834347496917376">"Ir a la pantalla principal"</string>
+ <string name="home_gesture_tutorial_title" msgid="3126834347496917376">"Ve a la pantalla principal"</string>
<string name="home_gesture_tutorial_subtitle" msgid="7245995490408668778">"Desliza hacia arriba desde la parte inferior de la pantalla"</string>
<string name="home_gesture_tutorial_success" msgid="1736295017642244751">"¡Bien hecho!"</string>
<string name="overview_gesture_feedback_swipe_too_far_from_edge" msgid="6402349235265407385">"Asegúrate de deslizar hacia arriba desde el borde inferior de la pantalla"</string>
@@ -76,7 +76,7 @@
<string name="overview_gesture_intro_title" msgid="2902054412868489378">"Desliza para cambiar de app"</string>
<string name="overview_gesture_intro_subtitle" msgid="4968091015637850859">"Desliza el dedo hacia arriba desde la parte inferior, mantenlo presionado y suéltalo."</string>
<string name="overview_gesture_spoken_intro_subtitle" msgid="3853371838260201751">"Para alternar entre apps, desliza el dedo hacia arriba, mantén presionado y, luego, suelta."</string>
- <string name="overview_gesture_tutorial_title" msgid="4125835002668708720">"Cambiar de app"</string>
+ <string name="overview_gesture_tutorial_title" msgid="4125835002668708720">"Cambia de app"</string>
<string name="overview_gesture_tutorial_subtitle" msgid="5253549754058973071">"Desliza hacia arriba desde la parte inferior de la pantalla, mantenla presionada y, luego, suelta"</string>
<string name="overview_gesture_tutorial_success" msgid="1910267697807973076">"¡Bien hecho!"</string>
<string name="gesture_tutorial_confirm_title" msgid="6201516182040074092">"Listo"</string>
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index e5fd605..ca9c577 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -18,6 +18,7 @@
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
+import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.provider.Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING;
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
import static android.view.RemoteAnimationTarget.MODE_OPENING;
@@ -144,6 +145,7 @@
import com.android.quickstep.util.SurfaceTransaction;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
import com.android.quickstep.util.SurfaceTransactionApplier;
+import com.android.quickstep.util.TaskRestartedDuringLaunchListener;
import com.android.quickstep.util.WorkspaceRevealAnim;
import com.android.quickstep.views.FloatingWidgetView;
import com.android.quickstep.views.RecentsView;
@@ -229,6 +231,7 @@
private RemoteAnimationProvider mRemoteAnimationProvider;
// Strong refs to runners which are cleared when the launcher activity is destroyed
private RemoteAnimationFactory mWallpaperOpenRunner;
+ private RemoteAnimationFactory mAppLaunchRunner;
private RemoteAnimationFactory mKeyguardGoingAwayRunner;
private RemoteAnimationFactory mWallpaperOpenTransitionRunner;
@@ -298,17 +301,23 @@
boolean fromRecents = isLaunchingFromRecents(v, null /* targets */);
RunnableList onEndCallback = new RunnableList();
- RemoteAnimationFactory delegateRunner = new AppLaunchAnimationRunner(v, onEndCallback);
+ // Handle the case where an already visible task is launched which results in no transition
+ TaskRestartedDuringLaunchListener restartedListener =
+ new TaskRestartedDuringLaunchListener();
+ restartedListener.register(onEndCallback::executeAllAndDestroy);
+ onEndCallback.add(restartedListener::unregister);
+
+ mAppLaunchRunner = new AppLaunchAnimationRunner(v, onEndCallback);
ItemInfo tag = (ItemInfo) v.getTag();
if (tag != null && tag.shouldUseBackgroundAnimation()) {
ContainerAnimationRunner containerAnimationRunner =
ContainerAnimationRunner.from(v, mStartingWindowListener, onEndCallback);
if (containerAnimationRunner != null) {
- delegateRunner = containerAnimationRunner;
+ mAppLaunchRunner = containerAnimationRunner;
}
}
RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(
- mHandler, delegateRunner, true /* startAtFrontOfQueue */);
+ mHandler, mAppLaunchRunner, true /* startAtFrontOfQueue */);
// Note that this duration is a guess as we do not know if the animation will be a
// recents launch or not for sure until we know the opening app targets.
@@ -1164,6 +1173,7 @@
// Also clear strong references to the runners registered with the remote animation
// definition so we don't have to wait for the system gc
mWallpaperOpenRunner = null;
+ mAppLaunchRunner = null;
mKeyguardGoingAwayRunner = null;
}
}
@@ -1201,14 +1211,15 @@
return false;
}
- private boolean hasMultipleTargetsWithMode(RemoteAnimationTarget[] targets, int mode) {
+ private boolean shouldPlayFallbackClosingAnimation(RemoteAnimationTarget[] targets) {
int numTargets = 0;
for (RemoteAnimationTarget target : targets) {
- if (target.mode == mode) {
+ if (target.mode == MODE_CLOSING) {
numTargets++;
- }
- if (numTargets > 1) {
- return true;
+ if (numTargets > 1 || target.windowConfiguration.getWindowingMode()
+ == WINDOWING_MODE_MULTI_WINDOW) {
+ return true;
+ }
}
}
return false;
@@ -1595,7 +1606,7 @@
boolean playFallBackAnimation = (launcherView == null
&& launcherIsForceInvisibleOrOpening)
|| mLauncher.getWorkspace().isOverlayShown()
- || hasMultipleTargetsWithMode(appTargets, MODE_CLOSING);
+ || shouldPlayFallbackClosingAnimation(appTargets);
boolean playWorkspaceReveal = true;
boolean skipAllAppsScale = false;
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index 17e7e1b..ddea51f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -202,6 +202,11 @@
public void onStateTransitionComplete(LauncherState finalState) {
mLauncherState = finalState;
updateStateForFlag(FLAG_LAUNCHER_IN_STATE_TRANSITION, false);
+ // TODO(b/279514548) Cleans up bad state that can occur when user interacts with
+ // taskbar on top of transparent activity.
+ if (finalState == LauncherState.NORMAL && mLauncher.isResumed()) {
+ updateStateForFlag(FLAG_RESUMED, true);
+ }
applyState();
boolean disallowLongClick = finalState == LauncherState.OVERVIEW_SPLIT_SELECT;
com.android.launcher3.taskbar.Utilities.setOverviewDragState(
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 658bf2d..2f13c5d 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -345,11 +345,13 @@
@Override
public RunnableList startActivitySafely(View v, Intent intent, ItemInfo item) {
- // Only pause is taskbar controller is not present
+ // Only pause is taskbar controller is not present until the transition (if it exists) ends
mHotseatPredictionController.setPauseUIUpdate(getTaskbarUIController() == null);
RunnableList result = super.startActivitySafely(v, intent, item);
- if (getTaskbarUIController() == null && result == null) {
- mHotseatPredictionController.setPauseUIUpdate(false);
+ if (result == null) {
+ if (getTaskbarUIController() == null) {
+ mHotseatPredictionController.setPauseUIUpdate(false);
+ }
} else {
result.add(() -> mHotseatPredictionController.setPauseUIUpdate(false));
}
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 499a260..1238819 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -473,16 +473,14 @@
throw new IllegalStateException(
"Expected task to be showing, but it is " + mode);
}
- if (change.getParent() == null) {
- throw new IllegalStateException("Initiating multi-split launch but the split"
- + "root of " + taskId + " is already visible or has broken hierarchy.");
- }
}
if (taskId == initialTaskId) {
- splitRoot1 = transitionInfo.getChange(change.getParent());
+ splitRoot1 = change.getParent() == null ? change :
+ transitionInfo.getChange(change.getParent());
}
if (taskId == secondTaskId) {
- splitRoot2 = transitionInfo.getChange(change.getParent());
+ splitRoot2 = change.getParent() == null ? change :
+ transitionInfo.getChange(change.getParent());
}
}
diff --git a/quickstep/src/com/android/quickstep/util/TaskRestartedDuringLaunchListener.java b/quickstep/src/com/android/quickstep/util/TaskRestartedDuringLaunchListener.java
new file mode 100644
index 0000000..91e8376
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/util/TaskRestartedDuringLaunchListener.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.quickstep.util;
+
+import static android.app.ActivityTaskManager.INVALID_TASK_ID;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter;
+import com.android.quickstep.RecentsModel;
+import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.TaskStackChangeListeners;
+
+/**
+ * This class tracks the failure of a task launch through the Launcher.startActivitySafely() call,
+ * in an edge case in which a task may already be visible on screen (ie. in PIP) and no transition
+ * will be run in WM, which results in expected callbacks to not be processed.
+ *
+ * We transiently register a task stack listener during a task launch and if the restart signal is
+ * received, then the registered callback will be notified.
+ */
+public class TaskRestartedDuringLaunchListener implements TaskStackChangeListener {
+
+ private static final String TAG = "TaskRestartedDuringLaunchListener";
+
+ private @NonNull Runnable mTaskRestartedCallback = null;
+
+ /**
+ * Registers a failure listener callback if it detects a scenario in which an app launch
+ * resulted in an already existing task to be "restarted".
+ */
+ public void register(@NonNull Runnable taskRestartedCallback) {
+ TaskStackChangeListeners.getInstance().registerTaskStackListener(this);
+ mTaskRestartedCallback = taskRestartedCallback;
+ }
+
+ /**
+ * Unregisters the failure listener.
+ */
+ public void unregister() {
+ TaskStackChangeListeners.getInstance().unregisterTaskStackListener(this);
+ mTaskRestartedCallback = null;
+ }
+
+ @Override
+ public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
+ boolean homeTaskVisible, boolean clearedTask, boolean wasVisible) {
+ if (wasVisible) {
+ Log.d(TAG, "Detected activity restart during launch for task=" + task.taskId);
+ mTaskRestartedCallback.run();
+ unregister();
+ }
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 17d83ec..83a5c72 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -841,17 +841,20 @@
// the actual overview state
failureListener.register(mActivity, mTask.key.id, () -> {
notifyTaskLaunchFailed(TAG);
- // Disable animations for now, as it is an edge case and the app usually covers
- // launcher and also any state transition animation also gets clobbered by
- // QuickstepTransitionManager.createWallpaperOpenAnimations when launcher
- // shows again
- getRecentsView().startHome(false /* animated */);
RecentsView rv = getRecentsView();
- if (rv != null && rv.mSizeStrategy.getTaskbarController() != null) {
- // LauncherTaskbarUIController depends on the launcher state when checking
- // whether to handle resume, but that can come in before startHome() changes
- // the state, so force-refresh here to ensure the taskbar is updated
- rv.mSizeStrategy.getTaskbarController().refreshResumedState();
+ if (rv != null) {
+ // Disable animations for now, as it is an edge case and the app usually
+ // covers launcher and also any state transition animation also gets
+ // clobbered by QuickstepTransitionManager.createWallpaperOpenAnimations
+ // when launcher shows again
+ rv.startHome(false /* animated */);
+ if (rv.mSizeStrategy.getTaskbarController() != null) {
+ // LauncherTaskbarUIController depends on the launcher state when
+ // checking whether to handle resume, but that can come in before
+ // startHome() changes the state, so force-refresh here to ensure the
+ // taskbar is updated
+ rv.mSizeStrategy.getTaskbarController().refreshResumedState();
+ }
}
});
}
diff --git a/res/layout/hotseat.xml b/res/layout/hotseat.xml
index 95ebd94..82b0b8d 100644
--- a/res/layout/hotseat.xml
+++ b/res/layout/hotseat.xml
@@ -21,5 +21,4 @@
android:layout_height="match_parent"
android:theme="@style/HomeScreenElementTheme"
android:importantForAccessibility="no"
- android:preferKeepClear="true"
launcher:containerType="hotseat" />
\ No newline at end of file