Add metrics logging to BrightLineFalsingManager.
This metric was logged in the old manager but not the new one.
Bug: 71762354
Change-Id: Ieca5d4659fc8eb60ba481c6daf495a69f8e0e9e6
Test: manual.
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java
index 6fb6467..67dfdca 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerImpl.java
@@ -67,8 +67,8 @@
Sensor.TYPE_LIGHT,
Sensor.TYPE_ROTATION_VECTOR,
};
- private static final String FALSING_REMAIN_LOCKED = "falsing_failure_after_attempts";
- private static final String FALSING_SUCCESS = "falsing_success_after_attempts";
+ public static final String FALSING_REMAIN_LOCKED = "falsing_failure_after_attempts";
+ public static final String FALSING_SUCCESS = "falsing_success_after_attempts";
private final Handler mHandler = new Handler(Looper.getMainLooper());
private final Context mContext;
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
index 19c46e4..00f35aa 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
@@ -16,6 +16,9 @@
package com.android.systemui.classifier.brightline;
+import static com.android.systemui.classifier.FalsingManagerImpl.FALSING_REMAIN_LOCKED;
+import static com.android.systemui.classifier.FalsingManagerImpl.FALSING_SUCCESS;
+
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
@@ -24,6 +27,7 @@
import android.util.Log;
import android.view.MotionEvent;
+import com.android.internal.logging.MetricsLogger;
import com.android.systemui.classifier.Classifier;
import com.android.systemui.plugins.FalsingManager;
@@ -44,6 +48,8 @@
private final SensorManager mSensorManager;
private final FalsingDataProvider mDataProvider;
private boolean mSessionStarted;
+ private MetricsLogger mMetricsLogger;
+ private int mIsFalseTouchCalls;
private final ExecutorService mBackgroundExecutor = Executors.newSingleThreadExecutor();
@@ -64,6 +70,7 @@
SensorManager sensorManager) {
mDataProvider = falsingDataProvider;
mSensorManager = sensorManager;
+ mMetricsLogger = new MetricsLogger();
mClassifiers = new ArrayList<>();
DistanceClassifier distanceClassifier = new DistanceClassifier(mDataProvider);
ProximityClassifier proximityClassifier = new ProximityClassifier(distanceClassifier,
@@ -111,6 +118,10 @@
unregisterSensors();
mDataProvider.onSessionEnd();
mClassifiers.forEach(FalsingClassifier::onSessionEnded);
+ if (mIsFalseTouchCalls != 0) {
+ mMetricsLogger.histogram(FALSING_REMAIN_LOCKED, mIsFalseTouchCalls);
+ mIsFalseTouchCalls = 0;
+ }
}
}
@@ -157,6 +168,10 @@
@Override
public void onSucccessfulUnlock() {
+ if (mIsFalseTouchCalls != 0) {
+ mMetricsLogger.histogram(FALSING_SUCCESS, mIsFalseTouchCalls);
+ mIsFalseTouchCalls = 0;
+ }
}
@Override