Loading quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java +8 −16 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i // animated to 1, so allow for a smooth transition. private final AnimatedFloat mActivityMultiplier = new AnimatedFloat(this::updateFinalShift); private final Task mRunningTask; private final int mRunningTaskId; private final Context mContext; private final MultiStateCallback mStateCallback; Loading @@ -116,13 +116,9 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i NavBarSwipeInteractionHandler(RunningTaskInfo runningTaskInfo, Context context, @InteractionType int interactionType) { // TODO: We need a better way for this TaskKey taskKey = new TaskKey(runningTaskInfo.id, 0, null, UserHandle.myUserId(), 0); mRunningTask = new Task(taskKey, null, null, "", "", Color.BLACK, Color.BLACK, true, false, false, false, null, 0, null, false); mContext = context; mInteractionType = interactionType; mRunningTaskId = runningTaskInfo.id; WindowManagerWrapper.getInstance().getStableInsets(mStableInsets); DeviceProfile dp = LauncherAppState.getIDP(mContext).getDeviceProfile(mContext); Loading Loading @@ -192,7 +188,7 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i launcher.setOnResumeCallback(this); mLauncher = launcher; mRecentsView = launcher.getOverviewPanel(); mRecentsView.showTask(mRunningTask); mRecentsView.showTask(mRunningTaskId); mHotseat = mLauncher.getHotseat(); mWasLauncherAlreadyVisible = alreadyOnHome; Loading Loading @@ -340,18 +336,15 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i @UiThread private void resumeLastTask() { // TODO: We need a better way for this TaskKey key = mRunningTask.key; RecentsTaskLoadPlan loadPlan = RecentsModel.getInstance(mContext).getLastLoadPlan(); if (loadPlan != null) { Task task = loadPlan.getTaskStack().findTaskWithId(key.id); Task task = loadPlan.getTaskStack().findTaskWithId(mRunningTaskId); if (task != null) { key = task.key; ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, 0, 0); ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(task.key, opts, null, null); } } ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, 0, 0); ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(key, opts, null, null); } public void reset() { Loading Loading @@ -380,8 +373,7 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i if (mInteractionType == INTERACTION_QUICK_SWITCH) { for (int i = mRecentsView.getFirstTaskIndex(); i < mRecentsView.getPageCount(); i++) { TaskView taskView = (TaskView) mRecentsView.getPageAt(i); // TODO: Match the keys directly if (taskView.getTask().key.id != mRunningTask.key.id) { if (taskView.getTask().key.id != mRunningTaskId) { mRecentsView.snapToPage(i, QUICK_SWITCH_SNAP_DURATION); taskView.postDelayed(() -> {taskView.launchTask(true);}, QUICK_SWITCH_SNAP_DURATION); Loading quickstep/src/com/android/quickstep/RecentsView.java +9 −30 Original line number Diff line number Diff line Loading @@ -98,7 +98,8 @@ public class RecentsView extends PagedView implements Insettable { private final RecentsModel mModel; private int mLoadPlanId = -1; private Task mFirstTask; // Only valid until the launcher state changes to NORMAL private int mRunningTaskId = -1; private Bitmap mScrim; private Paint mFadePaint; Loading Loading @@ -241,13 +242,6 @@ public class RecentsView extends PagedView implements Insettable { final ArrayList<Task> tasks = new ArrayList<>(stack.getTasks()); setLayoutTransition(null); if (mFirstTask != null) { // TODO: Handle this case here once we have a valid implementation for mFirstTask if (tasks.isEmpty() || !keysEquals(tasks.get(tasks.size() - 1), mFirstTask)) { // tasks.add(mFirstTask); } } final int requiredChildCount = tasks.size() + mFirstTaskIndex; for (int i = getChildCount(); i < requiredChildCount; i++) { final TaskView taskView = (TaskView) inflater.inflate(R.layout.task, this, false); Loading Loading @@ -394,7 +388,7 @@ public class RecentsView extends PagedView implements Insettable { } public void reset() { mFirstTask = null; mRunningTaskId = -1; setCurrentPage(0); } Loading @@ -407,11 +401,7 @@ public class RecentsView extends PagedView implements Insettable { */ public void reloadIfNeeded() { if (!mModel.isLoadPlanValid(mLoadPlanId)) { int taskId = -1; if (mFirstTask != null) { taskId = mFirstTask.key.id; } mLoadPlanId = mModel.loadTasks(taskId, this::applyLoadPlan); mLoadPlanId = mModel.loadTasks(mRunningTaskId, this::applyLoadPlan); } } Loading @@ -423,41 +413,30 @@ public class RecentsView extends PagedView implements Insettable { * is called. * Also scrolls the view to this task */ public void showTask(Task task) { public void showTask(int runningTaskId) { boolean needsReload = false; boolean inflateFirstChild = true; if (getTaskCount() > 0) { TaskView tv = (TaskView) getChildAt(mFirstTaskIndex); inflateFirstChild = !keysEquals(tv.getTask(), task); } if (inflateFirstChild) { if (getTaskCount() == 0) { needsReload = true; setLayoutTransition(null); // Add an empty view for now setLayoutTransition(null); final TaskView taskView = (TaskView) LayoutInflater.from(getContext()) .inflate(R.layout.task, this, false); addView(taskView, mFirstTaskIndex); taskView.bind(task); setLayoutTransition(mLayoutTransition); } if (!needsReload) { needsReload = !mModel.isLoadPlanValid(mLoadPlanId); } if (needsReload) { mLoadPlanId = mModel.loadTasks(task.key.id, this::applyLoadPlan); mLoadPlanId = mModel.loadTasks(runningTaskId, this::applyLoadPlan); } mFirstTask = task; mRunningTaskId = runningTaskId; setCurrentPage(mFirstTaskIndex); if (mCurrentPage >= mFirstTaskIndex) { ((TaskView) getPageAt(mCurrentPage)).setIconScale(0); } } private static boolean keysEquals(Task t1, Task t2) { // TODO: Match the keys directly return t1.key.id == t2.key.id; } public QuickScrubController getQuickScrubController() { return mQuickScrubController; } Loading quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +4 −7 Original line number Diff line number Diff line Loading @@ -106,8 +106,8 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { private final MainThreadExecutor mMainExecutor = new MainThreadExecutor(); private final Task mRunningTask; private final Context mContext; private final int mRunningTaskId; private MultiStateCallback mStateCallback; private boolean mControllerStateAnimation; Loading @@ -131,11 +131,8 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { private Matrix mTmpMatrix = new Matrix(); WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context) { // TODO: We need a better way for this TaskKey taskKey = new TaskKey(runningTaskInfo.id, 0, null, UserHandle.myUserId(), 0); mRunningTask = new Task(taskKey, null, null, "", "", Color.BLACK, Color.BLACK, true, false, false, false, null, 0, null, false); mContext = context; mRunningTaskId = runningTaskInfo.id; WindowManagerWrapper.getInstance().getStableInsets(mStableInsets); Loading Loading @@ -257,7 +254,7 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { } mRecentsView = mLauncher.getOverviewPanel(); mRecentsView.showTask(mRunningTask); mRecentsView.showTask(mRunningTaskId); mWasLauncherAlreadyVisible = alreadyOnHome; mLauncherLayoutListener = new LauncherLayoutListener(mLauncher, this); mLauncher.getDragLayer().addView(mLauncherLayoutListener); Loading Loading @@ -480,7 +477,7 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { for (int i = mRecentsView.getFirstTaskIndex(); i < mRecentsView.getPageCount(); i++) { TaskView taskView = (TaskView) mRecentsView.getPageAt(i); // TODO: Match the keys directly if (taskView.getTask().key.id != mRunningTask.key.id) { if (taskView.getTask().key.id != mRunningTaskId) { mRecentsView.snapToPage(i, QUICK_SWITCH_SNAP_DURATION); taskView.postDelayed(() -> {taskView.launchTask(true);}, QUICK_SWITCH_SNAP_DURATION); Loading Loading
quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java +8 −16 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i // animated to 1, so allow for a smooth transition. private final AnimatedFloat mActivityMultiplier = new AnimatedFloat(this::updateFinalShift); private final Task mRunningTask; private final int mRunningTaskId; private final Context mContext; private final MultiStateCallback mStateCallback; Loading @@ -116,13 +116,9 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i NavBarSwipeInteractionHandler(RunningTaskInfo runningTaskInfo, Context context, @InteractionType int interactionType) { // TODO: We need a better way for this TaskKey taskKey = new TaskKey(runningTaskInfo.id, 0, null, UserHandle.myUserId(), 0); mRunningTask = new Task(taskKey, null, null, "", "", Color.BLACK, Color.BLACK, true, false, false, false, null, 0, null, false); mContext = context; mInteractionType = interactionType; mRunningTaskId = runningTaskInfo.id; WindowManagerWrapper.getInstance().getStableInsets(mStableInsets); DeviceProfile dp = LauncherAppState.getIDP(mContext).getDeviceProfile(mContext); Loading Loading @@ -192,7 +188,7 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i launcher.setOnResumeCallback(this); mLauncher = launcher; mRecentsView = launcher.getOverviewPanel(); mRecentsView.showTask(mRunningTask); mRecentsView.showTask(mRunningTaskId); mHotseat = mLauncher.getHotseat(); mWasLauncherAlreadyVisible = alreadyOnHome; Loading Loading @@ -340,18 +336,15 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i @UiThread private void resumeLastTask() { // TODO: We need a better way for this TaskKey key = mRunningTask.key; RecentsTaskLoadPlan loadPlan = RecentsModel.getInstance(mContext).getLastLoadPlan(); if (loadPlan != null) { Task task = loadPlan.getTaskStack().findTaskWithId(key.id); Task task = loadPlan.getTaskStack().findTaskWithId(mRunningTaskId); if (task != null) { key = task.key; ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, 0, 0); ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(task.key, opts, null, null); } } ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, 0, 0); ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(key, opts, null, null); } public void reset() { Loading Loading @@ -380,8 +373,7 @@ public class NavBarSwipeInteractionHandler extends BaseSwipeInteractionHandler i if (mInteractionType == INTERACTION_QUICK_SWITCH) { for (int i = mRecentsView.getFirstTaskIndex(); i < mRecentsView.getPageCount(); i++) { TaskView taskView = (TaskView) mRecentsView.getPageAt(i); // TODO: Match the keys directly if (taskView.getTask().key.id != mRunningTask.key.id) { if (taskView.getTask().key.id != mRunningTaskId) { mRecentsView.snapToPage(i, QUICK_SWITCH_SNAP_DURATION); taskView.postDelayed(() -> {taskView.launchTask(true);}, QUICK_SWITCH_SNAP_DURATION); Loading
quickstep/src/com/android/quickstep/RecentsView.java +9 −30 Original line number Diff line number Diff line Loading @@ -98,7 +98,8 @@ public class RecentsView extends PagedView implements Insettable { private final RecentsModel mModel; private int mLoadPlanId = -1; private Task mFirstTask; // Only valid until the launcher state changes to NORMAL private int mRunningTaskId = -1; private Bitmap mScrim; private Paint mFadePaint; Loading Loading @@ -241,13 +242,6 @@ public class RecentsView extends PagedView implements Insettable { final ArrayList<Task> tasks = new ArrayList<>(stack.getTasks()); setLayoutTransition(null); if (mFirstTask != null) { // TODO: Handle this case here once we have a valid implementation for mFirstTask if (tasks.isEmpty() || !keysEquals(tasks.get(tasks.size() - 1), mFirstTask)) { // tasks.add(mFirstTask); } } final int requiredChildCount = tasks.size() + mFirstTaskIndex; for (int i = getChildCount(); i < requiredChildCount; i++) { final TaskView taskView = (TaskView) inflater.inflate(R.layout.task, this, false); Loading Loading @@ -394,7 +388,7 @@ public class RecentsView extends PagedView implements Insettable { } public void reset() { mFirstTask = null; mRunningTaskId = -1; setCurrentPage(0); } Loading @@ -407,11 +401,7 @@ public class RecentsView extends PagedView implements Insettable { */ public void reloadIfNeeded() { if (!mModel.isLoadPlanValid(mLoadPlanId)) { int taskId = -1; if (mFirstTask != null) { taskId = mFirstTask.key.id; } mLoadPlanId = mModel.loadTasks(taskId, this::applyLoadPlan); mLoadPlanId = mModel.loadTasks(mRunningTaskId, this::applyLoadPlan); } } Loading @@ -423,41 +413,30 @@ public class RecentsView extends PagedView implements Insettable { * is called. * Also scrolls the view to this task */ public void showTask(Task task) { public void showTask(int runningTaskId) { boolean needsReload = false; boolean inflateFirstChild = true; if (getTaskCount() > 0) { TaskView tv = (TaskView) getChildAt(mFirstTaskIndex); inflateFirstChild = !keysEquals(tv.getTask(), task); } if (inflateFirstChild) { if (getTaskCount() == 0) { needsReload = true; setLayoutTransition(null); // Add an empty view for now setLayoutTransition(null); final TaskView taskView = (TaskView) LayoutInflater.from(getContext()) .inflate(R.layout.task, this, false); addView(taskView, mFirstTaskIndex); taskView.bind(task); setLayoutTransition(mLayoutTransition); } if (!needsReload) { needsReload = !mModel.isLoadPlanValid(mLoadPlanId); } if (needsReload) { mLoadPlanId = mModel.loadTasks(task.key.id, this::applyLoadPlan); mLoadPlanId = mModel.loadTasks(runningTaskId, this::applyLoadPlan); } mFirstTask = task; mRunningTaskId = runningTaskId; setCurrentPage(mFirstTaskIndex); if (mCurrentPage >= mFirstTaskIndex) { ((TaskView) getPageAt(mCurrentPage)).setIconScale(0); } } private static boolean keysEquals(Task t1, Task t2) { // TODO: Match the keys directly return t1.key.id == t2.key.id; } public QuickScrubController getQuickScrubController() { return mQuickScrubController; } Loading
quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +4 −7 Original line number Diff line number Diff line Loading @@ -106,8 +106,8 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { private final MainThreadExecutor mMainExecutor = new MainThreadExecutor(); private final Task mRunningTask; private final Context mContext; private final int mRunningTaskId; private MultiStateCallback mStateCallback; private boolean mControllerStateAnimation; Loading @@ -131,11 +131,8 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { private Matrix mTmpMatrix = new Matrix(); WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context) { // TODO: We need a better way for this TaskKey taskKey = new TaskKey(runningTaskInfo.id, 0, null, UserHandle.myUserId(), 0); mRunningTask = new Task(taskKey, null, null, "", "", Color.BLACK, Color.BLACK, true, false, false, false, null, 0, null, false); mContext = context; mRunningTaskId = runningTaskInfo.id; WindowManagerWrapper.getInstance().getStableInsets(mStableInsets); Loading Loading @@ -257,7 +254,7 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { } mRecentsView = mLauncher.getOverviewPanel(); mRecentsView.showTask(mRunningTask); mRecentsView.showTask(mRunningTaskId); mWasLauncherAlreadyVisible = alreadyOnHome; mLauncherLayoutListener = new LauncherLayoutListener(mLauncher, this); mLauncher.getDragLayer().addView(mLauncherLayoutListener); Loading Loading @@ -480,7 +477,7 @@ public class WindowTransformSwipeHandler extends BaseSwipeInteractionHandler { for (int i = mRecentsView.getFirstTaskIndex(); i < mRecentsView.getPageCount(); i++) { TaskView taskView = (TaskView) mRecentsView.getPageAt(i); // TODO: Match the keys directly if (taskView.getTask().key.id != mRunningTask.key.id) { if (taskView.getTask().key.id != mRunningTaskId) { mRecentsView.snapToPage(i, QUICK_SWITCH_SNAP_DURATION); taskView.postDelayed(() -> {taskView.launchTask(true);}, QUICK_SWITCH_SNAP_DURATION); Loading