summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/Parcel.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index f132ac54b58c..2bb0ec74117e 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -304,6 +304,8 @@ public final class Parcel {
@CriticalNative
private static native void nativeMarkSensitive(long nativePtr);
+ @FastNative
+ private static native void nativeMarkForBinder(long nativePtr, IBinder binder);
@CriticalNative
private static native int nativeDataSize(long nativePtr);
@CriticalNative
@@ -528,6 +530,16 @@ public final class Parcel {
/**
* Parcel data should be zero'd before realloc'd or deleted.
+ *
+ * Note: currently this feature requires multiple things to work in concert:
+ * - markSensitive must be called on every relative Parcel
+ * - FLAG_CLEAR_BUF must be passed into the kernel
+ * This requires having code which does the right thing in every method and in every backend
+ * of AIDL. Rather than exposing this API, it should be replaced with a single API on
+ * IBinder objects which can be called once, and the information should be fed into the
+ * Parcel using markForBinder APIs. In terms of code size and number of API calls, this is
+ * much more extensible.
+ *
* @hide
*/
public final void markSensitive() {
@@ -535,9 +547,23 @@ 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
+ */
+ public void markForBinder(@NonNull IBinder binder) {
+ nativeMarkForBinder(mNativePtr, binder);
+ }
+
+ /**
* Returns the total amount of data contained in the parcel.
*/
- public final int dataSize() {
+ public int dataSize() {
return nativeDataSize(mNativePtr);
}