Merge changes from topic "aidlCameraHalInterfaces"
* changes:
Add AIDL interface files for android.hardware.camera.common .
Add AIDL interfaces for camera device hal functionality.
Add AIDL interfaces for camera HAL provider.
Add AIDL interfaces for camera metadata.
diff --git a/audio/7.1/Android.bp b/audio/7.1/Android.bp
index 52980e2..cede72a 100644
--- a/audio/7.1/Android.bp
+++ b/audio/7.1/Android.bp
@@ -17,7 +17,6 @@
"IDevice.hal",
"IDevicesFactory.hal",
"IPrimaryDevice.hal",
- "IStreamIn.hal",
"IStreamOut.hal",
"IStreamOutLatencyModeCallback.hal",
],
diff --git a/audio/7.1/IDevice.hal b/audio/7.1/IDevice.hal
index e0b1e92..c158e7e 100644
--- a/audio/7.1/IDevice.hal
+++ b/audio/7.1/IDevice.hal
@@ -20,7 +20,6 @@
import @7.0::AudioInOutFlag;
import @7.0::IDevice;
import @7.0::Result;
-import IStreamIn;
import IStreamOut;
interface IDevice extends @7.0::IDevice {
@@ -56,37 +55,6 @@
AudioConfig suggestedConfig);
/**
- * This method creates and opens the audio hardware input stream.
- * If the stream can not be opened with the proposed audio config,
- * HAL must provide suggested values for the audio config.
- *
- * Note: INVALID_ARGUMENTS is returned both in the case when the
- * HAL can not use the provided config and in the case when
- * the value of any argument is invalid. In the latter case the
- * HAL must provide a default initialized suggested config.
- *
- * @param ioHandle handle assigned by AudioFlinger.
- * @param device device type and (if needed) address.
- * @param config stream configuration.
- * @param flags additional flags.
- * @param sinkMetadata Description of the audio that is suggested by the client.
- * May be used by implementations to configure processing effects.
- * @return retval operation completion status.
- * @return inStream in case of success, created input stream.
- * @return suggestedConfig in the case of rejection of the proposed config,
- * a config suggested by the HAL.
- */
- openInputStream_7_1(
- AudioIoHandle ioHandle,
- DeviceAddress device,
- AudioConfig config,
- vec<AudioInOutFlag> flags,
- SinkMetadata sinkMetadata) generates (
- Result retval,
- IStreamIn inStream,
- AudioConfig suggestedConfig);
-
- /**
* Notifies the device module about the connection state of an input/output
* device attached to it. The devicePort identifies the device and may also
* provide extra information such as raw audio descriptors.
diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp
index ca8c03d..b954fcd 100644
--- a/audio/core/all-versions/default/Device.cpp
+++ b/audio/core/all-versions/default/Device.cpp
@@ -348,16 +348,6 @@
_hidl_cb(result, streamOut, suggestedConfig);
return Void();
}
-
-Return<void> Device::openInputStream_7_1(int32_t ioHandle, const DeviceAddress& device,
- const AudioConfig& config, const AudioInputFlags& flags,
- const SinkMetadata& sinkMetadata,
- openInputStream_7_1_cb _hidl_cb) {
- auto [result, streamIn, suggestedConfig] =
- openInputStreamImpl(ioHandle, device, config, flags, sinkMetadata);
- _hidl_cb(result, streamIn, suggestedConfig);
- return Void();
-}
#endif // V7.1
Return<bool> Device::supportsAudioPatches() {
diff --git a/audio/core/all-versions/default/include/core/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h
index 8cde3e0..0696f97 100644
--- a/audio/core/all-versions/default/include/core/default/Device.h
+++ b/audio/core/all-versions/default/include/core/default/Device.h
@@ -123,10 +123,6 @@
const AudioConfig& config, const AudioOutputFlags& flags,
const SourceMetadata& sourceMetadata,
openOutputStream_7_1_cb _hidl_cb) override;
- Return<void> openInputStream_7_1(int32_t ioHandle, const DeviceAddress& device,
- const AudioConfig& config, const AudioInputFlags& flags,
- const SinkMetadata& sinkMetadata,
- openInputStream_7_1_cb _hidl_cb) override;
#endif
Return<bool> supportsAudioPatches() override;
diff --git a/audio/core/all-versions/default/include/core/default/StreamIn.h b/audio/core/all-versions/default/include/core/default/StreamIn.h
index a6346e5..4627eec 100644
--- a/audio/core/all-versions/default/include/core/default/StreamIn.h
+++ b/audio/core/all-versions/default/include/core/default/StreamIn.h
@@ -17,7 +17,9 @@
#ifndef ANDROID_HARDWARE_AUDIO_STREAMIN_H
#define ANDROID_HARDWARE_AUDIO_STREAMIN_H
-#include PATH(android/hardware/audio/FILE_VERSION/IStreamIn.h)
+// clang-format off
+#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/IStreamIn.h)
+// clang-format on
#include "Device.h"
#include "Stream.h"
diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
index a567cf9..83ca9eb 100644
--- a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
+++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
@@ -15,9 +15,9 @@
*/
// clang-format off
-#include PATH(android/hardware/audio/FILE_VERSION/IStreamIn.h)
-#include PATH(android/hardware/audio/FILE_VERSION/IStreamOut.h)
+#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/IStreamIn.h)
#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h)
+#include PATH(android/hardware/audio/FILE_VERSION/IStreamOut.h)
#include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h)
// clang-format on
#include <hidl/HidlSupport.h>
diff --git a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
index d82d4ad..6b9b32d 100644
--- a/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/7.1/AudioPrimaryHidlHalTest.cpp
@@ -47,3 +47,51 @@
// initial state. To workaround this, destroy the HAL at the end of this test.
ASSERT_TRUE(resetDevice());
}
+class LatencyModeOutputStreamTest : public OutputStreamTest {
+ protected:
+ void SetUp() override {
+ OutputStreamTest::SetUp();
+
+ Result res;
+ EXPECT_OK(stream->getRecommendedLatencyModes(returnIn(res, mSupportedLatencyModes)));
+ EXPECT_RESULT(okOrNotSupported, res);
+ if (res == Result::NOT_SUPPORTED) {
+ GTEST_SKIP() << "latency mode is not supported"; // returns
+ }
+ }
+ hidl_vec<LatencyMode> mSupportedLatencyModes;
+};
+
+TEST_P(LatencyModeOutputStreamTest, GetRecommendedLatencyModes) {
+ doc::test("Verify that reported latency modes are valid when supported");
+ for (auto mode : mSupportedLatencyModes) {
+ ASSERT_TRUE(mode >= LatencyMode::FREE && mode <= LatencyMode::LOW);
+ }
+}
+
+TEST_P(LatencyModeOutputStreamTest, SetValidLatencyMode) {
+ doc::test("Verify that setting valid latency modes works when supported");
+ for (auto mode : mSupportedLatencyModes) {
+ EXPECT_OK(stream->setLatencyMode(mode));
+ }
+}
+
+TEST_P(LatencyModeOutputStreamTest, SetInValidLatencyMode) {
+ doc::test("Verify that setting invalid latency modes fails");
+ EXPECT_RESULT(invalidArgsOrNotSupported,
+ stream->setLatencyMode(static_cast<LatencyMode>(1977)));
+}
+
+/** Stub implementation of IStreamOutEventCallback **/
+class MockOutLatencyModeCallback : public IStreamOutLatencyModeCallback {
+ Return<void> onRecommendedLatencyModeChanged(
+ const hidl_vec<LatencyMode>& hidlModes __unused) override {
+ return {};
+ }
+};
+
+TEST_P(LatencyModeOutputStreamTest, SetLatencyModeCallback) {
+ doc::test("Verify that setting a latency mode callback works when supported");
+ EXPECT_OK(stream->setLatencyModeCallback(new MockOutLatencyModeCallback));
+ EXPECT_OK(stream->setLatencyModeCallback(nullptr));
+}
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index 404532a..09446cd 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -91,8 +91,9 @@
using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION;
using namespace ::android::hardware::audio::common::test::utility;
using namespace ::android::hardware::audio::CPP_VERSION;
-using ReadParameters = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadParameters;
-using ReadStatus = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadStatus;
+using ReadParameters =
+ ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn::ReadParameters;
+using ReadStatus = ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn::ReadStatus;
using WriteCommand = ::android::hardware::audio::CPP_VERSION::IStreamOut::WriteCommand;
using WriteStatus = ::android::hardware::audio::CPP_VERSION::IStreamOut::WriteStatus;
#if MAJOR_VERSION >= 7
@@ -1010,6 +1011,7 @@
class OutputStreamTest
: public OpenStreamTest<::android::hardware::audio::CPP_VERSION::IStreamOut> {
+ protected:
void SetUp() override {
ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base
#if MAJOR_VERSION <= 6
@@ -1035,7 +1037,6 @@
}
#if MAJOR_VERSION >= 4 && MAJOR_VERSION <= 6
- protected:
const SourceMetadata initMetadata = {
{ { AudioUsage::MEDIA,
AudioContentType::MUSIC,
@@ -1089,7 +1090,7 @@
class StreamReader : public StreamWorker<StreamReader> {
public:
- using IStreamIn = ::android::hardware::audio::CPP_VERSION::IStreamIn;
+ using IStreamIn = ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn;
StreamReader(IStreamIn* stream, size_t bufferSize)
: mStream(stream), mBufferSize(bufferSize), mData(mBufferSize) {}
@@ -1204,7 +1205,8 @@
EventFlag* mEfGroup = nullptr;
};
-class InputStreamTest : public OpenStreamTest<::android::hardware::audio::CPP_VERSION::IStreamIn> {
+class InputStreamTest
+ : public OpenStreamTest<::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn> {
void SetUp() override {
ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base
#if MAJOR_VERSION <= 6
@@ -1226,13 +1228,8 @@
auto flags = getInputFlags();
testOpen(
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
-#if MAJOR_VERSION < 7 || (MAJOR_VERSION == 7 && MINOR_VERSION == 0)
return getDevice()->openInputStream(handle, address, config, flags,
initMetadata, cb);
-#elif MAJOR_VERSION == 7 && MINOR_VERSION == 1
- return getDevice()->openInputStream_7_1(handle, address, config, flags,
- initMetadata, cb);
-#endif
},
config);
}
@@ -1605,8 +1602,9 @@
"InputStream::setGain");
}
-static void testPrepareForReading(::android::hardware::audio::CPP_VERSION::IStreamIn* stream,
- uint32_t frameSize, uint32_t framesCount) {
+static void testPrepareForReading(
+ ::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn* stream, uint32_t frameSize,
+ uint32_t framesCount) {
Result res;
// Ignore output parameters as the call should fail
ASSERT_OK(stream->prepareForReading(frameSize, framesCount,
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl
new file mode 100644
index 0000000..2491340
--- /dev/null
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum TrailerState {
+ UNKNOWN = 0,
+ NOT_PRESENT = 1,
+ PRESENT = 2,
+ ERROR = 3,
+}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 2505dbd..5cd814c 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -204,4 +204,5 @@
EV_CHARGE_SWITCH = 287313730,
EV_CHARGE_TIME_REMAINING = 289410883,
EV_REGENERATIVE_BRAKING_STATE = 289410884,
+ TRAILER_PRESENT = 289410885,
}
diff --git a/audio/7.1/IStreamIn.hal b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl
similarity index 62%
rename from audio/7.1/IStreamIn.hal
rename to automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl
index abebe6a..fd42062 100644
--- a/audio/7.1/IStreamIn.hal
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 The Android Open Source Project
+ * 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.
@@ -14,9 +14,17 @@
* limitations under the License.
*/
-package android.hardware.audio@7.1;
+package android.hardware.automotive.vehicle;
-import @7.0::IStreamIn;
-
-interface IStreamIn extends @7.0::IStreamIn {
-};
+/**
+ * Used by the trailer present property to enumerate the current state
+ * of the trailer.
+ */
+@VintfStability
+@Backing(type="int")
+enum TrailerState {
+ UNKNOWN = 0,
+ NOT_PRESENT = 1,
+ PRESENT = 2,
+ ERROR = 3,
+}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 87b4802..9dbeae2 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -2803,4 +2803,16 @@
*/
EV_REGENERATIVE_BRAKING_STATE = 0x0F44 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
+ /**
+ * Indicates if there is a trailer present or not.
+ *
+ * Returns the trailer state of the car.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @data_enum TrailerState
+ */
+ TRAILER_PRESENT = 0x0F45 + 0x10000000 + 0x01000000
+ + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
}
diff --git a/bluetooth/audio/2.0/vts/OWNERS b/bluetooth/audio/2.0/vts/OWNERS
deleted file mode 100644
index b266b06..0000000
--- a/bluetooth/audio/2.0/vts/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-include platform/packages/modules/Bluetooth:/OWNERS
-
-cheneyni@google.com
diff --git a/bluetooth/audio/2.1/vts/OWNERS b/bluetooth/audio/2.1/vts/OWNERS
deleted file mode 100644
index b266b06..0000000
--- a/bluetooth/audio/2.1/vts/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-include platform/packages/modules/Bluetooth:/OWNERS
-
-cheneyni@google.com
diff --git a/bluetooth/audio/aidl/default/OWNERS b/bluetooth/audio/OWNERS
similarity index 98%
rename from bluetooth/audio/aidl/default/OWNERS
rename to bluetooth/audio/OWNERS
index 17ea464..a8e9bda 100644
--- a/bluetooth/audio/aidl/default/OWNERS
+++ b/bluetooth/audio/OWNERS
@@ -1,4 +1,4 @@
include platform/packages/modules/Bluetooth:/OWNERS
cheneyni@google.com
-aliceypkuo@google.com
\ No newline at end of file
+aliceypkuo@google.com
diff --git a/bluetooth/audio/aidl/vts/OWNERS b/bluetooth/audio/aidl/vts/OWNERS
deleted file mode 100644
index 17ea464..0000000
--- a/bluetooth/audio/aidl/vts/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-include platform/packages/modules/Bluetooth:/OWNERS
-
-cheneyni@google.com
-aliceypkuo@google.com
\ No newline at end of file
diff --git a/bluetooth/audio/utils/OWNERS b/bluetooth/audio/utils/OWNERS
deleted file mode 100644
index 17ea464..0000000
--- a/bluetooth/audio/utils/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-include platform/packages/modules/Bluetooth:/OWNERS
-
-cheneyni@google.com
-aliceypkuo@google.com
\ No newline at end of file
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 3cda353..fd961c8 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -308,7 +308,10 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <!-- Either the AIDL or the HIDL composer HAL must exist on the device.
+ If the HIDL composer HAL exists, it must be at least version 2.1.
+ See DeviceManifestTest.ComposerHal -->
+ <hal format="hidl" optional="true">
<name>android.hardware.graphics.composer</name>
<version>2.1-4</version>
<interface>
@@ -443,7 +446,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.light</name>
- <version>1</version>
+ <version>2</version>
<interface>
<name>ILights</name>
<instance>default</instance>
diff --git a/graphics/OWNERS b/graphics/OWNERS
new file mode 100644
index 0000000..75ceb23
--- /dev/null
+++ b/graphics/OWNERS
@@ -0,0 +1,9 @@
+# Bug component: 1075130
+
+# Graphics team
+adyabr@google.com
+alecmouri@google.com
+chrisforbes@google.com
+jreck@google.com
+lpy@google.com
+sumir@google.com
\ No newline at end of file
diff --git a/graphics/allocator/aidl/vts/Android.bp b/graphics/allocator/aidl/vts/Android.bp
new file mode 100644
index 0000000..d74129b
--- /dev/null
+++ b/graphics/allocator/aidl/vts/Android.bp
@@ -0,0 +1,62 @@
+/**
+ * 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.
+ */
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_test {
+ name: "VtsHalGraphicsAllocatorAidl_TargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ srcs: [
+ "VtsHalGraphicsAllocatorAidl_TargetTest.cpp",
+ ],
+
+ shared_libs: [
+ "android.hardware.graphics.allocator-V1-ndk",
+ "android.hardware.graphics.common-V3-ndk",
+ "android.hardware.graphics.mapper@4.0",
+ "libEGL",
+ "libGLESv2",
+ "libbinder_ndk",
+ "libbase",
+ "libsync",
+ "libui",
+ "libgui",
+ "libhidlbase",
+ "libvndksupport",
+ ],
+ static_libs: [
+ "libaidlcommonsupport",
+ "libgtest",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
new file mode 100644
index 0000000..784bc66
--- /dev/null
+++ b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2022 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_TAG "VtsHalGraphicsAllocatorAidl_TargetTest"
+
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/graphics/allocator/AllocationError.h>
+#include <aidl/android/hardware/graphics/allocator/AllocationResult.h>
+#include <aidl/android/hardware/graphics/allocator/IAllocator.h>
+#include <aidl/android/hardware/graphics/common/BufferUsage.h>
+#include <aidl/android/hardware/graphics/common/PixelFormat.h>
+#include <aidlcommonsupport/NativeHandle.h>
+#include <android/binder_manager.h>
+#include <android/hardware/graphics/mapper/4.0/IMapper.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+#include <initializer_list>
+#include <optional>
+#include <string>
+#include <tuple>
+
+using namespace aidl::android::hardware::graphics::allocator;
+using namespace aidl::android::hardware::graphics::common;
+using namespace android;
+using namespace android::hardware;
+using namespace android::hardware::graphics::mapper::V4_0;
+
+static constexpr uint64_t pack(const std::initializer_list<BufferUsage>& usages) {
+ uint64_t ret = 0;
+ for (const auto u : usages) {
+ ret |= static_cast<uint64_t>(u);
+ }
+ return ret;
+}
+
+static constexpr hardware::graphics::common::V1_2::PixelFormat cast(PixelFormat format) {
+ return static_cast<hardware::graphics::common::V1_2::PixelFormat>(format);
+}
+
+class BufferHandle {
+ sp<IMapper> mMapper;
+ native_handle_t* mRawHandle;
+ bool mImported = false;
+ uint32_t mStride;
+
+ BufferHandle(const BufferHandle&) = delete;
+ void operator=(const BufferHandle&) = delete;
+
+ public:
+ BufferHandle(const sp<IMapper> mapper, native_handle_t* handle, bool imported, uint32_t stride)
+ : mMapper(mapper), mRawHandle(handle), mImported(imported), mStride(stride) {}
+
+ ~BufferHandle() {
+ if (mRawHandle == nullptr) return;
+
+ if (mImported) {
+ Error error = mMapper->freeBuffer(mRawHandle);
+ EXPECT_EQ(Error::NONE, error) << "failed to free buffer " << mRawHandle;
+ } else {
+ native_handle_close(mRawHandle);
+ native_handle_delete(mRawHandle);
+ }
+ }
+
+ uint32_t stride() const { return mStride; }
+};
+
+class GraphicsAllocatorAidlTests
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
+ private:
+ std::shared_ptr<IAllocator> mAllocator;
+ sp<IMapper> mMapper;
+
+ public:
+ void SetUp() override {
+ mAllocator = IAllocator::fromBinder(
+ ndk::SpAIBinder(AServiceManager_checkService(std::get<0>(GetParam()).c_str())));
+ mMapper = IMapper::getService(std::get<1>(GetParam()));
+
+ ASSERT_NE(nullptr, mAllocator.get()) << "failed to get allocator service";
+ ASSERT_NE(nullptr, mMapper.get()) << "failed to get mapper service";
+ ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode";
+ }
+
+ void TearDown() override {}
+
+ BufferDescriptor createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo) {
+ BufferDescriptor descriptor;
+ mMapper->createDescriptor(
+ descriptorInfo, [&](const auto& tmpError, const auto& tmpDescriptor) {
+ ASSERT_EQ(Error::NONE, tmpError) << "failed to create descriptor";
+ descriptor = tmpDescriptor;
+ });
+
+ return descriptor;
+ }
+
+ native_handle_t* importBuffer(const hidl_handle& rawHandle) {
+ native_handle_t* bufferHandle = nullptr;
+ mMapper->importBuffer(rawHandle, [&](const auto& tmpError, const auto& tmpBuffer) {
+ ASSERT_EQ(Error::NONE, tmpError)
+ << "failed to import buffer %p" << rawHandle.getNativeHandle();
+ bufferHandle = static_cast<native_handle_t*>(tmpBuffer);
+ });
+ return bufferHandle;
+ }
+
+ std::unique_ptr<BufferHandle> allocate(const IMapper::BufferDescriptorInfo& descriptorInfo,
+ bool import = false) {
+ auto descriptor = createDescriptor(descriptorInfo);
+ if (::testing::Test::HasFatalFailure()) {
+ return nullptr;
+ }
+
+ AllocationResult result;
+ auto status = mAllocator->allocate(descriptor, 1, &result);
+ if (!status.isOk()) {
+ status_t error = status.getExceptionCode();
+ if (error == EX_SERVICE_SPECIFIC) {
+ error = status.getServiceSpecificError();
+ EXPECT_NE(OK, error) << "Failed to set error properly";
+ EXPECT_EQ(OK, error) << "Failed to allocate";
+ } else {
+ EXPECT_EQ(OK, error) << "Allocation transport failure";
+ }
+ return nullptr;
+ } else {
+ if (import) {
+ native_handle_t* importedHandle = importBuffer(makeFromAidl(result.buffers[0]));
+ if (importedHandle) {
+ return std::make_unique<BufferHandle>(mMapper, importedHandle, true,
+ result.stride);
+ } else {
+ return nullptr;
+ }
+ } else {
+ return std::make_unique<BufferHandle>(mMapper, dupFromAidl(result.buffers[0]),
+ false, result.stride);
+ }
+ }
+ }
+};
+
+TEST_P(GraphicsAllocatorAidlTests, CreateDescriptorBasic) {
+ ASSERT_NO_FATAL_FAILURE(createDescriptor({
+ .name = "CPU_8888",
+ .width = 64,
+ .height = 64,
+ .layerCount = 1,
+ .format = cast(PixelFormat::RGBA_8888),
+ .usage = pack({BufferUsage::CPU_WRITE_OFTEN, BufferUsage::CPU_READ_OFTEN}),
+ .reservedSize = 0,
+ }));
+}
+
+TEST_P(GraphicsAllocatorAidlTests, CanAllocate) {
+ auto buffer = allocate({
+ .name = "CPU_8888",
+ .width = 64,
+ .height = 64,
+ .layerCount = 1,
+ .format = cast(PixelFormat::RGBA_8888),
+ .usage = pack({BufferUsage::CPU_WRITE_OFTEN, BufferUsage::CPU_READ_OFTEN}),
+ .reservedSize = 0,
+ });
+ ASSERT_NE(nullptr, buffer.get());
+ EXPECT_GE(buffer->stride(), 64);
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsAllocatorAidlTests);
+INSTANTIATE_TEST_CASE_P(
+ PerInstance, GraphicsAllocatorAidlTests,
+ testing::Combine(testing::ValuesIn(getAidlHalInstanceNames(IAllocator::descriptor)),
+ testing::ValuesIn(getAllHalInstanceNames(IMapper::descriptor))),
+ PrintInstanceTupleNameToString<>);
\ No newline at end of file
diff --git a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/BrightnessMode.aidl b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/BrightnessMode.aidl
index c4c6d64..8813907 100644
--- a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/BrightnessMode.aidl
+++ b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/BrightnessMode.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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.
+ */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/FlashMode.aidl b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/FlashMode.aidl
index 349f9f3..0411f82 100644
--- a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/FlashMode.aidl
+++ b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/FlashMode.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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.
+ */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLight.aidl b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLight.aidl
index c397f91..25a2dce 100644
--- a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLight.aidl
+++ b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLight.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2019 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.
+ */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLightState.aidl b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLightState.aidl
index 44a0882..40e520b 100644
--- a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLightState.aidl
+++ b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/HwLightState.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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.
+ */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/ILights.aidl b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/ILights.aidl
index fc6c626..30bb3c3 100644
--- a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/ILights.aidl
+++ b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/ILights.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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.
+ */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
diff --git a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/LightType.aidl b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/LightType.aidl
index 77ab98c..2b978ab 100644
--- a/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/LightType.aidl
+++ b/light/aidl/aidl_api/android.hardware.light/current/android/hardware/light/LightType.aidl
@@ -1,14 +1,30 @@
+/*
+ * Copyright (C) 2020 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.
+ */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
//
-// You must not make a backward incompatible changes to the AIDL files built
+// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
@@ -27,4 +43,5 @@
BLUETOOTH = 6,
WIFI = 7,
MICROPHONE = 8,
+ CAMERA = 9,
}
diff --git a/light/aidl/android/hardware/light/LightType.aidl b/light/aidl/android/hardware/light/LightType.aidl
index 9a7f656..f7161d0 100644
--- a/light/aidl/android/hardware/light/LightType.aidl
+++ b/light/aidl/android/hardware/light/LightType.aidl
@@ -32,4 +32,5 @@
BLUETOOTH = 6,
WIFI = 7,
MICROPHONE = 8,
+ CAMERA = 9,
}
diff --git a/light/aidl/default/Android.bp b/light/aidl/default/Android.bp
index 2ccf140..7920503 100644
--- a/light/aidl/default/Android.bp
+++ b/light/aidl/default/Android.bp
@@ -16,7 +16,7 @@
shared_libs: [
"libbase",
"libbinder_ndk",
- "android.hardware.light-V1-ndk",
+ "android.hardware.light-V2-ndk",
],
srcs: [
"Lights.cpp",
diff --git a/light/aidl/default/lights-default.xml b/light/aidl/default/lights-default.xml
index db604d6..abdd74e 100644
--- a/light/aidl/default/lights-default.xml
+++ b/light/aidl/default/lights-default.xml
@@ -1,6 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.light</name>
+ <version>2</version>
<fqname>ILights/default</fqname>
</hal>
</manifest>