Merge "Metadata: recycle Parcel"

This commit is contained in:
TreeHugger Robot
2019-08-14 14:27:39 +00:00
committed by Android (Google) Code Review

View File

@@ -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;
}