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

Commit 5300cbcb authored by Dave Mankoff's avatar Dave Mankoff Committed by Automerger Merge Worker
Browse files

RESTRICT AUTOMERGE ProximitySensor now supports dual-sensor approach. am: 311fb193

Change-Id: I823fce9b3bab9dcadcd0b74a1040892eea160530
parents d52e823a 311fb193
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -205,6 +205,14 @@
         far break points. A sensor value less than this is considered "near". -->
    <item name="proximity_sensor_threshold" translatable="false" format="float" type="dimen"></item>

    <!-- Override value to use for proximity sensor as confirmation for proximity_sensor_type. -->
    <string name="proximity_sensor_secondary_type" translatable="false"></string>

    <!-- If using proximity_sensor_confirmation_type, specifies a threshold value to distinguish
         near and far break points. A sensor value less than this is considered "near". -->
    <item name="proximity_sensor_secondary_threshold" translatable="false" format="float"
          type="dimen"></item>

    <!-- Doze: pulse parameter - how long does it take to fade in? -->
    <integer name="doze_pulse_duration_in">130</integer>

+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ public class FalsingManagerProxy implements FalsingManager, Dumpable {
        mUiBgExecutor = uiBgExecutor;
        mStatusBarStateController = statusBarStateController;
        mProximitySensor.setTag(PROXIMITY_SENSOR_TAG);
        mProximitySensor.setSensorDelay(SensorManager.SENSOR_DELAY_GAME);
        mProximitySensor.setDelay(SensorManager.SENSOR_DELAY_GAME);
        mDeviceConfig = deviceConfig;
        mDeviceConfigListener =
                properties -> onDeviceConfigPropertiesChanged(context, properties.getNamespace());
+3 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.util.sensors.ProximitySensor;
import com.android.systemui.util.sensors.ThresholdSensor;

import java.io.PrintWriter;
import java.util.ArrayDeque;
@@ -76,7 +77,7 @@ public class BrightLineFalsingManager implements FalsingManager {

    private final List<FalsingClassifier> mClassifiers;

    private ProximitySensor.ProximitySensorListener mSensorEventListener = this::onProximityEvent;
    private ThresholdSensor.Listener mSensorEventListener = this::onProximityEvent;

    private final KeyguardUpdateMonitorCallback mKeyguardUpdateCallback =
            new KeyguardUpdateMonitorCallback() {
@@ -240,7 +241,7 @@ public class BrightLineFalsingManager implements FalsingManager {
        mClassifiers.forEach((classifier) -> classifier.onTouchEvent(motionEvent));
    }

    private void onProximityEvent(ProximitySensor.ProximityEvent proximityEvent) {
    private void onProximityEvent(ThresholdSensor.ThresholdSensorEvent proximityEvent) {
        // TODO: some of these classifiers might allow us to abort early, meaning we don't have to
        // make these calls.
        mClassifiers.forEach((classifier) -> classifier.onProximityEvent(proximityEvent));
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ abstract class FalsingClassifier {
    /**
     * Called when a ProximityEvent occurs (change in near/far).
     */
    void onProximityEvent(ProximitySensor.ProximityEvent proximityEvent) {};
    void onProximityEvent(ProximitySensor.ThresholdSensorEvent proximityEvent) {};

    /**
     * The phone screen has turned on and we need to begin falsing detection.
+2 −2
Original line number Diff line number Diff line
@@ -101,8 +101,8 @@ class ProximityClassifier extends FalsingClassifier {

    @Override
    public void onProximityEvent(
            ProximitySensor.ProximityEvent proximityEvent) {
        boolean near = proximityEvent.getNear();
            ProximitySensor.ThresholdSensorEvent proximityEvent) {
        boolean near = proximityEvent.getBelow();
        long timestampNs = proximityEvent.getTimestampNs();
        logDebug("Sensor is: " + near + " at time " + timestampNs);
        update(near, timestampNs);
Loading