From ca5ad35e7ff3132ae4d522a546b37b922fa4bb33 Mon Sep 17 00:00:00 2001 From: Muntashir Al-Islam Date: Mon, 13 Jan 2025 14:33:57 -0800 Subject: [PATCH] [AppDetails] Handle apps installed in a separate non-work profile Signed-off-by: Muntashir Al-Islam --- .../AppManager/compat/PackageManagerCompat.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/muntashirakon/AppManager/compat/PackageManagerCompat.java b/app/src/main/java/io/github/muntashirakon/AppManager/compat/PackageManagerCompat.java index 2f61df8016f..68bbfab624f 100644 --- a/app/src/main/java/io/github/muntashirakon/AppManager/compat/PackageManagerCompat.java +++ b/app/src/main/java/io/github/muntashirakon/AppManager/compat/PackageManagerCompat.java @@ -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 activityInfoList = launcherApps.getActivityList(packageName, userHandle);