Merge "IBinder: support FLAG_CLEAR_BUF" am: 9910d9980e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1477120 Change-Id: I8ad610798d8ca3cdababa8a9b61cc3f70f8c760d
This commit is contained in:
@@ -169,6 +169,15 @@ public interface IBinder {
|
||||
*/
|
||||
int FLAG_ONEWAY = 0x00000001;
|
||||
|
||||
/**
|
||||
* Flag to {@link #transact}: request binder driver to clear transaction data.
|
||||
*
|
||||
* Be very careful when using this flag in Java, since Java objects read from a Java
|
||||
* Parcel may be non-trivial to clear.
|
||||
* @hide
|
||||
*/
|
||||
int FLAG_CLEAR_BUF = 0x00000020;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
|
||||
@@ -276,6 +276,8 @@ public final class Parcel {
|
||||
// see libbinder's binder/Status.h
|
||||
private static final int EX_TRANSACTION_FAILED = -129;
|
||||
|
||||
@CriticalNative
|
||||
private static native void nativeMarkSensitive(long nativePtr);
|
||||
@CriticalNative
|
||||
private static native int nativeDataSize(long nativePtr);
|
||||
@CriticalNative
|
||||
@@ -490,6 +492,14 @@ public final class Parcel {
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
public static native long getGlobalAllocCount();
|
||||
|
||||
/**
|
||||
* Parcel data should be zero'd before realloc'd or deleted.
|
||||
* @hide
|
||||
*/
|
||||
public final void markSensitive() {
|
||||
nativeMarkSensitive(mNativePtr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total amount of data contained in the parcel.
|
||||
*/
|
||||
|
||||
@@ -90,6 +90,14 @@ void recycleJavaParcelObject(JNIEnv* env, jobject parcelObj)
|
||||
env->CallVoidMethod(parcelObj, gParcelOffsets.recycle);
|
||||
}
|
||||
|
||||
static void android_os_Parcel_markSensitive(jlong nativePtr)
|
||||
{
|
||||
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
|
||||
if (parcel) {
|
||||
parcel->markSensitive();
|
||||
}
|
||||
}
|
||||
|
||||
static jint android_os_Parcel_dataSize(jlong nativePtr)
|
||||
{
|
||||
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
|
||||
@@ -757,6 +765,8 @@ static jboolean android_os_Parcel_replaceCallingWorkSourceUid(jlong nativePtr, j
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const JNINativeMethod gParcelMethods[] = {
|
||||
// @CriticalNative
|
||||
{"nativeMarkSensitive", "(J)V", (void*)android_os_Parcel_markSensitive},
|
||||
// @CriticalNative
|
||||
{"nativeDataSize", "(J)I", (void*)android_os_Parcel_dataSize},
|
||||
// @CriticalNative
|
||||
|
||||
Reference in New Issue
Block a user