Merge "Fix LauncherApps.isActivityEnalbed()"

This commit is contained in:
Makoto Onuki
2019-01-29 18:01:05 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -781,6 +781,9 @@ public class LauncherApps {
/**
* Checks if the activity exists and it enabled for a profile.
*
* <p>The activity may still not be exported, in which case {@link #startMainActivity} will
* throw a {@link SecurityException} unless the caller has the same UID as the target app's.
*
* @param component The activity to check.
* @param user The UserHandle of the profile.
*

View File

@@ -837,7 +837,11 @@ public class LauncherAppsService extends SystemService {
PackageManager.MATCH_DIRECT_BOOT_AWARE
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
callingUid, user.getIdentifier());
return info != null;
// Note we don't check "exported" because if the caller has the same UID as the
// callee's UID, it can still be launched.
// (If an app doesn't export a front door activity and causes issues with the
// launcher, that's just the app's bug.)
return info != null && info.isEnabled();
} finally {
Binder.restoreCallingIdentity(ident);
}