Merge "Binder: allow stability downgrade" am: 7236cf6dca am: 0852de16cb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1651544 Change-Id: I5f0e1dcb3a06dcb35bf2c68f077afbe32a4e8088
This commit is contained in:
@@ -542,6 +542,16 @@ public class Binder implements IBinder {
|
|||||||
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||||
public final native void markVintfStability();
|
public final native void markVintfStability();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use a VINTF-stability binder w/o VINTF requirements. Should be called
|
||||||
|
* on a binder before it is sent out of process.
|
||||||
|
*
|
||||||
|
* This must be called before the object is sent to another process.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final native void forceDowngradeToSystemStability();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush any Binder commands pending in the current thread to the kernel
|
* Flush any Binder commands pending in the current thread to the kernel
|
||||||
* driver. This can be
|
* driver. This can be
|
||||||
|
|||||||
@@ -486,9 +486,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void markVintf() {
|
void markVintf() {
|
||||||
|
AutoMutex _l(mLock);
|
||||||
mVintf = true;
|
mVintf = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void forceDowngradeToSystemStability() {
|
||||||
|
AutoMutex _l(mLock);
|
||||||
|
mVintf = false;
|
||||||
|
}
|
||||||
|
|
||||||
sp<IBinder> getExtension() {
|
sp<IBinder> getExtension() {
|
||||||
AutoMutex _l(mLock);
|
AutoMutex _l(mLock);
|
||||||
sp<JavaBBinder> b = mBinder.promote();
|
sp<JavaBBinder> b = mBinder.promote();
|
||||||
@@ -1013,6 +1019,12 @@ static void android_os_Binder_markVintfStability(JNIEnv* env, jobject clazz) {
|
|||||||
jbh->markVintf();
|
jbh->markVintf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void android_os_Binder_forceDowngradeToSystemStability(JNIEnv* env, jobject clazz) {
|
||||||
|
JavaBBinderHolder* jbh =
|
||||||
|
(JavaBBinderHolder*) env->GetLongField(clazz, gBinderOffsets.mObject);
|
||||||
|
jbh->forceDowngradeToSystemStability();
|
||||||
|
}
|
||||||
|
|
||||||
static void android_os_Binder_flushPendingCommands(JNIEnv* env, jobject clazz)
|
static void android_os_Binder_flushPendingCommands(JNIEnv* env, jobject clazz)
|
||||||
{
|
{
|
||||||
IPCThreadState::self()->flushCommands();
|
IPCThreadState::self()->flushCommands();
|
||||||
@@ -1076,6 +1088,7 @@ static const JNINativeMethod gBinderMethods[] = {
|
|||||||
{ "clearCallingWorkSource", "()J", (void*)android_os_Binder_clearCallingWorkSource },
|
{ "clearCallingWorkSource", "()J", (void*)android_os_Binder_clearCallingWorkSource },
|
||||||
{ "restoreCallingWorkSource", "(J)V", (void*)android_os_Binder_restoreCallingWorkSource },
|
{ "restoreCallingWorkSource", "(J)V", (void*)android_os_Binder_restoreCallingWorkSource },
|
||||||
{ "markVintfStability", "()V", (void*)android_os_Binder_markVintfStability},
|
{ "markVintfStability", "()V", (void*)android_os_Binder_markVintfStability},
|
||||||
|
{ "forceDowngradeToSystemStability", "()V", (void*)android_os_Binder_forceDowngradeToSystemStability},
|
||||||
{ "flushPendingCommands", "()V", (void*)android_os_Binder_flushPendingCommands },
|
{ "flushPendingCommands", "()V", (void*)android_os_Binder_flushPendingCommands },
|
||||||
{ "getNativeBBinderHolder", "()J", (void*)android_os_Binder_getNativeBBinderHolder },
|
{ "getNativeBBinderHolder", "()J", (void*)android_os_Binder_getNativeBBinderHolder },
|
||||||
{ "getNativeFinalizer", "()J", (void*)android_os_Binder_getNativeFinalizer },
|
{ "getNativeFinalizer", "()J", (void*)android_os_Binder_getNativeFinalizer },
|
||||||
|
|||||||
Reference in New Issue
Block a user