当前位置: 首页 > article >正文

Android14 和android12 在锁屏界面Keyguard输错5次密码后倒计时30秒时重启手机不显示倒计时

参考如下修改:Android9.0在锁屏界面Keyguard输错5次密码后倒计时30秒时重启手机不显示倒计时_android 锁屏密码输错5次-CSDN博客

android 14 修改如下:


androidap/SYSTEM/frameworks/base$ git status
Refresh index: 100% (47218/47218), done.
HEAD detached from e83cd3f473f9

        modified:   core/java/android/provider/Settings.java
        modified:   packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
        modified:   packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java

androidap/SYSTEM/frameworks/base$ git diff
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 6d1594e011dc..7ccaa8cea477 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4641,7 +4641,12 @@ public final class Settings {
         @Deprecated
         @Readable
         public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
-
+        /**
+         * @deprecated Use {@link android.provider.Settings.Secure#COUNT_DOWNTIME_UNLOCK}
+         * @hide
+         */
+        @Readable
+        public static final String COUNT_DOWNTIME_UNLOCK = "count_downtime_unlock";
         /**
          * Scaling factor for fonts, float.
          */
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
index 12fccc59dc90..22b04826bc07 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
@@ -26,6 +26,12 @@ import android.os.CountDownTimer;
 import android.os.SystemClock;
 import android.util.PluralsMessageFormatter;
 import android.view.KeyEvent;
+import android.util.Log;
+import android.content.Context;
+import android.content.ContentResolver;
+import android.provider.Settings;
+import android.provider.Settings.Global;
+import android.provider.Settings.System;

 import com.android.internal.util.LatencyTracker;
 import com.android.internal.widget.LockPatternChecker;
@@ -54,7 +60,8 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
     protected AsyncTask<?, ?, ?> mPendingLockCheck;
     protected boolean mResumed;
     protected boolean mLockedOut;
-
+    static final String LOG_TAG = "KeyguardAbsKeyInputViewController";
+    Context mContext;
     private final KeyDownListener mKeyDownListener = (keyCode, keyEvent) -> {
         // Fingerprint sensor sends a KeyEvent.KEYCODE_UNKNOWN.
         // We don't want to consider it valid user input because the UI
@@ -88,6 +95,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
         mLatencyTracker = latencyTracker;
         mFalsingCollector = falsingCollector;
         mEmergencyButtonController = emergencyButtonController;
+        mContext=getContext();
     }

     abstract void resetState();
@@ -111,6 +119,26 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
         mDismissing = false;
         mView.resetPasswordText(false /* animate */, false /* announce */);
         resetState();
+        long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+                KeyguardUpdateMonitor.getCurrentUser());
+
+
+        long deadline_new = SystemClock.elapsedRealtime();
+        long timeuses =0;
+
+
+        timeuses=(long) Math.abs(deadline - deadline_new);
+        Log.d(LOG_TAG, "== reset  deadline - deadline_new =" + timeuses);
+        if(timeuses > 30000){
+            if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.COUNT_DOWNTIME_UNLOCK, 0) == 1 && mCountdownTimer == null) {
+                long mDeadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                        KeyguardUpdateMonitor.getCurrentUser(), 30000);
+
+            }
+        }else{
+
+            Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
+        }
     }

     @Override
@@ -156,6 +184,11 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
                             arguments,
                             R.string.kg_too_many_failed_attempts_countdown),
                         /* animate= */ false);
+                Log.d(LOG_TAG, "== handleAttemptLockout  secondsRemaining = "+secondsRemaining);
+                if(secondsRemaining == 30){
+                    Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,1);
+
+                }
             }

             @Override
@@ -163,6 +196,9 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
                 mMessageAreaController.setMessage("");
                 mLockedOut = false;
                 resetState();
+
+                Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
+
             }
         }.start();
     }
@@ -281,8 +317,33 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
         // if the user is currently locked out, enforce it.
         long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
                 KeyguardUpdateMonitor.getCurrentUser());
+
+
+        long deadline_new = SystemClock.elapsedRealtime();
+        long timeuses =0;
+
+
+        timeuses=(long) Math.abs(deadline - deadline_new);
+        Log.d(LOG_TAG, "== onResume  deadline - deadline_new =" + timeuses);
+
+
+        if(timeuses > 30000) {
+            if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.COUNT_DOWNTIME_UNLOCK, 0) == 1 && mCountdownTimer == null) {
+                long mDeadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                        KeyguardUpdateMonitor.getCurrentUser(), 30000);
+
+            }
+        }
+        deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+                KeyguardUpdateMonitor.getCurrentUser());
+
+
         if (shouldLockout(deadline)) {
+
             handleAttemptLockout(deadline);
+        }else{
+
+            Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
         }
     }

diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
index 2239556e4fd3..b3ba37cb70d3 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
@@ -27,6 +27,13 @@ import android.util.PluralsMessageFormatter;
 import android.view.MotionEvent;
 import android.view.View;

+import android.util.Log;
+import android.content.Context;
+import android.content.ContentResolver;
+import android.provider.Settings;
+import android.provider.Settings.Global;
+import android.provider.Settings.System;
+
 import com.android.internal.util.LatencyTracker;
 import com.android.internal.widget.LockPatternChecker;
 import com.android.internal.widget.LockPatternUtils;
@@ -66,6 +73,9 @@ public class KeyguardPatternViewController
     private CountDownTimer mCountdownTimer;
     private AsyncTask<?, ?, ?> mPendingLockCheck;

+    static final String LOG_TAG = "KeyguardPatternViewController";
+    Context mContext;
+
     private EmergencyButtonCallback mEmergencyButtonCallback = new EmergencyButtonCallback() {
         @Override
         public void onEmergencyButtonClickedWhenInCall() {
@@ -208,8 +218,10 @@ public class KeyguardPatternViewController
         mEmergencyButtonController = emergencyButtonController;
         mLockPatternView = mView.findViewById(R.id.lockPatternView);
         mPostureController = postureController;
+        mContext=getContext();
     }

+
     @Override
     public void onInit() {
         super.onInit();
@@ -263,6 +275,26 @@ public class KeyguardPatternViewController
         mLockPatternView.clearPattern();

         displayDefaultSecurityMessage();
+        long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+                KeyguardUpdateMonitor.getCurrentUser());
+
+
+        long deadline_new = SystemClock.elapsedRealtime();
+        long timeuses =0;
+
+
+        timeuses=(long) Math.abs(deadline - deadline_new);
+        Log.d(LOG_TAG, "== reset  deadline - deadline_new =" + timeuses);
+        if(timeuses > 30000){
+            if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.COUNT_DOWNTIME_UNLOCK, 0) == 1 && mCountdownTimer == null) {
+                long mDeadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                        KeyguardUpdateMonitor.getCurrentUser(), 30000);
+
+            }
+        }else{
+
+            Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
+        }
     }

     @Override
@@ -271,8 +303,34 @@ public class KeyguardPatternViewController
         // if the user is currently locked out, enforce it.
         long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
                 KeyguardUpdateMonitor.getCurrentUser());
+
+
+        long deadline_new = SystemClock.elapsedRealtime();
+        long timeuses =0;
+
+
+        timeuses=(long) Math.abs(deadline - deadline_new);
+        Log.d(LOG_TAG, "== onResume  deadline - deadline_new =" + timeuses);
+
+
+        if(timeuses > 30000) {
+            if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.COUNT_DOWNTIME_UNLOCK, 0) == 1 && mCountdownTimer == null) {
+                long mDeadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                        KeyguardUpdateMonitor.getCurrentUser(), 30000);
+
+            }
+        }
+
+        deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+                KeyguardUpdateMonitor.getCurrentUser());
+
+
         if (deadline != 0) {
+
             handleAttemptLockout(deadline);
+        }else{
+
+            Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
         }
     }

@@ -384,12 +442,19 @@ public class KeyguardPatternViewController
                             R.string.kg_too_many_failed_attempts_countdown),
                         /* animate= */ false
                 );
+                Log.d(LOG_TAG, "== handleAttemptLockout  secondsRemaining = "+secondsRemaining);
+                if(secondsRemaining == 30){
+                    Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,1);
+
+                }
             }

             @Override
             public void onFinish() {
                 mLockPatternView.setEnabled(true);
                 displayDefaultSecurityMessage();
+                Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
+
             }

         }.start();


android12 修改如下:

androidap/QSSI12/frameworks/base$ git status
Refresh index: 100% (40261/40261), done.
HEAD detached at d7cf647c5f4d

        modified:   core/java/android/provider/Settings.java

        modified:   packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
        modified:   packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java

