[Samsung Galaxy Grand Quattro] Arinio:
Let Us Start Communicating

Before you begin follow post no #2 and follow accordingly.

Now issue the command:

$ adb devices

The response will include:

Serial number

The unique ID of each connected device. You will need the serial number to connect

directly. The format of the serial number includes information about the device

itself (namely, the type of device and the port on which it is listening).

State

The connection state of the device. This will be offline if the device is connected but

not responding. It will be device if is available and connected. Otherwise, the response

will be no devices, which indicates there are no active devices that ADB can

communicate with currently.

Now issue the command:

$ adb -s serialNumber version [serialNumber = The serial number you get from $adb devices command]

The output will be like this:

arinio@ubuntu:~$ adb -s 1fd***** version

Android Debug Bridge version 1.0.31

Now that ADB knows which device to target, we can interact with it. It is possible to do

a variety of useful things with this interface.

TRANSFERRING FILES: THE FAMOUS PUSH & PULL COMMANDS

It is very easy to transfer files between your computer and your device using the push

and pull commands.

PUSH = File transferrs from your computer to the attached device.

PULL = File transfers from your attached device to computer.

You can include additional path parameters if you would like to specify a

particular location for the files. If a path is not specified, the commands will use the

current directory of your computer for the local location and the data folder on the

device for the remote location. push and pull can also copy complete directories

(recursively), which can be very useful.

The syntax of push is:

$ adb push local-directory

remote

An example of using this command is shown here. We are using ADB to push a file

named test.txt from the current directory to the SD card. The syntax for this is:

$ adb push test.txt /sdcard/test.txt [Here sdcard means the internal sdcard]

To move the file off the SD card and back onto your machine, in a new directory and

with a new name, type:

$ adb pull /sdcard/test.txt home/arinio/andro/test.txt

INTERACTIVE MODE

Interactive mode allows you to execute more than one command successively on the

device. To start interactive shell mode, type:

$ adb shell

You will see a # symbol, which indicates that you are in shell mode. When you are ready

to exit the remote shell, you can use Ctrl+D or type exit to end the shell session.

REal-Time Example:

arinio@ubuntu:~$ adb shell

shell@android:/ $

/

shell@android:/ $ cd /sys

sys/ system/

shell@android:/ $ cd /system/etc/

shell@android:/system/etc $ pwd

/system/etc

shell@android:/system/etc $exit

ONE-OFF MODE

It is also possible to execute commands noninteractively. To do this, type the command

you want to execute after the shell keyword.

adb shell command

arinio@ubuntu:~$ adb shell cat /system/etc/hosts

127.0.0.1 localhost

RETRIEVING SYSTEM DATA

There are many cases in which you need detailed information about the various systems

on your device. Some useful commands can dump huge amounts of information about

the system, including service status, system statistics, and error logs. You may want to

collect these statistics if you are trying to analyze trends or specific details about your application.

$ adb shell dumpsys > /home/arinio/Downloads/dump.txt [Here I redirected the output to dump.txt file. Tolal output line is 31000+]

Outputs data about specific system services to the screen. For example, adb shell

dumpsys alarm will output details about all the alarms currently registered on the

system.

The first few lines are:

Currently running services:

AtCmdFwd

CustomFrequencyManagerService

DirEncryptService

FMPlayer

SurfaceFlinger

accessibility

account

activity

alarm

apn_settings_policy

application_policy

apppermission_control_policy

appwidget

audio

auditlog

backup

battery

batteryinfo

bluetooth

bluetooth_a2dp

bluetooth_avrcp

bluetooth_policy

browser_policy

certificate_policy

clipboard

clipboardEx

commontime_management

connectivity

content

country_detector

cpuinfo

date_time_policy

dbinfo

device_account_policy

device_info

device_policy

devicestoragemonitor

diskstats

display.hwcservice

drm.drmManager

dropbox

eas_account_policy

edm_proxy

edmnativehelper

email_account_policy

email_policy

enterprise_license_policy

enterprise_policy

enterprise_vpn_policy

entropy

firewall_policy

geofencing

gfxinfo

hardware

input

input_method

iphonesubinfo

iphonesubinfo_msim

isms

isms_msim

kioskmode

ldap_account_policy

license_log_service

location

location_policy

lock_settings

lockscreen_overlay

log_manager_service

mdm.remotedesktop

media.audio_flinger

media.audio_policy

media.camera

media.gestures

media.player

