Merge "Support save-for-bugreport command in WMShell" into tm-qpr-dev am: bc8078abdd am: a778b301e3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21159015

Change-Id: I11efc327900afdbaebaa69cff011ded943dab019
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hongwei Wang
2023-02-08 19:42:07 +00:00
committed by Automerger Merge Worker

View File

@@ -84,6 +84,15 @@ public class ProtoLogController implements ShellCommandHandler.ShellCommandActio
String[] groups = Arrays.copyOfRange(args, 1, args.length);
return mShellProtoLog.stopTextLogging(groups, pw) == 0;
}
case "save-for-bugreport": {
if (!mShellProtoLog.isProtoEnabled()) {
pw.println("Logging to proto is not enabled for WMShell.");
return false;
}
mShellProtoLog.stopProtoLog(pw, true /* writeToFile */);
mShellProtoLog.startProtoLog(pw);
return true;
}
default: {
pw.println("Invalid command: " + args[0]);
printShellCommandHelp(pw, "");
@@ -108,5 +117,7 @@ public class ProtoLogController implements ShellCommandHandler.ShellCommandActio
pw.println(prefix + " Enable logcat logging for given groups.");
pw.println(prefix + "disable-text [group...]");
pw.println(prefix + " Disable logcat logging for given groups.");
pw.println(prefix + "save-for-bugreport");
pw.println(prefix + " Flush proto logging to file, only if it's enabled.");
}
}