Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ed7657c authored by Jaewan Kim's avatar Jaewan Kim
Browse files

Hide system UI activity with FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS in Recents

Bug: 27319061
Change-Id: I41150137cdfac6750f74ba3a72c4872dc6816f1d
parent c1d317f7
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -94,12 +94,18 @@ public class SystemServicesProxy {
    final static String TAG = "SystemServicesProxy";

    final static BitmapFactory.Options sBitmapOptions;

    static {
        sBitmapOptions = new BitmapFactory.Options();
        sBitmapOptions.inMutable = true;
    }

    final static List<String> sRecentsBlacklist;
    static {
        sRecentsBlacklist = new ArrayList<>();
        sRecentsBlacklist.add("com.android.systemui.tv.pip.PipOnboardingActivity");
        sRecentsBlacklist.add("com.android.systemui.tv.pip.PipMenuActivity");
    }

    AccessibilityManager mAccm;
    ActivityManager mAm;
    IActivityManager mIam;
@@ -227,12 +233,13 @@ public class SystemServicesProxy {

            // Check the first non-recents task, include this task even if it is marked as excluded
            // from recents if we are currently in the app.  In other words, only remove excluded
            // tasks if it is not the first active task.
            // tasks if it is not the first active task, and not in the blacklist.
            boolean isExcluded = (t.baseIntent.getFlags() & Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
                    == Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
            boolean isBlackListed = sRecentsBlacklist.contains(t.realActivity.getClassName());
            // Filter out recent tasks from managed profiles which are in quiet mode.
            isExcluded |= quietProfileIds.contains(t.userId);
            if (isExcluded && (isTopTaskHome || !isFirstValidTask)) {
            if (isBlackListed || (isExcluded && (isTopTaskHome || !isFirstValidTask))) {
                iter.remove();
                continue;
            }