mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-26 16:09:23 -05:00
50 lines
2.1 KiB
Diff
50 lines
2.1 KiB
Diff
From 9b8ea26004ada2b15d0403f55a23a0c02d16c5b2 Mon Sep 17 00:00:00 2001
|
|
From: Tad <tad@spotco.us>
|
|
Date: Sat, 2 Apr 2016 11:28:50 -0400
|
|
Subject: [PATCH] Shutdown after 5 failed unlock attempts
|
|
|
|
Change-Id: If18654ff5816a1c7b31187b4c511b940772c20cf
|
|
---
|
|
.../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 827b378..3bb587b 100644
|
|
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
|
|
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
|
|
@@ -19,6 +19,7 @@ import android.app.Activity;
|
|
import android.app.AlertDialog;
|
|
import android.app.admin.DevicePolicyManager;
|
|
import android.content.Context;
|
|
+import android.os.PowerManager;
|
|
import android.os.RemoteException;
|
|
import android.os.UserHandle;
|
|
import android.util.AttributeSet;
|
|
@@ -294,6 +295,10 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
|
if (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 1562901..add89a4 100644
|
|
--- a/packages/SystemUI/AndroidManifest.xml
|
|
+++ b/packages/SystemUI/AndroidManifest.xml
|
|
@@ -109,6 +109,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.8.0
|
|
|