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

Commit e5a12e0d authored by Wei Jia's avatar Wei Jia
Browse files

Metadata: recycle Parcel

Test: cts
Bug: 139319531
Change-Id: Ica1a7333fc15869b16b55669c3ba001187670eb7
parent d14d2ecd
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -272,6 +272,15 @@ import java.util.TimeZone;
    @UnsupportedAppUsage
    public Metadata() { }

    // Have to declare protected for finalize() since it is protected
    // in the base class Object.
    @Override
    protected void finalize() throws Throwable {
        if (mParcel != null) {
            mParcel.recycle();
        }
    }

    /**
     * Go over all the records, collecting metadata keys and records'
     * type field offset in the Parcel. These are stored in
@@ -418,6 +427,10 @@ import java.util.TimeZone;
            parcel.setDataPosition(pin);
            return false;
        }

        if (mParcel != null) {
            mParcel.recycle();
        }
        mParcel = parcel;
        return true;
    }