From bc5a1ce3960a7956501dd3fa849cc68a4dacc896 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Thu, 25 Feb 2021 09:35:57 +1100 Subject: [PATCH] fix screen lock --- .../thoughtcrime/securesms/service/KeyCachingService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java b/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java index 046004aa46..e1c2350ef1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java @@ -69,7 +69,7 @@ public class KeyCachingService extends Service { // AC: This is a temporal drop off replacement for the refactoring time being. // This field only indicates if the app was unlocked or not (null means locked). - private static Object masterSecret = new Object(); + private static Object masterSecret = null; /** * A temporal utility method to quickly call {@link KeyCachingService#setMasterSecret(Object)} @@ -97,7 +97,8 @@ public class KeyCachingService extends Service { public KeyCachingService() {} public static synchronized boolean isLocked(Context context) { - return getMasterSecret(context) == null; + boolean enabled = !TextSecurePreferences.isPasswordDisabled(context) || TextSecurePreferences.isScreenLockEnabled(context); + return getMasterSecret(context) == null && enabled; } public static void onAppForegrounded(@NonNull Context context) {