Merge "Relax angle-related false touch classification." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7f3e5bb053
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.systemui.classifier;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -49,13 +52,18 @@ import java.util.List;
|
||||
public class AnglesClassifier extends StrokeClassifier {
|
||||
private HashMap<Stroke, Data> mStrokeMap = new HashMap<>();
|
||||
|
||||
public static final boolean VERBOSE = SystemProperties.getBoolean("debug.falsing_log.ang",
|
||||
Build.IS_DEBUGGABLE);
|
||||
|
||||
private static String TAG = "ANG";
|
||||
|
||||
public AnglesClassifier(ClassifierData classifierData) {
|
||||
mClassifierData = classifierData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return "ANG";
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,18 +178,31 @@ public class AnglesClassifier extends StrokeClassifier {
|
||||
|
||||
public float getAnglesVariance() {
|
||||
float anglesVariance = getAnglesVariance(mSumSquares, mSum, mCount);
|
||||
if (VERBOSE) {
|
||||
FalsingLog.i(TAG, "getAnglesVariance: (first pass) " + anglesVariance);
|
||||
FalsingLog.i(TAG, " - mFirstLength=" + mFirstLength);
|
||||
FalsingLog.i(TAG, " - mLength=" + mLength);
|
||||
}
|
||||
if (mFirstLength < mLength / 2f) {
|
||||
anglesVariance = Math.min(anglesVariance, mFirstAngleVariance
|
||||
+ getAnglesVariance(mSecondSumSquares, mSecondSum, mSecondCount));
|
||||
if (VERBOSE) FalsingLog.i(TAG, "getAnglesVariance: (second pass) " + anglesVariance);
|
||||
}
|
||||
return anglesVariance;
|
||||
}
|
||||
|
||||
public float getAnglesPercentage() {
|
||||
if (mAnglesCount == 0.0f) {
|
||||
if (VERBOSE) FalsingLog.i(TAG, "getAnglesPercentage: count==0, result=1");
|
||||
return 1.0f;
|
||||
}
|
||||
return (Math.max(mLeftAngles, mRightAngles) + mStraightAngles) / mAnglesCount;
|
||||
final float result = (Math.max(mLeftAngles, mRightAngles) + mStraightAngles) / mAnglesCount;
|
||||
if (VERBOSE) {
|
||||
FalsingLog.i(TAG, "getAnglesPercentage: left=" + mLeftAngles + " right="
|
||||
+ mRightAngles + " straight=" + mStraightAngles + " count=" + mAnglesCount
|
||||
+ " result=" + result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ public class AnglesVarianceEvaluator {
|
||||
public static float evaluate(float value, int type) {
|
||||
final boolean secureUnlock = type == Classifier.BOUNCER_UNLOCK;
|
||||
float evaluation = 0.0f;
|
||||
if (value > 0.05) evaluation++;
|
||||
if (value > 0.10) evaluation++;
|
||||
if (value > 0.20) evaluation++;
|
||||
if (value > 0.40 && !secureUnlock) evaluation++;
|
||||
if (value > 0.80 && !secureUnlock) evaluation++;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.systemui.classifier;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.SystemProperties;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -34,6 +36,10 @@ import java.util.List;
|
||||
* should be in this interval.
|
||||
*/
|
||||
public class SpeedAnglesClassifier extends StrokeClassifier {
|
||||
public static final boolean VERBOSE = SystemProperties.getBoolean("debug.falsing_log.spd_ang",
|
||||
Build.IS_DEBUGGABLE);
|
||||
public static final String TAG = "SPD_ANG";
|
||||
|
||||
private HashMap<Stroke, Data> mStrokeMap = new HashMap<>();
|
||||
|
||||
public SpeedAnglesClassifier(ClassifierData classifierData) {
|
||||
@@ -42,7 +48,7 @@ public class SpeedAnglesClassifier extends StrokeClassifier {
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return "SPD_ANG";
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,14 +141,24 @@ public class SpeedAnglesClassifier extends StrokeClassifier {
|
||||
}
|
||||
|
||||
public float getAnglesVariance() {
|
||||
return mSumSquares / mCount - (mSum / mCount) * (mSum / mCount);
|
||||
final float v = mSumSquares / mCount - (mSum / mCount) * (mSum / mCount);
|
||||
if (VERBOSE) {
|
||||
FalsingLog.i(TAG, "getAnglesVariance: sum^2=" + mSumSquares
|
||||
+ " count=" + mCount + " result=" + v);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public float getAnglesPercentage() {
|
||||
if (mAnglesCount == 0.0f) {
|
||||
return 1.0f;
|
||||
}
|
||||
return (mAcceleratingAngles) / mAnglesCount;
|
||||
final float v = (mAcceleratingAngles) / mAnglesCount;
|
||||
if (VERBOSE) {
|
||||
FalsingLog.i(TAG, "getAnglesPercentage: angles=" + mAcceleratingAngles
|
||||
+ " count=" + mAnglesCount + " result=" + v);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user