Android Camera 調(diào)試常用調(diào)式命令

1、CameraService進程信息打印

adb shell dumpsys media.camera

可以獲取設(shè)計的相機相關(guān)信息及狀態(tài)

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<IServiceManager> 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<String16> services;

? ? Vector<String16> args;

? ? ....


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

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

? ? ? ? if (IsSkipped(skippedServices, service_name)) continue;

? ? ? ? sp<IBinder> 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<String16>& 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抓?。?/p>

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、執(zhí)行截圖命令:

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、內(nèi)存信息打印

adb shell dumpsys meminfo packagename

1

9、修改文件的讀寫權(quán)限

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 腳本開關(guān)應(yīng)用

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數(shù)據(jù)保存位置:

/data/data/<packagename>/shared_prefs/name of sharedPreference

1

14、CPP文件中開關(guān)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開關(guān)

//打開等級為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 開關(guān)

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;

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

版權(quán)聲明:本文為CSDN博主「gaojian.shi」的原創(chuàng)文章,遵循 CC 4.0 BY-SA 版權(quán)協(xié)議,轉(zhuǎn)載請附上原文出處鏈接及本聲明。

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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容