Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b4ed932 authored by Winson Chung's avatar Winson Chung
Browse files

Proxy wm commands to shell to simplify command line usage

- Existing command (will continue to work):
    adb shell dumpsys activity service SystemUIService WMShell <cmd>
  Alternative command:
    adb shell wm shell <cmd>
- Piggy back off existing statusbar cmd passthroughs to route
  "adb wm shell ..." commands to shell (both have to go to SysUI)
- Add explicit dump command for clarity (instead of automatically dumping
  if there is no specified command)
- Remove legacy "wm shell tracing" commands since
  PerfettoTransitionTracer doesn't implement them and the
  perfettoTransitionTracing() flag is already in nextfood

Flag: EXEMPT dev-only bug fix
Fixes: 378908218
Test: Verified both new and legacy commands continuet to work:
      adb shell wm shell <cmd>
      adb shell dumpsys activity service SystemUIService WMShell <cmd>
Change-Id: Ic5761487ac78f3d1f11e3d92c994e938d70b09a7
parent 177b4e45
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
package com.android.wm.shell;

import com.android.internal.protolog.LegacyProtoLogImpl;
import com.android.internal.protolog.ProtoLog;
import com.android.internal.protolog.common.ILogger;
import com.android.internal.protolog.common.IProtoLog;
import com.android.internal.protolog.ProtoLog;
import com.android.wm.shell.sysui.ShellCommandHandler;
import com.android.wm.shell.sysui.ShellInit;

@@ -29,7 +29,7 @@ import java.util.Arrays;
/**
 * Controls the {@link ProtoLog} in WMShell via adb shell commands.
 *
 * Use with {@code adb shell dumpsys activity service SystemUIService WMShell protolog ...}.
 * Use with {@code adb shell wm shell protolog ...}.
 */
public class ProtoLogController implements ShellCommandHandler.ShellCommandActionHandler {
    private final ShellCommandHandler mShellCommandHandler;
+1 −2
Original line number Diff line number Diff line
@@ -27,8 +27,7 @@ import javax.inject.Inject;
/**
 * Handles the shell commands for the CompatUX.
 *
 * <p> Use with {@code adb shell dumpsys activity service SystemUIService WMShell compatui
 * &lt;command&gt;}.
 * <p> Use with {@code adb shell wm shell compatui &lt;command&gt;}.
 */
@WMSingleton
public final class CompatUIShellCommandHandler implements
+1 −2
Original line number Diff line number Diff line
@@ -31,8 +31,7 @@ import javax.inject.Inject
/**
 * Handles the shell commands for the CompatUI.
 *
 * <p> Use with [adb shell dumpsys activity service SystemUIService WMShell letterbox
 * &lt;command&gt;].
 * <p> Use with [adb shell wm shell letterbox &lt;command&gt;].
 */
@WMSingleton
class LetterboxCommandHandler @Inject constructor(
+13 −5
Original line number Diff line number Diff line
@@ -44,8 +44,10 @@ adb shell wm logging disable-text TAG

And these commands to enable protologs (in logcat) for WM Shell ([list of all shell tags](/libs/WindowManager/Shell/src/com/android/wm/shell/protolog/ShellProtoLogGroup.java)):
```shell
adb shell dumpsys activity service SystemUIService WMShell protolog enable-text TAG
adb shell dumpsys activity service SystemUIService WMShell protolog enable-text TAG
# Note: prior to 25Q2, you may need to use:
#   adb shell dumpsys activity service SystemUIService WMShell protolog enable-text TAG
adb shell wm shell protolog enable-text TAG
adb shell wm shell protolog disable-text TAG
```

## Winscope Tracing
@@ -138,7 +140,9 @@ part of dumping the SystemUI service. Dumping the Shell specific data can be do
WMShell SysUI service:

```shell
adb shell dumpsys activity service SystemUIService WMShell
# Note: prior to 25Q2, you may need to use:
#   adb shell dumpsys activity service SystemUIService WMShell dump
adb shell wm shell dump
```

If information should be added to the dump, either:
@@ -154,10 +158,14 @@ shell command handler in your controller.

```shell
# List all available commands
adb shell dumpsys activity service SystemUIService WMShell help
# Note: prior to 25Q2, you may need to use:
#   adb shell dumpsys activity service SystemUIService WMShell help
adb shell wm shell help

# Run a specific command
adb shell dumpsys activity service SystemUIService WMShell <cmd> <args> ...
# Note: prior to 25Q2, you may need to use:
#   adb shell dumpsys activity service SystemUIService WMShell <cmd> <args> ...
adb shell wm shell <cmd> <args> ...
```

## Debugging in Android Studio
+2 −11
Original line number Diff line number Diff line
@@ -71,15 +71,6 @@ they will need to post to the Shell main thread to run.
## Shell commands & Dumps

Since the Shell library is a part of the SysUI process, it relies on SysUI to trigger commands
on individual Shell components, or to dump individual shell components.
on individual Shell components.

```shell
# Dump everything
adb shell dumpsys activity service SystemUIService WMShell

# Run a specific command
adb shell dumpsys activity service SystemUIService WMShell help
adb shell dumpsys activity service SystemUIService WMShell <cmd> <args> ...
```

More detail can be found in [Debugging in the Shell](debugging.md) section.
 No newline at end of file
More detail can be found in [Debugging in the Shell](debugging.md#shell-commands) section.
 No newline at end of file
Loading