Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +8 −10 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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)); Loading Loading @@ -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) { Loading packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; Loading packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -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); Loading packages/SystemUI/src/com/android/systemui/recents/events/ui/UpdateFreeformTaskViewVisibilityEvent.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * 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; } } packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +28 −10 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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); } Loading Loading @@ -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()); } Loading Loading @@ -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; } } } Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +8 −10 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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)); Loading Loading @@ -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) { Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +1 −1 Original line number Diff line number Diff line Loading @@ -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; Loading
packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -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); Loading
packages/SystemUI/src/com/android/systemui/recents/events/ui/UpdateFreeformTaskViewVisibilityEvent.java 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * 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; } }
packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +28 −10 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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); } Loading Loading @@ -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()); } Loading Loading @@ -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; } } }