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

Commit e62be97c authored by Gabriele M's avatar Gabriele M
Browse files

Revert "Always hide protected apps from the recent tasks list"

This doesn't always have the desired effect. For example, CMParts is
now a protected component manager and can start protected activities
without requiring any authentication. This change seems to undo the
effect of FLAG_ACTIVITY_NEW_TASK that CMParts sets when it starts a
protected component, therefore, even though no new entry is added to
the recents list, the protected component replaces the entry for
CMParts. This is equivalent to adding an entry for the app to the
recents list. Forcing FLAG_ACTIVITY_NEW_TASK appears to have desired
effect (no entry for the protected app in recents), but this change
would be too intrusive and it could potentially break something else.
Setting the proper flags from the protected component manager is
probably a safer option, even though it would not be able to stop
apps from creating new entries in recents themselves.

This reverts commit 15360dfe.

Change-Id: Ie54cb6c6ddc1d1156076bce4b7ce9a5811df1460
parent ea19b33a
Loading
Loading
Loading
Loading
+1 −35
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ class ActivityStarter {
            }
        }

        int launchFlags = intent.getFlags();
        final int launchFlags = intent.getFlags();

        if ((launchFlags & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0 && sourceRecord != null) {
            // Transfer the result target from the source activity to the new
@@ -386,16 +386,6 @@ class ActivityStarter {
            }
        }

        try {
            if (shouldExcludeFromRecents(intent, userId)) {
                launchFlags |= FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
                intent.setFlags(launchFlags);
            }
        } catch (RemoteException e) {
            Slog.w(TAG, "Failure checking protected apps status", e);
            err = ActivityManager.START_PROTECTED_APP;
        }

        final ActivityStack resultStack = resultRecord == null ? null : resultRecord.task.stack;

        if (err != START_SUCCESS) {
@@ -826,15 +816,6 @@ class ActivityStarter {
                e.printStackTrace();
            }

            try {
                if (shouldExcludeFromRecents(intent, userId)) {
                    startFlags |= FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
                    intent.setFlags(startFlags);
                }
            } catch (RemoteException e) {
                Slog.w(TAG, "Failure checking protected apps status", e);
            }

            final int realCallingPid = Binder.getCallingPid();
            final int realCallingUid = Binder.getCallingUid();
            int callingPid;
@@ -1119,14 +1100,6 @@ class ActivityStarter {
            e.printStackTrace();
        }

        try {
            if (shouldExcludeFromRecents(r.intent, r.userId)) {
                mLaunchFlags |= FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
            }
        } catch (RemoteException e) {
            Slog.w(TAG, "Failure checking protected apps status", e);
        }

        computeLaunchingTaskFlags();

        computeSourceStack();
@@ -2188,11 +2161,4 @@ class ActivityStarter {
            }
        }
    }

    private boolean shouldExcludeFromRecents(final Intent intent, final int userId)
            throws RemoteException {
        return intent.getComponent() != null &&
                AppGlobals.getPackageManager().isComponentProtected(
                        null, -1, intent.getComponent(), userId);
    }
}