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

Commit 8a6f705f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Camera: Address an issue that the invalid memory is accessed" into...

Merge "Camera: Address an issue that the invalid memory is accessed" into udc-dev am: 36d5df64 am: 903f8374

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23371881



Change-Id: I7d5d6f857fb3fea0b79345bed230765b07993f3b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 00f66bb2 903f8374
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public class GraphicBuffer implements Parcelable {
    private final int mUsage;
    // Note: do not rename, this field is used by native code
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private final long mNativeObject;
    private long mNativeObject;

    // These two fields are only used by lock/unlockCanvas()
    private Canvas mCanvas;
@@ -219,6 +219,7 @@ public class GraphicBuffer implements Parcelable {
        if (!mDestroyed) {
            mDestroyed = true;
            nDestroyGraphicBuffer(mNativeObject);
            mNativeObject = 0;
        }
    }

@@ -239,7 +240,7 @@ public class GraphicBuffer implements Parcelable {
    @Override
    protected void finalize() throws Throwable {
        try {
            if (!mDestroyed) nDestroyGraphicBuffer(mNativeObject);
            destroy();
        } finally {
            super.finalize();
        }
+1 −0
Original line number Diff line number Diff line
@@ -768,6 +768,7 @@ static void ImageReader_unlockGraphicBuffer(JNIEnv* env, jobject /*thiz*/,
            android_graphics_GraphicBuffer_getNativeGraphicsBuffer(env, buffer);
    if (graphicBuffer.get() == NULL) {
        jniThrowRuntimeException(env, "Invalid graphic buffer!");
        return;
    }

    status_t res = graphicBuffer->unlock();
+5 −1
Original line number Diff line number Diff line
@@ -2057,7 +2057,11 @@ public class CameraExtensionsProxyService extends Service {
            mIsImageValid = false;

            if (mGraphicBuffer != null) {
                try {
                    ImageReader.unlockGraphicBuffer(mGraphicBuffer);
                } catch (RuntimeException e) {
                    e.printStackTrace();
                }
                mGraphicBuffer.destroy();
                mGraphicBuffer = null;
            }