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

Commit cb3b384f authored by Ravneet Dhanjal's avatar Ravneet Dhanjal
Browse files

Camera: Mark unchanged streams as reconfigured to clear buffer caches

- During stream configuration, unchanged streams are not flagged
as reconfigured. This prevents onStreamReConfigured from being called
which is responsible for clearing buffer caches. If stream
configuration happens before a buffer's on freed sequence is complete,
the buffer cache for that stream remains uncleared. This can result
in a hwasan error due to attempts to access the stale buffer.

Test: Partner verified; CTS camera test
Bug: 341740105
Flag: com.android.internal.camera.flags.enable_stream_reconfiguration_for_unchanged_streams
Change-Id: I8953eae6c814a034dcdb21c63fa8b255e6b0d1ac
parent c2fc0bd8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -243,3 +243,10 @@ flag {
    description: "Enable CameraServiceWatchdog to abort camera HAL to generate HAL tombstones"
    bug: "349652177"
}

flag {
    namespace: "camera_platform"
    name: "enable_stream_reconfiguration_for_unchanged_streams"
    description: "Enable stream reconfiguration for unchanged streams"
    bug: "341740105"
}
+7 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@
#include "ui/GraphicBufferMapper.h"

#include <cutils/properties.h>
#include <com_android_internal_camera_flags.h>

namespace flags = com::android::internal::camera::flags;

namespace android {

@@ -388,6 +391,10 @@ status_t Camera3Stream::finishConfiguration(/*out*/bool* streamReconfigured) {
            mOldDataSpace == camera_stream::data_space &&
            mOldFormat == camera_stream::format) {
        mState = STATE_CONFIGURED;
        if (flags::enable_stream_reconfiguration_for_unchanged_streams()
                && streamReconfigured != nullptr) {
            *streamReconfigured = true;
        }
        return OK;
    }