libbinder_ndk: eradicate global lock
Let the nightmares cease!
Without contention, peace.
Note, in the case that an ABpBinder is backed by a BBinder (this happens
when you talk in-process to something between the NDK backend and either
the C++, Rust, or Java backends of AIDL), this introduces an additional
allocation b/c the BBinder's mExtra needs to be allocated for
BBinder::withLock to work. Since this is generally frowned upon, and the
thrashing in this case is already pretty egregious, I don't mind it.
Now, binder proxies can be allocated simultaneously in a process.
Bug: 192023359
Test: CtsNdkBinderTestCases
Change-Id: Ib1c28c9488f7a03579ea9d18347a8fc08cc3f48a
diff --git a/libs/binder/ndk/ibinder_internal.h b/libs/binder/ndk/ibinder_internal.h
index 22cacb4..f2c69b3 100644
--- a/libs/binder/ndk/ibinder_internal.h
+++ b/libs/binder/ndk/ibinder_internal.h
@@ -105,6 +105,7 @@
ABpBinder* asABpBinder() override { return this; }
private:
+ friend android::sp<ABpBinder>;
explicit ABpBinder(const ::android::sp<::android::IBinder>& binder);
};