Merge "Add @SystemApi annotation to parcel.writeBlob and readBlob."

This commit is contained in:
Terry Wang
2021-12-14 21:13:06 +00:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 8 deletions

View File

@@ -31959,6 +31959,7 @@ package android.os {
method @Nullable public <T> java.util.ArrayList<T> readArrayList(@Nullable ClassLoader, @NonNull Class<? extends T>);
method public void readBinderArray(@NonNull android.os.IBinder[]);
method public void readBinderList(@NonNull java.util.List<android.os.IBinder>);
method @Nullable public byte[] readBlob();
method public boolean readBoolean();
method public void readBooleanArray(@NonNull boolean[]);
method @Nullable public android.os.Bundle readBundle();
@@ -32018,6 +32019,8 @@ package android.os {
method public void writeArray(@Nullable Object[]);
method public void writeBinderArray(@Nullable android.os.IBinder[]);
method public void writeBinderList(@Nullable java.util.List<android.os.IBinder>);
method public void writeBlob(@Nullable byte[]);
method public void writeBlob(@Nullable byte[], int, int);
method public void writeBoolean(boolean);
method public void writeBooleanArray(@Nullable boolean[]);
method public void writeBundle(@Nullable android.os.Bundle);

View File

@@ -915,11 +915,15 @@ public final class Parcel {
/**
* Write a blob of data into the parcel at the current {@link #dataPosition},
* growing {@link #dataCapacity} if needed.
*
* <p> If the blob is small, then it is stored in-place, otherwise it is transferred by way of
* an anonymous shared memory region. If you prefer send in-place, please use
* {@link #writeByteArray(byte[])}.
*
* @param b Bytes to place into the parcel.
* {@hide}
* {@SystemApi}
*
* @see #readBlob()
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public final void writeBlob(@Nullable byte[] b) {
writeBlob(b, 0, (b != null) ? b.length : 0);
}
@@ -927,11 +931,16 @@ public final class Parcel {
/**
* Write a blob of data into the parcel at the current {@link #dataPosition},
* growing {@link #dataCapacity} if needed.
*
* <p> If the blob is small, then it is stored in-place, otherwise it is transferred by way of
* an anonymous shared memory region. If you prefer send in-place, please use
* {@link #writeByteArray(byte[], int, int)}.
*
* @param b Bytes to place into the parcel.
* @param offset Index of first byte to be written.
* @param len Number of bytes to write.
* {@hide}
* {@SystemApi}
*
* @see #readBlob()
*/
public final void writeBlob(@Nullable byte[] b, int offset, int len) {
if (b == null) {
@@ -3210,10 +3219,8 @@ public final class Parcel {
/**
* Read a blob of data from the parcel and return it as a byte array.
* {@hide}
* {@SystemApi}
* @see #writeBlob(byte[], int, int)
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@Nullable
public final byte[] readBlob() {
return nativeReadBlob(mNativePtr);