androidap/QSSI12/frameworks/base$ git diff
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index e7a8e8a1a80c..44d56b41f745 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4250,7 +4250,12 @@ public final class Settings {
         @Deprecated
         @Readable
         public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
-
+        /**
+         * @deprecated Use {@link android.provider.Settings.Secure#COUNT_DOWNTIME_UNLOCK}
+         * @hide
+         */
+        @Readable
+        public static final String COUNT_DOWNTIME_UNLOCK = "count_downtime_unlock";
         /**
          * Scaling factor for fonts, float.
          */

diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
index eb5e39e769fc..6614290b4418 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java
@@ -26,6 +26,13 @@ import android.os.AsyncTask;
 import android.os.CountDownTimer;
 import android.os.SystemClock;
 import android.view.KeyEvent;
+import android.util.Log;
+
+import android.content.Context;
+import android.content.ContentResolver;
+import android.provider.Settings;
+import android.provider.Settings.Global;
+import android.provider.Settings.System;

 import com.android.internal.util.LatencyTracker;
 import com.android.internal.widget.LockPatternChecker;
@@ -50,7 +57,8 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
     private boolean mDismissing;
     protected AsyncTask<?, ?, ?> mPendingLockCheck;
     protected boolean mResumed;
-
+    static final String LOG_TAG = "KeyguardAbsKeyInputViewController";
+    Context mContext;
     private final KeyDownListener mKeyDownListener = (keyCode, keyEvent) -> {
         // Fingerprint sensor sends a KeyEvent.KEYCODE_UNKNOWN.
         // We don't want to consider it valid user input because the UI
@@ -84,6 +92,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
         mEmergencyButtonController = emergencyButtonController;
         KeyguardMessageArea kma = KeyguardMessageArea.findSecurityMessageDisplay(mView);
         mMessageAreaController = messageAreaControllerFactory.create(kma);
+        mContext=getContext();
     }

     abstract void resetState();
@@ -91,6 +100,8 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
     @Override
     public void onInit() {
         super.onInit();

         mMessageAreaController.init();
     }

@@ -107,13 +118,43 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
         // start fresh
         mDismissing = false;
         mView.resetPasswordText(false /* animate */, false /* announce */);

         // if the user is currently locked out, enforce it.
         long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
                 KeyguardUpdateMonitor.getCurrentUser());
+
+        Log.d(LOG_TAG, "== reset deadline =" + deadline);
+        long deadline_new = SystemClock.elapsedRealtime();
+        long timeuses =0;
+
+        Log.d(LOG_TAG, "== reset deadline_new =" + deadline_new);
+        timeuses=(long) Math.abs(deadline - deadline_new);
+        Log.d(LOG_TAG, "== reset  deadline - deadline_new =" + timeuses);
+
+        Log.d(LOG_TAG, "== reset() COUNT_DOWNTIME_UNLOCK ="+Settings.System.getInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0));
+        if(timeuses > 30000) {
+            if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.COUNT_DOWNTIME_UNLOCK, 0) == 1 && mCountdownTimer == null) {
+                long mDeadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                        KeyguardUpdateMonitor.getCurrentUser(), 30000);
+                Log.d(LOG_TAG, "== reset(inside)  handleAttemptLockout(mDeadline)" + mDeadline);
+            }
+        }
+        deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+                KeyguardUpdateMonitor.getCurrentUser());
+
+
         if (shouldLockout(deadline)) {
+
+            Log.d(LOG_TAG, "== reset deadline shouldLockout(deadline)=" + deadline );
+
             handleAttemptLockout(deadline);
         } else {
             resetState();
+            Log.d(LOG_TAG, "== reset() else resetState() COUNT_DOWNTIME_UNLOCK ="+Settings.System.getInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0));
+
+            Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
         }
     }

