Allow reregistering callback
Callbacks would have to be allowed being reregistered
to handle frameworks restarts.
Bug: 35758079
Test: adb shell stop; adb shell start; and see if USB notifications happen.
Change-Id: I256b4e714340f48c1dd8377e660cb28ebd716b8a
diff --git a/usb/1.0/default/Usb.h b/usb/1.0/default/Usb.h
index cf418f4..c34d080 100644
--- a/usb/1.0/default/Usb.h
+++ b/usb/1.0/default/Usb.h
@@ -32,6 +32,7 @@
using ::android::sp;
struct Usb : public IUsb {
+ Usb();
Return<void> switchRole(const hidl_string& portName, const PortRole& role) override;
Return<void> setCallback(const sp<IUsbCallback>& callback) override;
Return<void> queryPortStatus() override;
@@ -39,6 +40,7 @@
sp<IUsbCallback> mCallback;
private:
pthread_t mPoll;
+ pthread_mutex_t mLock = PTHREAD_MUTEX_INITIALIZER;
};
} // namespace implementation