2012年10月24日 星期三

Dumpsys Information - Android Open Source

Preface

Dumpsys is a tool to gather various information from Android device and tell you its system status. All you have to do is to execute a command - "adb shell dumpsys" on your computer with J2SDK and Android SDK.  Let's take a look on it.

Description

After executing the command of "adb shell dumpsys", there're various service messages are outputted as follows. (In this case, I used an Android device to depict how to get the information and what they stand for.)

 Currently running services:
  accessibility
  account
  activity
  alarm
  apn_settings_policy
  application_policy
  appwidget
  audio
  backup
  battery
  batteryinfo
  bluetooth
  bluetooth_a2dp
  bluetooth_avrcp
  bluetooth_policy
  browser_policy
  clipboard
  clipboardEx
  connectivity
  content
  country_detector
  cpuinfo
  CustomFrequencyManagerService
  date_time_policy
  device_info
  device_policy
  devicestoragemonitor
  DirEncryptService
  diskstats
  drm.drmManager
  dropbox
  eas_account_policy
  email_account_policy
  enterprise_policy
  enterprise_vpn_policy
  entropy
  firewall_policy
  FMPlayer
  gfxinfo
  hardware
  input_method
  iphonesubinfo
  isms
  location
  location_policy
  mdm.remotedesktop
  media.audio_flinger
  media.audio_policy
  media.camera
  media.player
  media.yamahaplayer
  meminfo
  mini_mode_app_manager
  misc_policy
  motion_recognition
  mount
  netpolicy
  netstats
  network_management
  notification
  package
  password_policy
  permission
  phone
  phone_restriction_policy
  phoneext
  power
  remoteinjection
  restriction_policy
  roaming_policy
  samplingprofiler
  search
  SecTVOutService
  security_policy
  sensorservice
  shutdownlogger
  simphonebook
  statusbar
  SurfaceFlinger
  telephony.registry
  textservices
  throttle
  tvoutservice
  TvoutService_C
  uimode
  usagestats
  usb
  vibrator
  voip
  vpn_policy
  wallpaper
  wifi
  wifi_policy
  wifip2p
  window

In above list, we see that there're various functional services are running on Android device. When debug engineering is necessary, we could get a lot of useful information from dumpsys for debugging purpose. 

We've discussed the MonkeyRunner Control with Jython script in separate article. We can check the testing result by comparing image. However, we always hope to acquire more clues to point out the root cause of problem.

Typically, I illustrate two situations. First one is when the problem is caused by up layer (Framework layer or UI representation), but it's work normally at lower layer ( E.g. driver). For instance, when trying to switch Bluetooth On, you may observe the icon on UI which remains Off state. But the driver of Bluetooth has been powered on. In another situation we can think about is oppositive to last case

Now we have another choice to make result more accurately. Fortunately, we can monitor both  system status by using parameter inspection from outputted information of dumpsys on Android device and UI comparison by using MonkeyRunner manner as the necessary testing criteria.  

Usage
dumpsys [running_service_name]

In case nothing is followed by dumpsys, the dumpsys will output all the information of running services.

What information can be found in Dumpsys ?

Dumpsys outputs various message to depict system status of an Android device. Let's talk about some frequent used messages. 


When you need power relative information, you can get them by following information.

Battery Information from Dumpsys

Execute the command of "adb shell dumpsys battery", you may see the following information.

Current Battery Service state:
  AC powered: false
  USB powered: true
  status: 2
  health: 2
  present: true
  level: 100
  scale: 100
  voltage:4191
  temperature: 350
  technology: Li-ion

From above information, you can get the information, including type of power source, battery capacity, measured battery voltage, measured temperature and so on.

The definitions of each parameter from battery information  are as follows,

AC powered:false (Power source)
USB powered:true (Power source)
status:5 (see next section)
health:2 (see next section)
present:true (indicating whether a battery is present.)
level:100 (returns battery level as a percentage)
scale:100 (maximum battery level)
voltage: 4195 (an integer containing the current battery voltage level)
temperature: 380 (an integer containing the current battery temperature)
technology: Li-ion (technology of the current battery)

With respect to status in battery information, the definition of value is as follows,
Defined in android.os.BatteryManager
BATTERY_STATUS_UNKNOWN (0x00000001)
BATTERY_STATUS_CHARGING (0x00000002)
BATTERY_STATUS_DISCHARGING (0x00000003)
BATTERY_STATUS_NOT_CHARGING (0x00000004)
BATTERY_STATUS_FULL (0x00000005)

