其他分享
首页 > 其他分享> > hall 状态下,禁用指纹解锁

hall 状态下,禁用指纹解锁

作者:互联网

hall状态:
在hall开启后,手机进入灭屏,power按键不可以唤醒,此时指纹解锁可以唤醒。
客户要求:hall开启状态下,禁止指纹解锁

基本思路:framework 接收到hall消息,发送广播
systemui 接收hall 状态广播,判断是否在灭屏时启动fingerprint

diff --git a/frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 0c087c2..a1abba3 100755
--- a/frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -1816,8 +1816,36 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                 }
             }
         }
-    }
-
+        //<!--jicong.wang modify for bug 30179
+        IntentFilter intentFilter = new IntentFilter();
+        intentFilter.addAction(HALL_TAG);
+        mContext.registerReceiver(mHallReciver,intentFilter);
+        //jicong.wang modify for bug 30179 -->
+    }
+    //<!--jicong.wang modify for bug 30179
+    private static final String HALL_TAG = "com.meig.broadcast.hallswitch";
+    private static final String HALL_STATE_TAG = "hallState";
+    private static final int HALL_CLOSE = 1;
+    private static final int HALL_ON = 0;
+    private int mHallstate = HALL_CLOSE;
+
+    private BroadcastReceiver mHallReciver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            String action = intent.getAction();
+            if (action.equals(HALL_TAG)){
+                if (DEBUG) Log.v(TAG,"receiver broadcast,action = "+action);
+                mHallstate = intent.getIntExtra(HALL_STATE_TAG,HALL_CLOSE);
+                if (DEBUG) Log.v(TAG,"hall state = "+mHallstate);
+                if (mHallstate==HALL_ON){
+                    stopListeningForFingerprint();
+                }else{
+                    startListeningForFingerprint();
+                }
+            }
+        }
+    };
+    //jicong.wang modify for bug 30179 -->
     private final UserSwitchObserver mUserSwitchObserver = new UserSwitchObserver() {
         @Override
         public void onUserSwitching(int newUserId, IRemoteCallback reply) {
@@ -2046,6 +2074,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
     }
 
     private void startListeningForFingerprint() {
+        //<!--jicong.wang modify for bug 30179
+        if (mHallstate==HALL_ON){
+            if (DEBUG) Log.v(TAG,"hall state on,should not start fingerprint");
+            return;
+        }
+        //jicong.wang modify for bug 30179 -->
         if (mFingerprintRunningState == BIOMETRIC_STATE_CANCELLING) {
             setFingerprintRunningState(BIOMETRIC_STATE_CANCELLING_RESTARTING);
             return;
@@ -3034,6 +3068,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
         mTrustManager.unregisterTrustListener(this);
 
         mHandler.removeCallbacksAndMessages(null);
+        //<!--jicong.wang modify for bug 30179
+        mContext.unregisterReceiver(mHallReciver);
+        //jicong.wang modify for bug 30179 -->
     }
 
     @Override
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 43cfc4f..3974929 100755
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -3756,9 +3756,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         }
 
         // <!-- add by sijingjing for task:15725, cit hall test
-        mContext.sendBroadcastAsUser(
+        // <!-- jicong.wang modify for bug 30179
+        /*mContext.sendBroadcastAsUser(
             new Intent("com.meig.broadcast.hallswitch").putExtra("hallState", newLidState),
-            UserHandle.CURRENT);
+            UserHandle.CURRENT);*/
+        mContext.sendStickyBroadcastAsUser(
+                new Intent("com.meig.broadcast.hallswitch").putExtra("hallState", newLidState),
+                UserHandle.CURRENT);
+        //jicong.wang modify for bug 30179 -->
         // added by sijingjing for task:15725, cit hall test -->
 
         mDefaultDisplayPolicy.setLidState(newLidState);

标签:java,解锁,指纹,frameworks,base,android,com,hall
来源: https://blog.csdn.net/wangjicong_215/article/details/122427692