Allow dumping all transactions.

Dump all transactions when we're not dumping for a bug report.

Bug: 158300259
Test: adb shell dumpsys tare
Change-Id: Idb7045dcacaa228947ad80d7b5651eb75407b9bd
This commit is contained in:
Kweku Adams
2021-12-01 13:40:59 -08:00
parent ef6564cbfb
commit 214d9cf269
2 changed files with 9 additions and 8 deletions

View File

@@ -847,15 +847,16 @@ public class InternalResourceService extends SystemService {
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpAndUsageStatsPermission(getContext(), TAG, pw)) return;
boolean dumpAll = true;
if (!ArrayUtils.isEmpty(args)) {
String arg = args[0];
if ("-h".equals(arg) || "--help".equals(arg)) {
dumpHelp(pw);
return;
} else if ("-a".equals(arg)) {
// -a is passed when dumping a bug report so we have to acknowledge the
// argument. However, we currently don't do anything differently for bug
// reports.
// -a is passed when dumping a bug report. Bug reports have a time limit for
// each service dump, so we can't dump everything.
dumpAll = false;
} else if (arg.length() > 0 && arg.charAt(0) == '-') {
pw.println("Unknown option: " + arg);
return;
@@ -864,7 +865,7 @@ public class InternalResourceService extends SystemService {
final long identityToken = Binder.clearCallingIdentity();
try {
dumpInternal(new IndentingPrintWriter(pw, " "));
dumpInternal(new IndentingPrintWriter(pw, " "), dumpAll);
} finally {
Binder.restoreCallingIdentity(identityToken);
}
@@ -1098,7 +1099,7 @@ public class InternalResourceService extends SystemService {
pw.println(" [package] is an optional package name to limit the output to.");
}
private void dumpInternal(final IndentingPrintWriter pw) {
private void dumpInternal(final IndentingPrintWriter pw, final boolean dumpAll) {
synchronized (mLock) {
pw.print("Is enabled: ");
pw.println(mIsEnabled);
@@ -1127,7 +1128,7 @@ public class InternalResourceService extends SystemService {
mCompleteEconomicPolicy.dump(pw);
pw.println();
mScribe.dumpLocked(pw);
mScribe.dumpLocked(pw, dumpAll);
pw.println();
mAgent.dumpLocked(pw);

View File

@@ -509,7 +509,7 @@ public class Scribe {
}
@GuardedBy("mIrs.getLock()")
void dumpLocked(IndentingPrintWriter pw) {
void dumpLocked(IndentingPrintWriter pw, boolean dumpAll) {
pw.println("Ledgers:");
pw.increaseIndent();
mLedgers.forEach((userId, pkgName, ledger) -> {
@@ -519,7 +519,7 @@ public class Scribe {
}
pw.println();
pw.increaseIndent();
ledger.dump(pw, MAX_NUM_TRANSACTION_DUMP);
ledger.dump(pw, dumpAll ? Integer.MAX_VALUE : MAX_NUM_TRANSACTION_DUMP);
pw.decreaseIndent();
});
pw.decreaseIndent();