With respect to health in battery information, the definition of value is as follows,
Defined in android.os.BatteryManager
BATTERY_HEALTH_UNKNOWN (0x00000001)
BATTERY_HEALTH_GOOD (0x00000002)
BATTERY_HEALTH_OVERHEAT (0x00000003)
BATTERY_HEALTH_DEAD (0x00000004)
BATTERY_HEALTH_OVER_VOLTAGE (0x00000005)
BATTERY_HEALTH_UNSPECIFIED_FAILURE(0x00000006)
BATTERY_HEALTH_COLD (0x00000007)


When you need to get the information from Bluetooth you can use following information.

Bluetooth Information from Dumpsys

Execute the command of "adb shell dumpsys bluetooth", you may see the following information.

DUMP OF SERVICE bluetooth:
 mIsAirplaneSensitive = true
 mIsAirplaneToggleable = true
 Local address = 00:07:0B:16:23:AC
 Local name = MyBTPhone
 isDiscovering() = false

The definitions of Bluetooth information for each parameter are as follows,
Parameter Value Definition
mIsAirplaneSensitive true | false Airplane mode can prevent Bluetooth radio from being turned on
mIsAirplaneToggleable true | false Airplane mode can prevent Bluetooth radio from being turned on
Local name   Bluetooth device name
Local address   Bluetooth Address
isDiscovering true|false Discoverable for Bluetooth

The following information will tell you what the status for telecom is.
telephony.registry Information from Dumpsys

Execute the command of "adb shell dumpsys telephony.registry", you may see the following information.

DUMP OF SERVICE telephony.registry:
last known state:
  mCallState=0
  mCallIncomingNumber=
  mServiceState=0 home TTT TTT 46999  HSDPA:9 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false
  mSignalStrength=SignalStrength: 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 gsm|lte 4
  mMessageWaiting=false
  mCallForwarding=false
  mDataActivity=0
  mDataConnectionState=0
  mDataConnectionPossible=true
  mDataConnectionReason=dataDisabled
  mDataConnectionApn=
  mDataConnectionLinkProperties=null
  mDataConnectionLinkCapabilities=null
  mCellLocation=Bundle[mParcelledData.dataSize=76]
registrations: count=8

Note, the information telephony.registry provided is the last know state. It means it may not the state that device is running.

The definitions of telephony.registry information for each parameter are as follows,

