refactor(events): Simplify ScopedCallback creation with type deduction
Introduce a new template overload for `makeScopedCallback` that
automatically deduces the event type from the provided callback's
signature. This is achieved using a `function_traits` helper to inspect
the lambda's arguments.
Previously, creating a scoped callback was verbose:
auto handle = android::base::makeScopedCallback<
SomeCallbackSource<MyEvent>, MyEvent>
(source, [](const MyEvent& event) {});
Now, the compiler can deduce the template arguments automatically:
auto handle = android::base::makeScopedCallback(
source, [](const MyEvent& event) {});
Change-Id: I4a95ba8715ea331d964c7a302afd65b31adcae55
2 files changed