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

Commit 1cb95c93 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Error check the return value of parcel->read" into main

parents 7f7e1a64 5da2208d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.LongDef;
import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.graphics.GraphicBuffer;
import android.os.BadParcelableException;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -399,11 +400,14 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
    public static final @android.annotation.NonNull Parcelable.Creator<HardwareBuffer> CREATOR =
            new Parcelable.Creator<HardwareBuffer>() {
        public HardwareBuffer createFromParcel(Parcel in) {
            if (in == null) {
                throw new NullPointerException("null passed to createFromParcel");
            }
            long nativeObject = nReadHardwareBufferFromParcel(in);
            if (nativeObject != 0) {
                return new HardwareBuffer(nativeObject);
            }
            return null;
            throw new BadParcelableException("Failed to read hardware buffer");
        }

        public HardwareBuffer[] newArray(int size) {
+3 −3
Original line number Diff line number Diff line
@@ -203,10 +203,10 @@ static jlong android_hardware_HardwareBuffer_read(JNIEnv* env, jobject clazz,
    Parcel* parcel = parcelForJavaObject(env, in);
    if (parcel) {
        sp<GraphicBuffer> buffer = new GraphicBuffer();
        parcel->read(*buffer);
        if (parcel->read(*buffer) == STATUS_OK) {
            return reinterpret_cast<jlong>(new GraphicBufferWrapper(buffer));
        }

    }
    return NULL;
}