Parameter Definition/Value
mCallState Call State
0 - CALL_STATE_IDLE(No activity.)
1 - CALL_STATE_RINGING
2 - CALL_STATE_OFFHOOK
mCallIncomingNumber Last incoming call number
mServiceState Radio service State
0 - STATE_IN_SERVICE(Normal operation condition, the phone is registered with an operator either in home network or in roaming. )
1 - STATE_OUT_OF_SERVICE (Phone is not registered with any operator, the phone can be currently searching a new operator to register to, or not searching to registration at all, or registration is denied, or radio signal is not available. )
2 - STATE_EMERGENCY_ONLY (The phone is registered and locked. Only emergency numbers are allowed. )
3 - STATE_POWER_OFF(Radio of telephony is explicitly powered off.)
SignalStrength Radio Signal Strength (RSSI)
mMessageWaiting Radio Message Waiting
true | false
mCallForwarding Radio Call Forwarding
true | false
mDataActivity 0 - Radio Data Call Activity: DATA_ACTIVITY_NONE(No traffic.)
1- DATA_ACTIVITY_IN(Currently receiving IP PPP traffic.)
2 - DATA_ACTIVITY_OUT(Currently sending IP PPP traffic.)
3 - DATA_ACTIVITY_INOUT(Currently both sending and receiving IP 
mDataConnectionState Radio Data Connection State
0 - DATA_DISCONNECTED (Disconnected. IP traffic not available. )
1- DATA_CONNECTING(Currently setting up a data connection.)
2 - DATA_CONNECTED (Connected. IP traffic should be available.)
3 - DATA_SUSPENDED (Suspended. The connection is up, but IP traffic is temporarily unavailable. For example, in a 2G network, data activity may be suspended when a voice call arrives.)
mActiveDataConnectionState Radio Data Connection State
0 - DATA_DISCONNECTED (Disconnected. IP traffic not available. )
1- DATA_CONNECTING(Currently setting up a data connection.)
2 - DATA_CONNECTED (Connected. IP traffic should be available.)
3 - DATA_SUSPENDED (Suspended. The connection is up, but IP traffic is temporarily unavailable. For example, in a 2G network, data activity may be suspended when a voice call arrives.)
mDataConnectionPossible Active Radio Data Connection
true | false
mDataConnectionReason Reason for data Connection
mDataConnectionApn APN Name
mDataConnectionInterfaceName Name of data connection interface
mCellLocation Information of Cell Location
registrations: count Recording count of registration


When you want to know the status of WiFi, you can refer to following information.


WiFi Information from Dumpsys

Execute the command of "adb shell dumpsys wifi", you may see the following information.

DUMP OF SERVICE wifi:
Wi-Fi is enabled
Stay-awake conditions: 0
Internal state:
current HSM state: ConnectedState
mLinkProperties InterfaceName: wlan0 LinkAddresses: [1.1.2.3/24 ] Routes: [0.0.0.0/0 -> 1.1.2.6,] DnsAddresses: [1.1.2.1,] HttpProxy: [ProxyProperties.mHost == null]
mWifiInfo SSID: Google, BSSID: 00:08:0a:02:03:08, MAC: 00:00:00:00:00:80, Supplicant state: COMPLETED, RSSI: -63, Link speed: 13, Net ID: 1, Explicit connect: true
mDhcpInfoInternal addr: 1.1.2.3/24 mRoutes: 0.0.0.0/0 -> 1.1.2.6 |  dns: 1.1.2.6, dhcpServer: 1.1.2.6 leaseDuration: 7200
mNetworkInfo NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason:(unspecified), extra: (none), roaming: false, failover: false, isAvailable: true
mLastSignalLevel 3
mLastBssid 00:00:00:00:00:00
mLastNetworkId 1
mReconnectCount 0
mIsScanMode false
Supplicant status
bssid=00:00:00:00:00:00
ssid=Google
id=1
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=1.1.2.3
address=00:00:00:00:00:00

The definitions of wifi information for each parameter are as follows,

Parameter Value Definition
Wi-Fi is  disabled|connected
enabled|disconnected
Wi-Fi Radio State
Stay-awake conditions   Stay-awake conditions value
Internal state   Internal state
interface   Netowrk Interface
runState   Run State
SSID   Wi-Fi AP's SSID
BSSID   BSSID of Wi-Fi AP
MAC   MAC Address for Wi-Fi
Supplicant state   Supplicant state for Wi-Fi
RSSI   RSSI for Wi-Fi
Link speed   Link speed for Wi-Fi
Net ID   Net ID for Wi-Fi
ipaddr   Obtained IP Address for Wi-Fi
gateway   Gateway for Wi-Fi
netmask   Netmask for Wi-Fi
dns1   Primary DNS for WiFi
dns2   Secondary DNS for WiFi
DHCP server   DHCP address for WiFi
scanModeActive true | false Scan Mode Active for Wi-Fi
haveIpAddress true | false Have IP Address for Wi-Fi
obtainingIpAddress true | false Obtaining Ip Address for Wi-Fi
lastSignalLevel   Last Signal Level for Wi-Fi
explicitlyDisabled   Explicitly Disabled for Wi-Fi

There're more information you can get from dumpsys for your purpose. Aforementioned has provided you a good start on how to get them. Now, it's your turn.

When you want to know what network interface you are using, you can look at following information.


Connectivity Information from Dumpsys


Execute the command of "adb shell dumpsys connectivity", you may see the following information.


DUMP OF SERVICE connectivity:
NetworkInfo: type: mobile[UMTS], state: DISCONNECTED/DISCONNECTED, reason: dataDisabled, extra: vivi, roaming: false, failover: false, isAvailable: true
Mobile data state: DISCONNECTED
Data enabled: user=true, policy=true

Active network: WIFI
NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true
android.net.wifi.WifiStateTracker@00000000
...


The definitions of connectivity information for each parameter are as follows,

Parameter Value Definition
Active network WiFi | UMTS Check if Active Network is transmitted by WiFi or UMTS
NetworkInfo: type: mobile   NetworkInfo: type for mobile: HSDPA|UMTS
state UNKNOW / IDEL  Radio State
CONNECTED|CONNECTED
DISCONNECTED|DISCONNECTED
Extra   NetworkInfo: Carrier Name
roaming true | false Roaming state
failover true | false  
isAvailable true | false Check if Mobile network is available



How Jython and MonkeyRunner use these information to do automated testings ?

Using shell command in MonkeyRunner and executing dumpsys service_name, you can get the particular information from it and parse/filter those information by Jython Script. Hence, you can use these information for your testing or control purpose.

Reference


2012年10月23日 星期二

A guide to Activity, Service, and Content Provider Testing by JUnit


Android Develop Team has well introduction on Activity Test by JUnit. Here is the link leads you to explore the testing skill.

http://developer.android.com/tools/testing/activity_test.html

For Service Testing by JUnit, take a look WEB sit - http://developer.android.com/tools/testing/service_testing.html.

For Content provider testing by JUnit, take a look WEB sit - http://developer.android.com/tools/testing/contentprovider_testing.html.

The limitation for this method to do test is that you need to have the source code of Activity you want to test. And you need to compile test case with source code of Activity.

One of strength of using JUnit to test Activity is you can control the particular UI component such as a button, or a textarea. Another good standpoint is that you can use JUnit to manage your test case and test result. There's another testing tool to test Android Framework called CTS. The CTS uses JUnit for its testing framework as well. With respect to CTS, take a look following WEB Site for more information. http://source.android.com/compatibility/cts-development.html


2012年10月18日 星期四

Android / Linux Shell Command List


Preface

We've discussed about the Android / Linux Command in separate article. Here, we want to talk about what we can use and where to find the useful commands in Android device. Connect your Android device and launch a command line window in advance. Then you can try to use all these commands by executing command adb shell command_name.

The following commands can be found in the folder "/system/bin/ on Nexus 7.


Commands Desc.
adb Android Debug Bridge
am Activity Manager
app_process Execute a runtime environment for a dalvik class/Jar file.
applypatch Apply patches to android files.
usage: applypatch [: ...]
   or  applypatch -c [ ...]
   or  applypatch -s
   or  applypatch -l

Filenames may be of the form
  MTD::::::...
to specify reading from or writing to an MTD partition.
atrace Trace information captured in the folder of /sys/kernel/debug/tracing/
usage: atrace [options]. Measure the system performance and do the analysis. Systrace tool provides more parameters to measure the performance than atrace.
options include:
  -b N            use a trace buffer size of N KB
  -c              trace into a circular buffer
  -d              trace disk I/O
  -f              trace CPU frequency changes
  -l              trace CPU frequency governor load
  -s              trace the kernel scheduler switches
  -t N            trace for N seconds [defualt 5]
  -w              trace the kernel workqueue
  -z              compress the trace dump
bluetoothd Bluetooth Debuging Utility
Usage:
  bluetoothd [OPTION...]

Help Options:
  -?, --help                  Show help options

Application Options:
  -d, --debug=DEBUG           Specify debug options to enable
  -p, --plugin=NAME,..,       Specify plugins to load
  -P, --noplugin=NAME,...     Specify plugins not to load
  -n, --nodetach              Don't run as daemon in background
  -v, --version               Show version information and exit
  -u, --udev                  Run from udev mode of operation
bmgr bmgr is a shell tool you can use to interact with the Backup Manager on Android devices.
usage: bmgr [backup|restore|list|transport|run]
       bmgr backup PACKAGE
       bmgr enable BOOL
       bmgr enabled
       bmgr list transports
       bmgr list sets
       bmgr transport WHICH
       bmgr restore TOKEN
       bmgr restore TOKEN PACKAGE...
       bmgr restore PACKAGE
       bmgr run
       bmgr wipe PACKAGE
bootanimation Show the boot animation.
brcm_patchram_plus This program downloads a patchram files in the HCD format to Broadcom Bluetooth based silicon and combo chips and and other utility functions.
It can be invoked from the command line in the form
 <-d> to print a debug log
 <--patchram patchram_file="patchram_file">
 <--baudrate baud_rate="baud_rate">
 <--bd_addr bd_address="bd_address">
 <--enable_lpm>
 <--enable_hci>
 uart_device_name
btmacreader Bluetooth MAC Reader.
bu Backup
Options:
   -apk,   Save APK
   -noapk,  Save no APK
   -shared,  Save Shared
   -noshared, Save no Shared
   -system,  All Includes System
   -nosystem,  Not all Includes System
   -all,   Everything
bugmailer.sh Send Bug Report to Vendor.
bugreport Export all the debug message from Android and Linux layer.
cat -> toolbox Concatenate, a tool to print out the content of a file continually. It's the same usage with Linux.
chmod -> toolbox Change the mode of file. Usage is the same with Linux.
chown -> toolbox Change the owner of a file/folder. Usage is the same with Linux.
cmp -> toolbox Compare the file. Usage is the same with Linux.
content Perform operations on particular content
usage: adb shell content [subcommand] [options]
usage: adb shell content insert --uri --bind [--bind ...]
  a content provider URI.
  binds a typed value to a column and is formatted:
  :: where:
  specifies data type such as:
  b - boolean, s - string, i - integer, l - long, f - float, d - double
  Note: Omit the value for passing an empty string, e.g column:s:
  Example:
  # Add "new_setting" secure setting with value "new_value".
  adb shell content insert --uri content://settings/secure --bind name:s:new_setting --bind value:s:new_value

usage: adb shell content update --uri [--where ]
  is a SQL style where clause in quotes (You have to escape single quotes - see example below).
  Example:
  # Change "new_setting" secure setting to "newer_value".
  adb shell content update --uri content://settings/secure --bind value:s:newer_value --where "name='new_setting'"

usage: adb shell content delete --uri --bind [--bind ...] [--where ]
  Example:
  # Remove "new_setting" secure setting.
  adb shell content delete --uri content://settings/secure --where "name='new_setting'"

usage: adb shell content query --uri [--projection ] [--where ] [--sort ]
  is a list of colon separated column names and is formatted:
  [:...]
  is the order in which rows in the result should be sorted.
  Example:
  # Select "name" and "value" columns from secure settings where "name" is equal to "new_setting" and sort the result by name in ascending order.
  adb shell content query --uri content://settings/secure --projection name:value --where "name='new_setting'" --sort "name ASC"
dalvikvm Launch the Dalvik VM to run a Java class in DEX format.
dalvikvm: [options] class [argument ...]
dalvikvm: [options] -jar file.jar [argument ...]

The following standard options are recognized:
  -classpath classpath
  -Dproperty=value
  -verbose:tag  ('gc', 'jni', or 'class')
  -ea[:... |:]
  -da[:... |:]
   (-enableassertions, -disableassertions)
  -esa
  -dsa
   (-enablesystemassertions, -disablesystemassertions)
  -showversion
  -help

The following extended options are recognized:
  -Xrunjdwp:
  -Xbootclasspath:bootclasspath
  -Xcheck:tag  (e.g. 'jni')
  -XmsN  (min heap, must be multiple of 1K, >= 1MB)
  -XmxN  (max heap, must be multiple of 1K, >= 2MB)
  -XssN  (stack size, >= 1KB, <= 256KB)
  -Xverify:{none,remote,all}
  -Xrs
  -Xint  (extended to accept ':portable', ':fast' and ':jit')

These are unique to Dalvik:
  -Xzygote
  -Xdexopt:{none,verified,all,full}
  -Xnoquithandler
  -Xjnigreflimit:N  (must be multiple of 100, >= 200)
  -Xjniopts:{warnonly,forcecopy}
  -Xjnitrace:substring (eg NativeClass or nativeMethod)
  -Xstacktracefile:
  -Xgc:[no]precise
  -Xgc:[no]preverify
  -Xgc:[no]postverify
  -Xgc:[no]concurrent
  -Xgc:[no]verifycardtable
  -XX:+DisableExplicitGC
  -X[no]genregmap
  -Xverifyopt:[no]checkmon
  -Xcheckdexsum
  -Xincludeselectedop
  -Xjitop:hexopvalue[-endvalue][,hexopvalue[-endvalue]]*
  -Xincludeselectedmethod
  -Xjitthreshold:decimalvalue
  -Xjitblocking
  -Xjitmethod:signature[,signature]* (eg Ljava/lang/String\;replace)
  -Xjitcheckcg
  -Xjitverbose
  -Xjitprofile
  -Xjitdisableopt
  -Xjitsuspendpoll

Configured with: debugger profiler hprof jit(armv7-a) show_exception=1

Dalvik VM init failed (check log file)
date -> toolbox Set date value.
date -s yyyymmdd, set date on Android
dd -> toolbox Copy, Convert, and Format a file.
Usage: dd [options]
   bs=BYTES [block size]
   cbs=BYTES [conversion record size]
   conv=KEYWORDS [conv option disabled]
   count=BLOCKS [block count]
   ibs=BYTES [input block size]
   if=FILE [read file]
   obs=BYTES [output block size]
   of=FILE [write file]
   seek=BLOCKS [seek blocks]
   skip=BLOCKS [skip blocks]
Ex: dd if=/data/local/tmp/1gb bs=64k | dd of=/sdcard/1gb
df -> toolbox List free space on disk
dmesg -> toolbox Output linux debug message
dumpstate Dump system status
usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s]
  -o: write to file (instead of stdout)
  -d: append date to filename (requires -o)
  -z: gzip output (requires -o)
  -p: capture screenshot to filename.png (requires -o)
  -s: write output to control socket (for init)
  -b: play sound file instead of vibrate, at beginning of job
  -e: play sound file instead of vibrate, at end of job
