Snap for 12658558 from 5d438685eb to 25Q1-release
Change-Id: I616fcc4cb193dd7de9949bf2ac745c2cca1d26b6
This commit is contained in:
commit
f1eaa1bd95
27 files changed
+598
-157
No files matched your search
@@ -526,4 +526,11 @@ flag {
|
||||
namespace: "launcher"
|
||||
description: "Enable Taskbar LayoutTransition for Recent Apps"
|
||||
bug: "343521765"
|
||||
}
|
||||
|
||||
flag {
|
||||
name: "enable_pinning_app_with_context_menu"
|
||||
namespace: "launcher"
|
||||
description: "Add options to pin/unpin to taskbar to app context menus."
|
||||
bug: "375648361"
|
||||
}
|
||||
@@ -152,7 +152,7 @@
|
||||
android:showOnLockScreen="true"
|
||||
android:launchMode="singleTop"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.START_WIDGET_PICKER_ACTIVITY">
|
||||
android:permission="${applicationId}.permission.START_WIDGET_PICKER_ACTIVITY">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PICK" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/keyboard_quick_switch_margin_top"
|
||||
android:layout_marginHorizontal="@dimen/keyboard_quick_switch_margin_ends"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/keyboard_quick_switch_view_background"
|
||||
android:clipToOutline="true"
|
||||
android:alpha="0"
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
|
||||
<!-- Launcher app transition -->
|
||||
<dimen name="closing_window_trans_y">115dp</dimen>
|
||||
<dimen name="closing_freeform_window_trans_y">36dp</dimen>
|
||||
|
||||
<dimen name="quick_switch_scaling_scroll_threshold">100dp</dimen>
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ import android.view.WindowManager;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
import android.window.DesktopModeFlags;
|
||||
import android.window.RemoteTransition;
|
||||
import android.window.TransitionFilter;
|
||||
import android.window.WindowAnimationState;
|
||||
@@ -166,11 +167,13 @@ import com.android.systemui.animation.RemoteAnimationRunnerCompat;
|
||||
import com.android.systemui.shared.system.BlurUtils;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
|
||||
import com.android.wm.shell.startingsurface.IStartingWindowListener;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -233,6 +236,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
protected final Handler mHandler;
|
||||
|
||||
private final float mClosingWindowTransY;
|
||||
private final float mClosingFreeformWindowTransY;
|
||||
private final float mMaxShadowRadius;
|
||||
|
||||
private final StartingWindowListener mStartingWindowListener =
|
||||
@@ -290,6 +294,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
|
||||
Resources res = mLauncher.getResources();
|
||||
mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
|
||||
mClosingFreeformWindowTransY =
|
||||
res.getDimensionPixelSize(R.dimen.closing_freeform_window_trans_y);
|
||||
mMaxShadowRadius = res.getDimensionPixelSize(R.dimen.max_shadow_radius);
|
||||
|
||||
mLauncher.addOnDeviceProfileChangeListener(this);
|
||||
@@ -1480,10 +1486,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
? 0 : getWindowCornerRadius(mLauncher);
|
||||
float startShadowRadius = areAllTargetsTranslucent(appTargets) ? 0 : mMaxShadowRadius;
|
||||
closingAnimator.setDuration(duration);
|
||||
boolean isFreeform = isFreeformAnimation(appTargets);
|
||||
float translateY = isFreeform ? mClosingFreeformWindowTransY : mClosingWindowTransY;
|
||||
float endScale = isFreeform ? 0.95f : 1f;
|
||||
Interpolator alphaInterpolator = isFreeform
|
||||
? clampToDuration(LINEAR, 0, 100, duration)
|
||||
: clampToDuration(LINEAR, 25, 125, duration);
|
||||
closingAnimator.addUpdateListener(new MultiValueUpdateListener() {
|
||||
FloatProp mDy = new FloatProp(0, mClosingWindowTransY, DECELERATE_1_7);
|
||||
FloatProp mScale = new FloatProp(1f, 1f, DECELERATE_1_7);
|
||||
FloatProp mAlpha = new FloatProp(1f, 0f, clampToDuration(LINEAR, 25, 125, duration));
|
||||
FloatProp mDy = new FloatProp(0, translateY, DECELERATE_1_7);
|
||||
FloatProp mScale = new FloatProp(1f, endScale, DECELERATE_1_7);
|
||||
FloatProp mAlpha = new FloatProp(1f, 0f, alphaInterpolator);
|
||||
FloatProp mShadowRadius = new FloatProp(startShadowRadius, 0, DECELERATE_1_7);
|
||||
|
||||
@Override
|
||||
@@ -1532,6 +1544,13 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
return closingAnimator;
|
||||
}
|
||||
|
||||
private boolean isFreeformAnimation(RemoteAnimationTarget[] appTargets) {
|
||||
return DesktopModeStatus.canEnterDesktopMode(mLauncher.getApplicationContext())
|
||||
&& DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_EXIT_TRANSITIONS.isTrue()
|
||||
&& Arrays.stream(appTargets)
|
||||
.anyMatch(app -> app.taskInfo != null && app.taskInfo.isFreeform());
|
||||
}
|
||||
|
||||
private void addCujInstrumentation(Animator anim, int cuj) {
|
||||
anim.addListener(getCujAnimationSuccessListener(cuj));
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PredictionRowView<T extends Context & ActivityContext>
|
||||
// Vertical padding of the icon that contributes to the expected cell height.
|
||||
private final int mVerticalPadding;
|
||||
// Extra padding that is used in the top app rows (prediction and search) that is not used in
|
||||
// the regular A-Z list. This only applies to single line label.
|
||||
// the regular A-Z list.
|
||||
private final int mTopRowExtraHeight;
|
||||
|
||||
// Helper to drawing the focus indicator.
|
||||
@@ -140,7 +140,7 @@ public class PredictionRowView<T extends Context & ActivityContext>
|
||||
// is not enabled. Otherwise, the extra height will increase by just the textHeight.
|
||||
int extraHeight = (Flags.enableTwolineToggle() &&
|
||||
LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE.get(getContext()))
|
||||
? textHeight : mTopRowExtraHeight;
|
||||
? (textHeight + mTopRowExtraHeight) : mTopRowExtraHeight;
|
||||
totalHeight += extraHeight;
|
||||
return getVisibility() == GONE ? 0 : totalHeight + getPaddingTop() + getPaddingBottom();
|
||||
}
|
||||
|
||||
@@ -139,18 +139,42 @@ public final class KeyboardQuickSwitchController implements
|
||||
@NonNull Set<Integer> taskIdsToExclude,
|
||||
boolean wasOpenedFromTaskbar) {
|
||||
if (mQuickSwitchViewController != null) {
|
||||
if (!mQuickSwitchViewController.isCloseAnimationRunning()
|
||||
&& mQuickSwitchViewController.wasOpenedFromTaskbar() == wasOpenedFromTaskbar) {
|
||||
return;
|
||||
}
|
||||
if (!mQuickSwitchViewController.isCloseAnimationRunning()) {
|
||||
if (mQuickSwitchViewController.wasOpenedFromTaskbar() == wasOpenedFromTaskbar) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Allow the KQS to be reopened during the close animation to make it more responsive.
|
||||
// Similarly, if KQS was opened in different mode (from taskbar vs. keyboard event),
|
||||
// close it so it can be reopened in the correct mode.
|
||||
// TODO(b/368119679) Consider updating list of shown tasks in place, or at least reopen
|
||||
// the view in the same vertical location.
|
||||
closeQuickSwitchView(false);
|
||||
// Relayout the KQS view instead of recreating a new one if it is the current
|
||||
// trigger surface is different than the previous one.
|
||||
final int currentFocusIndexOverride =
|
||||
currentFocusedIndex == -1 && !mControllerCallbacks.isFirstTaskRunning()
|
||||
? 0 : currentFocusedIndex;
|
||||
|
||||
// Skip the task reload if the list is not changed.
|
||||
if (!mModel.isTaskListValid(mTaskListChangeId) || !taskIdsToExclude.equals(
|
||||
mExcludedTaskIds)) {
|
||||
mExcludedTaskIds = taskIdsToExclude;
|
||||
mTaskListChangeId = mModel.getTasks((tasks) -> {
|
||||
processLoadedTasks(tasks, taskIdsToExclude);
|
||||
mQuickSwitchViewController.updateQuickSwitchView(
|
||||
mTasks,
|
||||
mNumHiddenTasks,
|
||||
currentFocusIndexOverride,
|
||||
mHasDesktopTask,
|
||||
mWasDesktopTaskFilteredOut);
|
||||
});
|
||||
}
|
||||
|
||||
mQuickSwitchViewController.updateLayoutForSurface(wasOpenedFromTaskbar,
|
||||
currentFocusIndexOverride);
|
||||
return;
|
||||
} else {
|
||||
// Allow the KQS to be reopened during the close animation to make it more
|
||||
// responsive.
|
||||
closeQuickSwitchView(false);
|
||||
}
|
||||
}
|
||||
|
||||
mOverlayContext = mControllers.taskbarOverlayController.requestWindow();
|
||||
if (Flags.taskbarOverflow()) {
|
||||
mOverlayContext.getDragLayer().addTouchController(this);
|
||||
@@ -186,13 +210,7 @@ public final class KeyboardQuickSwitchController implements
|
||||
|
||||
mExcludedTaskIds = taskIdsToExclude;
|
||||
mTaskListChangeId = mModel.getTasks((tasks) -> {
|
||||
mHasDesktopTask = false;
|
||||
mWasDesktopTaskFilteredOut = false;
|
||||
if (onDesktop) {
|
||||
processLoadedTasksOnDesktop(tasks, taskIdsToExclude);
|
||||
} else {
|
||||
processLoadedTasks(tasks, taskIdsToExclude);
|
||||
}
|
||||
processLoadedTasks(tasks, taskIdsToExclude);
|
||||
// Check if the first task is running after the recents model has updated so that we use
|
||||
// the correct index.
|
||||
mQuickSwitchViewController.openQuickSwitchView(
|
||||
@@ -213,6 +231,17 @@ public final class KeyboardQuickSwitchController implements
|
||||
}
|
||||
|
||||
private void processLoadedTasks(List<GroupTask> tasks, Set<Integer> taskIdsToExclude) {
|
||||
mHasDesktopTask = false;
|
||||
mWasDesktopTaskFilteredOut = false;
|
||||
if (mControllers.taskbarDesktopModeController.getAreDesktopTasksVisible()) {
|
||||
processLoadedTasksOnDesktop(tasks, taskIdsToExclude);
|
||||
} else {
|
||||
processLoadedTasksOutsideDesktop(tasks, taskIdsToExclude);
|
||||
}
|
||||
}
|
||||
|
||||
private void processLoadedTasksOutsideDesktop(List<GroupTask> tasks,
|
||||
Set<Integer> taskIdsToExclude) {
|
||||
// Only store MAX_TASK tasks, from most to least recent
|
||||
Collections.reverse(tasks);
|
||||
mTasks = tasks.stream()
|
||||
|
||||
@@ -201,6 +201,8 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
int currentFocusIndexOverride,
|
||||
@NonNull KeyboardQuickSwitchViewController.ViewCallbacks viewCallbacks,
|
||||
boolean useDesktopTaskView) {
|
||||
mContent.removeAllViews();
|
||||
|
||||
mViewCallbacks = viewCallbacks;
|
||||
Resources resources = context.getResources();
|
||||
Resources.Theme theme = context.getTheme();
|
||||
@@ -333,11 +335,17 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
|
||||
return closeAnimation;
|
||||
}
|
||||
|
||||
private void animateOpen(int currentFocusIndexOverride) {
|
||||
protected void animateOpen(int currentFocusIndexOverride) {
|
||||
if (mOpenAnimation != null) {
|
||||
// Restart animation since currentFocusIndexOverride can change the initial scroll.
|
||||
mOpenAnimation.cancel();
|
||||
}
|
||||
|
||||
// Reset the alpha for the case where the KQS view is opened before.
|
||||
setAlpha(0);
|
||||
mScrollView.setAlpha(0);
|
||||
mNoRecentItemsPane.setAlpha(0);
|
||||
|
||||
mOpenAnimation = new AnimatorSet();
|
||||
|
||||
Animator outlineAnimation = mOutlineAnimationProgress.animateToValue(1f);
|
||||
|
||||
@@ -128,6 +128,23 @@ public class KeyboardQuickSwitchViewController {
|
||||
/* useDesktopTaskView= */ !onDesktop && hasDesktopTask);
|
||||
}
|
||||
|
||||
protected void updateQuickSwitchView(
|
||||
@NonNull List<GroupTask> tasks,
|
||||
int numHiddenTasks,
|
||||
int currentFocusIndexOverride,
|
||||
boolean hasDesktopTask,
|
||||
boolean wasDesktopTaskFilteredOut) {
|
||||
mWasDesktopTaskFilteredOut = wasDesktopTaskFilteredOut;
|
||||
mKeyboardQuickSwitchView.applyLoadPlan(
|
||||
mOverlayContext,
|
||||
tasks,
|
||||
numHiddenTasks,
|
||||
/* updateTasks= */ true,
|
||||
currentFocusIndexOverride,
|
||||
mViewCallbacks,
|
||||
/* useDesktopTaskView= */ !mOnDesktop && hasDesktopTask);
|
||||
}
|
||||
|
||||
protected void positionView(boolean wasOpenedFromTaskbar, boolean isTransientTaskbar) {
|
||||
if (!wasOpenedFromTaskbar) {
|
||||
// Keep the default positioning.
|
||||
@@ -155,6 +172,20 @@ public class KeyboardQuickSwitchViewController {
|
||||
mKeyboardQuickSwitchView.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
protected void updateLayoutForSurface(boolean updateLayoutFromTaskbar,
|
||||
int currentFocusIndexOverride) {
|
||||
BaseDragLayer.LayoutParams lp =
|
||||
(BaseDragLayer.LayoutParams) mKeyboardQuickSwitchView.getLayoutParams();
|
||||
|
||||
if (updateLayoutFromTaskbar) {
|
||||
lp.width = BaseDragLayer.LayoutParams.WRAP_CONTENT;
|
||||
} else {
|
||||
lp.width = BaseDragLayer.LayoutParams.MATCH_PARENT;
|
||||
}
|
||||
|
||||
mKeyboardQuickSwitchView.animateOpen(currentFocusIndexOverride);
|
||||
}
|
||||
|
||||
boolean isCloseAnimationRunning() {
|
||||
return mCloseAnimation != null;
|
||||
}
|
||||
|
||||
@@ -667,7 +667,7 @@ public abstract class AbsSwipeUpHandler<
|
||||
TopTaskTracker.CachedTaskInfo cachedTaskInfo = mGestureState.getRunningTask();
|
||||
if (mIsSwipeForSplit) {
|
||||
int[] splitTaskIds = TopTaskTracker.INSTANCE.get(mContext).getRunningSplitTaskIds();
|
||||
runningTasks = cachedTaskInfo.getPlaceholderTasks(splitTaskIds);
|
||||
runningTasks = cachedTaskInfo.getSplitPlaceholderTasks(splitTaskIds);
|
||||
} else {
|
||||
runningTasks = cachedTaskInfo.getPlaceholderTasks();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET_HOME;
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.SET_END_TARGET_NEW_TASK;
|
||||
|
||||
import android.app.TaskInfo;
|
||||
import android.content.Intent;
|
||||
import android.os.SystemClock;
|
||||
import android.view.MotionEvent;
|
||||
@@ -45,6 +46,7 @@ import com.android.quickstep.util.ActiveGestureLog;
|
||||
import com.android.quickstep.util.ActiveGestureProtoLogProxy;
|
||||
import com.android.quickstep.views.RecentsViewContainer;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.wm.shell.shared.GroupedTaskInfo;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -330,13 +332,23 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
|
||||
if (mRunningTask == null) {
|
||||
return new int[]{INVALID_TASK_ID, INVALID_TASK_ID};
|
||||
} else {
|
||||
int cachedTasksSize = mRunningTask.mAllCachedTasks.size();
|
||||
int count = Math.min(cachedTasksSize, getMultipleTasks ? 2 : 1);
|
||||
int[] runningTaskIds = new int[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
runningTaskIds[i] = mRunningTask.mAllCachedTasks.get(i).taskId;
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
if (mRunningTask.getVisibleTasks().isEmpty()) {
|
||||
return new int[0];
|
||||
}
|
||||
GroupedTaskInfo topRunningTask = mRunningTask.getVisibleTasks().getFirst();
|
||||
List<TaskInfo> groupedTasks = topRunningTask.getTaskInfoList();
|
||||
return groupedTasks.stream().mapToInt(
|
||||
groupedTask -> groupedTask.taskId).toArray();
|
||||
} else {
|
||||
int cachedTasksSize = mRunningTask.mAllCachedTasks.size();
|
||||
int count = Math.min(cachedTasksSize, getMultipleTasks ? 2 : 1);
|
||||
int[] runningTaskIds = new int[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
runningTaskIds[i] = mRunningTask.mAllCachedTasks.get(i).taskId;
|
||||
}
|
||||
return runningTaskIds;
|
||||
}
|
||||
return runningTaskIds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,12 +114,9 @@ public class RecentTasksList {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskMovedToFront(GroupedTaskInfo[] visibleTasks) {
|
||||
public void onTaskMovedToFront(GroupedTaskInfo taskToFront) {
|
||||
mMainThreadExecutor.execute(() -> {
|
||||
// TODO(b/346588978): We currently are only sending a single task, but this will
|
||||
// be updated once we send the full set of visible tasks
|
||||
final TaskInfo info = visibleTasks[0].getTaskInfo1();
|
||||
topTaskTracker.handleTaskMovedToFront(info);
|
||||
topTaskTracker.handleTaskMovedToFront(taskToFront.getTaskInfo1());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -127,6 +124,13 @@ public class RecentTasksList {
|
||||
public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
|
||||
mMainThreadExecutor.execute(() -> topTaskTracker.onTaskChanged(taskInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisibleTasksChanged(GroupedTaskInfo[] visibleTasks) {
|
||||
mMainThreadExecutor.execute(() -> {
|
||||
topTaskTracker.onVisibleTasksChanged(visibleTasks);
|
||||
});
|
||||
}
|
||||
});
|
||||
// We may receive onRunningTaskAppeared events later for tasks which have already been
|
||||
// included in the list returned by mSysUiProxy.getRunningTasks(), or may receive
|
||||
|
||||
@@ -354,7 +354,11 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener, E
|
||||
* @return whether the given running task info matches the gesture-blocked task.
|
||||
*/
|
||||
public boolean isGestureBlockedTask(CachedTaskInfo taskInfo) {
|
||||
return taskInfo != null && taskInfo.getTaskId() == mGestureBlockingTaskId;
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return taskInfo != null && taskInfo.topGroupedTaskContainsTask(mGestureBlockingTaskId);
|
||||
} else {
|
||||
return taskInfo != null && taskInfo.getTaskId() == mGestureBlockingTaskId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,17 +18,18 @@ package com.android.quickstep;
|
||||
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
|
||||
import static android.content.Intent.ACTION_CHOOSER;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.shared.GroupedTaskInfo.TYPE_SPLIT;
|
||||
|
||||
import android.annotation.UserIdInt;
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.app.TaskInfo;
|
||||
import android.content.Context;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -46,8 +47,10 @@ import com.android.systemui.shared.recents.model.Task.TaskKey;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListener;
|
||||
import com.android.systemui.shared.system.TaskStackChangeListeners;
|
||||
import com.android.wm.shell.shared.GroupedTaskInfo;
|
||||
import com.android.wm.shell.splitscreen.ISplitScreenListener;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -61,37 +64,58 @@ import java.util.List;
|
||||
*/
|
||||
public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
implements TaskStackChangeListener, SafeCloseable {
|
||||
|
||||
private static final String TAG = "TopTaskTracker";
|
||||
public static MainThreadInitializedObject<TopTaskTracker> INSTANCE =
|
||||
new MainThreadInitializedObject<>(TopTaskTracker::new);
|
||||
|
||||
private static final int HISTORY_SIZE = 5;
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
// Only used when Flags.enableShellTopTaskTracking() is disabled
|
||||
// Ordered list with first item being the most recent task.
|
||||
private final LinkedList<TaskInfo> mOrderedTaskList = new LinkedList<>();
|
||||
|
||||
private final Context mContext;
|
||||
private final SplitStageInfo mMainStagePosition = new SplitStageInfo();
|
||||
private final SplitStageInfo mSideStagePosition = new SplitStageInfo();
|
||||
private int mPinnedTaskId = INVALID_TASK_ID;
|
||||
|
||||
// Only used when Flags.enableShellTopTaskTracking() is enabled
|
||||
// Mapping of display id to running tasks. Running tasks are ordered from top most to
|
||||
// bottom most.
|
||||
private ArrayMap<Integer, ArrayList<GroupedTaskInfo>> mVisibleTasks = new ArrayMap<>();
|
||||
|
||||
private TopTaskTracker(Context context) {
|
||||
mContext = context;
|
||||
mMainStagePosition.stageType = SplitConfigurationOptions.STAGE_TYPE_MAIN;
|
||||
mSideStagePosition.stageType = SplitConfigurationOptions.STAGE_TYPE_SIDE;
|
||||
|
||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(this);
|
||||
SystemUiProxy.INSTANCE.get(context).registerSplitScreenListener(this);
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// Just prepopulate a list for the default display tasks so we don't need to add null
|
||||
// checks everywhere
|
||||
mVisibleTasks.put(DEFAULT_DISPLAY, new ArrayList<>());
|
||||
} else {
|
||||
mMainStagePosition.stageType = SplitConfigurationOptions.STAGE_TYPE_MAIN;
|
||||
mSideStagePosition.stageType = SplitConfigurationOptions.STAGE_TYPE_SIDE;
|
||||
|
||||
TaskStackChangeListeners.getInstance().registerTaskStackListener(this);
|
||||
SystemUiProxy.INSTANCE.get(context).registerSplitScreenListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(this);
|
||||
SystemUiProxy.INSTANCE.get(mContext).unregisterSplitScreenListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskRemoved(int taskId) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mOrderedTaskList.removeIf(rto -> rto.taskId == taskId);
|
||||
}
|
||||
|
||||
@@ -100,7 +124,11 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
handleTaskMovedToFront(taskInfo);
|
||||
}
|
||||
|
||||
public void handleTaskMovedToFront(TaskInfo taskInfo) {
|
||||
void handleTaskMovedToFront(TaskInfo taskInfo) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mOrderedTaskList.removeIf(rto -> rto.taskId == taskInfo.taskId);
|
||||
mOrderedTaskList.addFirst(taskInfo);
|
||||
|
||||
@@ -131,8 +159,39 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the set of visible tasks have changed.
|
||||
*/
|
||||
public void onVisibleTasksChanged(GroupedTaskInfo[] visibleTasks) {
|
||||
if (!com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(346588978): Per-display info, just have everything in order by display
|
||||
|
||||
// Clear existing tasks for each display
|
||||
mVisibleTasks.forEach((displayId, visibleTasksOnDisplay) -> visibleTasksOnDisplay.clear());
|
||||
|
||||
// Update the visible tasks on each display
|
||||
for (int i = 0; i < visibleTasks.length; i++) {
|
||||
final int displayId = visibleTasks[i].getTaskInfo1().getDisplayId();
|
||||
final ArrayList<GroupedTaskInfo> displayTasks;
|
||||
if (mVisibleTasks.containsKey(displayId)) {
|
||||
displayTasks = mVisibleTasks.get(displayId);
|
||||
} else {
|
||||
displayTasks = new ArrayList<>();
|
||||
mVisibleTasks.put(displayId, displayTasks);
|
||||
}
|
||||
displayTasks.add(visibleTasks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStagePositionChanged(@StageType int stage, @StagePosition int position) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stage == SplitConfigurationOptions.STAGE_TYPE_MAIN) {
|
||||
mMainStagePosition.stagePosition = position;
|
||||
} else {
|
||||
@@ -141,6 +200,10 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
}
|
||||
|
||||
public void onTaskChanged(RunningTaskInfo taskInfo) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < mOrderedTaskList.size(); i++) {
|
||||
if (mOrderedTaskList.get(i).taskId == taskInfo.taskId) {
|
||||
mOrderedTaskList.set(i, taskInfo);
|
||||
@@ -151,6 +214,10 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
|
||||
@Override
|
||||
public void onTaskStageChanged(int taskId, @StageType int stage, boolean visible) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If a task is not visible anymore or has been moved to undefined, stop tracking it.
|
||||
if (!visible || stage == SplitConfigurationOptions.STAGE_TYPE_UNDEFINED) {
|
||||
if (mMainStagePosition.taskId == taskId) {
|
||||
@@ -170,11 +237,19 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
|
||||
@Override
|
||||
public void onActivityPinned(String packageName, int userId, int taskId, int stackId) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPinnedTaskId = taskId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityUnpinned() {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPinnedTaskId = INVALID_TASK_ID;
|
||||
}
|
||||
|
||||
@@ -183,21 +258,59 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
* Will return empty array if device is not in staged split
|
||||
*/
|
||||
public int[] getRunningSplitTaskIds() {
|
||||
if (mMainStagePosition.taskId == INVALID_TASK_ID
|
||||
|| mSideStagePosition.taskId == INVALID_TASK_ID) {
|
||||
return new int[]{};
|
||||
}
|
||||
int[] out = new int[2];
|
||||
if (mMainStagePosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
out[0] = mMainStagePosition.taskId;
|
||||
out[1] = mSideStagePosition.taskId;
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// TODO(346588978): This assumes default display for now
|
||||
final ArrayList<GroupedTaskInfo> visibleTasks = mVisibleTasks.get(DEFAULT_DISPLAY);
|
||||
final GroupedTaskInfo splitTaskInfo = visibleTasks.stream()
|
||||
.filter(taskInfo -> taskInfo.getType() == TYPE_SPLIT)
|
||||
.findFirst().orElse(null);
|
||||
if (splitTaskInfo != null && splitTaskInfo.getSplitBounds() != null) {
|
||||
return new int[] {
|
||||
splitTaskInfo.getSplitBounds().leftTopTaskId,
|
||||
splitTaskInfo.getSplitBounds().rightBottomTaskId
|
||||
};
|
||||
}
|
||||
return new int[0];
|
||||
} else {
|
||||
out[1] = mMainStagePosition.taskId;
|
||||
out[0] = mSideStagePosition.taskId;
|
||||
if (mMainStagePosition.taskId == INVALID_TASK_ID
|
||||
|| mSideStagePosition.taskId == INVALID_TASK_ID) {
|
||||
return new int[]{};
|
||||
}
|
||||
int[] out = new int[2];
|
||||
if (mMainStagePosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
out[0] = mMainStagePosition.taskId;
|
||||
out[1] = mSideStagePosition.taskId;
|
||||
} else {
|
||||
out[1] = mMainStagePosition.taskId;
|
||||
out[0] = mSideStagePosition.taskId;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps the list of tasks in top task tracker.
|
||||
*/
|
||||
public void dump(PrintWriter pw) {
|
||||
if (!com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(346588978): This assumes default display for now
|
||||
final ArrayList<GroupedTaskInfo> displayTasks = mVisibleTasks.get(DEFAULT_DISPLAY);
|
||||
pw.println("TopTaskTracker:");
|
||||
pw.println(" tasks: [");
|
||||
for (GroupedTaskInfo taskInfo : displayTasks) {
|
||||
final TaskInfo info = taskInfo.getTaskInfo1();
|
||||
final boolean isExcluded = (info.baseIntent.getFlags()
|
||||
& FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0;
|
||||
pw.println(" " + info.taskId + ": excluded=" + isExcluded
|
||||
+ " visibleRequested=" + info.isVisibleRequested
|
||||
+ " visible=" + info.isVisible
|
||||
+ " " + info.baseIntent.getComponent());
|
||||
}
|
||||
pw.println(" ]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CachedTaskInfo for the top most task
|
||||
@@ -205,25 +318,35 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
@NonNull
|
||||
@UiThread
|
||||
public CachedTaskInfo getCachedTopTask(boolean filterOnlyVisibleRecents) {
|
||||
if (filterOnlyVisibleRecents) {
|
||||
// Since we only know about the top most task, any filtering may not be applied on the
|
||||
// cache. The second to top task may change while the top task is still the same.
|
||||
RunningTaskInfo[] tasks = TraceHelper.allowIpcs("getCachedTopTask.true", () ->
|
||||
ActivityManagerWrapper.getInstance().getRunningTasks(true));
|
||||
return new CachedTaskInfo(Arrays.asList(tasks));
|
||||
}
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// TODO(346588978): Currently ignore filterOnlyVisibleRecents, but perhaps make this an
|
||||
// explicit filter For things to ignore (ie. PIP/Bubbles/Assistant/etc/so that this is
|
||||
// explicit)
|
||||
// TODO(346588978): This assumes default display for now (as does all of Launcher)
|
||||
final ArrayList<GroupedTaskInfo> displayTasks = mVisibleTasks.get(DEFAULT_DISPLAY);
|
||||
return new CachedTaskInfo(new ArrayList<>(displayTasks));
|
||||
} else {
|
||||
if (filterOnlyVisibleRecents) {
|
||||
// Since we only know about the top most task, any filtering may not be applied on
|
||||
// the cache. The second to top task may change while the top task is still the
|
||||
// same.
|
||||
RunningTaskInfo[] tasks = TraceHelper.allowIpcs("getCachedTopTask.true", () ->
|
||||
ActivityManagerWrapper.getInstance().getRunningTasks(true));
|
||||
return new CachedTaskInfo(Arrays.asList(tasks));
|
||||
}
|
||||
|
||||
if (mOrderedTaskList.isEmpty()) {
|
||||
RunningTaskInfo[] tasks = TraceHelper.allowIpcs("getCachedTopTask.false", () ->
|
||||
ActivityManagerWrapper.getInstance().getRunningTasks(
|
||||
false /* filterOnlyVisibleRecents */));
|
||||
Collections.addAll(mOrderedTaskList, tasks);
|
||||
}
|
||||
if (mOrderedTaskList.isEmpty()) {
|
||||
RunningTaskInfo[] tasks = TraceHelper.allowIpcs("getCachedTopTask.false", () ->
|
||||
ActivityManagerWrapper.getInstance().getRunningTasks(
|
||||
false /* filterOnlyVisibleRecents */));
|
||||
Collections.addAll(mOrderedTaskList, tasks);
|
||||
}
|
||||
|
||||
ArrayList<TaskInfo> tasks = new ArrayList<>(mOrderedTaskList);
|
||||
// Strip the pinned task and recents task
|
||||
tasks.removeIf(t -> t.taskId == mPinnedTaskId || isRecentsTask(t));
|
||||
return new CachedTaskInfo(tasks);
|
||||
ArrayList<TaskInfo> tasks = new ArrayList<>(mOrderedTaskList);
|
||||
// Strip the pinned task and recents task
|
||||
tasks.removeIf(t -> t.taskId == mPinnedTaskId || isRecentsTask(t));
|
||||
return new CachedTaskInfo(tasks);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isRecentsTask(TaskInfo task) {
|
||||
@@ -237,24 +360,79 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
*/
|
||||
public static class CachedTaskInfo {
|
||||
|
||||
// Only used when enableShellTopTaskTracking() is disabled
|
||||
@Nullable
|
||||
private final TaskInfo mTopTask;
|
||||
@Nullable
|
||||
public final List<TaskInfo> mAllCachedTasks;
|
||||
|
||||
CachedTaskInfo(List<TaskInfo> allCachedTasks) {
|
||||
// Only used when enableShellTopTaskTracking() is enabled
|
||||
@Nullable
|
||||
private final GroupedTaskInfo mTopGroupedTask;
|
||||
@Nullable
|
||||
private final ArrayList<GroupedTaskInfo> mVisibleTasks;
|
||||
|
||||
|
||||
// Only used when enableShellTopTaskTracking() is enabled
|
||||
CachedTaskInfo(@NonNull ArrayList<GroupedTaskInfo> visibleTasks) {
|
||||
mAllCachedTasks = null;
|
||||
mTopTask = null;
|
||||
mVisibleTasks = visibleTasks;
|
||||
mTopGroupedTask = !mVisibleTasks.isEmpty() ? mVisibleTasks.getFirst() : null;
|
||||
|
||||
}
|
||||
|
||||
// Only used when enableShellTopTaskTracking() is disabled
|
||||
CachedTaskInfo(@NonNull List<TaskInfo> allCachedTasks) {
|
||||
mVisibleTasks = null;
|
||||
mTopGroupedTask = null;
|
||||
mAllCachedTasks = allCachedTasks;
|
||||
mTopTask = allCachedTasks.isEmpty() ? null : allCachedTasks.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of visible tasks
|
||||
*/
|
||||
public ArrayList<GroupedTaskInfo> getVisibleTasks() {
|
||||
return mVisibleTasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The top task id
|
||||
*/
|
||||
public int getTaskId() {
|
||||
return mTopTask == null ? INVALID_TASK_ID : mTopTask.taskId;
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// Callers should use topGroupedTaskContainsTask() instead
|
||||
return INVALID_TASK_ID;
|
||||
} else {
|
||||
return mTopTask != null ? mTopTask.taskId : INVALID_TASK_ID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether the top grouped task contains the given {@param taskId} if
|
||||
* Flags.enableShellTopTaskTracking() is true, otherwise it checks the top
|
||||
* task as reported from TaskStackListener.
|
||||
*/
|
||||
public boolean topGroupedTaskContainsTask(int taskId) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
return mTopGroupedTask != null && mTopGroupedTask.containsTask(taskId);
|
||||
} else {
|
||||
return mTopTask != null && mTopTask.taskId == taskId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the root of the task chooser activity
|
||||
*/
|
||||
public boolean isRootChooseActivity() {
|
||||
return mTopTask != null && ACTION_CHOOSER.equals(mTopTask.baseIntent.getAction());
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// TODO(346588978): Update this to not make an assumption on a specific task info
|
||||
return mTopGroupedTask != null && ACTION_CHOOSER.equals(
|
||||
mTopGroupedTask.getTaskInfo1().baseIntent.getAction());
|
||||
} else {
|
||||
return mTopTask != null && ACTION_CHOOSER.equals(mTopTask.baseIntent.getAction());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,6 +440,10 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
* is another running task that is not excluded from recents, returns that underlying task.
|
||||
*/
|
||||
public @Nullable CachedTaskInfo getVisibleNonExcludedTask() {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// Callers should not need this when the full set of visible tasks are provided
|
||||
return null;
|
||||
}
|
||||
if (mTopTask == null
|
||||
|| (mTopTask.baseIntent.getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) == 0) {
|
||||
// Not an excluded task.
|
||||
@@ -278,24 +460,30 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this represents the HOME task
|
||||
* Returns true if this represents the HOME activity type task
|
||||
*/
|
||||
public boolean isHomeTask() {
|
||||
return mTopTask != null && mTopTask.configuration.windowConfiguration
|
||||
.getActivityType() == ACTIVITY_TYPE_HOME;
|
||||
}
|
||||
|
||||
public boolean isRecentsTask() {
|
||||
return TopTaskTracker.isRecentsTask(mTopTask);
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// TODO(346588978): Update this to not make an assumption on a specific task info
|
||||
return mTopGroupedTask != null
|
||||
&& mTopGroupedTask.getTaskInfo1().getActivityType() == ACTIVITY_TYPE_HOME;
|
||||
} else {
|
||||
return mTopTask != null && mTopTask.configuration.windowConfiguration
|
||||
.getActivityType() == ACTIVITY_TYPE_HOME;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this task windowing mode is set to {@link
|
||||
* android.app.WindowConfiguration#WINDOWING_MODE_FREEFORM}
|
||||
* Returns true if this represents the RECENTS activity type task
|
||||
*/
|
||||
public boolean isFreeformTask() {
|
||||
return mTopTask != null && mTopTask.configuration.windowConfiguration.getWindowingMode()
|
||||
== WINDOWING_MODE_FREEFORM;
|
||||
public boolean isRecentsTask() {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// TODO(346588978): Update this to not make an assumption on a specific task info
|
||||
return mTopGroupedTask != null
|
||||
&& TopTaskTracker.isRecentsTask(mTopGroupedTask.getTaskInfo1());
|
||||
} else {
|
||||
return TopTaskTracker.isRecentsTask(mTopTask);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,43 +491,78 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
|
||||
* is loaded by the model
|
||||
*/
|
||||
public Task[] getPlaceholderTasks() {
|
||||
return mTopTask == null ? new Task[0]
|
||||
: new Task[]{Task.from(new TaskKey(mTopTask), mTopTask, false)};
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// TODO(346588978): Update this to return more than a single task once the callers
|
||||
// are refactored
|
||||
if (mVisibleTasks.isEmpty()) {
|
||||
return new Task[0];
|
||||
}
|
||||
final TaskInfo info = mVisibleTasks.getFirst().getTaskInfo1();
|
||||
return new Task[]{Task.from(new TaskKey(info), info, false)};
|
||||
} else {
|
||||
return mTopTask == null ? new Task[0]
|
||||
: new Task[]{Task.from(new TaskKey(mTopTask), mTopTask, false)};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link Task} array corresponding to the provided task ids which can be used as a
|
||||
* placeholder until the true object is loaded by the model
|
||||
*/
|
||||
public Task[] getPlaceholderTasks(int[] taskIds) {
|
||||
if (mTopTask == null) {
|
||||
return new Task[0];
|
||||
}
|
||||
Task[] result = new Task[taskIds.length];
|
||||
for (int i = 0; i < taskIds.length; i++) {
|
||||
final int index = i;
|
||||
int taskId = taskIds[i];
|
||||
mAllCachedTasks.forEach(rti -> {
|
||||
if (rti.taskId == taskId) {
|
||||
result[index] = Task.from(new TaskKey(rti), rti, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public Task[] getSplitPlaceholderTasks(int[] taskIds) {
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
if (mVisibleTasks.isEmpty()
|
||||
|| mVisibleTasks.getFirst().getType() != TYPE_SPLIT) {
|
||||
return new Task[0];
|
||||
}
|
||||
|
||||
@UserIdInt
|
||||
@Nullable
|
||||
public Integer getUserId() {
|
||||
return mTopTask == null ? null : mTopTask.userId;
|
||||
GroupedTaskInfo splitTask = mVisibleTasks.getFirst();
|
||||
Task[] result = new Task[taskIds.length];
|
||||
for (int i = 0; i < taskIds.length; i++) {
|
||||
TaskInfo info = splitTask.getTaskById(taskIds[i]);
|
||||
if (info == null) {
|
||||
Log.w(TAG, "Requested task (" + taskIds[i] + ") not found");
|
||||
return new Task[0];
|
||||
}
|
||||
result[i] = Task.from(new TaskKey(info), info, false);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
if (mTopTask == null) {
|
||||
return new Task[0];
|
||||
}
|
||||
Task[] result = new Task[taskIds.length];
|
||||
for (int i = 0; i < taskIds.length; i++) {
|
||||
final int index = i;
|
||||
int taskId = taskIds[i];
|
||||
mAllCachedTasks.forEach(rti -> {
|
||||
if (rti.taskId == taskId) {
|
||||
result[index] = Task.from(new TaskKey(rti), rti, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPackageName() {
|
||||
if (mTopTask == null || mTopTask.baseActivity == null) {
|
||||
return null;
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// TODO(346588978): Update this to not make an assumption on a specific task info
|
||||
if (mTopGroupedTask == null) {
|
||||
return null;
|
||||
}
|
||||
final TaskInfo info = mTopGroupedTask.getTaskInfo1();
|
||||
if (info.baseActivity == null) {
|
||||
return null;
|
||||
}
|
||||
return info.baseActivity.getPackageName();
|
||||
} else {
|
||||
if (mTopTask == null || mTopTask.baseActivity == null) {
|
||||
return null;
|
||||
}
|
||||
return mTopTask.baseActivity.getPackageName();
|
||||
}
|
||||
return mTopTask.baseActivity.getPackageName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1362,15 +1362,17 @@ public class TouchInteractionService extends Service {
|
||||
&& runningTask != null
|
||||
&& runningTask.isRootChooseActivity();
|
||||
|
||||
// In the case where we are in an excluded, translucent overlay, ignore it and treat the
|
||||
// running activity as the task behind the overlay.
|
||||
TopTaskTracker.CachedTaskInfo otherVisibleTask = runningTask == null
|
||||
? null
|
||||
: runningTask.getVisibleNonExcludedTask();
|
||||
if (otherVisibleTask != null) {
|
||||
ActiveGestureProtoLogProxy.logUpdateGestureStateRunningTask(
|
||||
otherVisibleTask.getPackageName(), runningTask.getPackageName());
|
||||
gestureState.updateRunningTask(otherVisibleTask);
|
||||
if (!com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
// In the case where we are in an excluded, translucent overlay, ignore it and treat the
|
||||
// running activity as the task behind the overlay.
|
||||
TopTaskTracker.CachedTaskInfo otherVisibleTask = runningTask == null
|
||||
? null
|
||||
: runningTask.getVisibleNonExcludedTask();
|
||||
if (otherVisibleTask != null) {
|
||||
ActiveGestureProtoLogProxy.logUpdateGestureStateRunningTask(
|
||||
otherVisibleTask.getPackageName(), runningTask.getPackageName());
|
||||
gestureState.updateRunningTask(otherVisibleTask);
|
||||
}
|
||||
}
|
||||
|
||||
boolean previousGestureAnimatedToLauncher =
|
||||
@@ -1672,6 +1674,7 @@ public class TouchInteractionService extends Service {
|
||||
ContextualSearchStateManager.INSTANCE.get(this).dump("\t", pw);
|
||||
SystemUiProxy.INSTANCE.get(this).dump(pw);
|
||||
DeviceConfigWrapper.get().dump(" ", pw);
|
||||
TopTaskTracker.INSTANCE.get(this).dump(pw);
|
||||
}
|
||||
|
||||
private AbsSwipeUpHandler createLauncherSwipeHandler(
|
||||
|
||||
@@ -149,7 +149,8 @@ public class RecentsWindowSwipeHandler extends AbsSwipeUpHandler<RecentsWindowMa
|
||||
if (mActiveAnimationFactory != null) {
|
||||
return;
|
||||
}
|
||||
setHomeScaleAndAlpha(builder, app, mCurrentShift.value, 0);
|
||||
setHomeScaleAndAlpha(builder, app, mCurrentShift.value,
|
||||
Utilities.boundToRange(1 - mCurrentShift.value, 0, 1));
|
||||
}
|
||||
|
||||
private void setHomeScaleAndAlpha(SurfaceProperties builder,
|
||||
|
||||
@@ -409,8 +409,8 @@ public class AppPairsController {
|
||||
);
|
||||
} else {
|
||||
// Tapped an app pair while in a single app
|
||||
int runningTaskId = topTaskTracker
|
||||
.getCachedTopTask(false /* filterOnlyVisibleRecents */).getTaskId();
|
||||
final TopTaskTracker.CachedTaskInfo runningTask = topTaskTracker
|
||||
.getCachedTopTask(false /* filterOnlyVisibleRecents */);
|
||||
|
||||
mSplitSelectStateController.findLastActiveTasksAndRunCallback(
|
||||
componentKeys,
|
||||
@@ -418,10 +418,21 @@ public class AppPairsController {
|
||||
foundTasks -> {
|
||||
Task foundTask1 = foundTasks[0];
|
||||
Task foundTask2 = foundTasks[1];
|
||||
boolean task1IsOnScreen =
|
||||
foundTask1 != null && foundTask1.getKey().getId() == runningTaskId;
|
||||
boolean task2IsOnScreen =
|
||||
foundTask2 != null && foundTask2.getKey().getId() == runningTaskId;
|
||||
boolean task1IsOnScreen;
|
||||
boolean task2IsOnScreen;
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
task1IsOnScreen = foundTask1 != null
|
||||
&& runningTask.topGroupedTaskContainsTask(
|
||||
foundTask1.getKey().getId());
|
||||
task2IsOnScreen = foundTask2 != null
|
||||
&& runningTask.topGroupedTaskContainsTask(
|
||||
foundTask2.getKey().getId());
|
||||
} else {
|
||||
task1IsOnScreen = foundTask1 != null && foundTask1.getKey().getId()
|
||||
== runningTask.getTaskId();
|
||||
task2IsOnScreen = foundTask2 != null && foundTask2.getKey().getId()
|
||||
== runningTask.getTaskId();
|
||||
}
|
||||
|
||||
if (!task1IsOnScreen && !task2IsOnScreen) {
|
||||
// Neither App A nor App B are on-screen, launch the app pair normally.
|
||||
|
||||
@@ -847,6 +847,8 @@ public abstract class RecentsView<
|
||||
private final RecentsViewModelHelper mHelper;
|
||||
private final RecentsViewUtils mUtils = new RecentsViewUtils();
|
||||
|
||||
private final Matrix mTmpMatrix = new Matrix();
|
||||
|
||||
public RecentsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
|
||||
BaseContainerInterface sizeStrategy) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
@@ -1966,7 +1968,7 @@ public abstract class RecentsView<
|
||||
// We try to avoid this because it can cause a scroll jump, but it is needed
|
||||
// for cases where the running task isn't included in this load plan (e.g. if
|
||||
// the current running task is excludedFromRecents.)
|
||||
showCurrentTask(mActiveGestureRunningTasks);
|
||||
showCurrentTask(mActiveGestureRunningTasks, "applyLoadPlan");
|
||||
} else {
|
||||
setRunningTaskViewId(INVALID_TASK_ID);
|
||||
}
|
||||
@@ -2749,7 +2751,7 @@ public abstract class RecentsView<
|
||||
updateSizeAndPadding();
|
||||
}
|
||||
|
||||
showCurrentTask(mActiveGestureRunningTasks);
|
||||
showCurrentTask(mActiveGestureRunningTasks, "onGestureAnimationStart");
|
||||
setEnableFreeScroll(false);
|
||||
setEnableDrawingLiveTile(false);
|
||||
setRunningTaskHidden(true);
|
||||
@@ -2930,8 +2932,9 @@ public abstract class RecentsView<
|
||||
* All subsequent calls to reload will keep the task as the first item until {@link #reset()}
|
||||
* is called. Also scrolls the view to this task.
|
||||
*/
|
||||
private void showCurrentTask(Task[] runningTasks) {
|
||||
Log.d(TAG, "showCurrentTask - runningTasks: " + Arrays.toString(runningTasks));
|
||||
private void showCurrentTask(Task[] runningTasks, String caller) {
|
||||
Log.d(TAG, "showCurrentTask(" + caller + ") - runningTasks: "
|
||||
+ Arrays.toString(runningTasks));
|
||||
if (runningTasks.length == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -5807,6 +5810,14 @@ public abstract class RecentsView<
|
||||
// mSyncTransactionApplier doesn't get transferred over
|
||||
runActionOnRemoteHandles(remoteTargetHandle -> {
|
||||
final TransformParams params = remoteTargetHandle.getTransformParams();
|
||||
if (Flags.enableFallbackOverviewInWindow() || Flags.enableLauncherOverviewInWindow()) {
|
||||
params.setHomeBuilderProxy((builder, app, transformParams) -> {
|
||||
mTmpMatrix.setScale(
|
||||
1f, 1f, app.localBounds.exactCenterX(), app.localBounds.exactCenterY());
|
||||
builder.setMatrix(mTmpMatrix).setAlpha(1f).setShow();
|
||||
});
|
||||
}
|
||||
|
||||
if (mSyncTransactionApplier != null) {
|
||||
params.setSyncTransactionApplier(mSyncTransactionApplier);
|
||||
params.getTargetSet().addReleaseCheck(mSyncTransactionApplier);
|
||||
|
||||
+24
-12
@@ -202,7 +202,7 @@ class AppPairsControllerTest {
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -226,7 +226,7 @@ class AppPairsControllerTest {
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -250,7 +250,7 @@ class AppPairsControllerTest {
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -274,7 +274,7 @@ class AppPairsControllerTest {
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -298,7 +298,7 @@ class AppPairsControllerTest {
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -322,7 +322,7 @@ class AppPairsControllerTest {
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -341,12 +341,16 @@ class AppPairsControllerTest {
|
||||
whenever(mockTaskKey1.getId()).thenReturn(1)
|
||||
whenever(mockTaskKey2.getId()).thenReturn(2)
|
||||
// ... with app 1 already on screen
|
||||
whenever(mockCachedTaskInfo.taskId).thenReturn(1)
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
whenever(mockCachedTaskInfo.topGroupedTaskContainsTask(eq(1))).thenReturn(true)
|
||||
} else {
|
||||
whenever(mockCachedTaskInfo.taskId).thenReturn(1)
|
||||
}
|
||||
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -365,12 +369,16 @@ class AppPairsControllerTest {
|
||||
whenever(mockTaskKey1.getId()).thenReturn(1)
|
||||
whenever(mockTaskKey2.getId()).thenReturn(2)
|
||||
// ... with app 2 already on screen
|
||||
whenever(mockCachedTaskInfo.taskId).thenReturn(2)
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
whenever(mockCachedTaskInfo.topGroupedTaskContainsTask(eq(2))).thenReturn(true)
|
||||
} else {
|
||||
whenever(mockCachedTaskInfo.taskId).thenReturn(2)
|
||||
}
|
||||
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
@@ -389,12 +397,16 @@ class AppPairsControllerTest {
|
||||
whenever(mockTaskKey1.getId()).thenReturn(1)
|
||||
whenever(mockTaskKey2.getId()).thenReturn(2)
|
||||
// ... with app 3 already on screen
|
||||
whenever(mockCachedTaskInfo.taskId).thenReturn(3)
|
||||
if (com.android.wm.shell.Flags.enableShellTopTaskTracking()) {
|
||||
whenever(mockCachedTaskInfo.topGroupedTaskContainsTask(eq(3))).thenReturn(true)
|
||||
} else {
|
||||
whenever(mockCachedTaskInfo.taskId).thenReturn(3)
|
||||
}
|
||||
|
||||
// Trigger app pair launch, capture and run callback from findLastActiveTasksAndRunCallback
|
||||
spyAppPairsController.handleAppPairLaunchInApp(
|
||||
mockAppPairIcon,
|
||||
listOf(mockItemInfo1, mockItemInfo2)
|
||||
listOf(mockItemInfo1, mockItemInfo2),
|
||||
)
|
||||
verify(splitSelectStateController)
|
||||
.findLastActiveTasksAndRunCallback(any(), any(), callbackCaptor.capture())
|
||||
|
||||
@@ -49,6 +49,7 @@ public class TaplTestsKeyboardQuickSwitch extends AbstractQuickStepTest {
|
||||
DISMISS(0),
|
||||
LAUNCH_LAST_APP(0),
|
||||
LAUNCH_SELECTED_APP(1),
|
||||
DISMISS_WHEN_GOING_HOME(1),
|
||||
LAUNCH_OVERVIEW(KeyboardQuickSwitchController.MAX_TASKS - 1);
|
||||
|
||||
private final int mNumAdditionalRunningTasks;
|
||||
@@ -156,6 +157,11 @@ public class TaplTestsKeyboardQuickSwitch extends AbstractQuickStepTest {
|
||||
mLauncher.goHome().showQuickSwitchView().launchFocusedAppTask(CALCULATOR_APP_PACKAGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDismissedWhenGoingHome() {
|
||||
runTest(TestSurface.LAUNCHED_APP, TestCase.DISMISS_WHEN_GOING_HOME);
|
||||
}
|
||||
|
||||
private void runTest(@NonNull TestSurface testSurface, @NonNull TestCase testCase) {
|
||||
for (int i = 0; i < testCase.mNumAdditionalRunningTasks; i++) {
|
||||
startTestActivity(3 + i);
|
||||
@@ -197,6 +203,9 @@ public class TaplTestsKeyboardQuickSwitch extends AbstractQuickStepTest {
|
||||
}
|
||||
kqs.launchFocusedAppTask(CALCULATOR_APP_PACKAGE);
|
||||
break;
|
||||
case DISMISS_WHEN_GOING_HOME:
|
||||
kqs.dismissByGoingHome();
|
||||
break;
|
||||
case LAUNCH_OVERVIEW:
|
||||
kqs.moveFocusBackward();
|
||||
if (!testSurface.mInitialFocusAtZero) {
|
||||
|
||||
@@ -312,9 +312,10 @@
|
||||
<attr name="rowCountSpecsId" format="reference" />
|
||||
<!-- defaults to allAppsCellSpecsId, if not specified -->
|
||||
<attr name="allAppsCellSpecsTwoPanelId" format="reference" />
|
||||
|
||||
<!-- defaults to false, if not specified -->
|
||||
<attr name="isFixedLandscape" format="boolean" />
|
||||
<!-- defaults to false, if not specified -->
|
||||
<attr name="isOldGrid" format="boolean" />
|
||||
|
||||
<!-- By default all categories are enabled -->
|
||||
<attr name="deviceCategory" format="integer">
|
||||
|
||||
@@ -1031,6 +1031,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
private final int mAllAppsCellSpecsTwoPanelId;
|
||||
private final int mRowCountSpecsId;
|
||||
private final boolean mIsFixedLandscape;
|
||||
private final boolean mIsOldGrid;
|
||||
|
||||
public GridOption(Context context, AttributeSet attrs, Info displayInfo) {
|
||||
TypedArray a = context.obtainStyledAttributes(
|
||||
@@ -1175,6 +1176,7 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
}
|
||||
|
||||
mIsFixedLandscape = a.getBoolean(R.styleable.GridDisplayOption_isFixedLandscape, false);
|
||||
mIsOldGrid = a.getBoolean(R.styleable.GridDisplayOption_isOldGrid, false);
|
||||
|
||||
int inlineForRotation = a.getInt(R.styleable.GridDisplayOption_inlineQsb,
|
||||
DONT_INLINE_QSB);
|
||||
@@ -1206,20 +1208,30 @@ public class InvariantDeviceProfile implements SafeCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNewGridOption() {
|
||||
return mRowCountSpecsId != INVALID_RESOURCE_HANDLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the grid option should be used given the flags that are toggled on/off.
|
||||
*/
|
||||
public boolean filterByFlag(int deviceType, boolean isFixedLandscape) {
|
||||
if (deviceType == TYPE_TABLET) {
|
||||
return Flags.oneGridRotationHandling() == mIsDualGrid;
|
||||
}
|
||||
|
||||
if (isFixedLandscape) {
|
||||
return Flags.oneGridSpecs() && mIsFixedLandscape;
|
||||
// Here we return true if fixed landscape mode should be on.
|
||||
if (mIsFixedLandscape || isFixedLandscape) {
|
||||
return mIsFixedLandscape && isFixedLandscape && Flags.oneGridSpecs();
|
||||
}
|
||||
|
||||
return ((Flags.oneGridSpecs() == isNewGridOption()) && !mIsFixedLandscape);
|
||||
// Here we return true if we want to show the new grids.
|
||||
if (mRowCountSpecsId != INVALID_RESOURCE_HANDLE) {
|
||||
return Flags.oneGridSpecs();
|
||||
}
|
||||
|
||||
// Here we return true if we want to show the old grids.
|
||||
if (mIsOldGrid) {
|
||||
return !Flags.oneGridSpecs();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_WIDGET_RESIZE_FRAME;
|
||||
import static com.android.launcher3.BubbleTextView.DISPLAY_FOLDER;
|
||||
import static com.android.launcher3.Flags.enableSmartspaceRemovalToggle;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
|
||||
@@ -1222,6 +1223,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
}
|
||||
|
||||
protected void onPageBeginTransition() {
|
||||
// Widget resize frame doesn't receive events to close when talkback is enabled. For that
|
||||
// case, close it here.
|
||||
AbstractFloatingView.closeOpenViews(mLauncher, false, TYPE_WIDGET_RESIZE_FRAME);
|
||||
|
||||
super.onPageBeginTransition();
|
||||
updateChildrenLayersEnabled();
|
||||
}
|
||||
|
||||
@@ -119,6 +119,9 @@ public class LauncherDragController extends DragController<Launcher> {
|
||||
initialDragViewScale,
|
||||
dragViewScaleOnDrop,
|
||||
scalePx);
|
||||
// During a drag, we don't want to expose the descendendants of drag view to a11y users,
|
||||
// since those decendents are not a valid position in the workspace.
|
||||
dragView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
|
||||
dragView.setItemInfo(dragInfo);
|
||||
mDragObject.dragComplete = false;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import static androidx.preference.PreferenceFragmentCompat.ARG_PREFERENCE_ROOT;
|
||||
|
||||
import static com.android.launcher3.BuildConfig.IS_DEBUG_DEVICE;
|
||||
import static com.android.launcher3.BuildConfig.IS_STUDIO_BUILD;
|
||||
import static com.android.launcher3.InvariantDeviceProfile.TYPE_MULTI_DISPLAY;
|
||||
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -52,6 +53,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.launcher3.BuildConfig;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.LauncherFiles;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.states.RotationHelper;
|
||||
@@ -310,7 +312,10 @@ public class SettingsActivity extends FragmentActivity
|
||||
}
|
||||
return mDeveloperOptionsEnabled;
|
||||
case FIXED_LANDSCAPE_MODE:
|
||||
if (!Flags.oneGridSpecs()) {
|
||||
if (!Flags.oneGridSpecs()
|
||||
// adding this condition until fixing b/378972567
|
||||
|| InvariantDeviceProfile.INSTANCE.get(getContext()).deviceType
|
||||
== TYPE_MULTI_DISPLAY) {
|
||||
return false;
|
||||
}
|
||||
// When the setting changes rotate the screen accordingly to showcase the result
|
||||
|
||||
@@ -295,8 +295,11 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
||||
}
|
||||
|
||||
private void attachScrollbarToRecyclerView(WidgetsRecyclerView recyclerView) {
|
||||
recyclerView.bindFastScrollbar(mFastScroller, WIDGET_SCROLLER);
|
||||
if (mCurrentWidgetsRecyclerView != recyclerView) {
|
||||
// Bind scrollbar if changing the recycler view. If widgets list updates, since
|
||||
// scrollbar is already attached to the recycler view, it will automatically adjust as
|
||||
// needed with recycler view's onScrollListener.
|
||||
recyclerView.bindFastScrollbar(mFastScroller, WIDGET_SCROLLER);
|
||||
// Only reset the scroll position & expanded apps if the currently shown recycler view
|
||||
// has been updated.
|
||||
reset();
|
||||
|
||||
@@ -162,6 +162,32 @@ public final class KeyboardQuickSwitch {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismisses the Keyboard Quick Switch view by going home. After the Keyboard Quick Switch view
|
||||
* gets hidden, it unpresses ALT key, which is generally used to keep the view visible.
|
||||
*/
|
||||
public Workspace dismissByGoingHome() {
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
|
||||
"verifying keyboard quick switch view is shown")) {
|
||||
mLauncher.waitForLauncherObject(KEYBOARD_QUICK_SWITCH_RES_ID);
|
||||
}
|
||||
|
||||
mLauncher.goHome();
|
||||
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
|
||||
"waiting for keyboard quick switch dismissal");
|
||||
LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) {
|
||||
mLauncher.waitUntilLauncherObjectGone(KEYBOARD_QUICK_SWITCH_RES_ID);
|
||||
}
|
||||
|
||||
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer(
|
||||
"get workspace after releasing ALT key")) {
|
||||
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_HOME_ALT_LEFT_UP);
|
||||
mLauncher.unpressKeyCode(KeyEvent.KEYCODE_ALT_LEFT, 0);
|
||||
return mLauncher.getWorkspace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the currently-focused app task.
|
||||
* <p>
|
||||
|
||||
Reference in new issue
Block a user