Merge changes Ided4e9bb,I2808441c am: 19345258e5 am: e03ea9f8ba
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2386900
Change-Id: Ie67f5ecd081864e424f6cf307bac5f1b89afe371
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp
index 87e1ab7..5aecd32 100644
--- a/audio/effect/all-versions/default/Effect.cpp
+++ b/audio/effect/all-versions/default/Effect.cpp
@@ -240,16 +240,6 @@
};
bool ProcessThread::threadLoop() {
- // For a spatializer effect, we perform scheduler adjustments to reduce glitches and power.
- {
- effect_descriptor_t halDescriptor{};
- if ((*mEffect)->get_descriptor(mEffect, &halDescriptor) == NO_ERROR &&
- memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) {
- const status_t status = scheduler::updateSpatializerPriority(gettid());
- ALOGW_IF(status != OK, "Failed to update Spatializer priority");
- }
- }
-
// This implementation doesn't return control back to the Thread until it decides to stop,
// as the Thread uses mutexes, and this can lead to priority inversion.
while (!std::atomic_load_explicit(mStop, std::memory_order_acquire)) {
@@ -570,6 +560,15 @@
return Void();
}
+ // For a spatializer effect, we perform scheduler adjustments to reduce glitches and power.
+ // We do it here instead of the ProcessThread::threadLoop to ensure that mHandle is valid.
+ if (effect_descriptor_t halDescriptor{};
+ (*mHandle)->get_descriptor(mHandle, &halDescriptor) == NO_ERROR &&
+ memcmp(&halDescriptor.type, FX_IID_SPATIALIZER, sizeof(effect_uuid_t)) == 0) {
+ const status_t status = scheduler::updateSpatializerPriority(mProcessThread->getTid());
+ ALOGW_IF(status != OK, "Failed to update Spatializer priority");
+ }
+
mStatusMQ = std::move(tempStatusMQ);
_hidl_cb(Result::OK, *mStatusMQ->getDesc());
return Void();
diff --git a/camera/device/3.2/default/convert.cpp b/camera/device/3.2/default/convert.cpp
index 06ad7e9..2075607 100644
--- a/camera/device/3.2/default/convert.cpp
+++ b/camera/device/3.2/default/convert.cpp
@@ -16,6 +16,7 @@
#define LOG_TAG "android.hardware.camera.device@3.2-convert-impl"
#include <log/log.h>
+#include <system/camera_metadata.h>
#include "include/convert.h"
@@ -43,6 +44,13 @@
ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__);
return false;
}
+
+ if (validate_camera_metadata_structure((camera_metadata_t*)data, /*expected_size=*/NULL) !=
+ OK) {
+ ALOGE("%s: Failed to validate the metadata structure", __FUNCTION__);
+ return false;
+ }
+
*dst = (camera_metadata_t*) data;
return true;
}