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

Commit d35e44d4 authored by Demon000's avatar Demon000 Committed by Arian
Browse files

DozeSensors: only use proximity sensor if supported

On msm-4.14 devices, when the proximity sensor is in use,
the smp2p-sleepstate IRQ is fired multiple times a second,
with each one holding a 200ms wakelock.
This is probably a bug in the DSP firmware.
To fix this, avoid using the proximity sensor in doze mode,
because sleep is preferred to turning off the screen.

Change-Id: I57750afd77267abdc49780f70636626d20e666ad
parent 09488b0e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -27,4 +27,7 @@

    <!-- Doze: does the long press sensor need a proximity check? -->
    <bool name="doze_long_press_proximity_check">false</bool>

    <!-- Whether usage of the proximity sensor during doze is supported -->
    <bool name="doze_proximity_sensor_supported">true</bool>
</resources>
+9 −7
Original line number Diff line number Diff line
@@ -268,6 +268,7 @@ public class DozeSensors {
                        false /* requiresProx */,
                        true /* immediatelyReRegister */),
        };
        if (resources.getBoolean(com.android.systemui.R.bool.doze_proximity_sensor_supported)) {
            setProxListening(false);  // Don't immediately start listening when we register.
            mProximitySensor.register(
                    proximityEvent -> {
@@ -275,6 +276,7 @@ public class DozeSensors {
                            mProxCallback.accept(!proximityEvent.getBelow());
                        }
                    });
        }

        mDevicePostureController.addCallback(mDevicePostureCallback);
    }