mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-31 20:25:38 +00:00
Added fail-safe
This commit is contained in:
parent
389aa04864
commit
36c44fa285
1 changed files with 11 additions and 4 deletions
|
@ -767,11 +767,18 @@ public class Helper {
|
|||
}
|
||||
|
||||
static void excludeFromRecents(Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (am != null) {
|
||||
try {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
if (am == null)
|
||||
return;
|
||||
|
||||
List<ActivityManager.AppTask> tasks = am.getAppTasks();
|
||||
if (tasks != null && tasks.size() > 0)
|
||||
tasks.get(0).setExcludeFromRecents(true);
|
||||
if (tasks == null || tasks.size() == 0)
|
||||
return;
|
||||
|
||||
tasks.get(0).setExcludeFromRecents(true);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue