Android am打开camera,Android Camera 调试常用调式命令

1、CameraService进程信息打印

adb shell dumpsys media.camera

可以获取设计的相机相关信息及状态

CameraService Log等级修改

adb shell dumpsys media.camera -v 1

代码入口是:

frameworks\native\cmds\dumpsys\main.cpp

int main(int argc, char* const argv[]) {

signal(SIGPIPE, SIG_IGN);

sp sm = defaultServiceManager();

fflush(stdout);

if (sm == nullptr) {

ALOGE("Unable to get default service manager!");

aerr << "dumpsys: Unable to get default service manager!" << endl;

return 20;

}

Dumpsys dumpsys(sm.get());

return dumpsys.main(argc, argv);

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

frameworks\native\cmds\dumpsys\dumpsys.cpp

int Dumpsys::main(int argc, char* const argv[]) {

Vector services;

Vector args;

....

for (size_t i = 0; i < N; i++) {

String16 service_name = std::move(services[i]);

if (IsSkipped(skippedServices, service_name)) continue;

sp service = sm_->checkService(service_name);

if (service != nullptr) {

....

// dump blocks until completion, so spawn a thread..

std::thread dump_thread([=, remote_end { std::move(remote_end) }]() mutable {

int err = service->dump(remote_end.get(), args);

});

...

return 0;

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

进入CameraServic

frameworks\av\services\camera\libcameraservice\CameraService.cpp

status_t CameraService::dump(int fd, const Vector& args) {

...

dprintf(fd, "\n== Service global info: ==\n\n");

dprintf(fd, "Number of camera devices: %d\n", mNumberOfCameras);

dprintf(fd, "Number of normal camera devices: %d\n", mNumberOfNormalCameras);

String8 activeClientString = mActiveClientManager.toString();

dprintf(fd, "Active Camera Clients:\n%s", activeClientString.string());

dprintf(fd, "Allowed user IDs: %s\n", toString(mAllowedUsers).string());

...

}

1

2

3

4

5

6

7

8

9

10

11

2、查看camera所在进程及运行在那个cpu上

ps –e | grep camera

ps -eo pid,args,psr|grep camera//run on which processor .

1

2

3、kernel log抓取:

adb logcat -b kernel -v threadtime > kernel.log

adb shell cat dev/kmsg | find “3641”//pid

adb logcat -b all > log//userspace and kernel space log

//main and kernel log

adb logcat -c && adb logcat -G 256M && adb logcat -b main -b crash -b kernel > log.txt

1

2

3

4

5

6

7

4、java层打印堆栈:

try{

throw new Exception();

} catch(Throwable e){

Log.e("sgj","e.printStackTrace();");

e.printStackTrace();

}

1

2

3

4

5

6

5、执行截图命令:

adb shell /system/bin/screencap -p /sdcard/screenshot.png

adb pull /sdcard/screenshot.png d:/screenshot.png

1

2

6、查看进程打开的文件:

adb shell lsof -p 685 >e:\log.txt

1

7、addr2line工具

addr2line -C -f -e  newcdr 00026cb3

1

8、内存信息打印

adb shell dumpsys meminfo packagename

1

9、修改文件的读写权限

chmod 777 build.prop

1

10、patch添加

git apply –reject xx.patch

11、代码上传主干及分支

git push origin HEAD:refs/for/master

上传分支

git push origin HEAD:refs/for/分支名

1

2

3

12、shell 脚本开关应用

adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity

adb shell am start -n com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity

adb shell am force-stop com.some.package

1

2

3

13、sharedpreference数据保存位置:

/data/data//shared_prefs/name of sharedPreference

1

14、CPP文件中开关log

打开ALOGV: #define LOG_NDEBUG 0

打开ALOGI:#define LOG_NIDEBUG 0

打开ALOGD:#define LOG_NDDEBUG 0

打开全部LOG:#undef NDEBUG

1

2

3

4

15、qcom HAL3 log开关

//打开等级为LEVEL: logInfoMask; GROUP: 0x80 即CamxLogGroupHAL LOG;

adb shell "echo logInfoMask=0x80 >> /vendor/etc/camera/camxoverridesettings.txt"

//打开所有chi log,bit 0 - error, bit 1 - warning, bit 2 - info, bit 3 - debug

adb shell "echo overrideLogLevels =15>> /vendor/etc/camera/camxoverridesettings.txt"

//CamxLogGroupHAL定义在vendor\qcom\proprietary\camx\src\utils\camxtypes.h

//CamxLogInfo定义在vendor\qcom\proprietary\camx\src\utils\camxtypes.h

//默认值定义在vendor\qcom\proprietary\camx\src\core\camxsettings.xml

//用户重载在camxoverridesettings.txt和camxoverridesettingsprivate.txt

1

2

3

4

5

6

7

8

9

16、qcom hal3 kernel log 开关

adb shell "echo 0x10 > /sys/module/cam_debug_util/parameters/debug_mdl"

1

17、

x = (m+n-1)&~(n-1)

意思是:

x=m/n*n+(m%n==0)?0:n;

————————————————

版权声明:本文为CSDN博主「gaojian.shi」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/u010116586/article/details/92766257

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值