这是工作中使用的adb 命令的总结。# 后面的内容是对该命令的简单解释
# generate bigfile for device to cause device memory risk request
adb shell dd if=/dev/zero of=/mnt/sdcard/bigfile
#get the build information
adb shell getprop ro.build.fingerprint
#set battery level
adb shell dumpsys battery set level 30
#fastboot commands:
fastboot erase userdata
Fastboot erase cache
Fastboot -w
Fastboot erase frp
Fastboot -w
fastboot oem wptest disable
#adb shell "setprop persist.sys.language fr; setprop persist.sys.country CA; setprop ctl.restart zygote"
adb shell "setprop persist.sys.locale fr-CA; setprop ctl.restart zygote"
#To get device system properties
adb shell getprop ro.build.id / ro.product.name /persist.sys.locale
#clear all notifications (request su )
adb shell service call notification 1
#send message
adb shell service call isms 5 s16 "PhoneNumber" i32 0 i32 0 s16 "BodyText"
$adb shell setprop persist.sys.usb.config mtp,adb
#To fresh storage files, in order to recognize the resources by file.
adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///mnt/shell/emulated/0
#To Get Apk from package infor
$adb shell pm path com.android.bluetooth
#To get build type
$adb shell getprop ro.build.type
#To turn on bluetooth -
$adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE
#To open wifi-
$adb shell am start -n com.android.settings/.wifi.WifiSettings
#To fetch wifi info -
$adb shell am start -n com.android.settings/.wifi.WifiInfo
#To fetch wifi status -
$adb shell am start -n com.android.settings/.wifi.WifiStatusTest
#To open language settings -
$adb shell am start -n com.android.settings/.LanguageSettings
#To open development option -
$adb shell am start -n com.android.settings/.DevelopmentSettings
#To open dateTime set-up
$adb shell am start -n com.android.settings/.DateTimeSettingsSetupWizardooth
#To send gmail with subject and body to specific recipients
$adb shell am start -n com.google.android.gm/com.google.android.gm.ComposeActivityGmail -d email:address@destination.com --es subject 'Your subject goes here' --es body 'Your email body goes here'
$adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name '"+name+"' -e phone "+number+"")
#To enable wifi / data roaming
$ adb shell svc wifi enable
$ adb shell svc data enable
#To disable wifi
$ adb shell svc wifi disable
$ adb shell svc data disable
#To enable bluetooth
$adb shell service call bluetooth_manager 6
#To enable Airplane mode
$adb shell settings put global airplane_mode_on 1
$adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
#To disable Airplane mode
$adb shell settings put global airplane_mode_on 0
$adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
#To disable setup package
$adb shell pm disable com.google.android.setupwizard
#To launch home screen directly
adb shell am start com.google.android.googlequicksearchbox/com.google.android.launcher.GEL
#To launch Settings item (refer to link https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml)
$adb shell am start -a android.intent.action.POWER_USAGE_SUMMARY android.settings.SYNC_SETTINGS
You can find the intents by looking at the <action> tags in the AndroidManifest.xml file for the Settings "application" (which can be viewed on GitHub). As an example, here is the activity definition for the Settings$PowerUsageSummaryActivity:
<activity android:name="Settings$PowerUsageSummaryActivity"
android:label="@string/power_usage_summary_title"
android:uiOptions="none"
android:taskAffinity=""
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.POWER_USAGE_SUMMARY" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.android.settings.SHORTCUT" />
</intent-filter>
<!-- Some other stuff here... -->
</activity>
/data/data/com.google.android.gm/database/gmail.db
adb shell pm list packages inputmethod
The telephonebook has 12 mimetypes:
_id: mimetype
1: vnd.android.cursor.item/email_v2
2: vnd.android.cursor.item/im
3: vnd.android.cursor.item/nickname
4: vnd.android.cursor.item/organization
5: vnd.android.cursor.item/phone_v2
6: vnd.android.cursor.item/sip_address
7: vnd.android.cursor.item/name
8: vnd.android.cursor.item/postal-address_v2
9: vnd.android.cursor.item/identity
10: vnd.android.cursor.item/photo
11: vnd.android.cursor.item/group_membership
12: vnd.android.cursor.item/website
#insert contact name and phone number
adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Avik' -e phone 123-456"
To launch specific information
$am start -a android.settings.APPLICATION_DETAILS_SETTINGS -d packagename