SensorDeviceUtils: do not create sp(this) in constructor.
This may cause refcount problems as stated in RefBase
document. Do this in HidlServiceRegistrationWaiter::onFirstRef
instead.
Test: boots multiple times
Bug: 68765551
Change-Id: Iae2589f7e003cb8d44fe6ca43f1342b89125f763
diff --git a/services/sensorservice/SensorDeviceUtils.h b/services/sensorservice/SensorDeviceUtils.h
index 4e42914..e2eb606 100644
--- a/services/sensorservice/SensorDeviceUtils.h
+++ b/services/sensorservice/SensorDeviceUtils.h
@@ -46,6 +46,8 @@
* @return true if service is restart since last reset(); false otherwise.
*/
bool wait();
+protected:
+ void onFirstRef() override;
private:
bool mRegistered;