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

Commit dd5bde0a authored by chaviw's avatar chaviw Committed by Issei Suzuki
Browse files

DO NOT MERGE: Deleted SurfaceControl.remove method

Updated all callers of SC.remove to use Transaction.remove(sc) and apply
immediately since that's the equivalent. Eventually, the transactions
that contain remove could combine with other transactions if it makes
sense to avoid duplicate applies.

Test: SurfaceControlTest
Change-Id: I13c6ec86de6a6d60f142c2269337557510dd006d
Exempt-From-Owner-Approval: Already approved and merged in master.
parent 5c1e9f0f
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ public final class SurfaceControl implements Parcelable {
    private static native long nativeCopyFromSurfaceControl(long nativeObject);
    private static native void nativeWriteToParcel(long nativeObject, Parcel out);
    private static native void nativeRelease(long nativeObject);
    private static native void nativeDestroy(long nativeObject);
    private static native void nativeDisconnect(long nativeObject);

    private static native ScreenshotGraphicBuffer nativeScreenshot(IBinder displayToken,
@@ -929,19 +928,6 @@ public final class SurfaceControl implements Parcelable {
        mCloseGuard.close();
    }

    /**
     * Release the local resources like {@link #release} but also
     * remove the Surface from the screen.
     * @hide
     */
    public void remove() {
        if (mNativeObject != 0) {
            nativeDestroy(mNativeObject);
            mNativeObject = 0;
        }
        mCloseGuard.close();
    }

    /**
     * Disconnect any client still connected to the surface.
     * @hide
+6 −4
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
    private int mPendingReportDraws;

    private SurfaceControl.Transaction mRtTransaction = new SurfaceControl.Transaction();
    private SurfaceControl.Transaction mTmpTransaction = new SurfaceControl.Transaction();

    public SurfaceView(Context context) {
        this(context, null);
@@ -338,7 +339,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb

        updateSurface();
        if (mSurfaceControl != null) {
            mSurfaceControl.remove();
            mTmpTransaction.remove(mSurfaceControl).apply();
        }
        mSurfaceControl = null;

@@ -533,13 +534,14 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb

    private void releaseSurfaces() {
        if (mSurfaceControl != null) {
            mSurfaceControl.remove();
            mTmpTransaction.remove(mSurfaceControl);
            mSurfaceControl = null;
        }
        if (mBackgroundControl != null) {
            mBackgroundControl.remove();
            mTmpTransaction.remove(mBackgroundControl);
            mBackgroundControl = null;
        }
        mTmpTransaction.apply();
    }

    /** @hide */
@@ -848,7 +850,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
        }

        if (mDeferredDestroySurfaceControl != null) {
            mDeferredDestroySurfaceControl.remove();
            mTmpTransaction.remove(mDeferredDestroySurfaceControl).apply();
            mDeferredDestroySurfaceControl = null;
        }

+1 −1
Original line number Diff line number Diff line
@@ -1637,7 +1637,7 @@ public final class ViewRootImpl implements ViewParent,
        mSurfaceSession = null;

        if (mBoundsSurfaceControl != null) {
            mBoundsSurfaceControl.remove();
            mTransaction.remove(mBoundsSurfaceControl).apply();
            mBoundsSurface.release();
            mBoundsSurfaceControl = null;
        }
+1 −1
Original line number Diff line number Diff line
@@ -1035,7 +1035,7 @@ public final class Magnifier {
            // Destroy the renderer. This will not proceed until pending frame callbacks complete.
            mRenderer.destroy();
            mSurface.destroy();
            mSurfaceControl.remove();
            new SurfaceControl.Transaction().remove(mSurfaceControl).apply();
            mSurfaceSession.kill();
            mHandler.removeCallbacks(mMagnifierUpdater);
            if (mBitmap != null) {
+0 −8
Original line number Diff line number Diff line
@@ -217,12 +217,6 @@ static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) {
    ctrl->decStrong((void *)nativeCreate);
}

static void nativeDestroy(JNIEnv* env, jclass clazz, jlong nativeObject) {
    sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
    ctrl->destroy();
    ctrl->decStrong((void *)nativeCreate);
}

static void nativeDisconnect(JNIEnv* env, jclass clazz, jlong nativeObject) {
    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
    if (ctrl != NULL) {
@@ -1268,8 +1262,6 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeWriteToParcel },
    {"nativeRelease", "(J)V",
            (void*)nativeRelease },
    {"nativeDestroy", "(J)V",
            (void*)nativeDestroy },
    {"nativeDisconnect", "(J)V",
            (void*)nativeDisconnect },
    {"nativeCreateTransaction", "()J",
Loading