@@ -146,8 +187,16 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
     protected void handleAttemptLockout(long elapsedRealtimeDeadline) {
         mView.setPasswordEntryEnabled(false);
         long elapsedRealtime = SystemClock.elapsedRealtime();
-        long secondsInFuture = (long) Math.ceil(
-                (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0);
+        long secondsInFuture =0;
+        long timeuses =0;
+        Log.d(LOG_TAG, "== handleAttemptLockout elapsedRealtimeDeadline =" + elapsedRealtimeDeadline);
+        Log.d(LOG_TAG, "== handleAttemptLockout elapsedRealtime =" + elapsedRealtime);
+        timeuses=(long) Math.abs(elapsedRealtimeDeadline - elapsedRealtime);
+        Log.d(LOG_TAG, "== handleAttemptLockout elapsedRealtimeDeadline - elapsedRealtime =" + timeuses);
+        secondsInFuture = (long) Math.ceil(
+                    (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0);
+
+
         mCountdownTimer = new CountDownTimer(secondsInFuture * 1000, 1000) {

             @Override
@@ -156,12 +205,19 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
                 mMessageAreaController.setMessage(mView.getResources().getQuantityString(
                         R.plurals.kg_too_many_failed_attempts_countdown,
                         secondsRemaining, secondsRemaining));
-            }

+                Log.d(LOG_TAG, "== handleAttemptLockout  secondsRemaining = "+secondsRemaining);
+                if(secondsRemaining == 30){
+                    Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,1);
+
+                  }
+            }
             @Override
             public void onFinish() {
                 mMessageAreaController.setMessage("");
                 resetState();
+                Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
+
             }
         }.start();
     }
@@ -182,6 +238,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
                 if (timeoutMs > 0) {
                     long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
                             userId, timeoutMs);
+
                     handleAttemptLockout(deadline);
                 }
             }
@@ -286,6 +343,8 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
             mPendingLockCheck.cancel(false);
             mPendingLockCheck = null;
         }
-        reset();
+        if (Settings.System.getInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0) == 0 && mCountdownTimer == null ) {
+            reset();
+        }
     }
 }
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
index 60d56503f73b..99ba0e56fe58 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternViewController.java
@@ -25,6 +25,13 @@ import android.os.CountDownTimer;
 import android.os.SystemClock;
 import android.view.MotionEvent;
 import android.view.View;
+import android.util.Log;
+
+import android.content.Context;
+import android.content.ContentResolver;
+import android.provider.Settings;
+import android.provider.Settings.Global;
+import android.provider.Settings.System;

 import com.android.internal.util.LatencyTracker;
 import com.android.internal.widget.LockPatternChecker;
@@ -65,7 +72,8 @@ public class KeyguardPatternViewController
     private LockPatternView mLockPatternView;
     private CountDownTimer mCountdownTimer;
     private AsyncTask<?, ?, ?> mPendingLockCheck;
-
+    static final String LOG_TAG = "KeyguardPatternViewController";
+    Context mContext;
     private EmergencyButtonCallback mEmergencyButtonCallback = new EmergencyButtonCallback() {
         @Override
         public void onEmergencyButtonClickedWhenInCall() {
@@ -178,6 +186,7 @@ public class KeyguardPatternViewController
                     if (timeoutMs > 0) {
                         long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
                                 userId, timeoutMs);
+
                         handleAttemptLockout(deadline);
                     }
                 }
@@ -210,6 +219,7 @@ public class KeyguardPatternViewController
         mMessageAreaController = mMessageAreaControllerFactory.create(kma);
         mLockPatternView = mView.findViewById(R.id.lockPatternView);
         mPostureController = postureController;
+        mContext=getContext();
     }

     @Override
@@ -270,10 +280,36 @@ public class KeyguardPatternViewController
         // if the user is currently locked out, enforce it.
         long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
                 KeyguardUpdateMonitor.getCurrentUser());
+
+        Log.d(LOG_TAG, "== reset deadline =" + deadline);
+        long deadline_new = SystemClock.elapsedRealtime();
+        long timeuses =0;
+
+        Log.d(LOG_TAG, "== reset deadline_new =" + deadline_new);
+        timeuses=(long) Math.abs(deadline - deadline_new);
+        Log.d(LOG_TAG, "== reset  deadline - deadline_new =" + timeuses);
+
+        Log.d(LOG_TAG, "== reset() COUNT_DOWNTIME_UNLOCK ="+Settings.System.getInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0));
+        if(timeuses > 30000) {
+            if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.COUNT_DOWNTIME_UNLOCK, 0) == 1 && mCountdownTimer == null) {
+                long mDeadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                        KeyguardUpdateMonitor.getCurrentUser(), 30000);
+                Log.d(LOG_TAG, "== reset(inside)  handleAttemptLockout(mDeadline)" + mDeadline);
+            }
+        }
+        deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+                KeyguardUpdateMonitor.getCurrentUser());
+
         if (deadline != 0) {
+
+            Log.d(LOG_TAG, "== reset deadline =" + deadline);
+
             handleAttemptLockout(deadline);
         } else {
             displayDefaultSecurityMessage();
+            Log.d(LOG_TAG, "== reset() else resetState() COUNT_DOWNTIME_UNLOCK ="+Settings.System.getInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0));
+
+            Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
         }
     }

