Loading camera/libcameraservice/CameraService.cpp +27 −1 Original line number Diff line number Diff line Loading @@ -1291,8 +1291,26 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(const sp<ICameraClient>& client->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame); } static const int kDumpLockRetries = 50; static const int kDumpLockSleep = 60000; static bool tryLock(Mutex& mutex) { bool locked = false; for (int i = 0; i < kDumpLockRetries; ++i) { if (mutex.tryLock() == NO_ERROR) { locked = true; break; } usleep(kDumpLockSleep); } return locked; } status_t CameraService::dump(int fd, const Vector<String16>& args) { static const char* kDeadlockedString = "CameraService may be deadlocked\n"; const size_t SIZE = 256; char buffer[SIZE]; String8 result; Loading @@ -1304,7 +1322,13 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) result.append(buffer); write(fd, result.string(), result.size()); } else { AutoMutex lock(&mServiceLock); bool locked = tryLock(mServiceLock); // failed to lock - CameraService is probably deadlocked if (!locked) { String8 result(kDeadlockedString); write(fd, result.string(), result.size()); } if (mClient != 0) { sp<Client> currentClient = mClient.promote(); sprintf(buffer, "Client (%p) PID: %d\n", Loading @@ -1317,6 +1341,8 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) result.append("No camera client yet.\n"); write(fd, result.string(), result.size()); } if (locked) mServiceLock.unlock(); } return NO_ERROR; } Loading cleanspec.mkdeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/os/IDropBoxService.java) cmds/keystore/keystore_get.h +10 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include <stdio.h> #include <stdint.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> Loading @@ -28,18 +27,21 @@ #define KEYSTORE_MESSAGE_SIZE 65535 #ifdef __cplusplus extern "C" { #endif /* This function is provided for native components to get values from keystore. * Users are required to link against libcutils. The lengths of keys and values * are limited to KEYSTORE_MESSAGE_SIZE. This function returns the length of * the requested value or -1 if something goes wrong. */ static int keystore_get(const char *key, char *value) static int keystore_get(const char *key, int length, char *value) { int length = strlen(key); uint8_t bytes[2] = {length >> 8, length}; uint8_t code = 'g'; int sock; if (length > KEYSTORE_MESSAGE_SIZE) { if (length < 0 || length > KEYSTORE_MESSAGE_SIZE) { return -1; } sock = socket_local_client("keystore", ANDROID_SOCKET_NAMESPACE_RESERVED, Loading @@ -66,4 +68,8 @@ static int keystore_get(const char *key, char *value) return length; } #ifdef __cplusplus } #endif #endif include/utils/ResourceTypes.h +2 −1 Original line number Diff line number Diff line Loading @@ -946,7 +946,8 @@ struct ResTable_config MASK_UI_MODE_TYPE = 0x0f, UI_MODE_TYPE_ANY = 0x00, UI_MODE_TYPE_NORMAL = 0x01, UI_MODE_TYPE_CAR = 0x02, UI_MODE_TYPE_DESK = 0x02, UI_MODE_TYPE_CAR = 0x03, // uiMode bits for the night switch. MASK_UI_MODE_NIGHT = 0x30, Loading libs/audioflinger/AudioFlinger.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -3247,7 +3247,10 @@ bool AudioFlinger::RecordThread::threadLoop() if (mBytesRead < 0) { LOGE("Error reading audio input"); if (mActiveTrack->mState == TrackBase::ACTIVE) { sleep(1); // Force input into standby so that it tries to // recover at next read attempt mInput->standby(); usleep(5000); } mRsmpInIndex = mFrameCount; framesOut = 0; Loading Loading @@ -3429,7 +3432,10 @@ status_t AudioFlinger::RecordThread::getNextBuffer(AudioBufferProvider::Buffer* if (mBytesRead < 0) { LOGE("RecordThread::getNextBuffer() Error reading audio input"); if (mActiveTrack->mState == TrackBase::ACTIVE) { sleep(1); // Force input into standby so that it tries to // recover at next read attempt mInput->standby(); usleep(5000); } buffer->raw = 0; buffer->frameCount = 0; Loading Loading
camera/libcameraservice/CameraService.cpp +27 −1 Original line number Diff line number Diff line Loading @@ -1291,8 +1291,26 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(const sp<ICameraClient>& client->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame); } static const int kDumpLockRetries = 50; static const int kDumpLockSleep = 60000; static bool tryLock(Mutex& mutex) { bool locked = false; for (int i = 0; i < kDumpLockRetries; ++i) { if (mutex.tryLock() == NO_ERROR) { locked = true; break; } usleep(kDumpLockSleep); } return locked; } status_t CameraService::dump(int fd, const Vector<String16>& args) { static const char* kDeadlockedString = "CameraService may be deadlocked\n"; const size_t SIZE = 256; char buffer[SIZE]; String8 result; Loading @@ -1304,7 +1322,13 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) result.append(buffer); write(fd, result.string(), result.size()); } else { AutoMutex lock(&mServiceLock); bool locked = tryLock(mServiceLock); // failed to lock - CameraService is probably deadlocked if (!locked) { String8 result(kDeadlockedString); write(fd, result.string(), result.size()); } if (mClient != 0) { sp<Client> currentClient = mClient.promote(); sprintf(buffer, "Client (%p) PID: %d\n", Loading @@ -1317,6 +1341,8 @@ status_t CameraService::dump(int fd, const Vector<String16>& args) result.append("No camera client yet.\n"); write(fd, result.string(), result.size()); } if (locked) mServiceLock.unlock(); } return NO_ERROR; } Loading
cleanspec.mkdeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/os/IDropBoxService.java)
cmds/keystore/keystore_get.h +10 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ #include <stdio.h> #include <stdint.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> Loading @@ -28,18 +27,21 @@ #define KEYSTORE_MESSAGE_SIZE 65535 #ifdef __cplusplus extern "C" { #endif /* This function is provided for native components to get values from keystore. * Users are required to link against libcutils. The lengths of keys and values * are limited to KEYSTORE_MESSAGE_SIZE. This function returns the length of * the requested value or -1 if something goes wrong. */ static int keystore_get(const char *key, char *value) static int keystore_get(const char *key, int length, char *value) { int length = strlen(key); uint8_t bytes[2] = {length >> 8, length}; uint8_t code = 'g'; int sock; if (length > KEYSTORE_MESSAGE_SIZE) { if (length < 0 || length > KEYSTORE_MESSAGE_SIZE) { return -1; } sock = socket_local_client("keystore", ANDROID_SOCKET_NAMESPACE_RESERVED, Loading @@ -66,4 +68,8 @@ static int keystore_get(const char *key, char *value) return length; } #ifdef __cplusplus } #endif #endif
include/utils/ResourceTypes.h +2 −1 Original line number Diff line number Diff line Loading @@ -946,7 +946,8 @@ struct ResTable_config MASK_UI_MODE_TYPE = 0x0f, UI_MODE_TYPE_ANY = 0x00, UI_MODE_TYPE_NORMAL = 0x01, UI_MODE_TYPE_CAR = 0x02, UI_MODE_TYPE_DESK = 0x02, UI_MODE_TYPE_CAR = 0x03, // uiMode bits for the night switch. MASK_UI_MODE_NIGHT = 0x30, Loading
libs/audioflinger/AudioFlinger.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -3247,7 +3247,10 @@ bool AudioFlinger::RecordThread::threadLoop() if (mBytesRead < 0) { LOGE("Error reading audio input"); if (mActiveTrack->mState == TrackBase::ACTIVE) { sleep(1); // Force input into standby so that it tries to // recover at next read attempt mInput->standby(); usleep(5000); } mRsmpInIndex = mFrameCount; framesOut = 0; Loading Loading @@ -3429,7 +3432,10 @@ status_t AudioFlinger::RecordThread::getNextBuffer(AudioBufferProvider::Buffer* if (mBytesRead < 0) { LOGE("RecordThread::getNextBuffer() Error reading audio input"); if (mActiveTrack->mState == TrackBase::ACTIVE) { sleep(1); // Force input into standby so that it tries to // recover at next read attempt mInput->standby(); usleep(5000); } buffer->raw = 0; buffer->frameCount = 0; Loading