Browse Source

passcodemanager: Simplified passcode/fingerprint auth timeout check.

ardevd 7 years ago
parent
commit
2f0464d6e4

+ 6 - 2
src/main/java/com/owncloud/android/authentication/PassCodeManager.java

@@ -110,7 +110,7 @@ public class PassCodeManager {
     }
 
     private boolean passCodeShouldBeRequested() {
-        return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT && visibleActivitiesCounter <= 0 && passCodeIsEnabled();
+        return (hasAuthenticationTimeoutExpired() && passCodeIsEnabled());
     }
 
     private boolean passCodeIsEnabled() {
@@ -119,7 +119,11 @@ public class PassCodeManager {
     }
 
     private boolean fingerprintShouldBeRequested() {
-        return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT && visibleActivitiesCounter <= 0 && fingerprintIsEnabled();
+        return (hasAuthenticationTimeoutExpired() && fingerprintIsEnabled());
+    }
+
+    private boolean hasAuthenticationTimeoutExpired() {
+        return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT && visibleActivitiesCounter <= 0;
     }
 
     private boolean fingerprintIsEnabled() {