您的位置:首页 > 移动开发 > Android开发

[RK3288][Android6.0] 调试笔记 --- Camera配置信息dump方法

2017-08-01 17:03 736 查看
Platform: Rockchip

OS: Android 6.0

Kernel: 3.10.92

系统默认提供了dump当前Camera所有配置及状态的方法,方便了调试。

方法:

#dumpsys media.camera


Camera module HAL API version: 0x1
Camera module API version: 0x1
Camera module name: RK29_ICS_CameraHal_Module
Camera module author: RockChip
Number of camera devices: 2
Active Camera Clients:
[
(Camera ID: 0, Cost: 100, PID: 1158, Priority: 2147483645, User Id: 0, Client Package Name: com.android.camera2, Conflicting Client Devices: {})
]
Allowed users:
0
Vendor tags left unimplemented.

Prior client events (most recent at top):
01-07 06:27:46 : CONNECT device 0 client for package com.android.camera2 (PID 1158)
01-07 06:27:39 : DISCONNECT device 1 client for package media (PID 213)
01-07 06:27:39 : DISCONNECT device 0 client for package media (PID 213)
01-07 06:27:35 : USER_SWITCH previous allowed users:  , current allowed users: 0

Camera 0 information:
Facing: BACK
Orientation: 0
Resource Cost: 100
Conflicting Devices: NONE
Device version: 0x100
Camera1 API shim is using parameters:
CameraParameters::dump: mMap.size = 50
antibanding: off
antibanding-values: off,50hz,60hz,auto
exposure-compensation: 0
exposure-compensation-step: 1
focal-length: 35
focus-distances: 0.3,50,Infinity
focus-mode: fixed
focus-mode-values: fixed
horizontal-view-angle: 10
jpeg-quality: 70
jpeg-thumbnail-height: 128
jpeg-thumbnail-quality: 50
jpeg-thumbnail-size-values: 0x0,160x128
jpeg-thumbnail-width: 160
max-exposure-compensation: 3
max-num-detected-faces-hw: 0
max-num-detected-faces-sw: 0
max-num-focus-areas: 0
max-num-metering-areas: 0
max-zoom: 40
min-exposure-compensation: -3
picture-format: jpeg
picture-format-values: jpeg
picture-size: 1920x1080
picture-size-values: 1920x1080,1280x720,640x480,320x240
preferred-preview-size-for-video:
preview-format: yuv420sp
preview-format-values: yuv420sp,yuv420p
preview-fps-range: 30000,30000
preview-fps-range-values: (30000,30000)
preview-frame-rate: 30
preview-frame-rate-values: 30
preview-size: 640x480
preview-size-values: 1920x1080,1280x720,640x480,320x240
recording-hint: false
rk-continous-pic-num: 1
rk-previwe-h-force: 0
rk-previwe-w-force: 0
rotation: 0
vertical-view-angle: 10
video-frame-format: yuv420sp
video-size:
video-size-values:
video-snapshot-supported: true
video-stabilization-supported: false
whitebalance: auto
whitebalance-values: auto,incandescent,fluorescent,daylight,cloudy-daylight
zoom: 0
zoom-ratios: 100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,255,260,265,270,275,280,285,290,295,300,
zoom-supported: true
Device 0 is open. Client instance dump:

Client priority level: 2147483645
Client PID: 1158
Client package: com.android.camera2
Client[0] (0xb735d0f0) with UID 10018
Latest set parameters:
CameraParameters::dump: mMap.size = 50
antibanding: auto
antibanding-values: off,50hz,60hz,auto
exposure-compensation: 0
exposure-compensation-step: 1
focal-length: 35
focus-distances: 0.3,50,Infinity
focus-mode: fixed
focus-mode-values: fixed
horizontal-view-angle: 10
jpeg-quality: 85
jpeg-thumbnail-height: 128
jpeg-thumbnail-quality: 85
jpeg-thumbnail-size-values: 0x0,160x128
jpeg-thumbnail-width: 160
max-exposure-compensation: 3
max-num-detected-faces-hw: 0
max-num-detected-faces-sw: 0
max-num-focus-areas: 0
max-num-metering-areas: 0
max-zoom: 40
min-exposure-compensation: -3
picture-format: jpeg
picture-format-values: jpeg
picture-size: 1920x1080
picture-size-values: 1920x1080,1280x720,640x480,320x240
preferred-preview-size-for-video:
preview-format: yuv420sp
preview-format-values: yuv420sp,yuv420p
preview-fps-range: 30000,30000
preview-fps-range-values: (30000,30000)
preview-frame-rate: 30
preview-frame-rate-values: 30
preview-size: 1920x1080
preview-size-values: 1920x1080,1280x720,640x480,320x240
recording-hint: false
rk-continous-pic-num: 1
rk-previwe-h-force: 0
rk-previwe-w-force: 0
rotation: 0
vertical-view-angle: 10
video-frame-format: yuv420sp
video-size:
video-size-values:
video-snapshot-supported: true
video-stabilization-supported: false
whitebalance: auto
whitebalance-values: auto,incandescent,fluorescent,daylight,cloudy-daylight
zoom: 0
zoom-ratios: 100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,255,260,265,270,275,280,285,290,295,300,
zoom-supported: true

