adb shell

1、获取第三方程序安装信息:

adb shell su 0 cat /data/system/packages.list

2、获取系统包安装信息:

adb shell su 0 cat /data/system/packages.xml

3、adb shell 打开网页:

adb shell am start -a android.intent.action.VIEW -d http://www.china.com

4、查看apk加载的组件:
adb shell cat /proc/4364/maps

5、adb shell am broadcast 

adb shell am broadcast 后面的参数有:
[-a <ACTION>]
[-d <DATA_URI>]
[-t <MIME_TYPE>] 
[-c <CATEGORY> [-c <CATEGORY>] ...] 
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...] 
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...] 
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...] 
[-n <COMPONENT>]
[-f <FLAGS>] [<URI>]


Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", true);
getApplicationContext().sendBroadcast(intent);


转换为
adb shell am broadcast -a android.location.GPS_ENABLED_CHANGE  --ez enabled true


final Intent poke = new Intent();
       poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); 
       poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
       poke.setData(Uri.parse("3")); 
       getApplicationContext().sendBroadcast(poke);


adb shell am broadcast -n com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider  -c android.intent.category.ALTERNATIVE -d custom:3 
adb shell am broadcast -n com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider  -c android.intent.category.ALTERNATIVE -d 3 
adb shell am broadcast -n com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider  -c android.intent.category.ALTERNATIVE  3 

你可能感兴趣的:(adb shell)