Loading apex/ld.config.txt +3 −1 Original line number Diff line number Diff line Loading @@ -38,8 +38,10 @@ namespace.default.link.platform.shared_libs = libEGL.so:libGLESv1_CM.so:libGLESv namespace.platform.isolated = true namespace.platform.search.paths = /system/${LIB} namespace.platform.search.paths += /apex/com.android.runtime/${LIB} namespace.platform.asan.search.paths = /data/asan/system/${LIB} namespace.platform.asan.search.paths += /system/${LIB} namespace.platform.asan.search.paths += /apex/com.android.runtime/${LIB} # /system/lib/libc.so, etc are symlinks to /apex/com.android.lib/lib/bionic/libc.so, etc. # Add /apex/... pat to the permitted paths because linker uses realpath(3) Loading camera/ndk/ndk_vendor/impl/ACameraDevice.h +1 −1 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ class CameraDevice final : public RefBase { private: friend ACameraCaptureSession; friend ACameraDevice; camera_status_t checkCameraClosedOrErrorLocked() const; Loading Loading @@ -388,7 +389,6 @@ struct ACameraDevice { mDevice(new android::acam::CameraDevice(id, cb, std::move(chars), this)) {} ~ACameraDevice(); /******************* * NDK public APIs * *******************/ Loading media/bufferpool/1.0/AccessorImpl.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ ResultStatus Accessor::Impl::connect( newConnection->initialize(accessor, id); *connection = newConnection; *pConnectionId = id; mBufferPool.mConnectionIds.insert(id); ++sSeqId; } } Loading Loading @@ -305,7 +306,12 @@ bool Accessor::Impl::BufferPool::handleTransferTo(const BufferStatusMessage &mes found->second->mSenderValidated = true; return true; } // TODO: verify there is target connection Id if (mConnectionIds.find(message.targetConnectionId) == mConnectionIds.end()) { // N.B: it could be fake or receive connection already closed. ALOGD("bufferpool %p receiver connection %lld is no longer valid", this, (long long)message.targetConnectionId); return false; } mStats.onBufferSent(); mTransactions.insert(std::make_pair( message.transactionId, Loading Loading @@ -450,6 +456,7 @@ bool Accessor::Impl::BufferPool::handleClose(ConnectionId connectionId) { } } } mConnectionIds.erase(connectionId); return true; } Loading media/bufferpool/1.0/AccessorImpl.h +1 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ private: std::map<BufferId, std::unique_ptr<InternalBuffer>> mBuffers; std::set<BufferId> mFreeBuffers; std::set<ConnectionId> mConnectionIds; /// Buffer pool statistics which tracks allocation and transfer statistics. struct Stats { Loading media/bufferpool/2.0/AccessorImpl.cpp +29 −3 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ ResultStatus Accessor::Impl::connect( *connection = newConnection; *pConnectionId = id; *pMsgId = mBufferPool.mInvalidation.mInvalidationId; mBufferPool.mConnectionIds.insert(id); mBufferPool.mInvalidationChannel.getDesc(invDescPtr); mBufferPool.mInvalidation.onConnect(id, observer); ++sSeqId; Loading Loading @@ -474,7 +475,12 @@ bool Accessor::Impl::BufferPool::handleTransferTo(const BufferStatusMessage &mes found->second->mSenderValidated = true; return true; } // TODO: verify there is target connection Id if (mConnectionIds.find(message.targetConnectionId) == mConnectionIds.end()) { // N.B: it could be fake or receive connection already closed. ALOGD("bufferpool2 %p receiver connection %lld is no longer valid", this, (long long)message.targetConnectionId); return false; } mStats.onBufferSent(); mTransactions.insert(std::make_pair( message.transactionId, Loading Loading @@ -644,6 +650,7 @@ bool Accessor::Impl::BufferPool::handleClose(ConnectionId connectionId) { } } } mConnectionIds.erase(connectionId); return true; } Loading Loading @@ -774,11 +781,19 @@ void Accessor::Impl::invalidatorThread( std::mutex &mutex, std::condition_variable &cv, bool &ready) { constexpr uint32_t NUM_SPIN_TO_INCREASE_SLEEP = 1024; constexpr uint32_t NUM_SPIN_TO_LOG = 1024*8; constexpr useconds_t MAX_SLEEP_US = 10000; uint32_t numSpin = 0; useconds_t sleepUs = 1; while(true) { std::map<uint32_t, const std::weak_ptr<Accessor::Impl>> copied; { std::unique_lock<std::mutex> lock(mutex); if (!ready) { numSpin = 0; sleepUs = 1; cv.wait(lock); } copied.insert(accessors.begin(), accessors.end()); Loading @@ -800,9 +815,20 @@ void Accessor::Impl::invalidatorThread( if (accessors.size() == 0) { ready = false; } else { // prevent draining cpu. // TODO Use an efficient way to wait over FMQ. // N.B. Since there is not a efficient way to wait over FMQ, // polling over the FMQ is the current way to prevent draining // CPU. lock.unlock(); std::this_thread::yield(); ++numSpin; if (numSpin % NUM_SPIN_TO_INCREASE_SLEEP == 0 && sleepUs < MAX_SLEEP_US) { sleepUs *= 10; } if (numSpin % NUM_SPIN_TO_LOG == 0) { ALOGW("invalidator thread spinning"); } ::usleep(sleepUs); } } } Loading Loading
apex/ld.config.txt +3 −1 Original line number Diff line number Diff line Loading @@ -38,8 +38,10 @@ namespace.default.link.platform.shared_libs = libEGL.so:libGLESv1_CM.so:libGLESv namespace.platform.isolated = true namespace.platform.search.paths = /system/${LIB} namespace.platform.search.paths += /apex/com.android.runtime/${LIB} namespace.platform.asan.search.paths = /data/asan/system/${LIB} namespace.platform.asan.search.paths += /system/${LIB} namespace.platform.asan.search.paths += /apex/com.android.runtime/${LIB} # /system/lib/libc.so, etc are symlinks to /apex/com.android.lib/lib/bionic/libc.so, etc. # Add /apex/... pat to the permitted paths because linker uses realpath(3) Loading
camera/ndk/ndk_vendor/impl/ACameraDevice.h +1 −1 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ class CameraDevice final : public RefBase { private: friend ACameraCaptureSession; friend ACameraDevice; camera_status_t checkCameraClosedOrErrorLocked() const; Loading Loading @@ -388,7 +389,6 @@ struct ACameraDevice { mDevice(new android::acam::CameraDevice(id, cb, std::move(chars), this)) {} ~ACameraDevice(); /******************* * NDK public APIs * *******************/ Loading
media/bufferpool/1.0/AccessorImpl.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ ResultStatus Accessor::Impl::connect( newConnection->initialize(accessor, id); *connection = newConnection; *pConnectionId = id; mBufferPool.mConnectionIds.insert(id); ++sSeqId; } } Loading Loading @@ -305,7 +306,12 @@ bool Accessor::Impl::BufferPool::handleTransferTo(const BufferStatusMessage &mes found->second->mSenderValidated = true; return true; } // TODO: verify there is target connection Id if (mConnectionIds.find(message.targetConnectionId) == mConnectionIds.end()) { // N.B: it could be fake or receive connection already closed. ALOGD("bufferpool %p receiver connection %lld is no longer valid", this, (long long)message.targetConnectionId); return false; } mStats.onBufferSent(); mTransactions.insert(std::make_pair( message.transactionId, Loading Loading @@ -450,6 +456,7 @@ bool Accessor::Impl::BufferPool::handleClose(ConnectionId connectionId) { } } } mConnectionIds.erase(connectionId); return true; } Loading
media/bufferpool/1.0/AccessorImpl.h +1 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ private: std::map<BufferId, std::unique_ptr<InternalBuffer>> mBuffers; std::set<BufferId> mFreeBuffers; std::set<ConnectionId> mConnectionIds; /// Buffer pool statistics which tracks allocation and transfer statistics. struct Stats { Loading
media/bufferpool/2.0/AccessorImpl.cpp +29 −3 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ ResultStatus Accessor::Impl::connect( *connection = newConnection; *pConnectionId = id; *pMsgId = mBufferPool.mInvalidation.mInvalidationId; mBufferPool.mConnectionIds.insert(id); mBufferPool.mInvalidationChannel.getDesc(invDescPtr); mBufferPool.mInvalidation.onConnect(id, observer); ++sSeqId; Loading Loading @@ -474,7 +475,12 @@ bool Accessor::Impl::BufferPool::handleTransferTo(const BufferStatusMessage &mes found->second->mSenderValidated = true; return true; } // TODO: verify there is target connection Id if (mConnectionIds.find(message.targetConnectionId) == mConnectionIds.end()) { // N.B: it could be fake or receive connection already closed. ALOGD("bufferpool2 %p receiver connection %lld is no longer valid", this, (long long)message.targetConnectionId); return false; } mStats.onBufferSent(); mTransactions.insert(std::make_pair( message.transactionId, Loading Loading @@ -644,6 +650,7 @@ bool Accessor::Impl::BufferPool::handleClose(ConnectionId connectionId) { } } } mConnectionIds.erase(connectionId); return true; } Loading Loading @@ -774,11 +781,19 @@ void Accessor::Impl::invalidatorThread( std::mutex &mutex, std::condition_variable &cv, bool &ready) { constexpr uint32_t NUM_SPIN_TO_INCREASE_SLEEP = 1024; constexpr uint32_t NUM_SPIN_TO_LOG = 1024*8; constexpr useconds_t MAX_SLEEP_US = 10000; uint32_t numSpin = 0; useconds_t sleepUs = 1; while(true) { std::map<uint32_t, const std::weak_ptr<Accessor::Impl>> copied; { std::unique_lock<std::mutex> lock(mutex); if (!ready) { numSpin = 0; sleepUs = 1; cv.wait(lock); } copied.insert(accessors.begin(), accessors.end()); Loading @@ -800,9 +815,20 @@ void Accessor::Impl::invalidatorThread( if (accessors.size() == 0) { ready = false; } else { // prevent draining cpu. // TODO Use an efficient way to wait over FMQ. // N.B. Since there is not a efficient way to wait over FMQ, // polling over the FMQ is the current way to prevent draining // CPU. lock.unlock(); std::this_thread::yield(); ++numSpin; if (numSpin % NUM_SPIN_TO_INCREASE_SLEEP == 0 && sleepUs < MAX_SLEEP_US) { sleepUs *= 10; } if (numSpin % NUM_SPIN_TO_LOG == 0) { ALOGW("invalidator thread spinning"); } ::usleep(sleepUs); } } } Loading