DivestOS/Patches/CyanogenMod-13.0/android_frameworks_base/FailedUnlockShutdown.patch

50 lines
2.1 KiB
Diff
Raw Normal View History

2016-12-21 19:30:02 -05:00
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