import com.android.systemui.recents.events.activity.AppWidgetProviderChangedEvent;
import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
import com.android.systemui.recents.events.activity.DebugFlagsChangedEvent;
+import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
+import com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent;
import com.android.systemui.recents.events.activity.HideHistoryEvent;
import com.android.systemui.recents.events.activity.HideRecentsEvent;
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
-import com.android.systemui.recents.events.ui.DismissTaskEvent;
-import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
+import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent;
import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
import com.android.systemui.recents.events.ui.UpdateFreeformTaskViewVisibilityEvent;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.RecentsView;
import com.android.systemui.recents.views.SystemBarScrimViews;
-import com.android.systemui.recents.views.ViewAnimation;
import com.android.systemui.statusbar.BaseStatusBar;
import java.util.ArrayList;
// If we have a focused Task, launch that Task now
if (mRecentsView.launchPreviousTask()) return true;
// If none of the other cases apply, then just go Home
- dismissRecentsToHome(true);
+ dismissRecentsToHome(true /* animateTaskViews */);
}
return false;
}
// If we have a focused Task, launch that Task now
if (mRecentsView.launchFocusedTask()) return true;
// If none of the other cases apply, then just go Home
- dismissRecentsToHome(true);
+ dismissRecentsToHome(true /* animateTaskViews */);
return true;
}
return false;
/**
* Dismisses Recents directly to Home without checking whether it is currently visible.
*/
- void dismissRecentsToHome(boolean animated) {
- if (animated) {
- ReferenceCountedTrigger exitTrigger = new ReferenceCountedTrigger();
- exitTrigger.increment();
- exitTrigger.addLastDecrementRunnable(mFinishLaunchHomeRunnable);
- exitTrigger.addLastDecrementRunnable(new Runnable() {
- @Override
- public void run() {
- Recents.getSystemServices().sendCloseSystemWindows(
- BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
- }
- });
- mRecentsView.startExitToHomeAnimation(
- new ViewAnimation.TaskViewExitContext(exitTrigger));
- exitTrigger.decrement();
- } else {
- mFinishLaunchHomeRunnable.run();
- Recents.getSystemServices().sendCloseSystemWindows(
- BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
- }
- }
-
- /** Dismisses Recents directly to Home without transition animation. */
- void dismissRecentsToHomeWithoutTransitionAnimation() {
- finish();
- overridePendingTransition(0, 0);
+ void dismissRecentsToHome(boolean animateTaskViews) {
+ DismissRecentsToHomeAnimationStarted dismissEvent =
+ new DismissRecentsToHomeAnimationStarted(animateTaskViews);
+ dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
+ dismissEvent.addPostAnimationCallback(new Runnable() {
+ @Override
+ public void run() {
+ Recents.getSystemServices().sendCloseSystemWindows(
+ BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
+ }
+ });
+ EventBus.getDefault().send(dismissEvent);
}
/** Dismisses Recents directly to Home if we currently aren't transitioning. */
if (!dismissHistory()) {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
if (launchState.launchedFromHome) {
- dismissRecentsToHome(true);
+ dismissRecentsToHome(true /* animateTaskViews */);
} else {
dismissRecentsToLaunchTargetTaskOrHome();
}
hideEvent.addPostAnimationCallback(new Runnable() {
@Override
public void run() {
- dismissRecentsToHome(true /* animated */);
+ dismissRecentsToHome(true /* animateTaskViews */);
}
});
EventBus.getDefault().send(hideEvent);
} else {
- dismissRecentsToHome(true /* animated */);
+ dismissRecentsToHome(true /* animateTaskViews */);
}
} else {
// Do nothing
public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
// Try and start the enter animation (or restart it on configuration changed)
- ReferenceCountedTrigger t = new ReferenceCountedTrigger();
- ViewAnimation.TaskViewEnterContext ctx = new ViewAnimation.TaskViewEnterContext(t);
- ctx.postAnimationTrigger.increment();
if (RecentsDebugFlags.Static.EnableSearchBar) {
if (mSearchWidgetInfo != null) {
- ctx.postAnimationTrigger.addLastDecrementRunnable(new Runnable() {
+ event.addPostAnimationCallback(new Runnable() {
@Override
public void run() {
// Start listening for widget package changes if there is one bound
});
}
}
- mRecentsView.startEnterRecentsAnimation(ctx);
- ctx.postAnimationTrigger.decrement();
}
public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) {
MetricsLogger.count(this, "overview_app_info", 1);
}
- public final void onBusEvent(DismissTaskEvent event) {
+ public final void onBusEvent(DeleteTaskDataEvent event) {
// Remove any stored data from the loader
RecentsTaskLoader loader = Recents.getTaskLoader();
loader.deleteTaskData(event.task, false);
mRecentsView.showEmptyView();
} else {
// Just go straight home (no animation necessary because there are no more task views)
- dismissRecentsToHome(false /* animated */);
+ dismissRecentsToHome(false /* animateTaskViews */);
}
// Keep track of all-deletions
public final void onBusEvent(LaunchTaskFailedEvent event) {
// Return to Home
- dismissRecentsToHome(true);
+ dismissRecentsToHome(true /* animateTaskViews */);
MetricsLogger.count(this, "overview_task_launch_failed", 1);
}
/**
* This is sent when the task animation when dismissing Recents starts.
*/
-public class DismissRecentsToHomeAnimationStarted extends EventBus.Event {
- // Simple event
+public class DismissRecentsToHomeAnimationStarted extends EventBus.AnimatedEvent {
+
+ public final boolean animated;
+
+ public DismissRecentsToHomeAnimationStarted(boolean animated) {
+ this.animated = animated;
+ }
+
}
* we can start in-app animations so that they don't conflict with the window transition into
* Recents.
*/
-public class EnterRecentsWindowAnimationCompletedEvent extends EventBus.Event {
+public class EnterRecentsWindowAnimationCompletedEvent extends EventBus.AnimatedEvent {
// Simple event
}
* limitations under the License.
*/
-package com.android.systemui.recents;
+package com.android.systemui.recents.events.activity;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.views.TaskView;
/**
- * This is sent to launch a task from Recents.
+ * This event is sent to request that a particular task is launched.
*/
public class LaunchTaskEvent extends EventBus.Event {
--- /dev/null
+/*
+ * Copyright (C) 2015 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.systemui.recents.events.activity;
+
+import com.android.systemui.recents.events.EventBus;
+import com.android.systemui.recents.views.TaskView;
+
+/**
+ * This event is sent following {@link LaunchTaskEvent} after the call to the system is made to
+ * start the task.
+ */
+public class LaunchTaskStartedEvent extends EventBus.AnimatedEvent {
+
+ public final TaskView taskView;
+ public final boolean screenPinningRequested;
+
+ public LaunchTaskStartedEvent(TaskView taskView, boolean screenPinningRequested) {
+ this.taskView = taskView;
+ this.screenPinningRequested = screenPinningRequested;
+ }
+
+}
import com.android.systemui.recents.views.TaskView;
/**
- * This is sent when a {@link Task} has been dismissed.
+ * This is sent when the data associated with a given {@link Task} should be deleted from the
+ * system.
*/
-public class DismissTaskEvent extends EventBus.Event {
+public class DeleteTaskDataEvent extends EventBus.Event {
public final Task task;
- public DismissTaskEvent(Task task) {
+ public DeleteTaskDataEvent(Task task) {
this.task = task;
}
}
import com.android.systemui.recents.views.TaskView;
/**
- * This is sent when a {@link TaskView} has been dismissed.
+ * This event is sent to request that the given {@link TaskView} is dismissed.
*/
-public class DismissTaskViewEvent extends EventBus.Event {
+public class DismissTaskViewEvent extends EventBus.AnimatedEvent {
- public final Task task;
public final TaskView taskView;
+ public final Task task;
- public DismissTaskViewEvent(Task task, TaskView taskView) {
- this.task = task;
+ public DismissTaskViewEvent(TaskView taskView, Task task) {
this.taskView = taskView;
+ this.task = task;
}
}
--- /dev/null
+/*
+ * Copyright (C) 2015 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.systemui.recents.events.ui;
+
+import com.android.systemui.recents.events.EventBus;
+import com.android.systemui.recents.model.Task;
+import com.android.systemui.recents.views.TaskView;
+
+/**
+ * This event is sent when a {@link TaskView} has been dismissed and is no longer visible.
+ */
+public class TaskViewDismissedEvent extends EventBus.Event {
+
+ public final Task task;
+ public final TaskView taskView;
+
+ public TaskViewDismissedEvent(Task task, TaskView taskView) {
+ this.task = task;
+ this.taskView = taskView;
+ }
+}
package com.android.systemui.recents.events.ui.focus;
import com.android.systemui.recents.events.EventBus;
+import com.android.systemui.recents.views.TaskView;
/**
- * Dismisses the currently focused task view.
+ * This event is sent to request that the currently focused {@link TaskView} is dismissed.
*/
public class DismissFocusedTaskViewEvent extends EventBus.Event {
// Simple event
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.recents.Constants;
import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.ui.DismissTaskEvent;
+import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
/**
RecentsHistoryAdapter.TaskRow taskRow = (RecentsHistoryAdapter.TaskRow) row;
// Remove the task from the system
- EventBus.getDefault().send(new DismissTaskEvent(taskRow.task));
+ EventBus.getDefault().send(new DeleteTaskDataEvent(taskRow.task));
mAdapter.onTaskRemoved(taskRow.task, position);
// Keep track of deletions by swiping within history
public class ReferenceCountedTrigger {
int mCount;
- ArrayList<Runnable> mFirstIncRunnables = new ArrayList<Runnable>();
- ArrayList<Runnable> mLastDecRunnables = new ArrayList<Runnable>();
+ ArrayList<Runnable> mFirstIncRunnables = new ArrayList<>();
+ ArrayList<Runnable> mLastDecRunnables = new ArrayList<>();
Runnable mErrorRunnable;
// Convenience runnables
*/
public class FreeformWorkspaceLayoutAlgorithm {
- private static final String TAG = "FreeformWorkspaceLayoutAlgorithm";
- private static final boolean DEBUG = false;
-
// Optimization, allows for quick lookup of task -> rect
private HashMap<Task.TaskKey, RectF> mTaskRectMap = new HashMap<>();
transformOut.rect.offset(stackLayout.mFreeformRect.left, stackLayout.mFreeformRect.top);
transformOut.visible = true;
transformOut.p = 1f;
-
- if (DEBUG) {
- Log.d(TAG, "getTransform: " + task.key + ", " + transformOut);
- }
return transformOut;
}
return null;
import android.view.IAppTransitionAnimationSpecsFuture;
import android.view.WindowManagerGlobal;
import com.android.internal.annotations.GuardedBy;
-import com.android.systemui.recents.ExitRecentsWindowFirstAnimationFrameEvent;
+import com.android.systemui.recents.events.activity.ExitRecentsWindowFirstAnimationFrameEvent;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsDebugFlags;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
+import com.android.systemui.recents.events.activity.LaunchTaskStartedEvent;
import com.android.systemui.recents.events.activity.LaunchTaskSucceededEvent;
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
-import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
+import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
*/
public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task,
final TaskStackView stackView, final TaskView taskView,
- final boolean lockToTask, final Rect bounds, int destinationStack) {
+ final boolean screenPinningRequested, final Rect bounds, int destinationStack) {
final ActivityOptions opts = ActivityOptions.makeBasic();
if (bounds != null) {
opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
- if (lockToTask) {
+ if (screenPinningRequested) {
// Request screen pinning after the animation runs
mHandler.postDelayed(mStartScreenPinningRunnable, 350);
}
// task views, and we can launch immediately
startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
} else {
+ LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView,
+ screenPinningRequested);
if (task.group != null && !task.group.isFrontMostTask(task)) {
- stackView.startLaunchTaskAnimation(taskView, new Runnable() {
+ launchStartedEvent.addPostAnimationCallback(new Runnable() {
@Override
public void run() {
startTaskActivity(stack, task, taskView, opts, transitionFuture,
animStartedListener);
}
- }, lockToTask);
+ });
+ EventBus.getDefault().send(launchStartedEvent);
} else {
- stackView.startLaunchTaskAnimation(taskView, null, lockToTask);
+ EventBus.getDefault().send(launchStartedEvent);
startTaskActivity(stack, task, taskView, opts, transitionFuture,
animStartedListener);
}
EventBus.getDefault().send(new LaunchTaskSucceededEvent(taskIndexFromFront));
} else {
// Dismiss the task if we fail to launch it
- EventBus.getDefault().send(new DismissTaskViewEvent(task, taskView));
+ taskView.dismissTask();
// Keep track of failed launches
EventBus.getDefault().send(new LaunchTaskFailedEvent());
return false;
}
- /** Requests all task stacks to start their enter-recents animation */
- public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx) {
- // We have to increment/decrement the post animation trigger in case there are no children
- // to ensure that it runs
- ctx.postAnimationTrigger.increment();
- if (mTaskStackView != null) {
- mTaskStackView.startEnterRecentsAnimation(ctx);
- }
- ctx.postAnimationTrigger.decrement();
- }
-
- /** Requests all task stacks to start their exit-recents animation */
- public void startExitToHomeAnimation(ViewAnimation.TaskViewExitContext ctx) {
- // We have to increment/decrement the post animation trigger in case there are no children
- // to ensure that it runs
- ctx.postAnimationTrigger.increment();
- if (mTaskStackView != null) {
- mTaskStackView.startExitToHomeAnimation(ctx);
- }
- ctx.postAnimationTrigger.decrement();
-
- // Hide the history button
- int taskViewExitToHomeDuration = getResources().getInteger(
- R.integer.recents_task_exit_to_home_duration);
- hideHistoryButton(taskViewExitToHomeDuration);
-
- // If we are going home, cancel the previous task's window transition
- EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(null));
-
- // Notify sof the exit animation
- EventBus.getDefault().send(new DismissRecentsToHomeAnimationStarted());
- }
-
/** Adds the search bar */
public void setSearchBar(RecentsAppWidgetHostView searchBar) {
// Remove the previous search bar if one exists
event.screenPinningRequested, event.targetTaskBounds, event.targetTaskStack);
}
+ public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
+ // Hide the history button
+ int taskViewExitToHomeDuration = getResources().getInteger(
+ R.integer.recents_task_exit_to_home_duration);
+ hideHistoryButton(taskViewExitToHomeDuration);
+
+ // If we are going home, cancel the previous task's window transition
+ EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(null));
+ }
+
public final void onBusEvent(DragStartEvent event) {
updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(),
TaskStack.DockState.NONE.viewState.dockAreaAlpha);
*/
public class TaskStackLayoutAlgorithm {
- private static final String TAG = "TaskStackViewLayoutAlgorithm";
- private static final boolean DEBUG = false;
-
// The scale factor to apply to the user movement in the stack to unfocus it
private static final float UNFOCUS_MULTIPLIER = 0.8f;
* allocate to the freeform workspace
* @param freeformBackgroundAlpha the background alpha for the freeform workspace
*/
- StackState(float freeformHeightPct, int freeformBackgroundAlpha) {
+ private StackState(float freeformHeightPct, int freeformBackgroundAlpha) {
this.freeformHeightPct = freeformHeightPct;
this.freeformBackgroundAlpha = freeformBackgroundAlpha;
}
mUnfocusedCurveInterpolator = new FreePathInterpolator(mUnfocusedCurve);
mFocusedCurve = constructFocusedCurve();
mFocusedCurveInterpolator = new FreePathInterpolator(mFocusedCurve);
-
- if (DEBUG) {
- Log.d(TAG, "initialize");
- Log.d(TAG, "\tmFreeformRect: " + mFreeformRect);
- Log.d(TAG, "\tmStackRect: " + mStackRect);
- Log.d(TAG, "\tmTaskRect: " + mTaskRect);
- Log.d(TAG, "\tmSystemInsets: " + mSystemInsets);
- }
}
/**
mInitialScrollP = (mNumStackTasks - 1) - mUnfocusedRange.getAbsoluteX(normX);
}
}
-
- if (DEBUG) {
- Log.d(TAG, "mNumStackTasks: " + mNumStackTasks);
- Log.d(TAG, "mNumFreeformTasks: " + mNumFreeformTasks);
- Log.d(TAG, "mMinScrollP: " + mMinScrollP);
- Log.d(TAG, "mMaxScrollP: " + mMaxScrollP);
- }
}
/**
if (task.thumbnail != null) {
transformOut.thumbnailScale = (float) mTaskRect.width() / task.thumbnail.getWidth();
}
- if (DEBUG) {
- Log.d(TAG, "getTransform: " + task.key + ", " + transformOut);
- }
return transformOut;
}
}
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
+import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
import com.android.systemui.recents.events.activity.HideHistoryButtonEvent;
import com.android.systemui.recents.events.activity.HideHistoryEvent;
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
import com.android.systemui.recents.events.activity.LaunchTaskEvent;
+import com.android.systemui.recents.events.activity.LaunchTaskStartedEvent;
import com.android.systemui.recents.events.activity.PackagesChangedEvent;
import com.android.systemui.recents.events.activity.ShowHistoryButtonEvent;
import com.android.systemui.recents.events.activity.ShowHistoryEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
-import com.android.systemui.recents.events.ui.DismissTaskEvent;
+import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
+import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
import com.android.systemui.recents.events.ui.UpdateFreeformTaskViewVisibilityEvent;
import com.android.systemui.recents.events.ui.UserInteractionEvent;
import com.android.systemui.recents.events.ui.dragndrop.DragDropTargetChangedEvent;
boolean mStackViewsClipDirty = true;
boolean mAwaitingFirstLayout = true;
boolean mEnterAnimationComplete = false;
- boolean mStartEnterAnimationRequestedAfterLayout;
- ViewAnimation.TaskViewEnterContext mStartEnterAnimationContext;
Rect mTaskStackBounds = new Rect();
int[] mTmpVisibleRange = new int[2];
// Find the next view to clip against
for (int j = i + 1; j < taskViewCount; j++) {
tmpTv = taskViews.get(j);
+
if (tmpTv.shouldClipViewInStack()) {
frontTv = tmpTv;
break;
tv.prepareEnterRecentsAnimation(hideTask, occludesLaunchTarget, offscreenY);
}
- // If the enter animation started already and we haven't completed a layout yet, do the
- // enter animation now
- if (mStartEnterAnimationRequestedAfterLayout) {
- startEnterRecentsAnimation(mStartEnterAnimationContext);
- mStartEnterAnimationRequestedAfterLayout = false;
- mStartEnterAnimationContext = null;
- }
-
// Animate in the freeform workspace
animateFreeformWorkspaceBackgroundAlpha(
mLayoutAlgorithm.getStackState().freeformBackgroundAlpha, 150,
} else {
EventBus.getDefault().send(new HideHistoryButtonEvent());
}
-
- // Start dozing
- mUIDozeTrigger.startDozing();
}
/** Requests this task stacks to start it's enter-recents animation */
public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx) {
- // If we are still waiting to layout, then just defer until then
- if (mAwaitingFirstLayout) {
- mStartEnterAnimationRequestedAfterLayout = true;
- mStartEnterAnimationContext = ctx;
- return;
- }
-
if (mStack.getStackTaskCount() > 0) {
// Find the launch target task
Task launchTargetTask = mStack.getLaunchTarget();
mUIDozeTrigger.stopDozing();
}
- public final void onBusEvent(DismissTaskViewEvent event) {
- removeTaskViewFromStack(event.taskView);
- EventBus.getDefault().send(new DismissTaskEvent(event.task));
+ public final void onBusEvent(LaunchTaskStartedEvent event) {
+ event.getAnimationTrigger().increment();
+ startLaunchTaskAnimation(event.taskView, event.getAnimationTrigger().decrementAsRunnable(),
+ event.screenPinningRequested);
}
- public final void onBusEvent(FocusNextTaskViewEvent event) {
- setRelativeFocusedTask(true, false /* stackTasksOnly */, true /* animated */);
- }
+ public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
+ // Stop any scrolling
+ mStackScroller.stopScroller();
+ mStackScroller.stopBoundScrollAnimation();
- public final void onBusEvent(FocusPreviousTaskViewEvent event) {
- setRelativeFocusedTask(false, false /* stackTasksOnly */, true /* animated */);
+ // Start the task animations
+ ViewAnimation.TaskViewExitContext context = new ViewAnimation.TaskViewExitContext(
+ event.getAnimationTrigger());
+ startExitToHomeAnimation(context);
+
+ // Dismiss the freeform workspace background
+ int taskViewExitToHomeDuration = getResources().getInteger(
+ R.integer.recents_task_exit_to_home_duration);
+ animateFreeformWorkspaceBackgroundAlpha(0, taskViewExitToHomeDuration,
+ mFastOutSlowInInterpolator);
}
public final void onBusEvent(DismissFocusedTaskViewEvent event) {
}
}
+ public final void onBusEvent(final DismissTaskViewEvent event) {
+ // For visible children, defer removing the task until after the animation
+ event.getAnimationTrigger().increment();
+ event.taskView.startDeleteTaskAnimation(
+ event.getAnimationTrigger().decrementAsRunnable(), 0);
+ }
+
+ public final void onBusEvent(TaskViewDismissedEvent event) {
+ removeTaskViewFromStack(event.taskView);
+ EventBus.getDefault().send(new DeleteTaskDataEvent(event.task));
+ }
+
+ public final void onBusEvent(FocusNextTaskViewEvent event) {
+ setRelativeFocusedTask(true, false /* stackTasksOnly */, true /* animated */);
+ }
+
+ public final void onBusEvent(FocusPreviousTaskViewEvent event) {
+ setRelativeFocusedTask(false, false /* stackTasksOnly */, true /* animated */);
+ }
+
public final void onBusEvent(UserInteractionEvent event) {
// Poke the doze trigger on user interaction
mUIDozeTrigger.poke();
public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
mEnterAnimationComplete = true;
+
+ if (mStack.getStackTaskCount() > 0) {
+ // Start the task enter animations
+ ViewAnimation.TaskViewEnterContext context = new ViewAnimation.TaskViewEnterContext(
+ event.getAnimationTrigger());
+ startEnterRecentsAnimation(context);
+
+ // Add a runnable to the post animation ref counter to clear all the views
+ event.addPostAnimationCallback(new Runnable() {
+ @Override
+ public void run() {
+ // Start the dozer to trigger to trigger any UI that shows after a timeout
+ mUIDozeTrigger.startDozing();
+
+ // Update the focused state here -- since we only set the focused task without
+ // requesting view focus in onFirstLayout(), actually request view focus and
+ // animate the focused state if we are alt-tabbing now, after the window enter
+ // animation is completed
+ if (mFocusedTask != null) {
+ RecentsConfiguration config = Recents.getConfiguration();
+ RecentsActivityLaunchState launchState = config.getLaunchState();
+ setFocusedTask(mStack.indexOfStackTask(mFocusedTask),
+ false /* scrollToTask */, launchState.launchedWithAltTab);
+ }
+ }
+ });
+ }
}
public final void onBusEvent(UpdateFreeformTaskViewVisibilityEvent event) {
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.HideRecentsEvent;
-import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
+import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.misc.Utilities;
// Re-enable touch events from this task view
tv.setTouchEnabled(true);
// Remove the task view from the stack
- EventBus.getDefault().send(new DismissTaskViewEvent(tv.getTask(), tv));
+ EventBus.getDefault().send(new TaskViewDismissedEvent(tv.getTask(), tv));
// Keep track of deletions by keyboard
MetricsLogger.histogram(tv.getContext(), "overview_task_dismissed_source",
Constants.Metrics.DismissSourceSwipeGesture);
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.LaunchTaskEvent;
import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
+import com.android.systemui.recents.events.ui.TaskViewDismissedEvent;
import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
void dismissTask() {
// Animate out the view and call the callback
final TaskView tv = this;
- startDeleteTaskAnimation(new Runnable() {
+ DismissTaskViewEvent dismissEvent = new DismissTaskViewEvent(tv, mTask);
+ dismissEvent.addPostAnimationCallback(new Runnable() {
@Override
public void run() {
- EventBus.getDefault().send(new DismissTaskViewEvent(mTask, tv));
+ EventBus.getDefault().send(new TaskViewDismissedEvent(mTask, tv));
}
- }, 0);
+ });
+ EventBus.getDefault().send(dismissEvent);
}
/**