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

Commit 38b17925 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SensorDeviceUtils: do not create sp(this) in constructor."

parents c7404f3b a53e89d2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -29,6 +29,11 @@ namespace android {
namespace SensorDeviceUtils {

HidlServiceRegistrationWaiter::HidlServiceRegistrationWaiter() {
}

void HidlServiceRegistrationWaiter::onFirstRef() {
    // Creating sp<...>(this) in the constructor should be avoided, hence
    // registerForNotifications is called in onFirstRef callback.
    mRegistered = ISensors::registerForNotifications("default", this);
}

+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ public:
     * @return true if service is restart since last reset(); false otherwise.
     */
    bool wait();
protected:
    void onFirstRef() override;
private:
    bool mRegistered;