From 5231f8eea5a29e325699a7e00e3d41c6b68c8e1f Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 23 Aug 2021 11:46:46 +0200 Subject: [PATCH] VX-N3 https://developer.android.com/docs/quality-guidelines/core-app-quality --- app/src/main/java/eu/faircode/email/ActivityMain.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/ActivityMain.java b/app/src/main/java/eu/faircode/email/ActivityMain.java index 9c345349ca..c1584ff306 100644 --- a/app/src/main/java/eu/faircode/email/ActivityMain.java +++ b/app/src/main/java/eu/faircode/email/ActivityMain.java @@ -36,6 +36,7 @@ import java.util.List; public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener { private static final long SPLASH_DELAY = 1500L; // milliseconds + private static final long RESTORE_STATE_INTERVAL = 3 * 60 * 1000L; // milliseconds private static final long SERVICE_START_DELAY = 5 * 1000L; // milliseconds @Override @@ -165,8 +166,16 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack Intent view = new Intent(ActivityMain.this, ActivityView.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + // VX-N3 + // https://developer.android.com/docs/quality-guidelines/core-app-quality + long now = new Date().getTime(); + long last = prefs.getLong("last_launched", 0L); + if (now - last > RESTORE_STATE_INTERVAL) + view.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); + Intent saved = args.getParcelable("intent"); if (saved == null) { + prefs.edit().putLong("last_launched", now).apply(); startActivity(view, options); if (sync_on_launch) ServiceUI.sync(ActivityMain.this, null);