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

Commit a3a884d9 authored by Michael Richardson's avatar Michael Richardson Committed by Jean-Baptiste Queru
Browse files

Allow META* macros outside of the framework

The META* macros are useful outside of the framework
for other systems implementing Binder interfaces, but
they depend upon the android namespace. This includes
the appropriate namespace operations, which should be
sane even in that android namespace.

Change-Id: If600156c65191f51f487d0ee301d9f9f532b263d
parent be0807b3
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -72,21 +72,24 @@ protected:
// ----------------------------------------------------------------------

#define DECLARE_META_INTERFACE(INTERFACE)                               \
    static const String16 descriptor;                                   \
    static sp<I##INTERFACE> asInterface(const sp<IBinder>& obj);        \
    virtual const String16& getInterfaceDescriptor() const;             \
    static const android::String16 descriptor;                          \
    static android::sp<I##INTERFACE> asInterface(                       \
            const android::sp<android::IBinder>& obj);                  \
    virtual const android::String16& getInterfaceDescriptor() const;    \
    I##INTERFACE();                                                     \
    virtual ~I##INTERFACE();                                            \


#define IMPLEMENT_META_INTERFACE(INTERFACE, NAME)                       \
    const String16 I##INTERFACE::descriptor(NAME);                      \
    const String16& I##INTERFACE::getInterfaceDescriptor() const {      \
    const android::String16 I##INTERFACE::descriptor(NAME);             \
    const android::String16&                                            \
            I##INTERFACE::getInterfaceDescriptor() const {              \
        return I##INTERFACE::descriptor;                                \
    }                                                                   \
    sp<I##INTERFACE> I##INTERFACE::asInterface(const sp<IBinder>& obj)  \
    android::sp<I##INTERFACE> I##INTERFACE::asInterface(                \
            const android::sp<android::IBinder>& obj)                   \
    {                                                                   \
        sp<I##INTERFACE> intr;                                          \
        android::sp<I##INTERFACE> intr;                                 \
        if (obj != NULL) {                                              \
            intr = static_cast<I##INTERFACE*>(                          \
                obj->queryLocalInterface(                               \