Camera 1 information:
Facing: FRONT
Orientation: 0
Resource Cost: 100
Conflicting Devices: NONE
Device version: 0x100
Camera1 API shim is using parameters:
CameraParameters::dump: mMap.size = 50
antibanding: off
antibanding-values: off,50hz,60hz,auto
exposure-compensation: 0
exposure-compensation-step: 1
focal-length: 35
focus-distances: 0.3,50,Infinity
focus-mode: fixed
focus-mode-values: fixed
horizontal-view-angle: 10
jpeg-quality: 70
jpeg-thumbnail-height: 128
jpeg-thumbnail-quality: 50
jpeg-thumbnail-size-values: 0x0,160x128
jpeg-thumbnail-width: 160
max-exposure-compensation: 3
max-num-detected-faces-hw: 0
max-num-detected-faces-sw: 0
max-num-focus-areas: 0
max-num-metering-areas: 0
max-zoom: 40
min-exposure-compensation: -3
picture-format: jpeg
picture-format-values: jpeg
picture-size: 1920x1080
picture-size-values: 1920x1080,1280x720,640x480,320x240
preferred-preview-size-for-video:
preview-format: yuv420sp
preview-format-values: yuv420sp,yuv420p
preview-fps-range: 30000,30000
preview-fps-range-values: (30000,30000)
preview-frame-rate: 30
preview-frame-rate-values: 30
preview-size: 640x480
preview-size-values: 1920x1080,1280x720,640x480,320x240
recording-hint: false
rk-continous-pic-num: 1
rk-previwe-h-force: 0
rk-previwe-w-force: 0
rotation: 0
vertical-view-angle: 10
video-frame-format: yuv420sp
video-size:
video-size-values:
video-snapshot-supported: true
video-stabilization-supported: false
whitebalance: auto
whitebalance-values: auto,incandescent,fluorescent,daylight,cloudy-daylight
zoom: 0
zoom-ratios: 100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,255,260,265,270,275,280,285,290,295,300,
zoom-supported: true
Device 1 is closed, no client instance

Camera traces (0):
No camera traces collected.


代码:

当前状态部分:

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

