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

Commit 045f7580 authored by Demon000's avatar Demon000 Committed by Paul Keith
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 dcb96947
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -31,4 +31,7 @@

    <!-- If not zero, limits the internal screen recorder's framerate to the set value. -->
    <integer name="config_screenRecorderMaxFramerate">0</integer>

    <!-- Whether usage of the proximity sensor during doze is supported -->
    <bool name="doze_proximity_sensor_supported">true</bool>
</resources>
+10 −7
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.UiEventLoggerImpl;
import com.android.internal.logging.nano.MetricsProto;
import com.android.systemui.R;
import com.android.systemui.plugins.SensorManagerPlugin;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.util.sensors.AsyncSensorManager;
@@ -174,6 +175,7 @@ public class DozeSensors {
                        dozeLog),
        };

        if (context.getResources().getBoolean(R.bool.doze_proximity_sensor_supported)) {
            setProxListening(false);  // Don't immediately start listening when we register.
            mProximitySensor.register(
                    proximityEvent -> {
@@ -182,6 +184,7 @@ public class DozeSensors {
                        }
                    });
        }
    }

    /**
     *  Unregister any sensors.