diff options
Diffstat (limited to 'platform/sysroot/usr/include/android/binder_interface_utils.h')
-rw-r--r-- | platform/sysroot/usr/include/android/binder_interface_utils.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/platform/sysroot/usr/include/android/binder_interface_utils.h b/platform/sysroot/usr/include/android/binder_interface_utils.h index 33e458613..f44ce0c63 100644 --- a/platform/sysroot/usr/include/android/binder_interface_utils.h +++ b/platform/sysroot/usr/include/android/binder_interface_utils.h @@ -88,13 +88,21 @@ class SharedRefBase { static void operator delete(void* p) { std::free(p); } - private: - std::once_flag mFlagThis; - std::weak_ptr<SharedRefBase> mThis; - + // Once minSdkVersion is 30, we are guaranteed to be building with the + // Android 11 AIDL compiler which supports the SharedRefBase::make API. + // // Use 'SharedRefBase::make<T>(...)' to make. SharedRefBase has implicit // ownership. Making this operator private to avoid double-ownership. +#if !defined(__ANDROID_API__) || __ANDROID_API__ >= 30 + private: +#else + [[deprecated("Prefer SharedRefBase::make<T>(...) if possible.")]] +#endif static void* operator new(size_t s) { return std::malloc(s); } + + private: + std::once_flag mFlagThis; + std::weak_ptr<SharedRefBase> mThis; }; /** |