status_t CameraService::dump(int fd, const Vector<String16>& args{
ATRACE_CALL();

String8 result("Dump of the Camera Service:\n");
if (checkCallingPermission(String16("android.permission.DUMP")) == false) {
result = result.format("Permission Denial: "
"can't dump CameraService from pid=%d, uid=%d\n",
getCallingPid(),
getCallingUid());
write(fd, result.string(), result.size());
} else {
bool locked = tryLock(mServiceLock);
// failed to lock - CameraService is probably deadlocked
if (!locked) {
result.append("CameraService may be deadlocked\n");
write(fd, result.string(), result.size());
}

bool hasClient = false;
if (!mModule) {
result = String8::format("No camera module available!\n");
write(fd, result.string(), result.size());

// Dump event log for error information
dumpEventLog(fd);

if (locked) mServiceLock.unlock();
return NO_ERROR;
}

result = String8::format("Camera module HAL API version: 0x%x\n", mModule->getHalApiVersion());
result.appendFormat("Camera module API version: 0x%x\n", mModule->getModuleApiVersion());
result.appendFormat("Camera module name: %s\n", mModule->getModuleName());
result.appendFormat("Camera module author: %s\n", mModule->getModuleAuthor());
result.appendFormat("Number of camera devices: %d\n", mNumberOfCameras);
String8 activeClientString = mActiveClientManager.toString();
result.appendFormat("Active Camera Clients:\n%s", activeClientString.string());
result.appendFormat("Allowed users:\n%s\n", toString(mAllowedUsers).string());

sp<VendorTagDescriptor> desc = VendorTagDescriptor::getGlobalVendorTagDescriptor();
if (desc == NULL) {
result.appendFormat("Vendor tags left unimplemented.\n");
} else {
result.appendFormat("Vendor tag definitions:\n");
}

write(fd, result.string(), result.size());

if (desc != NULL) {
desc->dump(fd, /*verbosity*/2, /*indentation*/4);
}

dumpEventLog(fd);

bool stateLocked = tryLock(mCameraStatesLock);
if (!stateLocked) {
result = String8::format("CameraStates in use, may be deadlocked\n");
write(fd, result.string(), result.size());
}

for (auto& state : mCameraStates) {
String8 cameraId = state.first;
result = String8::format("Camera %s information:\n", cameraId.string());
camera_info info;

// TODO: Change getCameraInfo + HAL to use String cameraIds
status_t rc = mModule->getCameraInfo(cameraIdToInt(cameraId), &info);
if (rc != OK) {
result.appendFormat("  Error reading static information!\n");
write(fd, result.string(), result.size());
} else {
result.appendFormat("  Facing: %s\n",
info.facing == CAMERA_FACING_BACK ? "BACK" : "FRONT");
result.appendFormat("  Orientation: %d\n", info.orientation);
int deviceVersion;
if (mModule->getModuleApiVersion() < CAMERA_MODULE_API_VERSION_2_0) {
deviceVersion = CAMERA_DEVICE_API_VERSION_1_0;
} else {
deviceVersion = info.device_version;
}

auto conflicting = state.second->getConflicting();
result.appendFormat("  Resource Cost: %d\n", state.second->getCost());
result.appendFormat("  Conflicting Devices:");
for (auto& id : conflicting) {
result.appendFormat(" %s", cameraId.string());
}
if (conflicting.size() == 0) {
result.appendFormat(" NONE");
}
result.appendFormat("\n");

result.appendFormat("  Device version: %#x\n", deviceVersion);
if (deviceVersion >= CAMERA_DEVICE_API_VERSION_2_0) {
result.appendFormat("  Device static metadata:\n");
write(fd, result.string(), result.size());
dump_indented_camera_metadata(info.static_camera_characteristics,
fd, /*verbosity*/2, /*indentation*/4);
} else {
write(fd, result.string(), result.size());
}

CameraParameters p = state.second->getShimParams();
if (!p.isEmpty()) {
result = String8::format("  Camera1 API shim is using parameters:\n        ");
write(fd, result.string(), result.size());
p.dump(fd, args);
}
}

auto clientDescriptor = mActiveClientManager.get(cameraId);
if (clientDescriptor == nullptr) {
result = String8::format("  Device %s is closed, no client instance\n",
cameraId.string());
write(fd, result.string(), result.size());
continue;
}
hasClient = true;
result = String8::format("  Device %s is open. Client instance dump:\n\n",
cameraId.string());
result.appendFormat("Client priority level: %d\n", clientDescriptor->getPriority());
result.appendFormat("Client PID: %d\n", clientDescriptor->getOwnerId());

auto client = clientDescriptor->getValue();
result.appendFormat("Client package: %s\n",
String8(client->getPackageName()).string());
write(fd, result.string(), result.size());

client->dumpClient(fd, args);
}

if (stateLocked) mCameraStatesLock.unlock();

if (!hasClient) {
result = String8::format("\nNo active camera clients yet.\n");
write(fd, result.string(), result.size());
}

if (locked) mServiceLock.unlock();

// Dump camera traces if there were any
write(fd, "\n", 1);
camera3::CameraTraces::dump(fd, args);

// change logging level
int n = args.size();
for (int i = 0; i + 1 < n; i++) {
String16 verboseOption("-v");
if (args[i] == verboseOption) {
String8 levelStr(args[i+1]);
int level = atoi(levelStr.string());
result = String8::format("\nSetting log level to %d.\n", level);
setLogLevel(level);
write(fd, result.string(), result.size());
}
}
}
return NO_ERROR;
}


当前参数配置部分:

frameworks/av/camera/CameraParameters.cpp

status_t CameraParameters::dump(int fd, const Vector<String16>& /*args*/) const
{
const size_t SIZE = 256;
char buffer[SIZE];
String8 result;
snprintf(buffer, 255, "CameraParameters::dump: mMap.size = %zu\n", mMap.size());
result.append(buffer);
for (size_t i = 0; i < mMap.size(); i++) {
String8 k, v;
k = mMap.keyAt(i);
v = mMap.valueAt(i);
snprintf(buffer, 255, "\t%s: %s\n", k.string(), v.string());
result.append(buffer);
}
write(fd, result.string(), result.size());
return NO_ERROR;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: