OSDN Git Service

FalsingManager: Allow disabling the HIC via device config flag
authorAdrian Roos <roosa@google.com>
Tue, 5 Sep 2017 14:11:10 +0000 (16:11 +0200)
committerAdrian Roos <roosa@google.com>
Tue, 5 Sep 2017 14:11:10 +0000 (16:11 +0200)
Bug: 65126931
Test: Verify HIC is still enabled on devices where it was not disabled
Change-Id: I30ac9e156dde693c34039d8c21e404a474dd86eb

packages/SystemUI/res/values/config.xml
packages/SystemUI/src/com/android/systemui/classifier/HumanInteractionClassifier.java

index 89e2675..87f6306 100644 (file)
      vibrator is capable of subtle vibrations -->
     <bool name="config_vibrateOnIconAnimation">false</bool>
 
+    <!-- If true, enable the advance anti-falsing classifier on the lockscreen. On some devices it
+         does not work well, particularly with noisy touchscreens. Note that disabling it may
+         increase the rate of unintentional unlocks. -->
+    <bool name="config_lockscreenAntiFalsingClassifierEnabled">true</bool>
+
 </resources>
index 2e9ba56..592a275 100644 (file)
@@ -27,6 +27,8 @@ import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.MotionEvent;
 
+import com.android.systemui.R;
+
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 
@@ -37,9 +39,6 @@ public class HumanInteractionClassifier extends Classifier {
     private static final String HIC_ENABLE = "HIC_enable";
     private static final float FINGER_DISTANCE = 0.1f;
 
-    /** Default value for the HIC_ENABLE setting: 1 - enabled, 0 - disabled */
-    private static final int HIC_ENABLE_DEFAULT = 1;
-
     private static HumanInteractionClassifier sInstance = null;
 
     private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -106,9 +105,12 @@ public class HumanInteractionClassifier extends Classifier {
     }
 
     private void updateConfiguration() {
+        boolean defaultValue = mContext.getResources().getBoolean(
+                R.bool.config_lockscreenAntiFalsingClassifierEnabled);
+
         mEnableClassifier = 0 != Settings.Global.getInt(
                 mContext.getContentResolver(),
-                HIC_ENABLE, HIC_ENABLE_DEFAULT);
+                HIC_ENABLE, defaultValue ? 1 : 0);
     }
 
     public void setType(int type) {