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

Commit 3f297c11 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Improve how parcels are recycled on AssisStructure custom parcelization."

parents d45e1db1 c52b6ea3
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -359,6 +359,8 @@ public class AssistStructure implements Parcelable {
            if (DEBUG_PARCEL) Log.d(TAG, "Finished reading: at " + mCurParcel.dataPosition()
                    + ", avail=" + mCurParcel.dataAvail() + ", windows=" + mNumReadWindows
                    + ", views=" + mNumReadViews);
            mCurParcel.recycle();
            mCurParcel = null; // Parcel cannot be used after recycled.
        }

        Parcel readParcel(int validateToken, int level) {
@@ -396,6 +398,7 @@ public class AssistStructure implements Parcelable {

        private void fetchData() {
            Parcel data = Parcel.obtain();
            try {
                data.writeInterfaceToken(DESCRIPTOR);
                data.writeStrongBinder(mTransferToken);
                if (DEBUG_PARCEL) Log.d(TAG, "Requesting data with token " + mTransferToken);
@@ -409,7 +412,9 @@ public class AssistStructure implements Parcelable {
                    Log.w(TAG, "Failure reading AssistStructure data", e);
                    throw new IllegalStateException("Failure reading AssistStructure data: " + e);
                }
            } finally {
                data.recycle();
            }
            mNumReadWindows = mNumReadViews = 0;
        }
    }