123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #ifndef ANDROID_MEDIASERVICE_DEATHNOTIFIER_H
- #define ANDROID_MEDIASERVICE_DEATHNOTIFIER_H
- #include <android/hidl/base/1.0/IBase.h>
- #include <binder/Binder.h>
- #include <hidl/HidlSupport.h>
- #include <variant>
- namespace android {
- class DeathNotifier {
- public:
- using HBase = hidl::base::V1_0::IBase;
- using Notify = std::function<void()>;
- DeathNotifier(sp<IBinder> const& service, Notify const& notify);
- DeathNotifier(sp<HBase> const& service, Notify const& notify);
- DeathNotifier(DeathNotifier&& other);
- ~DeathNotifier();
- private:
- std::variant<std::monostate, sp<IBinder>, sp<HBase>> mService;
- class DeathRecipient;
- sp<DeathRecipient> mDeathRecipient;
- };
- }
- #endif
|