Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Commit 2a33fcb

Browse files
authored
Merge pull request #9 from ypid/patch/do-not-require-strong-auth-on-regular-time-interval
[PATCH] Don’t require strong auth on regular time interval
2 parents 20216d0 + d15db17 commit 2a33fcb

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[PATCH] Don’t require strong auth on regular time interval
2+
3+
This disables the need to provide strong authentication except when booting the
4+
device. The idea behind this is that you are no longer forced to enter your
5+
strong authentication credentials in random locations where it might be easy to
6+
snoop your strong authentication credentials allowing an adversary to boot and
7+
decrypt your device against your will.
8+
9+
Changing DEFAULT_STRONG_AUTH_TIMEOUT_MS is not enough. Rather, it has the
10+
opposite effect for some reason. In my tests, it caused the strong auth to be
11+
required every hour rather than a 42 d interval.
12+
13+
In my tests, dpm.getRequiredStrongAuthTimeout(null, userId)) returned 3600000.
14+
15+
project frameworks/base/
16+
diff --git a/frameworks/base/core/java/android/app/admin/DevicePolicyManager.java b/frameworks/base/core/java/android/app/admin/DevicePolicyManager.java
17+
index f73e13f4dbd..82c05c71e30 100644
18+
--- a/frameworks/base/core/java/android/app/admin/DevicePolicyManager.java
19+
+++ b/frameworks/base/core/java/android/app/admin/DevicePolicyManager.java
20+
@@ -488,7 +488,7 @@ public class DevicePolicyManager {
21+
*
22+
* @hide
23+
*/
24+
- public static final long DEFAULT_STRONG_AUTH_TIMEOUT_MS = 72 * 60 * 60 * 1000; // 72h
25+
+ public static final long DEFAULT_STRONG_AUTH_TIMEOUT_MS = 42 * 24 * 60 * 60 * 1000; // 42d
26+
27+
/**
28+
* A {@link android.os.Parcelable} extra of type {@link android.os.PersistableBundle} that
29+
diff --git a/frameworks/base/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java b/frameworks/base/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java
30+
index c4f1f3d7369..f25e2d9b891 100644
31+
--- a/frameworks/base/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java
32+
+++ b/frameworks/base/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java
33+
@@ -128,18 +128,7 @@ public class LockSettingsStrongAuth {
34+
private void handleScheduleStrongAuthTimeout(int userId) {
35+
final DevicePolicyManager dpm =
36+
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
37+
- long when = SystemClock.elapsedRealtime() + dpm.getRequiredStrongAuthTimeout(null, userId);
38+
- // cancel current alarm listener for the user (if there was one)
39+
- StrongAuthTimeoutAlarmListener alarm = mStrongAuthTimeoutAlarmListenerForUser.get(userId);
40+
- if (alarm != null) {
41+
- mAlarmManager.cancel(alarm);
42+
- } else {
43+
- alarm = new StrongAuthTimeoutAlarmListener(userId);
44+
- mStrongAuthTimeoutAlarmListenerForUser.put(userId, alarm);
45+
- }
46+
- // schedule a new alarm listener for the user
47+
- mAlarmManager.set(AlarmManager.ELAPSED_REALTIME, when, STRONG_AUTH_TIMEOUT_ALARM_TAG,
48+
- alarm, mHandler);
49+
+ Slog.d(TAG, "getRequiredStrongAuthTimeout: " + dpm.getRequiredStrongAuthTimeout(null, userId));
50+
}
51+
52+
private void notifyStrongAuthTrackers(int strongAuthReason, int userId) {

0 commit comments

Comments
 (0)