Merge "spatializer: disable head tracker sensor when not neeeded" into tm-dev
diff --git a/camera/camera2/OutputConfiguration.cpp b/camera/camera2/OutputConfiguration.cpp
index 4300f9a..5b8da34 100644
--- a/camera/camera2/OutputConfiguration.cpp
+++ b/camera/camera2/OutputConfiguration.cpp
@@ -77,7 +77,7 @@
return mSensorPixelModesUsed;
}
-int OutputConfiguration::getDynamicRangeProfile() const {
+int64_t OutputConfiguration::getDynamicRangeProfile() const {
return mDynamicRangeProfile;
}
@@ -186,8 +186,8 @@
ALOGE("%s: Failed to read sensor pixel mode(s) from parcel", __FUNCTION__);
return err;
}
- int dynamicProfile;
- if ((err = parcel->readInt32(&dynamicProfile)) != OK) {
+ int64_t dynamicProfile;
+ if ((err = parcel->readInt64(&dynamicProfile)) != OK) {
ALOGE("%s: Failed to read surface dynamic range profile flag from parcel", __FUNCTION__);
return err;
}
@@ -314,7 +314,7 @@
err = parcel->writeParcelableVector(mSensorPixelModesUsed);
if (err != OK) return err;
- err = parcel->writeInt32(mDynamicRangeProfile ? 1 : 0);
+ err = parcel->writeInt64(mDynamicRangeProfile);
if (err != OK) return err;
err = parcel->writeInt32(mStreamUseCase);
diff --git a/camera/include/camera/CameraSessionStats.h b/camera/include/camera/CameraSessionStats.h
index ab2d903..26dc70c 100644
--- a/camera/include/camera/CameraSessionStats.h
+++ b/camera/include/camera/CameraSessionStats.h
@@ -63,7 +63,7 @@
std::vector<int64_t> mHistogramCounts;
// Dynamic range profile
- int mDynamicRangeProfile;
+ int64_t mDynamicRangeProfile;
// Stream use case
int mStreamUseCase;
diff --git a/camera/include/camera/camera2/OutputConfiguration.h b/camera/include/camera/camera2/OutputConfiguration.h
index d7abfba..6b0f333 100644
--- a/camera/include/camera/camera2/OutputConfiguration.h
+++ b/camera/include/camera/camera2/OutputConfiguration.h
@@ -58,7 +58,7 @@
int getSurfaceType() const;
int getWidth() const;
int getHeight() const;
- int getDynamicRangeProfile() const;
+ int64_t getDynamicRangeProfile() const;
bool isDeferred() const;
bool isShared() const;
String16 getPhysicalCameraId() const;
@@ -184,7 +184,7 @@
String16 mPhysicalCameraId;
bool mIsMultiResolution;
std::vector<int32_t> mSensorPixelModesUsed;
- int mDynamicRangeProfile;
+ int64_t mDynamicRangeProfile;
int mStreamUseCase;
int mTimestampBase;
int mMirrorMode;
diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h
index 4911429..4c492f0 100644
--- a/camera/ndk/include/camera/NdkCameraMetadataTags.h
+++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h
@@ -3474,7 +3474,7 @@
* <p>A map of all available 10-bit dynamic range profiles along with their
* capture request constraints.</p>
*
- * <p>Type: int32[n*2] (acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t)</p>
+ * <p>Type: int64[n*3] (acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t)</p>
*
* <p>This tag may appear in:
* <ul>
@@ -3487,7 +3487,7 @@
* support every possible profile combination within a single capture request, then the
* constraints must be listed here as well.</p>
*/
- ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = // int32[n*2] (acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t)
+ ACAMERA_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = // int64[n*3] (acamera_metadata_enum_android_request_available_dynamic_range_profiles_map_t)
ACAMERA_REQUEST_START + 19,
ACAMERA_REQUEST_END,
diff --git a/drm/libmediadrm/CryptoHalAidl.cpp b/drm/libmediadrm/CryptoHalAidl.cpp
index 642264f..3dc62e9 100644
--- a/drm/libmediadrm/CryptoHalAidl.cpp
+++ b/drm/libmediadrm/CryptoHalAidl.cpp
@@ -355,8 +355,7 @@
std::string msgStr(statusAidl.getMessage());
*errorDetailMsg = toString8(msgStr);
if (err != OK) {
- ALOGE("Failed on decrypt, error message:%s, bytes written:%d", statusAidl.getMessage(),
- result);
+ ALOGE("Failed on decrypt, error description:%s", statusAidl.getDescription().c_str());
return err;
}
@@ -376,7 +375,7 @@
mHeapSizes.add(seqNum, heap->size());
SharedBufferAidl memAidl;
- memAidl.handle = ::android::makeToAidl(heap->handle());
+ memAidl.handle = ::android::dupToAidl(heap->handle());
memAidl.size = heap->size();
memAidl.bufferId = bufferId;
diff --git a/drm/libmediadrm/DrmHalAidl.cpp b/drm/libmediadrm/DrmHalAidl.cpp
index dc6d23e..284abd5 100644
--- a/drm/libmediadrm/DrmHalAidl.cpp
+++ b/drm/libmediadrm/DrmHalAidl.cpp
@@ -19,6 +19,7 @@
#include <array>
#include <algorithm>
+#include <map>
#include <android/binder_auto_utils.h>
#include <android/binder_manager.h>
#include <media/PluginMetricsReporting.h>
@@ -52,6 +53,7 @@
using ::aidl::android::hardware::drm::SecureStopId;
using ::aidl::android::hardware::drm::SecurityLevel;
using ::aidl::android::hardware::drm::Status;
+using ::aidl::android::hardware::drm::SupportedContentType;
using ::aidl::android::hardware::drm::Uuid;
using DrmMetricGroupAidl = ::aidl::android::hardware::drm::DrmMetricGroup;
using DrmMetricGroupHidl = ::android::hardware::drm::V1_1::DrmMetricGroup;
@@ -420,16 +422,30 @@
continue;
}
- if (levelAidl != SecurityLevel::DEFAULT && levelAidl != SecurityLevel::UNKNOWN) {
- if (levelAidl > schemes.maxLevel || levelAidl < schemes.minLevel) {
- continue;
- }
+ ALOGV("supported schemes: %s; query: level %d mime %s",
+ schemes.toString().c_str(), levelAidl, mimeType.c_str());
+ std::map<std::string, SupportedContentType> contentTypes;
+ for (auto ct : schemes.mimeTypes) {
+ contentTypes[ct.mime] = ct;
}
- if (!mimeTypeStr.empty()) {
- if (!std::count(schemes.mimeTypes.begin(), schemes.mimeTypes.end(), mimeTypeStr)) {
- continue;
+ // handle default value cases
+ if (levelAidl == SecurityLevel::DEFAULT || levelAidl == SecurityLevel::UNKNOWN) {
+ if (mimeType == "") {
+ // isCryptoSchemeSupported(uuid)
+ *isSupported = true;
+ } else {
+ // isCryptoSchemeSupported(uuid, mimeType)
+ *isSupported = contentTypes.count(mimeTypeStr);
}
+ return OK;
+ } else if (mimeType == "") {
+ return BAD_VALUE;
+ }
+
+ auto ct = contentTypes[mimeTypeStr];
+ if (levelAidl > ct.maxLevel || levelAidl < ct.minLevel) {
+ continue;
}
*isSupported = true;
diff --git a/drm/mediadrm/plugins/clearkey/aidl/CryptoPlugin.cpp b/drm/mediadrm/plugins/clearkey/aidl/CryptoPlugin.cpp
index 651d8f5..201cf02 100644
--- a/drm/mediadrm/plugins/clearkey/aidl/CryptoPlugin.cpp
+++ b/drm/mediadrm/plugins/clearkey/aidl/CryptoPlugin.cpp
@@ -227,7 +227,7 @@
}
SharedBufferBase::~SharedBufferBase() {
- if (munmap(mBase, mSize)) {
+ if (mBase && munmap(mBase, mSize)) {
ALOGE("munmap err: base %p; errno %s",
mBase, strerror(errno));
}
diff --git a/drm/mediadrm/plugins/clearkey/aidl/DrmFactory.cpp b/drm/mediadrm/plugins/clearkey/aidl/DrmFactory.cpp
index bef05ec..30db4c0 100644
--- a/drm/mediadrm/plugins/clearkey/aidl/DrmFactory.cpp
+++ b/drm/mediadrm/plugins/clearkey/aidl/DrmFactory.cpp
@@ -82,10 +82,12 @@
for (const auto& uuid : ::aidl::android::hardware::drm::clearkey::getSupportedCryptoSchemes()) {
schemes.uuids.push_back({uuid});
}
- schemes.minLevel = SecurityLevel::SW_SECURE_CRYPTO;
- schemes.maxLevel = SecurityLevel::SW_SECURE_CRYPTO;
- schemes.mimeTypes = {kIsoBmffVideoMimeType, kIsoBmffAudioMimeType, kCencInitDataFormat,
- kWebmVideoMimeType, kWebmAudioMimeType, kWebmInitDataFormat};
+ for (auto mime : {kIsoBmffVideoMimeType, kIsoBmffAudioMimeType, kCencInitDataFormat,
+ kWebmVideoMimeType, kWebmAudioMimeType, kWebmInitDataFormat}) {
+ const auto minLevel = SecurityLevel::SW_SECURE_CRYPTO;
+ const auto maxLevel = SecurityLevel::SW_SECURE_CRYPTO;
+ schemes.mimeTypes.push_back({mime, minLevel, maxLevel});
+ }
*_aidl_return = schemes;
return ndk::ScopedAStatus::ok();
}
diff --git a/media/bufferpool/2.0/tests/Android.bp b/media/bufferpool/2.0/tests/Android.bp
index 803a813..5e26e3a 100644
--- a/media/bufferpool/2.0/tests/Android.bp
+++ b/media/bufferpool/2.0/tests/Android.bp
@@ -80,3 +80,22 @@
],
compile_multilib: "both",
}
+
+cc_test {
+ name: "BufferpoolUnitTest",
+ test_suites: ["device-tests"],
+ defaults: ["VtsHalTargetTestDefaults"],
+ srcs: [
+ "allocator.cpp",
+ "BufferpoolUnitTest.cpp",
+ ],
+ static_libs: [
+ "android.hardware.media.bufferpool@2.0",
+ "libcutils",
+ "libstagefright_bufferpool@2.0.1",
+ ],
+ shared_libs: [
+ "libfmq",
+ ],
+ compile_multilib: "both",
+}
diff --git a/media/bufferpool/2.0/tests/AndroidTest.xml b/media/bufferpool/2.0/tests/AndroidTest.xml
new file mode 100644
index 0000000..b027ad0
--- /dev/null
+++ b/media/bufferpool/2.0/tests/AndroidTest.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Test module config for bufferpool unit tests">
+ <option name="test-suite-tag" value="BufferpoolUnitTest" />
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="BufferpoolUnitTest" />
+ </test>
+</configuration>
diff --git a/media/bufferpool/2.0/tests/BufferpoolUnitTest.cpp b/media/bufferpool/2.0/tests/BufferpoolUnitTest.cpp
new file mode 100644
index 0000000..b448405
--- /dev/null
+++ b/media/bufferpool/2.0/tests/BufferpoolUnitTest.cpp
@@ -0,0 +1,541 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "BufferpoolUnitTest"
+#include <utils/Log.h>
+
+#include <binder/ProcessState.h>
+#include <bufferpool/ClientManager.h>
+#include <gtest/gtest.h>
+#include <hidl/LegacySupport.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unordered_set>
+#include <vector>
+#include "allocator.h"
+
+using android::hardware::configureRpcThreadpool;
+using android::hardware::media::bufferpool::BufferPoolData;
+using android::hardware::media::bufferpool::V2_0::IClientManager;
+using android::hardware::media::bufferpool::V2_0::ResultStatus;
+using android::hardware::media::bufferpool::V2_0::implementation::BufferId;
+using android::hardware::media::bufferpool::V2_0::implementation::ClientManager;
+using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId;
+using android::hardware::media::bufferpool::V2_0::implementation::TransactionId;
+
+using namespace android;
+
+// communication message types between processes.
+enum PipeCommand : int32_t {
+ INIT,
+ TRANSFER,
+ STOP,
+
+ INIT_OK,
+ INIT_ERROR,
+ TRANSFER_OK,
+ TRANSFER_ERROR,
+ STOP_OK,
+ STOP_ERROR,
+};
+
+// communication message between processes.
+union PipeMessage {
+ struct {
+ int32_t command;
+ int32_t memsetValue;
+ BufferId bufferId;
+ ConnectionId connectionId;
+ TransactionId transactionId;
+ int64_t timestampUs;
+ } data;
+ char array[0];
+};
+
+static int32_t kNumIterationCount = 10;
+
+class BufferpoolTest {
+ public:
+ BufferpoolTest() : mConnectionValid(false), mManager(nullptr), mAllocator(nullptr) {
+ mConnectionId = -1;
+ mReceiverId = -1;
+ }
+
+ ~BufferpoolTest() {
+ if (mConnectionValid) {
+ mManager->close(mConnectionId);
+ }
+ }
+
+ protected:
+ bool mConnectionValid;
+ ConnectionId mConnectionId;
+ ConnectionId mReceiverId;
+
+ android::sp<ClientManager> mManager;
+ std::shared_ptr<BufferPoolAllocator> mAllocator;
+
+ void setupBufferpoolManager();
+};
+
+void BufferpoolTest::setupBufferpoolManager() {
+ // retrieving per process bufferpool object sp<ClientManager>
+ mManager = ClientManager::getInstance();
+ ASSERT_NE(mManager, nullptr) << "unable to get ClientManager\n";
+
+ mAllocator = std::make_shared<TestBufferPoolAllocator>();
+ ASSERT_NE(mAllocator, nullptr) << "unable to create TestBufferPoolAllocator\n";
+
+ // set-up local bufferpool connection for sender
+ ResultStatus status = mManager->create(mAllocator, &mConnectionId);
+ ASSERT_EQ(status, ResultStatus::OK)
+ << "unable to set-up local bufferpool connection for sender\n";
+ mConnectionValid = true;
+}
+
+class BufferpoolUnitTest : public BufferpoolTest, public ::testing::Test {
+ public:
+ virtual void SetUp() override { setupBufferpoolManager(); }
+
+ virtual void TearDown() override {}
+};
+
+class BufferpoolFunctionalityTest : public BufferpoolTest, public ::testing::Test {
+ public:
+ virtual void SetUp() override {
+ mReceiverPid = -1;
+
+ ASSERT_TRUE(pipe(mCommandPipeFds) == 0) << "pipe connection failed for commandPipe\n";
+ ASSERT_TRUE(pipe(mResultPipeFds) == 0) << "pipe connection failed for resultPipe\n";
+
+ mReceiverPid = fork();
+ ASSERT_TRUE(mReceiverPid >= 0) << "fork failed\n";
+
+ if (mReceiverPid == 0) {
+ doReceiver();
+ // In order to ignore gtest behaviour, wait for being killed from tearDown
+ pause();
+ }
+ setupBufferpoolManager();
+ }
+
+ virtual void TearDown() override {
+ if (mReceiverPid > 0) {
+ kill(mReceiverPid, SIGKILL);
+ int wstatus;
+ wait(&wstatus);
+ }
+ }
+
+ protected:
+ pid_t mReceiverPid;
+ int mCommandPipeFds[2];
+ int mResultPipeFds[2];
+
+ bool sendMessage(int* pipes, const PipeMessage& message) {
+ int ret = write(pipes[1], message.array, sizeof(PipeMessage));
+ return ret == sizeof(PipeMessage);
+ }
+
+ bool receiveMessage(int* pipes, PipeMessage* message) {
+ int ret = read(pipes[0], message->array, sizeof(PipeMessage));
+ return ret == sizeof(PipeMessage);
+ }
+
+ void doReceiver();
+};
+
+void BufferpoolFunctionalityTest::doReceiver() {
+ // Configures the threadpool used for handling incoming RPC calls in this process.
+ configureRpcThreadpool(1 /*threads*/, false /*willJoin*/);
+ bool receiverRunning = true;
+ while (receiverRunning) {
+ PipeMessage message;
+ receiveMessage(mCommandPipeFds, &message);
+ ResultStatus err = ResultStatus::OK;
+ switch (message.data.command) {
+ case PipeCommand::INIT: {
+ // receiver manager creation
+ mManager = ClientManager::getInstance();
+ if (!mManager) {
+ message.data.command = PipeCommand::INIT_ERROR;
+ sendMessage(mResultPipeFds, message);
+ return;
+ }
+
+ android::status_t status = mManager->registerAsService();
+ if (status != android::OK) {
+ message.data.command = PipeCommand::INIT_ERROR;
+ sendMessage(mResultPipeFds, message);
+ return;
+ }
+ message.data.command = PipeCommand::INIT_OK;
+ sendMessage(mResultPipeFds, message);
+ break;
+ }
+ case PipeCommand::TRANSFER: {
+ native_handle_t* receiveHandle = nullptr;
+ std::shared_ptr<BufferPoolData> receiveBuffer;
+ err = mManager->receive(message.data.connectionId, message.data.transactionId,
+ message.data.bufferId, message.data.timestampUs,
+ &receiveHandle, &receiveBuffer);
+ if (err != ResultStatus::OK) {
+ message.data.command = PipeCommand::TRANSFER_ERROR;
+ sendMessage(mResultPipeFds, message);
+ return;
+ }
+ if (!TestBufferPoolAllocator::Verify(receiveHandle, message.data.memsetValue)) {
+ message.data.command = PipeCommand::TRANSFER_ERROR;
+ sendMessage(mResultPipeFds, message);
+ return;
+ }
+ if (receiveHandle) {
+ native_handle_close(receiveHandle);
+ native_handle_delete(receiveHandle);
+ }
+ receiveHandle = nullptr;
+ receiveBuffer.reset();
+ message.data.command = PipeCommand::TRANSFER_OK;
+ sendMessage(mResultPipeFds, message);
+ break;
+ }
+ case PipeCommand::STOP: {
+ err = mManager->close(message.data.connectionId);
+ if (err != ResultStatus::OK) {
+ message.data.command = PipeCommand::STOP_ERROR;
+ sendMessage(mResultPipeFds, message);
+ return;
+ }
+ message.data.command = PipeCommand::STOP_OK;
+ sendMessage(mResultPipeFds, message);
+ receiverRunning = false;
+ break;
+ }
+ default:
+ ALOGE("unknown command. try again");
+ break;
+ }
+ }
+}
+
+// Buffer allocation test.
+// Check whether each buffer allocation is done successfully with unique buffer id.
+TEST_F(BufferpoolUnitTest, AllocateBuffer) {
+ std::vector<uint8_t> vecParams;
+ getTestAllocatorParams(&vecParams);
+
+ std::vector<std::shared_ptr<BufferPoolData>> buffers{};
+ std::vector<native_handle_t*> allocHandle{};
+ ResultStatus status;
+ for (int i = 0; i < kNumIterationCount; ++i) {
+ native_handle_t* handle = nullptr;
+ std::shared_ptr<BufferPoolData> buffer{};
+ status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer);
+ ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration";
+
+ buffers.push_back(std::move(buffer));
+ if (handle) {
+ allocHandle.push_back(std::move(handle));
+ }
+ }
+
+ for (int i = 0; i < kNumIterationCount; ++i) {
+ for (int j = i + 1; j < kNumIterationCount; ++j) {
+ ASSERT_TRUE(buffers[i]->mId != buffers[j]->mId) << "allocated buffers are not unique";
+ }
+ }
+ // delete the buffer handles
+ for (auto handle : allocHandle) {
+ native_handle_close(handle);
+ native_handle_delete(handle);
+ }
+ // clear the vectors
+ buffers.clear();
+ allocHandle.clear();
+}
+
+// Buffer recycle test.
+// Check whether de-allocated buffers are recycled.
+TEST_F(BufferpoolUnitTest, RecycleBuffer) {
+ std::vector<uint8_t> vecParams;
+ getTestAllocatorParams(&vecParams);
+
+ ResultStatus status;
+ std::vector<BufferId> bid{};
+ std::vector<native_handle_t*> allocHandle{};
+ for (int i = 0; i < kNumIterationCount; ++i) {
+ native_handle_t* handle = nullptr;
+ std::shared_ptr<BufferPoolData> buffer;
+ status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer);
+ ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration";
+
+ bid.push_back(buffer->mId);
+ if (handle) {
+ allocHandle.push_back(std::move(handle));
+ }
+ buffer.reset();
+ }
+
+ std::unordered_set<BufferId> set(bid.begin(), bid.end());
+ ASSERT_EQ(set.size(), 1) << "buffers are not recycled properly";
+
+ // delete the buffer handles
+ for (auto handle : allocHandle) {
+ native_handle_close(handle);
+ native_handle_delete(handle);
+ }
+ allocHandle.clear();
+}
+
+// Validate cache evict and invalidate APIs.
+TEST_F(BufferpoolUnitTest, FlushTest) {
+ std::vector<uint8_t> vecParams;
+ getTestAllocatorParams(&vecParams);
+
+ ResultStatus status = mManager->registerSender(mManager, mConnectionId, &mReceiverId);
+ ASSERT_TRUE(status == ResultStatus::ALREADY_EXISTS && mReceiverId == mConnectionId);
+
+ // testing empty flush
+ status = mManager->flush(mConnectionId);
+ ASSERT_EQ(status, ResultStatus::OK) << "failed to flush connection : " << mConnectionId;
+
+ std::vector<std::shared_ptr<BufferPoolData>> senderBuffer{};
+ std::vector<native_handle_t*> allocHandle{};
+ std::vector<TransactionId> tid{};
+ std::vector<int64_t> timestampUs{};
+
+ std::map<TransactionId, BufferId> bufferMap{};
+
+ for (int i = 0; i < kNumIterationCount; i++) {
+ int64_t postUs;
+ TransactionId transactionId;
+ native_handle_t* handle = nullptr;
+ std::shared_ptr<BufferPoolData> buffer{};
+ status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer);
+ ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << " iteration";
+
+ ASSERT_TRUE(TestBufferPoolAllocator::Fill(handle, i));
+
+ status = mManager->postSend(mReceiverId, buffer, &transactionId, &postUs);
+ ASSERT_EQ(status, ResultStatus::OK) << "unable to post send transaction on bufferpool";
+
+ timestampUs.push_back(postUs);
+ tid.push_back(transactionId);
+ bufferMap.insert({transactionId, buffer->mId});
+
+ senderBuffer.push_back(std::move(buffer));
+ if (handle) {
+ allocHandle.push_back(std::move(handle));
+ }
+ buffer.reset();
+ }
+
+ status = mManager->flush(mConnectionId);
+ ASSERT_EQ(status, ResultStatus::OK) << "failed to flush connection : " << mConnectionId;
+
+ std::shared_ptr<BufferPoolData> receiverBuffer{};
+ native_handle_t* recvHandle = nullptr;
+ for (int i = 0; i < kNumIterationCount; i++) {
+ status = mManager->receive(mReceiverId, tid[i], senderBuffer[i]->mId, timestampUs[i],
+ &recvHandle, &receiverBuffer);
+ ASSERT_EQ(status, ResultStatus::OK) << "receive failed for buffer " << senderBuffer[i]->mId;
+
+ // find the buffer id from transaction id
+ auto findIt = bufferMap.find(tid[i]);
+ ASSERT_NE(findIt, bufferMap.end()) << "inconsistent buffer mapping";
+
+ // buffer id received must be same as the buffer id sent
+ ASSERT_EQ(findIt->second, receiverBuffer->mId) << "invalid buffer received";
+
+ ASSERT_TRUE(TestBufferPoolAllocator::Verify(recvHandle, i))
+ << "Message received not same as that sent";
+
+ bufferMap.erase(findIt);
+ if (recvHandle) {
+ native_handle_close(recvHandle);
+ native_handle_delete(recvHandle);
+ }
+ recvHandle = nullptr;
+ receiverBuffer.reset();
+ }
+
+ ASSERT_EQ(bufferMap.size(), 0) << "buffers received is less than the number of buffers sent";
+
+ for (auto handle : allocHandle) {
+ native_handle_close(handle);
+ native_handle_delete(handle);
+ }
+ allocHandle.clear();
+ senderBuffer.clear();
+ timestampUs.clear();
+}
+
+// Buffer transfer test between processes.
+TEST_F(BufferpoolFunctionalityTest, TransferBuffer) {
+ // initialize the receiver
+ PipeMessage message;
+ message.data.command = PipeCommand::INIT;
+ sendMessage(mCommandPipeFds, message);
+ ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n";
+ ASSERT_EQ(message.data.command, PipeCommand::INIT_OK) << "receiver init failed";
+
+ android::sp<IClientManager> receiver = IClientManager::getService();
+ ASSERT_NE(receiver, nullptr) << "getService failed for receiver\n";
+
+ ConnectionId receiverId;
+ ResultStatus status = mManager->registerSender(receiver, mConnectionId, &receiverId);
+ ASSERT_EQ(status, ResultStatus::OK)
+ << "registerSender failed for connection id " << mConnectionId << "\n";
+
+ std::vector<uint8_t> vecParams;
+ getTestAllocatorParams(&vecParams);
+
+ for (int i = 0; i < kNumIterationCount; ++i) {
+ native_handle_t* handle = nullptr;
+ std::shared_ptr<BufferPoolData> buffer;
+ status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer);
+ ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration";
+
+ ASSERT_TRUE(TestBufferPoolAllocator::Fill(handle, i))
+ << "Fill fail for buffer handle " << handle << "\n";
+
+ // send the buffer to the receiver
+ int64_t postUs;
+ TransactionId transactionId;
+ status = mManager->postSend(receiverId, buffer, &transactionId, &postUs);
+ ASSERT_EQ(status, ResultStatus::OK)
+ << "postSend failed for receiver " << receiverId << "\n";
+
+ // PipeMessage message;
+ message.data.command = PipeCommand::TRANSFER;
+ message.data.memsetValue = i;
+ message.data.bufferId = buffer->mId;
+ message.data.connectionId = receiverId;
+ message.data.transactionId = transactionId;
+ message.data.timestampUs = postUs;
+ sendMessage(mCommandPipeFds, message);
+ // delete buffer handle
+ if (handle) {
+ native_handle_close(handle);
+ native_handle_delete(handle);
+ }
+ ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n";
+ ASSERT_EQ(message.data.command, PipeCommand::TRANSFER_OK)
+ << "received error during buffer transfer\n";
+ }
+ message.data.command = PipeCommand::STOP;
+ sendMessage(mCommandPipeFds, message);
+ ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n";
+ ASSERT_EQ(message.data.command, PipeCommand::STOP_OK)
+ << "received error during buffer transfer\n";
+}
+
+/* Validate bufferpool for following corner cases:
+ 1. invalid connectionID
+ 2. invalid receiver
+ 3. when sender is not registered
+ 4. when connection is closed
+*/
+// TODO: Enable when the issue in b/212196495 is fixed
+TEST_F(BufferpoolFunctionalityTest, DISABLED_ValidityTest) {
+ std::vector<uint8_t> vecParams;
+ getTestAllocatorParams(&vecParams);
+
+ std::shared_ptr<BufferPoolData> senderBuffer;
+ native_handle_t* allocHandle = nullptr;
+
+ // call allocate() on a random connection id
+ ConnectionId randomId = rand();
+ ResultStatus status = mManager->allocate(randomId, vecParams, &allocHandle, &senderBuffer);
+ EXPECT_TRUE(status == ResultStatus::NOT_FOUND);
+
+ // initialize the receiver
+ PipeMessage message;
+ message.data.command = PipeCommand::INIT;
+ sendMessage(mCommandPipeFds, message);
+ ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n";
+ ASSERT_EQ(message.data.command, PipeCommand::INIT_OK) << "receiver init failed";
+
+ allocHandle = nullptr;
+ senderBuffer.reset();
+ status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &senderBuffer);
+
+ ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x77));
+
+ // send buffers w/o registering sender
+ int64_t postUs;
+ TransactionId transactionId;
+
+ // random receiver
+ status = mManager->postSend(randomId, senderBuffer, &transactionId, &postUs);
+ ASSERT_NE(status, ResultStatus::OK) << "bufferpool shouldn't allow send on random receiver";
+
+ // establish connection
+ android::sp<IClientManager> receiver = IClientManager::getService();
+ ASSERT_NE(receiver, nullptr) << "getService failed for receiver\n";
+
+ ConnectionId receiverId;
+ status = mManager->registerSender(receiver, mConnectionId, &receiverId);
+ ASSERT_EQ(status, ResultStatus::OK)
+ << "registerSender failed for connection id " << mConnectionId << "\n";
+
+ allocHandle = nullptr;
+ senderBuffer.reset();
+ status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &senderBuffer);
+ ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for connection " << mConnectionId;
+
+ ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x88));
+
+ // send the buffer to the receiver
+ status = mManager->postSend(receiverId, senderBuffer, &transactionId, &postUs);
+ ASSERT_EQ(status, ResultStatus::OK) << "postSend failed for receiver " << receiverId << "\n";
+
+ // PipeMessage message;
+ message.data.command = PipeCommand::TRANSFER;
+ message.data.memsetValue = 0x88;
+ message.data.bufferId = senderBuffer->mId;
+ message.data.connectionId = receiverId;
+ message.data.transactionId = transactionId;
+ message.data.timestampUs = postUs;
+ sendMessage(mCommandPipeFds, message);
+ ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n";
+ ASSERT_EQ(message.data.command, PipeCommand::TRANSFER_OK)
+ << "received error during buffer transfer\n";
+
+ if (allocHandle) {
+ native_handle_close(allocHandle);
+ native_handle_delete(allocHandle);
+ }
+
+ message.data.command = PipeCommand::STOP;
+ sendMessage(mCommandPipeFds, message);
+ ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n";
+ ASSERT_EQ(message.data.command, PipeCommand::STOP_OK)
+ << "received error during buffer transfer\n";
+
+ // try to send msg to closed connection
+ status = mManager->postSend(receiverId, senderBuffer, &transactionId, &postUs);
+ ASSERT_NE(status, ResultStatus::OK) << "bufferpool shouldn't allow send on closed connection";
+}
+
+int main(int argc, char** argv) {
+ android::hardware::details::setTrebleTestingOverride(true);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGV("Test result = %d\n", status);
+ return status;
+}
diff --git a/media/bufferpool/2.0/tests/README.md b/media/bufferpool/2.0/tests/README.md
new file mode 100644
index 0000000..5efd966
--- /dev/null
+++ b/media/bufferpool/2.0/tests/README.md
@@ -0,0 +1,33 @@
+## Media Testing ##
+---
+#### Bufferpool :
+The Bufferpool Test Suite validates bufferpool library in android.
+
+Run the following steps to build the test suite:
+```
+m BufferpoolUnitTest
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+To test 64-bit binary push binaries from nativetest64.
+```
+adb push ${OUT}/data/nativetest64/BufferpoolUnitTest/BufferpoolUnitTest /data/local/tmp/
+```
+
+To test 32-bit binary push binaries from nativetest.
+```
+adb push ${OUT}/data/nativetest/BufferpoolUnitTest/BufferpoolUnitTest /data/local/tmp/
+```
+
+usage: BufferpoolUnitTest
+```
+adb shell /data/local/tmp/BufferpoolUnitTest
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest BufferpoolUnitTest
+```
diff --git a/media/codec2/TEST_MAPPING b/media/codec2/TEST_MAPPING
index f477f1c..90bb054 100644
--- a/media/codec2/TEST_MAPPING
+++ b/media/codec2/TEST_MAPPING
@@ -8,7 +8,7 @@
],
"presubmit-large": [
{
- "name": "CtsMediaTestCases",
+ "name": "CtsMediaMiscTestCases",
"options": [
{
"include-annotation": "android.platform.test.annotations.Presubmit"
diff --git a/media/codec2/vndk/C2AllocatorGralloc.cpp b/media/codec2/vndk/C2AllocatorGralloc.cpp
index b5200a5..d8d6f06 100644
--- a/media/codec2/vndk/C2AllocatorGralloc.cpp
+++ b/media/codec2/vndk/C2AllocatorGralloc.cpp
@@ -265,6 +265,7 @@
for (const PlaneLayoutComponent &component : plane.components) {
if (!gralloc4::isStandardPlaneLayoutComponentType(component.type)) {
+ mapper.unlock(handle);
return C2_CANNOT_DO;
}
@@ -287,6 +288,7 @@
channel = C2PlaneInfo::CHANNEL_CR;
break;
default:
+ mapper.unlock(handle);
return C2_CORRUPTED;
}
diff --git a/media/extractors/mp4/MPEG4Extractor.cpp b/media/extractors/mp4/MPEG4Extractor.cpp
index fb935b6..e0cc5bf 100644
--- a/media/extractors/mp4/MPEG4Extractor.cpp
+++ b/media/extractors/mp4/MPEG4Extractor.cpp
@@ -3501,7 +3501,7 @@
}
unsigned mask = br.getBits(8);
for (unsigned i = 0; i < 8; i++) {
- if (((0x1 << i) && mask) == 0)
+ if (((0x1 << i) & mask) == 0)
continue;
if (br.numBitsLeft() < 8) {
diff --git a/media/libaaudio/src/utility/AAudioUtilities.cpp b/media/libaaudio/src/utility/AAudioUtilities.cpp
index a0952fe..4b42203 100644
--- a/media/libaaudio/src/utility/AAudioUtilities.cpp
+++ b/media/libaaudio/src/utility/AAudioUtilities.cpp
@@ -560,9 +560,10 @@
}
int32_t AAudioProperty_getMinimumSleepMicros() {
- const int32_t minMicros = 20; // arbitrary
- const int32_t defaultMicros = 200; // arbitrary
- const int32_t maxMicros = 2000; // arbitrary
+ const int32_t minMicros = 1; // arbitrary
+ // Higher values can increase latency for moderate workloads.
+ const int32_t defaultMicros = 1; // arbitrary
+ const int32_t maxMicros = 200; // arbitrary
int32_t prop = property_get_int32(AAUDIO_PROP_MINIMUM_SLEEP_USEC, defaultMicros);
if (prop < minMicros) {
ALOGW("AAudioProperty_getMinimumSleepMicros: clipped %d to %d", prop, minMicros);
diff --git a/media/libaudioclient/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
index a5fb394..0871365 100644
--- a/media/libaudioclient/AudioRecord.cpp
+++ b/media/libaudioclient/AudioRecord.cpp
@@ -307,6 +307,8 @@
int32_t maxSharedAudioHistoryMs)
{
status_t status = NO_ERROR;
+ LOG_ALWAYS_FATAL_IF(mInitialized, "%s: should not be called twice", __func__);
+ mInitialized = true;
// Note mPortId is not valid until the track is created, so omit mPortId in ALOG for set.
ALOGV("%s(): inputSource %d, sampleRate %u, format %#x, channelMask %#x, frameCount %zu, "
"notificationFrames %u, sessionId %d, transferType %d, flags %#x, attributionSource %s"
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index 32c77c7..dd729c4 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -1270,7 +1270,8 @@
}
status_t AudioSystem::getDevicesForAttributes(const AudioAttributes& aa,
- AudioDeviceTypeAddrVector* devices) {
+ AudioDeviceTypeAddrVector* devices,
+ bool forVolume) {
if (devices == nullptr) {
return BAD_VALUE;
}
@@ -1281,7 +1282,7 @@
legacy2aidl_AudioAttributes_AudioAttributesEx(aa));
std::vector<AudioDevice> retAidl;
RETURN_STATUS_IF_ERROR(
- statusTFromBinderStatus(aps->getDevicesForAttributes(aaAidl, &retAidl)));
+ statusTFromBinderStatus(aps->getDevicesForAttributes(aaAidl, forVolume, &retAidl)));
*devices = VALUE_OR_RETURN_STATUS(
convertContainer<AudioDeviceTypeAddrVector>(
retAidl,
@@ -1497,13 +1498,12 @@
if (port == nullptr) {
return BAD_VALUE;
}
-
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) return PERMISSION_DENIED;
- media::AudioPort portAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_port_v7_AudioPort(*port));
+ media::AudioPort portAidl;
RETURN_STATUS_IF_ERROR(
- statusTFromBinderStatus(aps->getAudioPort(portAidl, &portAidl)));
+ statusTFromBinderStatus(aps->getAudioPort(port->id, &portAidl)));
*port = VALUE_OR_RETURN_STATUS(aidl2legacy_AudioPort_audio_port_v7(portAidl));
return OK;
}
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index bceca2d..58c4a07 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -277,10 +277,12 @@
{
mAttributes = AUDIO_ATTRIBUTES_INITIALIZER;
- (void)set(streamType, sampleRate, format, channelMask,
- frameCount, flags, callback, notificationFrames,
- 0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId, transferType, offloadInfo,
- attributionSource, pAttributes, doNotReconnect, maxRequiredSpeed, selectedDeviceId);
+ // make_unique does not aggregate init until c++20
+ mSetParams = std::unique_ptr<SetParams>{
+ new SetParams{streamType, sampleRate, format, channelMask, frameCount, flags, callback,
+ notificationFrames, 0 /*sharedBuffer*/, false /*threadCanCallJava*/,
+ sessionId, transferType, offloadInfo, attributionSource, pAttributes,
+ doNotReconnect, maxRequiredSpeed, selectedDeviceId}};
}
namespace {
@@ -355,10 +357,11 @@
} else if (user) {
LOG_ALWAYS_FATAL("Callback data provided without callback pointer!");
}
- (void)set(streamType, sampleRate, format, channelMask,
- frameCount, flags, mLegacyCallbackWrapper, notificationFrames,
- 0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId, transferType, offloadInfo,
- attributionSource, pAttributes, doNotReconnect, maxRequiredSpeed, selectedDeviceId);
+ mSetParams = std::unique_ptr<SetParams>{new SetParams{
+ streamType, sampleRate, format, channelMask, frameCount, flags, mLegacyCallbackWrapper,
+ notificationFrames, 0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId,
+ transferType, offloadInfo, attributionSource, pAttributes, doNotReconnect,
+ maxRequiredSpeed, selectedDeviceId}};
}
AudioTrack::AudioTrack(
@@ -387,10 +390,11 @@
{
mAttributes = AUDIO_ATTRIBUTES_INITIALIZER;
- (void)set(streamType, sampleRate, format, channelMask,
- 0 /*frameCount*/, flags, callback, notificationFrames,
- sharedBuffer, false /*threadCanCallJava*/, sessionId, transferType, offloadInfo,
- attributionSource, pAttributes, doNotReconnect, maxRequiredSpeed);
+ mSetParams = std::unique_ptr<SetParams>{
+ new SetParams{streamType, sampleRate, format, channelMask, 0 /*frameCount*/, flags,
+ callback, notificationFrames, sharedBuffer, false /*threadCanCallJava*/,
+ sessionId, transferType, offloadInfo, attributionSource, pAttributes,
+ doNotReconnect, maxRequiredSpeed, AUDIO_PORT_HANDLE_NONE}};
}
AudioTrack::AudioTrack(
@@ -424,11 +428,18 @@
} else if (user) {
LOG_ALWAYS_FATAL("Callback data provided without callback pointer!");
}
+ mSetParams = std::unique_ptr<SetParams>{new SetParams{
+ streamType, sampleRate, format, channelMask, 0 /*frameCount*/, flags,
+ mLegacyCallbackWrapper, notificationFrames, sharedBuffer, false /*threadCanCallJava*/,
+ sessionId, transferType, offloadInfo, attributionSource, pAttributes, doNotReconnect,
+ maxRequiredSpeed, AUDIO_PORT_HANDLE_NONE}};
+}
- (void)set(streamType, sampleRate, format, channelMask, 0 /*frameCount*/, flags,
- mLegacyCallbackWrapper, notificationFrames, sharedBuffer,
- false /*threadCanCallJava*/, sessionId, transferType, offloadInfo, attributionSource,
- pAttributes, doNotReconnect, maxRequiredSpeed);
+void AudioTrack::onFirstRef() {
+ if (mSetParams) {
+ set(*mSetParams);
+ mSetParams.reset();
+ }
}
AudioTrack::~AudioTrack()
diff --git a/media/libaudioclient/aidl/android/media/IAudioPolicyService.aidl b/media/libaudioclient/aidl/android/media/IAudioPolicyService.aidl
index de0f75b..748a10b 100644
--- a/media/libaudioclient/aidl/android/media/IAudioPolicyService.aidl
+++ b/media/libaudioclient/aidl/android/media/IAudioPolicyService.aidl
@@ -139,7 +139,7 @@
AudioDeviceDescription[] getDevicesForStream(AudioStreamType stream);
- AudioDevice[] getDevicesForAttributes(in AudioAttributesEx attr);
+ AudioDevice[] getDevicesForAttributes(in AudioAttributesEx attr, boolean forVolume);
int /* audio_io_handle_t */ getOutputForEffect(in EffectDescriptor desc);
@@ -216,8 +216,8 @@
inout Int count,
out AudioPort[] ports);
- /** Get attributes for a given audio port. */
- AudioPort getAudioPort(in AudioPort port);
+ /** Get attributes for the audio port with the given id (AudioPort.hal.id field). */
+ AudioPort getAudioPort(int /* audio_port_handle_t */ portId);
/**
* Create an audio patch between several source and sink ports.
diff --git a/media/libaudioclient/include/media/AudioRecord.h b/media/libaudioclient/include/media/AudioRecord.h
index faea716..cb05dd9 100644
--- a/media/libaudioclient/include/media/AudioRecord.h
+++ b/media/libaudioclient/include/media/AudioRecord.h
@@ -740,6 +740,7 @@
wp<IAudioRecordCallback> mCallback;
sp<IAudioRecordCallback> mLegacyCallbackWrapper;
+ bool mInitialized = false; // Protect against double set
// for notification APIs
uint32_t mNotificationFramesReq; // requested number of frames between each
// notification callback
diff --git a/media/libaudioclient/include/media/AudioSystem.h b/media/libaudioclient/include/media/AudioSystem.h
index baefee3..f1fcd3f 100644
--- a/media/libaudioclient/include/media/AudioSystem.h
+++ b/media/libaudioclient/include/media/AudioSystem.h
@@ -330,7 +330,8 @@
static product_strategy_t getStrategyForStream(audio_stream_type_t stream);
static DeviceTypeSet getDevicesForStream(audio_stream_type_t stream);
static status_t getDevicesForAttributes(const AudioAttributes &aa,
- AudioDeviceTypeAddrVector *devices);
+ AudioDeviceTypeAddrVector *devices,
+ bool forVolume);
static audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc);
static status_t registerEffect(const effect_descriptor_t *desc,
@@ -374,7 +375,8 @@
struct audio_port_v7 *ports,
unsigned int *generation);
- /* Get attributes for a given audio port */
+ /* Get attributes for a given audio port. On input, the port
+ * only needs the 'id' field to be filled in. */
static status_t getAudioPort(struct audio_port_v7 *port);
/* Create an audio patch between several source and sink ports */
diff --git a/media/libaudioclient/include/media/AudioTrack.h b/media/libaudioclient/include/media/AudioTrack.h
index 1708cc7..1cf6ef9 100644
--- a/media/libaudioclient/include/media/AudioTrack.h
+++ b/media/libaudioclient/include/media/AudioTrack.h
@@ -458,6 +458,38 @@
float maxRequiredSpeed = 1.0f,
audio_port_handle_t selectedDeviceId = AUDIO_PORT_HANDLE_NONE);
+ struct SetParams {
+ audio_stream_type_t streamType;
+ uint32_t sampleRate;
+ audio_format_t format;
+ audio_channel_mask_t channelMask;
+ size_t frameCount;
+ audio_output_flags_t flags;
+ wp<IAudioTrackCallback> callback;
+ int32_t notificationFrames;
+ sp<IMemory> sharedBuffer;
+ bool threadCanCallJava;
+ audio_session_t sessionId;
+ transfer_type transferType;
+ // TODO don't take pointers here
+ const audio_offload_info_t *offloadInfo;
+ AttributionSourceState attributionSource;
+ const audio_attributes_t* pAttributes;
+ bool doNotReconnect;
+ float maxRequiredSpeed;
+ audio_port_handle_t selectedDeviceId;
+ };
+ private:
+ // Note: Consumes parameters
+ void set(SetParams& s) {
+ (void)set(s.streamType, s.sampleRate, s.format, s.channelMask, s.frameCount,
+ s.flags, std::move(s.callback), s.notificationFrames,
+ std::move(s.sharedBuffer), s.threadCanCallJava, s.sessionId,
+ s.transferType, s.offloadInfo, std::move(s.attributionSource),
+ s.pAttributes, s.doNotReconnect, s.maxRequiredSpeed, s.selectedDeviceId);
+ }
+ void onFirstRef() override;
+ public:
status_t set(audio_stream_type_t streamType,
uint32_t sampleRate,
audio_format_t format,
@@ -1349,6 +1381,8 @@
wp<IAudioTrackCallback> mCallback; // callback handler for events, or NULL
sp<IAudioTrackCallback> mLegacyCallbackWrapper; // wrapper for legacy callback interface
// for notification APIs
+ std::unique_ptr<SetParams> mSetParams; // Temporary copy of ctor params to allow for
+ // deferred set after first reference.
bool mInitialized = false; // Set after track is initialized
// next 2 fields are const after constructor or set()
diff --git a/media/libstagefright/TEST_MAPPING b/media/libstagefright/TEST_MAPPING
index 91a44d1..22885c9 100644
--- a/media/libstagefright/TEST_MAPPING
+++ b/media/libstagefright/TEST_MAPPING
@@ -13,7 +13,7 @@
"presubmit-large": [
{
- "name": "CtsMediaTestCases",
+ "name": "CtsMediaMiscTestCases",
"options": [
{
"include-annotation": "android.platform.test.annotations.Presubmit"
diff --git a/media/libstagefright/id3/TEST_MAPPING b/media/libstagefright/id3/TEST_MAPPING
index d82d26e..6106908 100644
--- a/media/libstagefright/id3/TEST_MAPPING
+++ b/media/libstagefright/id3/TEST_MAPPING
@@ -9,14 +9,15 @@
"presubmit-large": [
// this doesn't seem to run any tests.
- // but: cts-tradefed run -m CtsMediaTestCases -t android.media.cts.MediaMetadataRetrieverTest
+ // but: cts-tradefed run -m CtsMediaMiscTestCases -t \
+ // android.media.misc.cts.MediaMetadataRetrieverTest
// does run he 32 and 64 bit tests, but not the instant tests
// but all I know is that with 'atest', it's not running
{
- "name": "CtsMediaTestCases",
+ "name": "CtsMediaMiscTestCases",
"options": [
{
- "include-filter": "android.media.cts.MediaMetadataRetrieverTest"
+ "include-filter": "android.media.misc.cts.MediaMetadataRetrieverTest"
}
]
}
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index 5b2b87e..0ccc963 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -215,7 +215,8 @@
// retrieves the list of enabled output devices for the given audio attributes
virtual status_t getDevicesForAttributes(const audio_attributes_t &attr,
- AudioDeviceTypeAddrVector *devices) = 0;
+ AudioDeviceTypeAddrVector *devices,
+ bool forVolume) = 0;
// Audio effect management
virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc) = 0;
diff --git a/services/audiopolicy/TEST_MAPPING b/services/audiopolicy/TEST_MAPPING
index eb6c19e..9b4cc8a 100644
--- a/services/audiopolicy/TEST_MAPPING
+++ b/services/audiopolicy/TEST_MAPPING
@@ -2,6 +2,15 @@
"presubmit": [
{
"name": "audiopolicy_tests"
+ },
+ {
+ "name": "GtsGmscoreHostTestCases",
+ "keywords": ["primary-device"],
+ "options" : [
+ {
+ "include-filter": "com.google.android.gts.audio.AudioHostTest#testTwoChannelCapturing"
+ }
+ ]
}
]
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp
index 035bef2..1132a29 100644
--- a/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/ClientDescriptor.cpp
@@ -88,7 +88,8 @@
void RecordClientDescriptor::dump(String8 *dst, int spaces) const
{
ClientDescriptor::dump(dst, spaces);
- dst->appendFormat("%*sSource: %d; Flags: %08x\n", spaces, "", mSource, mFlags);
+ dst->appendFormat("%*sSource: %d; Flags: %08x; is soundtrigger: %d\n",
+ spaces, "", mSource, mFlags, mIsSoundTrigger);
mEnabledEffects.dump(dst, spaces + 2 /*spaces*/, false /*verbose*/);
}
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index e08ed2a..f981b26 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3706,7 +3706,7 @@
}
dst->appendFormat(" TTS output %savailable\n", mTtsOutputAvailable ? "" : "not ");
dst->appendFormat(" Master mono: %s\n", mMasterMono ? "on" : "off");
- dst->appendFormat(" Communnication Strategy: %d\n", mCommunnicationStrategy);
+ dst->appendFormat(" Communication Strategy id: %d\n", mCommunnicationStrategy);
dst->appendFormat(" Config source: %s\n", mConfig.getSource().c_str()); // getConfig not const
dst->append("\n");
@@ -3919,7 +3919,7 @@
status_t AudioPolicyManager::getDirectProfilesForAttributes(const audio_attributes_t* attr,
AudioProfileVector& audioProfilesVector) {
AudioDeviceTypeAddrVector devices;
- status_t status = getDevicesForAttributes(*attr, &devices);
+ status_t status = getDevicesForAttributes(*attr, &devices, false /* forVolume */);
if (status != OK) {
return status;
}
@@ -6472,24 +6472,69 @@
// TODO - consider MSD routes b/214971780
status_t AudioPolicyManager::getDevicesForAttributes(
- const audio_attributes_t &attr, AudioDeviceTypeAddrVector *devices) {
+ const audio_attributes_t &attr, AudioDeviceTypeAddrVector *devices, bool forVolume) {
if (devices == nullptr) {
return BAD_VALUE;
}
+
+ // Devices are determined in the following precedence:
+ //
+ // 1) Devices associated with a dynamic policy matching the attributes. This is often
+ // a remote submix from MIX_ROUTE_FLAG_LOOP_BACK.
+ //
+ // If no such dynamic policy then
+ // 2) Devices containing an active client using setPreferredDevice
+ // with same strategy as the attributes.
+ // (from the default Engine::getOutputDevicesForAttributes() implementation).
+ //
+ // If no corresponding active client with setPreferredDevice then
+ // 3) Devices associated with the strategy determined by the attributes
+ // (from the default Engine::getOutputDevicesForAttributes() implementation).
+ //
+ // See related getOutputForAttrInt().
+
// check dynamic policies but only for primary descriptors (secondary not used for audible
// audio routing, only used for duplication for playback capture)
sp<AudioPolicyMix> policyMix;
status_t status = mPolicyMixes.getOutputForAttr(attr, 0 /*uid unknown here*/,
- AUDIO_OUTPUT_FLAG_NONE, policyMix, nullptr);
+ AUDIO_OUTPUT_FLAG_NONE, policyMix, nullptr /* secondaryMixes */);
if (status != OK) {
return status;
}
- if (policyMix != nullptr && policyMix->getOutput() != nullptr) {
- AudioDeviceTypeAddr device(policyMix->mDeviceType, policyMix->mDeviceAddress.c_str());
- devices->push_back(device);
- return NO_ERROR;
+
+ DeviceVector curDevices;
+ if (policyMix != nullptr && policyMix->getOutput() != nullptr &&
+ // For volume control, skip LOOPBACK mixes which use AUDIO_DEVICE_OUT_REMOTE_SUBMIX
+ // as they are unaffected by device/stream volume
+ // (per SwAudioOutputDescriptor::isFixedVolume()).
+ (!forVolume || policyMix->mDeviceType != AUDIO_DEVICE_OUT_REMOTE_SUBMIX)
+ ) {
+ sp<DeviceDescriptor> deviceDesc = mAvailableOutputDevices.getDevice(
+ policyMix->mDeviceType, policyMix->mDeviceAddress, AUDIO_FORMAT_DEFAULT);
+ curDevices.add(deviceDesc);
+ } else {
+ // The default Engine::getOutputDevicesForAttributes() uses findPreferredDevice()
+ // which selects setPreferredDevice if active. This means forVolume call
+ // will take an active setPreferredDevice, if such exists.
+
+ curDevices = mEngine->getOutputDevicesForAttributes(
+ attr, nullptr /* preferredDevice */, false /* fromCache */);
}
- DeviceVector curDevices = mEngine->getOutputDevicesForAttributes(attr, nullptr, false);
+
+ if (forVolume) {
+ // We alias the device AUDIO_DEVICE_OUT_SPEAKER_SAFE to AUDIO_DEVICE_OUT_SPEAKER
+ // for single volume control in AudioService (such relationship should exist if
+ // SPEAKER_SAFE is present).
+ //
+ // (This is unrelated to a different device grouping as Volume::getDeviceCategory)
+ DeviceVector speakerSafeDevices =
+ curDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPEAKER_SAFE);
+ if (!speakerSafeDevices.isEmpty()) {
+ curDevices.merge(
+ mAvailableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPEAKER));
+ curDevices.remove(speakerSafeDevices);
+ }
+ }
for (const auto& device : curDevices) {
devices->push_back(device->getDeviceTypeAddr());
}
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index daa4faf..ac8b625 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -193,9 +193,37 @@
// return the enabled output devices for the given stream type
virtual DeviceTypeSet getDevicesForStream(audio_stream_type_t stream);
+ /**
+ * Returns a vector of devices associated with attributes.
+ *
+ * An AudioTrack opened with specified attributes should play on the returned devices.
+ * If forVolume is set to true, the caller is AudioService, determining the proper
+ * device volume to adjust.
+ *
+ * Devices are determined in the following precedence:
+ * 1) Devices associated with a dynamic policy matching the attributes. This is often
+ * a remote submix from MIX_ROUTE_FLAG_LOOP_BACK. Secondary mixes from a
+ * dynamic policy are not included.
+ *
+ * If no such dynamic policy then
+ * 2) Devices containing an active client using setPreferredDevice
+ * with same strategy as the attributes.
+ * (from the default Engine::getOutputDevicesForAttributes() implementation).
+ *
+ * If no corresponding active client with setPreferredDevice then
+ * 3) Devices associated with the strategy determined by the attributes
+ * (from the default Engine::getOutputDevicesForAttributes() implementation).
+ *
+ * @param attributes to be considered
+ * @param devices an AudioDeviceTypeAddrVector container passed in that
+ * will be filled on success.
+ * @param forVolume true if the devices are to be associated with current device volume.
+ * @return NO_ERROR on success.
+ */
virtual status_t getDevicesForAttributes(
const audio_attributes_t &attributes,
- AudioDeviceTypeAddrVector *devices);
+ AudioDeviceTypeAddrVector *devices,
+ bool forVolume);
virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc = NULL);
virtual status_t registerEffect(const effect_descriptor_t *desc,
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 04d023e..5637222 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -1188,6 +1188,7 @@
}
Status AudioPolicyService::getDevicesForAttributes(const media::AudioAttributesEx& attrAidl,
+ bool forVolume,
std::vector<AudioDevice>* _aidl_return)
{
AudioAttributes aa = VALUE_OR_RETURN_BINDER_STATUS(
@@ -1200,7 +1201,8 @@
Mutex::Autolock _l(mLock);
AutoCallerClear acc;
RETURN_IF_BINDER_ERROR(binderStatusFromStatusT(
- mAudioPolicyManager->getDevicesForAttributes(aa.getAttributes(), &devices)));
+ mAudioPolicyManager->getDevicesForAttributes(
+ aa.getAttributes(), &devices, forVolume)));
*_aidl_return = VALUE_OR_RETURN_BINDER_STATUS(
convertContainer<std::vector<AudioDevice>>(devices,
legacy2aidl_AudioDeviceTypeAddress));
@@ -1571,12 +1573,9 @@
return Status::ok();
}
-Status AudioPolicyService::getAudioPort(const media::AudioPort& portAidl,
+Status AudioPolicyService::getAudioPort(int portId,
media::AudioPort* _aidl_return) {
- audio_port_v7 port = VALUE_OR_RETURN_BINDER_STATUS(
- aidl2legacy_AudioPort_audio_port_v7(portAidl));
- RETURN_IF_BINDER_ERROR(binderStatusFromStatusT(AudioValidator::validateAudioPort(port)));
-
+ audio_port_v7 port{ .id = portId };
Mutex::Autolock _l(mLock);
if (mAudioPolicyManager == NULL) {
return binderStatusFromStatusT(NO_INIT);
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index 443b9f7..26b83ba 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -609,18 +609,23 @@
char buffer[SIZE];
String8 result;
- snprintf(buffer, SIZE, "AudioPolicyManager: %p\n", mAudioPolicyManager);
+ snprintf(buffer, SIZE, "Supported System Usages:\n ");
result.append(buffer);
- snprintf(buffer, SIZE, "Command Thread: %p\n", mAudioCommandThread.get());
- result.append(buffer);
-
- snprintf(buffer, SIZE, "Supported System Usages:\n");
- result.append(buffer);
- for (std::vector<audio_usage_t>::iterator it = mSupportedSystemUsages.begin();
- it != mSupportedSystemUsages.end(); ++it) {
- snprintf(buffer, SIZE, "\t%d\n", *it);
- result.append(buffer);
+ std::stringstream msg;
+ size_t i = 0;
+ for (auto usage : mSupportedSystemUsages) {
+ if (i++ != 0) msg << ", ";
+ if (const char* strUsage = audio_usage_to_string(usage); strUsage) {
+ msg << strUsage;
+ } else {
+ msg << usage << " (unknown)";
+ }
}
+ if (i == 0) {
+ msg << "None";
+ }
+ msg << std::endl;
+ result.append(msg.str().c_str());
write(fd, result.string(), result.size());
@@ -1033,12 +1038,24 @@
}
dumpInternals(fd);
+
+ String8 actPtr = String8::format("AudioCommandThread: %p\n", mAudioCommandThread.get());
+ write(fd, actPtr.string(), actPtr.size());
if (mAudioCommandThread != 0) {
mAudioCommandThread->dump(fd);
}
+ String8 octPtr = String8::format("OutputCommandThread: %p\n", mOutputCommandThread.get());
+ write(fd, octPtr.string(), octPtr.size());
+ if (mOutputCommandThread != 0) {
+ mOutputCommandThread->dump(fd);
+ }
+
if (mAudioPolicyManager) {
mAudioPolicyManager->dump(fd);
+ } else {
+ String8 apmPtr = String8::format("AudioPolicyManager: %p\n", mAudioPolicyManager);
+ write(fd, apmPtr.string(), apmPtr.size());
}
mPackageManager.dump(fd);
@@ -2040,10 +2057,6 @@
char buffer[SIZE];
String8 result;
- snprintf(buffer, SIZE, "AudioCommandThread %p Dump\n", this);
- result.append(buffer);
- write(fd, result.string(), result.size());
-
const bool locked = dumpTryLock(mLock);
if (!locked) {
String8 result2(kCmdDeadlockedString);
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h
index d3e0453..1637918 100644
--- a/services/audiopolicy/service/AudioPolicyService.h
+++ b/services/audiopolicy/service/AudioPolicyService.h
@@ -138,6 +138,7 @@
AudioStreamType stream,
std::vector<AudioDeviceDescription>* _aidl_return) override;
binder::Status getDevicesForAttributes(const media::AudioAttributesEx& attr,
+ bool forVolume,
std::vector<AudioDevice>* _aidl_return) override;
binder::Status getOutputForEffect(const media::EffectDescriptor& desc,
int32_t* _aidl_return) override;
@@ -176,7 +177,7 @@
binder::Status listAudioPorts(media::AudioPortRole role, media::AudioPortType type,
Int* count, std::vector<media::AudioPort>* ports,
int32_t* _aidl_return) override;
- binder::Status getAudioPort(const media::AudioPort& port,
+ binder::Status getAudioPort(int portId,
media::AudioPort* _aidl_return) override;
binder::Status createAudioPatch(const media::AudioPatch& patch, int32_t handle,
int32_t* _aidl_return) override;
diff --git a/services/audiopolicy/service/SpatializerPoseController.cpp b/services/audiopolicy/service/SpatializerPoseController.cpp
index 6a3c9d1..58a57ac 100644
--- a/services/audiopolicy/service/SpatializerPoseController.cpp
+++ b/services/audiopolicy/service/SpatializerPoseController.cpp
@@ -57,7 +57,7 @@
constexpr float kAutoRecenterTranslationThreshold = 0.1f;
// Auto-recenter considers head not still if rotated by this much (in radians, approx).
-constexpr float kAutoRecenterRotationThreshold = 7.0f / 180 * M_PI;
+constexpr float kAutoRecenterRotationThreshold = 10.5f / 180 * M_PI;
// Screen is considered to be unstable (not still) if it has moved significantly within the last
// time window of this duration.
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
index b61bc09..69300be 100644
--- a/services/camera/libcameraservice/Android.bp
+++ b/services/camera/libcameraservice/Android.bp
@@ -105,6 +105,8 @@
],
header_libs: [
+ "libdynamic_depth-internal_headers",
+ "libdynamic_depth-public_headers",
"libmediadrm_headers",
"libmediametrics_headers",
],
@@ -185,8 +187,6 @@
include_dirs: [
"system/media/private/camera/include",
"frameworks/native/include/media/openmax",
- "external/dynamic_depth/includes",
- "external/dynamic_depth/internal",
],
export_include_dirs: ["."],
@@ -216,6 +216,11 @@
"utils/SessionConfigurationUtilsHost.cpp",
],
+ header_libs: [
+ "libdynamic_depth-internal_headers",
+ "libdynamic_depth-public_headers",
+ ],
+
shared_libs: [
"libbase",
"libbinder",
@@ -229,8 +234,6 @@
],
include_dirs: [
- "external/dynamic_depth/includes",
- "external/dynamic_depth/internal",
"frameworks/av/camera/include",
"frameworks/av/camera/include/camera",
],
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index 1020c13..bcba80e 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -152,19 +152,20 @@
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT);
if (it != entry.data.u8 + entry.count) {
entry = deviceInfo.find(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP);
- if (entry.count > 0 || ((entry.count % 2) != 0)) {
- int standardBitmap = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
- for (size_t i = 0; i < entry.count; i += 2) {
- if (entry.data.i32[i] !=
+ if (entry.count > 0 || ((entry.count % 3) != 0)) {
+ int64_t standardBitmap =
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD;
+ for (size_t i = 0; i < entry.count; i += 3) {
+ if (entry.data.i64[i] !=
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD) {
- mDynamicProfileMap.emplace(entry.data.i32[i], entry.data.i32[i+1]);
- if ((entry.data.i32[i+1] == 0) || (entry.data.i32[i+1] &
+ mDynamicProfileMap.emplace(entry.data.i64[i], entry.data.i64[i+1]);
+ if ((entry.data.i64[i+1] == 0) || (entry.data.i64[i+1] &
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD)) {
- standardBitmap |= entry.data.i32[i];
+ standardBitmap |= entry.data.i64[i];
}
} else {
- ALOGE("%s: Device %s includes unexpected profile entry: 0x%x!",
- __FUNCTION__, mCameraIdStr.c_str(), entry.data.i32[i]);
+ ALOGE("%s: Device %s includes unexpected profile entry: 0x%" PRIx64 "!",
+ __FUNCTION__, mCameraIdStr.c_str(), entry.data.i64[i]);
}
}
mDynamicProfileMap.emplace(
@@ -335,7 +336,7 @@
SurfaceMap surfaceMap;
Vector<int32_t> outputStreamIds;
std::vector<std::string> requestedPhysicalIds;
- int dynamicProfileBitmap = 0;
+ int64_t dynamicProfileBitmap = 0;
if (request.mSurfaceList.size() > 0) {
for (const sp<Surface>& surface : request.mSurfaceList) {
if (surface == 0) continue;
@@ -410,7 +411,7 @@
} else {
ALOGE("%s: Camera %s: Tried to submit a request with a surfaces that"
" reference an unsupported dynamic range profile combination"
- " 0x%x!", __FUNCTION__, mCameraIdStr.string(),
+ " 0x%" PRIx64 "!", __FUNCTION__, mCameraIdStr.string(),
dynamicProfileBitmap);
return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT,
"Request targets an unsupported dynamic range profile"
@@ -862,7 +863,7 @@
String8 physicalCameraId = String8(outputConfiguration.getPhysicalCameraId());
bool deferredConsumerOnly = deferredConsumer && numBufferProducers == 0;
bool isMultiResolution = outputConfiguration.isMultiResolution();
- int dynamicRangeProfile = outputConfiguration.getDynamicRangeProfile();
+ int64_t dynamicRangeProfile = outputConfiguration.getDynamicRangeProfile();
int streamUseCase = outputConfiguration.getStreamUseCase();
int timestampBase = outputConfiguration.getTimestampBase();
int mirrorMode = outputConfiguration.getMirrorMode();
@@ -1261,7 +1262,7 @@
outputConfiguration.getSensorPixelModesUsed();
int streamUseCase = outputConfiguration.getStreamUseCase();
int timestampBase = outputConfiguration.getTimestampBase();
- int dynamicRangeProfile = outputConfiguration.getDynamicRangeProfile();
+ int64_t dynamicRangeProfile = outputConfiguration.getDynamicRangeProfile();
int mirrorMode = outputConfiguration.getMirrorMode();
for (size_t i = 0; i < newOutputsMap.size(); i++) {
@@ -1627,7 +1628,7 @@
std::vector<sp<Surface>> consumerSurfaces;
const std::vector<int32_t> &sensorPixelModesUsed =
outputConfiguration.getSensorPixelModesUsed();
- int dynamicRangeProfile = outputConfiguration.getDynamicRangeProfile();
+ int64_t dynamicRangeProfile = outputConfiguration.getDynamicRangeProfile();
int streamUseCase= outputConfiguration.getStreamUseCase();
int timestampBase = outputConfiguration.getTimestampBase();
int mirrorMode = outputConfiguration.getMirrorMode();
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h
index 6675e24..9d1deb1 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.h
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h
@@ -308,7 +308,7 @@
// Dynamic range profile id -> Supported dynamic profiles bitmap within an single capture
// request
- std::unordered_map<int, int> mDynamicProfileMap;
+ std::unordered_map<int64_t, int64_t> mDynamicProfileMap;
struct InputStreamConfiguration {
bool configured;
diff --git a/services/camera/libcameraservice/common/CameraDeviceBase.h b/services/camera/libcameraservice/common/CameraDeviceBase.h
index bde0693..5883988 100644
--- a/services/camera/libcameraservice/common/CameraDeviceBase.h
+++ b/services/camera/libcameraservice/common/CameraDeviceBase.h
@@ -183,7 +183,7 @@
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
bool isShared = false, bool isMultiResolution = false,
uint64_t consumerUsage = 0,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
int mirrorMode = OutputConfiguration::MIRROR_MODE_AUTO) = 0;
@@ -204,7 +204,7 @@
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
bool isShared = false, bool isMultiResolution = false,
uint64_t consumerUsage = 0,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
int mirrorMode = OutputConfiguration::MIRROR_MODE_AUTO) = 0;
@@ -228,7 +228,7 @@
android_dataspace dataSpace;
bool dataSpaceOverridden;
android_dataspace originalDataSpace;
- uint32_t dynamicRangeProfile;
+ int64_t dynamicRangeProfile;
StreamInfo() : width(0), height(0), format(0), formatOverridden(false), originalFormat(0),
dataSpace(HAL_DATASPACE_UNKNOWN), dataSpaceOverridden(false),
diff --git a/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp b/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
index 0922b74..b2a7fee 100644
--- a/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
+++ b/services/camera/libcameraservice/common/aidl/AidlProviderInfo.cpp
@@ -57,8 +57,6 @@
return -EBUSY;
case Status::MAX_CAMERAS_IN_USE:
return -EUSERS;
- case Status::METHOD_NOT_SUPPORTED:
- return UNKNOWN_TRANSACTION;
case Status::OPERATION_NOT_SUPPORTED:
return INVALID_OPERATION;
case Status::CAMERA_DISCONNECTED:
@@ -660,18 +658,14 @@
}
status_t AidlProviderInfo::AidlDeviceInfo3::dumpState(int fd) {
- native_handle_t* handle = native_handle_create(1,0);
- handle->data[0] = fd;
const std::shared_ptr<camera::device::ICameraDevice> interface = startDeviceInterface();
if (interface == nullptr) {
return DEAD_OBJECT;
}
- ::ndk::ScopedFileDescriptor sFd;
- sFd.set(fcntl(fd, F_DUPFD_CLOEXEC, 0));
- auto ret = interface->dumpState(sFd);
- native_handle_delete(handle);
- if (!ret.isOk()) {
- return mapToStatusT(ret);
+ const char *args = nullptr;
+ auto ret = interface->dump(fd, &args, /*numArgs*/0);
+ if (ret != OK) {
+ return ret;
}
return OK;
}
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index a5c4e4d..688b6df 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -978,8 +978,8 @@
const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
std::vector<int> *surfaceIds, int streamSetId, bool isShared, bool isMultiResolution,
- uint64_t consumerUsage, int dynamicRangeProfile, int streamUseCase, int timestampBase,
- int mirrorMode) {
+ uint64_t consumerUsage, int64_t dynamicRangeProfile, int streamUseCase,
+ int timestampBase, int mirrorMode) {
ATRACE_CALL();
if (consumer == nullptr) {
@@ -1013,7 +1013,7 @@
android_dataspace dataSpace, camera_stream_rotation_t rotation, int *id,
const String8& physicalCameraId, const std::unordered_set<int32_t> &sensorPixelModesUsed,
std::vector<int> *surfaceIds, int streamSetId, bool isShared, bool isMultiResolution,
- uint64_t consumerUsage, int dynamicRangeProfile, int streamUseCase, int timestampBase,
+ uint64_t consumerUsage, int64_t dynamicRangeProfile, int streamUseCase, int timestampBase,
int mirrorMode) {
ATRACE_CALL();
@@ -1022,7 +1022,7 @@
Mutex::Autolock l(mLock);
ALOGV("Camera %s: Creating new stream %d: %d x %d, format %d, dataspace %d rotation %d"
" consumer usage %" PRIu64 ", isShared %d, physicalCameraId %s, isMultiResolution %d"
- " dynamicRangeProfile %d, streamUseCase %d, timestampBase %d, mirrorMode %d",
+ " dynamicRangeProfile %" PRIx64 ", streamUseCase %d, timestampBase %d, mirrorMode %d",
mId.string(), mNextStreamId, width, height, format, dataSpace, rotation,
consumerUsage, isShared, physicalCameraId.string(), isMultiResolution,
dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode);
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index be976d0..453ac3a 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -139,7 +139,7 @@
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
bool isShared = false, bool isMultiResolution = false,
uint64_t consumerUsage = 0,
- int dynamicRangeProfile =
+ int64_t dynamicRangeProfile =
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
@@ -154,7 +154,7 @@
int streamSetId = camera3::CAMERA3_STREAM_SET_ID_INVALID,
bool isShared = false, bool isMultiResolution = false,
uint64_t consumerUsage = 0,
- int dynamicRangeProfile =
+ int64_t dynamicRangeProfile =
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
diff --git a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
index f737ed6..2497c22 100644
--- a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
+++ b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
@@ -34,7 +34,7 @@
android_dataspace dataSpace, camera_stream_rotation_t rotation,
const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
- int setId, bool isMultiResolution, int dynamicRangeProfile, int streamUseCase,
+ int setId, bool isMultiResolution, int64_t dynamicRangeProfile, int streamUseCase,
bool deviceTimeBaseIsRealtime, int timestampBase) :
Camera3Stream(id, type,
width, height, maxSize, format, dataSpace, rotation,
@@ -89,7 +89,8 @@
if (strlen(camera_stream::physical_camera_id) > 0) {
lines.appendFormat(" Physical camera id: %s\n", camera_stream::physical_camera_id);
}
- lines.appendFormat(" Dynamic Range Profile: 0x%x", camera_stream::dynamic_range_profile);
+ lines.appendFormat(" Dynamic Range Profile: 0x%" PRIx64,
+ camera_stream::dynamic_range_profile);
lines.appendFormat(" Stream use case: %d\n", camera_stream::use_case);
lines.appendFormat(" Frames produced: %d, last timestamp: %" PRId64 " ns\n",
mFrameCount, mLastTimestamp);
diff --git a/services/camera/libcameraservice/device3/Camera3IOStreamBase.h b/services/camera/libcameraservice/device3/Camera3IOStreamBase.h
index 300f207..e757ec6 100644
--- a/services/camera/libcameraservice/device3/Camera3IOStreamBase.h
+++ b/services/camera/libcameraservice/device3/Camera3IOStreamBase.h
@@ -38,7 +38,7 @@
const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
bool deviceTimeBaseIsRealtime = false,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT);
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index 9574309..8ae16e5 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -46,7 +46,7 @@
android_dataspace dataSpace, camera_stream_rotation_t rotation,
nsecs_t timestampOffset, const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
- int setId, bool isMultiResolution, int dynamicRangeProfile,
+ int setId, bool isMultiResolution, int64_t dynamicRangeProfile,
int streamUseCase, bool deviceTimeBaseIsRealtime, int timestampBase,
int mirrorMode) :
Camera3IOStreamBase(id, CAMERA_STREAM_OUTPUT, width, height,
@@ -79,7 +79,7 @@
android_dataspace dataSpace, camera_stream_rotation_t rotation,
nsecs_t timestampOffset, const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
- int setId, bool isMultiResolution, int dynamicRangeProfile,
+ int setId, bool isMultiResolution, int64_t dynamicRangeProfile,
int streamUseCase, bool deviceTimeBaseIsRealtime, int timestampBase,
int mirrorMode) :
Camera3IOStreamBase(id, CAMERA_STREAM_OUTPUT, width, height, maxSize,
@@ -117,7 +117,7 @@
camera_stream_rotation_t rotation, nsecs_t timestampOffset,
const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
- int setId, bool isMultiResolution, int dynamicRangeProfile,
+ int setId, bool isMultiResolution, int64_t dynamicRangeProfile,
int streamUseCase, bool deviceTimeBaseIsRealtime, int timestampBase,
int mirrorMode) :
Camera3IOStreamBase(id, CAMERA_STREAM_OUTPUT, width, height,
@@ -163,7 +163,7 @@
const std::unordered_set<int32_t> &sensorPixelModesUsed,
uint64_t consumerUsage, nsecs_t timestampOffset,
int setId, bool isMultiResolution,
- int dynamicRangeProfile, int streamUseCase,
+ int64_t dynamicRangeProfile, int streamUseCase,
bool deviceTimeBaseIsRealtime, int timestampBase,
int mirrorMode) :
Camera3IOStreamBase(id, type, width, height,
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.h b/services/camera/libcameraservice/device3/Camera3OutputStream.h
index 80901d6..e777e85 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.h
@@ -90,7 +90,7 @@
nsecs_t timestampOffset, const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
bool deviceTimeBaseIsRealtime = false,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
@@ -107,7 +107,7 @@
nsecs_t timestampOffset, const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
bool deviceTimeBaseIsRealtime = false,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
@@ -123,7 +123,7 @@
const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
bool deviceTimeBaseIsRealtime = false,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
@@ -255,7 +255,7 @@
const std::unordered_set<int32_t> &sensorPixelModesUsed,
uint64_t consumerUsage = 0, nsecs_t timestampOffset = 0,
int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
bool deviceTimeBaseIsRealtime = false,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
diff --git a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp
index 9bf7b6a..198e32f 100644
--- a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.cpp
@@ -33,7 +33,7 @@
camera_stream_rotation_t rotation,
nsecs_t timestampOffset, const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
- int setId, bool useHalBufManager, int dynamicProfile,
+ int setId, bool useHalBufManager, int64_t dynamicProfile,
int streamUseCase, bool deviceTimeBaseIsRealtime, int timestampBase,
int mirrorMode) :
Camera3OutputStream(id, CAMERA_STREAM_OUTPUT, width, height,
@@ -397,10 +397,10 @@
(infoIt.format != getOriginalFormat() && infoIt.format != getFormat()) ||
(infoIt.dataSpace != getDataSpace() &&
infoIt.dataSpace != getOriginalDataSpace())) {
- ALOGE("%s: Shared surface parameters format: 0x%x dataSpace: 0x%x dynamic range 0x%x "
- " don't match source stream format: 0x%x dataSpace: 0x%x dynamic range 0x%x"
- , __FUNCTION__, infoIt.format, infoIt.dataSpace, infoIt.dynamicRangeProfile,
- getFormat(), getDataSpace(), dynamic_range_profile);
+ ALOGE("%s: Shared surface parameters format: 0x%x dataSpace: 0x%x dynamic range 0x%"
+ PRIx64 " don't match source stream format: 0x%x dataSpace: 0x%x dynamic"
+ " range 0x%" PRIx64 , __FUNCTION__, infoIt.format, infoIt.dataSpace,
+ infoIt.dynamicRangeProfile, getFormat(), getDataSpace(), dynamic_range_profile);
return BAD_VALUE;
}
}
diff --git a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h
index 0061a52..9be0c86 100644
--- a/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3SharedOutputStream.h
@@ -41,7 +41,7 @@
const std::unordered_set<int32_t> &sensorPixelModesUsed,
int setId = CAMERA3_STREAM_SET_ID_INVALID,
bool useHalBufManager = false,
- int dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
+ int64_t dynamicProfile = ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
int streamUseCase = ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
bool deviceTimeBaseIsRealtime = false,
int timestampBase = OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.cpp b/services/camera/libcameraservice/device3/Camera3Stream.cpp
index 3f0299b..396b316 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Stream.cpp
@@ -54,7 +54,7 @@
android_dataspace dataSpace, camera_stream_rotation_t rotation,
const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
- int setId, bool isMultiResolution, int dynamicRangeProfile,
+ int setId, bool isMultiResolution, int64_t dynamicRangeProfile,
int streamUseCase, bool deviceTimeBaseIsRealtime, int timestampBase) :
camera_stream(),
mId(id),
@@ -155,7 +155,7 @@
return mOriginalFormat;
}
-int Camera3Stream::getDynamicRangeProfile() const {
+int64_t Camera3Stream::getDynamicRangeProfile() const {
return camera_stream::dynamic_range_profile;
}
@@ -1103,7 +1103,7 @@
}
void Camera3Stream::queueHDRMetadata(buffer_handle_t buffer, sp<ANativeWindow>& anw,
- int dynamicRangeProfile) {
+ int64_t dynamicRangeProfile) {
auto& mapper = GraphicBufferMapper::get();
switch (dynamicRangeProfile) {
case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10: {
diff --git a/services/camera/libcameraservice/device3/Camera3Stream.h b/services/camera/libcameraservice/device3/Camera3Stream.h
index 8232ce0..d1545cc 100644
--- a/services/camera/libcameraservice/device3/Camera3Stream.h
+++ b/services/camera/libcameraservice/device3/Camera3Stream.h
@@ -140,7 +140,7 @@
// Queue corresponding HDR metadata to given native window.
static void queueHDRMetadata(buffer_handle_t buffer, sp<ANativeWindow>& anw,
- int dynamicRangeProfile);
+ int64_t dynamicRangeProfile);
/**
* Get the stream's ID
@@ -172,7 +172,7 @@
void setFormatOverride(bool formatOverriden);
bool isFormatOverridden() const;
int getOriginalFormat() const;
- int getDynamicRangeProfile() const;
+ int64_t getDynamicRangeProfile() const;
void setDataSpaceOverride(bool dataSpaceOverriden);
bool isDataSpaceOverridden() const;
android_dataspace getOriginalDataSpace() const;
@@ -508,7 +508,7 @@
android_dataspace dataSpace, camera_stream_rotation_t rotation,
const String8& physicalCameraId,
const std::unordered_set<int32_t> &sensorPixelModesUsed,
- int setId, bool isMultiResolution, int dynamicRangeProfile,
+ int setId, bool isMultiResolution, int64_t dynamicRangeProfile,
int streamUseCase, bool deviceTimeBaseIsRealtime, int timestampBase);
wp<Camera3StreamBufferFreedListener> mBufferFreedListener;
diff --git a/services/camera/libcameraservice/device3/Camera3StreamInterface.h b/services/camera/libcameraservice/device3/Camera3StreamInterface.h
index 148e511..77c6483 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamInterface.h
+++ b/services/camera/libcameraservice/device3/Camera3StreamInterface.h
@@ -65,7 +65,7 @@
const char* physical_camera_id;
std::unordered_set<int32_t> sensor_pixel_modes_used;
- int dynamic_range_profile;
+ int64_t dynamic_range_profile;
int use_case;
} camera_stream_t;
@@ -110,7 +110,7 @@
bool finalized = false;
bool supportsOffline = false;
std::unordered_set<int32_t> sensorPixelModesUsed;
- int dynamicRangeProfile;
+ int64_t dynamicRangeProfile;
int streamUseCase;
int timestampBase;
int mirrorMode;
@@ -123,7 +123,7 @@
mirrorMode(OutputConfiguration::MIRROR_MODE_AUTO) {}
OutputStreamInfo(int _width, int _height, int _format, android_dataspace _dataSpace,
uint64_t _consumerUsage, const std::unordered_set<int32_t>& _sensorPixelModesUsed,
- int _dynamicRangeProfile, int _streamUseCase, int _timestampBase, int _mirrorMode) :
+ int64_t _dynamicRangeProfile, int _streamUseCase, int _timestampBase, int _mirrorMode) :
width(_width), height(_height), format(_format),
dataSpace(_dataSpace), consumerUsage(_consumerUsage),
sensorPixelModesUsed(_sensorPixelModesUsed), dynamicRangeProfile(_dynamicRangeProfile),
@@ -167,7 +167,7 @@
virtual uint32_t getWidth() const = 0;
virtual uint32_t getHeight() const = 0;
virtual int getFormat() const = 0;
- virtual int getDynamicRangeProfile() const = 0;
+ virtual int64_t getDynamicRangeProfile() const = 0;
virtual android_dataspace getDataSpace() const = 0;
virtual void setFormatOverride(bool formatOverriden) = 0;
virtual bool isFormatOverridden() const = 0;
diff --git a/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp b/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
index 1149d13..fd23958 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
+++ b/services/camera/libcameraservice/device3/Camera3StreamSplitter.cpp
@@ -43,7 +43,7 @@
status_t Camera3StreamSplitter::connect(const std::unordered_map<size_t, sp<Surface>> &surfaces,
uint64_t consumerUsage, uint64_t producerUsage, size_t halMaxBuffers, uint32_t width,
uint32_t height, android::PixelFormat format, sp<Surface>* consumer,
- int dynamicRangeProfile) {
+ int64_t dynamicRangeProfile) {
ATRACE_CALL();
if (consumer == nullptr) {
SP_LOGE("%s: consumer pointer is NULL", __FUNCTION__);
diff --git a/services/camera/libcameraservice/device3/Camera3StreamSplitter.h b/services/camera/libcameraservice/device3/Camera3StreamSplitter.h
index 827865c..0f728a0 100644
--- a/services/camera/libcameraservice/device3/Camera3StreamSplitter.h
+++ b/services/camera/libcameraservice/device3/Camera3StreamSplitter.h
@@ -58,7 +58,7 @@
status_t connect(const std::unordered_map<size_t, sp<Surface>> &surfaces,
uint64_t consumerUsage, uint64_t producerUsage, size_t halMaxBuffers, uint32_t width,
uint32_t height, android::PixelFormat format, sp<Surface>* consumer,
- int dynamicRangeProfile);
+ int64_t dynamicRangeProfile);
// addOutput adds an output BufferQueue to the splitter. The splitter
// connects to outputQueue as a CPU producer, and any buffers queued
diff --git a/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp b/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp
index 452c9f9..529c9f0 100644
--- a/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp
+++ b/services/camera/libcameraservice/device3/aidl/AidlCamera3Device.cpp
@@ -82,7 +82,7 @@
namespace android {
RequestAvailableDynamicRangeProfilesMap
-mapToAidlDynamicProfile(int dynamicRangeProfile) {
+mapToAidlDynamicProfile(int64_t dynamicRangeProfile) {
return static_cast<RequestAvailableDynamicRangeProfilesMap>(dynamicRangeProfile);
}
diff --git a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp
index 87cf99a..4894ba9 100644
--- a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp
+++ b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.cpp
@@ -70,7 +70,7 @@
namespace android {
CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap
-HidlCamera3Device::mapToHidlDynamicProfile(int dynamicRangeProfile) {
+HidlCamera3Device::mapToHidlDynamicProfile(int64_t dynamicRangeProfile) {
return static_cast<CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap>(
dynamicRangeProfile);
}
@@ -966,7 +966,7 @@
if ((src->dynamic_range_profile !=
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD) &&
(mHidlSession_3_8 == nullptr)) {
- ALOGE("%s: Camera device doesn't support non-standard dynamic range profiles: %d",
+ ALOGE("%s: Camera device doesn't support non-standard dynamic range profiles: %" PRIx64,
__FUNCTION__, src->dynamic_range_profile);
return BAD_VALUE;
}
diff --git a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h
index a83080b..77d539a 100644
--- a/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h
+++ b/services/camera/libcameraservice/device3/hidl/HidlCamera3Device.h
@@ -45,7 +45,7 @@
android_dataspace dataSpace);
static hardware::camera::device::V3_2::BufferUsageFlags mapToConsumerUsage(uint64_t usage);
static CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap mapToHidlDynamicProfile(
- int dynamicRangeProfile);
+ int64_t dynamicRangeProfile);
static hardware::camera::device::V3_2::StreamRotation mapToStreamRotation(
camera_stream_rotation_t rotation);
// Returns a negative error code if the passed-in operation mode is not valid.
diff --git a/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp b/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp
index ddcbdee..af00e81 100644
--- a/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp
+++ b/services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp
@@ -223,7 +223,7 @@
}
}
-bool isDynamicRangeProfileSupported(int dynamicRangeProfile, const CameraMetadata& staticInfo) {
+bool isDynamicRangeProfileSupported(int64_t dynamicRangeProfile, const CameraMetadata& staticInfo) {
if (dynamicRangeProfile == ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD) {
// Supported by default
return true;
@@ -256,8 +256,8 @@
case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF:
case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO:
entry = staticInfo.find(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP);
- for (size_t i = 0; i < entry.count; i += 2) {
- if (dynamicRangeProfile == entry.data.i32[i]) {
+ for (size_t i = 0; i < entry.count; i += 3) {
+ if (dynamicRangeProfile == entry.data.i64[i]) {
return true;
}
}
@@ -271,7 +271,7 @@
}
//check if format is 10-bit compatible
-bool is10bitDynamicRangeProfile(int32_t dynamicRangeProfile) {
+bool is10bitDynamicRangeProfile(int64_t dynamicRangeProfile) {
switch (dynamicRangeProfile) {
case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS:
case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10:
@@ -335,7 +335,7 @@
OutputStreamInfo& streamInfo, bool isStreamInfoValid,
sp<Surface>& surface, const sp<IGraphicBufferProducer>& gbp,
const String8 &logicalCameraId, const CameraMetadata &physicalCameraMetadata,
- const std::vector<int32_t> &sensorPixelModesUsed, int dynamicRangeProfile,
+ const std::vector<int32_t> &sensorPixelModesUsed, int64_t dynamicRangeProfile,
int streamUseCase, int timestampBase, int mirrorMode) {
// bufferProducer must be non-null
if (gbp == nullptr) {
@@ -436,15 +436,16 @@
}
if (!SessionConfigurationUtils::isDynamicRangeProfileSupported(dynamicRangeProfile,
physicalCameraMetadata)) {
- String8 msg = String8::format("Camera %s: Dynamic range profile 0x%x not supported,"
- " failed to create output stream", logicalCameraId.string(), dynamicRangeProfile);
+ String8 msg = String8::format("Camera %s: Dynamic range profile 0x%" PRIx64
+ " not supported,failed to create output stream", logicalCameraId.string(),
+ dynamicRangeProfile);
ALOGE("%s: %s", __FUNCTION__, msg.string());
return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.string());
}
if (SessionConfigurationUtils::is10bitDynamicRangeProfile(dynamicRangeProfile) &&
!SessionConfigurationUtils::is10bitCompatibleFormat(format)) {
String8 msg = String8::format("Camera %s: No 10-bit supported stream configurations with "
- "format %#x defined and profile %#x, failed to create output stream",
+ "format %#x defined and profile %" PRIx64 ", failed to create output stream",
logicalCameraId.string(), format, dynamicRangeProfile);
ALOGE("%s: %s", __FUNCTION__, msg.string());
return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.string());
@@ -695,7 +696,7 @@
bool deferredConsumer = it.isDeferred();
String8 physicalCameraId = String8(it.getPhysicalCameraId());
- int dynamicRangeProfile = it.getDynamicRangeProfile();
+ int64_t dynamicRangeProfile = it.getDynamicRangeProfile();
std::vector<int32_t> sensorPixelModesUsed = it.getSensorPixelModesUsed();
const CameraMetadata &physicalDeviceInfo = getMetadata(physicalCameraId,
overrideForPerfClass);
@@ -1033,7 +1034,7 @@
const hardware::camera::device::V3_8::StreamConfiguration &streamConfigV38) {
streamConfigV37.streams.resize(streamConfigV38.streams.size());
for (size_t i = 0; i < streamConfigV38.streams.size(); i++) {
- if (static_cast<int32_t>(streamConfigV38.streams[i].dynamicRangeProfile) !=
+ if (static_cast<int64_t>(streamConfigV38.streams[i].dynamicRangeProfile) !=
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD) {
// ICameraDevice older than 3.8 doesn't support 10-bit dynamic range profiles
// image
diff --git a/services/camera/libcameraservice/utils/SessionConfigurationUtils.h b/services/camera/libcameraservice/utils/SessionConfigurationUtils.h
index 7027dfe..406510f 100644
--- a/services/camera/libcameraservice/utils/SessionConfigurationUtils.h
+++ b/services/camera/libcameraservice/utils/SessionConfigurationUtils.h
@@ -98,7 +98,7 @@
camera3::OutputStreamInfo& streamInfo, bool isStreamInfoValid,
sp<Surface>& surface, const sp<IGraphicBufferProducer>& gbp,
const String8 &logicalCameraId, const CameraMetadata &physicalCameraMetadata,
- const std::vector<int32_t> &sensorPixelModesUsed, int dynamicRangeProfile,
+ const std::vector<int32_t> &sensorPixelModesUsed, int64_t dynamicRangeProfile,
int streamUseCase, int timestampBase, int mirrorMode);
void mapStreamInfo(const camera3::OutputStreamInfo &streamInfo,
@@ -109,10 +109,10 @@
bool is10bitCompatibleFormat(int32_t format);
// check if the dynamic range requires 10-bit output
-bool is10bitDynamicRangeProfile(int32_t dynamicRangeProfile);
+bool is10bitDynamicRangeProfile(int64_t dynamicRangeProfile);
// Check if the device supports a given dynamicRangeProfile
-bool isDynamicRangeProfileSupported(int dynamicRangeProfile, const CameraMetadata& staticMeta);
+bool isDynamicRangeProfileSupported(int64_t dynamicRangeProfile, const CameraMetadata& staticMeta);
bool isStreamUseCaseSupported(int streamUseCase, const CameraMetadata &deviceInfo);
diff --git a/services/mediametrics/AudioAnalytics.cpp b/services/mediametrics/AudioAnalytics.cpp
index ade54d0..aacc2be 100644
--- a/services/mediametrics/AudioAnalytics.cpp
+++ b/services/mediametrics/AudioAnalytics.cpp
@@ -1246,10 +1246,10 @@
if (channelMask != 0) {
switch (direction) {
case 1: // Output, keep sync with AudioTypes#getAAudioDirection()
- channelCount = audio_channel_count_from_out_mask(channelMask);
+ channelCount = (int32_t)audio_channel_count_from_out_mask(channelMask);
break;
case 2: // Input, keep sync with AudioTypes#getAAudioDirection()
- channelCount = audio_channel_count_from_in_mask(channelMask);
+ channelCount = (int32_t)audio_channel_count_from_in_mask(channelMask);
break;
default:
ALOGW("Invalid direction %d", direction);
diff --git a/services/mediametrics/statsd_drm.cpp b/services/mediametrics/statsd_drm.cpp
index 287fb8d..e06a605 100644
--- a/services/mediametrics/statsd_drm.cpp
+++ b/services/mediametrics/statsd_drm.cpp
@@ -171,7 +171,7 @@
std::vector<uint8_t> buf(str.length() / 4 * 3, 0);
size_t size = buf.size();
if (decodeBase64(buf.data(), &size, str.c_str()) && size <= buf.size()) {
- buf.erase(buf.begin() + size, buf.end());
+ buf.erase(buf.begin() + (ptrdiff_t)size, buf.end());
return buf;
}
return {};