meminfo

mini_mode_app_manager

misc_policy

motion_recognition

mount

netpolicy

netstats

network_management

notification

package

password_policy

permission

phone

phone_msim

phone_restriction_policy

phoneextadb shell dumpsys > /home/arinio/Downloads/dump.txt

power

remoteinjection

restriction_policy

roaming_policy

samplingprofiler

samsung.facedetection_service

scheduling_policy

seandroid_policy

search

security_policy

sensorservice

serial

servicediscovery

simphonebook

simphonebook_msim

sip

smartcard_browser_policy

smartcard_email_policy

smartcard_vpn_policy

statusbar

telephony.msim.registry

telephony.registry

textservices

throttle

uimode

updatelock

usagestats

usb

vibrator

voip

vpn_policy

wallpaper

wifi

wifi_policy

wifip2p

window

Another Command:

$ adb shell dumpstate > /home/arinio/Downloads/dump1.txt

Detailed system data representing a device at a particular state in time (includes

dumpsys information as well).

The output contains 90772 lines.

THe first few lines are:

mkdir(/data/anr): Permission denied

========================================================

== dumpstate: 2013-11-30 22:37:19

========================================================

Build: JZO54K.I8552XXAMJ7

Build fingerprint: 'samsung/delos3gxx/delos3geur:4.1.2/JZO54K/I8552XXAMJ7:user/release-keys'

Bootloader: I8552XXAMDB

Radio: msm

Network: AirTel

Kernel: Linux version 3.4.0-1441994 (se.infra@SEP-67) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Oct 29 13:28:51 KST 2013

Command line: (unknown)

------ UPTIME (uptime) ------

up time: 4 days, 03:13:23, idle time: 1 days, 23:21:38, sleep time: 3 days, 14:12:20

[uptime: 0.1s elapsed]

------ MEMORY INFO (/proc/meminfo) ------

MemTotal: 865328 kB

MemFree: 63208 kB

Buffers: 18316 kB

Cached: 201748 kB

SwapCached: 0 kB

Active: 540780 kB

Inactive: 121620 kB

Active(anon): 443292 kB

Inactive(anon): 1020 kB

Active(file): 97488 kB

Inactive(file): 120600 kB

Unevictable: 848 kB

Mlocked: 0 kB

HighTotal: 117760 kB

HighFree: 1624 kB

LowTotal: 747568 kB

LowFree: 61584 kB

SwapTotal: 0 kB

SwapFree: 0 kB

Dirty: 0 kB

Writeback: 0 kB

AnonPages: 443196 kB

Mapped: 105740 kB

Shmem: 1116 kB

Slab: 46192 kB

SReclaimable: 9332 kB

SUnreclaim: 36860 kB

KernelStack: 8112 kB

PageTables: 16444 kB

NFS_Unstable: 0 kB

Bounce: 0 kB

WritebackTmp: 0 kB

CommitLimit: 432664 kB

Committed_AS: 8003824 kB

VmallocTotal: 245760 kB

VmallocUsed: 82488 kB

VmallocChunk: 59248 kB

------ CPU INFO (top -n 1 -d 1 -m 30 -t) ------

User 2%, System 8%, IOW 0%, IRQ 0%

User 21 + Nice 0 + Sys 61 + Idle 645 + IOW 0 + IRQ 0 + SIRQ 0 = 727

PID TID PR CPU% S VSS RSS PCY UID Thread Proc

26459 26459 0 10% R 1432K 808K shell top top

96 96 0 0% S 0K 0K root irq/89-msm-cpr-

1013 1025 0 0% S 6012K 448K root mpdecision /system/bin/mpdecision

6 6 0 0% S 0K 0K root migration/0

16 16 1 0% S 0K 0K root khelper

17 17 1 0% S 0K 0K root suspend_sys_syn

18 18 1 0% S 0K 0K root suspend

19 19 0 0% S 0K 0K root irq/53-msmdatam

20 20 0 0% S 0K 0K root sync_supers

21 21 0 0% S 0K 0K root bdi-default

22 22 1 0% S 0K 0K root kblockd

23 23 0 0% S 0K 0K root khubd

24 24 1 0% S 0K 0K root modem_notifier

25 25 1 0% S 0K 0K root smd_channel_clo

26 26 1 0% S 0K 0K root smsm_cb_wq

30 30 1 0% S 0K 0K root qmi

31 31 1 0% S 0K 0K root rpcrouter

