Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d606182 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5688376 from 2cbc7cd8 to qt-release

Change-Id: I09d6211c4172d1cc84b7a093200601b2bbec8e6f
parents dce75079 2cbc7cd8
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@

#include "ACameraCaptureSession.inc"

ACameraDevice::~ACameraDevice() {
    mDevice->stopLooper();
}

namespace android {
namespace acam {

@@ -116,15 +120,11 @@ CameraDevice::~CameraDevice() {
        if (!isClosed()) {
            disconnectLocked(session);
        }
        LOG_ALWAYS_FATAL_IF(mCbLooper != nullptr,
                "CameraDevice looper should've been stopped before ~CameraDevice");
        mCurrentSession = nullptr;
        if (mCbLooper != nullptr) {
            mCbLooper->unregisterHandler(mHandler->id());
            mCbLooper->stop();
    }
}
    mCbLooper.clear();
    mHandler.clear();
}

void
CameraDevice::postSessionMsgAndCleanup(sp<AMessage>& msg) {
@@ -892,6 +892,16 @@ CameraDevice::onCaptureErrorLocked(
    return;
}

void CameraDevice::stopLooper() {
    Mutex::Autolock _l(mDeviceLock);
    if (mCbLooper != nullptr) {
      mCbLooper->unregisterHandler(mHandler->id());
      mCbLooper->stop();
    }
    mCbLooper.clear();
    mHandler.clear();
}

CameraDevice::CallbackHandler::CallbackHandler(const char* id) : mId(id) {
}

+4 −1
Original line number Diff line number Diff line
@@ -109,6 +109,9 @@ class CameraDevice final : public RefBase {

    inline ACameraDevice* getWrapper() const { return mWrapper; };

    // Stop the looper thread and unregister the handler
    void stopLooper();

  private:
    friend ACameraCaptureSession;
    camera_status_t checkCameraClosedOrErrorLocked() const;
@@ -354,7 +357,7 @@ struct ACameraDevice {
                  sp<ACameraMetadata> chars) :
            mDevice(new android::acam::CameraDevice(id, cb, chars, this)) {}

    ~ACameraDevice() {};
    ~ACameraDevice();

    /*******************
     * NDK public APIs *
+16 −6
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@

using namespace android;

ACameraDevice::~ACameraDevice() {
    mDevice->stopLooper();
}

namespace android {
namespace acam {

@@ -130,14 +134,10 @@ CameraDevice::~CameraDevice() {
            disconnectLocked(session);
        }
        mCurrentSession = nullptr;
        if (mCbLooper != nullptr) {
            mCbLooper->unregisterHandler(mHandler->id());
            mCbLooper->stop();
        LOG_ALWAYS_FATAL_IF(mCbLooper != nullptr,
            "CameraDevice looper should've been stopped before ~CameraDevice");
    }
}
    mCbLooper.clear();
    mHandler.clear();
}

void
CameraDevice::postSessionMsgAndCleanup(sp<AMessage>& msg) {
@@ -1400,6 +1400,16 @@ CameraDevice::checkAndFireSequenceCompleteLocked() {
    }
}

void CameraDevice::stopLooper() {
    Mutex::Autolock _l(mDeviceLock);
    if (mCbLooper != nullptr) {
      mCbLooper->unregisterHandler(mHandler->id());
      mCbLooper->stop();
    }
    mCbLooper.clear();
    mHandler.clear();
}

/**
  * Camera service callback implementation
  */
+4 −1
Original line number Diff line number Diff line
@@ -133,6 +133,9 @@ class CameraDevice final : public RefBase {
    bool setDeviceMetadataQueues();
    inline ACameraDevice* getWrapper() const { return mWrapper; };

    // Stop the looper thread and unregister the handler
    void stopLooper();

  private:
    friend ACameraCaptureSession;

@@ -383,7 +386,7 @@ struct ACameraDevice {
                  sp<ACameraMetadata> chars) :
            mDevice(new android::acam::CameraDevice(id, cb, std::move(chars), this)) {}

    ~ACameraDevice() {};
    ~ACameraDevice();

    /*******************
     * NDK public APIs *
+19 −2
Original line number Diff line number Diff line
@@ -439,6 +439,10 @@ size_t BuffersArrayImpl::numClientBuffers() const {
            });
}

size_t BuffersArrayImpl::arraySize() const {
    return mBuffers.size();
}

// InputBuffersArray

void InputBuffersArray::initialize(
@@ -883,11 +887,24 @@ void OutputBuffersArray::realloc(const std::shared_ptr<C2Buffer> &c2buffer) {
            mAlloc = [format = mFormat, size] {
                return new LocalLinearBuffer(format, new ABuffer(size));
            };
            ALOGD("[%s] reallocating with linear buffer of size %u", mName, size);
            break;
        }

        // TODO: add support
        case C2BufferData::GRAPHIC:         [[fallthrough]];
        case C2BufferData::GRAPHIC: {
            // This is only called for RawGraphicOutputBuffers.
            mAlloc = [format = mFormat,
                      lbp = LocalBufferPool::Create(kMaxLinearBufferSize * mImpl.arraySize())] {
                return ConstGraphicBlockBuffer::AllocateEmpty(
                        format,
                        [lbp](size_t capacity) {
                            return lbp->newBuffer(capacity);
                        });
            };
            ALOGD("[%s] reallocating with graphic buffer: format = %s",
                  mName, mFormat->debugString().c_str());
            break;
        }

        case C2BufferData::INVALID:         [[fallthrough]];
        case C2BufferData::LINEAR_CHUNKS:   [[fallthrough]];
Loading