Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.systemui.recents.views; |
| 18 | |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 19 | import static android.app.ActivityManager.INVALID_STACK_ID; |
| 20 | |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 21 | import android.app.ActivityManager; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 22 | import android.app.ActivityOptions; |
| 23 | import android.content.Context; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 24 | import android.graphics.Bitmap; |
| 25 | import android.graphics.Canvas; |
| 26 | import android.graphics.Rect; |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 27 | import android.graphics.drawable.Drawable; |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 28 | import android.os.Bundle; |
| 29 | import android.os.IRemoteCallback; |
| 30 | import android.os.RemoteException; |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 31 | import android.util.ArraySet; |
Winson Chung | 8e548f7 | 2014-06-24 14:40:53 -0700 | [diff] [blame] | 32 | import android.util.AttributeSet; |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 33 | import android.util.Log; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 34 | import android.util.SparseArray; |
| 35 | import android.view.AppTransitionAnimationSpec; |
Winson Chung | ecd9b30 | 2014-04-16 17:07:18 -0700 | [diff] [blame] | 36 | import android.view.LayoutInflater; |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 37 | import android.view.MotionEvent; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 38 | import android.view.View; |
Winson Chung | 653f70c2 | 2014-05-19 14:49:42 -0700 | [diff] [blame] | 39 | import android.view.WindowInsets; |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 40 | import android.view.WindowManagerGlobal; |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 41 | import android.view.animation.AnimationUtils; |
| 42 | import android.view.animation.Interpolator; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 43 | import android.widget.FrameLayout; |
Winson Chung | 5c9f4b9 | 2015-06-25 16:16:46 -0700 | [diff] [blame] | 44 | import com.android.internal.logging.MetricsLogger; |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 45 | import com.android.systemui.R; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 46 | import com.android.systemui.recents.Constants; |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 47 | import com.android.systemui.recents.RecentsActivity; |
Winson Chung | aee097c | 2015-04-02 18:16:02 -0700 | [diff] [blame] | 48 | import com.android.systemui.recents.RecentsAppWidgetHostView; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 49 | import com.android.systemui.recents.RecentsConfiguration; |
Winson | 2536c7e | 2015-10-01 15:49:31 -0700 | [diff] [blame] | 50 | import com.android.systemui.recents.events.EventBus; |
| 51 | import com.android.systemui.recents.events.ui.DismissTaskEvent; |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 52 | import com.android.systemui.recents.events.ui.dragndrop.DragDockStateChangedEvent; |
| 53 | import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent; |
| 54 | import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent; |
Winson Chung | 1f24c7e | 2014-07-11 17:06:48 -0700 | [diff] [blame] | 55 | import com.android.systemui.recents.misc.SystemServicesProxy; |
Winson Chung | f1fbd77 | 2014-06-24 18:06:58 -0700 | [diff] [blame] | 56 | import com.android.systemui.recents.model.RecentsTaskLoader; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 57 | import com.android.systemui.recents.model.Task; |
| 58 | import com.android.systemui.recents.model.TaskStack; |
| 59 | |
| 60 | import java.util.ArrayList; |
Winson Chung | 6ac8bd6 | 2015-01-07 16:38:35 -0800 | [diff] [blame] | 61 | import java.util.List; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 62 | |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 63 | /** |
| 64 | * This view is the the top level layout that contains TaskStacks (which are laid out according |
| 65 | * to their SpaceNode bounds. |
| 66 | */ |
Winson | e6c9073 | 2015-09-24 16:06:29 -0700 | [diff] [blame] | 67 | public class RecentsView extends FrameLayout implements TaskStackView.TaskStackViewCallbacks { |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 68 | |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 69 | private static final String TAG = "RecentsView"; |
| 70 | |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 71 | private static final boolean ADD_HEADER_BITMAP = true; |
| 72 | |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 73 | /** The RecentsView callbacks */ |
| 74 | public interface RecentsViewCallbacks { |
Winson Chung | 7aceb9a | 2014-07-03 13:38:01 -0700 | [diff] [blame] | 75 | public void onTaskViewClicked(); |
Winson Chung | 4e96eb7 | 2014-09-17 15:16:09 +0200 | [diff] [blame] | 76 | public void onTaskLaunchFailed(); |
Winson Chung | 7aceb9a | 2014-07-03 13:38:01 -0700 | [diff] [blame] | 77 | public void onAllTaskViewsDismissed(); |
Winson Chung | cdbbb7e | 2014-06-24 12:11:49 -0700 | [diff] [blame] | 78 | public void onExitToHomeAnimationTriggered(); |
Jason Monk | 18f99d9 | 2014-09-11 13:36:42 -0400 | [diff] [blame] | 79 | public void onScreenPinningRequest(); |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 80 | public void runAfterPause(Runnable r); |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Winson Chung | d42a6cf | 2014-06-03 16:24:04 -0700 | [diff] [blame] | 83 | RecentsConfiguration mConfig; |
| 84 | LayoutInflater mInflater; |
| 85 | |
Winson Chung | dcfa797 | 2014-07-22 12:27:13 -0700 | [diff] [blame] | 86 | ArrayList<TaskStack> mStacks; |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 87 | TaskStackView mTaskStackView; |
Winson Chung | aee097c | 2015-04-02 18:16:02 -0700 | [diff] [blame] | 88 | RecentsAppWidgetHostView mSearchBar; |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 89 | RecentsViewCallbacks mCb; |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 90 | |
| 91 | RecentsViewTouchHandler mTouchHandler; |
| 92 | DragView mDragView; |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 93 | TaskStack.DockState[] mVisibleDockStates = { |
| 94 | TaskStack.DockState.LEFT, |
| 95 | TaskStack.DockState.TOP, |
| 96 | TaskStack.DockState.RIGHT, |
| 97 | TaskStack.DockState.BOTTOM, |
| 98 | }; |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 99 | |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 100 | Interpolator mFastOutSlowInInterpolator; |
| 101 | |
| 102 | Rect mSystemInsets = new Rect(); |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 103 | |
| 104 | public RecentsView(Context context) { |
| 105 | super(context); |
Winson Chung | 8e548f7 | 2014-06-24 14:40:53 -0700 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | public RecentsView(Context context, AttributeSet attrs) { |
| 109 | this(context, attrs, 0); |
| 110 | } |
| 111 | |
| 112 | public RecentsView(Context context, AttributeSet attrs, int defStyleAttr) { |
| 113 | this(context, attrs, defStyleAttr, 0); |
| 114 | } |
| 115 | |
| 116 | public RecentsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { |
| 117 | super(context, attrs, defStyleAttr, defStyleRes); |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 118 | setWillNotDraw(false); |
Winson Chung | d42a6cf | 2014-06-03 16:24:04 -0700 | [diff] [blame] | 119 | mConfig = RecentsConfiguration.getInstance(); |
Winson Chung | ecd9b30 | 2014-04-16 17:07:18 -0700 | [diff] [blame] | 120 | mInflater = LayoutInflater.from(context); |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 121 | mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context, |
| 122 | com.android.internal.R.interpolator.fast_out_slow_in); |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 123 | mTouchHandler = new RecentsViewTouchHandler(this); |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 124 | } |
| 125 | |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 126 | /** Sets the callbacks */ |
| 127 | public void setCallbacks(RecentsViewCallbacks cb) { |
| 128 | mCb = cb; |
| 129 | } |
| 130 | |
Winson Chung | dcfa797 | 2014-07-22 12:27:13 -0700 | [diff] [blame] | 131 | /** Set/get the bsp root node */ |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 132 | public void setTaskStack(TaskStack stack) { |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 133 | if (mConfig.getLaunchState().launchedReuseTaskStackViews) { |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 134 | if (mTaskStackView != null) { |
| 135 | // If onRecentsHidden is not triggered, we need to the stack view again here |
| 136 | mTaskStackView.reset(); |
| 137 | mTaskStackView.setStack(stack); |
| 138 | } else { |
| 139 | mTaskStackView = new TaskStackView(getContext(), stack); |
| 140 | mTaskStackView.setCallbacks(this); |
| 141 | addView(mTaskStackView); |
| 142 | } |
| 143 | } else { |
| 144 | if (mTaskStackView != null) { |
| 145 | removeView(mTaskStackView); |
| 146 | } |
| 147 | mTaskStackView = new TaskStackView(getContext(), stack); |
| 148 | mTaskStackView.setCallbacks(this); |
| 149 | addView(mTaskStackView); |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 150 | } |
Winson Chung | 02d4927 | 2014-08-29 13:57:29 -0700 | [diff] [blame] | 151 | |
Winson Chung | b0a28ea | 2014-10-28 15:21:35 -0700 | [diff] [blame] | 152 | // Trigger a new layout |
| 153 | requestLayout(); |
Winson Chung | 19fc117 | 2014-07-31 18:40:03 -0700 | [diff] [blame] | 154 | } |
| 155 | |
Skuhne | 8aa7d16 | 2015-03-20 13:40:53 -0700 | [diff] [blame] | 156 | /** Gets the next task in the stack - or if the last - the top task */ |
| 157 | public Task getNextTaskOrTopTask(Task taskToSearch) { |
Chong Zhang | 0fa656b | 2015-08-31 15:17:21 -0700 | [diff] [blame] | 158 | Task returnTask = null; |
Skuhne | 8aa7d16 | 2015-03-20 13:40:53 -0700 | [diff] [blame] | 159 | boolean found = false; |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 160 | if (mTaskStackView != null) { |
| 161 | TaskStack stack = mTaskStackView.getStack(); |
Skuhne | 8aa7d16 | 2015-03-20 13:40:53 -0700 | [diff] [blame] | 162 | ArrayList<Task> taskList = stack.getTasks(); |
| 163 | // Iterate the stack views and try and find the focused task |
| 164 | for (int j = taskList.size() - 1; j >= 0; --j) { |
| 165 | Task task = taskList.get(j); |
| 166 | // Return the next task in the line. |
| 167 | if (found) |
| 168 | return task; |
| 169 | // Remember the first possible task as the top task. |
| 170 | if (returnTask == null) |
| 171 | returnTask = task; |
| 172 | if (task == taskToSearch) |
| 173 | found = true; |
| 174 | } |
| 175 | } |
| 176 | return returnTask; |
| 177 | } |
| 178 | |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 179 | /** Launches the focused task from the first stack if possible */ |
| 180 | public boolean launchFocusedTask() { |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 181 | if (mTaskStackView != null) { |
| 182 | TaskStack stack = mTaskStackView.getStack(); |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 183 | // Iterate the stack views and try and find the focused task |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 184 | List<TaskView> taskViews = mTaskStackView.getTaskViews(); |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 185 | int taskViewCount = taskViews.size(); |
| 186 | for (int j = 0; j < taskViewCount; j++) { |
| 187 | TaskView tv = taskViews.get(j); |
| 188 | Task task = tv.getTask(); |
| 189 | if (tv.isFocusedTask()) { |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 190 | onTaskViewClicked(mTaskStackView, tv, stack, task, false, false, null, |
| 191 | INVALID_STACK_ID); |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 192 | return true; |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | } |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 196 | return false; |
| 197 | } |
| 198 | |
Skuhne | 8aa7d16 | 2015-03-20 13:40:53 -0700 | [diff] [blame] | 199 | /** Launches a given task. */ |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 200 | public boolean launchTask(Task task, Rect taskBounds, int destinationStack) { |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 201 | if (mTaskStackView != null) { |
| 202 | TaskStack stack = mTaskStackView.getStack(); |
Skuhne | 8aa7d16 | 2015-03-20 13:40:53 -0700 | [diff] [blame] | 203 | // Iterate the stack views and try and find the given task. |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 204 | List<TaskView> taskViews = mTaskStackView.getTaskViews(); |
Skuhne | 8aa7d16 | 2015-03-20 13:40:53 -0700 | [diff] [blame] | 205 | int taskViewCount = taskViews.size(); |
| 206 | for (int j = 0; j < taskViewCount; j++) { |
| 207 | TaskView tv = taskViews.get(j); |
| 208 | if (tv.getTask() == task) { |
Winson | b1bbaed | 2015-09-23 15:45:11 -0700 | [diff] [blame] | 209 | onTaskViewClicked(mTaskStackView, tv, stack, task, false, taskBounds != null, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 210 | taskBounds, destinationStack); |
Skuhne | 8aa7d16 | 2015-03-20 13:40:53 -0700 | [diff] [blame] | 211 | return true; |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | return false; |
| 216 | } |
| 217 | |
Winson Chung | dcfa797 | 2014-07-22 12:27:13 -0700 | [diff] [blame] | 218 | /** Launches the task that Recents was launched from, if possible */ |
| 219 | public boolean launchPreviousTask() { |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 220 | if (mTaskStackView != null) { |
| 221 | TaskStack stack = mTaskStackView.getStack(); |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 222 | ArrayList<Task> tasks = stack.getTasks(); |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 223 | |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 224 | // Find the launch task in the stack |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 225 | // TODO: replace this with an event from RecentsActivity |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 226 | if (!tasks.isEmpty()) { |
| 227 | int taskCount = tasks.size(); |
| 228 | for (int j = 0; j < taskCount; j++) { |
| 229 | if (tasks.get(j).isLaunchTarget) { |
| 230 | Task task = tasks.get(j); |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 231 | TaskView tv = mTaskStackView.getChildViewForTask(task); |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 232 | onTaskViewClicked(mTaskStackView, tv, stack, task, false, false, null, |
| 233 | INVALID_STACK_ID); |
Winson Chung | d16c565 | 2015-01-26 16:11:07 -0800 | [diff] [blame] | 234 | return true; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 235 | } |
| 236 | } |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 237 | } |
| 238 | } |
| 239 | return false; |
| 240 | } |
| 241 | |
Winson Chung | 24cf152 | 2014-05-29 12:03:33 -0700 | [diff] [blame] | 242 | /** Requests all task stacks to start their enter-recents animation */ |
Winson Chung | 969f586 | 2014-06-16 17:08:24 -0700 | [diff] [blame] | 243 | public void startEnterRecentsAnimation(ViewAnimation.TaskViewEnterContext ctx) { |
Winson Chung | 740c3ac | 2014-11-12 16:14:38 -0800 | [diff] [blame] | 244 | // We have to increment/decrement the post animation trigger in case there are no children |
| 245 | // to ensure that it runs |
| 246 | ctx.postAnimationTrigger.increment(); |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 247 | if (mTaskStackView != null) { |
| 248 | mTaskStackView.startEnterRecentsAnimation(ctx); |
Winson Chung | 24cf152 | 2014-05-29 12:03:33 -0700 | [diff] [blame] | 249 | } |
Winson Chung | 740c3ac | 2014-11-12 16:14:38 -0800 | [diff] [blame] | 250 | ctx.postAnimationTrigger.decrement(); |
Winson Chung | 24cf152 | 2014-05-29 12:03:33 -0700 | [diff] [blame] | 251 | } |
| 252 | |
Winson Chung | d42a6cf | 2014-06-03 16:24:04 -0700 | [diff] [blame] | 253 | /** Requests all task stacks to start their exit-recents animation */ |
Winson Chung | 969f586 | 2014-06-16 17:08:24 -0700 | [diff] [blame] | 254 | public void startExitToHomeAnimation(ViewAnimation.TaskViewExitContext ctx) { |
Winson Chung | a91c293 | 2014-11-07 15:02:38 -0800 | [diff] [blame] | 255 | // We have to increment/decrement the post animation trigger in case there are no children |
| 256 | // to ensure that it runs |
| 257 | ctx.postAnimationTrigger.increment(); |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 258 | if (mTaskStackView != null) { |
| 259 | mTaskStackView.startExitToHomeAnimation(ctx); |
Winson Chung | d42a6cf | 2014-06-03 16:24:04 -0700 | [diff] [blame] | 260 | } |
Winson Chung | a91c293 | 2014-11-07 15:02:38 -0800 | [diff] [blame] | 261 | ctx.postAnimationTrigger.decrement(); |
Winson Chung | d42a6cf | 2014-06-03 16:24:04 -0700 | [diff] [blame] | 262 | |
Winson Chung | 969f586 | 2014-06-16 17:08:24 -0700 | [diff] [blame] | 263 | // Notify of the exit animation |
Winson Chung | cdbbb7e | 2014-06-24 12:11:49 -0700 | [diff] [blame] | 264 | mCb.onExitToHomeAnimationTriggered(); |
Winson Chung | d42a6cf | 2014-06-03 16:24:04 -0700 | [diff] [blame] | 265 | } |
| 266 | |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 267 | /** Adds the search bar */ |
Winson Chung | aee097c | 2015-04-02 18:16:02 -0700 | [diff] [blame] | 268 | public void setSearchBar(RecentsAppWidgetHostView searchBar) { |
Winson Chung | af3bb69 | 2015-06-03 17:31:39 -0700 | [diff] [blame] | 269 | // Remove the previous search bar if one exists |
| 270 | if (mSearchBar != null && indexOfChild(mSearchBar) > -1) { |
| 271 | removeView(mSearchBar); |
| 272 | } |
| 273 | // Add the new search bar |
| 274 | if (searchBar != null) { |
| 275 | mSearchBar = searchBar; |
| 276 | addView(mSearchBar); |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 277 | } |
Winson Chung | ecd9b30 | 2014-04-16 17:07:18 -0700 | [diff] [blame] | 278 | } |
| 279 | |
Winson Chung | 772b6b1 | 2014-07-03 15:54:02 -0700 | [diff] [blame] | 280 | /** Returns whether there is currently a search bar */ |
Winson Chung | aee097c | 2015-04-02 18:16:02 -0700 | [diff] [blame] | 281 | public boolean hasValidSearchBar() { |
| 282 | return mSearchBar != null && !mSearchBar.isReinflateRequired(); |
Winson Chung | 772b6b1 | 2014-07-03 15:54:02 -0700 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | /** Sets the visibility of the search bar */ |
| 286 | public void setSearchBarVisibility(int visibility) { |
| 287 | if (mSearchBar != null) { |
| 288 | mSearchBar.setVisibility(visibility); |
Winson Chung | 012ef36 | 2014-07-31 18:36:25 -0700 | [diff] [blame] | 289 | // Always bring the search bar to the top |
| 290 | mSearchBar.bringToFront(); |
Winson Chung | 772b6b1 | 2014-07-03 15:54:02 -0700 | [diff] [blame] | 291 | } |
| 292 | } |
| 293 | |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 294 | @Override |
| 295 | protected void onAttachedToWindow() { |
| 296 | EventBus.getDefault().register(this, RecentsActivity.EVENT_BUS_PRIORITY + 1); |
| 297 | EventBus.getDefault().register(mTouchHandler, RecentsActivity.EVENT_BUS_PRIORITY + 1); |
| 298 | super.onAttachedToWindow(); |
| 299 | } |
| 300 | |
| 301 | @Override |
| 302 | protected void onDetachedFromWindow() { |
| 303 | super.onDetachedFromWindow(); |
| 304 | EventBus.getDefault().unregister(this); |
| 305 | EventBus.getDefault().unregister(mTouchHandler); |
| 306 | } |
| 307 | |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 308 | /** |
| 309 | * This is called with the full size of the window since we are handling our own insets. |
| 310 | */ |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 311 | @Override |
| 312 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 313 | int width = MeasureSpec.getSize(widthMeasureSpec); |
| 314 | int height = MeasureSpec.getSize(heightMeasureSpec); |
Winson Chung | bd91297 | 2014-03-18 14:36:35 -0700 | [diff] [blame] | 315 | |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 316 | // Get the search bar bounds and measure the search bar layout |
Winson Chung | af3bb69 | 2015-06-03 17:31:39 -0700 | [diff] [blame] | 317 | Rect searchBarSpaceBounds = new Rect(); |
Winson Chung | ecd9b30 | 2014-04-16 17:07:18 -0700 | [diff] [blame] | 318 | if (mSearchBar != null) { |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 319 | mConfig.getSearchBarBounds(new Rect(0, 0, width, height), mSystemInsets.top, |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 320 | searchBarSpaceBounds); |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 321 | mSearchBar.measure( |
| 322 | MeasureSpec.makeMeasureSpec(searchBarSpaceBounds.width(), MeasureSpec.EXACTLY), |
| 323 | MeasureSpec.makeMeasureSpec(searchBarSpaceBounds.height(), MeasureSpec.EXACTLY)); |
Winson Chung | ecd9b30 | 2014-04-16 17:07:18 -0700 | [diff] [blame] | 324 | } |
| 325 | |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 326 | Rect taskStackBounds = new Rect(); |
Winson | 88f00ab | 2015-10-05 17:24:00 -0700 | [diff] [blame] | 327 | mConfig.getTaskStackBounds(new Rect(0, 0, width, height), mSystemInsets.top, |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 328 | mSystemInsets.right, searchBarSpaceBounds, taskStackBounds); |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 329 | if (mTaskStackView != null && mTaskStackView.getVisibility() != GONE) { |
Winson | 88f00ab | 2015-10-05 17:24:00 -0700 | [diff] [blame] | 330 | mTaskStackView.setTaskStackBounds(taskStackBounds, mSystemInsets); |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 331 | mTaskStackView.measure(widthMeasureSpec, heightMeasureSpec); |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 332 | } |
| 333 | |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 334 | if (mDragView != null) { |
| 335 | mDragView.measure( |
| 336 | MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), |
| 337 | MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); |
| 338 | } |
| 339 | |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 340 | setMeasuredDimension(width, height); |
| 341 | } |
| 342 | |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 343 | /** |
| 344 | * This is called with the full size of the window since we are handling our own insets. |
| 345 | */ |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 346 | @Override |
| 347 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { |
Winson Chung | f7bca43 | 2014-04-30 17:11:13 -0700 | [diff] [blame] | 348 | // Get the search bar bounds so that we lay it out |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 349 | Rect measuredRect = new Rect(0, 0, getMeasuredWidth(), getMeasuredHeight()); |
| 350 | Rect searchBarSpaceBounds = new Rect(); |
Winson Chung | ecd9b30 | 2014-04-16 17:07:18 -0700 | [diff] [blame] | 351 | if (mSearchBar != null) { |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 352 | mConfig.getSearchBarBounds(measuredRect, |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 353 | mSystemInsets.top, searchBarSpaceBounds); |
Winson Chung | dcfa797 | 2014-07-22 12:27:13 -0700 | [diff] [blame] | 354 | mSearchBar.layout(searchBarSpaceBounds.left, searchBarSpaceBounds.top, |
| 355 | searchBarSpaceBounds.right, searchBarSpaceBounds.bottom); |
Winson Chung | ecd9b30 | 2014-04-16 17:07:18 -0700 | [diff] [blame] | 356 | } |
| 357 | |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 358 | if (mTaskStackView != null && mTaskStackView.getVisibility() != GONE) { |
| 359 | mTaskStackView.layout(left, top, left + getMeasuredWidth(), top + getMeasuredHeight()); |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 360 | } |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 361 | |
| 362 | if (mDragView != null) { |
| 363 | mDragView.layout(left, top, left + mDragView.getMeasuredWidth(), |
| 364 | top + mDragView.getMeasuredHeight()); |
| 365 | } |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 366 | } |
| 367 | |
Winson Chung | 8eaeb7d | 2014-06-25 15:10:59 -0700 | [diff] [blame] | 368 | @Override |
Winson Chung | 8eaeb7d | 2014-06-25 15:10:59 -0700 | [diff] [blame] | 369 | public WindowInsets onApplyWindowInsets(WindowInsets insets) { |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 370 | mSystemInsets.set(insets.getSystemWindowInsets()); |
Winson Chung | 8eaeb7d | 2014-06-25 15:10:59 -0700 | [diff] [blame] | 371 | requestLayout(); |
Winson Chung | dcfa797 | 2014-07-22 12:27:13 -0700 | [diff] [blame] | 372 | return insets.consumeSystemWindowInsets(); |
Winson Chung | 8eaeb7d | 2014-06-25 15:10:59 -0700 | [diff] [blame] | 373 | } |
| 374 | |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 375 | @Override |
| 376 | public boolean onInterceptTouchEvent(MotionEvent ev) { |
| 377 | return mTouchHandler.onInterceptTouchEvent(ev); |
| 378 | } |
| 379 | |
| 380 | @Override |
| 381 | public boolean onTouchEvent(MotionEvent ev) { |
| 382 | return mTouchHandler.onTouchEvent(ev); |
| 383 | } |
| 384 | |
| 385 | @Override |
| 386 | protected void dispatchDraw(Canvas canvas) { |
| 387 | super.dispatchDraw(canvas); |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 388 | for (int i = mVisibleDockStates.length - 1; i >= 0; i--) { |
| 389 | Drawable d = mVisibleDockStates[i].viewState.dockAreaOverlay; |
| 390 | if (d.getAlpha() > 0) { |
| 391 | d.draw(canvas); |
| 392 | } |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 393 | } |
| 394 | } |
| 395 | |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 396 | @Override |
| 397 | protected boolean verifyDrawable(Drawable who) { |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 398 | for (int i = mVisibleDockStates.length - 1; i >= 0; i--) { |
| 399 | Drawable d = mVisibleDockStates[i].viewState.dockAreaOverlay; |
| 400 | if (d == who) { |
| 401 | return true; |
| 402 | } |
| 403 | } |
| 404 | return super.verifyDrawable(who); |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 405 | } |
| 406 | |
Winson Chung | a26fb78 | 2014-06-12 17:52:39 -0700 | [diff] [blame] | 407 | /** Notifies each task view of the user interaction. */ |
| 408 | public void onUserInteraction() { |
| 409 | // Get the first stack view |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 410 | if (mTaskStackView != null) { |
| 411 | mTaskStackView.onUserInteraction(); |
Winson Chung | a26fb78 | 2014-06-12 17:52:39 -0700 | [diff] [blame] | 412 | } |
| 413 | } |
| 414 | |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 415 | /** Focuses the next task in the first stack view */ |
| 416 | public void focusNextTask(boolean forward) { |
| 417 | // Get the first stack view |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 418 | if (mTaskStackView != null) { |
| 419 | mTaskStackView.focusNextTask(forward, true); |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 420 | } |
Winson Chung | a0e88b5 | 2014-08-11 19:25:42 -0700 | [diff] [blame] | 421 | } |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 422 | |
Winson Chung | a0e88b5 | 2014-08-11 19:25:42 -0700 | [diff] [blame] | 423 | /** Dismisses the focused task. */ |
| 424 | public void dismissFocusedTask() { |
| 425 | // Get the first stack view |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 426 | if (mTaskStackView != null) { |
| 427 | mTaskStackView.dismissFocusedTask(); |
Winson Chung | 1e8d71b | 2014-05-16 17:05:22 -0700 | [diff] [blame] | 428 | } |
| 429 | } |
| 430 | |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 431 | /** Unfilters any filtered stacks */ |
| 432 | public boolean unfilterFilteredStacks() { |
Winson Chung | dcfa797 | 2014-07-22 12:27:13 -0700 | [diff] [blame] | 433 | if (mStacks != null) { |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 434 | // Check if there are any filtered stacks and unfilter them before we back out of Recents |
| 435 | boolean stacksUnfiltered = false; |
Winson Chung | dcfa797 | 2014-07-22 12:27:13 -0700 | [diff] [blame] | 436 | int numStacks = mStacks.size(); |
| 437 | for (int i = 0; i < numStacks; i++) { |
| 438 | TaskStack stack = mStacks.get(i); |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 439 | if (stack.hasFilteredTasks()) { |
| 440 | stack.unfilterTasks(); |
| 441 | stacksUnfiltered = true; |
| 442 | } |
| 443 | } |
| 444 | return stacksUnfiltered; |
| 445 | } |
| 446 | return false; |
| 447 | } |
| 448 | |
Jorim Jaggi | 900fb48 | 2015-06-02 15:07:33 -0700 | [diff] [blame] | 449 | public void disableLayersForOneFrame() { |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 450 | if (mTaskStackView != null) { |
| 451 | mTaskStackView.disableLayersForOneFrame(); |
Jorim Jaggi | 900fb48 | 2015-06-02 15:07:33 -0700 | [diff] [blame] | 452 | } |
| 453 | } |
| 454 | |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 455 | private void postDrawHeaderThumbnailTransitionRunnable(final TaskStackView view, |
| 456 | final TaskView clickedView, final int offsetX, final int offsetY, |
| 457 | final float stackScroll, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 458 | final ActivityOptions.OnAnimationStartedListener animStartedListener, |
| 459 | final int destinationStack) { |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 460 | Runnable r = new Runnable() { |
| 461 | @Override |
| 462 | public void run() { |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 463 | overrideDrawHeaderThumbnailTransition(view, clickedView, offsetX, offsetY, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 464 | stackScroll, animStartedListener, destinationStack); |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 465 | |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 466 | } |
| 467 | }; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 468 | |
Jorim Jaggi | 6e18e00 | 2015-06-02 17:07:39 -0700 | [diff] [blame] | 469 | mCb.runAfterPause(r); |
| 470 | } |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 471 | |
| 472 | private void overrideDrawHeaderThumbnailTransition(TaskStackView stackView, |
| 473 | TaskView clickedTask, int offsetX, int offsetY, float stackScroll, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 474 | final ActivityOptions.OnAnimationStartedListener animStartedListener, |
| 475 | int destinationStack) { |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 476 | List<AppTransitionAnimationSpec> specs = getAppTransitionAnimationSpecs(stackView, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 477 | clickedTask, offsetX, offsetY, stackScroll, destinationStack); |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 478 | if (specs == null) { |
| 479 | return; |
| 480 | } |
| 481 | |
| 482 | IRemoteCallback.Stub callback = new IRemoteCallback.Stub() { |
| 483 | @Override |
| 484 | public void sendResult(Bundle data) throws RemoteException { |
| 485 | post(new Runnable() { |
| 486 | @Override |
| 487 | public void run() { |
| 488 | if (animStartedListener != null) { |
| 489 | animStartedListener.onAnimationStarted(); |
| 490 | } |
| 491 | } |
| 492 | }); |
| 493 | } |
| 494 | }; |
| 495 | |
| 496 | AppTransitionAnimationSpec[] specsArray = |
| 497 | new AppTransitionAnimationSpec[specs.size()]; |
| 498 | try { |
| 499 | WindowManagerGlobal.getWindowManagerService().overridePendingAppTransitionMultiThumb( |
| 500 | specs.toArray(specsArray), callback, true /* scaleUp */); |
| 501 | |
| 502 | } catch (RemoteException e) { |
| 503 | Log.w(TAG, "Error overriding app transition", e); |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | private List<AppTransitionAnimationSpec> getAppTransitionAnimationSpecs(TaskStackView stackView, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 508 | TaskView clickedTask, int offsetX, int offsetY, float stackScroll, |
| 509 | int destinationStack) { |
| 510 | final int targetStackId = destinationStack != INVALID_STACK_ID ? |
| 511 | destinationStack : clickedTask.getTask().key.stackId; |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 512 | if (targetStackId != ActivityManager.FREEFORM_WORKSPACE_STACK_ID |
| 513 | && targetStackId != ActivityManager.FULLSCREEN_WORKSPACE_STACK_ID) { |
| 514 | return null; |
| 515 | } |
| 516 | // If this is a full screen stack, the transition will be towards the single, full screen |
| 517 | // task. We only need the transition spec for this task. |
| 518 | List<AppTransitionAnimationSpec> specs = new ArrayList<>(); |
| 519 | if (targetStackId == ActivityManager.FULLSCREEN_WORKSPACE_STACK_ID) { |
| 520 | specs.add(createThumbnailHeaderAnimationSpec( |
| 521 | stackView, offsetX, offsetY, stackScroll, clickedTask, |
| 522 | clickedTask.getTask().key.id, ADD_HEADER_BITMAP)); |
| 523 | return specs; |
| 524 | } |
| 525 | // This is a free form stack or full screen stack, so there will be multiple windows |
| 526 | // animating from thumbnails. We need transition animation specs for all of them. |
| 527 | |
| 528 | // We will use top and bottom task views as a base for tasks, that aren't visible on the |
| 529 | // screen. This is necessary for cascade recents list, where some of the tasks might be |
| 530 | // hidden. |
| 531 | List<TaskView> taskViews = stackView.getTaskViews(); |
| 532 | int childCount = taskViews.size(); |
| 533 | TaskView topChild = taskViews.get(0); |
| 534 | TaskView bottomChild = taskViews.get(childCount - 1); |
| 535 | SparseArray<TaskView> taskViewsByTaskId = new SparseArray<>(); |
| 536 | for (int i = 0; i < childCount; i++) { |
| 537 | TaskView taskView = taskViews.get(i); |
| 538 | taskViewsByTaskId.put(taskView.getTask().key.id, taskView); |
| 539 | } |
| 540 | |
| 541 | TaskStack stack = stackView.getStack(); |
| 542 | // We go through all tasks now and for each generate transition animation spec. If there is |
| 543 | // a view associated with a task, we use that view as a base for the animation. If there |
| 544 | // isn't, we use bottom or top view, depending on which one would be closer to the task |
| 545 | // view if it existed. |
| 546 | ArrayList<Task> tasks = stack.getTasks(); |
| 547 | boolean passedClickedTask = false; |
| 548 | for (int i = 0, n = tasks.size(); i < n; i++) { |
| 549 | Task task = tasks.get(i); |
| 550 | TaskView taskView = taskViewsByTaskId.get(task.key.id); |
| 551 | if (taskView != null) { |
| 552 | specs.add(createThumbnailHeaderAnimationSpec(stackView, offsetX, offsetY, |
| 553 | stackScroll, taskView, taskView.getTask().key.id, ADD_HEADER_BITMAP)); |
| 554 | if (taskView == clickedTask) { |
| 555 | passedClickedTask = true; |
| 556 | } |
| 557 | } else { |
| 558 | taskView = passedClickedTask ? bottomChild : topChild; |
| 559 | specs.add(createThumbnailHeaderAnimationSpec(stackView, offsetX, offsetY, |
| 560 | stackScroll, taskView, task.key.id, !ADD_HEADER_BITMAP)); |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | return specs; |
| 565 | } |
| 566 | |
| 567 | private AppTransitionAnimationSpec createThumbnailHeaderAnimationSpec(TaskStackView stackView, |
| 568 | int offsetX, int offsetY, float stackScroll, TaskView tv, int taskId, |
| 569 | boolean addHeaderBitmap) { |
| 570 | // Disable any focused state before we draw the header |
| 571 | // Upfront the processing of the thumbnail |
| 572 | if (tv.isFocusedTask()) { |
| 573 | tv.unsetFocusedTask(); |
| 574 | } |
| 575 | TaskViewTransform transform = new TaskViewTransform(); |
| 576 | transform = stackView.getStackAlgorithm().getStackTransform(tv.mTask, stackScroll, |
| 577 | transform, null); |
| 578 | |
| 579 | float scale = tv.getScaleX(); |
| 580 | int fromHeaderWidth = (int) (tv.mHeaderView.getMeasuredWidth() * scale); |
| 581 | int fromHeaderHeight = (int) (tv.mHeaderView.getMeasuredHeight() * scale); |
| 582 | |
| 583 | Bitmap b = null; |
| 584 | if (addHeaderBitmap) { |
| 585 | b = Bitmap.createBitmap(fromHeaderWidth, fromHeaderHeight, |
| 586 | Bitmap.Config.ARGB_8888); |
| 587 | |
| 588 | if (Constants.DebugFlags.App.EnableTransitionThumbnailDebugMode) { |
| 589 | b.eraseColor(0xFFff0000); |
| 590 | } else { |
| 591 | Canvas c = new Canvas(b); |
| 592 | c.scale(tv.getScaleX(), tv.getScaleY()); |
| 593 | tv.mHeaderView.draw(c); |
| 594 | c.setBitmap(null); |
| 595 | |
| 596 | } |
| 597 | b = b.createAshmemBitmap(); |
| 598 | } |
| 599 | |
| 600 | int[] pts = new int[2]; |
| 601 | tv.getLocationOnScreen(pts); |
| 602 | |
| 603 | final int left = pts[0] + offsetX; |
| 604 | final int top = pts[1] + offsetY; |
| 605 | final Rect rect = new Rect(left, top, left + transform.rect.width(), |
| 606 | top + transform.rect.height()); |
| 607 | |
| 608 | return new AppTransitionAnimationSpec(taskId, b, rect); |
| 609 | } |
| 610 | |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 611 | /**** TaskStackView.TaskStackCallbacks Implementation ****/ |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 612 | |
| 613 | @Override |
Winson Chung | 7aceb9a | 2014-07-03 13:38:01 -0700 | [diff] [blame] | 614 | public void onTaskViewClicked(final TaskStackView stackView, final TaskView tv, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 615 | final TaskStack stack, final Task task, final boolean lockToTask, |
| 616 | final boolean boundsValid, final Rect bounds, int destinationStack) { |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 617 | // Notify any callbacks of the launching of a new task |
| 618 | if (mCb != null) { |
Winson Chung | 7aceb9a | 2014-07-03 13:38:01 -0700 | [diff] [blame] | 619 | mCb.onTaskViewClicked(); |
Winson Chung | 47c4c69 | 2014-03-17 10:17:11 -0700 | [diff] [blame] | 620 | } |
| 621 | |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 622 | // Upfront the processing of the thumbnail |
Winson Chung | ffa2ec6 | 2014-07-03 15:54:42 -0700 | [diff] [blame] | 623 | TaskViewTransform transform = new TaskViewTransform(); |
Jorim Jaggi | cb55703 | 2014-09-16 23:09:24 +0200 | [diff] [blame] | 624 | View sourceView; |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 625 | int offsetX = 0; |
| 626 | int offsetY = 0; |
Winson Chung | 012ef36 | 2014-07-31 18:36:25 -0700 | [diff] [blame] | 627 | float stackScroll = stackView.getScroller().getStackScroll(); |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 628 | if (tv == null) { |
| 629 | // If there is no actual task view, then use the stack view as the source view |
| 630 | // and then offset to the expected transform rect, but bound this to just |
| 631 | // outside the display rect (to ensure we don't animate from too far away) |
| 632 | sourceView = stackView; |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 633 | offsetX = transform.rect.left; |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 634 | offsetY = getMeasuredHeight(); |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 635 | } else { |
Jorim Jaggi | cb55703 | 2014-09-16 23:09:24 +0200 | [diff] [blame] | 636 | sourceView = tv.mThumbnailView; |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 637 | } |
| 638 | |
| 639 | // Compute the thumbnail to scale up from |
Winson Chung | 1f24c7e | 2014-07-11 17:06:48 -0700 | [diff] [blame] | 640 | final SystemServicesProxy ssp = |
| 641 | RecentsTaskLoader.getInstance().getSystemServicesProxy(); |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 642 | ActivityOptions opts = null; |
Chong Zhang | 0fa656b | 2015-08-31 15:17:21 -0700 | [diff] [blame] | 643 | ActivityOptions.OnAnimationStartedListener animStartedListener = null; |
Winson Chung | 2e7f3bd | 2014-09-05 13:17:22 +0200 | [diff] [blame] | 644 | if (task.thumbnail != null && task.thumbnail.getWidth() > 0 && |
| 645 | task.thumbnail.getHeight() > 0) { |
Winson Chung | 1f24c7e | 2014-07-11 17:06:48 -0700 | [diff] [blame] | 646 | if (lockToTask) { |
| 647 | animStartedListener = new ActivityOptions.OnAnimationStartedListener() { |
| 648 | boolean mTriggered = false; |
| 649 | @Override |
| 650 | public void onAnimationStarted() { |
| 651 | if (!mTriggered) { |
| 652 | postDelayed(new Runnable() { |
| 653 | @Override |
| 654 | public void run() { |
Jason Monk | 18f99d9 | 2014-09-11 13:36:42 -0400 | [diff] [blame] | 655 | mCb.onScreenPinningRequest(); |
Winson Chung | 1f24c7e | 2014-07-11 17:06:48 -0700 | [diff] [blame] | 656 | } |
| 657 | }, 350); |
| 658 | mTriggered = true; |
| 659 | } |
| 660 | } |
| 661 | }; |
| 662 | } |
Filip Gruszczynski | 170192a | 2015-08-16 17:46:34 -0700 | [diff] [blame] | 663 | postDrawHeaderThumbnailTransitionRunnable(stackView, tv, offsetX, offsetY, stackScroll, |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 664 | animStartedListener, destinationStack); |
Winson | ec417e4 | 2015-09-29 12:42:29 -0700 | [diff] [blame] | 665 | opts = ActivityOptions.makeThumbnailAspectScaleUpAnimation(sourceView, |
| 666 | Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8).createAshmemBitmap(), |
| 667 | offsetX, offsetY, transform.rect.width(), transform.rect.height(), |
| 668 | sourceView.getHandler(), animStartedListener); |
Chong Zhang | 0fa656b | 2015-08-31 15:17:21 -0700 | [diff] [blame] | 669 | } else { |
| 670 | opts = ActivityOptions.makeBasic(); |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 671 | } |
Chong Zhang | 0fa656b | 2015-08-31 15:17:21 -0700 | [diff] [blame] | 672 | if (boundsValid) { |
Winson | b1bbaed | 2015-09-23 15:45:11 -0700 | [diff] [blame] | 673 | opts.setBounds(bounds.isEmpty() ? null : bounds); |
Chong Zhang | 0fa656b | 2015-08-31 15:17:21 -0700 | [diff] [blame] | 674 | } |
Winson Chung | e0e45bc | 2014-06-17 17:56:17 -0700 | [diff] [blame] | 675 | final ActivityOptions launchOpts = opts; |
Chong Zhang | 0fa656b | 2015-08-31 15:17:21 -0700 | [diff] [blame] | 676 | final boolean screenPinningRequested = (animStartedListener == null) && lockToTask; |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 677 | final Runnable launchRunnable = new Runnable() { |
| 678 | @Override |
| 679 | public void run() { |
Winson Chung | 4be0445 | 2014-03-24 17:22:30 -0700 | [diff] [blame] | 680 | if (task.isActive) { |
| 681 | // Bring an active task to the foreground |
Craig Mautner | dc00cbe | 2014-07-20 17:48:47 -0700 | [diff] [blame] | 682 | ssp.moveTaskToFront(task.key.id, launchOpts); |
Winson Chung | 4be0445 | 2014-03-24 17:22:30 -0700 | [diff] [blame] | 683 | } else { |
Winson Chung | 4e96eb7 | 2014-09-17 15:16:09 +0200 | [diff] [blame] | 684 | if (ssp.startActivityFromRecents(getContext(), task.key.id, |
| 685 | task.activityLabel, launchOpts)) { |
Chong Zhang | 0fa656b | 2015-08-31 15:17:21 -0700 | [diff] [blame] | 686 | if (screenPinningRequested) { |
Jason Monk | 18f99d9 | 2014-09-11 13:36:42 -0400 | [diff] [blame] | 687 | mCb.onScreenPinningRequest(); |
Winson Chung | 4be0445 | 2014-03-24 17:22:30 -0700 | [diff] [blame] | 688 | } |
Winson Chung | 4e96eb7 | 2014-09-17 15:16:09 +0200 | [diff] [blame] | 689 | } else { |
| 690 | // Dismiss the task and return the user to home if we fail to |
| 691 | // launch the task |
Winson | 2536c7e | 2015-10-01 15:49:31 -0700 | [diff] [blame] | 692 | EventBus.getDefault().send(new DismissTaskEvent(task, tv)); |
Winson Chung | 4e96eb7 | 2014-09-17 15:16:09 +0200 | [diff] [blame] | 693 | if (mCb != null) { |
| 694 | mCb.onTaskLaunchFailed(); |
| 695 | } |
Winson Chung | 5c9f4b9 | 2015-06-25 16:16:46 -0700 | [diff] [blame] | 696 | |
| 697 | // Keep track of failed launches |
| 698 | MetricsLogger.count(getContext(), "overview_task_launch_failed", 1); |
Winson Chung | 4be0445 | 2014-03-24 17:22:30 -0700 | [diff] [blame] | 699 | } |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 700 | } |
| 701 | } |
| 702 | }; |
| 703 | |
Winson Chung | 5c9f4b9 | 2015-06-25 16:16:46 -0700 | [diff] [blame] | 704 | // Keep track of the index of the task launch |
| 705 | int taskIndexFromFront = 0; |
| 706 | int taskIndex = stack.indexOfTask(task); |
| 707 | if (taskIndex > -1) { |
| 708 | taskIndexFromFront = stack.getTaskCount() - taskIndex - 1; |
| 709 | } |
| 710 | MetricsLogger.histogram(getContext(), "overview_task_launch_index", taskIndexFromFront); |
| 711 | |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 712 | // Launch the app right away if there is no task view, otherwise, animate the icon out first |
Winson Chung | 814086d | 2014-05-07 15:01:14 -0700 | [diff] [blame] | 713 | if (tv == null) { |
Winson Chung | a91c293 | 2014-11-07 15:02:38 -0800 | [diff] [blame] | 714 | launchRunnable.run(); |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 715 | } else { |
Winson Chung | e1e20e1 | 2015-06-02 14:11:49 -0700 | [diff] [blame] | 716 | if (task.group != null && !task.group.isFrontMostTask(task)) { |
Winson Chung | a4ccb86 | 2014-08-22 15:26:27 -0700 | [diff] [blame] | 717 | // For affiliated tasks that are behind other tasks, we must animate the front cards |
| 718 | // out of view before starting the task transition |
Winson Chung | ebfc698 | 2014-08-26 12:25:34 -0700 | [diff] [blame] | 719 | stackView.startLaunchTaskAnimation(tv, launchRunnable, lockToTask); |
Winson Chung | a4ccb86 | 2014-08-22 15:26:27 -0700 | [diff] [blame] | 720 | } else { |
| 721 | // Otherwise, we can start the task transition immediately |
Winson Chung | ebfc698 | 2014-08-26 12:25:34 -0700 | [diff] [blame] | 722 | stackView.startLaunchTaskAnimation(tv, null, lockToTask); |
Winson Chung | a91c293 | 2014-11-07 15:02:38 -0800 | [diff] [blame] | 723 | launchRunnable.run(); |
Winson Chung | a4ccb86 | 2014-08-22 15:26:27 -0700 | [diff] [blame] | 724 | } |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 725 | } |
| 726 | } |
Winson Chung | 9f9679d | 2014-04-11 16:49:09 -0700 | [diff] [blame] | 727 | |
| 728 | @Override |
Winson Chung | 6ac8bd6 | 2015-01-07 16:38:35 -0800 | [diff] [blame] | 729 | public void onAllTaskViewsDismissed(ArrayList<Task> removedTasks) { |
Winson | 2536c7e | 2015-10-01 15:49:31 -0700 | [diff] [blame] | 730 | /* TODO: Not currently enabled |
Winson Chung | 6ac8bd6 | 2015-01-07 16:38:35 -0800 | [diff] [blame] | 731 | if (removedTasks != null) { |
| 732 | int taskCount = removedTasks.size(); |
| 733 | for (int i = 0; i < taskCount; i++) { |
| 734 | onTaskViewDismissed(removedTasks.get(i)); |
| 735 | } |
| 736 | } |
Winson | 2536c7e | 2015-10-01 15:49:31 -0700 | [diff] [blame] | 737 | */ |
Winson Chung | 6ac8bd6 | 2015-01-07 16:38:35 -0800 | [diff] [blame] | 738 | |
Winson Chung | 7aceb9a | 2014-07-03 13:38:01 -0700 | [diff] [blame] | 739 | mCb.onAllTaskViewsDismissed(); |
Winson Chung | 5c9f4b9 | 2015-06-25 16:16:46 -0700 | [diff] [blame] | 740 | |
| 741 | // Keep track of all-deletions |
| 742 | MetricsLogger.count(getContext(), "overview_task_all_dismissed", 1); |
Winson Chung | d7b2cb1 | 2014-06-26 15:08:50 -0700 | [diff] [blame] | 743 | } |
| 744 | |
Winson Chung | b0a28ea | 2014-10-28 15:21:35 -0700 | [diff] [blame] | 745 | /** Final callback after Recents is finally hidden. */ |
| 746 | public void onRecentsHidden() { |
| 747 | // Notify each task stack view |
Winson | 147ecaf | 2015-09-16 16:49:55 -0700 | [diff] [blame] | 748 | if (mTaskStackView != null) { |
| 749 | mTaskStackView.onRecentsHidden(); |
Winson Chung | b0a28ea | 2014-10-28 15:21:35 -0700 | [diff] [blame] | 750 | } |
| 751 | } |
| 752 | |
Winson Chung | d7b2cb1 | 2014-06-26 15:08:50 -0700 | [diff] [blame] | 753 | @Override |
Winson Chung | 8e548f7 | 2014-06-24 14:40:53 -0700 | [diff] [blame] | 754 | public void onTaskStackFilterTriggered() { |
| 755 | // Hide the search bar |
| 756 | if (mSearchBar != null) { |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 757 | int filterDuration = getResources().getInteger( |
| 758 | R.integer.recents_filter_animate_current_views_duration); |
Winson Chung | 8e548f7 | 2014-06-24 14:40:53 -0700 | [diff] [blame] | 759 | mSearchBar.animate() |
| 760 | .alpha(0f) |
| 761 | .setStartDelay(0) |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 762 | .setInterpolator(mFastOutSlowInInterpolator) |
| 763 | .setDuration(filterDuration) |
Winson Chung | 8e548f7 | 2014-06-24 14:40:53 -0700 | [diff] [blame] | 764 | .withLayer() |
| 765 | .start(); |
| 766 | } |
| 767 | } |
| 768 | |
| 769 | @Override |
| 770 | public void onTaskStackUnfilterTriggered() { |
| 771 | // Show the search bar |
| 772 | if (mSearchBar != null) { |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 773 | int filterDuration = getResources().getInteger( |
| 774 | R.integer.recents_filter_animate_new_views_duration); |
Winson Chung | 8e548f7 | 2014-06-24 14:40:53 -0700 | [diff] [blame] | 775 | mSearchBar.animate() |
| 776 | .alpha(1f) |
| 777 | .setStartDelay(0) |
Winson | 35f3050 | 2015-09-28 11:24:36 -0700 | [diff] [blame] | 778 | .setInterpolator(mFastOutSlowInInterpolator) |
| 779 | .setDuration(filterDuration) |
Winson Chung | 8e548f7 | 2014-06-24 14:40:53 -0700 | [diff] [blame] | 780 | .withLayer() |
| 781 | .start(); |
| 782 | } |
| 783 | } |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 784 | |
| 785 | /**** EventBus Events ****/ |
| 786 | |
| 787 | public final void onBusEvent(DragStartEvent event) { |
| 788 | // Add the drag view |
| 789 | mDragView = event.dragView; |
| 790 | addView(mDragView); |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 791 | |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 792 | updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(), |
| 793 | TaskStack.DockState.NONE.viewState.dockAreaAlpha); |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 794 | } |
| 795 | |
| 796 | public final void onBusEvent(DragDockStateChangedEvent event) { |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 797 | if (event.dockState == TaskStack.DockState.NONE) { |
| 798 | updateVisibleDockRegions(mTouchHandler.getDockStatesForCurrentOrientation(), |
| 799 | TaskStack.DockState.NONE.viewState.dockAreaAlpha); |
| 800 | } else { |
| 801 | updateVisibleDockRegions(new TaskStack.DockState[] {event.dockState}, -1); |
| 802 | } |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 803 | } |
| 804 | |
| 805 | public final void onBusEvent(final DragEndEvent event) { |
| 806 | event.postAnimationTrigger.increment(); |
| 807 | event.postAnimationTrigger.addLastDecrementRunnable(new Runnable() { |
| 808 | @Override |
| 809 | public void run() { |
| 810 | // Remove the drag view |
| 811 | removeView(mDragView); |
| 812 | mDragView = null; |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 813 | updateVisibleDockRegions(null, -1); |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 814 | |
| 815 | // Dock the new task if we are hovering over a valid dock state |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 816 | if (event.dockState != TaskStack.DockState.NONE) { |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 817 | SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); |
| 818 | ssp.setTaskResizeable(event.task.key.id); |
| 819 | ssp.dockTask(event.task.key.id, event.dockState.createMode); |
Filip Gruszczynski | f48b585 | 2015-10-13 10:28:22 -0700 | [diff] [blame^] | 820 | launchTask(event.task, null, INVALID_STACK_ID); |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 821 | } |
| 822 | } |
| 823 | }); |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 824 | if (event.dockState == TaskStack.DockState.NONE) { |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 825 | // Animate the alpha back to what it was before |
| 826 | Rect taskBounds = mTaskStackView.getStackAlgorithm().getUntransformedTaskViewBounds(); |
| 827 | int left = taskBounds.left + (int) ((1f - event.taskView.getScaleX()) * taskBounds.width()) / 2; |
| 828 | int top = taskBounds.top + (int) ((1f - event.taskView.getScaleY()) * taskBounds.height()) / 2; |
| 829 | event.dragView.animate() |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 830 | .scaleX(1f) |
| 831 | .scaleY(1f) |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 832 | .translationX(left + event.taskView.getTranslationX()) |
| 833 | .translationY(top + event.taskView.getTranslationY()) |
| 834 | .setDuration(175) |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 835 | .setInterpolator(mFastOutSlowInInterpolator) |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 836 | .withEndAction(event.postAnimationTrigger.decrementAsRunnable()) |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 837 | .start(); |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 838 | |
| 839 | // Animate the overlay alpha back to 0 |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 840 | updateVisibleDockRegions(null, -1); |
Winson | be7607a | 2015-10-01 17:24:51 -0700 | [diff] [blame] | 841 | } else { |
| 842 | event.postAnimationTrigger.decrement(); |
| 843 | } |
| 844 | } |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 845 | |
| 846 | /** |
| 847 | * Updates the dock region to match the specified dock state. |
| 848 | */ |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 849 | private void updateVisibleDockRegions(TaskStack.DockState[] newDockStates, int overrideAlpha) { |
| 850 | ArraySet<TaskStack.DockState> newDockStatesSet = new ArraySet<>(); |
| 851 | if (newDockStates != null) { |
| 852 | for (TaskStack.DockState dockState : newDockStates) { |
| 853 | newDockStatesSet.add(dockState); |
| 854 | } |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 855 | } |
Winson | 882072b | 2015-10-12 11:26:33 -0700 | [diff] [blame] | 856 | for (TaskStack.DockState dockState : mVisibleDockStates) { |
| 857 | TaskStack.DockState.ViewState viewState = dockState.viewState; |
| 858 | if (newDockStates == null || !newDockStatesSet.contains(dockState)) { |
| 859 | // This is no longer visible, so hide it |
| 860 | viewState.startAlphaAnimation(0, 150); |
| 861 | } else { |
| 862 | // This state is now visible, update the bounds and show it |
| 863 | int alpha = (overrideAlpha != -1 ? overrideAlpha : viewState.dockAreaAlpha); |
| 864 | viewState.dockAreaOverlay.setBounds( |
| 865 | dockState.getDockedBounds(getMeasuredWidth(), getMeasuredHeight())); |
| 866 | viewState.dockAreaOverlay.setCallback(this); |
| 867 | viewState.startAlphaAnimation(alpha, 150); |
| 868 | } |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 869 | } |
Winson | 4165d336 | 2015-10-10 14:40:35 -0700 | [diff] [blame] | 870 | } |
Winson Chung | 303e1ff | 2014-03-07 15:06:19 -0800 | [diff] [blame] | 871 | } |