diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2012-07-17 14:13:34 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-07-17 14:13:34 -0700 |
commit | ea682976030a3930f6ee49b33b7e21abfc68174a (patch) | |
tree | 24bb02a54f694b57a7c7b2d30c5f7e9949c6e6cf | |
parent | a189a6883ee55cf62da1d7bf5bf5a8ab501938a4 (diff) | |
parent | f5926136ad328e95a79336b051d6f853443eaab9 (diff) | |
download | frameworks_av-ea682976030a3930f6ee49b33b7e21abfc68174a.zip frameworks_av-ea682976030a3930f6ee49b33b7e21abfc68174a.tar.gz frameworks_av-ea682976030a3930f6ee49b33b7e21abfc68174a.tar.bz2 |
Merge "CameraService: Add more information to service dump."
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 912ee4a..a83c28f 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -429,17 +429,69 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) { // 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()); + return NO_ERROR; + } + + result = String8::format("Camera module HAL API version: 0x%x\n", + mModule->common.hal_api_version); + result.appendFormat("Camera module API version: 0x%x\n", + mModule->common.module_api_version); + result.appendFormat("Camera module name: %s\n", + mModule->common.name); + result.appendFormat("Camera module author: %s\n", + mModule->common.author); + result.appendFormat("Number of camera devices: %d\n\n", mNumberOfCameras); + write(fd, result.string(), result.size()); for (int i = 0; i < mNumberOfCameras; i++) { + result = String8::format("Camera %d static information:\n", i); + camera_info info; + + status_t rc = mModule->get_camera_info(i, &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->common.module_api_version < + CAMERA_MODULE_API_VERSION_2_0) { + deviceVersion = CAMERA_DEVICE_API_VERSION_1_0; + } else { + deviceVersion = info.device_version; + } + result.appendFormat(" Device version: 0x%x\n", deviceVersion); + if (deviceVersion >= CAMERA_DEVICE_API_VERSION_2_0) { + result.appendFormat(" Device static metadata:\n"); + write(fd, result.string(), result.size()); + dump_camera_metadata(info.static_camera_characteristics, fd, 2); + } else { + write(fd, result.string(), result.size()); + } + } + sp<Client> client = mClient[i].promote(); - if (client == 0) continue; + if (client == 0) { + result = String8::format(" Device is closed, no client instance\n"); + write(fd, result.string(), result.size()); + continue; + } hasClient = true; + result = String8::format(" Device is open. Client instance dump:\n"); + write(fd, result.string(), result.size()); client->dump(fd, args); } if (!hasClient) { - result.append("No camera clients yet.\n"); + result = String8::format("\nNo active camera clients yet.\n"); + write(fd, result.string(), result.size()); } if (locked) mServiceLock.unlock(); @@ -451,11 +503,12 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) { if (args[i] == verboseOption) { String8 levelStr(args[i+1]); int level = atoi(levelStr.string()); - result.appendFormat("Setting log level to %d.\n", level); + result = String8::format("\nSetting log level to %d.\n", level); setLogLevel(level); + write(fd, result.string(), result.size()); } } - write(fd, result.string(), result.size()); + } return NO_ERROR; } |