diff --git a/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java b/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java index 269a2e8f..33b6fe85 100644 --- a/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java +++ b/app/src/main/java/com/beemdevelopment/aegis/ui/AegisActivity.java @@ -74,15 +74,20 @@ public abstract class AegisActivity extends AppCompatActivity implements VaultMa } @SuppressLint("SoonBlockedPrivateApi") + @SuppressWarnings("JavaReflectionMemberAccess") @Override public void onLocked(boolean userInitiated) { setResult(RESULT_CANCELED, null); + try { + // Call a private overload of the finish() method to prevent the app + // from disappearing from the recent apps menu Method method = Activity.class.getDeclaredMethod("finish", int.class); method.setAccessible(true); method.invoke(this, 2); // FINISH_TASK_WITH_ACTIVITY = 2 } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - e.printStackTrace(); + // On recent Android versions, the overload of the finish() method + // used above is no longer accessible finishAndRemoveTask(); } }