Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b4cc363 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "Binder: allow stability downgrade" am: 7236cf6d am: 0852de16 am:...

Merge "Binder: allow stability downgrade" am: 7236cf6d am: 0852de16 am: e86ea5d7 am: 32f27edf

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1651544

Change-Id: If57b7ff10a3ffe56e14752650c3d3bd347f2a823
parents 34ec9d5e 32f27edf
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -549,6 +549,16 @@ public class Binder implements IBinder {
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    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
     * driver.  This can be
+13 −0
Original line number Diff line number Diff line
@@ -487,9 +487,15 @@ public:
    }

    void markVintf() {
        AutoMutex _l(mLock);
        mVintf = true;
    }

    void forceDowngradeToSystemStability() {
        AutoMutex _l(mLock);
        mVintf = false;
    }

    sp<IBinder> getExtension() {
        AutoMutex _l(mLock);
        sp<JavaBBinder> b = mBinder.promote();
@@ -1005,6 +1011,12 @@ static void android_os_Binder_markVintfStability(JNIEnv* env, jobject clazz) {
    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)
{
    IPCThreadState::self()->flushCommands();
@@ -1069,6 +1081,7 @@ static const JNINativeMethod gBinderMethods[] = {
    { "clearCallingWorkSource", "()J", (void*)android_os_Binder_clearCallingWorkSource },
    { "restoreCallingWorkSource", "(J)V", (void*)android_os_Binder_restoreCallingWorkSource },
    { "markVintfStability", "()V", (void*)android_os_Binder_markVintfStability},
    { "forceDowngradeToSystemStability", "()V", (void*)android_os_Binder_forceDowngradeToSystemStability},
    { "flushPendingCommands", "()V", (void*)android_os_Binder_flushPendingCommands },
    { "getNativeBBinderHolder", "()J", (void*)android_os_Binder_getNativeBBinderHolder },
    { "getNativeFinalizer", "()J", (void*)android_os_Binder_getNativeFinalizer },