Add @SystemApi annotation to parcel.writeBlob and readBlob.

AppSearch will put text-based document via binder to server side.
Parcel.writeBlob could take care of decide where to put in Android
Shared Memory if data is too large.
Remove {@SystemApi} to make it available for AppSearch.

Bug: 185441119
Test: presubmit
Change-Id: I95218fdca2baa5b4a287f05c9d79273b4a6e622c
This commit is contained in:
Terry Wang
2021-11-23 15:25:17 -08:00
parent f3a2ac354f
commit 69aa938dc1
2 changed files with 18 additions and 8 deletions

View File

@@ -31728,6 +31728,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();
@@ -31786,6 +31787,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

@@ -902,11 +902,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);
}
@@ -914,11 +918,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) {
@@ -3197,10 +3206,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);