| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.android.wm.shell.pip; |
| 18 |
|
| 19 |
import static android.app.WindowConfiguration.ROTATION_UNDEFINED; |
| 20 |
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; |
| 21 |
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; |
| 22 |
import static android.util.RotationUtils.deltaRotation; |
| 23 |
import static android.util.RotationUtils.rotateBounds; |
| 24 |
import static android.view.Surface.ROTATION_270; |
| 25 |
import static android.view.Surface.ROTATION_90; |
| 26 |
import static android.view.WindowManager.TRANSIT_CHANGE; |
| 27 |
import static android.view.WindowManager.TRANSIT_OPEN; |
| 28 |
import static android.view.WindowManager.TRANSIT_PIP; |
| 29 |
import static android.view.WindowManager.transitTypeToString; |
| 30 |
import static android.window.TransitionInfo.FLAG_IS_DISPLAY; |
| 31 |
|
| 32 |
import static com.android.wm.shell.pip.PipAnimationController.ANIM_TYPE_ALPHA; |
| 33 |
import static com.android.wm.shell.pip.PipAnimationController.ANIM_TYPE_BOUNDS; |
| 34 |
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP; |
| 35 |
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_SAME; |
| 36 |
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP; |
| 37 |
import static com.android.wm.shell.pip.PipAnimationController.isInPipDirection; |
| 38 |
import static com.android.wm.shell.pip.PipAnimationController.isOutPipDirection; |
| 39 |
import static com.android.wm.shell.pip.PipTransitionState.ENTERED_PIP; |
| 40 |
import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP; |
| 41 |
import static com.android.wm.shell.transition.Transitions.TRANSIT_EXIT_PIP_TO_SPLIT; |
| 42 |
import static com.android.wm.shell.transition.Transitions.TRANSIT_REMOVE_PIP; |
| 43 |
import static com.android.wm.shell.transition.Transitions.isOpeningType; |
| 44 |
|
| 45 |
import android.animation.Animator; |
| 46 |
import android.app.ActivityManager; |
| 47 |
import android.app.TaskInfo; |
| 48 |
import android.content.Context; |
| 49 |
import android.graphics.Matrix; |
| 50 |
import android.graphics.Point; |
| 51 |
import android.graphics.Rect; |
| 52 |
import android.os.IBinder; |
| 53 |
import android.view.Surface; |
| 54 |
import android.view.SurfaceControl; |
| 55 |
import android.view.WindowManager; |
| 56 |
import android.window.TransitionInfo; |
| 57 |
import android.window.TransitionRequestInfo; |
| 58 |
import android.window.WindowContainerToken; |
| 59 |
import android.window.WindowContainerTransaction; |
| 60 |
|
| 61 |
import androidx.annotation.NonNull; |
| 62 |
import androidx.annotation.Nullable; |
| 63 |
|
| 64 |
import com.android.internal.protolog.common.ProtoLog; |
| 65 |
import com.android.wm.shell.R; |
| 66 |
import com.android.wm.shell.ShellTaskOrganizer; |
| 67 |
import com.android.wm.shell.protolog.ShellProtoLogGroup; |
| 68 |
import com.android.wm.shell.splitscreen.SplitScreenController; |
| 69 |
import com.android.wm.shell.sysui.ShellInit; |
| 70 |
import com.android.wm.shell.transition.CounterRotatorHelper; |
| 71 |
import com.android.wm.shell.transition.Transitions; |
| 72 |
|
| 73 |
import java.util.Optional; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
public class PipTransition extends PipTransitionController { |
| 80 |
|
| 81 |
private static final String TAG = PipTransition.class.getSimpleName(); |
| 82 |
|
| 83 |
private final Context mContext; |
| 84 |
private final PipTransitionState mPipTransitionState; |
| 85 |
private final int mEnterExitAnimationDuration; |
| 86 |
private final PipSurfaceTransactionHelper mSurfaceTransactionHelper; |
| 87 |
private final Optional<SplitScreenController> mSplitScreenOptional; |
| 88 |
private @PipAnimationController.AnimationType int mOneShotAnimationType = ANIM_TYPE_BOUNDS; |
| 89 |
private Transitions.TransitionFinishCallback mFinishCallback; |
| 90 |
private SurfaceControl.Transaction mFinishTransaction; |
| 91 |
private final Rect mExitDestinationBounds = new Rect(); |
| 92 |
@Nullable |
| 93 |
private IBinder mExitTransition; |
| 94 |
private IBinder mRequestedEnterTransition; |
| 95 |
private WindowContainerToken mRequestedEnterTask; |
| 96 |
|
| 97 |
@Nullable |
| 98 |
private WindowContainerToken mCurrentPipTaskToken; |
| 99 |
|
| 100 |
private boolean mInFixedRotation; |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
@Surface.Rotation |
| 106 |
private int mEndFixedRotation; |
| 107 |
|
| 108 |
private boolean mHasFadeOut; |
| 109 |
|
| 110 |
public PipTransition(Context context, |
| 111 |
@NonNull ShellInit shellInit, |
| 112 |
@NonNull ShellTaskOrganizer shellTaskOrganizer, |
| 113 |
@NonNull Transitions transitions, |
| 114 |
PipBoundsState pipBoundsState, |
| 115 |
PipTransitionState pipTransitionState, |
| 116 |
PipMenuController pipMenuController, |
| 117 |
PipBoundsAlgorithm pipBoundsAlgorithm, |
| 118 |
PipAnimationController pipAnimationController, |
| 119 |
PipSurfaceTransactionHelper pipSurfaceTransactionHelper, |
| 120 |
Optional<SplitScreenController> splitScreenOptional) { |
| 121 |
super(shellInit, shellTaskOrganizer, transitions, pipBoundsState, pipMenuController, |
| 122 |
pipBoundsAlgorithm, pipAnimationController); |
| 123 |
mContext = context; |
| 124 |
mPipTransitionState = pipTransitionState; |
| 125 |
mEnterExitAnimationDuration = context.getResources() |
| 126 |
.getInteger(R.integer.config_pipResizeAnimationDuration); |
| 127 |
mSurfaceTransactionHelper = pipSurfaceTransactionHelper; |
| 128 |
mSplitScreenOptional = splitScreenOptional; |
| 129 |
} |
| 130 |
|
| 131 |
@Override |
| 132 |
public void setIsFullAnimation(boolean isFullAnimation) { |
| 133 |
setOneShotAnimationType(isFullAnimation ? ANIM_TYPE_BOUNDS : ANIM_TYPE_ALPHA); |
| 134 |
} |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
private void setOneShotAnimationType(@PipAnimationController.AnimationType int animationType) { |
| 142 |
mOneShotAnimationType = animationType; |
| 143 |
} |
| 144 |
|
| 145 |
@Override |
| 146 |
public void startExitTransition(int type, WindowContainerTransaction out, |
| 147 |
@Nullable Rect destinationBounds) { |
| 148 |
if (destinationBounds != null) { |
| 149 |
mExitDestinationBounds.set(destinationBounds); |
| 150 |
} |
| 151 |
final PipAnimationController.PipTransitionAnimator animator = |
| 152 |
mPipAnimationController.getCurrentAnimator(); |
| 153 |
if (animator != null && animator.isRunning()) { |
| 154 |
animator.cancel(); |
| 155 |
} |
| 156 |
mExitTransition = mTransitions.startTransition(type, out, this); |
| 157 |
} |
| 158 |
|
| 159 |
@Override |
| 160 |
public boolean startAnimation(@NonNull IBinder transition, |
| 161 |
@NonNull TransitionInfo info, |
| 162 |
@NonNull SurfaceControl.Transaction startTransaction, |
| 163 |
@NonNull SurfaceControl.Transaction finishTransaction, |
| 164 |
@NonNull Transitions.TransitionFinishCallback finishCallback) { |
| 165 |
final TransitionInfo.Change currentPipTaskChange = findCurrentPipTaskChange(info); |
| 166 |
final TransitionInfo.Change fixedRotationChange = findFixedRotationChange(info); |
| 167 |
mInFixedRotation = fixedRotationChange != null; |
| 168 |
mEndFixedRotation = mInFixedRotation |
| 169 |
? fixedRotationChange.getEndFixedRotation() |
| 170 |
: ROTATION_UNDEFINED; |
| 171 |
|
| 172 |
|
| 173 |
final int type = info.getType(); |
| 174 |
if (transition.equals(mExitTransition)) { |
| 175 |
mExitDestinationBounds.setEmpty(); |
| 176 |
mExitTransition = null; |
| 177 |
mHasFadeOut = false; |
| 178 |
if (mFinishCallback != null) { |
| 179 |
callFinishCallback(null ); |
| 180 |
mFinishTransaction = null; |
| 181 |
throw new RuntimeException("Previous callback not called, aborting exit PIP."); |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
final TaskInfo pipTaskInfo = currentPipTaskChange != null |
| 189 |
? currentPipTaskChange.getTaskInfo() |
| 190 |
: mPipOrganizer.getTaskInfo(); |
| 191 |
if (pipTaskInfo == null) { |
| 192 |
throw new RuntimeException("Cannot find the pip task for exit-pip transition."); |
| 193 |
} |
| 194 |
|
| 195 |
switch (type) { |
| 196 |
case TRANSIT_EXIT_PIP: |
| 197 |
startExitAnimation(info, startTransaction, finishTransaction, finishCallback, |
| 198 |
pipTaskInfo, currentPipTaskChange); |
| 199 |
break; |
| 200 |
case TRANSIT_EXIT_PIP_TO_SPLIT: |
| 201 |
startExitToSplitAnimation(info, startTransaction, finishTransaction, |
| 202 |
finishCallback, pipTaskInfo); |
| 203 |
break; |
| 204 |
case TRANSIT_REMOVE_PIP: |
| 205 |
removePipImmediately(info, startTransaction, finishTransaction, finishCallback, |
| 206 |
pipTaskInfo); |
| 207 |
break; |
| 208 |
default: |
| 209 |
throw new IllegalStateException("mExitTransition with unexpected transit type=" |
| 210 |
+ transitTypeToString(type)); |
| 211 |
} |
| 212 |
mCurrentPipTaskToken = null; |
| 213 |
return true; |
| 214 |
} else if (transition == mRequestedEnterTransition) { |
| 215 |
mRequestedEnterTransition = null; |
| 216 |
mRequestedEnterTask = null; |
| 217 |
} |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
if (currentPipTaskChange != null |
| 223 |
&& currentPipTaskChange.getTaskInfo().getWindowingMode() != WINDOWING_MODE_PINNED) { |
| 224 |
resetPrevPip(currentPipTaskChange, startTransaction); |
| 225 |
} |
| 226 |
|
| 227 |
|
| 228 |
if (isEnteringPip(info)) { |
| 229 |
startEnterAnimation(info, startTransaction, finishTransaction, finishCallback); |
| 230 |
return true; |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
if (currentPipTaskChange != null) { |
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
if (!currentPipTaskChange.getEndAbsBounds().isEmpty()) { |
| 240 |
mPipBoundsState.setBounds(currentPipTaskChange.getEndAbsBounds()); |
| 241 |
} |
| 242 |
updatePipForUnhandledTransition(currentPipTaskChange, startTransaction, |
| 243 |
finishTransaction); |
| 244 |
} |
| 245 |
|
| 246 |
|
| 247 |
if (mPipTransitionState.isInPip() && !mInFixedRotation && mHasFadeOut) { |
| 248 |
fadeExistingPip(true ); |
| 249 |
} |
| 250 |
|
| 251 |
return false; |
| 252 |
} |
| 253 |
|
| 254 |
@Override |
| 255 |
public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, |
| 256 |
@NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget, |
| 257 |
@NonNull Transitions.TransitionFinishCallback finishCallback) { |
| 258 |
end(); |
| 259 |
} |
| 260 |
|
| 261 |
|
| 262 |
private boolean isAnimatingLocally() { |
| 263 |
return mFinishTransaction != null; |
| 264 |
} |
| 265 |
|
| 266 |
@Nullable |
| 267 |
@Override |
| 268 |
public WindowContainerTransaction handleRequest(@NonNull IBinder transition, |
| 269 |
@NonNull TransitionRequestInfo request) { |
| 270 |
if (requestHasPipEnter(request)) { |
| 271 |
WindowContainerTransaction wct = new WindowContainerTransaction(); |
| 272 |
augmentRequest(transition, request, wct); |
| 273 |
return wct; |
| 274 |
} else { |
| 275 |
return null; |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
@Override |
| 280 |
public void augmentRequest(@NonNull IBinder transition, |
| 281 |
@NonNull TransitionRequestInfo request, @NonNull WindowContainerTransaction outWCT) { |
| 282 |
if (!requestHasPipEnter(request)) { |
| 283 |
throw new IllegalStateException("Called PiP augmentRequest when request has no PiP"); |
| 284 |
} |
| 285 |
if (mOneShotAnimationType == ANIM_TYPE_ALPHA) { |
| 286 |
mRequestedEnterTransition = transition; |
| 287 |
mRequestedEnterTask = request.getTriggerTask().token; |
| 288 |
outWCT.setActivityWindowingMode(request.getTriggerTask().token, |
| 289 |
WINDOWING_MODE_UNDEFINED); |
| 290 |
final Rect destinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds(); |
| 291 |
outWCT.setBounds(request.getTriggerTask().token, destinationBounds); |
| 292 |
} |
| 293 |
} |
| 294 |
|
| 295 |
@Override |
| 296 |
public void end() { |
| 297 |
Animator animator = mPipAnimationController.getCurrentAnimator(); |
| 298 |
if (animator == null) return; |
| 299 |
animator.end(); |
| 300 |
} |
| 301 |
|
| 302 |
@Override |
| 303 |
public boolean handleRotateDisplay(int startRotation, int endRotation, |
| 304 |
WindowContainerTransaction wct) { |
| 305 |
if (mRequestedEnterTransition != null && mOneShotAnimationType == ANIM_TYPE_ALPHA) { |
| 306 |
|
| 307 |
|
| 308 |
int rotationDelta = deltaRotation(startRotation, endRotation); |
| 309 |
if (rotationDelta != Surface.ROTATION_0) { |
| 310 |
mPipBoundsState.getDisplayLayout().rotateTo(mContext.getResources(), endRotation); |
| 311 |
final Rect destinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds(); |
| 312 |
wct.setBounds(mRequestedEnterTask, destinationBounds); |
| 313 |
return true; |
| 314 |
} |
| 315 |
} |
| 316 |
return false; |
| 317 |
} |
| 318 |
|
| 319 |
@Override |
| 320 |
public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted, |
| 321 |
@Nullable SurfaceControl.Transaction finishT) { |
| 322 |
if (transition != mExitTransition) { |
| 323 |
return; |
| 324 |
} |
| 325 |
|
| 326 |
|
| 327 |
boolean cancelled = false; |
| 328 |
if (mPipAnimationController.getCurrentAnimator() != null) { |
| 329 |
mPipAnimationController.getCurrentAnimator().cancel(); |
| 330 |
cancelled = true; |
| 331 |
} |
| 332 |
|
| 333 |
mExitTransition = null; |
| 334 |
if (!cancelled || aborted) return; |
| 335 |
final ActivityManager.RunningTaskInfo taskInfo = mPipOrganizer.getTaskInfo(); |
| 336 |
if (taskInfo != null) { |
| 337 |
startExpandAnimation(taskInfo, mPipOrganizer.getSurfaceControl(), |
| 338 |
mPipBoundsState.getBounds(), mPipBoundsState.getBounds(), |
| 339 |
new Rect(mExitDestinationBounds), Surface.ROTATION_0); |
| 340 |
} |
| 341 |
mExitDestinationBounds.setEmpty(); |
| 342 |
mCurrentPipTaskToken = null; |
| 343 |
} |
| 344 |
|
| 345 |
@Override |
| 346 |
public void onFinishResize(TaskInfo taskInfo, Rect destinationBounds, |
| 347 |
@PipAnimationController.TransitionDirection int direction, |
| 348 |
@Nullable SurfaceControl.Transaction tx) { |
| 349 |
final boolean enteringPip = isInPipDirection(direction); |
| 350 |
if (enteringPip) { |
| 351 |
mPipTransitionState.setTransitionState(ENTERED_PIP); |
| 352 |
} |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
if ((mExitTransition == null || isAnimatingLocally()) && mFinishCallback != null) { |
| 358 |
WindowContainerTransaction wct = null; |
| 359 |
if (isOutPipDirection(direction)) { |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
if (tx != null && !mInFixedRotation) { |
| 365 |
mFinishTransaction.merge(tx); |
| 366 |
} |
| 367 |
} else { |
| 368 |
wct = new WindowContainerTransaction(); |
| 369 |
if (isInPipDirection(direction)) { |
| 370 |
|
| 371 |
|
| 372 |
wct.setActivityWindowingMode(taskInfo.token, WINDOWING_MODE_UNDEFINED); |
| 373 |
wct.scheduleFinishEnterPip(taskInfo.token, destinationBounds); |
| 374 |
wct.setBounds(taskInfo.token, destinationBounds); |
| 375 |
} else { |
| 376 |
wct.setBounds(taskInfo.token, null ); |
| 377 |
} |
| 378 |
if (tx != null) { |
| 379 |
wct.setBoundsChangeTransaction(taskInfo.token, tx); |
| 380 |
} |
| 381 |
} |
| 382 |
final SurfaceControl leash = mPipOrganizer.getSurfaceControl(); |
| 383 |
final int displayRotation = taskInfo.getConfiguration().windowConfiguration |
| 384 |
.getDisplayRotation(); |
| 385 |
if (enteringPip && mInFixedRotation && mEndFixedRotation != displayRotation |
| 386 |
&& leash != null && leash.isValid()) { |
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
final Rect displayBounds = mPipBoundsState.getDisplayBounds(); |
| 391 |
final Rect finishBounds = new Rect(destinationBounds); |
| 392 |
rotateBounds(finishBounds, displayBounds, mEndFixedRotation, displayRotation); |
| 393 |
mSurfaceTransactionHelper.crop(mFinishTransaction, leash, finishBounds); |
| 394 |
} |
| 395 |
mFinishTransaction = null; |
| 396 |
callFinishCallback(wct); |
| 397 |
} |
| 398 |
finishResizeForMenu(destinationBounds); |
| 399 |
} |
| 400 |
|
| 401 |
private void callFinishCallback(WindowContainerTransaction wct) { |
| 402 |
|
| 403 |
|
| 404 |
final Transitions.TransitionFinishCallback finishCallback = mFinishCallback; |
| 405 |
mFinishCallback = null; |
| 406 |
finishCallback.onTransitionFinished(wct, null ); |
| 407 |
} |
| 408 |
|
| 409 |
@Override |
| 410 |
public void forceFinishTransition() { |
| 411 |
if (mFinishCallback == null) return; |
| 412 |
mFinishCallback.onTransitionFinished(null , null ); |
| 413 |
mFinishCallback = null; |
| 414 |
mFinishTransaction = null; |
| 415 |
} |
| 416 |
|
| 417 |
@Override |
| 418 |
public void onFixedRotationStarted() { |
| 419 |
|
| 420 |
|
| 421 |
if (mPipTransitionState.getTransitionState() == ENTERED_PIP && !mHasFadeOut) { |
| 422 |
|
| 423 |
fadeExistingPip(false ); |
| 424 |
} |
| 425 |
} |
| 426 |
|
| 427 |
@Nullable |
| 428 |
private TransitionInfo.Change findCurrentPipTaskChange(@NonNull TransitionInfo info) { |
| 429 |
if (mCurrentPipTaskToken == null) { |
| 430 |
return null; |
| 431 |
} |
| 432 |
for (int i = info.getChanges().size() - 1; i >= 0; --i) { |
| 433 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 434 |
if (mCurrentPipTaskToken.equals(change.getContainer())) { |
| 435 |
return change; |
| 436 |
} |
| 437 |
} |
| 438 |
return null; |
| 439 |
} |
| 440 |
|
| 441 |
@Nullable |
| 442 |
private TransitionInfo.Change findFixedRotationChange(@NonNull TransitionInfo info) { |
| 443 |
for (int i = info.getChanges().size() - 1; i >= 0; --i) { |
| 444 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 445 |
if (change.getEndFixedRotation() != ROTATION_UNDEFINED) { |
| 446 |
return change; |
| 447 |
} |
| 448 |
} |
| 449 |
return null; |
| 450 |
} |
| 451 |
|
| 452 |
private void startExitAnimation(@NonNull TransitionInfo info, |
| 453 |
@NonNull SurfaceControl.Transaction startTransaction, |
| 454 |
@NonNull SurfaceControl.Transaction finishTransaction, |
| 455 |
@NonNull Transitions.TransitionFinishCallback finishCallback, |
| 456 |
@NonNull TaskInfo taskInfo, @Nullable TransitionInfo.Change pipTaskChange) { |
| 457 |
TransitionInfo.Change pipChange = pipTaskChange; |
| 458 |
if (mCurrentPipTaskToken == null) { |
| 459 |
ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, |
| 460 |
"%s: There is no existing PiP Task for TRANSIT_EXIT_PIP", TAG); |
| 461 |
} else if (pipChange == null) { |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
for (int i = info.getChanges().size() - 1; i >= 0; --i) { |
| 466 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 467 |
if (mCurrentPipTaskToken.equals(change.getLastParent())) { |
| 468 |
|
| 469 |
pipChange = change; |
| 470 |
break; |
| 471 |
} |
| 472 |
} |
| 473 |
} |
| 474 |
if (pipChange == null) { |
| 475 |
ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, |
| 476 |
"%s: No window of exiting PIP is found. Can't play expand animation", TAG); |
| 477 |
removePipImmediately(info, startTransaction, finishTransaction, finishCallback, |
| 478 |
taskInfo); |
| 479 |
return; |
| 480 |
} |
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
final SurfaceControl pipLeash = pipChange.getLeash(); |
| 487 |
startTransaction.reparent(pipLeash, info.getRootLeash()); |
| 488 |
startTransaction.setLayer(pipLeash, Integer.MAX_VALUE); |
| 489 |
|
| 490 |
final Point offset = info.getRootOffset(); |
| 491 |
final Rect currentBounds = mPipBoundsState.getBounds(); |
| 492 |
currentBounds.offset(-offset.x, -offset.y); |
| 493 |
startTransaction.setPosition(pipLeash, currentBounds.left, currentBounds.top); |
| 494 |
|
| 495 |
mFinishCallback = (wct, wctCB) -> { |
| 496 |
mPipOrganizer.onExitPipFinished(taskInfo); |
| 497 |
finishCallback.onTransitionFinished(wct, wctCB); |
| 498 |
}; |
| 499 |
mFinishTransaction = finishTransaction; |
| 500 |
|
| 501 |
|
| 502 |
if (Transitions.SHELL_TRANSITIONS_ROTATION) { |
| 503 |
TransitionInfo.Change displayRotationChange = null; |
| 504 |
for (int i = info.getChanges().size() - 1; i >= 0; --i) { |
| 505 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 506 |
if (change.getMode() == TRANSIT_CHANGE |
| 507 |
&& (change.getFlags() & FLAG_IS_DISPLAY) != 0 |
| 508 |
&& change.getStartRotation() != change.getEndRotation()) { |
| 509 |
displayRotationChange = change; |
| 510 |
break; |
| 511 |
} |
| 512 |
} |
| 513 |
if (displayRotationChange != null) { |
| 514 |
|
| 515 |
startExpandAndRotationAnimation(info, startTransaction, finishTransaction, |
| 516 |
displayRotationChange, taskInfo, pipChange, offset); |
| 517 |
return; |
| 518 |
} |
| 519 |
} |
| 520 |
|
| 521 |
|
| 522 |
final Rect destinationBounds = new Rect(pipChange.getEndAbsBounds()); |
| 523 |
destinationBounds.offset(-offset.x, -offset.y); |
| 524 |
startTransaction.setWindowCrop(pipLeash, destinationBounds); |
| 525 |
mSurfaceTransactionHelper.scale(startTransaction, pipLeash, destinationBounds, |
| 526 |
currentBounds); |
| 527 |
startTransaction.apply(); |
| 528 |
|
| 529 |
|
| 530 |
final int rotationDelta; |
| 531 |
if (mInFixedRotation) { |
| 532 |
final int startRotation = pipChange.getStartRotation(); |
| 533 |
final int endRotation = mEndFixedRotation; |
| 534 |
rotationDelta = deltaRotation(startRotation, endRotation); |
| 535 |
final Rect endBounds = new Rect(destinationBounds); |
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
rotateBounds(endBounds, destinationBounds, rotationDelta); |
| 540 |
final int degree, x, y; |
| 541 |
if (rotationDelta == ROTATION_90) { |
| 542 |
degree = 90; |
| 543 |
x = destinationBounds.right; |
| 544 |
y = destinationBounds.top; |
| 545 |
} else { |
| 546 |
degree = -90; |
| 547 |
x = destinationBounds.left; |
| 548 |
y = destinationBounds.bottom; |
| 549 |
} |
| 550 |
mSurfaceTransactionHelper.rotateAndScaleWithCrop(finishTransaction, |
| 551 |
pipLeash, endBounds, endBounds, new Rect(), degree, x, y, |
| 552 |
true , rotationDelta == ROTATION_270 ); |
| 553 |
} else { |
| 554 |
rotationDelta = Surface.ROTATION_0; |
| 555 |
} |
| 556 |
startExpandAnimation(taskInfo, pipLeash, currentBounds, currentBounds, destinationBounds, |
| 557 |
rotationDelta); |
| 558 |
} |
| 559 |
|
| 560 |
private void startExpandAndRotationAnimation(@NonNull TransitionInfo info, |
| 561 |
@NonNull SurfaceControl.Transaction startTransaction, |
| 562 |
@NonNull SurfaceControl.Transaction finishTransaction, |
| 563 |
@NonNull TransitionInfo.Change displayRotationChange, |
| 564 |
@NonNull TaskInfo taskInfo, @NonNull TransitionInfo.Change pipChange, |
| 565 |
@NonNull Point offset) { |
| 566 |
final int rotateDelta = deltaRotation(displayRotationChange.getStartRotation(), |
| 567 |
displayRotationChange.getEndRotation()); |
| 568 |
|
| 569 |
|
| 570 |
final CounterRotatorHelper rotator = new CounterRotatorHelper(); |
| 571 |
rotator.handleClosingChanges(info, startTransaction, displayRotationChange); |
| 572 |
|
| 573 |
|
| 574 |
final Rect startBounds = new Rect(pipChange.getStartAbsBounds()); |
| 575 |
rotateBounds(startBounds, displayRotationChange.getStartAbsBounds(), rotateDelta); |
| 576 |
final Rect endBounds = new Rect(pipChange.getEndAbsBounds()); |
| 577 |
startBounds.offset(-offset.x, -offset.y); |
| 578 |
endBounds.offset(-offset.x, -offset.y); |
| 579 |
|
| 580 |
|
| 581 |
final int pipRotateDelta = deltaRotation(rotateDelta, 0); |
| 582 |
|
| 583 |
|
| 584 |
final int degree, x, y; |
| 585 |
if (pipRotateDelta == ROTATION_90) { |
| 586 |
degree = 90; |
| 587 |
x = startBounds.right; |
| 588 |
y = startBounds.top; |
| 589 |
} else { |
| 590 |
degree = -90; |
| 591 |
x = startBounds.left; |
| 592 |
y = startBounds.bottom; |
| 593 |
} |
| 594 |
mSurfaceTransactionHelper.rotateAndScaleWithCrop(startTransaction, pipChange.getLeash(), |
| 595 |
endBounds, startBounds, new Rect(), degree, x, y, true , |
| 596 |
pipRotateDelta == ROTATION_270 ); |
| 597 |
startTransaction.apply(); |
| 598 |
rotator.cleanUp(finishTransaction); |
| 599 |
|
| 600 |
|
| 601 |
final PipAnimationController.PipTransitionAnimator animator = |
| 602 |
mPipAnimationController.getAnimator(taskInfo, pipChange.getLeash(), |
| 603 |
startBounds, startBounds, endBounds, null, TRANSITION_DIRECTION_LEAVE_PIP, |
| 604 |
0 , pipRotateDelta); |
| 605 |
animator.setTransitionDirection(TRANSITION_DIRECTION_LEAVE_PIP) |
| 606 |
.setPipAnimationCallback(mPipAnimationCallback) |
| 607 |
.setDuration(mEnterExitAnimationDuration) |
| 608 |
.start(); |
| 609 |
} |
| 610 |
|
| 611 |
private void startExpandAnimation(final TaskInfo taskInfo, final SurfaceControl leash, |
| 612 |
final Rect baseBounds, final Rect startBounds, final Rect endBounds, |
| 613 |
final int rotationDelta) { |
| 614 |
final PipAnimationController.PipTransitionAnimator animator = |
| 615 |
mPipAnimationController.getAnimator(taskInfo, leash, baseBounds, startBounds, |
| 616 |
endBounds, null , TRANSITION_DIRECTION_LEAVE_PIP, |
| 617 |
0 , rotationDelta); |
| 618 |
animator.setTransitionDirection(TRANSITION_DIRECTION_LEAVE_PIP) |
| 619 |
.setPipAnimationCallback(mPipAnimationCallback) |
| 620 |
.setDuration(mEnterExitAnimationDuration) |
| 621 |
.start(); |
| 622 |
} |
| 623 |
|
| 624 |
|
| 625 |
private void removePipImmediately(@NonNull TransitionInfo info, |
| 626 |
@NonNull SurfaceControl.Transaction startTransaction, |
| 627 |
@NonNull SurfaceControl.Transaction finishTransaction, |
| 628 |
@NonNull Transitions.TransitionFinishCallback finishCallback, |
| 629 |
@NonNull TaskInfo taskInfo) { |
| 630 |
startTransaction.apply(); |
| 631 |
finishTransaction.setWindowCrop(info.getChanges().get(0).getLeash(), |
| 632 |
mPipBoundsState.getDisplayBounds()); |
| 633 |
mPipOrganizer.onExitPipFinished(taskInfo); |
| 634 |
finishCallback.onTransitionFinished(null, null); |
| 635 |
} |
| 636 |
|
| 637 |
|
| 638 |
private boolean isEnteringPip(@NonNull TransitionInfo info) { |
| 639 |
for (int i = info.getChanges().size() - 1; i >= 0; --i) { |
| 640 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 641 |
if (isEnteringPip(change, info.getType())) return true; |
| 642 |
} |
| 643 |
return false; |
| 644 |
} |
| 645 |
|
| 646 |
|
| 647 |
@Override |
| 648 |
public boolean isEnteringPip(@NonNull TransitionInfo.Change change, |
| 649 |
@WindowManager.TransitionType int transitType) { |
| 650 |
if (change.getTaskInfo() != null |
| 651 |
&& change.getTaskInfo().getWindowingMode() == WINDOWING_MODE_PINNED |
| 652 |
&& !change.getContainer().equals(mCurrentPipTaskToken)) { |
| 653 |
|
| 654 |
|
| 655 |
if (transitType == TRANSIT_PIP || transitType == TRANSIT_OPEN) { |
| 656 |
return true; |
| 657 |
} |
| 658 |
|
| 659 |
|
| 660 |
if (transitType == TRANSIT_CHANGE) { |
| 661 |
return true; |
| 662 |
} |
| 663 |
|
| 664 |
|
| 665 |
throw new IllegalStateException("Entering PIP with unexpected transition type=" |
| 666 |
+ transitTypeToString(transitType)); |
| 667 |
} |
| 668 |
return false; |
| 669 |
} |
| 670 |
|
| 671 |
private void startEnterAnimation(@NonNull TransitionInfo info, |
| 672 |
@NonNull SurfaceControl.Transaction startTransaction, |
| 673 |
@NonNull SurfaceControl.Transaction finishTransaction, |
| 674 |
@NonNull Transitions.TransitionFinishCallback finishCallback) { |
| 675 |
|
| 676 |
TransitionInfo.Change enterPip = null; |
| 677 |
for (int i = info.getChanges().size() - 1; i >= 0; --i) { |
| 678 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 679 |
if (change.getTaskInfo() != null |
| 680 |
&& change.getTaskInfo().getWindowingMode() == WINDOWING_MODE_PINNED) { |
| 681 |
enterPip = change; |
| 682 |
} |
| 683 |
} |
| 684 |
if (enterPip == null) { |
| 685 |
throw new IllegalStateException("Trying to start PiP animation without a pip" |
| 686 |
+ "participant"); |
| 687 |
} |
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
for (int i = info.getChanges().size() - 1; i >= 0; --i) { |
| 692 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 693 |
if (change == enterPip) continue; |
| 694 |
if (isOpeningType(change.getMode())) { |
| 695 |
final SurfaceControl leash = change.getLeash(); |
| 696 |
startTransaction.show(leash).setAlpha(leash, 1.f); |
| 697 |
} |
| 698 |
} |
| 699 |
|
| 700 |
startEnterAnimation(enterPip, startTransaction, finishTransaction, finishCallback); |
| 701 |
} |
| 702 |
|
| 703 |
@Override |
| 704 |
public void startEnterAnimation(@NonNull final TransitionInfo.Change pipChange, |
| 705 |
@NonNull final SurfaceControl.Transaction startTransaction, |
| 706 |
@NonNull final SurfaceControl.Transaction finishTransaction, |
| 707 |
@NonNull final Transitions.TransitionFinishCallback finishCallback) { |
| 708 |
if (mFinishCallback != null) { |
| 709 |
callFinishCallback(null ); |
| 710 |
mFinishTransaction = null; |
| 711 |
throw new RuntimeException("Previous callback not called, aborting entering PIP."); |
| 712 |
} |
| 713 |
|
| 714 |
|
| 715 |
mCurrentPipTaskToken = pipChange.getContainer(); |
| 716 |
mHasFadeOut = false; |
| 717 |
mPipTransitionState.setTransitionState(PipTransitionState.ENTERING_PIP); |
| 718 |
mFinishCallback = finishCallback; |
| 719 |
mFinishTransaction = finishTransaction; |
| 720 |
|
| 721 |
final ActivityManager.RunningTaskInfo taskInfo = pipChange.getTaskInfo(); |
| 722 |
final SurfaceControl leash = pipChange.getLeash(); |
| 723 |
final int startRotation = pipChange.getStartRotation(); |
| 724 |
final int endRotation = mInFixedRotation ? mEndFixedRotation : pipChange.getEndRotation(); |
| 725 |
|
| 726 |
setBoundsStateForEntry(taskInfo.topActivity, taskInfo.pictureInPictureParams, |
| 727 |
taskInfo.topActivityInfo); |
| 728 |
final Rect destinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds(); |
| 729 |
final Rect currentBounds = taskInfo.configuration.windowConfiguration.getBounds(); |
| 730 |
int rotationDelta = deltaRotation(startRotation, endRotation); |
| 731 |
Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( |
| 732 |
taskInfo.pictureInPictureParams, currentBounds); |
| 733 |
if (rotationDelta != Surface.ROTATION_0 && mInFixedRotation) { |
| 734 |
|
| 735 |
computeEnterPipRotatedBounds(rotationDelta, startRotation, endRotation, taskInfo, |
| 736 |
destinationBounds, sourceHintRect); |
| 737 |
} |
| 738 |
|
| 739 |
mSurfaceTransactionHelper |
| 740 |
.crop(finishTransaction, leash, destinationBounds) |
| 741 |
.round(finishTransaction, leash, true ); |
| 742 |
mTransitions.getMainExecutor().executeDelayed(() -> mPipMenuController.attach(leash), 0); |
| 743 |
|
| 744 |
if (taskInfo.pictureInPictureParams != null |
| 745 |
&& taskInfo.pictureInPictureParams.isAutoEnterEnabled() |
| 746 |
&& mPipTransitionState.getInSwipePipToHomeTransition()) { |
| 747 |
mOneShotAnimationType = ANIM_TYPE_BOUNDS; |
| 748 |
final SurfaceControl swipePipToHomeOverlay = mPipOrganizer.mSwipePipToHomeOverlay; |
| 749 |
startTransaction.setMatrix(leash, Matrix.IDENTITY_MATRIX, new float[9]) |
| 750 |
.setPosition(leash, destinationBounds.left, destinationBounds.top) |
| 751 |
.setWindowCrop(leash, destinationBounds.width(), destinationBounds.height()); |
| 752 |
if (swipePipToHomeOverlay != null) { |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
startTransaction.reparent(swipePipToHomeOverlay, leash) |
| 757 |
.setLayer(swipePipToHomeOverlay, Integer.MAX_VALUE); |
| 758 |
mPipOrganizer.mSwipePipToHomeOverlay = null; |
| 759 |
} |
| 760 |
startTransaction.apply(); |
| 761 |
if (rotationDelta != Surface.ROTATION_0 && mInFixedRotation) { |
| 762 |
|
| 763 |
|
| 764 |
destinationBounds.set(mPipBoundsAlgorithm.getEntryDestinationBounds()); |
| 765 |
} |
| 766 |
mPipBoundsState.setBounds(destinationBounds); |
| 767 |
onFinishResize(taskInfo, destinationBounds, TRANSITION_DIRECTION_TO_PIP, null ); |
| 768 |
sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP); |
| 769 |
if (swipePipToHomeOverlay != null) { |
| 770 |
mPipOrganizer.fadeOutAndRemoveOverlay(swipePipToHomeOverlay, |
| 771 |
null , false ); |
| 772 |
} |
| 773 |
mPipTransitionState.setInSwipePipToHomeTransition(false); |
| 774 |
return; |
| 775 |
} |
| 776 |
|
| 777 |
if (rotationDelta != Surface.ROTATION_0) { |
| 778 |
Matrix tmpTransform = new Matrix(); |
| 779 |
tmpTransform.postRotate(rotationDelta); |
| 780 |
startTransaction.setMatrix(leash, tmpTransform, new float[9]); |
| 781 |
} |
| 782 |
if (mOneShotAnimationType == ANIM_TYPE_ALPHA) { |
| 783 |
startTransaction.setAlpha(leash, 0f); |
| 784 |
} |
| 785 |
startTransaction.apply(); |
| 786 |
|
| 787 |
PipAnimationController.PipTransitionAnimator animator; |
| 788 |
if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { |
| 789 |
animator = mPipAnimationController.getAnimator(taskInfo, leash, currentBounds, |
| 790 |
currentBounds, destinationBounds, sourceHintRect, TRANSITION_DIRECTION_TO_PIP, |
| 791 |
0 , rotationDelta); |
| 792 |
if (sourceHintRect == null) { |
| 793 |
|
| 794 |
|
| 795 |
animator.setColorContentOverlay(mContext); |
| 796 |
} |
| 797 |
} else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) { |
| 798 |
animator = mPipAnimationController.getAnimator(taskInfo, leash, destinationBounds, |
| 799 |
0f, 1f); |
| 800 |
mOneShotAnimationType = ANIM_TYPE_BOUNDS; |
| 801 |
} else { |
| 802 |
throw new RuntimeException("Unrecognized animation type: " |
| 803 |
+ mOneShotAnimationType); |
| 804 |
} |
| 805 |
animator.setTransitionDirection(TRANSITION_DIRECTION_TO_PIP) |
| 806 |
.setPipAnimationCallback(mPipAnimationCallback) |
| 807 |
.setDuration(mEnterExitAnimationDuration); |
| 808 |
if (rotationDelta != Surface.ROTATION_0 && mInFixedRotation) { |
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
animator.setDestinationBounds(mPipBoundsAlgorithm.getEntryDestinationBounds()); |
| 813 |
} |
| 814 |
animator.start(); |
| 815 |
} |
| 816 |
|
| 817 |
|
| 818 |
private void computeEnterPipRotatedBounds(int rotationDelta, int startRotation, int endRotation, |
| 819 |
TaskInfo taskInfo, Rect outDestinationBounds, @Nullable Rect outSourceHintRect) { |
| 820 |
mPipBoundsState.getDisplayLayout().rotateTo(mContext.getResources(), endRotation); |
| 821 |
final Rect displayBounds = mPipBoundsState.getDisplayBounds(); |
| 822 |
outDestinationBounds.set(mPipBoundsAlgorithm.getEntryDestinationBounds()); |
| 823 |
|
| 824 |
rotateBounds(outDestinationBounds, displayBounds, endRotation, startRotation); |
| 825 |
|
| 826 |
|
| 827 |
if (outSourceHintRect != null && taskInfo.displayCutoutInsets != null) { |
| 828 |
if (rotationDelta == Surface.ROTATION_270) { |
| 829 |
outSourceHintRect.offset(taskInfo.displayCutoutInsets.left, |
| 830 |
taskInfo.displayCutoutInsets.top); |
| 831 |
} |
| 832 |
} |
| 833 |
} |
| 834 |
|
| 835 |
private void startExitToSplitAnimation(@NonNull TransitionInfo info, |
| 836 |
@NonNull SurfaceControl.Transaction startTransaction, |
| 837 |
@NonNull SurfaceControl.Transaction finishTransaction, |
| 838 |
@NonNull Transitions.TransitionFinishCallback finishCallback, |
| 839 |
@NonNull TaskInfo taskInfo) { |
| 840 |
final int changeSize = info.getChanges().size(); |
| 841 |
if (changeSize < 4) { |
| 842 |
throw new RuntimeException( |
| 843 |
"Got an exit-pip-to-split transition with unexpected change-list"); |
| 844 |
} |
| 845 |
for (int i = changeSize - 1; i >= 0; i--) { |
| 846 |
final TransitionInfo.Change change = info.getChanges().get(i); |
| 847 |
final int mode = change.getMode(); |
| 848 |
|
| 849 |
if (mode == TRANSIT_CHANGE && change.getParent() != null) { |
| 850 |
|
| 851 |
continue; |
| 852 |
} |
| 853 |
|
| 854 |
if (isOpeningType(mode) && change.getParent() == null) { |
| 855 |
final SurfaceControl leash = change.getLeash(); |
| 856 |
final Rect endBounds = change.getEndAbsBounds(); |
| 857 |
startTransaction |
| 858 |
.show(leash) |
| 859 |
.setAlpha(leash, 1f) |
| 860 |
.setPosition(leash, endBounds.left, endBounds.top) |
| 861 |
.setWindowCrop(leash, endBounds.width(), endBounds.height()); |
| 862 |
} |
| 863 |
} |
| 864 |
mSplitScreenOptional.get().finishEnterSplitScreen(startTransaction); |
| 865 |
startTransaction.apply(); |
| 866 |
|
| 867 |
mPipOrganizer.onExitPipFinished(taskInfo); |
| 868 |
finishCallback.onTransitionFinished(null, null); |
| 869 |
} |
| 870 |
|
| 871 |
private void resetPrevPip(@NonNull TransitionInfo.Change prevPipTaskChange, |
| 872 |
@NonNull SurfaceControl.Transaction startTransaction) { |
| 873 |
final SurfaceControl leash = prevPipTaskChange.getLeash(); |
| 874 |
final Rect bounds = prevPipTaskChange.getEndAbsBounds(); |
| 875 |
final Point offset = prevPipTaskChange.getEndRelOffset(); |
| 876 |
bounds.offset(-offset.x, -offset.y); |
| 877 |
|
| 878 |
startTransaction.setWindowCrop(leash, null); |
| 879 |
startTransaction.setMatrix(leash, 1, 0, 0, 1); |
| 880 |
startTransaction.setCornerRadius(leash, 0); |
| 881 |
startTransaction.setPosition(leash, bounds.left, bounds.top); |
| 882 |
|
| 883 |
if (mHasFadeOut && prevPipTaskChange.getTaskInfo().isVisible()) { |
| 884 |
if (mPipAnimationController.getCurrentAnimator() != null) { |
| 885 |
mPipAnimationController.getCurrentAnimator().cancel(); |
| 886 |
} |
| 887 |
startTransaction.setAlpha(leash, 1); |
| 888 |
} |
| 889 |
mHasFadeOut = false; |
| 890 |
mCurrentPipTaskToken = null; |
| 891 |
mPipOrganizer.onExitPipFinished(prevPipTaskChange.getTaskInfo()); |
| 892 |
} |
| 893 |
|
| 894 |
private void updatePipForUnhandledTransition(@NonNull TransitionInfo.Change pipChange, |
| 895 |
@NonNull SurfaceControl.Transaction startTransaction, |
| 896 |
@NonNull SurfaceControl.Transaction finishTransaction) { |
| 897 |
|
| 898 |
|
| 899 |
final SurfaceControl leash = pipChange.getLeash(); |
| 900 |
final Rect destBounds = mPipBoundsState.getBounds(); |
| 901 |
final boolean isInPip = mPipTransitionState.isInPip(); |
| 902 |
mSurfaceTransactionHelper |
| 903 |
.crop(startTransaction, leash, destBounds) |
| 904 |
.round(startTransaction, leash, isInPip); |
| 905 |
mSurfaceTransactionHelper |
| 906 |
.crop(finishTransaction, leash, destBounds) |
| 907 |
.round(finishTransaction, leash, isInPip); |
| 908 |
} |
| 909 |
|
| 910 |
|
| 911 |
private void fadeExistingPip(boolean show) { |
| 912 |
final SurfaceControl leash = mPipOrganizer.getSurfaceControl(); |
| 913 |
final TaskInfo taskInfo = mPipOrganizer.getTaskInfo(); |
| 914 |
if (leash == null || !leash.isValid() || taskInfo == null) { |
| 915 |
ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, |
| 916 |
"%s: Invalid leash on fadeExistingPip: %s", TAG, leash); |
| 917 |
return; |
| 918 |
} |
| 919 |
final float alphaStart = show ? 0 : 1; |
| 920 |
final float alphaEnd = show ? 1 : 0; |
| 921 |
mPipAnimationController |
| 922 |
.getAnimator(taskInfo, leash, mPipBoundsState.getBounds(), alphaStart, alphaEnd) |
| 923 |
.setTransitionDirection(TRANSITION_DIRECTION_SAME) |
| 924 |
.setPipAnimationCallback(mPipAnimationCallback) |
| 925 |
.setDuration(mEnterExitAnimationDuration) |
| 926 |
.start(); |
| 927 |
mHasFadeOut = !show; |
| 928 |
} |
| 929 |
|
| 930 |
private void finishResizeForMenu(Rect destinationBounds) { |
| 931 |
mPipMenuController.movePipMenu(null, null, destinationBounds); |
| 932 |
mPipMenuController.updateMenuBounds(destinationBounds); |
| 933 |
} |
| 934 |
} |