https://blog.csdn.net/kris_fei/article/details/76546417
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.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
代码:
- 当前状态部分:
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;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 当前参数配置部分:
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;
}