Merge "Updates destination bounds upon rotation change" into rvc-dev
This commit is contained in:
@@ -99,6 +99,10 @@ public class PipAnimationController {
|
|||||||
return mCurrentAnimator;
|
return mCurrentAnimator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PipTransitionAnimator getCurrentAnimator() {
|
||||||
|
return mCurrentAnimator;
|
||||||
|
}
|
||||||
|
|
||||||
private PipTransitionAnimator setupPipTransitionAnimator(PipTransitionAnimator animator) {
|
private PipTransitionAnimator setupPipTransitionAnimator(PipTransitionAnimator animator) {
|
||||||
animator.setInterpolator(mFastOutSlowInInterpolator);
|
animator.setInterpolator(mFastOutSlowInInterpolator);
|
||||||
animator.setFloatValues(FRACTION_START, FRACTION_END);
|
animator.setFloatValues(FRACTION_START, FRACTION_END);
|
||||||
|
|||||||
@@ -166,7 +166,22 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
|
|||||||
* Updates the display dimension with given {@link DisplayInfo}
|
* Updates the display dimension with given {@link DisplayInfo}
|
||||||
*/
|
*/
|
||||||
public void onDisplayInfoChanged(DisplayInfo displayInfo) {
|
public void onDisplayInfoChanged(DisplayInfo displayInfo) {
|
||||||
mDisplayBounds.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
|
final Rect newDisplayBounds = new Rect(0, 0,
|
||||||
|
displayInfo.logicalWidth, displayInfo.logicalHeight);
|
||||||
|
if (!mDisplayBounds.equals(newDisplayBounds)) {
|
||||||
|
// Updates the exiting PiP animation in case the screen rotation changes in the middle.
|
||||||
|
// It's a legit case that PiP window is in portrait mode on home screen and
|
||||||
|
// the application requests landscape onces back to fullscreen mode.
|
||||||
|
final PipAnimationController.PipTransitionAnimator animator =
|
||||||
|
mPipAnimationController.getCurrentAnimator();
|
||||||
|
if (animator != null
|
||||||
|
&& animator.getAnimationType() == ANIM_TYPE_BOUNDS
|
||||||
|
&& animator.getDestinationBounds().equals(mDisplayBounds)) {
|
||||||
|
animator.updateEndValue(newDisplayBounds);
|
||||||
|
animator.setDestinationBounds(newDisplayBounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDisplayBounds.set(newDisplayBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
private IActivityManager mActivityManager;
|
private IActivityManager mActivityManager;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
|
|
||||||
private final PinnedStackListener mPinnedStackListener = new PipManagerPinnedStackListener();
|
|
||||||
private final DisplayInfo mTmpDisplayInfo = new DisplayInfo();
|
private final DisplayInfo mTmpDisplayInfo = new DisplayInfo();
|
||||||
private final Rect mTmpInsetBounds = new Rect();
|
private final Rect mTmpInsetBounds = new Rect();
|
||||||
private final Rect mTmpNormalBounds = new Rect();
|
private final Rect mTmpNormalBounds = new Rect();
|
||||||
@@ -211,7 +210,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
mActivityManager = ActivityManager.getService();
|
mActivityManager = ActivityManager.getService();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
WindowManagerWrapper.getInstance().addPinnedStackListener(mPinnedStackListener);
|
WindowManagerWrapper.getInstance().addPinnedStackListener(
|
||||||
|
new PipManagerPinnedStackListener());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Failed to register pinned stack listener", e);
|
Log.e(TAG, "Failed to register pinned stack listener", e);
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,6 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
|
|
||||||
private void updateMovementBounds(Rect animatingBounds, boolean fromImeAdjustment,
|
private void updateMovementBounds(Rect animatingBounds, boolean fromImeAdjustment,
|
||||||
boolean fromShelfAdjustment) {
|
boolean fromShelfAdjustment) {
|
||||||
mPipTaskOrganizer.onDisplayInfoChanged(mTmpDisplayInfo);
|
|
||||||
// Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before
|
// Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before
|
||||||
// passing to mTouchHandler, mTouchHandler would rely on the bounds calculated by
|
// passing to mTouchHandler, mTouchHandler would rely on the bounds calculated by
|
||||||
// mPipBoundsHandler with up-to-dated information
|
// mPipBoundsHandler with up-to-dated information
|
||||||
@@ -350,6 +349,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
|
|||||||
mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds,
|
mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds,
|
||||||
animatingBounds, fromImeAdjustment, fromShelfAdjustment,
|
animatingBounds, fromImeAdjustment, fromShelfAdjustment,
|
||||||
mTmpDisplayInfo.rotation);
|
mTmpDisplayInfo.rotation);
|
||||||
|
mPipTaskOrganizer.onDisplayInfoChanged(mTmpDisplayInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dump(PrintWriter pw) {
|
public void dump(PrintWriter pw) {
|
||||||
|
|||||||
Reference in New Issue
Block a user