Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c4120b2 authored by Miranda Kephart's avatar Miranda Kephart Committed by Android (Google) Code Review
Browse files

Merge "Post screenshot removeWindow call if necessary" into 24D1-dev

parents e944dade 84326475
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -222,7 +222,8 @@ public class ScreenshotController {
    private Bitmap mScreenBitmap;
    private SaveImageInBackgroundTask mSaveInBgTask;
    private boolean mScreenshotTakenInPortrait;
    private boolean mBlockAttach;
    private boolean mAttachRequested;
    private boolean mDetachRequested;
    private Animator mScreenshotAnimation;
    private RequestCallback mCurrentRequestCallback;
    private ScreenshotActionsProvider mActionsProvider;
@@ -675,7 +676,7 @@ public class ScreenshotController {
                    new ViewTreeObserver.OnWindowAttachListener() {
                        @Override
                        public void onWindowAttached() {
                            mBlockAttach = false;
                            mAttachRequested = false;
                            decorView.getViewTreeObserver().removeOnWindowAttachListener(this);
                            action.run();
                        }
@@ -691,13 +692,13 @@ public class ScreenshotController {
    @MainThread
    private void attachWindow() {
        View decorView = mWindow.getDecorView();
        if (decorView.isAttachedToWindow() || mBlockAttach) {
        if (decorView.isAttachedToWindow() || mAttachRequested) {
            return;
        }
        if (DEBUG_WINDOW) {
            Log.d(TAG, "attachWindow");
        }
        mBlockAttach = true;
        mAttachRequested = true;
        mWindowManager.addView(decorView, mWindowLayoutParams);
        decorView.requestApplyInsets();

@@ -715,6 +716,11 @@ public class ScreenshotController {
                Log.d(TAG, "Removing screenshot window");
            }
            mWindowManager.removeViewImmediate(decorView);
            mDetachRequested = false;
        }
        if (mAttachRequested && !mDetachRequested) {
            mDetachRequested = true;
            withWindowAttached(this::removeWindow);
        }

        mViewProxy.stopInputListening();