Loading services/core/java/com/android/server/pm/verify/domain/DomainVerificationService.java +27 −7 Original line number Diff line number Diff line Loading @@ -148,6 +148,8 @@ public class DomainVerificationService extends SystemService @NonNull private DomainVerificationProxy mProxy = new DomainVerificationProxyUnavailable(); private boolean mCanSendBroadcasts; public DomainVerificationService(@NonNull Context context, @NonNull SystemConfig systemConfig, @NonNull PlatformCompat platformCompat) { super(context); Loading Loading @@ -181,11 +183,18 @@ public class DomainVerificationService extends SystemService @Override public void onBootPhase(int phase) { super.onBootPhase(phase); if (phase != SystemService.PHASE_BOOT_COMPLETED || !hasRealVerifier()) { if (!hasRealVerifier()) { return; } switch (phase) { case PHASE_ACTIVITY_MANAGER_READY: mCanSendBroadcasts = true; break; case PHASE_BOOT_COMPLETED: verifyPackages(null, false); break; } } @Override Loading Loading @@ -858,7 +867,7 @@ public class DomainVerificationService extends SystemService } if (sendBroadcast) { sendBroadcastForPackage(pkgName); sendBroadcast(pkgName); } } Loading Loading @@ -937,7 +946,7 @@ public class DomainVerificationService extends SystemService } if (sendBroadcast && hasAutoVerifyDomains) { sendBroadcastForPackage(pkgName); sendBroadcast(pkgName); } } Loading Loading @@ -1098,8 +1107,19 @@ public class DomainVerificationService extends SystemService return mCollector; } private void sendBroadcastForPackage(@NonNull String packageName) { mProxy.sendBroadcastForPackages(Collections.singleton(packageName)); private void sendBroadcast(@NonNull String packageName) { sendBroadcast(Collections.singleton(packageName)); } private void sendBroadcast(@NonNull Set<String> packageNames) { if (!mCanSendBroadcasts) { // If the system cannot send broadcasts, it's probably still in boot, so dropping this // request should be fine. The verification agent should re-scan packages once boot // completes. return; } mProxy.sendBroadcastForPackages(packageNames); } private boolean hasRealVerifier() { Loading Loading @@ -1183,7 +1203,7 @@ public class DomainVerificationService extends SystemService } if (!packagesToBroadcast.isEmpty()) { mProxy.sendBroadcastForPackages(packagesToBroadcast); sendBroadcast(packagesToBroadcast); } } Loading Loading
services/core/java/com/android/server/pm/verify/domain/DomainVerificationService.java +27 −7 Original line number Diff line number Diff line Loading @@ -148,6 +148,8 @@ public class DomainVerificationService extends SystemService @NonNull private DomainVerificationProxy mProxy = new DomainVerificationProxyUnavailable(); private boolean mCanSendBroadcasts; public DomainVerificationService(@NonNull Context context, @NonNull SystemConfig systemConfig, @NonNull PlatformCompat platformCompat) { super(context); Loading Loading @@ -181,11 +183,18 @@ public class DomainVerificationService extends SystemService @Override public void onBootPhase(int phase) { super.onBootPhase(phase); if (phase != SystemService.PHASE_BOOT_COMPLETED || !hasRealVerifier()) { if (!hasRealVerifier()) { return; } switch (phase) { case PHASE_ACTIVITY_MANAGER_READY: mCanSendBroadcasts = true; break; case PHASE_BOOT_COMPLETED: verifyPackages(null, false); break; } } @Override Loading Loading @@ -858,7 +867,7 @@ public class DomainVerificationService extends SystemService } if (sendBroadcast) { sendBroadcastForPackage(pkgName); sendBroadcast(pkgName); } } Loading Loading @@ -937,7 +946,7 @@ public class DomainVerificationService extends SystemService } if (sendBroadcast && hasAutoVerifyDomains) { sendBroadcastForPackage(pkgName); sendBroadcast(pkgName); } } Loading Loading @@ -1098,8 +1107,19 @@ public class DomainVerificationService extends SystemService return mCollector; } private void sendBroadcastForPackage(@NonNull String packageName) { mProxy.sendBroadcastForPackages(Collections.singleton(packageName)); private void sendBroadcast(@NonNull String packageName) { sendBroadcast(Collections.singleton(packageName)); } private void sendBroadcast(@NonNull Set<String> packageNames) { if (!mCanSendBroadcasts) { // If the system cannot send broadcasts, it's probably still in boot, so dropping this // request should be fine. The verification agent should re-scan packages once boot // completes. return; } mProxy.sendBroadcastForPackages(packageNames); } private boolean hasRealVerifier() { Loading Loading @@ -1183,7 +1203,7 @@ public class DomainVerificationService extends SystemService } if (!packagesToBroadcast.isEmpty()) { mProxy.sendBroadcastForPackages(packagesToBroadcast); sendBroadcast(packagesToBroadcast); } } Loading