Exclude from recents

This commit is contained in:
M66B 2021-02-01 20:46:19 +01:00
parent 703d2b16ac
commit b1c60ee1d3
1 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,8 @@ package eu.faircode.email;
Copyright 2018-2021 by Marcel Bokhorst (M66B) Copyright 2018-2021 by Marcel Bokhorst (M66B)
*/ */
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -32,6 +34,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ActivityCompose extends ActivityBase implements FragmentManager.OnBackStackChangedListener { public class ActivityCompose extends ActivityBase implements FragmentManager.OnBackStackChangedListener {
@ -85,6 +88,14 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
Bundle args; Bundle args;
String action = intent.getAction(); String action = intent.getAction();
if (isShared(action)) { if (isShared(action)) {
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
if (am != null) {
List<ActivityManager.AppTask> tasks = am.getAppTasks();
if (tasks != null && tasks.size() > 0) {
tasks.get(0).setExcludeFromRecents(true);
}
}
args = new Bundle(); args = new Bundle();
args.putString("action", "new"); args.putString("action", "new");
args.putLong("account", -1); args.putLong("account", -1);