Making stack visibility more specific to the launching tasks.
- When going from freeform -> overview, hide all freeform tasks until the final frame of the enter transition, if the stack we are launching to/from is in the freeform stack - When going from overview -> freeform, hide all freeform tasks after the first frame of the exit transition, if we are launching a task in the freeform stack - Separate the dragging gesture from the freeform launch visibility Bug: 25842568 Change-Id: Ibcd17a02eeb70244ac73f599b8c23c71d22f73fd
This commit is contained in:
@@ -43,9 +43,9 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.recents.events.EventBus;
|
||||
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.EnterRecentsWindowAnimationCompletedEvent;
|
||||
import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
|
||||
import com.android.systemui.recents.events.activity.DebugFlagsChangedEvent;
|
||||
import com.android.systemui.recents.events.activity.HideRecentsEvent;
|
||||
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
|
||||
import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
|
||||
@@ -58,6 +58,7 @@ import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
|
||||
import com.android.systemui.recents.events.ui.ResizeTaskEvent;
|
||||
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.events.ui.UserInteractionEvent;
|
||||
import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
|
||||
import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
|
||||
@@ -401,13 +402,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
mRecentsView.disableLayersForOneFrame();
|
||||
}
|
||||
|
||||
if (launchState.startHidden) {
|
||||
launchState.startHidden = false;
|
||||
mRecentsView.setStackViewVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
mRecentsView.setStackViewVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
// Notify that recents is now visible
|
||||
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||
EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, ssp, true));
|
||||
@@ -630,13 +624,17 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
}
|
||||
|
||||
public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) {
|
||||
mRecentsView.setStackViewVisibility(View.VISIBLE);
|
||||
EventBus.getDefault().send(new UpdateFreeformTaskViewVisibilityEvent(true));
|
||||
mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
|
||||
mRecentsView.invalidate();
|
||||
}
|
||||
|
||||
public final void onBusEvent(ExitRecentsWindowFirstAnimationFrameEvent event) {
|
||||
mRecentsView.setStackViewVisibility(View.INVISIBLE);
|
||||
if (mRecentsView.isLastTaskLaunchedFreeform()) {
|
||||
EventBus.getDefault().send(new UpdateFreeformTaskViewVisibilityEvent(false));
|
||||
}
|
||||
mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
|
||||
mRecentsView.invalidate();
|
||||
}
|
||||
|
||||
public final void onBusEvent(CancelEnterRecentsWindowAnimationEvent event) {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class RecentsActivityLaunchState {
|
||||
public boolean launchedFromSearchHome;
|
||||
public boolean launchedReuseTaskStackViews;
|
||||
public boolean launchedHasConfigurationChanged;
|
||||
public boolean startHidden;
|
||||
public boolean launchedViaDragGesture;
|
||||
public int launchedToTaskId;
|
||||
public int launchedNumVisibleTasks;
|
||||
public int launchedNumVisibleThumbnails;
|
||||
|
||||
@@ -881,8 +881,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements
|
||||
launchState.launchedNumVisibleTasks = vr.numVisibleTasks;
|
||||
launchState.launchedNumVisibleThumbnails = vr.numVisibleThumbnails;
|
||||
launchState.launchedHasConfigurationChanged = false;
|
||||
launchState.startHidden = topTask != null && topTask.stackId == FREEFORM_WORKSPACE_STACK_ID
|
||||
|| mDraggingInRecents;
|
||||
launchState.launchedViaDragGesture = mDraggingInRecents;
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(RECENTS_PACKAGE, RECENTS_ACTIVITY);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* This is sent to update the visibility of all visible freeform task views.
|
||||
*/
|
||||
public class UpdateFreeformTaskViewVisibilityEvent extends EventBus.Event {
|
||||
|
||||
public final boolean visible;
|
||||
|
||||
public UpdateFreeformTaskViewVisibilityEvent(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
}
|
||||
@@ -36,11 +36,13 @@ import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.RecentsActivity;
|
||||
import com.android.systemui.recents.RecentsActivityLaunchState;
|
||||
import com.android.systemui.recents.RecentsAppWidgetHostView;
|
||||
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.component.RecentsVisibilityChangedEvent;
|
||||
import com.android.systemui.recents.events.ui.DraggingInRecentsEndedEvent;
|
||||
import com.android.systemui.recents.events.ui.DraggingInRecentsEvent;
|
||||
import com.android.systemui.recents.events.ui.dragndrop.DragDropTargetChangedEvent;
|
||||
@@ -64,14 +66,13 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
private static final String TAG = "RecentsView";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private int mStackViewVisibility = View.VISIBLE;
|
||||
|
||||
LayoutInflater mInflater;
|
||||
Handler mHandler;
|
||||
|
||||
ArrayList<TaskStack> mStacks;
|
||||
TaskStackView mTaskStackView;
|
||||
RecentsAppWidgetHostView mSearchBar;
|
||||
boolean mAwaitingFirstLayout = true;
|
||||
boolean mLastTaskLaunchedWasFreeform;
|
||||
|
||||
RecentsTransitionHelper mTransitionHelper;
|
||||
RecentsViewTouchHandler mTouchHandler;
|
||||
@@ -131,12 +132,18 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
mTaskStackView.setCallbacks(this);
|
||||
addView(mTaskStackView);
|
||||
}
|
||||
mTaskStackView.setVisibility(mStackViewVisibility);
|
||||
|
||||
// Trigger a new layout
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the last task launched was in the freeform stack or not.
|
||||
*/
|
||||
public boolean isLastTaskLaunchedFreeform() {
|
||||
return mLastTaskLaunchedWasFreeform;
|
||||
}
|
||||
|
||||
/** Gets the next task in the stack - or if the last - the top task */
|
||||
public Task getNextTaskOrTopTask(Task taskToSearch) {
|
||||
Task returnTask = null;
|
||||
@@ -325,6 +332,17 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
mDragView.layout(left, top, left + mDragView.getMeasuredWidth(),
|
||||
top + mDragView.getMeasuredHeight());
|
||||
}
|
||||
|
||||
if (mAwaitingFirstLayout) {
|
||||
mAwaitingFirstLayout = false;
|
||||
|
||||
// If launched via dragging from the nav bar, then we should translate the whole view
|
||||
// down offscreen
|
||||
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
|
||||
if (launchState.launchedViaDragGesture) {
|
||||
setTranslationY(getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -378,6 +396,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
public void onTaskViewClicked(final TaskStackView stackView, final TaskView tv,
|
||||
final TaskStack stack, final Task task, final boolean lockToTask,
|
||||
final Rect bounds, int destinationStack) {
|
||||
mLastTaskLaunchedWasFreeform = SystemServicesProxy.isFreeformStack(task.key.stackId);
|
||||
mTransitionHelper.launchTaskFromRecents(stack, task, stackView, tv, lockToTask, bounds,
|
||||
destinationStack);
|
||||
}
|
||||
@@ -467,7 +486,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
}
|
||||
|
||||
public final void onBusEvent(DraggingInRecentsEvent event) {
|
||||
setStackViewVisibility(View.VISIBLE);
|
||||
setTranslationY(event.distanceFromTop - mTaskStackView.getTaskViews().get(0).getY());
|
||||
}
|
||||
|
||||
@@ -501,11 +519,11 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
}
|
||||
}
|
||||
|
||||
public void setStackViewVisibility(int stackViewVisibility) {
|
||||
mStackViewVisibility = stackViewVisibility;
|
||||
if (mTaskStackView != null) {
|
||||
mTaskStackView.setVisibility(stackViewVisibility);
|
||||
invalidate();
|
||||
public final void onBusEvent(RecentsVisibilityChangedEvent event) {
|
||||
if (!event.visible) {
|
||||
// Reset the view state
|
||||
mAwaitingFirstLayout = true;
|
||||
mLastTaskLaunchedWasFreeform = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.android.systemui.recents.events.component.RecentsVisibilityChangedEve
|
||||
import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
|
||||
import com.android.systemui.recents.events.ui.DismissTaskViewEvent;
|
||||
import com.android.systemui.recents.events.ui.StackViewScrolledEvent;
|
||||
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;
|
||||
import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
|
||||
@@ -298,6 +299,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
}
|
||||
mStackScroller.reset();
|
||||
mLayoutAlgorithm.reset();
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
/** Requests that the views be synchronized with the model */
|
||||
@@ -985,9 +987,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
for (int i = taskViewCount - 1; i >= 0; i--) {
|
||||
TaskView tv = taskViews.get(i);
|
||||
Task task = tv.getTask();
|
||||
boolean occludesLaunchTarget = (launchTargetTask != null) &&
|
||||
launchTargetTask.group.isTaskAboveTask(task, launchTargetTask);
|
||||
tv.prepareEnterRecentsAnimation(task.isLaunchTarget, occludesLaunchTarget,
|
||||
boolean hideTask = false;
|
||||
boolean occludesLaunchTarget = false;
|
||||
if (launchTargetTask != null) {
|
||||
occludesLaunchTarget = launchTargetTask.group.isTaskAboveTask(task,
|
||||
launchTargetTask);
|
||||
hideTask = SystemServicesProxy.isFreeformStack(launchTargetTask.key.stackId) &&
|
||||
SystemServicesProxy.isFreeformStack(task.key.stackId);
|
||||
}
|
||||
tv.prepareEnterRecentsAnimation(task.isLaunchTarget, hideTask, occludesLaunchTarget,
|
||||
offscreenY);
|
||||
}
|
||||
|
||||
@@ -1468,6 +1476,18 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
mEnterAnimationComplete = true;
|
||||
}
|
||||
|
||||
public final void onBusEvent(UpdateFreeformTaskViewVisibilityEvent event) {
|
||||
List<TaskView> taskViews = getTaskViews();
|
||||
int taskViewCount = taskViews.size();
|
||||
for (int i = 0; i < taskViewCount; i++) {
|
||||
TaskView tv = taskViews.get(i);
|
||||
Task task = tv.getTask();
|
||||
if (SystemServicesProxy.isFreeformStack(task.key.stackId)) {
|
||||
tv.setVisibility(event.visible ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the task from the stack, and updates the focus to the next task in the stack if the
|
||||
* removed TaskView was focused.
|
||||
|
||||
@@ -153,7 +153,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
}
|
||||
|
||||
/** Gets the task */
|
||||
Task getTask() {
|
||||
public Task getTask() {
|
||||
return mTask;
|
||||
}
|
||||
|
||||
@@ -251,6 +251,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
mActionButtonView.setAlpha(1f);
|
||||
mActionButtonView.setTranslationZ(mActionButtonTranslationZ);
|
||||
}
|
||||
setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,12 +276,14 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
|
||||
/** Prepares this task view for the enter-recents animations. This is called earlier in the
|
||||
* first layout because the actual animation into recents may take a long time. */
|
||||
void prepareEnterRecentsAnimation(boolean isTaskViewLaunchTargetTask,
|
||||
boolean occludesLaunchTarget, int offscreenY) {
|
||||
void prepareEnterRecentsAnimation(boolean isTaskViewLaunchTargetTask, boolean hideTask,
|
||||
boolean occludesLaunchTarget, int offscreenY) {
|
||||
RecentsConfiguration config = Recents.getConfiguration();
|
||||
RecentsActivityLaunchState launchState = config.getLaunchState();
|
||||
int initialDim = getDim();
|
||||
if (launchState.launchedHasConfigurationChanged) {
|
||||
if (hideTask) {
|
||||
setVisibility(View.INVISIBLE);
|
||||
} else if (launchState.launchedHasConfigurationChanged) {
|
||||
// Just load the views as-is
|
||||
} else if (launchState.launchedFromAppWithThumbnail) {
|
||||
if (isTaskViewLaunchTargetTask) {
|
||||
|
||||
Reference in New Issue
Block a user