How to use common android gadgets

Source: Internet
Author: User

1. Input

Input text <string>

Input string, which can be easier to debug without using a soft keyboard (including writing a script for testing)

Input keyevent <event_code>

Enter a key event. You can press the key on the full keyboard to operate the system when no device is input. For button events, refer to the source file: keyevent. Java

E. g:

Input keyevent 82 // unlock

Input keyevent 1 // left softkey

Input keyevent 2 // right softkey

Input keyevent 3 // back idle

Input keyevent 4 // back key

Jellybean supports more features:

Input keyevent <key codenumber or name>

Keyevent can be represented by a name, such:

Input keyevent menu (jellybean)

Input tap <x> <Y>

You can send a click event.

 

Input swipe <x1> <Y1> <X2> <Y2>

You can send a slide event, such as sliding to the right:

Input swipe 100 200 300 200

2. screencap

Screenshot Tool

Request surfaceflinger to re-rendersurface

> Surfaceflinger uses OpenGL to draw data to FBO.

> The hwcomposer and our de are not displayed.

This may be different from the display on the final screen:

> Surfaceflinger has a problem (framebuffer or hwcomposer)

> Overlay

> Our de has two layers: graphic (Android UI) and overlay (Video/camera display). Currently, this function is only applicable to the former.

Intercept framebuffer, which can be implemented through the Sys File Interface

> CAT/dev/graphics/fb0

Usage:

Usage: screencap [-HP] [filename]

-H: this message

-P: Save the file as a PNG.

If filename ends with. PNG it will be saved asa png.

If filename is not given, the results will beprinted to stdout.

# ADB shell screencap-P/sdcard/screen1.png

# ADB pull/sdcard/screen1.png.

 

3. Monkey

Monkey is an executable program on the device that generates random numbers, such as events.

> Keyevent

> Touch event

> Guesture

> System Events

Development Stage for stress testing

The customer customization phase can be partially used for stability verification

Some testing methods can be implemented through scripts

 

Command Format

> Usage: Monkey [Options] Count

Parameter Details

> Basicconfiguration options, such as setting the number of events toattempt.

> Operationalconstraints, such as restricting the test to a singlepackage.

> Event types andfrequencies.

> Debugging options.

> Https://developer.android.com/tools/help/monkey.html

Common commands:

Monkey 100 (Basic command)

Monkey -- ignore-crashes -- ignore-timeouts99999 (stress testing with no specific purpose)

Monkey-P com. Android. browser-pcom. Android. launcher-v 999999 (only test lancher and browser, and the test outputs the most trace information)

 

4. AM

Android supports controlling Android startup behaviors from command lines

It is helpful in the initial phase of project/hardware.

Usage: am [subcommand] [Options]

E. g:

Start music:

Am start-N com. Android. Music/COM. Android. Music. mediaplaybackactivity

Call number:

Am start-A Android. Intent. Action. Call-dtel: 10086

Webpage Browsing:

Am start-A Android. Intent. Action. View-D http://www.google.cn/

Performance test:

Am profile com. Android. browser start/sdcard/dump. Trace

Am profile com. Android. browser stop

With traceview, you can easily solve tracejava program performance problems. (In the current version, traceview cannot run (logs are not paired ))

 

5. PM

Usage: PM [list | path | install | uninstall]

Powerful Android package management tool

It is often used during debugging: installation, uninstallation, and disabling.

 

6. bugreport

Bugreport is relatively simple. It mainly collects system information and outputs it to files for analysis by developers.

Note that a lot of information may require root permission to be obtained.

The actual execution is dumpstate. The obtained information includes:

>>> Logcat

>>> Kernel message

>>> Dumpsys

>>> Other system information

7. procrank

Obtain the memory usage snapshot of each process in the current system. This tool is only available in the project version.

Usage:

Usage: procrank [-W] [-v |-r |-p |-u |-H]

-V sort by VSS.

-R sort by RSS.

-P sort by PSS.

-U sort by USS.

(Default sort order is pss .)

-R reverse sort order (default isdescending ).

-W display statistics for workingset only.

-W reset working set of allprocesses.

-H display this help screen.

 

VSS-virtual set size virtual memory consumption (including memory occupied by shared libraries)
RSS-resident set size actually uses physical memory (including memory occupied by shared libraries)
Pss-proportional set size physical memory actually used (proportional allocation of memory occupied by the Shared Library)
USS-unique set size physical memory occupied by the process (excluding the memory occupied by the Shared Library)

The procrank statistics on our machines are not accurate.

8. toolbox

The shell commands implemented by Android are poor, simple, and not powerful enough.

For details about the tool, see system/CORE/toolbox/Android. mk.

Our system provides more powerful busybox

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.