blob: 483f9e523c55da4c0e56f022b6618cdd93691bf9 [file] [log] [blame]
Sid Soundararajanb58c46a2016-01-26 15:39:27 -08001/*
2 * Copyright (C) 2016 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 */
16package com.android.systemui.recents.tv;
17
18import android.app.Activity;
19import android.app.ActivityOptions;
20import android.content.Intent;
Jaewan Kimc92a7d12016-02-15 17:33:25 -080021import android.graphics.Rect;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080022import android.os.Bundle;
23import android.os.UserHandle;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080024import android.util.Log;
25import android.view.KeyEvent;
26import android.view.View;
27import android.view.ViewTreeObserver.OnPreDrawListener;
28import android.view.WindowManager;
Jaewan Kimc92a7d12016-02-15 17:33:25 -080029import android.widget.FrameLayout.LayoutParams;
Winsonc0d70582016-01-29 10:24:39 -080030
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080031import com.android.systemui.R;
Winsonc0d70582016-01-29 10:24:39 -080032import com.android.systemui.recents.Recents;
33import com.android.systemui.recents.RecentsActivityLaunchState;
34import com.android.systemui.recents.RecentsConfiguration;
35import com.android.systemui.recents.RecentsImpl;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080036import com.android.systemui.recents.events.EventBus;
37import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
38import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
39import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
40import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
41import com.android.systemui.recents.events.activity.HideRecentsEvent;
42import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080043import com.android.systemui.recents.events.activity.ToggleRecentsEvent;
44import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
45import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
46import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
47import com.android.systemui.recents.events.ui.UpdateFreeformTaskViewVisibilityEvent;
48import com.android.systemui.recents.events.ui.UserInteractionEvent;
49import com.android.systemui.recents.events.ui.focus.DismissFocusedTaskViewEvent;
50import com.android.systemui.recents.misc.SystemServicesProxy;
51import com.android.systemui.recents.model.RecentsPackageMonitor;
52import com.android.systemui.recents.model.RecentsTaskLoadPlan;
53import com.android.systemui.recents.model.RecentsTaskLoader;
54import com.android.systemui.recents.model.Task;
55import com.android.systemui.recents.model.TaskStack;
Jaewan Kima0d4d252016-03-31 13:37:10 +090056import com.android.systemui.recents.tv.animations.FocusAnimationHolder;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080057import com.android.systemui.recents.tv.views.RecentsTvView;
58import com.android.systemui.recents.tv.views.TaskStackHorizontalViewAdapter;
59import com.android.systemui.statusbar.BaseStatusBar;
60import com.android.systemui.tv.pip.PipManager;
Jaewan Kima0d4d252016-03-31 13:37:10 +090061import com.android.systemui.tv.pip.PipRecentsOverlayManager;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080062
63import java.util.ArrayList;
Sid Soundararajan1008cc22016-02-01 11:11:14 -080064import java.util.Collections;
65import java.util.List;
Jaewan Kimc92a7d12016-02-15 17:33:25 -080066
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080067/**
68 * The main TV recents activity started by the RecentsImpl.
69 */
70public class RecentsTvActivity extends Activity implements OnPreDrawListener {
71 private final static String TAG = "RecentsTvActivity";
72 private final static boolean DEBUG = false;
73
74 public final static int EVENT_BUS_PRIORITY = Recents.EVENT_BUS_PRIORITY + 1;
75
76 private boolean mFinishedOnStartup;
77 private RecentsPackageMonitor mPackageMonitor;
78 private long mLastTabKeyEventTime;
79 private boolean mIgnoreAltTabRelease;
80
81 private RecentsTvView mRecentsView;
Jaewan Kima0d4d252016-03-31 13:37:10 +090082 private FocusAnimationHolder mRecentsFocusAnimationHolder;
83 private View mPipView;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080084 private TaskStackHorizontalViewAdapter mTaskStackViewAdapter;
85 private FinishRecentsRunnable mFinishLaunchHomeRunnable;
86
Jaewan Kima0d4d252016-03-31 13:37:10 +090087 private final PipManager mPipManager = PipManager.getInstance();
88 private final PipManager.Listener mPipListener = new PipManager.Listener() {
Jaewan Kimc92a7d12016-02-15 17:33:25 -080089 @Override
Jaewan Kim82ac50d2016-03-21 17:34:28 +090090 public void onPipEntered() {
91 updatePipUI();
92 }
93
94 @Override
Jaewan Kimc92a7d12016-02-15 17:33:25 -080095 public void onPipActivityClosed() {
Jaewan Kim82ac50d2016-03-21 17:34:28 +090096 updatePipUI();
Jaewan Kimc92a7d12016-02-15 17:33:25 -080097 }
98
99 @Override
Jaewan Kim8f584b82016-03-22 22:16:59 +0900100 public void onShowPipMenu() {
101 updatePipUI();
102 }
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800103
104 @Override
Youngsang Cho72a67c932016-03-24 13:40:51 -0700105 public void onMoveToFullscreen() {
106 // Recents should be dismissed when PIP moves to fullscreen. If not, Recents will
107 // be unnecessarily shown in the scenario: PIP->Fullscreen->PIP.
108 dismissRecentsToLaunchTargetTaskOrHome();
109 }
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800110
111 @Override
112 public void onPipResizeAboutToStart() { }
113 };
Jaewan Kima0d4d252016-03-31 13:37:10 +0900114 private PipRecentsOverlayManager mPipRecentsOverlayManager;
115 private final PipRecentsOverlayManager.Callback mPipRecentsOverlayManagerCallback =
116 new PipRecentsOverlayManager.Callback() {
117 @Override
118 public void onClosed() {
119 dismissRecentsToLaunchTargetTaskOrHome();
120 }
121
122 @Override
123 public void onBackPressed() {
124 RecentsTvActivity.this.onBackPressed();
125 }
126
127 @Override
128 public void onRecentsFocused() {
129 mRecentsView.requestFocus();
130 }
131 };
132 private final View.OnFocusChangeListener mPipViewFocusChangeListener =
133 new View.OnFocusChangeListener() {
134 @Override
135 public void onFocusChange(View v, boolean hasFocus) {
136 if (hasFocus) {
137 mRecentsFocusAnimationHolder.startFocusLoseAnimation();
138 mPipRecentsOverlayManager.requestFocus(
139 mTaskStackViewAdapter.getItemCount() > 0);
140 } else {
141 mRecentsFocusAnimationHolder.startFocusGainAnimation();
142 }
143 }
144 };
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800145
146 /**
147 * A common Runnable to finish Recents by launching Home with an animation depending on the
148 * last activity launch state. Generally we always launch home when we exit Recents rather than
149 * just finishing the activity since we don't know what is behind Recents in the task stack.
150 */
151 class FinishRecentsRunnable implements Runnable {
152 Intent mLaunchIntent;
153
154 /**
155 * Creates a finish runnable that starts the specified intent.
156 */
157 public FinishRecentsRunnable(Intent launchIntent) {
158 mLaunchIntent = launchIntent;
159 }
160
161 @Override
162 public void run() {
163 try {
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800164 ActivityOptions opts = ActivityOptions.makeCustomAnimation(RecentsTvActivity.this,
Winson008ee15f2016-03-18 17:17:25 -0700165 R.anim.recents_to_launcher_enter, R.anim.recents_to_launcher_exit);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800166 startActivityAsUser(mLaunchIntent, opts.toBundle(), UserHandle.CURRENT);
167 } catch (Exception e) {
168 Log.e(TAG, getString(R.string.recents_launch_error_message, "Home"), e);
169 }
170 }
171 }
172
173 private void updateRecentsTasks() {
174 RecentsTaskLoader loader = Recents.getTaskLoader();
175 RecentsTaskLoadPlan plan = RecentsImpl.consumeInstanceLoadPlan();
176 if (plan == null) {
177 plan = loader.createLoadPlan(this);
178 }
179
180 RecentsConfiguration config = Recents.getConfiguration();
181 RecentsActivityLaunchState launchState = config.getLaunchState();
182 if (!plan.hasTasks()) {
183 loader.preloadTasks(plan, -1, launchState.launchedFromHome);
184 }
185 TaskStack stack = plan.getTaskStack();
186 RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
187 loadOpts.runningTaskId = launchState.launchedToTaskId;
188 loadOpts.numVisibleTasks = stack.getStackTaskCount();
189 loadOpts.numVisibleTaskThumbnails = stack.getStackTaskCount();
190 loader.loadTasks(this, plan, loadOpts);
191
192
193 mRecentsView.setTaskStack(stack);
Sid Soundararajan1008cc22016-02-01 11:11:14 -0800194 List stackTasks = stack.getStackTasks();
195 Collections.reverse(stackTasks);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800196 if (mTaskStackViewAdapter == null) {
Sid Soundararajan1008cc22016-02-01 11:11:14 -0800197 mTaskStackViewAdapter = new TaskStackHorizontalViewAdapter(stackTasks);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800198 mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
199 } else {
Sid Soundararajan1008cc22016-02-01 11:11:14 -0800200 mTaskStackViewAdapter.setNewStackTasks(stackTasks);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800201 }
202
203 if (launchState.launchedToTaskId != -1) {
204 ArrayList<Task> tasks = stack.getStackTasks();
205 int taskCount = tasks.size();
206 for (int i = 0; i < taskCount; i++) {
207 Task t = tasks.get(i);
208 if (t.key.id == launchState.launchedToTaskId) {
209 t.isLaunchTarget = true;
210 break;
211 }
212 }
213 }
214 }
215
216 boolean dismissRecentsToLaunchTargetTaskOrHome() {
217 SystemServicesProxy ssp = Recents.getSystemServices();
218 if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
219 // If we have a focused Task, launch that Task now
220 if (mRecentsView.launchPreviousTask()) return true;
221 // If none of the other cases apply, then just go Home
222 dismissRecentsToHome(true /* animateTaskViews */);
223 }
224 return false;
225 }
226
227 boolean dismissRecentsToFocusedTaskOrHome() {
228 SystemServicesProxy ssp = Recents.getSystemServices();
229 if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
230 // If we have a focused Task, launch that Task now
231 if (mRecentsView.launchFocusedTask()) return true;
232 // If none of the other cases apply, then just go Home
233 dismissRecentsToHome(true /* animateTaskViews */);
234 return true;
235 }
236 return false;
237 }
238
239 void dismissRecentsToHome(boolean animateTaskViews) {
240 DismissRecentsToHomeAnimationStarted dismissEvent =
241 new DismissRecentsToHomeAnimationStarted(animateTaskViews);
242 dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
243 dismissEvent.addPostAnimationCallback(new Runnable() {
244 @Override
245 public void run() {
246 Recents.getSystemServices().sendCloseSystemWindows(
247 BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
248 }
249 });
250 EventBus.getDefault().send(dismissEvent);
251 }
252
253 boolean dismissRecentsToHomeIfVisible(boolean animated) {
254 SystemServicesProxy ssp = Recents.getSystemServices();
255 if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
256 // Return to Home
257 dismissRecentsToHome(animated);
258 return true;
259 }
260 return false;
261 }
262
263 @Override
264 public void onCreate(Bundle savedInstanceState) {
265 super.onCreate(savedInstanceState);
266 mFinishedOnStartup = false;
267
268 // In the case that the activity starts up before the Recents component has initialized
269 // (usually when debugging/pushing the SysUI apk), just finish this activity.
270 SystemServicesProxy ssp = Recents.getSystemServices();
271 if (ssp == null) {
272 mFinishedOnStartup = true;
273 finish();
274 return;
275 }
Jaewan Kima0d4d252016-03-31 13:37:10 +0900276 mPipRecentsOverlayManager = PipManager.getInstance().getPipRecentsOverlayManager();
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800277
278 // Register this activity with the event bus
279 EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
280
281 mPackageMonitor = new RecentsPackageMonitor();
282 mPackageMonitor.register(this);
283
284 // Set the Recents layout
285 setContentView(R.layout.recents_on_tv);
286
287 mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
288 mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
289 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
290 View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
Jaewan Kima0d4d252016-03-31 13:37:10 +0900291 mRecentsFocusAnimationHolder = new FocusAnimationHolder(mRecentsView);
Jaewan Kim8f584b82016-03-22 22:16:59 +0900292
Jaewan Kima0d4d252016-03-31 13:37:10 +0900293 mPipView = findViewById(R.id.pip);
294 // Place mPipView at the PIP bounds for fine tuned focus handling.
295 Rect pipBounds = mPipManager.getPipBounds();
296 LayoutParams lp = (LayoutParams) mPipView.getLayoutParams();
297 lp.width = pipBounds.width();
298 lp.height = pipBounds.height();
299 lp.leftMargin = pipBounds.left;
300 lp.topMargin = pipBounds.top;
301 mPipView.setLayoutParams(lp);
302
303 mPipRecentsOverlayManager.setCallback(mPipRecentsOverlayManagerCallback);
Jaewan Kim8f584b82016-03-22 22:16:59 +0900304
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800305 getWindow().getAttributes().privateFlags |=
306 WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
307
308 // Create the home intent runnable
309 Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
310 homeIntent.addCategory(Intent.CATEGORY_HOME);
311 homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
312 Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
313 mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900314
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900315 mPipManager.addListener(mPipListener);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800316 }
317
318 @Override
319 protected void onNewIntent(Intent intent) {
320 super.onNewIntent(intent);
321 setIntent(intent);
322 }
323
324 @Override
325 protected void onStart() {
326 super.onStart();
327
328 // Update the recent tasks
329 updateRecentsTasks();
330
331 // If this is a new instance from a configuration change, then we have to manually trigger
332 // the enter animation state, or if recents was relaunched by AM, without going through
333 // the normal mechanisms
334 RecentsConfiguration config = Recents.getConfiguration();
335 RecentsActivityLaunchState launchState = config.getLaunchState();
336 boolean wasLaunchedByAm = !launchState.launchedFromHome &&
Winsone693aaf2016-03-01 12:05:59 -0800337 !launchState.launchedFromApp;
Winsona1ededd2016-03-25 12:23:12 -0700338 if (wasLaunchedByAm) {
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800339 EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
340 }
341
342 // Notify that recents is now visible
343 SystemServicesProxy ssp = Recents.getSystemServices();
Winson88737542016-02-17 13:27:33 -0800344 EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, true));
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800345
Jaewan Kima0d4d252016-03-31 13:37:10 +0900346 updatePipUI();
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800347 }
348
349 @Override
350 public void onEnterAnimationComplete() {
351 super.onEnterAnimationComplete();
352 EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
353 }
354
355 @Override
Jaewan Kima0d4d252016-03-31 13:37:10 +0900356 public void onResume() {
357 super.onResume();
358 mPipRecentsOverlayManager.onRecentsResumed();
359 }
360
361 @Override
362 public void onPause() {
363 super.onPause();
364 mPipRecentsOverlayManager.onRecentsPaused();
365 }
366
367 @Override
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800368 protected void onStop() {
369 super.onStop();
370
371 mIgnoreAltTabRelease = false;
372 // Notify that recents is now hidden
Winson88737542016-02-17 13:27:33 -0800373 EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800374
375 // Workaround for b/22542869, if the RecentsActivity is started again, but without going
376 // through SystemUI, we need to reset the config launch flags to ensure that we do not
377 // wait on the system to send a signal that was never queued.
378 RecentsConfiguration config = Recents.getConfiguration();
379 RecentsActivityLaunchState launchState = config.getLaunchState();
Jorim Jaggie161f082016-02-05 14:26:16 -0800380 launchState.reset();
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800381 }
382
383 @Override
384 protected void onDestroy() {
385 super.onDestroy();
386
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900387 mPipManager.removeListener(mPipListener);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800388 // In the case that the activity finished on startup, just skip the unregistration below
389 if (mFinishedOnStartup) {
390 return;
391 }
392
393 // Unregister any broadcast receivers for the task loader
394 mPackageMonitor.unregister();
395
396 EventBus.getDefault().unregister(this);
397 }
398
399 @Override
400 public void onTrimMemory(int level) {
401 RecentsTaskLoader loader = Recents.getTaskLoader();
402 if (loader != null) {
403 loader.onTrimMemory(level);
404 }
405 }
406
407 @Override
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800408 public boolean onKeyDown(int keyCode, KeyEvent event) {
409 switch (keyCode) {
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800410 case KeyEvent.KEYCODE_DEL:
411 case KeyEvent.KEYCODE_FORWARD_DEL: {
412 EventBus.getDefault().send(new DismissFocusedTaskViewEvent());
413 return true;
414 }
415 default:
416 break;
417 }
418 return super.onKeyDown(keyCode, event);
419 }
420
421 @Override
422 public void onUserInteraction() {
423 EventBus.getDefault().send(new UserInteractionEvent());
424 }
425
426 @Override
427 public void onBackPressed() {
428 // Back behaves like the recents button so just trigger a toggle event
429 EventBus.getDefault().send(new ToggleRecentsEvent());
430 }
431
432 /**** EventBus events ****/
433
434 public final void onBusEvent(ToggleRecentsEvent event) {
435 RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
436 if (launchState.launchedFromHome) {
437 dismissRecentsToHome(true /* animateTaskViews */);
438 } else {
439 dismissRecentsToLaunchTargetTaskOrHome();
440 }
441 }
442
443 public final void onBusEvent(HideRecentsEvent event) {
444 if (event.triggeredFromAltTab) {
445 // If we are hiding from releasing Alt-Tab, dismiss Recents to the focused app
446 if (!mIgnoreAltTabRelease) {
447 dismissRecentsToFocusedTaskOrHome();
448 }
449 } else if (event.triggeredFromHomeKey) {
450 dismissRecentsToHome(true /* animateTaskViews */);
451 } else {
452 // Do nothing
453 }
454 }
455
456 public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) {
457 EventBus.getDefault().send(new UpdateFreeformTaskViewVisibilityEvent(true));
458 mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
459 mRecentsView.invalidate();
460 }
461
462 public final void onBusEvent(CancelEnterRecentsWindowAnimationEvent event) {
463 RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
464 int launchToTaskId = launchState.launchedToTaskId;
465 if (launchToTaskId != -1 &&
466 (event.launchTask == null || launchToTaskId != event.launchTask.key.id)) {
467 SystemServicesProxy ssp = Recents.getSystemServices();
468 ssp.cancelWindowTransition(launchState.launchedToTaskId);
469 ssp.cancelThumbnailTransition(getTaskId());
470 }
471 }
472
473 public final void onBusEvent(DeleteTaskDataEvent event) {
474 // Remove any stored data from the loader
475 RecentsTaskLoader loader = Recents.getTaskLoader();
476 loader.deleteTaskData(event.task, false);
477
478 // Remove the task from activity manager
479 SystemServicesProxy ssp = Recents.getSystemServices();
480 ssp.removeTask(event.task.key.id);
481 }
482
483 public final void onBusEvent(AllTaskViewsDismissedEvent event) {
484 SystemServicesProxy ssp = Recents.getSystemServices();
485 if (ssp.hasDockedTask()) {
486 mRecentsView.showEmptyView();
487 } else {
488 // Just go straight home (no animation necessary because there are no more task views)
489 dismissRecentsToHome(false /* animateTaskViews */);
490 }
491 }
492
493 public final void onBusEvent(LaunchTaskFailedEvent event) {
494 // Return to Home
495 dismissRecentsToHome(true /* animateTaskViews */);
496 }
497
498 @Override
499 public boolean onPreDraw() {
500 mRecentsView.getViewTreeObserver().removeOnPreDrawListener(this);
501 // We post to make sure that this information is delivered after this traversals is
502 // finished.
503 mRecentsView.post(new Runnable() {
504 @Override
505 public void run() {
506 Recents.getSystemServices().endProlongedAnimations();
507 }
508 });
509 return true;
510 }
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900511
512 private void updatePipUI() {
Jaewan Kim8f584b82016-03-22 22:16:59 +0900513 if (mPipManager.isPipShown()) {
Jaewan Kima0d4d252016-03-31 13:37:10 +0900514 mPipView.setVisibility(View.VISIBLE);
515 mPipView.setOnFocusChangeListener(mPipViewFocusChangeListener);
516 mPipView.requestFocus();
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900517 } else {
Jaewan Kima0d4d252016-03-31 13:37:10 +0900518 mPipView.setVisibility(View.GONE);
519 mPipRecentsOverlayManager.removePipRecentsOverlayView();
520 mRecentsFocusAnimationHolder.reset();
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900521 }
522 }
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800523}