Convert DomainVerificationService.Connection to synchronous set

Unfortunately it's possible to call this during PackageManagerService
initialization, so this needs to be attached before PMS gets created.

Rather than using a deferred injection, this makes PMS call
setConnection to directly set the callback. A better isolated might be
worth exploring in the future, but overall it shouldn't really matter.

Exempt-From-Owner-Approval: Already approved by owners on main branch

Bug: 163565712

Test: com.android.server.pm.test.domain.verify

Change-Id: Ib60f5560ecaa510474228aa1c38eff5d6041ab58
This commit is contained in:
Winson
2021-01-20 12:26:37 -08:00
parent 0af8c46c2f
commit 47dbabfc14
5 changed files with 98 additions and 109 deletions

View File

@@ -87,7 +87,6 @@ import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.IndentingPrintWriter;
import android.util.Pair;
import android.util.Singleton;
import android.util.Slog;
import android.util.TimeUtils;
import android.view.contentcapture.ContentCaptureManager;
@@ -1064,16 +1063,7 @@ public final class SystemServer implements Dumpable {
t.traceBegin("StartDomainVerificationService");
DomainVerificationService domainVerificationService = new DomainVerificationService(
mSystemContext, SystemConfig.getInstance(), platformCompat,
new Singleton<DomainVerificationService.Connection>() {
@Override
protected DomainVerificationService.Connection create() {
// Deferred retrieval from PackageManagerService, since PMS is initialized after
// DVS. The alternative would be to expose this through the PackageManagerInternal
// local service, but making it visible to consumers of that interface isn't useful.
return mPackageManagerService.getDomainVerificationConnection();
}
});
mSystemContext, SystemConfig.getInstance(), platformCompat);
mSystemServiceManager.startService(domainVerificationService);
t.traceEnd();