文章目录
- idmap
- 开发者模式
- 正常主题
- monkey自测
- 查看广播队列
- 日志不显示
- shared_prefs
- setting存储
- 本地数据库查询
- keyevent 输入
- logcat命令
- 复制多个文件(文件夹下所有文件)到指定路径
- launcher冷启动
- IO 监听
- 查看内存
- 系统属性SystemProperties反射调用
idmap
adb shell idmap --inspect /data/resource-cache/vendor@overlay@.apk@vendor@priv-app@account.apk@idmap
开发者模式
adb shell settings put global device_provisioned 1
正常主题
<style name="PhoneTheme" parent="Theme..CommonUI">
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowBackground">@color/translucent</item>
</style>
monkey自测
adb shell monkey -p com.launcher --pct-syskeys 0 -s 500 --throttle 200 --ignore-crashes --ignore-timeouts --monitor-native-crashes -v -v 50000 >D:/monkey/monkey_log.txt
- adb reboot bootloader
- fastboot devices
查看广播队列
adb shell
m891a:/ # dumpsys |grep BroadcastRecord
dumpsys activity b history
dumpsys package -f |grep BOOT_COMPLETED 查看开机广播的监听应用
- pm list packages 查看包名
- 查看包安装位置 $ pm list packages -f
- 对包可以进行筛选 $ pm list packages -f | grep tencent
- 根据某个关键字查找包 $ pm list packages | grep tencent
日志不显示
- adb logcat -G 128M
adb shell pm clear com.launcher
adb shell settings put system launcher_settings_loaded 0
adb shell settings get system launcher_settings_loaded
/data/system/users/0
cat settings_system.xml
// 所有的偏好设置对系统的所有用户公开,第三方APP有读没有写的权限;
/data # cd user_de/0/
/data/user/0/com.android.providers.settings/databases/settings.db
adb shell settings get global "com..privacy.version"
/data/system/users/0 # cat settings_global.xml
/data/system/users/0 # cat settings_global.xml |grep "com.."
shared_prefs
d /data/data/com..launcher/ <
m891a:/data/data/com..launcher # ls
cache code_cache databases shared_prefs
m891a:/data/data/com..launcher # cd shared_prefs/
m891a:/data/data/com..launcher/shared_prefs # ls
launcher_settings.xml
m891a:/data/data/com..launcher/shared_prefs # cat launcher_settings.xml
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<boolean name="launcher_settings_loaded" value="true" />
</map>
setting存储
adb shell pm clear com..launcher
adb shell settings put system launcher_settings_loaded 0
adb shell settings get system launcher_settings_loaded
/data # cd user_de/0/
/data/user/0/com.android.providers.settings/databases/settings.db
D:\ac\ac891\AVT\apps\navigation\app\build\outputs\apk\debug>adb install -r -t navigation.apk
本地数据库查询
:/data/user/0/com..launcher/databases # ls
sqlite3 launcher.db
sqlite>.help 这个命令让我们看到许多命令
sqlite> .exit 命令退出sqlite,返回到#提示符。
sqlite>.tables 查看所有表.
sqlite> .mode column 显示的列会对齐
sqlite> select * from secure;
sqlite>.header on 显示的时候会在顶部显示列的名称
退出当前数据库系统
.quit
显示当前打开的数据库文的位置
.database
查看表中表头的信息
.schema
- adb shell am broadcast -a com…action.FEED_TEXT -e text 查一下北京到上海的机票
- input keyevent 4
- adb shell pm uninstall com.launcher
keyevent 输入
adb shell input keyevent
3 Home
4 返回
adb root && adb remount
adb push D:\ac\signapk\phone.apk /vendor/app/
adb shell am restart
adb shell pm list package 列出所有应用
adb shell pm list package -3 列出第三方应用
adb shell pm list instrumentation 列出所有测试包
logcat命令
- 打印TAG下全部日志
adb shell logcat -s TAG
- 打印过滤指定字段日志
adb shell logcat | grep recvTurnInfo
如果grep报错,切换到shell环境下分开执行
先执行adb shell,在执行logcat | grep
adb shell
root@sabresd_6dq:/ # logcat | grep recvTurnInfo
- 下载全部日志
adb logcat > D:/log_navi.txt
- 下载指定字段日志
adb shell logcat -s PresentationsService > D:/locat_navi.txt
复制多个文件(文件夹下所有文件)到指定路径
adb push D:\ac\lib\armeabi-v7a\. /system/lib/
launcher冷启动
am start -S -W com.launcher/com.carlauncher.ui.CarLauncherActivity
IO 监听
查看 LOW占用 top -m 10
查看分区IO占用 busybox iostat -d 1
iotop -a -P |grep launcher
闲时查看整体 io执行情况 iotop -a -P -m 10
过滤launcher 闲时资源占用情况 top -p pid
过滤launcher 闲时io 操作 iotop -a -P |grep launcher
查看应用进程号 ps -ef |grep carsteward
查看内存
adb shell dumpsys meminfo
adb shell dumpsys meminfo com.by.pkg
import java.lang.reflect.Method;
public class PropUtils {
/**
* get system properties
*/
public static String getProperty(String key, String defaultValue) {
String value = defaultValue;
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class, String.class);
value = (String) (get.invoke(c, key, defaultValue));
} catch (Exception e) {
e.printStackTrace();
} finally {
return value;
}
}
/**
* set system properties
*/
public static void setProperty(String key, String value) {
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method set = c.getMethod("set", String.class, String.class);
set.invoke(c, key, value);
} catch (Exception e) {
e.printStackTrace();
}
}
}
系统属性SystemProperties反射调用
import java.lang.reflect.Method;
public class PropUtils {
/**
* get system properties
*/
public static String getProperty(String key, String defaultValue) {
String value = defaultValue;
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class, String.class);
value = (String) (get.invoke(c, key, defaultValue));
} catch (Exception e) {
e.printStackTrace();
} finally {
return value;
}
}
/**
* set system properties
*/
public static void setProperty(String key, String value) {
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method set = c.getMethod("set", String.class, String.class);
set.invoke(c, key, value);
} catch (Exception e) {
e.printStackTrace();
}
}
}