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

Commit 1d4f1cda authored by Robert Carr's avatar Robert Carr Committed by android-build-merger
Browse files

Merge "Force pending transactions to flush before screenshot." into nyc-dev

am: 39e8022a

* commit '39e8022a':
  Force pending transactions to flush before screenshot.

Change-Id: Ib8dd84af143226e2b62cdfa51066e68ba7802d28
parents 3425c6c6 39e8022a
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@ public class SurfaceControl {
            boolean allLayers, boolean useIdentityTransform);
            boolean allLayers, boolean useIdentityTransform);


    private static native void nativeOpenTransaction();
    private static native void nativeOpenTransaction();
    private static native void nativeCloseTransaction();
    private static native void nativeCloseTransaction(boolean sync);
    private static native void nativeSetAnimationTransaction();
    private static native void nativeSetAnimationTransaction();


    private static native void nativeSetLayer(long nativeObject, int zorder);
    private static native void nativeSetLayer(long nativeObject, int zorder);
@@ -372,7 +372,11 @@ public class SurfaceControl {


    /** end a transaction */
    /** end a transaction */
    public static void closeTransaction() {
    public static void closeTransaction() {
        nativeCloseTransaction();
        nativeCloseTransaction(false);
    }

    public static void closeTransactionSync() {
        nativeCloseTransaction(true);
    }
    }


    public void deferTransactionUntil(IBinder handle, long frame) {
    public void deferTransactionUntil(IBinder handle, long frame) {
+4 −3
Original line number Original line Diff line number Diff line
@@ -223,8 +223,9 @@ static void nativeOpenTransaction(JNIEnv* env, jclass clazz) {
    SurfaceComposerClient::openGlobalTransaction();
    SurfaceComposerClient::openGlobalTransaction();
}
}


static void nativeCloseTransaction(JNIEnv* env, jclass clazz) {

    SurfaceComposerClient::closeGlobalTransaction();
static void nativeCloseTransaction(JNIEnv* env, jclass clazz, jboolean sync) {
    SurfaceComposerClient::closeGlobalTransaction(sync);
}
}


static void nativeSetAnimationTransaction(JNIEnv* env, jclass clazz) {
static void nativeSetAnimationTransaction(JNIEnv* env, jclass clazz) {
@@ -649,7 +650,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeScreenshot },
            (void*)nativeScreenshot },
    {"nativeOpenTransaction", "()V",
    {"nativeOpenTransaction", "()V",
            (void*)nativeOpenTransaction },
            (void*)nativeOpenTransaction },
    {"nativeCloseTransaction", "()V",
    {"nativeCloseTransaction", "(Z)V",
            (void*)nativeCloseTransaction },
            (void*)nativeCloseTransaction },
    {"nativeSetAnimationTransaction", "()V",
    {"nativeSetAnimationTransaction", "()V",
            (void*)nativeSetAnimationTransaction },
            (void*)nativeSetAnimationTransaction },
+5 −0
Original line number Original line Diff line number Diff line
@@ -6386,6 +6386,11 @@ public class WindowManagerService extends IWindowManager.Stub
            if (DEBUG_SCREENSHOT && inRotation) Slog.v(TAG_WM,
            if (DEBUG_SCREENSHOT && inRotation) Slog.v(TAG_WM,
                    "Taking screenshot while rotating");
                    "Taking screenshot while rotating");


            // We force pending transactions to flush before taking
            // the screenshot by pushing an empty synchronous transaction.
            SurfaceControl.openTransaction();
            SurfaceControl.closeTransactionSync();

            bm = SurfaceControl.screenshot(crop, width, height, minLayer, maxLayer,
            bm = SurfaceControl.screenshot(crop, width, height, minLayer, maxLayer,
                    inRotation, rot);
                    inRotation, rot);
            if (bm == null) {
            if (bm == null) {