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

Commit 5ad67f02 authored by Kweku Adams's avatar Kweku Adams
Browse files

Add additional comments to explain code.

Adding additional comments to explain why the MotionListener unregisters
in one method and not the other so future readers better understand
what's happening.

Bug: N/A
Test: N/A
Change-Id: I1a43946ba537f9e0243b2ddfeedb7c0d3a20e444
parent 9ee1d945
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -761,6 +761,7 @@ public class DeviceIdleController extends SystemService
        @Override
        @Override
        public void onTrigger(TriggerEvent event) {
        public void onTrigger(TriggerEvent event) {
            synchronized (DeviceIdleController.this) {
            synchronized (DeviceIdleController.this) {
                // One_shot sensors (which call onTrigger) are unregistered when onTrigger is called
                active = false;
                active = false;
                motionLocked();
                motionLocked();
            }
            }
@@ -769,6 +770,9 @@ public class DeviceIdleController extends SystemService
        @Override
        @Override
        public void onSensorChanged(SensorEvent event) {
        public void onSensorChanged(SensorEvent event) {
            synchronized (DeviceIdleController.this) {
            synchronized (DeviceIdleController.this) {
                // Since one_shot sensors are unregistered when onTrigger is called, unregister
                // listeners here so that the MotionListener is in a consistent state when it calls
                // out to motionLocked.
                mSensorManager.unregisterListener(this, mMotionSensor);
                mSensorManager.unregisterListener(this, mMotionSensor);
                active = false;
                active = false;
                motionLocked();
                motionLocked();