mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 16:27:21 +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.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.ApplicationContext;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
@ -220,13 +222,16 @@ public class KeyCachingService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void startTimeoutIfAppropriate(@NonNull Context context) {
|
private static void startTimeoutIfAppropriate(@NonNull Context context) {
|
||||||
boolean timeoutEnabled = TextSecurePreferences.isPassphraseTimeoutEnabled(context);
|
boolean appVisible = ApplicationContext.getInstance(context).isAppVisible();
|
||||||
long screenTimeout = TextSecurePreferences.getScreenLockTimeout(context);
|
boolean secretSet = KeyCachingService.masterSecret != null;
|
||||||
|
|
||||||
if ((KeyCachingService.masterSecret != null) &&
|
boolean timeoutEnabled = TextSecurePreferences.isPassphraseTimeoutEnabled(context);
|
||||||
(timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(context)) ||
|
boolean passLockActive = timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(context);
|
||||||
(screenTimeout >= 60 && TextSecurePreferences.isScreenLockEnabled(context)))
|
|
||||||
{
|
long screenTimeout = TextSecurePreferences.getScreenLockTimeout(context);
|
||||||
|
boolean screenLockActive = screenTimeout >= 60 && TextSecurePreferences.isScreenLockEnabled(context);
|
||||||
|
|
||||||
|
if (!appVisible && secretSet && (passLockActive || screenLockActive)) {
|
||||||
long passphraseTimeoutMinutes = TextSecurePreferences.getPassphraseTimeoutInterval(context);
|
long passphraseTimeoutMinutes = TextSecurePreferences.getPassphraseTimeoutInterval(context);
|
||||||
long screenLockTimeoutSeconds = TextSecurePreferences.getScreenLockTimeout(context);
|
long screenLockTimeoutSeconds = TextSecurePreferences.getScreenLockTimeout(context);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user