Enable protolog by default for WMShell

WMShell is a static library built into systemui. In this change, we
allocate a 128KB buffer and enable it by default on debuggable builds,
e.g.  userdebug or eng builds. This should give us sufficient amount of
log for debugging purpose when receive bug-reports.

We need further have the viewer in bug-report / winscope to actually
view the logs being written.

Bug: 262244460
Test: adb shell dumpsys activity service SystemUIService WMShell \
      protolog save-for-bugreport
Change-Id: I50e1ad31d944ac530c9c7f2d881c09cf05493be9
This commit is contained in:
Hongwei Wang
2023-02-15 14:36:23 -08:00
parent fe18a7bb78
commit 4005c0e25c
2 changed files with 6 additions and 2 deletions

View File

@@ -16,6 +16,8 @@
package com.android.wm.shell;
import android.os.Build;
import com.android.wm.shell.protolog.ShellProtoLogImpl;
import com.android.wm.shell.sysui.ShellCommandHandler;
import com.android.wm.shell.sysui.ShellInit;
@@ -41,6 +43,9 @@ public class ProtoLogController implements ShellCommandHandler.ShellCommandActio
void onInit() {
mShellCommandHandler.addCommandCallback("protolog", this, this);
if (Build.IS_DEBUGGABLE) {
mShellProtoLog.startProtoLog(null /* PrintWriter */);
}
}
@Override

View File

@@ -31,8 +31,7 @@ import java.io.PrintWriter;
*/
public class ShellProtoLogImpl extends BaseProtoLogImpl {
private static final String TAG = "ProtoLogImpl";
private static final int BUFFER_CAPACITY = 1024 * 1024;
// TODO: find a proper location to save the protolog message file
private static final int BUFFER_CAPACITY = 128 * 1024;
private static final String LOG_FILENAME = "/data/misc/wmtrace/shell_log.winscope";
private static final String VIEWER_CONFIG_FILENAME = "/system_ext/etc/wmshell.protolog.json.gz";