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

Commit ba79aa24 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "InsetController: Release leashes from RenderThread" into rvc-dev am:...

Merge "InsetController: Release leashes from RenderThread" into rvc-dev am: 672e0e80 am: 737e879d am: 76b592f5 am: d1633fba

Change-Id: Ic00c8c2fa9f3b2757e15753c0f44d647b9197078
parents 62d10301 d1633fba
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -992,4 +992,23 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        }
        }
        return mViewRoot.mWindowAttributes.insetsFlags.behavior;
        return mViewRoot.mWindowAttributes.insetsFlags.behavior;
    }
    }

    /**
     * At the time we receive new leashes (e.g. InsetsSourceConsumer is processing
     * setControl) we need to release the old leash. But we may have already scheduled
     * a SyncRtSurfaceTransaction applier to use it from the RenderThread. To avoid
     * synchronization issues we also release from the RenderThread so this release
     * happens after any existing items on the work queue.
     */
    public void releaseSurfaceControlFromRt(SurfaceControl sc) {
        if (mViewRoot.mView != null && mViewRoot.mView.isHardwareAccelerated()) {
            mViewRoot.registerRtFrameCallback(frame -> {
                  sc.release();
            });
            // Make sure a frame gets scheduled.
            mViewRoot.mView.invalidate();
        } else {
              sc.release();
        }
    }
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -117,7 +117,7 @@ public class InsetsSourceConsumer {
            }
            }
        }
        }
        if (lastControl != null) {
        if (lastControl != null) {
            lastControl.release();
            lastControl.release(mController);
        }
        }
    }
    }


+2 −2
Original line number Original line Diff line number Diff line
@@ -94,9 +94,9 @@ public class InsetsSourceControl implements Parcelable {
        dest.writeParcelable(mSurfacePosition, 0 /* flags*/);
        dest.writeParcelable(mSurfacePosition, 0 /* flags*/);
    }
    }


    public void release() {
    public void release(InsetsController controller) {
        if (mLeash != null) {
        if (mLeash != null) {
            mLeash.release();
            controller.releaseSurfaceControlFromRt(mLeash);
        }
        }
    }
    }