Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0da9d5c7 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder_ndk: cleaner API for making SpAIBinder

Both to make it easier to change the underlying API in the future and
to make it look nicer.

Bug: 112664205
Test: android.binder.cts
Change-Id: I61ae78949055a4dde655dd54f5dad86ea354e6b4
parent 2cb822fe
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -56,6 +56,15 @@ public:
        return std::static_pointer_cast<CHILD>(ref());
    }

    /**
     * Convenience method for making an object directly with a reference.
     */
    template<class T, class... Args>
    static std::shared_ptr<T> make(Args&&... args) {
        T* t = new T(std::forward<Args>(args)...);
        return t->template ref<T>();
    }

private:
    std::once_flag mFlagThis;
    std::weak_ptr<SharedRefBase> mThis;