Skip to content
This repository has been archived by the owner on Dec 17, 2023. It is now read-only.

Commit

Permalink
Allow searching for hidden Android Work apps, by checking every user
Browse files Browse the repository at this point in the history
  • Loading branch information
amirzaidi committed Mar 25, 2018
1 parent 3d2622f commit 562f1d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
9 changes: 4 additions & 5 deletions src/com/android/launcher3/allapps/AlphabeticalAppsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,18 +631,17 @@ private List<AppInfo> getFiltersAppInfos() {
}

final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(mLauncher);
final UserHandle user = android.os.Process.myUserHandle();
final IconCache iconCache = LauncherAppState.getInstance(mLauncher).getIconCache();
ArrayList<AppInfo> result = new ArrayList<>();
boolean quietMode = UserManagerCompat.getInstance(mLauncher).isQuietModeEnabled(user);
final UserManagerCompat userManagerCompat = UserManagerCompat.getInstance(mLauncher);
final ArrayList<AppInfo> result = new ArrayList<>();
for (ComponentKey key : mSearchResults) {
AppInfo match = mComponentToAppMap.get(key);
if (match != null) {
result.add(match);
} else {
for (LauncherActivityInfo info : launcherApps.getActivityList(key.componentName.getPackageName(), user)) {
for (LauncherActivityInfo info : launcherApps.getActivityList(key.componentName.getPackageName(), key.user)) {
if (info.getComponentName().equals(key.componentName)) {
final AppInfo appInfo = new AppInfo(info, user, quietMode);
final AppInfo appInfo = new AppInfo(info, key.user, userManagerCompat.isQuietModeEnabled(key.user));
iconCache.getTitleAndIcon(appInfo, false);
result.add(appInfo);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.util.ComponentKey;

import java.text.Collator;
Expand Down Expand Up @@ -90,15 +91,16 @@ public static List<AppInfo> getApps(Context context, List<AppInfo> defaultApps)
return defaultApps;
}
final List<AppInfo> apps = new ArrayList<>();
final List<ComponentName> duplicatePreventionCache = new ArrayList<>();
final UserHandle user = android.os.Process.myUserHandle();
final IconCache iconCache = LauncherAppState.getInstance(context).getIconCache();
for (LauncherActivityInfo info : LauncherAppsCompat.getInstance(context).getActivityList(null, user)) {
if (!duplicatePreventionCache.contains(info.getComponentName())) {
duplicatePreventionCache.add(info.getComponentName());
final AppInfo appInfo = new AppInfo(context, info, user);
iconCache.getTitleAndIcon(appInfo, false);
apps.add(appInfo);
for (UserHandle user : UserManagerCompat.getInstance(context).getUserProfiles()) {
final List<ComponentName> duplicatePreventionCache = new ArrayList<>();
for (LauncherActivityInfo info : LauncherAppsCompat.getInstance(context).getActivityList(null, user)) {
if (!duplicatePreventionCache.contains(info.getComponentName())) {
duplicatePreventionCache.add(info.getComponentName());
final AppInfo appInfo = new AppInfo(context, info, user);
iconCache.getTitleAndIcon(appInfo, false);
apps.add(appInfo);
}
}
}
return apps;
Expand Down

0 comments on commit 562f1d1

Please sign in to comment.