@@ -301,6 +337,9 @@ public class KeyguardPatternViewController
             mPendingLockCheck = null;
         }
         displayDefaultSecurityMessage();
+        if (Settings.System.getInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0) == 0 && mCountdownTimer == null ) {
+            reset();
+        }
     }

     @Override
@@ -362,8 +401,24 @@ public class KeyguardPatternViewController
         mLockPatternView.clearPattern();
         mLockPatternView.setEnabled(false);
         final long elapsedRealtime = SystemClock.elapsedRealtime();
-        final long secondsInFuture = (long) Math.ceil(
-                (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0);
+   /*     final long secondsInFuture = (long) Math.ceil(
+                (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0);*/
+        long secondsInFuture =0;
+        long timeuses =0;
+        Log.d(LOG_TAG, "== handleAttemptLockout elapsedRealtimeDeadline =" + elapsedRealtimeDeadline);
+        Log.d(LOG_TAG, "== handleAttemptLockout elapsedRealtime =" + elapsedRealtime);
+        timeuses=(long) Math.abs(elapsedRealtimeDeadline - elapsedRealtime);
+        Log.d(LOG_TAG, "== handleAttemptLockout elapsedRealtimeDeadline - elapsedRealtime =" + timeuses);
+
+        if (timeuses > 30000){
+            secondsInFuture =(long) Math.ceil((30000.0) / 1000.0);
+
+        }else {
+            secondsInFuture = (long) Math.ceil(
+                    (elapsedRealtimeDeadline - elapsedRealtime) / 1000.0);
+
+        }
+
         mCountdownTimer = new CountDownTimer(secondsInFuture * 1000, 1000) {

             @Override
@@ -372,12 +427,18 @@ public class KeyguardPatternViewController
                 mMessageAreaController.setMessage(mView.getResources().getQuantityString(
                         R.plurals.kg_too_many_failed_attempts_countdown,
                         secondsRemaining, secondsRemaining));
+                Log.d(LOG_TAG, "== handleAttemptLockout  secondsRemaining = "+secondsRemaining);
+                if(secondsRemaining == 30){
+                    Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,1);
+
+                }
             }

             @Override
             public void onFinish() {
                 mLockPatternView.setEnabled(true);
                 displayDefaultSecurityMessage();
+                Settings.System.putInt(mContext.getContentResolver(),Settings.System.COUNT_DOWNTIME_UNLOCK,0);
             }

         }.start();


http://www.kler.cn/news/365059.html

相关文章:

  • AIGC底层技术揭秘
  • 腾讯会议pc端3.29.11开启悬浮窗口
  • Oracle 第3章:Oracle数据库体系结构
  • 飞睿智能超宽带UWB音频传输模块,超低延迟数据传输,实时音频声音更纯净
  • 微信小程序/uniapp动态修改tabBar信息及常见报错
  • vue3移动端可同时上传照片和视频的组件
  • SOLIDWORKS正版软件的渠道分别是哪些,如何选择?
  • 使用RNN、LSTM和Transformer进行时间序列预测
  • AJAX 实例:深入解析与实战应用
  • 代码随想录算法训练营Day09 | 151.翻转字符串里的单词、卡码网:55.右旋转字符串、28. 实现 strStr()、459.重复的子字符串
  • AUTOSAR CP 中 BswM 模块功能与使用介绍(2/2)
  • python主流框架Django:ORM框架关联查询与管理器
  • 关于Linux自带的python2.6.6升级到2.7.5版本步骤详解
  • 在银河麒麟系统中Qt连接达梦数据库
  • Python爬虫:自动化获取商品评论数据
  • 纯血鸿蒙的未来前景
  • 7款视频转换器大测评!哪款是最适合你的视频格式转换器?
  • spring boot yml文件中引用*.properties文件中的属性
  • 雷池社区版那么火,为什么站长都使用雷池社区版??
  • 我们可以用微服务创建状态机吗?
  • 边缘计算路由网关R40钡铼技术3LAN口1WAN口Modbus协议
  • 系统架构设计师教程 第6章 6.4 应用程序域数据库的交互 笔记
  • ASP.NET Core 8.0 中使用 Hangfire 调度 API
  • Python中input()输入函数和print()输出函数的用法
  • 网络连接设备的功能与应用概述
  • tensorflow案例2--猴痘病识别,一道激活函数的bug