Merge "Fix screnshot null during rotation" into tm-qpr-dev
This commit is contained in:
@@ -247,11 +247,11 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
|||||||
|
|
||||||
/** Stops showing resizing hint. */
|
/** Stops showing resizing hint. */
|
||||||
public void onResized(SurfaceControl.Transaction t, Runnable animFinishedCallback) {
|
public void onResized(SurfaceControl.Transaction t, Runnable animFinishedCallback) {
|
||||||
if (mScreenshot != null) {
|
|
||||||
if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
|
if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
|
||||||
mScreenshotAnimator.cancel();
|
mScreenshotAnimator.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mScreenshot != null) {
|
||||||
t.setPosition(mScreenshot, mOffsetX, mOffsetY);
|
t.setPosition(mScreenshot, mOffsetX, mOffsetY);
|
||||||
|
|
||||||
final SurfaceControl.Transaction animT = new SurfaceControl.Transaction();
|
final SurfaceControl.Transaction animT = new SurfaceControl.Transaction();
|
||||||
@@ -321,6 +321,10 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
|||||||
/** Screenshot host leash and attach on it if meet some conditions */
|
/** Screenshot host leash and attach on it if meet some conditions */
|
||||||
public void screenshotIfNeeded(SurfaceControl.Transaction t) {
|
public void screenshotIfNeeded(SurfaceControl.Transaction t) {
|
||||||
if (!mShown && mIsResizing && !mOldBounds.equals(mResizingBounds)) {
|
if (!mShown && mIsResizing && !mOldBounds.equals(mResizingBounds)) {
|
||||||
|
if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
|
||||||
|
mScreenshotAnimator.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
mTempRect.set(mOldBounds);
|
mTempRect.set(mOldBounds);
|
||||||
mTempRect.offsetTo(0, 0);
|
mTempRect.offsetTo(0, 0);
|
||||||
mScreenshot = ScreenshotUtils.takeScreenshot(t, mHostLeash, mTempRect,
|
mScreenshot = ScreenshotUtils.takeScreenshot(t, mHostLeash, mTempRect,
|
||||||
@@ -333,6 +337,10 @@ public class SplitDecorManager extends WindowlessWindowManager {
|
|||||||
if (screenshot == null || !screenshot.isValid()) return;
|
if (screenshot == null || !screenshot.isValid()) return;
|
||||||
|
|
||||||
if (!mShown && mIsResizing && !mOldBounds.equals(mResizingBounds)) {
|
if (!mShown && mIsResizing && !mOldBounds.equals(mResizingBounds)) {
|
||||||
|
if (mScreenshotAnimator != null && mScreenshotAnimator.isRunning()) {
|
||||||
|
mScreenshotAnimator.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
mScreenshot = screenshot;
|
mScreenshot = screenshot;
|
||||||
t.reparent(screenshot, mHostLeash);
|
t.reparent(screenshot, mHostLeash);
|
||||||
t.setLayer(screenshot, Integer.MAX_VALUE - 1);
|
t.setLayer(screenshot, Integer.MAX_VALUE - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user