Removed close on autolock/nav

pull/194/merge
M66B 4 years ago
parent 3c55af0552
commit 9fcd007b5a

@ -370,7 +370,9 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
if (this.getClass().equals(ActivityMain.class)) if (this.getClass().equals(ActivityMain.class))
return; return;
if (Helper.shouldAuthenticate(this, !auth)) { if (!Helper.shouldAuthenticate(this, !auth))
return;
lock(); lock();
if (auth) { if (auth) {
@ -387,10 +389,6 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
startActivity(main); startActivity(main);
} }
} }
} else {
if (!auth && Helper.shouldAutoLockNav(this))
getMainHandler().postDelayed(autoLockNav, Helper.AUTOLOCK_GRACE * 1000L);
}
} }
private void lock() { private void lock() {
@ -399,18 +397,6 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
finishAffinity(); finishAffinity();
} }
private final Runnable autoLockNav = new Runnable() {
@Override
public void run() {
try {
if (Helper.willAuthenticate(ActivityBase.this))
lock();
} catch (Throwable ex) {
Log.e(ex);
}
}
};
private void processStreams(Intent intent) { private void processStreams(Intent intent) {
intent.setClipData(null); intent.setClipData(null);

@ -2012,14 +2012,6 @@ public class Helper {
return false; return false;
} }
static boolean willAuthenticate(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
long now = new Date().getTime();
long last_authentication = prefs.getLong("last_authentication", 0);
long biometrics_timeout = prefs.getInt("biometrics_timeout", 2) * 60 * 1000L;
return (last_authentication + biometrics_timeout < now);
}
static boolean shouldAutoLock(Context context) { static boolean shouldAutoLock(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean biometrics = prefs.getBoolean("biometrics", false); boolean biometrics = prefs.getBoolean("biometrics", false);
@ -2028,14 +2020,6 @@ public class Helper {
return (autolock && (biometrics || !TextUtils.isEmpty(pin))); return (autolock && (biometrics || !TextUtils.isEmpty(pin)));
} }
static boolean shouldAutoLockNav(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean biometrics = prefs.getBoolean("biometrics", false);
String pin = prefs.getString("pin", null);
boolean autolock_nav = prefs.getBoolean("autolock_nav", false);
return (autolock_nav && (biometrics || !TextUtils.isEmpty(pin)));
}
static void authenticate(final FragmentActivity activity, final LifecycleOwner owner, static void authenticate(final FragmentActivity activity, final LifecycleOwner owner,
Boolean enabled, final Boolean enabled, final
Runnable authenticated, final Runnable cancelled) { Runnable authenticated, final Runnable cancelled) {

Loading…
Cancel
Save