Include all apps when getting Recents

The current RecentTasks fetches the recents app (based on
config_recentsComponentName). However, it does so for user 0. In some
cases, the recents app might not be installed in user 0 (even though it
is installed in other users). We need to fetch it even in that case, so
that recents can work on those other users. (Otherwise, the attempting
app will not only not do recents, it'll probably crash.)

Bug: 216636343
Test: manual confirmation on a headless user 0 device where launcher is
uninstalled on user 0

Change-Id: Ib2b536e997d58f8fb34c75e92a1cdd843b4b04fa
This commit is contained in:
Adam Bookatz
2022-01-27 11:03:30 -08:00
parent d707ebcd7a
commit 992f8b5b0f

View File

@@ -380,8 +380,11 @@ class RecentTasks {
final ComponentName cn = ComponentName.unflattenFromString(rawRecentsComponent);
if (cn != null) {
try {
final ApplicationInfo appInfo = AppGlobals.getPackageManager()
.getApplicationInfo(cn.getPackageName(), 0, mService.mContext.getUserId());
final ApplicationInfo appInfo = AppGlobals.getPackageManager().getApplicationInfo(
cn.getPackageName(),
PackageManager.MATCH_UNINSTALLED_PACKAGES
| PackageManager.MATCH_DISABLED_COMPONENTS,
mService.mContext.getUserId());
if (appInfo != null) {
mRecentsUid = appInfo.uid;
mRecentsComponent = cn;