Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal change #3106

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ public Integer call() {
name = "commands",
aliases = {"c"},
description = "List all commands currently waiting to be executed")
public int commands() throws MobileHarnessException, InterruptedException {
public int commands(@Option(names = "all") boolean listAllCommands)
throws MobileHarnessException, InterruptedException {
serverPreparer.prepareOlcServer();
ImmutableList<AtsSessionPluginConfigOutput> sessionPluginConfigOutputs =
atsSessionStub.getAllUnfinishedSessions(
RunCommand.RUN_COMMAND_SESSION_NAME, /* fromCurrentClient= */ true);
RunCommand.RUN_COMMAND_SESSION_NAME, /* fromCurrentClient= */ !listAllCommands);
String result = PluginOutputPrinter.listCommands(sessionPluginConfigOutputs);
consoleUtil.printlnStdout(result);
return ExitCode.OK;
Expand Down Expand Up @@ -139,11 +140,12 @@ public int devices(@Option(names = "all") boolean listAllDevices)
name = "invocations",
aliases = {"i"},
description = "List all invocation threads")
public int invocations() throws MobileHarnessException, InterruptedException {
public int invocations(@Option(names = "all") boolean listAllInvocations)
throws MobileHarnessException, InterruptedException {
serverPreparer.prepareOlcServer();
ImmutableList<AtsSessionPluginConfigOutput> sessionPluginConfigOutputs =
atsSessionStub.getAllUnfinishedSessions(
RunCommand.RUN_COMMAND_SESSION_NAME, /* fromCurrentClient= */ true);
RunCommand.RUN_COMMAND_SESSION_NAME, /* fromCurrentClient= */ !listAllInvocations);
String result = PluginOutputPrinter.listInvocations(sessionPluginConfigOutputs);
consoleUtil.printlnStdout(result);
return ExitCode.OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,33 @@
/**
* Types of dumpsys.
*
* @see <a href="https://developer.android.com/studio/command-line/dumpsys">dumpsys</a>
* @see <a href="http://wrightrocket.blogspot.com/2010/12/useful-commands-in-adb-shell.html">Using
* dumpsys commands in the Android adb shell</a>
*/
public enum DumpSysType {
ACCOUNT("account"), // Account information
ACTIVITY("activity"), // Activity information
ALL("all"), // Use it to get a diagnostic output for all system services as command "adb shell
// dumpsys".
BATTERY("battery"), // Battery information
BATTERYSTATS("batterystats"), // Batterystats information
CAMERA("media.camera"), // Camera information
CONNECTIVITY("connectivity"), // Network connectivity
CPUINFO("cpuinfo"), // Processor usage
DISPLAY("display"), // Information of the keyboards, windows and their z order
GFXINFO("gfxinfo"), // GPU rendering information
INPUT(
"input"), // The state of the system’s input devices, such as keyboards and touchscreens, and
// processing of input events. See https://source.android.com/devices/input/diagnostics.html.
MEMINFO("meminfo"), // Memory usage
NONE(""), // Use it to for all types as command "adb shell dumpsys".
NONE(""), // Alias for ALL.
PACKAGE("package"), // Package info of applications
PROCSTATS("procstats"), // statistics of app's runtime, PSS and USS
POWER("power"), // Power manager information
PROCSTATS("procstats"), // statistics of app's runtime, PSS and USS
WIFI("wifi"), // Available access points and current connection
WIFISCANNER("wifiscanner"), // Scanned wifi information
WINDOW("window"), // Display information
INPUT("input"); // The state of the system’s input devices, such as keyboards and touchscreens,
// and processing of input events. See https://source.android.com/devices/input/diagnostics.html
WINDOW("window"); // Display information

private final String dumpSysTypeValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,14 @@ public class Flags {
converter = Flag.BooleanConverter.class)
public Flag<Boolean> enableAtsFileServerUploader = enableAtsFileServerUploaderDefault;

private static final Flag<Boolean> enableFastbootDetectorDefault = Flag.value(true);

@com.beust.jcommander.Parameter(
names = "--enable_fastboot_detector",
description = "Whether to enable fastboot detector. Default is true.",
converter = Flag.BooleanConverter.class)
public Flag<Boolean> enableFastbootDetector = enableFastbootDetectorDefault;

private static final Flag<Boolean> enableFastbootInAndroidRealDeviceDefault = Flag.value(true);

@com.beust.jcommander.Parameter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ public enum Name {
/** Customized dimension, SSID for network simulation. */
NETWORK_SIMULATION_USE_NETTROL,
PING_GOOGLE_STABILITY,
/** The average ping time of the device. */
/** The max ping time of the device. */
/** Device pool name. Values include: shared/shared_without_recovery/group_shared/dedicated. */
POOL,
/** Whether the device is reachable from the host. */
/** The release version of the device. */
RELEASE_VERSION,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public void setUp() throws Exception {
/* parseCommandOnly= */ false));
injector.injectMembers(this);
atsConsole.injector = injector;

// Prepares the cts configs file for testing
realLocalFileUtil.copyFileOrDir(TEST_CTS_CONFIG_DIR, xtsRootDirPath);
}

@After
Expand Down Expand Up @@ -182,9 +185,6 @@ public void tearDown() throws Exception {

@Test
public void listDevicesAndModules_expectedOutput() throws Exception {
// Prepares the cts configs file for testing
realLocalFileUtil.copyFileOrDir(TEST_CTS_CONFIG_DIR, xtsRootDirPath);

when(lineReader.readLine(anyString()))
.thenReturn("list devices")
.thenReturn("list devices all")
Expand Down Expand Up @@ -232,6 +232,18 @@ public void listResults() throws Exception {
+ " SQ3A.220705.003.A1 redfin");
}

@Test
public void listCommands() throws Exception {
when(lineReader.readLine(anyString()))
.thenReturn("run cts")
.thenReturn("list commands")
.thenReturn("exit");

atsConsole.run();

verify(lineReader).printAbove("Command n/a: [0m:00] cts");
}

@Test
public void listSubPlans() throws Exception {
String subPlanFilePath1 =
Expand Down