32 32 1 0% S 0K 0K root rpcrotuer_smd_x

33 33 0 0% S 0K 0K root krpcserversd

35 35 0 0% S 0K 0K root rmt_storage

36 36 1 0% S 0K 0K root kadspd

37 37 1 0% D 0K 0K root voicememo_rpc

39 39 0 0% D 0K 0K root krmt_storagecln

40 40 0 0% D 0K 0K root krmt_storagecln

41 41 0 0% S 0K 0K root kswapd0

42 42 0 0% S 0K 0K root fsnotify_mark

43 43 0 0% S 0K 0K root ecryptfs-kthrea

44 44 1 0% S 0K 0K root crypto

57 57 1 0% S 0K 0K root mdp_dma_wq

58 58 1 0% S 0K 0K root mdp_vsync_wq

[top: 2.7s elapsed]

------ PROCRANK (procrank) ------

*** exec(procrank): Permission denied

*** procrank: Exit code 255

[procrank: 0.1s elapsed]

------ VIRTUAL MEMORY STATS (/proc/vmstat) ------

nr_free_pages 10236

nr_inactive_anon 255

nr_active_anon 110826

nr_inactive_file 30149

nr_active_file 24375

nr_unevictable 212

nr_mlock 0

nr_anon_pages 110801

nr_mapped 26437

nr_file_pages 55015

nr_dirty 0

nr_writeback 0

nr_slab_reclaimable 2746

nr_slab_unreclaimable 14345

nr_page_table_pages 4117

nr_kernel_stack 1015

nr_unstable 0

nr_bounce 0

nr_vmscan_write 0

nr_vmscan_immediate_reclaim 0

nr_writeback_temp 0

nr_isolated_anon 0

nr_isolated_file 0

nr_shmem 279

nr_dirtied 439303

nr_written 438957

nr_anon_transparent_hugepages 0

nr_dirty_threshold 11861

nr_dirty_background_threshold 2965

pgpgin 1208499

pgpgout 1874766

pswpin 0

pswpout 0

pgalloc_normal 7397855

pgalloc_high 1334847

pgalloc_movable 0

pgfree 8862011

pgactivate 127582

pgdeactivate 53470

pgfault 10679448

pgmajfault 8080

pgrefill_normal 15854

pgrefill_high 79498

pgrefill_movable 0

pgsteal_kswapd_normal 337890

pgsteal_kswapd_high 103263

pgsteal_kswapd_movable 0

pgsteal_direct_normal 17327

pgsteal_direct_high 1880

pgsteal_direct_movable 0

pgscan_kswapd_normal 352987

pgscan_kswapd_high 127978

pgscan_kswapd_movable 0

pgscan_direct_normal 22790

pgscan_direct_high 2645

pgscan_direct_movable 0

pginodesteal 0

slabs_scanned 28130432

kswapd_inodesteal 0

kswapd_low_wmark_hit_quickly 289

kswapd_high_wmark_hit_quickly 748

kswapd_skip_congestion_wait 0

pageoutrun 2014157

allocstall 452

pgrotated 8

compact_blocks_moved 17749

compact_pages_moved 78038

compact_pagemigrate_failed 10421

compact_stall 640

compact_fail 248

compact_success 392

unevictable_pgs_culled 212

unevictable_pgs_scanned 0

unevictable_pgs_rescued 2

unevictable_pgs_mlocked 2

unevictable_pgs_munlocked 2

unevictable_pgs_cleared 0

unevictable_pgs_stranded 0

unevictable_pgs_mlockfreed 0

Another Useful Command:

$ adb shell logcat -b radio

This command provides access to the cellular radio log. This information is useful

when interacting with the networking stack. Some of the information available in

this log includes time of events, a listing of commands used by the system to com‐

municate, SMS information, IP information, and cellular network data.

ADB DOES A LOT MORE:

The ADB tool has a variety of additional functionality. Some functionality worth highlighting includes:

• Modify network configuration options like port forwarding (example: adb forward

tcp:7101 tcp:8101)

• Access your device as the root user (example: adb shell su)

• Restart the device in alternate modes, such as recovery mode (example: adb reboot

recovery)

• View system logs, such as the radio or event buffers (example: adb logcat -b events)

• Examine system utilization (example: adb shell tail | top)

There is a lot of other functionality we aren’t able to cover. For a complete list of all

available commands and their parameters, type adb -help without any additional arguments to get a listing of all options.