Loading libs/binder/ndk/ibinder.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -307,7 +307,8 @@ AIBinder_Class::AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_o : onCreate(onCreate), : onCreate(onCreate), onDestroy(onDestroy), onDestroy(onDestroy), onTransact(onTransact), onTransact(onTransact), mInterfaceDescriptor(interfaceDescriptor) {} mInterfaceDescriptor(interfaceDescriptor), mWideInterfaceDescriptor(interfaceDescriptor) {} AIBinder_Class* AIBinder_Class_define(const char* interfaceDescriptor, AIBinder_Class* AIBinder_Class_define(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class_onCreate onCreate, Loading Loading @@ -335,6 +336,12 @@ void AIBinder_Class_setHandleShellCommand(AIBinder_Class* clazz, clazz->handleShellCommand = handleShellCommand; clazz->handleShellCommand = handleShellCommand; } } const char* AIBinder_Class_getDescriptor(const AIBinder_Class* clazz) { CHECK(clazz != nullptr) << "getDescriptor requires non-null clazz"; return clazz->getInterfaceDescriptorUtf8(); } void AIBinder_DeathRecipient::TransferDeathRecipient::binderDied(const wp<IBinder>& who) { void AIBinder_DeathRecipient::TransferDeathRecipient::binderDied(const wp<IBinder>& who) { CHECK(who == mWho); CHECK(who == mWho); Loading libs/binder/ndk/ibinder_internal.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -112,7 +112,8 @@ struct AIBinder_Class { AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact); AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact); const ::android::String16& getInterfaceDescriptor() const { return mInterfaceDescriptor; } const ::android::String16& getInterfaceDescriptor() const { return mWideInterfaceDescriptor; } const char* getInterfaceDescriptorUtf8() const { return mInterfaceDescriptor.c_str(); } // required to be non-null, implemented for every class // required to be non-null, implemented for every class const AIBinder_Class_onCreate onCreate = nullptr; const AIBinder_Class_onCreate onCreate = nullptr; Loading @@ -124,9 +125,11 @@ struct AIBinder_Class { AIBinder_handleShellCommand handleShellCommand = nullptr; AIBinder_handleShellCommand handleShellCommand = nullptr; private: private: // Copy of the raw char string for when we don't have to return UTF-16 const std::string mInterfaceDescriptor; // This must be a String16 since BBinder virtual getInterfaceDescriptor returns a reference to // This must be a String16 since BBinder virtual getInterfaceDescriptor returns a reference to // one. // one. const ::android::String16 mInterfaceDescriptor; const ::android::String16 mWideInterfaceDescriptor; }; }; // Ownership is like this (when linked to death): // Ownership is like this (when linked to death): Loading libs/binder/ndk/include_ndk/android/binder_ibinder.h +17 −0 Original line number Original line Diff line number Diff line Loading @@ -642,6 +642,23 @@ binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) __INTRODU #endif //__ANDROID_API__ >= 30 #endif //__ANDROID_API__ >= 30 #if __ANDROID_API__ >= 31 /** * Retrieve the class descriptor for the class. * * Available since API level 31. * * \param clazz the class to fetch the descriptor from * * \return the class descriptor string. This pointer will never be null; a * descriptor is required to define a class. The pointer is owned by the class * and will remain valid as long as the class does. */ const char* AIBinder_Class_getDescriptor(const AIBinder_Class* clazz) __INTRODUCED_IN(31); #endif //__ANDROID_API__ >= 31 __END_DECLS __END_DECLS /** @} */ /** @} */ libs/binder/ndk/libbinder_ndk.map.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -121,6 +121,7 @@ LIBBINDER_NDK31 { # introduced=31 AServiceManager_registerLazyService; # llndk AServiceManager_registerLazyService; # llndk AServiceManager_waitForService; # apex llndk AServiceManager_waitForService; # apex llndk AIBinder_Class_getDescriptor; AParcel_appendFrom; AParcel_appendFrom; AParcel_create; AParcel_create; AParcel_getDataSize; AParcel_getDataSize; Loading libs/binder/ndk/tests/iface.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,7 @@ using ::android::wp; const char* IFoo::kSomeInstanceName = "libbinder_ndk-test-IFoo"; const char* IFoo::kSomeInstanceName = "libbinder_ndk-test-IFoo"; const char* IFoo::kInstanceNameToDieFor = "libbinder_ndk-test-IFoo-to-die"; const char* IFoo::kInstanceNameToDieFor = "libbinder_ndk-test-IFoo-to-die"; const char* kIFooDescriptor = "my-special-IFoo-class"; const char* IFoo::kIFooDescriptor = "my-special-IFoo-class"; struct IFoo_Class_Data { struct IFoo_Class_Data { sp<IFoo> foo; sp<IFoo> foo; Loading Loading
libs/binder/ndk/ibinder.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -307,7 +307,8 @@ AIBinder_Class::AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_o : onCreate(onCreate), : onCreate(onCreate), onDestroy(onDestroy), onDestroy(onDestroy), onTransact(onTransact), onTransact(onTransact), mInterfaceDescriptor(interfaceDescriptor) {} mInterfaceDescriptor(interfaceDescriptor), mWideInterfaceDescriptor(interfaceDescriptor) {} AIBinder_Class* AIBinder_Class_define(const char* interfaceDescriptor, AIBinder_Class* AIBinder_Class_define(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class_onCreate onCreate, Loading Loading @@ -335,6 +336,12 @@ void AIBinder_Class_setHandleShellCommand(AIBinder_Class* clazz, clazz->handleShellCommand = handleShellCommand; clazz->handleShellCommand = handleShellCommand; } } const char* AIBinder_Class_getDescriptor(const AIBinder_Class* clazz) { CHECK(clazz != nullptr) << "getDescriptor requires non-null clazz"; return clazz->getInterfaceDescriptorUtf8(); } void AIBinder_DeathRecipient::TransferDeathRecipient::binderDied(const wp<IBinder>& who) { void AIBinder_DeathRecipient::TransferDeathRecipient::binderDied(const wp<IBinder>& who) { CHECK(who == mWho); CHECK(who == mWho); Loading
libs/binder/ndk/ibinder_internal.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -112,7 +112,8 @@ struct AIBinder_Class { AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact); AIBinder_Class_onDestroy onDestroy, AIBinder_Class_onTransact onTransact); const ::android::String16& getInterfaceDescriptor() const { return mInterfaceDescriptor; } const ::android::String16& getInterfaceDescriptor() const { return mWideInterfaceDescriptor; } const char* getInterfaceDescriptorUtf8() const { return mInterfaceDescriptor.c_str(); } // required to be non-null, implemented for every class // required to be non-null, implemented for every class const AIBinder_Class_onCreate onCreate = nullptr; const AIBinder_Class_onCreate onCreate = nullptr; Loading @@ -124,9 +125,11 @@ struct AIBinder_Class { AIBinder_handleShellCommand handleShellCommand = nullptr; AIBinder_handleShellCommand handleShellCommand = nullptr; private: private: // Copy of the raw char string for when we don't have to return UTF-16 const std::string mInterfaceDescriptor; // This must be a String16 since BBinder virtual getInterfaceDescriptor returns a reference to // This must be a String16 since BBinder virtual getInterfaceDescriptor returns a reference to // one. // one. const ::android::String16 mInterfaceDescriptor; const ::android::String16 mWideInterfaceDescriptor; }; }; // Ownership is like this (when linked to death): // Ownership is like this (when linked to death): Loading
libs/binder/ndk/include_ndk/android/binder_ibinder.h +17 −0 Original line number Original line Diff line number Diff line Loading @@ -642,6 +642,23 @@ binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) __INTRODU #endif //__ANDROID_API__ >= 30 #endif //__ANDROID_API__ >= 30 #if __ANDROID_API__ >= 31 /** * Retrieve the class descriptor for the class. * * Available since API level 31. * * \param clazz the class to fetch the descriptor from * * \return the class descriptor string. This pointer will never be null; a * descriptor is required to define a class. The pointer is owned by the class * and will remain valid as long as the class does. */ const char* AIBinder_Class_getDescriptor(const AIBinder_Class* clazz) __INTRODUCED_IN(31); #endif //__ANDROID_API__ >= 31 __END_DECLS __END_DECLS /** @} */ /** @} */
libs/binder/ndk/libbinder_ndk.map.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -121,6 +121,7 @@ LIBBINDER_NDK31 { # introduced=31 AServiceManager_registerLazyService; # llndk AServiceManager_registerLazyService; # llndk AServiceManager_waitForService; # apex llndk AServiceManager_waitForService; # apex llndk AIBinder_Class_getDescriptor; AParcel_appendFrom; AParcel_appendFrom; AParcel_create; AParcel_create; AParcel_getDataSize; AParcel_getDataSize; Loading
libs/binder/ndk/tests/iface.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,7 @@ using ::android::wp; const char* IFoo::kSomeInstanceName = "libbinder_ndk-test-IFoo"; const char* IFoo::kSomeInstanceName = "libbinder_ndk-test-IFoo"; const char* IFoo::kInstanceNameToDieFor = "libbinder_ndk-test-IFoo-to-die"; const char* IFoo::kInstanceNameToDieFor = "libbinder_ndk-test-IFoo-to-die"; const char* kIFooDescriptor = "my-special-IFoo-class"; const char* IFoo::kIFooDescriptor = "my-special-IFoo-class"; struct IFoo_Class_Data { struct IFoo_Class_Data { sp<IFoo> foo; sp<IFoo> foo; Loading