mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Merge pull request #509 from RyanRory/screenlock-timeout
Screenlock Time under 60s
This commit is contained in:
commit
e874032e1e
@ -84,6 +84,7 @@ public class PassphrasePromptActivity extends BaseActionBarActivity {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
|
keyCachingService.setMasterSecret(new Object());
|
||||||
keyCachingService = null;
|
keyCachingService = null;
|
||||||
}
|
}
|
||||||
}, Context.BIND_AUTO_CREATE);
|
}, Context.BIND_AUTO_CREATE);
|
||||||
@ -133,7 +134,9 @@ public class PassphrasePromptActivity extends BaseActionBarActivity {
|
|||||||
private void handleAuthenticated() {
|
private void handleAuthenticated() {
|
||||||
authenticated = true;
|
authenticated = true;
|
||||||
//TODO Replace with a proper call.
|
//TODO Replace with a proper call.
|
||||||
keyCachingService.setMasterSecret(new Object());
|
if (keyCachingService != null) {
|
||||||
|
keyCachingService.setMasterSecret(new Object());
|
||||||
|
}
|
||||||
|
|
||||||
// Finish and proceed with the next intent.
|
// Finish and proceed with the next intent.
|
||||||
Intent nextIntent = getIntent().getParcelableExtra("next_intent");
|
Intent nextIntent = getIntent().getParcelableExtra("next_intent");
|
||||||
@ -188,6 +191,8 @@ public class PassphrasePromptActivity extends BaseActionBarActivity {
|
|||||||
|
|
||||||
if (!keyguardManager.isKeyguardSecure()) {
|
if (!keyguardManager.isKeyguardSecure()) {
|
||||||
Log.w(TAG ,"Keyguard not secure...");
|
Log.w(TAG ,"Keyguard not secure...");
|
||||||
|
TextSecurePreferences.setScreenLockEnabled(getApplicationContext(), false);
|
||||||
|
TextSecurePreferences.setScreenLockTimeout(getApplicationContext(), 0);
|
||||||
handleAuthenticated();
|
handleAuthenticated();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,8 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
|||||||
if (duration == 0) {
|
if (duration == 0) {
|
||||||
TextSecurePreferences.setScreenLockTimeout(getContext(), 0);
|
TextSecurePreferences.setScreenLockTimeout(getContext(), 0);
|
||||||
} else {
|
} else {
|
||||||
long timeoutSeconds = Math.max(TimeUnit.MILLISECONDS.toSeconds(duration), 60);
|
long timeoutSeconds = TimeUnit.MILLISECONDS.toSeconds(duration);
|
||||||
|
// long timeoutSeconds = Math.max(TimeUnit.MILLISECONDS.toSeconds(duration), 60);
|
||||||
TextSecurePreferences.setScreenLockTimeout(getContext(), timeoutSeconds);
|
TextSecurePreferences.setScreenLockTimeout(getContext(), timeoutSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,6 @@ public class KeyCachingService extends Service {
|
|||||||
KeyCachingService.masterSecret = masterSecret;
|
KeyCachingService.masterSecret = masterSecret;
|
||||||
|
|
||||||
foregroundService();
|
foregroundService();
|
||||||
startTimeoutIfAppropriate(this);
|
|
||||||
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
@ -210,7 +209,7 @@ public class KeyCachingService extends Service {
|
|||||||
boolean passLockActive = timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(context);
|
boolean passLockActive = timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(context);
|
||||||
|
|
||||||
long screenTimeout = TextSecurePreferences.getScreenLockTimeout(context);
|
long screenTimeout = TextSecurePreferences.getScreenLockTimeout(context);
|
||||||
boolean screenLockActive = screenTimeout >= 60 && TextSecurePreferences.isScreenLockEnabled(context);
|
boolean screenLockActive = screenTimeout >= 0 && TextSecurePreferences.isScreenLockEnabled(context);
|
||||||
|
|
||||||
if (!appVisible && secretSet && (passLockActive || screenLockActive)) {
|
if (!appVisible && secretSet && (passLockActive || screenLockActive)) {
|
||||||
long passphraseTimeoutMinutes = TextSecurePreferences.getPassphraseTimeoutInterval(context);
|
long passphraseTimeoutMinutes = TextSecurePreferences.getPassphraseTimeoutInterval(context);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user