Loading libs/binder/ndk/ibinder.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,26 @@ AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder) { return binder.get(); } AIBinder_Weak* AIBinder_Weak_clone(const AIBinder_Weak* weak) { if (weak == nullptr) { return nullptr; } return new AIBinder_Weak{weak->binder}; } bool AIBinder_lt(const AIBinder* lhs, const AIBinder* rhs) { if (lhs == nullptr || rhs == nullptr) return lhs < rhs; return const_cast<AIBinder*>(lhs)->getBinder() < const_cast<AIBinder*>(rhs)->getBinder(); } bool AIBinder_Weak_lt(const AIBinder_Weak* lhs, const AIBinder_Weak* rhs) { if (lhs == nullptr || rhs == nullptr) return lhs < rhs; return lhs->binder < rhs->binder; } AIBinder_Class::AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact) Loading libs/binder/ndk/include_ndk/android/binder_ibinder.h +62 −0 Original line number Diff line number Diff line Loading @@ -657,6 +657,68 @@ binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) __INTRODU */ const char* AIBinder_Class_getDescriptor(const AIBinder_Class* clazz) __INTRODUCED_IN(31); /** * Whether AIBinder is less than another. * * This provides a per-process-unique total ordering of binders determined by * an underlying allocation address where a null AIBinder* is considered to be * ordered before all other binders. * * AIBinder* pointers themselves actually also create a per-process-unique total * ordering. However, this ordering is inconsistent with AIBinder_Weak_lt for * remote binders. * * Available since API level 31. * * \param lhs comparison object * \param rhs comparison object * * \return whether "lhs < rhs" is true */ bool AIBinder_lt(const AIBinder* lhs, const AIBinder* rhs); /** * Clone an AIBinder_Weak. Useful because even if a weak binder promotes to a * null value, after further binder transactions, it may no longer promote to a * null value. * * Available since API level 31. * * \param weak Object to clone * * \return clone of the input parameter. This must be deleted with * AIBinder_Weak_delete. Null if weak input parameter is also null. */ AIBinder_Weak* AIBinder_Weak_clone(const AIBinder_Weak* weak); /** * Whether AIBinder_Weak is less than another. * * This provides a per-process-unique total ordering of binders which is exactly * the same as AIBinder_lt. Similarly, a null AIBinder_Weak* is considered to be * ordered before all other weak references. * * If you have many AIBinder_Weak* objects which are all references to distinct * binder objects which happen to have the same underlying address (as ordered * by AIBinder_lt), these AIBinder_Weak* objects will retain the same order with * respect to all other AIBinder_Weak* pointers with different underlying * addresses and are also guaranteed to have a per-process-unique ordering. That * is, even though multiple AIBinder* instances may happen to be allocated at * the same underlying address, this function will still correctly distinguish * that these are weak pointers to different binder objects. * * Unlike AIBinder*, the AIBinder_Weak* addresses themselves have nothing to do * with the underlying binder. * * Available since API level 31. * * \param lhs comparison object * \param rhs comparison object * * \return whether "lhs < rhs" is true */ bool AIBinder_Weak_lt(const AIBinder_Weak* lhs, const AIBinder_Weak* rhs); #endif //__ANDROID_API__ >= 31 __END_DECLS Loading libs/binder/ndk/libbinder_ndk.map.txt +3 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,9 @@ LIBBINDER_NDK31 { # introduced=31 AServiceManager_waitForService; # apex llndk AIBinder_Class_getDescriptor; AIBinder_Weak_clone; AIBinder_Weak_lt; AIBinder_lt; AParcel_appendFrom; AParcel_create; AParcel_getDataSize; Loading Loading
libs/binder/ndk/ibinder.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,26 @@ AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder) { return binder.get(); } AIBinder_Weak* AIBinder_Weak_clone(const AIBinder_Weak* weak) { if (weak == nullptr) { return nullptr; } return new AIBinder_Weak{weak->binder}; } bool AIBinder_lt(const AIBinder* lhs, const AIBinder* rhs) { if (lhs == nullptr || rhs == nullptr) return lhs < rhs; return const_cast<AIBinder*>(lhs)->getBinder() < const_cast<AIBinder*>(rhs)->getBinder(); } bool AIBinder_Weak_lt(const AIBinder_Weak* lhs, const AIBinder_Weak* rhs) { if (lhs == nullptr || rhs == nullptr) return lhs < rhs; return lhs->binder < rhs->binder; } AIBinder_Class::AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact) Loading
libs/binder/ndk/include_ndk/android/binder_ibinder.h +62 −0 Original line number Diff line number Diff line Loading @@ -657,6 +657,68 @@ binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) __INTRODU */ const char* AIBinder_Class_getDescriptor(const AIBinder_Class* clazz) __INTRODUCED_IN(31); /** * Whether AIBinder is less than another. * * This provides a per-process-unique total ordering of binders determined by * an underlying allocation address where a null AIBinder* is considered to be * ordered before all other binders. * * AIBinder* pointers themselves actually also create a per-process-unique total * ordering. However, this ordering is inconsistent with AIBinder_Weak_lt for * remote binders. * * Available since API level 31. * * \param lhs comparison object * \param rhs comparison object * * \return whether "lhs < rhs" is true */ bool AIBinder_lt(const AIBinder* lhs, const AIBinder* rhs); /** * Clone an AIBinder_Weak. Useful because even if a weak binder promotes to a * null value, after further binder transactions, it may no longer promote to a * null value. * * Available since API level 31. * * \param weak Object to clone * * \return clone of the input parameter. This must be deleted with * AIBinder_Weak_delete. Null if weak input parameter is also null. */ AIBinder_Weak* AIBinder_Weak_clone(const AIBinder_Weak* weak); /** * Whether AIBinder_Weak is less than another. * * This provides a per-process-unique total ordering of binders which is exactly * the same as AIBinder_lt. Similarly, a null AIBinder_Weak* is considered to be * ordered before all other weak references. * * If you have many AIBinder_Weak* objects which are all references to distinct * binder objects which happen to have the same underlying address (as ordered * by AIBinder_lt), these AIBinder_Weak* objects will retain the same order with * respect to all other AIBinder_Weak* pointers with different underlying * addresses and are also guaranteed to have a per-process-unique ordering. That * is, even though multiple AIBinder* instances may happen to be allocated at * the same underlying address, this function will still correctly distinguish * that these are weak pointers to different binder objects. * * Unlike AIBinder*, the AIBinder_Weak* addresses themselves have nothing to do * with the underlying binder. * * Available since API level 31. * * \param lhs comparison object * \param rhs comparison object * * \return whether "lhs < rhs" is true */ bool AIBinder_Weak_lt(const AIBinder_Weak* lhs, const AIBinder_Weak* rhs); #endif //__ANDROID_API__ >= 31 __END_DECLS Loading
libs/binder/ndk/libbinder_ndk.map.txt +3 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,9 @@ LIBBINDER_NDK31 { # introduced=31 AServiceManager_waitForService; # apex llndk AIBinder_Class_getDescriptor; AIBinder_Weak_clone; AIBinder_Weak_lt; AIBinder_lt; AParcel_appendFrom; AParcel_create; AParcel_getDataSize; Loading