mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-09-06 17:42:25 +00:00
50 lines
2.1 KiB
Diff
50 lines
2.1 KiB
Diff
From 4921beaf996a89c9a56b98f213401ceeb2a23082 Mon Sep 17 00:00:00 2001
|
|
From: Tad <tad@spotco.us>
|
|
Date: Fri, 18 Nov 2016 14:52:59 -0500
|
|
Subject: [PATCH] Shutdown after 5 failed unlock attempts
|
|
|
|
Change-Id: Icc23122e5a25b756872fe132cd0e93684e8bafca
|
|
---
|
|
.../Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java | 5 +++++
|
|
packages/SystemUI/AndroidManifest.xml | 1 +
|
|
2 files changed, 6 insertions(+)
|
|
|
|
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
|
|
index aaff265..865956f 100644
|
|
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
|
|
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
|
|
@@ -22,6 +22,7 @@ import android.app.admin.DevicePolicyManager;
|
|
import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.content.Intent;
|
|
+import android.os.PowerManager;
|
|
import android.os.UserHandle;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
@@ -366,6 +367,10 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
|
if (!enableTimesCounter && (timeoutMs > 0)) {
|
|
showTimeoutDialog(timeoutMs);
|
|
}
|
|
+ if (failedAttempts >=5) {
|
|
+ final PowerManager powerManager = mContext.getSystemService(PowerManager.class);
|
|
+ powerManager.shutdown(false, false);
|
|
+ }
|
|
}
|
|
|
|
/**
|
|
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
|
|
index 2248baf..b13b0fd 100644
|
|
--- a/packages/SystemUI/AndroidManifest.xml
|
|
+++ b/packages/SystemUI/AndroidManifest.xml
|
|
@@ -112,6 +112,7 @@
|
|
<uses-permission android:name="android.permission.TRUST_LISTENER" />
|
|
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
|
<uses-permission android:name="android.permission.RESET_FINGERPRINT_LOCKOUT" />
|
|
+ <uses-permission android:name="android.permission.REBOOT" />
|
|
|
|
<!-- Needed for WallpaperManager.clear in ImageWallpaper.updateWallpaperLocked -->
|
|
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
|
--
|
|
2.9.3
|
|
|