Skip to content

Commit

Permalink
[AppDetails] Handle apps installed in a separate non-work profile
Browse files Browse the repository at this point in the history
Signed-off-by: Muntashir Al-Islam <[email protected]>
  • Loading branch information
MuntashirAkon committed Jan 13, 2025
1 parent addfba2 commit ca5ad35
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,13 @@ public static Intent getLaunchIntentForPackage(@NonNull String packageName, @Use
return null;
}
LauncherApps launcherApps = (LauncherApps) context.getSystemService(Context.LAUNCHER_APPS_SERVICE);
if (!launcherApps.isPackageEnabled(packageName, userHandle)) {
// Package not enabled
try {
if (!launcherApps.isPackageEnabled(packageName, userHandle)) {
// Package not enabled
return null;
}
} catch (SecurityException e) {
Log.w(TAG, "Could not retrieve enable state of " + packageName + " for user " + userHandle, e);
return null;
}
List<LauncherActivityInfo> activityInfoList = launcherApps.getActivityList(packageName, userHandle);
Expand Down

0 comments on commit ca5ad35

Please sign in to comment.