Merge "Parcel: markForBinder -> obtain(IBinder)" am: fb7a6db2a2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1840654 Change-Id: Ibde592b1d34c2e7143c961c7d2e2029d0fbfd82f
This commit is contained in:
@@ -475,6 +475,23 @@ public final class Parcel {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a new Parcel object from the pool for use with a specific binder.
|
||||||
|
*
|
||||||
|
* Associate this parcel with a binder object. This marks the parcel as being prepared for a
|
||||||
|
* transaction on this specific binder object. Based on this, the format of the wire binder
|
||||||
|
* protocol may change. For future compatibility, it is recommended to use this for all
|
||||||
|
* Parcels.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static Parcel obtain(@NonNull IBinder binder) {
|
||||||
|
Parcel parcel = Parcel.obtain();
|
||||||
|
parcel.markForBinder(binder);
|
||||||
|
return parcel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a Parcel object back into the pool. You must not touch
|
* Put a Parcel object back into the pool. You must not touch
|
||||||
* the object after this call.
|
* the object after this call.
|
||||||
@@ -549,16 +566,9 @@ public final class Parcel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associate this parcel with a binder object. This marks the parcel as being prepared for a
|
|
||||||
* transaction on this specific binder object. Based on this, the format of the wire binder
|
|
||||||
* protocol may change. This should be called before any data is written to the parcel. If this
|
|
||||||
* is called multiple times, this will only be marked for the last binder. For future
|
|
||||||
* compatibility, it is recommended to call this on all parcels which are being sent over
|
|
||||||
* binder.
|
|
||||||
*
|
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void markForBinder(@NonNull IBinder binder) {
|
private void markForBinder(@NonNull IBinder binder) {
|
||||||
nativeMarkForBinder(mNativePtr, binder);
|
nativeMarkForBinder(mNativePtr, binder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user