blob: 134b90c99fff2a6520550bf5e63d82165cbb6567 [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
Jaewan Kim8f584b82016-03-22 22:16:59 +090018import android.animation.AnimatorInflater;
19import android.animation.AnimatorSet;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080020import android.app.Activity;
21import android.app.ActivityOptions;
22import android.content.Intent;
Jaewan Kimc92a7d12016-02-15 17:33:25 -080023import android.graphics.Rect;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080024import android.os.Bundle;
25import android.os.UserHandle;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080026import android.util.Log;
27import android.view.KeyEvent;
28import android.view.View;
29import android.view.ViewTreeObserver.OnPreDrawListener;
30import android.view.WindowManager;
Jaewan Kimc92a7d12016-02-15 17:33:25 -080031import android.widget.FrameLayout.LayoutParams;
Winsonc0d70582016-01-29 10:24:39 -080032
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080033import com.android.systemui.R;
Winsonc0d70582016-01-29 10:24:39 -080034import com.android.systemui.recents.Recents;
35import com.android.systemui.recents.RecentsActivityLaunchState;
36import com.android.systemui.recents.RecentsConfiguration;
37import com.android.systemui.recents.RecentsImpl;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080038import com.android.systemui.recents.events.EventBus;
39import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
40import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
41import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
42import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
43import com.android.systemui.recents.events.activity.HideRecentsEvent;
44import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080045import com.android.systemui.recents.events.activity.ToggleRecentsEvent;
46import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
47import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent;
48import com.android.systemui.recents.events.ui.DeleteTaskDataEvent;
49import com.android.systemui.recents.events.ui.UpdateFreeformTaskViewVisibilityEvent;
50import com.android.systemui.recents.events.ui.UserInteractionEvent;
51import com.android.systemui.recents.events.ui.focus.DismissFocusedTaskViewEvent;
52import com.android.systemui.recents.misc.SystemServicesProxy;
53import com.android.systemui.recents.model.RecentsPackageMonitor;
54import com.android.systemui.recents.model.RecentsTaskLoadPlan;
55import com.android.systemui.recents.model.RecentsTaskLoader;
56import com.android.systemui.recents.model.Task;
57import com.android.systemui.recents.model.TaskStack;
58import com.android.systemui.recents.tv.views.RecentsTvView;
59import com.android.systemui.recents.tv.views.TaskStackHorizontalViewAdapter;
60import com.android.systemui.statusbar.BaseStatusBar;
61import com.android.systemui.tv.pip.PipManager;
Jaewan Kim8f584b82016-03-22 22:16:59 +090062import com.android.systemui.tv.pip.PipControlsView;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080063
64import java.util.ArrayList;
Sid Soundararajan1008cc22016-02-01 11:11:14 -080065import java.util.Collections;
66import java.util.List;
Jaewan Kimc92a7d12016-02-15 17:33:25 -080067
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080068/**
69 * The main TV recents activity started by the RecentsImpl.
70 */
71public class RecentsTvActivity extends Activity implements OnPreDrawListener {
72 private final static String TAG = "RecentsTvActivity";
73 private final static boolean DEBUG = false;
74
75 public final static int EVENT_BUS_PRIORITY = Recents.EVENT_BUS_PRIORITY + 1;
76
77 private boolean mFinishedOnStartup;
78 private RecentsPackageMonitor mPackageMonitor;
79 private long mLastTabKeyEventTime;
80 private boolean mIgnoreAltTabRelease;
81
82 private RecentsTvView mRecentsView;
Jaewan Kim8f584b82016-03-22 22:16:59 +090083 private PipControlsView mPipControlsView;
Jaewan Kimc92a7d12016-02-15 17:33:25 -080084 private View mPipShadeView;
Jaewan Kim8f584b82016-03-22 22:16:59 +090085 private AnimatorSet mPipControlsViewFadeInAnimator;
86 private AnimatorSet mPipControlsViewFadeOutAnimator;
Sid Soundararajanb58c46a2016-01-26 15:39:27 -080087 private TaskStackHorizontalViewAdapter mTaskStackViewAdapter;
88 private FinishRecentsRunnable mFinishLaunchHomeRunnable;
89
Jaewan Kimc92a7d12016-02-15 17:33:25 -080090 private PipManager mPipManager;
91 private PipManager.Listener mPipListener = new PipManager.Listener() {
92 @Override
Jaewan Kim82ac50d2016-03-21 17:34:28 +090093 public void onPipEntered() {
94 updatePipUI();
95 }
96
97 @Override
Jaewan Kimc92a7d12016-02-15 17:33:25 -080098 public void onPipActivityClosed() {
Jaewan Kim82ac50d2016-03-21 17:34:28 +090099 updatePipUI();
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800100 }
101
102 @Override
Jaewan Kim8f584b82016-03-22 22:16:59 +0900103 public void onShowPipMenu() {
104 updatePipUI();
105 }
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800106
107 @Override
Youngsang Cho72a67c932016-03-24 13:40:51 -0700108 public void onMoveToFullscreen() {
109 // Recents should be dismissed when PIP moves to fullscreen. If not, Recents will
110 // be unnecessarily shown in the scenario: PIP->Fullscreen->PIP.
111 dismissRecentsToLaunchTargetTaskOrHome();
112 }
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800113
114 @Override
115 public void onPipResizeAboutToStart() { }
Jaewan Kim62338192016-02-25 10:00:05 -0800116
117 @Override
118 public void onMediaControllerChanged() { }
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800119 };
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800120
121 /**
122 * A common Runnable to finish Recents by launching Home with an animation depending on the
123 * last activity launch state. Generally we always launch home when we exit Recents rather than
124 * just finishing the activity since we don't know what is behind Recents in the task stack.
125 */
126 class FinishRecentsRunnable implements Runnable {
127 Intent mLaunchIntent;
128
129 /**
130 * Creates a finish runnable that starts the specified intent.
131 */
132 public FinishRecentsRunnable(Intent launchIntent) {
133 mLaunchIntent = launchIntent;
134 }
135
136 @Override
137 public void run() {
138 try {
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800139 ActivityOptions opts = ActivityOptions.makeCustomAnimation(RecentsTvActivity.this,
Winson008ee15f2016-03-18 17:17:25 -0700140 R.anim.recents_to_launcher_enter, R.anim.recents_to_launcher_exit);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800141 startActivityAsUser(mLaunchIntent, opts.toBundle(), UserHandle.CURRENT);
142 } catch (Exception e) {
143 Log.e(TAG, getString(R.string.recents_launch_error_message, "Home"), e);
144 }
145 }
146 }
147
148 private void updateRecentsTasks() {
149 RecentsTaskLoader loader = Recents.getTaskLoader();
150 RecentsTaskLoadPlan plan = RecentsImpl.consumeInstanceLoadPlan();
151 if (plan == null) {
152 plan = loader.createLoadPlan(this);
153 }
154
155 RecentsConfiguration config = Recents.getConfiguration();
156 RecentsActivityLaunchState launchState = config.getLaunchState();
157 if (!plan.hasTasks()) {
158 loader.preloadTasks(plan, -1, launchState.launchedFromHome);
159 }
160 TaskStack stack = plan.getTaskStack();
161 RecentsTaskLoadPlan.Options loadOpts = new RecentsTaskLoadPlan.Options();
162 loadOpts.runningTaskId = launchState.launchedToTaskId;
163 loadOpts.numVisibleTasks = stack.getStackTaskCount();
164 loadOpts.numVisibleTaskThumbnails = stack.getStackTaskCount();
165 loader.loadTasks(this, plan, loadOpts);
166
167
168 mRecentsView.setTaskStack(stack);
Sid Soundararajan1008cc22016-02-01 11:11:14 -0800169 List stackTasks = stack.getStackTasks();
170 Collections.reverse(stackTasks);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800171 if (mTaskStackViewAdapter == null) {
Sid Soundararajan1008cc22016-02-01 11:11:14 -0800172 mTaskStackViewAdapter = new TaskStackHorizontalViewAdapter(stackTasks);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800173 mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
174 } else {
Sid Soundararajan1008cc22016-02-01 11:11:14 -0800175 mTaskStackViewAdapter.setNewStackTasks(stackTasks);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800176 }
177
178 if (launchState.launchedToTaskId != -1) {
179 ArrayList<Task> tasks = stack.getStackTasks();
180 int taskCount = tasks.size();
181 for (int i = 0; i < taskCount; i++) {
182 Task t = tasks.get(i);
183 if (t.key.id == launchState.launchedToTaskId) {
184 t.isLaunchTarget = true;
185 break;
186 }
187 }
188 }
189 }
190
191 boolean dismissRecentsToLaunchTargetTaskOrHome() {
192 SystemServicesProxy ssp = Recents.getSystemServices();
193 if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
194 // If we have a focused Task, launch that Task now
195 if (mRecentsView.launchPreviousTask()) return true;
196 // If none of the other cases apply, then just go Home
197 dismissRecentsToHome(true /* animateTaskViews */);
198 }
199 return false;
200 }
201
202 boolean dismissRecentsToFocusedTaskOrHome() {
203 SystemServicesProxy ssp = Recents.getSystemServices();
204 if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
205 // If we have a focused Task, launch that Task now
206 if (mRecentsView.launchFocusedTask()) return true;
207 // If none of the other cases apply, then just go Home
208 dismissRecentsToHome(true /* animateTaskViews */);
209 return true;
210 }
211 return false;
212 }
213
214 void dismissRecentsToHome(boolean animateTaskViews) {
215 DismissRecentsToHomeAnimationStarted dismissEvent =
216 new DismissRecentsToHomeAnimationStarted(animateTaskViews);
217 dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
218 dismissEvent.addPostAnimationCallback(new Runnable() {
219 @Override
220 public void run() {
221 Recents.getSystemServices().sendCloseSystemWindows(
222 BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY);
223 }
224 });
225 EventBus.getDefault().send(dismissEvent);
226 }
227
228 boolean dismissRecentsToHomeIfVisible(boolean animated) {
229 SystemServicesProxy ssp = Recents.getSystemServices();
230 if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
231 // Return to Home
232 dismissRecentsToHome(animated);
233 return true;
234 }
235 return false;
236 }
237
238 @Override
239 public void onCreate(Bundle savedInstanceState) {
240 super.onCreate(savedInstanceState);
241 mFinishedOnStartup = false;
242
243 // In the case that the activity starts up before the Recents component has initialized
244 // (usually when debugging/pushing the SysUI apk), just finish this activity.
245 SystemServicesProxy ssp = Recents.getSystemServices();
246 if (ssp == null) {
247 mFinishedOnStartup = true;
248 finish();
249 return;
250 }
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800251 mPipManager = PipManager.getInstance();
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800252
253 // Register this activity with the event bus
254 EventBus.getDefault().register(this, EVENT_BUS_PRIORITY);
255
256 mPackageMonitor = new RecentsPackageMonitor();
257 mPackageMonitor.register(this);
258
259 // Set the Recents layout
260 setContentView(R.layout.recents_on_tv);
261
262 mRecentsView = (RecentsTvView) findViewById(R.id.recents_view);
263 mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
264 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
265 View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
Jaewan Kim8f584b82016-03-22 22:16:59 +0900266 mPipControlsView = (PipControlsView) findViewById(R.id.pip_controls);
267 mPipControlsView.setListener(new PipControlsView.Listener() {
268 @Override
269 public void onClosed() {
270 dismissRecentsToLaunchTargetTaskOrHome();
271 }
272 });
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800273 mPipShadeView = findViewById(R.id.pip_shade);
Jaewan Kim8f584b82016-03-22 22:16:59 +0900274
275 mPipControlsViewFadeInAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(this,
276 R.anim.tv_pip_controls_fade_in);
277 mPipControlsViewFadeInAnimator.setTarget(mPipControlsView);
278 mPipControlsViewFadeOutAnimator = (AnimatorSet) AnimatorInflater.loadAnimator(this,
279 R.anim.tv_pip_controls_fade_out);
280 mPipControlsViewFadeOutAnimator.setTarget(mPipControlsView);
281
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800282 getWindow().getAttributes().privateFlags |=
283 WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
284
285 // Create the home intent runnable
286 Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
287 homeIntent.addCategory(Intent.CATEGORY_HOME);
288 homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
289 Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
290 mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent);
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900291
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900292 updatePipUI();
293 mPipManager.addListener(mPipListener);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800294 }
295
296 @Override
297 protected void onNewIntent(Intent intent) {
298 super.onNewIntent(intent);
299 setIntent(intent);
300 }
301
302 @Override
303 protected void onStart() {
304 super.onStart();
305
306 // Update the recent tasks
307 updateRecentsTasks();
308
309 // If this is a new instance from a configuration change, then we have to manually trigger
310 // the enter animation state, or if recents was relaunched by AM, without going through
311 // the normal mechanisms
312 RecentsConfiguration config = Recents.getConfiguration();
313 RecentsActivityLaunchState launchState = config.getLaunchState();
314 boolean wasLaunchedByAm = !launchState.launchedFromHome &&
Winsone693aaf2016-03-01 12:05:59 -0800315 !launchState.launchedFromApp;
Winsona1ededd2016-03-25 12:23:12 -0700316 if (wasLaunchedByAm) {
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800317 EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
318 }
319
320 // Notify that recents is now visible
321 SystemServicesProxy ssp = Recents.getSystemServices();
Winson88737542016-02-17 13:27:33 -0800322 EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, true));
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800323
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800324 mPipManager.onRecentsStarted();
325 // Give focus to the recents row whenever its visible to an user.
326 mRecentsView.requestFocus();
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800327 }
328
329 @Override
330 public void onEnterAnimationComplete() {
331 super.onEnterAnimationComplete();
332 EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
333 }
334
335 @Override
336 protected void onStop() {
337 super.onStop();
338
Jaewan Kimc92a7d12016-02-15 17:33:25 -0800339 mPipManager.onRecentsStopped();
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800340 mIgnoreAltTabRelease = false;
341 // Notify that recents is now hidden
Winson88737542016-02-17 13:27:33 -0800342 EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800343
344 // Workaround for b/22542869, if the RecentsActivity is started again, but without going
345 // through SystemUI, we need to reset the config launch flags to ensure that we do not
346 // wait on the system to send a signal that was never queued.
347 RecentsConfiguration config = Recents.getConfiguration();
348 RecentsActivityLaunchState launchState = config.getLaunchState();
Jorim Jaggie161f082016-02-05 14:26:16 -0800349 launchState.reset();
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800350 }
351
352 @Override
353 protected void onDestroy() {
354 super.onDestroy();
355
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900356 mPipManager.removeListener(mPipListener);
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800357 // In the case that the activity finished on startup, just skip the unregistration below
358 if (mFinishedOnStartup) {
359 return;
360 }
361
362 // Unregister any broadcast receivers for the task loader
363 mPackageMonitor.unregister();
364
365 EventBus.getDefault().unregister(this);
366 }
367
368 @Override
369 public void onTrimMemory(int level) {
370 RecentsTaskLoader loader = Recents.getTaskLoader();
371 if (loader != null) {
372 loader.onTrimMemory(level);
373 }
374 }
375
376 @Override
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800377 public boolean onKeyDown(int keyCode, KeyEvent event) {
378 switch (keyCode) {
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800379 case KeyEvent.KEYCODE_DEL:
380 case KeyEvent.KEYCODE_FORWARD_DEL: {
381 EventBus.getDefault().send(new DismissFocusedTaskViewEvent());
382 return true;
383 }
384 default:
385 break;
386 }
387 return super.onKeyDown(keyCode, event);
388 }
389
390 @Override
391 public void onUserInteraction() {
392 EventBus.getDefault().send(new UserInteractionEvent());
393 }
394
395 @Override
396 public void onBackPressed() {
397 // Back behaves like the recents button so just trigger a toggle event
398 EventBus.getDefault().send(new ToggleRecentsEvent());
399 }
400
401 /**** EventBus events ****/
402
403 public final void onBusEvent(ToggleRecentsEvent event) {
404 RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
405 if (launchState.launchedFromHome) {
406 dismissRecentsToHome(true /* animateTaskViews */);
407 } else {
408 dismissRecentsToLaunchTargetTaskOrHome();
409 }
410 }
411
412 public final void onBusEvent(HideRecentsEvent event) {
413 if (event.triggeredFromAltTab) {
414 // If we are hiding from releasing Alt-Tab, dismiss Recents to the focused app
415 if (!mIgnoreAltTabRelease) {
416 dismissRecentsToFocusedTaskOrHome();
417 }
418 } else if (event.triggeredFromHomeKey) {
419 dismissRecentsToHome(true /* animateTaskViews */);
420 } else {
421 // Do nothing
422 }
423 }
424
425 public final void onBusEvent(EnterRecentsWindowLastAnimationFrameEvent event) {
426 EventBus.getDefault().send(new UpdateFreeformTaskViewVisibilityEvent(true));
427 mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
428 mRecentsView.invalidate();
429 }
430
431 public final void onBusEvent(CancelEnterRecentsWindowAnimationEvent event) {
432 RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
433 int launchToTaskId = launchState.launchedToTaskId;
434 if (launchToTaskId != -1 &&
435 (event.launchTask == null || launchToTaskId != event.launchTask.key.id)) {
436 SystemServicesProxy ssp = Recents.getSystemServices();
437 ssp.cancelWindowTransition(launchState.launchedToTaskId);
438 ssp.cancelThumbnailTransition(getTaskId());
439 }
440 }
441
442 public final void onBusEvent(DeleteTaskDataEvent event) {
443 // Remove any stored data from the loader
444 RecentsTaskLoader loader = Recents.getTaskLoader();
445 loader.deleteTaskData(event.task, false);
446
447 // Remove the task from activity manager
448 SystemServicesProxy ssp = Recents.getSystemServices();
449 ssp.removeTask(event.task.key.id);
450 }
451
452 public final void onBusEvent(AllTaskViewsDismissedEvent event) {
453 SystemServicesProxy ssp = Recents.getSystemServices();
454 if (ssp.hasDockedTask()) {
455 mRecentsView.showEmptyView();
456 } else {
457 // Just go straight home (no animation necessary because there are no more task views)
458 dismissRecentsToHome(false /* animateTaskViews */);
459 }
460 }
461
462 public final void onBusEvent(LaunchTaskFailedEvent event) {
463 // Return to Home
464 dismissRecentsToHome(true /* animateTaskViews */);
465 }
466
467 @Override
468 public boolean onPreDraw() {
469 mRecentsView.getViewTreeObserver().removeOnPreDrawListener(this);
470 // We post to make sure that this information is delivered after this traversals is
471 // finished.
472 mRecentsView.post(new Runnable() {
473 @Override
474 public void run() {
475 Recents.getSystemServices().endProlongedAnimations();
476 }
477 });
478 return true;
479 }
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900480
481 private void updatePipUI() {
Jaewan Kim8f584b82016-03-22 22:16:59 +0900482 if (mPipManager.isPipShown()) {
483 mPipControlsView.setAlpha(0);
484 mPipControlsView.setVisibility(View.VISIBLE);
485 mPipShadeView.setVisibility(View.INVISIBLE);
486 mPipControlsView.setOnChildFocusChangeListener(new View.OnFocusChangeListener() {
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900487 @Override
488 public void onFocusChange(View v, boolean hasFocus) {
489 mPipManager.onPipViewFocusChangedInRecents(hasFocus);
Jaewan Kim8f584b82016-03-22 22:16:59 +0900490 if (hasFocus) {
491 mPipControlsViewFadeInAnimator.start();
492 } else {
493 mPipControlsViewFadeOutAnimator.start();
494 }
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900495 mPipShadeView.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
496 }
497 });
498 mPipShadeView.setVisibility(View.GONE);
499 } else {
Jaewan Kim8f584b82016-03-22 22:16:59 +0900500 mPipControlsView.setVisibility(View.GONE);
Jaewan Kim82ac50d2016-03-21 17:34:28 +0900501 mPipShadeView.setVisibility(View.GONE);
502 }
503 }
Sid Soundararajanb58c46a2016-01-26 15:39:27 -0800504}