Android Camera 调试分析方法
查看camera app使用内存(可测试三方算法占用内存情况 TOTAL PASS)
ps -A | grep camera
adb shell dumpsys meminfo pid >> meminfo_total_.txt
文件名和文件内容替换
grep -rl string1 . | xargs sed -i 's/string1/string2/g' (替换文件中的字串)
find . -name *string1* | xargs rename 's/string1/string2/g' (替换文件名)
Android VTS快速测试的方式
chmod a+x VtsHalCameraProviderV2_4TargetTest
./VtsHalCameraProviderV2_4TargetTest --g-filter *processCaptureRequest*
GIT回退到某一天的版本
repo forall -c 'commitID=`git log --before "2020-08-18 00:01" -1 --pretty=format:"%H"`; git reset --hard $commitID'
GPIO状态查询
adb shell "ls /sys/devices/platform | grep pinctrl"
1000b000.pinctrl
adb shell "cat/sys/devices/platform/pinctrl@1000b000/mt_gpio | grep 99"
099: 0100000100
对应格式如下:
PIN:(MODE)(DIR)(DOUT)(DIN)(DRIVER)(SMT)(IES)(PULL_EN)(PULL_SEL)(R1 R0)
如果gpio 99 设置为mclk引脚,进入camera,MODE会变成1(mclk mode), 0是(gpio mode)
099: 1100000100
高通gpio/pmic状态查询
for /l %%I in (1,1,100000) do (
adb shell cat /sys/kernel/debug/gpio | adb shell grep gpio20"
adb shell cat /sys/kernel/debug/regulator/4a84000.i2c:qcom,pm8008@9:qcom,pm8008-regulator-pm8008_l1/enable
)
DTBO 反编译
out目录下:
./host/linux-x86/bin/dtc -i dtb -O dts ./target/product/xxx/obj/kernel/msm-4.19/arch/arm64/boot/dts/.../xxx.dtbo
backtrace解析
aarch64-linux-android-addr2line -f -e + 库名称 + 地址
./prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-addr2line
-f -e out/target/product/k6833v1_64/symbols/system/lib/libc.so 000485a0
高通DTSI确认方法
Machine model: Qualcomm Technologies, Inc. Bengal QRD
Raw图解析Stride的确认
(1)stride可通过log查看
(2)stride = raw图字节数 / higth
(3)stride = width / 8 * 10(12) 取结果能被16整除的数
高通Camx loglevel设置
hal debug
adb root
adb remount
adb shell rm /vendor/etc/camera/camxoverridesettings.txt
adb shell "echo overrideLogLevels = 0xFF >> /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo logInfoMask = 0x52082 >> /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo logWarningMask = 0x52082 >> /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo logVerboseMask = 0x52082 >> /vendor/etc/camera/camxoverridesettings.txt"
adb shell "echo logConfigMask = 0xFFFFFFFF >> /vendor/etc/camera/camxoverridesettings.txt"
adb shell cat vendor/etc/camera/camxoverridesettings.txt
adb shell "kill -9 $(pidof android.hardware.camera.provider@2.4-service_64)"
kernel debug
adb shell “echo 0x20 > /sys/module/cam_debug_util/parameters/debug_mdl”
adb shell cat /proc/kmsg > kernel.log
压测脚本(热启动,切换模式,拍照,连拍,切换摄像头)
:: ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10200000 cmp=com.mediatek.camera/.CameraLauncher bnds=[14,78][187,316]} from uid 10305
@echo off
rem adb shell am start -a android.media.action.STILL_IMAGE_CAMERA open camera
rem adb shell am start org.codeaurora.snapcamera/com.android.camera.CameraLauncher
for /l %%I in (1,1,50) do (
echo %%I st open specific camera
adb shell am start -n com.mediatek.camera/.CameraLauncher
ping /n 3 127.0.0.1 >nul
adb shell am force-stop com.mediatek.camera )
rem adb shell input touchscreen swipe {x1} {y1} {x2} {y2}
adb shell am start -n com.mediatek.camera/.CameraLauncher
for /l %%I in (1,1,50) do (
echo %%I st switch preveiw and video
adb shell input swipe 200 100 300 100
ping /n 3 127.0.0.1 >nul
adb shell input swipe 300 100 200 100)
adb shell am force-stop com.mediatek.camera
rem adb shell input keyevent CAMERA
for /l %%I in (1,1,50) do (
echo %%I st take picture/video
adb shell input keyevent CAMERA
ping /n 3 127.0.0.1 >nul
echo %%I st end picture/video
rem adb shell input keyevent CAMERA video录像 再调用一次就是关闭
rem ping /n 3 127.0.0.1 >nul
)
rem adb shell getevent
rem /dev/input/event0: 0001 0072 00000001
rem /dev/input/event0: 0000 0000 00000000
echo continus shot
adb shell sendevent /dev/input/event0 1 114 1
adb shell sendevent /dev/input/event0 0 0 0
ping /n 30 127.0.0.1 >nul
adb shell sendevent /dev/input/event0 1 114 0
adb shell sendevent /dev/input/event0 0 0 0
rem Develper options -> Pointer location 打开坐标线获取坐标 下发tap 到对应的坐标
echo continus shot
adb shell input tap 380 1314
adb shell input swipe 380 1314 380 1314 30000
echo switch main and front
adb shell input tap 184 1278
ping /n 2 127.0.0.1 >nul
adb shell input tap 184 1278
pause
打印CallStack(C/C++)
#include <utils/CallStack.h>
extern "C" void dump_callstack(void);
void dump_callstack(void){
android::CallStack stack("xxx call stack");
}
void dump_callstack(void);
LOCAL_SRC_FILES := xxx.c
LOCAL_SRC_FILES += callstack.cpp
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_HEADER_LIBRARIES := libhardware_headers
LOCAL_SHARED_LIBRARIES := liblog libutilscallstack
LOCAL_CFLAGS := -DLOG_TAG=\"qdlights\"
LOCAL_CLANG := true
LOCAL_MODULE := lights.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_TAGS := optional
LOCAL_VENDOR_MODULE := true
include $(BUILD_SHARED_LIBRARY)
#include <utils/CallStack.h>
android::CallStack stack;
stack.update();
stack.log("log_Tag");