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

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

android 14 修改如下:

diff 复制代码
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 修改如下:

diff 复制代码
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();
相关推荐
大耳猫1 小时前
Android gradle和maven国内镜像地址
android·gradle·maven
法迪3 小时前
华为手机系统应用瘦身
华为·智能手机·功耗
-seventy-3 小时前
Android 玩机知识储备
android
CYRUS STUDIO3 小时前
frida脚本,自动化寻址JNI方法
android·运维·自动化·逆向·移动安全·jni·frida
暮志未晚Webgl4 小时前
102. UE5 GAS RPG 实现范围技能奥术伤害
android·java·ue5
Patience to do4 小时前
Android Studio项目(算法计算器)
android·算法·android studio
我又来搬代码了7 小时前
【Android】使用TextView实现按钮开关代替Switch开关
android
深度矩阵shennan-qk8 小时前
怎么实现电脑控制100台手机,苹果手机群控系统不用越狱实现新突破
智能手机·电脑
江-月*夜10 小时前
uniapp vuex 搭建
android·javascript·uni-app
大风起兮云飞扬丶11 小时前
Android——显式/隐式Intent
android