dumpsys Dump functional state
dumpsys [options]
Execute dumpsys will output all the message in case there's no option specified.
option:
  accessibility
  account
  activity
  alarm
  appwidget
  audio
  backup
  battery
  batteryinfo
  bluetooth
  bluetooth_a2dp
  clipboard
  commontime_management
  connectivity
  content
  country_detector
  cpuinfo
  dbinfo
  device_policy
  devicestoragemonitor
  diskstats
  drm.drmManager
  dropbox
  entropy
  gfxinfo
  hardware
  input
  input_method
  iphonesubinfo
  isms
  location
  lock_settings
  media.audio_flinger
  media.audio_policy
  media.camera
  media.player
  meminfo
  mount
  netpolicy
  netstats
  network_management
  nfc
  notification
  package
  permission
  phone
  power
  samplingprofiler
  scheduling_policy
  search
  sensorservice
  serial
  servicediscovery
  simphonebook
  sip
  statusbar
  SurfaceFlinger
  telephony.registry
  textservices
  throttle
  uimode
  updatelock
  usagestats
  usb
  vibrator
  wallpaper
  wifi
  wifip2p
  window
getevent -> toolbox The getevent tool runs on the device and provides information about input devices and a live dump of kernel input events.
Usage: getevent [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-d] [-p] [-i] [-l] [-q] [-c count] [-r]
[device]
    -t: show time stamps
    -n: don't print newlines
    -s: print switch states for given bits
    -S: print all switch states
    -v: verbosity mask (errs=1, dev=2, name=4, info=8, vers=16, pos. events=32, props=64)
    -d: show HID descriptor, if available
    -p: show possible events (errs, dev, name, pos. events)
    -i: show all device info and possible events
    -l: label event types and names in plain text
    -q: quiet (clear verbosity mask)
    -c: print given number of events then exit
    -r: print rate events are received
