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

Commit 4b1286de authored by Shuzhen Wang's avatar Shuzhen Wang Committed by Android (Google) Code Review
Browse files

Merge "Camera: Only call cacheDump for the current camera id" into main

parents 1f336eb8 3db15193
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -5534,7 +5534,7 @@ static bool tryLock(Mutex& mutex)
    return locked;
}

void CameraService::cacheDump() {
void CameraService::cacheDump(const std::string& cameraId) {
    if (mMemFd != -1) {
        const Vector<String16> args;
        ATRACE_CALL();
@@ -5542,10 +5542,7 @@ void CameraService::cacheDump() {
        // cacheDump will not be called during the second disconnect.
        Mutex::Autolock lock(mServiceLock);

        Mutex::Autolock l(mCameraStatesLock);
        // Start collecting the info for open sessions and store it in temp file.
        for (const auto& state : mCameraStates) {
            std::string cameraId = state.first;
        // Start collecting the info for calling camera Id and store it in temp file.
        auto clientDescriptor = mActiveClientManager.get(cameraId);
        if (clientDescriptor != nullptr) {
            dprintf(mMemFd, "== Camera device %s dynamic info: ==\n", cameraId.c_str());
@@ -5554,7 +5551,6 @@ void CameraService::cacheDump() {
        }
    }
}
}

status_t CameraService::dump(int fd, const Vector<String16>& args) {
    ATRACE_CALL();
+1 −1
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public:
    void                notifyMonitoredUids(const std::unordered_set<uid_t> &notifyUidSet);

    // Stores current open session device info in temp file.
    void cacheDump();
    void cacheDump(const std::string& cameraId);

    // Register an offline client for a given active camera id
    status_t addOfflineClient(const std::string &cameraId, sp<BasicClient> offlineClient);
+1 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ binder::Status Camera2ClientBase<TClientBase>::disconnectImpl() {
    // deadlock while acquiring service lock in cacheDump.
    if (!TClientBase::mDisconnected) {
        ALOGD("Camera %s: start to cacheDump", TClientBase::mCameraIdStr.c_str());
        Camera2ClientBase::getCameraService()->cacheDump();
        Camera2ClientBase::getCameraService()->cacheDump(TClientBase::mCameraIdStr);
    }

    detachDevice();