From f19b092800534e600f563b3f7a5aec65125f56a2 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 14 Jan 2022 21:06:34 +0000 Subject: Change IInterface default_impl to use sp<> Make it simpler to use with existing interface APIs. sp<> was used everywhere in IInterface except for default_impl. Bug: 198787022 Test: m Change-Id: I078c45bd9154f0281ac870850e190d874e1fca83 --- libs/binder/include/binder/IInterface.h | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/libs/binder/include/binder/IInterface.h b/libs/binder/include/binder/IInterface.h index 7d14315b01..f295417ab2 100644 --- a/libs/binder/include/binder/IInterface.h +++ b/libs/binder/include/binder/IInterface.h @@ -93,20 +93,20 @@ protected: // ---------------------------------------------------------------------- -#define DECLARE_META_INTERFACE(INTERFACE) \ -public: \ - static const ::android::String16 descriptor; \ - static ::android::sp asInterface( \ - const ::android::sp<::android::IBinder>& obj); \ - virtual const ::android::String16& getInterfaceDescriptor() const; \ - I##INTERFACE(); \ - virtual ~I##INTERFACE(); \ - static bool setDefaultImpl(std::unique_ptr impl); \ - static const std::unique_ptr& getDefaultImpl(); \ -private: \ - static std::unique_ptr default_impl; \ -public: \ - +#define DECLARE_META_INTERFACE(INTERFACE) \ +public: \ + static const ::android::String16 descriptor; \ + static ::android::sp asInterface(const ::android::sp<::android::IBinder>& obj); \ + virtual const ::android::String16& getInterfaceDescriptor() const; \ + I##INTERFACE(); \ + virtual ~I##INTERFACE(); \ + static bool setDefaultImpl(::android::sp impl); \ + static const ::android::sp& getDefaultImpl(); \ + \ +private: \ + static ::android::sp default_impl; \ + \ +public: #define __IINTF_CONCAT(x, y) (x ## y) @@ -142,8 +142,8 @@ public: \ } \ return intr; \ } \ - std::unique_ptr ITYPE::default_impl; \ - bool ITYPE::setDefaultImpl(std::unique_ptr impl) { \ + ::android::sp ITYPE::default_impl; \ + bool ITYPE::setDefaultImpl(::android::sp impl) { \ /* Only one user of this interface can use this function */ \ /* at a time. This is a heuristic to detect if two different */ \ /* users in the same process use this function. */ \ @@ -154,7 +154,7 @@ public: \ } \ return false; \ } \ - const std::unique_ptr& ITYPE::getDefaultImpl() { return ITYPE::default_impl; } \ + const ::android::sp& ITYPE::getDefaultImpl() { return ITYPE::default_impl; } \ ITYPE::INAME() {} \ ITYPE::~INAME() {} -- cgit v1.2.3-59-g8ed1b