Fix bug in activity resolving logic

Test: manual
Change-Id: I77185c981c9cefd1ca98b1d1f6945c65843113fe
This commit is contained in:
Kholoud Mohamed
2023-05-18 14:20:54 +00:00
parent 0f26a22cdb
commit 05bdac0b1c

View File

@@ -1076,12 +1076,9 @@ final class DevicePolicyEngine {
if (policies.get(admin).getValue() != null
&& policies.get(admin).getValue().getPackageName().equals(packageName)) {
try {
if (packageManager.getPackageInfo(
packageName, 0, userId) == null
|| packageManager.getReceiverInfo(policies.get(admin).getValue(),
PackageManager.MATCH_DIRECT_BOOT_AWARE
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE,
userId) == null) {
if (packageManager.getPackageInfo(packageName, 0, userId) == null
|| packageManager.getActivityInfo(
policies.get(admin).getValue(), 0, userId) == null) {
Slogf.e(TAG, String.format(
"Persistent preferred activity in package %s not found for "
+ "user %d, removing policy for admin",