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

Commit 3792f09d authored by Demon000's avatar Demon000 Committed by Bruno Martins
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 d42ec4c0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -42,4 +42,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>
+10 −7
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.UiEventLoggerImpl;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.R;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.plugins.SensorManagerPlugin;
import com.android.systemui.statusbar.phone.DozeParameters;
@@ -262,6 +263,7 @@ public class DozeSensors {
                        false /* ignoresSetting */,
                        false /* requiresProx */),
        };
        if (context.getResources().getBoolean(R.bool.doze_proximity_sensor_supported)) {
            setProxListening(false);  // Don't immediately start listening when we register.
            mProximitySensor.register(
                    proximityEvent -> {
@@ -269,6 +271,7 @@ public class DozeSensors {
                            mProxCallback.accept(!proximityEvent.getBelow());
                        }
                    });
        }

        mDevicePostureController.addCallback(mDevicePostureCallback);
    }