Merge pull request #716 from DerEnderKeks/fix-recent-apps-behavior

Fixed that app vanished from recent apps list after locking
This commit is contained in:
Alexander Bakker 2021-04-09 14:01:58 +02:00 committed by GitHub
commit efb5b10a76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
package com.beemdevelopment.aegis.ui;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.Configuration;
@ -19,6 +20,8 @@ import com.beemdevelopment.aegis.ThemeMap;
import com.beemdevelopment.aegis.ui.dialogs.Dialogs;
import com.beemdevelopment.aegis.vault.VaultManagerException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Locale;
import java.util.Map;
@ -89,8 +92,15 @@ public abstract class AegisActivity extends AppCompatActivity implements AegisAp
@Override
public void onLocked(boolean userInitiated) {
setResult(RESULT_CANCELED, null);
try {
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();
finishAndRemoveTask();
}
}
protected AegisApplication getApp() {
return _app;