From 9f6e183c01dae146eace14919bfa1286ae223669 Mon Sep 17 00:00:00 2001 From: Aravind Akella Date: Sat, 27 Sep 2014 02:06:32 +0000 Subject: Revert "Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections." This reverts commit 5105960d49bfa86efeeea8f87c87aa96b5771c37. Change-Id: I4d39ded2e50ef8a8e0aac27e438876203385a1f0 --- services/sensorservice/SensorService.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 77ada40deb..f953a960a9 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -653,7 +653,6 @@ void SensorService::cleanupConnection(SensorEventConnection* c) i++; } } - mLooper->removeFd(c->getSensorChannel()->getSendFd()); mActiveConnections.remove(connection); BatteryService::cleanup(c->getUid()); if (c->needsWakeLock()) { @@ -800,7 +799,6 @@ status_t SensorService::cleanupWithoutDisableLocked( BatteryService::disableSensor(connection->getUid(), handle); } if (connection->hasAnySensor() == false) { - mLooper->removeFd(connection->getSensorChannel()->getSendFd()); mActiveConnections.remove(connection); } // see if this sensor becomes inactive -- cgit v1.2.3 From ffd3fbf34cbb9c5ddc5e41142328b5c0cfabe1f5 Mon Sep 17 00:00:00 2001 From: Michael Lentine Date: Thu, 2 Oct 2014 09:11:04 -0700 Subject: Add more logging for dup(fd) failure Bug: 17477219 Change-Id: Ide0ae16d777c9af783023c705c18a93c00999147 --- libs/binder/Parcel.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 76504cee5c..ba5688c7ce 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -36,6 +36,7 @@ #include +#include #include #include #include @@ -1280,11 +1281,22 @@ status_t Parcel::read(FlattenableHelperInterface& val) const status_t err = NO_ERROR; for (size_t i=0 ; ireadFileDescriptor()); + int oldfd = this->readFileDescriptor(); + fds[i] = dup(oldfd); if (fds[i] < 0) { + int dupErrno = errno; err = BAD_VALUE; - ALOGE("dup() failed in Parcel::read, i is %zu, fds[i] is %d, fd_count is %zu, error: %s", - i, fds[i], fd_count, strerror(errno)); + int flags = fcntl(oldfd, F_GETFD); + int fcntlErrno = errno; + const flat_binder_object* flat = readObject(true); + ALOGE("dup failed in Parcel::read, fd %zu of %zu\n" + " dup(%d) = %d [errno: %d (%s)]\n" + " fcntl(%d, F_GETFD) = %d [errno: %d (%s)]\n" + " flat %p type %d", + i, fd_count, + oldfd, fds[i], dupErrno, strerror(dupErrno), + oldfd, flags, fcntlErrno, strerror(fcntlErrno), + flat, flat ? flat->type : 0); } } -- cgit v1.2.3 From 78d43d681db8b3a81f07b217c8a3fad3afe14086 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Wed, 1 Oct 2014 21:49:18 -0700 Subject: add OMX_VIDEO_AVCLevel52 constant Bug: 17676461 Change-Id: I120041e9b2ffe2a232a2419bcb5fe88cb49961cb --- include/media/openmax/OMX_Video.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/media/openmax/OMX_Video.h b/include/media/openmax/OMX_Video.h index 21dc5a62cd..89425e01d9 100644 --- a/include/media/openmax/OMX_Video.h +++ b/include/media/openmax/OMX_Video.h @@ -818,6 +818,7 @@ typedef enum OMX_VIDEO_AVCLEVELTYPE { OMX_VIDEO_AVCLevel42 = 0x2000, /**< Level 4.2 */ OMX_VIDEO_AVCLevel5 = 0x4000, /**< Level 5 */ OMX_VIDEO_AVCLevel51 = 0x8000, /**< Level 5.1 */ + OMX_VIDEO_AVCLevel52 = 0x10000, /**< Level 5.2 */ OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF -- cgit v1.2.3 From 4bd1c416204868f143eb03c2bc6227e38f69dc90 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Thu, 2 Oct 2014 11:09:03 -0700 Subject: Surface: cancel the dequeued buffer when requestBuffer fails Partial fix for bug: 17477219 Change-Id: Ibf5a9e26e02c4be8854925a77a70f5c9c7dcf6f2 --- libs/gui/Surface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index b56030e9ea..0e2baa28fd 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -237,6 +237,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) { result = mGraphicBufferProducer->requestBuffer(buf, &gbuf); if (result != NO_ERROR) { ALOGE("dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d", result); + mGraphicBufferProducer->cancelBuffer(buf, fence); return result; } } -- cgit v1.2.3 From 40fc668a460e65afa6b35ef2b00b043ed810c51a Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Mon, 6 Oct 2014 09:49:45 -0700 Subject: Parcel: extra validation/debug code for writeDupFileDescriptor Temporary extra debug validation for b/17477219: a Parcel recipient is getting a positive but invalid fd unexpectedly. Trying to track down where it's coming from. Debug code for bug: 17477219 Change-Id: Idb1e71621025a3928c7adc88fd44790e1abd2a01 --- libs/binder/Parcel.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index ba5688c7ce..f61eacae87 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -767,6 +768,29 @@ status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership) status_t Parcel::writeDupFileDescriptor(int fd) { int dupFd = dup(fd); + + { // Temporary extra debug validation for b/17477219: a Parcel recipient is + // getting a positive but invalid fd unexpectedly. Trying to track down + // where it's coming from. + int dupErrno = dupFd < 0 ? errno : 0; + int fdFlags = fcntl(fd, F_GETFD); + int fdFlagsErrno = fdFlags == -1 ? errno : 0; + int dupFlags = fcntl(dupFd, F_GETFD); + int dupFlagsErrno = dupFlags == -1 ? errno : 0; + if (dupFd < 0 || fdFlags == -1 || dupFlags == -1) { + ALOGE("Parcel::writeDupFileDescriptor failed:\n" + " fd=%d flags=%d err=%d(%s)\n" + " dupFd=%d dupErr=%d(%s) flags=%d err=%d(%s)", + fd, fdFlags, fdFlagsErrno, strerror(fdFlagsErrno), + dupFd, dupErrno, strerror(dupErrno), + dupFlags, dupFlagsErrno, strerror(dupFlagsErrno)); + if (fd < 0 || fdFlags == -1) { + CallStack(LOG_TAG); + } + return -errno; + } + } + if (dupFd < 0) { return -errno; } @@ -1297,6 +1321,7 @@ status_t Parcel::read(FlattenableHelperInterface& val) const oldfd, fds[i], dupErrno, strerror(dupErrno), oldfd, flags, fcntlErrno, strerror(fcntlErrno), flat, flat ? flat->type : 0); + CallStack(LOG_TAG); } } -- cgit v1.2.3