Snap for 12359238 from 0f155df855891754e343beaa02e052f5e07a2801 to android15-tests-release Change-Id: I7a9c144c68f43ace1d31ef44851216bb31fb7903
diff --git a/Android.bp b/Android.bp index 0bcbe48..bbd36e6 100644 --- a/Android.bp +++ b/Android.bp
@@ -30,11 +30,7 @@ ], apex_available: [ "//apex_available:platform", - "com.android.btservices", - "com.android.media.swcodec", - "com.android.neuralnetworks", - "test_com.android.media.swcodec", - "test_com.android.neuralnetworks", + "//apex_available:anyapex", ], export_include_dirs: ["include"], local_include_dirs: ["include"],
diff --git a/ErasedMessageQueue.cpp b/ErasedMessageQueue.cpp index 7fb03aa..a0637fb 100644 --- a/ErasedMessageQueue.cpp +++ b/ErasedMessageQueue.cpp
@@ -23,7 +23,7 @@ NativeHandle convertHandle(const int* fds, size_t n_fds, const int32_t* ints, size_t n_ints) { std::vector<ndk::ScopedFileDescriptor> fdv; for (size_t i = 0; i < n_fds; i++) { - fdv.push_back(std::move(ndk::ScopedFileDescriptor(fds[i]))); + fdv.push_back(std::move(ndk::ScopedFileDescriptor(dup(fds[i])))); } std::vector<int32_t> intv(ints, ints + n_ints); @@ -112,6 +112,6 @@ return inner->commitRead(nMessages); } -ErasedMessageQueueDesc* ErasedMessageQueue::dupeDesc() { +ErasedMessageQueueDesc* ErasedMessageQueue::dupeDesc() const { return new ErasedMessageQueueDesc(inner->dupeDesc()); }
diff --git a/ErasedMessageQueue.hpp b/ErasedMessageQueue.hpp index b3c4357..b4b5931 100644 --- a/ErasedMessageQueue.hpp +++ b/ErasedMessageQueue.hpp
@@ -161,5 +161,5 @@ * @return ErasedMessageQueueDesc The copied descriptor, which must be freed * by passing it to freeDesc. */ - ErasedMessageQueueDesc* dupeDesc(); + ErasedMessageQueueDesc* dupeDesc() const; };
diff --git a/benchmarks/Android.bp b/benchmarks/Android.bp new file mode 100644 index 0000000..edb6701 --- /dev/null +++ b/benchmarks/Android.bp
@@ -0,0 +1,43 @@ +// +// Copyright (C) 2016 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. +// + +package { + // See: http://go/android-license-faq + default_applicable_licenses: [ + "Android-Apache-2.0", + ], + default_team: "trendy_team_testing", +} + +cc_test { + name: "mq_benchmark_client", + srcs: ["msgq_benchmark_client.cpp"], + cflags: [ + "-Wall", + "-Werror", + ], + shared_libs: [ + "android.hardware.tests.msgq@1.0", + "libbase", + "libcutils", + "libfmq", + "libhidlbase", + "libutils", + ], + required: [ + "android.hardware.tests.msgq@1.0-impl", + ], +}
diff --git a/benchmarks/Android.mk b/benchmarks/Android.mk deleted file mode 100644 index 3cae117..0000000 --- a/benchmarks/Android.mk +++ /dev/null
@@ -1,41 +0,0 @@ -# -# Copyright (C) 2016 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. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := \ - msgq_benchmark_client.cpp - -LOCAL_CFLAGS := -Wall -Werror - -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libutils \ - libhidlbase - -LOCAL_REQUIRED_MODULES := android.hardware.tests.msgq@1.0-impl - -ifneq ($(TARGET_2ND_ARCH),) -LOCAL_REQUIRED_MODULES += android.hardware.tests.msgq@1.0-impl:32 -endif - -LOCAL_SHARED_LIBRARIES += android.hardware.tests.msgq@1.0 libfmq -LOCAL_MODULE := mq_benchmark_client -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -include $(BUILD_NATIVE_TEST)
diff --git a/include/fmq/AidlMessageQueue.h b/include/fmq/AidlMessageQueue.h index 138760f..e4c3d84 100644 --- a/include/fmq/AidlMessageQueue.h +++ b/include/fmq/AidlMessageQueue.h
@@ -115,7 +115,7 @@ android::base::unique_fd bufferFd, size_t bufferSize, std::enable_if_t<std::is_same_v<V, MQErased>, size_t> quantum); - MQDescriptor<T, U> dupeDesc(); + MQDescriptor<T, U> dupeDesc() const; private: AidlMessageQueue(const AidlMessageQueue& other) = delete; @@ -144,7 +144,7 @@ quantum) {} template <typename T, typename U> -MQDescriptor<T, U> AidlMessageQueue<T, U>::dupeDesc() { +MQDescriptor<T, U> AidlMessageQueue<T, U>::dupeDesc() const { auto* shim = MessageQueueBase<AidlMQDescriptorShim, T, FlavorTypeToValue<U>::value>::getDesc(); if (shim) { std::vector<aidl::android::hardware::common::fmq::GrantorDescriptor> grantors;
diff --git a/libfmq.rs b/libfmq.rs index a215a02..b743df1 100644 --- a/libfmq.rs +++ b/libfmq.rs
@@ -202,7 +202,7 @@ /// Obtain a copy of the MessageQueue's descriptor, which may be used to /// access it remotely. - pub fn dupe_desc(&mut self) -> MQDescriptor<T, SynchronizedReadWrite> { + pub fn dupe_desc(&self) -> MQDescriptor<T, SynchronizedReadWrite> { // SAFETY: dupeDesc may be called on any valid ErasedMessageQueue; it // simply forwards to dupeDesc on the inner AidlMessageQueue and wraps // in a heap allocation.
diff --git a/tests/msgq_rust_test_client.rs b/tests/msgq_rust_test_client.rs index bad57a7..a78000a 100644 --- a/tests/msgq_rust_test_client.rs +++ b/tests/msgq_rust_test_client.rs
@@ -33,7 +33,7 @@ let num_elements_in_sync_queue: usize = (page_size - 16) / std::mem::size_of::<i32>(); /* Create a queue on the client side. */ - let mut mq = MessageQueue::<i32>::new( + let mq = MessageQueue::<i32>::new( num_elements_in_sync_queue, true, /* configure event flag word */ );