mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Only start the screen lock timeout when the app is backgrounded.
This commit is contained in:
parent
78124ef224
commit
a287408a7a
@ -32,6 +32,8 @@ import android.os.SystemClock;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
@ -220,13 +222,16 @@ public class KeyCachingService extends Service {
|
||||
}
|
||||
|
||||
private static void startTimeoutIfAppropriate(@NonNull Context context) {
|
||||
boolean timeoutEnabled = TextSecurePreferences.isPassphraseTimeoutEnabled(context);
|
||||
long screenTimeout = TextSecurePreferences.getScreenLockTimeout(context);
|
||||
boolean appVisible = ApplicationContext.getInstance(context).isAppVisible();
|
||||
boolean secretSet = KeyCachingService.masterSecret != null;
|
||||
|
||||
if ((KeyCachingService.masterSecret != null) &&
|
||||
(timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(context)) ||
|
||||
(screenTimeout >= 60 && TextSecurePreferences.isScreenLockEnabled(context)))
|
||||
{
|
||||
boolean timeoutEnabled = TextSecurePreferences.isPassphraseTimeoutEnabled(context);
|
||||
boolean passLockActive = timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(context);
|
||||
|
||||
long screenTimeout = TextSecurePreferences.getScreenLockTimeout(context);
|
||||
boolean screenLockActive = screenTimeout >= 60 && TextSecurePreferences.isScreenLockEnabled(context);
|
||||
|
||||
if (!appVisible && secretSet && (passLockActive || screenLockActive)) {
|
||||
long passphraseTimeoutMinutes = TextSecurePreferences.getPassphraseTimeoutInterval(context);
|
||||
long screenLockTimeoutSeconds = TextSecurePreferences.getScreenLockTimeout(context);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user