Merge "Only dump necessary info when specifying a package" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-05-13 18:04:30 +00:00
committed by Android (Google) Code Review

View File

@@ -24102,12 +24102,12 @@ public class PackageManagerService extends IPackageManager.Stub
pw.println("vers,1"); pw.println("vers,1");
} }
// reader if (!checkin
if (dumpState.isDumping(DumpState.DUMP_VERSION) && packageName == null) { && dumpState.isDumping(DumpState.DUMP_VERSION)
if (!checkin) { && packageName == null) {
// dump version information for all volumes with installed packages
dump(DumpState.DUMP_VERSION, fd, pw, dumpState); dump(DumpState.DUMP_VERSION, fd, pw, dumpState);
} }
}
if (!checkin if (!checkin
&& dumpState.isDumping(DumpState.DUMP_KNOWN_PACKAGES) && dumpState.isDumping(DumpState.DUMP_KNOWN_PACKAGES)
@@ -24137,7 +24137,8 @@ public class PackageManagerService extends IPackageManager.Stub
ipw.decreaseIndent(); ipw.decreaseIndent();
} }
if (dumpState.isDumping(DumpState.DUMP_VERIFIERS) && packageName == null) { if (dumpState.isDumping(DumpState.DUMP_VERIFIERS)
&& packageName == null) {
final String requiredVerifierPackage = mRequiredVerifierPackage; final String requiredVerifierPackage = mRequiredVerifierPackage;
if (!checkin) { if (!checkin) {
if (dumpState.onTitlePrinted()) { if (dumpState.onTitlePrinted()) {
@@ -24158,7 +24159,8 @@ public class PackageManagerService extends IPackageManager.Stub
} }
} }
if (dumpState.isDumping(DumpState.DUMP_DOMAIN_VERIFIER) && packageName == null) { if (dumpState.isDumping(DumpState.DUMP_DOMAIN_VERIFIER)
&& packageName == null) {
final DomainVerificationProxy proxy = mDomainVerificationManager.getProxy(); final DomainVerificationProxy proxy = mDomainVerificationManager.getProxy();
final ComponentName verifierComponent = proxy.getComponentName(); final ComponentName verifierComponent = proxy.getComponentName();
if (verifierComponent != null) { if (verifierComponent != null) {
@@ -24185,11 +24187,13 @@ public class PackageManagerService extends IPackageManager.Stub
} }
} }
if (dumpState.isDumping(DumpState.DUMP_LIBS) && packageName == null) { if (dumpState.isDumping(DumpState.DUMP_LIBS)
&& packageName == null) {
dump(DumpState.DUMP_LIBS, fd, pw, dumpState); dump(DumpState.DUMP_LIBS, fd, pw, dumpState);
} }
if (dumpState.isDumping(DumpState.DUMP_FEATURES) && packageName == null) { if (dumpState.isDumping(DumpState.DUMP_FEATURES)
&& packageName == null) {
if (dumpState.onTitlePrinted()) { if (dumpState.onTitlePrinted()) {
pw.println(); pw.println();
} }
@@ -24199,12 +24203,7 @@ public class PackageManagerService extends IPackageManager.Stub
synchronized (mAvailableFeatures) { synchronized (mAvailableFeatures) {
for (FeatureInfo feat : mAvailableFeatures.values()) { for (FeatureInfo feat : mAvailableFeatures.values()) {
if (checkin) { if (!checkin) {
pw.print("feat,");
pw.print(feat.name);
pw.print(",");
pw.println(feat.version);
} else {
pw.print(" "); pw.print(" ");
pw.print(feat.name); pw.print(feat.name);
if (feat.version > 0) { if (feat.version > 0) {
@@ -24212,55 +24211,73 @@ public class PackageManagerService extends IPackageManager.Stub
pw.print(feat.version); pw.print(feat.version);
} }
pw.println(); pw.println();
} else {
pw.print("feat,");
pw.print(feat.name);
pw.print(",");
pw.println(feat.version);
} }
} }
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_ACTIVITY_RESOLVERS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_ACTIVITY_RESOLVERS)) {
synchronized (mLock) { synchronized (mLock) {
mComponentResolver.dumpActivityResolvers(pw, dumpState, packageName); mComponentResolver.dumpActivityResolvers(pw, dumpState, packageName);
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_RECEIVER_RESOLVERS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_RECEIVER_RESOLVERS)) {
synchronized (mLock) { synchronized (mLock) {
mComponentResolver.dumpReceiverResolvers(pw, dumpState, packageName); mComponentResolver.dumpReceiverResolvers(pw, dumpState, packageName);
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_SERVICE_RESOLVERS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_SERVICE_RESOLVERS)) {
synchronized (mLock) { synchronized (mLock) {
mComponentResolver.dumpServiceResolvers(pw, dumpState, packageName); mComponentResolver.dumpServiceResolvers(pw, dumpState, packageName);
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_CONTENT_RESOLVERS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_CONTENT_RESOLVERS)) {
synchronized (mLock) { synchronized (mLock) {
mComponentResolver.dumpProviderResolvers(pw, dumpState, packageName); mComponentResolver.dumpProviderResolvers(pw, dumpState, packageName);
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_PREFERRED)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_PREFERRED)
&& packageName == null) {
dump(DumpState.DUMP_PREFERRED, fd, pw, dumpState); dump(DumpState.DUMP_PREFERRED, fd, pw, dumpState);
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_PREFERRED_XML)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_PREFERRED_XML)
&& packageName == null) {
dump(DumpState.DUMP_PREFERRED_XML, fd, pw, dumpState); dump(DumpState.DUMP_PREFERRED_XML, fd, pw, dumpState);
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_DOMAIN_PREFERRED)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_DOMAIN_PREFERRED)
&& packageName == null) {
dump(DumpState.DUMP_DOMAIN_PREFERRED, fd, pw, dumpState); dump(DumpState.DUMP_DOMAIN_PREFERRED, fd, pw, dumpState);
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_PERMISSIONS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_PERMISSIONS)) {
mSettings.dumpPermissions(pw, packageName, permissionNames, dumpState); mSettings.dumpPermissions(pw, packageName, permissionNames, dumpState);
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_PROVIDERS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_PROVIDERS)) {
synchronized (mLock) { synchronized (mLock) {
mComponentResolver.dumpContentProviders(pw, dumpState, packageName); mComponentResolver.dumpContentProviders(pw, dumpState, packageName);
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_KEYSETS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_KEYSETS)) {
synchronized (mLock) { synchronized (mLock) {
mSettings.getKeySetManagerService().dumpLPr(pw, packageName, dumpState); mSettings.getKeySetManagerService().dumpLPr(pw, packageName, dumpState);
} }
@@ -24275,11 +24292,15 @@ public class PackageManagerService extends IPackageManager.Stub
} }
} }
if (dumpState.isDumping(DumpState.DUMP_QUERIES)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_QUERIES)
&& packageName == null) {
dump(DumpState.DUMP_QUERIES, fd, pw, dumpState); dump(DumpState.DUMP_QUERIES, fd, pw, dumpState);
} }
if (dumpState.isDumping(DumpState.DUMP_SHARED_USERS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_SHARED_USERS)
&& packageName == null) {
// This cannot be moved to ComputerEngine since the set of packages in the // This cannot be moved to ComputerEngine since the set of packages in the
// SharedUserSetting do not have a copy. // SharedUserSetting do not have a copy.
synchronized (mLock) { synchronized (mLock) {
@@ -24287,7 +24308,9 @@ public class PackageManagerService extends IPackageManager.Stub
} }
} }
if (dumpState.isDumping(DumpState.DUMP_CHANGES)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_CHANGES)
&& packageName == null) {
if (dumpState.onTitlePrinted()) pw.println(); if (dumpState.onTitlePrinted()) pw.println();
pw.println("Package Changes:"); pw.println("Package Changes:");
synchronized (mLock) { synchronized (mLock) {
@@ -24314,7 +24337,9 @@ public class PackageManagerService extends IPackageManager.Stub
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_FROZEN) && packageName == null) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_FROZEN)
&& packageName == null) {
// XXX should handle packageName != null by dumping only install data that // XXX should handle packageName != null by dumping only install data that
// the given package is involved with. // the given package is involved with.
if (dumpState.onTitlePrinted()) pw.println(); if (dumpState.onTitlePrinted()) pw.println();
@@ -24335,7 +24360,9 @@ public class PackageManagerService extends IPackageManager.Stub
ipw.decreaseIndent(); ipw.decreaseIndent();
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_VOLUMES) && packageName == null) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_VOLUMES)
&& packageName == null) {
if (dumpState.onTitlePrinted()) pw.println(); if (dumpState.onTitlePrinted()) pw.println();
final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ", 120); final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ", 120);
@@ -24354,24 +24381,31 @@ public class PackageManagerService extends IPackageManager.Stub
ipw.decreaseIndent(); ipw.decreaseIndent();
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_SERVICE_PERMISSIONS) if (!checkin
&& dumpState.isDumping(DumpState.DUMP_SERVICE_PERMISSIONS)
&& packageName == null) { && packageName == null) {
synchronized (mLock) { synchronized (mLock) {
mComponentResolver.dumpServicePermissions(pw, dumpState); mComponentResolver.dumpServicePermissions(pw, dumpState);
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_DEXOPT)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_DEXOPT)
&& packageName == null) {
if (dumpState.onTitlePrinted()) pw.println(); if (dumpState.onTitlePrinted()) pw.println();
dump(DumpState.DUMP_DEXOPT, fd, pw, dumpState); dump(DumpState.DUMP_DEXOPT, fd, pw, dumpState);
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_COMPILER_STATS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_COMPILER_STATS)
&& packageName == null) {
if (dumpState.onTitlePrinted()) pw.println(); if (dumpState.onTitlePrinted()) pw.println();
dump(DumpState.DUMP_COMPILER_STATS, fd, pw, dumpState); dump(DumpState.DUMP_COMPILER_STATS, fd, pw, dumpState);
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_MESSAGES) && packageName == null) { if (dumpState.isDumping(DumpState.DUMP_MESSAGES)
&& packageName == null) {
if (!checkin) {
if (dumpState.onTitlePrinted()) pw.println(); if (dumpState.onTitlePrinted()) pw.println();
synchronized (mLock) { synchronized (mLock) {
mSettings.dumpReadMessagesLPr(pw, dumpState); mSettings.dumpReadMessagesLPr(pw, dumpState);
@@ -24379,25 +24413,29 @@ public class PackageManagerService extends IPackageManager.Stub
pw.println(); pw.println();
pw.println("Package warning messages:"); pw.println("Package warning messages:");
dumpCriticalInfo(pw, null); dumpCriticalInfo(pw, null);
} } else {
if (checkin && dumpState.isDumping(DumpState.DUMP_MESSAGES)) {
dumpCriticalInfo(pw, "msg,"); dumpCriticalInfo(pw, "msg,");
} }
}
// PackageInstaller should be called outside of mPackages lock // PackageInstaller should be called outside of mPackages lock
if (!checkin && dumpState.isDumping(DumpState.DUMP_INSTALLS) && packageName == null) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_INSTALLS)
&& packageName == null) {
// XXX should handle packageName != null by dumping only install data that // XXX should handle packageName != null by dumping only install data that
// the given package is involved with. // the given package is involved with.
if (dumpState.onTitlePrinted()) pw.println(); if (dumpState.onTitlePrinted()) pw.println();
mInstallerService.dump(new IndentingPrintWriter(pw, " ", 120)); mInstallerService.dump(new IndentingPrintWriter(pw, " ", 120));
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_APEX)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_APEX)
&& packageName == null) {
mApexManager.dump(pw, packageName); mApexManager.dump(pw, packageName);
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_PER_UID_READ_TIMEOUTS) if (!checkin
&& dumpState.isDumping(DumpState.DUMP_PER_UID_READ_TIMEOUTS)
&& packageName == null) { && packageName == null) {
pw.println(); pw.println();
pw.println("Per UID read timeouts:"); pw.println("Per UID read timeouts:");
@@ -24416,7 +24454,9 @@ public class PackageManagerService extends IPackageManager.Stub
} }
} }
if (!checkin && dumpState.isDumping(DumpState.DUMP_SNAPSHOT_STATISTICS)) { if (!checkin
&& dumpState.isDumping(DumpState.DUMP_SNAPSHOT_STATISTICS)
&& packageName == null) {
pw.println("Snapshot statistics"); pw.println("Snapshot statistics");
if (!mSnapshotEnabled) { if (!mSnapshotEnabled) {
pw.println(" Snapshots disabled"); pw.println(" Snapshots disabled");