http://source.android.com/tech/input/getevent.html
getprop -> toolbox List some property of Android
hd -> toolbox To sum up each character in specified file and result the summation.
To do hd command repeatedly and to set delay interval between each execution if -r is designated.
Usage: hd [-b base] [-c count] [-r delay] file
id -> toolbox Print uid, gid, and context
ifconfig -> toolbox TCP/IP command. Assign an address to a network interface and/or configure network interface parameters. ifconfig is typically used at boot time to define the network address of each interface on a machine.
iftop -> toolbox Show the packet flow for each network interface
Usage: iftop [ -r repeats] [ -d delay ]
input Send string or key event to device
usage: input [text|keyevent]
       input text
       input keyevent
insmod -> toolbox Load a module into the kernel at runtime. The module cannot be used after reboot.
Usage: insmod
ioctl -> toolbox IO Control Command between Up and lower layer.
ioctl [-l ] [-a ] [-rdh]
  -l    Length of io buffer
  -a   Size of each argument (1-8)
  -r            Open device in read only mode
  -d            Direct argument (no iobuffer)
  -h            Print help
ionice -> toolbox Configure the Process.
Usage: ionice [none|rt|be|idle] [prio]
kill -> toolbox Kill the process
usage:  kill [-s signame | -signum | -signame] { job | pid | pgrp }
        kill -l [exit_status ...]
