Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.

Camera debugging

This page describes the debugging tools in the camera service for viewing changes in capture request and result values that are sent to and from the camera HAL. The camera service includes the watch and the dumpsys commands. Available on devices running Android 13 or higher, the watch command allows control over when tags are monitored and accessed, live previewing of tag monitoring dumps from open clients, and viewing of cached dumps from closed clients. The dumpsys command allows for accessing debugging information but doesn't provide tag monitoring dumps from closed clients.

watch command

This section describes how to use the watch command and provides examples.

Start monitoring tags

To start monitoring tags, use:

adbshellcmdmedia.camerawatchstart-m<tags>[-c<clients>]

Example:

adbshellcmdmedia.camerawatchstart\
-mandroid.control.effectMode,android.control.aeMode\
-ccom.google.android.GoogleCamera,com.android.chrome

Arguments:

  • tags: Comma-separated list of tags to be monitored. Also accepts the shorthand 3a, where 3a refers to the set of all android.control.* tags related to AF, AE, and AWB (for the full list of tags, see TagMonitor.cpp).
  • clients: Optional argument. Comma-separated list of client package names for which tags are monitored. Watches all clients if no client argument is passed, or if all is present in the list of clients.

This command starts tag monitoring in open clients and in any clients that are subsequently opened (until stop is called). After start is called, The camera service caches tag monitoring dumps from clients when the clients close.

Unless start is called, the camera service doesn't monitor tags for any clients, and doesn't cache tag monitoring dumps. If all is passed in the clients parameter, the camera service monitors tags and caches monitoring dumps from all clients.

Dump tag monitoring information

To dump tag monitoring information, use:

adbshellcmdmedia.camerawatchdump

This command dumps the tag monitoring information to standard output and then exits. It prints the cached tag monitoring dumps from clients that have closed since start (or last clear) and the latest tag monitoring dump from open clients.

Sample output:

$adbshellcmdmedia.camerawatchdump
Client:com.android.chrome(active)
1:com.android.chromef0:532642803202286ns:REQ:android.control.aeMode:[ON]outputstreamids:0
1:com.android.chromef0:532642803202286ns:REQ:android.control.afMode:[CONTINUOUS_PICTURE]outputstreamids:0
..
Client:com.google.android.GoogleCamera(cached)
0:com.google.android.GoogleCameraf0:532601698728552ns:REQ:android.control.aeMode:[ON]outputstreamids:0312
0:com.google.android.GoogleCameraf0:532601698728552ns:REQ:android.control.afMode:[CONTINUOUS_PICTURE]outputstreamids:2130
0:com.google.android.GoogleCameraf0:532601698728552ns:REQ:android.control.awbMode:[AUTO]outputstreamids:0312
...

Preview tag monitoring information in real time

To preview tag monitoring information in real time, use:

adbshellcmdmedia.camerawatchlive[-nrefresh_interval_ms]

Example:

adbshellcmdmedia.camerawatchlive-n250

Arguments:

  • refresh_interval_ms: Optional argument. Interval in milliseconds to refresh the information at. Defaults to 1000 if no value is passed.

This command prints tag monitoring information in real time. To exit, press return/enter.

Sample output:

$adbshellcmdmedia.camerawatchlive
Pressreturntoexit...
0:com.google.android.GoogleCameraf0:533016991302201ns:REQ:android.control.aeMode:[ON]outputstreamids:1302
0:com.google.android.GoogleCameraf0:533016991302201ns:REQ:android.control.afMode:[CONTINUOUS_PICTURE]outputstreamids:2031
...
0:com.google.android.GoogleCameraf0:533017066793915ns:RES:android.control.aeState:[SEARCHING]
0:com.google.android.GoogleCameraf0:533017066793915ns:3RES:android.control.aeState:[SEARCHING]
0:com.google.android.GoogleCameraf0:533017066793915ns:2RES:android.control.aeState:[SEARCHING]
0:com.google.android.GoogleCameraf0:533017066793915ns:RES:android.control.afState:[PASSIVE_SCAN]

Clear cached dumps

To clear all cached tag monitoring dumps, use:

adbshellcmdmedia.camerawatchclear

This command doesn't stop tag monitoring.

Stop monitoring tags

To stop monitoring tags in all clients and clear all buffers held for caching tag monitoring dumps, use:

adbshellcmdmedia.camerawatchstop

dumpsys command

The dumpsys command provides a host of debugging information from the camera service. The following command captures the entire debugging dump from the camera service:

adbshelldumpsysmedia.camera

The dumpsys command also allows capturing tag monitoring dumps from open clients. However, dumpsys doesn't provide tag monitoring dumps from closed clients. The following are examples of using dumpsys for tag monitoring:

  • Capture tag monitoring dumps from all open clients:

    adbshelldumpsysmedia.camera-m3a|grep-A50Monitored
  • Get live preview of tag monitoring information using the Linux watch command:

    watch-n1-c'adb shell dumpsys media.camera -m 3a | grep -A50 Monitored'

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025年12月02日 UTC.