ln -> toolbox Create pseudonyms (links) for files, allowing them to be accessed by different names.
ln [-s]
log -> toolbox Display specified log information.
USAGE: log [-p priorityChar] [-t tag] message
        priorityChar should be one of:
                v,d,i,w,e
logcat Real time Log for all application running on Android System.
options include:
  -s              Set default filter to silent.
                  Like specifying filterspec '*:s'
  -f    Log to file. Default to stdout
  -r []   Rotate log every kbytes. (16 if unspecified). Requires -f
  -n       Sets max number of rotated logs to , default 4
  -v      Sets the log print format, where is one of:

                  brief process tag thread raw time threadtime long

  -c              clear (flush) the entire log and exit
  -d              dump the log and then exit (don't block)
  -t       print only the most recent lines (implies -d)
  -g              get the size of the log's ring buffer and exit
  -b      Request alternate ring buffer, 'main', 'system', 'radio'
                  or 'events'. Multiple -b parameters are allowed and the
                  results are interleaved. The default is -b main -b system.
  -B              output the log in binary
filterspecs are a series of
  [:priority]

where is a log component tag (or * for all) and priority is:
  V    Verbose
  D    Debug
  I    Info
  W    Warn
  E    Error
  F    Fatal
  S    Silent (supress all output)

'*' means '*:d' and by itself means :v

If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS.
If no filterspec is found, filter defaults to '*:I'

If not specified with -v, format is set from ANDROID_PRINTF_LOG
or defaults to "brief"
ls -> toolbox List the file and directory at current or specified path.
Usage: ls -l: LIST_LONG; break;
-n:LIST_LONG | LIST_LONG_NUMERIC; break;
-s: LIST_SIZE; break;
-R:LIST_RECURSIVE; break;
-d: LIST_DIRECTORIES; break;
-Z: LIST_MACLABEL; break;
-a: LIST_ALL; break;
-F: LIST_CLASSIFY; break;
lsmod -> toolbox List the module in Android device.
lsof -> toolbox List information in /Proc folder which contains all the process information.
md5 -> toolbox MD5 encription tool
mkdir -> toolbox Create a folder.
monkey A automation stress test tool which generates random event for Android device.
mount -> toolbox Mount a file structure.
Usage: mount [-r] [-w] [-o options] [-t type] device directory
mv -> toolbox Remove a file.
USAGE: mv
nandread -> toolbox nandread [-d ] [-f file] [-s sparesize] [-vh]
  -d    Read from
  -f   Write to
  -s   Number of spare bytes in file (default 64)
  -R         Raw mode
  -S Start offset (default 0)
  -L    Length (default 0)
  -v         Print info
  -h         Print help
netcfg Configure network interface
usage: netcfg [ {dhcp|up|down}]
netstat -> toolbox Print net state
newfs_msdos -> toolbox New a file System with specified format
usage: newfs_msdos [ -options ] special [disktype]
where the options are:
        -@ create file system at specified offset
        -B get bootstrap from file
        -C create image file with specified size
        -F FAT type (12, 16, or 32)
        -I volume ID
        -L volume label
        -N don't create file system: just print out parameters
        -O OEM string
        -S bytes/sector
        -a sectors/FAT
        -b block size
        -c sectors/cluster
        -e root directory entries
        -f standard format
        -h drive heads
        -i file system info sector
        -k backup boot sector
        -m media descriptor
        -n number of FATs
        -o hidden sectors
        -r reserved sectors
        -s file system size (sectors)
        -u sectors/track
ping Check if the specified host address is online.
pm Package Manager for running Dalvik Class file.
printenv -> toolbox Print Environment Variables and their Values for Android Device
ps -> toolbox Print the running process with its state.
Usage: ps [options]
    -t   Show threads
   -x   Show time
   -Z   Show MAC Label
   -P   Show Policy
   -p   Show Priority
   -c   Show CPU
reboot -> toolbox Reboot Android Device
renice -> toolbox Change the priority of a process.
USAGE: renice [[-r] priority pids ...] [-g pid]
rm -> toolbox Remove a file or folder.
Usage: rm file_name or rm -r folder_name  
rmdir -> toolbox Remove the folder.
Usage: rmdir
rmmod -> toolbox Remove a module
usage: rmmod
route -> toolbox Add or Remove route
Ex: route add -net 192.168.1.2 netmask 255.255.255.0 gw 192.168.1.1
screencap Output Android screen
usage: screencap [-hp] [FILENAME]
   -h: this message
   -p: save the file as a png.
If FILENAME ends with .png it will be saved as a png.
If FILENAME is not given, the results will be printed to stdout.
screenshot Output Android screen
usage: screenshot [-s soundfile] filename.png
   -s: play a sound effect to signal success
   -i: autoincrement to avoid overwriting filename.png
sendevent -> toolbox Send a event trigger to specified device with type, code, and value. E.g. Touch, or Key.
Usage: sendevent [device] [type] [code] [value].
service Service operation
Usage: service [-h|-?]
       service list
       service check SERVICE
       service call SERVICE CODE [i32 INT | s16 STR] ...
Options:
   i32: Write the integer INT into the send parcel.
   s16: Write the UTF-16 string STR into the send parcel.
setconsole -> toolbox setconsole [-d ] [-v ] [-gtncpoh]
  -d    Use instead of /dev/tty0
  -v     Switch to virtual console
  -g         Switch to graphics mode
  -t         Switch to text mode
  -n         Create and switch to new virtual console
  -c         Close unused virtual consoles
  -p         Print new virtual console
  -o         Print old virtual console
  -h         Print help
setprop -> toolbox Set the Android property.
Usage: setprop
sh -> mksh Execute a shell script.
sleep -> toolbox Interval of next action/command (seconds)
start -> toolbox Start a specified service
stop -> toolbox Stop a specified service
sync -> toolbox Copy host->device only if changed. adb sync is a tool which may be used to copy files from the computer to the device if the files has been changed. By default the command will synchronize /data and /system unless one option is specified. For the command to operate properly a system variable must be created and defined. ANDROID_PRODUCT_OUT must designate the full actual path to the directory containing a file structure with system and/or data subfolders containing the files and folders changed.
Usage: sync [ ]
toolbox Check if the specified command existed.
Usage: toolbox command_name
top -> toolbox Display usage of thread or process.
Usage: top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ]
    -m num  Maximum number of processes to display.
    -n num  Updates to show before exiting.
    -d num  Seconds to wait between updates.
    -s col  Column to sort by (cpu,vss,rss,thr).
    -t      Show threads instead of processes.
    -h      Display this help screen.
umount -> toolbox Unmount the device
Usage: umount device_path
uptime -> toolbox The up time since last boot. The information includes up, idle, and sleep time.
vmstat -> toolbox Virtual Meomory Statistics
Usage: vmstat [ -h ] [ -n iterations ] [ -d delay ] [ -r header_repeat ]
    -n iterations     How many rows of data to print.
    -d delay          How long to sleep between rows.
    -r header_repeat  How many rows to print before repeating
                      the header.  Zero means never repeat.
    -h                Displays this help screen.
vold Manage the device on Android. The function is similar with udev in Linux.
watchprops -> toolbox Monitor the change of property and list them. The properties can be viewed by executing getprop and set by executing setprop.
wipe -> toolbox Erase the system or data
Usage: wipe
   system means '/system'
   data means '/data'
wpa_supplicant Configure WLAN
usage:
  wpa_supplicant [-BddhKLqqstuvW] [-P] [-g] \
        -i -c [-C] [-D] [-p] \
        [-b] [-f] [-e] \
        [-o] [-O] \
        [-N -i -c [-C] [-D] \
        [-p] [-b] ...]

drivers:
  nl80211 = Linux nl80211/cfg80211
options:
  -b = optional bridge interface name
  -B = run daemon in the background
  -c = Configuration file
  -C = ctrl_interface parameter (only used if -c is not)
  -i = interface name
  -d = increase debugging verbosity (-dd even more)
  -D = driver name (can be multiple drivers: nl80211,wext)
  -e = entropy file
  -g = global ctrl_interface
  -K = include keys (passwords, etc.) in debug output
  -t = include timestamp in debug messages
  -h = show this help text
  -L = show license (GPL and BSD)
  -o = override driver parameter for new interfaces
  -O = override ctrl_interface parameter for new interfaces
  -p = driver parameters
  -P = PID file
  -q = decrease debugging verbosity (-qq even less)
  -v = show version
  -W = wait for a control interface monitor before starting
  -N = start describing new interface
example:
  wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf