diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1d74e21965c4f858f5f818a270e64e1bfad7d843 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/ diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 3851c0f949b515c242d996d5f5302da52fc6ecfd..fd893ec1ed69839f76149add527fdda23471f12a 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -33,7 +33,7 @@ aidl_interface { "android/hardware/audio/common/SourceMetadata.aidl", ], imports: [ - "android.media.audio.common.types", + "android.media.audio.common.types-V1", ], stability: "vintf", backend: { @@ -41,7 +41,12 @@ aidl_interface { enabled: true, }, java: { - platform_apis: true, + sdk_version: "module_current", + min_sdk_version: "31", + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], }, ndk: { apex_available: [ @@ -51,6 +56,11 @@ aidl_interface { min_sdk_version: "31", }, }, - versions: [ + versions_with_info: [ + { + version: "1", + imports: ["android.media.audio.common.types-V1"], + }, ], + } diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/1/.hash b/audio/aidl/aidl_api/android.hardware.audio.common/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..7fe1e438764b8ee79173196fdae9244046d4129f --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/1/.hash @@ -0,0 +1 @@ +90d0a7ea5cee4579d33066885d8648f180387f55 diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/PlaybackTrackMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/PlaybackTrackMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..be4941c7513512fef8638ac932c3dfe719f0d79b --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/PlaybackTrackMetadata.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable PlaybackTrackMetadata { + android.media.audio.common.AudioUsage usage = android.media.audio.common.AudioUsage.INVALID; + android.media.audio.common.AudioContentType contentType = android.media.audio.common.AudioContentType.UNKNOWN; + float gain; + android.media.audio.common.AudioChannelLayout channelMask; + @nullable android.media.audio.common.AudioDevice sourceDevice; + @utf8InCpp String[] tags; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/RecordTrackMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/RecordTrackMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8f667d1081629f1be20e9ff91b967772260da08e --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/RecordTrackMetadata.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RecordTrackMetadata { + android.media.audio.common.AudioSource source = android.media.audio.common.AudioSource.SYS_RESERVED_INVALID; + float gain; + @nullable android.media.audio.common.AudioDevice destinationDevice; + android.media.audio.common.AudioChannelLayout channelMask; + @utf8InCpp String[] tags; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/SinkMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/SinkMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..270147d2bbb1243c5aaf8eb109e745ef3f0df1d1 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/SinkMetadata.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SinkMetadata { + android.hardware.audio.common.RecordTrackMetadata[] tracks; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/SourceMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/SourceMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2d4a982352dd1c787ace5351397378ec66290424 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/1/android/hardware/audio/common/SourceMetadata.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SourceMetadata { + android.hardware.audio.common.PlaybackTrackMetadata[] tracks; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/PlaybackTrackMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/PlaybackTrackMetadata.aidl index 8fe869683b3316b5e70dd5ad1fd8b3b5c24f6967..be4941c7513512fef8638ac932c3dfe719f0d79b 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/PlaybackTrackMetadata.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/PlaybackTrackMetadata.aidl @@ -37,5 +37,7 @@ parcelable PlaybackTrackMetadata { android.media.audio.common.AudioUsage usage = android.media.audio.common.AudioUsage.INVALID; android.media.audio.common.AudioContentType contentType = android.media.audio.common.AudioContentType.UNKNOWN; float gain; + android.media.audio.common.AudioChannelLayout channelMask; + @nullable android.media.audio.common.AudioDevice sourceDevice; @utf8InCpp String[] tags; } diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/RecordTrackMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/RecordTrackMetadata.aidl index 50330ef8da15fcfb8967c883ffe3233d6e815636..8f667d1081629f1be20e9ff91b967772260da08e 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/RecordTrackMetadata.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/RecordTrackMetadata.aidl @@ -36,5 +36,7 @@ package android.hardware.audio.common; parcelable RecordTrackMetadata { android.media.audio.common.AudioSource source = android.media.audio.common.AudioSource.SYS_RESERVED_INVALID; float gain; + @nullable android.media.audio.common.AudioDevice destinationDevice; + android.media.audio.common.AudioChannelLayout channelMask; @utf8InCpp String[] tags; } diff --git a/audio/aidl/android/hardware/audio/common/PlaybackTrackMetadata.aidl b/audio/aidl/android/hardware/audio/common/PlaybackTrackMetadata.aidl index 28a2f32fe625a511f6426c3a159e48ecec697194..9ce1e1fe571952591a2baf942a8a20d3524fe4b4 100644 --- a/audio/aidl/android/hardware/audio/common/PlaybackTrackMetadata.aidl +++ b/audio/aidl/android/hardware/audio/common/PlaybackTrackMetadata.aidl @@ -16,7 +16,9 @@ package android.hardware.audio.common; +import android.media.audio.common.AudioChannelLayout; import android.media.audio.common.AudioContentType; +import android.media.audio.common.AudioDevice; import android.media.audio.common.AudioUsage; /** @@ -32,6 +34,11 @@ parcelable PlaybackTrackMetadata { * 0 means muted, 1 is unity gain, 2 means double amplitude, etc. */ float gain; + AudioChannelLayout channelMask; + /** + * Indicates the source of an output stream, can be left unspecified. + */ + @nullable AudioDevice sourceDevice; /** * Tags from AudioTrack audio attributes. Tag is an additional use case * qualifier complementing AudioUsage and AudioContentType. Tags are set by diff --git a/audio/aidl/android/hardware/audio/common/RecordTrackMetadata.aidl b/audio/aidl/android/hardware/audio/common/RecordTrackMetadata.aidl index 9a59b4175fee4aa7443a63a5e75a1d45a57c1183..dfd88f110d2132b1f8eac677e4efba1cf5176367 100644 --- a/audio/aidl/android/hardware/audio/common/RecordTrackMetadata.aidl +++ b/audio/aidl/android/hardware/audio/common/RecordTrackMetadata.aidl @@ -16,6 +16,9 @@ package android.hardware.audio.common; +import android.media.audio.common.AudioChannelLayout; +import android.media.audio.common.AudioContentType; +import android.media.audio.common.AudioDevice; import android.media.audio.common.AudioSource; /** @@ -30,6 +33,11 @@ parcelable RecordTrackMetadata { * 0 means muted, 1 is unity gain, 2 means double amplitude, etc. */ float gain; + /** + * Indicates the destination of an input stream, can be left unspecified. + */ + @nullable AudioDevice destinationDevice; + AudioChannelLayout channelMask; /** * Tags from AudioRecord audio attributes. Tag is an additional use case * qualifier complementing AudioUsage and AudioContentType. Tags are set by diff --git a/audio/common/5.0/Android.bp b/audio/common/5.0/Android.bp index c4f3d4c8c6e382dde09511f5b9b5496339a392be..fd8e85ff45f18f3c4f821f9a12ab59e0457dda53 100644 --- a/audio/common/5.0/Android.bp +++ b/audio/common/5.0/Android.bp @@ -20,4 +20,8 @@ hidl_interface { ], gen_java: true, gen_java_constants: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + ], } diff --git a/audio/common/6.0/Android.bp b/audio/common/6.0/Android.bp index fc54caff83ad9cd43e93b7e85b5d08c0d25d0cbf..91721fc7e9620aae0f02c5fc0f5576cea503d5c7 100644 --- a/audio/common/6.0/Android.bp +++ b/audio/common/6.0/Android.bp @@ -20,4 +20,8 @@ hidl_interface { ], gen_java: true, gen_java_constants: true, + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], } 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 d82d4adb5116de00acabd7dccdd34f0554c689f9..09b25d9cd4e8d09a266a64bbfd958918c7a040eb 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,57 @@ TEST_P(AudioHidlDeviceTest, SetConnectedState_7_1) { // 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 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(1977))); +} + +/** Stub implementation of IStreamOutEventCallback **/ +class MockOutLatencyModeCallback : public IStreamOutLatencyModeCallback { + Return onRecommendedLatencyModeChanged( + const hidl_vec& 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)); +} + +INSTANTIATE_TEST_CASE_P(LatencyModeOutputStream, LatencyModeOutputStreamTest, + ::testing::ValuesIn(getOutputDeviceSingleConfigParameters()), + &DeviceConfigParameterToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(LatencyModeOutputStreamTest); diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index 3007f017866b4fb6bd185824132de7a99508dbe0..c757032e0fe24fc8917ad0ea6c313f83a74fea1f 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -30,6 +30,7 @@ cc_defaults { "android.hardware.audio.common.test.utility", "audioclient-types-aidl-cpp", "libaudioclient_aidl_conversion", + "libstagefright_foundation", ], shared_libs: [ "libbinder", @@ -60,6 +61,7 @@ cc_test { "libmedia_helper", "android.hardware.audio@2.0", "android.hardware.audio.common@2.0", + "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=2", @@ -89,6 +91,7 @@ cc_test { "libmedia_helper", "android.hardware.audio@4.0", "android.hardware.audio.common@4.0", + "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=4", @@ -115,6 +118,7 @@ cc_test { "libmedia_helper", "android.hardware.audio@5.0", "android.hardware.audio.common@5.0", + "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=5", @@ -145,6 +149,7 @@ cc_test { "libmedia_helper", "android.hardware.audio@6.0", "android.hardware.audio.common@6.0", + "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=6", @@ -244,6 +249,7 @@ cc_test { static_libs: [ "android.hardware.audio@6.0", "android.hardware.audio.common@6.0", + "android.media.audio.common.types-V1-cpp", "libaudiofoundation", "libaudiopolicycomponents", "libmedia_helper", diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index 61d447dbd436cfc3aa3bc8bff5ccabb682833e45..38e9e5f467d31b0729e027cf72c1bfb442dfa74c 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -1041,6 +1041,7 @@ class StreamWriter : public StreamWorker { 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 @@ -1066,7 +1067,6 @@ class OutputStreamTest } #if MAJOR_VERSION >= 4 && MAJOR_VERSION <= 6 - protected: const SourceMetadata initMetadata = { { { AudioUsage::MEDIA, AudioContentType::MUSIC, diff --git a/audio/effect/all-versions/default/Android.bp b/audio/effect/all-versions/default/Android.bp index 1e01ffb3774024718d2a2c2d58c85beb89d831d3..a3c3ed6882a90648ef6438783879557eaff57505 100644 --- a/audio/effect/all-versions/default/Android.bp +++ b/audio/effect/all-versions/default/Android.bp @@ -30,6 +30,7 @@ cc_defaults { ], shared_libs: [ + "libaudioutils", "libbase", "libcutils", "libeffects", @@ -48,6 +49,7 @@ cc_defaults { "libeffects_headers", "libhardware_headers", "libmedia_headers", + "libmediautils_headers", ], } diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index 49f6bf2eceff162b3e3c58b68476d5a25acafafc..3baafc93434e377e46d230d1c17e970e29e674e7 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -22,13 +22,11 @@ #include "Effect.h" #include "common/all-versions/default/EffectMap.h" -#include - #define ATRACE_TAG ATRACE_TAG_AUDIO - #include #include #include +#include #include #include @@ -49,21 +47,27 @@ using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementati namespace { +#define SCOPED_STATS() \ + ::android::mediautils::ScopedStatistics scopedStatistics { \ + std::string("EffectHal::").append(__func__), mEffectHal->mStatistics \ + } + class ProcessThread : public Thread { public: // ProcessThread's lifespan never exceeds Effect's lifespan. - ProcessThread(std::atomic* stop, effect_handle_t effect, - std::atomic* inBuffer, std::atomic* outBuffer, - Effect::StatusMQ* statusMQ, EventFlag* efGroup) - : Thread(false /*canCallJava*/), - mStop(stop), - mEffect(effect), - mHasProcessReverse((*mEffect)->process_reverse != NULL), - mInBuffer(inBuffer), - mOutBuffer(outBuffer), - mStatusMQ(statusMQ), - mEfGroup(efGroup) {} - virtual ~ProcessThread() {} + ProcessThread(std::atomic* stop, effect_handle_t effect, + std::atomic* inBuffer, std::atomic* outBuffer, + Effect::StatusMQ* statusMQ, EventFlag* efGroup, Effect* effectHal) + : Thread(false /*canCallJava*/), + mStop(stop), + mEffect(effect), + mHasProcessReverse((*mEffect)->process_reverse != NULL), + mInBuffer(inBuffer), + mOutBuffer(outBuffer), + mStatusMQ(statusMQ), + mEfGroup(efGroup), + mEffectHal(effectHal) {} + virtual ~ProcessThread() {} private: std::atomic* mStop; @@ -73,6 +77,7 @@ class ProcessThread : public Thread { std::atomic* mOutBuffer; Effect::StatusMQ* mStatusMQ; EventFlag* mEfGroup; + Effect* const mEffectHal; bool threadLoop() override; }; @@ -102,6 +107,9 @@ bool ProcessThread::threadLoop() { audio_buffer_t* outBuffer = std::atomic_load_explicit(mOutBuffer, std::memory_order_relaxed); if (inBuffer != nullptr && outBuffer != nullptr) { + // Time this effect process + SCOPED_STATS(); + if (efState & static_cast(MessageQueueFlagBits::REQUEST_PROCESS)) { processResult = (*mEffect)->process(mEffect, inBuffer, outBuffer); } else { @@ -359,7 +367,7 @@ Return Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) { // Create and launch the thread. mProcessThread = new ProcessThread(&mStopProcessThread, mHandle, &mHalInBufferPtr, - &mHalOutBufferPtr, tempStatusMQ.get(), mEfGroup); + &mHalOutBufferPtr, tempStatusMQ.get(), mEfGroup, this); status = mProcessThread->run("effect", PRIORITY_URGENT_AUDIO); if (status != OK) { ALOGW("failed to start effect processing thread: %s", strerror(-status)); @@ -749,6 +757,8 @@ Return Effect::debug(const hidl_handle& fd, const hidl_vec& / if (fd.getNativeHandle() != nullptr && fd->numFds == 1) { uint32_t cmdData = fd->data[0]; (void)sendCommand(EFFECT_CMD_DUMP, "DUMP", sizeof(cmdData), &cmdData); + const std::string s = mStatistics->dump(); + if (s.size() != 0) write(cmdData, s.c_str(), s.size()); } return Void(); } diff --git a/audio/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h index f9a6796e8fdab1ab6b91d0a91acdd1d0b182cd98..011544d760a9ed8ab2c3c0d39d1262aeff93f9ba 100644 --- a/audio/effect/all-versions/default/Effect.h +++ b/audio/effect/all-versions/default/Effect.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -169,7 +170,11 @@ struct Effect : public IEffect { Result setParameterImpl(uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData); - private: + // process execution statistics + const std::shared_ptr> mStatistics = + std::make_shared>(); + + private: friend struct VirtualizerEffect; // for getParameterImpl friend struct VisualizerEffect; // to allow executing commands diff --git a/automotive/TEST_MAPPING b/automotive/TEST_MAPPING new file mode 100644 index 0000000000000000000000000000000000000000..c64c8805d63d3e2056c8af958ead9454adb96edb --- /dev/null +++ b/automotive/TEST_MAPPING @@ -0,0 +1,28 @@ +{ + "auto-presubmit": [ + { + "name": "AndroidCarApiTest" + }, + { + "name": "CarSecurityPermissionTest" + }, + { + "name": "CtsCarTestCases" + }, + { + "name": "CtsCarBuiltinApiTestCases" + }, + { + "name": "CtsCarHostTestCases" + }, + { + "name": "CtsCarBuiltinApiHostTestCases" + }, + { + "name": "CarServiceTest" + }, + { + "name": "CarServiceUnitTest" + } + ] +} \ No newline at end of file diff --git a/automotive/audiocontrol/1.0/Android.bp b/automotive/audiocontrol/1.0/Android.bp index 628793bfbde3185af03816dfb97f62f6eeb91f5b..53ed78b9501da1330eaaa9f24edc484404fab307 100644 --- a/automotive/audiocontrol/1.0/Android.bp +++ b/automotive/audiocontrol/1.0/Android.bp @@ -20,4 +20,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], } diff --git a/automotive/audiocontrol/2.0/Android.bp b/automotive/audiocontrol/2.0/Android.bp index 4d1fdbca26f405a3eda7310a9cfbb6ac2f06f00d..413cf48e93cb0d13651ddec59b0ca01eb3355b87 100644 --- a/automotive/audiocontrol/2.0/Android.bp +++ b/automotive/audiocontrol/2.0/Android.bp @@ -24,4 +24,8 @@ hidl_interface { "android.hidl.safe_union@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], } diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index 623097c930b8ce3e5c270e1e5ba8d14c51cfae00..e5f7a4f8c1a2494c47399fec42c064b67e6eb4ce 100644 --- a/automotive/audiocontrol/aidl/Android.bp +++ b/automotive/audiocontrol/aidl/Android.bp @@ -14,16 +14,36 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/automotive/audiocontrol/*.aidl"], imports: [ - "android.media.audio.common.types", - "android.hardware.audio.common", + "android.hardware.audio.common-V1", + "android.media.audio.common.types-V1", ], stability: "vintf", backend: { java: { - platform_apis: true, + sdk_version: "module_current", + min_sdk_version: "31", + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], }, }, - versions: [ - "1", + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.audio.common-V1", + "android.media.audio.common.types-V1", + ], + }, + { + version: "2", + imports: [ + "android.hardware.audio.common-V1", + "android.media.audio.common.types-V1", + ], + }, + ], + } diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/.hash b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..c10902125c11969f4c6e969d6cabeec71fcfdb15 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/.hash @@ -0,0 +1 @@ +b9c1e8584d328e39eac9eff2ef039a6541186cc4 diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..58a36673cdec15b46f0c2234f8f53ee3cc67ad9f --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl @@ -0,0 +1,45 @@ +/* + * 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 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 -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.audiocontrol; +@Backing(type="int") @VintfStability +enum AudioFocusChange { + NONE = 0, + GAIN = 1, + GAIN_TRANSIENT = 2, + GAIN_TRANSIENT_MAY_DUCK = 3, + GAIN_TRANSIENT_EXCLUSIVE = 4, + LOSS = -1, + LOSS_TRANSIENT = -2, + LOSS_TRANSIENT_CAN_DUCK = -3, +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91ce0352293852bc924489ce2d425a221cf50961 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.audiocontrol; +@VintfStability +parcelable AudioGainConfigInfo { + int zoneId; + String devicePortAddress; + int volumeIndex; +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/DuckingInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..23abb46bd759494a56317ad873d52fa5716b976c --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/DuckingInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.audiocontrol; +@VintfStability +parcelable DuckingInfo { + int zoneId; + String[] deviceAddressesToDuck; + String[] deviceAddressesToUnduck; + String[] usagesHoldingFocus; + @nullable android.hardware.audio.common.PlaybackTrackMetadata[] playbackMetaDataHoldingFocus; +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IAudioControl.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8dc5ffe2ebbef7450d9b0261e64f5b54ab11bc84 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IAudioControl.aidl @@ -0,0 +1,49 @@ +/* + * 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 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 -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.audiocontrol; +@VintfStability +interface IAudioControl { + /** + * @deprecated use {@link android.hardware.audio.common.PlaybackTrackMetadata} instead. + */ + oneway void onAudioFocusChange(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange); + oneway void onDevicesToDuckChange(in android.hardware.automotive.audiocontrol.DuckingInfo[] duckingInfos); + oneway void onDevicesToMuteChange(in android.hardware.automotive.audiocontrol.MutingInfo[] mutingInfos); + oneway void registerFocusListener(in android.hardware.automotive.audiocontrol.IFocusListener listener); + oneway void setBalanceTowardRight(in float value); + oneway void setFadeTowardFront(in float value); + oneway void onAudioFocusChangeWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange); + oneway void setAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains); + oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback); +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..17a087f20c781375414fafb0df27c730d22519ff --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.audiocontrol; +@VintfStability +interface IAudioGainCallback { + oneway void onAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains); +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IFocusListener.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3e175529fa1d233f3706e8c5c6f3d6e65c1be9a2 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/IFocusListener.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.audiocontrol; +@VintfStability +interface IFocusListener { + oneway void abandonAudioFocus(in String usage, in int zoneId); + oneway void requestAudioFocus(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain); + oneway void abandonAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId); + oneway void requestAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain); +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/MutingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/MutingInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b25ed0f1e92e6daba4e8ee50967b221e117cc124 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/MutingInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.audiocontrol; +@VintfStability +parcelable MutingInfo { + int zoneId; + String[] deviceAddressesToMute; + String[] deviceAddressesToUnmute; +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/Reasons.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/Reasons.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c1e22d44a7d5e591dd7af910019440aa95fe8842 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/2/android/hardware/automotive/audiocontrol/Reasons.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.audiocontrol; +@Backing(type="int") @VintfStability +enum Reasons { + FORCED_MASTER_MUTE = 1, + REMOTE_MUTE = 2, + TCU_MUTE = 4, + ADAS_DUCKING = 8, + NAV_DUCKING = 16, + PROJECTION_DUCKING = 32, + THERMAL_LIMITATION = 64, + SUSPEND_EXIT_VOL_LIMITATION = 128, + EXTERNAL_AMP_VOL_FEEDBACK = 256, + OTHER = -2147483648, +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl index fb6ac65005ca719b302bac96d62e198e32e3b019..91ce0352293852bc924489ce2d425a221cf50961 100644 --- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.audiocontrol; -@JavaDerive(equals=true, toString=true) @VintfStability +@VintfStability parcelable AudioGainConfigInfo { int zoneId; String devicePortAddress; diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl index c93829665a935d311f62d5667f566488c90f8e2b..68bfeab990d557cb64c767ab871063c15738d1ea 100644 --- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl +++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl @@ -21,7 +21,6 @@ package android.hardware.automotive.audiocontrol; * Was expecting to reuse android.media.audio types... Limit info to minimum to prevent * duplicating aidl_api. Will follow up if AudioGainConfig is exposed by android.media AIDL API. */ -@JavaDerive(equals=true, toString=true) @VintfStability parcelable AudioGainConfigInfo { /** diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl index c30d5f60ddc89d2f88660bda3450b71ce4b4db40..513af4707ec02fa67f4a09c2c566d5064f1b6614 100644 --- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl +++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl @@ -18,47 +18,47 @@ package android.hardware.automotive.audiocontrol; import android.hardware.audio.common.PlaybackTrackMetadata; - /** - * The current ducking information for a single audio zone. - * - *

This includes devices to duck, as well as unduck based on the contents of a previous - * {@link DuckingInfo}. Additionally, the current usages holding focus in the specified zone are - * included, which were used to determine which addresses to duck. - */ - @VintfStability - parcelable DuckingInfo { - /** - * ID of the associated audio zone - */ - int zoneId; +/** + * The current ducking information for a single audio zone. + * + *

This includes devices to duck, as well as unduck based on the contents of a previous + * {@link DuckingInfo}. Additionally, the current usages holding focus in the specified zone are + * included, which were used to determine which addresses to duck. + */ +@VintfStability +parcelable DuckingInfo { + /** + * ID of the associated audio zone + */ + int zoneId; - /** - * List of addresses for audio output devices that should be ducked. - * - *

The provided address strings are defined in audio_policy_configuration.xml. - */ - String[] deviceAddressesToDuck; + /** + * List of addresses for audio output devices that should be ducked. + * + *

The provided address strings are defined in audio_policy_configuration.xml. + */ + String[] deviceAddressesToDuck; - /** - * List of addresses for audio output devices that were previously be ducked and should now be - * unducked. - * - *

The provided address strings are defined in audio_policy_configuration.xml. - */ - String[] deviceAddressesToUnduck; + /** + * List of addresses for audio output devices that were previously be ducked and should now be + * unducked. + * + *

The provided address strings are defined in audio_policy_configuration.xml. + */ + String[] deviceAddressesToUnduck; - /** - * List of usages currently holding focus for this audio zone. - * - * This field was deprecated in version 2. - * Use playbackMetaDataHoldingFocus instead. - * - *

See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values. - */ - String[] usagesHoldingFocus; + /** + * List of usages currently holding focus for this audio zone. + * + * This field was deprecated in version 2. + * Use playbackMetaDataHoldingFocus instead. + * + *

See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values. + */ + String[] usagesHoldingFocus; - /** - * List of output stream metadata associated with the current focus holder for this audio zone - */ - @nullable PlaybackTrackMetadata[] playbackMetaDataHoldingFocus; + /** + * List of output stream metadata associated with the current focus holder for this audio zone + */ + @nullable PlaybackTrackMetadata[] playbackMetaDataHoldingFocus; } diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl index 100f1ba78d1ac3221ec83002e59df72b4bf03c0e..0ffcd5e19f2fb5525d09884503f4366fcacfc28b 100644 --- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl +++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl @@ -16,14 +16,6 @@ package android.hardware.automotive.audiocontrol; -import android.hardware.automotive.audiocontrol.AudioFocusChange; -import android.hardware.automotive.audiocontrol.DuckingInfo; -import android.hardware.automotive.audiocontrol.MutingInfo; -import android.hardware.automotive.audiocontrol.IFocusListener; -import android.hardware.automotive.audiocontrol.IAudioGainCallback; -import android.hardware.automotive.audiocontrol.AudioGainConfigInfo; -import android.hardware.automotive.audiocontrol.Reasons; - /** * Important note on Metadata: * Metadata qualifies a playback track for an output stream. @@ -54,6 +46,13 @@ import android.hardware.automotive.audiocontrol.Reasons; * audio_policy_engine_configuration.xml file. */ import android.hardware.audio.common.PlaybackTrackMetadata; +import android.hardware.automotive.audiocontrol.AudioFocusChange; +import android.hardware.automotive.audiocontrol.AudioGainConfigInfo; +import android.hardware.automotive.audiocontrol.DuckingInfo; +import android.hardware.automotive.audiocontrol.IAudioGainCallback; +import android.hardware.automotive.audiocontrol.IFocusListener; +import android.hardware.automotive.audiocontrol.MutingInfo; +import android.hardware.automotive.audiocontrol.Reasons; /** * Interacts with the car's audio subsystem to manage audio sources and volumes @@ -90,19 +89,19 @@ interface IAudioControl { * @param duckingInfos an array of {@link DuckingInfo} objects for the audio zones where audio * focus has changed. */ - oneway void onDevicesToDuckChange(in DuckingInfo[] duckingInfos); + oneway void onDevicesToDuckChange(in DuckingInfo[] duckingInfos); - /** - * Notifies HAL of changes in output devices that the HAL should apply muting to. - * - * This will be called in response to changes in audio mute state for each volume group - * and will include a {@link MutingInfo} object per audio zone that experienced a mute state - * event. - * - * @param mutingInfos an array of {@link MutingInfo} objects for the audio zones where audio - * mute state has changed. - */ - oneway void onDevicesToMuteChange(in MutingInfo[] mutingInfos); + /** + * Notifies HAL of changes in output devices that the HAL should apply muting to. + * + * This will be called in response to changes in audio mute state for each volume group + * and will include a {@link MutingInfo} object per audio zone that experienced a mute state + * event. + * + * @param mutingInfos an array of {@link MutingInfo} objects for the audio zones where audio + * mute state has changed. + */ + oneway void onDevicesToMuteChange(in MutingInfo[] mutingInfos); /** * Registers focus listener to be used by HAL for requesting and abandoning audio focus. @@ -153,9 +152,9 @@ interface IAudioControl { * @param focusChange the AudioFocusChange that has occurred. */ oneway void onAudioFocusChangeWithMetaData(in PlaybackTrackMetadata playbackMetaData, - in int zoneId, in AudioFocusChange focusChange); + in int zoneId, in AudioFocusChange focusChange); - /** + /** * Notifies HAL of changes in output devices that the HAL should apply gain change to * and the reason(s) why * @@ -168,8 +167,8 @@ interface IAudioControl { * {@link android.hardware.automotive.audiocontrol.Reasons} constants. * * @param gains List of gains the change is intended to. - */ - oneway void setAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains); + */ + oneway void setAudioDeviceGainsChanged(in Reasons[] reasons, in AudioGainConfigInfo[] gains); /** * Registers callback to be used by HAL for reporting unexpected gain(s) changed and the diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl index 1ce1f40dea62c002f97dab1b55ca3a440a738102..ac9ac018347e62496f872a3d637f80cc8ad1eb3f 100644 --- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl +++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl @@ -16,9 +16,8 @@ package android.hardware.automotive.audiocontrol; -import android.hardware.automotive.audiocontrol.AudioFocusChange; - import android.hardware.audio.common.PlaybackTrackMetadata; +import android.hardware.automotive.audiocontrol.AudioFocusChange; /** * Callback interface for audio focus listener. @@ -72,8 +71,8 @@ interface IFocusListener { * @param playbackMetaData The output stream metadata associated with the focus request * @param zoneId The identifier for the audio zone that the HAL abandoning focus */ - oneway void abandonAudioFocusWithMetaData(in PlaybackTrackMetadata playbackMetaData, - in int zoneId); + oneway void abandonAudioFocusWithMetaData( + in PlaybackTrackMetadata playbackMetaData, in int zoneId); /** * Used to indicate that the audio output stream associated with @@ -87,5 +86,5 @@ interface IFocusListener { * constants. */ oneway void requestAudioFocusWithMetaData(in PlaybackTrackMetadata playbackMetaData, - in int zoneId, in AudioFocusChange focusGain); + in int zoneId, in AudioFocusChange focusGain); } diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl index 3d9e8a25e09340636058d119d8a39cc2a8afdd5e..860bf015f254aa738a5d8cc123962434e1f7640e 100644 --- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl +++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/Reasons.aidl @@ -28,58 +28,58 @@ enum Reasons { * This may be used for example in case of cyber attach to ensure driver can safely drive back * to garage to restore sw. */ - FORCED_MASTER_MUTE = 0x1, + FORCED_MASTER_MUTE = 0x1, /** - * Reports a mute request outside the IVI (Android) system. - * It may target to mute the list of - * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo}. - * A focus request may also be reported in addition if the use case that initiates the mute - * has matching {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata} - * For regulation issue, the action of mute could be managed by HAL itself. + * Reports a mute request outside the IVI (Android) system. + * It may target to mute the list of + * {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo}. + * A focus request may also be reported in addition if the use case that initiates the mute + * has matching {@link android.hardware.automotive.audiocontrol.PlaybackTrackMetadata} + * For regulation issue, the action of mute could be managed by HAL itself. */ - REMOTE_MUTE = 0x2, + REMOTE_MUTE = 0x2, /** - * Reports a mute initiated by the TCU. It may be applied to all audio source (no - * associated {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} reported, or - * it may target to mute only the given list of ports. - * A focus request may also be reported in addition. - * For regulation issue, the action of mute could be managed by HAL itself. + * Reports a mute initiated by the TCU. It may be applied to all audio source (no + * associated {@link android.hardware.automotive.audiocontrol.AudioGainConfigInfo} reported, or + * it may target to mute only the given list of ports. + * A focus request may also be reported in addition. + * For regulation issue, the action of mute could be managed by HAL itself. */ - TCU_MUTE = 0x4, + TCU_MUTE = 0x4, /** * Reports a duck due to ADAS use case. A focus request may also be reported in addition. * For regulation issue, the action of duck could be managed by HAL itself. * It gives a chance to CarAudioService to decide whether contextual volume change may be * applied from the ducked index base or not. */ - ADAS_DUCKING = 0x8, + ADAS_DUCKING = 0x8, /** * Reports a duck due to navigation use case. It gives a chance to CarAudioService to decide * whether contextual volume change may be applied from the ducked index base or not. */ - NAV_DUCKING = 0x10, + NAV_DUCKING = 0x10, /** * Some device projection stack may send signal to IVI to duck / unduck main audio stream. * In this case, Contextual Volume Policy may be adapted to control the alternate / secondary * audio stream. */ - PROJECTION_DUCKING = 0x20, + PROJECTION_DUCKING = 0x20, /** * When the amplifier is overheating, it may be recovered by limiting the volume. */ - THERMAL_LIMITATION = 0x40, + THERMAL_LIMITATION = 0x40, /** * Before the system enters suspend, it may ensure while exiting suspend or during cold boot * that the volume is limited to prevent from sound explosion. */ - SUSPEND_EXIT_VOL_LIMITATION = 0x80, + SUSPEND_EXIT_VOL_LIMITATION = 0x80, /** * When using an external amplifier, it may be required to keep volume in sync and have * asynchronous notification of effective volume change. */ - EXTERNAL_AMP_VOL_FEEDBACK = 0x100, + EXTERNAL_AMP_VOL_FEEDBACK = 0x100, /** * For other OEM use. */ - OTHER = 0x80000000, + OTHER = 0x80000000, } diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp index 1439cce60686dbac89dd9a1124ee0e61c69a4df5..6bf4b9d860fea145fbf6ceaaa284604743df912c 100644 --- a/automotive/audiocontrol/aidl/default/Android.bp +++ b/automotive/audiocontrol/aidl/default/Android.bp @@ -29,8 +29,9 @@ cc_binary { vendor: true, shared_libs: [ "android.hardware.audio.common@7.0-enums", + "android.hardware.audio.common-V1-ndk", "android.frameworks.automotive.powerpolicy-V1-ndk", - "android.hardware.automotive.audiocontrol-V1-ndk", + "android.hardware.automotive.audiocontrol-V2-ndk", "libbase", "libbinder_ndk", "libcutils", diff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp index c0bc796cdf46db37bb43c6d52e5b7637d7339b67..a121f8be21ed203b39ff178cbd94b78ae82f7391 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.cpp +++ b/automotive/audiocontrol/aidl/default/AudioControl.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include namespace aidl::android::hardware::automotive::audiocontrol { @@ -147,6 +149,47 @@ ndk::ScopedAStatus AudioControl::onDevicesToMuteChange( return ndk::ScopedAStatus::ok(); } +template +static inline std::string toString(const std::vector& in_values) { + return std::accumulate(std::begin(in_values), std::end(in_values), std::string{}, + [](std::string& ls, const aidl_type& rs) { + return ls += (ls.empty() ? "" : ",") + rs.toString(); + }); +} +template +static inline std::string toEnumString(const std::vector& in_values) { + return std::accumulate(std::begin(in_values), std::end(in_values), std::string{}, + [](std::string& ls, const aidl_enum_type& rs) { + return ls += (ls.empty() ? "" : ",") + toString(rs); + }); +} + +ndk::ScopedAStatus AudioControl::onAudioFocusChangeWithMetaData( + const audiohalcommon::PlaybackTrackMetadata& in_playbackMetaData, int32_t in_zoneId, + AudioFocusChange in_focusChange) { + LOG(INFO) << "Focus changed: " << toString(in_focusChange).c_str() << " for metadata " + << in_playbackMetaData.toString().c_str() << " in zone " << in_zoneId; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AudioControl::setAudioDeviceGainsChanged( + const std::vector& in_reasons, const std::vector& in_gains) { + LOG(INFO) << "Audio Device Gains changed: resons:" << toEnumString(in_reasons).c_str() + << " for devices: " << toString(in_gains).c_str(); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AudioControl::registerGainCallback( + const std::shared_ptr& in_callback) { + LOG(DEBUG) << ": " << __func__; + if (in_callback) { + std::atomic_store(&mAudioGainCallback, in_callback); + } else { + LOG(ERROR) << "Unexpected nullptr for audio gain callback resulting in no-op."; + } + return ndk::ScopedAStatus::ok(); +} + binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) { if (numArgs == 0) { return dumpsys(fd); @@ -159,6 +202,12 @@ binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) return cmdRequestFocus(fd, args, numArgs); } else if (EqualsIgnoreCase(option, "--abandon")) { return cmdAbandonFocus(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--requestFocusWithMetaData")) { + return cmdRequestFocusWithMetaData(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--abandonFocusWithMetaData")) { + return cmdAbandonFocusWithMetaData(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--audioGainCallback")) { + return cmdOnAudioDeviceGainsChanged(fd, args, numArgs); } else { dprintf(fd, "Invalid option: %s\n", option.c_str()); return STATUS_BAD_VALUE; @@ -171,20 +220,49 @@ binder_status_t AudioControl::dumpsys(int fd) { } else { dprintf(fd, "Focus listener registered\n"); } + dprintf(fd, "AudioGainCallback %sregistered\n", (mAudioGainCallback == nullptr ? "NOT " : "")); return STATUS_OK; } binder_status_t AudioControl::cmdHelp(int fd) const { dprintf(fd, "Usage: \n\n"); - dprintf(fd, "[no args]: dumps focus listener status\n"); + dprintf(fd, "[no args]: dumps focus listener / gain callback registered status\n"); dprintf(fd, "--help: shows this help\n"); dprintf(fd, "--request : requests audio focus for specified " - "usage (string), audio zone ID (int), and focus gain type (int)\n"); + "usage (string), audio zone ID (int), and focus gain type (int)\n" + "Deprecated, use MetaData instead\n"); dprintf(fd, "--abandon : abandons audio focus for specified usage (string) and " - "audio zone ID (int)\n"); + "audio zone ID (int)\n" + "Deprecated, use MetaData instead\n"); dprintf(fd, "See audio_policy_configuration.xsd for valid AudioUsage values.\n"); + + dprintf(fd, + "--requestFocusWithMetaData : " + "requests audio focus for specified metadata, audio zone ID (int), " + "and focus gain type (int)\n"); + dprintf(fd, + "--abandonFocusWithMetaData : " + "abandons audio focus for specified metadata and audio zone ID (int)\n"); + dprintf(fd, + "--audioGainCallback [, ...]" + " [ ...]: fire audio " + "gain callback for audio zone ID (int), the given reasons (csv int) for given pairs " + "of device address (string) and gain index (int) \n"); + + dprintf(fd, + "Note on : specified as where (int)usage, " + "(int)content type and tags (string)string)\n"); + dprintf(fd, + "See android/media/audio/common/AudioUsageType.aidl for valid AudioUsage values.\n"); + dprintf(fd, + "See android/media/audio/common/AudioContentType.aidl for valid AudioContentType " + "values.\n"); + dprintf(fd, + "Tags are optional. If provided, it must follow the = pattern, where the " + "value is namespaced (for example com.google.strategy=VR).\n"); + return STATUS_OK; } @@ -266,4 +344,174 @@ binder_status_t AudioControl::cmdAbandonFocus(int fd, const char** args, uint32_ return STATUS_OK; } +binder_status_t AudioControl::parseMetaData(int fd, const std::string& metadataLiteral, + audiohalcommon::PlaybackTrackMetadata& trackMetadata) { + std::stringstream csvMetaData(metadataLiteral); + std::vector splitMetaData; + std::string attribute; + while (getline(csvMetaData, attribute, ',')) { + splitMetaData.push_back(attribute); + } + if (splitMetaData.size() != 2 && splitMetaData.size() != 3) { + dprintf(fd, + "Invalid metadata: %s, please provide as " + "where (int)usage, (int)content type and tags (string)string)\n", + metadataLiteral.c_str()); + return STATUS_BAD_VALUE; + } + int usage; + if (!safelyParseInt(splitMetaData[0], &usage)) { + dprintf(fd, "Non-integer usage provided with request: %s\n", splitMetaData[0].c_str()); + return STATUS_BAD_VALUE; + } + int contentType; + if (!safelyParseInt(splitMetaData[1], &contentType)) { + dprintf(fd, "Non-integer content type provided with request: %s\n", + splitMetaData[1].c_str()); + return STATUS_BAD_VALUE; + } + const std::string tags = (splitMetaData.size() == 3 ? splitMetaData[2] : ""); + + trackMetadata = {.usage = static_cast(usage), + .contentType = static_cast(contentType), + .tags = {tags}}; + return STATUS_OK; +} + +binder_status_t AudioControl::cmdRequestFocusWithMetaData(int fd, const char** args, + uint32_t numArgs) { + if (!checkCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 4) { + dprintf(fd, + "Invalid number of arguments: please provide:\n" + "--requestFocusWithMetaData : " + "requests audio focus for specified metadata, audio zone ID (int), " + "and focus gain type (int)\n"); + return STATUS_BAD_VALUE; + } + std::string metadataLiteral = std::string(args[1]); + audiohalcommon::PlaybackTrackMetadata trackMetadata{}; + auto status = parseMetaData(fd, metadataLiteral, trackMetadata); + if (status != STATUS_OK) { + return status; + } + + int zoneId; + if (!safelyParseInt(std::string(args[2]), &zoneId)) { + dprintf(fd, "Non-integer zoneId provided with request: %s\n", std::string(args[2]).c_str()); + return STATUS_BAD_VALUE; + } + + int focusGainValue; + if (!safelyParseInt(std::string(args[3]), &focusGainValue)) { + dprintf(fd, "Non-integer focusGain provided with request: %s\n", + std::string(args[3]).c_str()); + return STATUS_BAD_VALUE; + } + AudioFocusChange focusGain = AudioFocusChange(focusGainValue); + + if (mFocusListener == nullptr) { + dprintf(fd, "Unable to request focus - no focus listener registered\n"); + return STATUS_BAD_VALUE; + } + mFocusListener->requestAudioFocusWithMetaData(trackMetadata, zoneId, focusGain); + dprintf(fd, "Requested focus for metadata %s, zoneId %d, and focusGain %d\n", + trackMetadata.toString().c_str(), zoneId, focusGain); + return STATUS_OK; +} + +binder_status_t AudioControl::cmdAbandonFocusWithMetaData(int fd, const char** args, + uint32_t numArgs) { + if (!checkCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 3) { + dprintf(fd, + "Invalid number of arguments: please provide:\n" + "--abandonFocusWithMetaData : " + "abandons audio focus for specified metadata and audio zone ID (int)\n"); + return STATUS_BAD_VALUE; + } + std::string metadataLiteral = std::string(args[1]); + audiohalcommon::PlaybackTrackMetadata trackMetadata{}; + auto status = parseMetaData(fd, metadataLiteral, trackMetadata); + if (status != STATUS_OK) { + return status; + } + int zoneId; + if (!safelyParseInt(std::string(args[2]), &zoneId)) { + dprintf(fd, "Non-integer zoneId provided with request: %s\n", std::string(args[2]).c_str()); + return STATUS_BAD_VALUE; + } + if (mFocusListener == nullptr) { + dprintf(fd, "Unable to abandon focus - no focus listener registered\n"); + return STATUS_BAD_VALUE; + } + + mFocusListener->abandonAudioFocusWithMetaData(trackMetadata, zoneId); + dprintf(fd, "Abandoned focus for metadata %s and zoneId %d\n", trackMetadata.toString().c_str(), + zoneId); + return STATUS_OK; +} + +binder_status_t AudioControl::cmdOnAudioDeviceGainsChanged(int fd, const char** args, + uint32_t numArgs) { + if (!checkCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if ((numArgs + 1) % 2 != 0) { + dprintf(fd, + "Invalid number of arguments: please provide\n" + "--audioGainCallback [, ...]" + " [ ...]: " + "fire audio gain callback for audio zone ID (int), " + "with the given reasons (csv int) for given pairs of device address (string) " + "and gain index (int) \n"); + return STATUS_BAD_VALUE; + } + int zoneId; + if (!safelyParseInt(string(args[1]), &zoneId)) { + dprintf(fd, "Non-integer zoneId provided with request: %s\n", std::string(args[1]).c_str()); + return STATUS_BAD_VALUE; + } + std::string reasonsLiteral = std::string(args[2]); + std::stringstream csvReasonsLiteral(reasonsLiteral); + std::vector reasons; + std::string reasonLiteral; + while (getline(csvReasonsLiteral, reasonLiteral, ',')) { + int reason; + if (!safelyParseInt(reasonLiteral, &reason)) { + dprintf(fd, "Invalid Reason(s) provided %s\n", reasonLiteral.c_str()); + return STATUS_BAD_VALUE; + } + reasons.push_back(static_cast(reason)); + } + + std::vector agcis{}; + for (uint32_t i = 3; i < numArgs; i += 2) { + std::string deviceAddress = std::string(args[i]); + int32_t index; + if (!safelyParseInt(std::string(args[i + 1]), &index)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + std::string(args[i + 1]).c_str()); + return STATUS_BAD_VALUE; + } + AudioGainConfigInfo agci{zoneId, deviceAddress, index}; + agcis.push_back(agci); + } + if (mAudioGainCallback == nullptr) { + dprintf(fd, + "Unable to trig audio gain callback for reasons=%s and gains=%s\n" + " - no audio gain callback registered\n", + toEnumString(reasons).c_str(), toString(agcis).c_str()); + return STATUS_BAD_VALUE; + } + + mAudioGainCallback->onAudioDeviceGainsChanged(reasons, agcis); + dprintf(fd, "Fired audio gain callback for reasons=%s and gains=%s\n", + toEnumString(reasons).c_str(), toString(agcis).c_str()); + return STATUS_OK; +} } // namespace aidl::android::hardware::automotive::audiocontrol diff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h index cca9c44004476aff52459af23c7776464ce67450..16b80e890c7714f98c787c2f07dad4aad59819db 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.h +++ b/automotive/audiocontrol/aidl/default/AudioControl.h @@ -17,12 +17,20 @@ #define ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H #include +#include #include #include +#include #include +#include + +#include namespace aidl::android::hardware::automotive::audiocontrol { +namespace audiohalcommon = ::aidl::android::hardware::audio::common; +namespace audiomediacommon = ::aidl::android::media::audio::common; + class AudioControl : public BnAudioControl { public: ndk::ScopedAStatus onAudioFocusChange(const std::string& in_usage, int32_t in_zoneId, @@ -35,6 +43,15 @@ class AudioControl : public BnAudioControl { const std::shared_ptr& in_listener) override; ndk::ScopedAStatus setBalanceTowardRight(float in_value) override; ndk::ScopedAStatus setFadeTowardFront(float in_value) override; + ndk::ScopedAStatus onAudioFocusChangeWithMetaData( + const audiohalcommon::PlaybackTrackMetadata& in_playbackMetaData, int32_t in_zoneId, + AudioFocusChange in_focusChange) override; + ndk::ScopedAStatus setAudioDeviceGainsChanged( + const std::vector& in_reasons, + const std::vector& in_gains) override; + ndk::ScopedAStatus registerGainCallback( + const std::shared_ptr& in_callback) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; private: @@ -44,9 +61,22 @@ class AudioControl : public BnAudioControl { // listener, then it should also include mutexes or make the listener atomic. std::shared_ptr mFocusListener; + /** + * @brief mAudioGainCallback will be used by this HAL instance to communicate e.g. with a single + * instance of CarAudioService to report unexpected gain changed. + */ + std::shared_ptr mAudioGainCallback = nullptr; + binder_status_t cmdHelp(int fd) const; binder_status_t cmdRequestFocus(int fd, const char** args, uint32_t numArgs); binder_status_t cmdAbandonFocus(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdRequestFocusWithMetaData(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdAbandonFocusWithMetaData(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdOnAudioDeviceGainsChanged(int fd, const char** args, uint32_t numArgs); + + binder_status_t parseMetaData(int fd, const std::string& metadataLiteral, + audiohalcommon::PlaybackTrackMetadata& trackMetadata); + binder_status_t dumpsys(int fd); }; diff --git a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml index f95d05fe7779353a24a941f7df027c5196a261db..e82f6fada994d4370c322097886e6bce557dd851 100644 --- a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml +++ b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml @@ -1,4 +1,4 @@ - + android.hardware.automotive.audiocontrol IAudioControl/default diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index 6856b91d2b1418adee80afd83f36021f2b4596b0..3d4be4828fbcf019a3544fce911fcf854f55a59b 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -37,11 +37,16 @@ cc_test { "libxml2", ], static_libs: [ - "android.hardware.automotive.audiocontrol-V1-cpp", + "android.hardware.automotive.audiocontrol-V2-cpp", + "android.hardware.audio.common-V1-cpp", + "android.media.audio.common.types-V1-cpp", "libgmock", ], test_suites: [ "general-tests", "vts", ], + cflags: [ + "-Wno-deprecated-declarations", + ], } diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp index ae53c685285b693c69b91cf1c9b3ad5aba12afb8..f4f5eef757dfda14ebb115bcd38b632a3775570e 100644 --- a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp +++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -30,10 +31,13 @@ using android::sp; using android::String16; using android::binder::Status; using android::hardware::automotive::audiocontrol::AudioFocusChange; +using android::hardware::automotive::audiocontrol::AudioGainConfigInfo; +using android::hardware::automotive::audiocontrol::BnAudioGainCallback; using android::hardware::automotive::audiocontrol::BnFocusListener; using android::hardware::automotive::audiocontrol::DuckingInfo; using android::hardware::automotive::audiocontrol::IAudioControl; using android::hardware::automotive::audiocontrol::MutingInfo; +using android::hardware::automotive::audiocontrol::Reasons; #include "android_audio_policy_configuration_V7_0.h" @@ -41,6 +45,9 @@ namespace xsd { using namespace android::audio::policy::configuration::V7_0; } +namespace audiohalcommon = android::hardware::audio::common; +namespace audiomediacommon = android::media::audio::common; + class AudioControlAidl : public testing::TestWithParam { public: virtual void SetUp() override { @@ -103,6 +110,11 @@ struct FocusListenerMock : BnFocusListener { MOCK_METHOD(Status, requestAudioFocus, (const String16& usage, int32_t zoneId, AudioFocusChange focusGain)); MOCK_METHOD(Status, abandonAudioFocus, (const String16& usage, int32_t zoneId)); + MOCK_METHOD(Status, requestAudioFocusWithMetaData, + (const audiohalcommon::PlaybackTrackMetadata& metaData, int32_t zoneId, + AudioFocusChange focusGain)); + MOCK_METHOD(Status, abandonAudioFocusWithMetaData, + (const audiohalcommon::PlaybackTrackMetadata& metaData, int32_t zoneId)); }; /* @@ -159,6 +171,61 @@ TEST_P(AudioControlAidl, DuckChangeExercise) { ASSERT_TRUE(audioControl->onDevicesToDuckChange(duckingInfos).isOk()); } +TEST_P(AudioControlAidl, FocusChangeWithMetaDataExercise) { + ALOGI("Focus Change test"); + + audiohalcommon::PlaybackTrackMetadata metadata; + metadata.usage = audiomediacommon::AudioUsage::MEDIA; + metadata.contentType = audiomediacommon::AudioContentType::MUSIC; + metadata.tags = {"com.google.android=VR"}; + ASSERT_TRUE( + audioControl + ->onAudioFocusChangeWithMetaData(metadata, 0, AudioFocusChange::GAIN_TRANSIENT) + .isOk()); +}; + +TEST_P(AudioControlAidl, SetAudioDeviceGainsChangedExercise) { + ALOGI("Set Audio Gains Changed test"); + + const std::vector reasons{Reasons::FORCED_MASTER_MUTE, Reasons::NAV_DUCKING}; + AudioGainConfigInfo agci1; + agci1.zoneId = 0; + agci1.devicePortAddress = String16("address 1"); + agci1.volumeIndex = 8; + + AudioGainConfigInfo agci2; + agci1.zoneId = 0; + agci1.devicePortAddress = String16("address 2"); + agci1.volumeIndex = 1; + + std::vector gains{agci1, agci2}; + ASSERT_TRUE(audioControl->setAudioDeviceGainsChanged(reasons, gains).isOk()); +} + +/* + * Test Audio Gain Callback registration. + * + * Verifies that: + * - registerGainCallback succeeds; + * - registering a second callback succeeds in replacing the first; + * - closing handle does not crash; + */ +struct AudioGainCallbackMock : BnAudioGainCallback { + MOCK_METHOD(Status, onAudioDeviceGainsChanged, + (const std::vector& reasons, + const std::vector& gains)); +}; + +TEST_P(AudioControlAidl, AudioGainCallbackRegistration) { + ALOGI("Focus listener test"); + + sp gainCallback = new AudioGainCallbackMock(); + ASSERT_TRUE(audioControl->registerGainCallback(gainCallback).isOk()); + + sp gainCallback2 = new AudioGainCallbackMock(); + ASSERT_TRUE(audioControl->registerGainCallback(gainCallback2).isOk()); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlAidl); INSTANTIATE_TEST_SUITE_P( Audiocontrol, AudioControlAidl, diff --git a/automotive/can/1.0/default/CanController.cpp b/automotive/can/1.0/default/CanController.cpp index 9c0f2c57a2f16c0c7d418d540b25cb2c424417bb..1b5bf5b48b8531b28b5f803ec91967b9ff1bc983 100644 --- a/automotive/can/1.0/default/CanController.cpp +++ b/automotive/can/1.0/default/CanController.cpp @@ -292,14 +292,6 @@ Return CanController::upInterface(const ICanController:: return ICanController::Result::OK; } -static bool unregisterCanBusService(const hidl_string& name, sp busService) { - auto manager = hidl::manager::V1_2::IServiceManager::getService(); - if (!manager) return false; - const auto res = manager->tryUnregister(ICanBus::descriptor, name, busService); - if (!res.isOk()) return false; - return res; -} - Return CanController::downInterface(const hidl_string& name) { LOG(VERBOSE) << "Attempting to bring interface down: " << name; @@ -313,12 +305,6 @@ Return CanController::downInterface(const hidl_string& name) { auto success = true; - if (!unregisterCanBusService(name, busEntry.mapped())) { - LOG(ERROR) << "Couldn't unregister " << name; - // don't return yet, let's try to do best-effort cleanup - success = false; - } - if (!busEntry.mapped()->down()) { LOG(ERROR) << "Couldn't bring " << name << " down"; success = false; diff --git a/automotive/can/1.0/default/libnl++/Android.bp b/automotive/can/1.0/default/libnl++/Android.bp index 790adcd073a759c0a17f1b4075f942b39d6832c4..2ebd1b473294af211cf3a5a305fc405ec904fc30 100644 --- a/automotive/can/1.0/default/libnl++/Android.bp +++ b/automotive/can/1.0/default/libnl++/Android.bp @@ -35,6 +35,7 @@ cc_library_static { "protocols/generic/Generic.cpp", "protocols/generic/GenericMessageBase.cpp", "protocols/generic/Unknown.cpp", + "protocols/generic/families/Mac80211hwsim.cpp", "protocols/generic/families/Nl80211.cpp", "protocols/route/Link.cpp", "protocols/route/Route.cpp", @@ -42,6 +43,7 @@ cc_library_static { "protocols/MessageDefinition.cpp", "protocols/NetlinkProtocol.cpp", "protocols/all.cpp", + "protocols/structs.cpp", "Attributes.cpp", "MessageFactory.cpp", "MessageMutator.cpp", diff --git a/automotive/can/1.0/default/libnl++/MessageMutator.cpp b/automotive/can/1.0/default/libnl++/MessageMutator.cpp index 00b48a66ae19d37526e9a36e0ec4cbda184f21c2..de2a2b1e475354b615cdf3cef47caca22099e499 100644 --- a/automotive/can/1.0/default/libnl++/MessageMutator.cpp +++ b/automotive/can/1.0/default/libnl++/MessageMutator.cpp @@ -19,7 +19,7 @@ namespace android::nl { MessageMutator::MessageMutator(nlmsghdr* buffer, size_t totalLen) - : mConstBuffer(buffer, totalLen), mMutableBuffer(buffer) { + : mMutableBuffer(buffer), mTotalLen(totalLen) { CHECK(totalLen >= sizeof(nlmsghdr)); } @@ -27,8 +27,12 @@ nlmsghdr* MessageMutator::operator->() const { return mMutableBuffer; } +Buffer MessageMutator::constBuffer() const { + return {mMutableBuffer, mTotalLen}; +} + MessageMutator::operator Buffer() const { - return mConstBuffer; + return constBuffer(); } uint64_t MessageMutator::read(Buffer attr) const { @@ -37,7 +41,8 @@ uint64_t MessageMutator::read(Buffer attr) const { void MessageMutator::write(Buffer attr, uint64_t val) const { const auto attrData = attr.data(); - const auto offset = mConstBuffer.getOffset(attrData); + // TODO(b/177251183): deduplicate this code against fragment() + const auto offset = constBuffer().getOffset(attrData); CHECK(offset.has_value()) << "Trying to write attribute that's not a member of this message"; const auto writeableBuffer = reinterpret_cast(mMutableBuffer) + *offset; @@ -47,4 +52,40 @@ void MessageMutator::write(Buffer attr, uint64_t val) const { memcpy(writeableBuffer, &val, std::min(sizeof(val), attrSize)); } +MessageMutator MessageMutator::fragment(Buffer buf) const { + const auto offset = constBuffer().getOffset(buf); + CHECK(offset.has_value()) << "Trying to modify a fragment outside of buffer range"; + + const auto writeableBuffer = reinterpret_cast(uintptr_t(mMutableBuffer) + *offset); + const auto len = buf.getRaw().len(); + CHECK(len <= mTotalLen - *offset); + + return {writeableBuffer, len}; +} + +MessageMutator::iterator MessageMutator::begin() const { + return {*this, constBuffer().begin()}; +} + +MessageMutator::iterator MessageMutator::end() const { + return {*this, constBuffer().end()}; +} + +MessageMutator::iterator::iterator(const MessageMutator& container, + Buffer::iterator current) + : mContainer(container), mCurrent(current) {} + +MessageMutator::iterator MessageMutator::iterator::operator++() { + ++mCurrent; + return *this; +} + +bool MessageMutator::iterator::operator==(const iterator& other) const { + return other.mCurrent == mCurrent; +} + +const MessageMutator MessageMutator::iterator::operator*() const { + return mContainer.fragment(*mCurrent); +} + } // namespace android::nl diff --git a/automotive/can/1.0/default/libnl++/Socket.cpp b/automotive/can/1.0/default/libnl++/Socket.cpp index 514d9bb1b9238d75778bdd66e5183aff0d1a798a..cc1d839434ca05673b263f37894f287a647d7f74 100644 --- a/automotive/can/1.0/default/libnl++/Socket.cpp +++ b/automotive/can/1.0/default/libnl++/Socket.cpp @@ -68,6 +68,11 @@ bool Socket::send(const Buffer& msg, const sockaddr_nl& sa) { return true; } +bool Socket::send(const Buffer& msg, uint32_t destination) { + sockaddr_nl sa = {.nl_family = AF_NETLINK, .nl_pad = 0, .nl_pid = destination, .nl_groups = 0}; + return send(msg, sa); +} + bool Socket::increaseReceiveBuffer(size_t maxSize) { if (maxSize == 0) { LOG(ERROR) << "Maximum receive size should not be zero"; @@ -157,6 +162,26 @@ pollfd Socket::preparePoll(short events) { return {mFd.get(), events, 0}; } +bool Socket::addMembership(unsigned group) { + const auto res = + setsockopt(mFd.get(), SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &group, sizeof(group)); + if (res < 0) { + PLOG(ERROR) << "Failed joining multicast group " << group; + return false; + } + return true; +} + +bool Socket::dropMembership(unsigned group) { + const auto res = + setsockopt(mFd.get(), SOL_NETLINK, NETLINK_DROP_MEMBERSHIP, &group, sizeof(group)); + if (res < 0) { + PLOG(ERROR) << "Failed leaving multicast group " << group; + return false; + } + return true; +} + Socket::receive_iterator::receive_iterator(Socket& socket, bool end) : mSocket(socket), mIsEnd(end) { if (!end) receive(); diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/Buffer.h b/automotive/can/1.0/default/libnl++/include/libnl++/Buffer.h index d759a0a570b44c9ca6b8a97c3382816b79e27fdd..4cabb9af87a4d0838d37e0783580bed1be4e9bb3 100644 --- a/automotive/can/1.0/default/libnl++/include/libnl++/Buffer.h +++ b/automotive/can/1.0/default/libnl++/include/libnl++/Buffer.h @@ -138,7 +138,7 @@ class Buffer { class raw_iterator : public iterator { public: iterator operator++() { - this->mCurrent.mData++; // ignore alignment + ++this->mCurrent.mData; // ignore alignment return *this; } const T& operator*() const { return *this->mCurrent.mData; } diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/Message.h b/automotive/can/1.0/default/libnl++/include/libnl++/Message.h index 50b3c4b05d4278cba0c324db0755c72eae1426dd..29f397d430f692623f6dac354e64c6cd5bcee5ac 100644 --- a/automotive/can/1.0/default/libnl++/include/libnl++/Message.h +++ b/automotive/can/1.0/default/libnl++/include/libnl++/Message.h @@ -34,7 +34,7 @@ namespace android::nl { * a single instance can only be used by a single thread - the one owning the underlying buffer). */ template -class Message { +class Message : public Buffer { public: /** * Validate buffer contents as a message carrying T data and create instance of parsed message. @@ -51,7 +51,7 @@ class Message { const auto attributes = buf.data(sizeof(T)); - return Message(nlHeader, dataHeader, attributes); + return Message(buf, nlHeader, dataHeader, attributes); } /** @@ -94,8 +94,9 @@ class Message { const T* operator->() const { return &data; } private: - Message(const nlmsghdr& nlHeader, const T& dataHeader, Attributes attributes) - : header(nlHeader), data(dataHeader), attributes(attributes) {} + Message(Buffer buffer, const nlmsghdr& nlHeader, const T& dataHeader, + Attributes attributes) + : Buffer(buffer), header(nlHeader), data(dataHeader), attributes(attributes) {} }; } // namespace android::nl diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/MessageMutator.h b/automotive/can/1.0/default/libnl++/include/libnl++/MessageMutator.h index 7d495e9a5b1f86bc1b780848ca0c9228c317cc8c..baadc44689256ca903c7ba0aa12661753a73fc82 100644 --- a/automotive/can/1.0/default/libnl++/include/libnl++/MessageMutator.h +++ b/automotive/can/1.0/default/libnl++/include/libnl++/MessageMutator.h @@ -53,9 +53,27 @@ class MessageMutator { */ void write(Buffer attr, uint64_t val) const; + class iterator { + public: + iterator(const MessageMutator& container, Buffer::iterator current); + + iterator operator++(); + bool operator==(const iterator& other) const; + const MessageMutator operator*() const; + + protected: + const MessageMutator& mContainer; + Buffer::iterator mCurrent; + }; + iterator begin() const; + iterator end() const; + private: - const Buffer mConstBuffer; nlmsghdr* mMutableBuffer; + size_t mTotalLen; + + Buffer constBuffer() const; + MessageMutator fragment(Buffer buf) const; }; } // namespace android::nl diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h index 8ea3575720fc56fbd6950dac8b319a82f29e7b8d..7ec0f7bdf903b7af8db9aa513294ce276734f58f 100644 --- a/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h +++ b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h @@ -94,6 +94,15 @@ class Socket { */ bool send(const Buffer& msg, const sockaddr_nl& sa); + /** + * Send Netlink message. + * + * \param msg Message to send. + * \param destination Destination PID. + * \return true, if succeeded. + */ + bool send(const Buffer& msg, uint32_t destination); + /** * Receive one or multiple Netlink messages. * @@ -182,6 +191,22 @@ class Socket { */ pollfd preparePoll(short events = 0); + /** + * Join a multicast group. + * + * \param group Group ID (*not* a bitfield) + * \return whether the operation succeeded + */ + bool addMembership(unsigned group); + + /** + * Leave a multicast group. + * + * \param group Group ID (*not* a bitfield) + * \return whether the operation succeeded + */ + bool dropMembership(unsigned group); + /** * Live iterator continuously receiving messages from Netlink socket. * diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/generic/families/mac80211_hwsim.h b/automotive/can/1.0/default/libnl++/include/libnl++/generic/families/mac80211_hwsim.h new file mode 100644 index 0000000000000000000000000000000000000000..9b811f8a3dadefc35b0484e263abc0b96de2cd39 --- /dev/null +++ b/automotive/can/1.0/default/libnl++/include/libnl++/generic/families/mac80211_hwsim.h @@ -0,0 +1,73 @@ +/* + * 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. + */ + +// API definitions from kernel drivers/net/wireless/mac80211_hwsim.h + +#define BIT(n) (1 << (n)) + +enum hwsim_tx_control_flags { + HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0), + HWSIM_TX_CTL_NO_ACK = BIT(1), + HWSIM_TX_STAT_ACK = BIT(2), +}; + +enum { + HWSIM_CMD_UNSPEC, + HWSIM_CMD_REGISTER, + HWSIM_CMD_FRAME, + HWSIM_CMD_TX_INFO_FRAME, + HWSIM_CMD_NEW_RADIO, + HWSIM_CMD_DEL_RADIO, + HWSIM_CMD_GET_RADIO, + HWSIM_CMD_ADD_MAC_ADDR, + HWSIM_CMD_DEL_MAC_ADDR, +}; + +enum { + HWSIM_ATTR_UNSPEC, + HWSIM_ATTR_ADDR_RECEIVER, + HWSIM_ATTR_ADDR_TRANSMITTER, + HWSIM_ATTR_FRAME, + HWSIM_ATTR_FLAGS, + HWSIM_ATTR_RX_RATE, + HWSIM_ATTR_SIGNAL, + HWSIM_ATTR_TX_INFO, + HWSIM_ATTR_COOKIE, + HWSIM_ATTR_CHANNELS, + HWSIM_ATTR_RADIO_ID, + HWSIM_ATTR_REG_HINT_ALPHA2, + HWSIM_ATTR_REG_CUSTOM_REG, + HWSIM_ATTR_REG_STRICT_REG, + HWSIM_ATTR_SUPPORT_P2P_DEVICE, + HWSIM_ATTR_USE_CHANCTX, + HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, + HWSIM_ATTR_RADIO_NAME, + HWSIM_ATTR_NO_VIF, + HWSIM_ATTR_FREQ, + HWSIM_ATTR_PAD, + HWSIM_ATTR_TX_INFO_FLAGS, + HWSIM_ATTR_PERM_ADDR, + HWSIM_ATTR_IFTYPE_SUPPORT, + HWSIM_ATTR_CIPHER_SUPPORT, +}; + +struct hwsim_tx_rate { + int8_t idx; + uint8_t count; +} __packed; +static_assert(sizeof(hwsim_tx_rate) == 2); + +#undef BIT diff --git a/automotive/can/1.0/default/libnl++/printer.cpp b/automotive/can/1.0/default/libnl++/printer.cpp index f08897e9514232a22937445baa399dfb206e8809..d5404825b8aa022fa7c0811e59d3bc2b693a6b10 100644 --- a/automotive/can/1.0/default/libnl++/printer.cpp +++ b/automotive/can/1.0/default/libnl++/printer.cpp @@ -154,16 +154,19 @@ static void toStream(std::stringstream& ss, const Buffer attr, } } -std::string toString(const Buffer hdr, int protocol, bool printPayload) { - if (!hdr.firstOk()) return "nlmsg{buffer overflow}"; +static void toStream(std::stringstream& ss, const Buffer hdr, int protocol, + bool printPayload) { + if (!hdr.firstOk()) { + ss << "nlmsg{buffer overflow}"; + return; + } - std::stringstream ss; ss << std::setfill('0'); auto protocolMaybe = protocols::get(protocol); if (!protocolMaybe.has_value()) { ss << "nlmsg{protocol=" << protocol << "}"; - return ss.str(); + return; } protocols::NetlinkProtocol& protocolDescr = *protocolMaybe; @@ -187,7 +190,7 @@ std::string toString(const Buffer hdr, int protocol, bool printPayload ss << ", crc=" << std::hex << std::setw(4) << crc16(hdr.data()) << std::dec; ss << '}'; - if (!printPayload) return ss.str(); + if (!printPayload) return; ss << ' '; if (!msgDescMaybe.has_value()) { @@ -210,6 +213,17 @@ std::string toString(const Buffer hdr, int protocol, bool printPayload } ss << "}"; +} + +std::string toString(const Buffer hdrs, int protocol, bool printPayload) { + std::stringstream ss; + bool first = true; + for (const auto hdr : hdrs) { + if (!first) ss << std::endl; + first = false; + + toStream(ss, hdr, protocol, printPayload); + } return ss.str(); } diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp index 1e1ad12c84cfc37e257b39fd09b748322b14b100..478c3831cf6d885122a0e1c6a30a86bb7af474ad 100644 --- a/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/generic/Ctrl.cpp @@ -16,6 +16,7 @@ #include "Ctrl.h" +#include "families/Mac80211hwsim.h" #include "families/Nl80211.h" #include @@ -68,12 +69,15 @@ void Ctrl::track(const Buffer hdr) { const auto familyId = msg.attributes.get(CTRL_ATTR_FAMILY_ID); const auto familyName = msg.attributes.get(CTRL_ATTR_FAMILY_NAME); - /* For now, we support just a single family. But if you add more, please define proper + /* For now, we support just two families. But if you add more, please define proper * abstraction and not hardcode every name and class here. */ if (familyName == "nl80211") { mFamilyRegister[familyId] = std::make_shared(familyId); } + if (familyName == "MAC80211_HWSIM") { + mFamilyRegister[familyId] = std::make_shared(familyId); + } } } // namespace android::nl::protocols::generic diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp index b7b811b629a7f6a542a2bb5116987ec9349c696b..f92d6c000b848e5f3d5cef23f2f629026b0a8674 100644 --- a/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/generic/GenericMessageBase.cpp @@ -40,9 +40,9 @@ void GenericMessageBase::toStream(std::stringstream& ss, const genlmsghdr& data) ss << "genlmsghdr{"; if (commandName.has_value()) { - ss << "cmd=" << unsigned(data.cmd); - } else { ss << "cmd=" << *commandName; + } else { + ss << "cmd=" << unsigned(data.cmd); } ss << ", version=" << unsigned(data.version); if (data.reserved != 0) ss << ", reserved=" << data.reserved; diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/families/Mac80211hwsim.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/families/Mac80211hwsim.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f85309e7a23b03580dee0df495f92e738a09fd9f --- /dev/null +++ b/automotive/can/1.0/default/libnl++/protocols/generic/families/Mac80211hwsim.cpp @@ -0,0 +1,91 @@ +/* + * 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. + */ + +#include "Mac80211hwsim.h" + +#include "../../structs.h" +#include "common.h" + +#include + +namespace android::nl::protocols::generic::families { + +using DataType = AttributeDefinition::DataType; +using Flags = AttributeDefinition::Flags; + +static void hwsim_tx_rateToStream(std::stringstream& ss, const Buffer attr); + +static const FlagsMap txControlFlags{ + {HWSIM_TX_CTL_REQ_TX_STATUS, "REQ_TX"}, + {HWSIM_TX_CTL_NO_ACK, "NO_ACK"}, + {HWSIM_TX_STAT_ACK, "ACK"}, +}; + +// clang-format off +Mac80211hwsim::Mac80211hwsim(nlmsgtype_t familyId) : GenericMessageBase(familyId, "hwsim", { + {HWSIM_CMD_UNSPEC, "UNSPEC"}, + {HWSIM_CMD_REGISTER, "REGISTER"}, + {HWSIM_CMD_FRAME, "FRAME"}, + {HWSIM_CMD_TX_INFO_FRAME, "TX_INFO_FRAME"}, + {HWSIM_CMD_NEW_RADIO, "NEW_RADIO"}, + {HWSIM_CMD_DEL_RADIO, "DEL_RADIO"}, + {HWSIM_CMD_GET_RADIO, "GET_RADIO"}, + {HWSIM_CMD_ADD_MAC_ADDR, "ADD_MAC_ADDR"}, + {HWSIM_CMD_DEL_MAC_ADDR, "DEL_MAC_ADDR"}, +}, { + {HWSIM_ATTR_UNSPEC, {"UNSPEC"}}, + {HWSIM_ATTR_ADDR_RECEIVER, {"ADDR_RECEIVER", DataType::Struct, hwaddrToStream}}, + {HWSIM_ATTR_ADDR_TRANSMITTER, {"ADDR_TRANSMITTER", DataType::Struct, hwaddrToStream}}, + {HWSIM_ATTR_FRAME, {"FRAME", DataType::Raw, AttributeMap{}, Flags::Verbose}}, + {HWSIM_ATTR_FLAGS, {"FLAGS", DataType::Struct, flagsToStream(txControlFlags)}}, + {HWSIM_ATTR_RX_RATE, {"RX_RATE", DataType::Uint}}, + {HWSIM_ATTR_SIGNAL, {"SIGNAL", DataType::Uint}}, + {HWSIM_ATTR_TX_INFO, {"TX_INFO", DataType::Struct, hwsim_tx_rateToStream}}, + {HWSIM_ATTR_COOKIE, {"COOKIE", DataType::Uint}}, + {HWSIM_ATTR_CHANNELS, {"CHANNELS", DataType::Uint}}, + {HWSIM_ATTR_RADIO_ID, {"RADIO_ID", DataType::Uint}}, + {HWSIM_ATTR_REG_HINT_ALPHA2, {"REG_HINT_ALPHA2", DataType::String}}, + {HWSIM_ATTR_REG_CUSTOM_REG, {"REG_CUSTOM_REG", DataType::Uint}}, + {HWSIM_ATTR_REG_STRICT_REG, {"REG_STRICT_REG", DataType::Flag}}, + {HWSIM_ATTR_SUPPORT_P2P_DEVICE, {"SUPPORT_P2P_DEVICE", DataType::Flag}}, + {HWSIM_ATTR_USE_CHANCTX, {"USE_CHANCTX", DataType::Flag}}, + {HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, {"DESTROY_RADIO_ON_CLOSE", DataType::Flag}}, + {HWSIM_ATTR_RADIO_NAME, {"RADIO_NAME", DataType::String}}, + {HWSIM_ATTR_NO_VIF, {"NO_VIF", DataType::Flag}}, + {HWSIM_ATTR_FREQ, {"FREQ", DataType::Uint}}, + {HWSIM_ATTR_PAD, {"PAD", DataType::Uint}}, + {HWSIM_ATTR_TX_INFO_FLAGS, {"TX_INFO_FLAGS"}}, // hwsim_tx_rate_flag + {HWSIM_ATTR_PERM_ADDR, {"PERM_ADDR"}}, + {HWSIM_ATTR_IFTYPE_SUPPORT, {"IFTYPE_SUPPORT", DataType::Uint}}, // NL80211_IFTYPE_STATION etc + {HWSIM_ATTR_CIPHER_SUPPORT, {"CIPHER_SUPPORT", DataType::Struct, arrayToStream}}, +}) {} +// clang-format on + +static void hwsim_tx_rateToStream(std::stringstream& ss, const Buffer attr) { + ss << '{'; + bool first = true; + for (const auto rate : attr.data().getRaw()) { + if (rate.idx == -1) continue; + + ss << (int)rate.idx << ": " << (unsigned)rate.count; + + if (!first) ss << ", "; + first = false; + } + ss << '}'; +} + +} // namespace android::nl::protocols::generic::families diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/families/Mac80211hwsim.h b/automotive/can/1.0/default/libnl++/protocols/generic/families/Mac80211hwsim.h new file mode 100644 index 0000000000000000000000000000000000000000..c01eb93b91425c3aa7690dcc3a7c84743231da9d --- /dev/null +++ b/automotive/can/1.0/default/libnl++/protocols/generic/families/Mac80211hwsim.h @@ -0,0 +1,28 @@ +/* + * 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. + */ + +#pragma once + +#include "../GenericMessageBase.h" + +namespace android::nl::protocols::generic::families { + +class Mac80211hwsim : public GenericMessageBase { + public: + Mac80211hwsim(nlmsgtype_t familyId); +}; + +} // namespace android::nl::protocols::generic::families diff --git a/automotive/can/1.0/default/libnl++/protocols/structs.cpp b/automotive/can/1.0/default/libnl++/protocols/structs.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ff71f006a442a89167c3321c2e3944d4343ca60 --- /dev/null +++ b/automotive/can/1.0/default/libnl++/protocols/structs.cpp @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#include "structs.h" + +#include + +namespace android::nl::protocols { + +AttributeDefinition::ToStream flagsToStream(FlagsMap flags) { + return [flags](std::stringstream& ss, const Buffer attr) { + auto val = attr.data().copyFirst(); + + bool first = true; + for (const auto& [flag, name] : flags) { + if ((val & flag) != flag) continue; + val &= ~flag; + + if (!first) ss << '|'; + first = false; + + ss << name; + } + + if (val == 0) return; + + if (!first) ss << '|'; + ss << std::hex << val << std::dec; + }; +} + +void hwaddrToStream(std::stringstream& ss, const Buffer attr) { + ss << std::hex; + bool first = true; + for (const auto byte : attr.data().getRaw()) { + if (!first) ss << ':'; + first = false; + + ss << std::setw(2) << unsigned(byte); + } + ss << std::dec; +} + +} // namespace android::nl::protocols diff --git a/automotive/can/1.0/default/libnl++/protocols/structs.h b/automotive/can/1.0/default/libnl++/protocols/structs.h index 44c17b84b9e18b4d79b3c2b9b6ca35b8c8c6bcfa..f3a8c44afe457824ef97f55f0cc9c29c800d8ae8 100644 --- a/automotive/can/1.0/default/libnl++/protocols/structs.h +++ b/automotive/can/1.0/default/libnl++/protocols/structs.h @@ -16,6 +16,8 @@ #pragma once +#include "MessageDefinition.h" + #include namespace android::nl::protocols { @@ -30,4 +32,9 @@ void arrayToStream(std::stringstream& ss, const Buffer attr) { ss << '}'; } +typedef std::map FlagsMap; +AttributeDefinition::ToStream flagsToStream(FlagsMap flags); + +void hwaddrToStream(std::stringstream& ss, const Buffer attr); + } // namespace android::nl::protocols diff --git a/automotive/can/1.0/tools/libprotocan/Android.bp b/automotive/can/1.0/tools/libprotocan/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..4c23fada2944efd5581bcd588eb5e0831f8460a4 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/Android.bp @@ -0,0 +1,42 @@ +// +// 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. +// + +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_library_static { + name: "libprotocan", + defaults: ["android.hardware.automotive.can@defaults"], + vendor: true, + srcs: [ + "Checksum.cpp", + "MessageCounter.cpp", + "MessageDef.cpp", + "MessageInjector.cpp", + "Signal.cpp", + ], + export_include_dirs: ["include"], + + shared_libs: [ + "android.hardware.automotive.can@1.0", + ], +} diff --git a/automotive/can/1.0/tools/libprotocan/Checksum.cpp b/automotive/can/1.0/tools/libprotocan/Checksum.cpp new file mode 100644 index 0000000000000000000000000000000000000000..72fb0af1a7936a48dd7d98a63a9f7797935ed582 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/Checksum.cpp @@ -0,0 +1,28 @@ +/* + * 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. + */ + +#include + +namespace android::hardware::automotive::protocan { + +Checksum::Checksum(Signal signal, formula f) : mSignal(signal), mFormula(f) {} + +void Checksum::update(can::V1_0::CanMessage& msg) const { + mSignal.set(msg, 0); + mSignal.set(msg, mFormula(msg) % (mSignal.maxValue + 1)); +} + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/MessageCounter.cpp b/automotive/can/1.0/tools/libprotocan/MessageCounter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ef9882fd8c5307585fd55f5a09604cec627b6298 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/MessageCounter.cpp @@ -0,0 +1,61 @@ +/* + * 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. + */ + +#include + +#include + +namespace android::hardware::automotive::protocan { + +/** Whether to log counter state messages. */ +static constexpr bool kSuperVerbose = false; + +MessageCounter::MessageCounter(Signal signal) : upperBound(signal.maxValue + 1), mSignal(signal) {} + +Signal::value MessageCounter::next() const { + CHECK(mCurrent.has_value()) << "Counter not initialized. Did you call isReady?"; + return (*mCurrent + 1) % upperBound; +} + +void MessageCounter::read(const can::V1_0::CanMessage& msg) { + auto val = mSignal.get(msg); + + if (!mCurrent.has_value()) { + LOG(VERBOSE) << "Got first counter val of " << val; + mCurrent = val; + return; + } + + auto nextVal = next(); + if (nextVal == val) { + if constexpr (kSuperVerbose) { + LOG(VERBOSE) << "Got next counter val of " << nextVal; + } + mCurrent = nextVal; + } else { + LOG(DEBUG) << "Ignoring next counter val of " << val << ", waiting for " << nextVal; + } +} + +bool MessageCounter::isReady() const { return mCurrent.has_value(); } + +void MessageCounter::increment(can::V1_0::CanMessage& msg) { + auto newVal = next(); + mCurrent = newVal; + mSignal.set(msg, newVal); +} + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/MessageDef.cpp b/automotive/can/1.0/tools/libprotocan/MessageDef.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23ce1df6401fca31597aff8274372f0d097e67b1 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/MessageDef.cpp @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#include + +#include + +namespace android::hardware::automotive::protocan { + +using can::V1_0::CanMessage; +using can::V1_0::CanMessageId; + +MessageDef::MessageDef(CanMessageId id, uint16_t len, std::map signals, + std::optional counter, std::optional checksum) + : id(id), kLen(len), kSignals(std::move(signals)), kCounter(counter), kChecksum(checksum) {} + +const Signal& MessageDef::operator[](const std::string& signalName) const { + auto it = kSignals.find(signalName); + CHECK(it != kSignals.end()) << "Signal " << signalName << " doesn't exist"; + return it->second; +} + +CanMessage MessageDef::makeDefault() const { + CanMessage msg = {}; + msg.id = id; + msg.payload.resize(kLen); + + for (auto const& [name, signal] : kSignals) { + signal.setDefault(msg); + } + + return msg; +} + +MessageCounter MessageDef::makeCounter() const { + CHECK(kCounter.has_value()) << "Can't build a counter for message without such signal"; + return MessageCounter(*kCounter); +} + +void MessageDef::updateChecksum(can::V1_0::CanMessage& msg) const { + if (!kChecksum.has_value()) return; + kChecksum->update(msg); +} + +bool MessageDef::validate(const can::V1_0::CanMessage& msg) const { + return msg.payload.size() >= kLen; +} + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/MessageInjector.cpp b/automotive/can/1.0/tools/libprotocan/MessageInjector.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7c45eaa025efa9592d386508287107fd07864950 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/MessageInjector.cpp @@ -0,0 +1,110 @@ +/* + * 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. + */ + +#include + +#include + +#include + +namespace android::hardware::automotive::protocan { + +/** Whether to log injected messages. */ +static constexpr bool kSuperVerbose = true; + +using namespace std::literals::chrono_literals; + +using can::V1_0::CanMessage; +using can::V1_0::CanMessageId; +using can::V1_0::ICanBus; +using can::V1_0::Result; + +MessageInjector::MessageInjector(MessageDef msgDef, + std::optional interMessageDelay) + : kMsgDef(std::move(msgDef)), + kInterMessageDelay(interMessageDelay), + mCounter(msgDef.makeCounter()) {} + +void MessageInjector::inject(const CanMessage& msg) { inject({msg}); } + +void MessageInjector::inject(const std::initializer_list msgs) { + std::lock_guard lock(mMessagesGuard); + for (const auto& msg : msgs) { + if constexpr (kSuperVerbose) { + LOG(VERBOSE) << "Message scheduled for injection: " << toString(msg); + } + + mMessages.push(msg); + } +} + +void MessageInjector::processQueueLocked(can::V1_0::ICanBus& bus) { + if (mMessages.empty() || !mCounter.isReady()) return; + + auto paddingMessagesCount = mCounter.upperBound - (mMessages.size() % mCounter.upperBound); + auto padMessage = kMsgDef.makeDefault(); + for (unsigned i = 0; i < paddingMessagesCount; i++) { + mMessages.push(padMessage); + } + + while (!mMessages.empty()) { + auto&& outMsg = mMessages.front(); + + mCounter.increment(outMsg); + kMsgDef.updateChecksum(outMsg); + + if constexpr (kSuperVerbose) { + LOG(VERBOSE) << "Injecting message: " << toString(outMsg); + } + auto result = bus.send(outMsg); + if (result != Result::OK) { + LOG(ERROR) << "Message injection failed: " << toString(result); + } + + mMessages.pop(); + + // This would block onReceive, but the class is not supposed to be used in production anyway + // (see MessageInjector docstring). + if (kInterMessageDelay.has_value()) { + std::this_thread::sleep_for(*kInterMessageDelay); + } + } +} + +void MessageInjector::onReceive(ICanBus& bus, const CanMessage& msg) { + if (!kMsgDef.validate(msg)) return; + + std::lock_guard lock(mMessagesGuard); + + mCounter.read(msg); + processQueueLocked(bus); +} + +MessageInjectorManager::MessageInjectorManager( + std::initializer_list> injectors) { + std::transform(injectors.begin(), injectors.end(), std::inserter(mInjectors, mInjectors.end()), + [](const std::shared_ptr& injector) { + return std::make_pair(injector->kMsgDef.id, std::move(injector)); + }); +} + +void MessageInjectorManager::onReceive(sp bus, const CanMessage& msg) { + auto it = mInjectors.find(msg.id); + if (it == mInjectors.end()) return; + it->second->onReceive(*bus, msg); +} + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/Signal.cpp b/automotive/can/1.0/tools/libprotocan/Signal.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc3e070ca105e85ff81baa66ee24bbf40ed29668 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/Signal.cpp @@ -0,0 +1,84 @@ +/* + * 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. + */ + +#include + +#include + +namespace android::hardware::automotive::protocan { + +static uint8_t calculateLastByteMask(uint16_t start, uint8_t length) { + unsigned lastByteBits = (start + length) % 8; + unsigned lastBytePadding = (8 - lastByteBits) % 8; + return 0xFF >> lastBytePadding; +} + +static uint8_t calculateFirstByteMask(uint16_t firstByte, uint8_t firstBit, uint16_t lastByte, + uint8_t lastMask) { + uint8_t firstMask = 0xFF << firstBit; + if (firstByte == lastByte) firstMask &= lastMask; + return firstMask; +} + +Signal::Signal(uint16_t start, uint8_t length, value defVal) + : maxValue((1u << length) - 1), + kFirstByte(start / 8), + kFirstBit(start % 8), + kFirstByteBits(8 - kFirstBit), + kLastByte((start + length - 1) / 8), + kLastMask(calculateLastByteMask(start, length)), + kFirstMask(calculateFirstByteMask(kFirstByte, kFirstBit, kLastByte, kLastMask)), + kDefVal(defVal) { + CHECK(length > 0) << "Signal length must not be zero"; +} + +Signal::value Signal::get(const can::V1_0::CanMessage& msg) const { + CHECK(msg.payload.size() > kLastByte) + << "Message is too short. Did you call MessageDef::validate?"; + + Signal::value v = 0; + if (kLastByte != kFirstByte) v = kLastMask & msg.payload[kLastByte]; + + for (int i = kLastByte - 1; i > kFirstByte; i--) { + v = (v << 8) | msg.payload[i]; + } + + return (v << kFirstByteBits) | ((msg.payload[kFirstByte] & kFirstMask) >> kFirstBit); +} + +void Signal::set(can::V1_0::CanMessage& msg, Signal::value val) const { + CHECK(msg.payload.size() > kLastByte) + << "Signal requires message of length " << (kLastByte + 1) + << " which is beyond message length of " << msg.payload.size(); + + uint8_t firstByte = val << kFirstBit; + val >>= kFirstByteBits; + + msg.payload[kFirstByte] = (msg.payload[kFirstByte] & ~kFirstMask) | (firstByte & kFirstMask); + + for (int i = kFirstByte + 1; i < kLastByte; i++) { + msg.payload[i] = val & 0xFF; + val >>= 8; + } + + if (kLastByte != kFirstByte) { + msg.payload[kLastByte] = (msg.payload[kLastByte] & ~kLastMask) | (val & kLastMask); + } +} + +void Signal::setDefault(can::V1_0::CanMessage& msg) const { set(msg, kDefVal); } + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/include/libprotocan/Checksum.h b/automotive/can/1.0/tools/libprotocan/include/libprotocan/Checksum.h new file mode 100644 index 0000000000000000000000000000000000000000..ff1dc91a50107b9ed3c3bf357e12caf917fb6c75 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/include/libprotocan/Checksum.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +namespace android::hardware::automotive::protocan { + +class Checksum { + public: + using formula = std::function; + + Checksum(Signal signal, formula f); + + void update(can::V1_0::CanMessage& msg) const; + + private: + const Signal mSignal; + const formula mFormula; +}; + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageCounter.h b/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageCounter.h new file mode 100644 index 0000000000000000000000000000000000000000..56113be61f37d0a616418081842566a4eec47c14 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageCounter.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +namespace android::hardware::automotive::protocan { + +class MessageCounter { + public: + const Signal::value upperBound; + + MessageCounter(Signal signal); + + /** + * Parse CAN message sent by external ECU to determine current counter value. + */ + void read(const can::V1_0::CanMessage& msg); + + /** + * States whether current counter value is determined. + */ + bool isReady() const; + + /** + * Increment current counter value and set it in a new message. + * + * Caller must check isReady() at least once before calling this method. + */ + void increment(can::V1_0::CanMessage& msg); + + private: + const Signal mSignal; + + std::optional mCurrent = std::nullopt; + + Signal::value next() const; +}; + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageDef.h b/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageDef.h new file mode 100644 index 0000000000000000000000000000000000000000..79b21e17b453d410d413cab8deb2803d0c67c680 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageDef.h @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +namespace android::hardware::automotive::protocan { + +/** + * CAN message definition (not the actual message data). + * + * Describes static message properties (message ID, signals etc). + */ +class MessageDef { + public: + const can::V1_0::CanMessageId id; + + /** + * Create message definition. + * + * Currently only constant length messages are supported. + * + * \param id CAN message ID + * \param len CAN message length + * \param signals CAN signal definitions + * \param counter Designated CAN signal definition for message counter, if the message has one + * \param checksum Designated CAN signal definition for payload checksum, if the message has one + */ + MessageDef(can::V1_0::CanMessageId id, uint16_t len, std::map signals, + std::optional counter = std::nullopt, + std::optional checksum = std::nullopt); + + const Signal& operator[](const std::string& signalName) const; + + can::V1_0::CanMessage makeDefault() const; + MessageCounter makeCounter() const; + + void updateChecksum(can::V1_0::CanMessage& msg) const; + + /** + * Validate the message payload is large enough to hold all the signals. + */ + bool validate(const can::V1_0::CanMessage& msg) const; + +private: + const uint16_t kLen; + const std::map kSignals; + const std::optional kCounter; + const std::optional kChecksum; +}; + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageInjector.h b/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageInjector.h new file mode 100644 index 0000000000000000000000000000000000000000..b0ea260640b8b69db35692b65dd8cf1f76387b8c --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/include/libprotocan/MessageInjector.h @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include + +namespace android::hardware::automotive::protocan { + +class MessageInjectorManager; + +/** + * Injects CAN messages with a counter to an existing system. + * + * This class is NOT meant to use in production - there should be no need to inject counted CAN + * messages where the other sender is also broadcasting them. If this is the case, it may be a sign + * your CAN network needs a redesign. This tool is intended for use for testing and demo purposes. + */ +class MessageInjector { + public: + MessageInjector(MessageDef msgDef, std::optional interMessageDelay); + + void inject(const can::V1_0::CanMessage& msg); + void inject(const std::initializer_list msgs); + + private: + const MessageDef kMsgDef; + const std::optional kInterMessageDelay; + MessageCounter mCounter; + + mutable std::mutex mMessagesGuard; + std::queue mMessages GUARDED_BY(mMessagesGuard); + + void onReceive(can::V1_0::ICanBus& bus, const can::V1_0::CanMessage& msg); + void processQueueLocked(can::V1_0::ICanBus& bus); + + friend class MessageInjectorManager; + + DISALLOW_COPY_AND_ASSIGN(MessageInjector); +}; + +/** + * Routes intercepted messages to MessageInjector instances configured to handle specific CAN + * message (CAN message ID). Intercepted messages from other nodes in CAN network are used to read + * current counter value in order to spoof the next packet. + */ +class MessageInjectorManager { + public: + MessageInjectorManager(std::initializer_list> injectors); + + void onReceive(sp bus, const can::V1_0::CanMessage& msg); + + private: + std::map> mInjectors; + + DISALLOW_COPY_AND_ASSIGN(MessageInjectorManager); +}; + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/include/libprotocan/Signal.h b/automotive/can/1.0/tools/libprotocan/include/libprotocan/Signal.h new file mode 100644 index 0000000000000000000000000000000000000000..7c0f11933a34e86252bf743913c401e518166233 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/include/libprotocan/Signal.h @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +namespace android::hardware::automotive::protocan { + +/** + * TODO(twasilczyk): right now, only Little Endian signals are supported. + */ +class Signal { + public: + using value = uint64_t; + + const value maxValue; + + Signal(uint16_t start, uint8_t length, value defVal = 0); + + value get(const can::V1_0::CanMessage& msg) const; + void set(can::V1_0::CanMessage& msg, value val) const; + void setDefault(can::V1_0::CanMessage& msg) const; + + private: + const uint16_t kFirstByte; ///< Index of first byte that holds the signal + const uint8_t kFirstBit; ///< Index of first bit within first byte + const uint8_t kFirstByteBits; ///< How many bits of the first byte belong to the signal + const uint16_t kLastByte; ///< Index of last byte that holds the signal + const uint8_t kLastMask; ///< Bits of the last byte that belong to the signal + const uint8_t kFirstMask; ///< Bits of the first byte that belong to the signal + + const value kDefVal; +}; + +} // namespace android::hardware::automotive::protocan diff --git a/automotive/can/1.0/tools/libprotocan/tests/Android.bp b/automotive/can/1.0/tools/libprotocan/tests/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..251cc061cd5fb83782403874e186f08400881f00 --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/tests/Android.bp @@ -0,0 +1,39 @@ +// +// 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. +// + +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: "libprotocan_signal_test", + defaults: ["android.hardware.automotive.can@defaults"], + vendor: true, + gtest: true, + srcs: ["libprotocan_signal_test.cpp"], + static_libs: [ + "libprotocan", + ], + shared_libs: [ + "android.hardware.automotive.can@1.0", + "libhidlbase", + ], +} diff --git a/automotive/can/1.0/tools/libprotocan/tests/libprotocan_signal_test.cpp b/automotive/can/1.0/tools/libprotocan/tests/libprotocan_signal_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..19c12099e676cbd3c6c7cc3dc61d0d27eac843fc --- /dev/null +++ b/automotive/can/1.0/tools/libprotocan/tests/libprotocan_signal_test.cpp @@ -0,0 +1,218 @@ +/* + * 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. + */ + +#include + +#include + +namespace android::hardware::automotive::protocan::unittest { + +TEST(SignalTest, TestGetSingleBytes) { + can::V1_0::CanMessage msg = {}; + msg.payload = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + for (unsigned i = 0; i < msg.payload.size(); i++) { + Signal signal(8 * i, 8); + ASSERT_EQ(i, signal.get(msg)); + } +} + +TEST(SignalTest, TestSetSingleBytes) { + std::vector msgs = {{}, {}, {}}; + msgs[0].payload = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + msgs[1].payload = {0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB}; + msgs[2].payload = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + for (unsigned i = 0; i < msgs[0].payload.size(); i++) { + Signal signal(8 * i, 8); + + for (auto&& msgOriginal : msgs) { + auto msgModified = msgOriginal; + signal.set(msgModified, 0xBA); + + auto msgExpected = msgOriginal; + msgExpected.payload[i] = 0xBA; + + ASSERT_EQ(msgExpected, msgModified) << "i=" << i; + } + } +} + +TEST(SignalTest, TestGetStart4) { + /* Data generated with Python3: + * + * from cantools.database.can import * + * hex(Message(1, 'm', 4, [Signal('s', 4, 16, byte_order='little_endian')]). + * decode(b'\xde\xad\xbe\xef')['s']) + */ + + can::V1_0::CanMessage msg = {}; + msg.payload = {0xDE, 0xAD, 0xBE, 0xEF}; + can::V1_0::CanMessage msg2 = {}; + msg2.payload = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD}; + + Signal s0_4(0, 4); + Signal s4_4(4, 4); + Signal s4_8(4, 8); + Signal s4_16(4, 16); + Signal s4_28(4, 28); + Signal s12_8(12, 8); + Signal s12_12(12, 12); + Signal s12_16(12, 16); + Signal s12_20(12, 20); + Signal s12_32(12, 32); + + ASSERT_EQ(0xEu, s0_4.get(msg)); + ASSERT_EQ(0xDu, s4_4.get(msg)); + ASSERT_EQ(0xDDu, s4_8.get(msg)); + ASSERT_EQ(0xEADDu, s4_16.get(msg)); + ASSERT_EQ(0xEFBEADDu, s4_28.get(msg)); + ASSERT_EQ(0xEAu, s12_8.get(msg)); + ASSERT_EQ(0xBEAu, s12_12.get(msg)); + ASSERT_EQ(0xFBEAu, s12_16.get(msg)); + ASSERT_EQ(0xEFBEAu, s12_20.get(msg)); + ASSERT_EQ(0xDDEEFBEAu, s12_32.get(msg2)); +} + +TEST(SignalTest, TestGet64) { + /* Data generated with Python3: + * + * from cantools.database.can import * + * hex(Message(1, 'm', 9, [Signal('s', 4, 64, byte_order='little_endian')]). + * decode(b'\xde\xad\xbe\xef\xab\xbc\xcd\xde\xef')['s']) + */ + + can::V1_0::CanMessage msg = {}; + msg.payload = {0xDE, 0xAD, 0xBE, 0xEF, 0xAB, 0xBC, 0xCD, 0xDE, 0xEF}; + + Signal s0_64(0, 64); + Signal s8_64(8, 64); + Signal s4_64(4, 64); + Signal s1_64(1, 64); + + ASSERT_EQ(0xDECDBCABEFBEADDEu, s0_64.get(msg)); + ASSERT_EQ(0xEFDECDBCABEFBEADu, s8_64.get(msg)); + ASSERT_EQ(0xFDECDBCABEFBEADDu, s4_64.get(msg)); + ASSERT_EQ(0xEF66DE55F7DF56EFu, s1_64.get(msg)); +} + +TEST(SignalTest, TestGetAllStarts) { + /* Data generated with Python3: + * + * from cantools.database.can import * + * hex(Message(1, 'm', 6, [Signal('s', 0, 20, byte_order='little_endian')]). + * decode(b'\xde\xad\xbe\xef\xde\xad')['s']) + */ + + std::map shifts = { + {0, 0xEADDEu}, {1, 0xF56EFu}, {2, 0xFAB77u}, {3, 0x7D5BBu}, {4, 0xBEADDu}, {5, 0xDF56Eu}, + {6, 0xEFAB7u}, {7, 0xF7D5Bu}, {8, 0xFBEADu}, {9, 0x7DF56u}, {10, 0xBEFABu}, {11, 0xDF7D5u}, + }; + + can::V1_0::CanMessage msg = {}; + msg.payload = {0xDE, 0xAD, 0xBE, 0xEF, 0xCC, 0xCC}; + + for (auto const& [start, expected] : shifts) { + Signal s(start, 20); + ASSERT_EQ(expected, s.get(msg)) << "shift of " << start << " failed"; + } +} + +TEST(SignalTest, TestSetStart4) { + /* Data generated with Python3: + * + * from cantools.database.can import * + * so=4 ; sl=8 + * md = Message(1, 'm', 4, [Signal('a1', 0, so), Signal('a2', so+sl, 32-so-sl), + * Signal('s', so, sl, byte_order='little_endian')]) + * m = md.decode(b'\xcc\xcc\xcc\xcc') + * m['s'] = 0xDE + * binascii.hexlify(md.encode(m)).upper() + */ + typedef struct { + int start; + int length; + Signal::value setValue; + hidl_vec payload; + } case_t; + + std::vector cases = { + {0, 4, 0xDu, {0xCD, 0xCC, 0xCC, 0xCC}}, {4, 4, 0xDu, {0xDC, 0xCC, 0xCC, 0xCC}}, + {4, 8, 0xDEu, {0xEC, 0xCD, 0xCC, 0xCC}}, {4, 16, 0xDEADu, {0xDC, 0xEA, 0xCD, 0xCC}}, + {4, 24, 0xDEADBEu, {0xEC, 0xDB, 0xEA, 0xCD}}, {4, 28, 0xDEADBEEu, {0xEC, 0xBE, 0xAD, 0xDE}}, + {12, 8, 0xDEu, {0xCC, 0xEC, 0xCD, 0xCC}}, {12, 12, 0xDEAu, {0xCC, 0xAC, 0xDE, 0xCC}}, + {12, 16, 0xDEADu, {0xCC, 0xDC, 0xEA, 0xCD}}, {12, 20, 0xDEADBu, {0xCC, 0xBC, 0xAD, 0xDE}}, + }; + + can::V1_0::CanMessage msg = {}; + msg.payload = {0xCC, 0xCC, 0xCC, 0xCC}; + + for (auto const& tcase : cases) { + Signal s(tcase.start, tcase.length); + + can::V1_0::CanMessage expectedMsg = {}; + expectedMsg.payload = tcase.payload; + + can::V1_0::CanMessage editedMsg = msg; + s.set(editedMsg, tcase.setValue); + + ASSERT_EQ(expectedMsg, editedMsg) << " set(" << tcase.start << ", " << tcase.length << ")"; + } +} + +TEST(SignalTest, TestSetAllStarts) { + /* Data generated with Python3: + * from cantools.database.can import * + * import binascii + * import textwrap + * + * length = 20 + * for start in range(0, 32 - length): + * signals = [Signal('s', start, length, byte_order='little_endian')] + * if start > 0: signals.append(Signal('a', 0, start, byte_order='little_endian')) + * signals.append(Signal('b', start + length, 32 - start - length, + * byte_order='little_endian')) + * + * md = Message(1, 'm', 4, signals) + * m = md.decode(b'\xcc\xcc\xcc\xcc') + * m['s'] = 0xDEADB + * out = binascii.hexlify(md.encode(m)).decode('ascii').upper() + * out = ', '.join(['0x{}'.format(v) for v in textwrap.wrap(out, 2)]) + * print('{{ {:d}, {{ {:s} }}}},'.format(start, out)) + */ + + std::map> shifts = { + {0, {0xDB, 0xEA, 0xCD, 0xCC}}, {1, {0xB6, 0xD5, 0xDB, 0xCC}}, {2, {0x6C, 0xAB, 0xF7, 0xCC}}, + {3, {0xDC, 0x56, 0xEF, 0xCC}}, {4, {0xBC, 0xAD, 0xDE, 0xCC}}, {5, {0x6C, 0x5B, 0xBD, 0xCD}}, + {6, {0xCC, 0xB6, 0x7A, 0xCF}}, {7, {0xCC, 0x6D, 0xF5, 0xCE}}, {8, {0xCC, 0xDB, 0xEA, 0xCD}}, + {9, {0xCC, 0xB6, 0xD5, 0xDB}}, {10, {0xCC, 0x6C, 0xAB, 0xF7}}, {11, {0xCC, 0xDC, 0x56, 0xEF}}, + }; + + can::V1_0::CanMessage msg = {}; + msg.payload = {0xCC, 0xCC, 0xCC, 0xCC}; + + for (auto const& [start, expectedPayload] : shifts) { + Signal s(start, 20); + + can::V1_0::CanMessage expectedMsg = {}; + expectedMsg.payload = expectedPayload; + + can::V1_0::CanMessage editedMsg = msg; + s.set(editedMsg, 0xDEADB); + + ASSERT_EQ(expectedMsg, editedMsg) << "shift of " << start << " failed"; + } +} + +} // namespace android::hardware::automotive::protocan::unittest diff --git a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp index d91d9f50359e1ae7a1ef3665528498c8760da255..a6e7baddc976fa2a946951af4d536f1cb879d29b 100644 --- a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp +++ b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,8 @@ namespace android::hardware::automotive::can::V1_0::vts { using hardware::hidl_vec; +using InterfaceType = ICanController::InterfaceType; +using IfId = ICanController::BusConfig::InterfaceId; struct CanMessageListener : public can::V1_0::ICanMessageListener { virtual Return onReceive(const can::V1_0::CanMessage&) override { return {}; } @@ -41,22 +44,62 @@ class CanBusHalTest : public ::testing::TestWithParam { virtual void SetUp() override; virtual void TearDown() override; + bool up(InterfaceType iftype, const std::string& srvname, const std::string& ifname); + std::tuple> listen(const hidl_vec& filter, const sp& listener); sp listenForErrors(const sp& listener); sp mCanBus; + sp mCanController; }; void CanBusHalTest::SetUp() { mCanBus = ICanBus::getService(GetParam()); ASSERT_TRUE(mCanBus) << "Couldn't open CAN Bus: " << GetParam(); + const auto controllers = getAllHalInstanceNames(ICanController::descriptor); + ASSERT_GT(controllers.size(), 0u); + // just grab the first one + mCanController = ICanController::getService(controllers[0]); + ASSERT_TRUE(mCanController) << "Couldn't open CAN Controller: " << controllers[0]; + + // this will throw an error if the bus is already up, but we have to try. + up(InterfaceType::VIRTUAL, GetParam(), "vcan0"); } void CanBusHalTest::TearDown() { mCanBus.clear(); } +bool CanBusHalTest::up(InterfaceType iftype, const std::string& srvname, + const std::string& ifname) { + ICanController::BusConfig config = {}; + config.name = srvname; + + // TODO(b/146214370): move interfaceId constructors to a library + if (iftype == InterfaceType::SOCKETCAN) { + IfId::Socketcan socketcan = {}; + socketcan.ifname(ifname); + config.interfaceId.socketcan(socketcan); + } else if (iftype == InterfaceType::SLCAN) { + IfId::Slcan slcan = {}; + slcan.ttyname(ifname); + config.interfaceId.slcan(slcan); + } else if (iftype == InterfaceType::VIRTUAL) { + config.interfaceId.virtualif({ifname}); + } else { + ADD_FAILURE() << "Unexpected iftype: " << toString(iftype); + } + + const auto upresult = mCanController->upInterface(config); + if (upresult != ICanController::Result::OK) { + // upInterface returns INVALID_STATE if the interface is already up (which is fine). + EXPECT_EQ(ICanController::Result::INVALID_STATE, upresult) + << ifname << " can't be brought up!"; + } + return true; +} + std::tuple> CanBusHalTest::listen( const hidl_vec& filter, const sp& listener) { Result halResult; diff --git a/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp index 294cd177584e054eec2d055a873380eb9ec01569..f8ae871b33a66901457b00cd715afa507d738298 100644 --- a/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp +++ b/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp @@ -33,18 +33,45 @@ using hardware::hidl_vec; using InterfaceType = ICanController::InterfaceType; using IfId = ICanController::BusConfig::InterfaceId; +struct Bus { + DISALLOW_COPY_AND_ASSIGN(Bus); + + Bus(sp controller, const ICanController::BusConfig& config) + : mIfname(config.name), mController(controller) { + // Don't bring up the bus, we just need a wrapper for the ICanBus object + /* Not using ICanBus::getService here, since it ignores interfaces not in the manifest + * file -- this is a test, so we don't want to add fake services to a device manifest. */ + auto manager = hidl::manager::V1_2::IServiceManager::getService(); + auto service = manager->get(ICanBus::descriptor, config.name); + mBus = ICanBus::castFrom(service); + } + + ICanBus* operator->() const { return mBus.get(); } + sp get() { return mBus; } + + Return send(const CanMessage& msg) { return mBus->send(msg); } + + private: + const std::string mIfname; + sp mController; + sp mBus; +}; + class CanControllerHalTest : public ::testing::TestWithParam { protected: virtual void SetUp() override; virtual void TearDown() override; static void SetUpTestCase(); + Bus makeBus(const std::string ifaceName); + hidl_vec getSupportedInterfaceTypes(); bool isSupported(InterfaceType iftype); bool up(InterfaceType iftype, const std::string srvname, std::string ifname, ICanController::Result expected); - void assertRegistered(const std::string srvname, bool expectRegistered); + void assertRegistered(const std::string srvname, const std::string ifaceName, + bool expectRegistered); sp mCanController; static hidl_vec mBusNames; @@ -117,16 +144,33 @@ bool CanControllerHalTest::up(InterfaceType iftype, std::string srvname, std::st return true; } -void CanControllerHalTest::assertRegistered(std::string srvname, bool expectRegistered) { +void CanControllerHalTest::assertRegistered(const std::string srvname, const std::string ifaceName, + bool expectRegistered) { /* Not using ICanBus::tryGetService here, since it ignores interfaces not in the manifest * file -- this is a test, so we don't want to add fake services to a device manifest. */ auto manager = hidl::manager::V1_2::IServiceManager::getService(); auto busService = manager->get(ICanBus::descriptor, srvname); + if (!expectRegistered) { + /* We can't unregister a HIDL interface defined in the manifest, so we'll just check to make + * sure that the interface behind it is down */ + auto bus = makeBus(ifaceName); + const auto result = bus->send({}); + ASSERT_EQ(Result::INTERFACE_DOWN, result); + return; + } ASSERT_EQ(expectRegistered, busService.withDefault(nullptr) != nullptr) << "ICanBus/" << srvname << (expectRegistered ? " is not " : " is ") << "registered" << " (should be otherwise)"; } +Bus CanControllerHalTest::makeBus(const std::string ifaceName) { + ICanController::BusConfig config = {}; + config.name = mBusNames[0]; + config.interfaceId.virtualif({ifaceName}); + + return Bus(mCanController, config); +} + TEST_P(CanControllerHalTest, SupportsSomething) { const auto supported = getSupportedInterfaceTypes(); ASSERT_GT(supported.size(), 0u); @@ -134,15 +178,17 @@ TEST_P(CanControllerHalTest, SupportsSomething) { TEST_P(CanControllerHalTest, BringUpDown) { const std::string name = mBusNames[0]; + const std::string iface = "vcan57"; + mCanController->downInterface(name); + + assertRegistered(name, iface, false); - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan57", ICanController::Result::OK)) GTEST_SKIP(); - assertRegistered(name, true); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::OK)) GTEST_SKIP(); + assertRegistered(name, iface, true); const auto dnresult = mCanController->downInterface(name); ASSERT_TRUE(dnresult); - - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, DownFake) { @@ -152,18 +198,19 @@ TEST_P(CanControllerHalTest, DownFake) { TEST_P(CanControllerHalTest, UpTwice) { const std::string name = mBusNames[0]; + const std::string iface = "vcan72"; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan72", ICanController::Result::OK)) GTEST_SKIP(); - assertRegistered(name, true); + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::OK)) GTEST_SKIP(); + assertRegistered(name, iface, true); if (!up(InterfaceType::VIRTUAL, name, "vcan73", ICanController::Result::INVALID_STATE)) { GTEST_SKIP(); } - assertRegistered(name, true); + assertRegistered(name, iface, true); const auto result = mCanController->downInterface(name); ASSERT_TRUE(result); - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, ConfigCompatibility) { @@ -230,63 +277,67 @@ TEST_P(CanControllerHalTest, ConfigCompatibility) { TEST_P(CanControllerHalTest, FailEmptyName) { const std::string name = ""; + const std::string iface = "vcan57"; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan57", ICanController::Result::BAD_SERVICE_NAME)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::BAD_SERVICE_NAME)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadName) { // 33 characters (name can be at most 32 characters long) const std::string name = "ab012345678901234567890123456789c"; + const std::string iface = "vcan57"; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan57", ICanController::Result::BAD_SERVICE_NAME)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::BAD_SERVICE_NAME)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadVirtualAddress) { const std::string name = mBusNames[0]; + const std::string iface = ""; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "", ICanController::Result::BAD_INTERFACE_ID)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::BAD_INTERFACE_ID)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadSocketcanAddress) { const std::string name = mBusNames[0]; + const std::string iface = "can87"; - assertRegistered(name, false); - if (!up(InterfaceType::SOCKETCAN, name, "can87", ICanController::Result::BAD_INTERFACE_ID)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::SOCKETCAN, name, iface, ICanController::Result::BAD_INTERFACE_ID)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); auto supported = up(InterfaceType::SOCKETCAN, name, "", ICanController::Result::BAD_INTERFACE_ID); ASSERT_TRUE(supported); - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadSlcanAddress) { const std::string name = mBusNames[0]; + const std::string iface = "/dev/shouldnotexist123"; - assertRegistered(name, false); - if (!up(InterfaceType::SLCAN, name, "/dev/shouldnotexist123", - ICanController::Result::BAD_INTERFACE_ID)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::SLCAN, name, iface, ICanController::Result::BAD_INTERFACE_ID)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); auto supported = up(InterfaceType::SLCAN, name, "", ICanController::Result::BAD_INTERFACE_ID); ASSERT_TRUE(supported); - assertRegistered(name, false); + assertRegistered(name, iface, false); } /** diff --git a/automotive/evs/1.1/default/Android.bp b/automotive/evs/1.1/default/Android.bp index ea1851f6079de5962da3742b5e44acd9c5482c42..4c08ef364ebe130f4413f6c52b197257ee7d58ee 100644 --- a/automotive/evs/1.1/default/Android.bp +++ b/automotive/evs/1.1/default/Android.bp @@ -13,48 +13,46 @@ cc_binary { proprietary: true, relative_install_path: "hw", srcs: [ - "service.cpp", - "EvsCamera.cpp", - "EvsEnumerator.cpp", - "EvsDisplay.cpp", - "ConfigManager.cpp", - "ConfigManagerUtil.cpp", - "EvsUltrasonicsArray.cpp", + "*.cpp", ], init_rc: ["android.hardware.automotive.evs@1.1-service.rc"], - shared_libs: [ + "android.frameworks.automotive.display@1.0", "android.hardware.automotive.evs@1.0", "android.hardware.automotive.evs@1.1", "android.hardware.camera.device@3.3", + "android.hardware.graphics.bufferqueue@1.0", + "android.hardware.graphics.bufferqueue@2.0", "android.hidl.allocator@1.0", "android.hidl.memory@1.0", + "android.hidl.token@1.0-utils", + "libEGL", + "libGLESv2", "libbase", "libbinder", - "liblog", + "libbufferqueueconverter", + "libcamera_metadata", "libhardware", "libhidlbase", "libhidlmemory", "liblog", + "libtinyxml2", "libui", "libutils", - "libcamera_metadata", - "libtinyxml2", - "android.hidl.token@1.0-utils", - "android.frameworks.automotive.display@1.0", - "android.hardware.graphics.bufferqueue@1.0", - "android.hardware.graphics.bufferqueue@2.0", ], - cflags: [ "-O0", "-g", + "-DLOG_TAG=\"MockEvsDriver\"", + "-DGL_GLEXT_PROTOTYPES", + "-DEGL_EGLEXT_PROTOTYPES", + ], + include_dirs: [ + "frameworks/native/include/", ], - required: [ "evs_default_configuration.xml", ], - vintf_fragments: [ "manifest_android.hardware.automotive.evs@1.1-service.xml", ], diff --git a/automotive/evs/1.1/default/ConfigManager.cpp b/automotive/evs/1.1/default/ConfigManager.cpp index 986793e8a8e6fd24d3cd9647277f91482fa3ba31..ca8cfae150265612ca0697ad568920868adb8199 100644 --- a/automotive/evs/1.1/default/ConfigManager.cpp +++ b/automotive/evs/1.1/default/ConfigManager.cpp @@ -14,38 +14,40 @@ * limitations under the License. */ -#include -#include -#include +#include "ConfigManager.h" +#include #include #include -#include -#include "ConfigManager.h" +#include +#include +#include -using ::android::hardware::camera::device::V3_2::StreamRotation; +namespace android::hardware::automotive::evs::V1_1::implementation { +using namespace std; +using namespace tinyxml2; +using hardware::camera::device::V3_2::StreamRotation; ConfigManager::~ConfigManager() { /* Nothing to do */ } - -void ConfigManager::readCameraInfo(const XMLElement * const aCameraElem) { +void ConfigManager::readCameraInfo(const XMLElement* const aCameraElem) { if (aCameraElem == nullptr) { ALOGW("XML file does not have required camera element"); return; } - const XMLElement *curElem = aCameraElem->FirstChildElement(); + const XMLElement* curElem = aCameraElem->FirstChildElement(); while (curElem != nullptr) { if (!strcmp(curElem->Name(), "group")) { /* camera group identifier */ - const char *id = curElem->FindAttribute("id")->Value(); + const char* id = curElem->FindAttribute("id")->Value(); /* create a camera group to be filled */ - CameraGroupInfo *aCamera = new CameraGroupInfo(); + CameraGroupInfo* aCamera = new CameraGroupInfo(); /* read camera device information */ if (!readCameraDeviceInfo(aCamera, curElem)) { @@ -55,28 +57,26 @@ void ConfigManager::readCameraInfo(const XMLElement * const aCameraElem) { } /* camera group synchronization */ - const char *sync = curElem->FindAttribute("synchronized")->Value(); + const char* sync = curElem->FindAttribute("synchronized")->Value(); if (!strcmp(sync, "CALIBRATED")) { - aCamera->synchronized = - ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED; + aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED; } else if (!strcmp(sync, "APPROXIMATE")) { - aCamera->synchronized = - ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE; + aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE; } else { - aCamera->synchronized = 0; // Not synchronized + aCamera->synchronized = 0; // Not synchronized } /* add a group to hash map */ mCameraGroupInfos.insert_or_assign(id, unique_ptr(aCamera)); } else if (!strcmp(curElem->Name(), "device")) { /* camera unique identifier */ - const char *id = curElem->FindAttribute("id")->Value(); + const char* id = curElem->FindAttribute("id")->Value(); /* camera mount location */ - const char *pos = curElem->FindAttribute("position")->Value(); + const char* pos = curElem->FindAttribute("position")->Value(); /* create a camera device to be filled */ - CameraInfo *aCamera = new CameraInfo(); + CameraInfo* aCamera = new CameraInfo(); /* read camera device information */ if (!readCameraDeviceInfo(aCamera, curElem)) { @@ -99,10 +99,7 @@ void ConfigManager::readCameraInfo(const XMLElement * const aCameraElem) { } } - -bool -ConfigManager::readCameraDeviceInfo(CameraInfo *aCamera, - const XMLElement *aDeviceElem) { +bool ConfigManager::readCameraDeviceInfo(CameraInfo* aCamera, const XMLElement* aDeviceElem) { if (aCamera == nullptr || aDeviceElem == nullptr) { return false; } @@ -113,16 +110,11 @@ ConfigManager::readCameraDeviceInfo(CameraInfo *aCamera, /* read device capabilities */ totalEntries += - readCameraCapabilities(aDeviceElem->FirstChildElement("caps"), - aCamera, - totalDataSize); - + readCameraCapabilities(aDeviceElem->FirstChildElement("caps"), aCamera, totalDataSize); /* read camera metadata */ - totalEntries += - readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"), - aCamera, - totalDataSize); + totalEntries += readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"), aCamera, + totalDataSize); /* construct camera_metadata_t */ if (!constructCameraMetadata(aCamera, totalEntries, totalDataSize)) { @@ -133,40 +125,34 @@ ConfigManager::readCameraDeviceInfo(CameraInfo *aCamera, return true; } - -size_t -ConfigManager::readCameraCapabilities(const XMLElement * const aCapElem, - CameraInfo *aCamera, - size_t &dataSize) { +size_t ConfigManager::readCameraCapabilities(const XMLElement* const aCapElem, CameraInfo* aCamera, + size_t& dataSize) { if (aCapElem == nullptr || aCamera == nullptr) { return 0; } string token; - const XMLElement *curElem = nullptr; + const XMLElement* curElem = nullptr; /* a list of supported camera parameters/controls */ curElem = aCapElem->FirstChildElement("supported_controls"); if (curElem != nullptr) { - const XMLElement *ctrlElem = curElem->FirstChildElement("control"); + const XMLElement* ctrlElem = curElem->FirstChildElement("control"); while (ctrlElem != nullptr) { - const char *nameAttr = ctrlElem->FindAttribute("name")->Value();; + const char* nameAttr = ctrlElem->FindAttribute("name")->Value(); + ; const int32_t minVal = stoi(ctrlElem->FindAttribute("min")->Value()); const int32_t maxVal = stoi(ctrlElem->FindAttribute("max")->Value()); int32_t stepVal = 1; - const XMLAttribute *stepAttr = ctrlElem->FindAttribute("step"); + const XMLAttribute* stepAttr = ctrlElem->FindAttribute("step"); if (stepAttr != nullptr) { stepVal = stoi(stepAttr->Value()); } CameraParam aParam; - if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr, - aParam)) { - aCamera->controls.emplace( - aParam, - make_tuple(minVal, maxVal, stepVal) - ); + if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr, aParam)) { + aCamera->controls.emplace(aParam, make_tuple(minVal, maxVal, stepVal)); } ctrlElem = ctrlElem->NextSiblingElement("control"); @@ -177,11 +163,11 @@ ConfigManager::readCameraCapabilities(const XMLElement * const aCapElem, curElem = aCapElem->FirstChildElement("stream"); while (curElem != nullptr) { /* read 5 attributes */ - const XMLAttribute *idAttr = curElem->FindAttribute("id"); - const XMLAttribute *widthAttr = curElem->FindAttribute("width"); - const XMLAttribute *heightAttr = curElem->FindAttribute("height"); - const XMLAttribute *fmtAttr = curElem->FindAttribute("format"); - const XMLAttribute *fpsAttr = curElem->FindAttribute("framerate"); + const XMLAttribute* idAttr = curElem->FindAttribute("id"); + const XMLAttribute* widthAttr = curElem->FindAttribute("width"); + const XMLAttribute* heightAttr = curElem->FindAttribute("height"); + const XMLAttribute* fmtAttr = curElem->FindAttribute("format"); + const XMLAttribute* fpsAttr = curElem->FindAttribute("framerate"); const int32_t id = stoi(idAttr->Value()); int32_t framerate = 0; @@ -190,16 +176,13 @@ ConfigManager::readCameraCapabilities(const XMLElement * const aCapElem, } int32_t pixFormat; - if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), - pixFormat)) { - RawStreamConfiguration cfg = { - id, - stoi(widthAttr->Value()), - stoi(heightAttr->Value()), - pixFormat, - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, - framerate - }; + if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), pixFormat)) { + RawStreamConfiguration cfg = {id, + stoi(widthAttr->Value()), + stoi(heightAttr->Value()), + pixFormat, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, + framerate}; aCamera->streamConfigurations.insert_or_assign(id, cfg); } @@ -207,70 +190,58 @@ ConfigManager::readCameraCapabilities(const XMLElement * const aCapElem, } dataSize = calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type( - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS - ), - aCamera->streamConfigurations.size() * kStreamCfgSz - ); + get_camera_metadata_tag_type(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS), + aCamera->streamConfigurations.size() * kStreamCfgSz); /* a single camera metadata entry contains multiple stream configurations */ return dataSize > 0 ? 1 : 0; } - -size_t -ConfigManager::readCameraMetadata(const XMLElement * const aParamElem, - CameraInfo *aCamera, - size_t &dataSize) { +size_t ConfigManager::readCameraMetadata(const XMLElement* const aParamElem, CameraInfo* aCamera, + size_t& dataSize) { if (aParamElem == nullptr || aCamera == nullptr) { return 0; } - const XMLElement *curElem = aParamElem->FirstChildElement("parameter"); + const XMLElement* curElem = aParamElem->FirstChildElement("parameter"); size_t numEntries = 0; camera_metadata_tag_t tag; while (curElem != nullptr) { if (!ConfigManagerUtil::convertToMetadataTag(curElem->FindAttribute("name")->Value(), tag)) { - switch(tag) { + switch (tag) { case ANDROID_LENS_DISTORTION: case ANDROID_LENS_POSE_ROTATION: case ANDROID_LENS_POSE_TRANSLATION: case ANDROID_LENS_INTRINSIC_CALIBRATION: { /* float[] */ size_t count = 0; - void *data = ConfigManagerUtil::convertFloatArray( - curElem->FindAttribute("size")->Value(), - curElem->FindAttribute("value")->Value(), - count - ); + void* data = ConfigManagerUtil::convertFloatArray( + curElem->FindAttribute("size")->Value(), + curElem->FindAttribute("value")->Value(), count); aCamera->cameraMetadata.insert_or_assign( - tag, make_pair(make_unique(data), count) - ); + tag, make_pair(make_unique(data), count)); ++numEntries; dataSize += calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type(tag), count - ); + get_camera_metadata_tag_type(tag), count); break; } case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: { - camera_metadata_enum_android_request_available_capabilities_t *data = - new camera_metadata_enum_android_request_available_capabilities_t[1]; + camera_metadata_enum_android_request_available_capabilities_t* data = + new camera_metadata_enum_android_request_available_capabilities_t[1]; if (ConfigManagerUtil::convertToCameraCapability( - curElem->FindAttribute("value")->Value(), *data)) { - curElem->FindAttribute("value")->Value(), - aCamera->cameraMetadata.insert_or_assign( - tag, make_pair(make_unique(data), 1) - ); + curElem->FindAttribute("value")->Value(), *data)) { + curElem->FindAttribute("value")->Value(), + aCamera->cameraMetadata.insert_or_assign( + tag, make_pair(make_unique(data), 1)); ++numEntries; dataSize += calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type(tag), 1 - ); + get_camera_metadata_tag_type(tag), 1); } break; } @@ -278,13 +249,11 @@ ConfigManager::readCameraMetadata(const XMLElement * const aParamElem, case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: { /* a comma-separated list of physical camera devices */ size_t len = strlen(curElem->FindAttribute("value")->Value()); - char *data = new char[len + 1]; - memcpy(data, - curElem->FindAttribute("value")->Value(), - len * sizeof(char)); + char* data = new char[len + 1]; + memcpy(data, curElem->FindAttribute("value")->Value(), len * sizeof(char)); /* replace commas with null char */ - char *p = data; + char* p = data; while (*p != '\0') { if (*p == ',') { *p = '\0'; @@ -293,19 +262,16 @@ ConfigManager::readCameraMetadata(const XMLElement * const aParamElem, } aCamera->cameraMetadata.insert_or_assign( - tag, make_pair(make_unique(data), len) - ); + tag, make_pair(make_unique(data), len)); ++numEntries; dataSize += calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type(tag), len - ); + get_camera_metadata_tag_type(tag), len); break; } default: - ALOGW("Parameter %s is not supported", - curElem->FindAttribute("name")->Value()); + ALOGW("Parameter %s is not supported", curElem->FindAttribute("name")->Value()); break; } } @@ -316,11 +282,8 @@ ConfigManager::readCameraMetadata(const XMLElement * const aParamElem, return numEntries; } - -bool -ConfigManager::constructCameraMetadata(CameraInfo *aCamera, - const size_t totalEntries, - const size_t totalDataSize) { +bool ConfigManager::constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries, + const size_t totalDataSize) { if (aCamera == nullptr || !aCamera->allocate(totalEntries, totalDataSize)) { ALOGE("Failed to allocate memory for camera metadata"); return false; @@ -328,16 +291,15 @@ ConfigManager::constructCameraMetadata(CameraInfo *aCamera, const size_t numStreamConfigs = aCamera->streamConfigurations.size(); unique_ptr data(new int32_t[kStreamCfgSz * numStreamConfigs]); - int32_t *ptr = data.get(); - for (auto &cfg : aCamera->streamConfigurations) { + int32_t* ptr = data.get(); + for (auto& cfg : aCamera->streamConfigurations) { for (auto i = 0; i < kStreamCfgSz; ++i) { - *ptr++ = cfg.second[i]; + *ptr++ = cfg.second[i]; } } int32_t err = add_camera_metadata_entry(aCamera->characteristics, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, - data.get(), - numStreamConfigs * kStreamCfgSz); + data.get(), numStreamConfigs * kStreamCfgSz); if (err) { ALOGE("Failed to add stream configurations to metadata, ignored"); @@ -345,11 +307,9 @@ ConfigManager::constructCameraMetadata(CameraInfo *aCamera, } bool success = true; - for (auto &[tag, entry] : aCamera->cameraMetadata) { + for (auto& [tag, entry] : aCamera->cameraMetadata) { /* try to add new camera metadata entry */ - int32_t err = add_camera_metadata_entry(aCamera->characteristics, - tag, - entry.first.get(), + int32_t err = add_camera_metadata_entry(aCamera->characteristics, tag, entry.first.get(), entry.second); if (err) { ALOGE("Failed to add an entry with a tag 0x%X", tag); @@ -376,8 +336,7 @@ ConfigManager::constructCameraMetadata(CameraInfo *aCamera, return success; } - -void ConfigManager::readSystemInfo(const XMLElement * const aSysElem) { +void ConfigManager::readSystemInfo(const XMLElement* const aSysElem) { if (aSysElem == nullptr) { return; } @@ -389,24 +348,22 @@ void ConfigManager::readSystemInfo(const XMLElement * const aSysElem) { */ /* read number of cameras available in the system */ - const XMLElement *xmlElem = aSysElem->FirstChildElement("num_cameras"); + const XMLElement* xmlElem = aSysElem->FirstChildElement("num_cameras"); if (xmlElem != nullptr) { - mSystemInfo.numCameras = - stoi(xmlElem->FindAttribute("value")->Value()); + mSystemInfo.numCameras = stoi(xmlElem->FindAttribute("value")->Value()); } } - -void ConfigManager::readDisplayInfo(const XMLElement * const aDisplayElem) { +void ConfigManager::readDisplayInfo(const XMLElement* const aDisplayElem) { if (aDisplayElem == nullptr) { ALOGW("XML file does not have required camera element"); return; } - const XMLElement *curDev = aDisplayElem->FirstChildElement("device"); + const XMLElement* curDev = aDisplayElem->FirstChildElement("device"); while (curDev != nullptr) { - const char *id = curDev->FindAttribute("id")->Value(); - //const char *pos = curDev->FirstAttribute("position")->Value(); + const char* id = curDev->FindAttribute("id")->Value(); + // const char *pos = curDev->FirstAttribute("position")->Value(); unique_ptr dpy(new DisplayInfo()); if (dpy == nullptr) { @@ -414,27 +371,26 @@ void ConfigManager::readDisplayInfo(const XMLElement * const aDisplayElem) { return; } - const XMLElement *cap = curDev->FirstChildElement("caps"); + const XMLElement* cap = curDev->FirstChildElement("caps"); if (cap != nullptr) { - const XMLElement *curStream = cap->FirstChildElement("stream"); + const XMLElement* curStream = cap->FirstChildElement("stream"); while (curStream != nullptr) { /* read 4 attributes */ - const XMLAttribute *idAttr = curStream->FindAttribute("id"); - const XMLAttribute *widthAttr = curStream->FindAttribute("width"); - const XMLAttribute *heightAttr = curStream->FindAttribute("height"); - const XMLAttribute *fmtAttr = curStream->FindAttribute("format"); + const XMLAttribute* idAttr = curStream->FindAttribute("id"); + const XMLAttribute* widthAttr = curStream->FindAttribute("width"); + const XMLAttribute* heightAttr = curStream->FindAttribute("height"); + const XMLAttribute* fmtAttr = curStream->FindAttribute("format"); const int32_t id = stoi(idAttr->Value()); int32_t pixFormat; - if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), - pixFormat)) { + if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), pixFormat)) { RawStreamConfiguration cfg = { - id, - stoi(widthAttr->Value()), - stoi(heightAttr->Value()), - pixFormat, - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, - 0 // unused + id, + stoi(widthAttr->Value()), + stoi(heightAttr->Value()), + pixFormat, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, + 0 // unused }; dpy->streamConfigurations.insert_or_assign(id, cfg); } @@ -450,7 +406,6 @@ void ConfigManager::readDisplayInfo(const XMLElement * const aDisplayElem) { return; } - bool ConfigManager::readConfigDataFromXML() noexcept { XMLDocument xmlDoc; @@ -464,7 +419,7 @@ bool ConfigManager::readConfigDataFromXML() noexcept { } /* retrieve the root element */ - const XMLElement *rootElem = xmlDoc.RootElement(); + const XMLElement* rootElem = xmlDoc.RootElement(); if (strcmp(rootElem->Name(), "configuration")) { ALOGE("A configuration file is not in the required format. " "See /etc/automotive/evs/evs_configuration.dtd"); @@ -487,12 +442,10 @@ bool ConfigManager::readConfigDataFromXML() noexcept { ALOGI("Parsing configuration file takes %lf (ms)", (double)(parsingEnd - parsingStart) / 1000000.0); - return true; } - -std::unique_ptr ConfigManager::Create(const char *path) { +std::unique_ptr ConfigManager::Create(const char* path) { unique_ptr cfgMgr(new ConfigManager(path)); /* @@ -510,3 +463,4 @@ std::unique_ptr ConfigManager::Create(const char *path) { } } +} // namespace android::hardware::automotive::evs::V1_1::implementation diff --git a/automotive/evs/1.1/default/ConfigManager.h b/automotive/evs/1.1/default/ConfigManager.h index b0b2670fb6a30cc84aee50d7f6a27dfa9a2ed8c7..0a1536010ba82520ad19450dd1abf91aabbdcc64 100644 --- a/automotive/evs/1.1/default/ConfigManager.h +++ b/automotive/evs/1.1/default/ConfigManager.h @@ -13,28 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef CONFIG_MANAGER_H -#define CONFIG_MANAGER_H +#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGER_H +#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGER_H -#include -#include -#include -#include - -#include +#include "ConfigManagerUtil.h" -#include -#include #include +#include +#include +#include -#include "ConfigManagerUtil.h" +#include +#include +#include +#include -using namespace std; -using namespace tinyxml2; +namespace android::hardware::automotive::evs::V1_1::implementation { -using ::android::hardware::hidl_vec; -using ::android::hardware::camera::device::V3_2::Stream; -using ::android::hardware::automotive::evs::V1_1::CameraParam; +using hardware::hidl_vec; +using hardware::automotive::evs::V1_1::CameraParam; +using hardware::camera::device::V3_2::Stream; /* * Plese note that this is different from what is defined in @@ -45,8 +43,8 @@ const size_t kStreamCfgSz = 6; typedef std::array RawStreamConfiguration; class ConfigManager { -public: - static std::unique_ptr Create(const char *path = ""); + public: + static std::unique_ptr Create(const char* path = ""); ConfigManager(const ConfigManager&) = delete; ConfigManager& operator=(const ConfigManager&) = delete; @@ -54,15 +52,11 @@ public: /* Camera device's capabilities and metadata */ class CameraInfo { - public: - CameraInfo() : - characteristics(nullptr) { - /* Nothing to do */ + public: + CameraInfo() : characteristics(nullptr) { /* Nothing to do */ } - virtual ~CameraInfo() { - free_camera_metadata(characteristics); - } + virtual ~CameraInfo() { free_camera_metadata(characteristics); } /* Allocate memory for camera_metadata_t */ bool allocate(size_t entry_cap, size_t data_cap) { @@ -79,50 +73,49 @@ public: * List of supported controls that the primary client can program. * Paraemters are stored with its valid range */ - unordered_map> controls; + std::unordered_map> controls; /* * List of supported output stream configurations; each array stores * format, width, height, and direction values in the order. */ - unordered_map streamConfigurations; + std::unordered_map streamConfigurations; /* * Internal storage for camera metadata. Each entry holds a pointer to * data and number of elements */ - unordered_map, size_t>> cameraMetadata; + std::unordered_map, size_t>> + cameraMetadata; /* Camera module characteristics */ - camera_metadata_t *characteristics; + camera_metadata_t* characteristics; }; class CameraGroupInfo : public CameraInfo { - public: + public: CameraGroupInfo() {} /* ID of member camera devices */ - unordered_set devices; + std::unordered_set devices; /* The capture operation of member camera devices are synchronized */ bool synchronized = false; }; class SystemInfo { - public: + public: /* number of available cameras */ int32_t numCameras = 0; }; class DisplayInfo { - public: + public: /* * List of supported input stream configurations; each array stores * format, width, height, and direction values in the order. */ - unordered_map streamConfigurations; + std::unordered_map streamConfigurations; }; /* @@ -131,80 +124,74 @@ public: * @return SystemInfo * Constant reference of SystemInfo. */ - const SystemInfo &getSystemInfo() { - return mSystemInfo; - } + const SystemInfo& getSystemInfo() { return mSystemInfo; } /* * Return a list of cameras * * This function assumes that it is not being called frequently. * - * @return vector + * @return std::vector * A vector that contains unique camera device identifiers. */ - vector getCameraList() { - vector aList; - for (auto &v : mCameraInfo) { - aList.emplace_back(v.first); + std::vector getCameraList() { + std::vector aList; + for (auto& v : mCameraInfo) { + aList.push_back(v.first); } return aList; } - /* * Return a list of cameras * * @return CameraGroupInfo * A pointer to a camera group identified by a given id. */ - unique_ptr& getCameraGroupInfo(const string& gid) { + std::unique_ptr& getCameraGroupInfo(const std::string& gid) { return mCameraGroupInfos[gid]; } - /* * Return a camera metadata * * @param cameraId - * Unique camera node identifier in string + * Unique camera node identifier in std::string * - * @return unique_ptr + * @return std::unique_ptr * A pointer to CameraInfo that is associated with a given camera * ID. This returns a null pointer if this does not recognize a * given camera identifier. */ - unique_ptr& getCameraInfo(const string cameraId) noexcept { + std::unique_ptr& getCameraInfo(const std::string cameraId) noexcept { return mCameraInfo[cameraId]; } -private: + private: /* Constructors */ - ConfigManager(const char *xmlPath) : - mConfigFilePath(xmlPath) { - } + ConfigManager(const char* xmlPath) : mConfigFilePath(xmlPath) {} /* System configuration */ SystemInfo mSystemInfo; /* Internal data structure for camera device information */ - unordered_map> mCameraInfo; + std::unordered_map> mCameraInfo; /* Internal data structure for camera device information */ - unordered_map> mDisplayInfo; + std::unordered_map> mDisplayInfo; /* Camera groups are stored in hash map */ - unordered_map> mCameraGroupInfos; + std::unordered_map> mCameraGroupInfos; /* * Camera positions are stored in hash map. * The position must be one of front, rear, left, and right. */ - unordered_map> mCameraPosition; + std::unordered_map> mCameraPosition; /* A path to XML configuration file */ - const char *mConfigFilePath; + const char* mConfigFilePath; /* * Parse a given EVS configuration file and store the information @@ -221,7 +208,7 @@ private: * @param aSysElem * A pointer to "system" XML element. */ - void readSystemInfo(const XMLElement * const aSysElem); + void readSystemInfo(const tinyxml2::XMLElement* const aSysElem); /* * read the information of camera devices @@ -230,7 +217,7 @@ private: * A pointer to "camera" XML element that may contain multiple * "device" elements. */ - void readCameraInfo(const XMLElement * const aCameraElem); + void readCameraInfo(const tinyxml2::XMLElement* const aCameraElem); /* * read display device information @@ -239,7 +226,7 @@ private: * A pointer to "display" XML element that may contain multiple * "device" elements. */ - void readDisplayInfo(const XMLElement * const aDisplayElem); + void readDisplayInfo(const tinyxml2::XMLElement* const aDisplayElem); /* * read camera device information @@ -255,8 +242,7 @@ private: * Return false upon any failure in reading and processing camera * device information. */ - bool readCameraDeviceInfo(CameraInfo *aCamera, - const XMLElement *aDeviceElem); + bool readCameraDeviceInfo(CameraInfo* aCamera, const tinyxml2::XMLElement* aDeviceElem); /* * read camera metadata @@ -273,9 +259,8 @@ private: * @return size_t * Number of camera metadata entries */ - size_t readCameraCapabilities(const XMLElement * const aCapElem, - CameraInfo *aCamera, - size_t &dataSize); + size_t readCameraCapabilities(const tinyxml2::XMLElement* const aCapElem, CameraInfo* aCamera, + size_t& dataSize); /* * read camera metadata @@ -291,9 +276,8 @@ private: * @return size_t * Number of camera metadata entries */ - size_t readCameraMetadata(const XMLElement * const aParamElem, - CameraInfo *aCamera, - size_t &dataSize); + size_t readCameraMetadata(const tinyxml2::XMLElement* const aParamElem, CameraInfo* aCamera, + size_t& dataSize); /* * construct camera_metadata_t from camera capabilities and metadata @@ -310,9 +294,9 @@ private: * or its size is not large enough to add all found camera metadata * entries. */ - bool constructCameraMetadata(CameraInfo *aCamera, - const size_t totalEntries, + bool constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries, const size_t totalDataSize); }; -#endif // CONFIG_MANAGER_H +} // namespace android::hardware::automotive::evs::V1_1::implementation +#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGER_H diff --git a/automotive/evs/1.1/default/ConfigManagerUtil.cpp b/automotive/evs/1.1/default/ConfigManagerUtil.cpp index d10f236bd405c8257426dce4c2cafce957effd7a..5edd405e2f2336b074443f66958879aaf6adc109 100644 --- a/automotive/evs/1.1/default/ConfigManagerUtil.cpp +++ b/automotive/evs/1.1/default/ConfigManagerUtil.cpp @@ -16,43 +16,45 @@ #include "ConfigManagerUtil.h" -#include -#include -#include - #include #include +#include +#include +#include + +namespace android::hardware::automotive::evs::V1_1::implementation { -bool ConfigManagerUtil::convertToEvsCameraParam(const string &id, - CameraParam &camParam) { +using namespace std; + +bool ConfigManagerUtil::convertToEvsCameraParam(const string& id, CameraParam& camParam) { string trimmed = ConfigManagerUtil::trimString(id); bool success = true; if (!trimmed.compare("BRIGHTNESS")) { - camParam = CameraParam::BRIGHTNESS; + camParam = CameraParam::BRIGHTNESS; } else if (!trimmed.compare("CONTRAST")) { - camParam = CameraParam::CONTRAST; + camParam = CameraParam::CONTRAST; } else if (!trimmed.compare("AUTOGAIN")) { - camParam = CameraParam::AUTOGAIN; + camParam = CameraParam::AUTOGAIN; } else if (!trimmed.compare("GAIN")) { - camParam = CameraParam::GAIN; + camParam = CameraParam::GAIN; } else if (!trimmed.compare("AUTO_WHITE_BALANCE")) { - camParam = CameraParam::AUTO_WHITE_BALANCE; + camParam = CameraParam::AUTO_WHITE_BALANCE; } else if (!trimmed.compare("WHITE_BALANCE_TEMPERATURE")) { - camParam = CameraParam::WHITE_BALANCE_TEMPERATURE; + camParam = CameraParam::WHITE_BALANCE_TEMPERATURE; } else if (!trimmed.compare("SHARPNESS")) { - camParam = CameraParam::SHARPNESS; + camParam = CameraParam::SHARPNESS; } else if (!trimmed.compare("AUTO_EXPOSURE")) { - camParam = CameraParam::AUTO_EXPOSURE; + camParam = CameraParam::AUTO_EXPOSURE; } else if (!trimmed.compare("ABSOLUTE_EXPOSURE")) { - camParam = CameraParam::ABSOLUTE_EXPOSURE; + camParam = CameraParam::ABSOLUTE_EXPOSURE; } else if (!trimmed.compare("ABSOLUTE_FOCUS")) { - camParam = CameraParam::ABSOLUTE_FOCUS; + camParam = CameraParam::ABSOLUTE_FOCUS; } else if (!trimmed.compare("AUTO_FOCUS")) { - camParam = CameraParam::AUTO_FOCUS; + camParam = CameraParam::AUTO_FOCUS; } else if (!trimmed.compare("ABSOLUTE_ZOOM")) { - camParam = CameraParam::ABSOLUTE_ZOOM; + camParam = CameraParam::ABSOLUTE_ZOOM; } else { success = false; } @@ -60,18 +62,16 @@ bool ConfigManagerUtil::convertToEvsCameraParam(const string &id, return success; } - -bool ConfigManagerUtil::convertToPixelFormat(const string &format, - int32_t &pixFormat) { +bool ConfigManagerUtil::convertToPixelFormat(const string& format, int32_t& pixFormat) { string trimmed = ConfigManagerUtil::trimString(format); bool success = true; if (!trimmed.compare("RGBA_8888")) { - pixFormat = HAL_PIXEL_FORMAT_RGBA_8888; + pixFormat = HAL_PIXEL_FORMAT_RGBA_8888; } else if (!trimmed.compare("YCRCB_420_SP")) { - pixFormat = HAL_PIXEL_FORMAT_YCRCB_420_SP; + pixFormat = HAL_PIXEL_FORMAT_YCRCB_420_SP; } else if (!trimmed.compare("YCBCR_422_I")) { - pixFormat = HAL_PIXEL_FORMAT_YCBCR_422_I; + pixFormat = HAL_PIXEL_FORMAT_YCBCR_422_I; } else { success = false; } @@ -79,21 +79,19 @@ bool ConfigManagerUtil::convertToPixelFormat(const string &format, return success; } - -bool ConfigManagerUtil::convertToMetadataTag(const char *name, - camera_metadata_tag &aTag) { +bool ConfigManagerUtil::convertToMetadataTag(const char* name, camera_metadata_tag& aTag) { if (!strcmp(name, "LENS_DISTORTION")) { - aTag = ANDROID_LENS_DISTORTION; + aTag = ANDROID_LENS_DISTORTION; } else if (!strcmp(name, "LENS_INTRINSIC_CALIBRATION")) { - aTag = ANDROID_LENS_INTRINSIC_CALIBRATION; + aTag = ANDROID_LENS_INTRINSIC_CALIBRATION; } else if (!strcmp(name, "LENS_POSE_ROTATION")) { - aTag = ANDROID_LENS_POSE_ROTATION; + aTag = ANDROID_LENS_POSE_ROTATION; } else if (!strcmp(name, "LENS_POSE_TRANSLATION")) { - aTag = ANDROID_LENS_POSE_TRANSLATION; + aTag = ANDROID_LENS_POSE_TRANSLATION; } else if (!strcmp(name, "REQUEST_AVAILABLE_CAPABILITIES")) { - aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES; + aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES; } else if (!strcmp(name, "LOGICAL_MULTI_CAMERA_PHYSICAL_IDS")) { - aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS; + aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS; } else { return false; } @@ -101,11 +99,8 @@ bool ConfigManagerUtil::convertToMetadataTag(const char *name, return true; } - bool ConfigManagerUtil::convertToCameraCapability( - const char *name, - camera_metadata_enum_android_request_available_capabilities_t &cap) { - + const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap) { if (!strcmp(name, "DEPTH_OUTPUT")) { cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT; } else if (!strcmp(name, "LOGICAL_MULTI_CAMERA")) { @@ -121,14 +116,13 @@ bool ConfigManagerUtil::convertToCameraCapability( return true; } - -float *ConfigManagerUtil::convertFloatArray(const char *sz, const char *vals, - size_t &count, const char delimiter) { +float* ConfigManagerUtil::convertFloatArray(const char* sz, const char* vals, size_t& count, + const char delimiter) { string size_string(sz); string value_string(vals); count = stoi(size_string); - float *result = new float[count]; + float* result = new float[count]; stringstream values(value_string); int32_t idx = 0; @@ -140,8 +134,7 @@ float *ConfigManagerUtil::convertFloatArray(const char *sz, const char *vals, return result; } - -string ConfigManagerUtil::trimString(const string &src, const string &ws) { +string ConfigManagerUtil::trimString(const string& src, const string& ws) { const auto s = src.find_first_not_of(ws); if (s == string::npos) { return ""; @@ -153,3 +146,4 @@ string ConfigManagerUtil::trimString(const string &src, const string &ws) { return src.substr(s, r); } +} // namespace android::hardware::automotive::evs::V1_1::implementation diff --git a/automotive/evs/1.1/default/ConfigManagerUtil.h b/automotive/evs/1.1/default/ConfigManagerUtil.h index 1710cac4f2a49d00f7ba387b70601d7f449a12fd..9d42ec18808a3effb8dde2c25e500e0432756819 100644 --- a/automotive/evs/1.1/default/ConfigManagerUtil.h +++ b/automotive/evs/1.1/default/ConfigManagerUtil.h @@ -13,57 +13,48 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef CONFIG_MANAGER_UTIL_H -#define CONFIG_MANAGER_UTIL_H +#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H +#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H -#include -#include -#include #include +#include +#include +#include -using namespace std; -using ::android::hardware::automotive::evs::V1_1::CameraParam; - +namespace android::hardware::automotive::evs::V1_1::implementation { class ConfigManagerUtil { -public: + public: /** * Convert a given string into V4L2_CID_* */ - static bool convertToEvsCameraParam(const string &id, - CameraParam &camParam); + static bool convertToEvsCameraParam(const std::string& id, CameraParam& camParam); /** * Convert a given string into android.hardware.graphics.common.PixelFormat */ - static bool convertToPixelFormat(const string &format, - int32_t &pixelFormat); + static bool convertToPixelFormat(const std::string& format, int32_t& pixelFormat); /** * Convert a given string into corresponding camera metadata data tag defined in * system/media/camera/include/system/camera_metadta_tags.h */ - static bool convertToMetadataTag(const char *name, - camera_metadata_tag &aTag); + static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag); /** * Convert a given string into a floating value array */ - static float *convertFloatArray(const char *sz, - const char *vals, - size_t &count, + static float* convertFloatArray(const char* sz, const char* vals, size_t& count, const char delimiter = ','); /** * Trim a string */ - static string trimString(const string &src, - const string &ws = " \n\r\t\f\v"); + static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v"); /** * Convert a given string to corresponding camera capabilities */ static bool convertToCameraCapability( - const char *name, - camera_metadata_enum_android_request_available_capabilities_t &cap); - + const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap); }; -#endif // CONFIG_MANAGER_UTIL_H +} // namespace android::hardware::automotive::evs::V1_1::implementation +#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_CONFIGMANAGERUTIL_H diff --git a/automotive/evs/1.1/default/EvsCamera.cpp b/automotive/evs/1.1/default/EvsCamera.cpp index 0e69ed408b946f5b1d1e92a2ad207266332a9e12..520670a5d622ef364699e1bd0a04124188d85829 100644 --- a/automotive/evs/1.1/default/EvsCamera.cpp +++ b/automotive/evs/1.1/default/EvsCamera.cpp @@ -14,69 +14,69 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.automotive.evs@1.1-service" - #include "EvsCamera.h" +#include "ConfigManager.h" #include "EvsEnumerator.h" #include #include #include -namespace android { -namespace hardware { -namespace automotive { -namespace evs { -namespace V1_1 { -namespace implementation { +namespace { +// Arbitrary limit on number of graphics buffers allowed to be allocated +// Safeguards against unreasonable resource consumption and provides a testable limit +constexpr unsigned kMaxBuffersInFlight = 100; -// Special camera names for which we'll initialize alternate test data -const char EvsCamera::kCameraName_Backup[] = "backup"; +// Minimum number of buffers to run a video stream +constexpr int kMinimumBuffersInFlight = 1; +// Colors for the colorbar test pattern in ABGR format +constexpr uint32_t kColors[] = { + 0xFFFFFFFF, // white + 0xFF00FFFF, // yellow + 0xFFFFFF00, // cyan + 0xFF00FF00, // green + 0xFFFF00FF, // fuchsia + 0xFF0000FF, // red + 0xFFFF0000, // blue + 0xFF000000, // black +}; +constexpr uint32_t kNumColors = sizeof(kColors) / sizeof(kColors[0]); -// Arbitrary limit on number of graphics buffers allowed to be allocated -// Safeguards against unreasonable resource consumption and provides a testable limit -const unsigned MAX_BUFFERS_IN_FLIGHT = 100; +} // namespace +namespace android::hardware::automotive::evs::V1_1::implementation { -EvsCamera::EvsCamera(const char *id, - unique_ptr &camInfo) : - mFramesAllowed(0), - mFramesInUse(0), - mStreamState(STOPPED), - mCameraInfo(camInfo) { +using V1_0::EvsResult; - ALOGD("EvsCamera instantiated"); +EvsCamera::EvsCamera(const char* id, std::unique_ptr& camInfo) + : mFramesAllowed(0), mFramesInUse(0), mStreamState(STOPPED), mCameraInfo(camInfo) { + ALOGD("%s", __FUNCTION__); /* set a camera id */ mDescription.v1.cameraId = id; /* set camera metadata */ - mDescription.metadata.setToExternal((uint8_t *)camInfo->characteristics, + mDescription.metadata.setToExternal((uint8_t*)camInfo->characteristics, get_camera_metadata_size(camInfo->characteristics)); } - EvsCamera::~EvsCamera() { - ALOGD("EvsCamera being destroyed"); + ALOGD("%s", __FUNCTION__); forceShutdown(); } - -// // This gets called if another caller "steals" ownership of the camera -// -void EvsCamera::forceShutdown() -{ - ALOGD("EvsCamera forceShutdown"); +void EvsCamera::forceShutdown() { + ALOGD("%s", __FUNCTION__); // Make sure our output stream is cleaned up // (It really should be already) stopVideoStream(); // Claim the lock while we work on internal state - std::lock_guard lock(mAccessLock); + std::lock_guard lock(mAccessLock); // Drop all the graphics buffers we've been using if (mBuffers.size() > 0) { @@ -96,19 +96,18 @@ void EvsCamera::forceShutdown() mStreamState = DEAD; } - // Methods from ::android::hardware::automotive::evs::V1_0::IEvsCamera follow. Return EvsCamera::getCameraInfo(getCameraInfo_cb _hidl_cb) { - ALOGD("getCameraInfo"); + ALOGD("%s", __FUNCTION__); // Send back our self description _hidl_cb(mDescription.v1); - return Void(); + return {}; } - Return EvsCamera::setMaxFramesInFlight(uint32_t bufferCount) { - ALOGD("setMaxFramesInFlight"); + ALOGD("%s, bufferCount = %u", __FUNCTION__, bufferCount); + std::lock_guard lock(mAccessLock); // If we've been displaced by another owner of the camera, then we can't do anything else @@ -131,9 +130,9 @@ Return EvsCamera::setMaxFramesInFlight(uint32_t bufferCount) { } } +Return EvsCamera::startVideoStream(const ::android::sp& stream) { + ALOGD("%s", __FUNCTION__); -Return EvsCamera::startVideoStream(const ::android::sp& stream) { - ALOGD("startVideoStream"); std::lock_guard lock(mAccessLock); // If we've been displaced by another owner of the camera, then we can't do anything else @@ -141,82 +140,86 @@ Return EvsCamera::startVideoStream(const ::android::sp EvsCamera::doneWithFrame(const V1_0::BufferDesc& buffer) { + std::lock_guard lock(mAccessLock); + returnBufferLocked(buffer.bufferId, buffer.memHandle); -Return EvsCamera::doneWithFrame(const BufferDesc_1_0& buffer) { - std::lock_guard lock(mAccessLock); - returnBuffer(buffer.bufferId, buffer.memHandle); - - return Void(); + return {}; } +Return EvsCamera::stopVideoStream() { + ALOGD("%s", __FUNCTION__); + + std::unique_lock lock(mAccessLock); -Return EvsCamera::stopVideoStream() { - ALOGD("stopVideoStream"); - std::unique_lock lock(mAccessLock); + if (mStreamState != RUNNING) { + return {}; + } - if (mStreamState == RUNNING) { - // Tell the GenerateFrames loop we want it to stop - mStreamState = STOPPING; + // Tell the GenerateFrames loop we want it to stop + mStreamState = STOPPING; - // Block outside the mutex until the "stop" flag has been acknowledged - // We won't send any more frames, but the client might still get some already in flight - ALOGD("Waiting for stream thread to end..."); - lock.unlock(); + // Block outside the mutex until the "stop" flag has been acknowledged + // We won't send any more frames, but the client might still get some already in flight + ALOGD("Waiting for stream thread to end..."); + lock.unlock(); + if (mCaptureThread.joinable()) { mCaptureThread.join(); - lock.lock(); - - mStreamState = STOPPED; - mStream = nullptr; - ALOGD("Stream marked STOPPED."); } + lock.lock(); + + mStreamState = STOPPED; + mStream = nullptr; + ALOGD("Stream marked STOPPED."); - return Void(); + return {}; } +Return EvsCamera::getExtendedInfo(uint32_t opaqueIdentifier) { + ALOGD("%s", __FUNCTION__); -Return EvsCamera::getExtendedInfo(uint32_t opaqueIdentifier) { - ALOGD("getExtendedInfo"); std::lock_guard lock(mAccessLock); - - // For any single digit value, return the index itself as a test value - if (opaqueIdentifier <= 9) { - return opaqueIdentifier; + const auto it = mExtInfo.find(opaqueIdentifier); + if (it == mExtInfo.end()) { + // Return zero by default as required by the spec + return 0; + } else { + return it->second[0]; } - - // Return zero by default as required by the spec - return 0; } +Return EvsCamera::setExtendedInfo([[maybe_unused]] uint32_t opaqueIdentifier, + [[maybe_unused]] int32_t opaqueValue) { + ALOGD("%s", __FUNCTION__); -Return EvsCamera::setExtendedInfo(uint32_t /*opaqueIdentifier*/, int32_t /*opaqueValue*/) { - ALOGD("setExtendedInfo"); std::lock_guard lock(mAccessLock); // If we've been displaced by another owner of the camera, then we can't do anything else @@ -225,76 +228,73 @@ Return EvsCamera::setExtendedInfo(uint32_t /*opaqueIdentifier*/, int3 return EvsResult::OWNERSHIP_LOST; } - // We don't store any device specific information in this implementation - return EvsResult::INVALID_ARG; + mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue); + return EvsResult::OK; } - // Methods from ::android::hardware::automotive::evs::V1_1::IEvsCamera follow. Return EvsCamera::getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) { - ALOGD("getCameraInfo_1_1"); + ALOGD("%s", __FUNCTION__); // Send back our self description _hidl_cb(mDescription); - return Void(); + return {}; } - -Return EvsCamera::getPhysicalCameraInfo(const hidl_string& id, +Return EvsCamera::getPhysicalCameraInfo([[maybe_unused]] const hidl_string& id, getCameraInfo_1_1_cb _hidl_cb) { ALOGD("%s", __FUNCTION__); // This works exactly same as getCameraInfo_1_1() in default implementation. - (void)id; _hidl_cb(mDescription); - return Void(); + return {}; } +Return EvsCamera::doneWithFrame_1_1(const hidl_vec& buffers) { + ALOGD("%s", __FUNCTION__); -Return EvsCamera::doneWithFrame_1_1(const hidl_vec& buffers) { - std::lock_guard lock(mAccessLock); - + std::lock_guard lock(mAccessLock); for (auto&& buffer : buffers) { - returnBuffer(buffer.bufferId, buffer.buffer.nativeHandle); + returnBufferLocked(buffer.bufferId, buffer.buffer.nativeHandle); } - return EvsResult::OK; } - Return EvsCamera::pauseVideoStream() { + ALOGD("%s", __FUNCTION__); // Default implementation does not support this. return EvsResult::UNDERLYING_SERVICE_ERROR; } - Return EvsCamera::resumeVideoStream() { + ALOGD("%s", __FUNCTION__); // Default implementation does not support this. return EvsResult::UNDERLYING_SERVICE_ERROR; } - Return EvsCamera::setMaster() { + ALOGD("%s", __FUNCTION__); // Default implementation does not expect multiple subscribers and therefore // return a success code always. return EvsResult::OK; } -Return EvsCamera::forceMaster(const sp& ) { +Return EvsCamera::forceMaster(const sp&) { + ALOGD("%s", __FUNCTION__); // Default implementation does not expect multiple subscribers and therefore // return a success code always. return EvsResult::OK; } - Return EvsCamera::unsetMaster() { + ALOGD("%s", __FUNCTION__); // Default implementation does not expect multiple subscribers and therefore // return a success code always. return EvsResult::OK; } - Return EvsCamera::getParameterList(getParameterList_cb _hidl_cb) { + ALOGD("%s", __FUNCTION__); hidl_vec hidlCtrls; hidlCtrls.resize(mCameraInfo->controls.size()); unsigned idx = 0; @@ -303,72 +303,132 @@ Return EvsCamera::getParameterList(getParameterList_cb _hidl_cb) { } _hidl_cb(hidlCtrls); - return Void(); + return {}; } - -Return EvsCamera::getIntParameterRange(CameraParam id, - getIntParameterRange_cb _hidl_cb) { - auto range = mCameraInfo->controls[id]; - _hidl_cb(get<0>(range), get<1>(range), get<2>(range)); - return Void(); +Return EvsCamera::getIntParameterRange(CameraParam id, getIntParameterRange_cb _hidl_cb) { + ALOGD("%s", __FUNCTION__); + auto it = mCameraInfo->controls.find(id); + if (it == mCameraInfo->controls.end()) { + _hidl_cb(0, 0, 0); + } else { + _hidl_cb(std::get<0>(it->second), std::get<1>(it->second), std::get<2>(it->second)); + } + return {}; } - Return EvsCamera::setIntParameter(CameraParam id, int32_t value, setIntParameter_cb _hidl_cb) { - // Default implementation does not support this. - (void)id; - (void)value; - _hidl_cb(EvsResult::INVALID_ARG, 0); - return Void(); + ALOGD("%s", __FUNCTION__); + mParams.insert_or_assign(id, value); + _hidl_cb(EvsResult::OK, {value}); + return {}; } - -Return EvsCamera::getIntParameter(CameraParam id, +Return EvsCamera::getIntParameter([[maybe_unused]] CameraParam id, getIntParameter_cb _hidl_cb) { - // Default implementation does not support this. - (void)id; - _hidl_cb(EvsResult::INVALID_ARG, 0); - return Void(); + ALOGD("%s", __FUNCTION__); + auto it = mParams.find(id); + std::vector values; + if (it == mParams.end()) { + _hidl_cb(EvsResult::INVALID_ARG, values); + } else { + values.push_back(it->second); + _hidl_cb(EvsResult::OK, values); + } + return {}; } - Return EvsCamera::setExtendedInfo_1_1(uint32_t opaqueIdentifier, const hidl_vec& opaqueValue) { - // Default implementation does not use an extended info. - (void)opaqueIdentifier; - (void)opaqueValue; - return EvsResult::INVALID_ARG; + ALOGD("%s", __FUNCTION__); + mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue); + return EvsResult::OK; } - Return EvsCamera::getExtendedInfo_1_1(uint32_t opaqueIdentifier, getExtendedInfo_1_1_cb _hidl_cb) { - // Default implementation does not use an extended info. - (void)opaqueIdentifier; - + ALOGD("%s", __FUNCTION__); + auto status = EvsResult::OK; hidl_vec value; - _hidl_cb(EvsResult::INVALID_ARG, value); - return Void(); + const auto it = mExtInfo.find(opaqueIdentifier); + if (it == mExtInfo.end()) { + status = EvsResult::INVALID_ARG; + } else { + value = it->second; + } + _hidl_cb(status, value); + return {}; } +Return EvsCamera::importExternalBuffers([[maybe_unused]] const hidl_vec& buffers, + importExternalBuffers_cb _hidl_cb) { + auto numBuffersToAdd = buffers.size(); + if (numBuffersToAdd < 1) { + ALOGD("No buffers to add"); + _hidl_cb(EvsResult::OK, mFramesAllowed); + return {}; + } -Return -EvsCamera::importExternalBuffers(const hidl_vec& /* buffers */, - importExternalBuffers_cb _hidl_cb) { - ALOGW("%s is not implemented yet.", __FUNCTION__); - _hidl_cb(EvsResult::UNDERLYING_SERVICE_ERROR, 0); - return {}; -} + { + std::scoped_lock lock(mAccessLock); + + if (numBuffersToAdd > (kMaxBuffersInFlight - mFramesAllowed)) { + numBuffersToAdd -= (kMaxBuffersInFlight - mFramesAllowed); + ALOGW("Exceed the limit on number of buffers. %" PRIu64 " buffers will be added only.", + static_cast(numBuffersToAdd)); + } + GraphicBufferMapper& mapper = GraphicBufferMapper::get(); + const auto before = mFramesAllowed; + for (auto i = 0; i < numBuffersToAdd; ++i) { + // TODO: reject if external buffer is configured differently. + auto& b = buffers[i]; + const AHardwareBuffer_Desc* pDesc = + reinterpret_cast(&b.buffer.description); + + // Import a buffer to add + buffer_handle_t memHandle = nullptr; + status_t result = + mapper.importBuffer(b.buffer.nativeHandle, pDesc->width, pDesc->height, 1, + pDesc->format, pDesc->usage, pDesc->stride, &memHandle); + if (result != android::NO_ERROR || !memHandle) { + ALOGW("Failed to import a buffer %d", b.bufferId); + continue; + } + + auto stored = false; + for (auto&& rec : mBuffers) { + if (rec.handle == nullptr) { + // Use this existing entry + rec.handle = memHandle; + rec.inUse = false; + + stored = true; + break; + } + } + + if (!stored) { + // Add a BufferRecord wrapping this handle to our set of available buffers + mBuffers.emplace_back(memHandle); + } + + ++mFramesAllowed; + } + + _hidl_cb(EvsResult::OK, mFramesAllowed - before); + return {}; + } +} bool EvsCamera::setAvailableFrames_Locked(unsigned bufferCount) { - if (bufferCount < 1) { - ALOGE("Ignoring request to set buffer count to zero"); + if (bufferCount < kMinimumBuffersInFlight) { + ALOGE("Ignoring request to set buffer count below the minimum number of buffers to run a " + "video stream"); return false; } - if (bufferCount > MAX_BUFFERS_IN_FLIGHT) { + if (bufferCount > kMaxBuffersInFlight) { ALOGE("Rejecting buffer request in excess of internal limit"); return false; } @@ -403,17 +463,16 @@ bool EvsCamera::setAvailableFrames_Locked(unsigned bufferCount) { return true; } - unsigned EvsCamera::increaseAvailableFrames_Locked(unsigned numToAdd) { // Acquire the graphics buffer allocator - GraphicBufferAllocator &alloc(GraphicBufferAllocator::get()); + GraphicBufferAllocator& alloc(GraphicBufferAllocator::get()); unsigned added = 0; while (added < numToAdd) { buffer_handle_t memHandle = nullptr; - status_t result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, - &memHandle, &mStride, 0, "EvsCamera"); + status_t result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, &memHandle, &mStride, + 0, "EvsCamera"); if (result != NO_ERROR) { ALOGE("Error %d allocating %d x %d graphics buffer", result, mWidth, mHeight); break; @@ -436,7 +495,7 @@ unsigned EvsCamera::increaseAvailableFrames_Locked(unsigned numToAdd) { } if (!stored) { // Add a BufferRecord wrapping this handle to our set of available buffers - mBuffers.emplace_back(memHandle); + mBuffers.push_back(std::move(BufferRecord(memHandle))); } mFramesAllowed++; @@ -446,10 +505,9 @@ unsigned EvsCamera::increaseAvailableFrames_Locked(unsigned numToAdd) { return added; } - unsigned EvsCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) { // Acquire the graphics buffer allocator - GraphicBufferAllocator &alloc(GraphicBufferAllocator::get()); + GraphicBufferAllocator& alloc(GraphicBufferAllocator::get()); unsigned removed = 0; @@ -472,14 +530,12 @@ unsigned EvsCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) { return removed; } - // This is the asynchronous frame generation thread that runs in parallel with the // main serving thread. There is one for each active camera instance. void EvsCamera::generateFrames() { ALOGD("Frame generation loop started"); unsigned idx; - while (true) { bool timeForFrame = false; nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -521,9 +577,9 @@ void EvsCamera::generateFrames() { if (timeForFrame) { // Assemble the buffer description we'll transmit below - BufferDesc_1_1 newBuffer = {}; + BufferDesc newBuffer = {}; AHardwareBuffer_Desc* pDesc = - reinterpret_cast(&newBuffer.buffer.description); + reinterpret_cast(&newBuffer.buffer.description); pDesc->width = mWidth; pDesc->height = mHeight; pDesc->layers = 1; @@ -534,19 +590,16 @@ void EvsCamera::generateFrames() { newBuffer.pixelSize = sizeof(uint32_t); newBuffer.bufferId = idx; newBuffer.deviceId = mDescription.v1.cameraId; - newBuffer.timestamp = elapsedRealtimeNano(); + newBuffer.timestamp = elapsedRealtimeNano() * 1e+3; // timestamps is in microseconds // Write test data into the image buffer fillTestFrame(newBuffer); // Issue the (asynchronous) callback to the client -- can't be holding the lock - hidl_vec frames; - frames.resize(1); - frames[0] = newBuffer; - auto result = mStream->deliverFrame_1_1(frames); + auto result = mStream->deliverFrame_1_1({newBuffer}); if (result.isOk()) { - ALOGD("Delivered %p as id %d", - newBuffer.buffer.nativeHandle.getNativeHandle(), newBuffer.bufferId); + ALOGD("Delivered %p as id %d", newBuffer.buffer.nativeHandle.getNativeHandle(), + newBuffer.bufferId); } else { // This can happen if the client dies and is likely unrecoverable. // To avoid consuming resources generating failing calls, we stop sending @@ -563,63 +616,50 @@ void EvsCamera::generateFrames() { } } - // We arbitrarily choose to generate frames at 12 fps to ensure we pass the 10fps test requirement - static const int kTargetFrameRate = 12; - static const nsecs_t kTargetFrameTimeUs = 1000*1000 / kTargetFrameRate; + // We arbitrarily choose to generate frames at 15 fps to ensure we pass the 10fps test + // requirement + static const int kTargetFrameRate = 15; + static const nsecs_t kTargetFrameIntervalUs = 1000 * 1000 / kTargetFrameRate; const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - const nsecs_t workTimeUs = (now - startTime) / 1000; - const nsecs_t sleepDurationUs = kTargetFrameTimeUs - workTimeUs; + const nsecs_t elapsedTimeUs = (now - startTime) / 1000; + const nsecs_t sleepDurationUs = kTargetFrameIntervalUs - elapsedTimeUs; if (sleepDurationUs > 0) { usleep(sleepDurationUs); } } // If we've been asked to stop, send an event to signal the actual end of stream - EvsEventDesc event; - event.aType = EvsEventType::STREAM_STOPPED; - auto result = mStream->notify(event); - if (!result.isOk()) { + EvsEventDesc event = { + .aType = EvsEventType::STREAM_STOPPED, + }; + if (!mStream->notify(event).isOk()) { ALOGE("Error delivering end of stream marker"); } return; } - -void EvsCamera::fillTestFrame(const BufferDesc_1_1& buff) { +void EvsCamera::fillTestFrame(const BufferDesc& buff) { // Lock our output buffer for writing - uint32_t *pixels = nullptr; + uint32_t* pixels = nullptr; const AHardwareBuffer_Desc* pDesc = - reinterpret_cast(&buff.buffer.description); - GraphicBufferMapper &mapper = GraphicBufferMapper::get(); + reinterpret_cast(&buff.buffer.description); + GraphicBufferMapper& mapper = GraphicBufferMapper::get(); mapper.lock(buff.buffer.nativeHandle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER, - android::Rect(pDesc->width, pDesc->height), - (void **) &pixels); + android::Rect(pDesc->width, pDesc->height), (void**)&pixels); // If we failed to lock the pixel buffer, we're about to crash, but log it first if (!pixels) { ALOGE("Camera failed to gain access to image buffer for writing"); + return; } - // Fill in the test pixels + // Fill in the test pixels; the colorbar in ABGR format for (unsigned row = 0; row < pDesc->height; row++) { for (unsigned col = 0; col < pDesc->width; col++) { - // Index into the row to check the pixel at this column. - // We expect 0xFF in the LSB channel, a vertical gradient in the - // second channel, a horitzontal gradient in the third channel, and - // 0xFF in the MSB. - // The exception is the very first 32 bits which is used for the - // time varying frame signature to avoid getting fooled by a static image. - uint32_t expectedPixel = 0xFF0000FF | // MSB and LSB - ((row & 0xFF) << 8) | // vertical gradient - ((col & 0xFF) << 16); // horizontal gradient - if ((row | col) == 0) { - static uint32_t sFrameTicker = 0; - expectedPixel = (sFrameTicker) & 0xFF; - sFrameTicker++; - } - pixels[col] = expectedPixel; + const uint32_t index = col * kNumColors / pDesc->width; + pixels[col] = kColors[index]; } // Point to the next row // NOTE: stride retrieved from gralloc is in units of pixels @@ -630,39 +670,35 @@ void EvsCamera::fillTestFrame(const BufferDesc_1_1& buff) { mapper.unlock(buff.buffer.nativeHandle); } - -void EvsCamera::fillTestFrame(const BufferDesc_1_0& buff) { - BufferDesc_1_1 newBufDesc = {}; - AHardwareBuffer_Desc desc = { - buff.width, // width - buff.height, // height - 1, // layers, always 1 for EVS - buff.format, // One of AHardwareBuffer_Format - buff.usage, // Combination of AHardwareBuffer_UsageFlags - buff.stride, // Row stride in pixels - 0, // Reserved - 0 // Reserved +void EvsCamera::fillTestFrame(const V1_0::BufferDesc& buff) { + BufferDesc newBuffer = { + .buffer.nativeHandle = buff.memHandle, + .pixelSize = buff.pixelSize, + .bufferId = buff.bufferId, }; - memcpy(&desc, &newBufDesc.buffer.description, sizeof(desc)); - newBufDesc.buffer.nativeHandle = buff.memHandle; - newBufDesc.pixelSize = buff.pixelSize; - newBufDesc.bufferId = buff.bufferId; - - return fillTestFrame(newBufDesc); + AHardwareBuffer_Desc* pDesc = + reinterpret_cast(&newBuffer.buffer.description); + *pDesc = { + buff.width, // width + buff.height, // height + 1, // layers, always 1 for EVS + buff.format, // One of AHardwareBuffer_Format + buff.usage, // Combination of AHardwareBuffer_UsageFlags + buff.stride, // Row stride in pixels + 0, // Reserved + 0 // Reserved + }; + return fillTestFrame(newBuffer); } - -void EvsCamera::returnBuffer(const uint32_t bufferId, const buffer_handle_t memHandle) { - std::lock_guard lock(mAccessLock); - +void EvsCamera::returnBufferLocked(const uint32_t bufferId, const buffer_handle_t memHandle) { if (memHandle == nullptr) { ALOGE("ignoring doneWithFrame called with null handle"); } else if (bufferId >= mBuffers.size()) { - ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", - bufferId, mBuffers.size()-1); + ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", bufferId, + mBuffers.size() - 1); } else if (!mBuffers[bufferId].inUse) { - ALOGE("ignoring doneWithFrame called on frame %d which is already free", - bufferId); + ALOGE("ignoring doneWithFrame called on frame %d which is already free", bufferId); } else { // Mark the frame as available mBuffers[bufferId].inUse = false; @@ -683,42 +719,33 @@ void EvsCamera::returnBuffer(const uint32_t bufferId, const buffer_handle_t memH } } - -sp EvsCamera::Create(const char *deviceName) { - unique_ptr nullCamInfo = nullptr; +sp EvsCamera::Create(const char* deviceName) { + std::unique_ptr nullCamInfo = nullptr; return Create(deviceName, nullCamInfo); } - -sp EvsCamera::Create(const char *deviceName, - unique_ptr &camInfo, - const Stream *streamCfg) { +sp EvsCamera::Create(const char* deviceName, + std::unique_ptr& camInfo, + [[maybe_unused]] const Stream* streamCfg) { sp evsCamera = new EvsCamera(deviceName, camInfo); if (evsCamera == nullptr) { return nullptr; } - /* default implementation does not use a given configuration */ - (void)streamCfg; - - /* Use the first resolution from the list for the testing */ + // Use the first resolution from the list for the testing + // TODO(b/214835237): Uses a given Stream configuration to choose the best + // stream configuration. auto it = camInfo->streamConfigurations.begin(); evsCamera->mWidth = it->second[1]; evsCamera->mHeight = it->second[2]; - evsCamera->mDescription.v1.vendorFlags = 0xFFFFFFFF; // Arbitrary test value + evsCamera->mDescription.v1.vendorFlags = 0xFFFFFFFF; // Arbitrary test value evsCamera->mFormat = HAL_PIXEL_FORMAT_RGBA_8888; - evsCamera->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE | - GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY; + evsCamera->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE | + GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY; return evsCamera; } - -} // namespace implementation -} // namespace V1_0 -} // namespace evs -} // namespace automotive -} // namespace hardware -} // namespace android +} // namespace android::hardware::automotive::evs::V1_1::implementation diff --git a/automotive/evs/1.1/default/EvsCamera.h b/automotive/evs/1.1/default/EvsCamera.h index 6163a34e0816378d35eabe6aa4e7375636c13fc2..1ea11869aa5aea0ef86c16df5eb2fcb7b6327d29 100644 --- a/automotive/evs/1.1/default/EvsCamera.h +++ b/automotive/evs/1.1/default/EvsCamera.h @@ -17,91 +17,70 @@ #ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERA_H #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERA_H -#include +#include "ConfigManager.h" + #include #include #include +#include #include #include -#include "ConfigManager.h" - -using BufferDesc_1_0 = ::android::hardware::automotive::evs::V1_0::BufferDesc; -using BufferDesc_1_1 = ::android::hardware::automotive::evs::V1_1::BufferDesc; -using IEvsCameraStream_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsCameraStream; -using IEvsCameraStream_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsCameraStream; -using ::android::hardware::automotive::evs::V1_0::EvsResult; -using ::android::hardware::automotive::evs::V1_0::CameraDesc; -using IEvsDisplay_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsDisplay; -using IEvsDisplay_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsDisplay; - - -namespace android { -namespace hardware { -namespace automotive { -namespace evs { -namespace V1_1 { -namespace implementation { - +namespace android::hardware::automotive::evs::V1_1::implementation { // From EvsEnumerator.h class EvsEnumerator; - class EvsCamera : public IEvsCamera { -public: + public: // Methods from ::android::hardware::automotive::evs::V1_0::IEvsCamera follow. - Return getCameraInfo(getCameraInfo_cb _hidl_cb) override; - Return setMaxFramesInFlight(uint32_t bufferCount) override; - Return startVideoStream(const ::android::sp& stream) override; - Return stopVideoStream() override; - Return doneWithFrame(const BufferDesc_1_0& buffer) override; + Return getCameraInfo(getCameraInfo_cb _hidl_cb) override; + Return setMaxFramesInFlight(uint32_t bufferCount) override; + Return startVideoStream(const sp& stream) override; + Return stopVideoStream() override; + Return doneWithFrame(const V1_0::BufferDesc& buffer) override; - Return getExtendedInfo(uint32_t opaqueIdentifier) override; - Return setExtendedInfo(uint32_t opaqueIdentifier, int32_t opaqueValue) override; + Return getExtendedInfo(uint32_t opaqueIdentifier) override; + Return setExtendedInfo(uint32_t opaqueIdentifier, + int32_t opaqueValue) override; // Methods from ::android::hardware::automotive::evs::V1_1::IEvsCamera follow. - Return getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) override; - Return getPhysicalCameraInfo(const hidl_string& id, - getPhysicalCameraInfo_cb _hidl_cb) override; - Return pauseVideoStream() override; - Return resumeVideoStream() override; - Return doneWithFrame_1_1(const hidl_vec& buffer) override; - Return setMaster() override; - Return forceMaster(const sp& display) override; - Return unsetMaster() override; - Return getParameterList(getParameterList_cb _hidl_cb) override; - Return getIntParameterRange(CameraParam id, - getIntParameterRange_cb _hidl_cb) override; - Return setIntParameter(CameraParam id, int32_t value, - setIntParameter_cb _hidl_cb) override; - Return getIntParameter(CameraParam id, - getIntParameter_cb _hidl_cb) override; - Return setExtendedInfo_1_1(uint32_t opaqueIdentifier, - const hidl_vec& opaqueValue) override; - Return getExtendedInfo_1_1(uint32_t opaqueIdentifier, - getExtendedInfo_1_1_cb _hidl_cb) override; - Return importExternalBuffers(const hidl_vec& buffers, - importExternalBuffers_cb _hidl_cb) override; - - static sp Create(const char *deviceName); - static sp Create(const char *deviceName, - unique_ptr &camInfo, - const Stream *streamCfg = nullptr); + Return getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) override; + Return getPhysicalCameraInfo(const hidl_string& id, + getPhysicalCameraInfo_cb _hidl_cb) override; + Return pauseVideoStream() override; + Return resumeVideoStream() override; + Return doneWithFrame_1_1(const hidl_vec& buffer) override; + Return setMaster() override; + Return forceMaster(const sp& display) override; + Return unsetMaster() override; + Return getParameterList(getParameterList_cb _hidl_cb) override; + Return getIntParameterRange(CameraParam id, getIntParameterRange_cb _hidl_cb) override; + Return setIntParameter(CameraParam id, int32_t value, + setIntParameter_cb _hidl_cb) override; + Return getIntParameter(CameraParam id, getIntParameter_cb _hidl_cb) override; + Return setExtendedInfo_1_1(uint32_t opaqueIdentifier, + const hidl_vec& opaqueValue) override; + Return getExtendedInfo_1_1(uint32_t opaqueIdentifier, + getExtendedInfo_1_1_cb _hidl_cb) override; + Return importExternalBuffers(const hidl_vec& buffers, + importExternalBuffers_cb _hidl_cb) override; + + static sp Create(const char* deviceName); + static sp Create(const char* deviceName, + std::unique_ptr& camInfo, + const Stream* streamCfg = nullptr); EvsCamera(const EvsCamera&) = delete; EvsCamera& operator=(const EvsCamera&) = delete; virtual ~EvsCamera() override; - void forceShutdown(); // This gets called if another caller "steals" ownership of the camera + void forceShutdown(); // This gets called if another caller "steals" ownership of the camera const CameraDesc& getDesc() { return mDescription; }; - static const char kCameraName_Backup[]; - -private: - EvsCamera(const char *id, - unique_ptr &camInfo); + private: + EvsCamera(const char* id, std::unique_ptr& camInfo); // These three functions are expected to be called while mAccessLock is held // bool setAvailableFrames_Locked(unsigned bufferCount); @@ -109,34 +88,34 @@ private: unsigned decreaseAvailableFrames_Locked(unsigned numToRemove); void generateFrames(); - void fillTestFrame(const BufferDesc_1_0& buff); - void fillTestFrame(const BufferDesc_1_1& buff); - void returnBuffer(const uint32_t bufferId, const buffer_handle_t memHandle); + void fillTestFrame(const V1_0::BufferDesc& buff); + void fillTestFrame(const BufferDesc& buff); + void returnBufferLocked(const uint32_t bufferId, const buffer_handle_t memHandle); sp mEnumerator; // The enumerator object that created this camera - CameraDesc mDescription = {}; // The properties of this camera + CameraDesc mDescription = {}; // The properties of this camera - std::thread mCaptureThread; // The thread we'll use to synthesize frames + std::thread mCaptureThread; // The thread we'll use to synthesize frames - uint32_t mWidth = 0; // Horizontal pixel count in the buffers - uint32_t mHeight = 0; // Vertical pixel count in the buffers - uint32_t mFormat = 0; // Values from android_pixel_format_t - uint64_t mUsage = 0; // Values from from Gralloc.h - uint32_t mStride = 0; // Bytes per line in the buffers + uint32_t mWidth = 0; // Horizontal pixel count in the buffers + uint32_t mHeight = 0; // Vertical pixel count in the buffers + uint32_t mFormat = 0; // Values from android_pixel_format_t + uint64_t mUsage = 0; // Values from from Gralloc.h + uint32_t mStride = 0; // Bytes per line in the buffers - sp mStream = nullptr; // The callback used to deliver each frame + sp mStream = nullptr; // The callback used to deliver each frame struct BufferRecord { buffer_handle_t handle; bool inUse; - explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false) {}; + explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false){}; }; - std::vector mBuffers; // Graphics buffers to transfer images - unsigned mFramesAllowed; // How many buffers are we currently using - unsigned mFramesInUse; // How many buffers are currently outstanding + std::vector mBuffers; // Graphics buffers to transfer images + unsigned mFramesAllowed; // How many buffers are we currently using + unsigned mFramesInUse; // How many buffers are currently outstanding enum StreamStateValues { STOPPED, @@ -150,14 +129,13 @@ private: std::mutex mAccessLock; // Static camera module information - unique_ptr &mCameraInfo; + std::unique_ptr& mCameraInfo; + + // For the extended info + std::unordered_map> mExtInfo; + std::unordered_map mParams; }; -} // namespace implementation -} // namespace V1_1 -} // namespace evs -} // namespace automotive -} // namespace hardware -} // namespace android +} // namespace android::hardware::automotive::evs::V1_1::implementation #endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERA_H diff --git a/automotive/evs/1.1/default/EvsDisplay.cpp b/automotive/evs/1.1/default/EvsDisplay.cpp index 2b5a4a977c5569efdfb75e806ed92289eeba118b..f7169e5859b207917869fbc35e9d1ee841e46322 100644 --- a/automotive/evs/1.1/default/EvsDisplay.cpp +++ b/automotive/evs/1.1/default/EvsDisplay.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.automotive.evs@1.1-service" - #include "EvsDisplay.h" #include @@ -23,51 +21,53 @@ using ::android::frameworks::automotive::display::V1_0::HwDisplayConfig; using ::android::frameworks::automotive::display::V1_0::HwDisplayState; +using ::android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService; +using ::android::hardware::automotive::evs::V1_0::DisplayDesc; +using ::android::hardware::automotive::evs::V1_0::DisplayState; +using ::android::hardware::automotive::evs::V1_0::EvsResult; + +namespace { + + // Arbitrary magic number for self-recognition + constexpr uint32_t kDefaultDisplayBufferId = 0x3870; -namespace android { -namespace hardware { -namespace automotive { -namespace evs { -namespace V1_1 { -namespace implementation { +} // namespace +namespace android::hardware::automotive::evs::V1_1::implementation { EvsDisplay::EvsDisplay() { EvsDisplay(nullptr, 0); } - EvsDisplay::EvsDisplay(sp pDisplayProxy, uint64_t displayId) : mDisplayProxy(pDisplayProxy), - mDisplayId(displayId) { + mDisplayId(displayId), + mGlWrapper(std::make_unique()) { ALOGD("EvsDisplay instantiated"); // Set up our self description // NOTE: These are arbitrary values chosen for testing - mInfo.displayId = "Mock Display"; - mInfo.vendorFlags = 3870; + mInfo.displayId = "Mock Display"; + mInfo.vendorFlags = 3870; // Assemble the buffer description we'll use for our render target - mBuffer.width = 320; - mBuffer.height = 240; - mBuffer.format = HAL_PIXEL_FORMAT_RGBA_8888; - mBuffer.usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER; - mBuffer.bufferId = 0x3870; // Arbitrary magic number for self recognition - mBuffer.pixelSize = 4; + mBuffer.width = 640; + mBuffer.height = 360; + mBuffer.format = HAL_PIXEL_FORMAT_RGBA_8888; + mBuffer.usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER; + mBuffer.bufferId = kDefaultDisplayBufferId; + mBuffer.pixelSize = 4; } - EvsDisplay::~EvsDisplay() { ALOGD("EvsDisplay being destroyed"); forceShutdown(); } - /** * This gets called if another caller "steals" ownership of the display */ -void EvsDisplay::forceShutdown() -{ +void EvsDisplay::forceShutdown() { ALOGD("EvsDisplay forceShutdown"); std::lock_guard lock(mAccessLock); @@ -84,6 +84,11 @@ void EvsDisplay::forceShutdown() GraphicBufferAllocator& alloc(GraphicBufferAllocator::get()); alloc.free(mBuffer.memHandle); mBuffer.memHandle = nullptr; + + if (mGlWrapper) { + mGlWrapper->hideWindow(mDisplayProxy, mDisplayId); + mGlWrapper->shutdown(); + } } // Put this object into an unrecoverable error state since somebody else @@ -91,20 +96,18 @@ void EvsDisplay::forceShutdown() mRequestedState = DisplayState::DEAD; } - /** * Returns basic information about the EVS display provided by the system. * See the description of the DisplayDesc structure for details. */ -Return EvsDisplay::getDisplayInfo(getDisplayInfo_cb _hidl_cb) { +Return EvsDisplay::getDisplayInfo(getDisplayInfo_cb _hidl_cb) { ALOGD("getDisplayInfo"); // Send back our self description _hidl_cb(mInfo); - return Void(); + return {}; } - /** * Clients may set the display state to express their desired state. * The HAL implementation must gracefully accept a request for any state @@ -124,18 +127,28 @@ Return EvsDisplay::setDisplayState(DisplayState state) { } // Ensure we recognize the requested state so we don't go off the rails - if (state < DisplayState::NUM_STATES) { - // Record the requested state - mRequestedState = state; - return EvsResult::OK; - } - else { - // Turn off the display if asked for an unrecognized state - mRequestedState = DisplayState::NOT_VISIBLE; + if (state >= DisplayState::NUM_STATES) { return EvsResult::INVALID_ARG; } -} + if (!mGlWrapper) { + switch (state) { + case DisplayState::NOT_VISIBLE: + mGlWrapper->hideWindow(mDisplayProxy, mDisplayId); + break; + case DisplayState::VISIBLE: + mGlWrapper->showWindow(mDisplayProxy, mDisplayId); + break; + default: + break; + } + } + + // Record the requested state + mRequestedState = state; + + return EvsResult::OK; +} /** * The HAL implementation should report the actual current state, which might @@ -144,14 +157,13 @@ Return EvsDisplay::setDisplayState(DisplayState state) { * the device layer, making it undesirable for the HAL implementation to * spontaneously change display states. */ -Return EvsDisplay::getDisplayState() { +Return EvsDisplay::getDisplayState() { ALOGD("getDisplayState"); std::lock_guard lock(mAccessLock); return mRequestedState; } - /** * This call returns a handle to a frame buffer associated with the display. * This buffer may be locked and written to by software and/or GL. This buffer @@ -159,43 +171,55 @@ Return EvsDisplay::getDisplayState() { * display is no longer visible. */ // TODO: We need to know if/when our client dies so we can get the buffer back! (blocked b/31632518) -Return EvsDisplay::getTargetBuffer(getTargetBuffer_cb _hidl_cb) { +Return EvsDisplay::getTargetBuffer(getTargetBuffer_cb _hidl_cb) { ALOGD("getTargetBuffer"); std::lock_guard lock(mAccessLock); if (mRequestedState == DisplayState::DEAD) { ALOGE("Rejecting buffer request from object that lost ownership of the display."); - BufferDesc_1_0 nullBuff = {}; - _hidl_cb(nullBuff); - return Void(); + _hidl_cb({}); + return {}; } // If we don't already have a buffer, allocate one now if (!mBuffer.memHandle) { + // Initialize our display window + // NOTE: This will cause the display to become "VISIBLE" before a frame is actually + // returned, which is contrary to the spec and will likely result in a black frame being + // (briefly) shown. + if (mGlWrapper->initialize(mDisplayProxy, mDisplayId)) { + // Assemble the buffer description we'll use for our render target + mBuffer.width = mGlWrapper->getWidth(); + mBuffer.height = mGlWrapper->getHeight(); + mBuffer.format = HAL_PIXEL_FORMAT_RGBA_8888; + mBuffer.usage = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER; + mBuffer.bufferId = kDefaultDisplayBufferId; + mBuffer.pixelSize = 4; + } else { + // If we failed to initialize a EGL, then we're not going to display + // any. + mGlWrapper = nullptr; + } + // Allocate the buffer that will hold our displayable image buffer_handle_t handle = nullptr; GraphicBufferAllocator& alloc(GraphicBufferAllocator::get()); - status_t result = alloc.allocate( - mBuffer.width, mBuffer.height, mBuffer.format, 1, mBuffer.usage, - &handle, &mBuffer.stride, 0, "EvsDisplay"); - if (result != NO_ERROR) { - ALOGE("Error %d allocating %d x %d graphics buffer", - result, mBuffer.width, mBuffer.height); - BufferDesc_1_0 nullBuff = {}; - _hidl_cb(nullBuff); - return Void(); - } - if (!handle) { - ALOGE("We didn't get a buffer handle back from the allocator"); - BufferDesc_1_0 nullBuff = {}; - _hidl_cb(nullBuff); - return Void(); + status_t result = alloc.allocate(mBuffer.width, mBuffer.height, mBuffer.format, 1, + mBuffer.usage, &handle, &mBuffer.stride, 0, "EvsDisplay"); + if (result != NO_ERROR || !handle) { + ALOGE("Error %d allocating %d x %d graphics buffer", result, mBuffer.width, + mBuffer.height); + if (mGlWrapper) { + mGlWrapper->shutdown(); + } + _hidl_cb({}); + return {}; } mBuffer.memHandle = handle; mFrameBusy = false; - ALOGD("Allocated new buffer %p with stride %u", - mBuffer.memHandle.getNativeHandle(), mBuffer.stride); + ALOGD("Allocated new buffer %p with stride %u", mBuffer.memHandle.getNativeHandle(), + mBuffer.stride); } // Do we have a frame available? @@ -205,41 +229,40 @@ Return EvsDisplay::getTargetBuffer(getTargetBuffer_cb _hidl_cb) { // a previously issued buffer yet (they're behaving badly). // NOTE: We have to make the callback even if we have nothing to provide ALOGE("getTargetBuffer called while no buffers available."); - BufferDesc_1_0 nullBuff = {}; - _hidl_cb(nullBuff); - return Void(); + _hidl_cb({}); + return {}; } else { // Mark our buffer as busy mFrameBusy = true; // Send the buffer to the client - ALOGD("Providing display buffer handle %p as id %d", - mBuffer.memHandle.getNativeHandle(), mBuffer.bufferId); + ALOGD("Providing display buffer handle %p as id %d", mBuffer.memHandle.getNativeHandle(), + mBuffer.bufferId); _hidl_cb(mBuffer); - return Void(); + return {}; } } - /** * This call tells the display that the buffer is ready for display. * The buffer is no longer valid for use by the client after this call. */ -Return EvsDisplay::returnTargetBufferForDisplayImpl(const uint32_t bufferId, const buffer_handle_t memHandle) { +Return EvsDisplay::returnTargetBufferForDisplayImpl(const uint32_t bufferId, + const buffer_handle_t memHandle) { ALOGD("returnTargetBufferForDisplay %p", memHandle); std::lock_guard lock(mAccessLock); // Nobody should call us with a null handle if (!memHandle) { - ALOGE ("returnTargetBufferForDisplay called without a valid buffer handle.\n"); + ALOGE("returnTargetBufferForDisplay called without a valid buffer handle.\n"); return EvsResult::INVALID_ARG; } if (bufferId != mBuffer.bufferId) { - ALOGE ("Got an unrecognized frame returned.\n"); + ALOGE("Got an unrecognized frame returned.\n"); return EvsResult::INVALID_ARG; } if (!mFrameBusy) { - ALOGE ("A frame was returned with no outstanding frames.\n"); + ALOGE("A frame was returned with no outstanding frames.\n"); return EvsResult::BUFFER_NOT_AVAILABLE; } @@ -253,23 +276,32 @@ Return EvsDisplay::returnTargetBufferForDisplayImpl(const uint32_t bu // If we were waiting for a new frame, this is it! if (mRequestedState == DisplayState::VISIBLE_ON_NEXT_FRAME) { mRequestedState = DisplayState::VISIBLE; + if (mGlWrapper) { + mGlWrapper->showWindow(mDisplayProxy, mDisplayId); + } } // Validate we're in an expected state if (mRequestedState != DisplayState::VISIBLE) { // We shouldn't get frames back when we're not visible. - ALOGE ("Got an unexpected frame returned while not visible - ignoring.\n"); - } else { + ALOGE("Got an unexpected frame returned while not visible - ignoring.\n"); + } else if (mGlWrapper) { // This is where the buffer would be made visible. - // For now we simply validate it has the data we expect in it by reading it back + if (!mGlWrapper->updateImageTexture(mBuffer)) { + return EvsResult::UNDERLYING_SERVICE_ERROR; + } + // Put the image on the screen + mGlWrapper->renderImageToScreen(); + } else { + // TODO: Move below validation logic to somewhere else +#if 0 + // For now we simply validate it has the data we expect in it by reading it back // Lock our display buffer for reading uint32_t* pixels = nullptr; - GraphicBufferMapper &mapper = GraphicBufferMapper::get(); - mapper.lock(mBuffer.memHandle, - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER, - android::Rect(mBuffer.width, mBuffer.height), - (void **)&pixels); + GraphicBufferMapper& mapper = GraphicBufferMapper::get(); + mapper.lock(mBuffer.memHandle, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER, + android::Rect(mBuffer.width, mBuffer.height), (void**)&pixels); // If we failed to lock the pixel buffer, we're about to crash, but log it first if (!pixels) { @@ -286,8 +318,8 @@ Return EvsDisplay::returnTargetBufferForDisplayImpl(const uint32_t bu // 0xFF in the MSB. // The exception is the very first 32 bits which is used for the // time varying frame signature to avoid getting fooled by a static image. - uint32_t expectedPixel = 0xFF0000FF | // MSB and LSB - ((row & 0xFF) << 8) | // vertical gradient + uint32_t expectedPixel = 0xFF0000FF | // MSB and LSB + ((row & 0xFF) << 8) | // vertical gradient ((col & 0xFF) << 16); // horizontal gradient if ((row | col) == 0) { // we'll check the "uniqueness" of the frame signature below @@ -318,39 +350,31 @@ Return EvsDisplay::returnTargetBufferForDisplayImpl(const uint32_t bu ALOGE("Duplicate, likely stale frame buffer detected"); } - // Release our output buffer mapper.unlock(mBuffer.memHandle); if (!frameLooksGood) { return EvsResult::UNDERLYING_SERVICE_ERROR; } +#endif } return EvsResult::OK; } - -Return EvsDisplay::returnTargetBufferForDisplay(const BufferDesc_1_0& buffer) { +Return EvsDisplay::returnTargetBufferForDisplay(const V1_0::BufferDesc& buffer) { return returnTargetBufferForDisplayImpl(buffer.bufferId, buffer.memHandle); } - Return EvsDisplay::getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) { if (mDisplayProxy != nullptr) { return mDisplayProxy->getDisplayInfo(mDisplayId, _info_cb); } else { HwDisplayConfig nullConfig; - HwDisplayState nullState; + HwDisplayState nullState; _info_cb(nullConfig, nullState); - return Void(); + return {}; } } - -} // namespace implementation -} // namespace V1_1 -} // namespace evs -} // namespace automotive -} // namespace hardware -} // namespace android +} // namespace android::hardware::automotive::evs::V1_1::implementation diff --git a/automotive/evs/1.1/default/EvsDisplay.h b/automotive/evs/1.1/default/EvsDisplay.h index 9b2ed901281e5cec118c0cd555a6e892d0b49989..b2ec3e82c4db3a3d96f6ca3d4593a542413e67d3 100644 --- a/automotive/evs/1.1/default/EvsDisplay.h +++ b/automotive/evs/1.1/default/EvsDisplay.h @@ -17,64 +17,48 @@ #ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H -#include +#include "GlWrapper.h" + #include +#include #include -using ::android::hardware::automotive::evs::V1_1::IEvsDisplay; -using ::android::hardware::automotive::evs::V1_0::DisplayDesc; -using ::android::hardware::automotive::evs::V1_0::DisplayState; -using ::android::hardware::automotive::evs::V1_0::EvsResult; -using BufferDesc_1_0 = ::android::hardware::automotive::evs::V1_0::BufferDesc; -using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService; - -namespace android { -namespace hardware { -namespace automotive { -namespace evs { -namespace V1_1 { -namespace implementation { - +namespace android::hardware::automotive::evs::V1_1::implementation { class EvsDisplay : public IEvsDisplay { -public: + public: // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow. - Return getDisplayInfo(getDisplayInfo_cb _hidl_cb) override; - Return setDisplayState(DisplayState state) override; - Return getDisplayState() override; - Return getTargetBuffer(getTargetBuffer_cb _hidl_cb) override; - Return returnTargetBufferForDisplay(const BufferDesc_1_0& buffer) override; + Return getDisplayInfo(getDisplayInfo_cb _hidl_cb) override; + Return setDisplayState(V1_0::DisplayState state) override; + Return getDisplayState() override; + Return getTargetBuffer(getTargetBuffer_cb _hidl_cb) override; + Return returnTargetBufferForDisplay(const V1_0::BufferDesc& buffer) override; // Methods from ::android::hardware::automotive::evs::V1_1::IEvsDisplay follow. - Return getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) override; + Return getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) override; // Implementation details EvsDisplay(); - EvsDisplay(sp pDisplayProxy, uint64_t displayId); + EvsDisplay( + sp pDisplayProxy, + uint64_t displayId); virtual ~EvsDisplay() override; - void forceShutdown(); // This gets called if another caller "steals" ownership of the display - Return returnTargetBufferForDisplayImpl(const uint32_t bufferId, - const buffer_handle_t memHandle); - -private: - DisplayDesc mInfo = {}; - BufferDesc_1_0 mBuffer = {}; // A graphics buffer into which we'll store images - - bool mFrameBusy = false; // A flag telling us our buffer is in use - DisplayState mRequestedState = DisplayState::NOT_VISIBLE; - - std::mutex mAccessLock; + void forceShutdown(); // This gets called if another caller "steals" ownership of the display + Return returnTargetBufferForDisplayImpl(const uint32_t bufferId, + const buffer_handle_t memHandle); - sp mDisplayProxy; - uint64_t mDisplayId; + private: + V1_0::DisplayDesc mInfo = {}; + V1_0::BufferDesc mBuffer = {}; // A graphics buffer into which we'll store images + V1_0::DisplayState mRequestedState = V1_0::DisplayState::NOT_VISIBLE; + bool mFrameBusy = false; // A flag telling us our buffer is in use + std::mutex mAccessLock; + sp mDisplayProxy; + uint64_t mDisplayId; + std::unique_ptr mGlWrapper; }; -} // namespace implementation -} // namespace V1_1 -} // namespace evs -} // namespace automotive -} // namespace hardware -} // namespace android +} // namespace android::hardware::automotive::evs::V1_1::implementation #endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSDISPLAY_H diff --git a/automotive/evs/1.1/default/EvsEnumerator.cpp b/automotive/evs/1.1/default/EvsEnumerator.cpp index d06647166fd6ee73b7830e6adfd436a672da55e3..b84268a15cb5af16b19e1bd20bb5cc8183cd3dc0 100644 --- a/automotive/evs/1.1/default/EvsEnumerator.cpp +++ b/automotive/evs/1.1/default/EvsEnumerator.cpp @@ -14,184 +14,171 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.automotive.evs@1.1-service" - #include "EvsEnumerator.h" #include "EvsCamera.h" #include "EvsDisplay.h" #include "EvsUltrasonicsArray.h" -namespace android { -namespace hardware { -namespace automotive { -namespace evs { -namespace V1_1 { -namespace implementation { +using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService; +using android::hardware::automotive::evs::V1_0::EvsResult; + +namespace android::hardware::automotive::evs::V1_1::implementation { +namespace evs_v1_0 = ::android::hardware::automotive::evs::V1_0; // NOTE: All members values are static so that all clients operate on the same state // That is to say, this is effectively a singleton despite the fact that HIDL // constructs a new instance for each client. -std::list EvsEnumerator::sCameraList; -wp EvsEnumerator::sActiveDisplay; -unique_ptr EvsEnumerator::sConfigManager; -sp EvsEnumerator::sDisplayProxyService; -std::unordered_map EvsEnumerator::sDisplayPortList; -std::list EvsEnumerator::sUltrasonicsArrayRecordList; - -EvsEnumerator::EvsEnumerator(sp windowService) { - ALOGD("EvsEnumerator created"); +std::list EvsEnumerator::sCameraList; +wp EvsEnumerator::sActiveDisplay; +std::unique_ptr EvsEnumerator::sConfigManager; +sp EvsEnumerator::sDisplayProxyService; +std::unordered_map EvsEnumerator::sDisplayPortList; +std::list EvsEnumerator::sUltrasonicsArrayRecordList; +uint64_t EvsEnumerator::sInternalDisplayId; + +EvsEnumerator::EvsEnumerator(sp& windowService) { + ALOGD("%s", __FUNCTION__); // Add sample camera data to our list of cameras // In a real driver, this would be expected to can the available hardware sConfigManager = - ConfigManager::Create("/vendor/etc/automotive/evs/evs_default_configuration.xml"); + ConfigManager::Create("/vendor/etc/automotive/evs/evs_default_configuration.xml"); // Add available cameras for (auto v : sConfigManager->getCameraList()) { - sCameraList.emplace_back(v.c_str()); + CameraRecord rec(v.data()); + std::unique_ptr& pInfo = sConfigManager->getCameraInfo(v); + if (pInfo) { + rec.desc.metadata.setToExternal(reinterpret_cast(pInfo->characteristics), + get_camera_metadata_size(pInfo->characteristics)); + } + sCameraList.push_back(std::move(rec)); } - if (sDisplayProxyService == nullptr) { + if (!sDisplayProxyService) { /* sets a car-window service handle */ sDisplayProxyService = windowService; } // Add available displays - if (sDisplayProxyService != nullptr) { + if (sDisplayProxyService) { // Get a display ID list. - sDisplayProxyService->getDisplayIdList([](const auto& displayIds) { - for (const auto& id : displayIds) { - const auto port = id & 0xF; - sDisplayPortList.insert_or_assign(port, id); + auto status = sDisplayProxyService->getDisplayIdList([](const auto& displayIds) { + if (displayIds.size() > 0) { + sInternalDisplayId = displayIds[0]; + for (const auto& id : displayIds) { + const auto port = id & 0xF; + sDisplayPortList.insert_or_assign(port, id); + } } }); + + if (!status.isOk()) { + ALOGE("Failed to read a display list"); + } } // Add ultrasonics array desc. - sUltrasonicsArrayRecordList.emplace_back( - EvsUltrasonicsArray::GetMockArrayDesc("front_array")); + sUltrasonicsArrayRecordList.emplace_back(EvsUltrasonicsArray::GetMockArrayDesc("front_array")); } - // Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow. -Return EvsEnumerator::getCameraList(getCameraList_cb _hidl_cb) { - ALOGD("getCameraList"); +Return EvsEnumerator::getCameraList(getCameraList_cb _hidl_cb) { + ALOGD("%s", __FUNCTION__); - const unsigned numCameras = sCameraList.size(); + const auto numCameras = sCameraList.size(); // Build up a packed array of CameraDesc for return // NOTE: Only has to live until the callback returns - std::vector descriptions; + std::vector descriptions; descriptions.reserve(numCameras); for (const auto& cam : sCameraList) { - descriptions.push_back( cam.desc.v1 ); + descriptions.push_back(cam.desc.v1); } // Encapsulate our camera descriptions in the HIDL vec type - hidl_vec hidlCameras(descriptions); + hidl_vec hidlCameras(descriptions); // Send back the results ALOGD("reporting %zu cameras available", hidlCameras.size()); _hidl_cb(hidlCameras); - - // HIDL convention says we return Void if we sent our result back via callback - return Void(); + return {}; } - -Return> EvsEnumerator::openCamera(const hidl_string& cameraId) { - ALOGD("openCamera"); +Return> EvsEnumerator::openCamera(const hidl_string& cameraId) { + ALOGD("%s", __FUNCTION__); // Find the named camera - CameraRecord *pRecord = nullptr; - for (auto &&cam : sCameraList) { - if (cam.desc.v1.cameraId == cameraId) { - // Found a match! - pRecord = &cam; - break; - } - } - - // Is this a recognized camera id? - if (!pRecord) { + auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) { + return cameraId == cam.desc.v1.cameraId; + }); + if (it == sCameraList.end()) { ALOGE("Requested camera %s not found", cameraId.c_str()); return nullptr; } // Has this camera already been instantiated by another caller? - sp pActiveCamera = pRecord->activeInstance.promote(); + sp pActiveCamera = it->activeInstance.promote(); if (pActiveCamera != nullptr) { ALOGW("Killing previous camera because of new caller"); closeCamera(pActiveCamera); } // Construct a camera instance for the caller - if (sConfigManager == nullptr) { + if (!sConfigManager) { pActiveCamera = EvsCamera::Create(cameraId.c_str()); } else { - pActiveCamera = EvsCamera::Create(cameraId.c_str(), - sConfigManager->getCameraInfo(cameraId)); + pActiveCamera = + EvsCamera::Create(cameraId.c_str(), sConfigManager->getCameraInfo(cameraId)); } - pRecord->activeInstance = pActiveCamera; - if (pActiveCamera == nullptr) { + it->activeInstance = pActiveCamera; + if (!pActiveCamera) { ALOGE("Failed to allocate new EvsCamera object for %s\n", cameraId.c_str()); } return pActiveCamera; } +Return EvsEnumerator::closeCamera(const ::android::sp& pCamera) { + ALOGD("%s", __FUNCTION__); -Return EvsEnumerator::closeCamera(const ::android::sp& pCamera) { - ALOGD("closeCamera"); - - auto pCamera_1_1 = IEvsCamera_1_1::castFrom(pCamera).withDefault(nullptr); - if (pCamera_1_1 == nullptr) { + auto pCamera_1_1 = IEvsCamera::castFrom(pCamera).withDefault(nullptr); + if (!pCamera_1_1) { ALOGE("Ignoring call to closeCamera with null camera ptr"); - return Void(); + return {}; } // Get the camera id so we can find it in our list std::string cameraId; - pCamera_1_1->getCameraInfo_1_1([&cameraId](CameraDesc desc) { - cameraId = desc.v1.cameraId; - } - ); + pCamera_1_1->getCameraInfo_1_1([&cameraId](CameraDesc desc) { cameraId = desc.v1.cameraId; }); // Find the named camera - CameraRecord *pRecord = nullptr; - for (auto &&cam : sCameraList) { - if (cam.desc.v1.cameraId == cameraId) { - // Found a match! - pRecord = &cam; - break; - } + auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) { + return cameraId == cam.desc.v1.cameraId; + }); + if (it == sCameraList.end()) { + ALOGE("Ignores a request to close unknown camera, %s", cameraId.data()); + return {}; } - // Is the display being destroyed actually the one we think is active? - if (!pRecord) { - ALOGE("Asked to close a camera who's name isn't recognized"); + sp pActiveCamera = it->activeInstance.promote(); + if (!pActiveCamera) { + ALOGE("Somehow a camera is being destroyed when the enumerator didn't know one existed"); + } else if (pActiveCamera != pCamera_1_1) { + // This can happen if the camera was aggressively reopened, orphaning this previous instance + ALOGW("Ignoring close of previously orphaned camera - why did a client steal?"); } else { - sp pActiveCamera = pRecord->activeInstance.promote(); - - if (pActiveCamera == nullptr) { - ALOGE("Somehow a camera is being destroyed when the enumerator didn't know one existed"); - } else if (pActiveCamera != pCamera_1_1) { - // This can happen if the camera was aggressively reopened, orphaning this previous instance - ALOGW("Ignoring close of previously orphaned camera - why did a client steal?"); - } else { - // Drop the active camera - pActiveCamera->forceShutdown(); - pRecord->activeInstance = nullptr; - } + // Drop the active camera + pActiveCamera->forceShutdown(); + it->activeInstance = nullptr; } - return Void(); + return {}; } - -Return> EvsEnumerator::openDisplay() { - ALOGD("openDisplay"); +Return> EvsEnumerator::openDisplay() { + ALOGD("%s", __FUNCTION__); // If we already have a display active, then we need to shut it down so we can // give exclusive access to the new caller. @@ -202,28 +189,25 @@ Return> EvsEnumerator::openDisplay() { } // Create a new display interface and return it - pActiveDisplay = new EvsDisplay(); + pActiveDisplay = new EvsDisplay(sDisplayProxyService, sInternalDisplayId); sActiveDisplay = pActiveDisplay; ALOGD("Returning new EvsDisplay object %p", pActiveDisplay.get()); return pActiveDisplay; } - Return EvsEnumerator::getDisplayIdList(getDisplayIdList_cb _list_cb) { hidl_vec ids; - ids.resize(sDisplayPortList.size()); + unsigned i = 0; - for (const auto& [port, id] : sDisplayPortList) { - ids[i++] = port; - } + std::for_each(sDisplayPortList.begin(), sDisplayPortList.end(), + [&](const auto& element) { ids[i++] = element.first; }); _list_cb(ids); - return Void(); + return {}; } - Return> EvsEnumerator::openDisplay_1_1(uint8_t port) { ALOGD("%s", __FUNCTION__); @@ -243,10 +227,8 @@ Return> EvsEnumerator::openDisplay_1_1(uint8_t port) { return pActiveDisplay; } - - -Return EvsEnumerator::closeDisplay(const ::android::sp& pDisplay) { - ALOGD("closeDisplay"); +Return EvsEnumerator::closeDisplay(const ::android::sp& pDisplay) { + ALOGD("%s", __FUNCTION__); // Do we still have a display object we think should be active? sp pActiveDisplay = sActiveDisplay.promote(); @@ -260,123 +242,111 @@ Return EvsEnumerator::closeDisplay(const ::android::sp& p sActiveDisplay = nullptr; } - return Void(); + return {}; } - -Return EvsEnumerator::getDisplayState() { - ALOGD("getDisplayState"); +Return EvsEnumerator::getDisplayState() { + ALOGD("%s", __FUNCTION__); // Do we still have a display object we think should be active? sp pActiveDisplay = sActiveDisplay.promote(); if (pActiveDisplay != nullptr) { return pActiveDisplay->getDisplayState(); } else { - return DisplayState::NOT_OPEN; + return V1_0::DisplayState::NOT_OPEN; } } - // Methods from ::android::hardware::automotive::evs::V1_1::IEvsEnumerator follow. -Return EvsEnumerator::getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) { - ALOGD("getCameraList"); +Return EvsEnumerator::getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) { + ALOGD("%s", __FUNCTION__); - const unsigned numCameras = sCameraList.size(); + const auto numCameras = sCameraList.size(); // Build up a packed array of CameraDesc for return // NOTE: Only has to live until the callback returns - std::vector descriptions; + std::vector descriptions; descriptions.reserve(numCameras); - for (const auto& cam : sCameraList) { - descriptions.push_back( cam.desc ); - } + std::for_each(sCameraList.begin(), sCameraList.end(), + [&](const auto& cam) { descriptions.push_back(cam.desc); }); // Encapsulate our camera descriptions in the HIDL vec type - hidl_vec hidlCameras(descriptions); + hidl_vec hidlCameras(descriptions); // Send back the results ALOGD("reporting %zu cameras available", hidlCameras.size()); _hidl_cb(hidlCameras); - - // HIDL convention says we return Void if we sent our result back via callback - return Void(); + return {}; } -Return> -EvsEnumerator::openCamera_1_1(const hidl_string& cameraId, - const Stream& streamCfg) { - // Find the named camera - CameraRecord *pRecord = nullptr; - for (auto &&cam : sCameraList) { - if (cam.desc.v1.cameraId == cameraId) { - // Found a match! - pRecord = &cam; - break; - } - } +Return> EvsEnumerator::openCamera_1_1(const hidl_string& cameraId, + const Stream& streamCfg) { + ALOGD("%s", __FUNCTION__); - // Is this a recognized camera id? - if (!pRecord) { + // Find the named camera + auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) { + return cameraId == cam.desc.v1.cameraId; + }); + if (it == sCameraList.end()) { ALOGE("Requested camera %s not found", cameraId.c_str()); return nullptr; } // Has this camera already been instantiated by another caller? - sp pActiveCamera = pRecord->activeInstance.promote(); + sp pActiveCamera = it->activeInstance.promote(); if (pActiveCamera != nullptr) { ALOGW("Killing previous camera because of new caller"); closeCamera(pActiveCamera); } // Construct a camera instance for the caller - if (sConfigManager == nullptr) { + if (!sConfigManager) { pActiveCamera = EvsCamera::Create(cameraId.c_str()); } else { - pActiveCamera = EvsCamera::Create(cameraId.c_str(), - sConfigManager->getCameraInfo(cameraId), + pActiveCamera = EvsCamera::Create(cameraId.c_str(), sConfigManager->getCameraInfo(cameraId), &streamCfg); } - pRecord->activeInstance = pActiveCamera; - if (pActiveCamera == nullptr) { + it->activeInstance = pActiveCamera; + if (!pActiveCamera) { ALOGE("Failed to allocate new EvsCamera object for %s\n", cameraId.c_str()); } return pActiveCamera; } - EvsEnumerator::CameraRecord* EvsEnumerator::findCameraById(const std::string& cameraId) { - // Find the named camera - CameraRecord *pRecord = nullptr; - for (auto &&cam : sCameraList) { - if (cam.desc.v1.cameraId == cameraId) { - // Found a match! - pRecord = &cam; - break; - } - } + ALOGD("%s", __FUNCTION__); - return pRecord; + // Find the named camera + auto it = std::find_if(sCameraList.begin(), sCameraList.end(), [&cameraId](const auto& cam) { + return cameraId == cam.desc.v1.cameraId; + }); + return (it != sCameraList.end()) ? &*it : nullptr; } EvsEnumerator::UltrasonicsArrayRecord* EvsEnumerator::findUltrasonicsArrayById( const std::string& ultrasonicsArrayId) { - auto recordIt = std::find_if( - sUltrasonicsArrayRecordList.begin(), sUltrasonicsArrayRecordList.end(), - [&ultrasonicsArrayId](const UltrasonicsArrayRecord& record) { - return ultrasonicsArrayId == record.desc.ultrasonicsArrayId;}); + ALOGD("%s", __FUNCTION__); + + auto recordIt = + std::find_if(sUltrasonicsArrayRecordList.begin(), sUltrasonicsArrayRecordList.end(), + [&ultrasonicsArrayId](const UltrasonicsArrayRecord& record) { + return ultrasonicsArrayId == record.desc.ultrasonicsArrayId; + }); return (recordIt != sUltrasonicsArrayRecordList.end()) ? &*recordIt : nullptr; } Return EvsEnumerator::getUltrasonicsArrayList(getUltrasonicsArrayList_cb _hidl_cb) { + ALOGD("%s", __FUNCTION__); + hidl_vec desc; desc.resize(sUltrasonicsArrayRecordList.size()); // Copy over desc from sUltrasonicsArrayRecordList. for (auto p = std::make_pair(sUltrasonicsArrayRecordList.begin(), desc.begin()); - p.first != sUltrasonicsArrayRecordList.end(); p.first++, p.second++) { + p.first != sUltrasonicsArrayRecordList.end(); p.first++, p.second++) { *p.second = p.first->desc; } @@ -385,11 +355,13 @@ Return EvsEnumerator::getUltrasonicsArrayList(getUltrasonicsArrayList_cb _ _hidl_cb(desc); // HIDL convention says we return Void if we sent our result back via callback - return Void(); + return {}; } Return> EvsEnumerator::openUltrasonicsArray( const hidl_string& ultrasonicsArrayId) { + ALOGD("%s", __FUNCTION__); + // Find the named ultrasonic array. UltrasonicsArrayRecord* pRecord = findUltrasonicsArrayById(ultrasonicsArrayId); @@ -419,10 +391,11 @@ Return> EvsEnumerator::openUltrasonicsArray( Return EvsEnumerator::closeUltrasonicsArray( const sp& pEvsUltrasonicsArray) { + ALOGD("%s", __FUNCTION__); if (pEvsUltrasonicsArray.get() == nullptr) { ALOGE("Ignoring call to closeUltrasonicsArray with null ultrasonics array"); - return Void(); + return {}; } // Get the ultrasonics array id so we can find it in our list. @@ -435,7 +408,7 @@ Return EvsEnumerator::closeUltrasonicsArray( UltrasonicsArrayRecord* pRecord = findUltrasonicsArrayById(ultrasonicsArrayId); if (!pRecord) { ALOGE("Asked to close a ultrasonics array whose name isnt not found"); - return Void(); + return {}; } sp pActiveUltrasonicsArray = pRecord->activeInstance.promote(); @@ -453,12 +426,7 @@ Return EvsEnumerator::closeUltrasonicsArray( pRecord->activeInstance = nullptr; } - return Void(); + return {}; } -} // namespace implementation -} // namespace V1_1 -} // namespace evs -} // namespace automotive -} // namespace hardware -} // namespace android +} // namespace android::hardware::automotive::evs::V1_1::implementation diff --git a/automotive/evs/1.1/default/EvsEnumerator.h b/automotive/evs/1.1/default/EvsEnumerator.h index d80124b94e08c7eaaed8e3200d6f3d066b7fe716..513fc8dd027577348f630ba254a5fe67189af6f9 100644 --- a/automotive/evs/1.1/default/EvsEnumerator.h +++ b/automotive/evs/1.1/default/EvsEnumerator.h @@ -17,56 +17,41 @@ #ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERAENUMERATOR_H #define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERAENUMERATOR_H -#include +#include "ConfigManager.h" + +#include #include #include -#include +#include #include #include -#include "ConfigManager.h" +namespace android::hardware::automotive::evs::V1_1::implementation { -using ::android::hardware::automotive::evs::V1_0::EvsResult; -using ::android::hardware::automotive::evs::V1_0::DisplayState; -using IEvsCamera_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsCamera; -using IEvsCamera_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsCamera; -using CameraDesc_1_0 = ::android::hardware::automotive::evs::V1_0::CameraDesc; -using CameraDesc_1_1 = ::android::hardware::automotive::evs::V1_1::CameraDesc; -using IEvsDisplay_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsDisplay; -using IEvsDisplay_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsDisplay; -using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService; - -namespace android { -namespace hardware { -namespace automotive { -namespace evs { -namespace V1_1 { -namespace implementation { - - -class EvsCamera; // from EvsCamera.h -class EvsDisplay; // from EvsDisplay.h -class EvsUltrasonicsArray; // from EvsUltrasonicsArray.h +namespace evs_v1_0 = ::android::hardware::automotive::evs::V1_0; +class EvsCamera; // from EvsCamera.h +class EvsDisplay; // from EvsDisplay.h +class EvsUltrasonicsArray; // from EvsUltrasonicsArray.h class EvsEnumerator : public IEvsEnumerator { -public: + public: // Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow. - Return getCameraList(getCameraList_cb _hidl_cb) override; - Return> openCamera(const hidl_string& cameraId) override; - Return closeCamera(const ::android::sp& carCamera) override; - Return> openDisplay() override; - Return closeDisplay(const ::android::sp& display) override; - Return getDisplayState() override; + Return getCameraList(getCameraList_cb _hidl_cb) override; + Return> openCamera(const hidl_string& cameraId) override; + Return closeCamera(const ::android::sp& carCamera) override; + Return> openDisplay() override; + Return closeDisplay(const ::android::sp& display) override; + Return getDisplayState() override; // Methods from ::android::hardware::automotive::evs::V1_1::IEvsEnumerator follow. - Return getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) override; - Return> openCamera_1_1(const hidl_string& cameraId, - const Stream& streamCfg) override; + Return getCameraList_1_1(getCameraList_1_1_cb _hidl_cb) override; + Return> openCamera_1_1(const hidl_string& cameraId, + const Stream& streamCfg) override; Return isHardware() override { return true; } - Return getDisplayIdList(getDisplayIdList_cb _list_cb) override; - Return> openDisplay_1_1(uint8_t port) override; + Return getDisplayIdList(getDisplayIdList_cb _list_cb) override; + Return> openDisplay_1_1(uint8_t port) override; Return getUltrasonicsArrayList(getUltrasonicsArrayList_cb _hidl_cb) override; Return> openUltrasonicsArray( const hidl_string& ultrasonicsArrayId) override; @@ -74,49 +59,40 @@ public: const ::android::sp& evsUltrasonicsArray) override; // Implementation details - EvsEnumerator(sp windowService = nullptr); + EvsEnumerator(sp& + windowService); -private: + private: // NOTE: All members values are static so that all clients operate on the same state // That is to say, this is effectively a singleton despite the fact that HIDL // constructs a new instance for each client. struct CameraRecord { - CameraDesc_1_1 desc; - wp activeInstance; + CameraDesc desc; + wp activeInstance; - CameraRecord(const char *cameraId) : desc() { desc.v1.cameraId = cameraId; } + CameraRecord(const char* cameraId) : desc() { desc.v1.cameraId = cameraId; } }; struct UltrasonicsArrayRecord { UltrasonicsArrayDesc desc; wp activeInstance; - UltrasonicsArrayRecord(const UltrasonicsArrayDesc& arrayDesc) : desc(arrayDesc) {}; + UltrasonicsArrayRecord(const UltrasonicsArrayDesc& arrayDesc) : desc(arrayDesc){}; }; static CameraRecord* findCameraById(const std::string& cameraId); - - static std::list sCameraList; - + static std::list sCameraList; static UltrasonicsArrayRecord* findUltrasonicsArrayById(const std::string& ultrasonicsArrayId); - static std::list sUltrasonicsArrayRecordList; - // Weak pointer. Object destructs if client dies. - static wp sActiveDisplay; - - static unique_ptr sConfigManager; - - static sp sDisplayProxyService; - static std::unordered_map sDisplayPortList; + static wp sActiveDisplay; // Weak pointer. Object destructs if client dies. + static uint64_t sInternalDisplayId; + static sp + sDisplayProxyService; + static std::unordered_map sDisplayPortList; + static std::unique_ptr sConfigManager; }; -} // namespace implementation -} // namespace V1_1 -} // namespace evs -} // namespace automotive -} // namespace hardware -} // namespace android +} // namespace android::hardware::automotive::evs::V1_1::implementation #endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_EVSCAMERAENUMERATOR_H diff --git a/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp b/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp index ebd47c618bb78bd33b005f380b63c0a063ae533f..951937a147f916ea0ad7855971027dd3ef6dbb6d 100644 --- a/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp +++ b/automotive/evs/1.1/default/EvsUltrasonicsArray.cpp @@ -113,10 +113,9 @@ bool fillMockDataFrame(UltrasonicsDataFrameDesc& dataFrameDesc, sp pIMe dataFrameDesc.receiversReadingsCountList = receiversReadingsCountList; const std::vector waveformDataList = { - {recvIdList[0], { {1000, 0.1f}, {2000, 0.8f} }}, - {recvIdList[1], { {1000, 0.1f}, {2000, 1.0f} }}, - {recvIdList[2], { {1000, 0.1f}, {2000, 0.2f}, {4000, 0.2f}, {5000, 0.1f} }} - }; + {recvIdList[0], {{1000, 0.1f}, {2000, 0.8f}}}, + {recvIdList[1], {{1000, 0.1f}, {2000, 1.0f}}}, + {recvIdList[2], {{1000, 0.1f}, {2000, 0.2f}, {4000, 0.2f}, {5000, 0.1f}}}}; if (pIMemory.get() == nullptr) { return false; diff --git a/automotive/evs/1.1/default/EvsUltrasonicsArray.h b/automotive/evs/1.1/default/EvsUltrasonicsArray.h index 88aa6003f66a6aa3616da47e8fa96fb10ada9706..681f68f721b9e851aafeeccaba4db3136876bbc8 100644 --- a/automotive/evs/1.1/default/EvsUltrasonicsArray.h +++ b/automotive/evs/1.1/default/EvsUltrasonicsArray.h @@ -119,7 +119,7 @@ class EvsUltrasonicsArray : public IEvsUltrasonicsArray { std::mutex mAccessLock; std::vector mDataFrames GUARDED_BY(mAccessLock); // Shared memory buffers. unsigned mFramesAllowed GUARDED_BY(mAccessLock); // How many buffers are we currently using. - unsigned mFramesInUse GUARDED_BY(mAccessLock); // How many buffers are currently outstanding. + unsigned mFramesInUse GUARDED_BY(mAccessLock); // How many buffers are currently outstanding. StreamStateValues mStreamState GUARDED_BY(mAccessLock); }; diff --git a/automotive/evs/1.1/default/GlWrapper.cpp b/automotive/evs/1.1/default/GlWrapper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..357b67c48a7ec3907017fda65f2527553f32f26f --- /dev/null +++ b/automotive/evs/1.1/default/GlWrapper.cpp @@ -0,0 +1,450 @@ +/* + * Copyright (C) 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. + */ + +#include "GlWrapper.h" + +#include +#include +#include + +#include +#include +#include +#include + +using android::GraphicBuffer; +using android::sp; + +namespace { + +// Defines a default color to clear the screen in RGBA format +constexpr float kDefaultColorInRgba[] = {0.1f, 0.5f, 0.1f, 1.0f}; + +// Defines the size of the preview area relative to the entire display +constexpr float kDisplayAreaRatio = 0.8f; + +constexpr const char vertexShaderSource[] = + "" + "#version 300 es \n" + "layout(location = 0) in vec4 pos; \n" + "layout(location = 1) in vec2 tex; \n" + "out vec2 uv; \n" + "void main() \n" + "{ \n" + " gl_Position = pos; \n" + " uv = tex; \n" + "} \n"; + +constexpr const char pixelShaderSource[] = + "#version 300 es \n" + "precision mediump float; \n" + "uniform sampler2D tex; \n" + "in vec2 uv; \n" + "out vec4 color; \n" + "void main() \n" + "{ \n" + " vec4 texel = texture(tex, uv); \n" + " color = texel; \n" + "} \n"; + +const char* getEGLError(void) { + switch (eglGetError()) { + case EGL_SUCCESS: + return "EGL_SUCCESS"; + case EGL_NOT_INITIALIZED: + return "EGL_NOT_INITIALIZED"; + case EGL_BAD_ACCESS: + return "EGL_BAD_ACCESS"; + case EGL_BAD_ALLOC: + return "EGL_BAD_ALLOC"; + case EGL_BAD_ATTRIBUTE: + return "EGL_BAD_ATTRIBUTE"; + case EGL_BAD_CONTEXT: + return "EGL_BAD_CONTEXT"; + case EGL_BAD_CONFIG: + return "EGL_BAD_CONFIG"; + case EGL_BAD_CURRENT_SURFACE: + return "EGL_BAD_CURRENT_SURFACE"; + case EGL_BAD_DISPLAY: + return "EGL_BAD_DISPLAY"; + case EGL_BAD_SURFACE: + return "EGL_BAD_SURFACE"; + case EGL_BAD_MATCH: + return "EGL_BAD_MATCH"; + case EGL_BAD_PARAMETER: + return "EGL_BAD_PARAMETER"; + case EGL_BAD_NATIVE_PIXMAP: + return "EGL_BAD_NATIVE_PIXMAP"; + case EGL_BAD_NATIVE_WINDOW: + return "EGL_BAD_NATIVE_WINDOW"; + case EGL_CONTEXT_LOST: + return "EGL_CONTEXT_LOST"; + default: + return "Unknown error"; + } +} + +// Given shader source, load and compile it +GLuint loadShader(GLenum type, const char* shaderSrc) { + // Create the shader object + GLuint shader = glCreateShader(type); + if (shader == 0) { + LOG(ERROR) << "glCreateSharder() failed with error = " << glGetError(); + return 0; + } + + // Load and compile the shader + glShaderSource(shader, 1, &shaderSrc, nullptr); + glCompileShader(shader); + + // Verify the compilation worked as expected + GLint compiled = 0; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + if (!compiled) { + LOG(ERROR) << "Error compiling shader"; + + GLint size = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &size); + if (size > 0) { + // Get and report the error message + char infoLog[size]; + glGetShaderInfoLog(shader, size, nullptr, infoLog); + LOG(ERROR) << " msg:" << std::endl << infoLog; + } + + glDeleteShader(shader); + return 0; + } + + return shader; +} + +// Create a program object given vertex and pixels shader source +GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) { + GLuint program = glCreateProgram(); + if (program == 0) { + LOG(ERROR) << "Failed to allocate program object"; + return 0; + } + + // Compile the shaders and bind them to this program + GLuint vertexShader = loadShader(GL_VERTEX_SHADER, vtxSrc); + if (vertexShader == 0) { + LOG(ERROR) << "Failed to load vertex shader"; + glDeleteProgram(program); + return 0; + } + GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pxlSrc); + if (pixelShader == 0) { + LOG(ERROR) << "Failed to load pixel shader"; + glDeleteProgram(program); + glDeleteShader(vertexShader); + return 0; + } + glAttachShader(program, vertexShader); + glAttachShader(program, pixelShader); + + // Link the program + glLinkProgram(program); + GLint linked = 0; + glGetProgramiv(program, GL_LINK_STATUS, &linked); + if (!linked) { + LOG(ERROR) << "Error linking program"; + GLint size = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &size); + if (size > 0) { + // Get and report the error message + char* infoLog = (char*)malloc(size); + glGetProgramInfoLog(program, size, nullptr, infoLog); + LOG(ERROR) << " msg: " << infoLog; + free(infoLog); + } + + glDeleteProgram(program); + glDeleteShader(vertexShader); + glDeleteShader(pixelShader); + return 0; + } + + return program; +} + +} // namespace + +namespace android::hardware::automotive::evs::V1_1::implementation { + +// Main entry point +bool GlWrapper::initialize(const sp& service, uint64_t displayId) { + LOG(DEBUG) << __FUNCTION__; + + if (!service) { + LOG(WARNING) << "IAutomotiveDisplayProxyService is invalid."; + return false; + } + + // We will use the first display in the list as the primary. + service->getDisplayInfo(displayId, [this](auto dpyConfig, auto dpyState) { + ui::DisplayMode* pConfig = reinterpret_cast(dpyConfig.data()); + mWidth = pConfig->resolution.getWidth(); + mHeight = pConfig->resolution.getHeight(); + + ui::DisplayState* pState = reinterpret_cast(dpyState.data()); + if (pState->orientation != ui::ROTATION_0 && pState->orientation != ui::ROTATION_180) { + // rotate + std::swap(mWidth, mHeight); + } + + LOG(DEBUG) << "Display resolution is " << mWidth << " x " << mHeight; + }); + + mGfxBufferProducer = service->getIGraphicBufferProducer(displayId); + if (mGfxBufferProducer == nullptr) { + LOG(ERROR) << "Failed to get IGraphicBufferProducer from IAutomotiveDisplayProxyService."; + return false; + } + + mSurfaceHolder = getSurfaceFromHGBP(mGfxBufferProducer); + if (mSurfaceHolder == nullptr) { + LOG(ERROR) << "Failed to get a Surface from HGBP."; + return false; + } + + mWindow = getNativeWindow(mSurfaceHolder.get()); + if (mWindow == nullptr) { + LOG(ERROR) << "Failed to get a native window from Surface."; + return false; + } + + // Set up our OpenGL ES context associated with the default display + mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (mDisplay == EGL_NO_DISPLAY) { + LOG(ERROR) << "Failed to get egl display"; + return false; + } + + EGLint major = 3; + EGLint minor = 0; + if (!eglInitialize(mDisplay, &major, &minor)) { + LOG(ERROR) << "Failed to initialize EGL: " << getEGLError(); + return false; + } + + const EGLint config_attribs[] = { + // Tag Value + EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_DEPTH_SIZE, 0, EGL_NONE}; + + // Pick the default configuration without constraints (is this good enough?) + EGLConfig egl_config = {0}; + EGLint numConfigs = -1; + eglChooseConfig(mDisplay, config_attribs, &egl_config, 1, &numConfigs); + if (numConfigs != 1) { + LOG(ERROR) << "Didn't find a suitable format for our display window"; + return false; + } + + // Create the EGL render target surface + mSurface = eglCreateWindowSurface(mDisplay, egl_config, mWindow, nullptr); + if (mSurface == EGL_NO_SURFACE) { + LOG(ERROR) << "eglCreateWindowSurface failed: " << getEGLError(); + ; + return false; + } + + // Create the EGL context + // NOTE: Our shader is (currently at least) written to require version 3, so this + // is required. + const EGLint context_attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; + mContext = eglCreateContext(mDisplay, egl_config, EGL_NO_CONTEXT, context_attribs); + if (mContext == EGL_NO_CONTEXT) { + LOG(ERROR) << "Failed to create OpenGL ES Context: " << getEGLError(); + return false; + } + + // Activate our render target for drawing + if (!eglMakeCurrent(mDisplay, mSurface, mSurface, mContext)) { + LOG(ERROR) << "Failed to make the OpenGL ES Context current: " << getEGLError(); + return false; + } + + // Create the shader program for our simple pipeline + mShaderProgram = buildShaderProgram(vertexShaderSource, pixelShaderSource); + if (!mShaderProgram) { + LOG(ERROR) << "Failed to build shader program: " << getEGLError(); + return false; + } + + // Create a GL texture that will eventually wrap our externally created texture surface(s) + glGenTextures(1, &mTextureMap); + if (mTextureMap <= 0) { + LOG(ERROR) << "Didn't get a texture handle allocated: " << getEGLError(); + return false; + } + + // Turn off mip-mapping for the created texture surface + // (the inbound camera imagery doesn't have MIPs) + glBindTexture(GL_TEXTURE_2D, mTextureMap); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glBindTexture(GL_TEXTURE_2D, 0); + + return true; +} + +void GlWrapper::shutdown() { + // Drop our device textures + if (mKHRimage != EGL_NO_IMAGE_KHR) { + eglDestroyImageKHR(mDisplay, mKHRimage); + mKHRimage = EGL_NO_IMAGE_KHR; + } + + // Release all GL resources + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroySurface(mDisplay, mSurface); + eglDestroyContext(mDisplay, mContext); + eglTerminate(mDisplay); + mSurface = EGL_NO_SURFACE; + mContext = EGL_NO_CONTEXT; + mDisplay = EGL_NO_DISPLAY; + + // Release the window + mSurfaceHolder = nullptr; +} + +void GlWrapper::showWindow(sp& service, uint64_t id) { + if (service != nullptr) { + service->showWindow(id); + } else { + LOG(ERROR) << "IAutomotiveDisplayProxyService is not available."; + } +} + +void GlWrapper::hideWindow(sp& service, uint64_t id) { + if (service != nullptr) { + service->hideWindow(id); + } else { + LOG(ERROR) << "IAutomotiveDisplayProxyService is not available."; + } +} + +bool GlWrapper::updateImageTexture(const V1_0::BufferDesc& buffer) { + BufferDesc newBuffer = { + .buffer = + { + .nativeHandle = buffer.memHandle, + }, + .pixelSize = buffer.pixelSize, + .bufferId = buffer.bufferId, + }; + AHardwareBuffer_Desc* pDesc = + reinterpret_cast(&newBuffer.buffer.description); + *pDesc = { + .width = buffer.width, + .height = buffer.height, + .layers = 1, + .format = buffer.format, + .usage = buffer.usage, + }; + return updateImageTexture(newBuffer); +} + +bool GlWrapper::updateImageTexture(const BufferDesc& aFrame) { + // If we haven't done it yet, create an "image" object to wrap the gralloc buffer + if (mKHRimage == EGL_NO_IMAGE_KHR) { + // create a temporary GraphicBuffer to wrap the provided handle + const AHardwareBuffer_Desc* pDesc = + reinterpret_cast(&aFrame.buffer.description); + sp pGfxBuffer = new GraphicBuffer( + pDesc->width, pDesc->height, pDesc->format, pDesc->layers, pDesc->usage, + pDesc->stride, + const_cast(aFrame.buffer.nativeHandle.getNativeHandle()), + false /* keep ownership */ + ); + if (pGfxBuffer.get() == nullptr) { + LOG(ERROR) << "Failed to allocate GraphicBuffer to wrap our native handle"; + return false; + } + + // Get a GL compatible reference to the graphics buffer we've been given + EGLint eglImageAttributes[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; + EGLClientBuffer cbuf = static_cast(pGfxBuffer->getNativeBuffer()); + mKHRimage = eglCreateImageKHR(mDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, cbuf, + eglImageAttributes); + if (mKHRimage == EGL_NO_IMAGE_KHR) { + LOG(ERROR) << "Error creating EGLImage: " << getEGLError(); + return false; + } + + // Update the texture handle we already created to refer to this gralloc buffer + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, mTextureMap); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast(mKHRimage)); + } + + return true; +} + +void GlWrapper::renderImageToScreen() { + // Set the viewport + glViewport(0, 0, mWidth, mHeight); + + // Clear the color buffer + glClearColor(kDefaultColorInRgba[0], kDefaultColorInRgba[1], + kDefaultColorInRgba[2], kDefaultColorInRgba[3]); + glClear(GL_COLOR_BUFFER_BIT); + + // Select our screen space simple texture shader + glUseProgram(mShaderProgram); + + // Bind the texture and assign it to the shader's sampler + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, mTextureMap); + GLint sampler = glGetUniformLocation(mShaderProgram, "tex"); + glUniform1i(sampler, 0); + + // We want our image to show up opaque regardless of alpha values + glDisable(GL_BLEND); + + // Draw a rectangle on the screen + GLfloat vertsCarPos[] = { + -kDisplayAreaRatio, kDisplayAreaRatio, 0.0f, // left top in window space + kDisplayAreaRatio, kDisplayAreaRatio, 0.0f, // right top + -kDisplayAreaRatio, -kDisplayAreaRatio, 0.0f, // left bottom + kDisplayAreaRatio, -kDisplayAreaRatio, 0.0f // right bottom + }; + + // NOTE: We didn't flip the image in the texture, so V=0 is actually the top of the image + GLfloat vertsCarTex[] = { + 0.0f, 0.0f, // left top + 1.0f, 0.0f, // right top + 0.0f, 1.0f, // left bottom + 1.0f, 1.0f // right bottom + }; + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertsCarPos); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, vertsCarTex); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + + // Clean up and flip the rendered result to the front so it is visible + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(1); + + glFinish(); + + eglSwapBuffers(mDisplay, mSurface); +} + +} // namespace android::hardware::automotive::evs::V1_1::implementation diff --git a/automotive/evs/1.1/default/GlWrapper.h b/automotive/evs/1.1/default/GlWrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..44c206f8a6a46e8d2b063e4a96981a5d460141e1 --- /dev/null +++ b/automotive/evs/1.1/default/GlWrapper.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_DISPLAY_GLWRAPPER_H +#define ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_DISPLAY_GLWRAPPER_H + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace android::hardware::automotive::evs::V1_1::implementation { + +using frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService; +using hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer; + +class GlWrapper { + public: + GlWrapper() : mSurfaceHolder(android::SurfaceHolderUniquePtr(nullptr, nullptr)) {} + bool initialize(const sp& service, uint64_t displayId); + void shutdown(); + + bool updateImageTexture(const V1_0::BufferDesc& buffer); + bool updateImageTexture(const BufferDesc& buffer); + void renderImageToScreen(); + + void showWindow(sp& service, uint64_t id); + void hideWindow(sp& service, uint64_t id); + + unsigned getWidth() { return mWidth; }; + unsigned getHeight() { return mHeight; }; + + private: + sp mGfxBufferProducer; + + EGLDisplay mDisplay; + EGLSurface mSurface; + EGLContext mContext; + + unsigned mWidth = 0; + unsigned mHeight = 0; + + EGLImageKHR mKHRimage = EGL_NO_IMAGE_KHR; + + GLuint mTextureMap = 0; + GLuint mShaderProgram = 0; + + // Opaque handle for a native hardware buffer defined in + // frameworks/native/opengl/include/EGL/eglplatform.h + ANativeWindow* mWindow; + + // Pointer to a Surface wrapper. + android::SurfaceHolderUniquePtr mSurfaceHolder; +}; + +} // namespace android::hardware::automotive::evs::V1_1::implementation + +#endif // ANDROID_HARDWARE_AUTOMOTIVE_EVS_V1_1_DISPLAY_GLWRAPPER_H diff --git a/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc b/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc index 284b3fda4ed081cc606a4facfff7408906c77260..5d4daf93cc802b103cb4aa052fc22d7f1b71a894 100644 --- a/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc +++ b/automotive/evs/1.1/default/android.hardware.automotive.evs@1.1-service.rc @@ -1,5 +1,8 @@ service vendor.evs-hal-mock /vendor/bin/hw/android.hardware.automotive.evs@1.1-service class hal - user automotive_evs - group automotive_evs - disabled + priority -20 + user graphics + group automotive_evs camera + onrestart restart automotive_display + onrestart restart evs_manager + disabled # will not automatically start with its class; must be explicitly started. diff --git a/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml b/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml index d4d9b17c0599d3f32c4fce414f81c515b6cc33d9..d9757010e0043c054f7afb94c299531e56982c70 100644 --- a/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml +++ b/automotive/evs/1.1/default/manifest_android.hardware.automotive.evs@1.1-service.xml @@ -15,12 +15,8 @@ --> - android.hardware.automotive.evs hwbinder - 1.1 - - IEvsEnumerator - hw/0 - + android.hardware.automotive.evs + @1.1::IEvsEnumerator/hw/0 diff --git a/automotive/evs/1.1/default/resources/evs_default_configuration.xml b/automotive/evs/1.1/default/resources/evs_default_configuration.xml index a79e7c2b2d8c332ca835454b8b5cfb4b3b5cc644..6cbc18eacf7d503d4dacd6e424c3cceb172d900c 100644 --- a/automotive/evs/1.1/default/resources/evs_default_configuration.xml +++ b/automotive/evs/1.1/default/resources/evs_default_configuration.xml @@ -30,31 +30,8 @@ - - - - - - - - - - - - - - + diff --git a/automotive/evs/1.1/default/service.cpp b/automotive/evs/1.1/default/service.cpp index 374b646812ccacc0d2d6566ce2cb7ffd069b910d..2764a26cc1d0f82aaf617d3b9b4fb74ada405ae8 100644 --- a/automotive/evs/1.1/default/service.cpp +++ b/automotive/evs/1.1/default/service.cpp @@ -14,42 +14,42 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.automotive.evs@1.1-service" - -#include +#include "EvsDisplay.h" +#include "EvsEnumerator.h" +#include "ServiceNames.h" #include #include #include #include -#include "ServiceNames.h" -#include "EvsEnumerator.h" -#include "EvsDisplay.h" - +#include -// libhidl: +using android::frameworks::automotive::display::V1_0::IAutomotiveDisplayProxyService; using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; - -// Generated HIDL files +using android::hardware::automotive::evs::V1_0::DisplayState; using android::hardware::automotive::evs::V1_1::IEvsEnumerator; - -// The namespace in which all our implementation code lives -using namespace android::hardware::automotive::evs::V1_1::implementation; -using namespace android; - +using android::hardware::automotive::evs::V1_1::implementation::EvsEnumerator; int main() { ALOGI("EVS Hardware Enumerator service is starting"); - android::sp service = new EvsEnumerator(); + + android::sp carWindowService = + IAutomotiveDisplayProxyService::getService("default"); + if (carWindowService == nullptr) { + ALOGE("Cannot use AutomotiveDisplayProxyService. Exiting."); + return EXIT_FAILURE; + } + + android::sp service = new EvsEnumerator(carWindowService); configureRpcThreadpool(1, true /* callerWillJoin */); // Register our service -- if somebody is already registered by our name, // they will be killed (their thread pool will throw an exception). - status_t status = service->registerAsService(kEnumeratorServiceName); - if (status == OK) { + auto status = service->registerAsService(kEnumeratorServiceName); + if (status == android::OK) { ALOGD("%s is ready.", kEnumeratorServiceName); joinRpcThreadpool(); } else { @@ -58,5 +58,5 @@ int main() { // In normal operation, we don't expect the thread pool to exit ALOGE("EVS Hardware Enumerator is shutting down"); - return 1; + return EXIT_SUCCESS; } diff --git a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp index d7f9ff848a189e2f71515f74cd86d66c62fa5fa0..623438f70e373644376cc3a596442eb00d498cf7 100644 --- a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp +++ b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp @@ -563,7 +563,8 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) { activeCameras.push_back(pCam); // Ask for a very large number of buffers in flight to ensure it errors correctly - Return badResult = pCam->setMaxFramesInFlight(0xFFFFFFFF); + Return badResult = + pCam->setMaxFramesInFlight(std::numeric_limits::max()); EXPECT_EQ(EvsResult::BUFFER_NOT_AVAILABLE, badResult); // Now ask for exactly two buffers in flight as we'll test behavior in that case @@ -648,7 +649,7 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) { ASSERT_GT(height, 0); android::ui::DisplayState* pState = (android::ui::DisplayState*)state.data(); - ASSERT_NE(pState->layerStack, -1); + ASSERT_NE(pState->layerStack, android::ui::INVALID_LAYER_STACK); }); // Test each reported camera diff --git a/automotive/evs/aidl/Android.bp b/automotive/evs/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..1c908aa60d50a8fc0b14bd7df023c528aa5db638 --- /dev/null +++ b/automotive/evs/aidl/Android.bp @@ -0,0 +1,61 @@ +// Copyright (C) 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. + +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"], +} + +aidl_interface { + name: "android.hardware.automotive.evs", + vendor_available: true, + srcs: [ + "android/hardware/automotive/evs/*.aidl", + ], + stability: "vintf", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V3", + ], + backend: { + java: { + // android.hardware.graphics.common package is not enabled + // for Java backend. + enabled: false, + }, + cpp: { + enabled: false, + }, + ndk: { + vndk: { + enabled: false, + }, + min_sdk_version: "29", + }, + }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V3", + ], + }, + ], + +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/.hash b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..b01d9abbc12822e6fb3cfa61b0f3be667572d03e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/.hash @@ -0,0 +1 @@ +4ebb038edc1da5aa232909382999b2831e70a319 diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/BufferDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/BufferDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..31acdb8e2781755c828f6fbcd8b177b850bf690c --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/BufferDesc.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable BufferDesc { + android.hardware.graphics.common.HardwareBuffer buffer; + int pixelSizeBytes; + int bufferId; + @utf8InCpp String deviceId; + long timestamp; + byte[] metadata; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/CameraDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/CameraDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4dadeb88b2a0cd276caf71ea9990f138d4e94334 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/CameraDesc.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable CameraDesc { + @utf8InCpp String id; + int vendorFlags; + byte[] metadata; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/CameraParam.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/CameraParam.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae4ce771923f45e15206b37b925bb453372af728 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/CameraParam.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum CameraParam { + BRIGHTNESS = 0, + CONTRAST = 1, + AUTOGAIN = 2, + GAIN = 3, + AUTO_WHITE_BALANCE = 4, + WHITE_BALANCE_TEMPERATURE = 5, + SHARPNESS = 6, + AUTO_EXPOSURE = 7, + ABSOLUTE_EXPOSURE = 8, + ABSOLUTE_FOCUS = 9, + AUTO_FOCUS = 10, + ABSOLUTE_ZOOM = 11, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DeviceStatus.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DeviceStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc066ac6db74bf71d1b884c06d254ff81ebd6b48 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DeviceStatus.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable DeviceStatus { + @utf8InCpp String id; + android.hardware.automotive.evs.DeviceStatusType status; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DeviceStatusType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DeviceStatusType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d0f1d8e1d68e9bc29a44d5bf6b2f42462dd2c83e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DeviceStatusType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum DeviceStatusType { + CAMERA_AVAILABLE = 0, + CAMERA_NOT_AVAILABLE = 1, + DISPLAY_AVAILABLE = 2, + DISPLAY_NOT_AVAILABLE = 3, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DisplayDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DisplayDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ac029e479ac8f2f8e6deb2db485190275d8d929 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DisplayDesc.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable DisplayDesc { + @utf8InCpp String id; + int width; + int height; + android.hardware.automotive.evs.Rotation orientation; + int vendorFlags; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DisplayState.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DisplayState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a5f43095c8d0565f6ea4439f101b51d552cbebb3 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/DisplayState.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum DisplayState { + NOT_OPEN = 0, + NOT_VISIBLE = 1, + VISIBLE_ON_NEXT_FRAME = 2, + VISIBLE = 3, + DEAD = 4, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsEventDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsEventDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..09b2b9db13edae7e5887b95fad55b9375774fdd7 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsEventDesc.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable EvsEventDesc { + android.hardware.automotive.evs.EvsEventType aType; + @utf8InCpp String deviceId; + int[] payload; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsEventType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsEventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..052a6b39694ca1d61d08aedb1e63eba8b4f9ee8e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsEventType.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum EvsEventType { + STREAM_STARTED = 0, + STREAM_STOPPED = 1, + FRAME_DROPPED = 2, + TIMEOUT = 3, + PARAMETER_CHANGED = 4, + MASTER_RELEASED = 5, + STREAM_ERROR = 6, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsResult.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a0418a94ef084f08b4322db4ff591e214931a02f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/EvsResult.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum EvsResult { + OK = 0, + INVALID_ARG = 1, + STREAM_ALREADY_RUNNING = 2, + BUFFER_NOT_AVAILABLE = 3, + OWNERSHIP_LOST = 4, + UNDERLYING_SERVICE_ERROR = 5, + PERMISSION_DENIED = 6, + RESOURCE_NOT_AVAILABLE = 7, + RESOURCE_BUSY = 8, + NOT_IMPLEMENTED = 9, + NOT_SUPPORTED = 10, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsCamera.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsCamera.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ce1b97d16c3f877b15853f5e2b680e3ef2d35e3d --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsCamera.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsCamera { + void doneWithFrame(in android.hardware.automotive.evs.BufferDesc[] buffer); + void forcePrimaryClient(in android.hardware.automotive.evs.IEvsDisplay display); + android.hardware.automotive.evs.CameraDesc getCameraInfo(); + byte[] getExtendedInfo(in int opaqueIdentifier); + int[] getIntParameter(in android.hardware.automotive.evs.CameraParam id); + android.hardware.automotive.evs.ParameterRange getIntParameterRange(in android.hardware.automotive.evs.CameraParam id); + android.hardware.automotive.evs.CameraParam[] getParameterList(); + android.hardware.automotive.evs.CameraDesc getPhysicalCameraInfo(in String deviceId); + int importExternalBuffers(in android.hardware.automotive.evs.BufferDesc[] buffers); + void pauseVideoStream(); + void resumeVideoStream(); + void setExtendedInfo(in int opaqueIdentifier, in byte[] opaqueValue); + int[] setIntParameter(in android.hardware.automotive.evs.CameraParam id, in int value); + void setPrimaryClient(); + void setMaxFramesInFlight(in int bufferCount); + void startVideoStream(in android.hardware.automotive.evs.IEvsCameraStream receiver); + void stopVideoStream(); + void unsetPrimaryClient(); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsCameraStream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsCameraStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e2e64a3c48fdeb52346bc593ea054dce028bd7d --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsCameraStream.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsCameraStream { + oneway void deliverFrame(in android.hardware.automotive.evs.BufferDesc[] buffer); + oneway void notify(in android.hardware.automotive.evs.EvsEventDesc event); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsDisplay.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9b538d43a20b6af016ed2fa3e09a229ba5220350 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsDisplay.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsDisplay { + android.hardware.automotive.evs.DisplayDesc getDisplayInfo(); + android.hardware.automotive.evs.DisplayState getDisplayState(); + android.hardware.automotive.evs.BufferDesc getTargetBuffer(); + void returnTargetBufferForDisplay(in android.hardware.automotive.evs.BufferDesc buffer); + void setDisplayState(in android.hardware.automotive.evs.DisplayState state); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsEnumerator.aidl new file mode 100644 index 0000000000000000000000000000000000000000..225b5041b8664e69dea67d4cea1aaacf733803dd --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsEnumerator.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsEnumerator { + void closeCamera(in android.hardware.automotive.evs.IEvsCamera carCamera); + void closeDisplay(in android.hardware.automotive.evs.IEvsDisplay display); + void closeUltrasonicsArray(in android.hardware.automotive.evs.IEvsUltrasonicsArray evsUltrasonicsArray); + android.hardware.automotive.evs.CameraDesc[] getCameraList(); + byte[] getDisplayIdList(); + android.hardware.automotive.evs.DisplayState getDisplayState(); + android.hardware.automotive.evs.Stream[] getStreamList(in android.hardware.automotive.evs.CameraDesc description); + android.hardware.automotive.evs.UltrasonicsArrayDesc[] getUltrasonicsArrayList(); + boolean isHardware(); + android.hardware.automotive.evs.IEvsCamera openCamera(in String cameraId, in android.hardware.automotive.evs.Stream streamCfg); + android.hardware.automotive.evs.IEvsDisplay openDisplay(in int id); + android.hardware.automotive.evs.IEvsUltrasonicsArray openUltrasonicsArray(in String ultrasonicsArrayId); + void registerStatusCallback(in android.hardware.automotive.evs.IEvsEnumeratorStatusCallback callback); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c39a4e855e20cf1d168257d22ab5f41f965b431a --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsEnumeratorStatusCallback { + oneway void deviceStatusChanged(in android.hardware.automotive.evs.DeviceStatus[] status); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1183ab392cc2ef719358493d851c100d60c8bc2f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsUltrasonicsArray { + void doneWithDataFrame(in android.hardware.automotive.evs.UltrasonicsDataFrameDesc dataFrameDesc); + android.hardware.automotive.evs.UltrasonicsArrayDesc getUltrasonicArrayInfo(); + void setMaxFramesInFlight(in int bufferCount); + void startStream(in android.hardware.automotive.evs.IEvsUltrasonicsArrayStream stream); + void stopStream(); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..510b0a4692aa546638fb97e7d400645e65b2ff56 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsUltrasonicsArrayStream { + oneway void deliverDataFrame(in android.hardware.automotive.evs.UltrasonicsDataFrameDesc dataFrameDesc); + oneway void notify(in android.hardware.automotive.evs.EvsEventDesc event); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/ParameterRange.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/ParameterRange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..44e9b592765ab8b68ab4caaf61ec8046657308e5 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/ParameterRange.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable ParameterRange { + int min; + int max; + int step; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Rotation.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Rotation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91971fc5e7d4dec7e412d233f7d3e8d6237b2b70 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Rotation.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum Rotation { + ROTATION_0 = 0, + ROTATION_90 = 1, + ROTATION_180 = 2, + ROTATION_270 = 3, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/RotationQuaternion.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/RotationQuaternion.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d9c8b6e247891692287276393faf0cb62bd77ce5 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/RotationQuaternion.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable RotationQuaternion { + float x; + float y; + float z; + float w; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/SensorPose.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/SensorPose.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ead9eaf2e79e67514fff052aec0eb99d7f2b53e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/SensorPose.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable SensorPose { + android.hardware.automotive.evs.RotationQuaternion rotation; + android.hardware.automotive.evs.Translation translation; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Stream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Stream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..154a693a51372b7563688cdd596191619d4deabb --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Stream.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable Stream { + int id; + android.hardware.automotive.evs.StreamType streamType; + int width; + int height; + int framerate; + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.BufferUsage usage; + android.hardware.automotive.evs.Rotation rotation; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/StreamType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/StreamType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9819c8910b19e746fae79bebf2bc296da9ddf39b --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/StreamType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum StreamType { + OUTPUT = 0, + INPUT = 1, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Translation.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Translation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..488d80f4796740bcb23eeb98954b3fb4fa9cfc5c --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/Translation.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable Translation { + float x; + float y; + float z; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicSensor.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicSensor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..23f81f80935550d449679c05473cb212db4e8c5b --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicSensor.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable UltrasonicSensor { + android.hardware.automotive.evs.SensorPose pose; + float maxRangeMm; + float angleOfMeasurement; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4a988759fd91078421c286f4cf7f81db5cc71685 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable UltrasonicsArrayDesc { + @utf8InCpp String ultrasonicsArrayId; + int maxReadingsPerSensorCount; + int maxReceiversCount; + android.hardware.automotive.evs.UltrasonicSensor[] sensors; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35ec84bdccec13995cb44fd1cbf2b303ff8257f6 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/1/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable UltrasonicsDataFrameDesc { + long timestampNs; + int id; + byte[] transmittersIdList; + byte[] receiversIdList; + int[] receiversReadingsCountList; + android.hardware.common.Ashmem waveformsData; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/BufferDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/BufferDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..31acdb8e2781755c828f6fbcd8b177b850bf690c --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/BufferDesc.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable BufferDesc { + android.hardware.graphics.common.HardwareBuffer buffer; + int pixelSizeBytes; + int bufferId; + @utf8InCpp String deviceId; + long timestamp; + byte[] metadata; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4dadeb88b2a0cd276caf71ea9990f138d4e94334 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraDesc.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable CameraDesc { + @utf8InCpp String id; + int vendorFlags; + byte[] metadata; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraParam.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraParam.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae4ce771923f45e15206b37b925bb453372af728 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraParam.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum CameraParam { + BRIGHTNESS = 0, + CONTRAST = 1, + AUTOGAIN = 2, + GAIN = 3, + AUTO_WHITE_BALANCE = 4, + WHITE_BALANCE_TEMPERATURE = 5, + SHARPNESS = 6, + AUTO_EXPOSURE = 7, + ABSOLUTE_EXPOSURE = 8, + ABSOLUTE_FOCUS = 9, + AUTO_FOCUS = 10, + ABSOLUTE_ZOOM = 11, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatus.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc066ac6db74bf71d1b884c06d254ff81ebd6b48 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatus.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable DeviceStatus { + @utf8InCpp String id; + android.hardware.automotive.evs.DeviceStatusType status; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatusType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatusType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d0f1d8e1d68e9bc29a44d5bf6b2f42462dd2c83e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatusType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum DeviceStatusType { + CAMERA_AVAILABLE = 0, + CAMERA_NOT_AVAILABLE = 1, + DISPLAY_AVAILABLE = 2, + DISPLAY_NOT_AVAILABLE = 3, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ac029e479ac8f2f8e6deb2db485190275d8d929 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayDesc.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable DisplayDesc { + @utf8InCpp String id; + int width; + int height; + android.hardware.automotive.evs.Rotation orientation; + int vendorFlags; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayState.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a5f43095c8d0565f6ea4439f101b51d552cbebb3 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayState.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum DisplayState { + NOT_OPEN = 0, + NOT_VISIBLE = 1, + VISIBLE_ON_NEXT_FRAME = 2, + VISIBLE = 3, + DEAD = 4, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..09b2b9db13edae7e5887b95fad55b9375774fdd7 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventDesc.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable EvsEventDesc { + android.hardware.automotive.evs.EvsEventType aType; + @utf8InCpp String deviceId; + int[] payload; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..052a6b39694ca1d61d08aedb1e63eba8b4f9ee8e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventType.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum EvsEventType { + STREAM_STARTED = 0, + STREAM_STOPPED = 1, + FRAME_DROPPED = 2, + TIMEOUT = 3, + PARAMETER_CHANGED = 4, + MASTER_RELEASED = 5, + STREAM_ERROR = 6, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsResult.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a0418a94ef084f08b4322db4ff591e214931a02f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsResult.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum EvsResult { + OK = 0, + INVALID_ARG = 1, + STREAM_ALREADY_RUNNING = 2, + BUFFER_NOT_AVAILABLE = 3, + OWNERSHIP_LOST = 4, + UNDERLYING_SERVICE_ERROR = 5, + PERMISSION_DENIED = 6, + RESOURCE_NOT_AVAILABLE = 7, + RESOURCE_BUSY = 8, + NOT_IMPLEMENTED = 9, + NOT_SUPPORTED = 10, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsCamera.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsCamera.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ce1b97d16c3f877b15853f5e2b680e3ef2d35e3d --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsCamera.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsCamera { + void doneWithFrame(in android.hardware.automotive.evs.BufferDesc[] buffer); + void forcePrimaryClient(in android.hardware.automotive.evs.IEvsDisplay display); + android.hardware.automotive.evs.CameraDesc getCameraInfo(); + byte[] getExtendedInfo(in int opaqueIdentifier); + int[] getIntParameter(in android.hardware.automotive.evs.CameraParam id); + android.hardware.automotive.evs.ParameterRange getIntParameterRange(in android.hardware.automotive.evs.CameraParam id); + android.hardware.automotive.evs.CameraParam[] getParameterList(); + android.hardware.automotive.evs.CameraDesc getPhysicalCameraInfo(in String deviceId); + int importExternalBuffers(in android.hardware.automotive.evs.BufferDesc[] buffers); + void pauseVideoStream(); + void resumeVideoStream(); + void setExtendedInfo(in int opaqueIdentifier, in byte[] opaqueValue); + int[] setIntParameter(in android.hardware.automotive.evs.CameraParam id, in int value); + void setPrimaryClient(); + void setMaxFramesInFlight(in int bufferCount); + void startVideoStream(in android.hardware.automotive.evs.IEvsCameraStream receiver); + void stopVideoStream(); + void unsetPrimaryClient(); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsCameraStream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsCameraStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e2e64a3c48fdeb52346bc593ea054dce028bd7d --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsCameraStream.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsCameraStream { + oneway void deliverFrame(in android.hardware.automotive.evs.BufferDesc[] buffer); + oneway void notify(in android.hardware.automotive.evs.EvsEventDesc event); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsDisplay.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9b538d43a20b6af016ed2fa3e09a229ba5220350 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsDisplay.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsDisplay { + android.hardware.automotive.evs.DisplayDesc getDisplayInfo(); + android.hardware.automotive.evs.DisplayState getDisplayState(); + android.hardware.automotive.evs.BufferDesc getTargetBuffer(); + void returnTargetBufferForDisplay(in android.hardware.automotive.evs.BufferDesc buffer); + void setDisplayState(in android.hardware.automotive.evs.DisplayState state); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl new file mode 100644 index 0000000000000000000000000000000000000000..225b5041b8664e69dea67d4cea1aaacf733803dd --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsEnumerator { + void closeCamera(in android.hardware.automotive.evs.IEvsCamera carCamera); + void closeDisplay(in android.hardware.automotive.evs.IEvsDisplay display); + void closeUltrasonicsArray(in android.hardware.automotive.evs.IEvsUltrasonicsArray evsUltrasonicsArray); + android.hardware.automotive.evs.CameraDesc[] getCameraList(); + byte[] getDisplayIdList(); + android.hardware.automotive.evs.DisplayState getDisplayState(); + android.hardware.automotive.evs.Stream[] getStreamList(in android.hardware.automotive.evs.CameraDesc description); + android.hardware.automotive.evs.UltrasonicsArrayDesc[] getUltrasonicsArrayList(); + boolean isHardware(); + android.hardware.automotive.evs.IEvsCamera openCamera(in String cameraId, in android.hardware.automotive.evs.Stream streamCfg); + android.hardware.automotive.evs.IEvsDisplay openDisplay(in int id); + android.hardware.automotive.evs.IEvsUltrasonicsArray openUltrasonicsArray(in String ultrasonicsArrayId); + void registerStatusCallback(in android.hardware.automotive.evs.IEvsEnumeratorStatusCallback callback); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c39a4e855e20cf1d168257d22ab5f41f965b431a --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsEnumeratorStatusCallback { + oneway void deviceStatusChanged(in android.hardware.automotive.evs.DeviceStatus[] status); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1183ab392cc2ef719358493d851c100d60c8bc2f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsUltrasonicsArray { + void doneWithDataFrame(in android.hardware.automotive.evs.UltrasonicsDataFrameDesc dataFrameDesc); + android.hardware.automotive.evs.UltrasonicsArrayDesc getUltrasonicArrayInfo(); + void setMaxFramesInFlight(in int bufferCount); + void startStream(in android.hardware.automotive.evs.IEvsUltrasonicsArrayStream stream); + void stopStream(); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..510b0a4692aa546638fb97e7d400645e65b2ff56 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +interface IEvsUltrasonicsArrayStream { + oneway void deliverDataFrame(in android.hardware.automotive.evs.UltrasonicsDataFrameDesc dataFrameDesc); + oneway void notify(in android.hardware.automotive.evs.EvsEventDesc event); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ParameterRange.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ParameterRange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..44e9b592765ab8b68ab4caaf61ec8046657308e5 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ParameterRange.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable ParameterRange { + int min; + int max; + int step; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Rotation.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Rotation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91971fc5e7d4dec7e412d233f7d3e8d6237b2b70 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Rotation.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum Rotation { + ROTATION_0 = 0, + ROTATION_90 = 1, + ROTATION_180 = 2, + ROTATION_270 = 3, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/RotationQuaternion.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/RotationQuaternion.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d9c8b6e247891692287276393faf0cb62bd77ce5 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/RotationQuaternion.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable RotationQuaternion { + float x; + float y; + float z; + float w; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/SensorPose.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/SensorPose.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ead9eaf2e79e67514fff052aec0eb99d7f2b53e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/SensorPose.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable SensorPose { + android.hardware.automotive.evs.RotationQuaternion rotation; + android.hardware.automotive.evs.Translation translation; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Stream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Stream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..154a693a51372b7563688cdd596191619d4deabb --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Stream.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable Stream { + int id; + android.hardware.automotive.evs.StreamType streamType; + int width; + int height; + int framerate; + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.BufferUsage usage; + android.hardware.automotive.evs.Rotation rotation; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/StreamType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/StreamType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9819c8910b19e746fae79bebf2bc296da9ddf39b --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/StreamType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@Backing(type="int") @VintfStability +enum StreamType { + OUTPUT = 0, + INPUT = 1, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Translation.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Translation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..488d80f4796740bcb23eeb98954b3fb4fa9cfc5c --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Translation.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable Translation { + float x; + float y; + float z; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicSensor.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicSensor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..23f81f80935550d449679c05473cb212db4e8c5b --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicSensor.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable UltrasonicSensor { + android.hardware.automotive.evs.SensorPose pose; + float maxRangeMm; + float angleOfMeasurement; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4a988759fd91078421c286f4cf7f81db5cc71685 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable UltrasonicsArrayDesc { + @utf8InCpp String ultrasonicsArrayId; + int maxReadingsPerSensorCount; + int maxReceiversCount; + android.hardware.automotive.evs.UltrasonicSensor[] sensors; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35ec84bdccec13995cb44fd1cbf2b303ff8257f6 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.evs; +@VintfStability +parcelable UltrasonicsDataFrameDesc { + long timestampNs; + int id; + byte[] transmittersIdList; + byte[] receiversIdList; + int[] receiversReadingsCountList; + android.hardware.common.Ashmem waveformsData; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/BufferDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/BufferDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0604abe1dc07a482856a1a1c460c5af4222b1fee --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/BufferDesc.aidl @@ -0,0 +1,60 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.graphics.common.HardwareBuffer; + +/** + * Structure representing an image buffer through our APIs + * + * In addition to the handle to the graphics memory, we need to retain + * the properties of the buffer for easy reference and reconstruction of + * an ANativeWindowBuffer object on the remote side of API calls. + * (Not least because OpenGL expect an ANativeWindowBuffer* for us as a + * texture via eglCreateImageKHR()). + */ +@VintfStability +parcelable BufferDesc { + /** + * Stable AIDL counter part of AHardwareBuffer. Please see + * hardware/interfaces/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl + * for more details. + */ + HardwareBuffer buffer; + /** + * The size of a pixel in the units of bytes. + */ + int pixelSizeBytes; + /** + * Opaque value from driver + */ + int bufferId; + /** + * Unique identifier of the physical camera device that produces this buffer. + */ + @utf8InCpp + String deviceId; + /** + * Time that this buffer is being filled in the units of microseconds and must be + * obtained from android::elapsedRealtimeNanos() or its equivalents. + */ + long timestamp; + /** + * Frame metadata. This is opaque to EvsManager. + */ + byte[] metadata; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/CameraDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/CameraDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2f500a73c5610fb822902723419d6a62f8fa39bf --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/CameraDesc.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * Structure describing the basic properties of an EVS camera. + * + * The HAL is responsible for filling out this structure for each + * EVS camera in the system. + */ +@VintfStability +parcelable CameraDesc { + /** + * Unique identifier for camera devices. This may be a path to detected + * camera device; for example, "/dev/video0". + */ + @utf8InCpp + String id; + /** + * Opaque value from driver. Vendor may use this field to store additional + * information; for example, sensor and bridge chip id. + */ + int vendorFlags; + /** + * Store camera metadata such as lens characteristics. + */ + byte[] metadata; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/CameraParam.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/CameraParam.aidl new file mode 100644 index 0000000000000000000000000000000000000000..15500b2deffb96884d3b20ca062b8ca6ce288081 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/CameraParam.aidl @@ -0,0 +1,75 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * EVS camera parameter + */ +@VintfStability +@Backing(type="int") +enum CameraParam { + /** + * The brightness of image frames + */ + BRIGHTNESS, + /** + * The contrast of image frames + */ + CONTRAST, + /** + * Automatic gain/exposure control + */ + AUTOGAIN, + /** + * Gain control + */ + GAIN, + /** + * Automatic Whitebalance + */ + AUTO_WHITE_BALANCE, + /** + * Manual white balance setting as a color temperature in Kelvin. + */ + WHITE_BALANCE_TEMPERATURE, + /** + * Image sharpness adjustment + */ + SHARPNESS, + /** + * Auto Exposure Control modes; auto, manual, shutter priority, or + * aperture priority. + */ + AUTO_EXPOSURE, + /** + * Manual exposure time of the camera + */ + ABSOLUTE_EXPOSURE, + /** + * Sets the focal point of the camera to the specified position. This + * parameter may not be effective when auto focus is enabled. + */ + ABSOLUTE_FOCUS, + /** + * Enables continuous automatic focus adjustments. + */ + AUTO_FOCUS, + /** + * Specifies the objective lens focal length as an absolute value. + */ + ABSOLUTE_ZOOM, +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/DeviceStatus.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/DeviceStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..535ace30acb67e1dd269cd9cb2ac21bb37b74799 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/DeviceStatus.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.DeviceStatusType; + +/** + * The status of the devices, as sent by EVS HAL through the + * IEvsEnumeratorCallback::deviceStatusChanged() call. + */ +@VintfStability +parcelable DeviceStatus { + /** + * The identifier of a device that has transitioned to a new status. + */ + @utf8InCpp + String id; + /** + * A new status of this device + */ + DeviceStatusType status; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/DeviceStatusType.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/DeviceStatusType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..902b31b15e5a9ac40b6c301fcf2f9f6c00349150 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/DeviceStatusType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * The status of the devices available through the EVS + */ +@VintfStability +@Backing(type="int") +enum DeviceStatusType { + /** + * A camera device is available and ready to be used. + */ + CAMERA_AVAILABLE, + /** + * A camera device is not available; e.g. disconnected from the system. + */ + CAMERA_NOT_AVAILABLE, + /** + * A display device is available and ready to be used. + */ + DISPLAY_AVAILABLE, + /** + * A display device is not available; e.g. disconnected from the + * system. + */ + DISPLAY_NOT_AVAILABLE, +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/DisplayDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/DisplayDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0b4243b8d9fc777ba66bec1d65f771b9544015d5 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/DisplayDesc.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.Rotation; + +/** + * Structure describing the basic properties of an EVS display + * + * The HAL is responsible for filling out this structure to describe + * the EVS display. As an implementation detail, this may be a physical + * display or a virtual display that is overlaid or mixed with another + * presentation device. + */ +@VintfStability +parcelable DisplayDesc { + /** + * Unique identifier for the display + */ + @utf8InCpp + String id; + /** + * The width of the display + */ + int width; + /** + * The height of the display + */ + int height; + /** + * Counterclock-wise orientation of the display + */ + Rotation orientation; + /** + * Opaque value from driver. Vendor may use this field to store additional + * information; for example, sensor and bridge chip id. + */ + int vendorFlags; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/DisplayState.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/DisplayState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c242d2fb7d9f788f064dcb41d37553f4278ad1d0 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/DisplayState.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * States for control of the EVS display + * + * The DisplayInfo structure describes the basic properties of an EVS display. Any EVS + * implementation is required to have one. The HAL is responsible for filling out this + * structure to describe the EVS display. As an implementation detail, this may be a + * physical display or a virtual display that is overlaid or mixed with another + * presentation device. + */ +@VintfStability +@Backing(type="int") +enum DisplayState { + /* + * Display has not been requested by any application yet + */ + NOT_OPEN = 0, + /* + * Display is inhibited + */ + NOT_VISIBLE, + /* + * Will become visible with next frame + */ + VISIBLE_ON_NEXT_FRAME, + /* + * Display is currently active + */ + VISIBLE, + /* + * Driver is in an undefined state. Interface should be closed. + */ + DEAD, +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ebff98f0772db10c014edfc042a597e73ad00337 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventDesc.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.EvsEventType; + +/** + * Structure that describes informative events occurred during EVS is streaming + */ +@VintfStability +parcelable EvsEventDesc { + /** + * Type of an informative event + */ + EvsEventType aType; + /** + * Device identifier + */ + @utf8InCpp + String deviceId; + /** + * Possible additional vendor information that is opaque to the EvsManager + */ + int[] payload; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventType.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3a493af61b56be48199d74ee1e09e1d1cb9238c2 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventType.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * Types of informative streaming events + */ +@VintfStability +@Backing(type="int") +enum EvsEventType { + /** + * Video stream is started + */ + STREAM_STARTED = 0, + /** + * Video stream is stopped + */ + STREAM_STOPPED, + /** + * Video frame is dropped + */ + FRAME_DROPPED, + /** + * Timeout happens + */ + TIMEOUT, + /** + * Camera parameter is changed; payload contains a changed parameter ID and + * its value + */ + PARAMETER_CHANGED, + /** + * Master role has become available + */ + MASTER_RELEASED, + /** + * Any other erroneous streaming events + */ + STREAM_ERROR, +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/EvsResult.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/EvsResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c355be35c22dc2df3c341f5d44692eaefca27943 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/EvsResult.aidl @@ -0,0 +1,66 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * Error codes used in EVS HAL interface. + */ +@VintfStability +@Backing(type="int") +enum EvsResult { + OK = 0, + /** + * Given arguments are invalid + */ + INVALID_ARG, + /** + * Requested stream is already running + */ + STREAM_ALREADY_RUNNING, + /** + * Buffer is not available; e.g. failed to allocate + */ + BUFFER_NOT_AVAILABLE, + /** + * Ownership has been expired or stolen by other clients + */ + OWNERSHIP_LOST, + /** + * A dependent service fails to handle a request + */ + UNDERLYING_SERVICE_ERROR, + /** + * Permission denied + */ + PERMISSION_DENIED, + /** + * Either the camera or the display is not available + */ + RESOURCE_NOT_AVAILABLE, + /** + * Device or resource busy + */ + RESOURCE_BUSY, + /** + * A method is not implemented yet + */ + NOT_IMPLEMENTED, + /** + * Requested functionality is not supported + */ + NOT_SUPPORTED, +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCamera.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCamera.aidl new file mode 100644 index 0000000000000000000000000000000000000000..080dd75247b7e11daba35fdc0660cc03008e3f85 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCamera.aidl @@ -0,0 +1,248 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.BufferDesc; +import android.hardware.automotive.evs.CameraDesc; +import android.hardware.automotive.evs.CameraParam; +import android.hardware.automotive.evs.IEvsCameraStream; +import android.hardware.automotive.evs.IEvsDisplay; +import android.hardware.automotive.evs.ParameterRange; + +/** + * Represents a single camera and is the primary interface for capturing images. + */ +@VintfStability +interface IEvsCamera { + /** + * Returns frames that were delivered to the IEvsCameraStream. + * + * When done consuming a frame delivered to the IEvsCameraStream + * interface, it must be returned to the IEvsCamera for reuse. + * A small, finite number of buffers are available (possibly as small + * as one), and if the supply is exhausted, no further frames may be + * delivered until a buffer is returned. + * + * @param in buffer Buffers to be returned. + */ + void doneWithFrame(in BufferDesc[] buffer); + + /** + * Sets to be the primary client forcibly. + * + * The client, which owns the display, has a high priority and can take over + * a primary client role from other clients without the display. + * + * @param in display IEvsDisplay handle. If a given display is in either + * NOT_VISIBLE, VISIBLE_ON_NEXT_FRAME, or VISIBLE state, the + * calling client is considered as the high priority client + * and therefore allowed to take over a primary client role from + * existing primary client. + * @throws EvsResult::INVALID_ARG if a given display handle is null or invalid states. + */ + void forcePrimaryClient(in IEvsDisplay display); + + /** + * Returns the description of this camera. + * + * @return The description of this camera. This must be the same value as + * reported by IEvsEnumerator::getCameraList(). + */ + CameraDesc getCameraInfo(); + + /** + * Request driver specific information from the HAL implementation. + * + * The values allowed for opaqueIdentifier are driver specific, + * but no value passed in may crash the driver. + * + * @param in opaqueIdentifier An unique identifier of the information to + * request. + * @return Requested information. Zero-size vector is returned if the driver does + * not recognize a given identifier. + * @throws EvsResult::INVALID_ARG for any unrecognized opaqueIdentifier. + */ + byte[] getExtendedInfo(in int opaqueIdentifier); + + /** + * Retrieves values of given camera parameter. The driver must report + * EvsResult::INVALID_ARG if a request parameter is not supported. + * + * @param in id The identifier of camera parameter, CameraParam enum. + * @return Values of requested camera parameter, the same number of values as + * backing camera devices. + * @throws EvsResult::INVALID_ARG for any unrecognized parameter. + * EvsResult::UNDERLYING_SERVICE_ERROR for any other failures. + */ + int[] getIntParameter(in CameraParam id); + + /** + * Requests a valid value range of a camera parameter + * + * @param in id The identifier of camera parameter, CameraParam enum. + * @return ParameterRange of a requested CameraParam + */ + ParameterRange getIntParameterRange(in CameraParam id); + + /** + * Retrieves a list of parameters this camera supports. + * + * @return A list of CameraParam that this camera supports. + */ + CameraParam[] getParameterList(); + + /** + * Returns the description of the physical camera device that backs this + * logical camera. + * + * If a requested device does not either exist or back this logical device, + * this method returns a null camera descriptor. And, if this is called on + * a physical camera device, this method is the same as getCameraInfo() + * method if a given device ID is matched. Otherwise, this will return a + * null camera descriptor. + * + * @param in deviceId Physical camera device identifier string. + * @return The description of a member physical camera device. + * This must be the same value as reported by IEvsEnumerator::getCameraList(). + */ + CameraDesc getPhysicalCameraInfo(in String deviceId); + + /** + * Import external buffers to capture frames + * + * This API must be called with a physical camera device identifier. + * + * @param in buffers A list of buffers allocated by the caller. EvsCamera + * will use these buffers to capture frames, in addition to + * other buffers already in its buffer pool. + * @return The amount of buffer pool size changes after importing given buffers. + */ + int importExternalBuffers(in BufferDesc[] buffers); + + /** + * Requests to pause EVS camera stream events. + * + * Like stopVideoStream(), events may continue to arrive for some time + * after this call returns. Delivered frame buffers must be returned. + */ + void pauseVideoStream(); + + /** + * Requests to resume EVS camera stream. + */ + void resumeVideoStream(); + + /** + * Send a driver specific value to the HAL implementation. + * + * This extension is provided to facilitate car specific + * extensions, but no HAL implementation may require this call + * in order to function in a default state. + * INVALID_ARG is returned if the opaqueValue is not meaningful to + * the driver implementation. + * + * @param in opaqueIdentifier An unique identifier of the information to + * program. + * in opaqueValue A value to program. + * @throws EvsResult::INVALID_ARG if this call fails to set a parameter. + */ + void setExtendedInfo(in int opaqueIdentifier, in byte[] opaqueValue); + + /** + * Requests to set a camera parameter. + * + * Only a request from the primary client will be processed successfully. + * When this method is called on a logical camera device, it will be forwarded + * to each physical device and, if it fails to program any physical device, + * it will return an error code with the same number of effective values as + * the number of backing camera devices. + * + * @param in id The identifier of camera parameter, CameraParam enum. + * @param in value A desired parameter value. + * @return Programmed parameter values. This may differ from what the client + * gives if, for example, the driver does not support a target parameter. + * @throws EvsResult::INVALID_ARG if either the request is not made by the primary + * client, or a requested parameter is not supported. + * EvsResult::UNDERLYING_SERVICE_ERROR if it fails to program a value by any + * other reason. + */ + int[] setIntParameter(in CameraParam id, in int value); + + /** + * Requests to be the primary client. + * + * When multiple clients subscribe to a single camera hardware and one of + * them adjusts a camera parameter such as the contrast, it may disturb + * other clients' operations. Therefore, the client must call this method + * to be a primary client. Once it becomes a primary client, it will be able to + * change camera parameters until either it dies or explicitly gives up the + * role. + * + * @throws EvsResult::OWNERSHIP_LOST if there is already the primary client. + */ + void setPrimaryClient(); + + /** + * Specifies the depth of the buffer chain the camera is asked to support. + * + * Up to this many frames may be held concurrently by the client of IEvsCamera. + * If this many frames have been delivered to the receiver without being returned + * by doneWithFrame, the stream must skip frames until a buffer is returned for reuse. + * It is legal for this call to come at any time, even while streams are already running, + * in which case buffers should be added or removed from the chain as appropriate. + * If no call is made to this entry point, the IEvsCamera must support at least one + * frame by default. More is acceptable. + * + * @param in bufferCount Number of buffers the client of IEvsCamera may hold concurrently. + * @throws EvsResult::BUFFER_NOT_AVAILABLE if the client cannot increase the max frames. + * EvsResult::INVALID_ARG if the client cannot decrease the max frames. + * EvsResult::OWNERSHIP_LOST if we lost an ownership of a target camera. + */ + void setMaxFramesInFlight(in int bufferCount); + + /** + * Request to start EVS camera stream from this camera. + * + * The IEvsCameraStream must begin receiving calls with various events + * including new image frame ready until stopVideoStream() is called. + * + * @param in receiver IEvsCameraStream implementation. + * @throws EvsResult::OWNERSHIP_LOST if we lost an ownership of a target camera. + * EvsResult::STREAM_ALREADY_RUNNING if a video stream has been started already. + * EvsResult::BUFFER_NOT_AVAILABLE if it fails to secure a minimum number of + * buffers to run a video stream. + * EvsResult::UNDERLYING_SERVICE_ERROR for all other failures. + */ + void startVideoStream(in IEvsCameraStream receiver); + + /** + * Stop the delivery of EVS camera frames. + * + * Because delivery is asynchronous, frames may continue to arrive for + * some time after this call returns. Each must be returned until the + * closure of the stream is signaled to the IEvsCameraStream. + * This function cannot fail and is simply ignored if the stream isn't running. + */ + void stopVideoStream(); + + /** + * Retires from the primary client role. + * + * @throws EvsResult::INVALID_ARG if the caller client is not a primary client. + */ + void unsetPrimaryClient(); +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCameraStream.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCameraStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c2b44caf5b53f5fd49b3f60c7ab328a0c372e9f --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCameraStream.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.BufferDesc; +import android.hardware.automotive.evs.EvsEventDesc; +import android.hardware.graphics.common.HardwareBuffer; + +/** + * Implemented on client side to receive asynchronous streaming event deliveries. + */ +@VintfStability +oneway interface IEvsCameraStream { + /** + * Receives calls from the HAL each time video frames is ready for inspection. + * Buffer handles received by this method must be returned via calls to + * IEvsCamera::doneWithFrame(). When the video stream is stopped via a call + * to IEvsCamera::stopVideoStream(), this callback may continue to happen for + * some time as the pipeline drains. Each frame must still be returned. + * When the last frame in the stream has been delivered, STREAM_STOPPED + * event must be delivered. No further frame deliveries may happen + * thereafter. + * + * A camera device will deliver the same number of frames as number of + * backing physical camera devices; it means, a physical camera device + * sends always a single frame and a logical camera device sends multiple + * frames as many as number of backing physical camera devices. + * + * @param in buffer Buffer descriptors of delivered image frames. + */ + void deliverFrame(in BufferDesc[] buffer); + + /** + * Receives calls from the HAL each time an event happens. + * + * @param in event EVS event with possible event information. + */ + void notify(in EvsEventDesc event); +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsDisplay.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8d57014df54b6c1dc3b1e08002cd831c20afe52a --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsDisplay.aidl @@ -0,0 +1,94 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.BufferDesc; +import android.hardware.automotive.evs.DisplayDesc; +import android.hardware.automotive.evs.DisplayState; + +/** + * Represents a single display. + */ +@VintfStability +interface IEvsDisplay { + /** + * Returns the description of this display. + * + * @return The information of this display including id, current mode, current state, + * and additional vendor-specific information. + * @throws EvsResult::UNDERLYING_SERVICE_ERROR if it fails to read a display information. + */ + DisplayDesc getDisplayInfo(); + + /** + * This call requests the current state of the display + * + * The HAL implementation should report the actual current state, which might + * transiently differ from the most recently requested state. Note, however, that + * the logic responsible for changing display states should generally live above + * the device layer, making it undesirable for the HAL implementation to spontaneously + * change display states. + * + * @return Current DisplayState of this Display. + */ + DisplayState getDisplayState(); + + /** + * This call returns a handle to a frame buffer associated with the display. + * + * @return A handle to a frame buffer. The returned buffer may be locked and + * written to by software and/or GL. This buffer must be returned via + * a call to returnTargetBufferForDisplay() even if the display is no + * longer visible. + * @throws EvsResult::OWNERSHIP_LOST if a display is in DisplayState::DEAD. + * EvsResult::BUFFER_NOT_AVAILABLE if no buffer is available. + * EvsResult::UNDERLYING_SERVICE_ERROR for any other failures. + */ + BufferDesc getTargetBuffer(); + + /** + * This call tells the display that the buffer is ready for display. + * + * The buffer is no longer valid for use by the client after this call. + * There is no maximum time the caller may hold onto the buffer before making this + * call. The buffer may be returned at any time and in any DisplayState, but all + * buffers are expected to be returned before the IEvsDisplay interface is destroyed. + * + * @param in buffer A buffer handle to the frame that is ready for display. + * @throws EvsResult::INVALID_ARG if a given buffer is unknown or invalid. + * EvsResult::OWNERSHIP_LOST if a display is in DisplayState::DEAD. + * EvsResult::UNDERLYING_SERVICE_ERROR for any other failures. + */ + void returnTargetBufferForDisplay(in BufferDesc buffer); + + /** + * Clients may set the display state to express their desired state. + * + * The HAL implementation must gracefully accept a request for any state while in + * any other state, although the response may be to defer or ignore the request. The display + * is defined to start in the NOT_VISIBLE state upon initialization. The client is + * then expected to request the VISIBLE_ON_NEXT_FRAME state, and then begin providing + * video. When the display is no longer required, the client is expected to request + * the NOT_VISIBLE state after passing the last video frame. + * Returns INVALID_ARG if the requested state is not a recognized value. + * + * @param in state Desired new DisplayState. + * @throws EvsResult::INVALID_ARG if a given state is invalid. + * EvsResult::OWNERSHIP_LOST if a display is in DisplayState::DEAD. + */ + void setDisplayState(in DisplayState state); +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl new file mode 100644 index 0000000000000000000000000000000000000000..86987008c5c427c8066ed10bfca090afcdfd9e05 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl @@ -0,0 +1,166 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.CameraDesc; +import android.hardware.automotive.evs.DisplayState; +import android.hardware.automotive.evs.IEvsCamera; +import android.hardware.automotive.evs.IEvsDisplay; +import android.hardware.automotive.evs.IEvsEnumeratorStatusCallback; +import android.hardware.automotive.evs.IEvsUltrasonicsArray; +import android.hardware.automotive.evs.Stream; +import android.hardware.automotive.evs.UltrasonicsArrayDesc; + +/** + * Provides the mechanism for EVS camera and ultrasonics array discovery + */ +@VintfStability +interface IEvsEnumerator { + /** + * Return the specified IEvsCamera interface as no longer in use + * + * When the IEvsCamera object is no longer required, it must be released. + * NOTE: Video streaming must be cleanly stopped before making this call. + * + * @param in carCamera EvsCamera object to be closed. + * @throws EvsResult::INVALID_ARG if a given camera object is invalid. + */ + void closeCamera(in IEvsCamera carCamera); + + /** + * Return the specified IEvsDisplay interface as no longer in use + * + * When the IEvsDisplay object is no longer required, it must be released. + * NOTE: All buffers must have been returned to the display before making this call. + * + * @param in display EvsDisplay object to be closed. + */ + void closeDisplay(in IEvsDisplay display); + + /** + * Return the specified IEvsUltrasonicsArray interface as no longer in use + * + * When the IEvsUltrasonicsArray object is no longer required, it must be released. + * NOTE: Data streaming must be cleanly stopped before making this call. + * + * @param in evsUltrasonicsArray EvsUltrasonics array object to be closed. + */ + void closeUltrasonicsArray(in IEvsUltrasonicsArray evsUltrasonicsArray); + + /** + * Returns a list of all EVS cameras available to the system + * + * @return A list of cameras availale for EVS service. + * @throws EvsResult::PERMISSION_DENIED if the process is not permitted to enumerate + * camera devices. + */ + CameraDesc[] getCameraList(); + + /** + * Returns a list of all EVS displays available to the system + * + * @return Identifiers of available displays. + */ + byte[] getDisplayIdList(); + + /** + * This call requests the current state of the display + * + * If there is no open display, this returns DisplayState::NOT_OPEN. otherwise, it returns + * the actual state of the active display. This call is replicated on the IEvsEnumerator + * interface in order to allow secondary clients to monitor the state of the EVS display + * without acquiring exclusive ownership of the display. + * + * @return Current DisplayState of this Display. + * @throws EvsResult::OWNERSHIP_LOST if current display is inactive + * EvsResult::PERMISSION_DENIED if the process is not permitted to do this operation. + */ + DisplayState getDisplayState(); + + /** + * Return a list of the stream configurations a target camera device supports + * + * @param in description A target camera descriptor + * @return A list of stream configurations supported by a given camera device + */ + Stream[] getStreamList(in CameraDesc description); + + /** + * Returns a list of all ultrasonics array available to the system. + * Will return an empty vector if ultrasonics is not supported. + * + * @return A list of ultrasonics available for EVS service. + */ + UltrasonicsArrayDesc[] getUltrasonicsArrayList(); + + /** + * Tells whether this is EvsManager or HAL implementation. + * + * @return False for EvsManager implementations and true for all others. + */ + boolean isHardware(); + + /** + * Gets the IEvsCamera associated with a cameraId from a CameraDesc + * + * Given a camera's unique cameraId from CameraDesc, returns the + * IEvsCamera interface associated with the specified camera. When + * done using the camera, the caller may release it by calling closeCamera(). + * + * @param in cameraId A unique identifier of the camera. + * @param in streamCfg A stream configuration the client wants to use. + * @return EvsCamera object associated with a given cameraId. + * Returned object would be null if a camera device does not support a + * given stream configuration or is already configured differently by + * another client. + * @throws EvsResult::PERMISSION_DENIED if the process is not permitted to use camera + * devices. + * EveResult::INVALID_ARG if it fails to open a camera with a given id. + */ + IEvsCamera openCamera(in String cameraId, in Stream streamCfg); + + /** + * Get exclusive access to IEvsDisplay for the system + * + * There can be more than one EVS display objects for the system and this function + * requests access to the display identified by a given ID. If the target EVS display + * is not available or is already in use the old instance shall be closed and give + * the new caller exclusive access. + * When done using the display, the caller may release it by calling closeDisplay(). + * + * @param in id Target display identifier. + * @return EvsDisplay object to be used. + * @throws EvsResult::INVALID_ARG if no display with a given id exists + */ + IEvsDisplay openDisplay(in int id); + + /** + * Gets the IEvsUltrasonicsArray associated with a ultrasonicsArrayId from a + * UltrasonicsDataDesc + * + * @param in ultrasonicsArrayId A unique identifier of the ultrasonic array. + * @return IEvsUltrasonicsArray object associated with a given ultrasonicsArrayId. + */ + IEvsUltrasonicsArray openUltrasonicsArray(in String ultrasonicsArrayId); + + /** + * Registers a callback to listen to devices' status changes + * + * @param in callback IEvsEnumeratorStatusCallback implementation + */ + void registerStatusCallback(in IEvsEnumeratorStatusCallback callback); +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..26ccf72f08a6a2a8fb3cdb06320fa3a9020a08fc --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.DeviceStatus; + +/** + * Implemented on client side to receive asynchronous notifications from + * IEvsEnumreator. + */ +@VintfStability +oneway interface IEvsEnumeratorStatusCallback { + /** + * Receives calls from the HAL each time a status of camera devices is + * changed. + * + * @param in status A list of newly updated device status + */ + void deviceStatusChanged(in DeviceStatus[] status); +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl new file mode 100644 index 0000000000000000000000000000000000000000..40de313abfee2e38d446f547befb036e28c174ef --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl @@ -0,0 +1,79 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.IEvsUltrasonicsArrayStream; +import android.hardware.automotive.evs.UltrasonicsArrayDesc; +import android.hardware.automotive.evs.UltrasonicsDataFrameDesc; + +/** + * HAL interface for ultrasonics sensor array. + */ +@VintfStability +interface IEvsUltrasonicsArray { + /** + * Notifies the UltrasonicsDataDesc is consumed that was received from + * IEvsUltrasonicsArrayStream + * + * @param in dataFrameDesc Ultrasonics data descriptor + */ + void doneWithDataFrame(in UltrasonicsDataFrameDesc dataFrameDesc); + + /** + * Returns the ultrasonic sensor array information + * + * @throws The description of this ultrasonic array. This must be the same + * value as reported by IEvsEnumerator::getUltrasonicsArrayList(). + */ + UltrasonicsArrayDesc getUltrasonicArrayInfo(); + + /** + * Specifies the depth of the buffer chain the ultrasonic sensors is + * asked to support + * + * Up to this many data frames may be held concurrently by the client of IEvsUltrasonicsArray. + * If this many frames have been delivered to the receiver without being returned + * by doneWithFrame, the stream must skip frames until a buffer is returned for reuse. + * It is legal for this call to come at any time, even while streams are already running, + * in which case buffers should be added or removed from the chain as appropriate. + * If no call is made to this entry point, the IEvsUltrasonicsArray must support at least one + * data frame by default. More is acceptable. + * + * @param in bufferCount Number of buffers the client of IEvsUltrasonicsArray may hold + * concurrently. + * @throws EvsResult::INVALID_ARG on invalid bufferCount. + */ + void setMaxFramesInFlight(in int bufferCount); + + /** + * Requests to start the stream + * + * @param in stream Implementation of IEvsUltrasonicsArrayStream. + * @throws EvsResult::STREAM_ALREADY_RUNNING if stream is already running + */ + void startStream(in IEvsUltrasonicsArrayStream stream); + + /** + * Requests to stop the delivery of the ultrasonic array data frames + * + * Because delivery is asynchronous, frames may continue to arrive for + * some time after this call returns. Each must be returned until the + * closure of the stream is signaled to the IEvsCameraStream. + * This function cannot fail and is ignored if the stream isn't running. + */ + void stopStream(); +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bc31a6ba9554b9a47d1a68babb3d28df270a0de5 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.EvsEventDesc; +import android.hardware.automotive.evs.UltrasonicsDataFrameDesc; + +/** + * Implemented on client side to receive asynchronous ultrasonic data + * deliveries. + */ +@VintfStability +interface IEvsUltrasonicsArrayStream { + /** + * Receives calls from the HAL each time a data frame is ready + * + * @param in dataFrameDesc Ultrasonic array data frame descriptor + */ + oneway void deliverDataFrame(in UltrasonicsDataFrameDesc dataFrameDesc); + + /** + * Receives calls from the HAL each time an event happens + * + * @param in event Event EVS event with possible event information + */ + oneway void notify(in EvsEventDesc event); +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/ParameterRange.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/ParameterRange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b08fcbd975314e6ad79d9eee03a37107f7802e62 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/ParameterRange.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * Represent a valid range of CameraParam + */ +@VintfStability +parcelable ParameterRange { + /** + * Lower bound of a valid value range + */ + int min; + /** + * Upper bound of a valid value range + */ + int max; + /** + * A value of unit increment + */ + int step; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/Rotation.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/Rotation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dede39e15e019cef6aeb6a99ce05bcc945b99b80 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/Rotation.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * Rotation: + * + * The required counterclockwise rotation of EVS camera stream and display. + */ +@VintfStability +@Backing(type="int") +enum Rotation { + /** No rotation */ + ROTATION_0 = 0, + /** Rotate by 90 degree counterclockwise */ + ROTATION_90 = 1, + /** Rotate by 180 degree counterclockwise */ + ROTATION_180 = 2, + /** Rotate by 270 degree counterclockwise */ + ROTATION_270 = 3 + +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/RotationQuaternion.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/RotationQuaternion.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b80343bf7c972076684538444fe51cc19cb97b0d --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/RotationQuaternion.aidl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * Structure for rotation expressed as quaternions. + * Convention used: Unit quaternion with hamilton convention. + */ +@VintfStability +parcelable RotationQuaternion { + float x; + float y; + float z; + float w; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/SensorPose.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/SensorPose.aidl new file mode 100644 index 0000000000000000000000000000000000000000..26c33399b8b8302a0a17c9aeb559410626b0bdd2 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/SensorPose.aidl @@ -0,0 +1,64 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.RotationQuaternion; +import android.hardware.automotive.evs.Translation; + +/** + * Provides the orientation and location of a car sensor relative to the android automotive + * coordinate system: + * https://source.android.com/devices/sensors/sensor-types#auto_axes + * The sensor pose defines the transformation to be applied to the android automotive axes to + * obtain the sensor local axes. + * The pose consists of rotation, (specified as a quaternions) and translation + * (vector with x, y, z). + * This rotation and translation applied to the sensor data in the sensor's local coordinate + * system transform the data to the automotive coordinate system. + * i.e. loc = ( Rot * Psensor ) + Trans + * Here loc is a point in automotive coordinate system and Psensor is a point in the sensor's + * coordinate system. + * Example: + * For a sensor on the front bumper and on the left corner of the car with its X axis pointing to + * the front, the sensor is located at (-2, 4, 0) meters w.r.t android automotive axes and the + * sensor local axes has a rotation of 90 degrees counter-clockwise w.r.t android automotive axes + * when viewing the car from top on the +Z axis side: + * + * ↑X sensor + * Y←∘______ + * | | front + * | car | + * | ↑Y | + * | ∘→X | rear + * |______| + * + * For this example the rotation and translation will be: + * Rotation = + 90 degrees around Z axis = (0.7071, 0, 0, 0.7071) as a unit quaternion. + * Translation = (-2, 4, 0) in meters = (-2000, 4000, 0) in milli-meters. + * Note: Every sensor type must specify its own pose. + */ +@VintfStability +parcelable SensorPose { + /** + * Rotation part of the sensor pose, expressed as a unit quaternion. + */ + RotationQuaternion rotation; + /** + * Translation part of the sensor pose, in (x, y, z) format with milli-meter units. + */ + Translation translation; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/Stream.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/Stream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..663ba229df753b7a2136e794b2440a4f6040d51c --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/Stream.aidl @@ -0,0 +1,75 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.Rotation; +import android.hardware.automotive.evs.StreamType; +import android.hardware.graphics.common.BufferUsage; +import android.hardware.graphics.common.PixelFormat; + +/** + * Stream: + * + * Structure that describes a EVS Camera stream + */ +@VintfStability +parcelable Stream { + /** + * Stream ID - a non-negative integer identifier for a stream. + * + * The identical stream ID must reference the same stream, with the same + * width/height/format, across consecutive calls to configureStreams. + * + * If previously-used stream ID is not used in a new call to + * configureStreams, then that stream is no longer active. Such a stream ID + * may be reused in a future configureStreams with a new + * width/height/format. + * + */ + int id; + /** + * The type of the stream (input vs output, etc). + */ + StreamType streamType; + /** + * The width in pixels of the buffers in this stream. + */ + int width; + /** + * The height in pixels of the buffers in this stream. + */ + int height; + /** + * The frame rate of this stream in frames-per-second + */ + int framerate; + /** + * The pixel format form the buffers in this stream. + */ + PixelFormat format; + /** + * The gralloc usage flags for this stream, as needed by the consumer of + * the stream. + */ + BufferUsage usage; + /** + * The required output rotation of the stream. + * + * This must be inspected by HAL along with stream with and height. + */ + Rotation rotation; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/StreamType.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/StreamType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c028a5c43f6ace59e4ad515b892d99decbb678bf --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/StreamType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * StreamType: + * + * The type of the camera stream, which defines whether the EVS client device is + * the producer or the consumer for that stream, and how the buffers of the + * stream relate to the other streams. + */ +@VintfStability +@Backing(type="int") +enum StreamType { + /** + * This stream is an output stream; the EVS HAL device must fill buffers + * from this stream with newly captured or reprocessed image data. + */ + OUTPUT = 0, + + /** + * This stream is an input stream; the EVS HAL device must read buffers + * from this stream and send them through the camera processing pipeline, + * as if the buffer was a newly captured image from the imager. + */ + INPUT = 1 +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/Translation.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/Translation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14b14db0c9dc328d0ecef0999d16f982f1cbba57 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/Translation.aidl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +/** + * Structure for translation with x, y and z units. + */ +@VintfStability +parcelable Translation { + float x; + float y; + float z; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicSensor.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicSensor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..712411bd6dbdc108e9ae03b9f2cf440917f0b2ff --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicSensor.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.SensorPose; + +/** + * Structure that contains all information of an ultrasonic sensor. + */ +@VintfStability +parcelable UltrasonicSensor { + /** + * Pose provides the orientation and location of the ultrasonic sensor within the car. + * The +Y axis points along the center of the beam spread the X axis to the right and the Z + * axis in the up direction. + */ + SensorPose pose; + /** + * Maximum range of the sensor in milli-metres. + */ + float maxRangeMm; + /** + * Half-angle of the angle of measurement of the sensor, relative to the + * sensor’s x axis, in radians. + */ + float angleOfMeasurement; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d4f0663b2738623067d4d4225bd0b181506d451c --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.automotive.evs.UltrasonicSensor; + +/** + * Structure identifies and describes an ultrasonics array in the car. + * + * A ultrasonics array represents a group of ultrasonic sensors within the + * car. These may be sensors that are physically connected to the same hardware + * control unit or represent a logical group of sensors like front and back. + * The HAL is responsible for filling out this structure for each Ultrasonics + * Array. + */ +@VintfStability +parcelable UltrasonicsArrayDesc { + /** + * Unique identifier for the ultrasonic array. This may be a path or name of the + * physical control device or a string identifying a logical group of sensors forming an array + * such as "front_array" and "back_array". + */ + @utf8InCpp + String ultrasonicsArrayId; + /** + * Maximum number of readings (points on waveform) provided per sensor in + * each data frame. Used by client to pre-allocate required memory buffer for + * incoming data. + */ + int maxReadingsPerSensorCount; + /** + * Maximum number of receiver sensors in a data frame. Must be between 1 + * and sensorCount. Used by client to pre-allocate required memory buffer for + * incoming data. + */ + int maxReceiversCount; + /** + * The order of sensors specified must be in clockwise order around the car, starting + * from front left-most sensor. + */ + UltrasonicSensor[] sensors; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e546db92c29dc7dcac61cde289e2adf524f81892 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl @@ -0,0 +1,82 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.automotive.evs; + +import android.hardware.common.Ashmem; + +/** + * Structure that describes the data frame received from an ultrasonics array. + * + * Each data frame returned consists of received waveform signals from a subset + * of sensors in an array as indicated by the receiversIdList. The signal is + * transmitted at a particular time instant indicated by timestampNs from a + * subset of sensors in the array as provided in the transmittersIdList. + */ +@VintfStability +parcelable UltrasonicsDataFrameDesc { + /** + * Timestamp of the start of the transmit signal for this data frame. + * Timestamp unit is nanoseconds and is obtained from android::elapsedRealtimeNanos(). + * timeOfFlight readings are future-deltas to this timestamp. + */ + long timestampNs; + /** + * Identifier of data frame. Used by implementation for managing multiple frames in flight. + */ + int id; + /** + * List of indexes of sensors in range [0, sensorCount - 1] that + * transmitted the signal for this data frame. + */ + byte[] transmittersIdList; + /** + * List of indexes of sensors in range [0, sensorCount - 1] that received + * the signal. The order of ids must match the order of the waveforms in the + * waveformsData. + * Size of list is upper bound by maxReceiversCount. + */ + byte[] receiversIdList; + /** + * List of the number of readings corresponding to each ultrasonics sensor in + * the receiversIdList. Order of the readings count must match the order in + * receiversIdList. + * Size of list is upper bound by maxReadingsPerSensorCount. + */ + int[] receiversReadingsCountList; + /** + * Shared memory object containing the waveforms data. Contains one waveform + * for each sensor specified in receiversIdList, in order. + * Each waveform is represented by a number of readings, which are sample + * points on the waveform. The number of readings for each waveform is as + * specified in the receiversReadingsCountList. + * Each reading is a pair of time Of flight and resonance. + * Time of flight (float): Time between transmit and receive signal in nanoseconds. + * Resonance (float): Resonance at time on waveform in range [0.0, 1.0]. + * + * The structure of shared memory (example with 2 waveforms, each with 2 readings): + * + * Byte: | 0 | 1-4 | 5-8 | 9-12 | 13-16 || 17 | 18-21 | 22-25 | 26-29 | 30-33 | + * Data: | RecId1 | TOF1 | RES1 | TOF2 | RES2 || RecId2 | TOF1 | RES1 | TOF2 | RES2 | + * | Waveform1 || Waveform2 | + * Here: + * RecId : Receiver's Id. Order matches the receiversIdList, type uint8_t + * TOF : Time of flight, type float (4 bytes) + * RES : Resonance, type float (4 bytes) + * Note: All readings and waveforms are contigious with no padding. + */ + Ashmem waveformsData; +} diff --git a/automotive/evs/aidl/impl/Android.bp b/automotive/evs/aidl/impl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..7eb01166c32382996a56a34409c4e4c717a66841 --- /dev/null +++ b/automotive/evs/aidl/impl/Android.bp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_defaults { + name: "EvsHalDefaults", + static_libs: [ + "android.hardware.automotive.evs-V1-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.graphics.common-V3-ndk", + ], + shared_libs: [ + "libbase", + "liblog", + "libutils", + ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", + ], +} diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..dbe03141181adcee7f87759d9ff1a378209c691b --- /dev/null +++ b/automotive/evs/aidl/impl/default/Android.bp @@ -0,0 +1,36 @@ +// Copyright (C) 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. + +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_binary { + name: "android.hardware.automotive.evs-aidl-default-service", + defaults: ["EvsHalDefaults"], + local_include_dirs: ["include"], + vintf_fragments: ["evs-default-service.xml"], + init_rc: ["evs-default-service.rc"], + vendor: true, + relative_install_path: "hw", + srcs: ["src/*.cpp"], + shared_libs: [ + "libbinder_ndk", + ], +} diff --git a/automotive/evs/aidl/impl/default/evs-default-service.rc b/automotive/evs/aidl/impl/default/evs-default-service.rc new file mode 100644 index 0000000000000000000000000000000000000000..ea8e6892dc9d6472f3e4f7b3e145f131300556d6 --- /dev/null +++ b/automotive/evs/aidl/impl/default/evs-default-service.rc @@ -0,0 +1,5 @@ +service vendor.evs-hal-default /vendor/bin/hw/android.hardware.automotive.evs-aidl-default-service + class early_hal + user automotive_evs + group automotive_evs + disabled diff --git a/automotive/evs/aidl/impl/default/evs-default-service.xml b/automotive/evs/aidl/impl/default/evs-default-service.xml new file mode 100644 index 0000000000000000000000000000000000000000..96ff9f657664de7c37c45c4d7683ce7e821238de --- /dev/null +++ b/automotive/evs/aidl/impl/default/evs-default-service.xml @@ -0,0 +1,11 @@ + + + android.hardware.automotive.evs + hwbinder + 1 + + IEvsEnumerator + hw/0 + + + diff --git a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h new file mode 100644 index 0000000000000000000000000000000000000000..03a578d954609fd4bbd6871fcac348cf2247bd34 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 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. + */ + +#ifndef android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ +#define android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ + +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class DefaultEvsEnumerator final + : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator { + ::ndk::ScopedAStatus isHardware(bool* flag) override; + ::ndk::ScopedAStatus openCamera( + const std::string& cameraId, + const ::aidl::android::hardware::automotive::evs::Stream& streamConfig, + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>* obj) override; + ::ndk::ScopedAStatus closeCamera( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>& obj) + override; + ::ndk::ScopedAStatus getCameraList( + std::vector<::aidl::android::hardware::automotive::evs::CameraDesc>* list) override; + ::ndk::ScopedAStatus getStreamList( + const ::aidl::android::hardware::automotive::evs::CameraDesc& desc, + std::vector<::aidl::android::hardware::automotive::evs::Stream>* _aidl_return) override; + ::ndk::ScopedAStatus openDisplay( + int32_t displayId, + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>* obj) override; + ::ndk::ScopedAStatus closeDisplay( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& obj) + override; + ::ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; + ::ndk::ScopedAStatus getDisplayState( + ::aidl::android::hardware::automotive::evs::DisplayState* state) override; + ::ndk::ScopedAStatus registerStatusCallback( + const std::shared_ptr< + ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback>& + callback) override; + ::ndk::ScopedAStatus openUltrasonicsArray( + const std::string& id, + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>* obj) + override; + ::ndk::ScopedAStatus closeUltrasonicsArray( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>& + arr) override; + ::ndk::ScopedAStatus getUltrasonicsArrayList( + std::vector<::aidl::android::hardware::automotive::evs::UltrasonicsArrayDesc>* list) + override; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation + +#endif // android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ diff --git a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5a81d05850823cdfab7f4d8610a62d43454b6d6b --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 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. + */ + +// TODO(b/203661081): Remove below lines to disable compiler warnings. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" + +#define LOG_TAG "DefaultEvsEnumerator" + +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +using ::ndk::ScopedAStatus; + +ScopedAStatus DefaultEvsEnumerator::isHardware(bool* flag) { + // This returns true always. + *flag = true; + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::openCamera(const std::string& cameraId, + const Stream& streamConfig, + std::shared_ptr* obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::closeCamera(const std::shared_ptr& obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getCameraList(std::vector* list) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getStreamList(const CameraDesc& desc, + std::vector* _aidl_return) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::openDisplay(int32_t displayId, + std::shared_ptr* obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::closeDisplay(const std::shared_ptr& state) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getDisplayIdList(std::vector* list) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getDisplayState(DisplayState* state) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::registerStatusCallback( + const std::shared_ptr& callback) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::openUltrasonicsArray( + const std::string& id, std::shared_ptr* obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::closeUltrasonicsArray( + const std::shared_ptr& obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getUltrasonicsArrayList( + std::vector* list) { + return ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation + +#pragma clang diagnostic pop diff --git a/automotive/evs/aidl/impl/default/src/service.cpp b/automotive/evs/aidl/impl/default/src/service.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a0913fd3ced7ba9a1c78a2bd3e8de6155dcd7c4 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/service.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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 "EvsService" + +#include + +#include +#include +#include + +using ::aidl::android::hardware::automotive::evs::implementation::DefaultEvsEnumerator; + +int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) { + std::shared_ptr vhal = ndk::SharedRefBase::make(); + + ALOGI("Registering as service..."); + binder_exception_t err = + AServiceManager_addService(vhal->asBinder().get(), "android.hardware.automotive.evs"); + if (err != EX_NONE) { + ALOGE("failed to register android.hardware.automotive.evs service, exception: %d", err); + return 1; + } + + if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { + ALOGE("%s", "failed to set thread pool max thread count"); + return 1; + } + ABinderProcess_startThreadPool(); + + ALOGI("Evs Service Ready"); + + ABinderProcess_joinThreadPool(); + + ALOGI("Evs Service Exiting"); + + return 0; +} diff --git a/automotive/evs/aidl/vts/Android.bp b/automotive/evs/aidl/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..980c6d5a5c80006be1609cebf736945c281553bf --- /dev/null +++ b/automotive/evs/aidl/vts/Android.bp @@ -0,0 +1,53 @@ +// +// Copyright (C) 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. +// + +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: + "VtsHalEvsTargetTest", + srcs: [ + "*.cpp", + ], + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + shared_libs: [ + "libbinder_ndk", + "libcamera_metadata", + "libui", + "libutils", + ], + static_libs: [ + "android.hardware.automotive.evs@common-default-lib", + "android.hardware.automotive.evs-V1-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.graphics.common-V3-ndk", + "libaidlcommonsupport", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/automotive/evs/aidl/vts/FrameHandler.cpp b/automotive/evs/aidl/vts/FrameHandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e51be674d7f12217216680a98f9e45a7f780a920 --- /dev/null +++ b/automotive/evs/aidl/vts/FrameHandler.cpp @@ -0,0 +1,413 @@ +/* + * Copyright (C) 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 "VtsHalEvsTest" + +#include "FrameHandler.h" +#include "FormatConvert.h" + +#include +#include +#include +#include +#include +#include + +namespace { + +using ::aidl::android::hardware::automotive::evs::BufferDesc; +using ::aidl::android::hardware::automotive::evs::CameraDesc; +using ::aidl::android::hardware::automotive::evs::EvsEventDesc; +using ::aidl::android::hardware::automotive::evs::EvsEventType; +using ::aidl::android::hardware::automotive::evs::IEvsCamera; +using ::aidl::android::hardware::automotive::evs::IEvsDisplay; +using ::aidl::android::hardware::common::NativeHandle; +using ::aidl::android::hardware::graphics::common::HardwareBuffer; +using ::aidl::android::hardware::graphics::common::HardwareBufferDescription; +using ::ndk::ScopedAStatus; +using std::chrono_literals::operator""s; + +NativeHandle dupNativeHandle(const NativeHandle& handle, bool doDup) { + NativeHandle dup; + + dup.fds = std::vector<::ndk::ScopedFileDescriptor>(handle.fds.size()); + if (!doDup) { + for (auto i = 0; i < handle.fds.size(); ++i) { + dup.fds.at(i).set(handle.fds[i].get()); + } + } else { + for (auto i = 0; i < handle.fds.size(); ++i) { + dup.fds[i] = std::move(handle.fds[i].dup()); + } + } + dup.ints = handle.ints; + + return std::move(dup); +} + +HardwareBuffer dupHardwareBuffer(const HardwareBuffer& buffer, bool doDup) { + HardwareBuffer dup = { + .description = buffer.description, + .handle = dupNativeHandle(buffer.handle, doDup), + }; + + return std::move(dup); +} + +BufferDesc dupBufferDesc(const BufferDesc& src, bool doDup) { + BufferDesc dup = { + .buffer = dupHardwareBuffer(src.buffer, doDup), + .pixelSizeBytes = src.pixelSizeBytes, + .bufferId = src.bufferId, + .deviceId = src.deviceId, + .timestamp = src.timestamp, + .metadata = src.metadata, + }; + + return std::move(dup); +} + +bool comparePayload(const EvsEventDesc& l, const EvsEventDesc& r) { + return std::equal(l.payload.begin(), l.payload.end(), r.payload.begin()); +} + +} // namespace + +FrameHandler::FrameHandler(const std::shared_ptr& pCamera, const CameraDesc& cameraInfo, + const std::shared_ptr& pDisplay, BufferControlFlag mode) + : mCamera(pCamera), mCameraInfo(cameraInfo), mDisplay(pDisplay), mReturnMode(mode) { + // Nothing but member initialization here. +} + +void FrameHandler::shutdown() { + // Make sure we're not still streaming + blockingStopStream(); + + // At this point, the receiver thread is no longer running, so we can safely drop + // our remote object references so they can be freed + mCamera = nullptr; + mDisplay = nullptr; +} + +bool FrameHandler::startStream() { + // Tell the camera to start streaming + auto status = mCamera->startVideoStream(ref()); + if (!status.isOk()) { + return false; + } + + // Mark ourselves as running + mLock.lock(); + mRunning = true; + mLock.unlock(); + + return true; +} + +void FrameHandler::asyncStopStream() { + // Tell the camera to stop streaming. + // This will result in a null frame being delivered when the stream actually stops. + mCamera->stopVideoStream(); +} + +void FrameHandler::blockingStopStream() { + // Tell the stream to stop + asyncStopStream(); + + // Wait until the stream has actually stopped + std::unique_lock lock(mEventLock); + if (mRunning) { + mEventSignal.wait(lock, [this]() { return !mRunning; }); + } +} + +bool FrameHandler::returnHeldBuffer() { + std::lock_guard lock(mLock); + + // Return the oldest buffer we're holding + if (mHeldBuffers.empty()) { + // No buffers are currently held + return false; + } + + std::vector buffers = std::move(mHeldBuffers.front()); + mHeldBuffers.pop(); + mCamera->doneWithFrame(buffers); + + return true; +} + +bool FrameHandler::isRunning() { + std::lock_guard lock(mLock); + return mRunning; +} + +void FrameHandler::waitForFrameCount(unsigned frameCount) { + // Wait until we've seen at least the requested number of frames (could be more) + std::unique_lock lock(mLock); + mFrameSignal.wait(lock, [this, frameCount]() { return mFramesReceived >= frameCount; }); +} + +void FrameHandler::getFramesCounters(unsigned* received, unsigned* displayed) { + std::lock_guard lock(mLock); + + if (received) { + *received = mFramesReceived; + } + if (displayed) { + *displayed = mFramesDisplayed; + } +} + +ScopedAStatus FrameHandler::deliverFrame(const std::vector& buffers) { + mLock.lock(); + // For VTS tests, FrameHandler uses a single frame among delivered frames. + auto bufferIdx = mFramesDisplayed % buffers.size(); + auto& buffer = buffers[bufferIdx]; + mLock.unlock(); + + // Store a dimension of a received frame. + mFrameWidth = buffer.buffer.description.width; + mFrameHeight = buffer.buffer.description.height; + + // If we were given an opened display at construction time, then send the received + // image back down the camera. + bool displayed = false; + if (mDisplay) { + // Get the output buffer we'll use to display the imagery + BufferDesc tgtBuffer; + auto status = mDisplay->getTargetBuffer(&tgtBuffer); + if (!status.isOk()) { + printf("Didn't get target buffer - frame lost\n"); + LOG(ERROR) << "Didn't get requested output buffer -- skipping this frame."; + } else { + // Copy the contents of the of buffer.memHandle into tgtBuffer + copyBufferContents(tgtBuffer, buffer); + + // Send the target buffer back for display + auto status = mDisplay->returnTargetBufferForDisplay(tgtBuffer); + if (!status.isOk()) { + printf("AIDL error on display buffer (%d)- frame lost\n", + status.getServiceSpecificError()); + LOG(ERROR) << "Error making the remote function call. AIDL said " + << status.getServiceSpecificError(); + } else { + // Everything looks good! + // Keep track so tests or watch dogs can monitor progress + displayed = true; + } + } + } + + mLock.lock(); + // increases counters + ++mFramesReceived; + mFramesDisplayed += (int)displayed; + mLock.unlock(); + mFrameSignal.notify_all(); + + switch (mReturnMode) { + case eAutoReturn: { + // Send the camera buffer back now that the client has seen it + LOG(DEBUG) << "Calling doneWithFrame"; + if (!mCamera->doneWithFrame(buffers).isOk()) { + LOG(WARNING) << "Failed to return buffers"; + } + break; + } + + case eNoAutoReturn: { + // Hang onto the buffer handles for now -- the client will return it explicitly later + std::vector buffersToHold; + for (const auto& buffer : buffers) { + buffersToHold.push_back(dupBufferDesc(buffer, /* doDup = */ true)); + } + mHeldBuffers.push(std::move(buffersToHold)); + break; + } + } + + LOG(DEBUG) << "Frame handling complete"; + return ScopedAStatus::ok(); +} + +ScopedAStatus FrameHandler::notify(const EvsEventDesc& event) { + // Local flag we use to keep track of when the stream is stopping + std::unique_lock lock(mEventLock); + mLatestEventDesc.aType = event.aType; + mLatestEventDesc.payload = event.payload; + if (mLatestEventDesc.aType == EvsEventType::STREAM_STOPPED) { + // Signal that the last frame has been received and the stream is stopped + mRunning = false; + } else if (mLatestEventDesc.aType == EvsEventType::PARAMETER_CHANGED) { + LOG(DEBUG) << "Camera parameter " << mLatestEventDesc.payload[0] << " is changed to " + << mLatestEventDesc.payload[1]; + } else { + LOG(DEBUG) << "Received an event " << eventToString(mLatestEventDesc.aType); + } + lock.unlock(); + mEventSignal.notify_one(); + + return ScopedAStatus::ok(); +} + +bool FrameHandler::copyBufferContents(const BufferDesc& tgtBuffer, const BufferDesc& srcBuffer) { + bool success = true; + const HardwareBufferDescription* pSrcDesc = + reinterpret_cast(&srcBuffer.buffer.description); + const HardwareBufferDescription* pTgtDesc = + reinterpret_cast(&tgtBuffer.buffer.description); + + // Make sure we don't run off the end of either buffer + const unsigned width = std::min(pTgtDesc->width, pSrcDesc->width); + const unsigned height = std::min(pTgtDesc->height, pSrcDesc->height); + + // FIXME: We duplicate file descriptors twice below; consider using TAKE_HANDLE + // instead of CLONE_HANDLE. + buffer_handle_t target = ::android::dupFromAidl(tgtBuffer.buffer.handle); + ::android::sp tgt = new android::GraphicBuffer( + target, android::GraphicBuffer::CLONE_HANDLE, pTgtDesc->width, pTgtDesc->height, + static_cast(pTgtDesc->format), pTgtDesc->layers, + static_cast(pTgtDesc->usage), pTgtDesc->stride); + + buffer_handle_t source = ::android::dupFromAidl(srcBuffer.buffer.handle); + ::android::sp src = new android::GraphicBuffer( + source, android::GraphicBuffer::CLONE_HANDLE, pSrcDesc->width, pSrcDesc->height, + static_cast(pSrcDesc->format), pSrcDesc->layers, + static_cast(pSrcDesc->usage), pSrcDesc->stride); + + // Lock our source buffer for reading (current expectation are for this to be NV21 format) + uint8_t* srcPixels = nullptr; + src->lock(GRALLOC_USAGE_SW_READ_OFTEN, (void**)&srcPixels); + + // Lock our target buffer for writing (should be either RGBA8888 or BGRA8888 format) + uint32_t* tgtPixels = nullptr; + tgt->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)&tgtPixels); + + if (srcPixels && tgtPixels) { + using namespace ::android::hardware::automotive::evs::common; + if (static_cast(pTgtDesc->format) == HAL_PIXEL_FORMAT_RGBA_8888) { + if (static_cast(pSrcDesc->format) == + HAL_PIXEL_FORMAT_YCRCB_420_SP) { // 420SP == NV21 + Utils::copyNV21toRGB32(width, height, srcPixels, tgtPixels, pTgtDesc->stride); + } else if (static_cast(pSrcDesc->format) == + HAL_PIXEL_FORMAT_YV12) { // YUV_420P == YV12 + Utils::copyYV12toRGB32(width, height, srcPixels, tgtPixels, pTgtDesc->stride); + } else if (static_cast(pSrcDesc->format) == + HAL_PIXEL_FORMAT_YCBCR_422_I) { // YUYV + Utils::copyYUYVtoRGB32(width, height, srcPixels, pSrcDesc->stride, tgtPixels, + pTgtDesc->stride); + } else if (pSrcDesc->format == pTgtDesc->format) { // 32bit RGBA + Utils::copyMatchedInterleavedFormats(width, height, srcPixels, pSrcDesc->stride, + tgtPixels, pTgtDesc->stride, + tgtBuffer.pixelSizeBytes); + } else { + LOG(ERROR) << "Camera buffer format is not supported"; + success = false; + } + } else if (static_cast(pTgtDesc->format) == + HAL_PIXEL_FORMAT_BGRA_8888) { + if (static_cast(pSrcDesc->format) == + HAL_PIXEL_FORMAT_YCRCB_420_SP) { // 420SP == NV21 + Utils::copyNV21toBGR32(width, height, srcPixels, tgtPixels, pTgtDesc->stride); + } else if (static_cast(pSrcDesc->format) == + HAL_PIXEL_FORMAT_YV12) { // YUV_420P == YV12 + Utils::copyYV12toBGR32(width, height, srcPixels, tgtPixels, pTgtDesc->stride); + } else if (static_cast(pSrcDesc->format) == + HAL_PIXEL_FORMAT_YCBCR_422_I) { // YUYV + Utils::copyYUYVtoBGR32(width, height, srcPixels, pSrcDesc->stride, tgtPixels, + pTgtDesc->stride); + } else if (pSrcDesc->format == pTgtDesc->format) { // 32bit RGBA + Utils::copyMatchedInterleavedFormats(width, height, srcPixels, pSrcDesc->stride, + tgtPixels, pTgtDesc->stride, + tgtBuffer.pixelSizeBytes); + } else { + LOG(ERROR) << "Camera buffer format is not supported"; + success = false; + } + } else { + // We always expect 32 bit RGB for the display output for now. Is there a need for 565? + LOG(ERROR) << "Diplay buffer is always expected to be 32bit RGBA"; + success = false; + } + } else { + LOG(ERROR) << "Failed to lock buffer contents for contents transfer"; + success = false; + } + + if (srcPixels) { + src->unlock(); + } + if (tgtPixels) { + tgt->unlock(); + } + + return success; +} + +void FrameHandler::getFrameDimension(unsigned* width, unsigned* height) { + if (width) { + *width = mFrameWidth; + } + + if (height) { + *height = mFrameHeight; + } +} + +bool FrameHandler::waitForEvent(const EvsEventDesc& aTargetEvent, EvsEventDesc& aReceivedEvent, + bool ignorePayload) { + // Wait until we get an expected parameter change event. + std::unique_lock lock(mEventLock); + auto now = std::chrono::system_clock::now(); + bool found = false; + while (!found) { + bool result = mEventSignal.wait_until( + lock, now + 5s, [this, aTargetEvent, ignorePayload, &aReceivedEvent, &found]() { + found = (mLatestEventDesc.aType == aTargetEvent.aType) && + (ignorePayload || comparePayload(mLatestEventDesc, aTargetEvent)); + aReceivedEvent.aType = mLatestEventDesc.aType; + aReceivedEvent.payload = mLatestEventDesc.payload; + return found; + }); + + if (!result) { + LOG(WARNING) << "A timer is expired before a target event has happened."; + break; + } + } + + return found; +} + +const char* FrameHandler::eventToString(const EvsEventType aType) { + switch (aType) { + case EvsEventType::STREAM_STARTED: + return "STREAM_STARTED"; + case EvsEventType::STREAM_STOPPED: + return "STREAM_STOPPED"; + case EvsEventType::FRAME_DROPPED: + return "FRAME_DROPPED"; + case EvsEventType::TIMEOUT: + return "TIMEOUT"; + case EvsEventType::PARAMETER_CHANGED: + return "PARAMETER_CHANGED"; + case EvsEventType::MASTER_RELEASED: + return "MASTER_RELEASED"; + default: + return "Unknown"; + } +} diff --git a/automotive/evs/aidl/vts/FrameHandler.h b/automotive/evs/aidl/vts/FrameHandler.h new file mode 100644 index 0000000000000000000000000000000000000000..0b959ab48de57bf3b2d3f2bdddaf8809390a44db --- /dev/null +++ b/automotive/evs/aidl/vts/FrameHandler.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 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. + */ + +#ifndef AUTOMOTIVE_EVS_VTS_FRAMEHANDLER_H +#define AUTOMOTIVE_EVS_VTS_FRAMEHANDLER_H + +#include +#include +#include +#include + +#include +#include + +/* + * FrameHandler: + * This class can be used to receive camera imagery from an IEvsCamera implementation. Given an + * IEvsDisplay instance at startup, it will forward the received imagery to the display, + * providing a trivial implementation of a rear vew camera type application. + * Note that the video frames are delivered on a background thread, while the control interface + * is actuated from the applications foreground thread. + */ +class FrameHandler : public ::aidl::android::hardware::automotive::evs::BnEvsCameraStream { + public: + enum BufferControlFlag { + eAutoReturn, + eNoAutoReturn, + }; + + FrameHandler( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>& pCamera, + const ::aidl::android::hardware::automotive::evs::CameraDesc& cameraInfo, + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& + pDisplay, + BufferControlFlag mode = eAutoReturn); + virtual ~FrameHandler() { + if (mCamera != nullptr) { + /* shutdown a camera explicitly */ + shutdown(); + } + } + + void shutdown(); + bool startStream(); + void asyncStopStream(); + void blockingStopStream(); + bool returnHeldBuffer(); + bool isRunning(); + void waitForFrameCount(unsigned frameCount); + bool waitForEvent(const ::aidl::android::hardware::automotive::evs::EvsEventDesc& aTargetEvent, + ::aidl::android::hardware::automotive::evs::EvsEventDesc& aReceivedEvent, + bool ignorePayload = false); + void getFramesCounters(unsigned* received, unsigned* displayed); + void getFrameDimension(unsigned* width, unsigned* height); + + private: + // Methods from ::aidl::android::hardware::automotive::evs::IEvsCameraStream follow. + ::ndk::ScopedAStatus deliverFrame( + const std::vector<::aidl::android::hardware::automotive::evs::BufferDesc>& buffer) + override; + ::ndk::ScopedAStatus notify( + const ::aidl::android::hardware::automotive::evs::EvsEventDesc& event) override; + + // Local implementation details + bool copyBufferContents( + const ::aidl::android::hardware::automotive::evs::BufferDesc& tgtBuffer, + const ::aidl::android::hardware::automotive::evs::BufferDesc& srcBuffer); + const char* eventToString(const ::aidl::android::hardware::automotive::evs::EvsEventType aType); + + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera> mCamera; + ::aidl::android::hardware::automotive::evs::CameraDesc mCameraInfo; + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay> mDisplay; + BufferControlFlag mReturnMode; + + // Since we get frames delivered to us asynchronously via the IEvsCameraStream interface, + // we need to protect all member variables that may be modified while we're streaming + // (ie: those below) + std::mutex mLock; + std::mutex mEventLock; + std::condition_variable mEventSignal; + std::condition_variable mFrameSignal; + std::queue> mHeldBuffers; + + bool mRunning = false; + unsigned mFramesReceived = 0; // Simple counter -- rolls over eventually! + unsigned mFramesDisplayed = 0; // Simple counter -- rolls over eventually! + unsigned mFrameWidth = 0; + unsigned mFrameHeight = 0; + ::aidl::android::hardware::automotive::evs::EvsEventDesc mLatestEventDesc; +}; + +#endif // AUTOMOTIVE_EVS_VTS_FRAMEHANDLER_H diff --git a/automotive/evs/aidl/vts/FrameHandlerUltrasonics.cpp b/automotive/evs/aidl/vts/FrameHandlerUltrasonics.cpp new file mode 100644 index 0000000000000000000000000000000000000000..650f0ed5016366215136ac14619f16ce8a73d43c --- /dev/null +++ b/automotive/evs/aidl/vts/FrameHandlerUltrasonics.cpp @@ -0,0 +1,123 @@ +/* + * 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. + */ + +#include "FrameHandlerUltrasonics.h" + +#include +#include +#include +#include +#include + +using ::aidl::android::hardware::automotive::evs::EvsEventDesc; +using ::aidl::android::hardware::automotive::evs::EvsEventType; +using ::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray; +using ::aidl::android::hardware::automotive::evs::UltrasonicsDataFrameDesc; +using ::ndk::ScopedAStatus; + +namespace { + +// Struct used by SerializeWaveformData(). +struct WaveformData { + uint8_t receiverId; + std::vector> readings; +}; + +} // namespace + +FrameHandlerUltrasonics::FrameHandlerUltrasonics( + const std::shared_ptr& pArray) + : mEvsUltrasonicsArray(pArray), mReceiveFramesCount(0) { + // Nothing but member initialization +} + +ScopedAStatus FrameHandlerUltrasonics::notify(const EvsEventDesc& evsEvent) { + switch (evsEvent.aType) { + case EvsEventType::STREAM_STARTED: + case EvsEventType::STREAM_STOPPED: + case EvsEventType::FRAME_DROPPED: + case EvsEventType::TIMEOUT: + mReceivedEvents.emplace_back(evsEvent); + break; + default: + LOG(ERROR) << "Received unexpected event"; + } + + return ScopedAStatus::ok(); +} + +// De-serializes shared memory to vector of WaveformData. +// TODO(b/149950362): Add a common library for serializing and deserializing waveform data. +std::vector DeSerializeWaveformData(std::vector recvReadingsCountList, + uint8_t* pData) { + std::vector waveformDataList(recvReadingsCountList.size()); + + for (int i = 0; i < waveformDataList.size(); i++) { + // Set Id + memcpy(&waveformDataList[i].receiverId, pData, sizeof(uint8_t)); + pData += sizeof(uint8_t); + + waveformDataList[i].readings.resize(recvReadingsCountList[i]); + + for (auto& reading : waveformDataList[i].readings) { + // Set the time of flight. + memcpy(&reading.first, pData, sizeof(float)); + pData += sizeof(float); + + // Set the resonance. + memcpy(&reading.second, pData, sizeof(float)); + pData += sizeof(float); + } + } + return waveformDataList; +} + +bool DataFrameValidator(const UltrasonicsDataFrameDesc& /*dataFrameDesc*/) { + // TODO(b/214026378): implement a method to validate an ultrasonics data frame + (void)DeSerializeWaveformData; + return true; +} + +ScopedAStatus FrameHandlerUltrasonics::deliverDataFrame( + const UltrasonicsDataFrameDesc& dataFrameDesc) { + LOG(DEBUG) << "FrameHandlerUltrasonics::receiveFrames"; + + mReceiveFramesCount++; + + if (!DataFrameValidator(dataFrameDesc)) { + mAllFramesValid = false; + } + + // Send done with data frame. + mEvsUltrasonicsArray->doneWithDataFrame(dataFrameDesc); + return ScopedAStatus::ok(); +} + +bool FrameHandlerUltrasonics::checkEventReceived(const EvsEventDesc& evsEvent) { + LOG(DEBUG) << "FrameHandlerUltrasonics::checkEventReceived"; + int size = mReceivedEvents.size(); // work around + LOG(DEBUG) << "Received event number: " << size; + auto iter = find(mReceivedEvents.begin(), mReceivedEvents.end(), evsEvent); + return iter != mReceivedEvents.end(); +} + +int FrameHandlerUltrasonics::getReceiveFramesCount() { + return mReceiveFramesCount; +} + +bool FrameHandlerUltrasonics::areAllFramesValid() { + return mAllFramesValid; +} diff --git a/automotive/evs/aidl/vts/FrameHandlerUltrasonics.h b/automotive/evs/aidl/vts/FrameHandlerUltrasonics.h new file mode 100644 index 0000000000000000000000000000000000000000..f853a00a251aa73c2caa54506f127f130f74b803 --- /dev/null +++ b/automotive/evs/aidl/vts/FrameHandlerUltrasonics.h @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#ifndef AUTOMOTIVE_EVS_VTS_FRAMEHANDLERULTRASONICS_H +#define AUTOMOTIVE_EVS_VTS_FRAMEHANDLERULTRASONICS_H + +#include +#include + +#include + +class FrameHandlerUltrasonics + : public ::aidl::android::hardware::automotive::evs::BnEvsUltrasonicsArrayStream { + public: + FrameHandlerUltrasonics( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>& + pArray); + + // Implementation for ::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArrayStream + ::ndk::ScopedAStatus notify( + const ::aidl::android::hardware::automotive::evs::EvsEventDesc& event) override; + ::ndk::ScopedAStatus deliverDataFrame( + const ::aidl::android::hardware::automotive::evs::UltrasonicsDataFrameDesc& desc) + override; + + bool checkEventReceived( + const ::aidl::android::hardware::automotive::evs::EvsEventDesc& evsEvent); + int getReceiveFramesCount(); + bool areAllFramesValid(); + + private: + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray> + mEvsUltrasonicsArray; + std::vector<::aidl::android::hardware::automotive::evs::EvsEventDesc> mReceivedEvents; + int mReceiveFramesCount; + bool mAllFramesValid = true; +}; + +#endif // AUTOMOTIVE_EVS_VTS_FRAMEHANDLERULTRASONICS_H diff --git a/automotive/evs/aidl/vts/OWNERS b/automotive/evs/aidl/vts/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..a104f509b24f2d0bec6cb0b12791a7c9621bceb0 --- /dev/null +++ b/automotive/evs/aidl/vts/OWNERS @@ -0,0 +1,3 @@ +#Bug component : 853002 +ankitarora@google.com +changyeon@google.com diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9c6c573174d429a83a4b5eb2165f09d60a7fccb0 --- /dev/null +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -0,0 +1,2212 @@ +/* + * Copyright (C) 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. + */ + +#include "FrameHandler.h" +#include "FrameHandlerUltrasonics.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace { + +// These values are called out in the EVS design doc (as of Mar 8, 2017) +constexpr int kMaxStreamStartMilliseconds = 500; +constexpr int kMinimumFramesPerSecond = 10; +constexpr int kSecondsToMilliseconds = 1000; +constexpr int kMillisecondsToMicroseconds = 1000; +constexpr float kNanoToMilliseconds = 0.000001f; +constexpr float kNanoToSeconds = 0.000000001f; + +/* + * Please note that this is different from what is defined in + * libhardware/modules/camera/3_4/metadata/types.h; this has one additional + * field to store a framerate. + */ +typedef struct { + int32_t id; + int32_t width; + int32_t height; + int32_t format; + int32_t direction; + int32_t framerate; +} RawStreamConfig; +constexpr size_t kStreamCfgSz = sizeof(RawStreamConfig) / sizeof(int32_t); + +using ::aidl::android::hardware::automotive::evs::BnEvsEnumeratorStatusCallback; +using ::aidl::android::hardware::automotive::evs::BufferDesc; +using ::aidl::android::hardware::automotive::evs::CameraDesc; +using ::aidl::android::hardware::automotive::evs::CameraParam; +using ::aidl::android::hardware::automotive::evs::DeviceStatus; +using ::aidl::android::hardware::automotive::evs::DisplayDesc; +using ::aidl::android::hardware::automotive::evs::DisplayState; +using ::aidl::android::hardware::automotive::evs::EvsEventDesc; +using ::aidl::android::hardware::automotive::evs::EvsEventType; +using ::aidl::android::hardware::automotive::evs::EvsResult; +using ::aidl::android::hardware::automotive::evs::IEvsCamera; +using ::aidl::android::hardware::automotive::evs::IEvsDisplay; +using ::aidl::android::hardware::automotive::evs::IEvsEnumerator; +using ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback; +using ::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray; +using ::aidl::android::hardware::automotive::evs::ParameterRange; +using ::aidl::android::hardware::automotive::evs::Stream; +using ::aidl::android::hardware::automotive::evs::UltrasonicsArrayDesc; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::HardwareBufferDescription; +using ::aidl::android::hardware::graphics::common::PixelFormat; +using std::chrono_literals::operator""s; + +} // namespace + +// The main test class for EVS +class EvsAidlTest : public ::testing::TestWithParam { + public: + virtual void SetUp() override { + // Make sure we can connect to the enumerator + std::string service_name = GetParam(); + AIBinder* binder = AServiceManager_waitForService(service_name.data()); + ASSERT_NE(binder, nullptr); + mEnumerator = IEvsEnumerator::fromBinder(::ndk::SpAIBinder(binder)); + LOG(INFO) << "Test target service: " << service_name; + + ASSERT_TRUE(mEnumerator->isHardware(&mIsHwModule).isOk()); + } + + virtual void TearDown() override { + // Attempt to close any active camera + for (auto&& cam : mActiveCameras) { + if (cam != nullptr) { + mEnumerator->closeCamera(cam); + } + } + mActiveCameras.clear(); + } + + protected: + void loadCameraList() { + // SetUp() must run first! + ASSERT_NE(mEnumerator, nullptr); + + // Get the camera list + ASSERT_TRUE(mEnumerator->getCameraList(&mCameraInfo).isOk()) + << "Failed to get a list of available cameras"; + LOG(INFO) << "We have " << mCameraInfo.size() << " cameras."; + } + + void loadUltrasonicsArrayList() { + // SetUp() must run first! + ASSERT_NE(mEnumerator, nullptr); + + // Get the ultrasonics array list + auto result = mEnumerator->getUltrasonicsArrayList(&mUltrasonicsArraysInfo); + ASSERT_TRUE(result.isOk() || + // TODO(b/149874793): Remove below conditions when + // getUltrasonicsArrayList() is implemented. + (!result.isOk() && result.getServiceSpecificError() == + static_cast(EvsResult::NOT_IMPLEMENTED))) + << "Failed to get a list of available ultrasonics arrays"; + LOG(INFO) << "We have " << mCameraInfo.size() << " ultrasonics arrays."; + } + + bool isLogicalCamera(const camera_metadata_t* metadata) { + if (metadata == nullptr) { + // A logical camera device must have a valid camera metadata. + return false; + } + + // Looking for LOGICAL_MULTI_CAMERA capability from metadata. + camera_metadata_ro_entry_t entry; + int rc = find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &entry); + if (rc != 0) { + // No capabilities are found. + return false; + } + + for (size_t i = 0; i < entry.count; ++i) { + uint8_t cap = entry.data.u8[i]; + if (cap == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) { + return true; + } + } + + return false; + } + + std::unordered_set getPhysicalCameraIds(const std::string& id, bool& flag) { + std::unordered_set physicalCameras; + const auto it = std::find_if(mCameraInfo.begin(), mCameraInfo.end(), + [&id](const CameraDesc& desc) { return id == desc.id; }); + if (it == mCameraInfo.end()) { + // Unknown camera is requested. Return an empty list. + return physicalCameras; + } + + const camera_metadata_t* metadata = reinterpret_cast(&it->metadata[0]); + flag = isLogicalCamera(metadata); + if (!flag) { + // EVS assumes that the device w/o a valid metadata is a physical + // device. + LOG(INFO) << id << " is not a logical camera device."; + physicalCameras.insert(id); + return physicalCameras; + } + + // Look for physical camera identifiers + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(metadata, ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS, + &entry); + if (rc != 0) { + LOG(ERROR) << "No physical camera ID is found for a logical camera device"; + } + + const uint8_t* ids = entry.data.u8; + size_t start = 0; + for (size_t i = 0; i < entry.count; ++i) { + if (ids[i] == '\0') { + if (start != i) { + std::string id(reinterpret_cast(ids + start)); + physicalCameras.insert(id); + } + start = i + 1; + } + } + + LOG(INFO) << id << " consists of " << physicalCameras.size() << " physical camera devices"; + return physicalCameras; + } + + Stream getFirstStreamConfiguration(camera_metadata_t* metadata) { + Stream targetCfg = {}; + camera_metadata_entry_t streamCfgs; + if (!find_camera_metadata_entry(metadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + &streamCfgs)) { + // Stream configurations are found in metadata + RawStreamConfig* ptr = reinterpret_cast(streamCfgs.data.i32); + for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && + ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { + targetCfg.width = ptr->width; + targetCfg.height = ptr->height; + targetCfg.format = static_cast(ptr->format); + break; + } + ++ptr; + } + } + + return targetCfg; + } + + class DeviceStatusCallback : public BnEvsEnumeratorStatusCallback { + ndk::ScopedAStatus deviceStatusChanged(const std::vector&) override { + // This empty implementation returns always ok(). + return ndk::ScopedAStatus::ok(); + } + }; + + // Every test needs access to the service + std::shared_ptr mEnumerator; + // Empty unless/util loadCameraList() is called + std::vector mCameraInfo; + // boolean to tell current module under testing is HW module implementation + // or not + bool mIsHwModule; + // A list of active camera handles that are need to be cleaned up + std::deque> mActiveCameras; + // Empty unless/util loadUltrasonicsArrayList() is called + std::vector mUltrasonicsArraysInfo; + // A list of active ultrasonics array handles that are to be cleaned up + std::deque> mActiveUltrasonicsArrays; +}; + +// Test cases, their implementations, and corresponding requirements are +// documented at go/aae-evs-public-api-test. + +/* + * CameraOpenClean: + * Opens each camera reported by the enumerator and then explicitly closes it via a + * call to closeCamera. Then repeats the test to ensure all cameras can be reopened. + */ +TEST_P(EvsAidlTest, CameraOpenClean) { + LOG(INFO) << "Starting CameraOpenClean test"; + + // Get the camera list + loadCameraList(); + + // Open and close each camera twice + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + auto devices = getPhysicalCameraIds(cam.id, isLogicalCam); + if (mIsHwModule && isLogicalCam) { + LOG(INFO) << "Skip a logical device, " << cam.id << " for HW target."; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + for (int pass = 0; pass < 2; pass++) { + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + ASSERT_NE(pCam, nullptr); + + CameraDesc cameraInfo; + for (auto&& devName : devices) { + ASSERT_TRUE(pCam->getPhysicalCameraInfo(devName, &cameraInfo).isOk()); + EXPECT_EQ(devName, cameraInfo.id); + } + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam); + + // Verify that this camera self-identifies correctly + ASSERT_TRUE(pCam->getCameraInfo(&cameraInfo).isOk()); + EXPECT_EQ(cam.id, cameraInfo.id); + + // Verify methods for extended info + const auto id = 0xFFFFFFFF; // meaningless id + std::vector values; + auto status = pCam->setExtendedInfo(id, values); + if (isLogicalCam) { + EXPECT_TRUE(!status.isOk() && status.getServiceSpecificError() == + static_cast(EvsResult::NOT_SUPPORTED)); + } else { + EXPECT_TRUE(status.isOk()); + } + + status = pCam->getExtendedInfo(id, &values); + if (isLogicalCam) { + EXPECT_TRUE(!status.isOk() && status.getServiceSpecificError() == + static_cast(EvsResult::NOT_SUPPORTED)); + } else { + EXPECT_TRUE(status.isOk()); + } + + // Explicitly close the camera so resources are released right away + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.clear(); + } + } +} + +/* + * CameraOpenAggressive: + * Opens each camera reported by the enumerator twice in a row without an intervening closeCamera + * call. This ensures that the intended "aggressive open" behavior works. This is necessary for + * the system to be tolerant of shutdown/restart race conditions. + */ +TEST_P(EvsAidlTest, CameraOpenAggressive) { + LOG(INFO) << "Starting CameraOpenAggressive test"; + + // Get the camera list + loadCameraList(); + + // Open and close each camera twice + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + getPhysicalCameraIds(cam.id, isLogicalCam); + if (mIsHwModule && isLogicalCam) { + LOG(INFO) << "Skip a logical device, " << cam.id << " for HW target."; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + mActiveCameras.clear(); + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + EXPECT_NE(pCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam); + + // Verify that this camera self-identifies correctly + CameraDesc cameraInfo; + ASSERT_TRUE(pCam->getCameraInfo(&cameraInfo).isOk()); + EXPECT_EQ(cam.id, cameraInfo.id); + + std::shared_ptr pCam2; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam2).isOk()); + EXPECT_NE(pCam2, nullptr); + EXPECT_NE(pCam, pCam2); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam2); + + auto status = pCam->setMaxFramesInFlight(2); + if (mIsHwModule) { + // Verify that the old camera rejects calls via HW module. + EXPECT_TRUE(!status.isOk() && status.getServiceSpecificError() == + static_cast(EvsResult::OWNERSHIP_LOST)); + } else { + // default implementation supports multiple clients. + EXPECT_TRUE(status.isOk()); + } + + // Close the superseded camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.pop_front(); + + // Verify that the second camera instance self-identifies correctly + ASSERT_TRUE(pCam2->getCameraInfo(&cameraInfo).isOk()); + EXPECT_EQ(cam.id, cameraInfo.id); + + // Close the second camera instance + ASSERT_TRUE(mEnumerator->closeCamera(pCam2).isOk()); + mActiveCameras.pop_front(); + } + + // Sleep here to ensure the destructor cleanup has time to run so we don't break follow on tests + sleep(1); // I hate that this is an arbitrary time to wait. :( b/36122635 +} + +/* + * CameraStreamPerformance: + * Measure and qualify the stream start up time and streaming frame rate of each reported camera + */ +TEST_P(EvsAidlTest, CameraStreamPerformance) { + LOG(INFO) << "Starting CameraStreamPerformance test"; + + // Get the camera list + loadCameraList(); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + auto devices = getPhysicalCameraIds(cam.id, isLogicalCam); + if (mIsHwModule && isLogicalCam) { + LOG(INFO) << "Skip a logical device " << cam.id; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + EXPECT_NE(pCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam); + + // Set up a frame receiver object which will fire up its own thread + std::shared_ptr frameHandler = ndk::SharedRefBase::make( + pCam, cam, nullptr, FrameHandler::eAutoReturn); + EXPECT_NE(frameHandler, nullptr); + + // Start the camera's video stream + nsecs_t start = systemTime(SYSTEM_TIME_MONOTONIC); + ASSERT_TRUE(frameHandler->startStream()); + + // Ensure the first frame arrived within the expected time + frameHandler->waitForFrameCount(1); + nsecs_t firstFrame = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t timeToFirstFrame = systemTime(SYSTEM_TIME_MONOTONIC) - start; + + // Extra delays are expected when we attempt to start a video stream on + // the logical camera device. The amount of delay is expected the + // number of physical camera devices multiplied by + // kMaxStreamStartMilliseconds at most. + EXPECT_LE(nanoseconds_to_milliseconds(timeToFirstFrame), + kMaxStreamStartMilliseconds * devices.size()); + printf("%s: Measured time to first frame %0.2f ms\n", cam.id.data(), + timeToFirstFrame * kNanoToMilliseconds); + LOG(INFO) << cam.id << ": Measured time to first frame " << std::scientific + << timeToFirstFrame * kNanoToMilliseconds << " ms."; + + // Check aspect ratio + unsigned width = 0, height = 0; + frameHandler->getFrameDimension(&width, &height); + EXPECT_GE(width, height); + + // Wait a bit, then ensure we get at least the required minimum number of frames + sleep(5); + nsecs_t end = systemTime(SYSTEM_TIME_MONOTONIC); + + // Even when the camera pointer goes out of scope, the FrameHandler object will + // keep the stream alive unless we tell it to shutdown. + // Also note that the FrameHandle and the Camera have a mutual circular reference, so + // we have to break that cycle in order for either of them to get cleaned up. + frameHandler->shutdown(); + + unsigned framesReceived = 0; + frameHandler->getFramesCounters(&framesReceived, nullptr); + framesReceived = framesReceived - 1; // Back out the first frame we already waited for + nsecs_t runTime = end - firstFrame; + float framesPerSecond = framesReceived / (runTime * kNanoToSeconds); + printf("Measured camera rate %3.2f fps\n", framesPerSecond); + LOG(INFO) << "Measured camera rate " << std::scientific << framesPerSecond << " fps."; + EXPECT_GE(framesPerSecond, kMinimumFramesPerSecond); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.clear(); + } +} + +/* + * CameraStreamBuffering: + * Ensure the camera implementation behaves properly when the client holds onto buffers for more + * than one frame time. The camera must cleanly skip frames until the client is ready again. + */ +TEST_P(EvsAidlTest, CameraStreamBuffering) { + LOG(INFO) << "Starting CameraStreamBuffering test"; + + // Arbitrary constant (should be > 1 and not too big) + static const unsigned int kBuffersToHold = 6; + + // Get the camera list + loadCameraList(); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + getPhysicalCameraIds(cam.id, isLogicalCam); + if (mIsHwModule && isLogicalCam) { + LOG(INFO) << "Skip a logical device " << cam.id << " for HW target."; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + EXPECT_NE(pCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam); + + // Ask for a very large number of buffers in flight to ensure it errors correctly + auto badResult = pCam->setMaxFramesInFlight(std::numeric_limits::max()); + EXPECT_TRUE(!badResult.isOk() && badResult.getServiceSpecificError() == + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + + // Now ask for exactly two buffers in flight as we'll test behavior in that case + ASSERT_TRUE(pCam->setMaxFramesInFlight(kBuffersToHold).isOk()); + + // Set up a frame receiver object which will fire up its own thread. + std::shared_ptr frameHandler = ndk::SharedRefBase::make( + pCam, cam, nullptr, FrameHandler::eNoAutoReturn); + EXPECT_NE(frameHandler, nullptr); + + // Start the camera's video stream + ASSERT_TRUE(frameHandler->startStream()); + + // Check that the video stream stalls once we've gotten exactly the number of buffers + // we requested since we told the frameHandler not to return them. + sleep(1); // 1 second should be enough for at least 5 frames to be delivered worst case + unsigned framesReceived = 0; + frameHandler->getFramesCounters(&framesReceived, nullptr); + ASSERT_EQ(kBuffersToHold, framesReceived) << "Stream didn't stall at expected buffer limit"; + + // Give back one buffer + ASSERT_TRUE(frameHandler->returnHeldBuffer()); + + // Once we return a buffer, it shouldn't take more than 1/10 second to get a new one + // filled since we require 10fps minimum -- but give a 10% allowance just in case. + usleep(110 * kMillisecondsToMicroseconds); + frameHandler->getFramesCounters(&framesReceived, nullptr); + EXPECT_EQ(kBuffersToHold + 1, framesReceived) << "Stream should've resumed"; + + // Even when the camera pointer goes out of scope, the FrameHandler object will + // keep the stream alive unless we tell it to shutdown. + // Also note that the FrameHandle and the Camera have a mutual circular reference, so + // we have to break that cycle in order for either of them to get cleaned up. + frameHandler->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.clear(); + } +} + +/* + * CameraToDisplayRoundTrip: + * End to end test of data flowing from the camera to the display. Each delivered frame of camera + * imagery is simply copied to the display buffer and presented on screen. This is the one test + * which a human could observe to see the operation of the system on the physical display. + */ +TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) { + LOG(INFO) << "Starting CameraToDisplayRoundTrip test"; + + // Get the camera list + loadCameraList(); + + // Request available display IDs + uint8_t targetDisplayId = 0; + std::vector displayIds; + ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk()); + EXPECT_GT(displayIds.size(), 0); + targetDisplayId = displayIds[0]; + + // Request exclusive access to the first EVS display + std::shared_ptr pDisplay; + ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); + EXPECT_NE(pDisplay, nullptr); + LOG(INFO) << "Display " << static_cast(targetDisplayId) << " is in use."; + + // Get the display descriptor + DisplayDesc displayDesc; + ASSERT_TRUE(pDisplay->getDisplayInfo(&displayDesc).isOk()); + LOG(INFO) << " Resolution: " << displayDesc.width << "x" << displayDesc.height; + ASSERT_GT(displayDesc.width, 0); + ASSERT_GT(displayDesc.height, 0); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + getPhysicalCameraIds(cam.id, isLogicalCam); + if (mIsHwModule && isLogicalCam) { + LOG(INFO) << "Skip a logical device " << cam.id << " for HW target."; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + EXPECT_NE(pCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam); + + // Set up a frame receiver object which will fire up its own thread. + std::shared_ptr frameHandler = ndk::SharedRefBase::make( + pCam, cam, pDisplay, FrameHandler::eAutoReturn); + EXPECT_NE(frameHandler, nullptr); + + // Activate the display + ASSERT_TRUE(pDisplay->setDisplayState(DisplayState::VISIBLE_ON_NEXT_FRAME).isOk()); + + // Start the camera's video stream + ASSERT_TRUE(frameHandler->startStream()); + + // Wait a while to let the data flow + static const int kSecondsToWait = 5; + const int streamTimeMs = + kSecondsToWait * kSecondsToMilliseconds - kMaxStreamStartMilliseconds; + const unsigned minimumFramesExpected = + streamTimeMs * kMinimumFramesPerSecond / kSecondsToMilliseconds; + sleep(kSecondsToWait); + unsigned framesReceived = 0; + unsigned framesDisplayed = 0; + frameHandler->getFramesCounters(&framesReceived, &framesDisplayed); + EXPECT_EQ(framesReceived, framesDisplayed); + EXPECT_GE(framesDisplayed, minimumFramesExpected); + + // Turn off the display (yes, before the stream stops -- it should be handled) + ASSERT_TRUE(pDisplay->setDisplayState(DisplayState::NOT_VISIBLE).isOk()); + + // Shut down the streamer + frameHandler->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.clear(); + } + + // Explicitly release the display + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); +} + +/* + * MultiCameraStream: + * Verify that each client can start and stop video streams on the same + * underlying camera. + */ +TEST_P(EvsAidlTest, MultiCameraStream) { + LOG(INFO) << "Starting MultiCameraStream test"; + + if (mIsHwModule) { + // This test is not for HW module implementation. + return; + } + + // Get the camera list + loadCameraList(); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + // Create two camera clients. + std::shared_ptr pCam0; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam0).isOk()); + EXPECT_NE(pCam0, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam0); + + std::shared_ptr pCam1; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam1).isOk()); + EXPECT_NE(pCam1, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam1); + + // Set up per-client frame receiver objects which will fire up its own thread + std::shared_ptr frameHandler0 = ndk::SharedRefBase::make( + pCam0, cam, nullptr, FrameHandler::eAutoReturn); + std::shared_ptr frameHandler1 = ndk::SharedRefBase::make( + pCam1, cam, nullptr, FrameHandler::eAutoReturn); + EXPECT_NE(frameHandler0, nullptr); + EXPECT_NE(frameHandler1, nullptr); + + // Start the camera's video stream via client 0 + ASSERT_TRUE(frameHandler0->startStream()); + ASSERT_TRUE(frameHandler1->startStream()); + + // Ensure the stream starts + frameHandler0->waitForFrameCount(1); + frameHandler1->waitForFrameCount(1); + + nsecs_t firstFrame = systemTime(SYSTEM_TIME_MONOTONIC); + + // Wait a bit, then ensure both clients get at least the required minimum number of frames + sleep(5); + nsecs_t end = systemTime(SYSTEM_TIME_MONOTONIC); + unsigned framesReceived0 = 0, framesReceived1 = 0; + frameHandler0->getFramesCounters(&framesReceived0, nullptr); + frameHandler1->getFramesCounters(&framesReceived1, nullptr); + framesReceived0 = framesReceived0 - 1; // Back out the first frame we already waited for + framesReceived1 = framesReceived1 - 1; // Back out the first frame we already waited for + nsecs_t runTime = end - firstFrame; + float framesPerSecond0 = framesReceived0 / (runTime * kNanoToSeconds); + float framesPerSecond1 = framesReceived1 / (runTime * kNanoToSeconds); + LOG(INFO) << "Measured camera rate " << std::scientific << framesPerSecond0 << " fps and " + << framesPerSecond1 << " fps"; + EXPECT_GE(framesPerSecond0, kMinimumFramesPerSecond); + EXPECT_GE(framesPerSecond1, kMinimumFramesPerSecond); + + // Shutdown one client + frameHandler0->shutdown(); + + // Read frame counters again + frameHandler0->getFramesCounters(&framesReceived0, nullptr); + frameHandler1->getFramesCounters(&framesReceived1, nullptr); + + // Wait a bit again + sleep(5); + unsigned framesReceivedAfterStop0 = 0, framesReceivedAfterStop1 = 0; + frameHandler0->getFramesCounters(&framesReceivedAfterStop0, nullptr); + frameHandler1->getFramesCounters(&framesReceivedAfterStop1, nullptr); + EXPECT_EQ(framesReceived0, framesReceivedAfterStop0); + EXPECT_LT(framesReceived1, framesReceivedAfterStop1); + + // Shutdown another + frameHandler1->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam0).isOk()); + ASSERT_TRUE(mEnumerator->closeCamera(pCam1).isOk()); + mActiveCameras.clear(); + + // TODO(b/145459970, b/145457727): below sleep() is added to ensure the + // destruction of active camera objects; this may be related with two + // issues. + sleep(1); + } +} + +/* + * CameraParameter: + * Verify that a client can adjust a camera parameter. + */ +TEST_P(EvsAidlTest, CameraParameter) { + LOG(INFO) << "Starting CameraParameter test"; + + // Get the camera list + loadCameraList(); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + getPhysicalCameraIds(cam.id, isLogicalCam); + if (isLogicalCam) { + // TODO(b/145465724): Support camera parameter programming on + // logical devices. + LOG(INFO) << "Skip a logical device " << cam.id; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + // Create a camera client + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + EXPECT_NE(pCam, nullptr); + + // Store a camera + mActiveCameras.push_back(pCam); + + // Get the parameter list + std::vector cmds; + ASSERT_TRUE(pCam->getParameterList(&cmds).isOk()); + if (cmds.size() < 1) { + continue; + } + + // Set up per-client frame receiver objects which will fire up its own thread + std::shared_ptr frameHandler = ndk::SharedRefBase::make( + pCam, cam, nullptr, FrameHandler::eAutoReturn); + EXPECT_NE(frameHandler, nullptr); + + // Start the camera's video stream + ASSERT_TRUE(frameHandler->startStream()); + + // Ensure the stream starts + frameHandler->waitForFrameCount(1); + + // Set current client is the primary client + ASSERT_TRUE(pCam->setPrimaryClient().isOk()); + for (auto& cmd : cmds) { + // Get a valid parameter value range + ParameterRange range; + ASSERT_TRUE(pCam->getIntParameterRange(cmd, &range).isOk()); + + std::vector values; + if (cmd == CameraParam::ABSOLUTE_FOCUS) { + // Try to turn off auto-focus + ASSERT_TRUE(pCam->setIntParameter(CameraParam::AUTO_FOCUS, 0, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(v, 0); + } + } + + // Try to program a parameter with a random value [minVal, maxVal] + int32_t val0 = range.min + (std::rand() % (range.max - range.min)); + + // Rounding down + val0 = val0 - (val0 % range.step); + values.clear(); + ASSERT_TRUE(pCam->setIntParameter(cmd, val0, &values).isOk()); + + values.clear(); + ASSERT_TRUE(pCam->getIntParameter(cmd, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(val0, v) << "Values are not matched."; + } + } + ASSERT_TRUE(pCam->unsetPrimaryClient().isOk()); + + // Shutdown + frameHandler->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.clear(); + } +} + +/* + * CameraPrimaryClientRelease + * Verify that non-primary client gets notified when the primary client either + * terminates or releases a role. + */ +TEST_P(EvsAidlTest, CameraPrimaryClientRelease) { + LOG(INFO) << "Starting CameraPrimaryClientRelease test"; + + if (mIsHwModule) { + // This test is not for HW module implementation. + return; + } + + // Get the camera list + loadCameraList(); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + getPhysicalCameraIds(cam.id, isLogicalCam); + if (isLogicalCam) { + // TODO(b/145465724): Support camera parameter programming on + // logical devices. + LOG(INFO) << "Skip a logical device " << cam.id; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + // Create two camera clients. + std::shared_ptr pPrimaryCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pPrimaryCam).isOk()); + EXPECT_NE(pPrimaryCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pPrimaryCam); + + std::shared_ptr pSecondaryCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pSecondaryCam).isOk()); + EXPECT_NE(pSecondaryCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pSecondaryCam); + + // Set up per-client frame receiver objects which will fire up its own thread + std::shared_ptr frameHandlerPrimary = ndk::SharedRefBase::make( + pPrimaryCam, cam, nullptr, FrameHandler::eAutoReturn); + std::shared_ptr frameHandlerSecondary = + ndk::SharedRefBase::make(pSecondaryCam, cam, nullptr, + FrameHandler::eAutoReturn); + EXPECT_NE(frameHandlerPrimary, nullptr); + EXPECT_NE(frameHandlerSecondary, nullptr); + + // Set one client as the primary client + ASSERT_TRUE(pPrimaryCam->setPrimaryClient().isOk()); + + // Try to set another client as the primary client. + ASSERT_FALSE(pSecondaryCam->setPrimaryClient().isOk()); + + // Start the camera's video stream via a primary client client. + ASSERT_TRUE(frameHandlerPrimary->startStream()); + + // Ensure the stream starts + frameHandlerPrimary->waitForFrameCount(1); + + // Start the camera's video stream via another client + ASSERT_TRUE(frameHandlerSecondary->startStream()); + + // Ensure the stream starts + frameHandlerSecondary->waitForFrameCount(1); + + // Non-primary client expects to receive a primary client role relesed + // notification. + EvsEventDesc aTargetEvent = {}; + EvsEventDesc aNotification = {}; + + bool listening = false; + std::mutex eventLock; + std::condition_variable eventCond; + std::thread listener = + std::thread([&aNotification, &frameHandlerSecondary, &listening, &eventCond]() { + // Notify that a listening thread is running. + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::MASTER_RELEASED; + if (!frameHandlerSecondary->waitForEvent(aTargetEvent, aNotification, true)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a listening thread starts. + std::unique_lock lock(eventLock); + auto timer = std::chrono::system_clock::now(); + while (!listening) { + timer += 1s; + eventCond.wait_until(lock, timer); + } + lock.unlock(); + + // Release a primary client role. + ASSERT_TRUE(pPrimaryCam->unsetPrimaryClient().isOk()); + + // Join a listening thread. + if (listener.joinable()) { + listener.join(); + } + + // Verify change notifications. + ASSERT_EQ(EvsEventType::MASTER_RELEASED, static_cast(aNotification.aType)); + + // Non-primary becomes a primary client. + ASSERT_TRUE(pSecondaryCam->setPrimaryClient().isOk()); + + // Previous primary client fails to become a primary client. + ASSERT_FALSE(pPrimaryCam->setPrimaryClient().isOk()); + + listening = false; + listener = std::thread([&aNotification, &frameHandlerPrimary, &listening, &eventCond]() { + // Notify that a listening thread is running. + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::MASTER_RELEASED; + if (!frameHandlerPrimary->waitForEvent(aTargetEvent, aNotification, true)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a listening thread starts. + timer = std::chrono::system_clock::now(); + lock.lock(); + while (!listening) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + // Closing current primary client. + frameHandlerSecondary->shutdown(); + + // Join a listening thread. + if (listener.joinable()) { + listener.join(); + } + + // Verify change notifications. + ASSERT_EQ(EvsEventType::MASTER_RELEASED, static_cast(aNotification.aType)); + + // Closing streams. + frameHandlerPrimary->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pPrimaryCam).isOk()); + ASSERT_TRUE(mEnumerator->closeCamera(pSecondaryCam).isOk()); + mActiveCameras.clear(); + } +} + +/* + * MultiCameraParameter: + * Verify that primary and non-primary clients behave as expected when they try to adjust + * camera parameters. + */ +TEST_P(EvsAidlTest, MultiCameraParameter) { + LOG(INFO) << "Starting MultiCameraParameter test"; + + if (mIsHwModule) { + // This test is not for HW module implementation. + return; + } + + // Get the camera list + loadCameraList(); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + getPhysicalCameraIds(cam.id, isLogicalCam); + if (isLogicalCam) { + // TODO(b/145465724): Support camera parameter programming on + // logical devices. + LOG(INFO) << "Skip a logical device " << cam.id; + continue; + } + + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + // Create two camera clients. + std::shared_ptr pPrimaryCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pPrimaryCam).isOk()); + EXPECT_NE(pPrimaryCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pPrimaryCam); + + std::shared_ptr pSecondaryCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pSecondaryCam).isOk()); + EXPECT_NE(pSecondaryCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pSecondaryCam); + + // Get the parameter list + std::vector camPrimaryCmds, camSecondaryCmds; + ASSERT_TRUE(pPrimaryCam->getParameterList(&camPrimaryCmds).isOk()); + ASSERT_TRUE(pSecondaryCam->getParameterList(&camSecondaryCmds).isOk()); + if (camPrimaryCmds.size() < 1 || camSecondaryCmds.size() < 1) { + // Skip a camera device if it does not support any parameter. + continue; + } + + // Set up per-client frame receiver objects which will fire up its own thread + std::shared_ptr frameHandlerPrimary = ndk::SharedRefBase::make( + pPrimaryCam, cam, nullptr, FrameHandler::eAutoReturn); + std::shared_ptr frameHandlerSecondary = + ndk::SharedRefBase::make(pSecondaryCam, cam, nullptr, + FrameHandler::eAutoReturn); + EXPECT_NE(frameHandlerPrimary, nullptr); + EXPECT_NE(frameHandlerSecondary, nullptr); + + // Set one client as the primary client. + ASSERT_TRUE(pPrimaryCam->setPrimaryClient().isOk()); + + // Try to set another client as the primary client. + ASSERT_FALSE(pSecondaryCam->setPrimaryClient().isOk()); + + // Start the camera's video stream via a primary client client. + ASSERT_TRUE(frameHandlerPrimary->startStream()); + + // Ensure the stream starts + frameHandlerPrimary->waitForFrameCount(1); + + // Start the camera's video stream via another client + ASSERT_TRUE(frameHandlerSecondary->startStream()); + + // Ensure the stream starts + frameHandlerSecondary->waitForFrameCount(1); + + int32_t val0 = 0; + std::vector values; + EvsEventDesc aNotification0 = {}; + EvsEventDesc aNotification1 = {}; + for (auto& cmd : camPrimaryCmds) { + // Get a valid parameter value range + ParameterRange range; + ASSERT_TRUE(pPrimaryCam->getIntParameterRange(cmd, &range).isOk()); + if (cmd == CameraParam::ABSOLUTE_FOCUS) { + // Try to turn off auto-focus + values.clear(); + ASSERT_TRUE( + pPrimaryCam->setIntParameter(CameraParam::AUTO_FOCUS, 0, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(v, 0); + } + } + + // Calculate a parameter value to program. + val0 = range.min + (std::rand() % (range.max - range.min)); + val0 = val0 - (val0 % range.step); + + // Prepare and start event listeners. + bool listening0 = false; + bool listening1 = false; + std::condition_variable eventCond; + std::thread listener0 = std::thread([cmd, val0, &aNotification0, &frameHandlerPrimary, + &listening0, &listening1, &eventCond]() { + listening0 = true; + if (listening1) { + eventCond.notify_all(); + } + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back(static_cast(cmd)); + aTargetEvent.payload.push_back(val0); + if (!frameHandlerPrimary->waitForEvent(aTargetEvent, aNotification0)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + std::thread listener1 = std::thread([cmd, val0, &aNotification1, &frameHandlerSecondary, + &listening0, &listening1, &eventCond]() { + listening1 = true; + if (listening0) { + eventCond.notify_all(); + } + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back(static_cast(cmd)); + aTargetEvent.payload.push_back(val0); + if (!frameHandlerSecondary->waitForEvent(aTargetEvent, aNotification1)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a listening thread starts. + std::mutex eventLock; + std::unique_lock lock(eventLock); + auto timer = std::chrono::system_clock::now(); + while (!listening0 || !listening1) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + // Try to program a parameter + values.clear(); + ASSERT_TRUE(pPrimaryCam->setIntParameter(cmd, val0, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(val0, v) << "Values are not matched."; + } + + // Join a listening thread. + if (listener0.joinable()) { + listener0.join(); + } + if (listener1.joinable()) { + listener1.join(); + } + + // Verify a change notification + ASSERT_EQ(EvsEventType::PARAMETER_CHANGED, + static_cast(aNotification0.aType)); + ASSERT_EQ(EvsEventType::PARAMETER_CHANGED, + static_cast(aNotification1.aType)); + ASSERT_GE(aNotification0.payload.size(), 2); + ASSERT_GE(aNotification1.payload.size(), 2); + ASSERT_EQ(cmd, static_cast(aNotification0.payload[0])); + ASSERT_EQ(cmd, static_cast(aNotification1.payload[0])); + for (auto&& v : values) { + ASSERT_EQ(v, aNotification0.payload[1]); + ASSERT_EQ(v, aNotification1.payload[1]); + } + + // Clients expects to receive a parameter change notification + // whenever a primary client client adjusts it. + values.clear(); + ASSERT_TRUE(pPrimaryCam->getIntParameter(cmd, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(val0, v) << "Values are not matched."; + } + } + + // Try to adjust a parameter via non-primary client + values.clear(); + ASSERT_FALSE(pSecondaryCam->setIntParameter(camSecondaryCmds[0], val0, &values).isOk()); + + // Non-primary client attempts to be a primary client + ASSERT_FALSE(pSecondaryCam->setPrimaryClient().isOk()); + + // Primary client retires from a primary client role + bool listening = false; + std::condition_variable eventCond; + std::thread listener = + std::thread([&aNotification0, &frameHandlerSecondary, &listening, &eventCond]() { + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::MASTER_RELEASED; + if (!frameHandlerSecondary->waitForEvent(aTargetEvent, aNotification0, true)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + std::mutex eventLock; + auto timer = std::chrono::system_clock::now(); + std::unique_lock lock(eventLock); + while (!listening) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + ASSERT_TRUE(pPrimaryCam->unsetPrimaryClient().isOk()); + + if (listener.joinable()) { + listener.join(); + } + ASSERT_EQ(EvsEventType::MASTER_RELEASED, static_cast(aNotification0.aType)); + + // Try to adjust a parameter after being retired + values.clear(); + ASSERT_FALSE(pPrimaryCam->setIntParameter(camPrimaryCmds[0], val0, &values).isOk()); + + // Non-primary client becomes a primary client + ASSERT_TRUE(pSecondaryCam->setPrimaryClient().isOk()); + + // Try to adjust a parameter via new primary client + for (auto& cmd : camSecondaryCmds) { + // Get a valid parameter value range + ParameterRange range; + ASSERT_TRUE(pSecondaryCam->getIntParameterRange(cmd, &range).isOk()); + + values.clear(); + if (cmd == CameraParam::ABSOLUTE_FOCUS) { + // Try to turn off auto-focus + values.clear(); + ASSERT_TRUE( + pSecondaryCam->setIntParameter(CameraParam::AUTO_FOCUS, 0, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(v, 0); + } + } + + // Calculate a parameter value to program. This is being rounding down. + val0 = range.min + (std::rand() % (range.max - range.min)); + val0 = val0 - (val0 % range.step); + + // Prepare and start event listeners. + bool listening0 = false; + bool listening1 = false; + std::condition_variable eventCond; + std::thread listener0 = std::thread([&]() { + listening0 = true; + if (listening1) { + eventCond.notify_all(); + } + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back(static_cast(cmd)); + aTargetEvent.payload.push_back(val0); + if (!frameHandlerPrimary->waitForEvent(aTargetEvent, aNotification0)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + std::thread listener1 = std::thread([&]() { + listening1 = true; + if (listening0) { + eventCond.notify_all(); + } + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back(static_cast(cmd)); + aTargetEvent.payload.push_back(val0); + if (!frameHandlerSecondary->waitForEvent(aTargetEvent, aNotification1)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a listening thread starts. + std::mutex eventLock; + std::unique_lock lock(eventLock); + auto timer = std::chrono::system_clock::now(); + while (!listening0 || !listening1) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + // Try to program a parameter + values.clear(); + ASSERT_TRUE(pSecondaryCam->setIntParameter(cmd, val0, &values).isOk()); + + // Clients expects to receive a parameter change notification + // whenever a primary client client adjusts it. + values.clear(); + ASSERT_TRUE(pSecondaryCam->getIntParameter(cmd, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(val0, v) << "Values are not matched."; + } + + // Join a listening thread. + if (listener0.joinable()) { + listener0.join(); + } + if (listener1.joinable()) { + listener1.join(); + } + + // Verify a change notification + ASSERT_EQ(EvsEventType::PARAMETER_CHANGED, + static_cast(aNotification0.aType)); + ASSERT_EQ(EvsEventType::PARAMETER_CHANGED, + static_cast(aNotification1.aType)); + ASSERT_GE(aNotification0.payload.size(), 2); + ASSERT_GE(aNotification1.payload.size(), 2); + ASSERT_EQ(cmd, static_cast(aNotification0.payload[0])); + ASSERT_EQ(cmd, static_cast(aNotification1.payload[0])); + for (auto&& v : values) { + ASSERT_EQ(v, aNotification0.payload[1]); + ASSERT_EQ(v, aNotification1.payload[1]); + } + } + + // New primary client retires from the role + ASSERT_TRUE(pSecondaryCam->unsetPrimaryClient().isOk()); + + // Shutdown + frameHandlerPrimary->shutdown(); + frameHandlerSecondary->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pPrimaryCam).isOk()); + ASSERT_TRUE(mEnumerator->closeCamera(pSecondaryCam).isOk()); + mActiveCameras.clear(); + } +} + +/* + * HighPriorityCameraClient: + * EVS client, which owns the display, is priortized and therefore can take over + * a primary client role from other EVS clients without the display. + */ +TEST_P(EvsAidlTest, HighPriorityCameraClient) { + LOG(INFO) << "Starting HighPriorityCameraClient test"; + + if (mIsHwModule) { + // This test is not for HW module implementation. + return; + } + + // Get the camera list + loadCameraList(); + + // Request available display IDs + uint8_t targetDisplayId = 0; + std::vector displayIds; + ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk()); + EXPECT_GT(displayIds.size(), 0); + targetDisplayId = displayIds[0]; + + // Request exclusive access to the EVS display + std::shared_ptr pDisplay; + ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); + EXPECT_NE(pDisplay, nullptr); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + // Create two clients + std::shared_ptr pCam0; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam0).isOk()); + EXPECT_NE(pCam0, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam0); + + std::shared_ptr pCam1; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam1).isOk()); + EXPECT_NE(pCam1, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam1); + + // Get the parameter list; this test will use the first command in both + // lists. + std::vector cam0Cmds, cam1Cmds; + ASSERT_TRUE(pCam0->getParameterList(&cam0Cmds).isOk()); + ASSERT_TRUE(pCam1->getParameterList(&cam1Cmds).isOk()); + if (cam0Cmds.size() < 1 || cam1Cmds.size() < 1) { + // Cannot execute this test. + return; + } + + // Set up a frame receiver object which will fire up its own thread. + std::shared_ptr frameHandler0 = ndk::SharedRefBase::make( + pCam0, cam, nullptr, FrameHandler::eAutoReturn); + std::shared_ptr frameHandler1 = ndk::SharedRefBase::make( + pCam1, cam, nullptr, FrameHandler::eAutoReturn); + EXPECT_NE(frameHandler0, nullptr); + EXPECT_NE(frameHandler1, nullptr); + + // Activate the display + ASSERT_TRUE(pDisplay->setDisplayState(DisplayState::VISIBLE_ON_NEXT_FRAME).isOk()); + + // Start the camera's video stream + ASSERT_TRUE(frameHandler0->startStream()); + ASSERT_TRUE(frameHandler1->startStream()); + + // Ensure the stream starts + frameHandler0->waitForFrameCount(1); + frameHandler1->waitForFrameCount(1); + + // Client 1 becomes a primary client and programs a parameter. + + // Get a valid parameter value range + ParameterRange range; + ASSERT_TRUE(pCam1->getIntParameterRange(cam1Cmds[0], &range).isOk()); + + // Client1 becomes a primary client + ASSERT_TRUE(pCam1->setPrimaryClient().isOk()); + + std::vector values; + EvsEventDesc aTargetEvent = {}; + EvsEventDesc aNotification = {}; + bool listening = false; + std::mutex eventLock; + std::condition_variable eventCond; + if (cam1Cmds[0] == CameraParam::ABSOLUTE_FOCUS) { + std::thread listener = + std::thread([&frameHandler0, &aNotification, &listening, &eventCond] { + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back( + static_cast(CameraParam::AUTO_FOCUS)); + aTargetEvent.payload.push_back(0); + if (!frameHandler0->waitForEvent(aTargetEvent, aNotification)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a lister starts. + std::unique_lock lock(eventLock); + auto timer = std::chrono::system_clock::now(); + while (!listening) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + // Try to turn off auto-focus + ASSERT_TRUE(pCam1->setIntParameter(CameraParam::AUTO_FOCUS, 0, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(v, 0); + } + + // Join a listener + if (listener.joinable()) { + listener.join(); + } + + // Make sure AUTO_FOCUS is off. + ASSERT_EQ(static_cast(aNotification.aType), + EvsEventType::PARAMETER_CHANGED); + } + + // Try to program a parameter with a random value [minVal, maxVal] after + // rounding it down. + int32_t val0 = range.min + (std::rand() % (range.max - range.min)); + val0 = val0 - (val0 % range.step); + + std::thread listener = std::thread( + [&frameHandler1, &aNotification, &listening, &eventCond, &cam1Cmds, val0] { + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back(static_cast(cam1Cmds[0])); + aTargetEvent.payload.push_back(val0); + if (!frameHandler1->waitForEvent(aTargetEvent, aNotification)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a lister starts. + listening = false; + std::unique_lock lock(eventLock); + auto timer = std::chrono::system_clock::now(); + while (!listening) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + values.clear(); + ASSERT_TRUE(pCam1->setIntParameter(cam1Cmds[0], val0, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(val0, v); + } + + // Join a listener + if (listener.joinable()) { + listener.join(); + } + + // Verify a change notification + ASSERT_EQ(static_cast(aNotification.aType), EvsEventType::PARAMETER_CHANGED); + ASSERT_GE(aNotification.payload.size(), 2); + ASSERT_EQ(static_cast(aNotification.payload[0]), cam1Cmds[0]); + for (auto&& v : values) { + ASSERT_EQ(v, aNotification.payload[1]); + } + + listener = std::thread([&frameHandler1, &aNotification, &listening, &eventCond] { + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::MASTER_RELEASED; + if (!frameHandler1->waitForEvent(aTargetEvent, aNotification, true)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a lister starts. + listening = false; + lock.lock(); + timer = std::chrono::system_clock::now(); + while (!listening) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + // Client 0 steals a primary client role + ASSERT_TRUE(pCam0->forcePrimaryClient(pDisplay).isOk()); + + // Join a listener + if (listener.joinable()) { + listener.join(); + } + + ASSERT_EQ(static_cast(aNotification.aType), EvsEventType::MASTER_RELEASED); + + // Client 0 programs a parameter + val0 = range.min + (std::rand() % (range.max - range.min)); + + // Rounding down + val0 = val0 - (val0 % range.step); + + if (cam0Cmds[0] == CameraParam::ABSOLUTE_FOCUS) { + std::thread listener = + std::thread([&frameHandler1, &aNotification, &listening, &eventCond] { + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back( + static_cast(CameraParam::AUTO_FOCUS)); + aTargetEvent.payload.push_back(0); + if (!frameHandler1->waitForEvent(aTargetEvent, aNotification)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a lister starts. + std::unique_lock lock(eventLock); + auto timer = std::chrono::system_clock::now(); + while (!listening) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + // Try to turn off auto-focus + values.clear(); + ASSERT_TRUE(pCam0->setIntParameter(CameraParam::AUTO_FOCUS, 0, &values).isOk()); + for (auto&& v : values) { + EXPECT_EQ(v, 0); + } + + // Join a listener + if (listener.joinable()) { + listener.join(); + } + + // Make sure AUTO_FOCUS is off. + ASSERT_EQ(static_cast(aNotification.aType), + EvsEventType::PARAMETER_CHANGED); + } + + listener = std::thread( + [&frameHandler0, &aNotification, &listening, &eventCond, &cam0Cmds, val0] { + listening = true; + eventCond.notify_all(); + + EvsEventDesc aTargetEvent; + aTargetEvent.aType = EvsEventType::PARAMETER_CHANGED; + aTargetEvent.payload.push_back(static_cast(cam0Cmds[0])); + aTargetEvent.payload.push_back(val0); + if (!frameHandler0->waitForEvent(aTargetEvent, aNotification)) { + LOG(WARNING) << "A timer is expired before a target event is fired."; + } + }); + + // Wait until a lister starts. + listening = false; + timer = std::chrono::system_clock::now(); + lock.lock(); + while (!listening) { + eventCond.wait_until(lock, timer + 1s); + } + lock.unlock(); + + values.clear(); + ASSERT_TRUE(pCam0->setIntParameter(cam0Cmds[0], val0, &values).isOk()); + + // Join a listener + if (listener.joinable()) { + listener.join(); + } + // Verify a change notification + ASSERT_EQ(static_cast(aNotification.aType), EvsEventType::PARAMETER_CHANGED); + ASSERT_GE(aNotification.payload.size(), 2); + ASSERT_EQ(static_cast(aNotification.payload[0]), cam0Cmds[0]); + for (auto&& v : values) { + ASSERT_EQ(v, aNotification.payload[1]); + } + + // Turn off the display (yes, before the stream stops -- it should be handled) + ASSERT_TRUE(pDisplay->setDisplayState(DisplayState::NOT_VISIBLE).isOk()); + + // Shut down the streamer + frameHandler0->shutdown(); + frameHandler1->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam0).isOk()); + ASSERT_TRUE(mEnumerator->closeCamera(pCam1).isOk()); + mActiveCameras.clear(); + } + + // Explicitly release the display + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); +} + +/* + * CameraUseStreamConfigToDisplay: + * End to end test of data flowing from the camera to the display. Similar to + * CameraToDisplayRoundTrip test case but this case retrieves available stream + * configurations from EVS and uses one of them to start a video stream. + */ +TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) { + LOG(INFO) << "Starting CameraUseStreamConfigToDisplay test"; + + // Get the camera list + loadCameraList(); + + // Request available display IDs + uint8_t targetDisplayId = 0; + std::vector displayIds; + ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk()); + EXPECT_GT(displayIds.size(), 0); + targetDisplayId = displayIds[0]; + + // Request exclusive access to the EVS display + std::shared_ptr pDisplay; + ASSERT_TRUE(mEnumerator->openDisplay(targetDisplayId, &pDisplay).isOk()); + EXPECT_NE(pDisplay, nullptr); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + // choose a configuration that has a frame rate faster than minReqFps. + Stream targetCfg = {}; + const int32_t minReqFps = 15; + int32_t maxArea = 0; + camera_metadata_entry_t streamCfgs; + bool foundCfg = false; + if (!find_camera_metadata_entry(reinterpret_cast(cam.metadata.data()), + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + &streamCfgs)) { + // Stream configurations are found in metadata + RawStreamConfig* ptr = reinterpret_cast(streamCfgs.data.i32); + for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && + ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { + if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) { + targetCfg.width = ptr->width; + targetCfg.height = ptr->height; + + maxArea = ptr->width * ptr->height; + foundCfg = true; + } + } + ++ptr; + } + } + targetCfg.format = static_cast(HAL_PIXEL_FORMAT_RGBA_8888); + + if (!foundCfg) { + // Current EVS camera does not provide stream configurations in the + // metadata. + continue; + } + + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + EXPECT_NE(pCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam); + + // Set up a frame receiver object which will fire up its own thread. + std::shared_ptr frameHandler = ndk::SharedRefBase::make( + pCam, cam, pDisplay, FrameHandler::eAutoReturn); + EXPECT_NE(frameHandler, nullptr); + + // Activate the display + ASSERT_TRUE(pDisplay->setDisplayState(DisplayState::VISIBLE_ON_NEXT_FRAME).isOk()); + + // Start the camera's video stream + ASSERT_TRUE(frameHandler->startStream()); + + // Wait a while to let the data flow + static const int kSecondsToWait = 5; + const int streamTimeMs = + kSecondsToWait * kSecondsToMilliseconds - kMaxStreamStartMilliseconds; + const unsigned minimumFramesExpected = + streamTimeMs * kMinimumFramesPerSecond / kSecondsToMilliseconds; + sleep(kSecondsToWait); + unsigned framesReceived = 0; + unsigned framesDisplayed = 0; + frameHandler->getFramesCounters(&framesReceived, &framesDisplayed); + EXPECT_EQ(framesReceived, framesDisplayed); + EXPECT_GE(framesDisplayed, minimumFramesExpected); + + // Turn off the display (yes, before the stream stops -- it should be handled) + ASSERT_TRUE(pDisplay->setDisplayState(DisplayState::NOT_VISIBLE).isOk()); + + // Shut down the streamer + frameHandler->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.clear(); + } + + // Explicitly release the display + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); +} + +/* + * MultiCameraStreamUseConfig: + * Verify that each client can start and stop video streams on the same + * underlying camera with same configuration. + */ +TEST_P(EvsAidlTest, MultiCameraStreamUseConfig) { + LOG(INFO) << "Starting MultiCameraStream test"; + + if (mIsHwModule) { + // This test is not for HW module implementation. + return; + } + + // Get the camera list + loadCameraList(); + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + // choose a configuration that has a frame rate faster than minReqFps. + Stream targetCfg = {}; + const int32_t minReqFps = 15; + int32_t maxArea = 0; + camera_metadata_entry_t streamCfgs; + bool foundCfg = false; + if (!find_camera_metadata_entry(reinterpret_cast(cam.metadata.data()), + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + &streamCfgs)) { + // Stream configurations are found in metadata + RawStreamConfig* ptr = reinterpret_cast(streamCfgs.data.i32); + for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) { + if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && + ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) { + if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) { + targetCfg.width = ptr->width; + targetCfg.height = ptr->height; + + maxArea = ptr->width * ptr->height; + foundCfg = true; + } + } + ++ptr; + } + } + targetCfg.format = static_cast(HAL_PIXEL_FORMAT_RGBA_8888); + + if (!foundCfg) { + LOG(INFO) << "Device " << cam.id + << " does not provide a list of supported stream configurations, skipped"; + continue; + } + + // Create the first camera client with a selected stream configuration. + std::shared_ptr pCam0; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam0).isOk()); + EXPECT_NE(pCam0, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam0); + + // Try to create the second camera client with different stream + // configuration. + int32_t id = targetCfg.id; + targetCfg.id += 1; // EVS manager sees only the stream id. + std::shared_ptr pCam1; + ASSERT_FALSE(mEnumerator->openCamera(cam.id, targetCfg, &pCam1).isOk()); + + // Try again with same stream configuration. + targetCfg.id = id; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam1).isOk()); + EXPECT_NE(pCam1, nullptr); + + // Set up per-client frame receiver objects which will fire up its own thread + std::shared_ptr frameHandler0 = ndk::SharedRefBase::make( + pCam0, cam, nullptr, FrameHandler::eAutoReturn); + std::shared_ptr frameHandler1 = ndk::SharedRefBase::make( + pCam1, cam, nullptr, FrameHandler::eAutoReturn); + EXPECT_NE(frameHandler0, nullptr); + EXPECT_NE(frameHandler1, nullptr); + + // Start the camera's video stream via client 0 + ASSERT_TRUE(frameHandler0->startStream()); + ASSERT_TRUE(frameHandler1->startStream()); + + // Ensure the stream starts + frameHandler0->waitForFrameCount(1); + frameHandler1->waitForFrameCount(1); + + nsecs_t firstFrame = systemTime(SYSTEM_TIME_MONOTONIC); + + // Wait a bit, then ensure both clients get at least the required minimum number of frames + sleep(5); + nsecs_t end = systemTime(SYSTEM_TIME_MONOTONIC); + unsigned framesReceived0 = 0, framesReceived1 = 0; + frameHandler0->getFramesCounters(&framesReceived0, nullptr); + frameHandler1->getFramesCounters(&framesReceived1, nullptr); + framesReceived0 = framesReceived0 - 1; // Back out the first frame we already waited for + framesReceived1 = framesReceived1 - 1; // Back out the first frame we already waited for + nsecs_t runTime = end - firstFrame; + float framesPerSecond0 = framesReceived0 / (runTime * kNanoToSeconds); + float framesPerSecond1 = framesReceived1 / (runTime * kNanoToSeconds); + LOG(INFO) << "Measured camera rate " << std::scientific << framesPerSecond0 << " fps and " + << framesPerSecond1 << " fps"; + EXPECT_GE(framesPerSecond0, kMinimumFramesPerSecond); + EXPECT_GE(framesPerSecond1, kMinimumFramesPerSecond); + + // Shutdown one client + frameHandler0->shutdown(); + + // Read frame counters again + frameHandler0->getFramesCounters(&framesReceived0, nullptr); + frameHandler1->getFramesCounters(&framesReceived1, nullptr); + + // Wait a bit again + sleep(5); + unsigned framesReceivedAfterStop0 = 0, framesReceivedAfterStop1 = 0; + frameHandler0->getFramesCounters(&framesReceivedAfterStop0, nullptr); + frameHandler1->getFramesCounters(&framesReceivedAfterStop1, nullptr); + EXPECT_EQ(framesReceived0, framesReceivedAfterStop0); + EXPECT_LT(framesReceived1, framesReceivedAfterStop1); + + // Shutdown another + frameHandler1->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam0).isOk()); + ASSERT_TRUE(mEnumerator->closeCamera(pCam1).isOk()); + mActiveCameras.clear(); + } +} + +/* + * LogicalCameraMetadata: + * Opens logical camera reported by the enumerator and validate its metadata by + * checking its capability and locating supporting physical camera device + * identifiers. + */ +TEST_P(EvsAidlTest, LogicalCameraMetadata) { + LOG(INFO) << "Starting LogicalCameraMetadata test"; + + // Get the camera list + loadCameraList(); + + // Open and close each camera twice + for (auto&& cam : mCameraInfo) { + bool isLogicalCam = false; + auto devices = getPhysicalCameraIds(cam.id, isLogicalCam); + if (isLogicalCam) { + ASSERT_GE(devices.size(), 1) << "Logical camera device must have at least one physical " + "camera device ID in its metadata."; + } + } +} + +/* + * CameraStreamExternalBuffering: + * This is same with CameraStreamBuffering except frame buffers are allocated by + * the test client and then imported by EVS framework. + */ +TEST_P(EvsAidlTest, CameraStreamExternalBuffering) { + LOG(INFO) << "Starting CameraStreamExternalBuffering test"; + + // Arbitrary constant (should be > 1 and not too big) + static const unsigned int kBuffersToHold = 3; + + // Get the camera list + loadCameraList(); + + // Acquire the graphics buffer allocator + android::GraphicBufferAllocator& alloc(android::GraphicBufferAllocator::get()); + const auto usage = + GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_OFTEN; + + // Test each reported camera + for (auto&& cam : mCameraInfo) { + // Read a target resolution from the metadata + Stream targetCfg = getFirstStreamConfiguration( + reinterpret_cast(cam.metadata.data())); + ASSERT_GT(targetCfg.width, 0); + ASSERT_GT(targetCfg.height, 0); + + // Allocate buffers to use + std::vector buffers; + buffers.resize(kBuffersToHold); + for (auto i = 0; i < kBuffersToHold; ++i) { + unsigned pixelsPerLine; + buffer_handle_t memHandle = nullptr; + android::status_t result = + alloc.allocate(targetCfg.width, targetCfg.height, + static_cast(targetCfg.format), + /* layerCount = */ 1, usage, &memHandle, &pixelsPerLine, + /* graphicBufferId = */ 0, + /* requestorName = */ "CameraStreamExternalBufferingTest"); + if (result != android::NO_ERROR) { + LOG(ERROR) << __FUNCTION__ << " failed to allocate memory."; + // Release previous allocated buffers + for (auto j = 0; j < i; j++) { + alloc.free(::android::dupFromAidl(buffers[i].buffer.handle)); + } + return; + } else { + BufferDesc buf; + HardwareBufferDescription* pDesc = + reinterpret_cast(&buf.buffer.description); + pDesc->width = targetCfg.width; + pDesc->height = targetCfg.height; + pDesc->layers = 1; + pDesc->format = targetCfg.format; + pDesc->usage = static_cast(usage); + pDesc->stride = pixelsPerLine; + buf.buffer.handle = ::android::dupToAidl(memHandle); + buf.bufferId = i; // Unique number to identify this buffer + buffers[i] = std::move(buf); + } + } + + bool isLogicalCam = false; + getPhysicalCameraIds(cam.id, isLogicalCam); + + std::shared_ptr pCam; + ASSERT_TRUE(mEnumerator->openCamera(cam.id, targetCfg, &pCam).isOk()); + EXPECT_NE(pCam, nullptr); + + // Store a camera handle for a clean-up + mActiveCameras.push_back(pCam); + + // Request to import buffers + int delta = 0; + auto status = pCam->importExternalBuffers(buffers, &delta); + if (isLogicalCam) { + ASSERT_FALSE(status.isOk()); + continue; + } + + ASSERT_TRUE(status.isOk()); + EXPECT_GE(delta, kBuffersToHold); + + // Set up a frame receiver object which will fire up its own thread. + std::shared_ptr frameHandler = ndk::SharedRefBase::make( + pCam, cam, nullptr, FrameHandler::eNoAutoReturn); + EXPECT_NE(frameHandler, nullptr); + + // Start the camera's video stream + ASSERT_TRUE(frameHandler->startStream()); + + // Check that the video stream stalls once we've gotten exactly the number of buffers + // we requested since we told the frameHandler not to return them. + sleep(1); // 1 second should be enough for at least 5 frames to be delivered worst case + unsigned framesReceived = 0; + frameHandler->getFramesCounters(&framesReceived, nullptr); + ASSERT_LE(kBuffersToHold, framesReceived) << "Stream didn't stall at expected buffer limit"; + + // Give back one buffer + EXPECT_TRUE(frameHandler->returnHeldBuffer()); + + // Once we return a buffer, it shouldn't take more than 1/10 second to get a new one + // filled since we require 10fps minimum -- but give a 10% allowance just in case. + unsigned framesReceivedAfter = 0; + usleep(110 * kMillisecondsToMicroseconds); + frameHandler->getFramesCounters(&framesReceivedAfter, nullptr); + EXPECT_EQ(framesReceived + 1, framesReceivedAfter) << "Stream should've resumed"; + + // Even when the camera pointer goes out of scope, the FrameHandler object will + // keep the stream alive unless we tell it to shutdown. + // Also note that the FrameHandle and the Camera have a mutual circular reference, so + // we have to break that cycle in order for either of them to get cleaned up. + frameHandler->shutdown(); + + // Explicitly release the camera + ASSERT_TRUE(mEnumerator->closeCamera(pCam).isOk()); + mActiveCameras.clear(); + // Release buffers + for (auto& b : buffers) { + alloc.free(::android::dupFromAidl(b.buffer.handle)); + } + buffers.resize(0); + } +} + +TEST_P(EvsAidlTest, DeviceStatusCallbackRegistration) { + std::shared_ptr cb = + ndk::SharedRefBase::make(); + ndk::ScopedAStatus status = mEnumerator->registerStatusCallback(cb); + if (mIsHwModule) { + ASSERT_TRUE(status.isOk()); + } else { + // A callback registration may fail if a HIDL EVS HAL implementation is + // running. + ASSERT_TRUE(status.isOk() || + status.getServiceSpecificError() == static_cast(EvsResult::NOT_SUPPORTED)); + } +} + +/* + * UltrasonicsArrayOpenClean: + * Opens each ultrasonics arrays reported by the enumerator and then explicitly closes it via a + * call to closeUltrasonicsArray. Then repeats the test to ensure all ultrasonics arrays + * can be reopened. + */ +TEST_P(EvsAidlTest, UltrasonicsArrayOpenClean) { + LOG(INFO) << "Starting UltrasonicsArrayOpenClean test"; + + // Get the ultrasonics array list + loadUltrasonicsArrayList(); + + // Open and close each ultrasonics array twice + for (auto&& ultraInfo : mUltrasonicsArraysInfo) { + for (int pass = 0; pass < 2; pass++) { + std::shared_ptr pUltrasonicsArray; + ASSERT_TRUE( + mEnumerator + ->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId, &pUltrasonicsArray) + .isOk()); + EXPECT_NE(pUltrasonicsArray, nullptr); + + // Verify that this ultrasonics array self-identifies correctly + UltrasonicsArrayDesc desc; + ASSERT_TRUE(pUltrasonicsArray->getUltrasonicArrayInfo(&desc).isOk()); + EXPECT_EQ(ultraInfo.ultrasonicsArrayId, desc.ultrasonicsArrayId); + LOG(DEBUG) << "Found ultrasonics array " << ultraInfo.ultrasonicsArrayId; + + // Explicitly close the ultrasonics array so resources are released right away + ASSERT_TRUE(mEnumerator->closeUltrasonicsArray(pUltrasonicsArray).isOk()); + } + } +} + +// Starts a stream and verifies all data received is valid. +TEST_P(EvsAidlTest, UltrasonicsVerifyStreamData) { + LOG(INFO) << "Starting UltrasonicsVerifyStreamData"; + + // Get the ultrasonics array list + loadUltrasonicsArrayList(); + + // For each ultrasonics array. + for (auto&& ultraInfo : mUltrasonicsArraysInfo) { + LOG(DEBUG) << "Testing ultrasonics array: " << ultraInfo.ultrasonicsArrayId; + + std::shared_ptr pUltrasonicsArray; + ASSERT_TRUE( + mEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId, &pUltrasonicsArray) + .isOk()); + EXPECT_NE(pUltrasonicsArray, nullptr); + + std::shared_ptr frameHandler = + ndk::SharedRefBase::make(pUltrasonicsArray); + EXPECT_NE(frameHandler, nullptr); + + // Start stream. + ASSERT_TRUE(pUltrasonicsArray->startStream(frameHandler).isOk()); + + // Wait 5 seconds to receive frames. + sleep(5); + + // Stop stream. + ASSERT_TRUE(pUltrasonicsArray->stopStream().isOk()); + + EXPECT_GT(frameHandler->getReceiveFramesCount(), 0); + EXPECT_TRUE(frameHandler->areAllFramesValid()); + + // Explicitly close the ultrasonics array so resources are released right away + ASSERT_TRUE(mEnumerator->closeUltrasonicsArray(pUltrasonicsArray).isOk()); + } +} + +// Sets frames in flight before and after start of stream and verfies success. +TEST_P(EvsAidlTest, UltrasonicsSetFramesInFlight) { + LOG(INFO) << "Starting UltrasonicsSetFramesInFlight"; + + // Get the ultrasonics array list + loadUltrasonicsArrayList(); + + // For each ultrasonics array. + for (auto&& ultraInfo : mUltrasonicsArraysInfo) { + LOG(DEBUG) << "Testing ultrasonics array: " << ultraInfo.ultrasonicsArrayId; + + std::shared_ptr pUltrasonicsArray; + ASSERT_TRUE( + mEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId, &pUltrasonicsArray) + .isOk()); + EXPECT_NE(pUltrasonicsArray, nullptr); + + ASSERT_TRUE(pUltrasonicsArray->setMaxFramesInFlight(10).isOk()); + + std::shared_ptr frameHandler = + ndk::SharedRefBase::make(pUltrasonicsArray); + EXPECT_NE(frameHandler, nullptr); + + // Start stream. + ASSERT_TRUE(pUltrasonicsArray->startStream(frameHandler).isOk()); + ASSERT_TRUE(pUltrasonicsArray->setMaxFramesInFlight(5).isOk()); + + // Stop stream. + ASSERT_TRUE(pUltrasonicsArray->stopStream().isOk()); + + // Explicitly close the ultrasonics array so resources are released right away + ASSERT_TRUE(mEnumerator->closeUltrasonicsArray(pUltrasonicsArray).isOk()); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EvsAidlTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, EvsAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IEvsEnumerator::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/automotive/occupant_awareness/aidl/Android.bp b/automotive/occupant_awareness/aidl/Android.bp index 1b180d92d7754829eab1df125a28fede357a1458..1a8124c011d72e4b2ccada79295136375ad5299b 100644 --- a/automotive/occupant_awareness/aidl/Android.bp +++ b/automotive/occupant_awareness/aidl/Android.bp @@ -16,7 +16,12 @@ aidl_interface { stability: "vintf", backend: { java: { - platform_apis: true, + sdk_version: "module_current", + min_sdk_version: "31", + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], }, }, versions: ["1"], diff --git a/automotive/vehicle/2.0/Android.bp b/automotive/vehicle/2.0/Android.bp index e2164b1d9dc33feafbf6d42e21d5aa4e97138d7e..5c2e0ea4558072cf9f44f3fac277fe62883a5c0f 100644 --- a/automotive/vehicle/2.0/Android.bp +++ b/automotive/vehicle/2.0/Android.bp @@ -21,4 +21,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], } diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp index ba3309898bbae7467bc7cdf41c061379c43fb880..0d3253b9f878cea90311607457d658eb6845b26e 100644 --- a/automotive/vehicle/2.0/default/Android.bp +++ b/automotive/vehicle/2.0/default/Android.bp @@ -47,6 +47,7 @@ cc_defaults { cc_library_headers { name: "vhal_v2_0_common_headers", + visibility: ["//visibility:public"], vendor: true, export_include_dirs: ["common/include/vhal_v2_0"], } @@ -58,6 +59,7 @@ cc_library { defaults: ["vhal_v2_0_target_defaults"], srcs: [ "common/src/Obd2SensorStore.cpp", + "common/src/ProtoMessageConverter.cpp", "common/src/SubscriptionManager.cpp", "common/src/VehicleHalManager.cpp", "common/src/VehicleObjectPool.cpp", @@ -68,9 +70,13 @@ cc_library { ], shared_libs: [ "libbase", + "libprotobuf-cpp-lite", ], local_include_dirs: ["common/include/vhal_v2_0"], export_include_dirs: ["common/include"], + static_libs: [ + "android.hardware.automotive.vehicle@2.0-libproto-native", + ], } // Vehicle default VehicleHAL implementation @@ -80,24 +86,18 @@ cc_library_static { defaults: ["vhal_v2_0_target_defaults"], cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"], srcs: [ - "impl/vhal_v2_0/CommConn.cpp", - "impl/vhal_v2_0/EmulatedVehicleConnector.cpp", - "impl/vhal_v2_0/EmulatedVehicleHal.cpp", + "impl/vhal_v2_0/DefaultVehicleHal.cpp", "impl/vhal_v2_0/VehicleHalClient.cpp", - "impl/vhal_v2_0/VehicleHalServer.cpp", - "impl/vhal_v2_0/VehicleEmulator.cpp", - "impl/vhal_v2_0/PipeComm.cpp", - "impl/vhal_v2_0/ProtoMessageConverter.cpp", - "impl/vhal_v2_0/SocketComm.cpp", + "impl/vhal_v2_0/DefaultVehicleHalServer.cpp", "impl/vhal_v2_0/LinearFakeValueGenerator.cpp", "impl/vhal_v2_0/JsonFakeValueGenerator.cpp", "impl/vhal_v2_0/GeneratorHub.cpp", - "impl/vhal_v2_0/qemu_pipe.cpp", + "impl/vhal_v2_0/FakeObd2Frame.cpp", ], local_include_dirs: ["common/include/vhal_v2_0"], export_include_dirs: ["impl"], whole_static_libs: [ - "android.hardware.automotive.vehicle@2.0-emulated-user-hal-lib", + "android.hardware.automotive.vehicle@2.0-fake-user-hal-lib", "android.hardware.automotive.vehicle@2.0-manager-lib", ], shared_libs: [ @@ -110,19 +110,6 @@ cc_library_static { ], } -// Library used to emulate User HAL behavior through lshal debug requests. -cc_library_static { - name: "android.hardware.automotive.vehicle@2.0-emulated-user-hal-lib", - vendor: true, - defaults: ["vhal_v2_0_target_defaults"], - srcs: [ - "impl/vhal_v2_0/EmulatedUserHal.cpp", - ], - whole_static_libs: [ - "android.hardware.automotive.vehicle@2.0-user-hal-helper-lib", - ], -} - // Vehicle HAL Server reference impl lib cc_library_static { name: "android.hardware.automotive.vehicle@2.0-server-common-lib", @@ -133,10 +120,14 @@ cc_library_static { export_include_dirs: ["common/include"], srcs: [ "common/src/Obd2SensorStore.cpp", + "common/src/ProtoMessageConverter.cpp", "common/src/VehicleObjectPool.cpp", "common/src/VehiclePropertyStore.cpp", "common/src/VehicleUtils.cpp", ], + static_libs: [ + "android.hardware.automotive.vehicle@2.0-libproto-native", + ], } // Vehicle HAL Server default implementation @@ -151,12 +142,11 @@ cc_library_static { "impl/vhal_v2_0/GeneratorHub.cpp", "impl/vhal_v2_0/JsonFakeValueGenerator.cpp", "impl/vhal_v2_0/LinearFakeValueGenerator.cpp", - "impl/vhal_v2_0/ProtoMessageConverter.cpp", - "impl/vhal_v2_0/VehicleHalServer.cpp", + "impl/vhal_v2_0/DefaultVehicleHalServer.cpp", + "impl/vhal_v2_0/FakeObd2Frame.cpp", ], whole_static_libs: [ "android.hardware.automotive.vehicle@2.0-server-common-lib", - "android.hardware.automotive.vehicle@2.0-user-hal-helper-lib", ], static_libs: [ "android.hardware.automotive.vehicle@2.0-libproto-native", @@ -187,6 +177,16 @@ cc_test { "libbase", "libcutils", ], + // Exclude share libraries from default because they might be missing on + // some test platforms and we are using static libraries instead. + exclude_shared_libs: [ + "android.automotive.watchdog-V2-ndk", + "android.hardware.automotive.vehicle@2.0", + ], + static_libs: [ + "android.automotive.watchdog-V2-ndk", + "android.hardware.automotive.vehicle@2.0", + ], header_libs: ["libbase_headers"], test_suites: ["general-tests"], } @@ -197,22 +197,41 @@ cc_test { defaults: ["vhal_v2_0_target_defaults"], srcs: [ "impl/vhal_v2_0/tests/ProtoMessageConverter_test.cpp", + "impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp", ], static_libs: [ + "libbase", + "libcutils", + "libgmock", + "libjsoncpp", + "libprotobuf-cpp-lite", + ], + // Exclude share libraries from default because they might be missing on + // some test platforms and we are using static libraries instead. + exclude_shared_libs: [ + "android.automotive.watchdog-V2-ndk", + "android.hardware.automotive.vehicle@2.0", + ], + whole_static_libs: [ + "android.automotive.watchdog-V2-ndk", + "android.hardware.automotive.vehicle@2.0", "android.hardware.automotive.vehicle@2.0-default-impl-lib", "android.hardware.automotive.vehicle@2.0-libproto-native", - "libprotobuf-cpp-lite", + ], + data: [ + ":vhal_test_json", + ":vhal_test_override_json", ], test_suites: ["general-tests"], } cc_binary { - name: "android.hardware.automotive.vehicle@2.0-service", + name: "android.hardware.automotive.vehicle@2.0-default-service", defaults: ["vhal_v2_0_target_defaults"], vintf_fragments: [ - "android.hardware.automotive.vehicle@2.0-service.xml", + "android.hardware.automotive.vehicle@2.0-default-service.xml", ], - init_rc: ["android.hardware.automotive.vehicle@2.0-service.rc"], + init_rc: ["android.hardware.automotive.vehicle@2.0-default-service.rc"], vendor: true, relative_install_path: "hw", srcs: ["VehicleService.cpp"], @@ -223,8 +242,8 @@ cc_binary { ], static_libs: [ "android.hardware.automotive.vehicle@2.0-manager-lib", - "android.hardware.automotive.vehicle@2.0-default-impl-lib", "android.hardware.automotive.vehicle@2.0-libproto-native", + "android.hardware.automotive.vehicle@2.0-default-impl-lib", ], } diff --git a/automotive/vehicle/2.0/default/TEST_MAPPING b/automotive/vehicle/2.0/default/TEST_MAPPING new file mode 100644 index 0000000000000000000000000000000000000000..bb58700f623bb917a228f3a586274b408d3cdd02 --- /dev/null +++ b/automotive/vehicle/2.0/default/TEST_MAPPING @@ -0,0 +1,10 @@ +{ + "presubmit": [ + { + "name": "android.hardware.automotive.vehicle@2.0-manager-unit-tests" + }, + { + "name": "android.hardware.automotive.vehicle@2.0-default-impl-unit-tests" + } + ] +} diff --git a/automotive/vehicle/2.0/default/VehicleService.cpp b/automotive/vehicle/2.0/default/VehicleService.cpp index 5a48284301839809ccb81c0c09c4d5f67cf5d6af..2968232ed4964428cb05f98d1e0df758bffae28b 100644 --- a/automotive/vehicle/2.0/default/VehicleService.cpp +++ b/automotive/vehicle/2.0/default/VehicleService.cpp @@ -14,42 +14,40 @@ * limitations under the License. */ -#define LOG_TAG "automotive.vehicle@2.0-service" +#define LOG_TAG "automotive.vehicle@2.0-default-service" #include #include #include -#include -#include -#include +#include +#include #include -using namespace android; -using namespace android::hardware; -using namespace android::hardware::automotive::vehicle::V2_0; +using ::android::hardware::automotive::vehicle::V2_0::VehicleHalManager; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyStore; +using ::android::hardware::automotive::vehicle::V2_0::impl::DefaultVehicleConnector; +using ::android::hardware::automotive::vehicle::V2_0::impl::DefaultVehicleHal; int main(int /* argc */, char* /* argv */ []) { auto store = std::make_unique(); - auto connector = std::make_unique(); - auto userHal = connector->getEmulatedUserHal(); - auto hal = std::make_unique(store.get(), connector.get(), userHal); - auto emulator = std::make_unique(hal.get()); + auto connector = std::make_unique(); + auto hal = std::make_unique(store.get(), connector.get()); auto service = android::sp::make(hal.get()); connector->setValuePool(hal->getValuePool()); - configureRpcThreadpool(4, true /* callerWillJoin */); + android::hardware::configureRpcThreadpool(4, true /* callerWillJoin */); ALOGI("Registering as service..."); - status_t status = service->registerAsService(); + android::status_t status = service->registerAsService(); - if (status != OK) { + if (status != android::OK) { ALOGE("Unable to register vehicle service (%d)", status); return 1; } ALOGI("Ready"); - joinRpcThreadpool(); + android::hardware::joinRpcThreadpool(); - return 1; + return 0; } diff --git a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.rc similarity index 77% rename from automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc rename to automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.rc index 44f91347145c8a6737d4c665f7204ed7bccef58a..8279af71c9d48e96446b868068a5c3f268d26eb7 100644 --- a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc +++ b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.rc @@ -1,4 +1,4 @@ -service vendor.vehicle-hal-2.0 /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-service +service vendor.vehicle-hal-2.0 /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-default-service class early_hal user vehicle_network group system inet diff --git a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.xml b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.xml similarity index 100% rename from automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.xml rename to automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.xml diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/ProtoMessageConverter.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/ProtoMessageConverter.h similarity index 100% rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/ProtoMessageConverter.h rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/ProtoMessageConverter.h diff --git a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h index 2908a55c250fe12049b1ca795c7407b70b0ecdf8..345c356714dacd7851ec5bc22c86db86fd0076e3 100644 --- a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h +++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h @@ -20,6 +20,7 @@ #include #include +#include #include "VehicleClient.h" #include "VehicleServer.h" @@ -72,7 +73,21 @@ class IPassThroughConnector : public VehicleClientType, public VehicleServerType } bool dump(const hidl_handle& handle, const hidl_vec& options) override { - return this->onDump(handle, options); + // Calls server's onDump function and print the dumped info to the handle. + std::vector stdOptions; + for (size_t i = 0; i < options.size(); i++) { + stdOptions.push_back(options[i]); + } + IVehicleServer::DumpResult result = this->onDump(stdOptions); + int fd = handle->data[0]; + if (fd < 0) { + ALOGW("Invalid fd from HIDL handle: %d", fd); + return false; + } + if (result.buffer.size() != 0) { + dprintf(fd, "[VehicleHalServer] Dumped info: %s\n", result.buffer.c_str()); + } + return result.callerShouldDumpState; } // To be implemented: diff --git a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleServer.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleServer.h index ba9799af1bd0120cc9dc028d666495d77939342b..2c484e8462bd893e0d10a147df39708c331db921 100644 --- a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleServer.h +++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleServer.h @@ -28,6 +28,16 @@ namespace android::hardware::automotive::vehicle::V2_0 { */ class IVehicleServer { public: + // The return structure for onDump function. + struct DumpResult { + // If callerShouldDumpState is true, caller would print the information in buffer and + // continue to dump its state, otherwise would just dump the buffer and skip its own + // dumping logic. + bool callerShouldDumpState; + // The dumped information for the caller to print. + std::string buffer; + }; + IVehicleServer() = default; IVehicleServer(const IVehicleServer&) = delete; @@ -54,15 +64,9 @@ class IVehicleServer { // generated by car (ECU/fake generator/injected) virtual void onPropertyValueFromCar(const VehiclePropValue& value, bool updateStatus) = 0; - // TODO (chenhaosjtuacm): fix this since there are no HIDL in non-Android OS -#ifdef __ANDROID__ // Dump method forwarded from HIDL's debug() // If implemented, it must return whether the caller should dump its state. - virtual bool onDump(const hidl_handle& /* handle */, - const hidl_vec& /* options */) { - return true; - } -#endif // __ANDROID__ + virtual DumpResult onDump(const std::vector& options) = 0; }; } // namespace android::hardware::automotive::vehicle::V2_0 diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/ProtoMessageConverter.cpp b/automotive/vehicle/2.0/default/common/src/ProtoMessageConverter.cpp similarity index 100% rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/ProtoMessageConverter.cpp rename to automotive/vehicle/2.0/default/common/src/ProtoMessageConverter.cpp diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/CommConn.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/CommConn.cpp deleted file mode 100644 index 136b2e0758d8d508edd02dcc7e3ce80054119631..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/CommConn.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2018 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 "CommConn" - -#include - -#include -#include - -#include "CommConn.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -void CommConn::start() { - mReadThread = std::make_unique(std::bind(&CommConn::readThread, this)); -} - -void CommConn::stop() { - if (mReadThread->joinable()) { - mReadThread->join(); - } -} - -void CommConn::sendMessage(vhal_proto::EmulatorMessage const& msg) { - int numBytes = msg.ByteSize(); - std::vector buffer(static_cast(numBytes)); - if (!msg.SerializeToArray(buffer.data(), numBytes)) { - ALOGE("%s: SerializeToString failed!", __func__); - return; - } - - write(buffer); -} - -void CommConn::readThread() { - std::vector buffer; - while (isOpen()) { - buffer = read(); - if (buffer.size() == 0) { - ALOGI("%s: Read returned empty message, exiting read loop.", __func__); - break; - } - - vhal_proto::EmulatorMessage rxMsg; - if (rxMsg.ParseFromArray(buffer.data(), static_cast(buffer.size()))) { - vhal_proto::EmulatorMessage respMsg; - mMessageProcessor->processMessage(rxMsg, respMsg); - - sendMessage(respMsg); - } - } -} - -} // namespace impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/CommConn.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/CommConn.h deleted file mode 100644 index 6d36da417f220ec6d7c045c9554e3859adb56bd0..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/CommConn.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef android_hardware_automotive_vehicle_V2_0_impl_CommBase_H_ -#define android_hardware_automotive_vehicle_V2_0_impl_CommBase_H_ - -#include -#include -#include -#include - -#include "VehicleHalProto.pb.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -/** - * MessageProcess is an interface implemented by VehicleEmulator to process messages received - * over a CommConn. - */ -class MessageProcessor { - public: - virtual ~MessageProcessor() = default; - - /** - * Process a single message received over a CommConn. Populate the given respMsg with the reply - * message we should send. - */ - virtual void processMessage(vhal_proto::EmulatorMessage const& rxMsg, - vhal_proto::EmulatorMessage& respMsg) = 0; -}; - -/** - * This is the interface that both PipeComm and SocketComm use to represent a connection. The - * connection will listen for commands on a separate 'read' thread. - */ -class CommConn { - public: - CommConn(MessageProcessor* messageProcessor) : mMessageProcessor(messageProcessor) {} - - virtual ~CommConn() {} - - /** - * Start the read thread reading messages from this connection. - */ - virtual void start(); - - /** - * Closes a connection if it is open. - */ - virtual void stop(); - - /** - * Returns true if the connection is open and available to send/receive. - */ - virtual bool isOpen() = 0; - - /** - * Blocking call to read data from the connection. - * - * @return std::vector Serialized protobuf data received from emulator. This will be - * an empty vector if the connection was closed or some other error occurred. - */ - virtual std::vector read() = 0; - - /** - * Transmits a string of data to the emulator. - * - * @param data Serialized protobuf data to transmit. - * - * @return int Number of bytes transmitted, or -1 if failed. - */ - virtual int write(const std::vector& data) = 0; - - /** - * Serialized and send the given message to the other side. - */ - void sendMessage(vhal_proto::EmulatorMessage const& msg); - - protected: - std::unique_ptr mReadThread; - MessageProcessor* mMessageProcessor; - - /** - * A thread that reads messages in a loop, and responds. You can stop this thread by calling - * stop(). - */ - void readThread(); -}; - -} // namespace impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - -#endif // android_hardware_automotive_vehicle_V2_0_impl_CommBase_H_ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index 55617be30d97f600d0a41d6301af196c7dfc6287..cfbbbd322467ec0339444bed3db9ab3a26d75da2 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -493,8 +493,12 @@ const ConfigDeclaration kVehicleProperties[]{ .changeMode = VehiclePropertyChangeMode::STATIC, .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR, - FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR}}}, - + FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR, + FAN_DIRECTION_DEFROST, + FAN_DIRECTION_FACE | FAN_DIRECTION_DEFROST, + FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST, + FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | + FAN_DIRECTION_FACE}}}, {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION), .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, @@ -641,46 +645,6 @@ const ConfigDeclaration kVehicleProperties[]{ }, .initialValue = {.floatValues = {101.0f}}}, - { - .config = - { - .prop = kGenerateFakeDataControllingProperty, - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {1, 0, 0, 2, 0, 0, 0, 0, 0}, - }, - }, - - { - .config = - { - .prop = kSetIntPropertyFromVehicleForTest, - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 0, 0, 2, 1, 0, 0, 0, 0}, - }, - }, - - { - .config = - { - .prop = kSetFloatPropertyFromVehicleForTest, - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 0, 1, 0, 1, 0, 1, 0, 0}, - }, - }, - - { - .config = - { - .prop = kSetBooleanPropertyFromVehicleForTest, - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 1, 1, 0, 1, 0, 0, 0, 0}, - }, - }, - { .config = {.prop = kMixedTypePropertyForTest, .access = VehiclePropertyAccess::READ_WRITE, @@ -1072,7 +1036,7 @@ const ConfigDeclaration kVehicleProperties[]{ .access = VehiclePropertyAccess::READ, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, - .initialValue = {.int32Values = {0 /* ClusterHome */, -1 /* ClusterNone */}}, + .initialValue = {.int32Values = {0 /* ClusterHome */}}, }, { .config = diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleConnector.h similarity index 51% rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleConnector.h index 31ac7d8fb518cd22b7b52c077bcf7e0bc33a3f8f..c3affb04b3e4febf45c2c28f9988ea3b007c473b 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleConnector.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 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,14 +14,13 @@ * limitations under the License. */ -#ifndef android_hardware_automotive_vehicle_V2_0_impl_EmulatedVehicleConnector_H_ -#define android_hardware_automotive_vehicle_V2_0_impl_EmulatedVehicleConnector_H_ +#ifndef android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleConnector_H_ +#define android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleConnector_H_ #include -#include "EmulatedUserHal.h" +#include "DefaultVehicleHalServer.h" #include "VehicleHalClient.h" -#include "VehicleHalServer.h" namespace android { namespace hardware { @@ -31,21 +30,12 @@ namespace V2_0 { namespace impl { -class EmulatedVehicleConnector : public IPassThroughConnector { +class DefaultVehicleConnector + : public IPassThroughConnector { public: - EmulatedVehicleConnector() = default; + DefaultVehicleConnector() = default; - EmulatedUserHal* getEmulatedUserHal(); - - // Methods from VehicleHalServer - void triggerSendAllValues() override; - - StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) override; - - bool onDump(const hidl_handle& fd, const hidl_vec& options) override; - - private: - EmulatedUserHal mEmulatedUserHal; + void triggerSendAllValues() { this->sendAllValuesToClient(); } }; } // namespace impl @@ -56,4 +46,4 @@ class EmulatedVehicleConnector : public IPassThroughConnector +#include +#include +#include +#include +#include +#include + +#include "FakeObd2Frame.h" +#include "PropertyUtils.h" +#include "VehicleUtils.h" + +#include "DefaultVehicleHal.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { + +namespace { +constexpr std::chrono::nanoseconds kHeartBeatIntervalNs = 3s; + +const VehicleAreaConfig* getAreaConfig(const VehiclePropValue& propValue, + const VehiclePropConfig* config) { + if (isGlobalProp(propValue.prop)) { + if (config->areaConfigs.size() == 0) { + return nullptr; + } + return &(config->areaConfigs[0]); + } else { + for (auto& c : config->areaConfigs) { + if (c.areaId == propValue.areaId) { + return &c; + } + } + } + return nullptr; +} + +VehicleHal::VehiclePropValuePtr addTimestamp(VehicleHal::VehiclePropValuePtr v) { + if (v.get()) { + v->timestamp = elapsedRealtimeNano(); + } + return v; +} +} // namespace + +VehicleHal::VehiclePropValuePtr DefaultVehicleHal::createVhalHeartBeatProp() { + VehicleHal::VehiclePropValuePtr v = getValuePool()->obtainInt64(uptimeMillis()); + v->prop = static_cast(VehicleProperty::VHAL_HEARTBEAT); + v->areaId = 0; + v->status = VehiclePropertyStatus::AVAILABLE; + return v; +} + +DefaultVehicleHal::DefaultVehicleHal(VehiclePropertyStore* propStore, VehicleHalClient* client) + : mPropStore(propStore), mRecurrentTimer(getTimerAction()), mVehicleClient(client) { + initStaticConfig(); + mVehicleClient->registerPropertyValueCallback( + [this](const VehiclePropValue& value, bool updateStatus) { + onPropertyValue(value, updateStatus); + }); +} + +VehicleHal::VehiclePropValuePtr DefaultVehicleHal::getUserHalProp( + const VehiclePropValue& requestedPropValue, StatusCode* outStatus) { + auto propId = requestedPropValue.prop; + ALOGI("get(): getting value for prop %d from User HAL", propId); + const auto& ret = mFakeUserHal.onGetProperty(requestedPropValue); + VehicleHal::VehiclePropValuePtr v = nullptr; + if (!ret.ok()) { + ALOGE("get(): User HAL returned error: %s", ret.error().message().c_str()); + *outStatus = StatusCode(ret.error().code()); + } else { + auto value = ret.value().get(); + if (value != nullptr) { + ALOGI("get(): User HAL returned value: %s", toString(*value).c_str()); + v = getValuePool()->obtain(*value); + *outStatus = StatusCode::OK; + } else { + ALOGE("get(): User HAL returned null value"); + *outStatus = StatusCode::INTERNAL_ERROR; + } + } + return addTimestamp(std::move(v)); +} + +VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(const VehiclePropValue& requestedPropValue, + StatusCode* outStatus) { + auto propId = requestedPropValue.prop; + ALOGV("get(%d)", propId); + + if (mFakeUserHal.isSupported(propId)) { + return getUserHalProp(requestedPropValue, outStatus); + } + + VehiclePropValuePtr v = nullptr; + if (propId == OBD2_FREEZE_FRAME) { + v = getValuePool()->obtainComplex(); + *outStatus = fillObd2FreezeFrame(mPropStore, requestedPropValue, v.get()); + return addTimestamp(std::move(v)); + } + + if (propId == OBD2_FREEZE_FRAME_INFO) { + v = getValuePool()->obtainComplex(); + *outStatus = fillObd2DtcInfo(mPropStore, v.get()); + return addTimestamp(std::move(v)); + } + + auto internalPropValue = mPropStore->readValueOrNull(requestedPropValue); + if (internalPropValue != nullptr) { + v = getValuePool()->obtain(*internalPropValue); + } + + if (!v) { + *outStatus = StatusCode::INVALID_ARG; + } else if (v->status == VehiclePropertyStatus::AVAILABLE) { + *outStatus = StatusCode::OK; + } else { + *outStatus = StatusCode::TRY_AGAIN; + } + return addTimestamp(std::move(v)); +} + +std::vector DefaultVehicleHal::listProperties() { + return mPropStore->getAllConfigs(); +} + +bool DefaultVehicleHal::dump(const hidl_handle& fd, const hidl_vec& options) { + int nativeFd = fd->data[0]; + if (nativeFd < 0) { + ALOGW("Invalid fd from HIDL handle: %d", nativeFd); + return false; + } + if (options.size() > 0) { + if (options[0] == "--help") { + std::string buffer; + buffer += "Fake user hal usage:\n"; + buffer += mFakeUserHal.showDumpHelp(); + buffer += "\n"; + buffer += "VHAL server debug usage:\n"; + buffer += "--debughal: send debug command to VHAL server, see '--debughal --help'\n"; + buffer += "\n"; + dprintf(nativeFd, "%s", buffer.c_str()); + return false; + } else if (options[0] == kUserHalDumpOption) { + dprintf(nativeFd, "%s", mFakeUserHal.dump("").c_str()); + return false; + } + } else { + // No options, dump the fake user hal state first and then send command to VHAL server + // to dump its state. + std::string buffer; + buffer += "Fake user hal state:\n"; + buffer += mFakeUserHal.dump(" "); + buffer += "\n"; + dprintf(nativeFd, "%s", buffer.c_str()); + } + + return mVehicleClient->dump(fd, options); +} + +StatusCode DefaultVehicleHal::checkPropValue(const VehiclePropValue& value, + const VehiclePropConfig* config) { + int32_t property = value.prop; + VehiclePropertyType type = getPropType(property); + switch (type) { + case VehiclePropertyType::BOOLEAN: + case VehiclePropertyType::INT32: + if (value.value.int32Values.size() != 1) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::INT32_VEC: + if (value.value.int32Values.size() < 1) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::INT64: + if (value.value.int64Values.size() != 1) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::INT64_VEC: + if (value.value.int64Values.size() < 1) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::FLOAT: + if (value.value.floatValues.size() != 1) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::FLOAT_VEC: + if (value.value.floatValues.size() < 1) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::BYTES: + // We allow setting an empty bytes array. + break; + case VehiclePropertyType::STRING: + // We allow setting an empty string. + break; + case VehiclePropertyType::MIXED: + if (getPropGroup(property) == VehiclePropertyGroup::VENDOR) { + // We only checks vendor mixed properties. + return checkVendorMixedPropValue(value, config); + } + break; + default: + ALOGW("Unknown property type: %d", type); + return StatusCode::INVALID_ARG; + } + return StatusCode::OK; +} + +StatusCode DefaultVehicleHal::checkVendorMixedPropValue(const VehiclePropValue& value, + const VehiclePropConfig* config) { + auto configArray = config->configArray; + // configArray[0], 1 indicates the property has a String value, we allow the string value to + // be empty. + + size_t int32Count = 0; + // configArray[1], 1 indicates the property has a Boolean value. + if (configArray[1] == 1) { + int32Count++; + } + // configArray[2], 1 indicates the property has an Integer value. + if (configArray[2] == 1) { + int32Count++; + } + // configArray[3], the number indicates the size of Integer[] in the property. + int32Count += static_cast(configArray[3]); + if (value.value.int32Values.size() != int32Count) { + return StatusCode::INVALID_ARG; + } + + size_t int64Count = 0; + // configArray[4], 1 indicates the property has a Long value. + if (configArray[4] == 1) { + int64Count++; + } + // configArray[5], the number indicates the size of Long[] in the property. + int64Count += static_cast(configArray[5]); + if (value.value.int64Values.size() != int64Count) { + return StatusCode::INVALID_ARG; + } + + size_t floatCount = 0; + // configArray[6], 1 indicates the property has a Float value. + if (configArray[6] == 1) { + floatCount++; + } + // configArray[7], the number indicates the size of Float[] in the property. + floatCount += static_cast(configArray[7]); + if (value.value.floatValues.size() != floatCount) { + return StatusCode::INVALID_ARG; + } + + // configArray[8], the number indicates the size of byte[] in the property. + if (configArray[8] != 0 && value.value.bytes.size() != static_cast(configArray[8])) { + return StatusCode::INVALID_ARG; + } + return StatusCode::OK; +} + +StatusCode DefaultVehicleHal::checkValueRange(const VehiclePropValue& value, + const VehicleAreaConfig* areaConfig) { + if (areaConfig == nullptr) { + return StatusCode::OK; + } + int32_t property = value.prop; + VehiclePropertyType type = getPropType(property); + switch (type) { + case VehiclePropertyType::INT32: + if (areaConfig->minInt32Value == 0 && areaConfig->maxInt32Value == 0) { + break; + } + // We already checked this in checkPropValue. + assert(value.value.int32Values.size() > 0); + if (value.value.int32Values[0] < areaConfig->minInt32Value || + value.value.int32Values[0] > areaConfig->maxInt32Value) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::INT64: + if (areaConfig->minInt64Value == 0 && areaConfig->maxInt64Value == 0) { + break; + } + // We already checked this in checkPropValue. + assert(value.value.int64Values.size() > 0); + if (value.value.int64Values[0] < areaConfig->minInt64Value || + value.value.int64Values[0] > areaConfig->maxInt64Value) { + return StatusCode::INVALID_ARG; + } + break; + case VehiclePropertyType::FLOAT: + if (areaConfig->minFloatValue == 0 && areaConfig->maxFloatValue == 0) { + break; + } + // We already checked this in checkPropValue. + assert(value.value.floatValues.size() > 0); + if (value.value.floatValues[0] < areaConfig->minFloatValue || + value.value.floatValues[0] > areaConfig->maxFloatValue) { + return StatusCode::INVALID_ARG; + } + break; + default: + // We don't check the rest of property types. Additional logic needs to be added if + // required for real implementation. E.g., you might want to enforce the range + // checks on vector as well or you might want to check the range for mixed property. + break; + } + return StatusCode::OK; +} + +StatusCode DefaultVehicleHal::setUserHalProp(const VehiclePropValue& propValue) { + ALOGI("onSetProperty(): property %d will be handled by UserHal", propValue.prop); + + const auto& ret = mFakeUserHal.onSetProperty(propValue); + if (!ret.ok()) { + ALOGE("onSetProperty(): HAL returned error: %s", ret.error().message().c_str()); + return StatusCode(ret.error().code()); + } + auto updatedValue = ret.value().get(); + if (updatedValue != nullptr) { + ALOGI("onSetProperty(): updating property returned by HAL: %s", + toString(*updatedValue).c_str()); + onPropertyValue(*updatedValue, true); + } + return StatusCode::OK; +} + +StatusCode DefaultVehicleHal::set(const VehiclePropValue& propValue) { + if (propValue.status != VehiclePropertyStatus::AVAILABLE) { + // Android side cannot set property status - this value is the + // purview of the HAL implementation to reflect the state of + // its underlying hardware + return StatusCode::INVALID_ARG; + } + + if (mFakeUserHal.isSupported(propValue.prop)) { + return setUserHalProp(propValue); + } + + std::unordered_set powerProps(std::begin(kHvacPowerProperties), + std::end(kHvacPowerProperties)); + if (powerProps.count(propValue.prop)) { + auto hvacPowerOn = mPropStore->readValueOrNull( + toInt(VehicleProperty::HVAC_POWER_ON), + (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT | + VehicleAreaSeat::ROW_2_LEFT | VehicleAreaSeat::ROW_2_CENTER | + VehicleAreaSeat::ROW_2_RIGHT)); + + if (hvacPowerOn && hvacPowerOn->value.int32Values.size() == 1 && + hvacPowerOn->value.int32Values[0] == 0) { + return StatusCode::NOT_AVAILABLE; + } + } + + if (propValue.prop == OBD2_FREEZE_FRAME_CLEAR) { + return clearObd2FreezeFrames(mPropStore, propValue); + } + if (propValue.prop == VEHICLE_MAP_SERVICE) { + // Placeholder for future implementation of VMS property in the default hal. For + // now, just returns OK; otherwise, hal clients crash with property not supported. + return StatusCode::OK; + } + + int32_t property = propValue.prop; + const VehiclePropConfig* config = mPropStore->getConfigOrNull(property); + if (config == nullptr) { + ALOGW("no config for prop 0x%x", property); + return StatusCode::INVALID_ARG; + } + const VehicleAreaConfig* areaConfig = getAreaConfig(propValue, config); + if (!isGlobalProp(property) && areaConfig == nullptr) { + // Ignore areaId for global property. For non global property, check whether areaId is + // allowed. areaId must appear in areaConfig. + ALOGW("invalid area ID: 0x%x for prop 0x%x, not listed in config", propValue.areaId, + property); + return StatusCode::INVALID_ARG; + } + auto status = checkPropValue(propValue, config); + if (status != StatusCode::OK) { + ALOGW("invalid property value: %s", toString(propValue).c_str()); + return status; + } + status = checkValueRange(propValue, areaConfig); + if (status != StatusCode::OK) { + ALOGW("property value out of range: %s", toString(propValue).c_str()); + return status; + } + + auto currentPropValue = mPropStore->readValueOrNull(propValue); + if (currentPropValue && currentPropValue->status != VehiclePropertyStatus::AVAILABLE) { + // do not allow Android side to set() a disabled/error property + return StatusCode::NOT_AVAILABLE; + } + + // Send the value to the vehicle server, the server will talk to the (real or emulated) car + return mVehicleClient->setProperty(propValue, /*updateStatus=*/false); +} + +// Parse supported properties list and generate vector of property values to hold current values. +void DefaultVehicleHal::onCreate() { + auto configs = mVehicleClient->getAllPropertyConfig(); + + for (const auto& cfg : configs) { + if (isDiagnosticProperty(cfg)) { + // do not write an initial empty value for the diagnostic properties + // as we will initialize those separately. + continue; + } + + int32_t numAreas = isGlobalProp(cfg.prop) ? 1 : cfg.areaConfigs.size(); + + for (int i = 0; i < numAreas; i++) { + int32_t curArea = isGlobalProp(cfg.prop) ? 0 : cfg.areaConfigs[i].areaId; + + // Create a separate instance for each individual zone + VehiclePropValue prop = { + .areaId = curArea, + .prop = cfg.prop, + .status = VehiclePropertyStatus::UNAVAILABLE, + }; + // Allow the initial values to set status. + mPropStore->writeValue(prop, /*updateStatus=*/true); + } + } + + mVehicleClient->triggerSendAllValues(); + + initObd2LiveFrame(mPropStore, *mPropStore->getConfigOrDie(OBD2_LIVE_FRAME)); + initObd2FreezeFrame(mPropStore, *mPropStore->getConfigOrDie(OBD2_FREEZE_FRAME)); + + registerHeartBeatEvent(); +} + +DefaultVehicleHal::~DefaultVehicleHal() { + mRecurrentTimer.unregisterRecurrentEvent(static_cast(VehicleProperty::VHAL_HEARTBEAT)); +} + +void DefaultVehicleHal::registerHeartBeatEvent() { + mRecurrentTimer.registerRecurrentEvent(kHeartBeatIntervalNs, + static_cast(VehicleProperty::VHAL_HEARTBEAT)); +} + +VehicleHal::VehiclePropValuePtr DefaultVehicleHal::doInternalHealthCheck() { + VehicleHal::VehiclePropValuePtr v = nullptr; + + // This is an example of very simple health checking. VHAL is considered healthy if we can read + // PERF_VEHICLE_SPEED. The more comprehensive health checking is required. + VehiclePropValue propValue = { + .prop = static_cast(VehicleProperty::PERF_VEHICLE_SPEED), + }; + auto internalPropValue = mPropStore->readValueOrNull(propValue); + if (internalPropValue != nullptr) { + v = createVhalHeartBeatProp(); + } else { + ALOGW("VHAL health check failed"); + } + return v; +} + +void DefaultVehicleHal::onContinuousPropertyTimer(const std::vector& properties) { + auto& pool = *getValuePool(); + + for (int32_t property : properties) { + VehiclePropValuePtr v; + if (isContinuousProperty(property)) { + auto internalPropValue = mPropStore->readValueOrNull(property); + if (internalPropValue != nullptr) { + v = pool.obtain(*internalPropValue); + } + } else if (property == static_cast(VehicleProperty::VHAL_HEARTBEAT)) { + // VHAL_HEARTBEAT is not a continuous value, but it needs to be updated periodically. + // So, the update is done through onContinuousPropertyTimer. + v = doInternalHealthCheck(); + } else { + ALOGE("Unexpected onContinuousPropertyTimer for property: 0x%x", property); + continue; + } + + if (v.get()) { + v->timestamp = elapsedRealtimeNano(); + doHalEvent(std::move(v)); + } + } +} + +RecurrentTimer::Action DefaultVehicleHal::getTimerAction() { + return [this](const std::vector& properties) { + onContinuousPropertyTimer(properties); + }; +} + +StatusCode DefaultVehicleHal::subscribe(int32_t property, float sampleRate) { + ALOGI("%s propId: 0x%x, sampleRate: %f", __func__, property, sampleRate); + + if (!isContinuousProperty(property)) { + return StatusCode::INVALID_ARG; + } + + // If the config does not exist, isContinuousProperty should return false. + const VehiclePropConfig* config = mPropStore->getConfigOrNull(property); + if (sampleRate < config->minSampleRate || sampleRate > config->maxSampleRate) { + ALOGW("sampleRate out of range"); + return StatusCode::INVALID_ARG; + } + + mRecurrentTimer.registerRecurrentEvent(hertzToNanoseconds(sampleRate), property); + return StatusCode::OK; +} + +StatusCode DefaultVehicleHal::unsubscribe(int32_t property) { + ALOGI("%s propId: 0x%x", __func__, property); + if (!isContinuousProperty(property)) { + return StatusCode::INVALID_ARG; + } + // If the event was not registered before, this would do nothing. + mRecurrentTimer.unregisterRecurrentEvent(property); + return StatusCode::OK; +} + +bool DefaultVehicleHal::isContinuousProperty(int32_t propId) const { + const VehiclePropConfig* config = mPropStore->getConfigOrNull(propId); + if (config == nullptr) { + ALOGW("Config not found for property: 0x%x", propId); + return false; + } + return config->changeMode == VehiclePropertyChangeMode::CONTINUOUS; +} + +void DefaultVehicleHal::onPropertyValue(const VehiclePropValue& value, bool updateStatus) { + VehiclePropValuePtr updatedPropValue = getValuePool()->obtain(value); + + if (mPropStore->writeValue(*updatedPropValue, updateStatus)) { + doHalEvent(std::move(updatedPropValue)); + } +} + +void DefaultVehicleHal::initStaticConfig() { + auto configs = mVehicleClient->getAllPropertyConfig(); + for (auto&& cfg : configs) { + VehiclePropertyStore::TokenFunction tokenFunction = nullptr; + + switch (cfg.prop) { + case OBD2_FREEZE_FRAME: { + // We use timestamp as token for OBD2_FREEZE_FRAME + tokenFunction = [](const VehiclePropValue& propValue) { + return propValue.timestamp; + }; + break; + } + default: + break; + } + + mPropStore->registerProperty(cfg, tokenFunction); + } +} + +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h new file mode 100644 index 0000000000000000000000000000000000000000..4d3036e5e13c976cfdc8be7db5dff4e56c77ed20 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h @@ -0,0 +1,109 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleHal_H_ +#define android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleHal_H_ + +#include +#include +#include + +#include "FakeUserHal.h" +#include "VehicleHalClient.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { + +/** Implementation of VehicleHal that connected to emulator instead of real vehicle network. */ +class DefaultVehicleHal : public VehicleHal { + public: + DefaultVehicleHal(VehiclePropertyStore* propStore, VehicleHalClient* client); + ~DefaultVehicleHal(); + + // Initialize VHAL. Should always call registerHeartBeatEvent() during onCreate. + void onCreate() override; + std::vector listProperties() override; + VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue, + StatusCode* outStatus) override; + StatusCode set(const VehiclePropValue& propValue) override; + StatusCode subscribe(int32_t property, float sampleRate) override; + StatusCode unsubscribe(int32_t property) override; + bool dump(const hidl_handle& fd, const hidl_vec& options) override; + + protected: + constexpr std::chrono::nanoseconds hertzToNanoseconds(float hz) const { + return std::chrono::nanoseconds(static_cast(1000000000L / hz)); + } + + VehiclePropertyStore* mPropStore; + RecurrentTimer mRecurrentTimer; + VehicleHalClient* mVehicleClient; + FakeUserHal mFakeUserHal; + + // The callback that would be called when a property value is updated. This function could + // be extended to handle specific property update event. + virtual void onPropertyValue(const VehiclePropValue& value, bool updateStatus); + // Do an internal health check, vendor should add health check logic in this function. + virtual VehicleHal::VehiclePropValuePtr doInternalHealthCheck(); + + // The callback that would be called for every event generated by 'subscribe' or heartbeat. + // Properties contains a list of properties that need to be handled. + void onContinuousPropertyTimer(const std::vector& properties); + // Initiate config for all properties, would be called during onCreate(). + void initStaticConfig(); + // Whether the property is a continuous property. + bool isContinuousProperty(int32_t propId) const; + // Returns a lambda that could be used in mRecurrentTimer. + RecurrentTimer::Action getTimerAction(); + // Check whether a propValue is valid according to its type. + StatusCode checkPropValue(const VehiclePropValue& propValue, const VehiclePropConfig* config); + // Check whether the property value is within the range according to area config. + StatusCode checkValueRange(const VehiclePropValue& propValue, + const VehicleAreaConfig* areaConfig); + // Register the heart beat event to be sent every 3s. This is required to inform watch dog that + // VHAL is alive. Subclasses should always calls this function during onCreate. + void registerHeartBeatEvent(); + // Get a user HAL property. + VehiclePropValuePtr getUserHalProp(const VehiclePropValue& requestedPropValue, + StatusCode* outStatus); + // Set a user HAL property. + StatusCode setUserHalProp(const VehiclePropValue& propValue); + // Create a VHAL heart beat property. + VehicleHal::VehiclePropValuePtr createVhalHeartBeatProp(); + + private: + // Check whether a vendor mixed value property is valid according to its config array. + // See 'VehiclePropertyType' documentation in 'types.hal' for detail. + StatusCode checkVendorMixedPropValue(const VehiclePropValue& value, + const VehiclePropConfig* config); + // Read the override properties from a config file. + void getAllPropertiesOverride(); +}; + +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleHal_H_ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHalServer.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHalServer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..470491728608deca256ded3c99888279b14ba265 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHalServer.cpp @@ -0,0 +1,571 @@ +/* + * 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_TAG "DefaultVehicleHalServer" + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "DefaultConfig.h" +#include "FakeObd2Frame.h" +#include "JsonFakeValueGenerator.h" +#include "LinearFakeValueGenerator.h" + +#include "DefaultVehicleHalServer.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { + +namespace { +const char* VENDOR_OVERRIDE_DIR = "/vendor/etc/vhaloverride/"; +} // namespace + +void DefaultVehicleHalServer::storePropInitialValue(const ConfigDeclaration& config) { + VehiclePropConfig cfg = config.config; + + // A global property will have only a single area + int32_t numAreas = isGlobalProp(cfg.prop) ? 1 : cfg.areaConfigs.size(); + + for (int i = 0; i < numAreas; i++) { + int32_t curArea = isGlobalProp(cfg.prop) ? 0 : cfg.areaConfigs[i].areaId; + + // Create a separate instance for each individual zone + VehiclePropValue prop = { + .areaId = curArea, + .prop = cfg.prop, + }; + + if (config.initialAreaValues.empty()) { + prop.value = config.initialValue; + } else if (auto valueForAreaIt = config.initialAreaValues.find(curArea); + valueForAreaIt != config.initialAreaValues.end()) { + prop.value = valueForAreaIt->second; + } else { + LOG(WARNING) << __func__ << " failed to get default value for" + << " prop 0x" << std::hex << cfg.prop << " area 0x" << std::hex << curArea; + prop.status = VehiclePropertyStatus::UNAVAILABLE; + } + + mServerSidePropStore.writeValue(prop, true); + } +} + +DefaultVehicleHalServer::DefaultVehicleHalServer() { + for (auto& it : kVehicleProperties) { + VehiclePropConfig cfg = it.config; + mServerSidePropStore.registerProperty(cfg); + // Skip diagnostic properties since there is special logic to handle those. + if (isDiagnosticProperty(cfg)) { + continue; + } + storePropInitialValue(it); + } + maybeOverrideProperties(VENDOR_OVERRIDE_DIR); +} + +void DefaultVehicleHalServer::sendAllValuesToClient() { + constexpr bool update_status = true; + auto values = mServerSidePropStore.readAllValues(); + for (const auto& value : values) { + onPropertyValueFromCar(value, update_status); + } +} + +GeneratorHub* DefaultVehicleHalServer::getGeneratorHub() { + return &mGeneratorHub; +} + +VehiclePropValuePool* DefaultVehicleHalServer::getValuePool() const { + if (!mValuePool) { + LOG(WARNING) << __func__ << ": Value pool not set!"; + } + return mValuePool; +} + +void DefaultVehicleHalServer::setValuePool(VehiclePropValuePool* valuePool) { + if (!valuePool) { + LOG(WARNING) << __func__ << ": Setting value pool to nullptr!"; + } + mValuePool = valuePool; +} + +void DefaultVehicleHalServer::onFakeValueGenerated(const VehiclePropValue& value) { + constexpr bool updateStatus = true; + LOG(DEBUG) << __func__ << ": " << toString(value); + auto updatedPropValue = getValuePool()->obtain(value); + if (updatedPropValue) { + updatedPropValue->timestamp = value.timestamp; + updatedPropValue->status = VehiclePropertyStatus::AVAILABLE; + mServerSidePropStore.writeValue(*updatedPropValue, updateStatus); + onPropertyValueFromCar(*updatedPropValue, updateStatus); + } +} + +std::vector DefaultVehicleHalServer::onGetAllPropertyConfig() const { + return mServerSidePropStore.getAllConfigs(); +} + +DefaultVehicleHalServer::VehiclePropValuePtr DefaultVehicleHalServer::createApPowerStateReq( + VehicleApPowerStateReq state, int32_t param) { + auto req = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 2); + req->prop = toInt(VehicleProperty::AP_POWER_STATE_REQ); + req->areaId = 0; + req->timestamp = elapsedRealtimeNano(); + req->status = VehiclePropertyStatus::AVAILABLE; + req->value.int32Values[0] = toInt(state); + req->value.int32Values[1] = param; + return req; +} + +DefaultVehicleHalServer::VehiclePropValuePtr DefaultVehicleHalServer::createHwInputKeyProp( + VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay) { + auto keyEvent = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 3); + keyEvent->prop = toInt(VehicleProperty::HW_KEY_INPUT); + keyEvent->areaId = 0; + keyEvent->timestamp = elapsedRealtimeNano(); + keyEvent->status = VehiclePropertyStatus::AVAILABLE; + keyEvent->value.int32Values[0] = toInt(action); + keyEvent->value.int32Values[1] = keyCode; + keyEvent->value.int32Values[2] = targetDisplay; + return keyEvent; +} + +StatusCode DefaultVehicleHalServer::onSetProperty(const VehiclePropValue& value, + bool updateStatus) { + LOG(DEBUG) << "onSetProperty(" << value.prop << ")"; + + // Some properties need to be treated non-trivially + switch (value.prop) { + case AP_POWER_STATE_REPORT: + switch (value.value.int32Values[0]) { + case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT): + case toInt(VehicleApPowerStateReport::SHUTDOWN_CANCELLED): + case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL): + // CPMS is in WAIT_FOR_VHAL state, simply move to ON + // Send back to HAL + // ALWAYS update status for generated property value + onPropertyValueFromCar(*createApPowerStateReq(VehicleApPowerStateReq::ON, 0), + true /* updateStatus */); + break; + case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY): + case toInt(VehicleApPowerStateReport::SHUTDOWN_START): + // CPMS is in WAIT_FOR_FINISH state, send the FINISHED command + // Send back to HAL + // ALWAYS update status for generated property value + onPropertyValueFromCar( + *createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0), + true /* updateStatus */); + break; + case toInt(VehicleApPowerStateReport::ON): + case toInt(VehicleApPowerStateReport::SHUTDOWN_POSTPONE): + case toInt(VehicleApPowerStateReport::SHUTDOWN_PREPARE): + // Do nothing + break; + default: + // Unknown state + break; + } + break; + +#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING + case toInt(VehicleProperty::CLUSTER_REPORT_STATE): + case toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY): + case toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE): + case VENDOR_CLUSTER_SWITCH_UI: + case VENDOR_CLUSTER_DISPLAY_STATE: { + auto updatedPropValue = createVehiclePropValue(getPropType(value.prop), 0); + updatedPropValue->prop = value.prop & ~toInt(VehiclePropertyGroup::MASK); + if (isSystemProperty(value.prop)) { + updatedPropValue->prop |= toInt(VehiclePropertyGroup::VENDOR); + } else { + updatedPropValue->prop |= toInt(VehiclePropertyGroup::SYSTEM); + } + updatedPropValue->value = value.value; + updatedPropValue->timestamp = elapsedRealtimeNano(); + updatedPropValue->areaId = value.areaId; + onPropertyValueFromCar(*updatedPropValue, updateStatus); + return StatusCode::OK; + } +#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING + + default: + break; + } + + // In the real vhal, the value will be sent to Car ECU. + // We just pretend it is done here and send back to HAL + auto updatedPropValue = getValuePool()->obtain(value); + updatedPropValue->timestamp = elapsedRealtimeNano(); + + mServerSidePropStore.writeValue(*updatedPropValue, updateStatus); + onPropertyValueFromCar(*updatedPropValue, updateStatus); + return StatusCode::OK; +} + +IVehicleServer::DumpResult DefaultVehicleHalServer::onDump( + const std::vector& options) { + DumpResult result; + if (options.size() == 0) { + // No options, dump all stored properties. + result.callerShouldDumpState = true; + result.buffer += "Server side properties: \n"; + auto values = mServerSidePropStore.readAllValues(); + size_t i = 0; + for (const auto& value : values) { + result.buffer += fmt::format("[{}]: {}\n", i, toString(value)); + i++; + } + return result; + } + if (options[0] != "--debughal") { + // We only expect "debughal" command. This might be some commands that the caller knows + // about, so let caller handle it. + result.callerShouldDumpState = true; + return result; + } + + return debugCommand(options); +} + +IVehicleServer::DumpResult DefaultVehicleHalServer::debugCommand( + const std::vector& options) { + DumpResult result; + // This is a debug command for the HAL, caller should not continue to dump state. + result.callerShouldDumpState = false; + + if (options.size() < 2) { + result.buffer += "No command specified\n"; + result.buffer += getHelpInfo(); + return result; + } + + std::string command = options[1]; + if (command == "--help") { + result.buffer += getHelpInfo(); + return result; + } else if (command == "--genfakedata") { + return genFakeDataCommand(options); + } else if (command == "--setint" || command == "--setfloat" || command == "--setbool") { + return setValueCommand(options); + } + + result.buffer += "Unknown command: \"" + command + "\"\n"; + result.buffer += getHelpInfo(); + return result; +} + +std::string DefaultVehicleHalServer::getHelpInfo() { + return "Help: \n" + "Generate Fake Data: \n" + "\tStart a linear generator: \n" + "\t--debughal --genfakedata --startlinear [propID(int32)] [middleValue(float)] " + "[currentValue(float)] [dispersion(float)] [increment(float)] [interval(int64)]\n" + "\tStop a linear generator: \n" + "\t--debughal --genfakedata --stoplinear [propID(int32)]\n" + "\tStart a json generator: \n" + "\t--debughal --genfakedata --startjson [jsonFilePath(string)] " + "[repetition(int32)(optional)]\n" + "\tStop a json generator: \n" + "\t--debughal --genfakedata --stopjson [jsonFilePath(string)]\n" + "\tGenerate key press: \n" + "\t--debughal --genfakedata --keypress [keyCode(int32)] [display[int32]]\n" + "\tSet a int property value: \n" + "\t--setint [propID(int32)] [value(int32)] [timestamp(int64)] " + "[areaID(int32)(optional)]\n" + "\tSet a boolean property value: \n" + "\t--setbool [propID(int32)] [value(\"true\"/\"false\")] [timestamp(int64)] " + "[areaID(int32)(optional)]\n" + "\tSet a float property value: \n" + "\t--setfloat [propID(int32)] [value(float)] [timestamp(int64)] " + "[areaID(int32)(optional)]\n"; +} + +IVehicleServer::DumpResult DefaultVehicleHalServer::genFakeDataCommand( + const std::vector& options) { + DumpResult result; + // This is a debug command for the HAL, caller should not continue to dump state. + result.callerShouldDumpState = false; + + if (options.size() < 3) { + result.buffer += "No subcommand specified for genfakedata\n"; + result.buffer += getHelpInfo(); + return result; + } + + std::string command = options[2]; + if (command == "--startlinear") { + LOG(INFO) << __func__ << "FakeDataCommand::StartLinear"; + // --debughal --genfakedata --startlinear [propID(int32)] [middleValue(float)] + // [currentValue(float)] [dispersion(float)] [increment(float)] [interval(int64)] + if (options.size() != 9) { + result.buffer += + "incorrect argument count, need 9 arguments for --genfakedata --startlinear\n"; + result.buffer += getHelpInfo(); + return result; + } + int32_t propId; + float middleValue; + float currentValue; + float dispersion; + float increment; + int64_t interval; + if (!android::base::ParseInt(options[3], &propId)) { + result.buffer += "failed to parse propdID as int: \"" + options[3] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + if (!android::base::ParseFloat(options[4], &middleValue)) { + result.buffer += "failed to parse middleValue as float: \"" + options[4] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + if (!android::base::ParseFloat(options[5], ¤tValue)) { + result.buffer += "failed to parse currentValue as float: \"" + options[5] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + if (!android::base::ParseFloat(options[6], &dispersion)) { + result.buffer += "failed to parse dispersion as float: \"" + options[6] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + if (!android::base::ParseFloat(options[7], &increment)) { + result.buffer += "failed to parse increment as float: \"" + options[7] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + if (!android::base::ParseInt(options[8], &interval)) { + result.buffer += "failed to parse interval as int: \"" + options[8] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + auto generator = std::make_unique( + propId, middleValue, currentValue, dispersion, increment, interval); + getGeneratorHub()->registerGenerator(propId, std::move(generator)); + return result; + } else if (command == "--stoplinear") { + LOG(INFO) << __func__ << "FakeDataCommand::StopLinear"; + // --debughal --genfakedata --stoplinear [propID(int32)] + if (options.size() != 4) { + result.buffer += + "incorrect argument count, need 4 arguments for --genfakedata --stoplinear\n"; + result.buffer += getHelpInfo(); + return result; + } + int32_t propId; + if (!android::base::ParseInt(options[3], &propId)) { + result.buffer += "failed to parse propdID as int: \"" + options[3] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + getGeneratorHub()->unregisterGenerator(propId); + return result; + } else if (command == "--startjson") { + LOG(INFO) << __func__ << "FakeDataCommand::StartJson"; + // --debughal --genfakedata --startjson [jsonFilePath(string)] [repetition(int32)(optional)] + if (options.size() != 4 && options.size() != 5) { + result.buffer += + "incorrect argument count, need 4 or 5 arguments for --genfakedata " + "--startjson\n"; + result.buffer += getHelpInfo(); + return result; + } + std::string fileName = options[3]; + int32_t cookie = std::hash()(fileName); + // Iterate infinitely if repetition number is not provided + int32_t repetition = -1; + if (options.size() == 5) { + if (!android::base::ParseInt(options[4], &repetition)) { + result.buffer += "failed to parse repetition as int: \"" + options[4] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + } + auto generator = std::make_unique(fileName, repetition); + if (!generator->hasNext()) { + result.buffer += "invalid JSON file, no events"; + return result; + } + getGeneratorHub()->registerGenerator(cookie, std::move(generator)); + return result; + } else if (command == "--stopjson") { + LOG(INFO) << __func__ << "FakeDataCommand::StopJson"; + // --debughal --genfakedata --stopjson [jsonFilePath(string)] + if (options.size() != 4) { + result.buffer += + "incorrect argument count, need 4 arguments for --genfakedata --stopjson\n"; + result.buffer += getHelpInfo(); + return result; + } + std::string fileName = options[3]; + int32_t cookie = std::hash()(fileName); + getGeneratorHub()->unregisterGenerator(cookie); + return result; + } else if (command == "--keypress") { + LOG(INFO) << __func__ << "FakeDataCommand::KeyPress"; + int32_t keyCode; + int32_t display; + // --debughal --genfakedata --keypress [keyCode(int32)] [display[int32]] + if (options.size() != 5) { + result.buffer += + "incorrect argument count, need 5 arguments for --genfakedata --keypress\n"; + result.buffer += getHelpInfo(); + return result; + } + if (!android::base::ParseInt(options[3], &keyCode)) { + result.buffer += "failed to parse keyCode as int: \"" + options[3] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + if (!android::base::ParseInt(options[4], &display)) { + result.buffer += "failed to parse display as int: \"" + options[4] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + // Send back to HAL + onPropertyValueFromCar( + *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_DOWN, keyCode, display), + /*updateStatus=*/true); + onPropertyValueFromCar( + *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_UP, keyCode, display), + /*updateStatus=*/true); + return result; + } + + result.buffer += "Unknown command: \"" + command + "\"\n"; + result.buffer += getHelpInfo(); + return result; +} + +void DefaultVehicleHalServer::maybeOverrideProperties(const char* overrideDir) { + if (android::base::GetBoolProperty("persist.vendor.vhal_init_value_override", false)) { + overrideProperties(overrideDir); + } +} + +void DefaultVehicleHalServer::overrideProperties(const char* overrideDir) { + LOG(INFO) << "loading vendor override properties from " << overrideDir; + if (auto dir = opendir(overrideDir)) { + std::regex reg_json(".*[.]json", std::regex::icase); + while (auto f = readdir(dir)) { + if (!regex_match(f->d_name, reg_json)) { + continue; + } + std::string file = overrideDir + std::string(f->d_name); + JsonFakeValueGenerator tmpGenerator(file); + + std::vector propValues = tmpGenerator.getAllEvents(); + for (const VehiclePropValue& prop : propValues) { + mServerSidePropStore.writeValue(prop, true); + } + } + closedir(dir); + } +} + +IVehicleServer::DumpResult DefaultVehicleHalServer::setValueCommand( + const std::vector& options) { + DumpResult result; + // This is a debug command for the HAL, caller should not continue to dump state. + result.callerShouldDumpState = false; + // --debughal --set* [propID(int32)] [value] [timestamp(int64)] + // [areaId(int32)(optional)] + if (options.size() != 5 && options.size() != 6) { + result.buffer += + "incorrect argument count, need 5 or 6 arguments for --setint or --setfloat or " + "--setbool\n"; + result.buffer += getHelpInfo(); + return result; + } + std::unique_ptr updatedPropValue; + int32_t propId; + int32_t intValue; + float floatValue; + int64_t timestamp; + int32_t areaId = 0; + if (options[1] == "--setint") { + updatedPropValue = std::move(createVehiclePropValue(VehiclePropertyType::INT32, 1)); + if (!android::base::ParseInt(options[3], &intValue)) { + result.buffer += "failed to parse value as int: \"" + options[3] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + updatedPropValue->value.int32Values[0] = intValue; + } else if (options[1] == "--setbool") { + updatedPropValue = std::move(createVehiclePropValue(VehiclePropertyType::BOOLEAN, 1)); + if (options[3] == "true" || options[3] == "True") { + updatedPropValue->value.int32Values[0] = 1; + } else if (options[3] == "false" || options[3] == "False") { + updatedPropValue->value.int32Values[0] = 0; + } else { + result.buffer += "failed to parse value as bool, only accepts true/false: \"" + + options[3] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + } else { + updatedPropValue = std::move(createVehiclePropValue(VehiclePropertyType::FLOAT, 1)); + if (!android::base::ParseFloat(options[3], &floatValue)) { + result.buffer += "failed to parse value as float: \"" + options[3] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + updatedPropValue->value.floatValues[0] = floatValue; + } + if (!android::base::ParseInt(options[2], &propId)) { + result.buffer += "failed to parse propID as int: \"" + options[2] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + updatedPropValue->prop = propId; + if (!android::base::ParseInt(options[4], ×tamp)) { + result.buffer += "failed to parse timestamp as int: \"" + options[4] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + updatedPropValue->timestamp = timestamp; + if (options.size() == 6) { + if (!android::base::ParseInt(options[5], &areaId)) { + result.buffer += "failed to parse areaID as int: \"" + options[5] + "\"\n"; + result.buffer += getHelpInfo(); + return result; + } + } + updatedPropValue->areaId = areaId; + + onPropertyValueFromCar(*updatedPropValue, /*updateStatus=*/true); + return result; +} + +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHalServer.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHalServer.h new file mode 100644 index 0000000000000000000000000000000000000000..87548465aaa145e8394a1d3d6e3e6cf2b52d3fee --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHalServer.h @@ -0,0 +1,112 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +#include "DefaultConfig.h" +#include "GeneratorHub.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { + +// This contains the server operation for VHAL running in emulator. +class DefaultVehicleHalServer : public IVehicleServer { + public: + DefaultVehicleHalServer(); + + // Send all the property values to client. + void sendAllValuesToClient(); + + // Methods from IVehicleServer + + std::vector onGetAllPropertyConfig() const override; + + StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) override; + + // Dump/debug the Default VHAL server. If options is empty, the internal information for the + // server would be dumped. Otherwise, the options would be treated as debug commands and sent + // to debug function to handle the commands. + DumpResult onDump(const std::vector& options) override; + + // Set the Property Value Pool used in this server + void setValuePool(VehiclePropValuePool* valuePool); + + protected: + using VehiclePropValuePtr = recyclable_ptr; + GeneratorHub* getGeneratorHub(); + + VehiclePropValuePool* getValuePool() const; + + void onFakeValueGenerated(const VehiclePropValue& value); + + StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request); + + VehiclePropValuePtr createApPowerStateReq(VehicleApPowerStateReq req, int32_t param); + + VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode, + int32_t targetDisplay); + + void storePropInitialValue(const ConfigDeclaration& config); + + // Handles debug commands. The first option must be "--debughal" otherwise the command would be + // ignored. The second option specifies the operations to execute. Different operations require + // different input options, for detail, see the helpInfo printed by getHelpInfo(). + DumpResult debugCommand(const std::vector& options); + + // Gets help info. Contains the usage for different debug commands. + std::string getHelpInfo(); + + // If "persist.vendor.vhal_init_value_override" is true, try to override the properties default + // values according to JSON files in 'overrideDir'. Would be called in constructor using + // VENDOR_OVERRIDE_DIR as overrideDir. + void maybeOverrideProperties(const char* overrideDir); + + // Handles "--genfakedata" debug command. + DumpResult genFakeDataCommand(const std::vector& options); + + // Handles "--setint" or "--setfloat" or "--setbool" debug command. + DumpResult setValueCommand(const std::vector& options); + + protected: + GeneratorHub mGeneratorHub{ + [this](const VehiclePropValue& value) { return onFakeValueGenerated(value); }}; + + VehiclePropValuePool* mValuePool{nullptr}; + VehiclePropertyStore mServerSidePropStore; + + private: + // Expose protected methods to unit test. + friend class DefaultVhalImplTestHelper; + // Override the properties using config files in 'overrideDir'. + void overrideProperties(const char* overrideDir); +}; + +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp deleted file mode 100644 index eae58d0759923cd9f8808a37a08831ceb1f6cbbf..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "automotive.vehicle@2.0-connector" - -#include - -#include -#include - -#include "EmulatedVehicleConnector.h" -#include "JsonFakeValueGenerator.h" -#include "LinearFakeValueGenerator.h" -#include "Obd2SensorStore.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -EmulatedUserHal* EmulatedVehicleConnector::getEmulatedUserHal() { - return &mEmulatedUserHal; -} - -void EmulatedVehicleConnector::triggerSendAllValues() { - sendAllValuesToClient(); -} - -StatusCode EmulatedVehicleConnector::onSetProperty(const VehiclePropValue& value, - bool updateStatus) { - if (mEmulatedUserHal.isSupported(value.prop)) { - LOG(INFO) << "onSetProperty(): property " << value.prop << " will be handled by UserHal"; - - const auto& ret = mEmulatedUserHal.onSetProperty(value); - if (!ret.ok()) { - LOG(ERROR) << "onSetProperty(): HAL returned error: " << ret.error().message(); - return StatusCode(ret.error().code()); - } - auto updatedValue = ret.value().get(); - if (updatedValue != nullptr) { - LOG(INFO) << "onSetProperty(): updating property returned by HAL: " - << toString(*updatedValue); - onPropertyValueFromCar(*updatedValue, updateStatus); - } - return StatusCode::OK; - } - return this->VehicleHalServer::onSetProperty(value, updateStatus); -} - -bool EmulatedVehicleConnector::onDump(const hidl_handle& handle, - const hidl_vec& options) { - int fd = handle->data[0]; - - if (options.size() > 0) { - if (options[0] == "--help") { - dprintf(fd, "Emulator-specific usage:\n"); - mEmulatedUserHal.showDumpHelp(fd); - dprintf(fd, "\n"); - // Include caller's help options - return true; - } else if (options[0] == kUserHalDumpOption) { - mEmulatedUserHal.dump(fd, ""); - return false; - - } else { - // Let caller handle the options... - return true; - } - } - - dprintf(fd, "Emulator-specific state:\n"); - mEmulatedUserHal.dump(fd, " "); - dprintf(fd, "\n"); - - return true; -} - -} // namespace impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp deleted file mode 100644 index e8b79dc3944389b72f193054986bd19c17a5be04..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +++ /dev/null @@ -1,532 +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. - */ -#define LOG_TAG "DefaultVehicleHal_v2_0" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "EmulatedVehicleHal.h" -#include "JsonFakeValueGenerator.h" -#include "LinearFakeValueGenerator.h" -#include "Obd2SensorStore.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -static constexpr std::chrono::nanoseconds kHeartBeatIntervalNs = 3s; - -static std::unique_ptr fillDefaultObd2Frame(size_t numVendorIntegerSensors, - size_t numVendorFloatSensors) { - std::unique_ptr sensorStore( - new Obd2SensorStore(numVendorIntegerSensors, numVendorFloatSensors)); - - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::FUEL_SYSTEM_STATUS, - toInt(Obd2FuelSystemStatus::CLOSED_LOOP)); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::MALFUNCTION_INDICATOR_LIGHT_ON, 0); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::IGNITION_MONITORS_SUPPORTED, - toInt(Obd2IgnitionMonitorKind::SPARK)); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::IGNITION_SPECIFIC_MONITORS, - Obd2CommonIgnitionMonitors::COMPONENTS_AVAILABLE | - Obd2CommonIgnitionMonitors::MISFIRE_AVAILABLE | - Obd2SparkIgnitionMonitors::AC_REFRIGERANT_AVAILABLE | - Obd2SparkIgnitionMonitors::EVAPORATIVE_SYSTEM_AVAILABLE); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::INTAKE_AIR_TEMPERATURE, 35); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::COMMANDED_SECONDARY_AIR_STATUS, - toInt(Obd2SecondaryAirStatus::FROM_OUTSIDE_OR_OFF)); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::NUM_OXYGEN_SENSORS_PRESENT, 1); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::RUNTIME_SINCE_ENGINE_START, 500); - sensorStore->setIntegerSensor( - DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON, 0); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::WARMUPS_SINCE_CODES_CLEARED, 51); - sensorStore->setIntegerSensor( - DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_SINCE_CODES_CLEARED, 365); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::ABSOLUTE_BAROMETRIC_PRESSURE, 30); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::CONTROL_MODULE_VOLTAGE, 12); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::AMBIENT_AIR_TEMPERATURE, 18); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::MAX_FUEL_AIR_EQUIVALENCE_RATIO, 1); - sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::FUEL_TYPE, - toInt(Obd2FuelType::GASOLINE)); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::CALCULATED_ENGINE_LOAD, 0.153); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1, -0.16); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK1, -0.16); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK2, -0.16); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK2, -0.16); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::INTAKE_MANIFOLD_ABSOLUTE_PRESSURE, 7.5); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ENGINE_RPM, 1250.); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::VEHICLE_SPEED, 40.); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::TIMING_ADVANCE, 2.5); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::THROTTLE_POSITION, 19.75); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::OXYGEN_SENSOR1_VOLTAGE, 0.265); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::FUEL_TANK_LEVEL_INPUT, 0.824); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::EVAPORATION_SYSTEM_VAPOR_PRESSURE, - -0.373); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::CATALYST_TEMPERATURE_BANK1_SENSOR1, - 190.); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::RELATIVE_THROTTLE_POSITION, 3.); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ABSOLUTE_THROTTLE_POSITION_B, 0.306); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_D, 0.188); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_E, 0.094); - sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::COMMANDED_THROTTLE_ACTUATOR, 0.024); - - return sensorStore; -} - -EmulatedVehicleHal::EmulatedVehicleHal(VehiclePropertyStore* propStore, VehicleHalClient* client, - EmulatedUserHal* emulatedUserHal) - : mPropStore(propStore), - mHvacPowerProps(std::begin(kHvacPowerProperties), std::end(kHvacPowerProperties)), - mRecurrentTimer(std::bind(&EmulatedVehicleHal::onContinuousPropertyTimer, this, - std::placeholders::_1)), - mVehicleClient(client), - mEmulatedUserHal(emulatedUserHal) { - initStaticConfig(); - mVehicleClient->registerPropertyValueCallback(std::bind(&EmulatedVehicleHal::onPropertyValue, - this, std::placeholders::_1, - std::placeholders::_2)); - - mInitVhalValueOverride = - android::base::GetBoolProperty("persist.vendor.vhal_init_value_override", false); - if (mInitVhalValueOverride) { - getAllPropertiesOverride(); - } -} - -void EmulatedVehicleHal::getAllPropertiesOverride() { - if (auto dir = opendir("/vendor/etc/vhaloverride/")) { - std::regex reg_json(".*[.]json", std::regex::icase); - while (auto f = readdir(dir)) { - if (!regex_match(f->d_name, reg_json)) { - continue; - } - std::string file = "/vendor/etc/vhaloverride/" + std::string(f->d_name); - JsonFakeValueGenerator tmpGenerator(file); - - std::vector propvalues = tmpGenerator.getAllEvents(); - mVehiclePropertiesOverride.insert(std::end(mVehiclePropertiesOverride), - std::begin(propvalues), std::end(propvalues)); - } - closedir(dir); - } -} - -VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get( - const VehiclePropValue& requestedPropValue, StatusCode* outStatus) { - auto propId = requestedPropValue.prop; - ALOGV("get(%d)", propId); - - auto& pool = *getValuePool(); - VehiclePropValuePtr v = nullptr; - - switch (propId) { - case OBD2_FREEZE_FRAME: - v = pool.obtainComplex(); - *outStatus = fillObd2FreezeFrame(requestedPropValue, v.get()); - break; - case OBD2_FREEZE_FRAME_INFO: - v = pool.obtainComplex(); - *outStatus = fillObd2DtcInfo(v.get()); - break; - default: - if (mEmulatedUserHal != nullptr && mEmulatedUserHal->isSupported(propId)) { - ALOGI("get(): getting value for prop %d from User HAL", propId); - const auto& ret = mEmulatedUserHal->onGetProperty(requestedPropValue); - if (!ret.ok()) { - ALOGE("get(): User HAL returned error: %s", ret.error().message().c_str()); - *outStatus = StatusCode(ret.error().code()); - } else { - auto value = ret.value().get(); - if (value != nullptr) { - ALOGI("get(): User HAL returned value: %s", toString(*value).c_str()); - v = getValuePool()->obtain(*value); - *outStatus = StatusCode::OK; - } else { - ALOGE("get(): User HAL returned null value"); - *outStatus = StatusCode::INTERNAL_ERROR; - } - } - break; - } - - auto internalPropValue = mPropStore->readValueOrNull(requestedPropValue); - if (internalPropValue != nullptr) { - v = getValuePool()->obtain(*internalPropValue); - } - - if (!v) { - *outStatus = StatusCode::INVALID_ARG; - } else if (v->status == VehiclePropertyStatus::AVAILABLE) { - *outStatus = StatusCode::OK; - } else { - *outStatus = StatusCode::TRY_AGAIN; - } - break; - } - if (v.get()) { - v->timestamp = elapsedRealtimeNano(); - } - return v; -} - -bool EmulatedVehicleHal::dump(const hidl_handle& fd, const hidl_vec& options) { - return mVehicleClient->dump(fd, options); -} - -StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { - constexpr bool updateStatus = false; - - if (propValue.prop == kGenerateFakeDataControllingProperty) { - // Send the generator controlling request to the server. - // 'updateStatus' flag is only for the value sent by setProperty (propValue in this case) - // instead of the generated values triggered by it. 'propValue' works as a control signal - // here, since we never send the control signal back, the value of 'updateStatus' flag - // does not matter here. - auto status = mVehicleClient->setProperty(propValue, updateStatus); - return status; - } else if (mHvacPowerProps.count(propValue.prop)) { - auto hvacPowerOn = mPropStore->readValueOrNull( - toInt(VehicleProperty::HVAC_POWER_ON), - (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT | - VehicleAreaSeat::ROW_2_LEFT | VehicleAreaSeat::ROW_2_CENTER | - VehicleAreaSeat::ROW_2_RIGHT)); - - if (hvacPowerOn && hvacPowerOn->value.int32Values.size() == 1 - && hvacPowerOn->value.int32Values[0] == 0) { - return StatusCode::NOT_AVAILABLE; - } - } else { - // Handle property specific code - switch (propValue.prop) { - case OBD2_FREEZE_FRAME_CLEAR: - return clearObd2FreezeFrames(propValue); - case VEHICLE_MAP_SERVICE: - // Placeholder for future implementation of VMS property in the default hal. For - // now, just returns OK; otherwise, hal clients crash with property not supported. - return StatusCode::OK; - } - } - - if (propValue.status != VehiclePropertyStatus::AVAILABLE) { - // Android side cannot set property status - this value is the - // purview of the HAL implementation to reflect the state of - // its underlying hardware - return StatusCode::INVALID_ARG; - } - auto currentPropValue = mPropStore->readValueOrNull(propValue); - - if (currentPropValue == nullptr) { - return StatusCode::INVALID_ARG; - } - if (currentPropValue->status != VehiclePropertyStatus::AVAILABLE) { - // do not allow Android side to set() a disabled/error property - return StatusCode::NOT_AVAILABLE; - } - - if (mInEmulator && propValue.prop == toInt(VehicleProperty::DISPLAY_BRIGHTNESS)) { - // Emulator does not support remote brightness control, b/139959479 - // do not send it down so that it does not bring unnecessary property change event - // return other error code, such NOT_AVAILABLE, causes Emulator to be freezing - // TODO: return StatusCode::NOT_AVAILABLE once the above issue is fixed - return StatusCode::OK; - } - - /** - * After checking all conditions, such as the property is available, a real vhal will - * sent the events to Car ECU to take actions. - */ - - // Send the value to the vehicle server, the server will talk to the (real or emulated) car - auto setValueStatus = mVehicleClient->setProperty(propValue, updateStatus); - if (setValueStatus != StatusCode::OK) { - return setValueStatus; - } - - return StatusCode::OK; -} - -static bool isDiagnosticProperty(VehiclePropConfig propConfig) { - switch (propConfig.prop) { - case OBD2_LIVE_FRAME: - case OBD2_FREEZE_FRAME: - case OBD2_FREEZE_FRAME_CLEAR: - case OBD2_FREEZE_FRAME_INFO: - return true; - } - return false; -} - -// Parse supported properties list and generate vector of property values to hold current values. -void EmulatedVehicleHal::onCreate() { - static constexpr bool shouldUpdateStatus = true; - - auto configs = mVehicleClient->getAllPropertyConfig(); - - for (const auto& cfg : configs) { - if (isDiagnosticProperty(cfg)) { - // do not write an initial empty value for the diagnostic properties - // as we will initialize those separately. - continue; - } - - int32_t numAreas = isGlobalProp(cfg.prop) ? 0 : cfg.areaConfigs.size(); - - for (int i = 0; i < numAreas; i++) { - int32_t curArea = isGlobalProp(cfg.prop) ? 0 : cfg.areaConfigs[i].areaId; - - // Create a separate instance for each individual zone - VehiclePropValue prop = { - .areaId = curArea, - .prop = cfg.prop, - .status = VehiclePropertyStatus::UNAVAILABLE, - }; - - if (mInitVhalValueOverride) { - for (auto& itOverride : mVehiclePropertiesOverride) { - if (itOverride.prop == cfg.prop) { - prop.status = VehiclePropertyStatus::AVAILABLE; - prop.value = itOverride.value; - } - } - } - mPropStore->writeValue(prop, shouldUpdateStatus); - } - } - - mVehicleClient->triggerSendAllValues(); - - initObd2LiveFrame(*mPropStore->getConfigOrDie(OBD2_LIVE_FRAME)); - initObd2FreezeFrame(*mPropStore->getConfigOrDie(OBD2_FREEZE_FRAME)); - mInEmulator = isInEmulator(); - ALOGD("mInEmulator=%s", mInEmulator ? "true" : "false"); - mRecurrentTimer.registerRecurrentEvent(kHeartBeatIntervalNs, - static_cast(VehicleProperty::VHAL_HEARTBEAT)); -} - -std::vector EmulatedVehicleHal::listProperties() { - return mPropStore->getAllConfigs(); -} - -void EmulatedVehicleHal::onContinuousPropertyTimer(const std::vector& properties) { - VehiclePropValuePtr v; - - auto& pool = *getValuePool(); - - for (int32_t property : properties) { - if (isContinuousProperty(property)) { - auto internalPropValue = mPropStore->readValueOrNull(property); - if (internalPropValue != nullptr) { - v = pool.obtain(*internalPropValue); - } - } else if (property == static_cast(VehicleProperty::VHAL_HEARTBEAT)) { - // VHAL_HEARTBEAT is not a continuous value, but it needs to be updated periodically. - // So, the update is done through onContinuousPropertyTimer. - v = doInternalHealthCheck(); - } else { - ALOGE("Unexpected onContinuousPropertyTimer for property: 0x%x", property); - } - - if (v.get()) { - v->timestamp = elapsedRealtimeNano(); - doHalEvent(std::move(v)); - } - } -} - -StatusCode EmulatedVehicleHal::subscribe(int32_t property, float sampleRate) { - ALOGI("%s propId: 0x%x, sampleRate: %f", __func__, property, sampleRate); - - if (isContinuousProperty(property)) { - mRecurrentTimer.registerRecurrentEvent(hertzToNanoseconds(sampleRate), property); - } - return StatusCode::OK; -} - -StatusCode EmulatedVehicleHal::unsubscribe(int32_t property) { - ALOGI("%s propId: 0x%x", __func__, property); - if (isContinuousProperty(property)) { - mRecurrentTimer.unregisterRecurrentEvent(property); - } - return StatusCode::OK; -} - -bool EmulatedVehicleHal::isContinuousProperty(int32_t propId) const { - const VehiclePropConfig* config = mPropStore->getConfigOrNull(propId); - if (config == nullptr) { - ALOGW("Config not found for property: 0x%x", propId); - return false; - } - return config->changeMode == VehiclePropertyChangeMode::CONTINUOUS; -} - -bool EmulatedVehicleHal::setPropertyFromVehicle(const VehiclePropValue& propValue) { - constexpr bool updateStatus = true; - return mVehicleClient->setProperty(propValue, updateStatus) == StatusCode::OK; -} - -std::vector EmulatedVehicleHal::getAllProperties() const { - return mPropStore->readAllValues(); -} - -void EmulatedVehicleHal::onPropertyValue(const VehiclePropValue& value, bool updateStatus) { - VehiclePropValuePtr updatedPropValue = getValuePool()->obtain(value); - - if (mPropStore->writeValue(*updatedPropValue, updateStatus)) { - getEmulatorOrDie()->doSetValueFromClient(*updatedPropValue); - doHalEvent(std::move(updatedPropValue)); - } -} - -void EmulatedVehicleHal::initStaticConfig() { - auto configs = mVehicleClient->getAllPropertyConfig(); - for (auto&& cfg : configs) { - VehiclePropertyStore::TokenFunction tokenFunction = nullptr; - - switch (cfg.prop) { - case OBD2_FREEZE_FRAME: { - tokenFunction = [](const VehiclePropValue& propValue) { - return propValue.timestamp; - }; - break; - } - default: - break; - } - - mPropStore->registerProperty(cfg, tokenFunction); - } -} - -void EmulatedVehicleHal::initObd2LiveFrame(const VehiclePropConfig& propConfig) { - static constexpr bool shouldUpdateStatus = true; - - auto liveObd2Frame = createVehiclePropValue(VehiclePropertyType::MIXED, 0); - auto sensorStore = fillDefaultObd2Frame(static_cast(propConfig.configArray[0]), - static_cast(propConfig.configArray[1])); - sensorStore->fillPropValue("", liveObd2Frame.get()); - liveObd2Frame->prop = OBD2_LIVE_FRAME; - - mPropStore->writeValue(*liveObd2Frame, shouldUpdateStatus); -} - -void EmulatedVehicleHal::initObd2FreezeFrame(const VehiclePropConfig& propConfig) { - static constexpr bool shouldUpdateStatus = true; - - auto sensorStore = fillDefaultObd2Frame(static_cast(propConfig.configArray[0]), - static_cast(propConfig.configArray[1])); - - static std::vector sampleDtcs = {"P0070", - "P0102" - "P0123"}; - for (auto&& dtc : sampleDtcs) { - auto freezeFrame = createVehiclePropValue(VehiclePropertyType::MIXED, 0); - sensorStore->fillPropValue(dtc, freezeFrame.get()); - freezeFrame->prop = OBD2_FREEZE_FRAME; - - mPropStore->writeValue(*freezeFrame, shouldUpdateStatus); - } -} - -StatusCode EmulatedVehicleHal::fillObd2FreezeFrame(const VehiclePropValue& requestedPropValue, - VehiclePropValue* outValue) { - if (requestedPropValue.value.int64Values.size() != 1) { - ALOGE("asked for OBD2_FREEZE_FRAME without valid timestamp"); - return StatusCode::INVALID_ARG; - } - auto timestamp = requestedPropValue.value.int64Values[0]; - auto freezeFrame = mPropStore->readValueOrNull(OBD2_FREEZE_FRAME, 0, timestamp); - if (freezeFrame == nullptr) { - ALOGE("asked for OBD2_FREEZE_FRAME at invalid timestamp"); - return StatusCode::INVALID_ARG; - } - outValue->prop = OBD2_FREEZE_FRAME; - outValue->value.int32Values = freezeFrame->value.int32Values; - outValue->value.floatValues = freezeFrame->value.floatValues; - outValue->value.bytes = freezeFrame->value.bytes; - outValue->value.stringValue = freezeFrame->value.stringValue; - outValue->timestamp = freezeFrame->timestamp; - return StatusCode::OK; -} - -StatusCode EmulatedVehicleHal::clearObd2FreezeFrames(const VehiclePropValue& propValue) { - if (propValue.value.int64Values.size() == 0) { - mPropStore->removeValuesForProperty(OBD2_FREEZE_FRAME); - return StatusCode::OK; - } else { - for (int64_t timestamp : propValue.value.int64Values) { - auto freezeFrame = mPropStore->readValueOrNull(OBD2_FREEZE_FRAME, 0, timestamp); - if (freezeFrame == nullptr) { - ALOGE("asked for OBD2_FREEZE_FRAME at invalid timestamp"); - return StatusCode::INVALID_ARG; - } - mPropStore->removeValue(*freezeFrame); - } - } - return StatusCode::OK; -} - -StatusCode EmulatedVehicleHal::fillObd2DtcInfo(VehiclePropValue* outValue) { - std::vector timestamps; - for (const auto& freezeFrame : mPropStore->readValuesForProperty(OBD2_FREEZE_FRAME)) { - timestamps.push_back(freezeFrame.timestamp); - } - outValue->value.int64Values = timestamps; - outValue->prop = OBD2_FREEZE_FRAME_INFO; - return StatusCode::OK; -} - -VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::doInternalHealthCheck() { - VehicleHal::VehiclePropValuePtr v = nullptr; - - // This is an example of very simpe health checking. VHAL is considered healthy if we can read - // PERF_VEHICLE_SPEED. The more comprehensive health checking is required. - VehiclePropValue propValue = { - .prop = static_cast(VehicleProperty::PERF_VEHICLE_SPEED), - }; - auto internalPropValue = mPropStore->readValueOrNull(propValue); - if (internalPropValue != nullptr) { - v = createVhalHeartBeatProp(); - } else { - ALOGW("VHAL health check failed"); - } - return v; -} - -VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::createVhalHeartBeatProp() { - VehicleHal::VehiclePropValuePtr v = getValuePool()->obtainInt64(uptimeMillis()); - v->prop = static_cast(VehicleProperty::VHAL_HEARTBEAT); - v->areaId = 0; - v->status = VehiclePropertyStatus::AVAILABLE; - return v; -} - -} // impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h index 7871c7b41a10f5929e1b81be5ea42a9ea0089cd8..1387f851efa3fcc04b5d761b71f39bfd93b7511a 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 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,26 +14,14 @@ * limitations under the License. */ -#ifndef android_hardware_automotive_vehicle_V2_0_impl_EmulatedVehicleHal_H_ -#define android_hardware_automotive_vehicle_V2_0_impl_EmulatedVehicleHal_H_ +// This file is just used for soft migration from EmulatedVehicleHal to DefaultVehicleHal. +// The virtualized VHAL that uses EmulatedVehicleHal is at a different repo and cannot be updated +// together with this repo, so we need a soft migration. Once the rename is finished at the +// virtualized VHAL side, this file would be removed. -#include -#include -#include -#include -#include +#pragma once -#include - -#include -#include -#include "vhal_v2_0/VehiclePropertyStore.h" - -#include "EmulatedUserHal.h" -#include "EmulatedVehicleConnector.h" -#include "GeneratorHub.h" -#include "PropertyUtils.h" -#include "VehicleEmulator.h" +#include "DefaultVehicleHal.h" namespace android { namespace hardware { @@ -43,66 +31,16 @@ namespace V2_0 { namespace impl { -/** Implementation of VehicleHal that connected to emulator instead of real vehicle network. */ -class EmulatedVehicleHal : public EmulatedVehicleHalIface { -public: - EmulatedVehicleHal(VehiclePropertyStore* propStore, VehicleHalClient* client, - EmulatedUserHal* emulatedUserHal = nullptr); - ~EmulatedVehicleHal() = default; - - // Methods from VehicleHal - void onCreate() override; - std::vector listProperties() override; - VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue, - StatusCode* outStatus) override; - StatusCode set(const VehiclePropValue& propValue) override; - StatusCode subscribe(int32_t property, float sampleRate) override; - StatusCode unsubscribe(int32_t property) override; - bool dump(const hidl_handle& fd, const hidl_vec& options) override; - - // Methods from EmulatedVehicleHalIface - bool setPropertyFromVehicle(const VehiclePropValue& propValue) override; - std::vector getAllProperties() const override; - void getAllPropertiesOverride(); - -private: - constexpr std::chrono::nanoseconds hertzToNanoseconds(float hz) const { - return std::chrono::nanoseconds(static_cast(1000000000L / hz)); - } - - StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request); - void onPropertyValue(const VehiclePropValue& value, bool updateStatus); - - void onContinuousPropertyTimer(const std::vector& properties); - bool isContinuousProperty(int32_t propId) const; - void initStaticConfig(); - void initObd2LiveFrame(const VehiclePropConfig& propConfig); - void initObd2FreezeFrame(const VehiclePropConfig& propConfig); - StatusCode fillObd2FreezeFrame(const VehiclePropValue& requestedPropValue, - VehiclePropValue* outValue); - StatusCode fillObd2DtcInfo(VehiclePropValue* outValue); - StatusCode clearObd2FreezeFrames(const VehiclePropValue& propValue); - VehicleHal::VehiclePropValuePtr doInternalHealthCheck(); - VehicleHal::VehiclePropValuePtr createVhalHeartBeatProp(); - - /* Private members */ - VehiclePropertyStore* mPropStore; - std::unordered_set mHvacPowerProps; - RecurrentTimer mRecurrentTimer; - VehicleHalClient* mVehicleClient; - bool mInEmulator; - bool mInitVhalValueOverride; - std::vector mVehiclePropertiesOverride; - EmulatedUserHal* mEmulatedUserHal; +class EmulatedVehicleHal : public DefaultVehicleHal { + public: + EmulatedVehicleHal(VehiclePropertyStore* propStore, VehicleHalClient* client) + : DefaultVehicleHal(propStore, client){}; }; -} // impl +} // namespace impl } // namespace V2_0 } // namespace vehicle } // namespace automotive } // namespace hardware } // namespace android - - -#endif // android_hardware_automotive_vehicle_V2_0_impl_EmulatedVehicleHal_H_ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/FakeObd2Frame.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/FakeObd2Frame.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d95584d2eef0e9228f1187fdaf187cd0a62fc5a9 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/FakeObd2Frame.cpp @@ -0,0 +1,184 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { + +namespace { + +std::unique_ptr fillDefaultObd2Frame(size_t numVendorIntegerSensors, + size_t numVendorFloatSensors) { + std::unique_ptr sensorStore( + new Obd2SensorStore(numVendorIntegerSensors, numVendorFloatSensors)); + + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::FUEL_SYSTEM_STATUS, + toInt(Obd2FuelSystemStatus::CLOSED_LOOP)); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::MALFUNCTION_INDICATOR_LIGHT_ON, 0); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::IGNITION_MONITORS_SUPPORTED, + toInt(Obd2IgnitionMonitorKind::SPARK)); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::IGNITION_SPECIFIC_MONITORS, + Obd2CommonIgnitionMonitors::COMPONENTS_AVAILABLE | + Obd2CommonIgnitionMonitors::MISFIRE_AVAILABLE | + Obd2SparkIgnitionMonitors::AC_REFRIGERANT_AVAILABLE | + Obd2SparkIgnitionMonitors::EVAPORATIVE_SYSTEM_AVAILABLE); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::INTAKE_AIR_TEMPERATURE, 35); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::COMMANDED_SECONDARY_AIR_STATUS, + toInt(Obd2SecondaryAirStatus::FROM_OUTSIDE_OR_OFF)); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::NUM_OXYGEN_SENSORS_PRESENT, 1); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::RUNTIME_SINCE_ENGINE_START, 500); + sensorStore->setIntegerSensor( + DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON, 0); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::WARMUPS_SINCE_CODES_CLEARED, 51); + sensorStore->setIntegerSensor( + DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_SINCE_CODES_CLEARED, 365); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::ABSOLUTE_BAROMETRIC_PRESSURE, 30); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::CONTROL_MODULE_VOLTAGE, 12); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::AMBIENT_AIR_TEMPERATURE, 18); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::MAX_FUEL_AIR_EQUIVALENCE_RATIO, 1); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::FUEL_TYPE, + toInt(Obd2FuelType::GASOLINE)); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::CALCULATED_ENGINE_LOAD, 0.153); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK1, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK2, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK2, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::INTAKE_MANIFOLD_ABSOLUTE_PRESSURE, 7.5); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ENGINE_RPM, 1250.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::VEHICLE_SPEED, 40.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::TIMING_ADVANCE, 2.5); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::THROTTLE_POSITION, 19.75); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::OXYGEN_SENSOR1_VOLTAGE, 0.265); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::FUEL_TANK_LEVEL_INPUT, 0.824); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::EVAPORATION_SYSTEM_VAPOR_PRESSURE, + -0.373); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::CATALYST_TEMPERATURE_BANK1_SENSOR1, + 190.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::RELATIVE_THROTTLE_POSITION, 3.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ABSOLUTE_THROTTLE_POSITION_B, 0.306); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_D, 0.188); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_E, 0.094); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::COMMANDED_THROTTLE_ACTUATOR, 0.024); + + return sensorStore; +} + +} // namespace + +void initObd2LiveFrame(VehiclePropertyStore* propStore, const VehiclePropConfig& propConfig) { + auto liveObd2Frame = createVehiclePropValue(VehiclePropertyType::MIXED, 0); + auto sensorStore = fillDefaultObd2Frame(static_cast(propConfig.configArray[0]), + static_cast(propConfig.configArray[1])); + sensorStore->fillPropValue("", liveObd2Frame.get()); + liveObd2Frame->prop = OBD2_LIVE_FRAME; + + propStore->writeValue(*liveObd2Frame, true); +} + +void initObd2FreezeFrame(VehiclePropertyStore* propStore, const VehiclePropConfig& propConfig) { + auto sensorStore = fillDefaultObd2Frame(static_cast(propConfig.configArray[0]), + static_cast(propConfig.configArray[1])); + + static std::vector sampleDtcs = {"P0070", "P0102", "P0123"}; + for (auto&& dtc : sampleDtcs) { + auto freezeFrame = createVehiclePropValue(VehiclePropertyType::MIXED, 0); + sensorStore->fillPropValue(dtc, freezeFrame.get()); + freezeFrame->prop = OBD2_FREEZE_FRAME; + ALOGE("freeze frame: %lld", (long long)freezeFrame->timestamp); + + propStore->writeValue(*freezeFrame, true); + } +} + +StatusCode fillObd2FreezeFrame(VehiclePropertyStore* propStore, + const VehiclePropValue& requestedPropValue, + VehiclePropValue* outValue) { + if (requestedPropValue.value.int64Values.size() != 1) { + ALOGE("asked for OBD2_FREEZE_FRAME without valid timestamp"); + return StatusCode::INVALID_ARG; + } + if (propStore->readValuesForProperty(OBD2_FREEZE_FRAME).size() == 0) { + // Should no freeze frame be available at the given timestamp, a response of NOT_AVAILABLE + // must be returned by the implementation + return StatusCode::NOT_AVAILABLE; + } + auto timestamp = requestedPropValue.value.int64Values[0]; + auto freezeFrame = propStore->readValueOrNull(OBD2_FREEZE_FRAME, 0, timestamp); + if (freezeFrame == nullptr) { + ALOGE("asked for OBD2_FREEZE_FRAME at invalid timestamp"); + return StatusCode::INVALID_ARG; + } + outValue->prop = OBD2_FREEZE_FRAME; + outValue->value.int32Values = freezeFrame->value.int32Values; + outValue->value.floatValues = freezeFrame->value.floatValues; + outValue->value.bytes = freezeFrame->value.bytes; + outValue->value.stringValue = freezeFrame->value.stringValue; + outValue->timestamp = freezeFrame->timestamp; + return StatusCode::OK; +} + +StatusCode fillObd2DtcInfo(VehiclePropertyStore* propStore, VehiclePropValue* outValue) { + std::vector timestamps; + for (const auto& freezeFrame : propStore->readValuesForProperty(OBD2_FREEZE_FRAME)) { + timestamps.push_back(freezeFrame.timestamp); + } + outValue->value.int64Values = timestamps; + outValue->prop = OBD2_FREEZE_FRAME_INFO; + return StatusCode::OK; +} + +StatusCode clearObd2FreezeFrames(VehiclePropertyStore* propStore, + const VehiclePropValue& propValue) { + if (propValue.value.int64Values.size() == 0) { + propStore->removeValuesForProperty(OBD2_FREEZE_FRAME); + return StatusCode::OK; + } else { + for (int64_t timestamp : propValue.value.int64Values) { + auto freezeFrame = propStore->readValueOrNull(OBD2_FREEZE_FRAME, 0, timestamp); + if (freezeFrame == nullptr) { + ALOGE("asked for OBD2_FREEZE_FRAME at invalid timestamp"); + return StatusCode::INVALID_ARG; + } + propStore->removeValue(*freezeFrame); + } + } + return StatusCode::OK; +} + +bool isDiagnosticProperty(const VehiclePropConfig& propConfig) { + return (propConfig.prop == OBD2_LIVE_FRAME || propConfig.prop == OBD2_FREEZE_FRAME || + propConfig.prop == OBD2_FREEZE_FRAME_CLEAR || + propConfig.prop == OBD2_FREEZE_FRAME_INFO); +} + +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/FakeObd2Frame.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/FakeObd2Frame.h new file mode 100644 index 0000000000000000000000000000000000000000..704964ca5ea35dc93ba43d2155cdb4a4dd65091f --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/FakeObd2Frame.h @@ -0,0 +1,48 @@ +/* + * 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. + */ +#ifndef android_hardware_automotive_vehicle_V2_0_impl_FakeObd2Frame_H_ +#define android_hardware_automotive_vehicle_V2_0_impl_FakeObd2Frame_H_ + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { + +void initObd2LiveFrame(VehiclePropertyStore* propStore, const VehiclePropConfig& propConfig); +void initObd2FreezeFrame(VehiclePropertyStore* propStore, const VehiclePropConfig& propConfig); +StatusCode fillObd2FreezeFrame(VehiclePropertyStore* propStore, + const VehiclePropValue& requestedPropValue, + VehiclePropValue* outValue); +StatusCode fillObd2DtcInfo(VehiclePropertyStore* propStore, VehiclePropValue* outValue); +StatusCode clearObd2FreezeFrames(VehiclePropertyStore* propStore, + const VehiclePropValue& propValue); +bool isDiagnosticProperty(const VehiclePropConfig& propConfig); + +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_V2_0_impl_FakeObd2Frame_H_ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp index b62918f61edad61c09a6cdc813342ad435b93945..b728d62e255a1367b6b62eecaa1e692a72beb21b 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp @@ -33,12 +33,37 @@ namespace V2_0 { namespace impl { +JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path, int32_t repetition) { + const char* file = path.c_str(); + std::ifstream ifs(file); + if (!ifs) { + ALOGE("%s: couldn't open %s for parsing.", __func__, file); + mGenCfg = { + .index = 0, + .events = {}, + }; + mNumOfIterations = 0; + return; + } + mGenCfg = { + .index = 0, + .events = parseFakeValueJson(ifs), + }; + mNumOfIterations = repetition; +} + JsonFakeValueGenerator::JsonFakeValueGenerator(const VehiclePropValue& request) { const auto& v = request.value; const char* file = v.stringValue.c_str(); std::ifstream ifs(file); if (!ifs) { ALOGE("%s: couldn't open %s for parsing.", __func__, file); + mGenCfg = { + .index = 0, + .events = {}, + }; + mNumOfIterations = 0; + return; } mGenCfg = { .index = 0, @@ -48,10 +73,16 @@ JsonFakeValueGenerator::JsonFakeValueGenerator(const VehiclePropValue& request) mNumOfIterations = v.int32Values.size() < 2 ? -1 : v.int32Values[1]; } -JsonFakeValueGenerator::JsonFakeValueGenerator(std::string path) { +JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path) { std::ifstream ifs(path); if (!ifs) { ALOGE("%s: couldn't open %s for parsing.", __func__, path.c_str()); + mGenCfg = { + .index = 0, + .events = {}, + }; + mNumOfIterations = 0; + return; } mGenCfg = { .index = 0, diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h index dc8ff6680c51a4bc6df2fd5e67f05e909b3831aa..caa3417b6dc0c8f3df7c483aec7c991c313a62fe 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h @@ -41,7 +41,8 @@ private: public: JsonFakeValueGenerator(const VehiclePropValue& request); - JsonFakeValueGenerator(std::string path); + JsonFakeValueGenerator(const std::string& path, int32_t repetition); + JsonFakeValueGenerator(const std::string& path); ~JsonFakeValueGenerator() = default; diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.cpp index 96aaafe0b0ef3edbd63f6eb84e702450dce5442f..a2278bd088c15f242c2343cbe1889c04101aeb9b 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.cpp @@ -29,23 +29,36 @@ namespace V2_0 { namespace impl { +LinearFakeValueGenerator::LinearFakeValueGenerator(int32_t propId, float middleValue, + float currentValue, float dispersion, + float increment, int64_t interval) { + initGenCfg(propId, middleValue, currentValue, dispersion, increment, interval); +} + LinearFakeValueGenerator::LinearFakeValueGenerator(const VehiclePropValue& request) { const auto& v = request.value; + initGenCfg(v.int32Values[1], v.floatValues[0], v.floatValues[0], v.floatValues[1], + v.floatValues[2], v.int64Values[0]); +} + +void LinearFakeValueGenerator::initGenCfg(int32_t propId, float middleValue, float currentValue, + float dispersion, float increment, int64_t interval) { + if (currentValue < middleValue - dispersion || currentValue >= middleValue + dispersion) { + ALOGW("%s: invalid initValue: %f, out of range, default to %f", __func__, currentValue, + middleValue); + currentValue = middleValue; + } mGenCfg = GeneratorCfg{ - .propId = v.int32Values[1], - .initialValue = v.floatValues[0], - .currentValue = v.floatValues[0], - .dispersion = v.floatValues[1], - .increment = v.floatValues[2], - .interval = Nanos(v.int64Values[0]), + .propId = propId, + .middleValue = middleValue, + .currentValue = currentValue, + .dispersion = dispersion, + .increment = increment, + .interval = Nanos(interval), }; } VehiclePropValue LinearFakeValueGenerator::nextEvent() { - mGenCfg.currentValue += mGenCfg.increment; - if (mGenCfg.currentValue > mGenCfg.initialValue + mGenCfg.dispersion) { - mGenCfg.currentValue = mGenCfg.initialValue - mGenCfg.dispersion; - } // TODO: (chenhaosjtuacm) remove "{}" if AGL compiler updated VehiclePropValue event = {.timestamp = {}, .areaId = {}, .prop = mGenCfg.propId}; auto& value = event.value; @@ -67,6 +80,12 @@ VehiclePropValue LinearFakeValueGenerator::nextEvent() { } TimePoint eventTime = Clock::now() + mGenCfg.interval; event.timestamp = eventTime.time_since_epoch().count(); + + mGenCfg.currentValue += mGenCfg.increment; + if (mGenCfg.currentValue >= mGenCfg.middleValue + mGenCfg.dispersion) { + // Wrap around, (i - d) + c - (i + d) = c - 2 * d + mGenCfg.currentValue = mGenCfg.currentValue - 2 * mGenCfg.dispersion; + } return event; } diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.h index d3b666dd9d6fd73ccd9accfb206a7328cb20a955..d8702094093d3e0339074d8e9ddd225f52e5c965 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/LinearFakeValueGenerator.h @@ -35,8 +35,8 @@ private: struct GeneratorCfg { int32_t propId; - float initialValue; - float currentValue; // Should be in range (initialValue +/- dispersion). + float middleValue; + float currentValue; // Should be in range (middleValue +/- dispersion). float dispersion; // Defines minimum and maximum value based on initial value. float increment; // Value that we will be added to currentValue with each timer tick. Nanos interval; @@ -44,6 +44,11 @@ private: public: LinearFakeValueGenerator(const VehiclePropValue& request); + // A linear value generator in range [middleValue - dispersion, middleValue + dispersion), + // starts at 'currentValue' and at each 'interval', increase by 'increment' and loop back if + // exceeds middleValue + dispersion. + LinearFakeValueGenerator(int32_t propId, float middleValue, float currentValue, + float dispersion, float increment, int64_t interval); ~LinearFakeValueGenerator() = default; VehiclePropValue nextEvent(); @@ -52,6 +57,9 @@ public: private: GeneratorCfg mGenCfg; + + void initGenCfg(int32_t propId, float middleValue, float currentValue, float dispersion, + float increment, int64_t interval); }; } // namespace impl diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp deleted file mode 100644 index 81e7c781c21274fc70a9935d7c06333134f0e519..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2017 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 "PipeComm" - -#include -#include - -#include "PipeComm.h" -#include "qemu_pipe.h" - -#define CAR_SERVICE_NAME "pipe:qemud:car" - - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -PipeComm::PipeComm(MessageProcessor* messageProcessor) : CommConn(messageProcessor), mPipeFd(-1) {} - -void PipeComm::start() { - int fd = qemu_pipe_open(CAR_SERVICE_NAME); - - if (fd < 0) { - ALOGE("%s: Could not open connection to service: %s %d", __FUNCTION__, strerror(errno), fd); - return; - } - - ALOGI("%s: Starting pipe connection, fd=%d", __FUNCTION__, fd); - mPipeFd = fd; - - CommConn::start(); -} - -void PipeComm::stop() { - if (mPipeFd > 0) { - ::close(mPipeFd); - mPipeFd = -1; - } - CommConn::stop(); -} - -std::vector PipeComm::read() { - static constexpr int MAX_RX_MSG_SZ = 2048; - std::vector msg = std::vector(MAX_RX_MSG_SZ); - int numBytes; - - numBytes = qemu_pipe_frame_recv(mPipeFd, msg.data(), msg.size()); - - if (numBytes == MAX_RX_MSG_SZ) { - ALOGE("%s: Received max size = %d", __FUNCTION__, MAX_RX_MSG_SZ); - } else if (numBytes > 0) { - msg.resize(numBytes); - return msg; - } else { - ALOGD("%s: Connection terminated on pipe %d, numBytes=%d", __FUNCTION__, mPipeFd, numBytes); - mPipeFd = -1; - } - - return std::vector(); -} - -int PipeComm::write(const std::vector& data) { - int retVal = 0; - - if (mPipeFd != -1) { - retVal = qemu_pipe_frame_send(mPipeFd, data.data(), data.size()); - } - - if (retVal < 0) { - retVal = -errno; - ALOGE("%s: send_cmd: (fd=%d): ERROR: %s", __FUNCTION__, mPipeFd, strerror(errno)); - } - - return retVal; -} - - -} // impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - - - diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.h deleted file mode 100644 index c8eabb8aa76830398df4a0957a2a430af2591bc7..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef android_hardware_automotive_vehicle_V2_0_impl_PipeComm_H_ -#define android_hardware_automotive_vehicle_V2_0_impl_PipeComm_H_ - -#include -#include -#include "CommConn.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -/** - * PipeComm opens a qemu pipe to connect to the emulator, allowing the emulator UI to access the - * Vehicle HAL and simulate changing properties. - * - * Since the pipe is a client, it directly implements CommConn, and only one PipeComm can be open - * at a time. - */ -class PipeComm : public CommConn { - public: - PipeComm(MessageProcessor* messageProcessor); - - void start() override; - void stop() override; - - std::vector read() override; - int write(const std::vector& data) override; - - inline bool isOpen() override { return mPipeFd > 0; } - - private: - int mPipeFd; -}; - -} // impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - - -#endif // android_hardware_automotive_vehicle_V2_0_impl_PipeComm_H_ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h index 51251a7e70418a3ea747c93835d094169c97902c..f58e09a67d0cef520daf2bd2a0f52352bf70bb09 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PropertyUtils.h @@ -37,6 +37,7 @@ constexpr int WINDOW_2_RIGHT = (int)VehicleAreaWindow::ROW_2_RIGHT; constexpr int WINDOW_ROOF_TOP_1 = (int)VehicleAreaWindow::ROOF_TOP_1; constexpr int FAN_DIRECTION_FACE = (int)VehicleHvacFanDirection::FACE; constexpr int FAN_DIRECTION_FLOOR = (int)VehicleHvacFanDirection::FLOOR; +constexpr int FAN_DIRECTION_DEFROST = (int)VehicleHvacFanDirection::DEFROST; constexpr int OBD2_LIVE_FRAME = (int)VehicleProperty::OBD2_LIVE_FRAME; constexpr int OBD2_FREEZE_FRAME = (int)VehicleProperty::OBD2_FREEZE_FRAME; constexpr int OBD2_FREEZE_FRAME_INFO = (int)VehicleProperty::OBD2_FREEZE_FRAME_INFO; @@ -71,35 +72,6 @@ constexpr int WHEEL_FRONT_RIGHT = (int)VehicleAreaWheel::RIGHT_FRONT; constexpr int WHEEL_REAR_LEFT = (int)VehicleAreaWheel::LEFT_REAR; constexpr int WHEEL_REAR_RIGHT = (int)VehicleAreaWheel::RIGHT_REAR; -/** - * This property is used for test purpose to generate fake events. Here is the test package that - * is referencing this property definition: packages/services/Car/tests/vehiclehal_test - */ -const int32_t kGenerateFakeDataControllingProperty = - 0x0666 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::MIXED; - -/** - * This property is used for test purpose to set properties' value from vehicle. - * For example: Mocking hard button press triggering a HVAC fan speed change. - * Android set kSetPropertyFromVehicleForTest with an array of integer {HVAC_FAN_SPEED, value of - * fan speed} and a long value indicates the timestamp of the events . - * It only works with integer type properties. - */ -const int32_t kSetIntPropertyFromVehicleForTest = - 0x1112 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::MIXED; -/** - * This property is used for test purpose to set properties' value from vehicle. - * It only works with float type properties. - */ -const int32_t kSetFloatPropertyFromVehicleForTest = - 0x1113 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::MIXED; -/** - * This property is used for test purpose to set properties' value from vehicle. - * It only works with boolean type properties. - */ -const int32_t kSetBooleanPropertyFromVehicleForTest = - 0x1114 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::MIXED; - /** * This property is used for test purpose. End to end tests use this property to test set and get * method for MIXED type properties. @@ -128,67 +100,6 @@ constexpr int32_t VENDOR_CLUSTER_NAVIGATION_STATE = toVendor(VehicleProperty::CLUSTER_NAVIGATION_STATE); #endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING -/** - * FakeDataCommand enum defines the supported command type for kGenerateFakeDataControllingProperty. - * All those commands can be send independently with each other. And each will override the one sent - * previously. - * - * The controlling property has the following format: - * - * int32Values[0] - command enum defined in FakeDataCommand - * - * The format of the arguments is defined for each command type as below: - */ -enum class FakeDataCommand : int32_t { - /** - * Starts linear fake data generation. Caller must provide additional data: - * int32Values[1] - vehicle property to which command applies - * int64Values[0] - periodic interval in nanoseconds - * floatValues[0] - initial value - * floatValues[1] - dispersion defines the min/max value relative to initial value, where - * max = initial_value + dispersion, min = initial_value - dispersion. - * Dispersion should be non-negative, otherwise the behavior is undefined. - * floatValues[2] - increment, with every timer tick the value will be incremented by this - * amount. When reaching to max value, the current value will be set to - * min. It should be non-negative, otherwise the behavior is undefined. - */ - StartLinear = 0, - - /** Stops linear fake data generation that was triggered by StartLinear commands. - * int32Values[1] - vehicle property to which command applies. VHAL will stop the - * corresponding linear generation for that property. - */ - StopLinear = 1, - - /** - * Starts JSON-based fake data generation. It iterates through JSON-encoded VHAL events from a - * file and inject them to VHAL. The iteration can be repeated multiple times or infinitely. - * Caller must provide additional data: - * int32Values[1] - number of iterations. If it is not provided or -1. The iteration will be - * repeated infinite times. - * stringValue - path to the fake values JSON file - */ - StartJson = 2, - - /** - * Stops JSON-based fake data generation. As multiple JSON-based generation can happen at the - * same time. Caller must provide the path of fake value JSON file to stop the corresponding - * generation: - * stringValue - path to the fake values JSON file - */ - StopJson = 3, - - /** - * Injects key press event (HAL incorporates UP/DOWN acction and triggers 2 HAL events for every - * key-press). We set the enum with high number to leave space for future start/stop commands. - * Caller must provide the following data: - * int32Values[2] - Android key code - * int32Values[3] - target display (0 - for main display, 1 - for instrument cluster, see - * VehicleDisplay) - */ - KeyPress = 100, -}; - /** * These properties are placeholder properties for developers to test new features without * implementing a real property. diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp deleted file mode 100644 index 916c320b90e88291c556aa3984f170954a84afc9..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 2017 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 "SocketComm" - -#include -#include -#include -#include -#include -#include - -#include "SocketComm.h" - -// Socket to use when communicating with Host PC -static constexpr int DEBUG_SOCKET = 33452; - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -SocketComm::SocketComm(MessageProcessor* messageProcessor) - : mListenFd(-1), mMessageProcessor(messageProcessor) {} - -SocketComm::~SocketComm() { -} - -void SocketComm::start() { - if (!listen()) { - return; - } - - mListenThread = std::make_unique(std::bind(&SocketComm::listenThread, this)); -} - -void SocketComm::stop() { - if (mListenFd > 0) { - ::close(mListenFd); - if (mListenThread->joinable()) { - mListenThread->join(); - } - mListenFd = -1; - } -} - -void SocketComm::sendMessage(vhal_proto::EmulatorMessage const& msg) { - std::lock_guard lock(mMutex); - for (std::unique_ptr const& conn : mOpenConnections) { - conn->sendMessage(msg); - } -} - -bool SocketComm::listen() { - int retVal; - struct sockaddr_in servAddr; - - mListenFd = socket(AF_INET, SOCK_STREAM, 0); - if (mListenFd < 0) { - ALOGE("%s: socket() failed, mSockFd=%d, errno=%d", __FUNCTION__, mListenFd, errno); - mListenFd = -1; - return false; - } - - memset(&servAddr, 0, sizeof(servAddr)); - servAddr.sin_family = AF_INET; - servAddr.sin_addr.s_addr = INADDR_ANY; - servAddr.sin_port = htons(DEBUG_SOCKET); - - retVal = bind(mListenFd, reinterpret_cast(&servAddr), sizeof(servAddr)); - if(retVal < 0) { - ALOGE("%s: Error on binding: retVal=%d, errno=%d", __FUNCTION__, retVal, errno); - close(mListenFd); - mListenFd = -1; - return false; - } - - ALOGI("%s: Listening for connections on port %d", __FUNCTION__, DEBUG_SOCKET); - if (::listen(mListenFd, 1) == -1) { - ALOGE("%s: Error on listening: errno: %d: %s", __FUNCTION__, errno, strerror(errno)); - return false; - } - return true; -} - -SocketConn* SocketComm::accept() { - sockaddr_in cliAddr; - socklen_t cliLen = sizeof(cliAddr); - int sfd = ::accept(mListenFd, reinterpret_cast(&cliAddr), &cliLen); - - if (sfd > 0) { - char addr[INET_ADDRSTRLEN]; - inet_ntop(AF_INET, &cliAddr.sin_addr, addr, INET_ADDRSTRLEN); - - ALOGD("%s: Incoming connection received from %s:%d", __FUNCTION__, addr, cliAddr.sin_port); - return new SocketConn(mMessageProcessor, sfd); - } - - return nullptr; -} - -void SocketComm::listenThread() { - while (true) { - SocketConn* conn = accept(); - if (conn == nullptr) { - return; - } - - conn->start(); - { - std::lock_guard lock(mMutex); - mOpenConnections.push_back(std::unique_ptr(conn)); - } - } -} - -/** - * Called occasionally to clean up connections that have been closed. - */ -void SocketComm::removeClosedConnections() { - std::lock_guard lock(mMutex); - std::remove_if(mOpenConnections.begin(), mOpenConnections.end(), - [](std::unique_ptr const& c) { return !c->isOpen(); }); -} - -SocketConn::SocketConn(MessageProcessor* messageProcessor, int sfd) - : CommConn(messageProcessor), mSockFd(sfd) {} - -/** - * Reads, in a loop, exactly numBytes from the given fd. If the connection is closed, returns - * an empty buffer, otherwise will return exactly the given number of bytes. - */ -std::vector readExactly(int fd, int numBytes) { - std::vector buffer(numBytes); - int totalRead = 0; - int offset = 0; - while (totalRead < numBytes) { - int numRead = ::read(fd, &buffer.data()[offset], numBytes - offset); - if (numRead == 0) { - buffer.resize(0); - return buffer; - } - - totalRead += numRead; - } - return buffer; -} - -/** - * Reads an int, guaranteed to be non-zero, from the given fd. If the connection is closed, returns - * -1. - */ -int32_t readInt(int fd) { - std::vector buffer = readExactly(fd, sizeof(int32_t)); - if (buffer.size() == 0) { - return -1; - } - - int32_t value = *reinterpret_cast(buffer.data()); - return ntohl(value); -} - -std::vector SocketConn::read() { - int32_t msgSize = readInt(mSockFd); - if (msgSize <= 0) { - ALOGD("%s: Connection terminated on socket %d", __FUNCTION__, mSockFd); - return std::vector(); - } - - return readExactly(mSockFd, msgSize); -} - -void SocketConn::stop() { - if (mSockFd > 0) { - close(mSockFd); - mSockFd = -1; - } -} - -int SocketConn::write(const std::vector& data) { - static constexpr int MSG_HEADER_LEN = 4; - int retVal = 0; - union { - uint32_t msgLen; - uint8_t msgLenBytes[MSG_HEADER_LEN]; - }; - - // Prepare header for the message - msgLen = static_cast(data.size()); - msgLen = htonl(msgLen); - - if (mSockFd > 0) { - retVal = ::write(mSockFd, msgLenBytes, MSG_HEADER_LEN); - - if (retVal == MSG_HEADER_LEN) { - retVal = ::write(mSockFd, data.data(), data.size()); - } - } - - return retVal; -} - -} // impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.h deleted file mode 100644 index 52326b9fc755ea718f9284f27966509333df1622..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/SocketComm.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef android_hardware_automotive_vehicle_V2_0_impl_SocketComm_H_ -#define android_hardware_automotive_vehicle_V2_0_impl_SocketComm_H_ - -#include -#include -#include -#include "CommConn.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -class SocketConn; - -/** - * SocketComm opens a socket, and listens for connections from clients. Typically the client will be - * adb's TCP port-forwarding to enable a host PC to connect to the VehicleHAL. - */ -class SocketComm { - public: - SocketComm(MessageProcessor* messageProcessor); - virtual ~SocketComm(); - - void start(); - void stop(); - - /** - * Serialized and send the given message to all connected clients. - */ - void sendMessage(vhal_proto::EmulatorMessage const& msg); - - private: - int mListenFd; - std::unique_ptr mListenThread; - std::vector> mOpenConnections; - MessageProcessor* mMessageProcessor; - std::mutex mMutex; - - /** - * Opens the socket and begins listening. - * - * @return bool Returns true on success. - */ - bool listen(); - - /** - * Blocks and waits for a connection from a client, returns a new SocketConn with the connection - * or null, if the connection has been closed. - * - * @return int Returns fd or socket number if connection is successful. - * Otherwise, returns -1 if no connection is availble. - */ - SocketConn* accept(); - - void listenThread(); - - void removeClosedConnections(); -}; - -/** - * SocketConn represents a single connection to a client. - */ -class SocketConn : public CommConn { - public: - SocketConn(MessageProcessor* messageProcessor, int sfd); - virtual ~SocketConn() = default; - - /** - * Blocking call to read data from the connection. - * - * @return std::vector Serialized protobuf data received from emulator. This will be - * an empty vector if the connection was closed or some other error occurred. - */ - std::vector read() override; - - /** - * Closes a connection if it is open. - */ - void stop() override; - - /** - * Transmits a string of data to the emulator. - * - * @param data Serialized protobuf data to transmit. - * - * @return int Number of bytes transmitted, or -1 if failed. - */ - int write(const std::vector& data) override; - - inline bool isOpen() override { return mSockFd > 0; } - - private: - int mSockFd; -}; - -} // impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - - -#endif // android_hardware_automotive_vehicle_V2_0_impl_SocketComm_H_ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.cpp deleted file mode 100644 index f7d0854d1c09fb3c212f757c0cf3fefcc25ec863..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (C) 2017 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 "VehicleEmulator_v2_0" -#include - -#include -#include -#include -#include - -#include - -#include "PipeComm.h" -#include "ProtoMessageConverter.h" -#include "SocketComm.h" - -#include "VehicleEmulator.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -VehicleEmulator::VehicleEmulator(EmulatedVehicleHalIface* hal) : mHal{hal} { - mHal->registerEmulator(this); - - ALOGI("Starting SocketComm"); - mSocketComm = std::make_unique(this); - mSocketComm->start(); - - if (isInEmulator()) { - ALOGI("Starting PipeComm"); - mPipeComm = std::make_unique(this); - mPipeComm->start(); - } -} - -VehicleEmulator::~VehicleEmulator() { - mSocketComm->stop(); - if (mPipeComm) { - mPipeComm->stop(); - } -} - -/** - * This is called by the HAL when a property changes. We need to notify our clients that it has - * changed. - */ -void VehicleEmulator::doSetValueFromClient(const VehiclePropValue& propValue) { - vhal_proto::EmulatorMessage msg; - vhal_proto::VehiclePropValue* val = msg.add_value(); - populateProtoVehiclePropValue(val, &propValue); - msg.set_status(vhal_proto::RESULT_OK); - msg.set_msg_type(vhal_proto::SET_PROPERTY_ASYNC); - - mSocketComm->sendMessage(msg); - if (mPipeComm) { - mPipeComm->sendMessage(msg); - } -} - -void VehicleEmulator::doGetConfig(VehicleEmulator::EmulatorMessage const& rxMsg, - VehicleEmulator::EmulatorMessage& respMsg) { - std::vector configs = mHal->listProperties(); - vhal_proto::VehiclePropGet getProp = rxMsg.prop(0); - - respMsg.set_msg_type(vhal_proto::GET_CONFIG_RESP); - respMsg.set_status(vhal_proto::ERROR_INVALID_PROPERTY); - - for (auto& config : configs) { - // Find the config we are looking for - if (config.prop == getProp.prop()) { - vhal_proto::VehiclePropConfig* protoCfg = respMsg.add_config(); - populateProtoVehicleConfig(protoCfg, config); - respMsg.set_status(vhal_proto::RESULT_OK); - break; - } - } -} - -void VehicleEmulator::doGetConfigAll(VehicleEmulator::EmulatorMessage const& /* rxMsg */, - VehicleEmulator::EmulatorMessage& respMsg) { - std::vector configs = mHal->listProperties(); - - respMsg.set_msg_type(vhal_proto::GET_CONFIG_ALL_RESP); - respMsg.set_status(vhal_proto::RESULT_OK); - - for (auto& config : configs) { - vhal_proto::VehiclePropConfig* protoCfg = respMsg.add_config(); - populateProtoVehicleConfig(protoCfg, config); - } -} - -void VehicleEmulator::doGetProperty(VehicleEmulator::EmulatorMessage const& rxMsg, - VehicleEmulator::EmulatorMessage& respMsg) { - int32_t areaId = 0; - vhal_proto::VehiclePropGet getProp = rxMsg.prop(0); - int32_t propId = getProp.prop(); - vhal_proto::Status status = vhal_proto::ERROR_INVALID_PROPERTY; - - respMsg.set_msg_type(vhal_proto::GET_PROPERTY_RESP); - - if (getProp.has_area_id()) { - areaId = getProp.area_id(); - } - - { - VehiclePropValue request = { - .areaId = areaId, - .prop = propId, - }; - StatusCode halStatus; - auto val = mHal->get(request, &halStatus); - if (val != nullptr) { - vhal_proto::VehiclePropValue* protoVal = respMsg.add_value(); - populateProtoVehiclePropValue(protoVal, val.get()); - status = vhal_proto::RESULT_OK; - } - } - - respMsg.set_status(status); -} - -void VehicleEmulator::doGetPropertyAll(VehicleEmulator::EmulatorMessage const& /* rxMsg */, - VehicleEmulator::EmulatorMessage& respMsg) { - respMsg.set_msg_type(vhal_proto::GET_PROPERTY_ALL_RESP); - respMsg.set_status(vhal_proto::RESULT_OK); - - { - for (const auto& prop : mHal->getAllProperties()) { - vhal_proto::VehiclePropValue* protoVal = respMsg.add_value(); - populateProtoVehiclePropValue(protoVal, &prop); - } - } -} - -void VehicleEmulator::doSetProperty(VehicleEmulator::EmulatorMessage const& rxMsg, - VehicleEmulator::EmulatorMessage& respMsg) { - vhal_proto::VehiclePropValue protoVal = rxMsg.value(0); - VehiclePropValue val = { - .timestamp = elapsedRealtimeNano(), - .areaId = protoVal.area_id(), - .prop = protoVal.prop(), - .status = (VehiclePropertyStatus)protoVal.status(), - }; - - respMsg.set_msg_type(vhal_proto::SET_PROPERTY_RESP); - - // Copy value data if it is set. This automatically handles complex data types if needed. - if (protoVal.has_string_value()) { - val.value.stringValue = protoVal.string_value().c_str(); - } - - if (protoVal.has_bytes_value()) { - val.value.bytes = std::vector { protoVal.bytes_value().begin(), - protoVal.bytes_value().end() }; - } - - if (protoVal.int32_values_size() > 0) { - val.value.int32Values = std::vector { protoVal.int32_values().begin(), - protoVal.int32_values().end() }; - } - - if (protoVal.int64_values_size() > 0) { - val.value.int64Values = std::vector { protoVal.int64_values().begin(), - protoVal.int64_values().end() }; - } - - if (protoVal.float_values_size() > 0) { - val.value.floatValues = std::vector { protoVal.float_values().begin(), - protoVal.float_values().end() }; - } - - bool halRes = mHal->setPropertyFromVehicle(val); - respMsg.set_status(halRes ? vhal_proto::RESULT_OK : vhal_proto::ERROR_INVALID_PROPERTY); -} - -void VehicleEmulator::processMessage(vhal_proto::EmulatorMessage const& rxMsg, - vhal_proto::EmulatorMessage& respMsg) { - switch (rxMsg.msg_type()) { - case vhal_proto::GET_CONFIG_CMD: - doGetConfig(rxMsg, respMsg); - break; - case vhal_proto::GET_CONFIG_ALL_CMD: - doGetConfigAll(rxMsg, respMsg); - break; - case vhal_proto::GET_PROPERTY_CMD: - doGetProperty(rxMsg, respMsg); - break; - case vhal_proto::GET_PROPERTY_ALL_CMD: - doGetPropertyAll(rxMsg, respMsg); - break; - case vhal_proto::SET_PROPERTY_CMD: - doSetProperty(rxMsg, respMsg); - break; - default: - ALOGW("%s: Unknown message received, type = %d", __func__, rxMsg.msg_type()); - respMsg.set_status(vhal_proto::ERROR_UNIMPLEMENTED_CMD); - break; - } -} - -void VehicleEmulator::populateProtoVehicleConfig(vhal_proto::VehiclePropConfig* protoCfg, - const VehiclePropConfig& cfg) { - return proto_msg_converter::toProto(protoCfg, cfg); -} - -void VehicleEmulator::populateProtoVehiclePropValue(vhal_proto::VehiclePropValue* protoVal, - const VehiclePropValue* val) { - return proto_msg_converter::toProto(protoVal, *val); -} - -bool isInEmulator() { - return android::base::GetBoolProperty("ro.boot.qemu", false); -} - -} // impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.h deleted file mode 100644 index 434d79b5426ceeb0d84639e2d935898cafbbe480..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleEmulator.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef android_hardware_automotive_vehicle_V2_0_impl_VehicleHalEmulator_H_ -#define android_hardware_automotive_vehicle_V2_0_impl_VehicleHalEmulator_H_ - -#include -#include -#include -#include - -#include "vhal_v2_0/VehicleHal.h" - -#include "CommConn.h" -#include "PipeComm.h" -#include "SocketComm.h" -#include "VehicleHalProto.pb.h" - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { -namespace V2_0 { - -namespace impl { - -class VehicleEmulator; // Forward declaration. - -/** Extension of VehicleHal that used by VehicleEmulator. */ -class EmulatedVehicleHalIface : public VehicleHal { -public: - virtual bool setPropertyFromVehicle(const VehiclePropValue& propValue) = 0; - virtual std::vector getAllProperties() const = 0; - - void registerEmulator(VehicleEmulator* emulator) { - ALOGI("%s, emulator: %p", __func__, emulator); - std::lock_guard g(mEmulatorLock); - mEmulator = emulator; - } - -protected: - VehicleEmulator* getEmulatorOrDie() { - std::lock_guard g(mEmulatorLock); - if (mEmulator == nullptr) abort(); - return mEmulator; - } - -private: - mutable std::mutex mEmulatorLock; - VehicleEmulator* mEmulator; -}; - -/** - * Emulates vehicle by providing controlling interface from host side either through ADB or Pipe. - */ -class VehicleEmulator : public MessageProcessor { - public: - VehicleEmulator(EmulatedVehicleHalIface* hal); - virtual ~VehicleEmulator(); - - void doSetValueFromClient(const VehiclePropValue& propValue); - void processMessage(vhal_proto::EmulatorMessage const& rxMsg, - vhal_proto::EmulatorMessage& respMsg) override; - - private: - friend class ConnectionThread; - using EmulatorMessage = vhal_proto::EmulatorMessage; - - void doGetConfig(EmulatorMessage const& rxMsg, EmulatorMessage& respMsg); - void doGetConfigAll(EmulatorMessage const& rxMsg, EmulatorMessage& respMsg); - void doGetProperty(EmulatorMessage const& rxMsg, EmulatorMessage& respMsg); - void doGetPropertyAll(EmulatorMessage const& rxMsg, EmulatorMessage& respMsg); - void doSetProperty(EmulatorMessage const& rxMsg, EmulatorMessage& respMsg); - void populateProtoVehicleConfig(vhal_proto::VehiclePropConfig* protoCfg, - const VehiclePropConfig& cfg); - void populateProtoVehiclePropValue(vhal_proto::VehiclePropValue* protoVal, - const VehiclePropValue* val); - -private: - EmulatedVehicleHalIface* mHal; - std::unique_ptr mSocketComm; - std::unique_ptr mPipeComm; -}; - -// determine if it's running inside Android Emulator -bool isInEmulator(); - -} // impl - -} // namespace V2_0 -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - -#endif // android_hardware_automotive_vehicle_V2_0_impl_VehicleHalEmulator_H_ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.cpp index 25ffc6d70deb4688164f8404472d3e7acc8181fa..bafd170dccdcd6e5a18a711cc5d2be5cd99cebcf 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.cpp @@ -18,7 +18,13 @@ #include -namespace android::hardware::automotive::vehicle::V2_0::impl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { void VehicleHalClient::onPropertyValue(const VehiclePropValue& value, bool updateStatus) { if (!mPropCallback) { @@ -36,4 +42,10 @@ void VehicleHalClient::registerPropertyValueCallback(PropertyCallBackType&& call mPropCallback = std::move(callback); } -} // namespace android::hardware::automotive::vehicle::V2_0::impl +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.h index 81dfca1b06fcbddacb1d9f98e467d0b92aaa79e8..2473f194c5e83deff62f59e033c7c6f81eac9f39 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalClient.h @@ -18,7 +18,13 @@ #include -namespace android::hardware::automotive::vehicle::V2_0::impl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { + +namespace impl { // The common client operations that may be used by both native and // virtualized VHAL clients. @@ -40,4 +46,10 @@ class VehicleHalClient : public IVehicleClient { PropertyCallBackType mPropCallback; }; -} // namespace android::hardware::automotive::vehicle::V2_0::impl +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp deleted file mode 100644 index 57dd7d42155dacd13099d24b299f56c46e2d3388..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "VehicleHalServer" - -#include "VehicleHalServer.h" - -#include - -#include -#include - -#include "DefaultConfig.h" -#include "JsonFakeValueGenerator.h" -#include "LinearFakeValueGenerator.h" -#include "Obd2SensorStore.h" - -namespace android::hardware::automotive::vehicle::V2_0::impl { - -static bool isDiagnosticProperty(VehiclePropConfig propConfig) { - switch (propConfig.prop) { - case OBD2_LIVE_FRAME: - case OBD2_FREEZE_FRAME: - case OBD2_FREEZE_FRAME_CLEAR: - case OBD2_FREEZE_FRAME_INFO: - return true; - } - return false; -} - -VehicleHalServer::VehicleHalServer() { - constexpr bool shouldUpdateStatus = true; - - for (auto& it : kVehicleProperties) { - VehiclePropConfig cfg = it.config; - - mServerSidePropStore.registerProperty(cfg); - - if (isDiagnosticProperty(cfg)) { - continue; - } - - // A global property will have only a single area - int32_t numAreas = isGlobalProp(cfg.prop) ? 1 : cfg.areaConfigs.size(); - - for (int i = 0; i < numAreas; i++) { - int32_t curArea = isGlobalProp(cfg.prop) ? 0 : cfg.areaConfigs[i].areaId; - - // Create a separate instance for each individual zone - VehiclePropValue prop = { - .areaId = curArea, - .prop = cfg.prop, - }; - - if (it.initialAreaValues.empty()) { - prop.value = it.initialValue; - } else if (auto valueForAreaIt = it.initialAreaValues.find(curArea); - valueForAreaIt != it.initialAreaValues.end()) { - prop.value = valueForAreaIt->second; - } else { - LOG(WARNING) << __func__ << " failed to get default value for" - << " prop 0x" << std::hex << cfg.prop << " area 0x" << std::hex - << curArea; - prop.status = VehiclePropertyStatus::UNAVAILABLE; - } - - mServerSidePropStore.writeValue(prop, shouldUpdateStatus); - } - } -} - -void VehicleHalServer::sendAllValuesToClient() { - constexpr bool update_status = true; - auto values = mServerSidePropStore.readAllValues(); - for (const auto& value : values) { - onPropertyValueFromCar(value, update_status); - } -} - -GeneratorHub* VehicleHalServer::getGenerator() { - return &mGeneratorHub; -} - -VehiclePropValuePool* VehicleHalServer::getValuePool() const { - if (!mValuePool) { - LOG(WARNING) << __func__ << ": Value pool not set!"; - } - return mValuePool; -} - -void VehicleHalServer::setValuePool(VehiclePropValuePool* valuePool) { - if (!valuePool) { - LOG(WARNING) << __func__ << ": Setting value pool to nullptr!"; - } - mValuePool = valuePool; -} - -void VehicleHalServer::onFakeValueGenerated(const VehiclePropValue& value) { - constexpr bool updateStatus = true; - LOG(DEBUG) << __func__ << ": " << toString(value); - auto updatedPropValue = getValuePool()->obtain(value); - if (updatedPropValue) { - updatedPropValue->timestamp = value.timestamp; - updatedPropValue->status = VehiclePropertyStatus::AVAILABLE; - mServerSidePropStore.writeValue(*updatedPropValue, updateStatus); - onPropertyValueFromCar(*updatedPropValue, updateStatus); - } -} - -std::vector VehicleHalServer::onGetAllPropertyConfig() const { - return mServerSidePropStore.getAllConfigs(); -} - -StatusCode VehicleHalServer::handleGenerateFakeDataRequest(const VehiclePropValue& request) { - constexpr bool updateStatus = true; - - LOG(INFO) << __func__; - const auto& v = request.value; - if (!v.int32Values.size()) { - LOG(ERROR) << __func__ << ": expected at least \"command\" field in int32Values"; - return StatusCode::INVALID_ARG; - } - - FakeDataCommand command = static_cast(v.int32Values[0]); - - switch (command) { - case FakeDataCommand::StartLinear: { - LOG(INFO) << __func__ << ", FakeDataCommand::StartLinear"; - if (v.int32Values.size() < 2) { - LOG(ERROR) << __func__ << ": expected property ID in int32Values"; - return StatusCode::INVALID_ARG; - } - if (!v.int64Values.size()) { - LOG(ERROR) << __func__ << ": interval is not provided in int64Values"; - return StatusCode::INVALID_ARG; - } - if (v.floatValues.size() < 3) { - LOG(ERROR) << __func__ << ": expected at least 3 elements in floatValues, got: " - << v.floatValues.size(); - return StatusCode::INVALID_ARG; - } - int32_t cookie = v.int32Values[1]; - getGenerator()->registerGenerator(cookie, - std::make_unique(request)); - break; - } - case FakeDataCommand::StartJson: { - LOG(INFO) << __func__ << ", FakeDataCommand::StartJson"; - if (v.stringValue.empty()) { - LOG(ERROR) << __func__ << ": path to JSON file is missing"; - return StatusCode::INVALID_ARG; - } - int32_t cookie = std::hash()(v.stringValue); - getGenerator()->registerGenerator(cookie, - std::make_unique(request)); - break; - } - case FakeDataCommand::StopLinear: { - LOG(INFO) << __func__ << ", FakeDataCommand::StopLinear"; - if (v.int32Values.size() < 2) { - LOG(ERROR) << __func__ << ": expected property ID in int32Values"; - return StatusCode::INVALID_ARG; - } - int32_t cookie = v.int32Values[1]; - getGenerator()->unregisterGenerator(cookie); - break; - } - case FakeDataCommand::StopJson: { - LOG(INFO) << __func__ << ", FakeDataCommand::StopJson"; - if (v.stringValue.empty()) { - LOG(ERROR) << __func__ << ": path to JSON file is missing"; - return StatusCode::INVALID_ARG; - } - int32_t cookie = std::hash()(v.stringValue); - getGenerator()->unregisterGenerator(cookie); - break; - } - case FakeDataCommand::KeyPress: { - LOG(INFO) << __func__ << ", FakeDataCommand::KeyPress"; - int32_t keyCode = request.value.int32Values[2]; - int32_t display = request.value.int32Values[3]; - // Send back to HAL - onPropertyValueFromCar( - *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_DOWN, keyCode, display), - updateStatus); - onPropertyValueFromCar( - *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_UP, keyCode, display), - updateStatus); - break; - } - default: { - LOG(ERROR) << __func__ << ": unexpected command: " << toInt(command); - return StatusCode::INVALID_ARG; - } - } - return StatusCode::OK; -} - -VehicleHalServer::VehiclePropValuePtr VehicleHalServer::createApPowerStateReq( - VehicleApPowerStateReq state, int32_t param) { - auto req = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 2); - req->prop = toInt(VehicleProperty::AP_POWER_STATE_REQ); - req->areaId = 0; - req->timestamp = elapsedRealtimeNano(); - req->status = VehiclePropertyStatus::AVAILABLE; - req->value.int32Values[0] = toInt(state); - req->value.int32Values[1] = param; - return req; -} - -VehicleHalServer::VehiclePropValuePtr VehicleHalServer::createHwInputKeyProp( - VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay) { - auto keyEvent = getValuePool()->obtain(VehiclePropertyType::INT32_VEC, 3); - keyEvent->prop = toInt(VehicleProperty::HW_KEY_INPUT); - keyEvent->areaId = 0; - keyEvent->timestamp = elapsedRealtimeNano(); - keyEvent->status = VehiclePropertyStatus::AVAILABLE; - keyEvent->value.int32Values[0] = toInt(action); - keyEvent->value.int32Values[1] = keyCode; - keyEvent->value.int32Values[2] = targetDisplay; - return keyEvent; -} - -StatusCode VehicleHalServer::onSetProperty(const VehiclePropValue& value, bool updateStatus) { - LOG(DEBUG) << "onSetProperty(" << value.prop << ")"; - - // Some properties need to be treated non-trivially - switch (value.prop) { - case kGenerateFakeDataControllingProperty: - return handleGenerateFakeDataRequest(value); - - // set the value from vehicle side, used in end to end test. - case kSetIntPropertyFromVehicleForTest: { - auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::INT32, 1); - updatedPropValue->prop = value.value.int32Values[0]; - updatedPropValue->value.int32Values[0] = value.value.int32Values[1]; - updatedPropValue->timestamp = value.value.int64Values[0]; - updatedPropValue->areaId = value.areaId; - onPropertyValueFromCar(*updatedPropValue, updateStatus); - return StatusCode::OK; - } - case kSetFloatPropertyFromVehicleForTest: { - auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::FLOAT, 1); - updatedPropValue->prop = value.value.int32Values[0]; - updatedPropValue->value.floatValues[0] = value.value.floatValues[0]; - updatedPropValue->timestamp = value.value.int64Values[0]; - updatedPropValue->areaId = value.areaId; - onPropertyValueFromCar(*updatedPropValue, updateStatus); - return StatusCode::OK; - } - case kSetBooleanPropertyFromVehicleForTest: { - auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::BOOLEAN, 1); - updatedPropValue->prop = value.value.int32Values[1]; - updatedPropValue->value.int32Values[0] = value.value.int32Values[0]; - updatedPropValue->timestamp = value.value.int64Values[0]; - updatedPropValue->areaId = value.areaId; - onPropertyValueFromCar(*updatedPropValue, updateStatus); - return StatusCode::OK; - } - - case AP_POWER_STATE_REPORT: - switch (value.value.int32Values[0]) { - case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT): - case toInt(VehicleApPowerStateReport::SHUTDOWN_CANCELLED): - case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL): - // CPMS is in WAIT_FOR_VHAL state, simply move to ON - // Send back to HAL - // ALWAYS update status for generated property value - onPropertyValueFromCar(*createApPowerStateReq(VehicleApPowerStateReq::ON, 0), - true /* updateStatus */); - break; - case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY): - case toInt(VehicleApPowerStateReport::SHUTDOWN_START): - // CPMS is in WAIT_FOR_FINISH state, send the FINISHED command - // Send back to HAL - // ALWAYS update status for generated property value - onPropertyValueFromCar( - *createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0), - true /* updateStatus */); - break; - case toInt(VehicleApPowerStateReport::ON): - case toInt(VehicleApPowerStateReport::SHUTDOWN_POSTPONE): - case toInt(VehicleApPowerStateReport::SHUTDOWN_PREPARE): - // Do nothing - break; - default: - // Unknown state - break; - } - break; - -#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING - case toInt(VehicleProperty::CLUSTER_REPORT_STATE): - case toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY): - case toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE): - case VENDOR_CLUSTER_SWITCH_UI: - case VENDOR_CLUSTER_DISPLAY_STATE: { - auto updatedPropValue = createVehiclePropValue(getPropType(value.prop), 0); - updatedPropValue->prop = value.prop & ~toInt(VehiclePropertyGroup::MASK); - if (isSystemProperty(value.prop)) { - updatedPropValue->prop |= toInt(VehiclePropertyGroup::VENDOR); - } else { - updatedPropValue->prop |= toInt(VehiclePropertyGroup::SYSTEM); - } - updatedPropValue->value = value.value; - updatedPropValue->timestamp = elapsedRealtimeNano(); - updatedPropValue->areaId = value.areaId; - onPropertyValueFromCar(*updatedPropValue, updateStatus); - return StatusCode::OK; - } -#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING - - default: - break; - } - - // In the real vhal, the value will be sent to Car ECU. - // We just pretend it is done here and send back to HAL - auto updatedPropValue = getValuePool()->obtain(value); - updatedPropValue->timestamp = elapsedRealtimeNano(); - - mServerSidePropStore.writeValue(*updatedPropValue, updateStatus); - onPropertyValueFromCar(*updatedPropValue, updateStatus); - return StatusCode::OK; -} - -} // namespace android::hardware::automotive::vehicle::V2_0::impl diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h index be88cd94cd26b11bcc36fecb717743b46238b836..1290f30a9edbd56514cfda04d56f4aab3fd4f42a 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 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,56 +14,32 @@ * limitations under the License. */ +// This file is just used for soft migration from VehicleHalServer to DefaultVehicleHalServer. +// The virtualized VHAL that uses VehichleHalServer is at a different repo and cannot be updated +// together with this repo, so we need a soft migration. Once the rename is finished at the +// virtualized VHAL side, this file would be removed. + #pragma once -#include -#include -#include +#include "DefaultVehicleHalServer.h" -#include "GeneratorHub.h" +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { -namespace android::hardware::automotive::vehicle::V2_0::impl { +namespace impl { -// This contains the common server operations that will be used by -// both native and virtualized VHAL server. Notice that in the virtualized -// scenario, the server may be run on a different OS than Android. -class VehicleHalServer : public IVehicleServer { +class VehicleHalServer : public DefaultVehicleHalServer { public: - VehicleHalServer(); - - void sendAllValuesToClient(); - - // Methods from IVehicleServer - - std::vector onGetAllPropertyConfig() const override; - - StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) override; - - // Set the Property Value Pool used in this server - void setValuePool(VehiclePropValuePool* valuePool); - - private: - using VehiclePropValuePtr = recyclable_ptr; - - GeneratorHub* getGenerator(); - - VehiclePropValuePool* getValuePool() const; - - void onFakeValueGenerated(const VehiclePropValue& value); - - StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request); - - VehiclePropValuePtr createApPowerStateReq(VehicleApPowerStateReq req, int32_t param); - - VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode, - int32_t targetDisplay); - - private: - GeneratorHub mGeneratorHub{ - std::bind(&VehicleHalServer::onFakeValueGenerated, this, std::placeholders::_1)}; - - VehiclePropValuePool* mValuePool{nullptr}; - VehiclePropertyStore mServerSidePropStore; + VehicleHalServer() : DefaultVehicleHalServer(){}; }; -} // namespace android::hardware::automotive::vehicle::V2_0::impl +} // namespace impl + +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleHalProto.proto b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleHalProto.proto deleted file mode 100644 index 4902a5d8fb161b797c835be1d941399f9341a620..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleHalProto.proto +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - -syntax = "proto2"; - -package vhal_proto; - -// CMD messages are from workstation --> VHAL -// RESP messages are from VHAL --> workstation -enum MsgType { - GET_CONFIG_CMD = 0; - GET_CONFIG_RESP = 1; - GET_CONFIG_ALL_CMD = 2; - GET_CONFIG_ALL_RESP = 3; - GET_PROPERTY_CMD = 4; - GET_PROPERTY_RESP = 5; - GET_PROPERTY_ALL_CMD = 6; - GET_PROPERTY_ALL_RESP = 7; - SET_PROPERTY_CMD = 8; - SET_PROPERTY_RESP = 9; - SET_PROPERTY_ASYNC = 10; -} -enum Status { - RESULT_OK = 0; - ERROR_UNKNOWN = 1; - ERROR_UNIMPLEMENTED_CMD = 2; - ERROR_INVALID_PROPERTY = 3; - ERROR_INVALID_AREA_ID = 4; - ERROR_PROPERTY_UNINITIALIZED = 5; - ERROR_WRITE_ONLY_PROPERTY = 6; - ERROR_MEMORY_ALLOC_FAILED = 7; - ERROR_INVALID_OPERATION = 8; -} - -enum VehiclePropStatus { - AVAILABLE = 0; - UNAVAILABLE = 1; - ERROR = 2; -} - -message VehicleAreaConfig { - required int32 area_id = 1; - optional sint32 min_int32_value = 2; - optional sint32 max_int32_value = 3; - optional sint64 min_int64_value = 4; - optional sint64 max_int64_value = 5; - optional float min_float_value = 6; - optional float max_float_value = 7; -} - -message VehiclePropConfig { - required int32 prop = 1; - optional int32 access = 2; - optional int32 change_mode = 3; - optional int32 value_type = 4; - optional int32 supported_areas = 5; // Deprecated - DO NOT USE - repeated VehicleAreaConfig area_configs = 6; - optional int32 config_flags = 7; - repeated int32 config_array = 8; - optional string config_string = 9; - optional float min_sample_rate = 10; - optional float max_sample_rate = 11; -}; - -message VehiclePropValue { - // common data - required int32 prop = 1; - optional int32 value_type = 2; - optional int64 timestamp = 3; // required for valid data from HAL, skipped for set - optional VehiclePropStatus status = 10; // required for valid data from HAL, skipped for set - - // values - optional int32 area_id = 4; - repeated sint32 int32_values = 5; // this also covers boolean value. - repeated sint64 int64_values = 6; - repeated float float_values = 7; - optional string string_value = 8; - optional bytes bytes_value = 9; -}; - -// This structure is used to notify what values to get from the Vehicle HAL -message VehiclePropGet { - required int32 prop = 1; - optional int32 area_id = 2; -}; - -message EmulatorMessage { - required MsgType msg_type = 1; - optional Status status = 2; // Only for RESP messages - repeated VehiclePropGet prop = 3; // Provided for getConfig, getProperty commands - repeated VehiclePropConfig config = 4; - repeated VehiclePropValue value = 5; -}; diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/qemu_pipe.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/qemu_pipe.cpp deleted file mode 100644 index cf1a0024796a47d28cd1315f5e3581573c4c9c3f..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/qemu_pipe.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ - -#include "qemu_pipe.h" - -#include -#include -#include -#include -#include - -#include - -using android::base::ReadFully; -using android::base::WriteFully; - -// Define QEMU_PIPE_DEBUG if you want to print error messages when an error -// occurs during pipe operations. The macro should simply take a printf-style -// formatting string followed by optional arguments. -#ifndef QEMU_PIPE_DEBUG -#define QEMU_PIPE_DEBUG(...) (void)0 -#endif - -int qemu_pipe_open(const char* pipeName) { - if (!pipeName) { - errno = EINVAL; - return -1; - } - - int fd = TEMP_FAILURE_RETRY(open("/dev/qemu_pipe", O_RDWR)); - if (fd < 0) { - QEMU_PIPE_DEBUG("%s: Could not open /dev/qemu_pipe: %s", __FUNCTION__, strerror(errno)); - return -1; - } - - // Write the pipe name, *including* the trailing zero which is necessary. - size_t pipeNameLen = strlen(pipeName); - if (WriteFully(fd, pipeName, pipeNameLen + 1U)) { - return fd; - } - - // now, add 'pipe:' prefix and try again - // Note: host side will wait for the trailing '\0' to start - // service lookup. - const char pipe_prefix[] = "pipe:"; - if (WriteFully(fd, pipe_prefix, strlen(pipe_prefix)) && - WriteFully(fd, pipeName, pipeNameLen + 1U)) { - return fd; - } - QEMU_PIPE_DEBUG("%s: Could not write to %s pipe service: %s", __FUNCTION__, pipeName, - strerror(errno)); - close(fd); - return -1; -} - -int qemu_pipe_frame_send(int fd, const void* buff, size_t len) { - char header[5]; - snprintf(header, sizeof(header), "%04zx", len); - if (!WriteFully(fd, header, 4)) { - QEMU_PIPE_DEBUG("Can't write qemud frame header: %s", strerror(errno)); - return -1; - } - if (!WriteFully(fd, buff, len)) { - QEMU_PIPE_DEBUG("Can't write qemud frame payload: %s", strerror(errno)); - return -1; - } - return 0; -} - -int qemu_pipe_frame_recv(int fd, void* buff, size_t len) { - char header[5]; - if (!ReadFully(fd, header, 4)) { - QEMU_PIPE_DEBUG("Can't read qemud frame header: %s", strerror(errno)); - return -1; - } - header[4] = '\0'; - size_t size; - if (sscanf(header, "%04zx", &size) != 1) { - QEMU_PIPE_DEBUG("Malformed qemud frame header: [%.*s]", 4, header); - return -1; - } - if (size > len) { - QEMU_PIPE_DEBUG("Oversized qemud frame (% bytes, expected <= %)", size, len); - return -1; - } - if (!ReadFully(fd, buff, size)) { - QEMU_PIPE_DEBUG("Could not read qemud frame payload: %s", strerror(errno)); - return -1; - } - return size; -} diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/qemu_pipe.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/qemu_pipe.h deleted file mode 100644 index 09874989902ce144601745cc618e6c2112d93c61..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/qemu_pipe.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2011 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. - */ -#ifndef ANDROID_CORE_INCLUDE_QEMU_PIPE_H -#define ANDROID_CORE_INCLUDE_QEMU_PIPE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif -// Try to open a new Qemu fast-pipe. This function returns a file descriptor -// that can be used to communicate with a named service managed by the -// emulator. -// -// This file descriptor can be used as a standard pipe/socket descriptor. -// -// 'pipeName' is the name of the emulator service you want to connect to, -// and should begin with 'pipe:' (e.g. 'pipe:camera' or 'pipe:opengles'). -// For backward compatibility, the 'pipe:' prefix can be omitted, and in -// that case, qemu_pipe_open will add it for you. - -// On success, return a valid file descriptor, or -1/errno on failure. E.g.: -// -// EINVAL -> unknown/unsupported pipeName -// ENOSYS -> fast pipes not available in this system. -// -// ENOSYS should never happen, except if you're trying to run within a -// misconfigured emulator. -// -// You should be able to open several pipes to the same pipe service, -// except for a few special cases (e.g. GSM modem), where EBUSY will be -// returned if more than one client tries to connect to it. -int qemu_pipe_open(const char* pipeName); - -// Send a framed message |buff| of |len| bytes through the |fd| descriptor. -// This really adds a 4-hexchar prefix describing the payload size. -// Returns 0 on success, and -1 on error. -int qemu_pipe_frame_send(int fd, const void* buff, size_t len); - -// Read a frame message from |fd|, and store it into |buff| of |len| bytes. -// If the framed message is larger than |len|, then this returns -1 and the -// content is lost. Otherwise, this returns the size of the message. NOTE: -// empty messages are possible in a framed wire protocol and do not mean -// end-of-stream. -int qemu_pipe_frame_recv(int fd, void* buff, size_t len); - -#ifdef __cplusplus -} -#endif - -#endif /* ANDROID_CORE_INCLUDE_QEMU_PIPE_H */ diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/Android.bp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..a0bcc6cb34371f522cb4b93070e270c9502c02e6 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/Android.bp @@ -0,0 +1,32 @@ +// 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"], +} + +filegroup { + name: "vhal_test_json", + srcs: ["prop.json"], +} + +filegroup { + name: "vhal_test_override_json", + srcs: ["override/*"], +} diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3c8dd6c793c8d8148618ad8033f94f3501b0fcd --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -0,0 +1,1394 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { +namespace impl { + +class DefaultVhalImplTestHelper { + public: + DefaultVhalImplTestHelper(DefaultVehicleHalServer* server) { mServer = server; } + + void overrideProperties(const char* overrideDir) { + mServer->overrideProperties(overrideDir); + } + + private: + DefaultVehicleHalServer* mServer; +}; + +} // namespace impl +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +namespace { + +using ::android::hardware::hidl_handle; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::automotive::vehicle::V2_0::FuelType; +using ::android::hardware::automotive::vehicle::V2_0::recyclable_ptr; +using ::android::hardware::automotive::vehicle::V2_0::StatusCode; +using ::android::hardware::automotive::vehicle::V2_0::VehicleHwKeyInputAction; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropConfig; +using ::android::hardware::automotive::vehicle::V2_0::VehicleProperty; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyStatus; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyStore; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropValue; +using ::android::hardware::automotive::vehicle::V2_0::VehiclePropValuePool; +using ::android::hardware::automotive::vehicle::V2_0::impl::DefaultVehicleConnector; +using ::android::hardware::automotive::vehicle::V2_0::impl::DefaultVehicleHal; +using ::android::hardware::automotive::vehicle::V2_0::impl::DefaultVhalImplTestHelper; +using ::android::hardware::automotive::vehicle::V2_0::impl::DOOR_1_LEFT; +using ::android::hardware::automotive::vehicle::V2_0::impl::DOOR_1_RIGHT; +using ::android::hardware::automotive::vehicle::V2_0::impl::HVAC_ALL; +using ::android::hardware::automotive::vehicle::V2_0::impl::HVAC_LEFT; +using ::android::hardware::automotive::vehicle::V2_0::impl::HVAC_RIGHT; +using ::android::hardware::automotive::vehicle::V2_0::impl::kMixedTypePropertyForTest; +using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_FREEZE_FRAME; +using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_FREEZE_FRAME_CLEAR; +using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_FREEZE_FRAME_INFO; +using ::android::hardware::automotive::vehicle::V2_0::impl::OBD2_LIVE_FRAME; + +using ::testing::HasSubstr; + +using VehiclePropValuePtr = recyclable_ptr; + +// The maximum length of property ID in string. +const size_t MAX_PROP_ID_LENGTH = 100; + +class DefaultVhalImplTest : public ::testing::Test { + public: + ~DefaultVhalImplTest() { + mEventQueue.deactivate(); + mHeartBeatQueue.deactivate(); + // Destroy mHal before destroying its dependencies. + mHal.reset(); + mConnector.reset(); + mPropStore.reset(); + } + + protected: + void SetUp() override { + mPropStore.reset(new VehiclePropertyStore); + mConnector.reset(new DefaultVehicleConnector); + mConnector->setValuePool(&mValueObjectPool); + mHal.reset(new DefaultVehicleHal(mPropStore.get(), mConnector.get())); + initHal(); + } + + void initHal() { + mHal->init(&mValueObjectPool, + std::bind(&DefaultVhalImplTest::onHalEvent, this, std::placeholders::_1), + std::bind(&DefaultVhalImplTest::onHalPropertySetError, this, + std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + } + + protected: + std::unique_ptr mHal; + std::unique_ptr mConnector; + std::unique_ptr mPropStore; + VehiclePropValuePool mValueObjectPool; + android::ConcurrentQueue mEventQueue; + android::ConcurrentQueue mHeartBeatQueue; + + private: + void onHalEvent(VehiclePropValuePtr v) { + if (v->prop != toInt(VehicleProperty::VHAL_HEARTBEAT)) { + // Ignore heartbeat properties. + mEventQueue.push(std::move(v)); + } else { + mHeartBeatQueue.push(std::move(v)); + } + } + + void onHalPropertySetError(StatusCode /*errorCode*/, int32_t /*property*/, int32_t /*areaId*/) { + } +}; + +TEST_F(DefaultVhalImplTest, testListProperties) { + std::vector configs = mHal->listProperties(); + + EXPECT_EQ((size_t)121, configs.size()); +} + +TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) { + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY); + + auto gotValue = mHal->get(value, &status); + + EXPECT_EQ(StatusCode::OK, status); + ASSERT_EQ((unsigned int)1, gotValue->value.floatValues.size()); + EXPECT_EQ(15000.0f, gotValue->value.floatValues[0]); +} + +TEST_F(DefaultVhalImplTest, testGetDefaultPropertyEnum) { + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::INFO_FUEL_TYPE); + + auto gotValue = mHal->get(value, &status); + + EXPECT_EQ(StatusCode::OK, status); + ASSERT_EQ((unsigned int)1, gotValue->value.int32Values.size()); + EXPECT_EQ((int)FuelType::FUEL_TYPE_UNLEADED, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testGetDefaultPropertyInt) { + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::INFO_MODEL_YEAR); + + auto gotValue = mHal->get(value, &status); + + EXPECT_EQ(StatusCode::OK, status); + ASSERT_EQ((unsigned int)1, gotValue->value.int32Values.size()); + EXPECT_EQ(2020, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testGetDefaultPropertyString) { + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::INFO_MAKE); + + auto gotValue = mHal->get(value, &status); + + EXPECT_EQ(StatusCode::OK, status); + EXPECT_EQ("Toy Vehicle", gotValue->value.stringValue); +} + +TEST_F(DefaultVhalImplTest, testGetUnknownProperty) { + VehiclePropValue value; + StatusCode status; + value.prop = 0; + + auto gotValue = mHal->get(value, &status); + + EXPECT_EQ(StatusCode::INVALID_ARG, status); +} + +TEST_F(DefaultVhalImplTest, testSetFloat) { + VehiclePropValue value; + value.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY); + value.value.floatValues.resize(1); + value.value.floatValues[0] = 1.0f; + + StatusCode status = mHal->set(value); + ASSERT_EQ(StatusCode::OK, status); + + auto gotValue = mHal->get(value, &status); + EXPECT_EQ(StatusCode::OK, status); + ASSERT_EQ((unsigned int)1, gotValue->value.floatValues.size()); + EXPECT_EQ(1.0f, gotValue->value.floatValues[0]); +} + +TEST_F(DefaultVhalImplTest, testSetEnum) { + VehiclePropValue value; + value.prop = toInt(VehicleProperty::INFO_FUEL_TYPE); + value.value.int32Values.resize(1); + value.value.int32Values[0] = (int)FuelType::FUEL_TYPE_LEADED; + + StatusCode status = mHal->set(value); + ASSERT_EQ(StatusCode::OK, status); + + auto gotValue = mHal->get(value, &status); + EXPECT_EQ(StatusCode::OK, status); + ASSERT_EQ((unsigned int)1, gotValue->value.int32Values.size()); + EXPECT_EQ((int)FuelType::FUEL_TYPE_LEADED, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testSetInt) { + VehiclePropValue value; + value.prop = toInt(VehicleProperty::INFO_MODEL_YEAR); + value.value.int32Values.resize(1); + value.value.int32Values[0] = 2021; + + StatusCode status = mHal->set(value); + EXPECT_EQ(StatusCode::OK, status); + + auto gotValue = mHal->get(value, &status); + EXPECT_EQ(StatusCode::OK, status); + EXPECT_EQ((unsigned int)1, gotValue->value.int32Values.size()); + EXPECT_EQ(2021, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testSetString) { + VehiclePropValue value; + value.prop = toInt(VehicleProperty::INFO_MAKE); + value.value.stringValue = "My Vehicle"; + + StatusCode status = mHal->set(value); + ASSERT_EQ(StatusCode::OK, status); + + auto gotValue = mHal->get(value, &status); + EXPECT_EQ(StatusCode::OK, status); + EXPECT_EQ("My Vehicle", gotValue->value.stringValue); +} + +TEST_F(DefaultVhalImplTest, testSetMixed) { + VehiclePropValue value; + value.prop = kMixedTypePropertyForTest; + // mixed prop. + // .configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0} + // 1 string, 1 int, 0 bool, 2 ints, 0 int64, 0 int64s, 1 float, 0 floats, 0 bytes + value.value.stringValue = "test"; + value.value.int32Values.resize(3); + value.value.int32Values[0] = 1; + value.value.int32Values[1] = 2; + value.value.int32Values[2] = 3; + value.value.floatValues.resize(1); + value.value.floatValues[0] = 1.0f; + + StatusCode status = mHal->set(value); + ASSERT_EQ(StatusCode::OK, status); + + auto gotValue = mHal->get(value, &status); + EXPECT_EQ(StatusCode::OK, status); + EXPECT_EQ("test", gotValue->value.stringValue); + ASSERT_EQ((size_t)3, gotValue->value.int32Values.size()); + EXPECT_EQ(1, gotValue->value.int32Values[0]); + EXPECT_EQ(2, gotValue->value.int32Values[1]); + EXPECT_EQ(3, gotValue->value.int32Values[2]); + ASSERT_EQ((size_t)1, gotValue->value.floatValues.size()); + EXPECT_EQ(1.0f, gotValue->value.floatValues[0]); +} + +TEST_F(DefaultVhalImplTest, testSetUnknownProperty) { + VehiclePropValue value; + value.prop = 0; + + EXPECT_EQ(StatusCode::INVALID_ARG, mHal->set(value)); +} + +TEST_F(DefaultVhalImplTest, testSetStatusNotAllowed) { + VehiclePropValue value; + value.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY); + value.status = VehiclePropertyStatus::UNAVAILABLE; + value.value.floatValues.resize(1); + value.value.floatValues[0] = 1.0f; + + StatusCode status = mHal->set(value); + + EXPECT_EQ(StatusCode::INVALID_ARG, status); +} + +TEST_F(DefaultVhalImplTest, testSubscribe) { + // Clear existing events. + mEventQueue.flush(); + + auto status = mHal->subscribe(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 10); + + ASSERT_EQ(StatusCode::OK, status); + + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + + // Modify the speed after 0.5 seconds. + VehiclePropValue value; + value.prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + value.value.floatValues.resize(1); + value.value.floatValues[0] = 1.0f; + ASSERT_EQ(StatusCode::OK, mHal->set(value)); + + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + + auto events = mEventQueue.flush(); + ASSERT_LE((size_t)10, events.size()); + + // The first event should be the default value. + ASSERT_EQ((size_t)1, events[0]->value.floatValues.size()); + EXPECT_EQ(0.0f, events[0]->value.floatValues[0]); + // The last event should be the value after update. + ASSERT_EQ((size_t)1, events[events.size() - 1]->value.floatValues.size()); + EXPECT_EQ(1.0f, events[events.size() - 1]->value.floatValues[0]); +} + +TEST_F(DefaultVhalImplTest, testSubscribeInvalidProp) { + EXPECT_EQ(StatusCode::INVALID_ARG, mHal->subscribe(toInt(VehicleProperty::INFO_MAKE), 10)); +} + +TEST_F(DefaultVhalImplTest, testSubscribeSampleRateOutOfRange) { + EXPECT_EQ(StatusCode::INVALID_ARG, + mHal->subscribe(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 10.1)); + EXPECT_EQ(StatusCode::INVALID_ARG, + mHal->subscribe(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 0.5)); +} + +TEST_F(DefaultVhalImplTest, testUnsubscribe) { + auto status = mHal->subscribe(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 10); + ASSERT_EQ(StatusCode::OK, status); + + // Wait for 0.5 seconds to generate some events. + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + + status = mHal->unsubscribe(toInt(VehicleProperty::PERF_VEHICLE_SPEED)); + ASSERT_EQ(StatusCode::OK, status); + + // Clear all the events. + mEventQueue.flush(); + + // Wait for 0.5 seconds. + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + + // There should be no new events generated. + auto events = mEventQueue.flush(); + EXPECT_EQ((size_t)0, events.size()); +} + +TEST_F(DefaultVhalImplTest, testUnsubscribeInvalidProp) { + EXPECT_EQ(StatusCode::INVALID_ARG, mHal->unsubscribe(toInt(VehicleProperty::INFO_MAKE))); +} + +int createMemfd(hidl_handle* fd) { + native_handle_t* handle = native_handle_create(/*numFds=*/1, /*numInts=*/0); + int memfd = memfd_create("memfile", 0); + handle->data[0] = dup(memfd); + fd->setTo(handle, /*shouldOwn=*/true); + return memfd; +} + +TEST_F(DefaultVhalImplTest, testDump) { + hidl_vec options; + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + + ASSERT_TRUE(mHal->dump(fd, options)); + + lseek(memfd, 0, SEEK_SET); + char buf[10240] = {}; + read(memfd, buf, sizeof(buf)); + close(memfd); + + // Read one property and check that it is in the dumped info. + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::INFO_MAKE); + auto gotValue = mHal->get(value, &status); + ASSERT_EQ(StatusCode::OK, status); + // Server side prop store does not have timestamp. + gotValue->timestamp = 0; + + std::string infoMake = toString(*gotValue); + EXPECT_THAT(std::string(buf), HasSubstr(infoMake)); +} + +TEST_F(DefaultVhalImplTest, testSetPropInvalidAreaId) { + VehiclePropValue propNormal = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), + .areaId = HVAC_ALL, + .value.int32Values = {3}}; + StatusCode status = mHal->set(propNormal); + + EXPECT_EQ(StatusCode::OK, status); + + // HVAC_FAN_SPEED only have HVAC_ALL area config and is not allowed to set by LEFT/RIGHT. + VehiclePropValue propWrongId = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), + .areaId = HVAC_LEFT, + .value.int32Values = {3}}; + + status = mHal->set(propWrongId); + + EXPECT_EQ(StatusCode::INVALID_ARG, status); +} + +class DefaultVhalImplSetInvalidPropTest : public DefaultVhalImplTest, + public testing::WithParamInterface {}; + +std::vector GenSetInvalidPropParams() { + std::vector props; + // int prop with no value. + VehiclePropValue intProp = {.prop = toInt(VehicleProperty::INFO_MODEL_YEAR)}; + props.push_back(intProp); + + // int prop with more than one value. + VehiclePropValue intPropWithValues = {.prop = toInt(VehicleProperty::INFO_MODEL_YEAR)}; + intPropWithValues.value.int32Values.resize(2); + props.push_back(intPropWithValues); + + // int vec prop with no value. + VehiclePropValue intVecProp = {.prop = toInt(VehicleProperty::INFO_FUEL_TYPE)}; + props.push_back(intVecProp); + + // int64 prop with no value. + VehiclePropValue int64Prop = {.prop = toInt(VehicleProperty::EPOCH_TIME)}; + props.push_back(int64Prop); + + // int64 prop with more than one value. + VehiclePropValue int64PropWithValues = {.prop = toInt(VehicleProperty::EPOCH_TIME)}; + int64PropWithValues.value.int64Values.resize(2); + props.push_back(int64PropWithValues); + + // int64 vec prop with no value. + VehiclePropValue int64VecProp = {.prop = toInt(VehicleProperty::WHEEL_TICK)}; + props.push_back(int64VecProp); + + // float prop with no value. + VehiclePropValue floatProp = {.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY)}; + props.push_back(floatProp); + + // float prop with more than one value. + VehiclePropValue floatPropWithValues = {.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY)}; + floatPropWithValues.value.floatValues.resize(2); + props.push_back(floatPropWithValues); + + // float vec prop with no value. + VehiclePropValue floatVecProp = { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION)}; + props.push_back(floatVecProp); + + // bool prop with no value. + VehiclePropValue boolProp = { + .prop = toInt(VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME)}; + props.push_back(boolProp); + + // bool prop with more than one value. + VehiclePropValue boolPropWithValues = { + .prop = toInt(VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME)}; + boolPropWithValues.value.int32Values.resize(2); + props.push_back(boolPropWithValues); + + // mixed prop. + // .configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0} + // 1 string, 1 int, 0 bool, 2 ints, 0 int64, 0 int64s, 1 float, 0 floats, 0 bytes + VehiclePropValue mixedProp1 = {.prop = kMixedTypePropertyForTest}; + // Expect 1 bool, and 2 ints, we only have 1 value. + mixedProp1.value.int32Values.resize(1); + mixedProp1.value.floatValues.resize(1); + props.push_back(mixedProp1); + + VehiclePropValue mixedProp2 = {.prop = kMixedTypePropertyForTest}; + mixedProp2.value.int32Values.resize(3); + // Missing float value. + mixedProp2.value.floatValues.resize(0); + props.push_back(mixedProp2); + + return props; +} + +TEST_P(DefaultVhalImplSetInvalidPropTest, testSetInvalidPropValue) { + VehiclePropValue value = GetParam(); + + StatusCode status = mHal->set(value); + + EXPECT_EQ(StatusCode::INVALID_ARG, status); +} + +INSTANTIATE_TEST_SUITE_P(DefaultVhalImplSetInvalidPropTests, DefaultVhalImplSetInvalidPropTest, + testing::ValuesIn(GenSetInvalidPropParams())); + +struct SetPropRangeTestCase { + std::string name; + VehiclePropValue prop; + StatusCode code; +}; + +class DefaultVhalImplSetPropRangeTest : public DefaultVhalImplTest, + public testing::WithParamInterface {}; + +std::vector GenSetPropRangeParams() { + std::vector tc; + VehiclePropValue intPropNormal = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), + .areaId = HVAC_ALL, + // min: 1, max: 7 + .value.int32Values = {3}}; + tc.push_back({"normal_case_int", intPropNormal, StatusCode::OK}); + + VehiclePropValue intPropSmall = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), + .areaId = HVAC_ALL, + // min: 1, max: 7 + .value.int32Values = {0}}; + tc.push_back({"normal_case_int_too_small", intPropSmall, StatusCode::INVALID_ARG}); + + VehiclePropValue intPropLarge = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), + .areaId = HVAC_ALL, + // min: 1, max: 7 + .value.int32Values = {8}}; + tc.push_back({"normal_case_int_too_large", intPropLarge, StatusCode::INVALID_ARG}); + + VehiclePropValue floatPropNormal = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), + .areaId = HVAC_LEFT, + // min: 16, max: 32 + .value.floatValues = {26}}; + tc.push_back({"normal_case_float", floatPropNormal, StatusCode::OK}); + VehiclePropValue floatPropSmall = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), + .areaId = HVAC_LEFT, + // min: 16, max: 32 + .value.floatValues = {15.5}}; + tc.push_back({"normal_case_float_too_small", floatPropSmall, StatusCode::INVALID_ARG}); + VehiclePropValue floatPropLarge = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), + .areaId = HVAC_LEFT, + // min: 16, max: 32 + .value.floatValues = {32.6}}; + tc.push_back({"normal_case_float_too_large", floatPropLarge, StatusCode::INVALID_ARG}); + + return tc; +} + +TEST_P(DefaultVhalImplSetPropRangeTest, testSetPropRange) { + SetPropRangeTestCase tc = GetParam(); + + StatusCode status = mHal->set(tc.prop); + + EXPECT_EQ(tc.code, status); +} + +INSTANTIATE_TEST_SUITE_P( + DefaultVhalImplSetPropRangeTests, DefaultVhalImplSetPropRangeTest, + testing::ValuesIn(GenSetPropRangeParams()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +std::string getPropIdString(VehicleProperty prop) { + char s[MAX_PROP_ID_LENGTH] = {}; + snprintf(s, sizeof(s), "%d", toInt(prop)); + return std::string(s); +} + +struct OptionsTestCase { + std::string name; + hidl_vec options; + std::string expectMsg; +}; + +class DefaultVhalImplOptionsTest : public DefaultVhalImplTest, + public testing::WithParamInterface {}; + +TEST_P(DefaultVhalImplOptionsTest, testInvalidOptions) { + auto tc = GetParam(); + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + + bool shouldDump = mHal->dump(fd, tc.options); + + EXPECT_FALSE(shouldDump); + char buf[10240] = {}; + lseek(memfd, 0, SEEK_SET); + read(memfd, buf, sizeof(buf)); + EXPECT_THAT(std::string(buf), HasSubstr(tc.expectMsg)); +} + +std::vector GenInvalidOptions() { + return {{"no_command", {"--debughal"}, "No command specified"}, + {"unknown_command", {"--debughal", "--unknown"}, "Unknown command: \"--unknown\""}, + {"help", {"--debughal", "--help"}, "Help:"}, + {"genfakedata_no_subcommand", + {"--debughal", "--genfakedata"}, + "No subcommand specified for genfakedata"}, + {"genfakedata_unknown_subcommand", + {"--debughal", "--genfakedata", "--unknown"}, + "Unknown command: \"--unknown\""}, + {"genfakedata_start_linear_no_args", + {"--debughal", "--genfakedata", "--startlinear"}, + "incorrect argument count"}, + {"genfakedata_start_linear_invalid_propId", + {"--debughal", "--genfakedata", "--startlinear", "abcd", "0.1", "0.1", "0.1", "0.1", + "100000000"}, + "failed to parse propdID as int: \"abcd\""}, + {"genfakedata_start_linear_invalid_middleValue", + {"--debughal", "--genfakedata", "--startlinear", "1", "abcd", "0.1", "0.1", "0.1", + "100000000"}, + "failed to parse middleValue as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_currentValue", + {"--debughal", "--genfakedata", "--startlinear", "1", "0.1", "abcd", "0.1", "0.1", + "100000000"}, + "failed to parse currentValue as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_dispersion", + {"--debughal", "--genfakedata", "--startlinear", "1", "0.1", "0.1", "abcd", "0.1", + "100000000"}, + "failed to parse dispersion as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_increment", + {"--debughal", "--genfakedata", "--startlinear", "1", "0.1", "0.1", "0.1", "abcd", + "100000000"}, + "failed to parse increment as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_interval", + {"--debughal", "--genfakedata", "--startlinear", "1", "0.1", "0.1", "0.1", "0.1", + "0.1"}, + "failed to parse interval as int: \"0.1\""}, + {"genfakedata_stop_linear_no_args", + {"--debughal", "--genfakedata", "--stoplinear"}, + "incorrect argument count"}, + {"genfakedata_stop_linear_invalid_propId", + {"--debughal", "--genfakedata", "--stoplinear", "abcd"}, + "failed to parse propdID as int: \"abcd\""}, + {"genfakedata_startjson_no_args", + {"--debughal", "--genfakedata", "--startjson"}, + "incorrect argument count"}, + {"genfakedata_startjson_invalid_repetition", + {"--debughal", "--genfakedata", "--startjson", "file", "0.1"}, + "failed to parse repetition as int: \"0.1\""}, + {"genfakedata_startjson_invalid_json_file", + {"--debughal", "--genfakedata", "--startjson", "file", "1"}, + "invalid JSON file"}, + {"genfakedata_stopjson_no_args", + {"--debughal", "--genfakedata", "--stopjson"}, + "incorrect argument count"}, + {"genfakedata_keypress_no_args", + {"--debughal", "--genfakedata", "--keypress"}, + "incorrect argument count"}, + {"genfakedata_keypress_invalid_keyCode", + {"--debughal", "--genfakedata", "--keypress", "0.1", "1"}, + "failed to parse keyCode as int: \"0.1\""}, + {"genfakedata_keypress_invalid_display", + {"--debughal", "--genfakedata", "--keypress", "1", "0.1"}, + "failed to parse display as int: \"0.1\""}, + {"setint_no_args", {"--debughal", "--setint"}, "incorrect argument count"}, + {"setint_invalid_prop_id", + {"--debughal", "--setint", "abcd", "0", "0", "0"}, + "failed to parse propID as int: \"abcd\""}, + {"setint_invalid_value", + {"--debughal", "--setint", "0", "1.1", "0", "0"}, + "failed to parse value as int: \"1.1\""}, + {"setint_invalid_timestamp", + {"--debughal", "--setint", "0", "0", "1.1", "0"}, + "failed to parse timestamp as int: \"1.1\""}, + {"setint_invalid_areaId", + {"--debughal", "--setint", "0", "0", "0", "1.1"}, + "failed to parse areaID as int: \"1.1\""}, + {"setbool_no_args", {"--debughal", "--setbool"}, "incorrect argument count"}, + {"setbool_invalid_value", + {"--debughal", "--setbool", "0", "1", "0", "0"}, + "failed to parse value as bool"}, + {"setfloat_no_args", {"--debughal", "--setfloat"}, "incorrect argument count"}, + {"setfloat_invalid_value", + {"--debughal", "--setfloat", "0", "abcd", "0", "0"}, + "failed to parse value as float: \"abcd\""}}; +} + +INSTANTIATE_TEST_SUITE_P( + DefaultVhalImplOptionsTests, DefaultVhalImplOptionsTest, + testing::ValuesIn(GenInvalidOptions()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_F(DefaultVhalImplTest, testDebugGenFakeDataLinear) { + // Start a fake linear data generator for vehicle speed at 0.1s interval. + // range: 0 - 100, current value: 30, step: 20. + hidl_vec options = {"--debughal", + "--genfakedata", + "--startlinear", + getPropIdString(VehicleProperty::PERF_VEHICLE_SPEED), + /*middleValue=*/"50", + /*currentValue=*/"30", + /*dispersion=*/"50", + /*increment=*/"20", + /*interval=*/"100000000"}; + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + // Clear existing events. + mEventQueue.flush(); + + EXPECT_FALSE(mHal->dump(fd, options)); + + lseek(memfd, 0, SEEK_SET); + char buf[10240] = {}; + // The dumped info should be empty. + read(memfd, buf, sizeof(buf)); + EXPECT_STREQ("", buf); + + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + + auto events = mEventQueue.flush(); + // We should get 10 events ideally, but let's be safe here. + ASSERT_LE((size_t)5, events.size()); + int32_t value = 30; + for (size_t i = 0; i < 5; i++) { + ASSERT_EQ((size_t)1, events[i]->value.floatValues.size()); + EXPECT_EQ((float)value, events[i]->value.floatValues[0]); + value = (value + 20) % 100; + } + + // Stop the linear generator. + options = {"--debughal", "--genfakedata", "--stoplinear", + getPropIdString(VehicleProperty::PERF_VEHICLE_SPEED)}; + EXPECT_FALSE(mHal->dump(fd, options)); + + // The dumped info should be empty. + lseek(memfd, 0, SEEK_SET); + read(memfd, buf, sizeof(buf)); + EXPECT_STREQ("", buf); + + close(memfd); + + // Clear existing events. + mEventQueue.flush(); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + // There should be no new events generated. + EXPECT_EQ((size_t)0, mEventQueue.flush().size()); +} + +std::string getTestFilePath(const char* filename) { + static std::string baseDir = android::base::GetExecutableDirectory(); + return baseDir + "/" + filename; +} + +TEST_F(DefaultVhalImplTest, testDebugGenFakeDataJson) { + hidl_vec options = {"--debughal", "--genfakedata", "--startjson", + getTestFilePath("prop.json"), "2"}; + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + // Clear existing events. + mEventQueue.flush(); + + EXPECT_FALSE(mHal->dump(fd, options)); + + lseek(memfd, 0, SEEK_SET); + char buf[10240] = {}; + // The dumped info should be empty. + read(memfd, buf, sizeof(buf)); + EXPECT_STREQ("", buf); + + // wait for some time. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)8, events.size()); + // First set of events, we test 1st and the last. + EXPECT_EQ((size_t)1, events[0]->value.int32Values.size()); + EXPECT_EQ(8, events[0]->value.int32Values[0]); + EXPECT_EQ((size_t)1, events[3]->value.int32Values.size()); + EXPECT_EQ(10, events[3]->value.int32Values[0]); + // Second set of the same events. + EXPECT_EQ((size_t)1, events[4]->value.int32Values.size()); + EXPECT_EQ(8, events[4]->value.int32Values[0]); + EXPECT_EQ((size_t)1, events[7]->value.int32Values.size()); + EXPECT_EQ(10, events[7]->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testDebugGenFakeDataKeyPress) { + hidl_vec options = {"--debughal", "--genfakedata", "--keypress", "1", "2"}; + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + // Clear existing events. + mEventQueue.flush(); + + EXPECT_FALSE(mHal->dump(fd, options)); + + lseek(memfd, 0, SEEK_SET); + char buf[10240] = {}; + // The dumped info should be empty. + read(memfd, buf, sizeof(buf)); + EXPECT_STREQ("", buf); + + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)2, events.size()); + EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[0]->prop); + EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[1]->prop); + ASSERT_EQ((size_t)3, events[0]->value.int32Values.size()); + ASSERT_EQ((size_t)3, events[1]->value.int32Values.size()); + EXPECT_EQ(toInt(VehicleHwKeyInputAction::ACTION_DOWN), events[0]->value.int32Values[0]); + EXPECT_EQ(1, events[0]->value.int32Values[1]); + EXPECT_EQ(2, events[0]->value.int32Values[2]); + EXPECT_EQ(toInt(VehicleHwKeyInputAction::ACTION_UP), events[1]->value.int32Values[0]); + EXPECT_EQ(1, events[1]->value.int32Values[1]); + EXPECT_EQ(2, events[1]->value.int32Values[2]); +} + +TEST_F(DefaultVhalImplTest, testHeartBeatEvent) { + // A heart beat would be sent every 3s, but let's wait for 6s to be sure at least 2 events have + // been generated (at 0s and 3s). + std::this_thread::sleep_for(std::chrono::milliseconds(6000)); + + auto events = mHeartBeatQueue.flush(); + ASSERT_GE(events.size(), (size_t)2); + ASSERT_EQ(toInt(VehicleProperty::VHAL_HEARTBEAT), events[0]->prop); +} + +TEST_F(DefaultVhalImplTest, testVendorOverrideProperties) { + // Destroy the existing VHAL first to prevent it using destroyed connector or propstore. + mHal.reset(); + // Create a new Default VHAL and reinitialize it to load the override properties. + std::string overrideDir = android::base::GetExecutableDirectory() + "/override/"; + mPropStore.reset(new VehiclePropertyStore); + mConnector.reset(new DefaultVehicleConnector); + mConnector->setValuePool(&mValueObjectPool); + mHal.reset(new DefaultVehicleHal(mPropStore.get(), mConnector.get())); + // Set vendor override directory. + DefaultVhalImplTestHelper helper(mConnector.get()); + helper.overrideProperties(overrideDir.c_str()); + + initHal(); + + VehiclePropValue value; + StatusCode status; + // This is the same as the prop in 'gear_selection.json'. + value.prop = toInt(VehicleProperty::GEAR_SELECTION); + + auto gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.int32Values.size()); + ASSERT_EQ(8, gotValue->value.int32Values[0]); + + // If we set the value, it should update despite the override. + value.prop = toInt(VehicleProperty::GEAR_SELECTION); + value.value.int32Values.resize(1); + value.value.int32Values[0] = 5; + + status = mHal->set(value); + ASSERT_EQ(StatusCode::OK, status); + + gotValue = mHal->get(value, &status); + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.int32Values.size()); + ASSERT_EQ(5, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testVendorOverridePropertiesMultipleAreas) { + // Destroy the existing VHAL first to prevent it using destroyed connector or propstore. + mHal.reset(); + // Create a new Default VHAL and reinitialize it to load the override properties. + std::string overrideDir = android::base::GetExecutableDirectory() + "/override/"; + mPropStore.reset(new VehiclePropertyStore); + mConnector.reset(new DefaultVehicleConnector); + mConnector->setValuePool(&mValueObjectPool); + mHal.reset(new DefaultVehicleHal(mPropStore.get(), mConnector.get())); + // Set vendor override directory. + DefaultVhalImplTestHelper helper(mConnector.get()); + helper.overrideProperties(overrideDir.c_str()); + + initHal(); + + VehiclePropValue value; + StatusCode status; + // This is the same as the prop in 'hvac_temperature_set.json'. + value.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET); + value.areaId = HVAC_LEFT; + + auto gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.floatValues.size()); + ASSERT_EQ(30.0f, gotValue->value.floatValues[0]); + + // HVAC_RIGHT should not be affected and return the default value. + value.areaId = HVAC_RIGHT; + + gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.floatValues.size()); + ASSERT_EQ(20.0f, gotValue->value.floatValues[0]); +} + +TEST_F(DefaultVhalImplTest, testVendorOverridePropertiesDirDoesNotExist) { + // Destroy the existing VHAL first to prevent it using destroyed connector or propstore. + mHal.reset(); + // Create a new Default VHAL and reinitialize it to load the override properties. + mPropStore.reset(new VehiclePropertyStore); + mConnector.reset(new DefaultVehicleConnector); + mConnector->setValuePool(&mValueObjectPool); + mHal.reset(new DefaultVehicleHal(mPropStore.get(), mConnector.get())); + // Set vendor override directory to a non-existing dir + DefaultVhalImplTestHelper helper(mConnector.get()); + helper.overrideProperties("123"); + initHal(); + + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::GEAR_SELECTION); + + auto gotValue = mHal->get(value, &status); + + // We should get the default value. + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.int32Values.size()); + ASSERT_EQ(4, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testGetObd2FreezeFrameNoTimestamp) { + VehiclePropValue value; + value.prop = OBD2_FREEZE_FRAME; + StatusCode status; + + auto gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); +} + +TEST_F(DefaultVhalImplTest, testGetObd2FreezeFrameInvalidTimestamp) { + VehiclePropValue value; + value.prop = OBD2_FREEZE_FRAME; + value.value.int64Values.resize(1); + value.value.int64Values[0] = 0; + StatusCode status; + + auto gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); +} + +TEST_F(DefaultVhalImplTest, testGetObd2FreezeFrameInfoGetObd2FreezeFrame) { + VehiclePropValue value; + value.prop = OBD2_FREEZE_FRAME_INFO; + StatusCode status; + + auto gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)3, gotValue->value.int64Values.size()); + + std::vector dtcs; + std::vector sampleDtcs = {"P0070", "P0102", "P0123"}; + for (int64_t timestamp : gotValue->value.int64Values) { + VehiclePropValue freezeFrameRequest; + freezeFrameRequest.prop = OBD2_FREEZE_FRAME; + freezeFrameRequest.value.int64Values.resize(1); + freezeFrameRequest.value.int64Values[0] = timestamp; + + auto freezeFrameValue = mHal->get(freezeFrameRequest, &status); + + ASSERT_EQ(StatusCode::OK, status); + // Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX + 1 + EXPECT_EQ((size_t)32, freezeFrameValue->value.int32Values.size()); + // Obd2FloatSensorIndex.LAST_SYSTEM_INDEX + 1 + EXPECT_EQ((size_t)71, freezeFrameValue->value.floatValues.size()); + // (intValues.size() + floatValues.size()) / 8 + EXPECT_EQ((size_t)13, freezeFrameValue->value.bytes.size()); + + dtcs.push_back(freezeFrameValue->value.stringValue); + } + + for (std::string expectDtc : sampleDtcs) { + EXPECT_NE(std::find(dtcs.begin(), dtcs.end(), expectDtc), dtcs.end()); + } +} + +TEST_F(DefaultVhalImplTest, testGetObd2LiveFrame) { + VehiclePropValue value; + value.prop = OBD2_LIVE_FRAME; + StatusCode status; + + auto gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::OK, status); + // Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX + 1 + EXPECT_EQ((size_t)32, gotValue->value.int32Values.size()); + // Obd2FloatSensorIndex.LAST_SYSTEM_INDEX + 1 + EXPECT_EQ((size_t)71, gotValue->value.floatValues.size()); + // (intValues.size() + floatValues.size()) / 8 + EXPECT_EQ((size_t)13, gotValue->value.bytes.size()); +} + +TEST_F(DefaultVhalImplTest, testClearObd2FreezeFrameAll) { + VehiclePropValue value; + value.prop = OBD2_FREEZE_FRAME_CLEAR; + // No int64Values is to clear all frames. + + auto status = mHal->set(value); + + EXPECT_EQ(StatusCode::OK, status); + + VehiclePropValue freezeFrameRequest; + freezeFrameRequest.prop = OBD2_FREEZE_FRAME; + freezeFrameRequest.value.int64Values.resize(1); + + auto gotValue = mHal->get(freezeFrameRequest, &status); + + EXPECT_EQ(StatusCode::NOT_AVAILABLE, status); + + VehiclePropValue freezeFrameInfoRequest; + freezeFrameInfoRequest.prop = OBD2_FREEZE_FRAME_INFO; + + gotValue = mHal->get(freezeFrameInfoRequest, &status); + + EXPECT_EQ(StatusCode::OK, status); + EXPECT_EQ((size_t)0, gotValue->value.int64Values.size()); +} + +TEST_F(DefaultVhalImplTest, testClearObd2FreezeFrameOneFrame) { + // Get existing freeze frame info first. + VehiclePropValue frameInfoRequest; + frameInfoRequest.prop = OBD2_FREEZE_FRAME_INFO; + StatusCode status; + auto gotValue = mHal->get(frameInfoRequest, &status); + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)3, gotValue->value.int64Values.size()); + + VehiclePropValue clearRequest; + int64_t timestamp = gotValue->value.int64Values[0]; + clearRequest.prop = OBD2_FREEZE_FRAME_CLEAR; + clearRequest.value.int64Values.resize(1); + clearRequest.value.int64Values[0] = timestamp; + + // Try to clear the first frame. + status = mHal->set(clearRequest); + + // Get freeze frame info again. + gotValue = mHal->get(frameInfoRequest, &status); + + ASSERT_EQ(StatusCode::OK, status); + // Now we should only have 2 frames. + ASSERT_EQ((size_t)2, gotValue->value.int64Values.size()); + + // Try to get the deleted frame, should fail. + VehiclePropValue frameRequest; + frameRequest.prop = OBD2_FREEZE_FRAME; + frameRequest.value.int64Values.resize(1); + frameRequest.value.int64Values[0] = timestamp; + + gotValue = mHal->get(frameRequest, &status); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); + + // Clear the same frame again should fail. + status = mHal->set(clearRequest); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); +} + +TEST_F(DefaultVhalImplTest, testGetUserPropertySetOnly) { + VehiclePropValue value; + value.prop = toInt(VehicleProperty::INITIAL_USER_INFO); + StatusCode status; + + mHal->get(value, &status); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); + + value.prop = toInt(VehicleProperty::SWITCH_USER); + + mHal->get(value, &status); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); + + value.prop = toInt(VehicleProperty::CREATE_USER); + + mHal->get(value, &status); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); + + value.prop = toInt(VehicleProperty::REMOVE_USER); + + mHal->get(value, &status); + + ASSERT_EQ(StatusCode::INVALID_ARG, status); +} + +TEST_F(DefaultVhalImplTest, testGetUserIdAssoc) { + VehiclePropValue value; + value.prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION); + StatusCode status; + + mHal->get(value, &status); + + // Default returns NOT_AVAILABLE. + ASSERT_EQ(StatusCode::NOT_AVAILABLE, status); + + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue setValue = { + .prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION), + .areaId = 1, + .value.int32Values = {666, 1, 1, 2}, + }; + + status = mHal->set(setValue); + + ASSERT_EQ(StatusCode::OK, status); + + auto gotValue = mHal->get(value, &status); + + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)4, gotValue->value.int32Values.size()); + EXPECT_EQ(1, gotValue->areaId); + EXPECT_EQ(666, gotValue->value.int32Values[0]); + EXPECT_EQ(1, gotValue->value.int32Values[1]); + EXPECT_EQ(1, gotValue->value.int32Values[2]); + EXPECT_EQ(2, gotValue->value.int32Values[3]); + EXPECT_EQ(toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION), gotValue->prop); +} + +TEST_F(DefaultVhalImplTest, testSwitchUser) { + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue setValue = { + .prop = toInt(VehicleProperty::SWITCH_USER), + .areaId = 1, + .value.int32Values = {666, 3, 2}, + }; + + auto status = mHal->set(setValue); + + ASSERT_EQ(StatusCode::OK, status); + + // Simulate a request from Android side. + setValue = { + .prop = toInt(VehicleProperty::SWITCH_USER), + .areaId = 0, + .value.int32Values = {666, 3}, + }; + // Clear existing events. + mEventQueue.flush(); + + status = mHal->set(setValue); + + ASSERT_EQ(StatusCode::OK, status); + + // Should generate an event for user hal response. + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + EXPECT_EQ(1, events[0]->areaId); + EXPECT_EQ(toInt(VehicleProperty::SWITCH_USER), events[0]->prop); + ASSERT_EQ((size_t)3, events[0]->value.int32Values.size()); + EXPECT_EQ(666, events[0]->value.int32Values[0]); + EXPECT_EQ(3, events[0]->value.int32Values[1]); + EXPECT_EQ(2, events[0]->value.int32Values[2]); + + // Try to get switch_user again, should return default value. + status = mHal->set(setValue); + ASSERT_EQ(StatusCode::OK, status); + + events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + EXPECT_EQ(0, events[0]->areaId); + EXPECT_EQ(toInt(VehicleProperty::SWITCH_USER), events[0]->prop); + ASSERT_EQ((size_t)3, events[0]->value.int32Values.size()); + // Request ID + EXPECT_EQ(666, events[0]->value.int32Values[0]); + // VEHICLE_RESPONSE + EXPECT_EQ(3, events[0]->value.int32Values[1]); + // SUCCESS + EXPECT_EQ(1, events[0]->value.int32Values[2]); +} + +TEST_F(DefaultVhalImplTest, testCreateUser) { + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue setValue = { + .prop = toInt(VehicleProperty::CREATE_USER), + .areaId = 1, + .value.int32Values = {666, 2}, + }; + + auto status = mHal->set(setValue); + + ASSERT_EQ(StatusCode::OK, status); + + // Simulate a request from Android side. + setValue = { + .prop = toInt(VehicleProperty::CREATE_USER), + .areaId = 0, + .value.int32Values = {666}, + }; + // Clear existing events. + mEventQueue.flush(); + + status = mHal->set(setValue); + + ASSERT_EQ(StatusCode::OK, status); + + // Should generate an event for user hal response. + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + EXPECT_EQ(1, events[0]->areaId); + EXPECT_EQ(toInt(VehicleProperty::CREATE_USER), events[0]->prop); + ASSERT_EQ((size_t)2, events[0]->value.int32Values.size()); + EXPECT_EQ(666, events[0]->value.int32Values[0]); + EXPECT_EQ(2, events[0]->value.int32Values[1]); + + // Try to get create_user again, should return default value. + status = mHal->set(setValue); + ASSERT_EQ(StatusCode::OK, status); + + events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + EXPECT_EQ(0, events[0]->areaId); + EXPECT_EQ(toInt(VehicleProperty::CREATE_USER), events[0]->prop); + ASSERT_EQ((size_t)2, events[0]->value.int32Values.size()); + // Request ID + EXPECT_EQ(666, events[0]->value.int32Values[0]); + // SUCCESS + EXPECT_EQ(1, events[0]->value.int32Values[1]); +} + +TEST_F(DefaultVhalImplTest, testInitialUserInfo) { + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue setValue = { + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .areaId = 1, + .value.int32Values = {666, 1, 11}, + }; + + auto status = mHal->set(setValue); + + ASSERT_EQ(StatusCode::OK, status); + + // Simulate a request from Android side. + setValue = { + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .areaId = 0, + .value.int32Values = {3}, + }; + // Clear existing events. + mEventQueue.flush(); + + status = mHal->set(setValue); + + ASSERT_EQ(StatusCode::OK, status); + + // Should generate an event for user hal response. + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + EXPECT_EQ(1, events[0]->areaId); + EXPECT_EQ(toInt(VehicleProperty::INITIAL_USER_INFO), events[0]->prop); + ASSERT_EQ((size_t)3, events[0]->value.int32Values.size()); + EXPECT_EQ(3, events[0]->value.int32Values[0]); + EXPECT_EQ(1, events[0]->value.int32Values[1]); + EXPECT_EQ(11, events[0]->value.int32Values[2]); + + // Try to get create_user again, should return default value. + status = mHal->set(setValue); + ASSERT_EQ(StatusCode::OK, status); + + events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + EXPECT_EQ(0, events[0]->areaId); + EXPECT_EQ(toInt(VehicleProperty::INITIAL_USER_INFO), events[0]->prop); + ASSERT_EQ((size_t)4, events[0]->value.int32Values.size()); + // Request ID + EXPECT_EQ(3, events[0]->value.int32Values[0]); + // ACTION: DEFAULT + EXPECT_EQ(0, events[0]->value.int32Values[1]); + // User id: 0 + EXPECT_EQ(0, events[0]->value.int32Values[2]); + // Flags: 0 + EXPECT_EQ(0, events[0]->value.int32Values[3]); +} + +TEST_F(DefaultVhalImplTest, testDebugSetInt) { + hidl_vec options = {"--debughal", "--setint", + getPropIdString(VehicleProperty::INFO_MODEL_YEAR), "2022", + "1000"}; + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + // Clear existing events. + mEventQueue.flush(); + + EXPECT_FALSE(mHal->dump(fd, options)); + + lseek(memfd, 0, SEEK_SET); + char buf[10240] = {}; + // The dumped info should be empty. + read(memfd, buf, sizeof(buf)); + EXPECT_STREQ("", buf); + + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + ASSERT_EQ((size_t)1, events[0]->value.int32Values.size()); + EXPECT_EQ(2022, events[0]->value.int32Values[0]); + EXPECT_EQ(1000, events[0]->timestamp); + + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::INFO_MODEL_YEAR); + auto gotValue = mHal->get(value, &status); + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.int32Values.size()); + EXPECT_EQ(2022, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testDebugSetBool) { + char doorLeft[100]; + snprintf(doorLeft, sizeof(doorLeft), "%d", DOOR_1_LEFT); + hidl_vec options = { + "--debughal", "--setbool", getPropIdString(VehicleProperty::DOOR_LOCK), + "false", "1000", doorLeft}; + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + // Clear existing events. + mEventQueue.flush(); + + EXPECT_FALSE(mHal->dump(fd, options)); + + lseek(memfd, 0, SEEK_SET); + char buf[10240] = {}; + // The dumped info should be empty. + read(memfd, buf, sizeof(buf)); + EXPECT_STREQ("", buf); + + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + EXPECT_EQ(0, events[0]->value.int32Values[0]); + EXPECT_EQ(DOOR_1_LEFT, events[0]->areaId); + EXPECT_EQ(1000, events[0]->timestamp); + + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::DOOR_LOCK); + value.areaId = DOOR_1_LEFT; + auto gotValue = mHal->get(value, &status); + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.int32Values.size()); + EXPECT_EQ(0, gotValue->value.int32Values[0]); + + value.areaId = DOOR_1_RIGHT; + gotValue = mHal->get(value, &status); + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.int32Values.size()); + EXPECT_EQ(1, gotValue->value.int32Values[0]); +} + +TEST_F(DefaultVhalImplTest, testDebugSetFloat) { + hidl_vec options = {"--debughal", "--setfloat", + getPropIdString(VehicleProperty::INFO_FUEL_CAPACITY), "10.5", + "1000"}; + hidl_handle fd = {}; + int memfd = createMemfd(&fd); + // Clear existing events. + mEventQueue.flush(); + + EXPECT_FALSE(mHal->dump(fd, options)); + + lseek(memfd, 0, SEEK_SET); + char buf[10240] = {}; + // The dumped info should be empty. + read(memfd, buf, sizeof(buf)); + EXPECT_STREQ("", buf); + + auto events = mEventQueue.flush(); + ASSERT_EQ((size_t)1, events.size()); + ASSERT_EQ((size_t)1, events[0]->value.floatValues.size()); + EXPECT_EQ(10.5, events[0]->value.floatValues[0]); + EXPECT_EQ(1000, events[0]->timestamp); + + VehiclePropValue value; + StatusCode status; + value.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY); + auto gotValue = mHal->get(value, &status); + ASSERT_EQ(StatusCode::OK, status); + ASSERT_EQ((size_t)1, gotValue->value.floatValues.size()); + EXPECT_EQ(10.5, gotValue->value.floatValues[0]); +} + +} // namespace diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/ProtoMessageConverter_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/ProtoMessageConverter_test.cpp index 3817e4406ed1e2a21665af0e7f35a9d537f2f264..a507b501b83c3521ea47af131353744d297ecf43 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/ProtoMessageConverter_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/ProtoMessageConverter_test.cpp @@ -17,9 +17,9 @@ #include #include +#include #include "vhal_v2_0/DefaultConfig.h" -#include "vhal_v2_0/ProtoMessageConverter.h" #include "vhal_v2_0/VehicleUtils.h" namespace android { diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/override/gear_selection.json b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/override/gear_selection.json new file mode 100644 index 0000000000000000000000000000000000000000..59666b80469e01204122b48f073bd89008c53fd8 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/override/gear_selection.json @@ -0,0 +1,9 @@ +[ + { + "timestamp": 1000000, + "areaId": 0, + "value": 8, + // GEAR_SELECTION + "prop": 289408000 + } +] diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/override/hvac_temperature_set.json b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/override/hvac_temperature_set.json new file mode 100644 index 0000000000000000000000000000000000000000..93a97ed095de62075a621cc4bbfa787065374360 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/override/hvac_temperature_set.json @@ -0,0 +1,10 @@ +[ + { + "timestamp": 1000000, + // HVAC_LEFT + "areaId": 49, + "value": 30, + // HVAC_TEMPERATURE_SET + "prop": 358614275 + } +] diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/prop.json b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/prop.json new file mode 100644 index 0000000000000000000000000000000000000000..b88110923742998f2c904c5d96f217dbdf190ca6 --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/prop.json @@ -0,0 +1,26 @@ +[ + { + "timestamp": 1000000, + "areaId": 0, + "value": 8, + "prop": 289408000 + }, + { + "timestamp": 2000000, + "areaId": 0, + "value": 4, + "prop": 289408000 + }, + { + "timestamp": 3000000, + "areaId": 0, + "value": 16, + "prop": 289408000 + }, + { + "timestamp": 4000000, + "areaId": 0, + "value": 10, + "prop": 289408000 + } +] diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/Android.bp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..ad125275aad580b9a6dd8c0f89f9d54258fcce7d --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/Android.bp @@ -0,0 +1,40 @@ +// 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. + +// Library used to emulate User HAL behavior through lshal debug requests. +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_library { + name: "android.hardware.automotive.vehicle@2.0-fake-user-hal-lib", + vendor: true, + defaults: ["vhal_v2_0_target_defaults"], + srcs: ["FakeUserHal.cpp"], + shared_libs: [ + "libbase", + "libutils", + "libcutils", + ], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + whole_static_libs: [ + "android.hardware.automotive.vehicle@2.0-user-hal-helper-lib", + ], +} diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/FakeUserHal.cpp similarity index 85% rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/FakeUserHal.cpp index 3bdf5a84a07916ea7f7c8796dae5e39c1171cd04..e9ebcc640e33a19c68ada43a61606bb133d22b61 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/FakeUserHal.cpp @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "EmulatedUserHal" - -#include "EmulatedUserHal.h" +#define LOG_TAG "FakeUserHal" #include #include #include "UserHalHelper.h" +#include "FakeUserHal.h" + namespace android { namespace hardware { namespace automotive { @@ -60,7 +60,7 @@ Result getSwitchUserMessageType(const VehiclePropValue& v } // namespace -bool EmulatedUserHal::isSupported(int32_t prop) { +bool FakeUserHal::isSupported(int32_t prop) { switch (prop) { case INITIAL_USER_INFO: case SWITCH_USER: @@ -73,7 +73,7 @@ bool EmulatedUserHal::isSupported(int32_t prop) { } } -Result> EmulatedUserHal::onSetProperty( +Result> FakeUserHal::onSetProperty( const VehiclePropValue& value) { ALOGV("onSetProperty(): %s", toString(value).c_str()); @@ -95,7 +95,7 @@ Result> EmulatedUserHal::onSetProperty( } } -Result> EmulatedUserHal::onGetProperty( +Result> FakeUserHal::onGetProperty( const VehiclePropValue& value) { ALOGV("onGetProperty(%s)", toString(value).c_str()); switch (value.prop) { @@ -113,7 +113,7 @@ Result> EmulatedUserHal::onGetProperty( } } -Result> EmulatedUserHal::onGetUserIdentificationAssociation( +Result> FakeUserHal::onGetUserIdentificationAssociation( const VehiclePropValue& value) { if (mSetUserIdentificationAssociationResponseFromCmd == nullptr) { return defaultUserIdentificationAssociation(value); @@ -132,7 +132,7 @@ Result> EmulatedUserHal::onGetUserIdentificati return newValue; } -Result> EmulatedUserHal::onSetInitialUserInfoResponse( +Result> FakeUserHal::onSetInitialUserInfoResponse( const VehiclePropValue& value) { auto requestId = getRequestId(value); if (!requestId.ok()) { @@ -164,7 +164,7 @@ Result> EmulatedUserHal::onSetInitialUserInfoR return updatedValue; } -Result> EmulatedUserHal::onSetSwitchUserResponse( +Result> FakeUserHal::onSetSwitchUserResponse( const VehiclePropValue& value) { auto requestId = getRequestId(value); if (!requestId.ok()) { @@ -217,7 +217,7 @@ Result> EmulatedUserHal::onSetSwitchUserRespon return updatedValue; } -Result> EmulatedUserHal::onSetCreateUserResponse( +Result> FakeUserHal::onSetCreateUserResponse( const VehiclePropValue& value) { auto requestId = getRequestId(value); if (!requestId.ok()) { @@ -248,7 +248,7 @@ Result> EmulatedUserHal::onSetCreateUserRespon return updatedValue; } -Result> EmulatedUserHal::onSetUserIdentificationAssociation( +Result> FakeUserHal::onSetUserIdentificationAssociation( const VehiclePropValue& value) { auto requestId = getRequestId(value); if (!requestId.ok()) { @@ -277,14 +277,14 @@ Result> EmulatedUserHal::onSetUserIdentificati return defaultUserIdentificationAssociation(value); } -Result> EmulatedUserHal::defaultUserIdentificationAssociation( +Result> FakeUserHal::defaultUserIdentificationAssociation( const VehiclePropValue& request) { // TODO(b/159498909): return a response with NOT_ASSOCIATED_ANY_USER for all requested types ALOGE("no lshal response for %s; replying with NOT_AVAILABLE", toString(request).c_str()); return Error(static_cast(StatusCode::NOT_AVAILABLE)) << "not set by lshal"; } -Result> EmulatedUserHal::sendUserHalResponse( +Result> FakeUserHal::sendUserHalResponse( std::unique_ptr response, int32_t requestId) { switch (response->areaId) { case 1: @@ -311,35 +311,37 @@ Result> EmulatedUserHal::sendUserHalResponse( return response; } -void EmulatedUserHal::showDumpHelp(int fd) { - dprintf(fd, "%s: dumps state used for user management\n", kUserHalDumpOption); +std::string FakeUserHal::showDumpHelp() { + return fmt::format("{}: dumps state used for user management\n", kUserHalDumpOption); } -void EmulatedUserHal::dump(int fd, std::string indent) { +std::string FakeUserHal::dump(std::string indent) { + std::string info; if (mInitialUserResponseFromCmd != nullptr) { - dprintf(fd, "%sInitialUserInfo response: %s\n", indent.c_str(), - toString(*mInitialUserResponseFromCmd).c_str()); + info += fmt::format("{}InitialUserInfo response: {}\n", indent.c_str(), + toString(*mInitialUserResponseFromCmd).c_str()); } else { - dprintf(fd, "%sNo InitialUserInfo response\n", indent.c_str()); + info += fmt::format("{}No InitialUserInfo response\n", indent.c_str()); } if (mSwitchUserResponseFromCmd != nullptr) { - dprintf(fd, "%sSwitchUser response: %s\n", indent.c_str(), - toString(*mSwitchUserResponseFromCmd).c_str()); + info += fmt::format("{}SwitchUser response: {}\n", indent.c_str(), + toString(*mSwitchUserResponseFromCmd).c_str()); } else { - dprintf(fd, "%sNo SwitchUser response\n", indent.c_str()); + info += fmt::format("{}No SwitchUser response\n", indent.c_str()); } if (mCreateUserResponseFromCmd != nullptr) { - dprintf(fd, "%sCreateUser response: %s\n", indent.c_str(), - toString(*mCreateUserResponseFromCmd).c_str()); + info += fmt::format("{}CreateUser response: {}\n", indent.c_str(), + toString(*mCreateUserResponseFromCmd).c_str()); } else { - dprintf(fd, "%sNo CreateUser response\n", indent.c_str()); + info += fmt::format("{}No CreateUser response\n", indent.c_str()); } if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) { - dprintf(fd, "%sSetUserIdentificationAssociation response: %s\n", indent.c_str(), - toString(*mSetUserIdentificationAssociationResponseFromCmd).c_str()); + info += fmt::format("{}SetUserIdentificationAssociation response: {}\n", indent.c_str(), + toString(*mSetUserIdentificationAssociationResponseFromCmd).c_str()); } else { - dprintf(fd, "%sNo SetUserIdentificationAssociation response\n", indent.c_str()); + info += fmt::format("{}No SetUserIdentificationAssociation response\n", indent.c_str()); } + return info; } } // namespace impl diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/FakeUserHal.h similarity index 91% rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.h rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/FakeUserHal.h index db2f117e3e176e2a702c4056e74ceddda9d86053..122aee8eb1b03d7860209a19cfbed9ed1253af54 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedUserHal.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/FakeUserHal.h @@ -14,9 +14,10 @@ * limitations under the License. */ -#ifndef android_hardware_automotive_vehicle_V2_0_impl_EmulatedUserHal_H_ -#define android_hardware_automotive_vehicle_V2_0_impl_EmulatedUserHal_H_ +#ifndef android_hardware_automotive_vehicle_V2_0_impl_FakeUserHal_H_ +#define android_hardware_automotive_vehicle_V2_0_impl_FakeUserHal_H_ +#include #include #include @@ -32,13 +33,13 @@ namespace impl { constexpr char kUserHalDumpOption[] = "--user-hal"; /** - * Class used to emulate User HAL behavior through lshal debug requests. + * Class used to emulate a real User HAL behavior through lshal debug requests. */ -class EmulatedUserHal { +class FakeUserHal { public: - EmulatedUserHal() {} + FakeUserHal() {} - ~EmulatedUserHal() = default; + ~FakeUserHal() = default; /** * Checks if the emulator can handle the property. @@ -64,12 +65,12 @@ class EmulatedUserHal { /** * Shows the User HAL emulation help. */ - void showDumpHelp(int fd); + std::string showDumpHelp(); /** * Dump its contents. */ - void dump(int fd, std::string indent); + std::string dump(std::string indent); private: /** @@ -148,4 +149,4 @@ class EmulatedUserHal { } // namespace hardware } // namespace android -#endif // android_hardware_automotive_vehicle_V2_0_impl_EmulatedUserHal_H_ +#endif // android_hardware_automotive_vehicle_V2_0_impl_FakeUserHal_H_ diff --git a/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp b/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp index 9fc17c665247f1258230a886aefe49ea796bb14b..d7547f655696239f7095e9914bb5de49495cfa86 100644 --- a/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp +++ b/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp @@ -41,7 +41,8 @@ TEST(RecurrentTimerTest, oneInterval) { timer.registerRecurrentEvent(milliseconds(1), 0xdead); std::this_thread::sleep_for(milliseconds(100)); - ASSERT_EQ_WITH_TOLERANCE(100, counter.load(), 20); + // This test is unstable, so set the tolerance to 50. + ASSERT_EQ_WITH_TOLERANCE(100, counter.load(), 50); } TEST(RecurrentTimerTest, multipleIntervals) { @@ -66,7 +67,8 @@ TEST(RecurrentTimerTest, multipleIntervals) { timer.registerRecurrentEvent(milliseconds(5), 0xbeef); std::this_thread::sleep_for(milliseconds(100)); - ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 20); + // This test is unstable, so set the tolerance to 50. + ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 50); ASSERT_EQ_WITH_TOLERANCE(20, counter5ms.load(), 5); } diff --git a/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp b/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp index 4e3ade15a3a473fdbf1966bdee4d9365eb9321f8..096816600f8232542e8583e9c0b4f6ac390f2222 100644 --- a/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp +++ b/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp @@ -58,10 +58,12 @@ public: TEST_F(VehicleObjectPoolTest, valuePoolBasicCorrectness) { auto value = valuePool->obtain(VehiclePropertyType::INT32); - // At this point, v1 should be recycled and the only object in the pool. - ASSERT_EQ(value.get(), valuePool->obtain(VehiclePropertyType::INT32).get()); + void* raw = value.get(); + value.reset(); + // At this point, value should be recycled and the only object in the pool. + ASSERT_EQ(raw, valuePool->obtain(VehiclePropertyType::INT32).get()); // Obtaining value of another type - should return a new object - ASSERT_NE(value.get(), valuePool->obtain(VehiclePropertyType::FLOAT).get()); + ASSERT_NE(raw, valuePool->obtain(VehiclePropertyType::FLOAT).get()); ASSERT_EQ(3u, stats->Obtained); ASSERT_EQ(2u, stats->Created); diff --git a/automotive/vehicle/2.0/vts/functional/VtsHalAutomotiveVehicleV2_0TargetTest.cpp b/automotive/vehicle/2.0/vts/functional/VtsHalAutomotiveVehicleV2_0TargetTest.cpp deleted file mode 100644 index 8adec8486f2b99ac3c2d77b39aa1f5ec6a155078..0000000000000000000000000000000000000000 --- a/automotive/vehicle/2.0/vts/functional/VtsHalAutomotiveVehicleV2_0TargetTest.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "VtsHalAutomotiveVehicle" - -#include -#include -#include - -#include -#include -#include - -using namespace android::hardware::automotive::vehicle::V2_0; -using ::android::sp; -using ::android::hardware::hidl_vec; -using ::android::hardware::Return; - -constexpr auto kTimeout = std::chrono::milliseconds(500); -constexpr auto kInvalidProp = 0x31600207; - -class VtsVehicleCallback : public IVehicleCallback { - private: - using MutexGuard = std::lock_guard; - using HidlVecOfValues = hidl_vec; - std::mutex mLock; - std::condition_variable mEventCond; - std::vector mReceivedEvents; - - public: - Return onPropertyEvent(const hidl_vec& values) override { - { - MutexGuard guard(mLock); - mReceivedEvents.push_back(values); - } - mEventCond.notify_one(); - return Return(); - } - - Return onPropertySet(const VehiclePropValue& /* value */) override { - return Return(); - } - Return onPropertySetError(StatusCode /* errorCode */, int32_t /* propId */, - int32_t /* areaId */) override { - return Return(); - } - - bool waitForExpectedEvents(size_t expectedEvents) { - std::unique_lock g(mLock); - - if (expectedEvents == 0 && mReceivedEvents.size() == 0) { - return mEventCond.wait_for(g, kTimeout) == std::cv_status::timeout; - } - - while (expectedEvents != mReceivedEvents.size()) { - if (mEventCond.wait_for(g, kTimeout) == std::cv_status::timeout) { - return false; - } - } - return true; - } - - void reset() { mReceivedEvents.clear(); } -}; - -class VehicleHalHidlTest : public testing::TestWithParam { - public: - virtual void SetUp() override { - mVehicle = IVehicle::getService(GetParam()); - ASSERT_NE(mVehicle.get(), nullptr); - } - virtual void TearDown() override {} - - sp mVehicle; - - bool isBooleanGlobalProp(int32_t property) { - return (property & (int)VehiclePropertyType::MASK) == (int)VehiclePropertyType::BOOLEAN && - (property & (int)VehicleArea::MASK) == (int)VehicleArea::GLOBAL; - } - - void invokeGet(int32_t property, int32_t areaId) { - VehiclePropValue requestedValue{}; - requestedValue.prop = property; - requestedValue.areaId = areaId; - - invokeGet(requestedValue); - } - - void invokeGet(const VehiclePropValue& requestedPropValue) { - mActualValue = VehiclePropValue{}; // reset previous values - - StatusCode refStatus; - VehiclePropValue refValue; - bool isCalled = false; - mVehicle->get(requestedPropValue, - [&refStatus, &refValue, &isCalled](StatusCode status, - const VehiclePropValue& value) { - refStatus = status; - refValue = value; - isCalled = true; - }); - ASSERT_TRUE(isCalled) << "callback wasn't called for property: " << requestedPropValue.prop; - - mActualValue = refValue; - mActualStatusCode = refStatus; - } - - VehiclePropValue mActualValue; - StatusCode mActualStatusCode; -}; - -// Test getAllPropConfig() returns at least 4 property configs. -TEST_P(VehicleHalHidlTest, getAllPropConfigs) { - ALOGD("VehicleHalHidlTest::getAllPropConfigs"); - bool isCalled = false; - hidl_vec propConfigs; - mVehicle->getAllPropConfigs([&isCalled, &propConfigs](const hidl_vec& cfgs) { - propConfigs = cfgs; - isCalled = true; - }); - ASSERT_TRUE(isCalled); - ASSERT_GE(propConfigs.size(), 4); -} - -// Test getPropConfig() can query all properties listed in CDD. -TEST_P(VehicleHalHidlTest, getPropConfigs) { - ALOGD("VehicleHalHidlTest::getPropConfigs"); - // Check the properties listed in CDD - hidl_vec properties = { - (int)VehicleProperty::GEAR_SELECTION, (int)VehicleProperty::NIGHT_MODE, - (int)VehicleProperty::PARKING_BRAKE_ON, (int)VehicleProperty::PERF_VEHICLE_SPEED}; - bool isCalled = false; - mVehicle->getPropConfigs( - properties, [&isCalled](StatusCode status, const hidl_vec& cfgs) { - ASSERT_EQ(StatusCode::OK, status); - ASSERT_EQ(4u, cfgs.size()); - isCalled = true; - }); - ASSERT_TRUE(isCalled); -} - -// Test getPropConfig() with an invalid propertyId returns an error code. -TEST_P(VehicleHalHidlTest, getPropConfigsWithInvalidProp) { - ALOGD("VehicleHalHidlTest::getPropConfigsWithInvalidProp"); - hidl_vec properties = {kInvalidProp}; - bool isCalled = false; - mVehicle->getPropConfigs( - properties, [&isCalled](StatusCode status, const hidl_vec& cfgs) { - ASSERT_NE(StatusCode::OK, status); - ASSERT_EQ(0, cfgs.size()); - isCalled = true; - }); - ASSERT_TRUE(isCalled); -} - -// Test get() return current value for properties. -TEST_P(VehicleHalHidlTest, get) { - ALOGD("VehicleHalHidlTest::get"); - invokeGet((int)VehicleProperty::PERF_VEHICLE_SPEED, 0); - ASSERT_EQ(StatusCode::OK, mActualStatusCode); -} - -// Test get() with an invalid propertyId return an error codes. -TEST_P(VehicleHalHidlTest, getInvalidProp) { - ALOGD("VehicleHalHidlTest::getInvalidProp"); - - invokeGet(kInvalidProp, 0); - ASSERT_NE(StatusCode::OK, mActualStatusCode); -} - -// Test set() on read_write properties. -TEST_P(VehicleHalHidlTest, setProp) { - ALOGD("VehicleHalHidlTest::setProp"); - hidl_vec propConfigs; - // skip hvac related properties - std::unordered_set hvacProps = {(int)VehicleProperty::HVAC_DEFROSTER, - (int)VehicleProperty::HVAC_AC_ON, - (int)VehicleProperty::HVAC_MAX_AC_ON, - (int)VehicleProperty::HVAC_MAX_DEFROST_ON, - (int)VehicleProperty::HVAC_RECIRC_ON, - (int)VehicleProperty::HVAC_DUAL_ON, - (int)VehicleProperty::HVAC_AUTO_ON, - (int)VehicleProperty::HVAC_POWER_ON, - (int)VehicleProperty::HVAC_AUTO_RECIRC_ON, - (int)VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON}; - mVehicle->getAllPropConfigs( - [&propConfigs](const hidl_vec& cfgs) { propConfigs = cfgs; }); - for (const VehiclePropConfig& cfg : propConfigs) { - // test on boolean and writable property - if (cfg.access == VehiclePropertyAccess::READ_WRITE && isBooleanGlobalProp(cfg.prop) && - !hvacProps.count(cfg.prop)) { - invokeGet(cfg.prop, 0); - int setValue = mActualValue.value.int32Values[0] == 1 ? 0 : 1; - VehiclePropValue propToSet = mActualValue; - propToSet.value.int32Values[0] = setValue; - ASSERT_EQ(StatusCode::OK, mVehicle->set(propToSet)) - << "Invalid status code for setting property: " << cfg.prop; - // check set success - invokeGet(cfg.prop, 0); - ASSERT_EQ(StatusCode::OK, mActualStatusCode); - ASSERT_EQ(setValue, mActualValue.value.int32Values[0]) - << "Failed to set value for property: " << cfg.prop; - } - } -} - -// Test set() on an read_only property. -TEST_P(VehicleHalHidlTest, setNotWritableProp) { - ALOGD("VehicleHalHidlTest::setNotWritableProp"); - invokeGet(static_cast(VehicleProperty::PERF_VEHICLE_SPEED), 0); - ASSERT_EQ(StatusCode::OK, mActualStatusCode); - VehiclePropValue vehicleSpeed = mActualValue; - - ASSERT_EQ(StatusCode::ACCESS_DENIED, mVehicle->set(vehicleSpeed)); -} - -// Test subscribe() and unsubscribe(). -TEST_P(VehicleHalHidlTest, subscribeAndUnsubscribe) { - ALOGD("VehicleHalHidlTest::subscribeAndUnsubscribe"); - const auto prop = static_cast(VehicleProperty::PERF_VEHICLE_SPEED); - sp cb = new VtsVehicleCallback(); - - hidl_vec options = { - SubscribeOptions{.propId = prop, 100.0, .flags = SubscribeFlags::EVENTS_FROM_CAR}}; - - ASSERT_EQ(StatusCode::OK, mVehicle->subscribe(cb, options)); - ASSERT_TRUE(cb->waitForExpectedEvents(10)); - - ASSERT_EQ(StatusCode::OK, mVehicle->unsubscribe(cb, prop)); - cb->reset(); - ASSERT_FALSE(cb->waitForExpectedEvents(10)); -} - -// Test subscribe() with an invalid property. -TEST_P(VehicleHalHidlTest, subscribeInvalidProp) { - ALOGD("VehicleHalHidlTest::subscribeInvalidProp"); - - sp cb = new VtsVehicleCallback(); - - hidl_vec options = {SubscribeOptions{ - .propId = kInvalidProp, 10.0, .flags = SubscribeFlags::EVENTS_FROM_CAR}}; - - ASSERT_NE(StatusCode::OK, mVehicle->subscribe(cb, options)); -} - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VehicleHalHidlTest); -INSTANTIATE_TEST_SUITE_P( - PerInstance, VehicleHalHidlTest, - testing::ValuesIn(android::hardware::getAllHalInstanceNames(IVehicle::descriptor)), - android::hardware::PrintInstanceNameToString); diff --git a/automotive/vehicle/TEST_MAPPING b/automotive/vehicle/TEST_MAPPING new file mode 100644 index 0000000000000000000000000000000000000000..7e425540f5849ca8a39f951cc02753e10fc6a178 --- /dev/null +++ b/automotive/vehicle/TEST_MAPPING @@ -0,0 +1,33 @@ +{ + "presubmit": [ + { + "name": "VehicleHalAidlHidlCompatibilityTest" + }, + { + "name": "VehicleHalDefaultConfigTest" + }, + { + "name": "VehicleHalVehicleUtilsTest" + }, + { + "name": "FakeVehicleHardwareTest" + }, + { + "name": "FakeVehicleHalValueGeneratorsTest" + }, + { + "name": "FakeObd2FrameTest" + }, + { + "name": "FakeUserHalTest" + }, + { + "name": "DefaultVehicleHalTest" + } + ], + "auto-presubmit": [ + { + "name": "VtsHalAutomotiveVehicle_TargetTest" + } + ] +} diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..9aeb4d2c78bb5178064b8a9f8d983a4beaff0334 --- /dev/null +++ b/automotive/vehicle/aidl/Android.bp @@ -0,0 +1,51 @@ +// 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"], +} + +aidl_interface { + name: "android.hardware.automotive.vehicle", + vendor_available: true, + srcs: [ + "android/hardware/automotive/vehicle/**/*.aidl", + ], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + min_sdk_version: "31", + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], + }, + }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..f4785043b53911192dec8e29b3d4b93648f496fb --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash @@ -0,0 +1 @@ +8610b651e162c614a97542d6f4ed039c969823e5 diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..22c690c00f9db5049fa0df236b8c98fcf9961353 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable CreateUserRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo newUserInfo; + @utf8InCpp String newUserName; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7d0196b4e51bda6ec4f474b5ccb2caa263b36cb0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable CreateUserResponse { + int requestId; + android.hardware.automotive.vehicle.CreateUserStatus status = android.hardware.automotive.vehicle.CreateUserStatus.SUCCESS; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4c3b751656d988b220ef7d1d69b91e971738895f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 CreateUserStatus { + SUCCESS = 1, + FAILURE = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CustomInputType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CustomInputType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4decb6985da0df64e4a35f09ec4a3c89e609419b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CustomInputType.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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 CustomInputType { + CUSTOM_EVENT_F1 = 1001, + CUSTOM_EVENT_F2 = 1002, + CUSTOM_EVENT_F3 = 1003, + CUSTOM_EVENT_F4 = 1004, + CUSTOM_EVENT_F5 = 1005, + CUSTOM_EVENT_F6 = 1006, + CUSTOM_EVENT_F7 = 1007, + CUSTOM_EVENT_F8 = 1008, + CUSTOM_EVENT_F9 = 1009, + CUSTOM_EVENT_F10 = 1010, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9704704eab9724340c48ccca628c226f33b9e487 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl @@ -0,0 +1,108 @@ +/* + * 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 -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 DiagnosticFloatSensorIndex { + CALCULATED_ENGINE_LOAD = 0, + ENGINE_COOLANT_TEMPERATURE = 1, + SHORT_TERM_FUEL_TRIM_BANK1 = 2, + LONG_TERM_FUEL_TRIM_BANK1 = 3, + SHORT_TERM_FUEL_TRIM_BANK2 = 4, + LONG_TERM_FUEL_TRIM_BANK2 = 5, + FUEL_PRESSURE = 6, + INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7, + ENGINE_RPM = 8, + VEHICLE_SPEED = 9, + TIMING_ADVANCE = 10, + MAF_AIR_FLOW_RATE = 11, + THROTTLE_POSITION = 12, + OXYGEN_SENSOR1_VOLTAGE = 13, + OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14, + OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15, + OXYGEN_SENSOR2_VOLTAGE = 16, + OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17, + OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18, + OXYGEN_SENSOR3_VOLTAGE = 19, + OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20, + OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21, + OXYGEN_SENSOR4_VOLTAGE = 22, + OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23, + OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24, + OXYGEN_SENSOR5_VOLTAGE = 25, + OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26, + OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27, + OXYGEN_SENSOR6_VOLTAGE = 28, + OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29, + OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30, + OXYGEN_SENSOR7_VOLTAGE = 31, + OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32, + OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33, + OXYGEN_SENSOR8_VOLTAGE = 34, + OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35, + OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36, + FUEL_RAIL_PRESSURE = 37, + FUEL_RAIL_GAUGE_PRESSURE = 38, + COMMANDED_EXHAUST_GAS_RECIRCULATION = 39, + EXHAUST_GAS_RECIRCULATION_ERROR = 40, + COMMANDED_EVAPORATIVE_PURGE = 41, + FUEL_TANK_LEVEL_INPUT = 42, + EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43, + CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44, + CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45, + CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46, + CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47, + ABSOLUTE_LOAD_VALUE = 48, + FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49, + RELATIVE_THROTTLE_POSITION = 50, + ABSOLUTE_THROTTLE_POSITION_B = 51, + ABSOLUTE_THROTTLE_POSITION_C = 52, + ACCELERATOR_PEDAL_POSITION_D = 53, + ACCELERATOR_PEDAL_POSITION_E = 54, + ACCELERATOR_PEDAL_POSITION_F = 55, + COMMANDED_THROTTLE_ACTUATOR = 56, + ETHANOL_FUEL_PERCENTAGE = 57, + ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66, + RELATIVE_ACCELERATOR_PEDAL_POSITION = 67, + HYBRID_BATTERY_PACK_REMAINING_LIFE = 68, + FUEL_INJECTION_TIMING = 69, + ENGINE_FUEL_RATE = 70, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b3f13d426373ed1a0f94fa2e7c90cd64a21f5c71 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl @@ -0,0 +1,69 @@ +/* + * 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 -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 DiagnosticIntegerSensorIndex { + FUEL_SYSTEM_STATUS = 0, + MALFUNCTION_INDICATOR_LIGHT_ON = 1, + IGNITION_MONITORS_SUPPORTED = 2, + IGNITION_SPECIFIC_MONITORS = 3, + INTAKE_AIR_TEMPERATURE = 4, + COMMANDED_SECONDARY_AIR_STATUS = 5, + NUM_OXYGEN_SENSORS_PRESENT = 6, + RUNTIME_SINCE_ENGINE_START = 7, + DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8, + WARMUPS_SINCE_CODES_CLEARED = 9, + DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10, + ABSOLUTE_BAROMETRIC_PRESSURE = 11, + CONTROL_MODULE_VOLTAGE = 12, + AMBIENT_AIR_TEMPERATURE = 13, + TIME_WITH_MALFUNCTION_LIGHT_ON = 14, + TIME_SINCE_TROUBLE_CODES_CLEARED = 15, + MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16, + MAX_OXYGEN_SENSOR_VOLTAGE = 17, + MAX_OXYGEN_SENSOR_CURRENT = 18, + MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19, + MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20, + FUEL_TYPE = 21, + FUEL_RAIL_ABSOLUTE_PRESSURE = 22, + ENGINE_OIL_TEMPERATURE = 23, + DRIVER_DEMAND_PERCENT_TORQUE = 24, + ENGINE_ACTUAL_PERCENT_TORQUE = 25, + ENGINE_REFERENCE_PERCENT_TORQUE = 26, + ENGINE_PERCENT_TORQUE_DATA_IDLE = 27, + ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28, + ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29, + ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30, + ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9772aeeba0442d07e5adeba551fb7e9f0e44ae74 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.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 -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 ElectronicTollCollectionCardStatus { + UNKNOWN = 0, + ELECTRONIC_TOLL_COLLECTION_CARD_VALID = 1, + ELECTRONIC_TOLL_COLLECTION_CARD_INVALID = 2, + ELECTRONIC_TOLL_COLLECTION_CARD_NOT_INSERTED = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..22cf2c388b93bff590ddcade170223753561a72b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 ElectronicTollCollectionCardType { + UNKNOWN = 0, + JP_ELECTRONIC_TOLL_COLLECTION_CARD = 1, + JP_ELECTRONIC_TOLL_COLLECTION_CARD_V2 = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvChargeState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvChargeState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fe1c240a2dcc55b5c448a5d3cc4d85aee00255b7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvChargeState.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 EvChargeState { + UNKNOWN = 0, + CHARGING = 1, + FULLY_CHARGED = 2, + NOT_CHARGING = 3, + ERROR = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvConnectorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b469578e7756dfb0344f8272c7a12c0ced4c17b2 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvConnectorType.aidl @@ -0,0 +1,50 @@ +/* + * 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 -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 EvConnectorType { + UNKNOWN = 0, + IEC_TYPE_1_AC = 1, + IEC_TYPE_2_AC = 2, + IEC_TYPE_3_AC = 3, + IEC_TYPE_4_DC = 4, + IEC_TYPE_1_CCS_DC = 5, + IEC_TYPE_2_CCS_DC = 6, + TESLA_ROADSTER = 7, + TESLA_HPWC = 8, + TESLA_SUPERCHARGER = 9, + GBT_AC = 10, + GBT_DC = 11, + OTHER = 101, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b8695623fb5a74bd5b29687810a343b54f472314 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.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 -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 EvRegenerativeBrakingState { + UNKNOWN = 0, + DISABLED = 1, + PARTIALLY_ENABLED = 2, + FULLY_ENABLED = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2fdb9b5a8dc9b6786d355beb966e09ff55de8466 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 EvsServiceRequestIndex { + TYPE = 0, + STATE = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df81ee7d27c5b461ac32abe09cd9971ee9c6f0e1 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceState.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 EvsServiceState { + OFF = 0, + ON = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1363a64cca3b42ec1aff722d8931fc9e40d9c347 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceType.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 EvsServiceType { + REARVIEW = 0, + SURROUNDVIEW = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/FuelType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/FuelType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14bb61b7af9ab50f6935ab376a806c4bfec5e433 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/FuelType.aidl @@ -0,0 +1,50 @@ +/* + * 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 -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 FuelType { + FUEL_TYPE_UNKNOWN = 0, + FUEL_TYPE_UNLEADED = 1, + FUEL_TYPE_LEADED = 2, + FUEL_TYPE_DIESEL_1 = 3, + FUEL_TYPE_DIESEL_2 = 4, + FUEL_TYPE_BIODIESEL = 5, + FUEL_TYPE_E85 = 6, + FUEL_TYPE_LPG = 7, + FUEL_TYPE_CNG = 8, + FUEL_TYPE_LNG = 9, + FUEL_TYPE_ELECTRIC = 10, + FUEL_TYPE_HYDROGEN = 11, + FUEL_TYPE_OTHER = 12, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d88cd8b076cb7aa8966b3ea8e1b3abb318dc3660 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueRequest { + long requestId; + android.hardware.automotive.vehicle.VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueRequests.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueRequests.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a7df2ff24d793f86f408765b35015893cf00ff05 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueRequests.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueRequests { + android.hardware.automotive.vehicle.GetValueRequest[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..25f357586293c5c7a859c94adb74b57499c68958 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueResult { + long requestId; + android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; + @nullable android.hardware.automotive.vehicle.VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueResults.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueResults.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4c365b10741d68d2e9eada47dd58ab43ee172b20 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/GetValueResults.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueResults { + android.hardware.automotive.vehicle.GetValueResult[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/IVehicle.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/IVehicle.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b5f62aa3bf5c7630fd755441a35bcbb0efca6a62 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/IVehicle.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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; +@VintfStability +interface IVehicle { + android.hardware.automotive.vehicle.VehiclePropConfigs getAllPropConfigs(); + android.hardware.automotive.vehicle.VehiclePropConfigs getPropConfigs(in int[] props); + void getValues(android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.GetValueRequests requests); + void setValues(android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.SetValueRequests requests); + void subscribe(in android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.SubscribeOptions[] options, int maxSharedMemoryFileCount); + void unsubscribe(in android.hardware.automotive.vehicle.IVehicleCallback callback, in int[] propIds); + void returnSharedMemory(in android.hardware.automotive.vehicle.IVehicleCallback callback, long sharedMemoryId); + const long INVALID_MEMORY_ID = 0; + const int MAX_SHARED_MEMORY_FILES_PER_CLIENT = 3; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/IVehicleCallback.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/IVehicleCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c5a333ddefd39ed3bf03892da986d12dba53eec --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/IVehicleCallback.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 -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; +@VintfStability +interface IVehicleCallback { + oneway void onGetValues(in android.hardware.automotive.vehicle.GetValueResults responses); + oneway void onSetValues(in android.hardware.automotive.vehicle.SetValueResults responses); + oneway void onPropertyEvent(in android.hardware.automotive.vehicle.VehiclePropValues propValues, int sharedMemoryFileCount); + oneway void onPropertySetError(in android.hardware.automotive.vehicle.VehiclePropErrors errors); +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a4c048aadb53ae54203689c33472ab86a32e6429 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable InitialUserInfoRequest { + int requestId; + android.hardware.automotive.vehicle.InitialUserInfoRequestType requestType = android.hardware.automotive.vehicle.InitialUserInfoRequestType.UNKNOWN; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..51260fa7b086855fd399e5de8ede6cb3fd3dd076 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 InitialUserInfoRequestType { + UNKNOWN = 0, + FIRST_BOOT = 1, + FIRST_BOOT_AFTER_OTA = 2, + COLD_BOOT = 3, + RESUME = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f0e161261d819e1fb27e1ad5784add0ec9682520 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable InitialUserInfoResponse { + int requestId; + android.hardware.automotive.vehicle.InitialUserInfoResponseAction action = android.hardware.automotive.vehicle.InitialUserInfoResponseAction.DEFAULT; + android.hardware.automotive.vehicle.UserInfo userToSwitchOrCreate; + @utf8InCpp String userLocales; + @utf8InCpp String userNameToCreate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d654b5c23e9297a3956146c17ec1dc4ea8f6e50d --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 InitialUserInfoResponseAction { + DEFAULT = 0, + SWITCH = 1, + CREATE = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..73d4a143b7e904569792e1adb27ad596f4ba3ec9 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 Obd2CommonIgnitionMonitors { + COMPONENTS_AVAILABLE = 1, + COMPONENTS_INCOMPLETE = 2, + FUEL_SYSTEM_AVAILABLE = 4, + FUEL_SYSTEM_INCOMPLETE = 8, + MISFIRE_AVAILABLE = 16, + MISFIRE_INCOMPLETE = 32, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..01104c1baf973cb675c3ee7511a9d6e4d4693c47 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl @@ -0,0 +1,55 @@ +/* + * 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 -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 Obd2CompressionIgnitionMonitors { + COMPONENTS_AVAILABLE = 1, + COMPONENTS_INCOMPLETE = 2, + FUEL_SYSTEM_AVAILABLE = 4, + FUEL_SYSTEM_INCOMPLETE = 8, + MISFIRE_AVAILABLE = 16, + MISFIRE_INCOMPLETE = 32, + EGR_OR_VVT_AVAILABLE = 64, + EGR_OR_VVT_INCOMPLETE = 128, + PM_FILTER_AVAILABLE = 256, + PM_FILTER_INCOMPLETE = 512, + EXHAUST_GAS_SENSOR_AVAILABLE = 1024, + EXHAUST_GAS_SENSOR_INCOMPLETE = 2048, + BOOST_PRESSURE_AVAILABLE = 4096, + BOOST_PRESSURE_INCOMPLETE = 8192, + NOx_SCR_AVAILABLE = 16384, + NOx_SCR_INCOMPLETE = 32768, + NMHC_CATALYST_AVAILABLE = 65536, + NMHC_CATALYST_INCOMPLETE = 131072, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9d588ead1c73b6355b84507a0a40a7320783d5ff --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 Obd2FuelSystemStatus { + OPEN_INSUFFICIENT_ENGINE_TEMPERATURE = 1, + CLOSED_LOOP = 2, + OPEN_ENGINE_LOAD_OR_DECELERATION = 4, + OPEN_SYSTEM_FAILURE = 8, + CLOSED_LOOP_BUT_FEEDBACK_FAULT = 16, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3ab3920d04e6a1f63f59ac971d79949bf76bb0f6 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl @@ -0,0 +1,61 @@ +/* + * 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 -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 Obd2FuelType { + NOT_AVAILABLE = 0, + GASOLINE = 1, + METHANOL = 2, + ETHANOL = 3, + DIESEL = 4, + LPG = 5, + CNG = 6, + PROPANE = 7, + ELECTRIC = 8, + BIFUEL_RUNNING_GASOLINE = 9, + BIFUEL_RUNNING_METHANOL = 10, + BIFUEL_RUNNING_ETHANOL = 11, + BIFUEL_RUNNING_LPG = 12, + BIFUEL_RUNNING_CNG = 13, + BIFUEL_RUNNING_PROPANE = 14, + BIFUEL_RUNNING_ELECTRIC = 15, + BIFUEL_RUNNING_ELECTRIC_AND_COMBUSTION = 16, + HYBRID_GASOLINE = 17, + HYBRID_ETHANOL = 18, + HYBRID_DIESEL = 19, + HYBRID_ELECTRIC = 20, + HYBRID_RUNNING_ELECTRIC_AND_COMBUSTION = 21, + HYBRID_REGENERATIVE = 22, + BIFUEL_RUNNING_DIESEL = 23, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec8f1c2e57da0b6b5b3c42e60b21c1dede4a677a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 Obd2IgnitionMonitorKind { + SPARK = 0, + COMPRESSION = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7f445bf564cd1aac18ce92dca73a3542829fd1bd --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.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 -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 Obd2SecondaryAirStatus { + UPSTREAM = 1, + DOWNSTREAM_OF_CATALYCIC_CONVERTER = 2, + FROM_OUTSIDE_OR_OFF = 4, + PUMP_ON_FOR_DIAGNOSTICS = 8, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..badc29c454caebc4708f32297314b0f62dd2d7ed --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl @@ -0,0 +1,59 @@ +/* + * 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 -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 Obd2SparkIgnitionMonitors { + COMPONENTS_AVAILABLE = 1, + COMPONENTS_INCOMPLETE = 2, + FUEL_SYSTEM_AVAILABLE = 4, + FUEL_SYSTEM_INCOMPLETE = 8, + MISFIRE_AVAILABLE = 16, + MISFIRE_INCOMPLETE = 32, + EGR_AVAILABLE = 64, + EGR_INCOMPLETE = 128, + OXYGEN_SENSOR_HEATER_AVAILABLE = 256, + OXYGEN_SENSOR_HEATER_INCOMPLETE = 512, + OXYGEN_SENSOR_AVAILABLE = 1024, + OXYGEN_SENSOR_INCOMPLETE = 2048, + AC_REFRIGERANT_AVAILABLE = 4096, + AC_REFRIGERANT_INCOMPLETE = 8192, + SECONDARY_AIR_SYSTEM_AVAILABLE = 16384, + SECONDARY_AIR_SYSTEM_INCOMPLETE = 32768, + EVAPORATIVE_SYSTEM_AVAILABLE = 65536, + EVAPORATIVE_SYSTEM_INCOMPLETE = 131072, + HEATED_CATALYST_AVAILABLE = 262144, + HEATED_CATALYST_INCOMPLETE = 524288, + CATALYST_AVAILABLE = 1048576, + CATALYST_INCOMPLETE = 2097152, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/PortLocationType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/PortLocationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b831c7ebd9e3bad39b3ae8dd5a286b5e306f6a22 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/PortLocationType.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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 PortLocationType { + UNKNOWN = 0, + FRONT_LEFT = 1, + FRONT_RIGHT = 2, + REAR_RIGHT = 3, + REAR_LEFT = 4, + FRONT = 5, + REAR = 6, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2838ad818d34a134a961ddcfeca3a01475bd37b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 ProcessTerminationReason { + NOT_RESPONDING = 1, + IO_OVERUSE = 2, + MEMORY_OVERUSE = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RawPropValues.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e7b0a137cfc384484c62f4b7effe508a2986a952 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RawPropValues { + int[] int32Values = {}; + float[] floatValues; + long[] int64Values; + byte[] byteValues; + @utf8InCpp String stringValue; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..74457b9ab7fb3474134927dc93ef1df507cd831b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RemoveUserRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo removedUserInfo; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RotaryInputType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RotaryInputType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ff900347113f11d6c944efc636c4a624bed86db0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RotaryInputType.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 RotaryInputType { + ROTARY_INPUT_TYPE_SYSTEM_NAVIGATION = 0, + ROTARY_INPUT_TYPE_AUDIO_VOLUME = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6a65307f3cc448dd17f52fea9d7851ed8476bc66 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueRequest { + long requestId; + android.hardware.automotive.vehicle.VehiclePropValue value; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueRequests.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueRequests.aidl new file mode 100644 index 0000000000000000000000000000000000000000..15fd7ea8a8b5975710630c962e0fa3406af0e363 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueRequests.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueRequests { + android.hardware.automotive.vehicle.SetValueRequest[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec5fabb0b4280d1542be473ebdef445497446ed4 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueResult { + long requestId; + android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueResults.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueResults.aidl new file mode 100644 index 0000000000000000000000000000000000000000..47f16563ce555a0dc64236c50482c387b529ecee --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SetValueResults.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueResults { + android.hardware.automotive.vehicle.SetValueResult[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/StatusCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9b724126af9a60a23f61907e9d9306bb6038fce4 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/StatusCode.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 StatusCode { + OK = 0, + TRY_AGAIN = 1, + INVALID_ARG = 2, + NOT_AVAILABLE = 3, + ACCESS_DENIED = 4, + INTERNAL_ERROR = 5, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SubscribeOptions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91e7c1499a54a87e5af10f5e08b04e3f113ebed9 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SubscribeOptions { + int propId; + int[] areaIds; + float sampleRate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a3e59f128d089446b83543b41e02b866858af719 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 SwitchUserMessageType { + UNKNOWN = 0, + LEGACY_ANDROID_SWITCH = 1, + ANDROID_SWITCH = 2, + VEHICLE_RESPONSE = 3, + VEHICLE_REQUEST = 4, + ANDROID_POST_SWITCH = 5, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3012b7a51de879ea50577d432c9058391224b319 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SwitchUserRequest { + int requestId; + android.hardware.automotive.vehicle.SwitchUserMessageType messageType = android.hardware.automotive.vehicle.SwitchUserMessageType.UNKNOWN; + android.hardware.automotive.vehicle.UserInfo targetUser; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8915d1b86693d5f619b0e3795a20fad3e6e3c917 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserResponse.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SwitchUserResponse { + int requestId; + android.hardware.automotive.vehicle.SwitchUserMessageType messageType = android.hardware.automotive.vehicle.SwitchUserMessageType.UNKNOWN; + android.hardware.automotive.vehicle.SwitchUserStatus status = android.hardware.automotive.vehicle.SwitchUserStatus.SUCCESS; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c7be9ec949c7a59a385f9e72faa4ee3bbfe1c130 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 SwitchUserStatus { + SUCCESS = 1, + FAILURE = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/TrailerState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2491340acd4062fa4136c3b1565a86345f33718d --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/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 -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/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a540f8ead8a3cdc4cde62576e17bb72829cb1d73 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationAssociation { + android.hardware.automotive.vehicle.UserIdentificationAssociationType type = android.hardware.automotive.vehicle.UserIdentificationAssociationType.INVALID; + android.hardware.automotive.vehicle.UserIdentificationAssociationValue value = android.hardware.automotive.vehicle.UserIdentificationAssociationValue.UNKNOWN; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1fd9ee8c315b0d594e847aacadbc5995d4c09a2c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.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 -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 UserIdentificationAssociationSetValue { + INVALID = 0, + ASSOCIATE_CURRENT_USER = 1, + DISASSOCIATE_CURRENT_USER = 2, + DISASSOCIATE_ALL_USERS = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6498375b0f3e0ac113790426741383026b2f14b1 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 UserIdentificationAssociationType { + INVALID = 0, + KEY_FOB = 1, + CUSTOM_1 = 101, + CUSTOM_2 = 102, + CUSTOM_3 = 103, + CUSTOM_4 = 104, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d5e01691fa57b947440b3715380857551b993066 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.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 -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 UserIdentificationAssociationValue { + UNKNOWN = 1, + ASSOCIATED_CURRENT_USER = 2, + ASSOCIATED_ANOTHER_USER = 3, + NOT_ASSOCIATED_ANY_USER = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fe7fd6f6bc3e665ad877a78495a88eeabb9788e5 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationGetRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo userInfo; + int numberAssociationTypes; + android.hardware.automotive.vehicle.UserIdentificationAssociationType[] associationTypes; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3e2a2579cc9286be6575a267e013942e16820e40 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationResponse.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationResponse { + int requestId; + int numberAssociation; + android.hardware.automotive.vehicle.UserIdentificationAssociation[] associations; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57840fb77c09c2c32e65e3bc9f089dea18440f96 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationSetAssociation { + android.hardware.automotive.vehicle.UserIdentificationAssociationType type = android.hardware.automotive.vehicle.UserIdentificationAssociationType.INVALID; + android.hardware.automotive.vehicle.UserIdentificationAssociationSetValue value = android.hardware.automotive.vehicle.UserIdentificationAssociationSetValue.INVALID; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..db01b515a8ba008072b78df371b2c95c4096cbb4 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationSetRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo userInfo; + int numberAssociations; + android.hardware.automotive.vehicle.UserIdentificationSetAssociation[] associations; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f47d5e74bbba257c5eb1dc0ae20c2cb22b00ffce --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserInfo { + int userId = 0; + int flags; + const int USER_FLAG_SYSTEM = 1; + const int USER_FLAG_GUEST = 2; + const int USER_FLAG_EPHEMERAL = 4; + const int USER_FLAG_ADMIN = 8; + const int USER_FLAG_DISABLED = 16; + const int USER_FLAG_PROFILE = 32; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UsersInfo.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UsersInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..edcef2edfd57207de4e1ed4d1fff3653d3d701a6 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UsersInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UsersInfo { + android.hardware.automotive.vehicle.UserInfo currentUser; + int numberUsers; + android.hardware.automotive.vehicle.UserInfo[] existingUsers; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d7b874a0be02effc63175e24b0ba443048f16842 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleApPowerStateConfigFlag { + ENABLE_DEEP_SLEEP_FLAG = 1, + CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 2, + ENABLE_HIBERNATION_FLAG = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc669ec17c46245401b1d8803f1754767bea2c3b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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 VehicleApPowerStateReport { + WAIT_FOR_VHAL = 1, + DEEP_SLEEP_ENTRY = 2, + DEEP_SLEEP_EXIT = 3, + SHUTDOWN_POSTPONE = 4, + SHUTDOWN_START = 5, + ON = 6, + SHUTDOWN_PREPARE = 7, + SHUTDOWN_CANCELLED = 8, + HIBERNATION_ENTRY = 9, + HIBERNATION_EXIT = 10, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b94d3159869fa04a41a565ed6764bd9b40e3c1a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.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 -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 VehicleApPowerStateReq { + ON = 0, + SHUTDOWN_PREPARE = 1, + CANCEL_SHUTDOWN = 2, + FINISHED = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f995c73ee535885802b07185261e97b510e52f2b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VehicleApPowerStateReqIndex { + STATE = 0, + ADDITIONAL = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3fde1c7869bc048ebf2cbc55bf36464e9e9ba794 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 VehicleApPowerStateShutdownParam { + SHUTDOWN_IMMEDIATELY = 1, + CAN_SLEEP = 2, + SHUTDOWN_ONLY = 3, + SLEEP_IMMEDIATELY = 4, + HIBERNATE_IMMEDIATELY = 5, + CAN_HIBERNATE = 6, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleArea.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f8b917256890d52a0ec3ceefd5ef174a57beb25 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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 VehicleArea { + GLOBAL = 16777216, + WINDOW = 50331648, + MIRROR = 67108864, + SEAT = 83886080, + DOOR = 100663296, + WHEEL = 117440512, + MASK = 251658240, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b93a11b60f04c64a0a0f126edf5f40ec03a37601 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehicleAreaConfig { + int areaId; + int minInt32Value; + int maxInt32Value; + long minInt64Value; + long maxInt64Value; + float minFloatValue; + float maxFloatValue; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..11139f9a3aae0ec0ace8e1683d17b3e717c48fa6 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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 VehicleAreaDoor { + ROW_1_LEFT = 1, + ROW_1_RIGHT = 4, + ROW_2_LEFT = 16, + ROW_2_RIGHT = 64, + ROW_3_LEFT = 256, + ROW_3_RIGHT = 1024, + HOOD = 268435456, + REAR = 536870912, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c1e2fbd6ff9503ad8036d2a755707a70b731113c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleAreaMirror { + DRIVER_LEFT = 1, + DRIVER_RIGHT = 2, + DRIVER_CENTER = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e76de324d32380682a3d8c2f1521eba9a22e77f5 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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 VehicleAreaSeat { + ROW_1_LEFT = 1, + ROW_1_CENTER = 2, + ROW_1_RIGHT = 4, + ROW_2_LEFT = 16, + ROW_2_CENTER = 32, + ROW_2_RIGHT = 64, + ROW_3_LEFT = 256, + ROW_3_CENTER = 512, + ROW_3_RIGHT = 1024, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9e834340b1e57f6ab317e135f964b662658288c3 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VehicleAreaWheel { + UNKNOWN = 0, + LEFT_FRONT = 1, + RIGHT_FRONT = 2, + LEFT_REAR = 4, + RIGHT_REAR = 8, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6ec26fe26103ab9af4924fb63fb02ae1fd6d3b0a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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 VehicleAreaWindow { + FRONT_WINDSHIELD = 1, + REAR_WINDSHIELD = 2, + ROW_1_LEFT = 16, + ROW_1_RIGHT = 64, + ROW_2_LEFT = 256, + ROW_2_RIGHT = 1024, + ROW_3_LEFT = 4096, + ROW_3_RIGHT = 16384, + ROOF_TOP_1 = 65536, + ROOF_TOP_2 = 131072, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5aeafa4676e3c9627abe9bfec7bcf4fd3038b01c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VehicleDisplay { + MAIN = 0, + INSTRUMENT_CLUSTER = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleGear.aidl new file mode 100644 index 0000000000000000000000000000000000000000..db4760d7a3fbba4029e087664f4ebe685e4f70d8 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleGear.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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 VehicleGear { + GEAR_UNKNOWN = 0, + GEAR_NEUTRAL = 1, + GEAR_REVERSE = 2, + GEAR_PARK = 4, + GEAR_DRIVE = 8, + GEAR_1 = 16, + GEAR_2 = 32, + GEAR_3 = 64, + GEAR_4 = 128, + GEAR_5 = 256, + GEAR_6 = 512, + GEAR_7 = 1024, + GEAR_8 = 2048, + GEAR_9 = 4096, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a85751f94f3e8c0dbac17c42f76eac0a8cdbaea2 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 VehicleHvacFanDirection { + UNKNOWN = 0, + FACE = 1, + FLOOR = 2, + FACE_AND_FLOOR = 3, + DEFROST = 4, + DEFROST_AND_FLOOR = 6, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c4ac002067cd031d2fca3919b844adf147a7f68f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VehicleHwKeyInputAction { + ACTION_DOWN = 0, + ACTION_UP = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..09d5423edc409a342d4c3be2fa095b6c32771968 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 VehicleIgnitionState { + UNDEFINED = 0, + LOCK = 1, + OFF = 2, + ACC = 3, + ON = 4, + START = 5, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d5698514075d32f34e511275671a779828098283 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleLightState { + OFF = 0, + ON = 1, + DAYTIME_RUNNING = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0d3c636b16a239975e55a4b78acfc6b6092ea865 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightSwitch.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 -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 VehicleLightSwitch { + OFF = 0, + ON = 1, + DAYTIME_RUNNING = 2, + AUTOMATIC = 256, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2eb5aa9134a4069ea4bca311201a33408833267 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VehicleOilLevel { + CRITICALLY_LOW = 0, + LOW = 1, + NORMAL = 2, + HIGH = 3, + ERROR = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8602d2d03d8d72e799d52d18251e2fb9e78f8c81 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropConfig { + int prop; + android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE; + android.hardware.automotive.vehicle.VehiclePropertyChangeMode changeMode = android.hardware.automotive.vehicle.VehiclePropertyChangeMode.STATIC; + android.hardware.automotive.vehicle.VehicleAreaConfig[] areaConfigs; + int[] configArray; + @utf8InCpp String configString; + float minSampleRate; + float maxSampleRate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..04c8006983c348a7cedcd49fee944b356e74b9f0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropConfigs { + android.hardware.automotive.vehicle.VehiclePropConfig[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..983529542f2667019c1b1b686957d9ad3645e10e --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropError { + int propId; + int areaId; + android.hardware.automotive.vehicle.StatusCode errorCode = android.hardware.automotive.vehicle.StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropErrors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropErrors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9dcb10bc9e7ba2af846ee1729404776a3e338d4e --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropErrors.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropErrors { + android.hardware.automotive.vehicle.VehiclePropError[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c87379fd9bc02998a6654c6a20597c23b39403c9 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropValue { + long timestamp; + int areaId; + int prop; + android.hardware.automotive.vehicle.VehiclePropertyStatus status = android.hardware.automotive.vehicle.VehiclePropertyStatus.AVAILABLE; + android.hardware.automotive.vehicle.RawPropValues value; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropValues.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e09a6b95df9c4f731ab0dd4622784cbe9fbc0f1a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropValues.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropValues { + android.hardware.automotive.vehicle.VehiclePropValue[] payloads; + long sharedMemoryId; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleProperty.aidl new file mode 100644 index 0000000000000000000000000000000000000000..04f8fa3b80b7e865b200efd13919ec4e06729f11 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -0,0 +1,209 @@ +/* + * 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 -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 VehicleProperty { + INVALID = 0, + INFO_VIN = 286261504, + INFO_MAKE = 286261505, + INFO_MODEL = 286261506, + INFO_MODEL_YEAR = 289407235, + INFO_FUEL_CAPACITY = 291504388, + INFO_FUEL_TYPE = 289472773, + INFO_EV_BATTERY_CAPACITY = 291504390, + INFO_EV_CONNECTOR_TYPE = 289472775, + INFO_FUEL_DOOR_LOCATION = 289407240, + INFO_EV_PORT_LOCATION = 289407241, + INFO_DRIVER_SEAT = 356516106, + INFO_EXTERIOR_DIMENSIONS = 289472779, + INFO_MULTI_EV_PORT_LOCATIONS = 289472780, + PERF_ODOMETER = 291504644, + PERF_VEHICLE_SPEED = 291504647, + PERF_VEHICLE_SPEED_DISPLAY = 291504648, + PERF_STEERING_ANGLE = 291504649, + PERF_REAR_STEERING_ANGLE = 291504656, + ENGINE_COOLANT_TEMP = 291504897, + ENGINE_OIL_LEVEL = 289407747, + ENGINE_OIL_TEMP = 291504900, + ENGINE_RPM = 291504901, + WHEEL_TICK = 290521862, + FUEL_LEVEL = 291504903, + FUEL_DOOR_OPEN = 287310600, + EV_BATTERY_LEVEL = 291504905, + EV_CHARGE_PORT_OPEN = 287310602, + EV_CHARGE_PORT_CONNECTED = 287310603, + EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 291504908, + RANGE_REMAINING = 291504904, + TIRE_PRESSURE = 392168201, + CRITICALLY_LOW_TIRE_PRESSURE = 392168202, + GEAR_SELECTION = 289408000, + CURRENT_GEAR = 289408001, + PARKING_BRAKE_ON = 287310850, + PARKING_BRAKE_AUTO_APPLY = 287310851, + FUEL_LEVEL_LOW = 287310853, + NIGHT_MODE = 287310855, + TURN_SIGNAL_STATE = 289408008, + IGNITION_STATE = 289408009, + ABS_ACTIVE = 287310858, + TRACTION_CONTROL_ACTIVE = 287310859, + HVAC_FAN_SPEED = 356517120, + HVAC_FAN_DIRECTION = 356517121, + HVAC_TEMPERATURE_CURRENT = 358614274, + HVAC_TEMPERATURE_SET = 358614275, + HVAC_DEFROSTER = 320865540, + HVAC_AC_ON = 354419973, + HVAC_MAX_AC_ON = 354419974, + HVAC_MAX_DEFROST_ON = 354419975, + HVAC_RECIRC_ON = 354419976, + HVAC_DUAL_ON = 354419977, + HVAC_AUTO_ON = 354419978, + HVAC_SEAT_TEMPERATURE = 356517131, + HVAC_SIDE_MIRROR_HEAT = 339739916, + HVAC_STEERING_WHEEL_HEAT = 289408269, + HVAC_TEMPERATURE_DISPLAY_UNITS = 289408270, + HVAC_ACTUAL_FAN_SPEED_RPM = 356517135, + HVAC_POWER_ON = 354419984, + HVAC_FAN_DIRECTION_AVAILABLE = 356582673, + HVAC_AUTO_RECIRC_ON = 354419986, + HVAC_SEAT_VENTILATION = 356517139, + HVAC_ELECTRIC_DEFROSTER_ON = 320865556, + HVAC_TEMPERATURE_VALUE_SUGGESTION = 291570965, + DISTANCE_DISPLAY_UNITS = 289408512, + FUEL_VOLUME_DISPLAY_UNITS = 289408513, + TIRE_PRESSURE_DISPLAY_UNITS = 289408514, + EV_BATTERY_DISPLAY_UNITS = 289408515, + FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = 287311364, + VEHICLE_SPEED_DISPLAY_UNITS = 289408517, + EXTERNAL_CAR_TIME = 290457096, + ANDROID_EPOCH_TIME = 290457094, + STORAGE_ENCRYPTION_BINDING_SEED = 292554247, + ENV_OUTSIDE_TEMPERATURE = 291505923, + AP_POWER_STATE_REQ = 289475072, + AP_POWER_STATE_REPORT = 289475073, + AP_POWER_BOOTUP_REASON = 289409538, + DISPLAY_BRIGHTNESS = 289409539, + HW_KEY_INPUT = 289475088, + HW_ROTARY_INPUT = 289475104, + HW_CUSTOM_INPUT = 289475120, + DOOR_POS = 373295872, + DOOR_MOVE = 373295873, + DOOR_LOCK = 371198722, + MIRROR_Z_POS = 339741504, + MIRROR_Z_MOVE = 339741505, + MIRROR_Y_POS = 339741506, + MIRROR_Y_MOVE = 339741507, + MIRROR_LOCK = 287312708, + MIRROR_FOLD = 287312709, + SEAT_MEMORY_SELECT = 356518784, + SEAT_MEMORY_SET = 356518785, + SEAT_BELT_BUCKLED = 354421634, + SEAT_BELT_HEIGHT_POS = 356518787, + SEAT_BELT_HEIGHT_MOVE = 356518788, + SEAT_FORE_AFT_POS = 356518789, + SEAT_FORE_AFT_MOVE = 356518790, + SEAT_BACKREST_ANGLE_1_POS = 356518791, + SEAT_BACKREST_ANGLE_1_MOVE = 356518792, + SEAT_BACKREST_ANGLE_2_POS = 356518793, + SEAT_BACKREST_ANGLE_2_MOVE = 356518794, + SEAT_HEIGHT_POS = 356518795, + SEAT_HEIGHT_MOVE = 356518796, + SEAT_DEPTH_POS = 356518797, + SEAT_DEPTH_MOVE = 356518798, + SEAT_TILT_POS = 356518799, + SEAT_TILT_MOVE = 356518800, + SEAT_LUMBAR_FORE_AFT_POS = 356518801, + SEAT_LUMBAR_FORE_AFT_MOVE = 356518802, + SEAT_LUMBAR_SIDE_SUPPORT_POS = 356518803, + SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 356518804, + SEAT_HEADREST_HEIGHT_POS = 289409941, + SEAT_HEADREST_HEIGHT_MOVE = 356518806, + SEAT_HEADREST_ANGLE_POS = 356518807, + SEAT_HEADREST_ANGLE_MOVE = 356518808, + SEAT_HEADREST_FORE_AFT_POS = 356518809, + SEAT_HEADREST_FORE_AFT_MOVE = 356518810, + SEAT_OCCUPANCY = 356518832, + WINDOW_POS = 322964416, + WINDOW_MOVE = 322964417, + WINDOW_LOCK = 320867268, + VEHICLE_MAP_SERVICE = 299895808, + OBD2_LIVE_FRAME = 299896064, + OBD2_FREEZE_FRAME = 299896065, + OBD2_FREEZE_FRAME_INFO = 299896066, + OBD2_FREEZE_FRAME_CLEAR = 299896067, + HEADLIGHTS_STATE = 289410560, + HIGH_BEAM_LIGHTS_STATE = 289410561, + FOG_LIGHTS_STATE = 289410562, + HAZARD_LIGHTS_STATE = 289410563, + HEADLIGHTS_SWITCH = 289410576, + HIGH_BEAM_LIGHTS_SWITCH = 289410577, + FOG_LIGHTS_SWITCH = 289410578, + HAZARD_LIGHTS_SWITCH = 289410579, + CABIN_LIGHTS_STATE = 289410817, + CABIN_LIGHTS_SWITCH = 289410818, + READING_LIGHTS_STATE = 356519683, + READING_LIGHTS_SWITCH = 356519684, + SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 287313669, + DISABLED_OPTIONAL_FEATURES = 286265094, + INITIAL_USER_INFO = 299896583, + SWITCH_USER = 299896584, + CREATE_USER = 299896585, + REMOVE_USER = 299896586, + USER_IDENTIFICATION_ASSOCIATION = 299896587, + EVS_SERVICE_REQUEST = 289476368, + POWER_POLICY_REQ = 286265121, + POWER_POLICY_GROUP_REQ = 286265122, + CURRENT_POWER_POLICY = 286265123, + WATCHDOG_ALIVE = 290459441, + WATCHDOG_TERMINATED_PROCESS = 299896626, + VHAL_HEARTBEAT = 290459443, + CLUSTER_SWITCH_UI = 289410868, + CLUSTER_DISPLAY_STATE = 289476405, + CLUSTER_REPORT_STATE = 299896630, + CLUSTER_REQUEST_DISPLAY = 289410871, + CLUSTER_NAVIGATION_STATE = 292556600, + ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = 289410873, + ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = 289410874, + FRONT_FOG_LIGHTS_STATE = 289410875, + FRONT_FOG_LIGHTS_SWITCH = 289410876, + REAR_FOG_LIGHTS_STATE = 289410877, + REAR_FOG_LIGHTS_SWITCH = 289410878, + EV_CHARGE_CURRENT_DRAW_LIMIT = 291508031, + EV_CHARGE_PERCENT_LIMIT = 291508032, + EV_CHARGE_STATE = 289410881, + EV_CHARGE_SWITCH = 287313730, + EV_CHARGE_TIME_REMAINING = 289410883, + EV_REGENERATIVE_BRAKING_STATE = 289410884, + TRAILER_PRESENT = 289410885, + VEHICLE_CURB_WEIGHT = 289410886, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec9587f60c33331d64660ebafb10f71462b9f394 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyAccess.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 -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 VehiclePropertyAccess { + NONE = 0, + READ = 1, + WRITE = 2, + READ_WRITE = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5455fdd5ca105e19241cd68b73b419544527ed29 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehiclePropertyChangeMode { + STATIC = 0, + ON_CHANGE = 1, + CONTINUOUS = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c049c4814f4947de4bcdfe93cce3a19e0da2cd8 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehiclePropertyGroup { + SYSTEM = 268435456, + VENDOR = 536870912, + MASK = -268435456, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6d0e041ff60e22161d8c0253c7d63f6bb8206811 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehiclePropertyStatus { + AVAILABLE = 0, + UNAVAILABLE = 1, + ERROR = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..da6d2c21686cb23e99b06dfed0e43b3d1a243fd2 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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 VehiclePropertyType { + STRING = 1048576, + BOOLEAN = 2097152, + INT32 = 4194304, + INT32_VEC = 4259840, + INT64 = 5242880, + INT64_VEC = 5308416, + FLOAT = 6291456, + FLOAT_VEC = 6356992, + BYTES = 7340032, + MIXED = 14680064, + MASK = 16711680, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3e870e89258e67362e1dd8d3501568e5630f7558 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleSeatOccupancyState { + UNKNOWN = 0, + VACANT = 1, + OCCUPIED = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl new file mode 100644 index 0000000000000000000000000000000000000000..78c17959b4e36401e612014be4c588bf8e9782fc --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleTurnSignal { + NONE = 0, + RIGHT = 1, + LEFT = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleUnit.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c80fdbbdbedd4f2ccc1041281d5807f46f3b42aa --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleUnit.aidl @@ -0,0 +1,70 @@ +/* + * 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 -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 VehicleUnit { + SHOULD_NOT_USE = 0, + METER_PER_SEC = 1, + RPM = 2, + HERTZ = 3, + PERCENTILE = 16, + MILLIMETER = 32, + METER = 33, + KILOMETER = 35, + MILE = 36, + CELSIUS = 48, + FAHRENHEIT = 49, + KELVIN = 50, + MILLILITER = 64, + LITER = 65, + GALLON = 66, + US_GALLON = 66, + IMPERIAL_GALLON = 67, + NANO_SECS = 80, + SECS = 83, + YEAR = 89, + WATT_HOUR = 96, + MILLIAMPERE = 97, + MILLIVOLT = 98, + MILLIWATTS = 99, + AMPERE_HOURS = 100, + KILOWATT_HOUR = 101, + AMPERE = 102, + KILOPASCAL = 112, + PSI = 113, + BAR = 114, + DEGREES = 128, + MILES_PER_HOUR = 144, + KILOMETERS_PER_HOUR = 145, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl new file mode 100644 index 0000000000000000000000000000000000000000..58524f3c668a0340cf56b38f209616b84adcfc54 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl @@ -0,0 +1,75 @@ +/* + * 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 -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 VehicleVendorPermission { + PERMISSION_DEFAULT = 0, + PERMISSION_SET_VENDOR_CATEGORY_WINDOW = 1, + PERMISSION_GET_VENDOR_CATEGORY_WINDOW = 2, + PERMISSION_SET_VENDOR_CATEGORY_DOOR = 3, + PERMISSION_GET_VENDOR_CATEGORY_DOOR = 4, + PERMISSION_SET_VENDOR_CATEGORY_SEAT = 5, + PERMISSION_GET_VENDOR_CATEGORY_SEAT = 6, + PERMISSION_SET_VENDOR_CATEGORY_MIRROR = 7, + PERMISSION_GET_VENDOR_CATEGORY_MIRROR = 8, + PERMISSION_SET_VENDOR_CATEGORY_INFO = 9, + PERMISSION_GET_VENDOR_CATEGORY_INFO = 10, + PERMISSION_SET_VENDOR_CATEGORY_ENGINE = 11, + PERMISSION_GET_VENDOR_CATEGORY_ENGINE = 12, + PERMISSION_SET_VENDOR_CATEGORY_HVAC = 13, + PERMISSION_GET_VENDOR_CATEGORY_HVAC = 14, + PERMISSION_SET_VENDOR_CATEGORY_LIGHT = 15, + PERMISSION_GET_VENDOR_CATEGORY_LIGHT = 16, + PERMISSION_SET_VENDOR_CATEGORY_1 = 65536, + PERMISSION_GET_VENDOR_CATEGORY_1 = 69632, + PERMISSION_SET_VENDOR_CATEGORY_2 = 131072, + PERMISSION_GET_VENDOR_CATEGORY_2 = 135168, + PERMISSION_SET_VENDOR_CATEGORY_3 = 196608, + PERMISSION_GET_VENDOR_CATEGORY_3 = 200704, + PERMISSION_SET_VENDOR_CATEGORY_4 = 262144, + PERMISSION_GET_VENDOR_CATEGORY_4 = 266240, + PERMISSION_SET_VENDOR_CATEGORY_5 = 327680, + PERMISSION_GET_VENDOR_CATEGORY_5 = 331776, + PERMISSION_SET_VENDOR_CATEGORY_6 = 393216, + PERMISSION_GET_VENDOR_CATEGORY_6 = 397312, + PERMISSION_SET_VENDOR_CATEGORY_7 = 458752, + PERMISSION_GET_VENDOR_CATEGORY_7 = 462848, + PERMISSION_SET_VENDOR_CATEGORY_8 = 524288, + PERMISSION_GET_VENDOR_CATEGORY_8 = 528384, + PERMISSION_SET_VENDOR_CATEGORY_9 = 589824, + PERMISSION_GET_VENDOR_CATEGORY_9 = 593920, + PERMISSION_SET_VENDOR_CATEGORY_10 = 655360, + PERMISSION_GET_VENDOR_CATEGORY_10 = 659456, + PERMISSION_NOT_ACCESSIBLE = -268435456, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0dcfbc4a5dd82f80bea3e7ebb659ec26edc8f25e --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.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 -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 VmsAvailabilityStateIntegerValuesIndex { + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_ASSOCIATED_LAYERS = 2, + LAYERS_START = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..45514d081aca8d8f722870e3175f0102db7ec912 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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 VmsBaseMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1248c069ce2bb6dbb37fd96a040231968bb3ea9f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageType.aidl @@ -0,0 +1,54 @@ +/* + * 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 -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 VmsMessageType { + SUBSCRIBE = 1, + SUBSCRIBE_TO_PUBLISHER = 2, + UNSUBSCRIBE = 3, + UNSUBSCRIBE_TO_PUBLISHER = 4, + OFFERING = 5, + AVAILABILITY_REQUEST = 6, + SUBSCRIPTIONS_REQUEST = 7, + AVAILABILITY_RESPONSE = 8, + AVAILABILITY_CHANGE = 9, + SUBSCRIPTIONS_RESPONSE = 10, + SUBSCRIPTIONS_CHANGE = 11, + DATA = 12, + PUBLISHER_ID_REQUEST = 13, + PUBLISHER_ID_RESPONSE = 14, + PUBLISHER_INFORMATION_REQUEST = 15, + PUBLISHER_INFORMATION_RESPONSE = 16, + START_SESSION = 17, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b0e3a5ef2bdc1d31dc21c3bf6dc628e096b0d77 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VmsMessageWithLayerAndPublisherIdIntegerValuesIndex { + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, + PUBLISHER_ID = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..65dd4ae39556a261192e0fd80098dfe668403cd7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.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 -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 VmsMessageWithLayerIntegerValuesIndex { + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc2a9c18446f8afe247cfc8e89c3f96c8bbadf97 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.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 -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 VmsOfferingMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, + NUMBER_OF_OFFERS = 2, + OFFERING_START = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a9b017fdb10f5679ce36eb90f810135ff3e982a7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VmsPublisherInformationIntegerValuesIndex { + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d942bc8392f29c7d4d761bd8342c6e22a83b39d0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VmsStartSessionMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, + SERVICE_ID = 1, + CLIENT_ID = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..796d7f722c5d88ceced8f78faafb6cfb9adf8d53 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VmsSubscriptionsStateIntegerValuesIndex { + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_LAYERS = 2, + NUMBER_OF_ASSOCIATED_LAYERS = 3, + SUBSCRIPTIONS_START = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..22c690c00f9db5049fa0df236b8c98fcf9961353 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable CreateUserRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo newUserInfo; + @utf8InCpp String newUserName; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7d0196b4e51bda6ec4f474b5ccb2caa263b36cb0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable CreateUserResponse { + int requestId; + android.hardware.automotive.vehicle.CreateUserStatus status = android.hardware.automotive.vehicle.CreateUserStatus.SUCCESS; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4c3b751656d988b220ef7d1d69b91e971738895f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 CreateUserStatus { + SUCCESS = 1, + FAILURE = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CustomInputType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CustomInputType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4decb6985da0df64e4a35f09ec4a3c89e609419b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CustomInputType.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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 CustomInputType { + CUSTOM_EVENT_F1 = 1001, + CUSTOM_EVENT_F2 = 1002, + CUSTOM_EVENT_F3 = 1003, + CUSTOM_EVENT_F4 = 1004, + CUSTOM_EVENT_F5 = 1005, + CUSTOM_EVENT_F6 = 1006, + CUSTOM_EVENT_F7 = 1007, + CUSTOM_EVENT_F8 = 1008, + CUSTOM_EVENT_F9 = 1009, + CUSTOM_EVENT_F10 = 1010, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9704704eab9724340c48ccca628c226f33b9e487 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl @@ -0,0 +1,108 @@ +/* + * 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 -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 DiagnosticFloatSensorIndex { + CALCULATED_ENGINE_LOAD = 0, + ENGINE_COOLANT_TEMPERATURE = 1, + SHORT_TERM_FUEL_TRIM_BANK1 = 2, + LONG_TERM_FUEL_TRIM_BANK1 = 3, + SHORT_TERM_FUEL_TRIM_BANK2 = 4, + LONG_TERM_FUEL_TRIM_BANK2 = 5, + FUEL_PRESSURE = 6, + INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7, + ENGINE_RPM = 8, + VEHICLE_SPEED = 9, + TIMING_ADVANCE = 10, + MAF_AIR_FLOW_RATE = 11, + THROTTLE_POSITION = 12, + OXYGEN_SENSOR1_VOLTAGE = 13, + OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14, + OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15, + OXYGEN_SENSOR2_VOLTAGE = 16, + OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17, + OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18, + OXYGEN_SENSOR3_VOLTAGE = 19, + OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20, + OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21, + OXYGEN_SENSOR4_VOLTAGE = 22, + OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23, + OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24, + OXYGEN_SENSOR5_VOLTAGE = 25, + OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26, + OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27, + OXYGEN_SENSOR6_VOLTAGE = 28, + OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29, + OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30, + OXYGEN_SENSOR7_VOLTAGE = 31, + OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32, + OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33, + OXYGEN_SENSOR8_VOLTAGE = 34, + OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35, + OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36, + FUEL_RAIL_PRESSURE = 37, + FUEL_RAIL_GAUGE_PRESSURE = 38, + COMMANDED_EXHAUST_GAS_RECIRCULATION = 39, + EXHAUST_GAS_RECIRCULATION_ERROR = 40, + COMMANDED_EVAPORATIVE_PURGE = 41, + FUEL_TANK_LEVEL_INPUT = 42, + EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43, + CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44, + CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45, + CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46, + CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47, + ABSOLUTE_LOAD_VALUE = 48, + FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49, + RELATIVE_THROTTLE_POSITION = 50, + ABSOLUTE_THROTTLE_POSITION_B = 51, + ABSOLUTE_THROTTLE_POSITION_C = 52, + ACCELERATOR_PEDAL_POSITION_D = 53, + ACCELERATOR_PEDAL_POSITION_E = 54, + ACCELERATOR_PEDAL_POSITION_F = 55, + COMMANDED_THROTTLE_ACTUATOR = 56, + ETHANOL_FUEL_PERCENTAGE = 57, + ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66, + RELATIVE_ACCELERATOR_PEDAL_POSITION = 67, + HYBRID_BATTERY_PACK_REMAINING_LIFE = 68, + FUEL_INJECTION_TIMING = 69, + ENGINE_FUEL_RATE = 70, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b3f13d426373ed1a0f94fa2e7c90cd64a21f5c71 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl @@ -0,0 +1,69 @@ +/* + * 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 -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 DiagnosticIntegerSensorIndex { + FUEL_SYSTEM_STATUS = 0, + MALFUNCTION_INDICATOR_LIGHT_ON = 1, + IGNITION_MONITORS_SUPPORTED = 2, + IGNITION_SPECIFIC_MONITORS = 3, + INTAKE_AIR_TEMPERATURE = 4, + COMMANDED_SECONDARY_AIR_STATUS = 5, + NUM_OXYGEN_SENSORS_PRESENT = 6, + RUNTIME_SINCE_ENGINE_START = 7, + DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8, + WARMUPS_SINCE_CODES_CLEARED = 9, + DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10, + ABSOLUTE_BAROMETRIC_PRESSURE = 11, + CONTROL_MODULE_VOLTAGE = 12, + AMBIENT_AIR_TEMPERATURE = 13, + TIME_WITH_MALFUNCTION_LIGHT_ON = 14, + TIME_SINCE_TROUBLE_CODES_CLEARED = 15, + MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16, + MAX_OXYGEN_SENSOR_VOLTAGE = 17, + MAX_OXYGEN_SENSOR_CURRENT = 18, + MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19, + MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20, + FUEL_TYPE = 21, + FUEL_RAIL_ABSOLUTE_PRESSURE = 22, + ENGINE_OIL_TEMPERATURE = 23, + DRIVER_DEMAND_PERCENT_TORQUE = 24, + ENGINE_ACTUAL_PERCENT_TORQUE = 25, + ENGINE_REFERENCE_PERCENT_TORQUE = 26, + ENGINE_PERCENT_TORQUE_DATA_IDLE = 27, + ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28, + ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29, + ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30, + ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9772aeeba0442d07e5adeba551fb7e9f0e44ae74 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.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 -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 ElectronicTollCollectionCardStatus { + UNKNOWN = 0, + ELECTRONIC_TOLL_COLLECTION_CARD_VALID = 1, + ELECTRONIC_TOLL_COLLECTION_CARD_INVALID = 2, + ELECTRONIC_TOLL_COLLECTION_CARD_NOT_INSERTED = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..22cf2c388b93bff590ddcade170223753561a72b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 ElectronicTollCollectionCardType { + UNKNOWN = 0, + JP_ELECTRONIC_TOLL_COLLECTION_CARD = 1, + JP_ELECTRONIC_TOLL_COLLECTION_CARD_V2 = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fe1c240a2dcc55b5c448a5d3cc4d85aee00255b7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 EvChargeState { + UNKNOWN = 0, + CHARGING = 1, + FULLY_CHARGED = 2, + NOT_CHARGING = 3, + ERROR = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvConnectorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b469578e7756dfb0344f8272c7a12c0ced4c17b2 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvConnectorType.aidl @@ -0,0 +1,50 @@ +/* + * 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 -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 EvConnectorType { + UNKNOWN = 0, + IEC_TYPE_1_AC = 1, + IEC_TYPE_2_AC = 2, + IEC_TYPE_3_AC = 3, + IEC_TYPE_4_DC = 4, + IEC_TYPE_1_CCS_DC = 5, + IEC_TYPE_2_CCS_DC = 6, + TESLA_ROADSTER = 7, + TESLA_HPWC = 8, + TESLA_SUPERCHARGER = 9, + GBT_AC = 10, + GBT_DC = 11, + OTHER = 101, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b8695623fb5a74bd5b29687810a343b54f472314 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.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 -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 EvRegenerativeBrakingState { + UNKNOWN = 0, + DISABLED = 1, + PARTIALLY_ENABLED = 2, + FULLY_ENABLED = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2fdb9b5a8dc9b6786d355beb966e09ff55de8466 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 EvsServiceRequestIndex { + TYPE = 0, + STATE = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df81ee7d27c5b461ac32abe09cd9971ee9c6f0e1 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceState.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 EvsServiceState { + OFF = 0, + ON = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1363a64cca3b42ec1aff722d8931fc9e40d9c347 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceType.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 EvsServiceType { + REARVIEW = 0, + SURROUNDVIEW = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/FuelType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/FuelType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14bb61b7af9ab50f6935ab376a806c4bfec5e433 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/FuelType.aidl @@ -0,0 +1,50 @@ +/* + * 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 -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 FuelType { + FUEL_TYPE_UNKNOWN = 0, + FUEL_TYPE_UNLEADED = 1, + FUEL_TYPE_LEADED = 2, + FUEL_TYPE_DIESEL_1 = 3, + FUEL_TYPE_DIESEL_2 = 4, + FUEL_TYPE_BIODIESEL = 5, + FUEL_TYPE_E85 = 6, + FUEL_TYPE_LPG = 7, + FUEL_TYPE_CNG = 8, + FUEL_TYPE_LNG = 9, + FUEL_TYPE_ELECTRIC = 10, + FUEL_TYPE_HYDROGEN = 11, + FUEL_TYPE_OTHER = 12, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d88cd8b076cb7aa8966b3ea8e1b3abb318dc3660 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueRequest { + long requestId; + android.hardware.automotive.vehicle.VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequests.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequests.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a7df2ff24d793f86f408765b35015893cf00ff05 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueRequests.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueRequests { + android.hardware.automotive.vehicle.GetValueRequest[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..25f357586293c5c7a859c94adb74b57499c68958 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueResult { + long requestId; + android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; + @nullable android.hardware.automotive.vehicle.VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResults.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResults.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4c365b10741d68d2e9eada47dd58ab43ee172b20 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GetValueResults.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueResults { + android.hardware.automotive.vehicle.GetValueResult[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/IVehicle.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/IVehicle.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b5f62aa3bf5c7630fd755441a35bcbb0efca6a62 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/IVehicle.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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; +@VintfStability +interface IVehicle { + android.hardware.automotive.vehicle.VehiclePropConfigs getAllPropConfigs(); + android.hardware.automotive.vehicle.VehiclePropConfigs getPropConfigs(in int[] props); + void getValues(android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.GetValueRequests requests); + void setValues(android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.SetValueRequests requests); + void subscribe(in android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.SubscribeOptions[] options, int maxSharedMemoryFileCount); + void unsubscribe(in android.hardware.automotive.vehicle.IVehicleCallback callback, in int[] propIds); + void returnSharedMemory(in android.hardware.automotive.vehicle.IVehicleCallback callback, long sharedMemoryId); + const long INVALID_MEMORY_ID = 0; + const int MAX_SHARED_MEMORY_FILES_PER_CLIENT = 3; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/IVehicleCallback.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/IVehicleCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c5a333ddefd39ed3bf03892da986d12dba53eec --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/IVehicleCallback.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 -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; +@VintfStability +interface IVehicleCallback { + oneway void onGetValues(in android.hardware.automotive.vehicle.GetValueResults responses); + oneway void onSetValues(in android.hardware.automotive.vehicle.SetValueResults responses); + oneway void onPropertyEvent(in android.hardware.automotive.vehicle.VehiclePropValues propValues, int sharedMemoryFileCount); + oneway void onPropertySetError(in android.hardware.automotive.vehicle.VehiclePropErrors errors); +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a4c048aadb53ae54203689c33472ab86a32e6429 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable InitialUserInfoRequest { + int requestId; + android.hardware.automotive.vehicle.InitialUserInfoRequestType requestType = android.hardware.automotive.vehicle.InitialUserInfoRequestType.UNKNOWN; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..51260fa7b086855fd399e5de8ede6cb3fd3dd076 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 InitialUserInfoRequestType { + UNKNOWN = 0, + FIRST_BOOT = 1, + FIRST_BOOT_AFTER_OTA = 2, + COLD_BOOT = 3, + RESUME = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f0e161261d819e1fb27e1ad5784add0ec9682520 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable InitialUserInfoResponse { + int requestId; + android.hardware.automotive.vehicle.InitialUserInfoResponseAction action = android.hardware.automotive.vehicle.InitialUserInfoResponseAction.DEFAULT; + android.hardware.automotive.vehicle.UserInfo userToSwitchOrCreate; + @utf8InCpp String userLocales; + @utf8InCpp String userNameToCreate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d654b5c23e9297a3956146c17ec1dc4ea8f6e50d --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 InitialUserInfoResponseAction { + DEFAULT = 0, + SWITCH = 1, + CREATE = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..73d4a143b7e904569792e1adb27ad596f4ba3ec9 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 Obd2CommonIgnitionMonitors { + COMPONENTS_AVAILABLE = 1, + COMPONENTS_INCOMPLETE = 2, + FUEL_SYSTEM_AVAILABLE = 4, + FUEL_SYSTEM_INCOMPLETE = 8, + MISFIRE_AVAILABLE = 16, + MISFIRE_INCOMPLETE = 32, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..01104c1baf973cb675c3ee7511a9d6e4d4693c47 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl @@ -0,0 +1,55 @@ +/* + * 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 -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 Obd2CompressionIgnitionMonitors { + COMPONENTS_AVAILABLE = 1, + COMPONENTS_INCOMPLETE = 2, + FUEL_SYSTEM_AVAILABLE = 4, + FUEL_SYSTEM_INCOMPLETE = 8, + MISFIRE_AVAILABLE = 16, + MISFIRE_INCOMPLETE = 32, + EGR_OR_VVT_AVAILABLE = 64, + EGR_OR_VVT_INCOMPLETE = 128, + PM_FILTER_AVAILABLE = 256, + PM_FILTER_INCOMPLETE = 512, + EXHAUST_GAS_SENSOR_AVAILABLE = 1024, + EXHAUST_GAS_SENSOR_INCOMPLETE = 2048, + BOOST_PRESSURE_AVAILABLE = 4096, + BOOST_PRESSURE_INCOMPLETE = 8192, + NOx_SCR_AVAILABLE = 16384, + NOx_SCR_INCOMPLETE = 32768, + NMHC_CATALYST_AVAILABLE = 65536, + NMHC_CATALYST_INCOMPLETE = 131072, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9d588ead1c73b6355b84507a0a40a7320783d5ff --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 Obd2FuelSystemStatus { + OPEN_INSUFFICIENT_ENGINE_TEMPERATURE = 1, + CLOSED_LOOP = 2, + OPEN_ENGINE_LOAD_OR_DECELERATION = 4, + OPEN_SYSTEM_FAILURE = 8, + CLOSED_LOOP_BUT_FEEDBACK_FAULT = 16, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3ab3920d04e6a1f63f59ac971d79949bf76bb0f6 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl @@ -0,0 +1,61 @@ +/* + * 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 -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 Obd2FuelType { + NOT_AVAILABLE = 0, + GASOLINE = 1, + METHANOL = 2, + ETHANOL = 3, + DIESEL = 4, + LPG = 5, + CNG = 6, + PROPANE = 7, + ELECTRIC = 8, + BIFUEL_RUNNING_GASOLINE = 9, + BIFUEL_RUNNING_METHANOL = 10, + BIFUEL_RUNNING_ETHANOL = 11, + BIFUEL_RUNNING_LPG = 12, + BIFUEL_RUNNING_CNG = 13, + BIFUEL_RUNNING_PROPANE = 14, + BIFUEL_RUNNING_ELECTRIC = 15, + BIFUEL_RUNNING_ELECTRIC_AND_COMBUSTION = 16, + HYBRID_GASOLINE = 17, + HYBRID_ETHANOL = 18, + HYBRID_DIESEL = 19, + HYBRID_ELECTRIC = 20, + HYBRID_RUNNING_ELECTRIC_AND_COMBUSTION = 21, + HYBRID_REGENERATIVE = 22, + BIFUEL_RUNNING_DIESEL = 23, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec8f1c2e57da0b6b5b3c42e60b21c1dede4a677a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 Obd2IgnitionMonitorKind { + SPARK = 0, + COMPRESSION = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7f445bf564cd1aac18ce92dca73a3542829fd1bd --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.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 -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 Obd2SecondaryAirStatus { + UPSTREAM = 1, + DOWNSTREAM_OF_CATALYCIC_CONVERTER = 2, + FROM_OUTSIDE_OR_OFF = 4, + PUMP_ON_FOR_DIAGNOSTICS = 8, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..badc29c454caebc4708f32297314b0f62dd2d7ed --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl @@ -0,0 +1,59 @@ +/* + * 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 -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 Obd2SparkIgnitionMonitors { + COMPONENTS_AVAILABLE = 1, + COMPONENTS_INCOMPLETE = 2, + FUEL_SYSTEM_AVAILABLE = 4, + FUEL_SYSTEM_INCOMPLETE = 8, + MISFIRE_AVAILABLE = 16, + MISFIRE_INCOMPLETE = 32, + EGR_AVAILABLE = 64, + EGR_INCOMPLETE = 128, + OXYGEN_SENSOR_HEATER_AVAILABLE = 256, + OXYGEN_SENSOR_HEATER_INCOMPLETE = 512, + OXYGEN_SENSOR_AVAILABLE = 1024, + OXYGEN_SENSOR_INCOMPLETE = 2048, + AC_REFRIGERANT_AVAILABLE = 4096, + AC_REFRIGERANT_INCOMPLETE = 8192, + SECONDARY_AIR_SYSTEM_AVAILABLE = 16384, + SECONDARY_AIR_SYSTEM_INCOMPLETE = 32768, + EVAPORATIVE_SYSTEM_AVAILABLE = 65536, + EVAPORATIVE_SYSTEM_INCOMPLETE = 131072, + HEATED_CATALYST_AVAILABLE = 262144, + HEATED_CATALYST_INCOMPLETE = 524288, + CATALYST_AVAILABLE = 1048576, + CATALYST_INCOMPLETE = 2097152, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/PortLocationType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/PortLocationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b831c7ebd9e3bad39b3ae8dd5a286b5e306f6a22 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/PortLocationType.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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 PortLocationType { + UNKNOWN = 0, + FRONT_LEFT = 1, + FRONT_RIGHT = 2, + REAR_RIGHT = 3, + REAR_LEFT = 4, + FRONT = 5, + REAR = 6, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2838ad818d34a134a961ddcfeca3a01475bd37b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 ProcessTerminationReason { + NOT_RESPONDING = 1, + IO_OVERUSE = 2, + MEMORY_OVERUSE = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RawPropValues.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e7b0a137cfc384484c62f4b7effe508a2986a952 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RawPropValues { + int[] int32Values = {}; + float[] floatValues; + long[] int64Values; + byte[] byteValues; + @utf8InCpp String stringValue; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..74457b9ab7fb3474134927dc93ef1df507cd831b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RemoveUserRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo removedUserInfo; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RotaryInputType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RotaryInputType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ff900347113f11d6c944efc636c4a624bed86db0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RotaryInputType.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 RotaryInputType { + ROTARY_INPUT_TYPE_SYSTEM_NAVIGATION = 0, + ROTARY_INPUT_TYPE_AUDIO_VOLUME = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6a65307f3cc448dd17f52fea9d7851ed8476bc66 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueRequest { + long requestId; + android.hardware.automotive.vehicle.VehiclePropValue value; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequests.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequests.aidl new file mode 100644 index 0000000000000000000000000000000000000000..15fd7ea8a8b5975710630c962e0fa3406af0e363 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueRequests.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueRequests { + android.hardware.automotive.vehicle.SetValueRequest[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec5fabb0b4280d1542be473ebdef445497446ed4 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueResult { + long requestId; + android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResults.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResults.aidl new file mode 100644 index 0000000000000000000000000000000000000000..47f16563ce555a0dc64236c50482c387b529ecee --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SetValueResults.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueResults { + android.hardware.automotive.vehicle.SetValueResult[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/StatusCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9b724126af9a60a23f61907e9d9306bb6038fce4 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/StatusCode.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 StatusCode { + OK = 0, + TRY_AGAIN = 1, + INVALID_ARG = 2, + NOT_AVAILABLE = 3, + ACCESS_DENIED = 4, + INTERNAL_ERROR = 5, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91e7c1499a54a87e5af10f5e08b04e3f113ebed9 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SubscribeOptions { + int propId; + int[] areaIds; + float sampleRate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a3e59f128d089446b83543b41e02b866858af719 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 SwitchUserMessageType { + UNKNOWN = 0, + LEGACY_ANDROID_SWITCH = 1, + ANDROID_SWITCH = 2, + VEHICLE_RESPONSE = 3, + VEHICLE_REQUEST = 4, + ANDROID_POST_SWITCH = 5, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3012b7a51de879ea50577d432c9058391224b319 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SwitchUserRequest { + int requestId; + android.hardware.automotive.vehicle.SwitchUserMessageType messageType = android.hardware.automotive.vehicle.SwitchUserMessageType.UNKNOWN; + android.hardware.automotive.vehicle.UserInfo targetUser; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8915d1b86693d5f619b0e3795a20fad3e6e3c917 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserResponse.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SwitchUserResponse { + int requestId; + android.hardware.automotive.vehicle.SwitchUserMessageType messageType = android.hardware.automotive.vehicle.SwitchUserMessageType.UNKNOWN; + android.hardware.automotive.vehicle.SwitchUserStatus status = android.hardware.automotive.vehicle.SwitchUserStatus.SUCCESS; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c7be9ec949c7a59a385f9e72faa4ee3bbfe1c130 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 SwitchUserStatus { + SUCCESS = 1, + FAILURE = 2, +} 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 0000000000000000000000000000000000000000..2491340acd4062fa4136c3b1565a86345f33718d --- /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 -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/UserIdentificationAssociation.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a540f8ead8a3cdc4cde62576e17bb72829cb1d73 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationAssociation { + android.hardware.automotive.vehicle.UserIdentificationAssociationType type = android.hardware.automotive.vehicle.UserIdentificationAssociationType.INVALID; + android.hardware.automotive.vehicle.UserIdentificationAssociationValue value = android.hardware.automotive.vehicle.UserIdentificationAssociationValue.UNKNOWN; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1fd9ee8c315b0d594e847aacadbc5995d4c09a2c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.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 -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 UserIdentificationAssociationSetValue { + INVALID = 0, + ASSOCIATE_CURRENT_USER = 1, + DISASSOCIATE_CURRENT_USER = 2, + DISASSOCIATE_ALL_USERS = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6498375b0f3e0ac113790426741383026b2f14b1 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 UserIdentificationAssociationType { + INVALID = 0, + KEY_FOB = 1, + CUSTOM_1 = 101, + CUSTOM_2 = 102, + CUSTOM_3 = 103, + CUSTOM_4 = 104, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d5e01691fa57b947440b3715380857551b993066 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.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 -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 UserIdentificationAssociationValue { + UNKNOWN = 1, + ASSOCIATED_CURRENT_USER = 2, + ASSOCIATED_ANOTHER_USER = 3, + NOT_ASSOCIATED_ANY_USER = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fe7fd6f6bc3e665ad877a78495a88eeabb9788e5 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationGetRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo userInfo; + int numberAssociationTypes; + android.hardware.automotive.vehicle.UserIdentificationAssociationType[] associationTypes; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3e2a2579cc9286be6575a267e013942e16820e40 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationResponse.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationResponse { + int requestId; + int numberAssociation; + android.hardware.automotive.vehicle.UserIdentificationAssociation[] associations; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57840fb77c09c2c32e65e3bc9f089dea18440f96 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationSetAssociation { + android.hardware.automotive.vehicle.UserIdentificationAssociationType type = android.hardware.automotive.vehicle.UserIdentificationAssociationType.INVALID; + android.hardware.automotive.vehicle.UserIdentificationAssociationSetValue value = android.hardware.automotive.vehicle.UserIdentificationAssociationSetValue.INVALID; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..db01b515a8ba008072b78df371b2c95c4096cbb4 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationSetRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo userInfo; + int numberAssociations; + android.hardware.automotive.vehicle.UserIdentificationSetAssociation[] associations; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f47d5e74bbba257c5eb1dc0ae20c2cb22b00ffce --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserInfo { + int userId = 0; + int flags; + const int USER_FLAG_SYSTEM = 1; + const int USER_FLAG_GUEST = 2; + const int USER_FLAG_EPHEMERAL = 4; + const int USER_FLAG_ADMIN = 8; + const int USER_FLAG_DISABLED = 16; + const int USER_FLAG_PROFILE = 32; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UsersInfo.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UsersInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..edcef2edfd57207de4e1ed4d1fff3653d3d701a6 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UsersInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UsersInfo { + android.hardware.automotive.vehicle.UserInfo currentUser; + int numberUsers; + android.hardware.automotive.vehicle.UserInfo[] existingUsers; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d7b874a0be02effc63175e24b0ba443048f16842 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleApPowerStateConfigFlag { + ENABLE_DEEP_SLEEP_FLAG = 1, + CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 2, + ENABLE_HIBERNATION_FLAG = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc669ec17c46245401b1d8803f1754767bea2c3b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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 VehicleApPowerStateReport { + WAIT_FOR_VHAL = 1, + DEEP_SLEEP_ENTRY = 2, + DEEP_SLEEP_EXIT = 3, + SHUTDOWN_POSTPONE = 4, + SHUTDOWN_START = 5, + ON = 6, + SHUTDOWN_PREPARE = 7, + SHUTDOWN_CANCELLED = 8, + HIBERNATION_ENTRY = 9, + HIBERNATION_EXIT = 10, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b94d3159869fa04a41a565ed6764bd9b40e3c1a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.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 -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 VehicleApPowerStateReq { + ON = 0, + SHUTDOWN_PREPARE = 1, + CANCEL_SHUTDOWN = 2, + FINISHED = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f995c73ee535885802b07185261e97b510e52f2b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VehicleApPowerStateReqIndex { + STATE = 0, + ADDITIONAL = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3fde1c7869bc048ebf2cbc55bf36464e9e9ba794 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 VehicleApPowerStateShutdownParam { + SHUTDOWN_IMMEDIATELY = 1, + CAN_SLEEP = 2, + SHUTDOWN_ONLY = 3, + SLEEP_IMMEDIATELY = 4, + HIBERNATE_IMMEDIATELY = 5, + CAN_HIBERNATE = 6, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleArea.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f8b917256890d52a0ec3ceefd5ef174a57beb25 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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 VehicleArea { + GLOBAL = 16777216, + WINDOW = 50331648, + MIRROR = 67108864, + SEAT = 83886080, + DOOR = 100663296, + WHEEL = 117440512, + MASK = 251658240, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b93a11b60f04c64a0a0f126edf5f40ec03a37601 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehicleAreaConfig { + int areaId; + int minInt32Value; + int maxInt32Value; + long minInt64Value; + long maxInt64Value; + float minFloatValue; + float maxFloatValue; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..11139f9a3aae0ec0ace8e1683d17b3e717c48fa6 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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 VehicleAreaDoor { + ROW_1_LEFT = 1, + ROW_1_RIGHT = 4, + ROW_2_LEFT = 16, + ROW_2_RIGHT = 64, + ROW_3_LEFT = 256, + ROW_3_RIGHT = 1024, + HOOD = 268435456, + REAR = 536870912, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c1e2fbd6ff9503ad8036d2a755707a70b731113c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleAreaMirror { + DRIVER_LEFT = 1, + DRIVER_RIGHT = 2, + DRIVER_CENTER = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e76de324d32380682a3d8c2f1521eba9a22e77f5 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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 VehicleAreaSeat { + ROW_1_LEFT = 1, + ROW_1_CENTER = 2, + ROW_1_RIGHT = 4, + ROW_2_LEFT = 16, + ROW_2_CENTER = 32, + ROW_2_RIGHT = 64, + ROW_3_LEFT = 256, + ROW_3_CENTER = 512, + ROW_3_RIGHT = 1024, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9e834340b1e57f6ab317e135f964b662658288c3 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VehicleAreaWheel { + UNKNOWN = 0, + LEFT_FRONT = 1, + RIGHT_FRONT = 2, + LEFT_REAR = 4, + RIGHT_REAR = 8, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6ec26fe26103ab9af4924fb63fb02ae1fd6d3b0a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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 VehicleAreaWindow { + FRONT_WINDSHIELD = 1, + REAR_WINDSHIELD = 2, + ROW_1_LEFT = 16, + ROW_1_RIGHT = 64, + ROW_2_LEFT = 256, + ROW_2_RIGHT = 1024, + ROW_3_LEFT = 4096, + ROW_3_RIGHT = 16384, + ROOF_TOP_1 = 65536, + ROOF_TOP_2 = 131072, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5aeafa4676e3c9627abe9bfec7bcf4fd3038b01c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VehicleDisplay { + MAIN = 0, + INSTRUMENT_CLUSTER = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleGear.aidl new file mode 100644 index 0000000000000000000000000000000000000000..db4760d7a3fbba4029e087664f4ebe685e4f70d8 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleGear.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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 VehicleGear { + GEAR_UNKNOWN = 0, + GEAR_NEUTRAL = 1, + GEAR_REVERSE = 2, + GEAR_PARK = 4, + GEAR_DRIVE = 8, + GEAR_1 = 16, + GEAR_2 = 32, + GEAR_3 = 64, + GEAR_4 = 128, + GEAR_5 = 256, + GEAR_6 = 512, + GEAR_7 = 1024, + GEAR_8 = 2048, + GEAR_9 = 4096, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a85751f94f3e8c0dbac17c42f76eac0a8cdbaea2 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 VehicleHvacFanDirection { + UNKNOWN = 0, + FACE = 1, + FLOOR = 2, + FACE_AND_FLOOR = 3, + DEFROST = 4, + DEFROST_AND_FLOOR = 6, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c4ac002067cd031d2fca3919b844adf147a7f68f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VehicleHwKeyInputAction { + ACTION_DOWN = 0, + ACTION_UP = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..09d5423edc409a342d4c3be2fa095b6c32771968 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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 VehicleIgnitionState { + UNDEFINED = 0, + LOCK = 1, + OFF = 2, + ACC = 3, + ON = 4, + START = 5, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d5698514075d32f34e511275671a779828098283 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleLightState { + OFF = 0, + ON = 1, + DAYTIME_RUNNING = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0d3c636b16a239975e55a4b78acfc6b6092ea865 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightSwitch.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 -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 VehicleLightSwitch { + OFF = 0, + ON = 1, + DAYTIME_RUNNING = 2, + AUTOMATIC = 256, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2eb5aa9134a4069ea4bca311201a33408833267 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VehicleOilLevel { + CRITICALLY_LOW = 0, + LOW = 1, + NORMAL = 2, + HIGH = 3, + ERROR = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8602d2d03d8d72e799d52d18251e2fb9e78f8c81 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropConfig { + int prop; + android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE; + android.hardware.automotive.vehicle.VehiclePropertyChangeMode changeMode = android.hardware.automotive.vehicle.VehiclePropertyChangeMode.STATIC; + android.hardware.automotive.vehicle.VehicleAreaConfig[] areaConfigs; + int[] configArray; + @utf8InCpp String configString; + float minSampleRate; + float maxSampleRate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..04c8006983c348a7cedcd49fee944b356e74b9f0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropConfigs { + android.hardware.automotive.vehicle.VehiclePropConfig[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..983529542f2667019c1b1b686957d9ad3645e10e --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropError { + int propId; + int areaId; + android.hardware.automotive.vehicle.StatusCode errorCode = android.hardware.automotive.vehicle.StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropErrors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropErrors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9dcb10bc9e7ba2af846ee1729404776a3e338d4e --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropErrors.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropErrors { + android.hardware.automotive.vehicle.VehiclePropError[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c87379fd9bc02998a6654c6a20597c23b39403c9 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropValue { + long timestamp; + int areaId; + int prop; + android.hardware.automotive.vehicle.VehiclePropertyStatus status = android.hardware.automotive.vehicle.VehiclePropertyStatus.AVAILABLE; + android.hardware.automotive.vehicle.RawPropValues value; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValues.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e09a6b95df9c4f731ab0dd4622784cbe9fbc0f1a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropValues.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropValues { + android.hardware.automotive.vehicle.VehiclePropValue[] payloads; + long sharedMemoryId; + @nullable ParcelFileDescriptor sharedMemoryFd; +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..04f8fa3b80b7e865b200efd13919ec4e06729f11 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -0,0 +1,209 @@ +/* + * 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 -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 VehicleProperty { + INVALID = 0, + INFO_VIN = 286261504, + INFO_MAKE = 286261505, + INFO_MODEL = 286261506, + INFO_MODEL_YEAR = 289407235, + INFO_FUEL_CAPACITY = 291504388, + INFO_FUEL_TYPE = 289472773, + INFO_EV_BATTERY_CAPACITY = 291504390, + INFO_EV_CONNECTOR_TYPE = 289472775, + INFO_FUEL_DOOR_LOCATION = 289407240, + INFO_EV_PORT_LOCATION = 289407241, + INFO_DRIVER_SEAT = 356516106, + INFO_EXTERIOR_DIMENSIONS = 289472779, + INFO_MULTI_EV_PORT_LOCATIONS = 289472780, + PERF_ODOMETER = 291504644, + PERF_VEHICLE_SPEED = 291504647, + PERF_VEHICLE_SPEED_DISPLAY = 291504648, + PERF_STEERING_ANGLE = 291504649, + PERF_REAR_STEERING_ANGLE = 291504656, + ENGINE_COOLANT_TEMP = 291504897, + ENGINE_OIL_LEVEL = 289407747, + ENGINE_OIL_TEMP = 291504900, + ENGINE_RPM = 291504901, + WHEEL_TICK = 290521862, + FUEL_LEVEL = 291504903, + FUEL_DOOR_OPEN = 287310600, + EV_BATTERY_LEVEL = 291504905, + EV_CHARGE_PORT_OPEN = 287310602, + EV_CHARGE_PORT_CONNECTED = 287310603, + EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 291504908, + RANGE_REMAINING = 291504904, + TIRE_PRESSURE = 392168201, + CRITICALLY_LOW_TIRE_PRESSURE = 392168202, + GEAR_SELECTION = 289408000, + CURRENT_GEAR = 289408001, + PARKING_BRAKE_ON = 287310850, + PARKING_BRAKE_AUTO_APPLY = 287310851, + FUEL_LEVEL_LOW = 287310853, + NIGHT_MODE = 287310855, + TURN_SIGNAL_STATE = 289408008, + IGNITION_STATE = 289408009, + ABS_ACTIVE = 287310858, + TRACTION_CONTROL_ACTIVE = 287310859, + HVAC_FAN_SPEED = 356517120, + HVAC_FAN_DIRECTION = 356517121, + HVAC_TEMPERATURE_CURRENT = 358614274, + HVAC_TEMPERATURE_SET = 358614275, + HVAC_DEFROSTER = 320865540, + HVAC_AC_ON = 354419973, + HVAC_MAX_AC_ON = 354419974, + HVAC_MAX_DEFROST_ON = 354419975, + HVAC_RECIRC_ON = 354419976, + HVAC_DUAL_ON = 354419977, + HVAC_AUTO_ON = 354419978, + HVAC_SEAT_TEMPERATURE = 356517131, + HVAC_SIDE_MIRROR_HEAT = 339739916, + HVAC_STEERING_WHEEL_HEAT = 289408269, + HVAC_TEMPERATURE_DISPLAY_UNITS = 289408270, + HVAC_ACTUAL_FAN_SPEED_RPM = 356517135, + HVAC_POWER_ON = 354419984, + HVAC_FAN_DIRECTION_AVAILABLE = 356582673, + HVAC_AUTO_RECIRC_ON = 354419986, + HVAC_SEAT_VENTILATION = 356517139, + HVAC_ELECTRIC_DEFROSTER_ON = 320865556, + HVAC_TEMPERATURE_VALUE_SUGGESTION = 291570965, + DISTANCE_DISPLAY_UNITS = 289408512, + FUEL_VOLUME_DISPLAY_UNITS = 289408513, + TIRE_PRESSURE_DISPLAY_UNITS = 289408514, + EV_BATTERY_DISPLAY_UNITS = 289408515, + FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = 287311364, + VEHICLE_SPEED_DISPLAY_UNITS = 289408517, + EXTERNAL_CAR_TIME = 290457096, + ANDROID_EPOCH_TIME = 290457094, + STORAGE_ENCRYPTION_BINDING_SEED = 292554247, + ENV_OUTSIDE_TEMPERATURE = 291505923, + AP_POWER_STATE_REQ = 289475072, + AP_POWER_STATE_REPORT = 289475073, + AP_POWER_BOOTUP_REASON = 289409538, + DISPLAY_BRIGHTNESS = 289409539, + HW_KEY_INPUT = 289475088, + HW_ROTARY_INPUT = 289475104, + HW_CUSTOM_INPUT = 289475120, + DOOR_POS = 373295872, + DOOR_MOVE = 373295873, + DOOR_LOCK = 371198722, + MIRROR_Z_POS = 339741504, + MIRROR_Z_MOVE = 339741505, + MIRROR_Y_POS = 339741506, + MIRROR_Y_MOVE = 339741507, + MIRROR_LOCK = 287312708, + MIRROR_FOLD = 287312709, + SEAT_MEMORY_SELECT = 356518784, + SEAT_MEMORY_SET = 356518785, + SEAT_BELT_BUCKLED = 354421634, + SEAT_BELT_HEIGHT_POS = 356518787, + SEAT_BELT_HEIGHT_MOVE = 356518788, + SEAT_FORE_AFT_POS = 356518789, + SEAT_FORE_AFT_MOVE = 356518790, + SEAT_BACKREST_ANGLE_1_POS = 356518791, + SEAT_BACKREST_ANGLE_1_MOVE = 356518792, + SEAT_BACKREST_ANGLE_2_POS = 356518793, + SEAT_BACKREST_ANGLE_2_MOVE = 356518794, + SEAT_HEIGHT_POS = 356518795, + SEAT_HEIGHT_MOVE = 356518796, + SEAT_DEPTH_POS = 356518797, + SEAT_DEPTH_MOVE = 356518798, + SEAT_TILT_POS = 356518799, + SEAT_TILT_MOVE = 356518800, + SEAT_LUMBAR_FORE_AFT_POS = 356518801, + SEAT_LUMBAR_FORE_AFT_MOVE = 356518802, + SEAT_LUMBAR_SIDE_SUPPORT_POS = 356518803, + SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 356518804, + SEAT_HEADREST_HEIGHT_POS = 289409941, + SEAT_HEADREST_HEIGHT_MOVE = 356518806, + SEAT_HEADREST_ANGLE_POS = 356518807, + SEAT_HEADREST_ANGLE_MOVE = 356518808, + SEAT_HEADREST_FORE_AFT_POS = 356518809, + SEAT_HEADREST_FORE_AFT_MOVE = 356518810, + SEAT_OCCUPANCY = 356518832, + WINDOW_POS = 322964416, + WINDOW_MOVE = 322964417, + WINDOW_LOCK = 320867268, + VEHICLE_MAP_SERVICE = 299895808, + OBD2_LIVE_FRAME = 299896064, + OBD2_FREEZE_FRAME = 299896065, + OBD2_FREEZE_FRAME_INFO = 299896066, + OBD2_FREEZE_FRAME_CLEAR = 299896067, + HEADLIGHTS_STATE = 289410560, + HIGH_BEAM_LIGHTS_STATE = 289410561, + FOG_LIGHTS_STATE = 289410562, + HAZARD_LIGHTS_STATE = 289410563, + HEADLIGHTS_SWITCH = 289410576, + HIGH_BEAM_LIGHTS_SWITCH = 289410577, + FOG_LIGHTS_SWITCH = 289410578, + HAZARD_LIGHTS_SWITCH = 289410579, + CABIN_LIGHTS_STATE = 289410817, + CABIN_LIGHTS_SWITCH = 289410818, + READING_LIGHTS_STATE = 356519683, + READING_LIGHTS_SWITCH = 356519684, + SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 287313669, + DISABLED_OPTIONAL_FEATURES = 286265094, + INITIAL_USER_INFO = 299896583, + SWITCH_USER = 299896584, + CREATE_USER = 299896585, + REMOVE_USER = 299896586, + USER_IDENTIFICATION_ASSOCIATION = 299896587, + EVS_SERVICE_REQUEST = 289476368, + POWER_POLICY_REQ = 286265121, + POWER_POLICY_GROUP_REQ = 286265122, + CURRENT_POWER_POLICY = 286265123, + WATCHDOG_ALIVE = 290459441, + WATCHDOG_TERMINATED_PROCESS = 299896626, + VHAL_HEARTBEAT = 290459443, + CLUSTER_SWITCH_UI = 289410868, + CLUSTER_DISPLAY_STATE = 289476405, + CLUSTER_REPORT_STATE = 299896630, + CLUSTER_REQUEST_DISPLAY = 289410871, + CLUSTER_NAVIGATION_STATE = 292556600, + ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = 289410873, + ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = 289410874, + FRONT_FOG_LIGHTS_STATE = 289410875, + FRONT_FOG_LIGHTS_SWITCH = 289410876, + REAR_FOG_LIGHTS_STATE = 289410877, + REAR_FOG_LIGHTS_SWITCH = 289410878, + EV_CHARGE_CURRENT_DRAW_LIMIT = 291508031, + EV_CHARGE_PERCENT_LIMIT = 291508032, + EV_CHARGE_STATE = 289410881, + EV_CHARGE_SWITCH = 287313730, + EV_CHARGE_TIME_REMAINING = 289410883, + EV_REGENERATIVE_BRAKING_STATE = 289410884, + TRAILER_PRESENT = 289410885, + VEHICLE_CURB_WEIGHT = 289410886, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec9587f60c33331d64660ebafb10f71462b9f394 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.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 -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 VehiclePropertyAccess { + NONE = 0, + READ = 1, + WRITE = 2, + READ_WRITE = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5455fdd5ca105e19241cd68b73b419544527ed29 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehiclePropertyChangeMode { + STATIC = 0, + ON_CHANGE = 1, + CONTINUOUS = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c049c4814f4947de4bcdfe93cce3a19e0da2cd8 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehiclePropertyGroup { + SYSTEM = 268435456, + VENDOR = 536870912, + MASK = -268435456, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6d0e041ff60e22161d8c0253c7d63f6bb8206811 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehiclePropertyStatus { + AVAILABLE = 0, + UNAVAILABLE = 1, + ERROR = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..da6d2c21686cb23e99b06dfed0e43b3d1a243fd2 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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 VehiclePropertyType { + STRING = 1048576, + BOOLEAN = 2097152, + INT32 = 4194304, + INT32_VEC = 4259840, + INT64 = 5242880, + INT64_VEC = 5308416, + FLOAT = 6291456, + FLOAT_VEC = 6356992, + BYTES = 7340032, + MIXED = 14680064, + MASK = 16711680, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3e870e89258e67362e1dd8d3501568e5630f7558 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleSeatOccupancyState { + UNKNOWN = 0, + VACANT = 1, + OCCUPIED = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl new file mode 100644 index 0000000000000000000000000000000000000000..78c17959b4e36401e612014be4c588bf8e9782fc --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VehicleTurnSignal { + NONE = 0, + RIGHT = 1, + LEFT = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c80fdbbdbedd4f2ccc1041281d5807f46f3b42aa --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl @@ -0,0 +1,70 @@ +/* + * 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 -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 VehicleUnit { + SHOULD_NOT_USE = 0, + METER_PER_SEC = 1, + RPM = 2, + HERTZ = 3, + PERCENTILE = 16, + MILLIMETER = 32, + METER = 33, + KILOMETER = 35, + MILE = 36, + CELSIUS = 48, + FAHRENHEIT = 49, + KELVIN = 50, + MILLILITER = 64, + LITER = 65, + GALLON = 66, + US_GALLON = 66, + IMPERIAL_GALLON = 67, + NANO_SECS = 80, + SECS = 83, + YEAR = 89, + WATT_HOUR = 96, + MILLIAMPERE = 97, + MILLIVOLT = 98, + MILLIWATTS = 99, + AMPERE_HOURS = 100, + KILOWATT_HOUR = 101, + AMPERE = 102, + KILOPASCAL = 112, + PSI = 113, + BAR = 114, + DEGREES = 128, + MILES_PER_HOUR = 144, + KILOMETERS_PER_HOUR = 145, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl new file mode 100644 index 0000000000000000000000000000000000000000..58524f3c668a0340cf56b38f209616b84adcfc54 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl @@ -0,0 +1,75 @@ +/* + * 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 -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 VehicleVendorPermission { + PERMISSION_DEFAULT = 0, + PERMISSION_SET_VENDOR_CATEGORY_WINDOW = 1, + PERMISSION_GET_VENDOR_CATEGORY_WINDOW = 2, + PERMISSION_SET_VENDOR_CATEGORY_DOOR = 3, + PERMISSION_GET_VENDOR_CATEGORY_DOOR = 4, + PERMISSION_SET_VENDOR_CATEGORY_SEAT = 5, + PERMISSION_GET_VENDOR_CATEGORY_SEAT = 6, + PERMISSION_SET_VENDOR_CATEGORY_MIRROR = 7, + PERMISSION_GET_VENDOR_CATEGORY_MIRROR = 8, + PERMISSION_SET_VENDOR_CATEGORY_INFO = 9, + PERMISSION_GET_VENDOR_CATEGORY_INFO = 10, + PERMISSION_SET_VENDOR_CATEGORY_ENGINE = 11, + PERMISSION_GET_VENDOR_CATEGORY_ENGINE = 12, + PERMISSION_SET_VENDOR_CATEGORY_HVAC = 13, + PERMISSION_GET_VENDOR_CATEGORY_HVAC = 14, + PERMISSION_SET_VENDOR_CATEGORY_LIGHT = 15, + PERMISSION_GET_VENDOR_CATEGORY_LIGHT = 16, + PERMISSION_SET_VENDOR_CATEGORY_1 = 65536, + PERMISSION_GET_VENDOR_CATEGORY_1 = 69632, + PERMISSION_SET_VENDOR_CATEGORY_2 = 131072, + PERMISSION_GET_VENDOR_CATEGORY_2 = 135168, + PERMISSION_SET_VENDOR_CATEGORY_3 = 196608, + PERMISSION_GET_VENDOR_CATEGORY_3 = 200704, + PERMISSION_SET_VENDOR_CATEGORY_4 = 262144, + PERMISSION_GET_VENDOR_CATEGORY_4 = 266240, + PERMISSION_SET_VENDOR_CATEGORY_5 = 327680, + PERMISSION_GET_VENDOR_CATEGORY_5 = 331776, + PERMISSION_SET_VENDOR_CATEGORY_6 = 393216, + PERMISSION_GET_VENDOR_CATEGORY_6 = 397312, + PERMISSION_SET_VENDOR_CATEGORY_7 = 458752, + PERMISSION_GET_VENDOR_CATEGORY_7 = 462848, + PERMISSION_SET_VENDOR_CATEGORY_8 = 524288, + PERMISSION_GET_VENDOR_CATEGORY_8 = 528384, + PERMISSION_SET_VENDOR_CATEGORY_9 = 589824, + PERMISSION_GET_VENDOR_CATEGORY_9 = 593920, + PERMISSION_SET_VENDOR_CATEGORY_10 = 655360, + PERMISSION_GET_VENDOR_CATEGORY_10 = 659456, + PERMISSION_NOT_ACCESSIBLE = -268435456, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0dcfbc4a5dd82f80bea3e7ebb659ec26edc8f25e --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.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 -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 VmsAvailabilityStateIntegerValuesIndex { + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_ASSOCIATED_LAYERS = 2, + LAYERS_START = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..45514d081aca8d8f722870e3175f0102db7ec912 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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 VmsBaseMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1248c069ce2bb6dbb37fd96a040231968bb3ea9f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageType.aidl @@ -0,0 +1,54 @@ +/* + * 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 -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 VmsMessageType { + SUBSCRIBE = 1, + SUBSCRIBE_TO_PUBLISHER = 2, + UNSUBSCRIBE = 3, + UNSUBSCRIBE_TO_PUBLISHER = 4, + OFFERING = 5, + AVAILABILITY_REQUEST = 6, + SUBSCRIPTIONS_REQUEST = 7, + AVAILABILITY_RESPONSE = 8, + AVAILABILITY_CHANGE = 9, + SUBSCRIPTIONS_RESPONSE = 10, + SUBSCRIPTIONS_CHANGE = 11, + DATA = 12, + PUBLISHER_ID_REQUEST = 13, + PUBLISHER_ID_RESPONSE = 14, + PUBLISHER_INFORMATION_REQUEST = 15, + PUBLISHER_INFORMATION_RESPONSE = 16, + START_SESSION = 17, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b0e3a5ef2bdc1d31dc21c3bf6dc628e096b0d77 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VmsMessageWithLayerAndPublisherIdIntegerValuesIndex { + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, + PUBLISHER_ID = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..65dd4ae39556a261192e0fd80098dfe668403cd7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.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 -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 VmsMessageWithLayerIntegerValuesIndex { + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc2a9c18446f8afe247cfc8e89c3f96c8bbadf97 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.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 -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 VmsOfferingMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, + NUMBER_OF_OFFERS = 2, + OFFERING_START = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a9b017fdb10f5679ce36eb90f810135ff3e982a7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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 VmsPublisherInformationIntegerValuesIndex { + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d942bc8392f29c7d4d761bd8342c6e22a83b39d0 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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 VmsStartSessionMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, + SERVICE_ID = 1, + CLIENT_ID = 2, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..796d7f722c5d88ceced8f78faafb6cfb9adf8d53 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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 VmsSubscriptionsStateIntegerValuesIndex { + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_LAYERS = 2, + NUMBER_OF_ASSOCIATED_LAYERS = 3, + SUBSCRIPTIONS_START = 4, +} diff --git a/automotive/vehicle/aidl/aidl_test/AidlHidlCompatibilityTest.cpp b/automotive/vehicle/aidl/aidl_test/AidlHidlCompatibilityTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4f3f28fdac83436d54ee84c75e19cfce30e53e7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_test/AidlHidlCompatibilityTest.cpp @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#include +#include + +#include +#include +#include +#include + +namespace hidl_vehicle = ::android::hardware::automotive::vehicle::V2_0; +namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle; +using ::android::hardware::hidl_enum_range; +using ::ndk::enum_range; + +TEST(AidlHidlCompatibilityTest, testHidlPropertiesDefinedInAidl) { + for (const auto prop : hidl_enum_range()) { + int propInt = ::android::hardware::automotive::vehicle::toInt(prop); + auto aidlProperties = enum_range(); + + ASSERT_NE(std::find(aidlProperties.begin(), aidlProperties.end(), + static_cast(propInt)), + aidlProperties.end()) + << "property: " << propInt << " defined in HIDL, but not defined in AIDL"; + } +} diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..5284a0a8e140efc361bc2194f4c0fe573aca80f6 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_test/Android.bp @@ -0,0 +1,37 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "VehicleHalAidlHidlCompatibilityTest", + srcs: ["*.cpp"], + shared_libs: [ + "libbinder_ndk", + "libhidlbase", + ], + static_libs: [ + "VehicleHalUtils", + "android.hardware.automotive.vehicle@2.0", + "libgtest", + "libgmock", + ], + defaults: ["VehicleHalDefaults"], + test_suites: ["device-tests"], + vendor: true, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..624e5a6d201358999494e660b15d59feeb6248df --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserRequest.aidl @@ -0,0 +1,47 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserInfo; +import android.hardware.automotive.vehicle.UsersInfo; + +/** + * Defines the format of a CREATE_USER property. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable CreateUserRequest { + /** + * Arbitrary id used to map the response to the request. + */ + int requestId; + /** + * Basic information about Android user that was created. + */ + UserInfo newUserInfo; + /** + * Name of the new Android user. + */ + @utf8InCpp String newUserName; + /** + * Information about the current state of the Android system. + */ + UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserResponse.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..29db44294815712596b17e71be474e2d113629f1 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserResponse.aidl @@ -0,0 +1,45 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.CreateUserStatus; + +/** + * Defines the result of a CreateUserRequest. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable CreateUserResponse { + /** + * Id of the request being responded. + */ + int requestId; + /** + * Status of the request. + */ + CreateUserStatus status = CreateUserStatus.SUCCESS; + /** + * HAL-specific error message. + * + * This argument is optional, and when defined, it's passed "as-is" to the caller. It could be + * used to show custom error messages to the end user. + */ + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserStatus.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5c8c5f0e760fe71fb1178cab98b55028745046b4 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserStatus.aidl @@ -0,0 +1,34 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Status of the response to a CreateUserRequest. + */ +@VintfStability +@Backing(type="int") +enum CreateUserStatus { + /** + * The request succeeded (for example, HAL created a new internal user, or associated the + * Android user to an existing internal user). + */ + SUCCESS = 1, + /** + * The request failed (and Android will remove the Android user). + */ + FAILURE = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CustomInputType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CustomInputType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0f4855e7b4db12c80fb8b93c7c23becbe1e24f13 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CustomInputType.aidl @@ -0,0 +1,42 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Input code values for HW_CUSTOM_INPUT. + */ +@VintfStability +@Backing(type="int") +enum CustomInputType { + /** + * Ten optional functions to be used in case OEM don't need more than 10 input code values. + * + * OEMs are free to use any signed 32 bits number to represent the input code value. + * The following function keys are only for convenience and any other integer values are + * also allowed. + */ + CUSTOM_EVENT_F1 = 1001, + CUSTOM_EVENT_F2 = 1002, + CUSTOM_EVENT_F3 = 1003, + CUSTOM_EVENT_F4 = 1004, + CUSTOM_EVENT_F5 = 1005, + CUSTOM_EVENT_F6 = 1006, + CUSTOM_EVENT_F7 = 1007, + CUSTOM_EVENT_F8 = 1008, + CUSTOM_EVENT_F9 = 1009, + CUSTOM_EVENT_F10 = 1010, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b0c471d72aa02cb2765a663c152afc6bf247b94 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl @@ -0,0 +1,314 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * This enum provides the canonical mapping for sensor properties that have a floating-point value. + * The ordering of the values is taken from the OBD2 specification. + * Any value greater than the last reserved index is available to vendors to map their extensions. + * While these values do not directly map to SAE J1979 PIDs, an equivalence is listed next + * to each one to aid implementors. + */ +@VintfStability +@Backing(type="int") +enum DiagnosticFloatSensorIndex { + CALCULATED_ENGINE_LOAD = 0, + /* + * PID 0x04 + */ + ENGINE_COOLANT_TEMPERATURE = 1, + /* + * PID 0x05 + */ + SHORT_TERM_FUEL_TRIM_BANK1 = 2, + /* + * PID 0x06 + */ + LONG_TERM_FUEL_TRIM_BANK1 = 3, + /* + * PID 0x07 + */ + SHORT_TERM_FUEL_TRIM_BANK2 = 4, + /* + * PID 0x08 + */ + LONG_TERM_FUEL_TRIM_BANK2 = 5, + /* + * PID 0x09 + */ + FUEL_PRESSURE = 6, + /* + * PID 0x0A + */ + INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7, + /* + * PID 0x0B + */ + ENGINE_RPM = 8, + /* + * PID 0x0C + */ + VEHICLE_SPEED = 9, + /* + * PID 0x0D + */ + TIMING_ADVANCE = 10, + /* + * PID 0x0E + */ + MAF_AIR_FLOW_RATE = 11, + /* + * PID 0x10 + */ + THROTTLE_POSITION = 12, + /* + * PID 0x11 + */ + OXYGEN_SENSOR1_VOLTAGE = 13, + /* + * PID 0x14 + */ + OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14, + /* + * PID 0x14 + */ + OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15, + /* + * PID 0x24 + */ + OXYGEN_SENSOR2_VOLTAGE = 16, + /* + * PID 0x15 + */ + OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17, + /* + * PID 0x15 + */ + OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18, + /* + * PID 0x25 + */ + OXYGEN_SENSOR3_VOLTAGE = 19, + /* + * PID 0x16 + */ + OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20, + /* + * PID 0x16 + */ + OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21, + /* + * PID 0x26 + */ + OXYGEN_SENSOR4_VOLTAGE = 22, + /* + * PID 0x17 + */ + OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23, + /* + * PID 0x17 + */ + OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24, + /* + * PID 0x27 + */ + OXYGEN_SENSOR5_VOLTAGE = 25, + /* + * PID 0x18 + */ + OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26, + /* + * PID 0x18 + */ + OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27, + /* + * PID 0x28 + */ + OXYGEN_SENSOR6_VOLTAGE = 28, + /* + * PID 0x19 + */ + OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29, + /* + * PID 0x19 + */ + OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30, + /* + * PID 0x29 + */ + OXYGEN_SENSOR7_VOLTAGE = 31, + /* + * PID 0x1A + */ + OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32, + /* + * PID 0x1A + */ + OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33, + /* + * PID 0x2A + */ + OXYGEN_SENSOR8_VOLTAGE = 34, + /* + * PID 0x1B + */ + OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35, + /* + * PID 0x1B + */ + OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36, + /* + * PID 0x2B + */ + FUEL_RAIL_PRESSURE = 37, + /* + * PID 0x22 + */ + FUEL_RAIL_GAUGE_PRESSURE = 38, + /* + * PID 0x23 + */ + COMMANDED_EXHAUST_GAS_RECIRCULATION = 39, + /* + * PID 0x2C + */ + EXHAUST_GAS_RECIRCULATION_ERROR = 40, + /* + * PID 0x2D + */ + COMMANDED_EVAPORATIVE_PURGE = 41, + /* + * PID 0x2E + */ + FUEL_TANK_LEVEL_INPUT = 42, + /* + * PID 0x2F + */ + EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43, + /* + * PID 0x32 + */ + CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44, + /* + * PID 0x3C + */ + CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45, + /* + * PID 0x3D + */ + CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46, + /* + * PID 0x3E + */ + CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47, + /* + * PID 0x3F + */ + ABSOLUTE_LOAD_VALUE = 48, + /* + * PID 0x43 + */ + FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49, + /* + * PID 0x44 + */ + RELATIVE_THROTTLE_POSITION = 50, + /* + * PID 0x45 + */ + ABSOLUTE_THROTTLE_POSITION_B = 51, + /* + * PID 0x47 + */ + ABSOLUTE_THROTTLE_POSITION_C = 52, + /* + * PID 0x48 + */ + ACCELERATOR_PEDAL_POSITION_D = 53, + /* + * PID 0x49 + */ + ACCELERATOR_PEDAL_POSITION_E = 54, + /* + * PID 0x4A + */ + ACCELERATOR_PEDAL_POSITION_F = 55, + /* + * PID 0x4B + */ + COMMANDED_THROTTLE_ACTUATOR = 56, + /* + * PID 0x4C + */ + ETHANOL_FUEL_PERCENTAGE = 57, + /* + * PID 0x52 + */ + ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58, + /* + * PID 0x53 + */ + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59, + /* + * PID 0x55 + */ + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60, + /* + * PID 0x57 + */ + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61, + /* + * PID 0x55 + */ + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62, + /* + * PID 0x57 + */ + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63, + /* + * PID 0x56 + */ + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64, + /* + * PID 0x58 + */ + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65, + /* + * PID 0x56 + */ + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66, + /* + * PID 0x58 + */ + RELATIVE_ACCELERATOR_PEDAL_POSITION = 67, + /* + * PID 0x5A + */ + HYBRID_BATTERY_PACK_REMAINING_LIFE = 68, + /* + * PID 0x5B + */ + FUEL_INJECTION_TIMING = 69, + /* + * PID 0x5D + */ + ENGINE_FUEL_RATE = 70, + /* + * PID 0x5E + */ + // LAST_SYSTEM_INDEX = ENGINE_FUEL_RATE, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..321b7ffdbc1e16a7f87f906522cfc5b83cdb7578 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl @@ -0,0 +1,178 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * This enum provides the canonical mapping for sensor properties that have an integer value. + * The ordering of the values is taken from the OBD2 specification. + * Some of the properties are represented as an integer mapping to another enum. In those cases + * expect a comment by the property definition describing the enum to look at for the mapping. + * Any value greater than the last reserved index is available to vendors to map their extensions. + * While these values do not directly map to SAE J1979 PIDs, an equivalence is listed next + * to each one to aid implementors. + */ +@VintfStability +@Backing(type="int") +enum DiagnosticIntegerSensorIndex { + /** + * refer to FuelSystemStatus for a description of this value. + */ + FUEL_SYSTEM_STATUS = 0, + /* + * PID 0x03 + */ + MALFUNCTION_INDICATOR_LIGHT_ON = 1, + /* + * PID 0x01 + * + * + * refer to IgnitionMonitorKind for a description of this value. + */ + IGNITION_MONITORS_SUPPORTED = 2, + /* + * PID 0x01 + * + * + * The value of this sensor is a bitmask that specifies whether ignition-specific + * tests are available and whether they are complete. The semantics of the individual + * bits in this value are given by, respectively, SparkIgnitionMonitors and + * CompressionIgnitionMonitors depending on the value of IGNITION_MONITORS_SUPPORTED. + */ + IGNITION_SPECIFIC_MONITORS = 3, + /* + * PID 0x01 + */ + INTAKE_AIR_TEMPERATURE = 4, + /* + * PID 0x0F + * + * + * refer to SecondaryAirStatus for a description of this value. + */ + COMMANDED_SECONDARY_AIR_STATUS = 5, + /* + * PID 0x12 + */ + NUM_OXYGEN_SENSORS_PRESENT = 6, + /* + * PID 0x13 + */ + RUNTIME_SINCE_ENGINE_START = 7, + /* + * PID 0x1F + */ + DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8, + /* + * PID 0x21 + */ + WARMUPS_SINCE_CODES_CLEARED = 9, + /* + * PID 0x30 + */ + DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10, + /* + * PID 0x31 + */ + ABSOLUTE_BAROMETRIC_PRESSURE = 11, + /* + * PID 0x33 + */ + CONTROL_MODULE_VOLTAGE = 12, + /* + * PID 0x42 + */ + AMBIENT_AIR_TEMPERATURE = 13, + /* + * PID 0x46 + */ + TIME_WITH_MALFUNCTION_LIGHT_ON = 14, + /* + * PID 0x4D + */ + TIME_SINCE_TROUBLE_CODES_CLEARED = 15, + /* + * PID 0x4E + */ + MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16, + /* + * PID 0x4F + */ + MAX_OXYGEN_SENSOR_VOLTAGE = 17, + /* + * PID 0x4F + */ + MAX_OXYGEN_SENSOR_CURRENT = 18, + /* + * PID 0x4F + */ + MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19, + /* + * PID 0x4F + */ + MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20, + /* + * PID 0x50 + * + * + * refer to FuelType for a description of this value. + */ + FUEL_TYPE = 21, + /* + * PID 0x51 + */ + FUEL_RAIL_ABSOLUTE_PRESSURE = 22, + /* + * PID 0x59 + */ + ENGINE_OIL_TEMPERATURE = 23, + /* + * PID 0x5C + */ + DRIVER_DEMAND_PERCENT_TORQUE = 24, + /* + * PID 0x61 + */ + ENGINE_ACTUAL_PERCENT_TORQUE = 25, + /* + * PID 0x62 + */ + ENGINE_REFERENCE_PERCENT_TORQUE = 26, + /* + * PID 0x63 + */ + ENGINE_PERCENT_TORQUE_DATA_IDLE = 27, + /* + * PID 0x64 + */ + ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28, + /* + * PID 0x64 + */ + ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29, + /* + * PID 0x64 + */ + ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30, + /* + * PID 0x64 + */ + ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31, + /* + * PID 0x64 + */ + // LAST_SYSTEM_INDEX = 31, +} diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl similarity index 65% rename from wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl rename to automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl index c9824027e984d58c0ebf78cc2a6c75d2bc207614..94209ba1506dd98350be3b520ba5b96960177996 100644 --- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Bandwidth.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl @@ -14,23 +14,16 @@ * limitations under the License. */ -package android.hardware.wifi.hostapd; +package android.hardware.automotive.vehicle; /** - * The channel bandwidth of the AP. + * Used by ELECTRONIC_TOLL_COLLECTION_CARD_STATUS. */ @VintfStability @Backing(type="int") -enum Bandwidth { - BANDWIDTH_INVALID = 0, - BANDWIDTH_20_NOHT = 1, - BANDWIDTH_20 = 2, - BANDWIDTH_40 = 3, - BANDWIDTH_80 = 4, - BANDWIDTH_80P80 = 5, - BANDWIDTH_160 = 6, - BANDWIDTH_2160 = 7, - BANDWIDTH_4320 = 8, - BANDWIDTH_6480 = 9, - BANDWIDTH_8640 = 10, +enum ElectronicTollCollectionCardStatus { + UNKNOWN = 0, + ELECTRONIC_TOLL_COLLECTION_CARD_VALID = 1, + ELECTRONIC_TOLL_COLLECTION_CARD_INVALID = 2, + ELECTRONIC_TOLL_COLLECTION_CARD_NOT_INSERTED = 3, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46c5f4839bf3a3e65e421f631b82df0542a0686b --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl @@ -0,0 +1,28 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by ELECTRONIC_TOLL_COLLECTION_CARD_TYPE. + */ +@VintfStability +@Backing(type="int") +enum ElectronicTollCollectionCardType { + UNKNOWN = 0, + JP_ELECTRONIC_TOLL_COLLECTION_CARD = 1, + JP_ELECTRONIC_TOLL_COLLECTION_CARD_V2 = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e095fc4959e669404e7f45208fbc011bf7b9966f --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl @@ -0,0 +1,33 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by EV charging properties to enumerate the current state of the battery charging. + */ +@VintfStability +@Backing(type="int") +enum EvChargeState { + UNKNOWN = 0, + CHARGING = 1, + FULLY_CHARGED = 2, + NOT_CHARGING = 3, + /** + * Vehicle not charging due to an error + */ + ERROR = 4, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvConnectorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e77f5376c89f3b7ce607071c2ec3113e1779c52 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvConnectorType.aidl @@ -0,0 +1,48 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by INFO_EV_CONNECTOR_TYPE to enumerate the type of connectors + * available to charge the vehicle. + */ +@VintfStability +@Backing(type="int") +enum EvConnectorType { + /** + * Default type if the vehicle does not know or report the EV connector + * type. + */ + UNKNOWN = 0, + IEC_TYPE_1_AC = 1, + IEC_TYPE_2_AC = 2, + IEC_TYPE_3_AC = 3, + IEC_TYPE_4_DC = 4, + IEC_TYPE_1_CCS_DC = 5, + IEC_TYPE_2_CCS_DC = 6, + TESLA_ROADSTER = 7, + TESLA_HPWC = 8, + TESLA_SUPERCHARGER = 9, + GBT_AC = 10, + GBT_DC = 11, + /** + * Connector type to use when no other types apply. Before using this + * value, work with Google to see if the EvConnectorType enum can be + * extended with an appropriate value. + */ + OTHER = 101, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..438228719a2d4f39513a97e49dc288eea251884c --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by the regenerative braking property to enumerate the current state + * of the regenerative braking. + */ +@VintfStability +@Backing(type="int") +enum EvRegenerativeBrakingState { + UNKNOWN = 0, + DISABLED = 1, + PARTIALLY_ENABLED = 2, + FULLY_ENABLED = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d27e032ba48d97c5bfe8c4a06e0f9b18c930b9d3 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Index in int32VAlues for VehicleProperty#EVS_SERVICE_REQUEST property. + */ +@VintfStability +@Backing(type="int") +enum EvsServiceRequestIndex { + TYPE = 0, + STATE = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceState.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ee5cd2b047051e86bae57befb6e68caf57522ac6 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceState.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by EVS_SERVICE_REQUEST to enumerate the service's state. + */ +@VintfStability +@Backing(type="int") +enum EvsServiceState { + OFF = 0, + ON = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6c621f79ad35c9e16efbf9afeea690072af14246 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceType.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by EVS_SERVICE_REQUEST to enumerate the service's type. + */ +@VintfStability +@Backing(type="int") +enum EvsServiceType { + REARVIEW = 0, + SURROUNDVIEW = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/FuelType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/FuelType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..98b1fa58a581968a9ad0bf16952b79e3631fe67f --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/FuelType.aidl @@ -0,0 +1,80 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by INFO_FUEL_TYPE to enumerate the type of fuels this vehicle uses. + * Consistent with projection protocol. + */ +@VintfStability +@Backing(type="int") +enum FuelType { + /** + * Fuel type to use if the HU does not know on which types of fuel the vehicle + * runs. The use of this value is generally discouraged outside of aftermarket units. + */ + FUEL_TYPE_UNKNOWN = 0, + /** + * Unleaded gasoline + */ + FUEL_TYPE_UNLEADED = 1, + /** + * Leaded gasoline + */ + FUEL_TYPE_LEADED = 2, + /** + * Diesel #1 + */ + FUEL_TYPE_DIESEL_1 = 3, + /** + * Diesel #2 + */ + FUEL_TYPE_DIESEL_2 = 4, + /** + * Biodiesel + */ + FUEL_TYPE_BIODIESEL = 5, + /** + * 85% ethanol/gasoline blend + */ + FUEL_TYPE_E85 = 6, + /** + * Liquified petroleum gas + */ + FUEL_TYPE_LPG = 7, + /** + * Compressed natural gas + */ + FUEL_TYPE_CNG = 8, + /** + * Liquified natural gas + */ + FUEL_TYPE_LNG = 9, + /** + * Electric + */ + FUEL_TYPE_ELECTRIC = 10, + /** + * Hydrogen fuel cell + */ + FUEL_TYPE_HYDROGEN = 11, + /** + * Fuel type to use when no other types apply. Before using this value, work with + * Google to see if the FuelType enum can be extended with an appropriate value. + */ + FUEL_TYPE_OTHER = 12, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e5b3929178e1306848ded311bcc604d9012446ef --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -0,0 +1,32 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VehiclePropValue; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable GetValueRequest { + // A unique request ID. For every client, the request ID must start with 1 + // and monotonically increase for every SetValueRequest. If it hits + // LONG_MAX (very unlikely), it must loop back to 0. + long requestId; + // The property to get, for most properties, only the property ID or area + // ID would be used to identify the property, but for some properties, other + // fields might be used. + VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequests.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequests.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3bbb88c0d3a34a4ae9b50baf2a9142b1263ccf97 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueRequests.aidl @@ -0,0 +1,32 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.GetValueRequest; +import android.os.ParcelFileDescriptor; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable GetValueRequests { + // A list of GetValueRequest to get if they fit the binder memory + // limitation. + GetValueRequest[] payloads; + // Shared memory file to store requests if they exceed binder memory + // limitation. Created by client, readable only at VHAL during the call. + // Caller could close it after the call. + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..24c57579dd70d5571d0f8ba7e66e55149e8c8c68 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -0,0 +1,33 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.StatusCode; +import android.hardware.automotive.vehicle.VehiclePropValue; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable GetValueResult { + // The ID for the request this response is for. + long requestId; + // The status for the getValue operation. If this is not OK, the getValue + // fails and prop should be ignored. + StatusCode status = StatusCode.OK; + // Contains the property value if status is OK. Must be null if status is + // not OK. + @nullable VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResults.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResults.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a8bfb2c04be83378554db28d778e4e4f5a63a222 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GetValueResults.aidl @@ -0,0 +1,31 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.GetValueResult; +import android.os.ParcelFileDescriptor; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable GetValueResults { + // The list of responses if they fit the binder memory limitation. + GetValueResult[] payloads; + // Shared memory file to store responses if they exceed binder memory + // limitation. Created by VHAL, readable only for the client. + // The client must close it after reading. + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicle.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicle.aidl new file mode 100644 index 0000000000000000000000000000000000000000..47fc54b8dc3edf395c206030d68efd278c108e6f --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicle.aidl @@ -0,0 +1,255 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.GetValueRequests; +import android.hardware.automotive.vehicle.IVehicleCallback; +import android.hardware.automotive.vehicle.SetValueRequests; +import android.hardware.automotive.vehicle.SubscribeOptions; +import android.hardware.automotive.vehicle.VehiclePropConfigs; + +// Vehicle HAL interface. +@VintfStability +interface IVehicle { + /* An invalid memory ID. */ + const long INVALID_MEMORY_ID = 0; + /* Maximum number of shared memory files for every subscription client. */ + const int MAX_SHARED_MEMORY_FILES_PER_CLIENT = 3; + + /** + * Returns a list of all property configurations supported by this vehicle + * HAL. + * + * @return A parcelable object that either contains a list of configs if + * they fit the binder memory limitation or a shared memory file that + * contains the configs. Must be parsed using + * {@code android-automotive-large-parcelable} library. + */ + VehiclePropConfigs getAllPropConfigs(); + + /** + * Returns a list of property configurations for given properties. + * + * If one of the requested VehicleProperty wasn't found it must return + * {@link StatusCode#INVALID_ARG}, otherwise a list of vehicle property + * configurations with {@link StatusCode#OK}. + * + * @param props A list of property IDs to get configurations for. + * @return A parcelable object that either contains a list of configs if + * they fit the binder memory limitation or a shared memory file that + * contains the configs. Must be parsed using + * {@code android-automotive-large-parcelable} library. + */ + VehiclePropConfigs getPropConfigs(in int[] props); + + /** + * Get vehicle property values asynchronously. + * + * The {@link IVehicleCallback#onGetValues} method will be called when + * values are fetched. The method might be called multiple times, and each + * time with a subset of properties that have been fetched. E.g., if you + * request properties [A, B, C], the callback might be called twice with + * [A, C] and with [B]. Caller should not expect any order for + * {@link IVehicleCallback#onGetValues}. + * + * If this method returns error, it means we fail to get all the properties. + * If this method returns OK, there are still chances we fail to get some + * properties, which are indicated by {@link GetValueResult#status}. + * + * For {@link VehiclePropertyChangeMode#STATIC} properties, this method must + * always return the same value. + * For {@link VehiclePropertyChangeMode#ON_CHANGE} properties, it must + * return the latest available value. For cachable properties, the value + * within cache would be returned without talking with the actual car bus. + * + * Some properties like {@code RADIO_PRESET} requires to pass additional + * data in {@link VehiclePropValue} object. + * + * If there is no data available yet, which can happen during initial stage, + * {@link GetValueResult#status} contains {@link StatusCode#TRY_AGAIN}. + * + * Caller must pass a unique RequestID for each request, if any of the + * given request ID is duplicate with one of the pending request ID, this + * function must return {@link StatusCode#INVALID_ARG}. + * + * To prevent confusion, duplicate properties (same property ID and same + * area ID) are not allowed in a single call. This function must return + * {@link StatusCode#INVALID_ARG} for duplicate properties. + * + * The {@link VehiclePropValue#timestamp} field in request is ignored. The + * {@link VehiclePropValue#timestamp} field in {@link GetValueResult} must + * be the system uptime since boot when the value changes for + * ON_CHANGE property or when the value is checked according to polling rate + * for CONTINUOUS property. Note that for CONTINUOUS property, VHAL client + * reading the property multiple times between the polling interval will get + * the same timestamp. + * + * @param callback A callback interface, whose 'onGetValues' would be called + * after the value is fetched. Caller should use + * {@code android-automotive-large-parcelable} library to parse the + * returned {@link GetValueResult} object. + * @param requests An object that contains either a list of requested + * properties or a shared memory file that contains the properties. The + * object must be parsed using helper libraries on sender and receiver. + */ + void getValues(IVehicleCallback callback, in GetValueRequests requests); + + /** + * Set vehicle property values. + * + * The {@link IVehicleCallback#onSetValues} function would be called after + * the values set request are sent through vehicle bus or failed to set. + * If the bus protocol supports confirmation, the callback would be called + * after getting the confirmation. + * + * For some vehicle bus such as CAN bus where confirmation is not supported, + * OnSetValues does not necessarily mean the value changes would be + * reflected in {@link #getValues} immediately. + * + * If the output status contains error, it means we fail to set all the + * properties. If we failed to set some of the values, they would be + * reflected as non OK {@link SetValueResult#status}. + * + * The order each property in the request is set is not guaranteed. If + * caller needs to make sure certain order in setting values, caller should + * set one value, wait for its callback and then set the other value. + * + * Timestamp of data must be ignored for set operation. + * + * Setting some properties requires having initial state available. If + * initial data is not available yet, the {@link SetValueResult#status} + * must be {@link StatusCode#TRY_AGAIN}. For a property with separate power + * control the {@link SetValueResult#status} must be + * {@link StatusCode#NOT_AVAILABLE} if property is not powered + * on. + * + * Caller must pass a unique RequestID for each request, if any of the + * given request ID is duplicate with one of the pending request ID, this + * function must return {@link StatusCode#INVALID_ARG}. + * + * To prevent confusion, duplicate properties (same property ID and same + * area ID) are not allowed in a single call. This function must return + * {@link StatusCode#INVALID_ARG} for duplicate properties. + * + * @param callback The callback, whose 'onSetValues' would be called after + * set value request is sent to bus. + * @param requests An object that contains a list of {@link SetValueRequest} + * or a shared memory file that stores the list of requests if they + * exceed binder memory limitation, must be parsed using helper libraries + * on sender and receiver. + */ + void setValues(IVehicleCallback callback, in SetValueRequests requests); + + /** + * Subscribes to property events. + * + * Clients must be able to subscribe to multiple properties at a time + * depending on data provided in options argument. + * + * For one callback, there is only one subscription for one property. + * A new subscription with a different sample rate would override the old + * subscription. One property could be subscribed multiple times for + * different callbacks. + * + * If error is returned, some of the properties failed to subscribe. + * Caller is safe to try again, since subscribing to an already subscribed + * property is okay. + * + * The specified sample rate is just a guidance. It is not guaranteed that + * the sample rate is achievable depending on how the polling refresh rate + * is. The actual property event rate might be higher/lower than the + * specified sampleRate, for example, if the polling rate can be 5 times/s + * or 10 times/s, subscribing to a sample rate of 7 might use the 5 times/s + * polling rate, thus generating 5 events/s. We only require that on + * average, the {@code minSampleRate} and {@code maxSampleRate} can be + * achieved, all the sampleRate within min and max would on average + * generates events with rate >= {@code minSampleRate} and <= + * {@code maxSampleRate}. + * + * The {@link VehiclePropValue#timestamp} field for each property event must + * be the system uptime since boot when the value changes for + * ON_CHANGE property or when the value is checked according to polling rate + * for CONTINUOUS property. Note that for CONTINUOUS property, VHAL client + * reading the property multiple times between the polling interval will get + * the same timestamp. + * For example, if the polling rate for a property is 10 times/s, no matter + * what the sampleRate specified in {@code options}, the timestamp for + * the timestamp is updated 10 times/s. + * + * @param callback The subscription callbacks. + * {@link IVehicleCallback#onPropertyEvent} would be called when a new + * property event arrives. + * {@link IVehicleCallback#onPropertySetError} would be called when a + * property set request failed asynchronously. This is usually caused by + * a property set failure message sent from the vehicle bus. + * @param options List of options to subscribe. SubscribeOption contains + * information such as property Id, area Id, sample rate, etc. + * For continuous properties, sample rate must be provided. If sample + * rate is less than {@link VehiclePropConfig#minSampleRate}, the sample + * rate would be minSampleRate. If sample rate is larger than + * {@link VehiclePropValue#maxSampleRate}, the sample rate would be + * maxSampleRate. + * @param maxSharedMemoryFileCount The maximum number of shared memory files + * allocated for in VHAL for this subscription. When a memory file is + * handled back to the client, it cannot be used by VHAL to deliver + * another event until the buffer is returned to VHAL by calling + * returnSharedMemory. A larger maxSharedMemoryFileCount means a better + * performance while handling large bursts of data, but also means larger + * memory footprint. If you don't expect events arriving very frequently, + * a recommended value is 2. A value of 0 means for each new property, + * a new shared memory file would be created and no shared memory file + * would ever be reused. This should only be configured for infrequent + * events or devices with limited memory. This value must be >=0 and + * < {@link MAX_SHARED_MEMORY_FILES_PER_CLIENT}. + */ + void subscribe(in IVehicleCallback callback, in SubscribeOptions[] options, + int maxSharedMemoryFileCount); + + /** + * Unsubscribes from property events. + * + * If 'callback' is not valid this method must return + * {@link StatusCode#INVALID_ARG}. If a specified propId was not subscribed + * before, this method must ignore that propId. + * + * If error is returned, some of the properties failed to unsubscribe. + * Caller is safe to try again, since unsubscribing an already unsubscribed + * property is okay. + * + * @param callback The callback used in the previous subscription. + * @param propIds The IDs for the properties to unsubscribe. + */ + void unsubscribe(in IVehicleCallback callback, in int[] propIds); + + /** + * Return a shared memory file back to VHAL for recycle. + * + * This must be called after a shared memory file returned by + * {@link IVehicleCallback#onPropertyEvent} is no longer in-use by the + * client. This is usually called at the end of 'onPropertyEvent'. + * + * If the 'callback' is not valid or 'sharedMemoryId' does not match any + * SharedMemoryId in 'VehiclePropValues' passed to + * {@link IVehicleCallback#onPropertyEvent}, this method must return + * {@link StatusCode#INVALID_ARG}. + * + * @param callback The callback used in subscription. + * @param sharedMemoryId The ID returned by 'onPropertyEvent' representing + * the used shared memory file to return. + */ + void returnSharedMemory(in IVehicleCallback callback, long sharedMemoryId); +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicleCallback.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicleCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b50321b42f2dd00f8471e8a008dbe755cfe5273 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicleCallback.aidl @@ -0,0 +1,99 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.GetValueResults; +import android.hardware.automotive.vehicle.SetValueResults; +import android.hardware.automotive.vehicle.StatusCode; +import android.hardware.automotive.vehicle.VehiclePropErrors; +import android.hardware.automotive.vehicle.VehiclePropValues; + +@VintfStability +interface IVehicleCallback { + /** + * Callback for {@link IVehicle#getValues} function. + * + * Called when some of the values to fetch are ready. This might be called + * once or multiple times for one 'getValues' request. Each callback + * contains part of the requested values. It is guaranteed that all the + * requested values would be returned in one of the callbacks, but the order + * each values are ready is not guaranteed. + * + * @param responses An object either contains a list of + * {@link GetValueResult} if they fits the binder memory limitation or a + * shared memory file that contains responses. Each + * {@link GetValueResult} either contains the property value or contains + * an error happened while getting the value. + * + * {@link GetValueResult} also contains a requestId which indicates which + * request this response is for. The responses object should be parsed by + * {@code android-automotive-large-parcelable} library. + */ + oneway void onGetValues(in GetValueResults responses); + + /** + * Callback for {@link IVehicle#setValues} function. + * + * Called when VHAL have finished handling some of the property set request. + * This might be called once or multiple times for one 'setValues' requests. + * Each callback contains part of the requested values. It is guaranteed + * that all the set value statuses would be returned in one of the + * callbacks, but the order each values are set is not guaranteed. + * + * @param responses A list of {@link SetValueResult}. Each SetValueResult + * contains a status indicating the status for setting the specific + * property. The requestId indicates which request the response is for. + */ + oneway void onSetValues(in SetValueResults responses); + + /** + * Event callback happens whenever one or more variables that the API user + * has subscribed to need to be reported. This may be based purely on + * threshold and frequency (a regular subscription, see subscribe call's + * arguments) or when the {@link IVehicle#setValues} method was called and + * the actual change needs to be reported. + * + * @param propValues The updated property values wrapped in an object. + * If the properties fit within binder limitation, they would be in + * {@code propValues.payloads}, otherwise, they would be in a shared + * memory file {@code propValues.sharedMemoryFd}. + * The shared memory file is created by VHAL and must be returned to + * VHAL using {@link IVehicle#returnSharedMemory} after use. There are + * limited number of memory files created for each subscription, if + * the client doesn't return the shared memory, the client might not get + * event in the future. + * @param sharedMemoryFileCount Number of shared memory file allocated for + * this subscription. This value could be used to tweak + * {@code maxSharedMemoryFileCount} in {@link IVehicle#subscribe}. For + * example, if you usually see sharedMemoryFileCount being the + * maxSharedMemoryFileCount you set, this means you might need to + * increase maxSharedMemoryFileCount. + */ + oneway void onPropertyEvent(in VehiclePropValues propValues, int sharedMemoryFileCount); + + /** + * Set property value is usually asynchronous operation. Thus even if + * client received {@link StatusCode#OK} from {@link IVehicle#setValues}, or + * received {@link StatusCode#OK} in {@link #onSetValues}, this doesn't + * guarantee that the value was successfully propagated to the vehicle + * network. If such rare event occurs this method must be called. + * + * @param errors A list of property set errors. If the VHAL implementation + * does not batch the errors, this may only contain one error. + */ + oneway void onPropertySetError(in VehiclePropErrors errors); +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c7ba836ab7fdd10e9dd78c4660d4595976a74214 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl @@ -0,0 +1,43 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.InitialUserInfoRequestType; +import android.hardware.automotive.vehicle.UsersInfo; + +/** + * Defines the format of a INITIAL_USER_INFO request made by the Android system. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable InitialUserInfoRequest { + /** + * Arbitrary id used to map the HAL response to the request. + */ + int requestId; + /** + * Type of request. + */ + InitialUserInfoRequestType requestType = InitialUserInfoRequestType.UNKNOWN; + /** + * Information about the current state of the Android system. + */ + UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..829a63ad20deb74119578f4a1906e2fd113227c3 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl @@ -0,0 +1,42 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Defines when a INITIAL_USER_INFO request was made. + */ +@VintfStability +@Backing(type="int") +enum InitialUserInfoRequestType { + UNKNOWN = 0, + /** + * At the first time Android was booted (or after a factory reset). + */ + FIRST_BOOT = 1, + /** + * At the first time Android was booted after the system was updated. + */ + FIRST_BOOT_AFTER_OTA = 2, + /** + * When Android was booted "from scratch". + */ + COLD_BOOT = 3, + /** + * When Android was resumed after the system was suspended to memory. + */ + RESUME = 4, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4c46fcb1643e1bca769bd07e453502475dd89e14 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl @@ -0,0 +1,52 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.InitialUserInfoResponseAction; +import android.hardware.automotive.vehicle.UserInfo; + +/** + * Defines the format of a HAL response to a INITIAL_USER_INFO request. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable InitialUserInfoResponse { + /** + * Id of the request being responded. + */ + int requestId; + /** + * which action the Android system should take. + */ + InitialUserInfoResponseAction action = InitialUserInfoResponseAction.DEFAULT; + /** + * Information about the user that should be switched to or created. + */ + UserInfo userToSwitchOrCreate; + /** + * System locales of the initial user (value will be passed as-is to + * android.provider.Settings.System.SYSTEM_LOCALES) + */ + @utf8InCpp String userLocales; + /** + * Name of the user that should be created. + */ + @utf8InCpp String userNameToCreate; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9a0741e414cce2db4cf9b01e6da5cfeca1031bb8 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl @@ -0,0 +1,40 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Defines which action the Android system should take in an INITIAL_USER_INFO request. + */ +@VintfStability +@Backing(type="int") +enum InitialUserInfoResponseAction { + /** + * Let the Android System decide what to do. + * + * For example, it might create a new user on first boot, and switch to the last + * active user afterwards. + */ + DEFAULT = 0, + /** + * Switch to an existing Android user. + */ + SWITCH = 1, + /** + * Create a new Android user (and switch to it). + */ + CREATE = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c1bba8ee8ce883822bff49a528249dbfd0774f1a --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl @@ -0,0 +1,32 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Ignition monitors common to both SPARK and COMPRESSION. + * These values come from the SAE J1979 standard. + */ +@VintfStability +@Backing(type="int") +enum Obd2CommonIgnitionMonitors { + COMPONENTS_AVAILABLE = 0x1 << 0, + COMPONENTS_INCOMPLETE = 0x1 << 1, + FUEL_SYSTEM_AVAILABLE = 0x1 << 2, + FUEL_SYSTEM_INCOMPLETE = 0x1 << 3, + MISFIRE_AVAILABLE = 0x1 << 4, + MISFIRE_INCOMPLETE = 0x1 << 5, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ccb49aa1b51f8f5f6a9a9cea9eaecf5b2306e194 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl @@ -0,0 +1,46 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.Obd2CommonIgnitionMonitors; + +/** + * Ignition monitors only available for COMPRESSION vehicles. + * These values come from the SAE J1979 standard. + */ +@VintfStability +@Backing(type="int") +enum Obd2CompressionIgnitionMonitors { + COMPONENTS_AVAILABLE = 0x1 << 0, + COMPONENTS_INCOMPLETE = 0x1 << 1, + FUEL_SYSTEM_AVAILABLE = 0x1 << 2, + FUEL_SYSTEM_INCOMPLETE = 0x1 << 3, + MISFIRE_AVAILABLE = 0x1 << 4, + MISFIRE_INCOMPLETE = 0x1 << 5, + EGR_OR_VVT_AVAILABLE = 0x1 << 6, + EGR_OR_VVT_INCOMPLETE = 0x1 << 7, + PM_FILTER_AVAILABLE = 0x1 << 8, + PM_FILTER_INCOMPLETE = 0x1 << 9, + EXHAUST_GAS_SENSOR_AVAILABLE = 0x1 << 10, + EXHAUST_GAS_SENSOR_INCOMPLETE = 0x1 << 11, + BOOST_PRESSURE_AVAILABLE = 0x1 << 12, + BOOST_PRESSURE_INCOMPLETE = 0x1 << 13, + NOx_SCR_AVAILABLE = 0x1 << 14, + NOx_SCR_INCOMPLETE = 0x1 << 15, + NMHC_CATALYST_AVAILABLE = 0x1 << 16, + NMHC_CATALYST_INCOMPLETE = 0x1 << 17, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8266ee2c983584c5cbfedc46c94d5a75c7bdcfa3 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl @@ -0,0 +1,31 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * The status of the vehicle's fuel system. + * These values come from the SAE J1979 standard. + */ +@VintfStability +@Backing(type="int") +enum Obd2FuelSystemStatus { + OPEN_INSUFFICIENT_ENGINE_TEMPERATURE = 1, + CLOSED_LOOP = 2, + OPEN_ENGINE_LOAD_OR_DECELERATION = 4, + OPEN_SYSTEM_FAILURE = 8, + CLOSED_LOOP_BUT_FEEDBACK_FAULT = 16, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c7b4f7773c60cad8cf807c8a8b1511debb6eaf50 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelType.aidl @@ -0,0 +1,50 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * The fuel type(s) supported by a vehicle. + * These values come from the SAE J1979 standard. + */ +@VintfStability +@Backing(type="int") +enum Obd2FuelType { + NOT_AVAILABLE = 0, + GASOLINE = 1, + METHANOL = 2, + ETHANOL = 3, + DIESEL = 4, + LPG = 5, + CNG = 6, + PROPANE = 7, + ELECTRIC = 8, + BIFUEL_RUNNING_GASOLINE = 9, + BIFUEL_RUNNING_METHANOL = 10, + BIFUEL_RUNNING_ETHANOL = 11, + BIFUEL_RUNNING_LPG = 12, + BIFUEL_RUNNING_CNG = 13, + BIFUEL_RUNNING_PROPANE = 14, + BIFUEL_RUNNING_ELECTRIC = 15, + BIFUEL_RUNNING_ELECTRIC_AND_COMBUSTION = 16, + HYBRID_GASOLINE = 17, + HYBRID_ETHANOL = 18, + HYBRID_DIESEL = 19, + HYBRID_ELECTRIC = 20, + HYBRID_RUNNING_ELECTRIC_AND_COMBUSTION = 21, + HYBRID_REGENERATIVE = 22, + BIFUEL_RUNNING_DIESEL = 23, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7399f7bb97c8621b89f2947fd4805ffacc1f6b68 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Defines which ignition monitors are available to be read. + */ +@VintfStability +@Backing(type="int") +enum Obd2IgnitionMonitorKind { + SPARK = 0, + COMPRESSION = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..06748caea053475360da2cbff3cfe0426af5ccb6 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * The status of the vehicle's secondary air system. + * These values come from the SAE J1979 standard. + */ +@VintfStability +@Backing(type="int") +enum Obd2SecondaryAirStatus { + UPSTREAM = 1, + DOWNSTREAM_OF_CATALYCIC_CONVERTER = 2, + FROM_OUTSIDE_OR_OFF = 4, + PUMP_ON_FOR_DIAGNOSTICS = 8, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d814b5edfc13b9a277866776106f850024684efe --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl @@ -0,0 +1,50 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.Obd2CommonIgnitionMonitors; + +/** + * Ignition monitors available for SPARK vehicles. + * These values come from the SAE J1979 standard. + */ +@VintfStability +@Backing(type="int") +enum Obd2SparkIgnitionMonitors { + COMPONENTS_AVAILABLE = 0x1 << 0, + COMPONENTS_INCOMPLETE = 0x1 << 1, + FUEL_SYSTEM_AVAILABLE = 0x1 << 2, + FUEL_SYSTEM_INCOMPLETE = 0x1 << 3, + MISFIRE_AVAILABLE = 0x1 << 4, + MISFIRE_INCOMPLETE = 0x1 << 5, + EGR_AVAILABLE = 0x1 << 6, + EGR_INCOMPLETE = 0x1 << 7, + OXYGEN_SENSOR_HEATER_AVAILABLE = 0x1 << 8, + OXYGEN_SENSOR_HEATER_INCOMPLETE = 0x1 << 9, + OXYGEN_SENSOR_AVAILABLE = 0x1 << 10, + OXYGEN_SENSOR_INCOMPLETE = 0x1 << 11, + AC_REFRIGERANT_AVAILABLE = 0x1 << 12, + AC_REFRIGERANT_INCOMPLETE = 0x1 << 13, + SECONDARY_AIR_SYSTEM_AVAILABLE = 0x1 << 14, + SECONDARY_AIR_SYSTEM_INCOMPLETE = 0x1 << 15, + EVAPORATIVE_SYSTEM_AVAILABLE = 0x1 << 16, + EVAPORATIVE_SYSTEM_INCOMPLETE = 0x1 << 17, + HEATED_CATALYST_AVAILABLE = 0x1 << 18, + HEATED_CATALYST_INCOMPLETE = 0x1 << 19, + CATALYST_AVAILABLE = 0x1 << 20, + CATALYST_INCOMPLETE = 0x1 << 21, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/PortLocationType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/PortLocationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ce26e1c3f088802a42892d4ca75495718be3be58 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/PortLocationType.aidl @@ -0,0 +1,37 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by INFO_FUEL_DOOR_LOCATION/INFO_CHARGE_PORT_LOCATION to enumerate fuel door or + * ev port location. + */ +@VintfStability +@Backing(type="int") +enum PortLocationType { + /** + * Default type if the vehicle does not know or report the Fuel door + * and ev port location. + */ + UNKNOWN = 0, + FRONT_LEFT = 1, + FRONT_RIGHT = 2, + REAR_RIGHT = 3, + REAR_LEFT = 4, + FRONT = 5, + REAR = 6, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4dec77289759d53e3c21c10b5e537c51057fcc00 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl @@ -0,0 +1,38 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * The reason why a process is terminated by car watchdog. + * This is used with WATCHDOG_TERMINATED_PROCESS property. + */ +@VintfStability +@Backing(type="int") +enum ProcessTerminationReason { + /** + * A process doesn't respond to car watchdog within the timeout. + */ + NOT_RESPONDING = 1, + /** + * A process uses more IO operations than what is allowed. + */ + IO_OVERUSE = 2, + /** + * A process uses more memory space than what is allowed. + */ + MEMORY_OVERUSE = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9c6875b0b5104f81981353d74e306da82f57e37e --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -0,0 +1,42 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable RawPropValues { + /** + * This is used for properties of types VehiclePropertyType#INT + * and VehiclePropertyType#INT_VEC + */ + int[] int32Values = {}; + + /** + * This is used for properties of types VehiclePropertyType#FLOAT + * and VehiclePropertyType#FLOAT_VEC + */ + float[] floatValues; + + /** This is used for properties of type VehiclePropertyType#INT64 */ + long[] int64Values; + + /** This is used for properties of type VehiclePropertyType#BYTES */ + byte[] byteValues; + + /** This is used for properties of type VehiclePropertyType#STRING */ + @utf8InCpp String stringValue; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RemoveUserRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RemoveUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cb61da85eb4a37d14cb8e0ceed8fd30126ed6f98 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RemoveUserRequest.aidl @@ -0,0 +1,43 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserInfo; +import android.hardware.automotive.vehicle.UsersInfo; + +/** + * Defines the format of a REMOVE_USER property. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable RemoveUserRequest { + /** + * Arbitrary id used to map the response to the request. + */ + int requestId; + /** + * Information about the Android user that was removed. + */ + UserInfo removedUserInfo; + /** + * Information about the current state of the Android system. + */ + UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RotaryInputType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RotaryInputType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5f08ed7d0331176688ce88be6486e42f6694c6f0 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RotaryInputType.aidl @@ -0,0 +1,34 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * A rotary control which can rotate without limits. These controls use HW_ROTARY_INPUT to report + * relative clockwise or counterclockwise motion. They have no absolute position. + */ +@VintfStability +@Backing(type="int") +enum RotaryInputType { + /** + * Main rotary control, typically in the center console, used to navigate the user interface. + */ + ROTARY_INPUT_TYPE_SYSTEM_NAVIGATION = 0, + /** + * Volume control for adjusting audio volume. + */ + ROTARY_INPUT_TYPE_AUDIO_VOLUME = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..625f9010e71e88a388db71ab8d4facaffd83f95d --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VehiclePropValue; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable SetValueRequest { + // A unique request ID. For every client, the request ID must start with 1 + // and monotonically increase for every SetValueRequest. If it hits + // LONG_MAX (very unlikely), it must loop back to 0. + long requestId; + // The value to set. + VehiclePropValue value; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequests.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequests.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a690fa2786972cfa6db0a3b7602228f950301b19 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueRequests.aidl @@ -0,0 +1,31 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.SetValueRequest; +import android.os.ParcelFileDescriptor; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable SetValueRequests { + // The list of request if they fit the binder memory limitation. + SetValueRequest[] payloads; + // Shared memory file to store requests if they exceed binder memory + // limitation. Created by client, readable only at VHAL during the call. + // Caller could close it after the call. + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b3feeaa1e1122399d2eeee964f9e9fd065c57a55 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -0,0 +1,28 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.StatusCode; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable SetValueResult { + // The ID for the request this response is for. + long requestId; + // The status for the setValue operation. + StatusCode status = StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResults.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResults.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9b0e505ee41ece996d1d9f25e4000eb275fa49eb --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SetValueResults.aidl @@ -0,0 +1,31 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.SetValueResult; +import android.os.ParcelFileDescriptor; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable SetValueResults { + // The list of responses if they fit the binder memory limitation. + SetValueResult[] payloads; + // Shared memory file to store responses if they exceed binder memory + // limitation. Created by VHAL, readable only for the client. + // The client must close it after reading. + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..23019cada8e03cd88f634ab48a0c61374141d918 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl @@ -0,0 +1,48 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Error codes used in vehicle HAL interface. + */ +@VintfStability +@Backing(type="int") +enum StatusCode { + OK = 0, + /** + * Try again. + */ + TRY_AGAIN = 1, + /** + * Invalid argument provided. + */ + INVALID_ARG = 2, + /** + * This code must be returned when device that associated with the vehicle + * property is not available. For example, when client tries to set HVAC + * temperature when the whole HVAC unit is turned OFF. + */ + NOT_AVAILABLE = 3, + /** + * Access denied + */ + ACCESS_DENIED = 4, + /** + * Something unexpected has happened in Vehicle HAL + */ + INTERNAL_ERROR = 5, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e68f7e3631a008afbdc0b898eba4d508a59f37fa --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -0,0 +1,42 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Encapsulates information about subscription to vehicle property events. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable SubscribeOptions { + /** Property to subscribe */ + int propId; + /** + * Optional areas to subscribe for this property, if empty, would subscribe + * to all areas configured for this property. + */ + int[] areaIds; + /** + * Sample rate in Hz. + * + * Must be provided for properties with + * VehiclePropertyChangeMode::CONTINUOUS. The value must be within + * VehiclePropConfig#minSamplingRate .. VehiclePropConfig#maxSamplingRate + * for a given property. + * This value indicates how many updates per second client wants to receive. + */ + float sampleRate; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f6ace54b7cc74d6a7cd71ec128b541f71fc5722c --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl @@ -0,0 +1,33 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Defines the reason a SWITCH_USER call was made. + * + * The meaning of each constant is explained in that property. + */ +@VintfStability +@Backing(type="int") +enum SwitchUserMessageType { + UNKNOWN = 0, + LEGACY_ANDROID_SWITCH = 1, + ANDROID_SWITCH = 2, + VEHICLE_RESPONSE = 3, + VEHICLE_REQUEST = 4, + ANDROID_POST_SWITCH = 5, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..320632cc6a523bbfb627afab473c311536c5433b --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserRequest.aidl @@ -0,0 +1,52 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.SwitchUserMessageType; +import android.hardware.automotive.vehicle.UserInfo; +import android.hardware.automotive.vehicle.UsersInfo; + +/** + * Defines the format of a SWITCH_USER property. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable SwitchUserRequest { + /** + * Arbitrary id used to map the response to the request. + */ + int requestId; + /** + * Type of message. + */ + SwitchUserMessageType messageType = SwitchUserMessageType.UNKNOWN; + /** + * Information about the Android user being switched to. + * + * Only the user id (but not the flags) should be set when the request is made by HAL. + */ + UserInfo targetUser; + /** + * Information about the current state of the Android system. + * + * Should not be set when the request is made by HAL. + */ + UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserResponse.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..106386dd4a8974078ff3484763a08e251ea50db3 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserResponse.aidl @@ -0,0 +1,50 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.SwitchUserMessageType; +import android.hardware.automotive.vehicle.SwitchUserStatus; + +/** + * Defines the result of a SwitchUserRequest. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable SwitchUserResponse { + /** + * Id of the request being responded. + */ + int requestId; + /** + * Type of message. + */ + SwitchUserMessageType messageType = SwitchUserMessageType.UNKNOWN; + /** + * Status of the request. + */ + SwitchUserStatus status = SwitchUserStatus.SUCCESS; + /** + * HAL-specific error message. + * + * This argument is optional, and when defined, it's passed "as-is" to the caller. It could be + * used to show custom error messages to the end user. + */ + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserStatus.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a84d1ce57a565f3cc3ce0d81ec641605918d0188 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserStatus.aidl @@ -0,0 +1,33 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Status of the response to a SwitchUserRequest. + */ +@VintfStability +@Backing(type="int") +enum SwitchUserStatus { + /** + * The request succeeded and the HAL user was switched. + */ + SUCCESS = 1, + /** + * The request failed and the HAL user remained the same. + */ + FAILURE = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fd420626d6640fa8d32f76e8fdc71fafa01042d5 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * 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/UserIdentificationAssociation.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4af5f72eb5e85cde263f723fab2632b69b3f9692 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserIdentificationAssociationType; +import android.hardware.automotive.vehicle.UserIdentificationAssociationValue; + +/** + * Helper struct used when getting a user/identification association type. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable UserIdentificationAssociation { + UserIdentificationAssociationType type = UserIdentificationAssociationType.INVALID; + UserIdentificationAssociationValue value = UserIdentificationAssociationValue.UNKNOWN; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..eceb30fd0e625cb57c98c601cca238fc4d1366bc --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl @@ -0,0 +1,38 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used to set a UserIdentificationAssociationType with an Android user. + */ +@VintfStability +@Backing(type="int") +enum UserIdentificationAssociationSetValue { + INVALID = 0, + /** + * Associate the identification type with the current foreground Android user. + */ + ASSOCIATE_CURRENT_USER = 1, + /** + * Disassociate the identification type from the current foreground Android user. + */ + DISASSOCIATE_CURRENT_USER = 2, + /** + * Disassociate the identification type from all Android users. + */ + DISASSOCIATE_ALL_USERS = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b21b5a1a8b23a99b999c528a6614717ee4befb2 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl @@ -0,0 +1,48 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Types of mechanisms used to identify an Android user. + * + * See USER_IDENTIFICATION_ASSOCIATION for more details and example. + */ +@VintfStability +@Backing(type="int") +enum UserIdentificationAssociationType { + INVALID = 0, + /** + * Key used to unlock the car. + */ + KEY_FOB = 1, + /** + * Custom mechanism defined by the OEM. + */ + CUSTOM_1 = 101, + /** + * Custom mechanism defined by the OEM. + */ + CUSTOM_2 = 102, + /** + * Custom mechanism defined by the OEM. + */ + CUSTOM_3 = 103, + /** + * Custom mechanism defined by the OEM. + */ + CUSTOM_4 = 104, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..28dad0d3a7a469e7fb7ec45b548923041d3f4e5e --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl @@ -0,0 +1,43 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Whether a UserIdentificationAssociationType is associate with an Android user. + */ +@VintfStability +@Backing(type="int") +enum UserIdentificationAssociationValue { + /** + * Used when the status of an association could not be determined. + * + * For example, in a set() request, it would indicate a failure to set the given type. + */ + UNKNOWN = 1, + /** + * The identification type is associated with the current foreground Android user. + */ + ASSOCIATED_CURRENT_USER = 2, + /** + * The identification type is associated with another Android user. + */ + ASSOCIATED_ANOTHER_USER = 3, + /** + * The identification type is not associated with any Android user. + */ + NOT_ASSOCIATED_ANY_USER = 4, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82580d795ebcccf8dd10f8fe4c5c21d195fac80a --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl @@ -0,0 +1,47 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserIdentificationAssociationType; +import android.hardware.automotive.vehicle.UserInfo; + +/** + * Defines the format of a get() call to USER_IDENTIFICATION_ASSOCIATION. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable UserIdentificationGetRequest { + /** + * Id of the request being responded. + */ + int requestId; + /** + * Information about the current foreground Android user. + */ + UserInfo userInfo; + /** + * Number of association being queried. + */ + int numberAssociationTypes; + /** + * Types of association being queried. + */ + UserIdentificationAssociationType[] associationTypes; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1487a709504a0375fc2f3e26da20ad18f2fa3eb6 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl @@ -0,0 +1,49 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserIdentificationAssociation; + +/** + * Defines the result of a USER_IDENTIFICATION_ASSOCIATION - both for get() and set(). + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable UserIdentificationResponse { + /** + * Id of the request being responded. + */ + int requestId; + /** + * Number of associations being returned. + */ + int numberAssociation; + /** + * Values associated with the user. + */ + UserIdentificationAssociation[] associations; + /** + * HAL-specific error message. + * + * This argument is optional, and when defined, it's passed "as-is" to the caller. It could be + * used to show custom error messages to the end user. + */ + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bfb9544be7f9c21875dbf24f0ee5dca211a08df0 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserIdentificationAssociationSetValue; +import android.hardware.automotive.vehicle.UserIdentificationAssociationType; + +/** + * Helper struct used when setting a user/identification association type. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable UserIdentificationSetAssociation { + UserIdentificationAssociationType type = UserIdentificationAssociationType.INVALID; + UserIdentificationAssociationSetValue value = UserIdentificationAssociationSetValue.INVALID; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..223ff08e7b29984a5d567763d60dcf81babaf3dd --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl @@ -0,0 +1,46 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserIdentificationSetAssociation; +import android.hardware.automotive.vehicle.UserInfo; + +/** + * Defines the format of a set() call to USER_IDENTIFICATION_ASSOCIATION. + * + * NOTE: this struct is not used in the HAL properties directly, it must be converted to + * VehiclePropValue.RawValue through libraries provided by the default Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable UserIdentificationSetRequest { + /** + * Id of the request being responded. + */ + int requestId; + /** + * Information about the current foreground Android user. + */ + UserInfo userInfo; + /** + * Number of association being set. + */ + int numberAssociations; + /** + * Associations being set. + */ + UserIdentificationSetAssociation[] associations; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..20c72bd6e5175f6bf8f17a7aaaa2bde15396f4b1 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserInfo.aidl @@ -0,0 +1,60 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Information about a specific Android user. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable UserInfo { + /** + * System user. + * + * On automotive, that user is always running, although never on foreground (except during + * boot or exceptional circumstances). + */ + const int USER_FLAG_SYSTEM = 0x01; + /** + * Guest users have restrictions. + */ + const int USER_FLAG_GUEST = 0x02; + /** + * Ephemeral users have non-persistent state. + */ + const int USER_FLAG_EPHEMERAL = 0x04; + /** + * Admin users have additional privileges such as permission to create other users. + */ + const int USER_FLAG_ADMIN = 0x08; + /** + * Disabled users are marked for deletion. + */ + const int USER_FLAG_DISABLED = 0x10; + /** + * Profile user is a profile of another user. + */ + const int USER_FLAG_PROFILE = 0x20; + /* + * The user ID. + */ + int userId = 0; + /* + * Bitmask for the user flags defined above (USER_FLAG_*). + */ + int flags; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UsersInfo.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UsersInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ede36f778ffa9877304ca4b85e46a517b9b6d1ae --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UsersInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.UserInfo; + +/** + * Information about all Android users. + * + * NOTE: this struct is not used in the HAL properties directly, it's part of other structs, which + * in turn are converted to a VehiclePropValue.RawValue through libraries provided by the default + * Vehicle HAL implementation. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable UsersInfo { + /** + * The current foreground user. + */ + UserInfo currentUser; + /** + * Number of existing users; includes the current user, recently removed users (with DISABLED + * flag), and profile users (with PROFILE flag). + */ + int numberUsers; + /** + * List of existing users; includes the current user, recently removed users (with DISABLED + * flag), and profile users (with PROFILE flag). + */ + UserInfo[] existingUsers; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b0190cea45e2e6a82ddd4a979e721178d6397a2 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.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. + */ + +package android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleApPowerStateConfigFlag { + /** + * AP can enter deep sleep state. If not set, AP will shutdown from + * VehicleApPowerState#SHUTDOWN_PREPARE power state when deep sleep is requested + * (via VehicleApPowerStateShutdownParam#CAN_SLEEP or + * VehicleApPowerStateShutdownParam#SLEEP_IMMEDIATELY flags)/ + */ + ENABLE_DEEP_SLEEP_FLAG = 0x1, + /** + * The power controller can power on AP from off state after timeout + * specified in VehicleApPowerSet VEHICLE_AP_POWER_SET_SHUTDOWN_READY message. + */ + CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2, + /** + * AP can enter hibernation state. If not set, AP will shutdown from + * VehicleApPowerState#SHUTDOWN_PREPARE when hibernation is requested + * (via VehicleApPowerStateShutdownParam#CAN_HIBERNATE or + * VehicleApPowerStateShutdownParam#HIBERNATE_IMMEDIATELY flags) + */ + ENABLE_HIBERNATION_FLAG = 0x4, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e94fc76cf481e1f00836d0c52bd7dd0dbd3ce1c6 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl @@ -0,0 +1,110 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleApPowerStateReport { + /** + * The device has booted. CarService has initialized and is ready to accept commands + * from VHAL. The user is not logged in, and vendor apps and services are expected to + * control the display and audio. + * After reporting this state, AP will accept VehicleApPowerStateReq#ON or + * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored. + */ + WAIT_FOR_VHAL = 0x1, + /** + * AP is ready to suspend. + * The AP will not send any more state reports after this. + * After reporting this state, AP will accept VehicleApPowerStateReq#FINISHED. + * Other power state requests are ignored. + * + * int32Values[1]: Time to turn AP back on, in seconds. Power controller should turn on + * AP after the specified time has elapsed, so AP can run tasks like + * update. If this value is 0, no wake up is requested. The power + * controller may not necessarily support timed wake-up. + */ + DEEP_SLEEP_ENTRY = 0x2, + /** + * AP is exiting from deep sleep state. + * After reporting this state, AP will accept VehicleApPowerStateReq#ON or + * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored. + */ + DEEP_SLEEP_EXIT = 0x3, + /** + * AP sends this message repeatedly while cleanup and idle tasks execute. + * After reporting this state, AP will accept VehicleApPowerStateReq#SHUTDOWN_PREPARE + * requesting immediate shutdown or VehicleApPowerStateReq#CANCEL_SHUTDOWN. Other + * power state requests are ignored. + * + * int32Values[1]: Time to postpone shutdown in ms. Maximum value is + * 5000 ms. + * If AP needs more time, it will send another SHUTDOWN_POSTPONE + * message before the previous one expires. + */ + SHUTDOWN_POSTPONE = 0x4, + /** + * AP is ready to shutdown. + * The AP will not send any more state reports after this. + * After reporting this state, AP will accept VehicleApPowerStateReq#FINISHED. + * Other power state requests are ignored. + * + * int32Values[1]: Time to turn AP back on, in seconds. Power controller should turn on + * AP after the specified time has elapsed so AP can run tasks like + * update. If this value is 0, no wake up is specified. The power + * controller may not necessarily support timed wake-up. + */ + SHUTDOWN_START = 0x5, + /** + * AP is entering its normal operating state. + * After reporting this state, AP will accept VehicleApPowerStateReq#SHUTDOWN_PREPARE. + * Other power state requests are ignored. + */ + ON = 0x6, + /** + * AP is preparing to shut down. In this state, Garage Mode is active and idle + * tasks are allowed to run. + * After reporting this state, AP will accept VehicleApPowerStateReq#SHUTDOWN_PREPARE + * requesting immediate shutdown or VehicleApPowerStateReq#CANCEL_SHUTDOWN. Other + * power state requests are ignored. + */ + SHUTDOWN_PREPARE = 0x7, + /** + * AP has stopped preparing to shut down. + * After reporting this state, AP will accept VehicleApPowerStateReq#ON or + * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored. + */ + SHUTDOWN_CANCELLED = 0x8, + /** + * AP is ready to hibernate. + * The AP will not send any more state reports after this. + * After reporting this state, AP will accept VehicleApPowerStateReq#FINISHED. + * Other power state requests are ignored. + * + * int32Values[1]: Time to turn AP back on, in seconds. Power controller should turn on + * AP after the specified time has elapsed, so AP can run tasks like + * update. If this value is 0, no wake up is requested. The power + * controller may not necessarily support timed wake-up. + */ + HIBERNATION_ENTRY = 0x9, + /** + * AP is exiting from hibernation state. + * After reporting this state, AP will accept VehicleApPowerStateReq#ON or + * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored. + */ + HIBERNATION_EXIT = 0xA, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1031ebbfaa218d112d8eff56c0e702fe04153190 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl @@ -0,0 +1,69 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleApPowerStateReq { + /** + * This requests Android to enter its normal operating state. + * This may be sent after the AP has reported + * VehicleApPowerStateReport#DEEP_SLEEP_EXIT, + * VehicleApPowerStateReport#HIBERNATION_EXIT, + * VehicleApPowerStateReport#SHUTDOWN_CANCELLED, or + * VehicleApPowerStateReport#WAIT_FOR_VHAL. + */ + ON = 0, + /** + * The power controller issues this request to shutdown the system. + * This may be sent after the AP has reported + * VehicleApPowerStateReport#DEEP_SLEEP_EXIT, + * VehicleApPowerStateReport#HIBERNATION_EXIT, + * VehicleApPowerStateReport#ON, + * VehicleApPowerStateReport#SHUTDOWN_CANCELLED, + * VehicleApPowerStateReport#SHUTDOWN_POSTPONE, + * VehicleApPowerStateReport#SHUTDOWN_PREPARE, or + * VehicleApPowerStateReport#WAIT_FOR_VHAL. + * + * int32Values[1] : One of VehicleApPowerStateShutdownParam. + * This parameter indicates if the AP should shut + * down fully or sleep. This parameter also + * indicates if the shutdown should be immediate + * or if it can be postponed. If the shutdown can + * be postponed, AP requests postponing by sending + * VehicleApPowerStateReport#SHUTDOWN_POSTPONE. + */ + SHUTDOWN_PREPARE = 1, + /** + * Cancel the shutdown. + * This may be sent after the AP has reported + * VehicleApPowerStateReport#SHUTDOWN_POSTPONE or + * VehicleApPowerStateReport#SHUTDOWN_PREPARE. + * After receiving this request, the AP will report + * VehicleApPowerStateReport#WAIT_FOR_VHAL in preparation to going ON. + */ + CANCEL_SHUTDOWN = 2, + /** + * Completes the shutdown process. + * This may be sent after the AP has reported + * VehicleApPowerStateReport#DEEP_SLEEP_ENTRY or + * VehicleApPowerStateReport#HIBERNATION_ENTRY or + * VehicleApPowerStateReport#SHUTDOWN_START. The AP will not report new + * state information after receiving this request. + */ + FINISHED = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aa556b081c9ab755ac288ade3ee34bedaf331444 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Index in int32Values for VehicleProperty#AP_POWER_STATE_REQ property. + */ +@VintfStability +@Backing(type="int") +enum VehicleApPowerStateReqIndex { + STATE = 0, + ADDITIONAL = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a863d1423de2db83d5bb84d316ccdecd98ae3082 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl @@ -0,0 +1,48 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleApPowerStateShutdownParam { + /** + * AP must shutdown immediately. Postponing is not allowed. + */ + SHUTDOWN_IMMEDIATELY = 1, + /** + * AP can enter deep sleep instead of shutting down completely. + */ + CAN_SLEEP = 2, + /** + * AP can only shutdown with postponing allowed. + */ + SHUTDOWN_ONLY = 3, + /** + * AP may enter deep sleep, but must either sleep or shut down immediately. + * Postponing is not allowed. + */ + SLEEP_IMMEDIATELY = 4, + /** + * AP must hibernate (suspend to disk) immediately. Postponing is not allowed. + * Depending on the actual implementation, it may shut down immediately + */ + HIBERNATE_IMMEDIATELY = 5, + /** + * AP can enter hibernation (suspend to disk) instead of shutting down completely. + */ + CAN_HIBERNATE = 6, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleArea.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dab03496cbb97de8f54fa58549b681d90141f88b --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -0,0 +1,35 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleArea { + GLOBAL = 0x01000000, + /** WINDOW maps to enum VehicleAreaWindow */ + WINDOW = 0x03000000, + /** MIRROR maps to enum VehicleAreaMirror */ + MIRROR = 0x04000000, + /** SEAT maps to enum VehicleAreaSeat */ + SEAT = 0x05000000, + /** DOOR maps to enum VehicleAreaDoor */ + DOOR = 0x06000000, + /** WHEEL maps to enum VehicleAreaWheel */ + WHEEL = 0x07000000, + + MASK = 0x0f000000, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b44996dc7ef3c5a279c3698a3e2b001a6e76057b --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -0,0 +1,43 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VehicleAreaConfig { + /** + * Area id is ignored for VehiclePropertyGroup:GLOBAL properties. + */ + int areaId; + + /** + * If the property has @data_enum, leave the range to zero. + * + * Range will be ignored in the following cases: + * - The VehiclePropertyType is not INT32, INT64 or FLOAT. + * - Both of min value and max value are zero. + */ + + int minInt32Value; + int maxInt32Value; + + long minInt64Value; + long maxInt64Value; + + float minFloatValue; + float maxFloatValue; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b729b8b838e1881aac49c904c0249316db1ab385 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleAreaDoor { + ROW_1_LEFT = 0x00000001, + ROW_1_RIGHT = 0x00000004, + ROW_2_LEFT = 0x00000010, + ROW_2_RIGHT = 0x00000040, + ROW_3_LEFT = 0x00000100, + ROW_3_RIGHT = 0x00000400, + HOOD = 0x10000000, + REAR = 0x20000000, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e1fd03b904d316f44a6fa91a1543a9f78e4e90ad --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl @@ -0,0 +1,25 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleAreaMirror { + DRIVER_LEFT = 0x00000001, + DRIVER_RIGHT = 0x00000002, + DRIVER_CENTER = 0x00000004, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl new file mode 100644 index 0000000000000000000000000000000000000000..89d50ea183da3ddb4397d58b611d24c87355f518 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl @@ -0,0 +1,34 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Various Seats in the car. + */ +@VintfStability +@Backing(type="int") +enum VehicleAreaSeat { + ROW_1_LEFT = 0x0001, + ROW_1_CENTER = 0x0002, + ROW_1_RIGHT = 0x0004, + ROW_2_LEFT = 0x0010, + ROW_2_CENTER = 0x0020, + ROW_2_RIGHT = 0x0040, + ROW_3_LEFT = 0x0100, + ROW_3_CENTER = 0x0200, + ROW_3_RIGHT = 0x0400, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..89f73cb6566a502b403709e7cd3938229bd8fa6b --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleAreaWheel { + UNKNOWN = 0x0, + LEFT_FRONT = 0x1, + RIGHT_FRONT = 0x2, + LEFT_REAR = 0x4, + RIGHT_REAR = 0x8, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e1e8e85c201caf1e1779dc1b04e72614407d8429 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl @@ -0,0 +1,35 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Various windshields/windows in the car. + */ +@VintfStability +@Backing(type="int") +enum VehicleAreaWindow { + FRONT_WINDSHIELD = 0x00000001, + REAR_WINDSHIELD = 0x00000002, + ROW_1_LEFT = 0x00000010, + ROW_1_RIGHT = 0x00000040, + ROW_2_LEFT = 0x00000100, + ROW_2_RIGHT = 0x00000400, + ROW_3_LEFT = 0x00001000, + ROW_3_RIGHT = 0x00004000, + ROOF_TOP_1 = 0x00010000, + ROOF_TOP_2 = 0x00020000, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1759a90e51397f5c955e00f7b79b9d8f5f589a8b --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleDisplay { + /** + * The primary Android display (for example, center console) + */ + MAIN = 0, + INSTRUMENT_CLUSTER = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleGear.aidl new file mode 100644 index 0000000000000000000000000000000000000000..40e492eca643cc4dcfe0a8e53d63c8fdeb84a567 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleGear.aidl @@ -0,0 +1,39 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Various gears which can be selected by user and chosen in system. + */ +@VintfStability +@Backing(type="int") +enum VehicleGear { + GEAR_UNKNOWN = 0x0000, + GEAR_NEUTRAL = 0x0001, + GEAR_REVERSE = 0x0002, + GEAR_PARK = 0x0004, + GEAR_DRIVE = 0x0008, + GEAR_1 = 0x0010, + GEAR_2 = 0x0020, + GEAR_3 = 0x0040, + GEAR_4 = 0x0080, + GEAR_5 = 0x0100, + GEAR_6 = 0x0200, + GEAR_7 = 0x0400, + GEAR_8 = 0x0800, + GEAR_9 = 0x1000, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fa5d711ef30e2428fc9385a70a3f99adde65c73a --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl @@ -0,0 +1,37 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Bit flags for fan direction + */ +@VintfStability +@Backing(type="int") +enum VehicleHvacFanDirection { + UNKNOWN = 0x0, + FACE = 0x1, + FLOOR = 0x2, + /** + * FACE_AND_FLOOR = FACE | FLOOR + */ + FACE_AND_FLOOR = 0x3, + DEFROST = 0x4, + /** + * DEFROST_AND_FLOOR = DEFROST | FLOOR + */ + DEFROST_AND_FLOOR = 0x06, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl new file mode 100644 index 0000000000000000000000000000000000000000..93e42a0a886c477f801ae6bb1ea78fd2d0ee53dc --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleHwKeyInputAction { + /** + * Key down + */ + ACTION_DOWN = 0, + /** + * Key up + */ + ACTION_UP = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4de97f6639ef4fd06990dd26e66a97fdae9eda4f --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl @@ -0,0 +1,47 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleIgnitionState { + UNDEFINED = 0, + /** + * Steering wheel is locked + */ + LOCK = 1, + /** + * Steering wheel is not locked, engine and all accessories are OFF. If + * car can be in LOCK and OFF state at the same time than HAL must report + * LOCK state. + */ + OFF, + /** + * Typically in this state accessories become available (e.g. radio). + * Instrument cluster and engine are turned off + */ + ACC, + /** + * Ignition is in state ON. Accessories and instrument cluster available, + * engine might be running or ready to be started. + */ + ON, + /** + * Typically in this state engine is starting (cranking). + */ + START, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightState.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ede20b796732840cb511a4ca0352beb6b90ab469 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightState.aidl @@ -0,0 +1,31 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by lights state properties to enumerate the current state of the lights. + * + * Most XXX_LIGHTS_STATE properties will only report ON and OFF states. Only + * the HEADLIGHTS_STATE property will report DAYTIME_RUNNING. + */ +@VintfStability +@Backing(type="int") +enum VehicleLightState { + OFF = 0, + ON = 1, + DAYTIME_RUNNING = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl new file mode 100644 index 0000000000000000000000000000000000000000..247e731206c12934116d0557b7f075f9eda0ead9 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl @@ -0,0 +1,40 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by lights switch properties to enumerate user selected switch setting. + * + * XXX_LIGHTS_SWITCH properties report the switch settings that the user + * selects. The switch setting may be decoupled from the state reported if the + * user selects AUTOMATIC. + */ +@VintfStability +@Backing(type="int") +enum VehicleLightSwitch { + OFF = 0, + ON = 1, + /** + * Daytime running lights mode. Most cars automatically use DRL but some + * cars allow the user to activate them manually. + */ + DAYTIME_RUNNING = 2, + /** + * Allows the vehicle ECU to set the lights automatically + */ + AUTOMATIC = 0x100, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleOilLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bf3c858c557d56557f598277c998a29e8547d9e8 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleOilLevel.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleOilLevel { + /** + * Oil level values + */ + CRITICALLY_LOW = 0, + LOW = 1, + NORMAL = 2, + HIGH = 3, + ERROR = 4, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1b48f0b1b665fc587436b13eefc03c88826de598 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -0,0 +1,64 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VehicleAreaConfig; +import android.hardware.automotive.vehicle.VehiclePropertyAccess; +import android.hardware.automotive.vehicle.VehiclePropertyChangeMode; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VehiclePropConfig { + /** Property identifier */ + int prop; + + /** + * Defines if the property is read or write or both. + */ + VehiclePropertyAccess access = VehiclePropertyAccess.NONE; + + /** + * Defines the change mode of the property. + */ + VehiclePropertyChangeMode changeMode = VehiclePropertyChangeMode.STATIC; + + /** + * Contains per-area configuration. + */ + VehicleAreaConfig[] areaConfigs; + + /** Contains additional configuration parameters */ + int[] configArray; + + /** + * Some properties may require additional information passed over this + * string. Most properties do not need to set this. + */ + @utf8InCpp String configString; + + /** + * Min sample rate in Hz. + * Must be defined for VehiclePropertyChangeMode::CONTINUOUS + */ + float minSampleRate; + + /** + * Must be defined for VehiclePropertyChangeMode::CONTINUOUS + * Max sample rate in Hz. + */ + float maxSampleRate; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9c2d5f7191615841b01ac5981ab5fa16b6375aa6 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl @@ -0,0 +1,32 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VehiclePropConfig; +import android.os.ParcelFileDescriptor; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VehiclePropConfigs { + // The list of vehicle property configs if they fit the binder memory + // limitation. + VehiclePropConfig[] payloads; + // Shared memory file to store configs if they exceed binder memory + // limitation. Created by VHAL, readable only at client. Client could keep + // the fd opened or keep the FD mapped to access configs. + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c31c72802e4146d071aa24846a6cfedae944363 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.StatusCode; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VehiclePropError { + // Property ID. + int propId; + // Area ID. + int areaId; + // The error associated with this property. + StatusCode errorCode = StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropErrors.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropErrors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10a164d26f67105fe902d5698df7ee840d8b36e3 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropErrors.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VehiclePropError; +import android.os.ParcelFileDescriptor; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VehiclePropErrors { + // List of property set errors if they fit binder memory limitation. + VehiclePropError[] payloads; + // Shared memory file to store payloads if they exceed binder memory + // limitation. + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..289f2701af8fea6a41f0440db4ddbd8563d2c5d2 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -0,0 +1,46 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.RawPropValues; +import android.hardware.automotive.vehicle.VehiclePropertyStatus; + +/** + * Encapsulates the property name and the associated value. It + * is used across various API calls to set values, get values or to register for + * events. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VehiclePropValue { + /** Time is elapsed nanoseconds since boot */ + long timestamp; + + /** + * Area type(s) for non-global property it must be one of the value from + * VehicleArea* enums or 0 for global properties. + */ + int areaId; + + /** Property identifier */ + int prop; + + /** Status of the property */ + VehiclePropertyStatus status = VehiclePropertyStatus.AVAILABLE; + + RawPropValues value; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValues.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValues.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df44fdbfc11637c2567fd69c6c6ae2591803af61 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropValues.aidl @@ -0,0 +1,36 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VehiclePropValue; +import android.os.ParcelFileDescriptor; + +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VehiclePropValues { + // The list of vehicle properties if they fit the binder memory limitation. + VehiclePropValue[] payloads; + // An unique ID associated with this sharedMemoryFd file. + // Must be INVALID_MEMORY_ID if shared memory file is not used. If shared + // memory file is used, This ID must be sent back to the server using + // returnSharedMemory after this object has been used. + long sharedMemoryId; + // Shared memory file to store props if they exceed binder memory + // limitation. Created by VHAL, readable only at client. Client must close + // it after use and call returnSharedMemory. + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl new file mode 100644 index 0000000000000000000000000000000000000000..727b949a37e81bfb4b07a84353dc7ece6f949f9c --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -0,0 +1,2843 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VehiclePropertyType; +/** + * Declares all vehicle properties. VehicleProperty has a bitwise structure. + * Each property must have: + * - a unique id from range 0x0100 - 0xffff + * - associated data type using VehiclePropertyType + * - property group (VehiclePropertyGroup) + * - vehicle area (VehicleArea) + * + * Vendors are allowed to extend this enum with their own properties. In this + * case they must use VehiclePropertyGroup:VENDOR flag when the property is + * declared. + * + * When a property's status field is not set to AVAILABLE: + * - IVehicle#set may return StatusCode::NOT_AVAILABLE. + * - IVehicle#get is not guaranteed to work. + * + * Properties set to values out of range must be ignored and no action taken + * in response to such ill formed requests. + */ +@VintfStability +@Backing(type="int") +enum VehicleProperty { + /** + * Undefined property. + */ + INVALID = 0x00000000, + /** + * VIN of vehicle + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + */ + INFO_VIN = 0x0100 + 0x10000000 + 0x01000000 + + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING + /** + * Manufacturer of vehicle + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + */ + INFO_MAKE = 0x0101 + 0x10000000 + 0x01000000 + + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING + /** + * Model of vehicle + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + */ + INFO_MODEL = 0x0102 + 0x10000000 + 0x01000000 + + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING + /** + * Model year of vehicle. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:YEAR + */ + INFO_MODEL_YEAR = 0x0103 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Fuel capacity of the vehicle in milliliters + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:MILLILITER + */ + INFO_FUEL_CAPACITY = 0x0104 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * List of fuels the vehicle may use + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @data_enum FuelType + */ + INFO_FUEL_TYPE = 0x0105 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Battery capacity of the vehicle, if EV or hybrid. This is the nominal + * battery capacity when the vehicle is new. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:WH + */ + INFO_EV_BATTERY_CAPACITY = 0x0106 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * List of connectors this EV may use + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @data_enum EvConnectorType + * @access VehiclePropertyAccess:READ + */ + INFO_EV_CONNECTOR_TYPE = 0x0107 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Fuel door location + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @data_enum PortLocationType + * @access VehiclePropertyAccess:READ + */ + INFO_FUEL_DOOR_LOCATION = 0x0108 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * EV port location + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @data_enum PortLocationType + */ + INFO_EV_PORT_LOCATION = 0x0109 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Driver's seat location + * VHAL implementations must ignore the areaId. Use VehicleArea:GLOBAL. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @data_enum VehicleAreaSeat + * @access VehiclePropertyAccess:READ + */ + INFO_DRIVER_SEAT = 0x010A + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Exterior dimensions of vehicle. + * + * int32Values[0] = height + * int32Values[1] = length + * int32Values[2] = width + * int32Values[3] = width including mirrors + * int32Values[4] = wheel base + * int32Values[5] = track width front + * int32Values[6] = track width rear + * int32Values[7] = curb to curb turning radius + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:MILLIMETER + */ + INFO_EXTERIOR_DIMENSIONS = 0x010B + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Multiple EV port locations + * + * Implement this property if the vehicle has multiple EV ports. + * Port locations are defined in PortLocationType. + * For example, a car has one port in front left and one port in rear left: + * int32Values[0] = PortLocationType::FRONT_LEFT + * int32Values[0] = PortLocationType::REAR_LEFT + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @data_enum PortLocationType + */ + INFO_MULTI_EV_PORT_LOCATIONS = 0x010C + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Current odometer value of the vehicle + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:KILOMETER + */ + PERF_ODOMETER = 0x0204 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Speed of the vehicle + * + * The value must be positive when the vehicle is moving forward and negative when + * the vehicle is moving backward. This value is independent of gear value + * (CURRENT_GEAR or GEAR_SELECTION), for example, if GEAR_SELECTION is GEAR_NEUTRAL, + * PERF_VEHICLE_SPEED is positive when the vehicle is moving forward, negative when moving + * backward, and zero when not moving. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:METER_PER_SEC + */ + PERF_VEHICLE_SPEED = 0x0207 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Speed of the vehicle for displays + * + * Some cars display a slightly slower speed than the actual speed. This is + * usually displayed on the speedometer. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:METER_PER_SEC + */ + PERF_VEHICLE_SPEED_DISPLAY = 0x0208 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Front bicycle model steering angle for vehicle + * + * Angle is in degrees. Left is negative. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:DEGREES + */ + PERF_STEERING_ANGLE = 0x0209 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Rear bicycle model steering angle for vehicle + * + * Angle is in degrees. Left is negative. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:DEGREES + */ + PERF_REAR_STEERING_ANGLE = 0x0210 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Temperature of engine coolant + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:CELSIUS + */ + ENGINE_COOLANT_TEMP = 0x0301 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Engine oil level + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleOilLevel + */ + ENGINE_OIL_LEVEL = 0x0303 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Temperature of engine oil + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:CELSIUS + */ + ENGINE_OIL_TEMP = 0x0304 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Engine rpm + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:RPM + */ + ENGINE_RPM = 0x0305 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Reports wheel ticks + * + * The first element in the vector is a reset count. A reset indicates + * previous tick counts are not comparable with this and future ones. Some + * sort of discontinuity in tick counting has occurred. + * + * The next four elements represent ticks for individual wheels in the + * following order: front left, front right, rear right, rear left. All + * tick counts are cumulative. Tick counts increment when the vehicle + * moves forward, and decrement when vehicles moves in reverse. The ticks + * should be reset to 0 when the vehicle is started by the user. + * + * int64Values[0] = reset count + * int64Values[1] = front left ticks + * int64Values[2] = front right ticks + * int64Values[3] = rear right ticks + * int64Values[4] = rear left ticks + * + * configArray is used to indicate the micrometers-per-wheel-tick value and + * which wheels are supported. configArray is set as follows: + * + * configArray[0], bits [0:3] = supported wheels. Uses enum Wheel. + * configArray[1] = micrometers per front left wheel tick + * configArray[2] = micrometers per front right wheel tick + * configArray[3] = micrometers per rear right wheel tick + * configArray[4] = micrometers per rear left wheel tick + * + * NOTE: If a wheel is not supported, its value shall always be set to 0. + * + * VehiclePropValue.timestamp must be correctly filled in. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + */ + WHEEL_TICK = 0x0306 + 0x10000000 + 0x01000000 + + 0x00510000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64_VEC + /** + * Fuel remaining in the vehicle, in milliliters + * + * Value may not exceed INFO_FUEL_CAPACITY + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:MILLILITER + */ + FUEL_LEVEL = 0x0307 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Fuel door open + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + FUEL_DOOR_OPEN = 0x0308 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * EV battery level in WH, if EV or hybrid + * + * Value may not exceed INFO_EV_BATTERY_CAPACITY + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:WH + */ + EV_BATTERY_LEVEL = 0x0309 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * EV charge port open + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + EV_CHARGE_PORT_OPEN = 0x030A + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * EV charge port connected + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + EV_CHARGE_PORT_CONNECTED = 0x030B + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * EV instantaneous charge rate in milliwatts + * + * Positive value indicates battery is being charged. + * Negative value indicates battery being discharged. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:MW + */ + EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 0x030C + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Range remaining + * + * Meters remaining of fuel and charge. Range remaining shall account for + * all energy sources in a vehicle. For example, a hybrid car's range will + * be the sum of the ranges based on fuel and battery. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ_WRITE + * @unit VehicleUnit:METER + */ + RANGE_REMAINING = 0x0308 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Tire pressure + * + * Each tires is identified by its areaConfig.areaId config and their + * minFloatValue/maxFloatValue are used to store OEM recommended pressure + * range. + * The Min value in the areaConfig data represents the lower bound of + * the recommended tire pressure. + * The Max value in the areaConfig data represents the upper bound of + * the recommended tire pressure. + * For example: + * The following areaConfig indicates the recommended tire pressure + * of left_front tire is from 200.0 KILOPASCAL to 240.0 KILOPASCAL. + * .areaConfigs = { + * VehicleAreaConfig { + * .areaId = VehicleAreaWheel::LEFT_FRONT, + * .minFloatValue = 200.0, + * .maxFloatValue = 240.0, + * } + * }, + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:KILOPASCAL + */ + TIRE_PRESSURE = 0x0309 + 0x10000000 + 0x07000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WHEEL,VehiclePropertyType:FLOAT + /** + * Critically low tire pressure + * + * This property indicates the critically low pressure threshold for each tire. + * It indicates when it is time for tires to be replaced or fixed. The value + * must be less than or equal to minFloatValue in TIRE_PRESSURE. + * Minimum and maximum property values (that is, minFloatValue, maxFloatValue) + * are not applicable to this property. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:KILOPASCAL + */ + CRITICALLY_LOW_TIRE_PRESSURE = 0x030A + 0x10000000 + 0x07000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WHEEL,VehiclePropertyType:FLOAT + /** + * Currently selected gear + * + * This is the gear selected by the user. + * + * Values in the config data must represent the list of supported gears + * for this vehicle. For example, config data for an automatic transmission + * must contain {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_PARK, GEAR_DRIVE, + * GEAR_1, GEAR_2,...} and for manual transmission the list must be + * {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...} + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleGear + */ + GEAR_SELECTION = 0x0400 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Current gear. In non-manual case, selected gear may not + * match the current gear. For example, if the selected gear is GEAR_DRIVE, + * the current gear will be one of GEAR_1, GEAR_2 etc, which reflects + * the actual gear the transmission is currently running in. + * + * Values in the config data must represent the list of supported gears + * for this vehicle. For example, config data for an automatic transmission + * must contain {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_PARK, GEAR_1, GEAR_2,...} + * and for manual transmission the list must be + * {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...}. This list need not be the + * same as that of the supported gears reported in GEAR_SELECTION. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleGear + */ + CURRENT_GEAR = 0x0401 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Parking brake state. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + PARKING_BRAKE_ON = 0x0402 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Auto-apply parking brake. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + PARKING_BRAKE_AUTO_APPLY = 0x0403 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Warning for fuel low level. + * + * This property corresponds to the low fuel warning on the dashboard. + * Once FUEL_LEVEL_LOW is set, it should not be cleared until more fuel is + * added to the vehicle. This property may take into account all fuel + * sources for a vehicle - for example: + * + * For a gas powered vehicle, this property is based soley on gas level. + * For a battery powered vehicle, this property is based solely on battery level. + * For a hybrid vehicle, this property may be based on the combination of gas and battery + * levels, at the OEM's discretion. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + FUEL_LEVEL_LOW = 0x0405 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Night mode + * + * True indicates that the night mode sensor has detected that the car cabin environment has + * low light. The platform could use this, for example, to enable appropriate UI for + * better viewing in dark or low light environments. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + NIGHT_MODE = 0x0407 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * State of the vehicles turn signals + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleTurnSignal + */ + TURN_SIGNAL_STATE = 0x0408 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Represents ignition state + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleIgnitionState + */ + IGNITION_STATE = 0x0409 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * ABS is active + * + * Set to true when ABS is active. Reset to false when ABS is off. This + * property may be intermittently set (pulsing) based on the real-time + * state of the ABS system. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + ABS_ACTIVE = 0x040A + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Traction Control is active + * + * Set to true when traction control (TC) is active. Reset to false when + * TC is off. This property may be intermittently set (pulsing) based on + * the real-time state of the TC system. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + TRACTION_CONTROL_ACTIVE = 0x040B + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /* + * HVAC Properties + * + * Additional rules for mapping a zoned HVAC property (except + * HVAC_MAX_DEFROST_ON) to AreaIDs: + * - Every seat in VehicleAreaSeat that is available in the car, must be + * part of an AreaID in the AreaID array. + * + * Example 1: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three + * back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). There are two + * temperature control units -- driver side and passenger side. + * - A valid mapping set of AreaIDs for HVAC_TEMPERATURE_SET would be a + * two element array: + * - ROW_1_LEFT | ROW_2_LEFT + * - ROW_1_RIGHT | ROW_2_CENTER | ROW_2_RIGHT + * - An alternative mapping for the same hardware configuration would be: + * - ROW_1_LEFT | ROW_2_CENTER | ROW_2_LEFT + * - ROW_1_RIGHT | ROW_2_RIGHT + * The temperature controllers are assigned to the seats which they + * "most influence", but every seat must be included exactly once. The + * assignment of the center rear seat to the left or right AreaID may seem + * arbitrary, but the inclusion of every seat in exactly one AreaID ensures + * that the seats in the car are all expressed and that a "reasonable" way + * to affect each seat is available. + * + * Example 2: A car has three seat rows with two seats in the front row (ROW_1_LEFT, + * ROW_1_RIGHT) and three seats in the second (ROW_2_LEFT, ROW_2_CENTER, + * ROW_2_RIGHT) and third rows (ROW_3_LEFT, ROW_3_CENTER, ROW_3_RIGHT). There + * are three temperature control units -- driver side, passenger side, and rear. + * - A reasonable way to map HVAC_TEMPERATURE_SET to AreaIDs is a three + * element array: + * - ROW_1_LEFT + * - ROW_1_RIGHT + * - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT + * + * + * Fan speed setting + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_FAN_SPEED = 0x0500 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Fan direction setting + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleHvacFanDirection + */ + HVAC_FAN_DIRECTION = 0x0501 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * HVAC current temperature. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:CELSIUS + */ + HVAC_TEMPERATURE_CURRENT = 0x0502 + 0x10000000 + 0x05000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:FLOAT + /** + * HVAC, target temperature set. + * + * The configArray is used to indicate the valid values for HVAC in Fahrenheit and Celsius. + * Android might use it in the HVAC app UI. + * The configArray is set as follows: + * configArray[0] = [the lower bound of the supported temperature in Celsius] * 10. + * configArray[1] = [the upper bound of the supported temperature in Celsius] * 10. + * configArray[2] = [the increment in Celsius] * 10. + * configArray[3] = [the lower bound of the supported temperature in Fahrenheit] * 10. + * configArray[4] = [the upper bound of the supported temperature in Fahrenheit] * 10. + * configArray[5] = [the increment in Fahrenheit] * 10. + * For example, if the vehicle supports temperature values as: + * [16.0, 16.5, 17.0 ,..., 28.0] in Celsius + * [60.5, 61.5, 62.5 ,..., 85.5] in Fahrenheit. + * The configArray should be configArray = {160, 280, 5, 605, 825, 10}. + * + * If the vehicle supports HVAC_TEMPERATURE_VALUE_SUGGESTION, the application can use + * that property to get the suggested value before setting HVAC_TEMPERATURE_SET. Otherwise, + * the application may choose the value in HVAC_TEMPERATURE_SET configArray by itself. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @unit VehicleUnit:CELSIUS + */ + HVAC_TEMPERATURE_SET = 0x0503 + 0x10000000 + 0x05000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:FLOAT + /** + * Fan-based defrost for designated window. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_DEFROSTER = 0x0504 + 0x10000000 + 0x03000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN + /** + * On/off AC for designated areaId + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @config_flags Supported areaIds + */ + HVAC_AC_ON = 0x0505 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * On/off max AC + * + * When MAX AC is on, the ECU may adjust the vent position, fan speed, + * temperature, etc as necessary to cool the vehicle as quickly as possible. + * Any parameters modified as a side effect of turning on/off the MAX AC + * parameter shall generate onPropertyEvent() callbacks to the VHAL. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_MAX_AC_ON = 0x0506 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * On/off max defrost + * + * When MAX DEFROST is on, the ECU may adjust the vent position, fan speed, + * temperature, etc as necessary to defrost the windows as quickly as + * possible. Any parameters modified as a side effect of turning on/off + * the MAX DEFROST parameter shall generate onPropertyEvent() callbacks to + * the VHAL. + * The AreaIDs for HVAC_MAX_DEFROST_ON indicate MAX DEFROST can be controlled + * in the area. + * For example: + * areaConfig.areaId = {ROW_1_LEFT | ROW_1_RIGHT} indicates HVAC_MAX_DEFROST_ON + * only can be controlled for the front rows. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_MAX_DEFROST_ON = 0x0507 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * Recirculation on/off + * + * Controls the supply of exterior air to the cabin. Recirc “on” means the + * majority of the airflow into the cabin is originating in the cabin. + * Recirc “off” means the majority of the airflow into the cabin is coming + * from outside the car. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_RECIRC_ON = 0x0508 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * Enable temperature coupling between areas. + * + * The AreaIDs for HVAC_DUAL_ON property shall contain a combination of + * HVAC_TEMPERATURE_SET AreaIDs that can be coupled together. If + * HVAC_TEMPERATURE_SET is mapped to AreaIDs [a_1, a_2, ..., a_n], and if + * HVAC_DUAL_ON can be enabled to couple a_i and a_j, then HVAC_DUAL_ON + * property must be mapped to [a_i | a_j]. Further, if a_k and a_l can also + * be coupled together separately then HVAC_DUAL_ON must be mapped to + * [a_i | a_j, a_k | a_l]. + * + * Example: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three + * back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). There are two + * temperature control units -- driver side and passenger side -- which can + * be optionally synchronized. This may be expressed in the AreaIDs this way: + * - HVAC_TEMPERATURE_SET->[ROW_1_LEFT | ROW_2_LEFT, ROW_1_RIGHT | ROW_2_CENTER | ROW_2_RIGHT] + * - HVAC_DUAL_ON->[ROW_1_LEFT | ROW_2_LEFT | ROW_1_RIGHT | ROW_2_CENTER | ROW_2_RIGHT] + * + * When the property is enabled, the ECU must synchronize the temperature + * for the affected areas. Any parameters modified as a side effect + * of turning on/off the DUAL_ON parameter shall generate + * onPropertyEvent() callbacks to the VHAL. In addition, if setting + * a temperature (i.e. driver's temperature) changes another temperature + * (i.e. front passenger's temperature), then the appropriate + * onPropertyEvent() callbacks must be generated. If a user changes a + * temperature that breaks the coupling (e.g. setting the passenger + * temperature independently) then the VHAL must send the appropriate + * onPropertyEvent() callbacks (i.e. HVAC_DUAL_ON = false, + * HVAC_TEMPERATURE_SET[AreaID] = xxx, etc). + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_DUAL_ON = 0x0509 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * On/off automatic mode + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_AUTO_ON = 0x050A + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * Seat heating/cooling + * + * Negative values indicate cooling. + * 0 indicates off. + * Positive values indicate heating. + * + * Some vehicles may have multiple levels of heating and cooling. The + * min/max range defines the allowable range and number of steps in each + * direction. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_SEAT_TEMPERATURE = 0x050B + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Side Mirror Heat + * + * Increasing values denote higher heating levels for side mirrors. + * The Max value in the config data represents the highest heating level. + * The Min value in the config data MUST be zero and indicates no heating. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_SIDE_MIRROR_HEAT = 0x050C + 0x10000000 + 0x04000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 + /** + * Steering Wheel Heating/Cooling + * + * Sets the amount of heating/cooling for the steering wheel + * config data Min and Max MUST be set appropriately. + * Positive value indicates heating. + * Negative value indicates cooling. + * 0 indicates temperature control is off. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_STEERING_WHEEL_HEAT = 0x050D + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Temperature units for display + * + * Indicates whether the vehicle is displaying temperature to the user as + * Celsius or Fahrenheit. + * VehiclePropConfig.configArray is used to indicate the supported temperature display units. + * For example: configArray[0] = CELSIUS + * configArray[1] = FAHRENHEIT + * + * This parameter MAY be used for displaying any HVAC temperature in the system. + * Values must be one of VehicleUnit::CELSIUS or VehicleUnit::FAHRENHEIT + * Note that internally, all temperatures are represented in floating point Celsius. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleUnit + */ + HVAC_TEMPERATURE_DISPLAY_UNITS = 0x050E + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Actual fan speed + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + HVAC_ACTUAL_FAN_SPEED_RPM = 0x050F + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Represents global power state for HVAC. Setting this property to false + * MAY mark some properties that control individual HVAC features/subsystems + * to UNAVAILABLE state. Setting this property to true MAY mark some + * properties that control individual HVAC features/subsystems to AVAILABLE + * state (unless any/all of them are UNAVAILABLE on their own individual + * merits). + * + * [Definition] HvacPower_DependentProperties: Properties that need HVAC to be + * powered on in order to enable their functionality. For example, in some cars, + * in order to turn on the AC, HVAC must be powered on first. + * + * HvacPower_DependentProperties list must be set in the + * VehiclePropConfig.configArray. HvacPower_DependentProperties must only contain + * properties that are associated with VehicleArea:SEAT. Properties that are not + * associated with VehicleArea:SEAT, for example, HVAC_DEFROSTER, must never + * depend on HVAC_POWER_ON property and must never be part of + * HvacPower_DependentProperties list. + * + * AreaID mapping for HVAC_POWER_ON property must contain all AreaIDs that + * HvacPower_DependentProperties are mapped to. + * + * Example 1: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three back + * seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). If the HVAC features (AC, + * Temperature etc.) throughout the car are dependent on a single HVAC power + * controller then HVAC_POWER_ON must be mapped to + * [ROW_1_LEFT | ROW_1_RIGHT | ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT]. + * + * Example 2: A car has two seats in the front row (ROW_1_LEFT, ROW_1_RIGHT) and + * three seats in the second (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT) and third + * rows (ROW_3_LEFT, ROW_3_CENTER, ROW_3_RIGHT). If the car has temperature + * controllers in the front row which can operate entirely independently of + * temperature controllers in the back of the vehicle, then HVAC_POWER_ON + * must be mapped to a two element array: + * - ROW_1_LEFT | ROW_1_RIGHT + * - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_POWER_ON = 0x0510 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * Fan Positions Available + * + * This is a bit mask of fan positions available for the zone. Each + * available fan direction is denoted by a separate entry in the vector. A + * fan direction may have multiple bits from vehicle_hvac_fan_direction set. + * For instance, a typical car may have the following fan positions: + * - FAN_DIRECTION_FACE (0x1) + * - FAN_DIRECTION_FLOOR (0x2) + * - FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR (0x3) + * - FAN_DIRECTION_DEFROST (0x4) + * - FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST (0x6) + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @data_enum VehicleHvacFanDirection + */ + HVAC_FAN_DIRECTION_AVAILABLE = 0x0511 + 0x10000000 + 0x05000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32_VEC + /** + * Automatic recirculation on/off + * + * When automatic recirculation is ON, the HVAC system may automatically + * switch to recirculation mode if the vehicle detects poor incoming air + * quality. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_AUTO_RECIRC_ON = 0x0512 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * Seat ventilation + * + * 0 indicates off. + * Positive values indicates ventilation level. + * + * Used by HVAC apps and Assistant to enable, change, or read state of seat + * ventilation. This is different than seating cooling. It can be on at the + * same time as cooling, or not. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_SEAT_VENTILATION = 0x0513 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Electric defrosters' status + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_ELECTRIC_DEFROSTER_ON = 0x0514 + 0x10000000 + 0x03000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN + /** + * Suggested values for setting HVAC temperature. + * + * Implement the property to help applications understand the closest supported temperature + * value in Celsius or Fahrenheit. + * + * floatValues[0] = the requested value that an application wants to set a temperature to. + * floatValues[1] = the unit for floatValues[0]. It should be one of + * {VehicleUnit:CELSIUS, VehicleUnit:FAHRENHEIT}. + * floatValues[2] = the value OEMs suggested in CELSIUS. This value is not included + * in the request. + * floatValues[3] = the value OEMs suggested in FAHRENHEIT. This value is not included + * in the request. + * + * An application calls set(VehiclePropValue propValue) with the requested value and unit for + * the value. OEMs need to return the suggested values in floatValues[2] and floatValues[3] by + * onPropertyEvent() callbacks. + * + * For example, when a user uses the voice assistant to set HVAC temperature to 66.2 in + * Fahrenheit. + * First, an application will set this property with the value + * [66.2, (float)VehicleUnit:FAHRENHEIT,0,0]. + * If OEMs suggest to set 19.0 in Celsius or 66.5 in Fahrenheit for user's request, then VHAL + * must generate a callback with property value + * [66.2, (float)VehicleUnit:FAHRENHEIT, 19.0, 66.5]. After the voice assistant gets the + * callback, it will inform the user and set HVAC temperature to the suggested value. + * + * Another example, an application receives 21 Celsius as the current temperature value by + * querying HVC_TEMPERATURE_SET. But the application wants to know what value is displayed on + * the car's UI in Fahrenheit. + * For this, the application sets the property to [21, (float)VehicleUnit:CELSIUS, 0, 0]. If + * the suggested value by the OEM for 21 Celsius is 70 Fahrenheit, then VHAL must generate a + * callback with property value [21, (float)VehicleUnit:CELSIUS, 21.0, 70.0]. + * In this case, the application can know that the value is 70.0 Fahrenheit in the car’s UI. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + HVAC_TEMPERATURE_VALUE_SUGGESTION = 0x0515 + 0x10000000 + 0x01000000 + + 0x00610000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT_VEC + /** + * Distance units for display + * + * Indicates which units the car is using to display distances to the user. Eg. Mile, Meter + * Kilometer. + * + * Distance units are defined in VehicleUnit. + * VehiclePropConfig.configArray is used to indicate the supported distance display units. + * For example: configArray[0] = METER + * configArray[1] = KILOMETER + * configArray[2] = MILE + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleUnit + */ + DISTANCE_DISPLAY_UNITS = 0x0600 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Fuel volume units for display + * + * Indicates which units the car is using to display fuel volume to the user. Eg. Liter or + * Gallon. + * + * VehiclePropConfig.configArray is used to indicate the supported fuel volume display units. + * Volume units are defined in VehicleUnit. + * For example: configArray[0] = LITER + * configArray[1] = GALLON + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleUnit + */ + FUEL_VOLUME_DISPLAY_UNITS = 0x0601 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Tire pressure units for display + * + * Indicates which units the car is using to display tire pressure to the user. Eg. PSI, Bar or + * Kilopascal. + * + * VehiclePropConfig.configArray is used to indicate the supported pressure display units. + * Pressure units are defined in VehicleUnit. + * For example: configArray[0] = KILOPASCAL + * configArray[1] = PSI + * configArray[2] = BAR + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleUnit + */ + TIRE_PRESSURE_DISPLAY_UNITS = 0x0602 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * EV battery units for display + * + * Indicates which units the car is using to display EV battery information to the user. Eg. + * watt-hours(Wh), kilowatt-hours(kWh) or ampere-hours(Ah). + * + * VehiclePropConfig.configArray is used to indicate the supported electrical energy units. + * Electrical energy units are defined in VehicleUnit. + * For example: configArray[0] = WATT_HOUR + * configArray[1] = AMPERE_HOURS + * configArray[2] = KILOWATT_HOUR + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleUnit + */ + EV_BATTERY_DISPLAY_UNITS = 0x0603 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Fuel consumption units for display + * + * Indicates type of units the car is using to display fuel consumption information to user + * True indicates units are distance over volume such as MPG. + * False indicates units are volume over distance such as L/100KM. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = 0x0604 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Speed units for display + * + * Indicates type of units the car is using to display speed to user. Eg. m/s, km/h, or mph. + * + * VehiclePropConfig.configArray is used to indicate the supported speed display units. + * Pressure units are defined in VehicleUnit. + * For example: configArray[0] = METER_PER_SEC + * configArray[1] = MILES_PER_HOUR + * configArray[2] = KILOMETERS_PER_HOUR + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + VEHICLE_SPEED_DISPLAY_UNITS = 0x0605 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Current date and time suggestion for the Car, encoded as Epoch time + * (in milliseconds). This value denotes the number of milliseconds seconds + * that have elapsed since 1/1/1970 UTC. + * + * This property signals a change in CarTime to Android. If the property is supported, VHAL + * must report the most accurate current CarTime when this property is read, and publish a + * change to this property when the CarTime value has changed. An on-change event for this + * property must be published when CarTime changes for any reason other than the natural elapse + * of time (time delta smaller than 500ms should not trigger an on change event). Android will + * read and subscribe to this property to fetch time from VHAL. This can be useful to + * synchronize Android's time with other vehicle systems (dash clock etc). + * int64Values[0] = provided Epoch time (in milliseconds) + * + * Whenever a new Value for the property is received, AAOS will create + * and send an "ExternalTimeSuggestion" to the "TimeDetectorService". + * If other sources do not have a higher priority, Android will use this + * to set the system time. For information on how to adjust time source + * priorities and how time suggestions are handled (including how Android + * handles gitter, drift, and minimum resolution) see Time Detector Service + * documentation. + * + * Note that the property may take >0 ms to get propagated through the stack + * and, having a timestamped property helps reduce any time drift. So, + * for all reads to the property, the timestamp can be used to negate this + * drift: + * drift = elapsedTime - PropValue.timestamp + * effectiveTime = PropValue.value.int64Values[0] + drift + * + * It is strongly recommended that this property must not be used to retrieve + * time from ECUs using protocols (GNSS, NTP, Telephony etc). Since these + * protocols are already supported by Android, it is recommended to use + * Android’s own systems for them instead of wiring those through the VHAL + * using this property. + * + * WARNING: The value available through this property should not be dependent + * on value written by Android to ANDROID_EPOCH_TIME property in any way. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_ONLY + * @unit VehicleUnit:MILLI_SECS + */ + EXTERNAL_CAR_TIME = 0x0608 + 0x10000000 // VehiclePropertyGroup:SYSTEM + + 0x01000000 // VehicleArea:GLOBAL + + 0x00500000, // VehiclePropertyType:INT64 + /** + * Current date and time, encoded as Epoch time (in milliseconds). + * This value denotes the number of milliseconds seconds that have + * elapsed since 1/1/1970 UTC. + * + * CarServices will write to this value to give VHAL the Android system's + * time, if the VHAL supports this property. This can be useful to + * synchronize other vehicle systems (dash clock etc) with Android's time. + * + * AAOS writes to this property once during boot, and + * will thereafter write only when some time-source changes are propagated. + * AAOS will fill in VehiclePropValue.timestamp correctly. + * Note that AAOS will not send updates for natural elapse of time. + * int64Values[0] = provided Unix time (in milliseconds) + * + * Note that the property may take >0 ms to get propagated through the stack + * and, having a timestamped property helps reduce any time drift. So, + * for all writes to the property, the timestamp can be used to negate this + * drift: + * drift = elapsedTime - PropValue.timestamp + * effectiveTime = PropValue.value.int64Values[0] + drift + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE_ONLY + * @unit VehicleUnit:MILLI_SECS + */ + ANDROID_EPOCH_TIME = 0x0606 + 0x10000000 + 0x01000000 + + 0x00500000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64 + /** + * External encryption binding seed. + * + * This value is mixed with the local key storage encryption key. + * This property holds 16 bytes, and is expected to be persisted on an ECU separate from + * the IVI. The property is initially set by AAOS, who generates it using a CSRNG. + * AAOS will then read the property on subsequent boots. The binding seed is expected to be + * reliably persisted. Any loss of the seed results in a factory reset of the IVI. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + STORAGE_ENCRYPTION_BINDING_SEED = 0x0607 + 0x10000000 + 0x01000000 + + 0x00700000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BYTES + /** + * Outside temperature + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:CELSIUS + */ + ENV_OUTSIDE_TEMPERATURE = 0x0703 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Property to control power state of application processor + * + * It is assumed that AP's power state is controlled by a separate power + * controller. + * + * For configuration information, VehiclePropConfig.configArray can have bit flag combining + * values in VehicleApPowerStateConfigFlag. + * + * int32Values[0] : VehicleApPowerStateReq enum value + * int32Values[1] : additional parameter relevant for each state, + * 0 if not used. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + AP_POWER_STATE_REQ = 0x0A00 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Property to report power state of application processor + * + * It is assumed that AP's power state is controller by separate power + * controller. + * + * int32Values[0] : VehicleApPowerStateReport enum value + * int32Values[1] : Time in ms to wake up, if necessary. Otherwise 0. + + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + AP_POWER_STATE_REPORT = 0x0A01 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Property to report bootup reason for the current power on. This is a + * static property that will not change for the whole duration until power + * off. For example, even if user presses power on button after automatic + * power on with door unlock, bootup reason must stay with + * VehicleApPowerBootupReason#USER_UNLOCK. + * + * int32Values[0] must be VehicleApPowerBootupReason. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + */ + AP_POWER_BOOTUP_REASON = 0x0A02 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Property to represent brightness of the display. Some cars have single + * control for the brightness of all displays and this property is to share + * change in that control. + * + * If this is writable, android side can set this value when user changes + * display brightness from Settings. If this is read only, user may still + * change display brightness from Settings, but that must not be reflected + * to other displays. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + DISPLAY_BRIGHTNESS = 0x0A03 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Property to feed H/W input events to android + * + * int32Values[0] : action defined by VehicleHwKeyInputAction + * int32Values[1] : key code, must use standard android key code + * int32Values[2] : target display defined in VehicleDisplay. Events not + * tied to specific display must be sent to + * VehicleDisplay#MAIN. + * int32Values[3] : [optional] Number of ticks. The value must be equal or + * greater than 1. When omitted, Android will default to 1. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @config_flags + */ + HW_KEY_INPUT = 0x0A10 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Property to feed H/W rotary events to android + * + * int32Values[0] : RotaryInputType identifying which rotary knob rotated + * int32Values[1] : number of detents (clicks), positive for clockwise, + * negative for counterclockwise + * int32Values[2] : target display defined in VehicleDisplay. Events not + * tied to specific display must be sent to + * VehicleDisplay#MAIN. + * int32values[3 .. 3 + abs(number of detents) - 2]: + * nanosecond deltas between pairs of consecutive detents, + * if the number of detents is > 1 or < -1 + * + * VehiclePropValue.timestamp: when the rotation occurred. If the number of + * detents is > 1 or < -1, this is when the + * first detent of rotation occurred. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @data_enum RotaryInputType + * @access VehiclePropertyAccess:READ + */ + HW_ROTARY_INPUT = 0x0A20 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Defines a custom OEM partner input event. + * + * This input event must be used by OEM partners who wish to propagate events not supported + * by Android. It is composed by an array of int32 values only. + * + * The Android properties are: + * + * int32Values[0] : Input code identifying the function representing this event. Valid event + * types are defined by CustomInputType.CUSTOM_EVENT_F1 up to + * CustomInputType.CUSTOM_EVENT_F10. They represent the custom event to be + * defined by OEM partners. + * int32Values[1] : target display type defined in VehicleDisplay. Events not tied to specific + * display must be sent to VehicleDisplay#MAIN. + * int32Values[2] : repeat counter, if 0 then event is not repeated. Values 1 or above means + * how many times this event repeated. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @data_enum CustomInputType + * @access VehiclePropertyAccess:READ + */ + HW_CUSTOM_INPUT = 0X0A30 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /*************************************************************************** + * Most Car Cabin properties have both a POSition and MOVE parameter. These + * are used to control the various movements for seats, doors, and windows + * in a vehicle. + * + * A POS parameter allows the user to set the absolution position. For + * instance, for a door, 0 indicates fully closed and max value indicates + * fully open. Thus, a value halfway between min and max must indicate + * the door is halfway open. + * + * A MOVE parameter moves the device in a particular direction. The sign + * indicates direction, and the magnitude indicates speed (if multiple + * speeds are available). For a door, a move of -1 will close the door, and + * a move of +1 will open it. Once a door reaches the limit of open/close, + * the door should automatically stop moving. The user must NOT need to + * send a MOVE(0) command to stop the door at the end of its range. + **************************************************************************/ + + /** + * Door position + * + * This is an integer in case a door may be set to a particular position. + * Max value indicates fully open, min value (0) indicates fully closed. + * + * Some vehicles (minivans) can open the door electronically. Hence, the + * ability to write this property. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + DOOR_POS = 0x0B00 + 0x10000000 + 0x06000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32 + /** + * Door move + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + DOOR_MOVE = 0x0B01 + 0x10000000 + 0x06000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32 + /** + * Door lock + * + * 'true' indicates door is locked + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + DOOR_LOCK = 0x0B02 + 0x10000000 + 0x06000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:BOOLEAN + /** + * Mirror Z Position + * + * Positive value indicates tilt upwards, negative value is downwards + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + MIRROR_Z_POS = 0x0B40 + 0x10000000 + 0x04000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 + /** + * Mirror Z Move + * + * Positive value indicates tilt upwards, negative value is downwards + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + MIRROR_Z_MOVE = 0x0B41 + 0x10000000 + 0x04000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 + /** + * Mirror Y Position + * + * Positive value indicate tilt right, negative value is left + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + MIRROR_Y_POS = 0x0B42 + 0x10000000 + 0x04000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 + /** + * Mirror Y Move + * + * Positive value indicate tilt right, negative value is left + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + MIRROR_Y_MOVE = 0x0B43 + 0x10000000 + 0x04000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 + /** + * Mirror Lock + * + * True indicates mirror positions are locked and not changeable + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + MIRROR_LOCK = 0x0B44 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Mirror Fold + * + * True indicates mirrors are folded + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + MIRROR_FOLD = 0x0B45 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Seat memory select + * + * This parameter selects the memory preset to use to select the seat + * position. The minValue is always 0, and the maxValue determines the + * number of seat positions available. + * + * For instance, if the driver's seat has 3 memory presets, the maxValue + * will be 3. When the user wants to select a preset, the desired preset + * number (1, 2, or 3) is set. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + SEAT_MEMORY_SELECT = 0x0B80 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat memory set + * + * This setting allows the user to save the current seat position settings + * into the selected preset slot. The maxValue for each seat position + * must match the maxValue for SEAT_MEMORY_SELECT. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + SEAT_MEMORY_SET = 0x0B81 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seatbelt buckled + * + * True indicates belt is buckled. + * + * Write access indicates automatic seat buckling capabilities. There are + * no known cars at this time, but you never know... + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_BELT_BUCKLED = 0x0B82 + 0x10000000 + 0x05000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN + /** + * Seatbelt height position + * + * Adjusts the shoulder belt anchor point. + * Max value indicates highest position + * Min value indicates lowest position + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_BELT_HEIGHT_POS = 0x0B83 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seatbelt height move + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_BELT_HEIGHT_MOVE = 0x0B84 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat fore/aft position + * + * Sets the seat position forward (closer to steering wheel) and backwards. + * Max value indicates closest to wheel, min value indicates most rearward + * position. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_FORE_AFT_POS = 0x0B85 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat fore/aft move + * + * Moves the seat position forward and aft. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_FORE_AFT_MOVE = 0x0B86 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat backrest angle 1 position + * + * Backrest angle 1 is the actuator closest to the bottom of the seat. + * Max value indicates angling forward towards the steering wheel. + * Min value indicates full recline. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_BACKREST_ANGLE_1_POS = 0x0B87 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat backrest angle 1 move + * + * Moves the backrest forward or recline. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_BACKREST_ANGLE_1_MOVE = 0x0B88 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat backrest angle 2 position + * + * Backrest angle 2 is the next actuator up from the bottom of the seat. + * Max value indicates angling forward towards the steering wheel. + * Min value indicates full recline. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_BACKREST_ANGLE_2_POS = 0x0B89 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat backrest angle 2 move + * + * Moves the backrest forward or recline. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_BACKREST_ANGLE_2_MOVE = 0x0B8A + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat height position + * + * Sets the seat height. + * Max value indicates highest position. + * Min value indicates lowest position. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEIGHT_POS = 0x0B8B + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat height move + * + * Moves the seat height. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEIGHT_MOVE = 0x0B8C + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat depth position + * + * Sets the seat depth, distance from back rest to front edge of seat. + * Max value indicates longest depth position. + * Min value indicates shortest position. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_DEPTH_POS = 0x0B8D + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat depth move + * + * Adjusts the seat depth. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_DEPTH_MOVE = 0x0B8E + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat tilt position + * + * Sets the seat tilt. + * Max value indicates front edge of seat higher than back edge. + * Min value indicates front edge of seat lower than back edge. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_TILT_POS = 0x0B8F + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat tilt move + * + * Tilts the seat. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_TILT_MOVE = 0x0B90 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Lumber fore/aft position + * + * Pushes the lumbar support forward and backwards + * Max value indicates most forward position. + * Min value indicates most rearward position. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_LUMBAR_FORE_AFT_POS = 0x0B91 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Lumbar fore/aft move + * + * Adjusts the lumbar support. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_LUMBAR_FORE_AFT_MOVE = 0x0B92 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Lumbar side support position + * + * Sets the amount of lateral lumbar support. + * Max value indicates widest lumbar setting (i.e. least support) + * Min value indicates thinnest lumbar setting. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_LUMBAR_SIDE_SUPPORT_POS = 0x0B93 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Lumbar side support move + * + * Adjusts the amount of lateral lumbar support. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 0x0B94 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Headrest height position + * + * Sets the headrest height. + * Max value indicates tallest setting. + * Min value indicates shortest setting. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEADREST_HEIGHT_POS = 0x0B95 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Headrest height move + * + * Moves the headrest up and down. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEADREST_HEIGHT_MOVE = 0x0B96 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Headrest angle position + * + * Sets the angle of the headrest. + * Max value indicates most upright angle. + * Min value indicates shallowest headrest angle. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEADREST_ANGLE_POS = 0x0B97 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Headrest angle move + * + * Adjusts the angle of the headrest + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEADREST_ANGLE_MOVE = 0x0B98 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Headrest fore/aft position + * + * Adjusts the headrest forwards and backwards. + * Max value indicates position closest to front of car. + * Min value indicates position closest to rear of car. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEADREST_FORE_AFT_POS = 0x0B99 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Headrest fore/aft move + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SEAT_HEADREST_FORE_AFT_MOVE = 0x0B9A + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Seat Occupancy + * + * Indicates whether a particular seat is occupied or not, to the best of the car's ability + * to determine. Valid values are from the VehicleSeatOccupancyState enum. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleSeatOccupancyState + */ + SEAT_OCCUPANCY = 0x0BB0 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Window Position + * + * Min = window up / closed + * Max = window down / open + * + * For a window that may open out of plane (i.e. vent mode of sunroof) this + * parameter will work with negative values as follows: + * Max = sunroof completely open + * 0 = sunroof closed. + * Min = sunroof vent completely open + * + * Note that in this mode, 0 indicates the window is closed. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + WINDOW_POS = 0x0BC0 + 0x10000000 + 0x03000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 + /** + * Window Move + * + * Max = Open the window as fast as possible + * Min = Close the window as fast as possible + * Magnitude denotes relative speed. I.e. +2 is faster than +1 in closing + * the window. + * + * For a window that may open out of plane (i.e. vent mode of sunroof) this + * parameter will work as follows: + * + * If sunroof is open: + * Max = open the sunroof further, automatically stop when fully open. + * Min = close the sunroof, automatically stop when sunroof is closed. + * + * If vent is open: + * Max = close the vent, automatically stop when vent is closed. + * Min = open the vent further, automatically stop when vent is fully open. + * + * If sunroof is in the closed position: + * Max = open the sunroof, automatically stop when sunroof is fully open. + * Min = open the vent, automatically stop when vent is fully open. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + WINDOW_MOVE = 0x0BC1 + 0x10000000 + 0x03000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 + /** + * Window Lock + * + * True indicates windows are locked and can't be moved. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + WINDOW_LOCK = 0x0BC4 + 0x10000000 + 0x03000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN + /** + * Vehicle Maps Service (VMS) message + * + * This property uses MIXED data to communicate vms messages. + * + * Its contents are to be interpreted as follows: + * the indices defined in VmsMessageIntegerValuesIndex are to be used to + * read from int32Values; + * bytes is a serialized VMS message as defined in the vms protocol + * which is opaque to the framework; + * + * IVehicle#get must always return StatusCode::NOT_AVAILABLE. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + VEHICLE_MAP_SERVICE = 0x0C00 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * OBD2 Live Sensor Data + * + * Reports a snapshot of the current (live) values of the OBD2 sensors available. + * + * The configArray is set as follows: + * configArray[0] = number of vendor-specific integer-valued sensors + * configArray[1] = number of vendor-specific float-valued sensors + * + * The values of this property are to be interpreted as in the following example. + * Considering a configArray = {2,3} + * int32Values must be a vector containing Obd2IntegerSensorIndex.LAST_SYSTEM_INDEX + 2 + * elements (that is, 33 elements); + * floatValues must be a vector containing Obd2FloatSensorIndex.LAST_SYSTEM_INDEX + 3 + * elements (that is, 73 elements); + * + * It is possible for each frame to contain a different subset of sensor values, both system + * provided sensors, and vendor-specific ones. In order to support that, the bytes element + * of the property value is used as a bitmask,. + * + * bytes must have a sufficient number of bytes to represent the total number of possible + * sensors (in this case, 14 bytes to represent 106 possible values); it is to be read as + * a contiguous bitmask such that each bit indicates the presence or absence of a sensor + * from the frame, starting with as many bits as the size of int32Values, immediately + * followed by as many bits as the size of floatValues. + * + * For example, should bytes[0] = 0x4C (0b01001100) it would mean that: + * int32Values[0 and 1] are not valid sensor values + * int32Values[2 and 3] are valid sensor values + * int32Values[4 and 5] are not valid sensor values + * int32Values[6] is a valid sensor value + * int32Values[7] is not a valid sensor value + * Should bytes[5] = 0x61 (0b01100001) it would mean that: + * int32Values[32] is a valid sensor value + * floatValues[0 thru 3] are not valid sensor values + * floatValues[4 and 5] are valid sensor values + * floatValues[6] is not a valid sensor value + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + OBD2_LIVE_FRAME = 0x0D00 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * OBD2 Freeze Frame Sensor Data + * + * Reports a snapshot of the value of the OBD2 sensors available at the time that a fault + * occurred and was detected. + * + * A configArray must be provided with the same meaning as defined for OBD2_LIVE_FRAME. + * + * The values of this property are to be interpreted in a similar fashion as those for + * OBD2_LIVE_FRAME, with the exception that the stringValue field may contain a non-empty + * diagnostic troubleshooting code (DTC). + * + * A IVehicle#get request of this property must provide a value for int64Values[0]. + * This will be interpreted as the timestamp of the freeze frame to retrieve. A list of + * timestamps can be obtained by a IVehicle#get of OBD2_FREEZE_FRAME_INFO. + * + * Should no freeze frame be available at the given timestamp, a response of NOT_AVAILABLE + * must be returned by the implementation. Because vehicles may have limited storage for + * freeze frames, it is possible for a frame request to respond with NOT_AVAILABLE even if + * the associated timestamp has been recently obtained via OBD2_FREEZE_FRAME_INFO. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + OBD2_FREEZE_FRAME = 0x0D01 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * OBD2 Freeze Frame Information + * + * This property describes the current freeze frames stored in vehicle + * memory and available for retrieval via OBD2_FREEZE_FRAME. + * + * The values are to be interpreted as follows: + * each element of int64Values must be the timestamp at which a a fault code + * has been detected and the corresponding freeze frame stored, and each + * such element can be used as the key to OBD2_FREEZE_FRAME to retrieve + * the corresponding freeze frame. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + OBD2_FREEZE_FRAME_INFO = 0x0D02 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * OBD2 Freeze Frame Clear + * + * This property allows deletion of any of the freeze frames stored in + * vehicle memory, as described by OBD2_FREEZE_FRAME_INFO. + * + * The configArray is set as follows: + * configArray[0] = 1 if the implementation is able to clear individual freeze frames + * by timestamp, 0 otherwise + * + * IVehicle#set of this property is to be interpreted as follows: + * if int64Values contains no elements, then all frames stored must be cleared; + * if int64Values contains one or more elements, then frames at the timestamps + * stored in int64Values must be cleared, and the others not cleared. Should the + * vehicle not support selective clearing of freeze frames, this latter mode must + * return NOT_AVAILABLE. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + OBD2_FREEZE_FRAME_CLEAR = 0x0D03 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Headlights State + * + * Return the current state of headlights. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + HEADLIGHTS_STATE = 0x0E00 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * High beam lights state + * + * Return the current state of high beam lights. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + HIGH_BEAM_LIGHTS_STATE = 0x0E01 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Fog light state + * + * Return the current state of fog lights. + * + * If the car has both front and rear fog lights: + * If front and rear fog lights can only be controlled together: FOG_LIGHTS_STATE must be + * implemented. FRONT_FOG_LIGHTS_STATE and REAR_FOG_LIGHTS_STATE must not be implemented. + * + * If the front and rear fog lights can only be controlled independently: FOG_LIGHTS_STATE + * must not be implemented. FRONT_FOG_LIGHTS_STATE and REAR_FOG_LIGHTS_STATE must be + * implemented. + * + * If the car has only front fog lights: + * Only one of FOG_LIGHTS_STATE or FRONT_FOG_LIGHTS_STATE must be implemented and not both. + * REAR_FOG_LIGHTS_STATE must not be implemented. + * + * If the car has only rear fog lights: + * Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented and not both. + * FRONT_FOG_LIGHTS_STATE must not be implemented. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + FOG_LIGHTS_STATE = 0x0E02 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Hazard light status + * + * Return the current status of hazard lights. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + HAZARD_LIGHTS_STATE = 0x0E03 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Headlight switch + * + * The setting that the user wants. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + HEADLIGHTS_SWITCH = 0x0E10 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * High beam light switch + * + * The setting that the user wants. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + HIGH_BEAM_LIGHTS_SWITCH = 0x0E11 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Fog light switch + * + * The setting that the user wants. + * + * If the car has both front and rear fog lights: + * If front and rear fog lights can only be controlled together: FOG_LIGHTS_SWITCH must be + * implemented. FRONT_FOG_LIGHTS_SWITCH and REAR_FOG_LIGHTS_SWITCH must not be implemented. + * + * If the front and rear fog lights can only be controlled independently: FOG_LIGHTS_SWITCH + * must not be implemented. FRONT_FOG_LIGHTS_SWITCH and REAR_FOG_LIGHTS_SWITCH must be + * implemented. + * + * If the car has only front fog lights: + * Only one of FOG_LIGHTS_SWITCH or FRONT_FOG_LIGHTS_SWITCH must be implemented and not both. + * REAR_FOG_LIGHTS_SWITCH must not be implemented. + * + * If the car has only rear fog lights: + * Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented and not both. + * FRONT_FOG_LIGHTS_SWITCH must not be implemented. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + FOG_LIGHTS_SWITCH = 0x0E12 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Hazard light switch + * + * The setting that the user wants. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + HAZARD_LIGHTS_SWITCH = 0x0E13 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Cabin lights + * + * Return current status of cabin lights. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + CABIN_LIGHTS_STATE = 0x0F01 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Cabin lights switch + * + * The position of the physical switch which controls the cabin lights. + * This might be different than the CABIN_LIGHTS_STATE if the lights are on because a door + * is open or because of a voice command. + * For example, while the switch is in the "off" or "automatic" position. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + CABIN_LIGHTS_SWITCH = 0x0F02 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Reading lights + * + * Return current status of reading lights. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + READING_LIGHTS_STATE = 0x0F03 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Reading lights switch + * + * The position of the physical switch which controls the reading lights. + * This might be different than the READING_LIGHTS_STATE if the lights are on because a door + * is open or because of a voice command. + * For example, while the switch is in the "off" or "automatic" position. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + READING_LIGHTS_SWITCH = 0x0F04 + 0x10000000 + 0x05000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Support customize permissions for vendor properties + * + * Implement this property if vehicle hal support customize vendor permissions feature. + * VehiclePropConfig.configArray is used to indicate vendor properties and permissions + * which selected for this vendor property. The permission must be one of enum in + * VehicleVendorPermission. + * The configArray is set as follows: + * configArray[n] = propId : property ID for the vendor property + * configArray[n+1] = one of enums in VehicleVendorPermission. It indicates the permission + * for reading value of the property. + * configArray[n+2] = one of enums in VehicleVendorPermission. It indicates the permission + * for writing value of the property. + * + * For example: + * configArray = { + * vendor_prop_1, PERMISSION_VENDOR_SEAT_READ, PERMISSION_VENDOR_SEAT_WRITE, + * vendor_prop_2, PERMISSION_VENDOR_INFO, PERMISSION_NOT_ACCESSIBLE, + * } + * If vendor properties are not in this array, they will have the default vendor permission. + * If vendor chose PERMISSION_NOT_ACCESSIBLE, android will not have access to the property. In + * the example, Android can not write value for vendor_prop_2. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + */ + SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 0x0F05 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Allow disabling optional featurs from vhal. + * + * This property reports optional features that should be disabled. + * All allowed optional features for the system is declared in Car service overlay, + * config_allowed_optional_car_features. + * This property allows disabling features defined in the overlay. Without this property, + * all the features declared in the overlay will be enabled. + * + * Value read should include all features disabled with ',' separation. + * ex) "com.android.car.user.CarUserNoticeService,storage_monitoring" + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + */ + DISABLED_OPTIONAL_FEATURES = 0x0F06 + 0x10000000 + 0x01000000 + + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING + /** + * Defines the initial Android user to be used during initialization. + * + * This property is called by the Android system when it initializes and it lets the HAL + * define which Android user should be started. + * + * This request is made by setting a VehiclePropValue (defined by InitialUserInfoRequest), + * and the HAL must respond with a property change event (defined by InitialUserInfoResponse). + * If the HAL doesn't respond after some time (defined by the Android system), the Android + * system will proceed as if HAL returned a response of action + * InitialUserInfoResponseAction:DEFAULT. + * + * For example, on first boot, the request could be: + * + * int32[0]: 42 // request id (arbitrary number set by Android system) + * int32[1]: 1 // InitialUserInfoRequestType::FIRST_BOOT + * int32[2]: 0 // id of current user (usersInfo.currentUser.userId) + * int32[3]: 1 // flag of current user (usersInfo.currentUser.flags = SYSTEM) + * int32[4]: 1 // number of existing users (usersInfo.numberUsers); + * int32[5]: 0 // user #0 (usersInfo.existingUsers[0].userId) + * int32[6]: 1 // flags of user #0 (usersInfo.existingUsers[0].flags) + * + * And if the HAL want to respond with the creation of an admin user called "Owner", the + * response would be: + * + * int32[0]: 42 // must match the request id from the request + * int32[1]: 2 // action = InitialUserInfoResponseAction::CREATE + * int32[2]: -10000 // userToSwitchOrCreate.userId (not used as user will be created) + * int32[3]: 8 // userToSwitchOrCreate.flags = ADMIN + * string: "||Owner" // userLocales + separator + userNameToCreate + * + * Notice the string value represents multiple values, separated by ||. The first value is the + * (optional) system locales for the user to be created (in this case, it's empty, meaning it + * will use Android's default value), while the second value is the (also optional) name of the + * to user to be created (when the type of response is InitialUserInfoResponseAction:CREATE). + * For example, to create the same "Owner" user with "en-US" and "pt-BR" locales, the string + * value of the response would be "en-US,pt-BR||Owner". As such, neither the locale nor the + * name can have || on it, although a single | is fine. + * + * NOTE: if the HAL doesn't support user management, then it should not define this property, + * which in turn would disable the other user-related properties (for example, the Android + * system would never issue them and user-related requests from the HAL layer would be ignored + * by the Android System). But if it supports user management, then it must support all core + * user-related properties (INITIAL_USER_INFO, SWITCH_USER, CREATE_USER, and REMOVE_USER). + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + INITIAL_USER_INFO = 0x0F07 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Defines a request to switch the foreground Android user. + * + * This property is used primarily by the Android System to inform the HAL that the + * current foreground Android user is switching, but it could also be used by the HAL to request + * the Android system to switch users - the + * + * When the request is made by Android, it sets a VehiclePropValue and the HAL must responde + * with a property change event; when the HAL is making the request, it must also do it through + * a property change event (the main difference is that the request id will be positive in the + * former case, and negative in the latter; the SwitchUserMessageType will also be different). + * + * The format of both request is defined by SwitchUserRequest and the format of the response + * (when needed) is defined by SwitchUserResponse. How the HAL (or Android System) should + * proceed depends on the message type (which is defined by the SwitchUserMessageType + * parameter), as defined below. + * + * 1.LEGACY_ANDROID_SWITCH + * ----------------------- + * + * Called by the Android System to indicate the Android user is about to change, when the change + * request was made in a way that is not integrated with the HAL (for example, through + * adb shell am switch-user). + * + * The HAL can switch its internal user once it receives this request, but it doesn't need to + * reply back to the Android System. If its internal user cannot be changed for some reason, + * then it must wait for the SWITCH_USER(type=ANDROID_POST_SWITCH) call to recover + * (for example, it could issue a SWITCH_USER(type=VEHICLE_REQUEST) to switch back to + * the previous user), but ideally it should never fail (as switching back could result in a + * confusing experience for the end user). + * + * For example, if the system have users (0, 10, 11) and it's switching from 0 to 11 (where none + * of them have any special flag), the request would be: + * + * int32[0]: 42 // request id + * int32[1]: 1 // SwitchUserMessageType::LEGACY_ANDROID_SWITCH + * int32[2]: 11 // target user id + * int32[3]: 0 // target user flags (none) + * int32[4]: 10 // current user + * int32[5]: 0 // current user flags (none) + * int32[6]: 3 // number of users + * int32[7]: 0 // user #0 (Android user id 0) + * int32[8]: 0 // flags of user #0 (none) + * int32[9]: 10 // user #1 (Android user id 10) + * int32[10]: 0 // flags of user #1 (none) + * int32[11]: 11 // user #2 (Android user id 11) + * int32[12]: 0 // flags of user #2 (none) + * + * 2.ANDROID_SWITCH + * ---------------- + * Called by the Android System to indicate the Android user is about to change, but Android + * will wait for the HAL's response (up to some time) before proceeding. + * + * The HAL must switch its internal user once it receives this request, then respond back to + * Android with a SWITCH_USER(type=VEHICLE_RESPONSE) indicating whether its internal + * user was switched or not (through the SwitchUserStatus enum). + * + * For example, if Android has users (0, 10, 11) and it's switching from 10 to 11 (where + * none of them have any special flag), the request would be: + * + * int32[0]: 42 // request id + * int32[1]: 2 // SwitchUserMessageType::ANDROID_SWITCH + * int32[2]: 11 // target user id + * int32[3]: 0 // target user flags (none) + * int32[4]: 10 // current user + * int32[5]: 0 // current user flags (none) + * int32[6]: 3 // number of users + * int32[7]: 0 // 1st user (user 0) + * int32[8]: 1 // 1st user flags (SYSTEM) + * int32[9]: 10 // 2nd user (user 10) + * int32[10]: 0 // 2nd user flags (none) + * int32[11]: 11 // 3rd user (user 11) + * int32[12]: 0 // 3rd user flags (none) + * + * If the request succeeded, the HAL must update the property with: + * + * int32[0]: 42 // request id + * int32[1]: 3 // messageType = SwitchUserMessageType::VEHICLE_RESPONSE + * int32[2]: 1 // status = SwitchUserStatus::SUCCESS + * + * But if it failed, the response would be something like: + * + * int32[0]: 42 // request id + * int32[1]: 3 // messageType = SwitchUserMessageType::VEHICLE_RESPONSE + * int32[2]: 2 // status = SwitchUserStatus::FAILURE + * string: "108-D'OH!" // OEM-specific error message + * + * 3.VEHICLE_RESPONSE + * ------------------ + * Called by the HAL to indicate whether a request of type ANDROID_SWITCH should proceed or + * abort - see the ANDROID_SWITCH section above for more info. + * + * 4.VEHICLE_REQUEST + * ------------------ + * Called by the HAL to request that the current foreground Android user is switched. + * + * This is useful in situations where Android started as one user, but the vehicle identified + * the driver as another user. For example, user A unlocked the car using the key fob of user B; + * the INITIAL_USER_INFO request returned user B, but then a face recognition subsubsystem + * identified the user as A. + * + * The HAL makes this request by a property change event (passing a negative request id), and + * the Android system will response by issue an ANDROID_POST_SWITCH call which the same + * request id. + * + * For example, if the current foreground Android user is 10 and the HAL asked it to switch to + * 11, the request would be: + * + * int32[0]: -108 // request id + * int32[1]: 4 // messageType = SwitchUserMessageType::VEHICLE_REQUEST + * int32[2]: 11 // Android user id + * + * If the request succeeded and Android has 3 users (0, 10, 11), the response would be: + * + * int32[0]: -108 // request id + * int32[1]: 5 // messageType = SwitchUserMessageType::ANDROID_POST_SWITCH + * int32[2]: 11 // target user id + * int32[3]: 0 // target user id flags (none) + * int32[4]: 11 // current user + * int32[5]: 0 // current user flags (none) + * int32[6]: 3 // number of users + * int32[7]: 0 // 1st user (user 0) + * int32[8]: 0 // 1st user flags (none) + * int32[9]: 10 // 2nd user (user 10) + * int32[10]: 4 // 2nd user flags (none) + * int32[11]: 11 // 3rd user (user 11) + * int32[12]: 3 // 3rd user flags (none) + * + * Notice that both the current and target user ids are the same - if the request failed, then + * they would be different (i.e, target user would be 11, but current user would still be 10). + * + * 5.ANDROID_POST_SWITCH + * --------------------- + * Called by the Android System after a request to switch a user was made. + * + * This property is called after switch requests of any type (i.e., LEGACY_ANDROID_SWITCH, + * ANDROID_SWITCH, or VEHICLE_REQUEST) and can be used to determine if the request succeeded or + * failed: + * + * 1. When it succeeded, it's called when the Android user is in the unlocked state and the + * value of the current and target users ids in the response are the same. This would be + * equivalent to receiving an Intent.ACTION_USER_UNLOCKED in an Android app. + * 2. When it failed it's called right away and the value of the current and target users ids + * in the response are different (as the current user didn't change to the target). + * 3. If a new switch request is made before the HAL responded to the previous one or before + * the user was unlocked, then the ANDROID_POST_SWITCH request is not made. For example, + * the driver could accidentally switch to the wrong user which has lock credentials, then + * switch to the right one before entering the credentials. + * + * The HAL can update its internal state once it receives this request, but it doesn't need to + * reply back to the Android System. + * + * Request: the first N values as defined by INITIAL_USER_INFO (where the request-specific + * value at index 1 is SwitchUserMessageType::ANDROID_POST_SWITCH), then 2 more values for the + * target user id (i.e., the Android user id that was requested to be switched to) and its flags + * (as defined by UserFlags). + * + * Response: none. + * + * Example: see VEHICLE_REQUEST section above. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + SWITCH_USER = 0x0F08 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Called by the Android System after an Android user was created. + * + * The HAL can use this property to create its equivalent user. + * + * This is an async request: Android makes the request by setting a VehiclePropValue, and HAL + * must respond with a property change indicating whether the request succeeded or failed. If + * it failed, the Android system will remove the user. + * + * The format of the request is defined by CreateUserRequest and the format of the response by + * CreateUserResponse. + * + * For example, if system had 2 users (0 and 10) and a 3rd one (which is an ephemeral guest) was + * created, the request would be: + * + * int32[0]: 42 // request id + * int32[1]: 11 // Android id of the created user + * int32[2]: 6 // Android flags (ephemeral guest) of the created user + * int32[3]: 10 // current user + * int32[4]: 0 // current user flags (none) + * int32[5]: 3 // number of users + * int32[6]: 0 // 1st user (user 0) + * int32[7]: 0 // 1st user flags (none) + * int32[8]: 10 // 2nd user (user 10) + * int32[9]: 0 // 2nd user flags (none) + * int32[19]: 11 // 3rd user (user 11) + * int32[11]: 6 // 3rd user flags (ephemeral guest) + * string: "ElGuesto" // name of the new user + * + * Then if the request succeeded, the HAL would return: + * + * int32[0]: 42 // request id + * int32[1]: 1 // CreateUserStatus::SUCCESS + * + * But if it failed: + * + * int32[0]: 42 // request id + * int32[1]: 2 // CreateUserStatus::FAILURE + * string: "D'OH!" // The meaning is a blackbox - it's passed to the caller (like Settings UI), + * // which in turn can take the proper action. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + CREATE_USER = 0x0F09 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Called by the Android System after an Android user was removed. + * + * The HAL can use this property to remove its equivalent user. + * + * This is write-only call - the Android System is not expecting a reply from the HAL. Hence, + * this request should not fail - if the equivalent HAL user cannot be removed, then HAL should + * mark it as inactive or recover in some other way. + * + * The request is made by setting the VehiclePropValue with the contents defined by + * RemoveUserRequest. + * + * For example, if system had 3 users (0, 10, and 11) and user 11 was removed, the request + * would be: + * + * int32[0]: 42 // request id + * int32[1]: 11 // (Android user id of the removed user) + * int32[2]: 0 // (Android user flags of the removed user) + * int32[3]: 10 // current user + * int32[4]: 0 // current user flags (none) + * int32[5]: 2 // number of users + * int32[6]: 0 // 1st user (user 0) + * int32[7]: 0 // 1st user flags (none) + * int32[8]: 10 // 2nd user (user 10) + * int32[9]: 0 // 2nd user flags (none) + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:WRITE + */ + REMOVE_USER = 0x0F0A + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Property used to associate (or query the association) the current user with vehicle-specific + * identification mechanisms (such as key FOB). + * + * This is an optional user management property - the OEM could still support user management + * without defining it. In fact, this property could be used without supporting the core + * user-related functions described on INITIAL_USER_INFO. + * + * To query the association, the Android system gets the property, passing a VehiclePropValue + * containing the types of associations are being queried, as defined by + * UserIdentificationGetRequest. The HAL must return right away, returning a VehiclePropValue + * with a UserIdentificationResponse. Notice that user identification should have already + * happened while system is booting up and the VHAL implementation should only return the + * already identified association (like the key FOB used to unlock the car), instead of starting + * a new association from the get call. + * + * To associate types, the Android system sets the property, passing a VehiclePropValue + * containing the types and values of associations being set, as defined by the + * UserIdentificationSetRequest. The HAL will then use a property change event (whose + * VehiclePropValue is defined by UserIdentificationResponse) indicating the current status of + * the types after the request. + * + * For example, to query if the current user (10) is associated with the FOB that unlocked the + * car and a custom mechanism provided by the OEM, the request would be: + * + * int32[0]: 42 // request id + * int32[1]: 10 (Android user id) + * int32[2]: 0 (Android user flags) + * int32[3]: 2 (number of types queried) + * int32[4]: 1 (1st type queried, UserIdentificationAssociationType::KEY_FOB) + * int32[5]: 101 (2nd type queried, UserIdentificationAssociationType::CUSTOM_1) + * + * If the user is associated with the FOB but not with the custom mechanism, the response would + * be: + * + * int32[0]: 42 // request id + * int32[1]: 2 (number of associations in the response) + * int32[2]: 1 (1st type: UserIdentificationAssociationType::KEY_FOB) + * int32[3]: 2 (1st value: UserIdentificationAssociationValue::ASSOCIATED_CURRENT_USER) + * int32[4]: 101 (2st type: UserIdentificationAssociationType::CUSTOM_1) + * int32[5]: 4 (2nd value: UserIdentificationAssociationValue::NOT_ASSOCIATED_ANY_USER) + * + * Then to associate the user with the custom mechanism, a set request would be made: + * + * int32[0]: 43 // request id + * int32[1]: 10 (Android user id) + * int32[2]: 0 (Android user flags) + * int32[3]: 1 (number of associations being set) + * int32[4]: 101 (1st type: UserIdentificationAssociationType::CUSTOM_1) + * int32[5]: 1 (1st value: UserIdentificationAssociationSetValue::ASSOCIATE_CURRENT_USER) + * + * If the request succeeded, the response would be simply: + * + * int32[0]: 43 // request id + * int32[1]: 1 (number of associations in the response) + * int32[2]: 101 (1st type: UserIdentificationAssociationType::CUSTOM_1) + * int32[3]: 1 (1st value: UserIdentificationAssociationValue::ASSOCIATED_CURRENT_USER) + * + * Notice that the set request adds associations, but doesn't remove the existing ones. In the + * example above, the end state would be 2 associations (FOB and CUSTOM_1). If we wanted to + * associate the user with just CUSTOM_1 but not FOB, then the request should have been: + * + * int32[0]: 43 // request id + * int32[1]: 10 (Android user id) + * int32[2]: 2 (number of types set) + * int32[3]: 1 (1st type: UserIdentificationAssociationType::KEY_FOB) + * int32[4]: 2 (1st value: UserIdentificationAssociationValue::DISASSOCIATE_CURRENT_USER) + * int32[5]: 101 (2nd type: UserIdentificationAssociationType::CUSTOM_1) + * int32[6]: 1 (2nd value: UserIdentificationAssociationValue::ASSOCIATE_CURRENT_USER) + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + USER_IDENTIFICATION_ASSOCIATION = 0x0F0B + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Enable/request an EVS service. + * + * The property provides a generalized way to trigger EVS services. VHAL + * should use this property to request Android to start or stop EVS service. + * + * int32Values[0] = a type of the EVS service. The value must be one of enums in + * EvsServiceType. + * int32Values[1] = the state of the EVS service. The value must be one of enums in + * EvsServiceState. + * + * For example, to enable rear view EVS service, android side can set the property value as + * [EvsServiceType::REAR_VIEW, EvsServiceState::ON]. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + EVS_SERVICE_REQUEST = 0x0F10 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Defines a request to apply power policy. + * + * VHAL sets this property to change car power policy. Car power policy service subscribes to + * this property and actually changes the power policy. + * The request is made by setting the VehiclePropValue with the ID of a power policy which is + * defined at /vendor/etc/power_policy.xml. If the given ID is not defined, car power policy + * service ignores the request and the current power policy is maintained. + * + * string: "sample_policy_id" // power policy ID + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + POWER_POLICY_REQ = 0x0F21 + 0x10000000 + 0x01000000 + + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING + /** + * Defines a request to set the power polic group used to decide a default power policy per + * power status transition. + * + * VHAL sets this property with the ID of a power policy group in order to set the default power + * policy applied at power status transition. Power policy groups are defined at + * /vendor/etc/power_policy.xml. If the given ID is not defined, car power policy service + * ignores the request. + * Car power policy service subscribes to this property and sets the power policy group. + * The actual application of power policy takes place when the system power status changes and + * there is a valid mapped power policy for the new power status. + * + * string: "sample_policy_group_id" // power policy group ID + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + POWER_POLICY_GROUP_REQ = 0x0F22 + 0x10000000 + 0x01000000 + + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING + /** + * Notifies the current power policy to VHAL layer. + * + * Car power policy service sets this property when the current power policy is changed. + * + * string: "sample_policy_id" // power policy ID + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + CURRENT_POWER_POLICY = 0x0F23 + 0x10000000 + 0x01000000 + + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING + /** + * Defines an event that car watchdog updates to tell it's alive. + * + * Car watchdog sets this property to system uptime in milliseconds at every 3 second. + * During the boot, the update may take longer time. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + WATCHDOG_ALIVE = 0xF31 + 0x10000000 + 0x01000000 + + 0x00500000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64 + /** + * Defines a process terminated by car watchdog and the reason of termination. + * + * int32Values[0]: 1 // ProcessTerminationReason showing why a process is terminated. + * string: "/system/bin/log" // Process execution command. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + WATCHDOG_TERMINATED_PROCESS = 0x0F32 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Defines an event that VHAL signals to car watchdog as a heartbeat. + * + * If VHAL supports this property, VHAL should write system uptime to this property at every 3 + * second. Car watchdog subscribes to this property and checks if the property is updated at + * every 3 second. With the buffer time of 3 second, car watchdog waits for a heart beat to be + * signaled up to 6 seconds from the last heart beat. If it isn’t, car watchdog considers + * VHAL unhealthy and terminates it. + * If this property is not supported by VHAL, car watchdog doesn't check VHAL health status. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + VHAL_HEARTBEAT = 0x0F33 + 0x10000000 + 0x01000000 + + 0x00500000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64 + /** + * Starts the ClusterUI in cluster display. + * + * int32: the type of ClusterUI to show + * 0 indicates ClusterHome, that is a home screen of cluster display, and provides + * the default UI and a kind of launcher functionality for cluster display. + * the other values are followed by OEM's definition. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + CLUSTER_SWITCH_UI = 0x0F34 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Changes the state of the cluster display. + * + * Bounds: the area to render the cluster Activity. + * Inset: the area which Activity should avoid from placing any important + * information. + * + * int32[0]: on/off: 0 - off, 1 - on, -1 - don't care + * int32[1]: Bounds - left: positive number - left position in pixels + -1 - don't care (should set all Bounds fields) + * int32[2]: Bounds - top: same format with 'left' + * int32[3]: Bounds - right: same format with 'left' + * int32[4]: Bounds - bottom: same format with 'left' + * int32[5]: Inset - left: positive number - actual left inset value in pixels + -1 - don't care (should set "don't care" all Inset fields) + * int32[6]: Inset - top: same format with 'left' + * int32[7]: Inset - right: same format with 'left' + * int32[8]: Inset - bottom: same format with 'left' + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + */ + CLUSTER_DISPLAY_STATE = 0x0F35 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Reports the current display state and ClusterUI state. + * + * ClusterHome will send this message when it handles CLUSTER_SWITCH_UI, CLUSTER_DISPLAY_STATE. + * + * In addition, ClusterHome should send this message when it starts for the first time. + * When ClusterOS receives this message and if the internal expectation is different with the + * received message, then it should send CLUSTER_SWITCH_UI, CLUSTER_DISPLAY_STATE again to + * match the state. + * + * int32[0]: on/off: 0 - off, 1 - on + * int32[1]: Bounds - left + * int32[2]: Bounds - top + * int32[3]: Bounds - right + * int32[4]: Bounds - bottom + * int32[5]: Inset - left + * int32[6]: Inset - top + * int32[7]: Inset - right + * int32[8]: Inset - bottom + * int32[9]: the type of ClusterUI in the fullscreen or main screen. + * 0 indicates ClusterHome. + * the other values are followed by OEM's definition. + * int32[10]: the type of ClusterUI in sub screen if the currently two UIs are shown. + * -1 indicates the area isn't used any more. + * bytes: the array to represent the availability of ClusterUI. + * 0 indicates non-available and 1 indicates available. + * For example, let's assume a car supports 3 OEM defined ClusterUI like HOME, MAPS, CALL, + * and it only supports CALL UI only when the cellular network is available. Then, if the + * nework is avaibale, it'll send [1 1 1], and if it's out of network, it'll send [1 1 0]. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + CLUSTER_REPORT_STATE = 0x0F36 + 0x10000000 + 0x01000000 + + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Requests to change the cluster display state to show some ClusterUI. + * + * When the current display state is off and ClusterHome sends this message to ClusterOS to + * request to turn the display on to show some specific ClusterUI. + * ClusterOS should response this with CLUSTER_DISPLAY_STATE. + * + * int32: the type of ClusterUI to show + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + CLUSTER_REQUEST_DISPLAY = 0x0F37 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Informs the current navigation state. + * + * bytes: the serialized message of NavigationStateProto. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:WRITE + */ + CLUSTER_NAVIGATION_STATE = 0x0F38 + 0x10000000 + 0x01000000 + + 0x00700000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BYTES + /** + * Electronic Toll Collection card type. + * + * This property indicates the type of ETC card in this vehicle. + * If the head unit is aware of an ETC card attached to the vehicle, this property should + * return the type of card attached; otherwise, this property should be UNAVAILABLE. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum ElectronicTollCollectionCardType + */ + ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = 0x0F39 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Electronic Toll Collection card status. + * + * This property indicates the status of ETC card in this vehicle. + * If the head unit is aware of an ETC card attached to the vehicle, + * ELECTRONIC_TOLL_COLLECTION_CARD_TYPE gives that status of the card; otherwise, + * this property should be UNAVAILABLE. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum ElectronicTollCollectionCardStatus + */ + ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = 0x0F3A + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Front fog lights state + * + * Return the current state of the front fog lights. + * Only one of FOG_LIGHTS_STATE or FRONT_FOG_LIGHTS_STATE must be implemented. Please refer to + * the documentation on FOG_LIGHTS_STATE for more information. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + FRONT_FOG_LIGHTS_STATE = 0x0F3B + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + + /** + * Front fog lights switch + * + * The setting that the user wants. + * Only one of FOG_LIGHTS_SWITCH or FRONT_FOG_LIGHTS_SWITCH must be implemented. Please refer to + * the documentation on FOG_LIGHTS_SWITCH for more information. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + FRONT_FOG_LIGHTS_SWITCH = 0x0F3C + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + + /** + * Rear fog lights state + * + * Return the current state of the rear fog lights. + * Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented. Please refer to + * the documentation on FOG_LIGHTS_STATE for more information. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum VehicleLightState + */ + REAR_FOG_LIGHTS_STATE = 0x0F3D + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + + /** + * Rear fog lights switch + * + * The setting that the user wants. + * Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented. Please refer to + * the documentation on FOG_LIGHTS_SWITCH for more information. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @data_enum VehicleLightSwitch + */ + REAR_FOG_LIGHTS_SWITCH = 0x0F3E + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + + /** + * Indicates the maximum current draw threshold for charging set by the user + * + * configArray[0] is used to specify the max current draw allowed by + * the vehicle in Amperes. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + * @unit VehicleUnit:AMPERE + */ + EV_CHARGE_CURRENT_DRAW_LIMIT = 0x0F3F + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + + /** + * Indicates the maximum charge percent threshold set by the user + * + * Returns a float value from 0 to 100. + * + * configArray is used to specify the valid values. + * For example, if the vehicle supports the following charge percent limit values: + * [20, 40, 60, 80, 100] + * then the configArray should be {20, 40, 60, 80, 100} + * If the configArray is empty then all values from 0 to 100 must be valid. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + EV_CHARGE_PERCENT_LIMIT = 0x0F40 + 0x10000000 + 0x01000000 + + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + + /** + * Charging state of the car + * + * Returns the current charging state of the car. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum EvChargeState + */ + EV_CHARGE_STATE = 0x0F41 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + + /** + * Start or stop charging the EV battery + * + * The setting that the user wants. Setting this property to true starts the battery charging + * and setting to false stops charging. + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ_WRITE + */ + EV_CHARGE_SWITCH = 0x0F42 + 0x10000000 + 0x01000000 + + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + + /** + * Estimated charge time remaining in seconds + * + * Returns 0 if the vehicle is not charging. + * + * @change_mode VehiclePropertyChangeMode:CONTINUOUS + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:SECS + */ + EV_CHARGE_TIME_REMAINING = 0x0F43 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + + /** + * Regenerative braking or one-pedal drive state of the car + * + * Returns the current state associated with the regenerative braking + * setting in the car + * + * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @access VehiclePropertyAccess:READ + * @data_enum EvRegenerativeBrakingState + */ + 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 + + /** + * Vehicle’s curb weight + * + * Returns the vehicle's curb weight in kilograms. Curb weight is + * the total weight of the vehicle with standard equipment and all + * necessary operating consumables such as motor oil,transmission oil, + * brake fluid, coolant, air conditioning refrigerant, and weight of + * fuel at nominal tank capacity, while not loaded with either passengers + * or cargo. + * + * configArray[0] is used to specify the vehicle’s gross weight in kilograms. + * The vehicle’s gross weight is the maximum operating weight of the vehicle + * as specified by the manufacturer including the vehicle's chassis, body, engine, + * engine fluids, fuel, accessories, driver, passengers and cargo but excluding + * that of any trailers. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @unit VehicleUnit:KILOGRAM + */ + + VEHICLE_CURB_WEIGHT = 0x0F46 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl new file mode 100644 index 0000000000000000000000000000000000000000..76e38e3893667f79110cbd3b4d14b93806dea786 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl @@ -0,0 +1,33 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Property config defines the capabilities of it. User of the API + * must first get the property config to understand the output from get() + * commands and also to ensure that set() or events commands are in sync with + * the expected output. + */ +@VintfStability +@Backing(type="int") +enum VehiclePropertyAccess { + NONE = 0x00, + + READ = 0x01, + WRITE = 0x02, + READ_WRITE = 0x03, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57228db5d55761c351bb9896775d2426ccb2c1de --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl @@ -0,0 +1,48 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * This describes how value of property can change. + */ +@VintfStability +@Backing(type="int") +enum VehiclePropertyChangeMode { + /** + * Property of this type must never be changed. Subscription is not supported + * for these properties. + */ + STATIC = 0x00, + + /** + * Properties of this type must report when there is a change. + * IVehicle#get call must return the current value. + * Set operation for this property is assumed to be asynchronous. When the + * property is read (using IVehicle#get) after IVehicle#set, it may still + * return old value until underlying H/W backing this property has actually + * changed the state. Once state is changed, the property must dispatch + * changed value as event. + */ + ON_CHANGE = 0x01, + + /** + * Properties of this type change continuously and require a fixed rate of + * sampling to retrieve the data. Implementers may choose to send extra + * notifications on significant value changes. + */ + CONTINUOUS = 0x02, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a2cbdec5e8b9ea56055ac19181d82a28876b0d39 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl @@ -0,0 +1,33 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehiclePropertyGroup { + /** + * Properties declared in AOSP must use this flag. + */ + SYSTEM = 0x10000000, + + /** + * Properties declared by vendors must use this flag. + */ + VENDOR = 0x20000000, + + MASK = 0xf0000000, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..400e256697c8578c279ddf17c304c4dca4c45e14 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyStatus.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. + */ + +package android.hardware.automotive.vehicle; + +/** + * Property status is a dynamic value that may change based on the vehicle state. + */ +@VintfStability +@Backing(type="int") +enum VehiclePropertyStatus { + /** Property is available and behaving normally */ + AVAILABLE = 0x00, + /** + * A property in this state is not available for reading and writing. This + * is a transient state that depends on the availability of the underlying + * implementation (e.g. hardware or driver). It MUST NOT be used to + * represent features that this vehicle is always incapable of. A get() of + * a property in this state MAY return an undefined value, but MUST + * correctly describe its status as UNAVAILABLE A set() of a property in + * this state MAY return NOT_AVAILABLE. The HAL implementation MUST ignore + * the value of the status field when writing a property value coming from + * Android. + */ + UNAVAILABLE = 0x01, + /** There is an error with this property. */ + ERROR = 0x02, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..62d26de3c36c487a44ae5ec9878314b752a979dc --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyType.aidl @@ -0,0 +1,59 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Enumerates supported data type for VehicleProperty. + * + * Used to create property ID in VehicleProperty enum. + */ +@VintfStability +@Backing(type="int") +enum VehiclePropertyType { + STRING = 0x00100000, + BOOLEAN = 0x00200000, + INT32 = 0x00400000, + INT32_VEC = 0x00410000, + INT64 = 0x00500000, + INT64_VEC = 0x00510000, + FLOAT = 0x00600000, + FLOAT_VEC = 0x00610000, + BYTES = 0x00700000, + + /** + * Any combination of scalar or vector types. The exact format must be + * provided in the description of the property. + * + * For vendor MIXED type properties, configArray needs to be formatted in this + * structure. + * configArray[0], 1 indicates the property has a String value + * configArray[1], 1 indicates the property has a Boolean value . + * configArray[2], 1 indicates the property has an Integer value. + * configArray[3], the number indicates the size of Integer[] in the property. + * configArray[4], 1 indicates the property has a Long value. + * configArray[5], the number indicates the size of Long[] in the property. + * configArray[6], 1 indicates the property has a Float value. + * configArray[7], the number indicates the size of Float[] in the property. + * configArray[8], the number indicates the size of byte[] in the property. + * For example: + * {@code configArray = {1, 1, 1, 3, 0, 0, 0, 0, 0}} indicates the property has + * a String value, a Boolean value, an Integer value and an array with 3 integers. + */ + MIXED = 0x00e00000, + + MASK = 0x00ff0000, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3a08a51492db512a24ec44dbd050e4959b1b3c62 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl @@ -0,0 +1,28 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by seat occupancy to enumerate the current occupancy state of the seat. + */ +@VintfStability +@Backing(type="int") +enum VehicleSeatOccupancyState { + UNKNOWN = 0, + VACANT = 1, + OCCUPIED = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f0f46ad1378fcc039455129683383892c8d41ff4 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl @@ -0,0 +1,25 @@ +/* + * 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 android.hardware.automotive.vehicle; + +@VintfStability +@Backing(type="int") +enum VehicleTurnSignal { + NONE = 0x00, + RIGHT = 0x01, + LEFT = 0x02, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3817b74ce928e1d95e803b1facc11322ffb496c1 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl @@ -0,0 +1,61 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Units used for int or float type with no attached enum types. + */ +@VintfStability +@Backing(type="int") +enum VehicleUnit { + SHOULD_NOT_USE = 0x000, + METER_PER_SEC = 0x01, + RPM = 0x02, + HERTZ = 0x03, + PERCENTILE = 0x10, + MILLIMETER = 0x20, + METER = 0x21, + KILOMETER = 0x23, + MILE = 0x24, + CELSIUS = 0x30, + FAHRENHEIT = 0x31, + KELVIN = 0x32, + MILLILITER = 0x40, + LITER = 0x41, + /** + * deprecated. Use US_GALLON instead. + */ + GALLON = 0x42, + US_GALLON = 0x42, + IMPERIAL_GALLON = 0x43, + NANO_SECS = 0x50, + SECS = 0x53, + YEAR = 0x59, + WATT_HOUR = 0x60, + MILLIAMPERE = 0x61, + MILLIVOLT = 0x62, + MILLIWATTS = 0x63, + AMPERE_HOURS = 0x64, + KILOWATT_HOUR = 0x65, + AMPERE = 0x66, + KILOPASCAL = 0x70, + PSI = 0x71, + BAR = 0x72, + DEGREES = 0x80, + MILES_PER_HOUR = 0x90, + KILOMETERS_PER_HOUR = 0x91, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl new file mode 100644 index 0000000000000000000000000000000000000000..29ad170817846eb5393ab2e9995f6810f467b073 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl @@ -0,0 +1,63 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Used by SUPPORT_CUSTOMIZE_VENDOR_PERMISSION to indicate the permission of vendor properties. + */ +@VintfStability +@Backing(type="int") +enum VehicleVendorPermission { + PERMISSION_DEFAULT = 0x00000000, + PERMISSION_SET_VENDOR_CATEGORY_WINDOW = 0X00000001, + PERMISSION_GET_VENDOR_CATEGORY_WINDOW = 0x00000002, + PERMISSION_SET_VENDOR_CATEGORY_DOOR = 0x00000003, + PERMISSION_GET_VENDOR_CATEGORY_DOOR = 0x00000004, + PERMISSION_SET_VENDOR_CATEGORY_SEAT = 0x00000005, + PERMISSION_GET_VENDOR_CATEGORY_SEAT = 0x00000006, + PERMISSION_SET_VENDOR_CATEGORY_MIRROR = 0x00000007, + PERMISSION_GET_VENDOR_CATEGORY_MIRROR = 0x00000008, + PERMISSION_SET_VENDOR_CATEGORY_INFO = 0x00000009, + PERMISSION_GET_VENDOR_CATEGORY_INFO = 0x0000000A, + PERMISSION_SET_VENDOR_CATEGORY_ENGINE = 0x0000000B, + PERMISSION_GET_VENDOR_CATEGORY_ENGINE = 0x0000000C, + PERMISSION_SET_VENDOR_CATEGORY_HVAC = 0x0000000D, + PERMISSION_GET_VENDOR_CATEGORY_HVAC = 0x0000000E, + PERMISSION_SET_VENDOR_CATEGORY_LIGHT = 0x0000000F, + PERMISSION_GET_VENDOR_CATEGORY_LIGHT = 0x00000010, + PERMISSION_SET_VENDOR_CATEGORY_1 = 0x00010000, + PERMISSION_GET_VENDOR_CATEGORY_1 = 0x00011000, + PERMISSION_SET_VENDOR_CATEGORY_2 = 0x00020000, + PERMISSION_GET_VENDOR_CATEGORY_2 = 0x00021000, + PERMISSION_SET_VENDOR_CATEGORY_3 = 0x00030000, + PERMISSION_GET_VENDOR_CATEGORY_3 = 0x00031000, + PERMISSION_SET_VENDOR_CATEGORY_4 = 0x00040000, + PERMISSION_GET_VENDOR_CATEGORY_4 = 0x00041000, + PERMISSION_SET_VENDOR_CATEGORY_5 = 0x00050000, + PERMISSION_GET_VENDOR_CATEGORY_5 = 0x00051000, + PERMISSION_SET_VENDOR_CATEGORY_6 = 0x00060000, + PERMISSION_GET_VENDOR_CATEGORY_6 = 0x00061000, + PERMISSION_SET_VENDOR_CATEGORY_7 = 0x00070000, + PERMISSION_GET_VENDOR_CATEGORY_7 = 0x00071000, + PERMISSION_SET_VENDOR_CATEGORY_8 = 0x00080000, + PERMISSION_GET_VENDOR_CATEGORY_8 = 0x00081000, + PERMISSION_SET_VENDOR_CATEGORY_9 = 0x00090000, + PERMISSION_GET_VENDOR_CATEGORY_9 = 0x00091000, + PERMISSION_SET_VENDOR_CATEGORY_10 = 0x000A0000, + PERMISSION_GET_VENDOR_CATEGORY_10 = 0x000A1000, + PERMISSION_NOT_ACCESSIBLE = 0xF0000000, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..def7c280cc8cf014a0f3d97e9f0dcb1ec715ae3d --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl @@ -0,0 +1,44 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VmsBaseMessageIntegerValuesIndex; + +/** + * An availability state is sent to the subscribers in response to a change in the available + * layers as part of a VmsMessageType.AVAILABILITY_CHANGE message, or in response to a + * VmsMessageType.AVAILABILITY_REQUEST message as part of a VmsMessageType.AVAILABILITY_RESPONSE. + * The VMS service issues monotonically increasing sequence numbers, and in case a subscriber + * receives a smaller sequence number, it should ignore the message. An available associated layer + * is a layer with a list of publisher IDs: + * - Layer type + * - Layer subtype + * - Layer version + * - Number of publisher IDs (N) + * - N x publisher ID + */ +@VintfStability +@Backing(type="int") +enum VmsAvailabilityStateIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_ASSOCIATED_LAYERS = 2, + LAYERS_START = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a82ce0b2116e27973049d30b2603fd42acfb8489 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl @@ -0,0 +1,31 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * Every VMS message starts with the type of the message from the VmsMessageType enum. + * Messages with no parameters such as VmsMessageType.AVAILABILITY_REQUEST, + * VmsMessageType.SUBSCRIPTIONS_REQUEST and VmsMessageType.DATA are also based on this enum. + */ +@VintfStability +@Backing(type="int") +enum VmsBaseMessageIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6f03e37413b27fc3edba0b3e3800eac45ac3d5cf --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageType.aidl @@ -0,0 +1,141 @@ +/* + * 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 android.hardware.automotive.vehicle; + +/** + * This enum lists the types of supported VMS messages. It is used as the first + * integer in the vehicle property integers array and determines how the rest of + * the message is decoded. + */ +@VintfStability +@Backing(type="int") +enum VmsMessageType { + /** + * A request from the subscribers to the VMS service to subscribe to a layer. + * + * This message type uses enum VmsMessageWithLayerIntegerValuesIndex. + */ + SUBSCRIBE = 1, + /** + * A request from the subscribers to the VMS service to subscribe to a layer from a specific + * publisher. + * + * This message type uses enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex. + */ + SUBSCRIBE_TO_PUBLISHER = 2, + /** + * A request from the subscribers to the VMS service to unsubscribes from a layer. + * + * This message type uses enum VmsMessageWithLayerIntegerValuesIndex. + */ + UNSUBSCRIBE = 3, + /** + * A request from the subscribers to the VMS service to unsubscribes from a layer from a + * specific publisher. + * + * This message type uses enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex. + */ + UNSUBSCRIBE_TO_PUBLISHER = 4, + /** + * Information from the publishers to the VMS service about the layers which the client can + * publish. + * + * This message type uses enum VmsOfferingMessageIntegerValuesIndex. + */ + OFFERING = 5, + /** + * A request from the subscribers to the VMS service to get the available layers. + * + * This message type uses enum VmsBaseMessageIntegerValuesIndex. + */ + AVAILABILITY_REQUEST = 6, + /** + * A request from the publishers to the VMS service to get the layers with subscribers. + * + * This message type uses enum VmsBaseMessageIntegerValuesIndex. + */ + SUBSCRIPTIONS_REQUEST = 7, + /** + * A response from the VMS service to the subscribers to a VmsMessageType.AVAILABILITY_REQUEST + * + * This message type uses enum VmsAvailabilityStateIntegerValuesIndex. + */ + AVAILABILITY_RESPONSE = 8, + /** + * A notification from the VMS service to the subscribers on a change in the available layers. + * + * This message type uses enum VmsAvailabilityStateIntegerValuesIndex. + */ + AVAILABILITY_CHANGE = 9, + /** + * A response from the VMS service to the publishers to a VmsMessageType.SUBSCRIPTIONS_REQUEST + * + * This message type uses enum VmsSubscriptionsStateIntegerValuesIndex. + */ + SUBSCRIPTIONS_RESPONSE = 10, + /** + * A notification from the VMS service to the publishers on a change in the layers with + * subscribers. + * + * This message type uses enum VmsSubscriptionsStateIntegerValuesIndex. + */ + SUBSCRIPTIONS_CHANGE = 11, + /** + * A message from the VMS service to the subscribers or from the publishers to the VMS service + * with a serialized VMS data packet as defined in the VMS protocol. + * + * This message type uses enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex. + */ + DATA = 12, + /** + * A request from the publishers to the VMS service to get a Publisher ID for a serialized VMS + * provider description packet as defined in the VMS protocol. + * + * This message type uses enum VmsBaseMessageIntegerValuesIndex. + */ + PUBLISHER_ID_REQUEST = 13, + /** + * A response from the VMS service to the publisher that contains a provider description packet + * and the publisher ID assigned to it. + * + * This message type uses enum VmsPublisherInformationIntegerValuesIndex. + */ + PUBLISHER_ID_RESPONSE = 14, + /** + * A request from the subscribers to the VMS service to get information for a Publisher ID. + * + * This message type uses enum VmsPublisherInformationIntegerValuesIndex. + */ + PUBLISHER_INFORMATION_REQUEST = 15, + /** + * A response from the VMS service to the subscribers that contains a provider description + * packet and the publisher ID assigned to it. + * + * This message type uses enum VmsPublisherInformationIntegerValuesIndex. + */ + PUBLISHER_INFORMATION_RESPONSE = 16, + /** + * A notification indicating that the sender has been reset. + * + * The receiving party must reset its internal state and respond to the + * sender with a START_SESSION message as acknowledgement. + * + * This message type uses enum VmsStartSessionMessageIntegerValuesIndex. + */ + START_SESSION = 17, + // LAST_VMS_MESSAGE_TYPE = START_SESSION, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c3a189cf460006e59288278f1032e720ac06b1bd --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl @@ -0,0 +1,37 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VmsMessageWithLayerIntegerValuesIndex; + +/* + * A VMS message with a layer and publisher ID is sent as part of a + * VmsMessageType.SUBSCRIBE_TO_PUBLISHER, VmsMessageType.UNSUBSCRIBE_TO_PUBLISHER messages and + * VmsMessageType.DATA . + */ +@VintfStability +@Backing(type="int") +enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, + PUBLISHER_ID = 4, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b209bf6bdb58d6bdeded0b72e7a11cb92a804abd --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl @@ -0,0 +1,38 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VmsBaseMessageIntegerValuesIndex; + +/* + * A VMS message with a layer is sent as part of a VmsMessageType.SUBSCRIBE or + * VmsMessageType.UNSUBSCRIBE messages. + * + * The layer type is defined in the VMS protocol, and the subtype and version are + * controlled by the implementer of the publisher. + */ +@VintfStability +@Backing(type="int") +enum VmsMessageWithLayerIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91c3297a37c408de44e9ffe46679d24d5d9f14c9 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl @@ -0,0 +1,43 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VmsBaseMessageIntegerValuesIndex; + +/* + * An offering can be sent by publishers as part of VmsMessageType.OFFERING in order to + * advertise which layers they can publish and under which constraints: e.g., I can publish Layer X + * if someone else will publish Layer Y. + * The offering contains the publisher ID which was assigned to the publisher by the VMS service. + * A single offering is represented as: + * - Layer type + * - Layer subtype + * - Layer version + * - Number of dependencies (N) + * - N x (Layer type, Layer subtype, Layer version) + */ +@VintfStability +@Backing(type="int") +enum VmsOfferingMessageIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, + NUMBER_OF_OFFERS = 2, + OFFERING_START = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..79bbe50affe264d5ef8018d3763e1740f3c751ff --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl @@ -0,0 +1,34 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VmsBaseMessageIntegerValuesIndex; + +/* + * Publishers send the VMS service their information and assigned in response a publisher ID. + * Subscribers can request the publisher information for a publisher ID they received in other + * messages. + */ +@VintfStability +@Backing(type="int") +enum VmsPublisherInformationIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..313ed8936fae784684a14501d8ac83a9c6d5955d --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl @@ -0,0 +1,53 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VmsBaseMessageIntegerValuesIndex; + +/* + * Handshake data sent as part of a VmsMessageType.START_SESSION message. + * + * A new session is initiated by sending a START_SESSION message with the + * sender's identifier populated and the receiver's identifier set to -1. + * + * Identifier values are independently generated, but must be non-negative, and + * increase monotonically between reboots. + * + * Upon receiving a START_SESSION with a mis-matching identifier, the receiver + * must clear any cached VMS offering or subscription state and acknowledge the + * new session by responding with a START_SESSION message that populates both + * identifier fields. + * + * Any VMS messages received between initiation and completion of the handshake + * must be discarded. + */ +@VintfStability +@Backing(type="int") +enum VmsStartSessionMessageIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, + /* + * Identifier field for the Android system service. + */ + SERVICE_ID = 1, + /* + * Identifier field for the HAL client process. + */ + CLIENT_ID = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd03535a9a39787cd1eaec4ea881030ad8c1f5e2 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl @@ -0,0 +1,50 @@ +/* + * 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 android.hardware.automotive.vehicle; + +import android.hardware.automotive.vehicle.VmsBaseMessageIntegerValuesIndex; + +/** + * A subscriptions state is sent to the publishers in response to a change in the subscriptions + * as part of a VmsMessageType.SUBSCRIPTIONS_CHANGE, or in response to a + * VmsMessageType.SUBSCRIPTIONS_REQUEST message as part of VmsMessageType.SUBSCRIPTIONS_RESPONSE. + * The VMS service issues monotonically increasing sequence numbers, and in case a subscriber + * receives a smaller sequence number it should ignore the message. The subscriptions are sent as a + * list of layers followed by a list of associated layers: {Sequence number, N, M, N x layer, M x + * associated layer} A subscribed layer is represented as three integers: + * - Layer type + * - Layer subtype + * - Layer version + * A subscribed associated layer is a layer with a list of publisher IDs. It is represented as: + * - Layer type + * - Layer subtype + * - Layer version + * - Number of publisher IDs (N) + * - N x publisher ID + */ +@VintfStability +@Backing(type="int") +enum VmsSubscriptionsStateIntegerValuesIndex { + /* + * The message type as enumerated by VmsMessageType enum. + */ + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_LAYERS = 2, + NUMBER_OF_ASSOCIATED_LAYERS = 3, + SUBSCRIPTIONS_START = 4, +} diff --git a/automotive/vehicle/aidl/impl/Android.bp b/automotive/vehicle/aidl/impl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..d24a73902b1332f2fcd86fcd6ae75bf1501f610d --- /dev/null +++ b/automotive/vehicle/aidl/impl/Android.bp @@ -0,0 +1,42 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_defaults { + name: "VehicleHalDefaults", + static_libs: [ + "android-automotive-large-parcelable-lib", + "android.hardware.automotive.vehicle-V1-ndk", + "libmath", + ], + shared_libs: [ + "libbase", + "liblog", + "libutils", + ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", + ], + defaults: [ + "android-automotive-large-parcelable-defaults", + ], +} diff --git a/automotive/vehicle/aidl/impl/default_config/Android.bp b/automotive/vehicle/aidl/impl/default_config/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..0feaf23a739968d8aa7ae5c3e18a86023a0a2941 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/Android.bp @@ -0,0 +1,31 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_headers { + name: "VehicleHalDefaultConfig", + vendor: true, + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], + static_libs: ["VehicleHalUtils"], + header_libs: ["VehicleHalTestUtilHeaders"], + export_static_lib_headers: ["VehicleHalUtils"], + export_header_lib_headers: ["VehicleHalTestUtilHeaders"], +} diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..e00f775a043de8900f257214809f50286138f000 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -0,0 +1,1307 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ +#define android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ + +#include +#include +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// Types used in configs, not to be exposed as public API. +namespace defaultconfig_impl { + +using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; +using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; +using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; +using ::aidl::android::hardware::automotive::vehicle::FuelType; +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; +using ::aidl::android::hardware::automotive::vehicle::VehicleGear; +using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; +using ::aidl::android::hardware::automotive::vehicle::VehicleIgnitionState; +using ::aidl::android::hardware::automotive::vehicle::VehicleOilLevel; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; +using ::aidl::android::hardware::automotive::vehicle::VehicleSeatOccupancyState; +using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal; +using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; +using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; + +struct ConfigDeclaration { + VehiclePropConfig config; + + // This value will be used as an initial value for the property. If this field is specified for + // property that supports multiple areas then it will be used for all areas unless particular + // area is overridden in initialAreaValue field. + RawPropValues initialValue; + // Use initialAreaValues if it is necessary to specify different values per each area. + std::map initialAreaValues; +}; + +const std::vector kVehicleProperties = { + {.config = + { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.floatValues = {15000.0f}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_FUEL_TYPE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {toInt(FuelType::FUEL_TYPE_UNLEADED)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.floatValues = {150000.0f}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {toInt(EvConnectorType::IEC_TYPE_1_AC)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_FUEL_DOOR_LOCATION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {FUEL_DOOR_REAR_LEFT}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_EV_PORT_LOCATION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT, CHARGE_PORT_REAR_LEFT}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_MAKE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.stringValue = "Toy Vehicle"}}, + {.config = + { + .prop = toInt(VehicleProperty::INFO_MODEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.stringValue = "Speedy Model"}}, + {.config = + { + .prop = toInt(VehicleProperty::INFO_MODEL_YEAR), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {2020}}}, + {.config = + { + .prop = toInt(VehicleProperty::INFO_EXTERIOR_DIMENSIONS), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {1776, 4950, 2008, 2140, 2984, 1665, 1667, 11800}}}, + {.config = + { + .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}}, + + {.config = + { + .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleUnit::METER_PER_SEC), + toInt(VehicleUnit::MILES_PER_HOUR), + toInt(VehicleUnit::KILOMETERS_PER_HOUR)}, + }, + .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = (SEAT_1_LEFT)}, + VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}}, + }, + .initialAreaValues = {{SEAT_1_LEFT, + {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}, + {SEAT_1_RIGHT, + {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}}}, + + {.config = + { + .prop = toInt(VehicleProperty::INFO_DRIVER_SEAT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + // this was a zoned property on an old vhal, but it is meant to be global + .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, + }, + .initialValue = {.int32Values = {SEAT_1_LEFT}}}, + + {.config = + { + .prop = toInt(VehicleProperty::PERF_ODOMETER), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}}, + {.config = + { + .prop = toInt(VehicleProperty::PERF_STEERING_ANGLE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}}, + {.config = + { + .prop = toInt(VehicleProperty::PERF_REAR_STEERING_ANGLE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}}, + { + .config = + { + .prop = toInt(VehicleProperty::ENGINE_RPM), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}, + }, + + {.config = + { + .prop = toInt(VehicleProperty::FUEL_LEVEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 100.0f, + }, + .initialValue = {.floatValues = {15000.0f}}}, + + {.config = + { + .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 100.0f, + }, + .initialValue = {.floatValues = {150000.0f}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {/*max current draw allowed by vehicle in amperes=*/20}, + }, + .initialValue = {.floatValues = {(float)12.5}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_CHARGE_PERCENT_LIMIT), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {20, 40, 60, 80, 100}, + }, + .initialValue = {.floatValues = {40}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_CHARGE_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {2}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_CHARGE_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0 /* false */}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_CHARGE_TIME_REMAINING), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.int32Values = {20}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EV_REGENERATIVE_BRAKING_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {2}}}, + + {.config = + { + .prop = toInt(VehicleProperty::TRAILER_PRESENT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {2}}}, + + {.config = + { + .prop = toInt(VehicleProperty::VEHICLE_CURB_WEIGHT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {30}}}, + + {.config = + { + .prop = toInt(VehicleProperty::RANGE_REMAINING), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 2.0f, + }, + .initialValue = {.floatValues = {50000.0f}}}, // units in meters + + {.config = + { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .areaConfigs = {VehicleAreaConfig{ + .areaId = WHEEL_FRONT_LEFT, + .minFloatValue = 193.0f, + .maxFloatValue = 300.0f, + }, + VehicleAreaConfig{ + .areaId = WHEEL_FRONT_RIGHT, + .minFloatValue = 193.0f, + .maxFloatValue = 300.0f, + }, + VehicleAreaConfig{ + .areaId = WHEEL_REAR_LEFT, + .minFloatValue = 193.0f, + .maxFloatValue = 300.0f, + }, + VehicleAreaConfig{ + .areaId = WHEEL_REAR_RIGHT, + .minFloatValue = 193.0f, + .maxFloatValue = 300.0f, + }}, + .minSampleRate = 1.0f, + .maxSampleRate = 2.0f, + }, + .initialValue = {.floatValues = {200.0f}}}, // units in kPa + + {.config = + { + .prop = toInt(VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + .areaConfigs = {VehicleAreaConfig{.areaId = WHEEL_FRONT_LEFT}, + VehicleAreaConfig{.areaId = WHEEL_FRONT_RIGHT}, + VehicleAreaConfig{.areaId = WHEEL_REAR_RIGHT}, + VehicleAreaConfig{.areaId = WHEEL_REAR_LEFT}}, + }, + .initialAreaValues = {{WHEEL_FRONT_LEFT, {.floatValues = {137.0f}}}, + {WHEEL_FRONT_RIGHT, {.floatValues = {137.0f}}}, + {WHEEL_REAR_RIGHT, {.floatValues = {137.0f}}}, + {WHEEL_REAR_LEFT, {.floatValues = {137.0f}}}}}, + + {.config = + { + .prop = toInt(VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleUnit::KILOPASCAL), toInt(VehicleUnit::PSI), + toInt(VehicleUnit::BAR)}, + }, + .initialValue = {.int32Values = {toInt(VehicleUnit::PSI)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::CURRENT_GEAR), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleGear::GEAR_PARK), + toInt(VehicleGear::GEAR_NEUTRAL), + toInt(VehicleGear::GEAR_REVERSE), + toInt(VehicleGear::GEAR_1), toInt(VehicleGear::GEAR_2), + toInt(VehicleGear::GEAR_3), toInt(VehicleGear::GEAR_4), + toInt(VehicleGear::GEAR_5)}, + }, + .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::PARKING_BRAKE_ON), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {1}}}, + + {.config = + { + .prop = toInt(VehicleProperty::PARKING_BRAKE_AUTO_APPLY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {1}}}, + + {.config = + { + .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HW_KEY_INPUT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0, 0, 0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HW_ROTARY_INPUT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0, 0, 0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HW_CUSTOM_INPUT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {0, 0, 0, 3, 0, 0, 0, 0, 0}, + }, + .initialValue = + { + .int32Values = {0, 0, 0}, + }}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}, + // TODO(bryaneyler): Ideally, this is generated dynamically from + // kHvacPowerProperties. + .configArray = {toInt(VehicleProperty::HVAC_FAN_SPEED), + toInt(VehicleProperty::HVAC_FAN_DIRECTION)}}, + .initialValue = {.int32Values = {1}}}, + + { + .config = {.prop = toInt(VehicleProperty::HVAC_DEFROSTER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)}, + VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}}, + .initialValue = {.int32Values = {0}} // Will be used for all areas. + }, + { + .config = {.prop = toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)}, + VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}}, + .initialValue = {.int32Values = {0}} // Will be used for all areas. + }, + + {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {1}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {1}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_AC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {1}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_DUAL_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ + .areaId = HVAC_ALL, .minInt32Value = 1, .maxInt32Value = 7}}}, + .initialValue = {.int32Values = {3}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR, + FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR, + FAN_DIRECTION_DEFROST, + FAN_DIRECTION_FACE | FAN_DIRECTION_DEFROST, + FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST, + FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | + FAN_DIRECTION_FACE}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ + .areaId = SEAT_1_LEFT, + .minInt32Value = 0, + .maxInt32Value = 3, + }, + VehicleAreaConfig{ + .areaId = SEAT_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 3, + }}}, + .initialValue = + {.int32Values = {0}}}, // 0 is off and +ve values indicate ventilation level. + + {.config = {.prop = toInt(VehicleProperty::HVAC_STEERING_WHEEL_HEAT), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ + .areaId = (0), .minInt32Value = -2, .maxInt32Value = 2}}}, + .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling + + {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ + .areaId = SEAT_1_LEFT, + .minInt32Value = -2, + .maxInt32Value = 2, + }, + VehicleAreaConfig{ + .areaId = SEAT_1_RIGHT, + .minInt32Value = -2, + .maxInt32Value = 2, + }}}, + .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling + + {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {160, 280, 5, 605, 825, 10}, + .areaConfigs = {VehicleAreaConfig{ + .areaId = HVAC_LEFT, + .minFloatValue = 16, + .maxFloatValue = 32, + }, + VehicleAreaConfig{ + .areaId = HVAC_RIGHT, + .minFloatValue = 16, + .maxFloatValue = 32, + }}}, + .initialAreaValues = {{HVAC_LEFT, {.floatValues = {16}}}, + {HVAC_RIGHT, {.floatValues = {20}}}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.floatValues = {66.2f, (float)VehicleUnit::FAHRENHEIT, 19.0f, 66.5f}}}, + + {.config = + { + .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE), + .access = VehiclePropertyAccess::READ, + // TODO(bryaneyler): Support ON_CHANGE as well. + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 2.0f, + }, + .initialValue = {.floatValues = {25.0f}}}, + + {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleUnit::FAHRENHEIT), toInt(VehicleUnit::CELSIUS)}}, + .initialValue = {.int32Values = {toInt(VehicleUnit::FAHRENHEIT)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, + .configArray = {toInt(VehicleUnit::KILOMETER), toInt(VehicleUnit::MILE)}, + }, + .initialValue = {.int32Values = {toInt(VehicleUnit::MILE)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::NIGHT_MODE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::GEAR_SELECTION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleGear::GEAR_PARK), + toInt(VehicleGear::GEAR_NEUTRAL), + toInt(VehicleGear::GEAR_REVERSE), + toInt(VehicleGear::GEAR_DRIVE), toInt(VehicleGear::GEAR_1), + toInt(VehicleGear::GEAR_2), toInt(VehicleGear::GEAR_3), + toInt(VehicleGear::GEAR_4), toInt(VehicleGear::GEAR_5)}, + }, + .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::TURN_SIGNAL_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {toInt(VehicleTurnSignal::NONE)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::IGNITION_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {toInt(VehicleOilLevel::NORMAL)}}}, + + {.config = + { + .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.1, // 0.1 Hz, every 10 seconds + .maxSampleRate = 10, // 10 Hz, every 100 ms + }, + .initialValue = {.floatValues = {101.0f}}}, + + { + .config = {.prop = kMixedTypePropertyForTest, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0}}, + .initialValue = + { + .int32Values = {1 /* indicate TRUE boolean value */, 2, 3}, + .floatValues = {4.5f}, + .stringValue = "MIXED property", + }, + }, + + {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, + VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, + VehicleAreaConfig{.areaId = DOOR_2_LEFT}, + VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, + .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, + {DOOR_1_RIGHT, {.int32Values = {1}}}, + {DOOR_2_LEFT, {.int32Values = {1}}}, + {DOOR_2_RIGHT, {.int32Values = {1}}}}}, + + {.config = {.prop = toInt(VehicleProperty::DOOR_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{ + .areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = DOOR_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 1}, + VehicleAreaConfig{ + .areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = DOOR_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 1}, + VehicleAreaConfig{ + .areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT | + WINDOW_2_RIGHT}}}, + .initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT, + {.int32Values = {0}}}}}, + + {.config = {.prop = toInt(VehicleProperty::WINDOW_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_2_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = + { + .prop = WHEEL_TICK, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000}, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}}, + + {.config = {.prop = ABS_ACTIVE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = TRACTION_CONTROL_ACTIVE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {3}}}, + + {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL), 0}}}, + + {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 100}}}, + .initialValue = {.int32Values = {100}}}, + + { + .config = {.prop = OBD2_LIVE_FRAME, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {0, 0}}, + }, + + { + .config = {.prop = OBD2_FREEZE_FRAME, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {0, 0}}, + }, + + { + .config = {.prop = OBD2_FREEZE_FRAME_INFO, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + }, + + { + .config = {.prop = OBD2_FREEZE_FRAME_CLEAR, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {1}}, + }, + + {.config = + { + .prop = toInt(VehicleProperty::HEADLIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = + { + .prop = toInt(VehicleProperty::FOG_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = + { + .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = + { + .prop = toInt(VehicleProperty::REAR_FOG_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HAZARD_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + + {.config = + { + .prop = toInt(VehicleProperty::FOG_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + + {.config = + { + .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + + {.config = + { + .prop = toInt(VehicleProperty::REAR_FOG_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + + {.config = + { + .prop = toInt(VehicleProperty::HAZARD_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + + {.config = + { + .prop = toInt(VehicleProperty::EVS_SERVICE_REQUEST), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {toInt(EvsServiceType::REARVIEW), + toInt(EvsServiceState::OFF)}}}, + + {.config = {.prop = VEHICLE_MAP_SERVICE, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}}, + + // Example Vendor Extension properties for testing + {.config = {.prop = VENDOR_EXTENSION_BOOLEAN_PROPERTY, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, + VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, + VehicleAreaConfig{.areaId = DOOR_2_LEFT}, + VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, + .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, + {DOOR_1_RIGHT, {.int32Values = {1}}}, + {DOOR_2_LEFT, {.int32Values = {0}}}, + {DOOR_2_RIGHT, {.int32Values = {0}}}}}, + + {.config = {.prop = VENDOR_EXTENSION_FLOAT_PROPERTY, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT, + .minFloatValue = -10, + .maxFloatValue = 10}, + VehicleAreaConfig{.areaId = HVAC_RIGHT, + .minFloatValue = -10, + .maxFloatValue = 10}}}, + .initialAreaValues = {{HVAC_LEFT, {.floatValues = {1}}}, + {HVAC_RIGHT, {.floatValues = {2}}}}}, + + {.config = {.prop = VENDOR_EXTENSION_INT_PROPERTY, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD), + .minInt32Value = -100, + .maxInt32Value = 100}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD), + .minInt32Value = -100, + .maxInt32Value = 100}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::ROOF_TOP_1), + .minInt32Value = -100, + .maxInt32Value = 100}}}, + .initialAreaValues = {{toInt(VehicleAreaWindow::FRONT_WINDSHIELD), {.int32Values = {1}}}, + {toInt(VehicleAreaWindow::REAR_WINDSHIELD), {.int32Values = {0}}}, + {toInt(VehicleAreaWindow::ROOF_TOP_1), {.int32Values = {-1}}}}}, + + {.config = {.prop = VENDOR_EXTENSION_STRING_PROPERTY, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.stringValue = "Vendor String Property"}}, + + {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {0}}}, + + {.config = + { + .prop = toInt(VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {kMixedTypePropertyForTest, + toInt(VehicleVendorPermission:: + PERMISSION_GET_VENDOR_CATEGORY_INFO), + toInt(VehicleVendorPermission:: + PERMISSION_SET_VENDOR_CATEGORY_INFO), + VENDOR_EXTENSION_INT_PROPERTY, + toInt(VehicleVendorPermission:: + PERMISSION_GET_VENDOR_CATEGORY_SEAT), + toInt(VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE), + VENDOR_EXTENSION_FLOAT_PROPERTY, + toInt(VehicleVendorPermission::PERMISSION_DEFAULT), + toInt(VehicleVendorPermission::PERMISSION_DEFAULT)}, + }, + .initialValue = {.int32Values = {1}}}, + + { + .config = + { + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::SWITCH_USER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::CREATE_USER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::REMOVE_USER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::POWER_POLICY_REQ), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::POWER_POLICY_GROUP_REQ), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::CURRENT_POWER_POLICY), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::ANDROID_EPOCH_TIME), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::WATCHDOG_ALIVE), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::WATCHDOG_TERMINATED_PROCESS), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::CLUSTER_SWITCH_UI), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0 /* ClusterHome */}}, + }, + { + .config = + { + .prop = toInt(VehicleProperty::CLUSTER_DISPLAY_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, + -1, -1 /* Insets */}}, + }, + { + .config = + { + .prop = toInt(VehicleProperty::CLUSTER_REPORT_STATE), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16}, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = PLACEHOLDER_PROPERTY_INT, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0}}, + }, + { + .config = + { + .prop = PLACEHOLDER_PROPERTY_FLOAT, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.floatValues = {0.0f}}, + }, + { + .config = + { + .prop = PLACEHOLDER_PROPERTY_BOOLEAN, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0 /* false */}}, + }, + { + .config = + { + .prop = PLACEHOLDER_PROPERTY_STRING, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.stringValue = {"Test"}}, + }, + { + .config = + { + .prop = ECHO_REVERSE_BYTES, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, +#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING + // Vendor propetry for E2E ClusterHomeService testing. + { + .config = + { + .prop = VENDOR_CLUSTER_SWITCH_UI, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = VENDOR_CLUSTER_DISPLAY_STATE, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, + { + .config = + { + .prop = VENDOR_CLUSTER_REPORT_STATE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16}, + }, + .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, + -1, -1 /* Insets */, 0 /* ClusterHome */, + -1 /* ClusterNone */}}, + }, + { + .config = + { + .prop = VENDOR_CLUSTER_REQUEST_DISPLAY, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {0 /* ClusterHome */}}, + }, + { + .config = + { + .prop = VENDOR_CLUSTER_NAVIGATION_STATE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + }, +#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING +}; + +} // namespace defaultconfig_impl + +// public namespace +namespace defaultconfig { + +typedef defaultconfig_impl::ConfigDeclaration ConfigDeclaration; + +inline constexpr const std::vector& getDefaultConfigs() { + return defaultconfig_impl::kVehicleProperties; +} + +} // namespace defaultconfig + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..771472c8c18c88fb2f3da0b9d7be777c5ef9d915 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp @@ -0,0 +1,34 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "VehicleHalDefaultConfigTest", + vendor: true, + defaults: ["VehicleHalDefaults"], + srcs: ["*.cpp"], + static_libs: [ + "VehicleHalUtils", + "libgtest", + ], + header_libs: [ + "VehicleHalDefaultConfig", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..baaae75108a2de207a88e9140052393594a67732 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp @@ -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. + */ + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace defaultconfig { + +namespace test { + +TEST(DefaultConfigTest, loadDefaultConfigs) { + for (ConfigDeclaration config : getDefaultConfigs()) { + ASSERT_NE(0, config.config.prop); + } +} + +} // namespace test + +} // namespace defaultconfig +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..ab223d3f94e9c942770820aead6a5cb90b06d2f8 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/Android.bp @@ -0,0 +1,35 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library { + name: "FakeVehicleHalValueGenerators", + vendor: true, + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], + static_libs: [ + "VehicleHalUtils", + "FakeObd2Frame", + ], + shared_libs: [ + "libjsoncpp", + ], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/FakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/FakeValueGenerator.h new file mode 100644 index 0000000000000000000000000000000000000000..5c90c301bc608d71b70b0c4601da3cfee96ac7c0 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/FakeValueGenerator.h @@ -0,0 +1,46 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_FakeValueGenerator_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_FakeValueGenerator_H_ + +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +// A abstract class for all fake value generators. +class FakeValueGenerator { + public: + virtual ~FakeValueGenerator() = default; + + // Returns the next event if there is one or {@code std::nullopt} if there is none. + virtual std::optional + nextEvent() = 0; +}; + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_FakeValueGenerator_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h new file mode 100644 index 0000000000000000000000000000000000000000..9f112ae7947b24cb645e20eacdeb4accfde141e1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h @@ -0,0 +1,92 @@ +/* + * 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. + */ + +#ifndef android_hardware_interfaces_automotive_vehicle_aidl_fake_impl_GeneratorHub_include_GeneratorHub_h_ +#define android_hardware_interfaces_automotive_vehicle_aidl_fake_impl_GeneratorHub_include_GeneratorHub_h_ + +#include "FakeValueGenerator.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +// This is the scheduler for all VHAL event generators. It manages all generators and uses priority +// queue to maintain generated events ordered by timestamp. The scheduler uses a single thread to +// keep querying and updating the event queue to make sure events from all generators are produced +// in order. +class GeneratorHub { + public: + using OnHalEvent = std::function; + + explicit GeneratorHub(OnHalEvent&& onHalEvent); + ~GeneratorHub(); + + // Register a new generator. The generator will be discarded if it could not produce next event. + // The existing generator will be overridden if it has the same generatorId. + void registerGenerator(int32_t generatorId, std::unique_ptr generator); + + // Unregister a generator with the generatorId. If no registered generator is found, this + // function does nothing. + void unregisterGenerator(int32_t generatorId); + + private: + struct VhalEvent { + int32_t generatorId; + aidl::android::hardware::automotive::vehicle::VehiclePropValue val; + }; + + // Comparator used by priority queue to keep track of soonest event. + struct GreaterByTime { + bool operator()(const VhalEvent& lhs, const VhalEvent& rhs) const { + return lhs.val.timestamp > rhs.val.timestamp; + } + }; + + std::priority_queue, GreaterByTime> mEventQueue; + std::mutex mGeneratorsLock; + std::unordered_map> mGenerators + GUARDED_BY(mGeneratorsLock); + OnHalEvent mOnHalEvent; + std::condition_variable mCond; + std::thread mThread; + std::atomic mShuttingDownFlag{false}; + + // Main loop of the single thread to producing event and updating event queue. + void run(); +}; + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_interfaces_automotive_vehicle_aidl_fake_impl_GeneratorHub_include_GeneratorHub_h_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h new file mode 100644 index 0000000000000000000000000000000000000000..d421ac525d5b6d2947103b98c6efdc330012586e --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_JsonFakeValueGenerator_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_JsonFakeValueGenerator_H_ + +#include "FakeValueGenerator.h" + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +class JsonFakeValueGenerator : public FakeValueGenerator { + public: + // Create a new JSON fake value generator. {@code request.value.stringValue} is the JSON file + // name. {@code request.value.int32Values[1]} if exists, is the number of iterations. If + // {@code int32Values} has less than 2 elements, number of iterations would be set to -1, which + // means iterate indefinitely. + explicit JsonFakeValueGenerator( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request); + // Create a new JSON fake value generator using the specified JSON file path. All the events + // in the JSON file would be generated for number of {@code iteration}. If iteration is 0, no + // value would be generated. If iteration is less than 0, it would iterate indefinitely. + explicit JsonFakeValueGenerator(const std::string& path, int32_t iteration); + // Create a new JSON fake value generator using the specified JSON file path. All the events + // in the JSON file would be generated once. + explicit JsonFakeValueGenerator(const std::string& path); + + ~JsonFakeValueGenerator() = default; + + std::optional nextEvent() + override; + const std::vector& + getAllEvents(); + + private: + size_t mEventIndex = 0; + std::vector mEvents; + int64_t mLastEventTimestamp = 0; + int32_t mNumOfIterations = 0; + + void setBit(std::vector& bytes, size_t idx); + void init(const std::string& path, int32_t iteration); +}; + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_JsonFakeValueGenerator_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/LinearFakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/LinearFakeValueGenerator.h new file mode 100644 index 0000000000000000000000000000000000000000..d2b701d9a5ae6f422c4b87ea49374cfb277c1be3 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/LinearFakeValueGenerator.h @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_LinearFakeValueGenerator_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_LinearFakeValueGenerator_H_ + +#include "FakeValueGenerator.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +class LinearFakeValueGenerator : public FakeValueGenerator { + public: + // A linear value generator initialized using values in request. + // int32Values[1]: propId + // floatValues[0]: middleValue and currentValue + // floatValues[1]: dispersion + // floatValues[2]: increment + // int64Values[0]: interval + // {@code propId} must be INT32 or INT64 or FLOAT type. + explicit LinearFakeValueGenerator( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request); + // A linear value generator in range [middleValue - dispersion, middleValue + dispersion), + // starts at 'currentValue' and at each 'interval', increase by 'increment' and loop back if + // exceeds middleValue + dispersion. {@code propId} must be INT32 or INT64 or FLOAT type. + explicit LinearFakeValueGenerator(int32_t propId, float middleValue, float initValue, + float dispersion, float increment, int64_t interval); + ~LinearFakeValueGenerator() = default; + + std::optional nextEvent() + override; + + private: + // In every timer tick we may want to generate new value based on initial value for debug + // purpose. It's better to have sequential values to see if events gets delivered in order + // to the client. + struct GeneratorCfg { + int32_t propId; + float middleValue; + float currentValue; // Should be in range (middleValue +/- dispersion). + float dispersion; // Defines minimum and maximum value based on initial value. + float increment; // Value that we will be added to currentValue with each timer tick. + int64_t interval; + long lastEventTimestamp; + }; + + GeneratorCfg mGenCfg; + + void initGenCfg(int32_t propId, float middleValue, float initValue, float dispersion, + float increment, int64_t interval); +}; + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_GeneratorHub_include_LinearFakeValueGenerator_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0c182d9c2b28ce3c8936e471ea4888585dc58bbb --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp @@ -0,0 +1,123 @@ +/* + * 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_TAG "GeneratorHub" + +#include "GeneratorHub.h" + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +using ::android::base::ScopedLockAssertion; + +GeneratorHub::GeneratorHub(OnHalEvent&& onHalEvent) + : mOnHalEvent(onHalEvent), mThread(&GeneratorHub::run, this) {} + +GeneratorHub::~GeneratorHub() { + mShuttingDownFlag.store(true); + mCond.notify_all(); + if (mThread.joinable()) { + mThread.join(); + } +} + +void GeneratorHub::registerGenerator(int32_t id, std::unique_ptr generator) { + { + std::scoped_lock lockGuard(mGeneratorsLock); + auto maybeNextEvent = generator->nextEvent(); + // Register only if the generator can produce at least one event. + if (maybeNextEvent.has_value()) { + // Push the next event if it is a new generator + if (mGenerators.find(id) == mGenerators.end()) { + ALOGI("%s: Registering new generator, id: %d", __func__, id); + mEventQueue.push({id, maybeNextEvent.value()}); + } + mGenerators[id] = std::move(generator); + ALOGI("%s: Registered generator, id: %d", __func__, id); + } + } + mCond.notify_one(); +} + +void GeneratorHub::unregisterGenerator(int32_t id) { + { + std::scoped_lock lockGuard(mGeneratorsLock); + mGenerators.erase(id); + } + mCond.notify_one(); + ALOGI("%s: Unregistered generator, id: %d", __func__, id); +} + +void GeneratorHub::run() { + while (!mShuttingDownFlag.load()) { + std::unique_lock lock(mGeneratorsLock); + ScopedLockAssertion lock_assertion(mGeneratorsLock); + // Pop events whose generator does not exist (may be already unregistered) + while (!mEventQueue.empty() && + mGenerators.find(mEventQueue.top().generatorId) == mGenerators.end()) { + mEventQueue.pop(); + } + // Wait until event queue is not empty or shutting down flag is set. + // This would unlock mGeneratorsLock and reacquire later. + mCond.wait(lock, [this] { return !mEventQueue.empty() || mShuttingDownFlag.load(); }); + if (mShuttingDownFlag.load()) { + break; + } + + const VhalEvent& curEvent = mEventQueue.top(); + long currentTime = elapsedRealtimeNano(); + long waitTime = + curEvent.val.timestamp > currentTime ? curEvent.val.timestamp - currentTime : 0; + if (waitTime != 0) { + // Wait until the soonest event happen + if (mCond.wait_for(lock, std::chrono::nanoseconds(waitTime)) != + std::cv_status::timeout) { + // It is possible that a new generator is registered and produced a sooner event, or + // current generator is unregistered, in this case the thread will re-evaluate the + // soonest event + ALOGI("Something happened while waiting"); + continue; + } + } + // Now it's time to handle current event. + mOnHalEvent(curEvent.val); + // Update queue by popping current event and producing next event from the same generator + int32_t id = curEvent.generatorId; + mEventQueue.pop(); + if (mGenerators.find(id) != mGenerators.end()) { + auto maybeNextEvent = mGenerators[id]->nextEvent(); + if (maybeNextEvent.has_value()) { + mEventQueue.push({id, maybeNextEvent.value()}); + continue; + } + } + + ALOGI("%s: Generator ended, unregister it, id: %d", __func__, id); + mGenerators.erase(id); + } +} + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d4d52a58493bdd972e719bbca4841359f59162a1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp @@ -0,0 +1,248 @@ +/* + * 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_TAG "JsonFakeValueGenerator" + +#include "JsonFakeValueGenerator.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::DiagnosticFloatSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::DiagnosticIntegerSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +bool isDiagnosticProperty(int32_t prop) { + return prop == toInt(VehicleProperty::OBD2_LIVE_FRAME) || + prop == toInt(VehicleProperty::OBD2_FREEZE_FRAME); +} + +void setBit(std::vector& bytes, size_t idx) { + uint8_t mask = 1 << (idx % 8); + bytes[idx / 8] |= mask; +} + +template +void copyJsonArray(const Json::Value& jsonArray, std::vector& dest) { + dest.resize(jsonArray.size()); + for (Json::Value::ArrayIndex i = 0; i < jsonArray.size(); i++) { + if (std::is_same::value) { + dest[i] = jsonArray[i].asInt(); + } else if (std::is_same::value) { + dest[i] = jsonArray[i].asInt64(); + } else if (std::is_same::value) { + dest[i] = jsonArray[i].asFloat(); + } + } +} + +void copyMixedValueJson(const Json::Value& jsonValue, RawPropValues& dest) { + copyJsonArray(jsonValue["int32Values"], dest.int32Values); + copyJsonArray(jsonValue["int64Values"], dest.int64Values); + copyJsonArray(jsonValue["floatValues"], dest.floatValues); + dest.stringValue = jsonValue["stringValue"].asString(); +} + +std::vector generateDiagnosticBytes(const RawPropValues& diagnosticValue) { + size_t lastIntegerSensorIndex = static_cast( + obd2frame::Obd2SensorStore::getLastIndex()); + size_t lastFloatSensorIndex = static_cast( + obd2frame::Obd2SensorStore::getLastIndex()); + + size_t byteSize = (lastIntegerSensorIndex + lastFloatSensorIndex + 2); + std::vector bytes((byteSize + 7) / 8); + + auto& int32Values = diagnosticValue.int32Values; + for (size_t i = 0; i < int32Values.size(); i++) { + if (int32Values[i] != 0) { + setBit(bytes, i); + } + } + + auto& floatValues = diagnosticValue.floatValues; + for (size_t i = 0; i < floatValues.size(); i++) { + if (floatValues[i] != 0.0) { + setBit(bytes, i + lastIntegerSensorIndex + 1); + } + } + return bytes; +} + +std::vector parseFakeValueJson(std::istream& is) { + std::vector fakeVhalEvents; + + Json::CharReaderBuilder builder; + Json::Value rawEvents; + std::string errorMessage; + if (!Json::parseFromStream(builder, is, &rawEvents, &errorMessage)) { + ALOGE("%s: Failed to parse fake data JSON file. Error: %s", __func__, errorMessage.c_str()); + return fakeVhalEvents; + } + + for (Json::Value::ArrayIndex i = 0; i < rawEvents.size(); i++) { + Json::Value rawEvent = rawEvents[i]; + if (!rawEvent.isObject()) { + ALOGE("%s: VHAL JSON event should be an object, %s", __func__, + rawEvent.toStyledString().c_str()); + continue; + } + if (rawEvent["prop"].empty() || rawEvent["areaId"].empty() || rawEvent["value"].empty() || + rawEvent["timestamp"].empty()) { + ALOGE("%s: VHAL JSON event has missing fields, skip it, %s", __func__, + rawEvent.toStyledString().c_str()); + continue; + } + VehiclePropValue event = { + .timestamp = rawEvent["timestamp"].asInt64(), + .areaId = rawEvent["areaId"].asInt(), + .prop = rawEvent["prop"].asInt(), + }; + + Json::Value rawEventValue = rawEvent["value"]; + auto& value = event.value; + int32_t count; + switch (getPropType(event.prop)) { + case VehiclePropertyType::BOOLEAN: + case VehiclePropertyType::INT32: + value.int32Values.resize(1); + value.int32Values[0] = rawEventValue.asInt(); + break; + case VehiclePropertyType::INT64: + value.int64Values.resize(1); + value.int64Values[0] = rawEventValue.asInt64(); + break; + case VehiclePropertyType::FLOAT: + value.floatValues.resize(1); + value.floatValues[0] = rawEventValue.asFloat(); + break; + case VehiclePropertyType::STRING: + value.stringValue = rawEventValue.asString(); + break; + case VehiclePropertyType::INT32_VEC: + value.int32Values.resize(rawEventValue.size()); + count = 0; + for (auto& it : rawEventValue) { + value.int32Values[count++] = it.asInt(); + } + break; + case VehiclePropertyType::MIXED: + copyMixedValueJson(rawEventValue, value); + if (isDiagnosticProperty(event.prop)) { + value.byteValues = generateDiagnosticBytes(value); + } + break; + default: + ALOGE("%s: unsupported type for property: 0x%x", __func__, event.prop); + continue; + } + fakeVhalEvents.push_back(event); + } + return fakeVhalEvents; +} + +} // namespace + +JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path) { + init(path, 1); +} + +JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path, int32_t iteration) { + init(path, iteration); +} + +JsonFakeValueGenerator::JsonFakeValueGenerator(const VehiclePropValue& request) { + const auto& v = request.value; + // Iterate infinitely if iteration number is not provided + int32_t numOfIterations = v.int32Values.size() < 2 ? -1 : v.int32Values[1]; + + init(v.stringValue, numOfIterations); +} + +void JsonFakeValueGenerator::init(const std::string& path, int32_t iteration) { + std::ifstream ifs(path); + if (!ifs) { + ALOGE("%s: couldn't open %s for parsing.", __func__, path.c_str()); + return; + } + mEvents = parseFakeValueJson(ifs); + mNumOfIterations = iteration; +} + +const std::vector& JsonFakeValueGenerator::getAllEvents() { + return mEvents; +} + +std::optional JsonFakeValueGenerator::nextEvent() { + if (mNumOfIterations == 0 || mEvents.size() == 0) { + return std::nullopt; + } + + VehiclePropValue generatedValue = mEvents[mEventIndex]; + + if (mLastEventTimestamp == 0) { + mLastEventTimestamp = elapsedRealtimeNano(); + } else { + int64_t nextEventTime = 0; + if (mEventIndex > 0) { + // All events (start from 2nd one) are supposed to happen in the future with a delay + // equals to the duration between previous and current event. + nextEventTime = mLastEventTimestamp + + (mEvents[mEventIndex].timestamp - mEvents[mEventIndex - 1].timestamp); + } else { + // We are starting another iteration, immediately send the next event after 1ms. + nextEventTime = mLastEventTimestamp + 1000000; + } + // Prevent overflow. + assert(nextEventTime > mLastEventTimestamp); + mLastEventTimestamp = nextEventTime; + } + + mEventIndex++; + if (mEventIndex == mEvents.size()) { + mEventIndex = 0; + if (mNumOfIterations > 0) { + mNumOfIterations--; + } + } + + generatedValue.timestamp = mLastEventTimestamp; + + return generatedValue; +} + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/LinearFakeValueGenerator.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/LinearFakeValueGenerator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..91331443bb2423fb4fdab7117129596ce9127ec7 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/LinearFakeValueGenerator.cpp @@ -0,0 +1,108 @@ +/* + * 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_TAG "LinearFakeValueGenerator" + +#include "LinearFakeValueGenerator.h" + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +LinearFakeValueGenerator::LinearFakeValueGenerator(int32_t propId, float middleValue, + float initValue, float dispersion, + float increment, int64_t interval) { + initGenCfg(propId, middleValue, initValue, dispersion, increment, interval); +} + +LinearFakeValueGenerator::LinearFakeValueGenerator(const VehiclePropValue& request) { + const auto& v = request.value; + initGenCfg(v.int32Values[1], v.floatValues[0], v.floatValues[0], v.floatValues[1], + v.floatValues[2], v.int64Values[0]); +} + +void LinearFakeValueGenerator::initGenCfg(int32_t propId, float middleValue, float initValue, + float dispersion, float increment, int64_t interval) { + // Other types are not supported. + assert(getPropType(propId) == VehicleProperty::INT32 || + getPropType(propId) == VehicleProperty::INT64 || + getPropType(propId) == VehicleProperty::FLOAT); + + if (initValue < middleValue - dispersion || initValue >= middleValue + dispersion) { + ALOGW("%s: invalid initValue: %f, out of range, default to %f", __func__, initValue, + middleValue); + initValue = middleValue; + } + mGenCfg = GeneratorCfg{ + .propId = propId, + .middleValue = middleValue, + .currentValue = initValue, + .dispersion = dispersion, + .increment = increment, + .interval = interval, + }; +} + +std::optional LinearFakeValueGenerator::nextEvent() { + VehiclePropValue event = { + .prop = mGenCfg.propId, + }; + auto& value = event.value; + switch (getPropType(event.prop)) { + case VehiclePropertyType::INT32: + value.int32Values = {static_cast(mGenCfg.currentValue)}; + break; + case VehiclePropertyType::INT64: + value.int64Values = {static_cast(mGenCfg.currentValue)}; + break; + case VehiclePropertyType::FLOAT: + value.floatValues = {mGenCfg.currentValue}; + break; + default: + ALOGE("%s: unsupported property type for 0x%x", __func__, event.prop); + } + if (mGenCfg.lastEventTimestamp == 0) { + mGenCfg.lastEventTimestamp = elapsedRealtimeNano(); + } else { + long nextEventTime = mGenCfg.lastEventTimestamp + mGenCfg.interval; + // Prevent overflow. + assert(nextEventTime > mGenCfg.lastEventTimestamp); + mGenCfg.lastEventTimestamp = nextEventTime; + } + event.timestamp = mGenCfg.lastEventTimestamp; + + mGenCfg.currentValue += mGenCfg.increment; + if (mGenCfg.currentValue >= mGenCfg.middleValue + mGenCfg.dispersion) { + // Wrap around, (i - d) + c - (i + d) = c - 2 * d + mGenCfg.currentValue = mGenCfg.currentValue - 2 * mGenCfg.dispersion; + } + return event; +} + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..2eef13c6e91ff89534fc45e7c5e5d9ce0c565f8a --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp @@ -0,0 +1,47 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "FakeVehicleHalValueGeneratorsTest", + vendor: true, + srcs: ["*.cpp"], + defaults: ["VehicleHalDefaults"], + static_libs: [ + "VehicleHalUtils", + "FakeVehicleHalValueGenerators", + "FakeObd2Frame", + ], + shared_libs: [ + "libjsoncpp", + ], + data: [ + ":FakeVehicleHalValueGeneratorsTestFiles", + ], + test_suites: ["device-tests"], +} + +filegroup { + name: "FakeVehicleHalValueGeneratorsTestFiles", + srcs: [ + "prop.json", + "prop_different_types.json", + "prop_invalid.json", + ], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cdfa8b20318e2f3a071c2147fa0a470850437bb1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp @@ -0,0 +1,483 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::ScopedLockAssertion; + +using std::literals::chrono_literals::operator""s; + +class FakeVehicleHalValueGeneratorsTest : public ::testing::Test { + protected: + void SetUp() override { + mHub = std::make_unique( + [this](const VehiclePropValue& event) { return onHalEvent(event); }); + } + + GeneratorHub* getHub() { return mHub.get(); } + + std::vector getEvents() { + std::scoped_lock lockGuard(mEventsLock); + return mEvents; + } + + void clearEvents() { + std::scoped_lock lockGuard(mEventsLock); + mEvents.clear(); + } + + void waitForEvents(size_t count) { + std::unique_lock uniqueLock(mEventsLock); + bool result = mCv.wait_for(uniqueLock, 10s, [this, count] { + ScopedLockAssertion lockAssertion(mEventsLock); + return mEvents.size() >= count; + }); + + ASSERT_TRUE(result) << "didn't receive enough events"; + } + + void TearDown() override { + // Generator callback uses mEvents, must stop generator before destroying mEvents. + mHub.reset(); + } + + static std::string getTestFilePath(const char* filename) { + static std::string baseDir = android::base::GetExecutableDirectory(); + return baseDir + "/" + filename; + } + + private: + void onHalEvent(const VehiclePropValue& event) { + VehiclePropValue eventCopy = event; + { + std::scoped_lock lockGuard(mEventsLock); + mEvents.push_back(std::move(eventCopy)); + } + mCv.notify_all(); + } + + std::unique_ptr mHub; + std::mutex mEventsLock; + std::condition_variable mCv; + std::vector mEvents GUARDED_BY(mEventsLock); +}; + +class TestFakeValueGenerator : public FakeValueGenerator { + public: + void setEvents(const std::vector& events) { + mEvents = events; + mEventIndex = 0; + } + + std::optional<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> nextEvent() + override { + if (mEventIndex == mEvents.size()) { + return std::nullopt; + } + return mEvents[mEventIndex++]; + } + + private: + std::vector mEvents; + size_t mEventIndex = 0; +}; + +TEST_F(FakeVehicleHalValueGeneratorsTest, testRegisterTestFakeValueGenerator) { + auto generator = std::make_unique(); + std::vector events; + size_t eventCount = 10; + int64_t timestamp = elapsedRealtimeNano(); + for (size_t i = 0; i < eventCount; i++) { + events.push_back(VehiclePropValue{ + .prop = static_cast(i), + // Generate 1 event every 1ms. + .timestamp = timestamp + static_cast(1000000 * i), + }); + } + generator->setEvents(events); + + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(events.size()); + + ASSERT_EQ(getEvents(), events); + + getHub()->unregisterGenerator(0); +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testUnregisterGeneratorStopGeneration) { + auto generator = std::make_unique(); + std::vector events; + size_t eventCount = 10; + int64_t timestamp = elapsedRealtimeNano(); + for (size_t i = 0; i < eventCount; i++) { + events.push_back(VehiclePropValue{ + .prop = static_cast(i), + // Generate 1 event every 1ms. + .timestamp = timestamp + static_cast(1000000 * i), + }); + } + generator->setEvents(events); + + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(1); + + getHub()->unregisterGenerator(0); + clearEvents(); + + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + // It is possible that one last event would be generated after unregistering. + ASSERT_LE(getEvents().size(), 1u) + << "Must stop generating event after generator is unregistered"; +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorFloat) { + std::unique_ptr generator = + std::make_unique(toInt(VehicleProperty::PERF_VEHICLE_SPEED), + /*middleValue=*/50.0, + /*initValue=*/30.0, + /*dispersion=*/50.0, + /*increment=*/20.0, + /*interval=*/10000000); + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(10); + auto events = getEvents(); + + int value = 30; + for (size_t i = 0; i < 10; i++) { + EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); + value = (value + 20) % 100; + } +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInt32) { + std::unique_ptr generator = + std::make_unique(toInt(VehicleProperty::INFO_MODEL_YEAR), + /*middleValue=*/50.0, + /*initValue=*/30.0, + /*dispersion=*/50.0, + /*increment=*/20.0, + /*interval=*/10000000); + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(10); + auto events = getEvents(); + + int value = 30; + for (size_t i = 0; i < 10; i++) { + EXPECT_EQ(std::vector({value}), events[i].value.int32Values); + value = (value + 20) % 100; + } +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInt64) { + std::unique_ptr generator = + std::make_unique(toInt(VehicleProperty::ANDROID_EPOCH_TIME), + /*middleValue=*/50.0, + /*initValue=*/30.0, + /*dispersion=*/50.0, + /*increment=*/20.0, + /*interval=*/10000000); + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(10); + auto events = getEvents(); + + int value = 30; + for (size_t i = 0; i < 10; i++) { + EXPECT_EQ(std::vector({value}), events[i].value.int64Values); + value = (value + 20) % 100; + } +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorUsingRequest) { + VehiclePropValue request; + request.value.int32Values = {0, toInt(VehicleProperty::PERF_VEHICLE_SPEED)}; + request.value.floatValues = {/*middleValue=*/50.0, /*dispersion=*/50.0, /*increment=*/20.0}; + request.value.int64Values = {/*interval=*/10000000}; + + std::unique_ptr generator = + std::make_unique(request); + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(10); + auto events = getEvents(); + + int value = 50; + for (size_t i = 0; i < 10; i++) { + EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); + value = (value + 20) % 100; + } +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInvalidInitValue) { + std::unique_ptr generator = + std::make_unique(toInt(VehicleProperty::PERF_VEHICLE_SPEED), + /*middleValue=*/50.0, + // Out of range + /*initValue=*/110.0, + /*dispersion=*/50.0, + /*increment=*/20.0, + /*interval=*/10000000); + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(10); + auto events = getEvents(); + + // Init value would be set to middleValue if given initValue is not valid. + int value = 50; + for (size_t i = 0; i < 10; i++) { + EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); + value = (value + 20) % 100; + } +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGenerator) { + int64_t currentTime = elapsedRealtimeNano(); + + std::unique_ptr generator = + std::make_unique(getTestFilePath("prop.json"), 2); + getHub()->registerGenerator(0, std::move(generator)); + + std::vector expectedValues = { + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {8}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {4}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {16}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {10}, + .prop = 289408000, + }, + }; + + // We have two iterations. + for (size_t i = 0; i < 4; i++) { + expectedValues.push_back(expectedValues[i]); + } + + waitForEvents(expectedValues.size()); + auto events = getEvents(); + + int64_t lastEventTime = currentTime; + for (auto& event : events) { + EXPECT_GT(event.timestamp, lastEventTime); + lastEventTime = event.timestamp; + event.timestamp = 0; + } + + EXPECT_EQ(events, expectedValues); +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorIterateIndefinitely) { + std::unique_ptr generator = + std::make_unique(getTestFilePath("prop.json"), -1); + getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(40); +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorUsingRequest) { + int64_t currentTime = elapsedRealtimeNano(); + + VehiclePropValue request = {.value = { + .stringValue = getTestFilePath("prop.json"), + .int32Values = {0, 2}, + }}; + + std::unique_ptr generator = + std::make_unique(request); + getHub()->registerGenerator(0, std::move(generator)); + + std::vector expectedValues = { + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {8}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {4}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {16}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {10}, + .prop = 289408000, + }, + }; + + // We have two iterations. + for (size_t i = 0; i < 4; i++) { + expectedValues.push_back(expectedValues[i]); + } + + waitForEvents(expectedValues.size()); + auto events = getEvents(); + + int64_t lastEventTime = currentTime; + for (auto& event : events) { + EXPECT_GT(event.timestamp, lastEventTime); + lastEventTime = event.timestamp; + event.timestamp = 0; + } + + EXPECT_EQ(events, expectedValues); +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorInvalidFile) { + VehiclePropValue request = {.value = { + .stringValue = getTestFilePath("prop_invalid.json"), + .int32Values = {0, 2}, + }}; + + std::unique_ptr generator = + std::make_unique(request); + getHub()->registerGenerator(0, std::move(generator)); + + ASSERT_TRUE(getEvents().empty()); +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorNonExistingFile) { + VehiclePropValue request = {.value = { + .stringValue = "non_existing_file", + .int32Values = {0, 2}, + }}; + + std::unique_ptr generator = + std::make_unique(request); + getHub()->registerGenerator(0, std::move(generator)); + + ASSERT_TRUE(getEvents().empty()); +} + +TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorDifferentTypes) { + std::unique_ptr generator = std::make_unique( + getTestFilePath("prop_different_types.json"), 1); + getHub()->registerGenerator(0, std::move(generator)); + + std::vector expectedValues = { + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {1}, + .prop = 287310600, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {2}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.floatValues = {3.3}, + .prop = 291504905, + }, + VehiclePropValue{ + .areaId = 0, + .value.int64Values = {4}, + .prop = 290457096, + }, + VehiclePropValue{ + .areaId = 0, + .value.stringValue = "test", + .prop = 286265094, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {1, 2}, + .prop = 289476368, + }, + VehiclePropValue{ + .areaId = 0, + .value = + { + .int32Values = {1, 2}, + .int64Values = {3, 4}, + .floatValues = {5.5, 6.6}, + .stringValue = "test", + }, + .prop = 299896626, + }, + VehiclePropValue{ + .areaId = 0, + .value = + { + .int32Values = {1}, + .floatValues = {1.0}, + .byteValues = {0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00}, + }, + .prop = 299896064, + }, + }; + + waitForEvents(expectedValues.size()); + auto events = getEvents(); + + for (auto& event : events) { + event.timestamp = 0; + } + + EXPECT_EQ(events, expectedValues); +} + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop.json b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop.json new file mode 100644 index 0000000000000000000000000000000000000000..b88110923742998f2c904c5d96f217dbdf190ca6 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop.json @@ -0,0 +1,26 @@ +[ + { + "timestamp": 1000000, + "areaId": 0, + "value": 8, + "prop": 289408000 + }, + { + "timestamp": 2000000, + "areaId": 0, + "value": 4, + "prop": 289408000 + }, + { + "timestamp": 3000000, + "areaId": 0, + "value": 16, + "prop": 289408000 + }, + { + "timestamp": 4000000, + "areaId": 0, + "value": 10, + "prop": 289408000 + } +] diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_different_types.json b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_different_types.json new file mode 100644 index 0000000000000000000000000000000000000000..0363ebd131ba8503820aaf5b6e9bba7982fe3783 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_different_types.json @@ -0,0 +1,58 @@ +[ + { + "timestamp": 1000000, + "areaId": 0, + "value": 1, + "prop": 287310600 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": 2, + "prop": 289408000 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": 3.3, + "prop": 291504905 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": 4, + "prop": 290457096 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": "test", + "prop": 286265094 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": [1, 2], + "prop": 289476368 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": { + "int32Values": [1, 2], + "int64Values": [3, 4], + "floatValues": [5.5, 6.6], + "stringValue": "test" + }, + "prop": 299896626 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": { + "int32Values": [1], + "floatValues": [1] + }, + "prop": 299896064 + } +] \ No newline at end of file diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_invalid.json b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_invalid.json new file mode 100644 index 0000000000000000000000000000000000000000..98232c64fce9360c79f119cf6de8f670f69f1c44 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_invalid.json @@ -0,0 +1 @@ +{ diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..dcd9208cabbef235083a116744bfefc83584e9fd --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp @@ -0,0 +1,51 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library { + name: "FakeVehicleHardware", + vendor: true, + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: [ + "VehicleHalDefaults", + "FakeVehicleHardwareDefaults", + ], +} + +cc_defaults { + name: "FakeVehicleHardwareDefaults", + cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"], + header_libs: [ + "IVehicleHardware", + "VehicleHalDefaultConfig", + ], + export_header_lib_headers: ["IVehicleHardware"], + static_libs: [ + "VehicleHalUtils", + "FakeVehicleHalValueGenerators", + "FakeObd2Frame", + "FakeUserHal", + ], + shared_libs: [ + "libjsoncpp", + ], + export_static_lib_headers: ["VehicleHalUtils"], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h new file mode 100644 index 0000000000000000000000000000000000000000..34b2b2454fc40c27b23342a89a3edded5327a4b2 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -0,0 +1,218 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_hardware_include_FakeVehicleHardware_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_hardware_include_FakeVehicleHardware_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +class FakeVehicleHardware : public IVehicleHardware { + public: + using ValueResultType = VhalResult; + + FakeVehicleHardware(); + + explicit FakeVehicleHardware(std::unique_ptr valuePool); + + ~FakeVehicleHardware(); + + // Get all the property configs. + std::vector + getAllPropertyConfigs() const override; + + // Set property values asynchronously. Server could return before the property set requests + // are sent to vehicle bus or before property set confirmation is received. The callback is + // safe to be called after the function returns and is safe to be called in a different thread. + aidl::android::hardware::automotive::vehicle::StatusCode setValues( + std::shared_ptr callback, + const std::vector& + requests) override; + + // Get property values asynchronously. Server could return before the property values are ready. + // The callback is safe to be called after the function returns and is safe to be called in a + // different thread. + aidl::android::hardware::automotive::vehicle::StatusCode getValues( + std::shared_ptr callback, + const std::vector& + requests) const override; + + // Dump debug information in the server. + DumpResult dump(const std::vector& options) override; + + // Check whether the system is healthy, return {@code StatusCode::OK} for healthy. + aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override; + + // Register a callback that would be called when there is a property change event from vehicle. + void registerOnPropertyChangeEvent( + std::unique_ptr callback) override; + + // Register a callback that would be called when there is a property set error event from + // vehicle. + void registerOnPropertySetErrorEvent( + std::unique_ptr callback) override; + + // Update the sample rate for the [propId, areaId] pair. + aidl::android::hardware::automotive::vehicle::StatusCode updateSampleRate( + int32_t propId, int32_t areaId, float sampleRate) override; + + protected: + // mValuePool is also used in mServerSidePropStore. + const std::shared_ptr mValuePool; + const std::shared_ptr mServerSidePropStore; + + ValueResultType getValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + + VhalResult setValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + + private: + // Expose private methods to unit test. + friend class FakeVehicleHardwareTestHelper; + + template + struct RequestWithCallback { + RequestType request; + std::shared_ptr callback; + }; + + template + class PendingRequestHandler { + public: + PendingRequestHandler(FakeVehicleHardware* hardware); + + void addRequest(RequestType request, std::shared_ptr callback); + + void stop(); + + private: + FakeVehicleHardware* mHardware; + std::thread mThread; + ConcurrentQueue> mRequests; + + void handleRequestsOnce(); + }; + + const std::unique_ptr mFakeObd2Frame; + const std::unique_ptr mFakeUserHal; + // RecurrentTimer is thread-safe. + std::unique_ptr mRecurrentTimer; + std::mutex mLock; + std::unique_ptr mOnPropertyChangeCallback GUARDED_BY(mLock); + std::unique_ptr mOnPropertySetErrorCallback GUARDED_BY(mLock); + std::unordered_map, PropIdAreaIdHash> + mRecurrentActions GUARDED_BY(mLock); + // PendingRequestHandler is thread-safe. + mutable PendingRequestHandler + mPendingGetValueRequests; + mutable PendingRequestHandler + mPendingSetValueRequests; + + void init(); + // Stores the initial value to property store. + void storePropInitialValue(const defaultconfig::ConfigDeclaration& config); + // The callback that would be called when a vehicle property value change happens. + void onValueChangeCallback( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + // If property "persist.vendor.vhal_init_value_override" is set to true, override the properties + // using config files in 'overrideDir'. + void maybeOverrideProperties(const char* overrideDir); + // Override the properties using config files in 'overrideDir'. + void overrideProperties(const char* overrideDir); + + VhalResult maybeSetSpecialValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, + bool* isSpecialValue); + ValueResultType maybeGetSpecialValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, + bool* isSpecialValue) const; + VhalResult setApPowerStateReport( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + VehiclePropValuePool::RecyclableType createApPowerStateReq( + aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq state); + VhalResult setUserHalProp( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + ValueResultType getUserHalProp( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + ValueResultType getEchoReverseBytes( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + bool isHvacPropAndHvacNotAvailable(int32_t propId); + + std::string dumpAllProperties(); + std::string dumpOnePropertyByConfig( + int rowNumber, + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config); + std::string dumpOnePropertyById(int32_t propId, int32_t areaId); + std::string dumpHelp(); + std::string dumpListProperties(); + std::string dumpSpecificProperty(const std::vector& options); + std::string dumpSetProperties(const std::vector& options); + + template + android::base::Result safelyParseInt(int index, const std::string& s) { + T out; + if (!::android::base::ParseInt(s, &out)) { + return android::base::Error() << android::base::StringPrintf( + "non-integer argument at index %d: %s\n", index, s.c_str()); + } + return out; + } + android::base::Result safelyParseFloat(int index, const std::string& s); + std::vector getOptionValues(const std::vector& options, + size_t* index); + android::base::Result + parseSetPropOptions(const std::vector& options); + android::base::Result> parseHexString(const std::string& s); + + android::base::Result checkArgumentsSize(const std::vector& options, + size_t minSize); + aidl::android::hardware::automotive::vehicle::GetValueResult handleGetValueRequest( + const aidl::android::hardware::automotive::vehicle::GetValueRequest& request); + aidl::android::hardware::automotive::vehicle::SetValueResult handleSetValueRequest( + const aidl::android::hardware::automotive::vehicle::SetValueRequest& request); +}; + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_hardware_include_FakeVehicleHardware_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b64c1a65cc5da35e2001a05574a17a26da5cb8f6 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -0,0 +1,1057 @@ +/* + * 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_TAG "FakeVehicleHardware" +#define FAKE_VEHICLEHARDWARE_DEBUG false // STOPSHIP if true. + +#include "FakeVehicleHardware.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::GetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::GetValueResult; +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::SetValueResult; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +using ::android::base::EqualsIgnoreCase; +using ::android::base::Error; +using ::android::base::ParseFloat; +using ::android::base::Result; +using ::android::base::ScopedLockAssertion; +using ::android::base::StartsWith; +using ::android::base::StringPrintf; + +const char* VENDOR_OVERRIDE_DIR = "/vendor/etc/automotive/vhaloverride/"; +const char* OVERRIDE_PROPERTY = "persist.vendor.vhal_init_value_override"; + +// A list of supported options for "--set" command. +const std::unordered_set SET_PROP_OPTIONS = { + // integer. + "-i", + // 64bit integer. + "-i64", + // float. + "-f", + // string. + "-s", + // bytes in hex format, e.g. 0xDEADBEEF. + "-b", + // Area id in integer. + "-a"}; + +} // namespace + +void FakeVehicleHardware::storePropInitialValue(const defaultconfig::ConfigDeclaration& config) { + const VehiclePropConfig& vehiclePropConfig = config.config; + int propId = vehiclePropConfig.prop; + + // A global property will have only a single area + bool globalProp = isGlobalProp(propId); + size_t numAreas = globalProp ? 1 : vehiclePropConfig.areaConfigs.size(); + + for (size_t i = 0; i < numAreas; i++) { + int32_t curArea = globalProp ? 0 : vehiclePropConfig.areaConfigs[i].areaId; + + // Create a separate instance for each individual zone + VehiclePropValue prop = { + .areaId = curArea, + .prop = propId, + .timestamp = elapsedRealtimeNano(), + }; + + if (config.initialAreaValues.empty()) { + if (config.initialValue == RawPropValues{}) { + // Skip empty initial values. + continue; + } + prop.value = config.initialValue; + } else if (auto valueForAreaIt = config.initialAreaValues.find(curArea); + valueForAreaIt != config.initialAreaValues.end()) { + prop.value = valueForAreaIt->second; + } else { + ALOGW("failed to get default value for prop 0x%x area 0x%x", propId, curArea); + continue; + } + + auto result = + mServerSidePropStore->writeValue(mValuePool->obtain(prop), /*updateStatus=*/true); + if (!result.ok()) { + ALOGE("failed to write default config value, error: %s, status: %d", + getErrorMsg(result).c_str(), getIntErrorCode(result)); + } + } +} + +FakeVehicleHardware::FakeVehicleHardware() + : FakeVehicleHardware(std::make_unique()) {} + +FakeVehicleHardware::FakeVehicleHardware(std::unique_ptr valuePool) + : mValuePool(std::move(valuePool)), + mServerSidePropStore(new VehiclePropertyStore(mValuePool)), + mFakeObd2Frame(new obd2frame::FakeObd2Frame(mServerSidePropStore)), + mFakeUserHal(new FakeUserHal(mValuePool)), + mRecurrentTimer(new RecurrentTimer()), + mPendingGetValueRequests(this), + mPendingSetValueRequests(this) { + init(); +} + +FakeVehicleHardware::~FakeVehicleHardware() { + mPendingGetValueRequests.stop(); + mPendingSetValueRequests.stop(); +} + +void FakeVehicleHardware::init() { + for (auto& it : defaultconfig::getDefaultConfigs()) { + VehiclePropConfig cfg = it.config; + VehiclePropertyStore::TokenFunction tokenFunction = nullptr; + + if (cfg.prop == OBD2_FREEZE_FRAME) { + tokenFunction = [](const VehiclePropValue& propValue) { return propValue.timestamp; }; + } + + mServerSidePropStore->registerProperty(cfg, tokenFunction); + if (obd2frame::FakeObd2Frame::isDiagnosticProperty(cfg)) { + // Ignore storing default value for diagnostic property. They have special get/set + // logic. + continue; + } + storePropInitialValue(it); + } + + maybeOverrideProperties(VENDOR_OVERRIDE_DIR); + + // OBD2_LIVE_FRAME and OBD2_FREEZE_FRAME must be configured in default configs. + mFakeObd2Frame->initObd2LiveFrame(*mServerSidePropStore->getConfig(OBD2_LIVE_FRAME).value()); + mFakeObd2Frame->initObd2FreezeFrame( + *mServerSidePropStore->getConfig(OBD2_FREEZE_FRAME).value()); + + mServerSidePropStore->setOnValueChangeCallback( + [this](const VehiclePropValue& value) { return onValueChangeCallback(value); }); +} + +std::vector FakeVehicleHardware::getAllPropertyConfigs() const { + return mServerSidePropStore->getAllConfigs(); +} + +VehiclePropValuePool::RecyclableType FakeVehicleHardware::createApPowerStateReq( + VehicleApPowerStateReq state) { + auto req = mValuePool->obtain(VehiclePropertyType::INT32_VEC, 2); + req->prop = toInt(VehicleProperty::AP_POWER_STATE_REQ); + req->areaId = 0; + req->timestamp = elapsedRealtimeNano(); + req->status = VehiclePropertyStatus::AVAILABLE; + req->value.int32Values[0] = toInt(state); + // Param = 0. + req->value.int32Values[1] = 0; + return req; +} + +VhalResult FakeVehicleHardware::setApPowerStateReport(const VehiclePropValue& value) { + auto updatedValue = mValuePool->obtain(value); + updatedValue->timestamp = elapsedRealtimeNano(); + + if (auto writeResult = mServerSidePropStore->writeValue(std::move(updatedValue)); + !writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << "failed to write value into property store, error: " << getErrorMsg(writeResult); + } + + VehiclePropValuePool::RecyclableType prop; + int32_t state = value.value.int32Values[0]; + switch (state) { + case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT): + [[fallthrough]]; + case toInt(VehicleApPowerStateReport::HIBERNATION_EXIT): + [[fallthrough]]; + case toInt(VehicleApPowerStateReport::SHUTDOWN_CANCELLED): + [[fallthrough]]; + case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL): + // CPMS is in WAIT_FOR_VHAL state, simply move to ON and send back to HAL. + // Must erase existing state because in the case when Car Service crashes, the power + // state would already be ON when we receive WAIT_FOR_VHAL and thus new property change + // event would be generated. However, Car Service always expect a property change event + // even though there is not actual state change. + mServerSidePropStore->removeValuesForProperty( + toInt(VehicleProperty::AP_POWER_STATE_REQ)); + prop = createApPowerStateReq(VehicleApPowerStateReq::ON); + + // ALWAYS update status for generated property value + if (auto writeResult = + mServerSidePropStore->writeValue(std::move(prop), /*updateStatus=*/true); + !writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << "failed to write AP_POWER_STATE_REQ into property store, error: " + << getErrorMsg(writeResult); + } + break; + case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY): + [[fallthrough]]; + case toInt(VehicleApPowerStateReport::HIBERNATION_ENTRY): + [[fallthrough]]; + case toInt(VehicleApPowerStateReport::SHUTDOWN_START): + // CPMS is in WAIT_FOR_FINISH state, send the FINISHED command + // Send back to HAL + // ALWAYS update status for generated property value + prop = createApPowerStateReq(VehicleApPowerStateReq::FINISHED); + if (auto writeResult = + mServerSidePropStore->writeValue(std::move(prop), /*updateStatus=*/true); + !writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << "failed to write AP_POWER_STATE_REQ into property store, error: " + << getErrorMsg(writeResult); + } + break; + default: + ALOGE("Unknown VehicleApPowerStateReport: %d", state); + break; + } + return {}; +} + +bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId) { + std::unordered_set powerProps(std::begin(HVAC_POWER_PROPERTIES), + std::end(HVAC_POWER_PROPERTIES)); + if (powerProps.count(propId)) { + auto hvacPowerOnResult = + mServerSidePropStore->readValue(toInt(VehicleProperty::HVAC_POWER_ON), HVAC_ALL); + + if (hvacPowerOnResult.ok() && hvacPowerOnResult.value()->value.int32Values.size() == 1 && + hvacPowerOnResult.value()->value.int32Values[0] == 0) { + return true; + } + } + return false; +} + +VhalResult FakeVehicleHardware::setUserHalProp(const VehiclePropValue& value) { + auto result = mFakeUserHal->onSetProperty(value); + if (!result.ok()) { + return StatusError(getErrorCode(result)) + << "onSetProperty(): HAL returned error: " << getErrorMsg(result); + } + auto& updatedValue = result.value(); + if (updatedValue != nullptr) { + ALOGI("onSetProperty(): updating property returned by HAL: %s", + updatedValue->toString().c_str()); + if (auto writeResult = mServerSidePropStore->writeValue(std::move(result.value())); + !writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << "failed to write value into property store, error: " + << getErrorMsg(writeResult); + } + } + return {}; +} + +FakeVehicleHardware::ValueResultType FakeVehicleHardware::getUserHalProp( + const VehiclePropValue& value) const { + auto propId = value.prop; + ALOGI("get(): getting value for prop %d from User HAL", propId); + + auto result = mFakeUserHal->onGetProperty(value); + if (!result.ok()) { + return StatusError(getErrorCode(result)) + << "get(): User HAL returned error: " << getErrorMsg(result); + } else { + auto& gotValue = result.value(); + if (gotValue != nullptr) { + ALOGI("get(): User HAL returned value: %s", gotValue->toString().c_str()); + gotValue->timestamp = elapsedRealtimeNano(); + return result; + } else { + return StatusError(StatusCode::INTERNAL_ERROR) << "get(): User HAL returned null value"; + } + } +} + +FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( + const VehiclePropValue& value, bool* isSpecialValue) const { + *isSpecialValue = false; + int32_t propId = value.prop; + ValueResultType result; + + if (mFakeUserHal->isSupported(propId)) { + *isSpecialValue = true; + return getUserHalProp(value); + } + + switch (propId) { + case OBD2_FREEZE_FRAME: + *isSpecialValue = true; + result = mFakeObd2Frame->getObd2FreezeFrame(value); + if (result.ok()) { + result.value()->timestamp = elapsedRealtimeNano(); + } + return result; + case OBD2_FREEZE_FRAME_INFO: + *isSpecialValue = true; + result = mFakeObd2Frame->getObd2DtcInfo(); + if (result.ok()) { + result.value()->timestamp = elapsedRealtimeNano(); + } + return result; + case ECHO_REVERSE_BYTES: + *isSpecialValue = true; + return getEchoReverseBytes(value); + default: + // Do nothing. + break; + } + + return nullptr; +} + +FakeVehicleHardware::ValueResultType FakeVehicleHardware::getEchoReverseBytes( + const VehiclePropValue& value) const { + auto readResult = mServerSidePropStore->readValue(value); + if (!readResult.ok()) { + return readResult; + } + auto& gotValue = readResult.value(); + gotValue->timestamp = elapsedRealtimeNano(); + std::vector byteValues = gotValue->value.byteValues; + size_t byteSize = byteValues.size(); + for (size_t i = 0; i < byteSize; i++) { + gotValue->value.byteValues[i] = byteValues[byteSize - 1 - i]; + } + return std::move(gotValue); +} + +VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValue& value, + bool* isSpecialValue) { + *isSpecialValue = false; + VehiclePropValuePool::RecyclableType updatedValue; + int32_t propId = value.prop; + + if (mFakeUserHal->isSupported(propId)) { + *isSpecialValue = true; + return setUserHalProp(value); + } + + if (isHvacPropAndHvacNotAvailable(propId)) { + *isSpecialValue = true; + return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; + } + + switch (propId) { + case toInt(VehicleProperty::AP_POWER_STATE_REPORT): + *isSpecialValue = true; + return setApPowerStateReport(value); + case toInt(VehicleProperty::VEHICLE_MAP_SERVICE): + // Placeholder for future implementation of VMS property in the default hal. For + // now, just returns OK; otherwise, hal clients crash with property not supported. + *isSpecialValue = true; + return {}; + case OBD2_FREEZE_FRAME_CLEAR: + *isSpecialValue = true; + return mFakeObd2Frame->clearObd2FreezeFrames(value); + +#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING + case toInt(VehicleProperty::CLUSTER_REPORT_STATE): + [[fallthrough]]; + case toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY): + [[fallthrough]]; + case toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE): + [[fallthrough]]; + case VENDOR_CLUSTER_SWITCH_UI: + [[fallthrough]]; + case VENDOR_CLUSTER_DISPLAY_STATE: + *isSpecialValue = true; + updatedValue = mValuePool->obtain(getPropType(value.prop)); + updatedValue->prop = value.prop & ~toInt(VehiclePropertyGroup::MASK); + if (getPropGroup(value.prop) == VehiclePropertyGroup::SYSTEM) { + updatedValue->prop |= toInt(VehiclePropertyGroup::VENDOR); + } else { + updatedValue->prop |= toInt(VehiclePropertyGroup::SYSTEM); + } + updatedValue->value = value.value; + updatedValue->timestamp = elapsedRealtimeNano(); + updatedValue->areaId = value.areaId; + if (auto writeResult = mServerSidePropStore->writeValue(std::move(updatedValue)); + !writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << "failed to write value into property store, error: " + << getErrorMsg(writeResult); + } + return {}; +#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING + + default: + break; + } + return {}; +} + +StatusCode FakeVehicleHardware::setValues(std::shared_ptr callback, + const std::vector& requests) { + for (auto& request : requests) { + if (FAKE_VEHICLEHARDWARE_DEBUG) { + ALOGD("Set value for property ID: %d", request.value.prop); + } + + // In a real VHAL implementation, you could either send the setValue request to vehicle bus + // here in the binder thread, or you could send the request in setValue which runs in + // the handler thread. If you decide to send the setValue request here, you should not + // wait for the response here and the handler thread should handle the setValue response. + mPendingSetValueRequests.addRequest(request, callback); + } + + return StatusCode::OK; +} + +VhalResult FakeVehicleHardware::setValue(const VehiclePropValue& value) { + // In a real VHAL implementation, this will send the request to vehicle bus if not already + // sent in setValues, and wait for the response from vehicle bus. + // Here we are just updating mValuePool. + bool isSpecialValue = false; + auto setSpecialValueResult = maybeSetSpecialValue(value, &isSpecialValue); + + if (isSpecialValue) { + if (!setSpecialValueResult.ok()) { + return StatusError(getErrorCode(setSpecialValueResult)) + << StringPrintf("failed to set special value for property ID: %d, error: %s", + value.prop, getErrorMsg(setSpecialValueResult).c_str()); + } + return {}; + } + + auto updatedValue = mValuePool->obtain(value); + int64_t timestamp = elapsedRealtimeNano(); + updatedValue->timestamp = timestamp; + + auto writeResult = mServerSidePropStore->writeValue(std::move(updatedValue)); + if (!writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << StringPrintf("failed to write value into property store, error: %s", + getErrorMsg(writeResult).c_str()); + } + + return {}; +} + +SetValueResult FakeVehicleHardware::handleSetValueRequest(const SetValueRequest& request) { + SetValueResult setValueResult; + setValueResult.requestId = request.requestId; + + if (auto result = setValue(request.value); !result.ok()) { + ALOGE("failed to set value, error: %s, code: %d", getErrorMsg(result).c_str(), + getIntErrorCode(result)); + setValueResult.status = getErrorCode(result); + } else { + setValueResult.status = StatusCode::OK; + } + + return setValueResult; +} + +StatusCode FakeVehicleHardware::getValues(std::shared_ptr callback, + const std::vector& requests) const { + for (auto& request : requests) { + if (FAKE_VEHICLEHARDWARE_DEBUG) { + ALOGD("getValues(%d)", request.prop.prop); + } + + // In a real VHAL implementation, you could either send the getValue request to vehicle bus + // here in the binder thread, or you could send the request in getValue which runs in + // the handler thread. If you decide to send the getValue request here, you should not + // wait for the response here and the handler thread should handle the getValue response. + mPendingGetValueRequests.addRequest(request, callback); + } + + return StatusCode::OK; +} + +GetValueResult FakeVehicleHardware::handleGetValueRequest(const GetValueRequest& request) { + GetValueResult getValueResult; + getValueResult.requestId = request.requestId; + + auto result = getValue(request.prop); + if (!result.ok()) { + ALOGE("failed to get value, error: %s, code: %d", getErrorMsg(result).c_str(), + getIntErrorCode(result)); + getValueResult.status = getErrorCode(result); + } else { + getValueResult.status = StatusCode::OK; + getValueResult.prop = *result.value(); + } + return getValueResult; +} + +FakeVehicleHardware::ValueResultType FakeVehicleHardware::getValue( + const VehiclePropValue& value) const { + // In a real VHAL implementation, this will send the request to vehicle bus if not already + // sent in getValues, and wait for the response from vehicle bus. + // Here we are just reading value from mValuePool. + bool isSpecialValue = false; + auto result = maybeGetSpecialValue(value, &isSpecialValue); + if (isSpecialValue) { + if (!result.ok()) { + return StatusError(getErrorCode(result)) + << StringPrintf("failed to get special value: %d, error: %s", value.prop, + getErrorMsg(result).c_str()); + } else { + return std::move(result); + } + } + + auto readResult = mServerSidePropStore->readValue(value); + if (!readResult.ok()) { + StatusCode errorCode = getErrorCode(readResult); + if (errorCode == StatusCode::NOT_AVAILABLE) { + return StatusError(errorCode) << "value has not been set yet"; + } else { + return StatusError(errorCode) + << "failed to get value, error: " << getErrorMsg(readResult); + } + } + + return std::move(readResult); +} + +DumpResult FakeVehicleHardware::dump(const std::vector& options) { + DumpResult result; + result.callerShouldDumpState = false; + if (options.size() == 0) { + // We only want caller to dump default state when there is no options. + result.callerShouldDumpState = true; + result.buffer = dumpAllProperties(); + return result; + } + std::string option = options[0]; + if (EqualsIgnoreCase(option, "--help")) { + result.buffer = dumpHelp(); + return result; + } else if (EqualsIgnoreCase(option, "--list")) { + result.buffer = dumpListProperties(); + } else if (EqualsIgnoreCase(option, "--get")) { + result.buffer = dumpSpecificProperty(options); + } else if (EqualsIgnoreCase(option, "--set")) { + result.buffer = dumpSetProperties(options); + } else if (EqualsIgnoreCase(option, kUserHalDumpOption)) { + if (options.size() == 1) { + result.buffer = mFakeUserHal->showDumpHelp(); + } else { + result.buffer = mFakeUserHal->dump(options[1]); + } + } else { + result.buffer = StringPrintf("Invalid option: %s\n", option.c_str()); + } + return result; +} + +std::string FakeVehicleHardware::dumpHelp() { + return "Usage: \n\n" + "[no args]: dumps (id and value) all supported properties \n" + "--help: shows this help\n" + "--list: lists the ids of all supported properties\n" + "--get [PROP2] [PROPN]: dumps the value of specific properties \n" + "--set [-i INT_VALUE [INT_VALUE ...]] [-i64 INT64_VALUE [INT64_VALUE ...]] " + "[-f FLOAT_VALUE [FLOAT_VALUE ...]] [-s STR_VALUE] " + "[-b BYTES_VALUE] [-a AREA_ID] : sets the value of property PROP. " + "Notice that the string, bytes and area value can be set just once, while the other can" + " have multiple values (so they're used in the respective array), " + "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n\n" + "Fake user HAL usage: \n" + + mFakeUserHal->showDumpHelp(); +} + +std::string FakeVehicleHardware::dumpAllProperties() { + auto configs = mServerSidePropStore->getAllConfigs(); + if (configs.size() == 0) { + return "no properties to dump\n"; + } + std::string msg = StringPrintf("dumping %zu properties\n", configs.size()); + int rowNumber = 1; + for (const VehiclePropConfig& config : configs) { + msg += dumpOnePropertyByConfig(rowNumber++, config); + } + return msg; +} + +std::string FakeVehicleHardware::dumpOnePropertyByConfig(int rowNumber, + const VehiclePropConfig& config) { + size_t numberAreas = config.areaConfigs.size(); + std::string msg = ""; + if (numberAreas == 0) { + msg += StringPrintf("%d: ", rowNumber); + msg += dumpOnePropertyById(config.prop, /* areaId= */ 0); + return msg; + } + for (size_t j = 0; j < numberAreas; ++j) { + if (numberAreas > 1) { + msg += StringPrintf("%d-%zu: ", rowNumber, j); + } else { + msg += StringPrintf("%d: ", rowNumber); + } + msg += dumpOnePropertyById(config.prop, config.areaConfigs[j].areaId); + } + return msg; +} + +std::string FakeVehicleHardware::dumpOnePropertyById(int32_t propId, int32_t areaId) { + VehiclePropValue value = { + .prop = propId, + .areaId = areaId, + }; + bool isSpecialValue = false; + auto result = maybeGetSpecialValue(value, &isSpecialValue); + if (!isSpecialValue) { + result = mServerSidePropStore->readValue(value); + } + if (!result.ok()) { + return StringPrintf("failed to read property value: %d, error: %s, code: %d\n", propId, + getErrorMsg(result).c_str(), getIntErrorCode(result)); + + } else { + return result.value()->toString() + "\n"; + } +} + +std::string FakeVehicleHardware::dumpListProperties() { + auto configs = mServerSidePropStore->getAllConfigs(); + if (configs.size() == 0) { + return "no properties to list\n"; + } + int rowNumber = 1; + std::string msg = StringPrintf("listing %zu properties\n", configs.size()); + for (const auto& config : configs) { + msg += StringPrintf("%d: %d\n", rowNumber++, config.prop); + } + return msg; +} + +Result FakeVehicleHardware::checkArgumentsSize(const std::vector& options, + size_t minSize) { + size_t size = options.size(); + if (size >= minSize) { + return {}; + } + return Error() << StringPrintf("Invalid number of arguments: required at least %zu, got %zu\n", + minSize, size); +} + +std::string FakeVehicleHardware::dumpSpecificProperty(const std::vector& options) { + if (auto result = checkArgumentsSize(options, /*minSize=*/2); !result.ok()) { + return getErrorMsg(result); + } + + // options[0] is the command itself... + int rowNumber = 1; + size_t size = options.size(); + std::string msg = ""; + for (size_t i = 1; i < size; ++i) { + auto propResult = safelyParseInt(i, options[i]); + if (!propResult.ok()) { + msg += getErrorMsg(propResult); + continue; + } + int32_t prop = propResult.value(); + auto result = mServerSidePropStore->getConfig(prop); + if (!result.ok()) { + msg += StringPrintf("No property %d\n", prop); + continue; + } + msg += dumpOnePropertyByConfig(rowNumber++, *result.value()); + } + return msg; +} + +std::vector FakeVehicleHardware::getOptionValues( + const std::vector& options, size_t* index) { + std::vector values; + while (*index < options.size()) { + std::string option = options[*index]; + if (SET_PROP_OPTIONS.find(option) != SET_PROP_OPTIONS.end()) { + return std::move(values); + } + values.push_back(option); + (*index)++; + } + return std::move(values); +} + +Result FakeVehicleHardware::parseSetPropOptions( + const std::vector& options) { + // Options format: + // --set PROP [-f f1 f2...] [-i i1 i2...] [-i64 i1 i2...] [-s s1 s2...] [-b b1 b2...] [-a a] + size_t optionIndex = 1; + auto result = safelyParseInt(optionIndex, options[optionIndex]); + if (!result.ok()) { + return Error() << StringPrintf("Property value: \"%s\" is not a valid int: %s\n", + options[optionIndex].c_str(), getErrorMsg(result).c_str()); + } + VehiclePropValue prop = {}; + prop.prop = result.value(); + prop.status = VehiclePropertyStatus::AVAILABLE; + optionIndex++; + std::unordered_set parsedOptions; + + while (optionIndex < options.size()) { + std::string type = options[optionIndex]; + optionIndex++; + size_t currentIndex = optionIndex; + std::vector values = getOptionValues(options, &optionIndex); + if (parsedOptions.find(type) != parsedOptions.end()) { + return Error() << StringPrintf("Duplicate \"%s\" options\n", type.c_str()); + } + parsedOptions.insert(type); + if (EqualsIgnoreCase(type, "-i")) { + if (values.size() == 0) { + return Error() << "No values specified when using \"-i\"\n"; + } + prop.value.int32Values.resize(values.size()); + for (size_t i = 0; i < values.size(); i++) { + auto int32Result = safelyParseInt(currentIndex + i, values[i]); + if (!int32Result.ok()) { + return Error() + << StringPrintf("Value: \"%s\" is not a valid int: %s\n", + values[i].c_str(), getErrorMsg(int32Result).c_str()); + } + prop.value.int32Values[i] = int32Result.value(); + } + } else if (EqualsIgnoreCase(type, "-i64")) { + if (values.size() == 0) { + return Error() << "No values specified when using \"-i64\"\n"; + } + prop.value.int64Values.resize(values.size()); + for (size_t i = 0; i < values.size(); i++) { + auto int64Result = safelyParseInt(currentIndex + i, values[i]); + if (!int64Result.ok()) { + return Error() + << StringPrintf("Value: \"%s\" is not a valid int64: %s\n", + values[i].c_str(), getErrorMsg(int64Result).c_str()); + } + prop.value.int64Values[i] = int64Result.value(); + } + } else if (EqualsIgnoreCase(type, "-f")) { + if (values.size() == 0) { + return Error() << "No values specified when using \"-f\"\n"; + } + prop.value.floatValues.resize(values.size()); + for (size_t i = 0; i < values.size(); i++) { + auto floatResult = safelyParseFloat(currentIndex + i, values[i]); + if (!floatResult.ok()) { + return Error() + << StringPrintf("Value: \"%s\" is not a valid float: %s\n", + values[i].c_str(), getErrorMsg(floatResult).c_str()); + } + prop.value.floatValues[i] = floatResult.value(); + } + } else if (EqualsIgnoreCase(type, "-s")) { + if (values.size() != 1) { + return Error() << "Expect exact one value when using \"-s\"\n"; + } + prop.value.stringValue = values[0]; + } else if (EqualsIgnoreCase(type, "-b")) { + if (values.size() != 1) { + return Error() << "Expect exact one value when using \"-b\"\n"; + } + auto bytesResult = parseHexString(values[0]); + if (!bytesResult.ok()) { + return Error() << StringPrintf("value: \"%s\" is not a valid hex string: %s\n", + values[0].c_str(), getErrorMsg(bytesResult).c_str()); + } + prop.value.byteValues = std::move(bytesResult.value()); + } else if (EqualsIgnoreCase(type, "-a")) { + if (values.size() != 1) { + return Error() << "Expect exact one value when using \"-a\"\n"; + } + auto int32Result = safelyParseInt(currentIndex, values[0]); + if (!int32Result.ok()) { + return Error() << StringPrintf("Area ID: \"%s\" is not a valid int: %s\n", + values[0].c_str(), getErrorMsg(int32Result).c_str()); + } + prop.areaId = int32Result.value(); + } else { + return Error() << StringPrintf("Unknown option: %s\n", type.c_str()); + } + } + + return prop; +} + +std::string FakeVehicleHardware::dumpSetProperties(const std::vector& options) { + if (auto result = checkArgumentsSize(options, 3); !result.ok()) { + return getErrorMsg(result); + } + + auto parseResult = parseSetPropOptions(options); + if (!parseResult.ok()) { + return getErrorMsg(parseResult); + } + VehiclePropValue prop = std::move(parseResult.value()); + ALOGD("Dump: Setting property: %s", prop.toString().c_str()); + + bool isSpecialValue = false; + auto setResult = maybeSetSpecialValue(prop, &isSpecialValue); + + if (!isSpecialValue) { + auto updatedValue = mValuePool->obtain(prop); + updatedValue->timestamp = elapsedRealtimeNano(); + setResult = mServerSidePropStore->writeValue(std::move(updatedValue)); + } + + if (setResult.ok()) { + return StringPrintf("Set property: %s\n", prop.toString().c_str()); + } + return StringPrintf("failed to set property: %s, error: %s\n", prop.toString().c_str(), + getErrorMsg(setResult).c_str()); +} + +StatusCode FakeVehicleHardware::checkHealth() { + // Always return OK for checkHealth. + return StatusCode::OK; +} + +void FakeVehicleHardware::registerOnPropertyChangeEvent( + std::unique_ptr callback) { + std::scoped_lock lockGuard(mLock); + mOnPropertyChangeCallback = std::move(callback); +} + +void FakeVehicleHardware::registerOnPropertySetErrorEvent( + std::unique_ptr callback) { + std::scoped_lock lockGuard(mLock); + mOnPropertySetErrorCallback = std::move(callback); +} + +StatusCode FakeVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, float sampleRate) { + // DefaultVehicleHal makes sure that sampleRate must be within minSampleRate and maxSampleRate. + // For fake implementation, we would write the same value with a new timestamp into propStore + // at sample rate. + std::scoped_lock lockGuard(mLock); + + PropIdAreaId propIdAreaId{ + .propId = propId, + .areaId = areaId, + }; + if (mRecurrentActions.find(propIdAreaId) != mRecurrentActions.end()) { + mRecurrentTimer->unregisterTimerCallback(mRecurrentActions[propIdAreaId]); + } + if (sampleRate == 0) { + return StatusCode::OK; + } + int64_t interval = static_cast(1'000'000'000. / sampleRate); + auto action = std::make_shared([this, propId, areaId] { + // Refresh the property value. In real implementation, this should poll the latest value + // from vehicle bus. Here, we are just refreshing the existing value with a new timestamp. + auto result = getValue(VehiclePropValue{ + .prop = propId, + .areaId = areaId, + }); + if (!result.ok()) { + // Failed to read current value, skip refreshing. + return; + } + result.value()->timestamp = elapsedRealtimeNano(); + // Must remove the value before writing, otherwise, we would generate no update event since + // the value is the same. + mServerSidePropStore->removeValue(*result.value()); + mServerSidePropStore->writeValue(std::move(result.value())); + }); + mRecurrentTimer->registerTimerCallback(interval, action); + mRecurrentActions[propIdAreaId] = action; + return StatusCode::OK; +} + +void FakeVehicleHardware::onValueChangeCallback(const VehiclePropValue& value) { + std::scoped_lock lockGuard(mLock); + + if (mOnPropertyChangeCallback == nullptr) { + return; + } + + std::vector updatedValues; + updatedValues.push_back(value); + (*mOnPropertyChangeCallback)(std::move(updatedValues)); +} + +void FakeVehicleHardware::maybeOverrideProperties(const char* overrideDir) { + if (android::base::GetBoolProperty(OVERRIDE_PROPERTY, false)) { + overrideProperties(overrideDir); + } +} + +void FakeVehicleHardware::overrideProperties(const char* overrideDir) { + ALOGI("loading vendor override properties from %s", overrideDir); + if (auto dir = opendir(overrideDir); dir != NULL) { + std::regex regJson(".*[.]json", std::regex::icase); + while (auto f = readdir(dir)) { + if (!std::regex_match(f->d_name, regJson)) { + continue; + } + std::string file = overrideDir + std::string(f->d_name); + JsonFakeValueGenerator tmpGenerator(file); + + std::vector propValues = tmpGenerator.getAllEvents(); + for (const VehiclePropValue& prop : propValues) { + auto propToStore = mValuePool->obtain(prop); + propToStore->timestamp = elapsedRealtimeNano(); + if (auto result = mServerSidePropStore->writeValue(std::move(propToStore), + /*updateStatus=*/true); + !result.ok()) { + ALOGW("failed to write vendor override properties: %d, error: %s, code: %d", + prop.prop, getErrorMsg(result).c_str(), getIntErrorCode(result)); + } + } + } + closedir(dir); + } +} + +Result FakeVehicleHardware::safelyParseFloat(int index, const std::string& s) { + float out; + if (!ParseFloat(s, &out)) { + return Error() << StringPrintf("non-float argument at index %d: %s\n", index, s.c_str()); + } + return out; +} + +Result> FakeVehicleHardware::parseHexString(const std::string& s) { + std::vector bytes; + if (s.size() % 2 != 0) { + return Error() << StringPrintf("invalid hex string: %s, should have even size\n", + s.c_str()); + } + if (!StartsWith(s, "0x")) { + return Error() << StringPrintf("hex string should start with \"0x\", got %s\n", s.c_str()); + } + std::string subs = s.substr(2); + std::transform(subs.begin(), subs.end(), subs.begin(), + [](unsigned char c) { return std::tolower(c); }); + + bool highDigit = true; + for (size_t i = 0; i < subs.size(); i++) { + char c = subs[i]; + uint8_t v; + if (c >= '0' && c <= '9') { + v = c - '0'; + } else if (c >= 'a' && c <= 'f') { + v = c - 'a' + 10; + } else { + return Error() << StringPrintf("invalid character %c in hex string %s\n", c, + subs.c_str()); + } + if (highDigit) { + bytes.push_back(v * 16); + } else { + bytes[bytes.size() - 1] += v; + } + highDigit = !highDigit; + } + return bytes; +} + +template +FakeVehicleHardware::PendingRequestHandler::PendingRequestHandler( + FakeVehicleHardware* hardware) + : mHardware(hardware) { + // Don't initialize mThread in initialization list because mThread depends on mRequests and we + // want mRequests to be initialized first. + mThread = std::thread([this] { + while (mRequests.waitForItems()) { + handleRequestsOnce(); + } + }); +} + +template +void FakeVehicleHardware::PendingRequestHandler::addRequest( + RequestType request, std::shared_ptr callback) { + mRequests.push({ + request, + callback, + }); +} + +template +void FakeVehicleHardware::PendingRequestHandler::stop() { + mRequests.deactivate(); + if (mThread.joinable()) { + mThread.join(); + } +} + +template <> +void FakeVehicleHardware::PendingRequestHandler::handleRequestsOnce() { + std::unordered_map, std::vector> + callbackToResults; + for (const auto& rwc : mRequests.flush()) { + auto result = mHardware->handleGetValueRequest(rwc.request); + callbackToResults[rwc.callback].push_back(std::move(result)); + } + for (const auto& [callback, results] : callbackToResults) { + (*callback)(std::move(results)); + } +} + +template <> +void FakeVehicleHardware::PendingRequestHandler::handleRequestsOnce() { + std::unordered_map, std::vector> + callbackToResults; + for (const auto& rwc : mRequests.flush()) { + auto result = mHardware->handleSetValueRequest(rwc.request); + callbackToResults[rwc.callback].push_back(std::move(result)); + } + for (const auto& [callback, results] : callbackToResults) { + (*callback)(std::move(results)); + } +} + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..90d1516a21f87353573cbd451ef53308c1f266fb --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp @@ -0,0 +1,53 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "FakeVehicleHardwareTest", + vendor: true, + srcs: ["*.cpp"], + cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"], + header_libs: [ + "IVehicleHardware", + "VehicleHalDefaultConfig", + "VehicleHalTestUtilHeaders", + ], + static_libs: [ + "VehicleHalUtils", + "FakeVehicleHardware", + "FakeVehicleHalValueGenerators", + "FakeObd2Frame", + "FakeUserHal", + "libgtest", + "libgmock", + ], + shared_libs: [ + "libjsoncpp", + ], + data: [ + ":FakeVehicleHardwareTestOverrideJson", + ], + defaults: ["VehicleHalDefaults"], + test_suites: ["device-tests"], +} + +filegroup { + name: "FakeVehicleHardwareTestOverrideJson", + srcs: ["override/*"], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3e8f634ab7043b1e8c12a4b47ba450311645a446 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -0,0 +1,1660 @@ +/* + * 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace { + +using ::aidl::android::hardware::automotive::vehicle::GetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::GetValueResult; +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::SetValueResult; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::expected; +using ::android::base::ScopedLockAssertion; +using ::android::base::StringPrintf; +using ::android::base::unexpected; +using ::testing::ContainerEq; +using ::testing::ContainsRegex; +using ::testing::Eq; +using ::testing::WhenSortedBy; + +using std::chrono::milliseconds; + +constexpr int INVALID_PROP_ID = 0; +constexpr char CAR_MAKE[] = "Default Car"; + +} // namespace + +// A helper class to access private methods for FakeVehicleHardware. +class FakeVehicleHardwareTestHelper { + public: + FakeVehicleHardwareTestHelper(FakeVehicleHardware* hardware) { mHardware = hardware; } + + void overrideProperties(const char* overrideDir) { mHardware->overrideProperties(overrideDir); } + + private: + FakeVehicleHardware* mHardware; +}; + +class FakeVehicleHardwareTest : public ::testing::Test { + protected: + void SetUp() override { + auto callback = std::make_unique( + [this](const std::vector& values) { + onPropertyChangeEvent(values); + }); + getHardware()->registerOnPropertyChangeEvent(std::move(callback)); + mSetValuesCallback = std::make_shared( + [this](std::vector results) { onSetValues(results); }); + mGetValuesCallback = std::make_shared( + [this](std::vector results) { onGetValues(results); }); + } + + FakeVehicleHardware* getHardware() { return &mHardware; } + + StatusCode setValues(const std::vector& requests) { + { + std::scoped_lock lockGuard(mLock); + for (const auto& request : requests) { + mPendingSetValueRequests.insert(request.requestId); + } + } + if (StatusCode status = getHardware()->setValues(mSetValuesCallback, requests); + status != StatusCode::OK) { + return status; + } + std::unique_lock lk(mLock); + // Wait for the onSetValueResults. + bool result = mCv.wait_for(lk, milliseconds(1000), [this] { + ScopedLockAssertion lockAssertion(mLock); + return mPendingSetValueRequests.size() == 0; + }); + if (!result) { + ALOGE("wait for callbacks for setValues timed-out"); + return StatusCode::INTERNAL_ERROR; + } + return StatusCode::OK; + } + + StatusCode getValues(const std::vector& requests) { + { + std::scoped_lock lockGuard(mLock); + for (const auto& request : requests) { + mPendingGetValueRequests.insert(request.requestId); + } + } + if (StatusCode status = getHardware()->getValues(mGetValuesCallback, requests); + status != StatusCode::OK) { + return status; + } + std::unique_lock lk(mLock); + // Wait for the onGetValueResults. + bool result = mCv.wait_for(lk, milliseconds(1000), [this] { + ScopedLockAssertion lockAssertion(mLock); + return mPendingGetValueRequests.size() == 0; + }); + if (!result) { + ALOGE("wait for callbacks for getValues timed-out"); + return StatusCode::INTERNAL_ERROR; + } + return StatusCode::OK; + } + + StatusCode setValue(const VehiclePropValue& value) { + std::vector requests = { + SetValueRequest{ + .requestId = 0, + .value = value, + }, + }; + + if (StatusCode status = setValues(requests); status != StatusCode::OK) { + return status; + } + + const SetValueResult& result = getSetValueResults().back(); + + if (result.requestId != 0) { + ALOGE("request ID mismatch, got %" PRId64 ", expect 0", result.requestId); + return StatusCode::INTERNAL_ERROR; + } + + return result.status; + } + + expected getValue(const VehiclePropValue& value) { + std::vector requests = { + GetValueRequest{ + .requestId = 0, + .prop = value, + }, + }; + + if (StatusCode status = getValues(requests); status != StatusCode::OK) { + return unexpected(status); + } + + const GetValueResult& result = getGetValueResults().back(); + if (result.requestId != 0) { + ALOGE("request ID mismatch, got %" PRId64 ", expect 0", result.requestId); + return unexpected(StatusCode::INTERNAL_ERROR); + } + + if (result.status != StatusCode::OK) { + return unexpected(result.status); + } + + if (!result.prop.has_value()) { + ALOGE("%s", "result property is empty"); + return unexpected(StatusCode::INTERNAL_ERROR); + } + + return result.prop.value(); + } + + template + int getStatus(expected result) { + return toInt(result.error()); + } + + void onSetValues(std::vector results) { + std::scoped_lock lockGuard(mLock); + for (auto& result : results) { + mSetValueResults.push_back(result); + mPendingSetValueRequests.erase(result.requestId); + } + mCv.notify_all(); + } + + const std::vector& getSetValueResults() { + std::scoped_lock lockGuard(mLock); + return mSetValueResults; + } + + void onGetValues(std::vector results) { + std::scoped_lock lockGuard(mLock); + for (auto& result : results) { + mGetValueResults.push_back(result); + mPendingGetValueRequests.erase(result.requestId); + } + mCv.notify_all(); + } + + const std::vector& getGetValueResults() { + std::scoped_lock lockGuard(mLock); + return mGetValueResults; + } + + void onPropertyChangeEvent(std::vector values) { + std::scoped_lock lockGuard(mLock); + for (auto& value : values) { + mChangedProperties.push_back(value); + PropIdAreaId propIdAreaId{ + .propId = value.prop, + .areaId = value.areaId, + }; + mEventCount[propIdAreaId]++; + } + mCv.notify_all(); + } + + const std::vector& getChangedProperties() { + std::scoped_lock lockGuard(mLock); + return mChangedProperties; + } + + bool waitForChangedProperties(int32_t propId, int32_t areaId, size_t count, + milliseconds timeout) { + PropIdAreaId propIdAreaId{ + .propId = propId, + .areaId = areaId, + }; + std::unique_lock lk(mLock); + return mCv.wait_for(lk, timeout, [this, propIdAreaId, count] { + ScopedLockAssertion lockAssertion(mLock); + return mEventCount[propIdAreaId] >= count; + }); + } + + void clearChangedProperties() { + std::scoped_lock lockGuard(mLock); + mEventCount.clear(); + mChangedProperties.clear(); + } + + static void addSetValueRequest(std::vector& requests, + std::vector& expectedResults, int64_t requestId, + const VehiclePropValue& value, StatusCode expectedStatus) { + SetValueRequest request; + request.requestId = requestId; + request.value = value; + request.value.timestamp = elapsedRealtimeNano(); + requests.push_back(std::move(request)); + + SetValueResult result; + result.requestId = requestId; + result.status = expectedStatus; + expectedResults.push_back(std::move(result)); + } + + static void addGetValueRequest(std::vector& requests, + std::vector& expectedResults, int64_t requestId, + const VehiclePropValue& value, StatusCode expectedStatus) { + GetValueRequest request; + request.requestId = requestId; + request.prop.prop = value.prop; + request.prop.areaId = value.areaId; + requests.push_back(std::move(request)); + + GetValueResult result; + result.requestId = requestId; + result.status = expectedStatus; + if (expectedStatus == StatusCode::OK) { + result.prop = value; + } + expectedResults.push_back(std::move(result)); + } + + std::vector getTestPropValues() { + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + + VehiclePropValue leftTirePressure = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .value = {.floatValues = {170.0}}, + .areaId = WHEEL_FRONT_LEFT, + }; + + VehiclePropValue rightTirePressure = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .value = {.floatValues = {180.0}}, + .areaId = WHEEL_FRONT_RIGHT, + }; + + return {fuelCapacity, leftTirePressure, rightTirePressure}; + } + + struct PropValueCmp { + bool operator()(const VehiclePropValue& a, const VehiclePropValue& b) const { + return (a.prop < b.prop) || ((a.prop == b.prop) && (a.value < b.value)) || + ((a.prop == b.prop) && (a.value == b.value) && (a.areaId < b.areaId)); + } + } mPropValueCmp; + + private: + FakeVehicleHardware mHardware; + std::shared_ptr mSetValuesCallback; + std::shared_ptr mGetValuesCallback; + std::condition_variable mCv; + std::mutex mLock; + std::unordered_map mEventCount GUARDED_BY(mLock); + std::vector mSetValueResults GUARDED_BY(mLock); + std::vector mGetValueResults GUARDED_BY(mLock); + std::vector mChangedProperties GUARDED_BY(mLock); + std::unordered_set mPendingSetValueRequests GUARDED_BY(mLock); + std::unordered_set mPendingGetValueRequests GUARDED_BY(mLock); +}; + +TEST_F(FakeVehicleHardwareTest, testGetAllPropertyConfigs) { + std::vector configs = getHardware()->getAllPropertyConfigs(); + + ASSERT_EQ(configs.size(), defaultconfig::getDefaultConfigs().size()); +} + +TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { + std::vector getValueRequests; + std::vector expectedGetValueResults; + int64_t requestId = 1; + + for (auto& config : defaultconfig::getDefaultConfigs()) { + if (obd2frame::FakeObd2Frame::isDiagnosticProperty(config.config)) { + // Ignore storing default value for diagnostic property. They have special get/set + // logic. + continue; + } + + if (FakeUserHal::isSupported(config.config.prop)) { + // Ignore fake user HAL properties, they have special logic for getting values. + continue; + } + + if (config.config.prop == ECHO_REVERSE_BYTES) { + // Ignore ECHO_REVERSE_BYTES, it has special logic. + continue; + } + + int propId = config.config.prop; + if (isGlobalProp(propId)) { + if (config.initialValue == RawPropValues{}) { + addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, + VehiclePropValue{.prop = propId}, StatusCode::NOT_AVAILABLE); + continue; + } + addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, + VehiclePropValue{ + .prop = propId, + .value = config.initialValue, + }, + StatusCode::OK); + continue; + } + for (auto areaConfig : config.config.areaConfigs) { + StatusCode status = StatusCode::OK; + VehiclePropValue propValue{ + .prop = propId, + .areaId = areaConfig.areaId, + }; + if (config.initialAreaValues.empty()) { + if (config.initialValue == RawPropValues{}) { + status = StatusCode::NOT_AVAILABLE; + } else { + propValue.value = config.initialValue; + } + } else if (auto valueForAreaIt = config.initialAreaValues.find(areaConfig.areaId); + valueForAreaIt != config.initialAreaValues.end()) { + propValue.value = valueForAreaIt->second; + } else { + status = StatusCode::NOT_AVAILABLE; + } + addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, propValue, + status); + } + } + + // In our implementation, this would finish immediately. + StatusCode status = getValues(getValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + + std::vector getValueResultsWithNoTimestamp; + for (auto& result : getGetValueResults()) { + GetValueResult resultCopy = result; + resultCopy.prop->timestamp = 0; + getValueResultsWithNoTimestamp.push_back(std::move(resultCopy)); + } + ASSERT_THAT(getValueResultsWithNoTimestamp, ContainerEq(expectedGetValueResults)); +} + +TEST_F(FakeVehicleHardwareTest, testSetValues) { + std::vector requests; + std::vector expectedResults; + + int64_t requestId = 1; + for (auto& value : getTestPropValues()) { + addSetValueRequest(requests, expectedResults, requestId++, value, StatusCode::OK); + } + + StatusCode status = setValues(requests); + + ASSERT_EQ(status, StatusCode::OK); + + // Although callback might be called asynchronously, in our implementation, the callback would + // be called before setValues returns. + ASSERT_THAT(getSetValueResults(), ContainerEq(expectedResults)); +} + +TEST_F(FakeVehicleHardwareTest, testSetValuesError) { + std::vector requests; + std::vector expectedResults; + + int64_t requestId = 1; + + VehiclePropValue invalidProp = { + .prop = INVALID_PROP_ID, + }; + addSetValueRequest(requests, expectedResults, requestId++, invalidProp, + StatusCode::INVALID_ARG); + + for (auto& value : getTestPropValues()) { + addSetValueRequest(requests, expectedResults, requestId++, value, StatusCode::OK); + } + + StatusCode status = setValues(requests); + + ASSERT_EQ(status, StatusCode::OK); + + // Although callback might be called asynchronously, in our implementation, the callback would + // be called before setValues returns. + ASSERT_THAT(getSetValueResults(), ContainerEq(expectedResults)); +} + +TEST_F(FakeVehicleHardwareTest, testRegisterOnPropertyChangeEvent) { + // We have already registered this callback in Setup, here we are registering again. + auto callback = std::make_unique( + [this](const std::vector& values) { onPropertyChangeEvent(values); }); + getHardware()->registerOnPropertyChangeEvent(std::move(callback)); + + auto testValues = getTestPropValues(); + std::vector requests; + std::vector expectedResults; + int64_t requestId = 1; + for (auto& value : testValues) { + addSetValueRequest(requests, expectedResults, requestId++, value, StatusCode::OK); + } + int64_t timestamp = elapsedRealtimeNano(); + + StatusCode status = setValues(requests); + + ASSERT_EQ(status, StatusCode::OK); + + auto updatedValues = getChangedProperties(); + std::vector updatedValuesWithNoTimestamp; + for (auto& value : updatedValues) { + ASSERT_GE(value.timestamp, timestamp); + VehiclePropValue valueCopy = value; + valueCopy.timestamp = 0; + updatedValuesWithNoTimestamp.push_back(std::move(valueCopy)); + } + + ASSERT_THAT(updatedValuesWithNoTimestamp, WhenSortedBy(mPropValueCmp, Eq(testValues))); +} + +TEST_F(FakeVehicleHardwareTest, testReadValues) { + std::vector setValueRequests; + std::vector expectedSetValueResults; + + int64_t requestId = 1; + for (auto& value : getTestPropValues()) { + addSetValueRequest(setValueRequests, expectedSetValueResults, requestId++, value, + StatusCode::OK); + } + int64_t timestamp = elapsedRealtimeNano(); + + // In our implementation, this would finish immediately. + StatusCode status = setValues(setValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + + std::vector getValueRequests; + std::vector expectedGetValueResults; + for (auto& value : getTestPropValues()) { + addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, value, + StatusCode::OK); + } + + // In our implementation, this would finish immediately. + status = getValues(getValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + + std::vector getValueResultsWithNoTimestamp; + for (auto& result : getGetValueResults()) { + ASSERT_GE(result.prop->timestamp, timestamp); + GetValueResult resultCopy = result; + resultCopy.prop->timestamp = 0; + getValueResultsWithNoTimestamp.push_back(std::move(resultCopy)); + } + ASSERT_THAT(getValueResultsWithNoTimestamp, ContainerEq(expectedGetValueResults)); +} + +TEST_F(FakeVehicleHardwareTest, testReadValuesErrorInvalidProp) { + std::vector setValueRequests; + std::vector expectedSetValueResults; + + int64_t requestId = 1; + for (auto& value : getTestPropValues()) { + addSetValueRequest(setValueRequests, expectedSetValueResults, requestId++, value, + StatusCode::OK); + } + + // In our implementation, this would finish immediately. + StatusCode status = setValues(setValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + + std::vector getValueRequests; + std::vector expectedGetValueResults; + VehiclePropValue invalidProp = { + .prop = INVALID_PROP_ID, + }; + addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, invalidProp, + StatusCode::INVALID_ARG); + + // In our implementation, this would finish immediately. + status = getValues(getValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + ASSERT_THAT(getGetValueResults(), ContainerEq(expectedGetValueResults)); +} + +TEST_F(FakeVehicleHardwareTest, testReadValuesErrorNotAvailable) { + std::vector getValueRequests; + std::vector expectedGetValueResults; + // VEHICLE_MAP_SERVICE does not have initial value, 'get' must always return + // StatusCode::NOT_AVAILABLE. + addGetValueRequest(getValueRequests, expectedGetValueResults, 0, + VehiclePropValue{ + .prop = VEHICLE_MAP_SERVICE, + }, + StatusCode::NOT_AVAILABLE); + + // In our implementation, this would finish immediately. + StatusCode status = getValues(getValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + ASSERT_THAT(getGetValueResults(), ContainerEq(expectedGetValueResults)); +} + +TEST_F(FakeVehicleHardwareTest, testSetStatusMustIgnore) { + VehiclePropValue testValue = getTestPropValues()[0]; + testValue.status = VehiclePropertyStatus::UNAVAILABLE; + + std::vector setValueRequests; + std::vector expectedSetValueResults; + + int64_t requestId = 1; + addSetValueRequest(setValueRequests, expectedSetValueResults, requestId++, testValue, + StatusCode::OK); + + // In our implementation, this would finish immediately. + StatusCode status = setValues(setValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + ASSERT_THAT(getSetValueResults(), ContainerEq(expectedSetValueResults)); + + std::vector getValueRequests; + getValueRequests.push_back(GetValueRequest{ + .requestId = requestId++, + .prop = testValue, + }); + + // In our implementation, this would finish immediately. + status = getValues(getValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + ASSERT_EQ(getGetValueResults().size(), static_cast(1)); + ASSERT_EQ(getGetValueResults()[0].status, StatusCode::OK); + // The status should be by-default AVAILABLE for new status. + ASSERT_EQ(getGetValueResults()[0].prop->status, VehiclePropertyStatus::AVAILABLE); + + // Try to set the property again. The status should not be overwritten. + status = setValues(setValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + + status = getValues(getValueRequests); + + ASSERT_EQ(status, StatusCode::OK); + ASSERT_EQ(getGetValueResults().size(), static_cast(2)); + ASSERT_EQ(getGetValueResults()[1].status, StatusCode::OK); + ASSERT_EQ(getGetValueResults()[1].prop->status, VehiclePropertyStatus::AVAILABLE); +} + +TEST_F(FakeVehicleHardwareTest, testVendorOverrideProperties) { + std::string overrideDir = android::base::GetExecutableDirectory() + "/override/"; + // Set vendor override directory. + FakeVehicleHardwareTestHelper helper(getHardware()); + helper.overrideProperties(overrideDir.c_str()); + + // This is the same as the prop in 'gear_selection.json'. + int gearProp = toInt(VehicleProperty::GEAR_SELECTION); + + auto result = getValue(VehiclePropValue{ + .prop = gearProp, + }); + + ASSERT_TRUE(result.ok()) << "expect to get the overridden property ok: " << getStatus(result); + ASSERT_EQ(static_cast(1), result.value().value.int32Values.size()); + ASSERT_EQ(8, result.value().value.int32Values[0]); + + // If we set the value, it should update despite the override. + ASSERT_EQ(setValue(VehiclePropValue{ + .prop = gearProp, + .value = + { + .int32Values = {5}, + }, + .timestamp = elapsedRealtimeNano(), + }), + StatusCode::OK) + << "expect to set the overridden property ok"; + + result = getValue(VehiclePropValue{ + .prop = gearProp, + }); + + ASSERT_TRUE(result.ok()) << "expect to get the overridden property after setting value ok"; + ASSERT_EQ(static_cast(1), result.value().value.int32Values.size()); + ASSERT_EQ(5, result.value().value.int32Values[0]); +} + +TEST_F(FakeVehicleHardwareTest, testVendorOverridePropertiesMultipleAreas) { + std::string overrideDir = android::base::GetExecutableDirectory() + "/override/"; + // Set vendor override directory. + FakeVehicleHardwareTestHelper helper(getHardware()); + helper.overrideProperties(overrideDir.c_str()); + + // This is the same as the prop in 'hvac_temperature_set.json'. + int hvacProp = toInt(VehicleProperty::HVAC_TEMPERATURE_SET); + + auto result = getValue(VehiclePropValue{ + .prop = hvacProp, + .areaId = HVAC_LEFT, + }); + + ASSERT_TRUE(result.ok()) << "expect to get the overridden property ok: " << getStatus(result); + ASSERT_EQ(static_cast(1), result.value().value.floatValues.size()); + ASSERT_EQ(30.0f, result.value().value.floatValues[0]); + + // HVAC_RIGHT should not be affected and return the default value. + result = getValue(VehiclePropValue{ + .prop = hvacProp, + .areaId = HVAC_RIGHT, + }); + + ASSERT_TRUE(result.ok()) << "expect to get the default property ok: " << getStatus(result); + ASSERT_EQ(static_cast(1), result.value().value.floatValues.size()); + ASSERT_EQ(20.0f, result.value().value.floatValues[0]); +} + +TEST_F(FakeVehicleHardwareTest, testVendorOverridePropertiesDirDoesNotExist) { + // Set vendor override directory to a non-existing dir + FakeVehicleHardwareTestHelper helper(getHardware()); + helper.overrideProperties("123"); + auto result = getValue(VehiclePropValue{ + .prop = toInt(VehicleProperty::GEAR_SELECTION), + }); + + ASSERT_TRUE(result.ok()) << "expect to get the default property ok: " << getStatus(result); + ASSERT_EQ(static_cast(1), result.value().value.int32Values.size()); + ASSERT_EQ(4, result.value().value.int32Values[0]); +} + +struct SetSpecialValueTestCase { + std::string name; + std::vector valuesToSet; + std::vector expectedValuesToGet; +}; + +std::vector setSpecialValueTestCases() { + return { + SetSpecialValueTestCase{ + .name = "set_ap_power_state_report_deep_sleep_exit", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::DEEP_SLEEP_EXIT)}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = {toInt(VehicleApPowerStateReq::ON), + 0}, + }, + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::DEEP_SLEEP_EXIT)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_ap_power_state_report_hibernation_exit", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::HIBERNATION_EXIT)}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = {toInt(VehicleApPowerStateReq::ON), + 0}, + }, + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::HIBERNATION_EXIT)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_ap_power_state_report_shutdown_cancelled", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::SHUTDOWN_CANCELLED)}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = {toInt(VehicleApPowerStateReq::ON), + 0}, + }, + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::SHUTDOWN_CANCELLED)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_ap_power_state_report_wait_for_vhal", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::WAIT_FOR_VHAL)}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = {toInt(VehicleApPowerStateReq::ON), + 0}, + }, + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::WAIT_FOR_VHAL)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_ap_power_state_report_deep_sleep_entry", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::DEEP_SLEEP_ENTRY)}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = + {toInt(VehicleApPowerStateReq::FINISHED), 0}, + }, + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::DEEP_SLEEP_ENTRY)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_ap_power_state_report_hibernation_entry", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::HIBERNATION_ENTRY)}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = + {toInt(VehicleApPowerStateReq::FINISHED), 0}, + }, + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::HIBERNATION_ENTRY)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "set_ap_power_state_report_shutdown_start", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::SHUTDOWN_START)}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = + {toInt(VehicleApPowerStateReq::FINISHED), 0}, + }, + VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .value.int32Values = {toInt( + VehicleApPowerStateReport::SHUTDOWN_START)}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "cluster_report_state_to_vendor", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::CLUSTER_REPORT_STATE), + .value.int32Values = {1}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = VENDOR_CLUSTER_REPORT_STATE, + .value.int32Values = {1}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "cluster_request_display_to_vendor", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY), + .value.int32Values = {1}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = VENDOR_CLUSTER_REQUEST_DISPLAY, + .value.int32Values = {1}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "cluster_navigation_state_to_vendor", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty::CLUSTER_NAVIGATION_STATE), + .value.byteValues = {0x1}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = VENDOR_CLUSTER_NAVIGATION_STATE, + .value.byteValues = {0x1}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "vendor_cluster_switch_ui_to_system", + .valuesToSet = + { + VehiclePropValue{ + .prop = VENDOR_CLUSTER_SWITCH_UI, + .value.int32Values = {1}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::CLUSTER_SWITCH_UI), + .value.int32Values = {1}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "vendor_cluster_display_state_to_system", + .valuesToSet = + { + VehiclePropValue{ + .prop = VENDOR_CLUSTER_DISPLAY_STATE, + .value.int32Values = {1, 2}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt(VehicleProperty::CLUSTER_DISPLAY_STATE), + .value.int32Values = {1, 2}, + }, + }, + }, + }; +} + +class FakeVehicleHardwareSpecialValuesTest + : public FakeVehicleHardwareTest, + public testing::WithParamInterface {}; + +TEST_P(FakeVehicleHardwareSpecialValuesTest, testSetSpecialProperties) { + const SetSpecialValueTestCase& tc = GetParam(); + + for (const auto& value : tc.valuesToSet) { + ASSERT_EQ(setValue(value), StatusCode::OK) << "failed to set property " << value.prop; + } + + std::vector gotValues; + + for (const auto& value : tc.expectedValuesToGet) { + auto result = getValue(VehiclePropValue{.prop = value.prop}); + + ASSERT_TRUE(result.ok()) << "failed to get property " << value.prop + << " status:" << getStatus(result); + + gotValues.push_back(result.value()); + VehiclePropValue valueWithNoTimestamp = result.value(); + valueWithNoTimestamp.timestamp = 0; + + ASSERT_EQ(valueWithNoTimestamp, value); + } + + // Some of the updated properties might be the same as default config, thus not causing + // a property change event. So the changed properties should be a subset of all the updated + // properties. + ASSERT_THAT(getChangedProperties(), WhenSortedBy(mPropValueCmp, Eq(gotValues))); +} + +INSTANTIATE_TEST_SUITE_P( + SpecialValuesTests, FakeVehicleHardwareSpecialValuesTest, + testing::ValuesIn(setSpecialValueTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_F(FakeVehicleHardwareTest, testSetWaitForVhalAfterCarServiceCrash) { + int32_t propId = toInt(VehicleProperty::AP_POWER_STATE_REPORT); + VehiclePropValue request = VehiclePropValue{ + .prop = propId, + .value.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL)}, + }; + ASSERT_EQ(setValue(request), StatusCode::OK) << "failed to set property " << propId; + + // Clear existing events. + clearChangedProperties(); + + // Simulate a Car Service crash, Car Service would restart and send the message again. + ASSERT_EQ(setValue(request), StatusCode::OK) << "failed to set property " << propId; + + std::vector events = getChangedProperties(); + // Even though the state is already ON, we should receive another ON event. + ASSERT_EQ(events.size(), 1u); + // Erase the timestamp for comparison. + events[0].timestamp = 0; + ASSERT_EQ(events[0], (VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}, + })); +} + +TEST_F(FakeVehicleHardwareTest, testGetObd2FreezeFrame) { + int64_t timestamp = elapsedRealtimeNano(); + + auto result = getValue(VehiclePropValue{.prop = OBD2_FREEZE_FRAME_INFO}); + + ASSERT_TRUE(result.ok()); + + auto propValue = result.value(); + ASSERT_GE(propValue.timestamp, timestamp); + ASSERT_EQ(propValue.value.int64Values.size(), static_cast(3)) + << "expect 3 obd2 freeze frames stored"; + + for (int64_t timestamp : propValue.value.int64Values) { + auto freezeFrameResult = getValue(VehiclePropValue{ + .prop = OBD2_FREEZE_FRAME, + .value.int64Values = {timestamp}, + }); + + EXPECT_TRUE(result.ok()) << "expect to get freeze frame for timestamp " << timestamp + << " ok"; + EXPECT_GE(freezeFrameResult.value().timestamp, timestamp); + } +} + +TEST_F(FakeVehicleHardwareTest, testClearObd2FreezeFrame) { + int64_t timestamp = elapsedRealtimeNano(); + + auto getValueResult = getValue(VehiclePropValue{.prop = OBD2_FREEZE_FRAME_INFO}); + + ASSERT_TRUE(getValueResult.ok()); + + auto propValue = getValueResult.value(); + ASSERT_GE(propValue.timestamp, timestamp); + ASSERT_EQ(propValue.value.int64Values.size(), static_cast(3)) + << "expect 3 obd2 freeze frames stored"; + + // No int64Values should clear all freeze frames. + StatusCode status = setValue(VehiclePropValue{.prop = OBD2_FREEZE_FRAME_CLEAR}); + + ASSERT_EQ(status, StatusCode::OK); + + getValueResult = getValue(VehiclePropValue{.prop = OBD2_FREEZE_FRAME_INFO}); + + ASSERT_TRUE(getValueResult.ok()); + ASSERT_EQ(getValueResult.value().value.int64Values.size(), static_cast(0)) + << "expect 0 obd2 freeze frames after cleared"; +} + +TEST_F(FakeVehicleHardwareTest, testSetVehicleMapService) { + StatusCode status = + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::VEHICLE_MAP_SERVICE)}); + + EXPECT_EQ(status, StatusCode::OK); + + auto getValueResult = + getValue(VehiclePropValue{.prop = toInt(VehicleProperty::VEHICLE_MAP_SERVICE)}); + + EXPECT_FALSE(getValueResult.ok()); + EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); +} + +TEST_F(FakeVehicleHardwareTest, testGetUserPropertySetOnly) { + for (VehicleProperty prop : std::vector({ + VehicleProperty::INITIAL_USER_INFO, + VehicleProperty::SWITCH_USER, + VehicleProperty::CREATE_USER, + VehicleProperty::REMOVE_USER, + })) { + auto result = getValue(VehiclePropValue{.prop = toInt(prop)}); + + EXPECT_FALSE(result.ok()); + if (!result.ok()) { + EXPECT_EQ(result.error(), StatusCode::INVALID_ARG); + } + } +} + +TEST_F(FakeVehicleHardwareTest, testGetUserIdAssoc) { + int32_t userIdAssocProp = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION); + + auto result = getValue(VehiclePropValue{.prop = userIdAssocProp}); + + // Default returns NOT_AVAILABLE. + ASSERT_FALSE(result.ok()); + ASSERT_EQ(result.error(), StatusCode::NOT_AVAILABLE); + + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue valueToSet = { + .prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION), + .areaId = 1, + .value.int32Values = {666, 1, 1, 2}, + }; + + StatusCode status = setValue(valueToSet); + + ASSERT_EQ(status, StatusCode::OK); + + result = getValue(VehiclePropValue{ + .prop = userIdAssocProp, + // Request ID + .value.int32Values = {1}, + }); + + ASSERT_TRUE(result.ok()); + + auto& gotValue = result.value(); + gotValue.timestamp = 0; + + // Expect to get the same request ID. + valueToSet.value.int32Values[0] = 1; + + ASSERT_EQ(gotValue, valueToSet); +} + +TEST_F(FakeVehicleHardwareTest, testSwitchUser) { + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue valueToSet = { + .prop = toInt(VehicleProperty::SWITCH_USER), + .areaId = 1, + .value.int32Values = {666, 3, 2}, + }; + + StatusCode status = setValue(valueToSet); + + ASSERT_EQ(status, StatusCode::OK); + + // Simulate a request from Android side. + VehiclePropValue switchUserRequest = { + .prop = toInt(VehicleProperty::SWITCH_USER), + .areaId = 0, + .value.int32Values = {666, 3}, + }; + // Clear existing events. + clearChangedProperties(); + + status = setValue(switchUserRequest); + + ASSERT_EQ(status, StatusCode::OK); + + // Should generate an event for user hal response. + auto events = getChangedProperties(); + ASSERT_EQ(events.size(), static_cast(1)); + + events[0].timestamp = 0; + ASSERT_EQ(events[0], valueToSet); + + // Try to get switch_user again, should return default value. + clearChangedProperties(); + status = setValue(switchUserRequest); + ASSERT_EQ(status, StatusCode::OK); + + events = getChangedProperties(); + ASSERT_EQ(events.size(), static_cast(1)); + events[0].timestamp = 0; + ASSERT_EQ(events[0], (VehiclePropValue{ + .areaId = 0, + .prop = toInt(VehicleProperty::SWITCH_USER), + .value.int32Values = + { + // Request ID + 666, + // VEHICLE_RESPONSE + 3, + // SUCCESS + 1, + }, + })); +} + +TEST_F(FakeVehicleHardwareTest, testCreateUser) { + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue valueToSet = { + .prop = toInt(VehicleProperty::CREATE_USER), + .areaId = 1, + .value.int32Values = {666, 2}, + }; + + StatusCode status = setValue(valueToSet); + + ASSERT_EQ(status, StatusCode::OK); + + // Simulate a request from Android side. + VehiclePropValue createUserRequest = { + .prop = toInt(VehicleProperty::CREATE_USER), + .areaId = 0, + .value.int32Values = {666}, + }; + // Clear existing events. + clearChangedProperties(); + + status = setValue(createUserRequest); + + ASSERT_EQ(status, StatusCode::OK); + + // Should generate an event for user hal response. + auto events = getChangedProperties(); + ASSERT_EQ(events.size(), static_cast(1)); + events[0].timestamp = 0; + EXPECT_EQ(events[0], valueToSet); + + // Try to get create_user again, should return default value. + clearChangedProperties(); + status = setValue(createUserRequest); + ASSERT_EQ(status, StatusCode::OK); + + events = getChangedProperties(); + ASSERT_EQ(events.size(), static_cast(1)); + events[0].timestamp = 0; + ASSERT_EQ(events[0], (VehiclePropValue{ + .areaId = 0, + .prop = toInt(VehicleProperty::CREATE_USER), + .value.int32Values = + { + // Request ID + 666, + // SUCCESS + 1, + }, + })); +} + +TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { + // This is the same example as used in User HAL Emulation doc. + VehiclePropValue valueToSet = { + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .areaId = 1, + .value.int32Values = {666, 1, 11}, + }; + + StatusCode status = setValue(valueToSet); + + ASSERT_EQ(status, StatusCode::OK); + + // Simulate a request from Android side. + VehiclePropValue initialUserInfoRequest = { + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .areaId = 0, + .value.int32Values = {3}, + }; + // Clear existing events. + clearChangedProperties(); + + status = setValue(initialUserInfoRequest); + + ASSERT_EQ(status, StatusCode::OK); + + // Should generate an event for user hal response. + auto events = getChangedProperties(); + ASSERT_EQ(events.size(), static_cast(1)); + events[0].timestamp = 0; + EXPECT_EQ(events[0], (VehiclePropValue{ + .areaId = 1, + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .value.int32Values = {3, 1, 11}, + })); + + // Try to get create_user again, should return default value. + clearChangedProperties(); + status = setValue(initialUserInfoRequest); + ASSERT_EQ(status, StatusCode::OK); + + events = getChangedProperties(); + ASSERT_EQ(events.size(), static_cast(1)); + events[0].timestamp = 0; + EXPECT_EQ(events[0], (VehiclePropValue{ + .areaId = 0, + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .value.int32Values = + { + // Request ID + 3, + // ACTION: DEFAULT + 0, + // User id: 0 + 0, + // Flags: 0 + 0, + }, + .value.stringValue = "||", + })); +} + +TEST_F(FakeVehicleHardwareTest, testDumpAllProperties) { + std::vector options; + DumpResult result = getHardware()->dump(options); + ASSERT_TRUE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex("dumping .+ properties")); +} + +TEST_F(FakeVehicleHardwareTest, testDumpHelp) { + std::vector options; + options.push_back("--help"); + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex("Usage: ")); +} + +TEST_F(FakeVehicleHardwareTest, testDumpListProperties) { + std::vector options; + options.push_back("--list"); + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex("listing .+ properties")); +} + +TEST_F(FakeVehicleHardwareTest, testDumpSpecificProperties) { + std::vector options; + options.push_back("--get"); + std::string prop1 = std::to_string(toInt(VehicleProperty::INFO_FUEL_CAPACITY)); + std::string prop2 = std::to_string(toInt(VehicleProperty::TIRE_PRESSURE)); + options.push_back(prop1); + options.push_back(prop2); + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, + ContainsRegex(StringPrintf("1:.*prop: %s.*\n2-0:.*prop: %s.*\n2-1:.*prop: %s.*\n", + prop1.c_str(), prop2.c_str(), prop2.c_str()))); +} + +TEST_F(FakeVehicleHardwareTest, testDumpSpecificPropertiesInvalidProp) { + std::vector options; + options.push_back("--get"); + std::string prop1 = std::to_string(toInt(VehicleProperty::INFO_FUEL_CAPACITY)); + std::string prop2 = std::to_string(INVALID_PROP_ID); + options.push_back(prop1); + options.push_back(prop2); + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex(StringPrintf("1:.*prop: %s.*\nNo property %d\n", + prop1.c_str(), INVALID_PROP_ID))); +} + +TEST_F(FakeVehicleHardwareTest, testDumpSpecificPropertiesNoArg) { + std::vector options; + options.push_back("--get"); + + // No arguments. + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex("Invalid number of arguments")); +} + +TEST_F(FakeVehicleHardwareTest, testDumpInvalidOptions) { + std::vector options; + options.push_back("--invalid"); + + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex("Invalid option: --invalid")); +} + +TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHalHelp) { + std::vector options; + options.push_back("--user-hal"); + + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex("dumps state used for user management")); +} + +TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHal) { + std::vector options; + options.push_back("--user-hal"); + // Indent: " ". + options.push_back(" "); + + DumpResult result = getHardware()->dump(options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex(" No InitialUserInfo response\n")); +} + +struct SetPropTestCase { + std::string test_name; + std::vector options; + bool success; + std::string errorMsg = ""; +}; + +class FakeVehicleHardwareSetPropTest : public FakeVehicleHardwareTest, + public testing::WithParamInterface {}; + +TEST_P(FakeVehicleHardwareSetPropTest, cmdSetOneProperty) { + const SetPropTestCase& tc = GetParam(); + + DumpResult result = getHardware()->dump(tc.options); + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + if (tc.success) { + ASSERT_THAT(result.buffer, ContainsRegex("Set property:")); + } else { + ASSERT_THAT(result.buffer, ContainsRegex(tc.errorMsg)); + } +} + +std::vector GenSetPropParams() { + std::string infoMakeProperty = std::to_string(toInt(VehicleProperty::INFO_MAKE)); + return { + {"success_set_string", {"--set", infoMakeProperty, "-s", CAR_MAKE}, true}, + {"success_set_bytes", {"--set", infoMakeProperty, "-b", "0xdeadbeef"}, true}, + {"success_set_bytes_caps", {"--set", infoMakeProperty, "-b", "0xDEADBEEF"}, true}, + {"success_set_int", {"--set", infoMakeProperty, "-i", "2147483647"}, true}, + {"success_set_ints", + {"--set", infoMakeProperty, "-i", "2147483647", "0", "-2147483648"}, + true}, + {"success_set_int64", + {"--set", infoMakeProperty, "-i64", "-9223372036854775808"}, + true}, + {"success_set_int64s", + {"--set", infoMakeProperty, "-i64", "-9223372036854775808", "0", + "9223372036854775807"}, + true}, + {"success_set_float", {"--set", infoMakeProperty, "-f", "1.175494351E-38"}, true}, + {"success_set_floats", + {"--set", infoMakeProperty, "-f", "-3.402823466E+38", "0", "3.402823466E+38"}, + true}, + {"success_set_area", {"--set", infoMakeProperty, "-a", "2147483647"}, true}, + {"fail_no_options", {"--set", infoMakeProperty}, false, "Invalid number of arguments"}, + {"fail_less_than_4_options", + {"--set", infoMakeProperty, "-i"}, + false, + "No values specified"}, + {"fail_unknown_options", {"--set", infoMakeProperty, "-abcd"}, false, "Unknown option"}, + {"fail_invalid_property", + {"--set", "not valid", "-s", CAR_MAKE}, + false, + "not a valid int"}, + {"fail_duplicate_string", + {"--set", infoMakeProperty, "-s", CAR_MAKE, "-s", CAR_MAKE}, + false, + "Duplicate \"-s\" options"}, + {"fail_multiple_strings", + {"--set", infoMakeProperty, "-s", CAR_MAKE, CAR_MAKE}, + false, + "Expect exact one value"}, + {"fail_no_string_value", + {"--set", infoMakeProperty, "-s", "-a", "1234"}, + false, + "Expect exact one value"}, + {"fail_duplicate_bytes", + {"--set", infoMakeProperty, "-b", "0xdeadbeef", "-b", "0xdeadbeef"}, + false, + "Duplicate \"-b\" options"}, + {"fail_multiple_bytes", + {"--set", infoMakeProperty, "-b", "0xdeadbeef", "0xdeadbeef"}, + false, + "Expect exact one value"}, + {"fail_invalid_bytes", + {"--set", infoMakeProperty, "-b", "0xgood"}, + false, + "not a valid hex string"}, + {"fail_invalid_bytes_no_prefix", + {"--set", infoMakeProperty, "-b", "deadbeef"}, + false, + "not a valid hex string"}, + {"fail_invalid_int", + {"--set", infoMakeProperty, "-i", "abc"}, + false, + "not a valid int"}, + {"fail_int_out_of_range", + {"--set", infoMakeProperty, "-i", "2147483648"}, + false, + "not a valid int"}, + {"fail_no_int_value", + {"--set", infoMakeProperty, "-i", "-s", CAR_MAKE}, + false, + "No values specified"}, + {"fail_invalid_int64", + {"--set", infoMakeProperty, "-i64", "abc"}, + false, + "not a valid int64"}, + {"fail_int64_out_of_range", + {"--set", infoMakeProperty, "-i64", "-9223372036854775809"}, + false, + "not a valid int64"}, + {"fail_no_int64_value", + {"--set", infoMakeProperty, "-i64", "-s", CAR_MAKE}, + false, + "No values specified"}, + {"fail_invalid_float", + {"--set", infoMakeProperty, "-f", "abc"}, + false, + "not a valid float"}, + {"fail_float_out_of_range", + {"--set", infoMakeProperty, "-f", "-3.402823466E+39"}, + false, + "not a valid float"}, + {"fail_no_float_value", + {"--set", infoMakeProperty, "-f", "-s", CAR_MAKE}, + false, + "No values specified"}, + {"fail_multiple_areas", + {"--set", infoMakeProperty, "-a", "2147483648", "0"}, + false, + "Expect exact one value"}, + {"fail_invalid_area", + {"--set", infoMakeProperty, "-a", "abc"}, + false, + "not a valid int"}, + {"fail_area_out_of_range", + {"--set", infoMakeProperty, "-a", "2147483648"}, + false, + "not a valid int"}, + {"fail_no_area_value", + {"--set", infoMakeProperty, "-a", "-s", CAR_MAKE}, + false, + "Expect exact one value"}, + }; +} + +INSTANTIATE_TEST_SUITE_P( + FakeVehicleHardwareSetPropTests, FakeVehicleHardwareSetPropTest, + testing::ValuesIn(GenSetPropParams()), + [](const testing::TestParamInfo& info) { + return info.param.test_name; + }); + +TEST_F(FakeVehicleHardwareTest, SetComplexPropTest) { + std::string infoMakeProperty = std::to_string(toInt(VehicleProperty::INFO_MAKE)); + getHardware()->dump({"--set", infoMakeProperty, "-s", CAR_MAKE, + "-b", "0xdeadbeef", "-i", "2147483647", + "0", "-2147483648", "-i64", "-9223372036854775808", + "0", "9223372036854775807", "-f", "-3.402823466E+38", + "0", "3.402823466E+38", "-a", "123"}); + VehiclePropValue requestProp; + requestProp.prop = toInt(VehicleProperty::INFO_MAKE); + requestProp.areaId = 123; + auto result = getValue(requestProp); + ASSERT_TRUE(result.ok()); + VehiclePropValue value = result.value(); + ASSERT_EQ(value.prop, toInt(VehicleProperty::INFO_MAKE)); + ASSERT_EQ(value.areaId, 123); + ASSERT_STREQ(CAR_MAKE, value.value.stringValue.c_str()); + uint8_t bytes[] = {0xde, 0xad, 0xbe, 0xef}; + ASSERT_FALSE(memcmp(bytes, value.value.byteValues.data(), sizeof(bytes))); + ASSERT_EQ(3u, value.value.int32Values.size()); + ASSERT_EQ(2147483647, value.value.int32Values[0]); + ASSERT_EQ(0, value.value.int32Values[1]); + ASSERT_EQ(-2147483648, value.value.int32Values[2]); + ASSERT_EQ(3u, value.value.int64Values.size()); + // -9223372036854775808 is not a valid literal since '-' and '9223372036854775808' would be two + // tokens and the later does not fit in unsigned long long. + ASSERT_EQ(-9223372036854775807 - 1, value.value.int64Values[0]); + ASSERT_EQ(0, value.value.int64Values[1]); + ASSERT_EQ(9223372036854775807, value.value.int64Values[2]); + ASSERT_EQ(3u, value.value.floatValues.size()); + ASSERT_EQ(-3.402823466E+38f, value.value.floatValues[0]); + ASSERT_EQ(0.0f, value.value.floatValues[1]); + ASSERT_EQ(3.402823466E+38f, value.value.floatValues[2]); +} + +TEST_F(FakeVehicleHardwareTest, testGetEchoReverseBytes) { + ASSERT_EQ(setValue(VehiclePropValue{ + .prop = ECHO_REVERSE_BYTES, + .value = + { + .byteValues = {0x01, 0x02, 0x03, 0x04}, + }, + }), + StatusCode::OK); + + auto result = getValue(VehiclePropValue{ + .prop = ECHO_REVERSE_BYTES, + }); + + ASSERT_TRUE(result.ok()) << "failed to get ECHO_REVERSE_BYTES value: " << getStatus(result); + ASSERT_EQ(result.value().value.byteValues, std::vector({0x04, 0x03, 0x02, 0x01})); +} + +TEST_F(FakeVehicleHardwareTest, testUpdateSampleRate) { + int32_t propSpeed = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + int32_t propSteering = toInt(VehicleProperty::PERF_STEERING_ANGLE); + int32_t areaId = 0; + getHardware()->updateSampleRate(propSpeed, areaId, 5); + + ASSERT_TRUE(waitForChangedProperties(propSpeed, areaId, /*count=*/5, milliseconds(1500))) + << "not enough events generated for speed"; + + getHardware()->updateSampleRate(propSteering, areaId, 10); + + ASSERT_TRUE(waitForChangedProperties(propSteering, areaId, /*count=*/10, milliseconds(1500))) + << "not enough events generated for steering"; + + int64_t timestamp = elapsedRealtimeNano(); + // Disable refreshing for propSpeed. + getHardware()->updateSampleRate(propSpeed, areaId, 0); + clearChangedProperties(); + + ASSERT_TRUE(waitForChangedProperties(propSteering, areaId, /*count=*/5, milliseconds(1500))) + << "should still receive steering events after disable polling for speed"; + auto updatedValues = getChangedProperties(); + for (auto& value : updatedValues) { + ASSERT_GE(value.timestamp, timestamp); + ASSERT_EQ(value.prop, propSteering); + ASSERT_EQ(value.areaId, areaId); + } +} + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json new file mode 100644 index 0000000000000000000000000000000000000000..59666b80469e01204122b48f073bd89008c53fd8 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json @@ -0,0 +1,9 @@ +[ + { + "timestamp": 1000000, + "areaId": 0, + "value": 8, + // GEAR_SELECTION + "prop": 289408000 + } +] diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json new file mode 100644 index 0000000000000000000000000000000000000000..93a97ed095de62075a621cc4bbfa787065374360 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json @@ -0,0 +1,10 @@ +[ + { + "timestamp": 1000000, + // HVAC_LEFT + "areaId": 49, + "value": 30, + // HVAC_TEMPERATURE_SET + "prop": 358614275 + } +] diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..c1cee84e636fdf9f116ce601f07f4203675b8907 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/Android.bp @@ -0,0 +1,32 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library { + name: "FakeObd2Frame", + vendor: true, + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], + static_libs: [ + "VehicleHalUtils", + ], + export_static_lib_headers: ["VehicleHalUtils"], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/FakeObd2Frame.h b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/FakeObd2Frame.h new file mode 100644 index 0000000000000000000000000000000000000000..4d2ffd049b140abfda9dd9418a13d04e620c4dbc --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/FakeObd2Frame.h @@ -0,0 +1,64 @@ +/* + * 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. + */ +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_obd2frame_include_FakeObd2Frame_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_obd2frame_include_FakeObd2Frame_H_ + +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace obd2frame { + +class FakeObd2Frame final { + public: + explicit FakeObd2Frame(std::shared_ptr propStore) + : mPropStore(propStore) {} + + void initObd2LiveFrame( + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig); + void initObd2FreezeFrame( + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig); + VhalResult getObd2FreezeFrame( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& + requestedPropValue) const; + VhalResult getObd2DtcInfo() const; + VhalResult clearObd2FreezeFrames( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); + static bool isDiagnosticProperty( + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& propConfig); + + private: + std::shared_ptr mPropStore; + + std::unique_ptr fillDefaultObd2Frame(size_t numVendorIntegerSensors, + size_t numVendorFloatSensors); +}; + +} // namespace obd2frame +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_obd2frame_include_FakeObd2Frame_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/Obd2SensorStore.h b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/Obd2SensorStore.h new file mode 100644 index 0000000000000000000000000000000000000000..1395eae3e19658b742aff1b5299903bb33aa162d --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/include/Obd2SensorStore.h @@ -0,0 +1,109 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_obd2frame_include_Obd2SensorStore_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_obd2frame_include_Obd2SensorStore_H_ + +#include +#include +#include + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace obd2frame { + +// This class wraps all the logic required to create an OBD2 frame. +// It allows storing sensor values, setting appropriate bitmasks as needed, and returning +// appropriately laid out storage of sensor values suitable for being returned via a VehicleHal +// implementation. +class Obd2SensorStore final { + public: + // Creates a sensor storage with a given number of vendor-specific sensors. + Obd2SensorStore(std::shared_ptr valuePool, size_t numVendorIntegerSensors, + size_t numVendorFloatSensors); + + template + static int getLastIndex() { + auto range = ndk::enum_range(); + auto it = range.begin(); + while (std::next(it) != range.end()) { + it++; + } + return toInt(*it); + } + + // Stores an integer-valued sensor. + aidl::android::hardware::automotive::vehicle::StatusCode setIntegerSensor( + aidl::android::hardware::automotive::vehicle::DiagnosticIntegerSensorIndex index, + int32_t value); + // Stores an integer-valued sensor. + aidl::android::hardware::automotive::vehicle::StatusCode setIntegerSensor(size_t index, + int32_t value); + // Stores a float-valued sensor. + aidl::android::hardware::automotive::vehicle::StatusCode setFloatSensor( + aidl::android::hardware::automotive::vehicle::DiagnosticFloatSensorIndex index, + float value); + // Stores a float-valued sensor. + aidl::android::hardware::automotive::vehicle::StatusCode setFloatSensor(size_t index, + float value); + + // Returns a sensor property value using the given DTC. + VehiclePropValuePool::RecyclableType getSensorProperty(const std::string& dtc) const; + + private: + class BitmaskInVector final { + public: + explicit BitmaskInVector(size_t numBits = 0); + void resize(size_t numBits); + android::base::Result get(size_t index) const; + android::base::Result set(size_t index, bool value); + + const std::vector& getBitmask() const; + + private: + std::vector mStorage; + size_t mNumBits; + }; + + std::vector mIntegerSensors; + std::vector mFloatSensors; + BitmaskInVector mSensorsBitmask; + std::shared_ptr mValuePool; + + // Returns a vector that contains all integer sensors stored. + const std::vector& getIntegerSensors() const; + // Returns a vector that contains all float sensors stored. + const std::vector& getFloatSensors() const; + // Returns a vector that contains a bitmask for all stored sensors. + const std::vector& getSensorsBitmask() const; +}; + +} // namespace obd2frame +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_obd2frame_include_Obd2SensorStore_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/src/FakeObd2Frame.cpp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/src/FakeObd2Frame.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f9f2174f098b97d04bd1cb2a00b43b7ec54b189 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/src/FakeObd2Frame.cpp @@ -0,0 +1,199 @@ +/* + * 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. + */ + +#include "FakeObd2Frame.h" +#include "Obd2SensorStore.h" + +#include +#include +#include +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace obd2frame { + +using ::aidl::android::hardware::automotive::vehicle::DiagnosticFloatSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::DiagnosticIntegerSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::Obd2CommonIgnitionMonitors; +using ::aidl::android::hardware::automotive::vehicle::Obd2FuelSystemStatus; +using ::aidl::android::hardware::automotive::vehicle::Obd2FuelType; +using ::aidl::android::hardware::automotive::vehicle::Obd2IgnitionMonitorKind; +using ::aidl::android::hardware::automotive::vehicle::Obd2SecondaryAirStatus; +using ::aidl::android::hardware::automotive::vehicle::Obd2SparkIgnitionMonitors; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::Result; + +std::unique_ptr FakeObd2Frame::fillDefaultObd2Frame(size_t numVendorIntegerSensors, + size_t numVendorFloatSensors) { + std::unique_ptr sensorStore(new Obd2SensorStore( + mPropStore->getValuePool(), numVendorIntegerSensors, numVendorFloatSensors)); + + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::FUEL_SYSTEM_STATUS, + toInt(Obd2FuelSystemStatus::CLOSED_LOOP)); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::MALFUNCTION_INDICATOR_LIGHT_ON, 0); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::IGNITION_MONITORS_SUPPORTED, + toInt(Obd2IgnitionMonitorKind::SPARK)); + sensorStore->setIntegerSensor( + DiagnosticIntegerSensorIndex::IGNITION_SPECIFIC_MONITORS, + toInt(Obd2CommonIgnitionMonitors::COMPONENTS_AVAILABLE) | + toInt(Obd2CommonIgnitionMonitors::MISFIRE_AVAILABLE) | + toInt(Obd2SparkIgnitionMonitors::AC_REFRIGERANT_AVAILABLE) | + toInt(Obd2SparkIgnitionMonitors::EVAPORATIVE_SYSTEM_AVAILABLE)); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::INTAKE_AIR_TEMPERATURE, 35); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::COMMANDED_SECONDARY_AIR_STATUS, + toInt(Obd2SecondaryAirStatus::FROM_OUTSIDE_OR_OFF)); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::NUM_OXYGEN_SENSORS_PRESENT, 1); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::RUNTIME_SINCE_ENGINE_START, 500); + sensorStore->setIntegerSensor( + DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON, 0); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::WARMUPS_SINCE_CODES_CLEARED, 51); + sensorStore->setIntegerSensor( + DiagnosticIntegerSensorIndex::DISTANCE_TRAVELED_SINCE_CODES_CLEARED, 365); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::ABSOLUTE_BAROMETRIC_PRESSURE, 30); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::CONTROL_MODULE_VOLTAGE, 12); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::AMBIENT_AIR_TEMPERATURE, 18); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::MAX_FUEL_AIR_EQUIVALENCE_RATIO, 1); + sensorStore->setIntegerSensor(DiagnosticIntegerSensorIndex::FUEL_TYPE, + toInt(Obd2FuelType::GASOLINE)); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::CALCULATED_ENGINE_LOAD, 0.153); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK1, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK2, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::LONG_TERM_FUEL_TRIM_BANK2, -0.16); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::INTAKE_MANIFOLD_ABSOLUTE_PRESSURE, 7.5); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ENGINE_RPM, 1250.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::VEHICLE_SPEED, 40.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::TIMING_ADVANCE, 2.5); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::THROTTLE_POSITION, 19.75); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::OXYGEN_SENSOR1_VOLTAGE, 0.265); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::FUEL_TANK_LEVEL_INPUT, 0.824); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::EVAPORATION_SYSTEM_VAPOR_PRESSURE, + -0.373); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::CATALYST_TEMPERATURE_BANK1_SENSOR1, + 190.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::RELATIVE_THROTTLE_POSITION, 3.); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ABSOLUTE_THROTTLE_POSITION_B, 0.306); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_D, 0.188); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::ACCELERATOR_PEDAL_POSITION_E, 0.094); + sensorStore->setFloatSensor(DiagnosticFloatSensorIndex::COMMANDED_THROTTLE_ACTUATOR, 0.024); + + return sensorStore; +} + +void FakeObd2Frame::initObd2LiveFrame(const VehiclePropConfig& propConfig) { + auto sensorStore = fillDefaultObd2Frame(static_cast(propConfig.configArray[0]), + static_cast(propConfig.configArray[1])); + auto liveObd2Frame = sensorStore->getSensorProperty(""); + liveObd2Frame->prop = OBD2_LIVE_FRAME; + + mPropStore->writeValue(std::move(liveObd2Frame), /*updateStatus=*/true); +} + +void FakeObd2Frame::initObd2FreezeFrame(const VehiclePropConfig& propConfig) { + auto sensorStore = fillDefaultObd2Frame(static_cast(propConfig.configArray[0]), + static_cast(propConfig.configArray[1])); + + static std::vector sampleDtcs = {"P0070", "P0102", "P0123"}; + for (auto&& dtc : sampleDtcs) { + auto freezeFrame = sensorStore->getSensorProperty(dtc); + freezeFrame->prop = OBD2_FREEZE_FRAME; + + mPropStore->writeValue(std::move(freezeFrame), /*updateStatus=*/true); + } +} + +VhalResult FakeObd2Frame::getObd2FreezeFrame( + const VehiclePropValue& requestedPropValue) const { + if (requestedPropValue.value.int64Values.size() != 1) { + return StatusError(StatusCode::INVALID_ARG) + << "asked for OBD2_FREEZE_FRAME without valid timestamp"; + } + auto readValuesResult = mPropStore->readValuesForProperty(OBD2_FREEZE_FRAME); + if (!readValuesResult.ok()) { + return StatusError(StatusCode::INTERNAL_ERROR) + << "failed to read OBD2_FREEZE_FRAME property: " + << readValuesResult.error().message(); + } + if (readValuesResult.value().size() == 0) { + // Should no freeze frame be available at the given timestamp, a response of NOT_AVAILABLE + // must be returned by the implementation + return StatusError(StatusCode::NOT_AVAILABLE); + } + auto timestamp = requestedPropValue.value.int64Values[0]; + auto readValueResult = mPropStore->readValue(OBD2_FREEZE_FRAME, /*area=*/0, timestamp); + if (!readValueResult.ok()) { + return StatusError(StatusCode::INVALID_ARG) + << "asked for OBD2_FREEZE_FRAME at invalid timestamp"; + } + return readValueResult; +} + +VhalResult FakeObd2Frame::getObd2DtcInfo() const { + std::vector timestamps; + auto result = mPropStore->readValuesForProperty(OBD2_FREEZE_FRAME); + if (!result.ok()) { + return StatusError(StatusCode::INTERNAL_ERROR) + << "failed to read OBD2_FREEZE_FRAME property: " << result.error().message(); + } + for (const auto& freezeFrame : result.value()) { + timestamps.push_back(freezeFrame->timestamp); + } + auto outValue = + mPropStore->getValuePool()->obtain(VehiclePropertyType::INT64_VEC, timestamps.size()); + outValue->value.int64Values = timestamps; + outValue->prop = OBD2_FREEZE_FRAME_INFO; + return outValue; +} + +VhalResult FakeObd2Frame::clearObd2FreezeFrames(const VehiclePropValue& propValue) { + if (propValue.value.int64Values.size() == 0) { + mPropStore->removeValuesForProperty(OBD2_FREEZE_FRAME); + return {}; + } + for (int64_t timestamp : propValue.value.int64Values) { + auto result = mPropStore->readValue(OBD2_FREEZE_FRAME, 0, timestamp); + if (!result.ok()) { + return StatusError(StatusCode::INVALID_ARG) + << "asked for OBD2_FREEZE_FRAME at invalid timestamp, error: %s" + << result.error().message(); + } + mPropStore->removeValue(*result.value()); + } + return {}; +} + +bool FakeObd2Frame::isDiagnosticProperty(const VehiclePropConfig& propConfig) { + return (propConfig.prop == OBD2_LIVE_FRAME || propConfig.prop == OBD2_FREEZE_FRAME || + propConfig.prop == OBD2_FREEZE_FRAME_CLEAR || + propConfig.prop == OBD2_FREEZE_FRAME_INFO); +} + +} // namespace obd2frame +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/src/Obd2SensorStore.cpp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/src/Obd2SensorStore.cpp new file mode 100644 index 0000000000000000000000000000000000000000..405061499c54f59d210773c1e373fee759860b57 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/src/Obd2SensorStore.cpp @@ -0,0 +1,144 @@ +/* + * 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. + */ + +#include "Obd2SensorStore.h" + +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace obd2frame { + +using ::aidl::android::hardware::automotive::vehicle::DiagnosticFloatSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::DiagnosticIntegerSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::android::base::Error; +using ::android::base::Result; + +Obd2SensorStore::BitmaskInVector::BitmaskInVector(size_t numBits) { + mNumBits = numBits; + resize(numBits); +} + +void Obd2SensorStore::BitmaskInVector::resize(size_t numBits) { + mNumBits = numBits; + mStorage = std::vector((numBits + 7) / 8, 0); +} + +Result Obd2SensorStore::BitmaskInVector::set(size_t index, bool value) { + const size_t byteIndex = index / 8; + const size_t bitIndex = index % 8; + if (index >= mNumBits) { + return Error() << "out of bound"; + } + const uint8_t byte = mStorage[byteIndex]; + uint8_t newValue = value ? (byte | (1 << bitIndex)) : (byte & ~(1 << bitIndex)); + mStorage[byteIndex] = newValue; + return {}; +} + +Result Obd2SensorStore::BitmaskInVector::get(size_t index) const { + const size_t byteIndex = index / 8; + const size_t bitIndex = index % 8; + if (index >= mNumBits) { + return Error() << "out of bound"; + } + const uint8_t byte = mStorage[byteIndex]; + return (byte & (1 << bitIndex)) != 0; +} + +const std::vector& Obd2SensorStore::BitmaskInVector::getBitmask() const { + return mStorage; +} + +Obd2SensorStore::Obd2SensorStore(std::shared_ptr valuePool, + size_t numVendorIntegerSensors, size_t numVendorFloatSensors) + : mValuePool(valuePool) { + const size_t numSystemIntegerSensors = getLastIndex() + 1; + const size_t numSystemFloatSensors = getLastIndex() + 1; + mIntegerSensors = std::vector(numSystemIntegerSensors + numVendorIntegerSensors, 0); + mFloatSensors = std::vector(numSystemFloatSensors + numVendorFloatSensors, 0); + mSensorsBitmask.resize(mIntegerSensors.size() + mFloatSensors.size()); +} + +StatusCode Obd2SensorStore::setIntegerSensor(DiagnosticIntegerSensorIndex index, int32_t value) { + return setIntegerSensor(toInt(index), value); +} +StatusCode Obd2SensorStore::setFloatSensor(DiagnosticFloatSensorIndex index, float value) { + return setFloatSensor(toInt(index), value); +} + +StatusCode Obd2SensorStore::setIntegerSensor(size_t index, int32_t value) { + if (index >= mIntegerSensors.size()) { + ALOGE("failed to set integer sensor: OOB"); + return StatusCode::INVALID_ARG; + } + mIntegerSensors[index] = value; + if (auto result = mSensorsBitmask.set(index, true); !result.ok()) { + ALOGE("failed to set integer sensor: %s", result.error().message().c_str()); + return StatusCode::INVALID_ARG; + } + return StatusCode::OK; +} + +StatusCode Obd2SensorStore::setFloatSensor(size_t index, float value) { + if (index >= mFloatSensors.size()) { + ALOGE("failed to set integer sensor: OOB"); + return StatusCode::INVALID_ARG; + } + mFloatSensors[index] = value; + if (auto result = mSensorsBitmask.set(index + mIntegerSensors.size(), true); !result.ok()) { + ALOGE("failed to set float sensor: %s", result.error().message().c_str()); + return StatusCode::INVALID_ARG; + } + return StatusCode::OK; +} + +const std::vector& Obd2SensorStore::getIntegerSensors() const { + return mIntegerSensors; +} + +const std::vector& Obd2SensorStore::getFloatSensors() const { + return mFloatSensors; +} + +const std::vector& Obd2SensorStore::getSensorsBitmask() const { + return mSensorsBitmask.getBitmask(); +} + +VehiclePropValuePool::RecyclableType Obd2SensorStore::getSensorProperty( + const std::string& dtc) const { + auto propValue = mValuePool->obtain(VehiclePropertyType::MIXED); + propValue->timestamp = elapsedRealtimeNano(); + propValue->value.int32Values = getIntegerSensors(); + propValue->value.floatValues = getFloatSensors(); + propValue->value.byteValues = getSensorsBitmask(); + propValue->value.stringValue = dtc; + return propValue; +} + +} // namespace obd2frame +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..55b8c9399ec49ba7fb38e4a176e09ca12cff170f --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp @@ -0,0 +1,31 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "FakeObd2FrameTest", + vendor: true, + srcs: ["*.cpp"], + defaults: ["VehicleHalDefaults"], + static_libs: [ + "FakeObd2Frame", + "VehicleHalUtils", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/FakeObd2FrameTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/FakeObd2FrameTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..54ec1b2e4abb6f8b66d280d9c61d340e80d09f4c --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/FakeObd2FrameTest.cpp @@ -0,0 +1,206 @@ +/* + * 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. + */ + +#include "FakeObd2Frame.h" + +#include +#include +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace obd2frame { + +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +class FakeObd2FrameTest : public ::testing::Test { + protected: + void SetUp() override { + std::shared_ptr valuePool = std::make_shared(); + mPropertyStore = std::make_shared(valuePool); + mObd2Frame = std::make_unique(mPropertyStore); + + mPropertyStore->registerProperty(getObd2LiveFrameConfig()); + mPropertyStore->registerProperty( + getObd2FreezeFrameConfig(), + [](const VehiclePropValue& propValue) { return propValue.timestamp; }); + mPropertyStore->registerProperty(getObd2FreezeFrameInfoConfig()); + } + + VehiclePropConfig getObd2LiveFrameConfig() { + return VehiclePropConfig{.prop = OBD2_LIVE_FRAME, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {1, 1}}; + } + + VehiclePropConfig getObd2FreezeFrameConfig() { + return VehiclePropConfig{.prop = OBD2_FREEZE_FRAME, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {0, 0}}; + } + + VehiclePropConfig getObd2FreezeFrameInfoConfig() { + return VehiclePropConfig{.prop = OBD2_FREEZE_FRAME_INFO, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}; + } + + FakeObd2Frame* getFakeObd2Frame() { return mObd2Frame.get(); } + + VehiclePropertyStore* getPropertyStore() { return mPropertyStore.get(); } + + private: + std::unique_ptr mObd2Frame; + std::shared_ptr mPropertyStore; +}; + +TEST_F(FakeObd2FrameTest, testIsDiagnosticPropertyTrue) { + for (auto prop : std::vector({ + OBD2_LIVE_FRAME, + OBD2_FREEZE_FRAME, + OBD2_FREEZE_FRAME_CLEAR, + OBD2_FREEZE_FRAME_INFO, + })) { + EXPECT_TRUE(FakeObd2Frame::isDiagnosticProperty(VehiclePropConfig{ + .prop = prop, + })); + } +} + +TEST_F(FakeObd2FrameTest, testIsDiagnosticPropertyFalse) { + ASSERT_FALSE(FakeObd2Frame::isDiagnosticProperty(VehiclePropConfig{ + .prop = toInt(VehicleProperty::INFO_VIN), + })); +} + +TEST_F(FakeObd2FrameTest, testInitObd2LiveFrame) { + int64_t timestamp = elapsedRealtimeNano(); + + getFakeObd2Frame()->initObd2LiveFrame(getObd2LiveFrameConfig()); + + auto result = getPropertyStore()->readValue(OBD2_LIVE_FRAME); + + ASSERT_TRUE(result.ok()); + auto& value = result.value(); + + EXPECT_GE(value->timestamp, timestamp); + EXPECT_EQ(value->value.stringValue, ""); + EXPECT_EQ(value->value.int32Values.size(), static_cast(33)); + EXPECT_EQ(value->value.floatValues.size(), static_cast(72)); +} + +TEST_F(FakeObd2FrameTest, testInitFreezeFrame) { + getFakeObd2Frame()->initObd2FreezeFrame(getObd2FreezeFrameConfig()); + + auto result = getPropertyStore()->readValuesForProperty(OBD2_FREEZE_FRAME); + + ASSERT_TRUE(result.ok()); + ASSERT_EQ(result.value().size(), static_cast(3)); +} + +TEST_F(FakeObd2FrameTest, testGetObd2DtcInfo) { + getFakeObd2Frame()->initObd2FreezeFrame(getObd2FreezeFrameConfig()); + + auto result = getFakeObd2Frame()->getObd2DtcInfo(); + + ASSERT_TRUE(result.ok()); + EXPECT_EQ(result.value()->prop, OBD2_FREEZE_FRAME_INFO); + EXPECT_EQ(result.value()->value.int64Values.size(), static_cast(3)); +} + +TEST_F(FakeObd2FrameTest, testGetObd2FreezeFrame) { + getFakeObd2Frame()->initObd2FreezeFrame(getObd2FreezeFrameConfig()); + + auto result = getFakeObd2Frame()->getObd2DtcInfo(); + + ASSERT_TRUE(result.ok()); + ASSERT_EQ(result.value()->prop, OBD2_FREEZE_FRAME_INFO); + ASSERT_EQ(result.value()->value.int64Values.size(), static_cast(3)); + + std::set dtcs; + + for (int64_t timestamp : result.value()->value.int64Values) { + auto freezeFrameResult = getFakeObd2Frame()->getObd2FreezeFrame(VehiclePropValue{ + .value.int64Values = {timestamp}, + }); + + ASSERT_TRUE(freezeFrameResult.ok()); + + dtcs.insert(freezeFrameResult.value()->value.stringValue); + } + + ASSERT_EQ(dtcs, std::set({"P0070", "P0102", "P0123"})); +} + +TEST_F(FakeObd2FrameTest, testClearObd2FreezeFrameAll) { + getFakeObd2Frame()->initObd2FreezeFrame(getObd2FreezeFrameConfig()); + + auto result = getFakeObd2Frame()->getObd2DtcInfo(); + + ASSERT_TRUE(result.ok()); + ASSERT_EQ(result.value()->prop, OBD2_FREEZE_FRAME_INFO); + ASSERT_EQ(result.value()->value.int64Values.size(), static_cast(3)); + + ASSERT_TRUE(getFakeObd2Frame()->clearObd2FreezeFrames(VehiclePropValue{}).ok()); + + result = getFakeObd2Frame()->getObd2DtcInfo(); + + ASSERT_TRUE(result.ok()); + EXPECT_EQ(result.value()->prop, OBD2_FREEZE_FRAME_INFO); + EXPECT_EQ(result.value()->value.int64Values.size(), static_cast(0)); +} + +TEST_F(FakeObd2FrameTest, testClearObd2FreezeFrameByTimestamp) { + getFakeObd2Frame()->initObd2FreezeFrame(getObd2FreezeFrameConfig()); + + auto result = getFakeObd2Frame()->getObd2DtcInfo(); + + ASSERT_TRUE(result.ok()); + ASSERT_EQ(result.value()->prop, OBD2_FREEZE_FRAME_INFO); + ASSERT_EQ(result.value()->value.int64Values.size(), static_cast(3)); + + ASSERT_TRUE(getFakeObd2Frame() + ->clearObd2FreezeFrames(VehiclePropValue{ + .value.int64Values = {result.value()->value.int64Values[0], + result.value()->value.int64Values[1]}}) + .ok()); + + result = getFakeObd2Frame()->getObd2DtcInfo(); + + ASSERT_TRUE(result.ok()); + EXPECT_EQ(result.value()->prop, OBD2_FREEZE_FRAME_INFO); + EXPECT_EQ(result.value()->value.int64Values.size(), static_cast(1)); +} + +} // namespace obd2frame +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Obd2SensorStoreTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Obd2SensorStoreTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23ea51d7bc5c90af6d2be18af4d94ad599d22a97 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Obd2SensorStoreTest.cpp @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#include "Obd2SensorStore.h" + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace obd2frame { + +using ::aidl::android::hardware::automotive::vehicle::DiagnosticFloatSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::DiagnosticIntegerSensorIndex; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; + +TEST(Obd2SensorStoreTest, testObd2SensorStore) { + int64_t timestamp = elapsedRealtimeNano(); + std::shared_ptr valuePool = std::make_shared(); + Obd2SensorStore sensorStore(valuePool, 1, 1); + + DiagnosticIntegerSensorIndex systemIntSensorIndex = + DiagnosticIntegerSensorIndex::IGNITION_MONITORS_SUPPORTED; + size_t vendorIntSensorIndex = Obd2SensorStore::getLastIndex() + 1; + DiagnosticFloatSensorIndex systemFloatSensorIndex = + DiagnosticFloatSensorIndex::SHORT_TERM_FUEL_TRIM_BANK1; + size_t vendorFloatSensorIndex = Obd2SensorStore::getLastIndex() + 1; + // Four 1s in all the bits. + std::vector bitMask = {0x4, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1}; + + ASSERT_EQ(sensorStore.setIntegerSensor(systemIntSensorIndex, 1), StatusCode::OK); + ASSERT_EQ(sensorStore.setIntegerSensor(vendorIntSensorIndex, 2), StatusCode::OK); + ASSERT_EQ(sensorStore.setFloatSensor(systemFloatSensorIndex, 3.0), StatusCode::OK); + ASSERT_EQ(sensorStore.setFloatSensor(vendorFloatSensorIndex, 4.0), StatusCode::OK); + + std::string dtc = "dtc"; + auto propValue = sensorStore.getSensorProperty(dtc); + + ASSERT_GE(propValue->timestamp, timestamp); + ASSERT_EQ(propValue->value.int32Values[toInt(systemIntSensorIndex)], 1); + ASSERT_EQ(propValue->value.int32Values[vendorIntSensorIndex], 2); + ASSERT_EQ(propValue->value.floatValues[toInt(systemFloatSensorIndex)], 3.0); + ASSERT_EQ(propValue->value.floatValues[vendorFloatSensorIndex], 4.0); + ASSERT_EQ(propValue->value.byteValues, bitMask); + ASSERT_EQ(propValue->value.stringValue, dtc); +} + +TEST(Obd2SensorStoreTest, testIndexOOB) { + std::shared_ptr valuePool = std::make_shared(); + Obd2SensorStore sensorStore(valuePool, 1, 1); + + EXPECT_EQ(sensorStore.setIntegerSensor( + Obd2SensorStore::getLastIndex() + 2, 1), + StatusCode::INVALID_ARG); + EXPECT_EQ(sensorStore.setIntegerSensor(static_cast(-1), 1), StatusCode::INVALID_ARG); + EXPECT_EQ(sensorStore.setFloatSensor( + Obd2SensorStore::getLastIndex() + 2, 1.0), + StatusCode::INVALID_ARG); + EXPECT_EQ(sensorStore.setFloatSensor(static_cast(-1), 1.0), StatusCode::INVALID_ARG); +} + +} // namespace obd2frame +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..2e955315cdcd178ce1a2c82f0ec0d71509a984e1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/Android.bp @@ -0,0 +1,32 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library { + name: "FakeUserHal", + vendor: true, + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], + static_libs: [ + "VehicleHalUtils", + ], + export_static_lib_headers: ["VehicleHalUtils"], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h new file mode 100644 index 0000000000000000000000000000000000000000..4ae9c8c1cb243c0d364ef0363cb503d9b3e853b6 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h @@ -0,0 +1,134 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_FakeUserHal_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_FakeUserHal_H_ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +constexpr char kUserHalDumpOption[] = "--user-hal"; + +// Class used to emulate a real User HAL behavior through lshal debug requests. +class FakeUserHal final { + public: + using ValueResultType = VhalResult; + + explicit FakeUserHal(std::shared_ptr valuePool) : mValuePool(valuePool) {} + + ~FakeUserHal() = default; + + // Checks if the emulator can handle the property. + static bool isSupported(int32_t prop); + + // Lets the emulator set the property. + // + // @return updated property and StatusCode + ValueResultType onSetProperty( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + + // Gets the property value from the emulator. + // + // @return property value and StatusCode + ValueResultType onGetProperty( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + + // Shows the User HAL emulation help. + std::string showDumpHelp() const; + + // Dump its contents. + std::string dump(std::string indent) const; + + private: + const std::shared_ptr mValuePool; + mutable std::mutex mLock; + VehiclePropValuePool::RecyclableType mInitialUserResponseFromCmd GUARDED_BY(mLock); + VehiclePropValuePool::RecyclableType mSwitchUserResponseFromCmd GUARDED_BY(mLock); + VehiclePropValuePool::RecyclableType mCreateUserResponseFromCmd GUARDED_BY(mLock); + VehiclePropValuePool::RecyclableType mSetUserIdentificationAssociationResponseFromCmd + GUARDED_BY(mLock); + + // INITIAL_USER_INFO is called by Android when it starts, and it's expecting a property change + // indicating what the initial user should be. + // + // During normal circumstances, the emulator will reply right away, passing a response if + // InitialUserInfoResponseAction::DEFAULT (so Android could use its own logic to decide which + // user to boot). + // + // But during development / testing, the behavior can be changed using lshal dump, which must + // use the areaId to indicate what should happen next. + // + // So, the behavior of set(INITIAL_USER_INFO) is: + // + // - if it has an areaId, store the property into mInitialUserResponseFromCmd (as it was called + // by lshal). + // - else if mInitialUserResponseFromCmd is not set, return a response with the same request id + // and InitialUserInfoResponseAction::DEFAULT + // - else the behavior is defined by the areaId on mInitialUserResponseFromCmd: + // - if it's 1, reply with mInitialUserResponseFromCmd and the right request id + // - if it's 2, reply with mInitialUserResponseFromCmd but a wrong request id (so Android can + // test this error scenario) + // - if it's 3, then don't send a property change (so Android can emulate a timeout) + ValueResultType onSetInitialUserInfoResponse( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + + // Used to emulate SWITCH_USER - see onSetInitialUserInfoResponse() for usage. + ValueResultType onSetSwitchUserResponse( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + + // Used to emulate CREATE_USER - see onSetInitialUserInfoResponse() for usage. + ValueResultType onSetCreateUserResponse( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + + // Used to emulate set USER_IDENTIFICATION_ASSOCIATION - see onSetInitialUserInfoResponse() for + // usage. + ValueResultType onSetUserIdentificationAssociation( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + + // Used to emulate get USER_IDENTIFICATION_ASSOCIATION - see onSetInitialUserInfoResponse() for + // usage. + ValueResultType onGetUserIdentificationAssociation( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + + // Creates a default USER_IDENTIFICATION_ASSOCIATION when it was not set by lshal. + static ValueResultType defaultUserIdentificationAssociation( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request); + + ValueResultType sendUserHalResponse(VehiclePropValuePool::RecyclableType response, + int32_t requestId); +}; + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_FakeUserHal_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalHelper.h b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..104876c4309ac873ad6e205bc440fa37cfa53d52 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalHelper.h @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_UserHalHelper_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_UserHalHelper_H_ + +#include +#include +#include +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace user_hal_helper { + +// Verify whether the |value| can be casted to the type |T| and return the casted value on success. +// Otherwise, return the error. +template +android::base::Result verifyAndCast(int32_t value); + +// Below functions parse VehiclePropValues to the respective User HAL request structs. On success, +// these functions return the User HAL struct. Otherwise, they return the error. +android::base::Result +toInitialUserInfoRequest( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); +android::base::Result +toSwitchUserRequest( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); +android::base::Result +toCreateUserRequest( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); +android::base::Result +toRemoveUserRequest( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); +android::base::Result +toUserIdentificationGetRequest( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); +android::base::Result +toUserIdentificationSetRequest( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); + +// Below functions convert the User HAL structs to VehiclePropValues. On success, these functions +// return the pointer to VehiclePropValue. Otherwise, they return the error. +android::base::Result toVehiclePropValue( + VehiclePropValuePool& pool, + const aidl::android::hardware::automotive::vehicle::SwitchUserRequest& request); +VehiclePropValuePool::RecyclableType toVehiclePropValue( + VehiclePropValuePool& pool, + const aidl::android::hardware::automotive::vehicle::InitialUserInfoResponse& response); +VehiclePropValuePool::RecyclableType toVehiclePropValue( + VehiclePropValuePool& pool, + const aidl::android::hardware::automotive::vehicle::SwitchUserResponse& response); +VehiclePropValuePool::RecyclableType toVehiclePropValue( + VehiclePropValuePool& pool, + const aidl::android::hardware::automotive::vehicle::CreateUserResponse& response); +VehiclePropValuePool::RecyclableType toVehiclePropValue( + VehiclePropValuePool& pool, + const aidl::android::hardware::automotive::vehicle::UserIdentificationResponse& response); + +} // namespace user_hal_helper +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_UserHalHelper_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalTypes.h b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..b5e17b31718120293a359e1538dbc12f057fd73e --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/UserHalTypes.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_UserHalTypes_H_ +#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_UserHalTypes_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // android_hardware_automotive_vehicle_aidl_impl_fake_impl_userhal_include_UserHalTypes_H_ diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7748fb6618c3b092c9f3df91462e28015553d814 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp @@ -0,0 +1,374 @@ +/* + * 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. + */ +#define LOG_TAG "FakeUserHal" + +#include "FakeUserHal.h" + +#include "UserHalHelper.h" + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::CreateUserResponse; +using ::aidl::android::hardware::automotive::vehicle::CreateUserStatus; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoResponse; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoResponseAction; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserMessageType; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserResponse; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserStatus; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::Error; +using ::android::base::Result; + +constexpr int32_t INITIAL_USER_INFO = toInt(VehicleProperty::INITIAL_USER_INFO); +constexpr int32_t SWITCH_USER = toInt(VehicleProperty::SWITCH_USER); +constexpr int32_t CREATE_USER = toInt(VehicleProperty::CREATE_USER); +constexpr int32_t REMOVE_USER = toInt(VehicleProperty::REMOVE_USER); +constexpr int32_t USER_IDENTIFICATION_ASSOCIATION = + toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION); + +VhalResult getRequestId(const VehiclePropValue& value) { + if (value.value.int32Values.size() < 1) { + return StatusError(StatusCode::INVALID_ARG) + << "no int32Values on property: " << value.toString(); + } + return value.value.int32Values[0]; +} + +VhalResult getSwitchUserMessageType(const VehiclePropValue& value) { + if (value.value.int32Values.size() < 2) { + return StatusError(StatusCode::INVALID_ARG) + << "missing switch user message type on property: " << value.toString(); + } + auto result = user_hal_helper::verifyAndCast(value.value.int32Values[1]); + if (!result.ok()) { + return StatusError(StatusCode::INVALID_ARG) << result.error().message(); + } + return result.value(); +} + +} // namespace + +bool FakeUserHal::isSupported(int32_t prop) { + switch (prop) { + case INITIAL_USER_INFO: + case SWITCH_USER: + case CREATE_USER: + case REMOVE_USER: + case USER_IDENTIFICATION_ASSOCIATION: + return true; + default: + return false; + } +} + +FakeUserHal::ValueResultType FakeUserHal::onSetProperty(const VehiclePropValue& value) { + ALOGV("onSetProperty(): %s", value.toString().c_str()); + + switch (value.prop) { + case INITIAL_USER_INFO: + return onSetInitialUserInfoResponse(value); + case SWITCH_USER: + return onSetSwitchUserResponse(value); + case CREATE_USER: + return onSetCreateUserResponse(value); + case REMOVE_USER: + ALOGI("REMOVE_USER is FYI only, nothing to do..."); + return nullptr; + case USER_IDENTIFICATION_ASSOCIATION: + return onSetUserIdentificationAssociation(value); + default: + return StatusError(StatusCode::INVALID_ARG) + << "Unsupported property: " << value.toString(); + } +} + +FakeUserHal::ValueResultType FakeUserHal::onGetProperty(const VehiclePropValue& value) const { + ALOGV("onGetProperty(%s)", value.toString().c_str()); + switch (value.prop) { + case INITIAL_USER_INFO: + case SWITCH_USER: + case CREATE_USER: + case REMOVE_USER: + ALOGE("onGetProperty(): %d is only supported on SET", value.prop); + return StatusError(StatusCode::INVALID_ARG) << "only supported on SET"; + case USER_IDENTIFICATION_ASSOCIATION: + return onGetUserIdentificationAssociation(value); + default: + ALOGE("onGetProperty(): %d is not supported", value.prop); + return StatusError(StatusCode::INVALID_ARG) << "not supported by User HAL"; + } +} + +FakeUserHal::ValueResultType FakeUserHal::onGetUserIdentificationAssociation( + const VehiclePropValue& value) const { + std::scoped_lock lockGuard(mLock); + + if (mSetUserIdentificationAssociationResponseFromCmd == nullptr) { + return defaultUserIdentificationAssociation(value); + } + ALOGI("get(USER_IDENTIFICATION_ASSOCIATION): returning %s", + mSetUserIdentificationAssociationResponseFromCmd->toString().c_str()); + auto newValue = mValuePool->obtain(*mSetUserIdentificationAssociationResponseFromCmd); + auto requestId = getRequestId(value); + if (requestId.ok()) { + // Must use the same requestId + newValue->value.int32Values[0] = *requestId; + } else { + ALOGE("get(USER_IDENTIFICATION_ASSOCIATION): no requestId on %s", value.toString().c_str()); + return requestId.error(); + } + return newValue; +} + +FakeUserHal::ValueResultType FakeUserHal::onSetInitialUserInfoResponse( + const VehiclePropValue& value) { + std::scoped_lock lockGuard(mLock); + + auto requestId = getRequestId(value); + if (!requestId.ok()) { + ALOGE("Failed to get requestId on set(INITIAL_USER_INFO): %s", + requestId.error().message().c_str()); + return requestId.error(); + } + + if (value.areaId != 0) { + ALOGD("set(INITIAL_USER_INFO) called from lshal; storing it: %s", value.toString().c_str()); + mInitialUserResponseFromCmd = mValuePool->obtain(value); + return nullptr; + } + + ALOGD("set(INITIAL_USER_INFO) called from Android: %s", value.toString().c_str()); + if (mInitialUserResponseFromCmd != nullptr) { + ALOGI("replying INITIAL_USER_INFO with lshal value: %s", + mInitialUserResponseFromCmd->toString().c_str()); + return sendUserHalResponse(std::move(mInitialUserResponseFromCmd), *requestId); + } + + // Returns default response + auto updatedValue = user_hal_helper::toVehiclePropValue( + *mValuePool, InitialUserInfoResponse{ + .requestId = *requestId, + .action = InitialUserInfoResponseAction::DEFAULT, + }); + ALOGI("no lshal response; replying with InitialUserInfoResponseAction::DEFAULT: %s", + updatedValue->toString().c_str()); + return updatedValue; +} + +FakeUserHal::ValueResultType FakeUserHal::onSetSwitchUserResponse(const VehiclePropValue& value) { + std::scoped_lock lockGuard(mLock); + + auto requestId = getRequestId(value); + if (!requestId.ok()) { + ALOGE("Failed to get requestId on set(SWITCH_USER): %s", + requestId.error().message().c_str()); + return requestId.error(); + } + + auto messageType = getSwitchUserMessageType(value); + if (!messageType.ok()) { + ALOGE("Failed to get messageType on set(SWITCH_USER): %s", + messageType.error().message().c_str()); + return messageType.error(); + } + + if (value.areaId != 0) { + if (*messageType == SwitchUserMessageType::VEHICLE_REQUEST) { + // User HAL can also request a user switch, so we need to check it first + ALOGD("set(SWITCH_USER) called from lshal to emulate a vehicle request: %s", + value.toString().c_str()); + return mValuePool->obtain(value); + } + // Otherwise, we store it + ALOGD("set(SWITCH_USER) called from lshal; storing it: %s", value.toString().c_str()); + mSwitchUserResponseFromCmd = mValuePool->obtain(value); + return nullptr; + } + ALOGD("set(SWITCH_USER) called from Android: %s", value.toString().c_str()); + + if (mSwitchUserResponseFromCmd != nullptr) { + ALOGI("replying SWITCH_USER with lshal value: %s", + mSwitchUserResponseFromCmd->toString().c_str()); + return sendUserHalResponse(std::move(mSwitchUserResponseFromCmd), *requestId); + } + + if (*messageType == SwitchUserMessageType::LEGACY_ANDROID_SWITCH || + *messageType == SwitchUserMessageType::ANDROID_POST_SWITCH) { + ALOGI("request is %s; ignoring it", toString(*messageType).c_str()); + return nullptr; + } + + // Returns default response + auto updatedValue = user_hal_helper::toVehiclePropValue( + *mValuePool, SwitchUserResponse{ + .requestId = *requestId, + .messageType = SwitchUserMessageType::VEHICLE_RESPONSE, + .status = SwitchUserStatus::SUCCESS, + }); + ALOGI("no lshal response; replying with VEHICLE_RESPONSE / SUCCESS: %s", + updatedValue->toString().c_str()); + return updatedValue; +} + +FakeUserHal::ValueResultType FakeUserHal::onSetCreateUserResponse(const VehiclePropValue& value) { + std::scoped_lock lockGuard(mLock); + + auto requestId = getRequestId(value); + if (!requestId.ok()) { + ALOGE("Failed to get requestId on set(CREATE_USER): %s", + requestId.error().message().c_str()); + return requestId.error(); + } + + if (value.areaId != 0) { + ALOGD("set(CREATE_USER) called from lshal; storing it: %s", value.toString().c_str()); + mCreateUserResponseFromCmd = mValuePool->obtain(value); + return nullptr; + } + ALOGD("set(CREATE_USER) called from Android: %s", value.toString().c_str()); + + if (mCreateUserResponseFromCmd != nullptr) { + ALOGI("replying CREATE_USER with lshal value: %s", + mCreateUserResponseFromCmd->toString().c_str()); + return sendUserHalResponse(std::move(mCreateUserResponseFromCmd), *requestId); + } + + // Returns default response + auto updatedValue = user_hal_helper::toVehiclePropValue( + *mValuePool, CreateUserResponse{ + .requestId = *requestId, + .status = CreateUserStatus::SUCCESS, + }); + ALOGI("no lshal response; replying with SUCCESS: %s", updatedValue->toString().c_str()); + return updatedValue; +} + +FakeUserHal::ValueResultType FakeUserHal::onSetUserIdentificationAssociation( + const VehiclePropValue& value) { + std::scoped_lock lockGuard(mLock); + + auto requestId = getRequestId(value); + if (!requestId.ok()) { + ALOGE("Failed to get requestId on set(USER_IDENTIFICATION_ASSOCIATION): %s", + requestId.error().message().c_str()); + return requestId.error(); + } + + if (value.areaId != 0) { + ALOGD("set(USER_IDENTIFICATION_ASSOCIATION) called from lshal; storing it: %s", + value.toString().c_str()); + mSetUserIdentificationAssociationResponseFromCmd = mValuePool->obtain(value); + return nullptr; + } + ALOGD("set(USER_IDENTIFICATION_ASSOCIATION) called from Android: %s", value.toString().c_str()); + + if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) { + ALOGI("replying USER_IDENTIFICATION_ASSOCIATION with lshal value: %s", + mSetUserIdentificationAssociationResponseFromCmd->toString().c_str()); + // Not moving response so it can be used on GET requests + auto copy = mValuePool->obtain(*mSetUserIdentificationAssociationResponseFromCmd); + return sendUserHalResponse(std::move(copy), *requestId); + } + // Returns default response + return defaultUserIdentificationAssociation(value); +} + +FakeUserHal::ValueResultType FakeUserHal::defaultUserIdentificationAssociation( + const VehiclePropValue& request) { + // TODO(b/159498909): return a response with NOT_ASSOCIATED_ANY_USER for all requested types + ALOGE("no lshal response for %s; replying with NOT_AVAILABLE", request.toString().c_str()); + return StatusError(StatusCode::NOT_AVAILABLE) << "not set by lshal"; +} + +FakeUserHal::ValueResultType FakeUserHal::sendUserHalResponse( + VehiclePropValuePool::RecyclableType response, int32_t requestId) { + switch (response->areaId) { + case 1: + ALOGD("returning response with right request id"); + response->value.int32Values[0] = requestId; + break; + case 2: + ALOGD("returning response with wrong request id"); + response->value.int32Values[0] = -requestId; + break; + case 3: + ALOGD("not generating a property change event because of lshal prop: %s", + response->toString().c_str()); + return StatusError(StatusCode::NOT_AVAILABLE) + << "not generating a property change event because of lshal prop: " + << response->toString(); + default: + ALOGE("invalid action on lshal response: %s", response->toString().c_str()); + return StatusError(StatusCode::INTERNAL_ERROR) + << "invalid action on lshal response: " << response->toString(); + } + + ALOGD("updating property to: %s", response->toString().c_str()); + return response; +} + +std::string FakeUserHal::showDumpHelp() const { + return fmt::format("{}: dumps state used for user management\n", kUserHalDumpOption); +} + +std::string FakeUserHal::dump(std::string indent) const { + std::scoped_lock lockGuard(mLock); + + std::string info; + if (mInitialUserResponseFromCmd != nullptr) { + info += fmt::format("{}InitialUserInfo response: {}\n", indent, + mInitialUserResponseFromCmd->toString()); + } else { + info += fmt::format("{}No InitialUserInfo response\n", indent); + } + if (mSwitchUserResponseFromCmd != nullptr) { + info += fmt::format("{}SwitchUser response: {}\n", indent, + mSwitchUserResponseFromCmd->toString()); + } else { + info += fmt::format("{}No SwitchUser response\n", indent); + } + if (mCreateUserResponseFromCmd != nullptr) { + info += fmt::format("{}CreateUser response: {}\n", indent, + mCreateUserResponseFromCmd->toString()); + } else { + info += fmt::format("{}No CreateUser response\n", indent); + } + if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) { + info += fmt::format("{}SetUserIdentificationAssociation response: {}\n", indent, + mSetUserIdentificationAssociationResponseFromCmd->toString()); + } else { + info += fmt::format("{}No SetUserIdentificationAssociation response\n", indent); + } + return info; +} + +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/src/UserHalHelper.cpp b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/UserHalHelper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4fd93ae24b2d81b97eb04d7362d67ac468f911f4 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/UserHalHelper.cpp @@ -0,0 +1,403 @@ +/* + * 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_TAG "UserHalHelper" + +#include "UserHalHelper.h" + +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace user_hal_helper { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::CreateUserRequest; +using ::aidl::android::hardware::automotive::vehicle::CreateUserResponse; +using ::aidl::android::hardware::automotive::vehicle::CreateUserStatus; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoRequest; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoRequestType; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoResponse; +using ::aidl::android::hardware::automotive::vehicle::RemoveUserRequest; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserMessageType; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserRequest; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserResponse; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserStatus; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationAssociationSetValue; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationAssociationType; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationGetRequest; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationResponse; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationSetAssociation; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationSetRequest; +using ::aidl::android::hardware::automotive::vehicle::UserInfo; +using ::aidl::android::hardware::automotive::vehicle::UsersInfo; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::Error; +using ::android::base::Result; + +constexpr const char kSeparator[] = "||"; +constexpr size_t kNumFieldsPerUserInfo = 2; +constexpr size_t kNumFieldsPerSetAssociation = 2; + +Result verifyPropValue(const VehiclePropValue& propValue, VehicleProperty vehicleProperty, + size_t minInt32Values) { + auto prop = verifyAndCast(propValue.prop); + if (!prop.ok()) { + return Error() << "Invalid vehicle property: " << prop.error(); + } + if (*prop != vehicleProperty) { + return Error() << "Mismatching " << toString(vehicleProperty) << " request, received " + << toString(*prop) << " property"; + } + if (propValue.value.int32Values.size() < minInt32Values) { + return Error() << "Int32Values must have at least " << minInt32Values + << " values, received " << propValue.value.int32Values.size(); + } + return {}; +} + +Result parseUserInfo(const std::vector& int32Values, size_t startPos, + UserInfo* userInfo) { + if (int32Values.size() < startPos + kNumFieldsPerUserInfo) { + return Error() << "Int32Values must have at least " << startPos + 2 << " values, received " + << int32Values.size(); + } + userInfo->userId = int32Values[startPos]; + int32_t intUserFlags = int32Values[startPos + 1]; + const int32_t combinedFlags = UserInfo::USER_FLAG_SYSTEM | UserInfo::USER_FLAG_GUEST | + UserInfo::USER_FLAG_EPHEMERAL | UserInfo::USER_FLAG_ADMIN | + UserInfo::USER_FLAG_DISABLED | UserInfo::USER_FLAG_PROFILE; + + if ((intUserFlags & ~combinedFlags) != 0) { + return Error() << "Invalid user flags: " << intUserFlags << ", must be '|' of UserFlags"; + } + userInfo->flags = intUserFlags; + return {}; +} + +Result parseUsersInfo(const std::vector& int32Values, size_t startPos, + UsersInfo* usersInfo) { + if (int32Values.size() < startPos + 3) { + return Error() << "Int32Values must have at least " << startPos + 3 << " values, received " + << int32Values.size(); + } + auto ret = parseUserInfo(int32Values, startPos, &usersInfo->currentUser); + if (!ret.ok()) { + return ret; + } + usersInfo->numberUsers = int32Values[startPos + 2]; + usersInfo->existingUsers.resize(usersInfo->numberUsers); + for (size_t i = 0; i < static_cast(usersInfo->numberUsers); ++i) { + ret = parseUserInfo(int32Values, startPos + 3 + (kNumFieldsPerUserInfo * i), + &usersInfo->existingUsers[i]); + if (!ret.ok()) { + return Error() << "Failed to parse existing user '" << i << "' info: " << ret.error(); + } + } + return {}; +} + +Result parseUserAssociationTypes( + const std::vector& int32Values, size_t startPos, size_t numberAssociationTypes, + std::vector* associationTypes) { + size_t minInt32Values = startPos + numberAssociationTypes; + if (int32Values.size() < minInt32Values) { + return Error() << "Int32Values must have at least " << minInt32Values + << " values, received " << int32Values.size(); + } + associationTypes->resize(numberAssociationTypes); + for (size_t i = 0; i < static_cast(numberAssociationTypes); ++i) { + size_t pos = startPos + i; + auto type = verifyAndCast(int32Values[pos]); + if (!type.ok()) { + return Error() << "Invalid association type in query '" << i << "': " << type.error(); + } + (*associationTypes)[i] = *type; + } + return {}; +} + +Result parseUserAssociations(const std::vector& int32Values, size_t startPos, + size_t numberAssociations, + std::vector* associations) { + size_t minInt32Values = startPos + (numberAssociations * kNumFieldsPerSetAssociation); + if (int32Values.size() < minInt32Values) { + return Error() << "Int32Values must have at least " << minInt32Values + << " values, received " << int32Values.size(); + } + associations->resize(numberAssociations); + for (size_t i = 0; i < static_cast(numberAssociations); ++i) { + size_t pos = startPos + (kNumFieldsPerSetAssociation * i); + auto type = verifyAndCast(int32Values[pos]); + if (!type.ok()) { + return Error() << "Invalid association type in request '" << i << "': " << type.error(); + } + (*associations)[i].type = *type; + auto value = verifyAndCast(int32Values[pos + 1]); + if (!value.ok()) { + return Error() << "Invalid association set value in request '" << i + << "': " << value.error(); + } + (*associations)[i].value = *value; + } + return {}; +} + +} // namespace + +template +Result verifyAndCast(int32_t value) { + T castValue = static_cast(value); + for (const auto& v : ::ndk::enum_range()) { + if (castValue == v) { + return castValue; + } + } + + return Error() << "Value " << value << " not in enum values"; +} + +Result toInitialUserInfoRequest(const VehiclePropValue& propValue) { + auto ret = verifyPropValue(propValue, VehicleProperty::INITIAL_USER_INFO, /*minInt32Values=*/2); + if (!ret.ok()) { + return ret.error(); + } + InitialUserInfoRequest request; + request.requestId = propValue.value.int32Values[0]; + auto requestType = verifyAndCast(propValue.value.int32Values[1]); + if (!requestType.ok()) { + return Error() << "Invalid InitialUserInfoRequestType: " << requestType.error(); + } + request.requestType = *requestType; + ret = parseUsersInfo(propValue.value.int32Values, 2, &request.usersInfo); + if (!ret.ok()) { + return Error() << "Failed to parse users info: " << ret.error(); + } + return request; +} + +Result toSwitchUserRequest(const VehiclePropValue& propValue) { + auto ret = verifyPropValue(propValue, VehicleProperty::SWITCH_USER, /*minInt32Values=*/2); + if (!ret.ok()) { + return ret.error(); + } + SwitchUserRequest request; + auto messageType = verifyAndCast(propValue.value.int32Values[1]); + if (!messageType.ok()) { + return Error() << "Invalid SwitchUserMessageType: " << messageType.error(); + } + if (*messageType != SwitchUserMessageType::LEGACY_ANDROID_SWITCH && + *messageType != SwitchUserMessageType::ANDROID_SWITCH && + *messageType != SwitchUserMessageType::ANDROID_POST_SWITCH) { + return Error() << "Invalid " << toString(*messageType) + << " message type from Android System"; + } + request.requestId = propValue.value.int32Values[0]; + request.messageType = *messageType; + ret = parseUserInfo(propValue.value.int32Values, /*startPos=*/2, &request.targetUser); + if (!ret.ok()) { + return Error() << "Failed to parse target user info: " << ret.error(); + } + ret = parseUsersInfo(propValue.value.int32Values, /*startPos=*/4, &request.usersInfo); + if (!ret.ok()) { + return Error() << "Failed to parse users info: " << ret.error(); + } + return request; +} + +Result toCreateUserRequest(const VehiclePropValue& propValue) { + auto ret = verifyPropValue(propValue, VehicleProperty::CREATE_USER, /*minInt32Values=*/1); + if (!ret.ok()) { + return ret.error(); + } + CreateUserRequest request; + request.requestId = propValue.value.int32Values[0]; + ret = parseUserInfo(propValue.value.int32Values, /*startPos=*/1, &request.newUserInfo); + if (!ret.ok()) { + return Error() << "Failed to parse new user info: " << ret.error(); + } + request.newUserName = propValue.value.stringValue; + ret = parseUsersInfo(propValue.value.int32Values, /*startPos=*/3, &request.usersInfo); + if (!ret.ok()) { + return Error() << "Failed to parse users info: " << ret.error(); + } + return request; +} + +Result toRemoveUserRequest(const VehiclePropValue& propValue) { + auto ret = verifyPropValue(propValue, VehicleProperty::REMOVE_USER, /*minInt32Values=*/1); + if (!ret.ok()) { + return ret.error(); + } + RemoveUserRequest request; + request.requestId = propValue.value.int32Values[0]; + ret = parseUserInfo(propValue.value.int32Values, /*startPos=*/1, &request.removedUserInfo); + if (!ret.ok()) { + return Error() << "Failed to parse removed user info: " << ret.error(); + } + ret = parseUsersInfo(propValue.value.int32Values, /*startPos=*/3, &request.usersInfo); + if (!ret.ok()) { + return Error() << "Failed to parse users info: " << ret.error(); + } + return request; +} + +Result toUserIdentificationGetRequest( + const VehiclePropValue& propValue) { + auto ret = verifyPropValue(propValue, VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, + /*minInt32Values=*/4); + if (!ret.ok()) { + return ret.error(); + } + UserIdentificationGetRequest request; + request.requestId = propValue.value.int32Values[0]; + ret = parseUserInfo(propValue.value.int32Values, /*startPos=*/1, &request.userInfo); + if (!ret.ok()) { + return Error() << "Failed to parse user info: " << ret.error(); + } + request.numberAssociationTypes = propValue.value.int32Values[3]; + ret = parseUserAssociationTypes(propValue.value.int32Values, 4, request.numberAssociationTypes, + &request.associationTypes); + if (!ret.ok()) { + return Error() << "Failed to parse UserIdentificationAssociationType: " << ret.error(); + } + return request; +} + +Result toUserIdentificationSetRequest( + const VehiclePropValue& propValue) { + auto ret = verifyPropValue(propValue, VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, + /*minInt32Values=*/4); + if (!ret.ok()) { + return ret.error(); + } + UserIdentificationSetRequest request; + request.requestId = propValue.value.int32Values[0]; + ret = parseUserInfo(propValue.value.int32Values, /*startPos=*/1, &request.userInfo); + if (!ret.ok()) { + return Error() << "Failed to parse user info: " << ret.error(); + } + request.numberAssociations = propValue.value.int32Values[3]; + ret = parseUserAssociations(propValue.value.int32Values, 4, request.numberAssociations, + &request.associations); + if (!ret.ok()) { + return Error() << "Failed to parse UserIdentificationSetAssociation: " << ret.error(); + } + return request; +} + +Result toVehiclePropValue(VehiclePropValuePool& pool, + const SwitchUserRequest& request) { + if (request.messageType != SwitchUserMessageType::VEHICLE_REQUEST) { + return Errorf("Invalid %s message type %s from HAL", + toString(VehicleProperty::SWITCH_USER).c_str(), + toString(request.messageType).c_str()); + } + int32_t switchUserProp = toInt(VehicleProperty::SWITCH_USER); + auto propValue = pool.obtain(getPropType(switchUserProp)); + propValue->prop = switchUserProp; + propValue->timestamp = elapsedRealtimeNano(); + propValue->value.int32Values.resize(3); + propValue->value.int32Values[0] = static_cast(request.requestId); + propValue->value.int32Values[1] = static_cast(request.messageType); + propValue->value.int32Values[2] = static_cast(request.targetUser.userId); + return propValue; +} + +VehiclePropValuePool::RecyclableType toVehiclePropValue(VehiclePropValuePool& pool, + const InitialUserInfoResponse& response) { + int32_t initialUserInfoProp = toInt(VehicleProperty::INITIAL_USER_INFO); + auto propValue = pool.obtain(getPropType(initialUserInfoProp)); + propValue->prop = initialUserInfoProp; + propValue->timestamp = elapsedRealtimeNano(); + propValue->value.int32Values.resize(4); + propValue->value.int32Values[0] = static_cast(response.requestId); + propValue->value.int32Values[1] = static_cast(response.action); + propValue->value.int32Values[2] = static_cast(response.userToSwitchOrCreate.userId); + propValue->value.int32Values[3] = response.userToSwitchOrCreate.flags; + propValue->value.stringValue = std::string(response.userLocales) + std::string(kSeparator) + + std::string(response.userNameToCreate); + return propValue; +} + +VehiclePropValuePool::RecyclableType toVehiclePropValue(VehiclePropValuePool& pool, + const SwitchUserResponse& response) { + int32_t switchUserProp = toInt(VehicleProperty::SWITCH_USER); + auto propValue = pool.obtain(getPropType(switchUserProp)); + propValue->prop = switchUserProp; + propValue->timestamp = elapsedRealtimeNano(); + propValue->value.int32Values.resize(3); + propValue->value.int32Values[0] = static_cast(response.requestId); + propValue->value.int32Values[1] = static_cast(response.messageType); + propValue->value.int32Values[2] = static_cast(response.status); + if (response.status == SwitchUserStatus::FAILURE) { + propValue->value.stringValue = response.errorMessage; + } + return propValue; +} + +VehiclePropValuePool::RecyclableType toVehiclePropValue(VehiclePropValuePool& pool, + const CreateUserResponse& response) { + int32_t createUserProp = toInt(VehicleProperty::CREATE_USER); + auto propValue = pool.obtain(getPropType(createUserProp)); + propValue->prop = createUserProp; + propValue->timestamp = elapsedRealtimeNano(); + propValue->value.int32Values.resize(2); + propValue->value.int32Values[0] = static_cast(response.requestId); + propValue->value.int32Values[1] = static_cast(response.status); + if (response.status == CreateUserStatus::FAILURE) { + propValue->value.stringValue = response.errorMessage; + } + return propValue; +} + +VehiclePropValuePool::RecyclableType toVehiclePropValue( + VehiclePropValuePool& pool, const UserIdentificationResponse& response) { + int32_t userIdAssocProp = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION); + auto propValue = pool.obtain(getPropType(userIdAssocProp)); + propValue->prop = userIdAssocProp; + propValue->timestamp = elapsedRealtimeNano(); + propValue->value.int32Values.resize(2 + (response.numberAssociation * 2)); + propValue->value.int32Values[0] = static_cast(response.requestId); + propValue->value.int32Values[1] = static_cast(response.numberAssociation); + for (size_t i = 0; i < static_cast(response.numberAssociation); ++i) { + size_t int32ValuesPos = 2 + (2 * i); + propValue->value.int32Values[int32ValuesPos] = + static_cast(response.associations[i].type); + propValue->value.int32Values[int32ValuesPos + 1] = + static_cast(response.associations[i].value); + } + if (!response.errorMessage.empty()) { + propValue->value.stringValue = response.errorMessage; + } + return propValue; +} + +} // namespace user_hal_helper +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..7d0a534b850d034075b32811507f93c82c318e0f --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp @@ -0,0 +1,33 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "FakeUserHalTest", + vendor: true, + srcs: ["*.cpp"], + defaults: ["VehicleHalDefaults"], + static_libs: [ + "FakeUserHal", + "VehicleHalUtils", + "libgtest", + "libgmock", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/UserHalHelper_test.cpp b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/UserHalHelper_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2afb2e3b2e37480a5ebeda4ecc359bfe6d08cfe0 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/UserHalHelper_test.cpp @@ -0,0 +1,715 @@ +/* + * 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. + */ + +#include "UserHalHelper.h" + +#include +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace fake { +namespace user_hal_helper { + +namespace { + +using ::testing::Eq; +using ::testing::Gt; +using ::testing::IsNull; +using ::testing::NotNull; +using ::testing::Pointee; + +using ::aidl::android::hardware::automotive::vehicle::CreateUserRequest; +using ::aidl::android::hardware::automotive::vehicle::CreateUserResponse; +using ::aidl::android::hardware::automotive::vehicle::CreateUserStatus; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoRequest; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoRequestType; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoResponse; +using ::aidl::android::hardware::automotive::vehicle::InitialUserInfoResponseAction; +using ::aidl::android::hardware::automotive::vehicle::RemoveUserRequest; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserMessageType; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserRequest; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserResponse; +using ::aidl::android::hardware::automotive::vehicle::SwitchUserStatus; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationAssociationSetValue; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationAssociationType; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationAssociationValue; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationGetRequest; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationResponse; +using ::aidl::android::hardware::automotive::vehicle::UserIdentificationSetRequest; +using ::aidl::android::hardware::automotive::vehicle::UserInfo; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +constexpr int32_t INITIAL_USER_INFO = toInt(VehicleProperty::INITIAL_USER_INFO); +constexpr int32_t SWITCH_USER = toInt(VehicleProperty::SWITCH_USER); +constexpr int32_t CREATE_USER = toInt(VehicleProperty::CREATE_USER); +constexpr int32_t REMOVE_USER = toInt(VehicleProperty::REMOVE_USER); +constexpr int32_t USER_IDENTIFICATION_ASSOCIATION = + toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION); + +constexpr int32_t FIRST_BOOT_AFTER_OTA = toInt(InitialUserInfoRequestType::FIRST_BOOT_AFTER_OTA); +constexpr int32_t LEGACY_ANDROID_SWITCH = toInt(SwitchUserMessageType::LEGACY_ANDROID_SWITCH); +constexpr int32_t VEHICLE_REQUEST = toInt(SwitchUserMessageType::VEHICLE_REQUEST); + +constexpr int32_t NONE_USER = 0; +constexpr int32_t GUEST_USER = toInt(UserInfo::USER_FLAG_GUEST); +constexpr int32_t SYSTEM_USER = toInt(UserInfo::USER_FLAG_SYSTEM); +constexpr int32_t SYSTEM_ADMIN_USER = SYSTEM_USER | toInt(UserInfo::USER_FLAG_ADMIN); +// 0x1111 is not a valid UserFlags combination. +constexpr int32_t INVALID_USER_FLAG = 0x1111; + +constexpr int32_t USER_ID_ASSOC_KEY_FOB = toInt(UserIdentificationAssociationType::KEY_FOB); +constexpr int32_t USER_ID_ASSOC_CUSTOM_1 = toInt(UserIdentificationAssociationType::CUSTOM_1); + +constexpr int32_t USER_ID_ASSOC_SET_CURRENT_USER = + toInt(UserIdentificationAssociationSetValue::ASSOCIATE_CURRENT_USER); +constexpr int32_t USER_ID_ASSOC_UNSET_CURRENT_USER = + toInt(UserIdentificationAssociationSetValue::DISASSOCIATE_CURRENT_USER); + +constexpr int32_t USER_ID_ASSOC_CURRENT_USER = + toInt(UserIdentificationAssociationValue::ASSOCIATED_CURRENT_USER); +constexpr int32_t USER_ID_ASSOC_NO_USER = + toInt(UserIdentificationAssociationValue::NOT_ASSOCIATED_ANY_USER); + +} // namespace + +TEST(UserHalHelperTest, TestToInitialUserInfoRequest) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, FIRST_BOOT_AFTER_OTA, 10, NONE_USER, 2, 0, SYSTEM_USER, + 10, NONE_USER}}, + }; + InitialUserInfoRequest expected{ + .requestId = 23, + .requestType = InitialUserInfoRequestType::FIRST_BOOT_AFTER_OTA, + .usersInfo = {{10, 0}, 2, {{0, SYSTEM_USER}, {10, 0}}}, + }; + + auto actual = toInitialUserInfoRequest(propValue); + + ASSERT_TRUE(actual.ok()) << actual.error().message(); + EXPECT_THAT(actual.value(), Eq(expected)); +} + +TEST(UserHalHelperTest, TestToInitialUserInfoRequestUserFlagsBitCombination) { + // SYSTEM_ADMIN_USER is two UserFlags combined. + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, FIRST_BOOT_AFTER_OTA, 10, NONE_USER, 2, 0, + SYSTEM_ADMIN_USER, 10, NONE_USER}}, + }; + InitialUserInfoRequest expected{ + .requestId = 23, + .requestType = InitialUserInfoRequestType::FIRST_BOOT_AFTER_OTA, + .usersInfo = {{10, 0}, 2, {{0, SYSTEM_ADMIN_USER}, {10, 0}}}, + }; + + auto actual = toInitialUserInfoRequest(propValue); + + ASSERT_TRUE(actual.ok()) << actual.error().message(); + EXPECT_THAT(actual.value(), Eq(expected)); +} + +TEST(UserHalHelperTest, TestToInitialUserInfoRequestUserInvalidUserFlag) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, FIRST_BOOT_AFTER_OTA, 10, NONE_USER, 2, 0, + INVALID_USER_FLAG, 10, NONE_USER}}, + }; + + auto actual = toInitialUserInfoRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on invalid user flags"; +} + +TEST(UserHalHelperTest, TestFailsToInitialUserInfoRequestWithMismatchingPropType) { + VehiclePropValue propValue{ + .prop = INT32_MAX, + .value = {.int32Values = {23, FIRST_BOOT_AFTER_OTA, 10, NONE_USER, 2, 0, SYSTEM_USER, + 10, NONE_USER}}, + }; + + auto actual = toInitialUserInfoRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on mismatching property type"; +} + +TEST(UserHalHelperTest, TestFailsToInitialUserInfoRequestWithInvalidRequestType) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, INT32_MAX, 10, NONE_USER, 2, 0, SYSTEM_USER, 10, + NONE_USER}}, + }; + + auto actual = toInitialUserInfoRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on invalid request type"; +} + +TEST(UserHalHelperTest, TestFailsToInitialUserInfoRequestWithInvalidUserFlag) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, FIRST_BOOT_AFTER_OTA, 10, NONE_USER, 2, 0, SYSTEM_USER, + 10, INT32_MAX}}, + }; + + auto actual = toInitialUserInfoRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on invalid user flags"; +} + +TEST(UserHalHelperTest, TestFailsToInitialUserInfoRequestWithIncompleteUsersInfo) { + VehiclePropValue propValueMissingSecondUserInfo{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, FIRST_BOOT_AFTER_OTA, 10, NONE_USER, 2, 0, + SYSTEM_USER /*Missing 2nd UserInfo*/}}, + }; + + auto actual = toInitialUserInfoRequest(propValueMissingSecondUserInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing second user info"; + + VehiclePropValue propValueMissingUsersInfo{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, FIRST_BOOT_AFTER_OTA, /*Missing UsersInfo*/}}, + }; + + actual = toInitialUserInfoRequest(propValueMissingUsersInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing users info"; +} + +TEST(UserHalHelperTest, TestToSwitchUserRequest) { + VehiclePropValue propValue{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, LEGACY_ANDROID_SWITCH, 0, SYSTEM_USER, 10, NONE_USER, 2, + 0, SYSTEM_USER, 10, NONE_USER}}, + }; + SwitchUserRequest expected{ + .requestId = 23, + .messageType = SwitchUserMessageType::LEGACY_ANDROID_SWITCH, + .targetUser = {0, SYSTEM_USER}, + .usersInfo = {{10, 0}, 2, {{0, SYSTEM_USER}, {10, 0}}}, + }; + + auto actual = toSwitchUserRequest(propValue); + + ASSERT_TRUE(actual.ok()) << actual.error().message(); + EXPECT_THAT(actual.value(), Eq(expected)); +} + +TEST(UserHalHelperTest, TestFailsToSwitchUserRequestWithMismatchingPropType) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, LEGACY_ANDROID_SWITCH, 0, SYSTEM_USER, 10, NONE_USER, 2, + 0, SYSTEM_USER, 10, NONE_USER}}, + }; + + auto actual = toSwitchUserRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on mismatching property type"; +} + +TEST(UserHalHelperTest, TestFailsToSwitchUserRequestWithInvalidMessageType) { + VehiclePropValue propValueIncompatibleMessageType{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, VEHICLE_REQUEST, 0, SYSTEM_USER, 10, NONE_USER, 2, 0, + SYSTEM_USER, 10, NONE_USER}}, + }; + + auto actual = toSwitchUserRequest(propValueIncompatibleMessageType); + + EXPECT_FALSE(actual.ok()) << "No error returned on incompatible message type"; + + VehiclePropValue propValueInvalidMessageType{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, INT32_MAX, 0, SYSTEM_USER, 10, NONE_USER, 2, 0, + SYSTEM_USER, 10, NONE_USER}}, + }; + + actual = toSwitchUserRequest(propValueInvalidMessageType); + + EXPECT_FALSE(actual.ok()) << "No error returned on invalid message type"; +} + +TEST(UserHalHelperTest, TestFailsToSwitchUserRequestWithIncompleteUsersInfo) { + VehiclePropValue propValueMissingSecondUserInfo{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, LEGACY_ANDROID_SWITCH, 0, SYSTEM_USER, 10, NONE_USER, 2, + 0, SYSTEM_USER, + /*Missing 2nd UserInfo*/}}, + }; + + auto actual = toSwitchUserRequest(propValueMissingSecondUserInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing second user info"; + + VehiclePropValue propValueMissingUsersInfo{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, LEGACY_ANDROID_SWITCH, 0, SYSTEM_USER, + /*Missing UsersInfo*/}}, + }; + + actual = toSwitchUserRequest(propValueMissingUsersInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing users info"; + + VehiclePropValue propValueMissingTargetUser{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, LEGACY_ANDROID_SWITCH, /*Missing target UserInfo*/}}, + }; + + actual = toSwitchUserRequest(propValueMissingTargetUser); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing target user info"; +} + +TEST(UserHalHelperTest, TestToCreateUserRequest) { + VehiclePropValue propValue{ + .prop = CREATE_USER, + .value = {.int32Values = {23, 11, GUEST_USER, 10, NONE_USER, 2, 0, SYSTEM_USER, 10, + NONE_USER}, + .stringValue = "Guest11"}, + }; + CreateUserRequest expected{ + .requestId = 23, + .newUserInfo = {11, GUEST_USER}, + .newUserName = "Guest11", + .usersInfo = {{10, 0}, 2, {{0, SYSTEM_USER}, {10, 0}}}, + }; + + auto actual = toCreateUserRequest(propValue); + + ASSERT_TRUE(actual.ok()) << actual.error().message(); + EXPECT_THAT(actual.value(), Eq(expected)); +} + +TEST(UserHalHelperTest, TestFailsToCreateUserRequestWithMismatchingPropType) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, 11, GUEST_USER, 10, NONE_USER, 2, 0, SYSTEM_USER, 10, + NONE_USER}, + .stringValue = "Guest11"}, + }; + + auto actual = toCreateUserRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on mismatching property type"; +} + +TEST(UserHalHelperTest, TestFailsToCreateUserRequestWithIncompleteUsersInfo) { + VehiclePropValue propValueMissingSecondUserInfo{ + .prop = CREATE_USER, + .value = {.int32Values = {23, 11, GUEST_USER, 10, NONE_USER, 2, 0, + SYSTEM_USER /*Missing 2nd UserInfo*/}, + .stringValue = "Guest11"}, + }; + + auto actual = toCreateUserRequest(propValueMissingSecondUserInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing second user info"; + + VehiclePropValue propValueMissingUsersInfo{ + .prop = CREATE_USER, + .value = {.int32Values = {23, 11, GUEST_USER, /*Missing UsersInfo*/}, + .stringValue = "Guest11"}, + }; + + actual = toCreateUserRequest(propValueMissingUsersInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing users info"; + + VehiclePropValue propValueMissingCreateUserInfo{ + .prop = CREATE_USER, + .value = {.int32Values = {23, /*Missing create UserInfo*/}, .stringValue = "Guest11"}, + }; + + actual = toCreateUserRequest(propValueMissingCreateUserInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing create user info"; +} + +TEST(UserHalHelperTest, TestToRemoveUserRequest) { + VehiclePropValue propValue{ + .prop = REMOVE_USER, + .value = {.int32Values = {23, 10, NONE_USER, 10, NONE_USER, 2, 0, SYSTEM_USER, 10, + NONE_USER}}, + }; + RemoveUserRequest expected{ + .requestId = 23, + .removedUserInfo = {10, 0}, + .usersInfo = {{10, 0}, 2, {{0, SYSTEM_USER}, {10, 0}}}, + }; + + auto actual = toRemoveUserRequest(propValue); + + ASSERT_TRUE(actual.ok()) << actual.error().message(); + EXPECT_THAT(actual.value(), Eq(expected)); +} + +TEST(UserHalHelperTest, TestFailsToRemoveUserRequestWithMismatchingPropType) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, 10, NONE_USER, 10, NONE_USER, 2, 0, SYSTEM_USER, 10, + NONE_USER}}, + }; + + auto actual = toRemoveUserRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on mismatching property type"; +} + +TEST(UserHalHelperTest, TestFailsToRemoveUserRequestWithIncompleteUsersInfo) { + VehiclePropValue propValueMissingSecondUserInfo{ + .prop = REMOVE_USER, + .value = {.int32Values = {23, 10, NONE_USER, 10, NONE_USER, 2, 0, + SYSTEM_USER /*Missing 2nd UserInfo*/}}, + }; + + auto actual = toRemoveUserRequest(propValueMissingSecondUserInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing second user info"; + + VehiclePropValue propValueMissingUsersInfo{ + .prop = REMOVE_USER, + .value = {.int32Values = {23, 10, NONE_USER, /*Missing UsersInfo*/}}, + }; + + actual = toRemoveUserRequest(propValueMissingUsersInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing users info"; + + VehiclePropValue propValueMissingRemoveUserInfo{ + .prop = REMOVE_USER, + .value = {.int32Values = {23, /*Missing remove UserInfo*/}}, + }; + + actual = toRemoveUserRequest(propValueMissingRemoveUserInfo); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing remove user info"; +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationGetRequest) { + VehiclePropValue propValue{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, 2, USER_ID_ASSOC_KEY_FOB, + USER_ID_ASSOC_CUSTOM_1}}, + }; + UserIdentificationGetRequest expected{ + .requestId = 23, + .userInfo = {10, 0}, + .numberAssociationTypes = 2, + .associationTypes = {UserIdentificationAssociationType::KEY_FOB, + UserIdentificationAssociationType::CUSTOM_1}, + }; + + auto actual = toUserIdentificationGetRequest(propValue); + + ASSERT_TRUE(actual.ok()) << actual.error().message(); + EXPECT_THAT(actual.value(), Eq(expected)); +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationGetRequestWithMismatchingPropType) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, 10, NONE_USER, 2, USER_ID_ASSOC_KEY_FOB, + USER_ID_ASSOC_CUSTOM_1}}, + }; + + auto actual = toUserIdentificationGetRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on mismatching property type"; +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationGetRequestWithInvalidAssociationTypes) { + VehiclePropValue propValue{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, 1, INT32_MAX}}, + }; + + auto actual = toUserIdentificationGetRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on invalid association type"; +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationGetRequestWithIncompleteAssociationTypes) { + VehiclePropValue propValueMissingSecondAssociationType{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, 2, + USER_ID_ASSOC_KEY_FOB /*Missing 2nd association type*/}}, + }; + + auto actual = toUserIdentificationGetRequest(propValueMissingSecondAssociationType); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing second association type"; + + VehiclePropValue propValueMissingNumberAssociationTypes{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, /*Missing number association types*/}}, + }; + + actual = toUserIdentificationGetRequest(propValueMissingNumberAssociationTypes); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing number association types"; +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationGetRequestWithMissingUserInfo) { + VehiclePropValue propValue{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, /*Missing user info*/}}, + }; + + auto actual = toUserIdentificationGetRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing UserInfo"; +} + +TEST(UserHalHelperTest, TestToUserIdentificationSetRequest) { + VehiclePropValue propValue{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, 2, USER_ID_ASSOC_KEY_FOB, + USER_ID_ASSOC_SET_CURRENT_USER, USER_ID_ASSOC_CUSTOM_1, + USER_ID_ASSOC_UNSET_CURRENT_USER}}, + }; + UserIdentificationSetRequest expected{ + .requestId = 23, + .userInfo = {10, 0}, + .numberAssociations = 2, + .associations = {{UserIdentificationAssociationType::KEY_FOB, + UserIdentificationAssociationSetValue::ASSOCIATE_CURRENT_USER}, + {UserIdentificationAssociationType::CUSTOM_1, + UserIdentificationAssociationSetValue::DISASSOCIATE_CURRENT_USER}}, + }; + + auto actual = toUserIdentificationSetRequest(propValue); + + ASSERT_TRUE(actual.ok()) << actual.error().message(); + EXPECT_THAT(actual.value(), Eq(expected)); +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationSetRequestWithMismatchingPropType) { + VehiclePropValue propValue{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, 10, NONE_USER, 2, USER_ID_ASSOC_KEY_FOB, + USER_ID_ASSOC_SET_CURRENT_USER, USER_ID_ASSOC_CUSTOM_1, + USER_ID_ASSOC_UNSET_CURRENT_USER}}, + }; + + auto actual = toUserIdentificationSetRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on mismatching property type"; +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationSetRequestWithInvalidAssociations) { + VehiclePropValue propValueInvalidAssociationType{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, 1, INT32_MAX, + USER_ID_ASSOC_SET_CURRENT_USER}}, + }; + + auto actual = toUserIdentificationSetRequest(propValueInvalidAssociationType); + + EXPECT_FALSE(actual.ok()) << "No error returned on invalid association type"; + + VehiclePropValue propValueInvalidAssociationValue{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, USER_ID_ASSOC_KEY_FOB, INT32_MAX}}, + }; + + actual = toUserIdentificationSetRequest(propValueInvalidAssociationValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing number association types"; +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationSetRequestWithIncompleteAssociations) { + VehiclePropValue propValueMissingSecondAssociationType{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, 2, USER_ID_ASSOC_KEY_FOB, + USER_ID_ASSOC_SET_CURRENT_USER, + /*Missing 2nd association*/}}, + }; + + auto actual = toUserIdentificationSetRequest(propValueMissingSecondAssociationType); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing second association type"; + + VehiclePropValue propValueMissingNumberAssociationTypes{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 10, NONE_USER, /*Missing number associations*/}}, + }; + + actual = toUserIdentificationSetRequest(propValueMissingNumberAssociationTypes); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing number association types"; +} + +TEST(UserHalHelperTest, TestFailsToUserIdentificationSetRequestWithMissingUserInfo) { + VehiclePropValue propValue{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, /*Missing user info*/}}, + }; + + auto actual = toUserIdentificationSetRequest(propValue); + + EXPECT_FALSE(actual.ok()) << "No error returned on missing UserInfo"; +} + +TEST(UserHalHelperTest, TestSwitchUserRequestToVehiclePropValue) { + SwitchUserRequest request{ + .requestId = 23, + .messageType = SwitchUserMessageType::VEHICLE_REQUEST, + .targetUser = {11, GUEST_USER}, + }; + VehiclePropValue expected{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, + static_cast(SwitchUserMessageType::VEHICLE_REQUEST), + 11}}, + }; + + VehiclePropValuePool pool; + auto result = toVehiclePropValue(pool, request); + + ASSERT_TRUE(result.ok()); + EXPECT_THAT(result.value()->timestamp, Gt(0)); + // Don't rely on real timestamp in tests as the expected and actual objects won't have the same + // timestamps. Thus remove the timestamps before comparing them. + result.value()->timestamp = 0; + EXPECT_THAT(result.value(), Pointee(Eq(expected))); +} + +TEST(UserHalHelperTest, TestFailsSwitchUserRequestToVehiclePropValueWithIncompatibleMessageType) { + SwitchUserRequest request{ + .requestId = 23, + .messageType = SwitchUserMessageType::VEHICLE_RESPONSE, + .targetUser = {11, GUEST_USER}, + }; + + VehiclePropValuePool pool; + auto result = toVehiclePropValue(pool, request); + + EXPECT_FALSE(result.ok()); +} + +TEST(UserHalHelperTest, TestInitialUserInfoResponseToVehiclePropValue) { + InitialUserInfoResponse response{ + .requestId = 23, + .action = InitialUserInfoResponseAction::CREATE, + .userToSwitchOrCreate = {11, GUEST_USER}, + .userLocales = "en-US,pt-BR", + .userNameToCreate = "Owner", + }; + VehiclePropValue expected{ + .prop = INITIAL_USER_INFO, + .value = {.int32Values = {23, + static_cast(InitialUserInfoResponseAction::CREATE), + 11, GUEST_USER}, + .stringValue = "en-US,pt-BR||Owner"}, + }; + + VehiclePropValuePool pool; + auto actual = toVehiclePropValue(pool, response); + + ASSERT_THAT(actual, NotNull()); + EXPECT_THAT(actual->timestamp, Gt(0)); + actual->timestamp = 0; + EXPECT_THAT(actual, Pointee(Eq(expected))); +} + +TEST(UserHalHelperTest, TestSwitchUserResponseToVehiclePropValue) { + SwitchUserResponse response{ + .requestId = 23, + .messageType = SwitchUserMessageType::VEHICLE_RESPONSE, + .status = SwitchUserStatus::FAILURE, + .errorMessage = "random error", + }; + VehiclePropValue expected{ + .prop = SWITCH_USER, + .value = {.int32Values = {23, + static_cast(SwitchUserMessageType::VEHICLE_RESPONSE), + static_cast(SwitchUserStatus::FAILURE)}, + .stringValue = "random error"}, + }; + + VehiclePropValuePool pool; + auto actual = toVehiclePropValue(pool, response); + + ASSERT_THAT(actual, NotNull()); + EXPECT_THAT(actual->timestamp, Gt(0)); + actual->timestamp = 0; + EXPECT_THAT(actual, Pointee(Eq(expected))); +} + +TEST(UserHalHelperTest, TestCreateUserResponseToVehiclePropValue) { + CreateUserResponse response{ + .requestId = 23, + .status = CreateUserStatus::FAILURE, + .errorMessage = "random error", + }; + VehiclePropValue expected{ + .prop = CREATE_USER, + .value = {.int32Values = {23, static_cast(CreateUserStatus::FAILURE)}, + .stringValue = "random error"}, + }; + + VehiclePropValuePool pool; + auto actual = toVehiclePropValue(pool, response); + + ASSERT_THAT(actual, NotNull()); + EXPECT_THAT(actual->timestamp, Gt(0)); + actual->timestamp = 0; + EXPECT_THAT(actual, Pointee(Eq(expected))); +} + +TEST(UserHalHelperTest, TestUserIdentificationResponseToVehiclePropValue) { + UserIdentificationResponse response{ + .requestId = 23, + .numberAssociation = 2, + .associations = {{UserIdentificationAssociationType::KEY_FOB, + UserIdentificationAssociationValue::ASSOCIATED_CURRENT_USER}, + {UserIdentificationAssociationType::CUSTOM_1, + UserIdentificationAssociationValue::NOT_ASSOCIATED_ANY_USER}}, + .errorMessage = "random error", + }; + VehiclePropValue expected{ + .prop = USER_IDENTIFICATION_ASSOCIATION, + .value = {.int32Values = {23, 2, USER_ID_ASSOC_KEY_FOB, USER_ID_ASSOC_CURRENT_USER, + USER_ID_ASSOC_CUSTOM_1, USER_ID_ASSOC_NO_USER}, + .stringValue = "random error"}, + }; + + VehiclePropValuePool pool; + auto actual = toVehiclePropValue(pool, response); + + ASSERT_THAT(actual, NotNull()); + EXPECT_THAT(actual->timestamp, Gt(0)); + actual->timestamp = 0; + EXPECT_THAT(actual, Pointee(Eq(expected))); +} + +} // namespace user_hal_helper +} // namespace fake +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..7670c25418169bc8aa15e8bcc1d94cf86173eae4 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp @@ -0,0 +1,59 @@ +/* + * 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_library { + name: "VehicleHalProtoMessageConverter", + srcs: [ + "src/*.cpp", + ], + vendor: true, + local_include_dirs: ["include"], + export_include_dirs: ["include"], + shared_libs: ["libprotobuf-cpp-full"], + static_libs: [ + "VehicleHalProtos", + "VehicleHalUtils", + ], + defaults: ["VehicleHalDefaults"], + export_static_lib_headers: ["VehicleHalUtils"], +} + +cc_test { + name: "VehicleHalProtoMessageConverterTest", + srcs: [ + "test/*.cpp", + ], + vendor: true, + defaults: ["VehicleHalDefaults"], + shared_libs: ["libprotobuf-cpp-full"], + static_libs: [ + "VehicleHalProtoMessageConverter", + "VehicleHalProtos", + "VehicleHalUtils", + "libgtest", + ], + header_libs: ["VehicleHalDefaultConfig"], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h new file mode 100644 index 0000000000000000000000000000000000000000..1c26fe868b92b9562241a86fa116372d168ac1e5 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_ +#define android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_ + +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace proto_msg_converter { + +// Convert AIDL VehiclePropConfig to Protobuf VehiclePropConfig. +void aidlToProto( + const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& inAidlConfig, + ::android::hardware::automotive::vehicle::proto::VehiclePropConfig* outProtoConfig); +// Convert Protobuf VehiclePropConfig to AIDL VehiclePropConfig. +void protoToAidl( + const ::android::hardware::automotive::vehicle::proto::VehiclePropConfig& inProtoConfig, + ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig* outAidlConfig); +// Convert AIDL VehiclePropValue to Protobuf VehiclePropValue. +void aidlToProto(const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& inAidlVal, + ::android::hardware::automotive::vehicle::proto::VehiclePropValue* outProtoVal); +// Convert Protobuf VehiclePropValue to AIDL VehiclePropValue. +void protoToAidl( + const ::android::hardware::automotive::vehicle::proto::VehiclePropValue& inProtoVal, + ::aidl::android::hardware::automotive::vehicle::VehiclePropValue* outAidlVal); + +} // namespace proto_msg_converter +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_ diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6cbc7e523e22f25cbbd0a8d4ef7d4f85bff2e3b0 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp @@ -0,0 +1,146 @@ +/* + * 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_TAG "ProtoMsgConverter" + +#include "ProtoMessageConverter.h" + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace proto_msg_converter { + +namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle; +namespace proto = ::android::hardware::automotive::vehicle::proto; + +// Copy the vector PROTO_VECNAME of protobuf class PROTO_VALUE to +// VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME, every element of PROTO_VECNAME is casted by CAST. +#define CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, \ + VHAL_TYPE_VECNAME, CAST) \ + do { \ + (VHAL_TYPE_VALUE)->VHAL_TYPE_VECNAME.resize(PROTO_VALUE.PROTO_VECNAME##_size()); \ + size_t idx = 0; \ + for (auto& value : PROTO_VALUE.PROTO_VECNAME()) { \ + VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME[idx++] = CAST(value); \ + } \ + } while (0) + +// Copying the vector PROTO_VECNAME of protobuf class PROTO_VALUE to +// VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME. +#define COPY_PROTOBUF_VEC_TO_VHAL_TYPE(PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, \ + VHAL_TYPE_VECNAME) \ + CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE( \ + PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, VHAL_TYPE_VECNAME, /*NO CAST*/) + +void aidlToProto(const aidl_vehicle::VehiclePropConfig& in, proto::VehiclePropConfig* out) { + out->set_prop(in.prop); + out->set_access(static_cast(toInt(in.access))); + out->set_change_mode(static_cast(toInt(in.changeMode))); + out->set_config_string(in.configString.c_str(), in.configString.size()); + out->set_min_sample_rate(in.minSampleRate); + out->set_max_sample_rate(in.maxSampleRate); + + for (auto& configElement : in.configArray) { + out->add_config_array(configElement); + } + + out->clear_area_configs(); + for (auto& areaConfig : in.areaConfigs) { + auto* protoACfg = out->add_area_configs(); + protoACfg->set_area_id(areaConfig.areaId); + protoACfg->set_min_int64_value(areaConfig.minInt64Value); + protoACfg->set_max_int64_value(areaConfig.maxInt64Value); + protoACfg->set_min_float_value(areaConfig.minFloatValue); + protoACfg->set_max_float_value(areaConfig.maxFloatValue); + protoACfg->set_min_int32_value(areaConfig.minInt32Value); + protoACfg->set_max_int32_value(areaConfig.maxInt32Value); + } +} + +void protoToAidl(const proto::VehiclePropConfig& in, aidl_vehicle::VehiclePropConfig* out) { + out->prop = in.prop(); + out->access = static_cast(in.access()); + out->changeMode = static_cast(in.change_mode()); + out->configString = in.config_string(); + out->minSampleRate = in.min_sample_rate(); + out->maxSampleRate = in.max_sample_rate(); + + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, config_array, out, configArray); + + auto cast_to_acfg = [](const proto::VehicleAreaConfig& protoAcfg) { + return aidl_vehicle::VehicleAreaConfig{ + .areaId = protoAcfg.area_id(), + .minInt32Value = protoAcfg.min_int32_value(), + .maxInt32Value = protoAcfg.max_int32_value(), + .minInt64Value = protoAcfg.min_int64_value(), + .maxInt64Value = protoAcfg.max_int64_value(), + .minFloatValue = protoAcfg.min_float_value(), + .maxFloatValue = protoAcfg.max_float_value(), + }; + }; + CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, area_configs, out, areaConfigs, cast_to_acfg); +} + +void aidlToProto(const aidl_vehicle::VehiclePropValue& in, proto::VehiclePropValue* out) { + out->set_prop(in.prop); + out->set_timestamp(in.timestamp); + out->set_status(static_cast(in.status)); + out->set_area_id(in.areaId); + out->set_string_value(in.value.stringValue); + out->set_byte_values(in.value.byteValues.data(), in.value.byteValues.size()); + + for (auto& int32Value : in.value.int32Values) { + out->add_int32_values(int32Value); + } + + for (auto& int64Value : in.value.int64Values) { + out->add_int64_values(int64Value); + } + + for (auto& floatValue : in.value.floatValues) { + out->add_float_values(floatValue); + } +} + +void protoToAidl(const proto::VehiclePropValue& in, aidl_vehicle::VehiclePropValue* out) { + out->prop = in.prop(); + out->timestamp = in.timestamp(); + out->status = static_cast(in.status()); + out->areaId = in.area_id(); + out->value.stringValue = in.string_value(); + for (const char& byte : in.byte_values()) { + out->value.byteValues.push_back(byte); + } + + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, int32_values, out, value.int32Values); + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, int64_values, out, value.int64Values); + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, float_values, out, value.floatValues); +} + +#undef COPY_PROTOBUF_VEC_TO_VHAL_TYPE +#undef CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE + +} // namespace proto_msg_converter +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c742db51f56498fe47751b4565f21d916533b2f6 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp @@ -0,0 +1,103 @@ +/* + * 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace proto_msg_converter { + +namespace { + +namespace proto = ::android::hardware::automotive::vehicle::proto; +namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle; + +std::vector prepareTestConfigs() { + std::vector configs; + for (auto& property : defaultconfig::getDefaultConfigs()) { + configs.push_back(property.config); + } + return configs; +} + +std::vector prepareTestValues() { + std::vector values; + int64_t timestamp = 1; + for (auto& property : defaultconfig::getDefaultConfigs()) { + values.push_back({ + .timestamp = timestamp, + .areaId = 123, + .prop = property.config.prop, + .value = property.initialValue, + .status = aidl_vehicle::VehiclePropertyStatus::ERROR, + }); + } + return values; +} + +class PropConfigConversionTest : public testing::TestWithParam {}; + +class PropValueConversionTest : public testing::TestWithParam {}; + +} // namespace + +TEST_P(PropConfigConversionTest, testConversion) { + proto::VehiclePropConfig protoCfg; + aidl_vehicle::VehiclePropConfig aidlCfg; + + aidlToProto(GetParam(), &protoCfg); + protoToAidl(protoCfg, &aidlCfg); + + EXPECT_EQ(aidlCfg, GetParam()); +} + +TEST_P(PropValueConversionTest, testConversion) { + proto::VehiclePropValue protoVal; + aidl_vehicle::VehiclePropValue aidlVal; + + aidlToProto(GetParam(), &protoVal); + protoToAidl(protoVal, &aidlVal); + + EXPECT_EQ(aidlVal, GetParam()); +} + +INSTANTIATE_TEST_SUITE_P(DefaultConfigs, PropConfigConversionTest, + ::testing::ValuesIn(prepareTestConfigs()), + [](const ::testing::TestParamInfo& info) { + return ::fmt::format("property_{:d}", info.param.prop); + }); + +INSTANTIATE_TEST_SUITE_P(TestValues, PropValueConversionTest, + ::testing::ValuesIn(prepareTestValues()), + [](const ::testing::TestParamInfo& info) { + return ::fmt::format("property_{:d}", info.param.prop); + }); + +} // namespace proto_msg_converter +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/hardware/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..edb0f298628867ada94e2754dba543a493732305 --- /dev/null +++ b/automotive/vehicle/aidl/impl/hardware/Android.bp @@ -0,0 +1,33 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_headers { + name: "IVehicleHardware", + vendor: true, + export_include_dirs: [ + "include", + ], + header_libs: [ + "VehicleHalUtilHeaders", + ], + export_header_lib_headers: [ + "VehicleHalUtilHeaders", + ], +} diff --git a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h new file mode 100644 index 0000000000000000000000000000000000000000..759db4153dc6b2c9c7a983b40254786a7bc8a851 --- /dev/null +++ b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h @@ -0,0 +1,133 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_hardware_include_IVehicleHardware_H_ +#define android_hardware_automotive_vehicle_aidl_impl_hardware_include_IVehicleHardware_H_ + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// A structure used to return dumped information. +struct DumpResult { + // If callerShouldDumpState is true, caller would print the information in buffer and + // continue to dump its state, otherwise would just dump the buffer and skip its own + // dumping logic. + bool callerShouldDumpState; + // The dumped information for the caller to print. + std::string buffer; +}; + +// A structure to represent a set value error event reported from vehicle. +struct SetValueErrorEvent { + aidl::android::hardware::automotive::vehicle::StatusCode errorCode; + int32_t propId; + int32_t areaId; +}; + +// An abstract interface to access vehicle hardware. +// For virtualized VHAL, GrpcVehicleHardware would communicate with a VehicleHardware +// implementation in another VM through GRPC. For non-virtualzied VHAL, VHAL directly communicates +// with a VehicleHardware through this interface. +class IVehicleHardware { + public: + using SetValuesCallback = std::function)>; + using GetValuesCallback = std::function)>; + using PropertyChangeCallback = std::function)>; + using PropertySetErrorCallback = std::function)>; + + virtual ~IVehicleHardware() = default; + + // Get all the property configs. + virtual std::vector + getAllPropertyConfigs() const = 0; + + // Set property values asynchronously. Server could return before the property set requests + // are sent to vehicle bus or before property set confirmation is received. The callback is + // safe to be called after the function returns and is safe to be called in a different thread. + virtual aidl::android::hardware::automotive::vehicle::StatusCode setValues( + std::shared_ptr callback, + const std::vector& + requests) = 0; + + // Get property values asynchronously. Server could return before the property values are ready. + // The callback is safe to be called after the function returns and is safe to be called in a + // different thread. + virtual aidl::android::hardware::automotive::vehicle::StatusCode getValues( + std::shared_ptr callback, + const std::vector& + requests) const = 0; + + // Update the sampling rate for the specified property and the specified areaId (0 for global + // property) if server supports it. The property must be a continuous property. + // {@code sampleRate} means that for this specific property, the server must generate at least + // this many OnPropertyChange events per seconds. + // A sampleRate of 0 means the property is no longer subscribed and server does not need to + // generate any onPropertyEvent for this property. + // This would be called if sample rate is updated for a subscriber, a new subscriber is added + // or an existing subscriber is removed. For example: + // 1. We have no subscriber for speed. + // 2. A new subscriber is subscribing speed for 10 times/s, updsateSampleRate would be called + // with sampleRate as 10. The impl is now polling vehicle speed from bus 10 times/s. + // 3. A new subscriber is subscribing speed for 5 times/s, because it is less than 10 + // times/sec, updateSampleRate would not be called. + // 4. The initial subscriber is removed, updateSampleRate would be called with sampleRate as + // 5, because now it only needs to report event 5times/sec. The impl can now poll vehicle + // speed 5 times/s. If the impl is still polling at 10 times/s, that is okay as long as + // the polling rate is larger than 5times/s. DefaultVehicleHal would ignore the additional + // events. + // 5. The second subscriber is removed, updateSampleRate would be called with sampleRate as 0. + // The impl can optionally disable the polling for vehicle speed. + // + // If the impl is always polling at {@code maxSampleRate} as specified in config, then this + // function can be a no-op. + virtual aidl::android::hardware::automotive::vehicle::StatusCode updateSampleRate( + [[maybe_unused]] int32_t propId, [[maybe_unused]] int32_t areaId, + [[maybe_unused]] float sampleRate) { + return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + } + + // Dump debug information in the server. + virtual DumpResult dump(const std::vector& options) = 0; + + // Check whether the system is healthy, return {@code StatusCode::OK} for healthy. + virtual aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() = 0; + + // Register a callback that would be called when there is a property change event from vehicle. + virtual void registerOnPropertyChangeEvent( + std::unique_ptr callback) = 0; + + // Register a callback that would be called when there is a property set error event from + // vehicle. + virtual void registerOnPropertySetErrorEvent( + std::unique_ptr callback) = 0; +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_hardware_include_IVehicleHardware_H_ diff --git a/automotive/vehicle/aidl/impl/proto/Android.bp b/automotive/vehicle/aidl/impl/proto/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..709307d3e17f8a56b9fd7321a63563fa107152ae --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/Android.bp @@ -0,0 +1,100 @@ +/* + * 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"], +} + +filegroup { + name: "VehicleHalProtoFiles", + srcs: ["**/*.proto"], + visibility: ["//hardware/interfaces/automotive/vehicle:__subpackages__"], +} + +genrule { + name: "VehicleProtoStub_h", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + ":VehicleHalProtoFiles", + ], + out: [ + "android/hardware/automotive/vehicle/DumpResult.pb.h", + "android/hardware/automotive/vehicle/StatusCode.pb.h", + "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.h", + "android/hardware/automotive/vehicle/VehiclePropConfig.pb.h", + "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.h", + "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.h", + "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.h", + "android/hardware/automotive/vehicle/VehiclePropValue.pb.h", + "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.h", + ], +} + +genrule { + name: "VehicleProtoStub_cc", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + ":VehicleHalProtoFiles", + ], + out: [ + "android/hardware/automotive/vehicle/DumpResult.pb.cc", + "android/hardware/automotive/vehicle/StatusCode.pb.cc", + "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropConfig.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropValue.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.cc", + ], +} + +cc_library_static { + name: "VehicleHalProtos", + vendor: true, + host_supported: true, + include_dirs: [ + "external/protobuf/src", + ], + generated_headers: [ + "VehicleProtoStub_h", + ], + export_generated_headers: [ + "VehicleProtoStub_h", + ], + generated_sources: [ + "VehicleProtoStub_cc", + ], + shared_libs: [ + "libgrpc++_unsecure", + ], + cflags: [ + "-Wno-unused-parameter", + ], +} diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto new file mode 100644 index 0000000000000000000000000000000000000000..25bb7d4f77451c6b6b2ff43873784e8d2812f2fa --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto @@ -0,0 +1,28 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +message DumpResult { + /* If callerShouldDumpState is true, caller would print the information in buffer and + * continue to dump its state, otherwise would just dump the buffer and skip its own + * dumping logic. */ + bool caller_should_dump_state = 1; + /* The dumped information for the caller to print. */ + string buffer = 2; +} diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto new file mode 100644 index 0000000000000000000000000000000000000000..97cb0f88b2900296af95ebd016096b5f091a8cf1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto @@ -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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with StatusCode.aidl. */ +enum StatusCode { + OK = 0; + + /* Try again. */ + TRY_AGAIN = 1; + + /* Invalid argument provided. */ + INVALID_ARG = 2; + + /* This code must be returned when device that associated with the vehicle + * property is not available. For example, when client tries to set HVAC + * temperature when the whole HVAC unit is turned OFF. */ + NOT_AVAILABLE = 3; + + /* Access denied */ + ACCESS_DENIED = 4; + + /* Something unexpected has happened in Vehicle HAL */ + INTERNAL_ERROR = 5; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto new file mode 100644 index 0000000000000000000000000000000000000000..b5b7e8070a8e43d98d9b6540130bdb24b438f73a --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto @@ -0,0 +1,39 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehicleAreaConfig.aidl. */ +message VehicleAreaConfig { + /* Area id is ignored for VehiclePropertyGroup:GLOBAL properties. */ + int32 area_id = 1; + + /* If the property has @data_enum, leave the range to zero. + * + * Range will be ignored in the following cases: + * - The VehiclePropertyType is not INT32, INT64 or FLOAT. + * - Both of min value and max value are zero. */ + int32 min_int32_value = 2; + int32 max_int32_value = 3; + + int64 min_int64_value = 4; + int64 max_int64_value = 5; + + float min_float_value = 6; + float max_float_value = 7; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto new file mode 100644 index 0000000000000000000000000000000000000000..e230d15d064136229b19edc22376e609706c02c7 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto @@ -0,0 +1,53 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/VehicleAreaConfig.proto"; +import "android/hardware/automotive/vehicle/VehiclePropertyAccess.proto"; +import "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto"; + +/* Must be in sync with VehiclePropConfig.aidl. */ +message VehiclePropConfig { + /* Property identifier */ + int32 prop = 1; + + /* Defines if the property is read or write or both. */ + VehiclePropertyAccess access = 2; + + /* Defines the change mode of the property. */ + VehiclePropertyChangeMode change_mode = 3; + + /* Contains per-area configuration. */ + repeated VehicleAreaConfig area_configs = 4; + + /* Contains additional configuration parameters */ + repeated int32 config_array = 5; + + /* Some properties may require additional information passed over this + * string. Most properties do not need to set this. */ + bytes config_string = 6; + + /* Min sample rate in Hz. + * Must be defined for VehiclePropertyChangeMode::CONTINUOUS */ + float min_sample_rate = 7; + + /* Must be defined for VehiclePropertyChangeMode::CONTINUOUS + * Max sample rate in Hz. */ + float max_sample_rate = 8; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto new file mode 100644 index 0000000000000000000000000000000000000000..80c73cbb7782f9ac59611d52c4c0e5252b5a49d2 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto @@ -0,0 +1,54 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/VehiclePropertyStatus.proto"; + +/* Must be in sync with VehiclePropValue.aidl. */ +message VehiclePropValue { + /* Time is elapsed nanoseconds since boot */ + int64 timestamp = 1; + + /* Area type(s) for non-global property it must be one of the value from + * VehicleArea* enums or 0 for global properties. */ + int32 area_id = 2; + + /* Property identifier */ + int32 prop = 3; + + /* Status of the property */ + VehiclePropertyStatus status = 4; + + /* This is used for properties of types VehiclePropertyType#INT + * and VehiclePropertyType#INT_VEC */ + repeated int32 int32_values = 5; + + /* This is used for properties of types VehiclePropertyType#FLOAT + * and VehiclePropertyType#FLOAT_VEC */ + repeated float float_values = 6; + + /* This is used for properties of type VehiclePropertyType#INT64 */ + repeated int64 int64_values = 7; + + /* This is used for properties of type VehiclePropertyType#BYTES */ + bytes byte_values = 8; + + /* This is used for properties of type VehiclePropertyType#STRING */ + string string_value = 9; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto new file mode 100644 index 0000000000000000000000000000000000000000..b16daa8bd36600f4bca26a9f0c19e4f883b74626 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto @@ -0,0 +1,26 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/VehiclePropValue.proto"; + +message VehiclePropValueRequest { + int32 request_id = 1; + VehiclePropValue value = 2; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto new file mode 100644 index 0000000000000000000000000000000000000000..55840f07d4ae47043b371df26c97280c063f0791 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto @@ -0,0 +1,27 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehiclePropertyAccess.aidl. */ +enum VehiclePropertyAccess { + NONE = 0; + READ = 1; + WRITE = 2; + READ_WRITE = 3; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto new file mode 100644 index 0000000000000000000000000000000000000000..c681e3b4c3cc07c94676f9e36f40e3eae4be9139 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto @@ -0,0 +1,40 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehiclePropertyChangeMode.aidl. */ +enum VehiclePropertyChangeMode { + /* Property of this type must never be changed. Subscription is not supported + * for these properties. */ + STATIC = 0; + + /* Properties of this type must report when there is a change. + * IVehicle#get call must return the current value. + * Set operation for this property is assumed to be asynchronous. When the + * property is read (using IVehicle#get) after IVehicle#set, it may still + * return old value until underlying H/W backing this property has actually + * changed the state. Once state is changed, the property must dispatch + * changed value as event. */ + ON_CHANGE = 1; + + /* Properties of this type change continuously and require a fixed rate of + * sampling to retrieve the data. Implementers may choose to send extra + * notifications on significant value changes. */ + CONTINUOUS = 2; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto new file mode 100644 index 0000000000000000000000000000000000000000..a44c8f03e685d11bf63080b40f4cff5741e845c9 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto @@ -0,0 +1,37 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehiclePropertyStatus.aidl. */ +enum VehiclePropertyStatus { + /* Property is available and behaving normally */ + AVAILABLE = 0; + /* A property in this state is not available for reading and writing. This + * is a transient state that depends on the availability of the underlying + * implementation (e.g. hardware or driver). It MUST NOT be used to + * represent features that this vehicle is always incapable of. A get() of + * a property in this state MAY return an undefined value, but MUST + * correctly describe its status as UNAVAILABLE A set() of a property in + * this state MAY return NOT_AVAILABLE. The HAL implementation MUST ignore + * the value of the status field when writing a property value coming from + * Android. */ + UNAVAILABLE = 1; + /* There is an error with this property. */ + ERROR = 2; +}; diff --git a/automotive/vehicle/aidl/impl/utils/common/Android.bp b/automotive/vehicle/aidl/impl/utils/common/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..e5d9346da4c504be99925de125faaf4a39538d7a --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/Android.bp @@ -0,0 +1,34 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library { + name: "VehicleHalUtils", + srcs: ["src/*.cpp"], + vendor_available: true, + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], +} + +cc_library_headers { + name: "VehicleHalUtilHeaders", + export_include_dirs: ["include"], + vendor: true, +} diff --git a/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h b/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h new file mode 100644 index 0000000000000000000000000000000000000000..327c0dc35d06894f25c48b19e5878fb28bfc2676 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/ConcurrentQueue.h @@ -0,0 +1,100 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_utils_common_include_ConcurrentQueue_H_ +#define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_ConcurrentQueue_H_ + +#include + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +template +class ConcurrentQueue { + public: + bool waitForItems() { + std::unique_lock lockGuard(mLock); + android::base::ScopedLockAssertion lockAssertion(mLock); + while (mQueue.empty() && mIsActive) { + mCond.wait(lockGuard); + } + return mIsActive; + } + + std::vector flush() { + std::vector items; + + std::scoped_lock lockGuard(mLock); + if (mQueue.empty()) { + return items; + } + while (!mQueue.empty()) { + // Even if the queue is deactivated, we should still flush all the remaining values + // in the queue. + items.push_back(std::move(mQueue.front())); + mQueue.pop(); + } + return items; + } + + void push(T&& item) { + { + std::scoped_lock lockGuard(mLock); + if (!mIsActive) { + return; + } + mQueue.push(std::move(item)); + } + mCond.notify_one(); + } + + // Deactivates the queue, thus no one can push items to it, also notifies all waiting thread. + // The items already in the queue could still be flushed even after the queue is deactivated. + void deactivate() { + { + std::scoped_lock lockGuard(mLock); + mIsActive = false; + } + // To unblock all waiting consumers. + mCond.notify_all(); + } + + ConcurrentQueue() = default; + + ConcurrentQueue(const ConcurrentQueue&) = delete; + ConcurrentQueue& operator=(const ConcurrentQueue&) = delete; + + private: + mutable std::mutex mLock; + bool mIsActive GUARDED_BY(mLock) = true; + std::condition_variable mCond; + std::queue mQueue GUARDED_BY(mLock); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_ConcurrentQueue_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/ParcelableUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/ParcelableUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..ab7b895f2078497e08ecefeac5a43086a564f9ee --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/ParcelableUtils.h @@ -0,0 +1,87 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_ParcelableUtils_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_include_ParcelableUtils_H_ + +#include +#include +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// Turns the values into a stable large parcelable that could be sent via binder. +// If values is small enough, it would be put into output.payloads, otherwise a shared memory file +// would be created and output.sharedMemoryFd would be filled in. +template +ndk::ScopedAStatus vectorToStableLargeParcelable(std::vector&& values, T2* output) { + output->payloads = std::move(values); + auto result = android::automotive::car_binder_lib::LargeParcelableBase:: + parcelableToStableLargeParcelable(*output); + if (!result.ok()) { + return toScopedAStatus( + result, aidl::android::hardware::automotive::vehicle::StatusCode::INTERNAL_ERROR); + } + auto& fd = result.value(); + if (fd != nullptr) { + // Move the returned ScopedFileDescriptor pointer to ScopedFileDescriptor value in + // 'sharedMemoryFd' field. + output->payloads.clear(); + output->sharedMemoryFd = std::move(*fd); + } else { + output->sharedMemoryFd = ndk::ScopedFileDescriptor(); + // Do not modify payloads. + } + return ndk::ScopedAStatus::ok(); +} + +template +ndk::ScopedAStatus vectorToStableLargeParcelable(const std::vector& values, T2* output) { + // Because 'values' is passed in as const reference, we have to do a copy here. + std::vector valuesCopy = values; + + return vectorToStableLargeParcelable(std::move(valuesCopy), output); +} + +template +android::base::expected< + android::automotive::car_binder_lib::LargeParcelableBase::BorrowedOwnedObject, + ndk::ScopedAStatus> +fromStableLargeParcelable(const T& largeParcelable) { + auto result = android::automotive::car_binder_lib::LargeParcelableBase:: + stableLargeParcelableToParcelable(largeParcelable); + + if (!result.ok()) { + return android::base::unexpected(toScopedAStatus( + result, aidl::android::hardware::automotive::vehicle::StatusCode::INVALID_ARG, + "failed to parse large parcelable")); + } + + return std::move(result.value()); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_ParcelableUtils_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h b/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h new file mode 100644 index 0000000000000000000000000000000000000000..3f8db93ba3fb7b33a856cd0327e311a308e0bc06 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h @@ -0,0 +1,103 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_PendingRequestPool_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_include_PendingRequestPool_H_ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// A thread-safe pending request pool that tracks whether each request has timed-out. +class PendingRequestPool final { + public: + using TimeoutCallbackFunc = std::function&)>; + + explicit PendingRequestPool(int64_t timeoutInNano); + + ~PendingRequestPool(); + + // Adds a list of requests to the request pool. + // The clientId is the key for all the requests. It could be a number or an address to a data + // structure that represents a client. The caller must maintain this data structure. + // All the request IDs must be unique for one client, if any of the requestIds is duplicate with + // any pending request IDs for the client, this function returns error and no requests would be + // added. Otherwise, they would be added to the request pool. + // The callback would be called if requests are not finished within {@code mTimeoutInNano} + // seconds. + VhalResult addRequests(const void* clientId, + const std::unordered_set& requestIds, + std::shared_ptr callback); + + // Checks whether the request is currently pending. + bool isRequestPending(const void* clientId, int64_t requestId) const; + + // Tries to mark the requests as finished and remove them from the pool if the request is + // currently pending. Returns the list of request that is pending and has been finished + // successfully. This function would try to finish any valid requestIds even though some of the + // requestIds are not valid. + std::unordered_set tryFinishRequests(const void* clientId, + const std::unordered_set& requestIds); + + // Returns how many pending requests in the pool, for testing purpose. + size_t countPendingRequests(const void* clientId) const; + + size_t countPendingRequests() const; + + private: + // The maximum number of pending requests allowed per client. If exceeds this number, adding + // more requests would fail. This is to prevent spamming from client. + static constexpr size_t MAX_PENDING_REQUEST_PER_CLIENT = 10000; + + struct PendingRequest { + std::unordered_set requestIds; + int64_t timeoutTimestamp; + std::shared_ptr callback; + }; + + int64_t mTimeoutInNano; + mutable std::mutex mLock; + std::unordered_map> mPendingRequestsByClient + GUARDED_BY(mLock); + std::thread mThread; + std::atomic mThreadStop = false; + std::condition_variable mCv; + std::mutex mCvLock; + + bool isRequestPendingLocked(const void* clientId, int64_t requestId) const REQUIRES(mLock); + + // Checks whether the requests in the pool has timed-out, run periodically in a separate thread. + void checkTimeout(); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_PendingRequestPool_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..2743578df128669ce76b264c1c5201c1206e2216 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -0,0 +1,120 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_utils_common_include_PropertyUtils_H_ +#define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_PropertyUtils_H_ + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace propertyutils_impl { + +// These names are not part of the API since we only expose ints. +using ::aidl::android::hardware::automotive::vehicle::PortLocationType; +using ::aidl::android::hardware::automotive::vehicle::VehicleArea; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaDoor; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaSeat; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWheel; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; +using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; +using ::aidl::android::hardware::automotive::vehicle::VehicleLightState; +using ::aidl::android::hardware::automotive::vehicle::VehicleLightSwitch; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; + +} // namespace propertyutils_impl + +// Some handy constants to avoid conversions from enum to int. +constexpr int ABS_ACTIVE = toInt(propertyutils_impl::VehicleProperty::ABS_ACTIVE); +constexpr int AP_POWER_STATE_REQ = toInt(propertyutils_impl::VehicleProperty::AP_POWER_STATE_REQ); +constexpr int AP_POWER_STATE_REPORT = + toInt(propertyutils_impl::VehicleProperty::AP_POWER_STATE_REPORT); +constexpr int DOOR_1_LEFT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_1_LEFT); +constexpr int DOOR_1_RIGHT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_1_RIGHT); +constexpr int DOOR_2_LEFT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_2_LEFT); +constexpr int DOOR_2_RIGHT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_2_RIGHT); +constexpr int DOOR_REAR = toInt(propertyutils_impl::VehicleAreaDoor::REAR); +constexpr int WINDOW_1_LEFT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_1_LEFT); +constexpr int WINDOW_1_RIGHT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_1_RIGHT); +constexpr int WINDOW_2_LEFT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_2_LEFT); +constexpr int WINDOW_2_RIGHT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_2_RIGHT); +constexpr int WINDOW_ROOF_TOP_1 = toInt(propertyutils_impl::VehicleAreaWindow::ROOF_TOP_1); +constexpr int FAN_DIRECTION_FACE = toInt(propertyutils_impl::VehicleHvacFanDirection::FACE); +constexpr int FAN_DIRECTION_FLOOR = toInt(propertyutils_impl::VehicleHvacFanDirection::FLOOR); +constexpr int FAN_DIRECTION_DEFROST = toInt(propertyutils_impl::VehicleHvacFanDirection::DEFROST); +constexpr int OBD2_LIVE_FRAME = toInt(propertyutils_impl::VehicleProperty::OBD2_LIVE_FRAME); +constexpr int OBD2_FREEZE_FRAME = toInt(propertyutils_impl::VehicleProperty::OBD2_FREEZE_FRAME); +constexpr int OBD2_FREEZE_FRAME_INFO = + toInt(propertyutils_impl::VehicleProperty::OBD2_FREEZE_FRAME_INFO); +constexpr int OBD2_FREEZE_FRAME_CLEAR = + toInt(propertyutils_impl::VehicleProperty::OBD2_FREEZE_FRAME_CLEAR); +constexpr int TRACTION_CONTROL_ACTIVE = + toInt(propertyutils_impl::VehicleProperty::TRACTION_CONTROL_ACTIVE); +constexpr int VEHICLE_MAP_SERVICE = toInt(propertyutils_impl::VehicleProperty::VEHICLE_MAP_SERVICE); +constexpr int WHEEL_TICK = toInt(propertyutils_impl::VehicleProperty::WHEEL_TICK); +constexpr int SEAT_1_LEFT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_1_LEFT); +constexpr int SEAT_1_RIGHT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_1_RIGHT); +constexpr int SEAT_2_LEFT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_LEFT); +constexpr int SEAT_2_RIGHT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_RIGHT); +constexpr int SEAT_2_CENTER = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_CENTER); +constexpr int VENDOR_EXTENSION_BOOLEAN_PROPERTY = + 0x101 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(propertyutils_impl::VehiclePropertyType::BOOLEAN) | + toInt(propertyutils_impl::VehicleArea::DOOR); +constexpr int VENDOR_EXTENSION_FLOAT_PROPERTY = + 0x102 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(propertyutils_impl::VehiclePropertyType::FLOAT) | + toInt(propertyutils_impl::VehicleArea::SEAT); +constexpr int VENDOR_EXTENSION_INT_PROPERTY = + 0x103 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(propertyutils_impl::VehiclePropertyType::INT32) | + toInt(propertyutils_impl::VehicleArea::WINDOW); +constexpr int VENDOR_EXTENSION_STRING_PROPERTY = + 0x104 | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(propertyutils_impl::VehiclePropertyType::STRING) | + toInt(propertyutils_impl::VehicleArea::GLOBAL); +constexpr int FUEL_DOOR_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT); +constexpr int CHARGE_PORT_FRONT_LEFT = toInt(propertyutils_impl::PortLocationType::FRONT_LEFT); +constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT); +constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON); +constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC); +constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT); +constexpr int WHEEL_FRONT_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_FRONT); +constexpr int WHEEL_REAR_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_REAR); +constexpr int WHEEL_REAR_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_REAR); +constexpr int ALL_WHEELS = + WHEEL_FRONT_LEFT | WHEEL_FRONT_RIGHT | WHEEL_REAR_LEFT | WHEEL_REAR_RIGHT; +constexpr int HVAC_LEFT = SEAT_1_LEFT | SEAT_2_LEFT | SEAT_2_CENTER; +constexpr int HVAC_RIGHT = SEAT_1_RIGHT | SEAT_2_RIGHT; +constexpr int HVAC_ALL = HVAC_LEFT | HVAC_RIGHT; + +const int32_t HVAC_POWER_PROPERTIES[] = { + toInt(propertyutils_impl::VehicleProperty::HVAC_FAN_SPEED), + toInt(propertyutils_impl::VehicleProperty::HVAC_FAN_DIRECTION), +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_PropertyUtils_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h b/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h new file mode 100644 index 0000000000000000000000000000000000000000..5f0f7161c2e64856e32426f10fe031f4237b0f7a --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_RecurrentTimer_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_include_RecurrentTimer_H_ + +#include + +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// A thread-safe recurrent timer. +class RecurrentTimer final { + public: + // The class for the function that would be called recurrently. + using Callback = std::function; + + RecurrentTimer(); + + ~RecurrentTimer(); + + // Registers a recurrent callback for a given interval. + // Registering the same callback twice will override the interval provided before. + void registerTimerCallback(int64_t intervalInNano, std::shared_ptr callback); + + // Unregisters a previously registered recurrent callback. + void unregisterTimerCallback(std::shared_ptr callback); + + private: + // friend class for unit testing. + friend class RecurrentTimerTest; + + struct CallbackInfo { + std::shared_ptr callback; + int64_t interval; + int64_t nextTime; + // A flag to indicate whether this CallbackInfo is already outdated and should be ignored. + // The reason we need this flag is because we cannot easily remove an element from a heap. + bool outdated = false; + + static bool cmp(const std::unique_ptr& lhs, + const std::unique_ptr& rhs); + }; + + std::mutex mLock; + std::thread mThread; + std::condition_variable mCond; + bool mStopRequested GUARDED_BY(mLock) = false; + // A map to map each callback to its current active CallbackInfo in the mCallbackQueue. + std::unordered_map, CallbackInfo*> mCallbacks GUARDED_BY(mLock); + // A min-heap sorted by nextTime. Note that because we cannot remove arbitrary element from the + // heap, a single Callback can have multiple entries in this queue, all but one should be valid. + // The rest should be mark as outdated. The valid one is one stored in mCallbacks. + std::vector> mCallbackQueue GUARDED_BY(mLock); + + void loop(); + + // Mark the callbackInfo as outdated and should be ignored when popped from the heap. + void markOutdatedLocked(CallbackInfo* callback) REQUIRES(mLock); + // Remove all outdated callbackInfos from the top of the heap. This function must be called + // each time we might introduce outdated elements to the top. We must make sure the heap is + // always valid from the top. + void removeInvalidCallbackLocked() REQUIRES(mLock); + // Pops the next closest callback (must be valid) from the heap. + std::unique_ptr popNextCallbackLocked() REQUIRES(mLock); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_RecurrentTimer_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..a7fcdcf99d1ed8c5b1eda62581399f1e424a9eb6 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ +#define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h new file mode 100644 index 0000000000000000000000000000000000000000..6e812d1d40db8ed1f6c776907a59d884309fcf09 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleObjectPool.h @@ -0,0 +1,293 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_utils_include_VehicleObjectPool_H_ +#define android_hardware_automotive_vehicle_utils_include_VehicleObjectPool_H_ + +#include +#include +#include +#include + +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// Handy metric mostly for unit tests and debug. +#define INC_METRIC_IF_DEBUG(val) PoolStats::instance()->val++; + +struct PoolStats { + std::atomic Obtained{0}; + std::atomic Created{0}; + std::atomic Recycled{0}; + std::atomic Deleted{0}; + + static PoolStats* instance() { + static PoolStats inst; + return &inst; + } +}; + +template +struct Deleter { + using OnDeleteFunc = std::function; + + explicit Deleter(const OnDeleteFunc& f) : mOnDelete(f){}; + + Deleter() = default; + Deleter(const Deleter&) = default; + + void operator()(T* o) { mOnDelete(o); } + + private: + OnDeleteFunc mOnDelete; +}; + +// This is std::unique_ptr<> with custom delete operation that typically moves the pointer it holds +// back to ObjectPool. +template +using recyclable_ptr = typename std::unique_ptr>; + +// Generic abstract object pool class. Users of this class must implement {@Code createObject}. +// +// This class is thread-safe. Concurrent calls to {@Code obtain} from multiple threads is OK, also +// client can obtain an object in one thread and then move ownership to another thread. +template +class ObjectPool { + public: + using GetSizeFunc = std::function; + + ObjectPool(size_t maxPoolObjectsSize, GetSizeFunc getSizeFunc) + : mMaxPoolObjectsSize(maxPoolObjectsSize), mGetSizeFunc(getSizeFunc){}; + virtual ~ObjectPool() = default; + + virtual recyclable_ptr obtain() { + std::scoped_lock lock(mLock); + INC_METRIC_IF_DEBUG(Obtained) + if (mObjects.empty()) { + INC_METRIC_IF_DEBUG(Created) + return wrap(createObject()); + } + + auto o = wrap(mObjects.front().release()); + mObjects.pop_front(); + mPoolObjectsSize -= mGetSizeFunc(*o); + return o; + } + + ObjectPool& operator=(const ObjectPool&) = delete; + ObjectPool(const ObjectPool&) = delete; + + protected: + virtual T* createObject() = 0; + + virtual void recycle(T* o) { + std::scoped_lock lock(mLock); + size_t objectSize = mGetSizeFunc(*o); + + if (objectSize > mMaxPoolObjectsSize || + mPoolObjectsSize > mMaxPoolObjectsSize - objectSize) { + INC_METRIC_IF_DEBUG(Deleted) + + // We have no space left in the pool. + delete o; + return; + } + + INC_METRIC_IF_DEBUG(Recycled) + + mObjects.push_back(std::unique_ptr{o}); + mPoolObjectsSize += objectSize; + } + + const size_t mMaxPoolObjectsSize; + + private: + const Deleter& getDeleter() { + if (!mDeleter.get()) { + Deleter* d = + new Deleter(std::bind(&ObjectPool::recycle, this, std::placeholders::_1)); + mDeleter.reset(d); + } + return *mDeleter.get(); + } + + recyclable_ptr wrap(T* raw) { return recyclable_ptr{raw, getDeleter()}; } + + mutable std::mutex mLock; + std::deque> mObjects GUARDED_BY(mLock); + std::unique_ptr> mDeleter; + size_t mPoolObjectsSize GUARDED_BY(mLock); + GetSizeFunc mGetSizeFunc; +}; + +#undef INC_METRIC_IF_DEBUG + +// This class provides a pool of recyclable VehiclePropertyValue objects. +// +// It has only one overloaded public method - obtain(...), users must call this method when new +// object is needed with given VehiclePropertyType and vector size (for vector properties). This +// method returns a recyclable smart pointer to VehiclePropertyValue, essentially this is a +// std::unique_ptr with custom delete function, so recyclable object has only one owner and +// developers can safely pass it around. Once this object goes out of scope, it will be returned to +// the object pool. +// +// Some objects are not recyclable: strings and vector data types with vector +// length > maxRecyclableVectorSize (provided in the constructor). These objects will be deleted +// immediately once the go out of scope. There's no synchronization penalty for these objects since +// we do not store them in the pool. +// +// This class is thread-safe. Users can obtain an object in one thread and pass it to another. +// +// Sample usage: +// +// VehiclePropValuePool pool; +// auto v = pool.obtain(VehiclePropertyType::INT32); +// v->propId = VehicleProperty::HVAC_FAN_SPEED; +// v->areaId = VehicleAreaSeat::ROW_1_LEFT; +// v->timestamp = elapsedRealtimeNano(); +// v->value->int32Values[0] = 42; +class VehiclePropValuePool { + public: + using RecyclableType = + recyclable_ptr; + + // Creates VehiclePropValuePool + // + // @param maxRecyclableVectorSize - vector value types (e.g. VehiclePropertyType::INT32_VEC) + // with size equal or less to this value will be stored in the pool. If users tries to obtain + // value with vector size greater than maxRecyclableVectorSize, user will receive a regular + // unique pointer instead of a recyclable pointer. The object would not be recycled once it + // goes out of scope, but would be deleted. + // @param maxPoolObjectsSize - The approximate upper bound of memory each internal recycling + // pool could take. We have 4 different type pools, each with 4 different vector size, so + // approximately this pool would at-most take 4 * 4 * 10240 = 160k memory. + VehiclePropValuePool(size_t maxRecyclableVectorSize = 4, size_t maxPoolObjectsSize = 10240) + : mMaxRecyclableVectorSize(maxRecyclableVectorSize), + mMaxPoolObjectsSize(maxPoolObjectsSize){}; + + // Obtain a recyclable VehiclePropertyValue object from the pool for the given type. If the + // given type is not MIXED or STRING, the internal value vector size would be set to 1. + // If the given type is MIXED or STRING, all the internal vector sizes would be initialized to + // 0. + RecyclableType obtain(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type); + + // Obtain a recyclable VehiclePropertyValue object from the pool for the given type. If the + // given type is *_VEC or BYTES, the internal value vector size would be set to vectorSize. If + // the given type is BOOLEAN, INT32, FLOAT, or INT64, the internal value vector size would be + // set to 1. If the given type is MIXED or STRING, all the internal value vector sizes would be + // set to 0. vectorSize must be larger than 0. + RecyclableType obtain(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type, + size_t vectorSize); + // Obtain a recyclable VehicePropertyValue object that is a copy of src. If src does not contain + // any value or the src property type is not valid, this function would return an empty + // VehiclePropValue. + RecyclableType obtain( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& src); + // Obtain a recyclable boolean object. + RecyclableType obtainBoolean(bool value); + // Obtain a recyclable int32 object. + RecyclableType obtainInt32(int32_t value); + // Obtain a recyclable int64 object. + RecyclableType obtainInt64(int64_t value); + // Obtain a recyclable float object. + RecyclableType obtainFloat(float value); + // Obtain a recyclable float object. + RecyclableType obtainString(const char* cstr); + // Obtain a recyclable mixed object. + RecyclableType obtainComplex(); + + VehiclePropValuePool(VehiclePropValuePool&) = delete; + VehiclePropValuePool& operator=(VehiclePropValuePool&) = delete; + + private: + static inline bool isSingleValueType( + aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) { + return type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN || + type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32 || + type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64 || + type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT; + } + + static inline bool isComplexType( + aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) { + return type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED || + type == aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING; + } + + bool isDisposable(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type, + size_t vectorSize) const { + return vectorSize > mMaxRecyclableVectorSize || isComplexType(type); + } + + RecyclableType obtainDisposable( + aidl::android::hardware::automotive::vehicle::VehiclePropertyType valueType, + size_t vectorSize) const; + RecyclableType obtainRecyclable( + aidl::android::hardware::automotive::vehicle::VehiclePropertyType type, + size_t vectorSize); + + class InternalPool + : public ObjectPool { + public: + InternalPool(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type, + size_t vectorSize, size_t maxPoolObjectsSize, + ObjectPool::GetSizeFunc getSizeFunc) + : ObjectPool(maxPoolObjectsSize, getSizeFunc), + mPropType(type), + mVectorSize(vectorSize) {} + + protected: + aidl::android::hardware::automotive::vehicle::VehiclePropValue* createObject() override; + void recycle(aidl::android::hardware::automotive::vehicle::VehiclePropValue* o) override; + + private: + bool check(aidl::android::hardware::automotive::vehicle::RawPropValues* v); + + template + bool check(std::vector* vec, bool isVectorType) { + return vec->size() == (isVectorType ? mVectorSize : 0); + } + + private: + aidl::android::hardware::automotive::vehicle::VehiclePropertyType mPropType; + size_t mVectorSize; + }; + const Deleter + mDisposableDeleter{ + [](aidl::android::hardware::automotive::vehicle::VehiclePropValue* v) { + delete v; + }}; + + mutable std::mutex mLock; + const size_t mMaxRecyclableVectorSize; + const size_t mMaxPoolObjectsSize; + // A map with 'property_type' | 'value_vector_size' as key and a recyclable object pool as + // value. We would create a recyclable pool for each property type and vector size combination. + std::map> mValueTypePools GUARDED_BY(mLock); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_utils_include_VehicleObjectPool_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h new file mode 100644 index 0000000000000000000000000000000000000000..ddc4f684aa9f4f79fdceaba2436e90f22ee92d22 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h @@ -0,0 +1,159 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehiclePropertyStore_H_ +#define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehiclePropertyStore_H_ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// Encapsulates work related to storing and accessing configuration, storing and modifying +// vehicle property values. +// +// VehiclePropertyValues stored in a sorted map thus it makes easier to get range of values, e.g. +// to get value for all areas for particular property. +// +// This class is thread-safe, however it uses blocking synchronization across all methods. +class VehiclePropertyStore final { + public: + using ValueResultType = VhalResult; + using ValuesResultType = VhalResult>; + + explicit VehiclePropertyStore(std::shared_ptr valuePool) + : mValuePool(valuePool) {} + + ~VehiclePropertyStore(); + + // Callback when a property value has been updated or a new value added. + using OnValueChangeCallback = std::function; + + // Function that used to calculate unique token for given VehiclePropValue. + using TokenFunction = std::function; + + // Register the given property according to the config. A property has to be registered first + // before write/read. If tokenFunc is not nullptr, it would be used to generate a unique + // property token to act as the key the property store. Otherwise, {propertyID, areaID} would be + // used as the key. + void registerProperty( + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config, + TokenFunction tokenFunc = nullptr); + + // Stores provided value. Returns error if config wasn't registered. If 'updateStatus' is + // true, the 'status' in 'propValue' would be stored. Otherwise, if this is a new value, + // 'status' would be initialized to {@code VehiclePropertyStatus::AVAILABLE}, if this is to + // override an existing value, the status for the existing value would be used for the + // overridden value. + VhalResult writeValue(VehiclePropValuePool::RecyclableType propValue, + bool updateStatus = false); + + // Remove a given property value from the property store. The 'propValue' would be used to + // generate the key for the value to remove. + void removeValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); + + // Remove all the values for the property. + void removeValuesForProperty(int32_t propId); + + // Read all the stored values. + std::vector readAllValues() const; + + // Read all the values for the property. + ValuesResultType readValuesForProperty(int32_t propId) const; + + // Read the value for the requested property. Returns {@code StatusCode::NOT_AVAILABLE} if the + // value has not been set yet. Returns {@code StatusCode::INVALID_ARG} if the property is + // not configured. + ValueResultType readValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& request) const; + + // Read the value for the requested property. Returns {@code StatusCode::NOT_AVAILABLE} if the + // value has not been set yet. Returns {@code StatusCode::INVALID_ARG} if the property is + // not configured. + ValueResultType readValue(int32_t prop, int32_t area = 0, int64_t token = 0) const; + + // Get all property configs. + std::vector getAllConfigs() + const; + + // Get the property config for the requested property. + android::base::Result + getConfig(int32_t propId) const; + + // Set a callback that would be called when a property value has been updated. + void setOnValueChangeCallback(const OnValueChangeCallback& callback); + + inline std::shared_ptr getValuePool() { return mValuePool; } + + private: + struct RecordId { + int32_t area; + int64_t token; + + std::string toString() const; + + bool operator==(const RecordId& other) const; + }; + + struct RecordIdHash { + size_t operator()(RecordId const& recordId) const; + }; + + struct Record { + aidl::android::hardware::automotive::vehicle::VehiclePropConfig propConfig; + TokenFunction tokenFunction; + std::unordered_map values; + }; + + // {@code VehiclePropValuePool} is thread-safe. + std::shared_ptr mValuePool; + mutable std::mutex mLock; + std::unordered_map mRecordsByPropId GUARDED_BY(mLock); + OnValueChangeCallback mOnValueChangeCallback GUARDED_BY(mLock); + + const Record* getRecordLocked(int32_t propId) const; + + Record* getRecordLocked(int32_t propId); + + RecordId getRecordIdLocked( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue, + const Record& record) const; + + ValueResultType readValueLocked(const RecordId& recId, const Record& record) const; +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehiclePropertyStore_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..c94bad6ca6f9b13bb574773bb23bd8d0df438fd1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleUtils.h @@ -0,0 +1,337 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleUtils_H_ +#define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleUtils_H_ + +#include + +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// Represents all supported areas for a property. +constexpr int32_t kAllSupportedAreas = 0; + +// Returns underlying (integer) value for given enum. +template ::type> +inline constexpr U toInt(ENUM const value) { + return static_cast(value); +} + +inline constexpr aidl::android::hardware::automotive::vehicle::VehiclePropertyType getPropType( + int32_t prop) { + return static_cast( + prop & toInt(aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MASK)); +} + +inline constexpr aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup getPropGroup( + int32_t prop) { + return static_cast( + prop & toInt(aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup::MASK)); +} + +inline constexpr aidl::android::hardware::automotive::vehicle::VehicleArea getPropArea( + int32_t prop) { + return static_cast( + prop & toInt(aidl::android::hardware::automotive::vehicle::VehicleArea::MASK)); +} + +inline constexpr bool isGlobalProp(int32_t prop) { + return getPropArea(prop) == aidl::android::hardware::automotive::vehicle::VehicleArea::GLOBAL; +} + +inline constexpr bool isSystemProp(int32_t prop) { + return aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup::SYSTEM == + getPropGroup(prop); +} + +inline const aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* getAreaConfig( + int32_t propId, int32_t areaId, + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config) { + if (config.areaConfigs.size() == 0) { + return nullptr; + } + + if (isGlobalProp(propId)) { + return &(config.areaConfigs[0]); + } + + for (const auto& c : config.areaConfigs) { + if (c.areaId == areaId) { + return &c; + } + } + return nullptr; +} + +inline const aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* getAreaConfig( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue, + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig& config) { + return getAreaConfig(propValue.prop, propValue.areaId, config); +} + +inline std::unique_ptr +createVehiclePropValueVec(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type, + size_t vecSize) { + auto val = std::unique_ptr( + new aidl::android::hardware::automotive::vehicle::VehiclePropValue); + switch (type) { + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32: + [[fallthrough]]; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN: + vecSize = 1; + [[fallthrough]]; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC: + val->value.int32Values.resize(vecSize); + break; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT: + vecSize = 1; + [[fallthrough]]; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC: + val->value.floatValues.resize(vecSize); + break; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64: + vecSize = 1; + [[fallthrough]]; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC: + val->value.int64Values.resize(vecSize); + break; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES: + val->value.byteValues.resize(vecSize); + break; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING: + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED: + break; // Valid, but nothing to do. + default: + ALOGE("createVehiclePropValue: unknown type: %d", toInt(type)); + val.reset(nullptr); + } + return val; +} + +inline std::unique_ptr +createVehiclePropValue(aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) { + return createVehiclePropValueVec(type, 1); +} + +inline size_t getVehicleRawValueVectorSize( + const aidl::android::hardware::automotive::vehicle::RawPropValues& value, + aidl::android::hardware::automotive::vehicle::VehiclePropertyType type) { + switch (type) { + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32: + [[fallthrough]]; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BOOLEAN: + return std::min(value.int32Values.size(), static_cast(1)); + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT: + return std::min(value.floatValues.size(), static_cast(1)); + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64: + return std::min(value.int64Values.size(), static_cast(1)); + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT32_VEC: + return value.int32Values.size(); + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::FLOAT_VEC: + return value.floatValues.size(); + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::INT64_VEC: + return value.int64Values.size(); + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::BYTES: + return value.byteValues.size(); + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::STRING: + [[fallthrough]]; + case aidl::android::hardware::automotive::vehicle::VehiclePropertyType::MIXED: + return 0; + default: + ALOGE("getVehicleRawValueVectorSize: unknown type: %d", toInt(type)); + return 0; + } +} + +inline void copyVehicleRawValue( + aidl::android::hardware::automotive::vehicle::RawPropValues* dest, + const aidl::android::hardware::automotive::vehicle::RawPropValues& src) { + dest->int32Values = src.int32Values; + dest->floatValues = src.floatValues; + dest->int64Values = src.int64Values; + dest->byteValues = src.byteValues; + dest->stringValue = src.stringValue; +} + +// getVehiclePropValueSize returns approximately how much memory 'value' would take. This should +// only be used in a limited-size memory pool to set an upper bound for memory consumption. +inline size_t getVehiclePropValueSize( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& prop) { + size_t size = 0; + size += sizeof(prop.timestamp); + size += sizeof(prop.areaId); + size += sizeof(prop.prop); + size += sizeof(prop.status); + size += prop.value.int32Values.size() * sizeof(int32_t); + size += prop.value.int64Values.size() * sizeof(int64_t); + size += prop.value.floatValues.size() * sizeof(float); + size += prop.value.byteValues.size() * sizeof(uint8_t); + size += prop.value.stringValue.size(); + return size; +} + +// Check whether the value is valid according to config. +// We check for the following: +// * If the type is INT32, {@code value.int32Values} must contain one element. +// * If the type is INT32_VEC, {@code value.int32Values} must contain at least one element. +// * If the type is INT64, {@code value.int64Values} must contain one element. +// * If the type is INT64_VEC, {@code value.int64Values} must contain at least one element. +// * If the type is FLOAT, {@code value.floatValues} must contain one element. +// * If the type is FLOAT_VEC, {@code value.floatValues} must contain at least one element. +// * If the type is MIXED, see checkVendorMixedPropValue. +android::base::Result checkPropValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig* config); + +// Check whether the Mixed type value is valid according to config. +// We check for the following: +// * configArray[1] + configArray[2] + configArray[3] must be equal to the number of +// {@code value.int32Values} elements. +// * configArray[4] + configArray[5] must be equal to the number of {@code value.int64Values} +// elements. +// * configArray[6] + configArray[7] must be equal to the number of {@code value.floatValues} +// elements. +// * configArray[8] must be equal to the number of {@code value.byteValues} elements. +android::base::Result checkVendorMixedPropValue( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, + const aidl::android::hardware::automotive::vehicle::VehiclePropConfig* config); + +// Check whether the value is within the configured range. +// We check for the following types: +// * If type is INT32 or INT32_VEC, all {@code value.int32Values} elements must be within +// {@code minInt32Value} and {@code maxInt32Value} if either of them is not 0. +// * If type is INT64 or INT64_VEC, all {@code value.int64Values} elements must be within +// {@code minInt64Value} and {@code maxInt64Value} if either of them is not 0. +// * If type is FLOAT or FLOAT_VEC, all {@code value.floatValues} elements must be within +// {@code minFloatValues} and {@code maxFloatValues} if either of them is not 0. +// We don't check other types. If more checks are required, they should be added in VehicleHardware +// implementation. +android::base::Result checkValueRange( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, + const aidl::android::hardware::automotive::vehicle::VehicleAreaConfig* config); + +// VhalError is a wrapper class for {@code StatusCode} that could act as E in {@code Result}. +class VhalError final { + public: + VhalError() : mCode(aidl::android::hardware::automotive::vehicle::StatusCode::OK) {} + + VhalError(aidl::android::hardware::automotive::vehicle::StatusCode&& code) : mCode(code) {} + + VhalError(const aidl::android::hardware::automotive::vehicle::StatusCode& code) : mCode(code) {} + + aidl::android::hardware::automotive::vehicle::StatusCode value() const; + + inline operator aidl::android::hardware::automotive::vehicle::StatusCode() const { + return value(); + } + + std::string print() const; + + private: + aidl::android::hardware::automotive::vehicle::StatusCode mCode; +}; + +// VhalResult is a {@code Result} that contains {@code StatusCode} as error type. +template +using VhalResult = android::base::Result; + +// StatusError could be cast to {@code ResultError} with a {@code StatusCode} and should be used +// as error type for {@VhalResult}. +using StatusError = android::base::Error; + +template +aidl::android::hardware::automotive::vehicle::StatusCode getErrorCode(const VhalResult& result) { + if (result.ok()) { + return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + } + return result.error().code(); +} + +template +int getIntErrorCode(const VhalResult& result) { + return toInt(getErrorCode(result)); +} + +template +std::string getErrorMsg(const android::base::Result& result) { + if (result.ok()) { + return ""; + } + return result.error().message(); +} + +template +ndk::ScopedAStatus toScopedAStatus(const android::base::Result& result, + aidl::android::hardware::automotive::vehicle::StatusCode status, + const std::string& additionalErrorMsg) { + if (result.ok()) { + return ndk::ScopedAStatus::ok(); + } + return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage( + toInt(status), + fmt::format("{}, error: {}", additionalErrorMsg, getErrorMsg(result)).c_str()); +} + +template +ndk::ScopedAStatus toScopedAStatus( + const android::base::Result& result, + aidl::android::hardware::automotive::vehicle::StatusCode status) { + return toScopedAStatus(result, status, ""); +} + +template +ndk::ScopedAStatus toScopedAStatus(const VhalResult& result) { + return toScopedAStatus(result, getErrorCode(result)); +} + +template +ndk::ScopedAStatus toScopedAStatus(const VhalResult& result, + const std::string& additionalErrorMsg) { + return toScopedAStatus(result, getErrorCode(result), additionalErrorMsg); +} + +struct PropIdAreaId { + int32_t propId; + int32_t areaId; + + inline bool operator==(const PropIdAreaId& other) const { + return areaId == other.areaId && propId == other.propId; + } +}; + +struct PropIdAreaIdHash { + inline size_t operator()(const PropIdAreaId& propIdAreaId) const { + size_t res = 0; + hashCombine(res, propIdAreaId.propId); + hashCombine(res, propIdAreaId.areaId); + return res; + } +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleUtils_H_ diff --git a/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp b/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0196edd2ca4d29dbafc1ef82d42d0547dc30810d --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp @@ -0,0 +1,231 @@ +/* + * 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. + */ + +#include "PendingRequestPool.h" + +#include +#include + +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::android::base::Result; + +// At least check every 1s. +constexpr int64_t CHECK_TIME_IN_NANO = 1'000'000'000; + +} // namespace + +PendingRequestPool::PendingRequestPool(int64_t timeoutInNano) + : mTimeoutInNano(timeoutInNano), mThread([this] { + // [this] must be alive within this thread because destructor would wait for this thread + // to exit. + int64_t sleepTime = std::min(mTimeoutInNano, static_cast(CHECK_TIME_IN_NANO)); + std::unique_lock lk(mCvLock); + while (!mCv.wait_for(lk, std::chrono::nanoseconds(sleepTime), + [this] { return mThreadStop.load(); })) { + checkTimeout(); + } + }) {} + +PendingRequestPool::~PendingRequestPool() { + mThreadStop = true; + mCv.notify_all(); + if (mThread.joinable()) { + mThread.join(); + } + + // If this pool is being destructed, send out all pending requests as timeout. + { + std::scoped_lock lockGuard(mLock); + + for (auto& [_, pendingRequests] : mPendingRequestsByClient) { + for (const auto& request : pendingRequests) { + (*request.callback)(request.requestIds); + } + } + mPendingRequestsByClient.clear(); + } +} + +VhalResult PendingRequestPool::addRequests( + const void* clientId, const std::unordered_set& requestIds, + std::shared_ptr callback) { + std::scoped_lock lockGuard(mLock); + std::list* pendingRequests; + size_t pendingRequestCount = 0; + if (mPendingRequestsByClient.find(clientId) != mPendingRequestsByClient.end()) { + pendingRequests = &mPendingRequestsByClient[clientId]; + for (const auto& pendingRequest : *pendingRequests) { + const auto& pendingRequestIds = pendingRequest.requestIds; + for (int64_t requestId : requestIds) { + if (pendingRequestIds.find(requestId) != pendingRequestIds.end()) { + return StatusError(StatusCode::INVALID_ARG) + << "duplicate request ID: " << requestId; + } + } + pendingRequestCount += pendingRequestIds.size(); + } + } else { + // Create a new empty list for this client. + pendingRequests = &mPendingRequestsByClient[clientId]; + } + + if (requestIds.size() > MAX_PENDING_REQUEST_PER_CLIENT - pendingRequestCount) { + return StatusError(StatusCode::TRY_AGAIN) << "too many pending requests"; + } + + int64_t currentTime = elapsedRealtimeNano(); + int64_t timeoutTimestamp = currentTime + mTimeoutInNano; + + pendingRequests->push_back({ + .requestIds = std::unordered_set(requestIds.begin(), requestIds.end()), + .timeoutTimestamp = timeoutTimestamp, + .callback = callback, + }); + + return {}; +} + +bool PendingRequestPool::isRequestPending(const void* clientId, int64_t requestId) const { + std::scoped_lock lockGuard(mLock); + + return isRequestPendingLocked(clientId, requestId); +} + +size_t PendingRequestPool::countPendingRequests() const { + std::scoped_lock lockGuard(mLock); + + size_t count = 0; + for (const auto& [clientId, requests] : mPendingRequestsByClient) { + for (const auto& request : requests) { + count += request.requestIds.size(); + } + } + return count; +} + +size_t PendingRequestPool::countPendingRequests(const void* clientId) const { + std::scoped_lock lockGuard(mLock); + + auto it = mPendingRequestsByClient.find(clientId); + if (it == mPendingRequestsByClient.end()) { + return 0; + } + + size_t count = 0; + for (const auto& pendingRequest : it->second) { + count += pendingRequest.requestIds.size(); + } + + return count; +} + +bool PendingRequestPool::isRequestPendingLocked(const void* clientId, int64_t requestId) const { + auto it = mPendingRequestsByClient.find(clientId); + if (it == mPendingRequestsByClient.end()) { + return false; + } + for (const auto& pendingRequest : it->second) { + const auto& requestIds = pendingRequest.requestIds; + if (requestIds.find(requestId) != requestIds.end()) { + return true; + } + } + return false; +} + +void PendingRequestPool::checkTimeout() { + std::vector timeoutRequests; + { + std::scoped_lock lockGuard(mLock); + + int64_t currentTime = elapsedRealtimeNano(); + + std::vector clientsWithEmptyRequests; + + for (auto& [clientId, pendingRequests] : mPendingRequestsByClient) { + auto it = pendingRequests.begin(); + while (it != pendingRequests.end()) { + if (it->timeoutTimestamp >= currentTime) { + break; + } + timeoutRequests.push_back(std::move(*it)); + it = pendingRequests.erase(it); + } + + if (pendingRequests.empty()) { + clientsWithEmptyRequests.push_back(clientId); + } + } + + for (const void* clientId : clientsWithEmptyRequests) { + mPendingRequestsByClient.erase(clientId); + } + } + + // Call the callback outside the lock. + for (const auto& request : timeoutRequests) { + (*request.callback)(request.requestIds); + } +} + +std::unordered_set PendingRequestPool::tryFinishRequests( + const void* clientId, const std::unordered_set& requestIds) { + std::scoped_lock lockGuard(mLock); + + std::unordered_set foundIds; + + if (mPendingRequestsByClient.find(clientId) == mPendingRequestsByClient.end()) { + return foundIds; + } + + auto& pendingRequests = mPendingRequestsByClient[clientId]; + auto it = pendingRequests.begin(); + while (it != pendingRequests.end()) { + auto& pendingRequestIds = it->requestIds; + for (int64_t requestId : requestIds) { + auto idIt = pendingRequestIds.find(requestId); + if (idIt == pendingRequestIds.end()) { + continue; + } + pendingRequestIds.erase(idIt); + foundIds.insert(requestId); + } + if (pendingRequestIds.empty()) { + it = pendingRequests.erase(it); + continue; + } + it++; + } + + return foundIds; +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8521c4db7c381c50332d754779baffffa19f8c1c --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp @@ -0,0 +1,177 @@ +/* + * 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. + */ + +#include "RecurrentTimer.h" + +#include +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::android::base::ScopedLockAssertion; + +RecurrentTimer::RecurrentTimer() : mThread(&RecurrentTimer::loop, this) {} + +RecurrentTimer::~RecurrentTimer() { + { + std::scoped_lock lockGuard(mLock); + mStopRequested = true; + } + mCond.notify_one(); + if (mThread.joinable()) { + mThread.join(); + } +} + +void RecurrentTimer::registerTimerCallback(int64_t intervalInNano, + std::shared_ptr callback) { + { + std::scoped_lock lockGuard(mLock); + + // Aligns the nextTime to multiply of interval. + int64_t nextTime = ceil(elapsedRealtimeNano() / intervalInNano) * intervalInNano; + + std::unique_ptr info = std::make_unique(); + info->callback = callback; + info->interval = intervalInNano; + info->nextTime = nextTime; + + auto it = mCallbacks.find(callback); + if (it != mCallbacks.end()) { + ALOGI("Replacing an existing timer callback with a new interval, current: %" PRId64 + " ns, new: %" PRId64 " ns", + it->second->interval, intervalInNano); + markOutdatedLocked(it->second); + } + mCallbacks[callback] = info.get(); + mCallbackQueue.push_back(std::move(info)); + // Insert the last element into the heap. + std::push_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); + } + mCond.notify_one(); +} + +void RecurrentTimer::unregisterTimerCallback(std::shared_ptr callback) { + { + std::scoped_lock lockGuard(mLock); + + auto it = mCallbacks.find(callback); + if (it == mCallbacks.end()) { + ALOGE("No event found to unregister"); + return; + } + + markOutdatedLocked(it->second); + mCallbacks.erase(it); + } + + mCond.notify_one(); +} + +void RecurrentTimer::markOutdatedLocked(RecurrentTimer::CallbackInfo* info) { + info->outdated = true; + info->callback = nullptr; + // Make sure the first element is always valid. + removeInvalidCallbackLocked(); +} + +void RecurrentTimer::removeInvalidCallbackLocked() { + while (mCallbackQueue.size() != 0 && mCallbackQueue[0]->outdated) { + std::pop_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); + mCallbackQueue.pop_back(); + } +} + +std::unique_ptr RecurrentTimer::popNextCallbackLocked() { + std::pop_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); + std::unique_ptr info = std::move(mCallbackQueue[mCallbackQueue.size() - 1]); + mCallbackQueue.pop_back(); + // Make sure the first element is always valid. + removeInvalidCallbackLocked(); + return info; +} + +void RecurrentTimer::loop() { + std::unique_lock uniqueLock(mLock); + + while (true) { + // Wait until the timer exits or we have at least one recurrent callback. + mCond.wait(uniqueLock, [this] { + ScopedLockAssertion lockAssertion(mLock); + return mStopRequested || mCallbackQueue.size() != 0; + }); + + int64_t interval; + { + ScopedLockAssertion lockAssertion(mLock); + if (mStopRequested) { + return; + } + // The first element is the nearest next event. + int64_t nextTime = mCallbackQueue[0]->nextTime; + int64_t now = elapsedRealtimeNano(); + if (nextTime > now) { + interval = nextTime - now; + } else { + interval = 0; + } + } + + // Wait for the next event or the timer exits. + if (mCond.wait_for(uniqueLock, std::chrono::nanoseconds(interval), [this] { + ScopedLockAssertion lockAssertion(mLock); + return mStopRequested; + })) { + return; + } + + { + ScopedLockAssertion lockAssertion(mLock); + int64_t now = elapsedRealtimeNano(); + while (mCallbackQueue.size() > 0) { + int64_t nextTime = mCallbackQueue[0]->nextTime; + if (nextTime > now) { + break; + } + + std::unique_ptr info = popNextCallbackLocked(); + info->nextTime += info->interval; + + auto callback = info->callback; + mCallbackQueue.push_back(std::move(info)); + std::push_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); + + (*callback)(); + } + } + } +} + +bool RecurrentTimer::CallbackInfo::cmp(const std::unique_ptr& lhs, + const std::unique_ptr& rhs) { + return lhs->nextTime > rhs->nextTime; +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehicleObjectPool.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehicleObjectPool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2480a7362e940a3704536e60beb3ebca08ca1b5e --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehicleObjectPool.cpp @@ -0,0 +1,167 @@ +/* + * 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_TAG "VehicleObjectPool" + +#include + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtain(VehiclePropertyType type) { + if (isComplexType(type)) { + return obtain(type, 0); + } + return obtain(type, 1); +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtain(VehiclePropertyType type, + size_t vectorSize) { + if (isSingleValueType(type)) { + vectorSize = 1; + } else if (isComplexType(type)) { + vectorSize = 0; + } + return isDisposable(type, vectorSize) ? obtainDisposable(type, vectorSize) + : obtainRecyclable(type, vectorSize); +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtain(const VehiclePropValue& src) { + int propId = src.prop; + VehiclePropertyType type = getPropType(propId); + size_t vectorSize = getVehicleRawValueVectorSize(src.value, type); + if (vectorSize == 0 && !isComplexType(type)) { + ALOGW("empty vehicle prop value, contains no content"); + ALOGW("empty vehicle prop value, contains no content, prop: %d", propId); + // Return any empty VehiclePropValue. + return RecyclableType{new VehiclePropValue{}, mDisposableDeleter}; + } + + auto dest = obtain(type, vectorSize); + + dest->prop = propId; + dest->areaId = src.areaId; + dest->status = src.status; + dest->timestamp = src.timestamp; + copyVehicleRawValue(&dest->value, src.value); + + return dest; +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainInt32(int32_t value) { + auto val = obtain(VehiclePropertyType::INT32); + val->value.int32Values[0] = value; + return val; +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainInt64(int64_t value) { + auto val = obtain(VehiclePropertyType::INT64); + val->value.int64Values[0] = value; + return val; +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainFloat(float value) { + auto val = obtain(VehiclePropertyType::FLOAT); + val->value.floatValues[0] = value; + return val; +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainString(const char* cstr) { + auto val = obtain(VehiclePropertyType::STRING); + val->value.stringValue = cstr; + return val; +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainComplex() { + return obtain(VehiclePropertyType::MIXED); +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainRecyclable( + VehiclePropertyType type, size_t vectorSize) { + std::scoped_lock lock(mLock); + assert(vectorSize > 0); + + // VehiclePropertyType is not overlapping with vectorSize. + int32_t key = static_cast(type) | static_cast(vectorSize); + auto it = mValueTypePools.find(key); + + if (it == mValueTypePools.end()) { + auto newPool(std::make_unique(type, vectorSize, mMaxPoolObjectsSize, + getVehiclePropValueSize)); + it = mValueTypePools.emplace(key, std::move(newPool)).first; + } + return it->second->obtain(); +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainBoolean(bool value) { + return obtainInt32(value); +} + +VehiclePropValuePool::RecyclableType VehiclePropValuePool::obtainDisposable( + VehiclePropertyType valueType, size_t vectorSize) const { + return RecyclableType{createVehiclePropValueVec(valueType, vectorSize).release(), + mDisposableDeleter}; +} + +void VehiclePropValuePool::InternalPool::recycle(VehiclePropValue* o) { + if (o == nullptr) { + ALOGE("Attempt to recycle nullptr"); + return; + } + + if (!check(&o->value)) { + ALOGE("Discarding value for prop 0x%x because it contains " + "data that is not consistent with this pool. " + "Expected type: %d, vector size: %zu", + o->prop, toInt(mPropType), mVectorSize); + delete o; + } else { + ObjectPool::recycle(o); + } +} + +bool VehiclePropValuePool::InternalPool::check(RawPropValues* v) { + return check(&v->int32Values, (VehiclePropertyType::INT32 == mPropType || + VehiclePropertyType::INT32_VEC == mPropType || + VehiclePropertyType::BOOLEAN == mPropType)) && + check(&v->floatValues, (VehiclePropertyType::FLOAT == mPropType || + VehiclePropertyType::FLOAT_VEC == mPropType)) && + check(&v->int64Values, (VehiclePropertyType::INT64 == mPropType || + VehiclePropertyType::INT64_VEC == mPropType)) && + check(&v->byteValues, VehiclePropertyType::BYTES == mPropType) && + v->stringValue.size() == 0; +} + +VehiclePropValue* VehiclePropValuePool::InternalPool::createObject() { + return createVehiclePropValueVec(mPropType, mVectorSize).release(); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c8fb99468488ad9b83acb288ce2a29fdce1f93e9 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp @@ -0,0 +1,270 @@ +/* + * 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_TAG "VehiclePropertyStore" +#include + +#include "VehiclePropertyStore.h" + +#include +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::Result; +using ::android::base::StringPrintf; + +bool VehiclePropertyStore::RecordId::operator==(const VehiclePropertyStore::RecordId& other) const { + return area == other.area && token == other.token; +} + +std::string VehiclePropertyStore::RecordId::toString() const { + return StringPrintf("RecordID{{.areaId=% " PRId32 ", .token=%" PRId64 "}", area, token); +} + +size_t VehiclePropertyStore::RecordIdHash::operator()(RecordId const& recordId) const { + size_t res = 0; + hashCombine(res, recordId.area); + hashCombine(res, recordId.token); + return res; +} + +VehiclePropertyStore::~VehiclePropertyStore() { + std::scoped_lock lockGuard(mLock); + + // Recycling record requires mValuePool, so need to recycle them before destroying mValuePool. + mRecordsByPropId.clear(); + mValuePool.reset(); +} + +const VehiclePropertyStore::Record* VehiclePropertyStore::getRecordLocked(int32_t propId) const + REQUIRES(mLock) { + auto RecordIt = mRecordsByPropId.find(propId); + return RecordIt == mRecordsByPropId.end() ? nullptr : &RecordIt->second; +} + +VehiclePropertyStore::Record* VehiclePropertyStore::getRecordLocked(int32_t propId) + REQUIRES(mLock) { + auto RecordIt = mRecordsByPropId.find(propId); + return RecordIt == mRecordsByPropId.end() ? nullptr : &RecordIt->second; +} + +VehiclePropertyStore::RecordId VehiclePropertyStore::getRecordIdLocked( + const VehiclePropValue& propValue, const VehiclePropertyStore::Record& record) const + REQUIRES(mLock) { + VehiclePropertyStore::RecordId recId{ + .area = isGlobalProp(propValue.prop) ? 0 : propValue.areaId, .token = 0}; + + if (record.tokenFunction != nullptr) { + recId.token = record.tokenFunction(propValue); + } + return recId; +} + +VhalResult VehiclePropertyStore::readValueLocked( + const RecordId& recId, const Record& record) const REQUIRES(mLock) { + if (auto it = record.values.find(recId); it != record.values.end()) { + return mValuePool->obtain(*(it->second)); + } + return StatusError(StatusCode::NOT_AVAILABLE) + << "Record ID: " << recId.toString() << " is not found"; +} + +void VehiclePropertyStore::registerProperty(const VehiclePropConfig& config, + VehiclePropertyStore::TokenFunction tokenFunc) { + std::scoped_lock g(mLock); + + mRecordsByPropId[config.prop] = Record{ + .propConfig = config, + .tokenFunction = tokenFunc, + }; +} + +VhalResult VehiclePropertyStore::writeValue(VehiclePropValuePool::RecyclableType propValue, + bool updateStatus) { + std::scoped_lock g(mLock); + + int32_t propId = propValue->prop; + + VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return StatusError(StatusCode::INVALID_ARG) << "property: " << propId << " not registered"; + } + + if (!isGlobalProp(propId) && getAreaConfig(*propValue, record->propConfig) == nullptr) { + return StatusError(StatusCode::INVALID_ARG) + << "no config for property: " << propId << " area: " << propValue->areaId; + } + + VehiclePropertyStore::RecordId recId = getRecordIdLocked(*propValue, *record); + bool valueUpdated = true; + if (auto it = record->values.find(recId); it != record->values.end()) { + const VehiclePropValue* valueToUpdate = it->second.get(); + int64_t oldTimestamp = valueToUpdate->timestamp; + VehiclePropertyStatus oldStatus = valueToUpdate->status; + // propValue is outdated and drops it. + if (oldTimestamp > propValue->timestamp) { + return StatusError(StatusCode::INVALID_ARG) + << "outdated timestamp: " << propValue->timestamp; + } + if (!updateStatus) { + propValue->status = oldStatus; + } + + valueUpdated = (valueToUpdate->value != propValue->value || + valueToUpdate->status != propValue->status || + valueToUpdate->prop != propValue->prop || + valueToUpdate->areaId != propValue->areaId); + } else if (!updateStatus) { + propValue->status = VehiclePropertyStatus::AVAILABLE; + } + + record->values[recId] = std::move(propValue); + if (valueUpdated && mOnValueChangeCallback != nullptr) { + mOnValueChangeCallback(*(record->values[recId])); + } + return {}; +} + +void VehiclePropertyStore::removeValue(const VehiclePropValue& propValue) { + std::scoped_lock g(mLock); + + VehiclePropertyStore::Record* record = getRecordLocked(propValue.prop); + if (record == nullptr) { + return; + } + + VehiclePropertyStore::RecordId recId = getRecordIdLocked(propValue, *record); + if (auto it = record->values.find(recId); it != record->values.end()) { + record->values.erase(it); + } +} + +void VehiclePropertyStore::removeValuesForProperty(int32_t propId) { + std::scoped_lock g(mLock); + + VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return; + } + + record->values.clear(); +} + +std::vector VehiclePropertyStore::readAllValues() const { + std::scoped_lock g(mLock); + + std::vector allValues; + + for (auto const& [_, record] : mRecordsByPropId) { + for (auto const& [_, value] : record.values) { + allValues.push_back(std::move(mValuePool->obtain(*value))); + } + } + + return allValues; +} + +VehiclePropertyStore::ValuesResultType VehiclePropertyStore::readValuesForProperty( + int32_t propId) const { + std::scoped_lock g(mLock); + + std::vector values; + + const VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return StatusError(StatusCode::INVALID_ARG) << "property: " << propId << " not registered"; + } + + for (auto const& [_, value] : record->values) { + values.push_back(std::move(mValuePool->obtain(*value))); + } + return values; +} + +VehiclePropertyStore::ValueResultType VehiclePropertyStore::readValue( + const VehiclePropValue& propValue) const { + std::scoped_lock g(mLock); + + int32_t propId = propValue.prop; + const VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return StatusError(StatusCode::INVALID_ARG) << "property: " << propId << " not registered"; + } + + VehiclePropertyStore::RecordId recId = getRecordIdLocked(propValue, *record); + return readValueLocked(recId, *record); +} + +VehiclePropertyStore::ValueResultType VehiclePropertyStore::readValue(int32_t propId, + int32_t areaId, + int64_t token) const { + std::scoped_lock g(mLock); + + const VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return StatusError(StatusCode::INVALID_ARG) << "property: " << propId << " not registered"; + } + + VehiclePropertyStore::RecordId recId{.area = isGlobalProp(propId) ? 0 : areaId, .token = token}; + return readValueLocked(recId, *record); +} + +std::vector VehiclePropertyStore::getAllConfigs() const { + std::scoped_lock g(mLock); + + std::vector configs; + configs.reserve(mRecordsByPropId.size()); + for (auto& [_, config] : mRecordsByPropId) { + configs.push_back(config.propConfig); + } + return configs; +} + +VhalResult VehiclePropertyStore::getConfig(int32_t propId) const { + std::scoped_lock g(mLock); + + const VehiclePropertyStore::Record* record = getRecordLocked(propId); + if (record == nullptr) { + return StatusError(StatusCode::INVALID_ARG) << "property: " << propId << " not registered"; + } + + return &record->propConfig; +} + +void VehiclePropertyStore::setOnValueChangeCallback( + const VehiclePropertyStore::OnValueChangeCallback& callback) { + std::scoped_lock g(mLock); + + mOnValueChangeCallback = callback; +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehicleUtils.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehicleUtils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f85728d4b615e47728a538513c904f31f9dc613d --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehicleUtils.cpp @@ -0,0 +1,219 @@ +/* + * 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. + */ + +#include "VehicleUtils.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::Error; +using ::android::base::Result; +using ::ndk::ScopedAStatus; + +Result checkPropValue(const VehiclePropValue& value, const VehiclePropConfig* config) { + int32_t property = value.prop; + VehiclePropertyType type = getPropType(property); + switch (type) { + case VehiclePropertyType::BOOLEAN: + [[fallthrough]]; + case VehiclePropertyType::INT32: + if (value.value.int32Values.size() != 1) { + return Error() << "expect 1 int32Values for INT32 type"; + } + break; + case VehiclePropertyType::INT32_VEC: + if (value.value.int32Values.size() < 1) { + return Error() << "expect >=1 int32Values for INT32_VEC type"; + } + break; + case VehiclePropertyType::INT64: + if (value.value.int64Values.size() != 1) { + return Error() << "expect 1 int64Values for INT64 type"; + } + break; + case VehiclePropertyType::INT64_VEC: + if (value.value.int64Values.size() < 1) { + return Error() << "expect >=1 int64Values for INT64_VEC type"; + } + break; + case VehiclePropertyType::FLOAT: + if (value.value.floatValues.size() != 1) { + return Error() << "expect 1 floatValues for FLOAT type"; + } + break; + case VehiclePropertyType::FLOAT_VEC: + if (value.value.floatValues.size() < 1) { + return Error() << "expect >=1 floatValues for FLOAT_VEC type"; + } + break; + case VehiclePropertyType::BYTES: + // We allow setting an empty bytes array. + break; + case VehiclePropertyType::STRING: + // We allow setting an empty string. + break; + case VehiclePropertyType::MIXED: + if (getPropGroup(property) == VehiclePropertyGroup::VENDOR) { + // We only checks vendor mixed properties. + return checkVendorMixedPropValue(value, config); + } + break; + default: + return Error() << "unknown property type: " << toInt(type); + } + return {}; +} + +Result checkVendorMixedPropValue(const VehiclePropValue& value, + const VehiclePropConfig* config) { + auto configArray = config->configArray; + // configArray[0], 1 indicates the property has a String value, we allow the string value to + // be empty. + + size_t int32Count = 0; + // configArray[1], 1 indicates the property has a Boolean value. + if (configArray[1] == 1) { + int32Count++; + } + // configArray[2], 1 indicates the property has an Integer value. + if (configArray[2] == 1) { + int32Count++; + } + // configArray[3], the number indicates the size of Integer[] in the property. + int32Count += static_cast(configArray[3]); + size_t int32Size = value.value.int32Values.size(); + if (int32Size != int32Count) { + return Error() << "invalid mixed property, got " << int32Size << " int32Values, expect " + << int32Count; + } + + size_t int64Count = 0; + // configArray[4], 1 indicates the property has a Long value. + if (configArray[4] == 1) { + int64Count++; + } + // configArray[5], the number indicates the size of Long[] in the property. + int64Count += static_cast(configArray[5]); + size_t int64Size = value.value.int64Values.size(); + if (int64Size != int64Count) { + return Error() << "invalid mixed property, got " << int64Size << " int64Values, expect " + << int64Count; + } + + size_t floatCount = 0; + // configArray[6], 1 indicates the property has a Float value. + if (configArray[6] == 1) { + floatCount++; + } + // configArray[7], the number indicates the size of Float[] in the property. + floatCount += static_cast(configArray[7]); + size_t floatSize = value.value.floatValues.size(); + if (floatSize != floatCount) { + return Error() << "invalid mixed property, got " << floatSize << " floatValues, expect " + << floatCount; + } + + // configArray[8], the number indicates the size of byte[] in the property. + size_t byteSize = value.value.byteValues.size(); + size_t byteCount = static_cast(configArray[8]); + if (byteCount != 0 && byteSize != byteCount) { + return Error() << "invalid mixed property, got " << byteSize << " byteValues, expect " + << byteCount; + } + return {}; +} + +Result checkValueRange(const VehiclePropValue& value, const VehicleAreaConfig* areaConfig) { + if (areaConfig == nullptr) { + return {}; + } + int32_t property = value.prop; + VehiclePropertyType type = getPropType(property); + switch (type) { + case VehiclePropertyType::INT32: + [[fallthrough]]; + case VehiclePropertyType::INT32_VEC: + if (areaConfig->minInt32Value == 0 && areaConfig->maxInt32Value == 0) { + break; + } + for (int32_t int32Value : value.value.int32Values) { + if (int32Value < areaConfig->minInt32Value || + int32Value > areaConfig->maxInt32Value) { + return Error() << "int32Value: " << int32Value + << " out of range, min: " << areaConfig->minInt32Value + << " max: " << areaConfig->maxInt32Value; + } + } + break; + case VehiclePropertyType::INT64: + [[fallthrough]]; + case VehiclePropertyType::INT64_VEC: + if (areaConfig->minInt64Value == 0 && areaConfig->maxInt64Value == 0) { + break; + } + for (int64_t int64Value : value.value.int64Values) { + if (int64Value < areaConfig->minInt64Value || + int64Value > areaConfig->maxInt64Value) { + return Error() << "int64Value: " << int64Value + << " out of range, min: " << areaConfig->minInt64Value + << " max: " << areaConfig->maxInt64Value; + } + } + break; + case VehiclePropertyType::FLOAT: + [[fallthrough]]; + case VehiclePropertyType::FLOAT_VEC: + if (areaConfig->minFloatValue == 0.f && areaConfig->maxFloatValue == 0.f) { + break; + } + for (float floatValue : value.value.floatValues) { + if (floatValue < areaConfig->minFloatValue || + floatValue > areaConfig->maxFloatValue) { + return Error() << "floatValue: " << floatValue + << " out of range, min: " << areaConfig->minFloatValue + << " max: " << areaConfig->maxFloatValue; + } + } + break; + default: + // We don't check the rest of property types. Additional logic needs to be added if + // required in VehicleHardware, e.g. you might want to check the range for mixed + // property. + break; + } + return {}; +} + +StatusCode VhalError::value() const { + return mCode; +} + +std::string VhalError::print() const { + return aidl::android::hardware::automotive::vehicle::toString(mCode); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..250b33135b137b84fa431f31baf5bf01a881535e --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp @@ -0,0 +1,33 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "VehicleHalVehicleUtilsTest", + srcs: ["*.cpp"], + vendor: true, + static_libs: [ + "VehicleHalUtils", + "libgtest", + "libgmock", + ], + header_libs: ["VehicleHalTestUtilHeaders"], + defaults: ["VehicleHalDefaults"], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/utils/common/test/PendingRequestPoolTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/PendingRequestPoolTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..734c7392a9a62ce98bf7f23f9b12e9e60550341c --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/test/PendingRequestPoolTest.cpp @@ -0,0 +1,274 @@ +/* + * 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. + */ + +#include "PendingRequestPool.h" + +#include +#include + +#include +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::StatusCode; + +using ::testing::ElementsAre; +using ::testing::UnorderedElementsAre; +using ::testing::WhenSorted; + +class PendingRequestPoolTest : public ::testing::Test { + public: + void SetUp() override { mPool = std::make_unique(TEST_TIMEOUT); } + + void TearDown() override { + if (mPool != nullptr) { + ASSERT_EQ(mPool->countPendingRequests(getTestClientId()), static_cast(0)) + << "at least one pending request still exists in the pool when finish"; + } + } + + PendingRequestPool* getPool() { return mPool.get(); } + + void destroyPool() { mPool.reset(); } + + int64_t getTimeout() { return TEST_TIMEOUT; } + + const void* getTestClientId() { return reinterpret_cast(0); } + + private: + // Test timeout is 0.1s. + static const int64_t TEST_TIMEOUT = 100000000; + + std::unique_ptr mPool; +}; + +TEST_F(PendingRequestPoolTest, testFinishAllRequests) { + std::mutex lock; + std::vector timeoutRequestIds; + + std::unordered_set requestIds; + for (int64_t i = 0; i < 10; i++) { + requestIds.insert(i); + } + + auto callback = std::make_shared( + [&lock, &timeoutRequestIds](const std::unordered_set& requests) { + std::scoped_lock lockGuard(lock); + for (int64_t request : requests) { + timeoutRequestIds.push_back(request); + } + }); + + ASSERT_RESULT_OK(getPool()->addRequests(getTestClientId(), requestIds, callback)); + + for (int64_t i = 0; i < 10; i++) { + ASSERT_TRUE(getPool()->isRequestPending(getTestClientId(), i)); + } + + for (int64_t i = 0; i < 10; i++) { + ASSERT_THAT(getPool()->tryFinishRequests(getTestClientId(), {i}), UnorderedElementsAre(i)); + } + + for (int64_t i = 0; i < 10; i++) { + ASSERT_FALSE(getPool()->isRequestPending(getTestClientId(), i)); + } +} + +TEST_F(PendingRequestPoolTest, testFinishHalfOfRequest) { + int64_t timeout = getTimeout(); + std::mutex lock; + std::vector timeoutRequestIds; + + std::unordered_set requestIds; + for (int64_t i = 0; i < 10; i++) { + requestIds.insert(i); + } + + auto callback = std::make_shared( + [&lock, &timeoutRequestIds](const std::unordered_set& requests) { + std::scoped_lock lockGuard(lock); + for (int64_t request : requests) { + timeoutRequestIds.push_back(request); + } + }); + + ASSERT_RESULT_OK(getPool()->addRequests(getTestClientId(), requestIds, callback)); + + for (int64_t i = 0; i < 10; i++) { + ASSERT_TRUE(getPool()->isRequestPending(getTestClientId(), i)); + } + + // Finish half of the requests. + requestIds.clear(); + for (int64_t i = 0; i < 5; i++) { + requestIds.insert(i); + } + + ASSERT_EQ(getPool()->tryFinishRequests(getTestClientId(), requestIds), requestIds); + + for (int64_t i = 0; i < 5; i++) { + ASSERT_FALSE(getPool()->isRequestPending(getTestClientId(), i)); + } + for (int64_t i = 5; i < 10; i++) { + ASSERT_TRUE(getPool()->isRequestPending(getTestClientId(), i)); + } + + // Wait until the unfinished requests timeout. The check interval is timeout, so at max we + // would wait an additional interval, which is 2 * timeout until the callback is called. + std::this_thread::sleep_for(2 * std::chrono::nanoseconds(timeout)); + + ASSERT_THAT(timeoutRequestIds, WhenSorted(ElementsAre(5, 6, 7, 8, 9))); +} + +TEST_F(PendingRequestPoolTest, testFinishRequestTwice) { + std::mutex lock; + std::vector timeoutRequestIds; + + auto callback = std::make_shared( + [&lock, &timeoutRequestIds](const std::unordered_set& requests) { + std::scoped_lock lockGuard(lock); + for (int64_t request : requests) { + timeoutRequestIds.push_back(request); + } + }); + + ASSERT_RESULT_OK(getPool()->addRequests(getTestClientId(), {0}, callback)); + + ASSERT_THAT(getPool()->tryFinishRequests(getTestClientId(), {0}), UnorderedElementsAre(0)) + << "failed to finish an added request"; + ASSERT_TRUE(getPool()->tryFinishRequests(getTestClientId(), {0}).empty()) + << "finish a request second time must return empty result"; +} + +TEST_F(PendingRequestPoolTest, testFinishRequestNonExistingId) { + std::mutex lock; + std::vector timeoutRequestIds; + + auto callback = std::make_shared( + [&lock, &timeoutRequestIds](const std::unordered_set& requests) { + std::scoped_lock lockGuard(lock); + for (int64_t request : requests) { + timeoutRequestIds.push_back(request); + } + }); + + ASSERT_RESULT_OK(getPool()->addRequests(getTestClientId(), {0, 1, 2}, callback)); + + ASSERT_THAT(getPool()->tryFinishRequests(getTestClientId(), {0, 1, 2, 3}), + UnorderedElementsAre(0, 1, 2)) + << "finished request IDs must not contain non-existing request ID"; + // Even though one of the request to finish does not exist, the rest of the requests should be + // finished. + ASSERT_EQ(getPool()->countPendingRequests(getTestClientId()), static_cast(0)) + << "requests not being finished correctly"; +} + +TEST_F(PendingRequestPoolTest, testFinishAfterTimeout) { + std::mutex lock; + std::vector timeoutRequestIds; + + auto callback = std::make_shared( + [&lock, &timeoutRequestIds](const std::unordered_set& requests) { + std::scoped_lock lockGuard(lock); + for (int64_t request : requests) { + timeoutRequestIds.push_back(request); + } + }); + + ASSERT_RESULT_OK(getPool()->addRequests(getTestClientId(), {0}, callback)); + + std::this_thread::sleep_for(2 * std::chrono::nanoseconds(getTimeout())); + + ASSERT_TRUE(getPool()->tryFinishRequests(getTestClientId(), {0}).empty()) + << "finish a request after timeout must do nothing"; +} + +TEST_F(PendingRequestPoolTest, testDestroyWithPendingRequests) { + std::mutex lock; + std::vector timeoutRequestIds; + + auto callback = std::make_shared( + [&lock, &timeoutRequestIds](const std::unordered_set& requests) { + std::scoped_lock lockGuard(lock); + for (int64_t request : requests) { + timeoutRequestIds.push_back(request); + } + }); + + ASSERT_RESULT_OK(getPool()->addRequests(getTestClientId(), {0}, callback)); + + destroyPool(); + + // Before the pool is destroyed, the pending requests should be notified as timeout. + ASSERT_THAT(timeoutRequestIds, UnorderedElementsAre(0)) + << "timeout not triggered when the pool is destroyed"; +} + +TEST_F(PendingRequestPoolTest, testDuplicateRequestId) { + auto callback = std::make_shared( + [](std::unordered_set) {}); + + ASSERT_RESULT_OK(getPool()->addRequests(getTestClientId(), {0}, callback)); + ASSERT_FALSE(getPool()->addRequests(getTestClientId(), {1, 2, 0}, callback).ok()) + << "adding duplicate request IDs must fail"; + + ASSERT_THAT(getPool()->tryFinishRequests(getTestClientId(), {0}), UnorderedElementsAre(0)); +} + +TEST_F(PendingRequestPoolTest, testSameRequestIdForDifferentClient) { + auto callback = std::make_shared( + [](std::unordered_set) {}); + + ASSERT_RESULT_OK(getPool()->addRequests(reinterpret_cast(0), {0}, callback)); + ASSERT_RESULT_OK(getPool()->addRequests(reinterpret_cast(1), {1, 2, 0}, callback)); + + ASSERT_THAT(getPool()->tryFinishRequests(reinterpret_cast(0), {0}), + UnorderedElementsAre(0)); + ASSERT_THAT(getPool()->tryFinishRequests(reinterpret_cast(1), {1, 2, 0}), + UnorderedElementsAre(0, 1, 2)); +} + +TEST_F(PendingRequestPoolTest, testPendingRequestCountLimit) { + auto callback = std::make_shared( + [](std::unordered_set) {}); + + std::unordered_set requests; + + // MAX_PENDING_REQUEST_PER_CLIENT = 10000 + for (size_t i = 0; i < 10000; i++) { + requests.insert(static_cast(i)); + } + ASSERT_RESULT_OK(getPool()->addRequests(reinterpret_cast(0), requests, callback)); + + auto result = getPool()->addRequests(reinterpret_cast(0), + {static_cast(10000)}, callback); + ASSERT_FALSE(result.ok()) << "adding more pending requests than limit must fail"; + ASSERT_EQ(result.error().code(), StatusCode::TRY_AGAIN); + + getPool()->tryFinishRequests(reinterpret_cast(0), requests); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a033a248cd996793fd04ba6196f9616efcc26a51 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp @@ -0,0 +1,192 @@ +/* + * 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. + */ + +#include "RecurrentTimer.h" + +#include +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +class RecurrentTimerTest : public testing::Test { + public: + std::shared_ptr getCallback(size_t token) { + return std::make_shared([this, token] { + std::scoped_lock lockGuard(mLock); + + mCallbacks.push_back(token); + }); + } + + std::vector getCalledCallbacks() { + std::scoped_lock lockGuard(mLock); + return mCallbacks; + } + + void clearCalledCallbacks() { + std::scoped_lock lockGuard(mLock); + mCallbacks.clear(); + } + + size_t countTimerCallbackQueue(RecurrentTimer* timer) { + std::scoped_lock lockGuard(timer->mLock); + return timer->mCallbackQueue.size(); + } + + private: + std::mutex mLock; + std::vector mCallbacks GUARDED_BY(mLock); +}; + +TEST_F(RecurrentTimerTest, testRegisterCallback) { + RecurrentTimer timer; + // 0.1s + int64_t interval = 100000000; + + auto action = getCallback(0); + timer.registerTimerCallback(interval, action); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + timer.unregisterTimerCallback(action); + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + ASSERT_GE(getCalledCallbacks().size(), static_cast(9)); +} + +TEST_F(RecurrentTimerTest, testRegisterUnregisterRegister) { + RecurrentTimer timer; + // 0.1s + int64_t interval = 100000000; + + auto action = getCallback(0); + timer.registerTimerCallback(interval, action); + + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + + timer.unregisterTimerCallback(action); + + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + + clearCalledCallbacks(); + + timer.registerTimerCallback(interval, action); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + ASSERT_GE(getCalledCallbacks().size(), static_cast(9)); +} + +TEST_F(RecurrentTimerTest, testDestroyTimerWithCallback) { + std::unique_ptr timer = std::make_unique(); + // 0.1s + int64_t interval = 100000000; + + auto action = getCallback(0); + timer->registerTimerCallback(interval, action); + + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + + timer.reset(); + + clearCalledCallbacks(); + + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + + ASSERT_TRUE(getCalledCallbacks().empty()); +} + +TEST_F(RecurrentTimerTest, testRegisterMultipleCallbacks) { + RecurrentTimer timer; + // 0.1s + int64_t interval1 = 100000000; + auto action1 = getCallback(1); + timer.registerTimerCallback(interval1, action1); + // 0.05s + int64_t interval2 = 50000000; + auto action2 = getCallback(2); + timer.registerTimerCallback(interval2, action2); + // 0.03s + int64_t interval3 = 30000000; + auto action3 = getCallback(3); + timer.registerTimerCallback(interval3, action3); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + timer.unregisterTimerCallback(action1); + timer.unregisterTimerCallback(action2); + timer.unregisterTimerCallback(action3); + + size_t action1Count = 0; + size_t action2Count = 0; + size_t action3Count = 0; + for (size_t token : getCalledCallbacks()) { + if (token == 1) { + action1Count++; + } + if (token == 2) { + action2Count++; + } + if (token == 3) { + action3Count++; + } + } + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + ASSERT_GE(action1Count, static_cast(9)); + // Theoretically trigger 20 times, but check for at least 15 times to be stable. + ASSERT_GE(action2Count, static_cast(15)); + // Theoretically trigger 33 times, but check for at least 25 times to be stable. + ASSERT_GE(action3Count, static_cast(25)); +} + +TEST_F(RecurrentTimerTest, testRegisterSameCallbackMultipleTimes) { + RecurrentTimer timer; + // 0.02s + int64_t interval1 = 20000000; + // 0.01s + int64_t interval2 = 10000000; + + auto action = getCallback(0); + for (int i = 0; i < 10; i++) { + timer.registerTimerCallback(interval1, action); + timer.registerTimerCallback(interval2, action); + } + + clearCalledCallbacks(); + + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + ASSERT_GE(getCalledCallbacks().size(), static_cast(9)); + + timer.unregisterTimerCallback(action); + + // Make sure there is no item in the callback queue. + ASSERT_EQ(countTimerCallbackQueue(&timer), static_cast(0)); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehicleObjectPoolTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehicleObjectPoolTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a62532c911746330ddb28585e18258cbe7cb6d73 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/test/VehicleObjectPoolTest.cpp @@ -0,0 +1,381 @@ +/* + * 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. + */ + +#include + +#include + +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +struct TestPropertyTypeInfo { + VehiclePropertyType type; + bool recyclable; + size_t vecSize; +}; + +std::vector getAllPropertyTypes() { + return { + { + .type = VehiclePropertyType::INT32, + .recyclable = true, + .vecSize = 1, + }, + { + .type = VehiclePropertyType::INT64, + .recyclable = true, + .vecSize = 1, + }, + { + .type = VehiclePropertyType::FLOAT, + .recyclable = true, + .vecSize = 1, + }, + { + .type = VehiclePropertyType::INT32_VEC, + .recyclable = true, + .vecSize = 4, + }, + { + .type = VehiclePropertyType::INT64_VEC, + .recyclable = true, + .vecSize = 4, + }, + { + .type = VehiclePropertyType::FLOAT_VEC, + .recyclable = true, + .vecSize = 4, + }, + { + .type = VehiclePropertyType::BYTES, + .recyclable = true, + .vecSize = 4, + }, + { + .type = VehiclePropertyType::INT32_VEC, + .recyclable = false, + .vecSize = 5, + }, + { + .type = VehiclePropertyType::INT64_VEC, + .recyclable = false, + .vecSize = 5, + }, + { + .type = VehiclePropertyType::FLOAT_VEC, + .recyclable = false, + .vecSize = 5, + }, + { + .type = VehiclePropertyType::BYTES, + .recyclable = false, + .vecSize = 5, + }, + { + .type = VehiclePropertyType::STRING, + .recyclable = false, + .vecSize = 0, + }, + { + .type = VehiclePropertyType::MIXED, + .recyclable = false, + .vecSize = 0, + }, + }; +} + +} // namespace + +class VehicleObjectPoolTest : public ::testing::Test { + protected: + void SetUp() override { + mStats = PoolStats::instance(); + resetStats(); + mValuePool.reset(new VehiclePropValuePool); + } + + void TearDown() override { + // At the end, all created objects should be either recycled or deleted. + ASSERT_EQ(mStats->Obtained, mStats->Recycled + mStats->Deleted); + // Some objects could be recycled multiple times. + ASSERT_LE(mStats->Created, mStats->Recycled + mStats->Deleted); + } + + PoolStats* mStats; + std::unique_ptr mValuePool; + + private: + void resetStats() { + mStats->Obtained = 0; + mStats->Created = 0; + mStats->Recycled = 0; + mStats->Deleted = 0; + } +}; + +class VehiclePropertyTypesTest : public VehicleObjectPoolTest, + public testing::WithParamInterface {}; + +TEST_P(VehiclePropertyTypesTest, testRecycle) { + auto info = GetParam(); + if (!info.recyclable) { + GTEST_SKIP(); + } + + auto value = mValuePool->obtain(info.type, info.vecSize); + void* raw = value.get(); + value.reset(); + // At this point, value should be recycled and the only object in the pool. + ASSERT_EQ(mValuePool->obtain(info.type, info.vecSize).get(), raw); + + ASSERT_EQ(mStats->Obtained, 2u); + ASSERT_EQ(mStats->Created, 1u); +} + +TEST_P(VehiclePropertyTypesTest, testNotRecyclable) { + auto info = GetParam(); + if (info.recyclable) { + GTEST_SKIP(); + } + + auto value = mValuePool->obtain(info.type, info.vecSize); + + ASSERT_EQ(mStats->Obtained, 0u) << "Non recyclable object should not be obtained from the pool"; + ASSERT_EQ(mStats->Created, 0u) << "Non recyclable object should not be created from the pool"; +} + +INSTANTIATE_TEST_SUITE_P(AllPropertyTypes, VehiclePropertyTypesTest, + ::testing::ValuesIn(getAllPropertyTypes())); + +TEST_F(VehicleObjectPoolTest, testObtainNewObject) { + auto value = mValuePool->obtain(VehiclePropertyType::INT32); + void* raw = value.get(); + value.reset(); + // At this point, value should be recycled and the only object in the pool. + ASSERT_EQ(mValuePool->obtain(VehiclePropertyType::INT32).get(), raw); + // Obtaining value of another type - should return a new object + ASSERT_NE(mValuePool->obtain(VehiclePropertyType::FLOAT).get(), raw); + + ASSERT_EQ(mStats->Obtained, 3u); + ASSERT_EQ(mStats->Created, 2u); +} + +TEST_F(VehicleObjectPoolTest, testObtainStrings) { + mValuePool->obtain(VehiclePropertyType::STRING); + auto stringProp = mValuePool->obtain(VehiclePropertyType::STRING); + stringProp->value.stringValue = "Hello"; + void* raw = stringProp.get(); + stringProp.reset(); // delete the pointer + + auto newStringProp = mValuePool->obtain(VehiclePropertyType::STRING); + + ASSERT_EQ(newStringProp->value.stringValue.size(), 0u); + ASSERT_NE(mValuePool->obtain(VehiclePropertyType::STRING).get(), raw); + ASSERT_EQ(mStats->Obtained, 0u); +} + +TEST_F(VehicleObjectPoolTest, testObtainBoolean) { + auto prop = mValuePool->obtainBoolean(true); + + ASSERT_NE(prop, nullptr); + ASSERT_EQ(*prop, (VehiclePropValue{ + .value = {.int32Values = {1}}, + })); +} + +TEST_F(VehicleObjectPoolTest, testObtainInt32) { + auto prop = mValuePool->obtainInt32(1234); + + ASSERT_NE(prop, nullptr); + ASSERT_EQ(*prop, (VehiclePropValue{ + .value = {.int32Values = {1234}}, + })); +} + +TEST_F(VehicleObjectPoolTest, testObtainInt64) { + auto prop = mValuePool->obtainInt64(1234); + + ASSERT_NE(prop, nullptr); + ASSERT_EQ(*prop, (VehiclePropValue{ + .value = {.int64Values = {1234}}, + })); +} + +TEST_F(VehicleObjectPoolTest, testObtainFloat) { + auto prop = mValuePool->obtainFloat(1.234); + + ASSERT_NE(prop, nullptr); + ASSERT_EQ(*prop, (VehiclePropValue{ + .value = {.floatValues = {1.234}}, + })); +} + +TEST_F(VehicleObjectPoolTest, testObtainString) { + auto prop = mValuePool->obtainString("test"); + + ASSERT_NE(prop, nullptr); + ASSERT_EQ(*prop, (VehiclePropValue{ + .value = {.stringValue = "test"}, + })); +} + +TEST_F(VehicleObjectPoolTest, testObtainComplex) { + auto prop = mValuePool->obtainComplex(); + + ASSERT_NE(prop, nullptr); + ASSERT_EQ(*prop, VehiclePropValue{}); +} + +TEST_F(VehicleObjectPoolTest, testObtainCopyInt32Values) { + VehiclePropValue prop{ + // INT32_VEC property. + .prop = toInt(VehicleProperty::INFO_FUEL_TYPE), + .areaId = 2, + .timestamp = 3, + .value = {.int32Values = {1, 2, 3, 4}}, + }; + auto gotValue = mValuePool->obtain(prop); + + ASSERT_NE(gotValue, nullptr); + ASSERT_EQ(*gotValue, prop); +} + +TEST_F(VehicleObjectPoolTest, testObtainCopyInt64Values) { + VehiclePropValue prop{ + // INT64_VEC property. + .prop = toInt(VehicleProperty::WHEEL_TICK), + .areaId = 2, + .timestamp = 3, + .value = {.int64Values = {1, 2, 3, 4}}, + }; + auto gotValue = mValuePool->obtain(prop); + + ASSERT_NE(gotValue, nullptr); + ASSERT_EQ(*gotValue, prop); +} + +TEST_F(VehicleObjectPoolTest, testObtainCopyFloatValues) { + VehiclePropValue prop{ + // FLOAT_VEC property. + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = 2, + .timestamp = 3, + .value = {.floatValues = {1, 2, 3, 4}}, + }; + auto gotValue = mValuePool->obtain(prop); + + ASSERT_NE(gotValue, nullptr); + ASSERT_EQ(*gotValue, prop); +} + +TEST_F(VehicleObjectPoolTest, testObtainCopyString) { + VehiclePropValue prop{ + // STRING property. + .prop = toInt(VehicleProperty::INFO_VIN), + .areaId = 2, + .timestamp = 3, + .value = {.stringValue = "test"}, + }; + auto gotValue = mValuePool->obtain(prop); + + ASSERT_NE(gotValue, nullptr); + ASSERT_EQ(*gotValue, prop); +} + +TEST_F(VehicleObjectPoolTest, testObtainCopyMixed) { + VehiclePropValue prop{ + // MIxed property. + .prop = toInt(VehicleProperty::VEHICLE_MAP_SERVICE), + .areaId = 2, + .timestamp = 3, + .value = + { + .int32Values = {1, 2, 3}, + .floatValues = {4.0, 5.0}, + .stringValue = "test", + }, + }; + auto gotValue = mValuePool->obtain(prop); + + ASSERT_NE(gotValue, nullptr); + ASSERT_EQ(*gotValue, prop); +} + +TEST_F(VehicleObjectPoolTest, testMultithreaded) { + // In this test we have T threads that concurrently in C cycles + // obtain and release O VehiclePropValue objects of FLOAT / INT32 types. + + const int T = 2; + const int C = 500; + const int O = 100; + + auto poolPtr = mValuePool.get(); + + std::vector threads; + for (int i = 0; i < T; i++) { + threads.push_back(std::thread([&poolPtr]() { + for (int j = 0; j < C; j++) { + std::vector> vec; + for (int k = 0; k < O; k++) { + vec.push_back(poolPtr->obtain(k % 2 == 0 ? VehiclePropertyType::FLOAT + : VehiclePropertyType::INT32)); + } + } + })); + } + + for (auto& t : threads) { + t.join(); + } + + ASSERT_EQ(mStats->Obtained, static_cast(T * C * O)); + ASSERT_EQ(mStats->Recycled + mStats->Deleted, static_cast(T * C * O)); + // Created less than obtained in one cycle. + ASSERT_LE(mStats->Created, static_cast(T * O)); +} + +TEST_F(VehicleObjectPoolTest, testMemoryLimitation) { + std::vector> vec; + for (size_t i = 0; i < 10000; i++) { + vec.push_back(mValuePool->obtain(VehiclePropertyType::INT32)); + } + // We have too many values, not all of them would be recycled, some of them will be deleted. + vec.clear(); + + ASSERT_EQ(mStats->Obtained, 10000u); + ASSERT_EQ(mStats->Created, 10000u); + ASSERT_GT(mStats->Deleted, 0u) << "expect some values to be deleted, not recycled if too many " + "values are in the pool"; +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4d6f811795a2a88374d3d5f5f75fc2ff910e07be --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp @@ -0,0 +1,454 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::testing::ElementsAre; +using ::testing::Eq; +using ::testing::WhenSortedBy; + +constexpr int INVALID_PROP_ID = 0; + +struct PropValueCmp { + bool operator()(const VehiclePropValue& a, const VehiclePropValue& b) const { + return (a.prop < b.prop) || ((a.prop == b.prop) && (a.value < b.value)) || + ((a.prop == b.prop) && (a.value == b.value) && (a.areaId < b.areaId)); + } +} propValueCmp; + +int64_t timestampToken(const VehiclePropValue& value) { + return value.timestamp; +} + +// A helper function to turn value pointer to value structure for easier comparison. +std::vector convertValuePtrsToValues( + const std::vector& values) { + std::vector returnValues; + returnValues.reserve(values.size()); + for (auto& value : values) { + returnValues.push_back(*value); + } + return returnValues; +} + +} // namespace + +class VehiclePropertyStoreTest : public ::testing::Test { + protected: + void SetUp() override { + mConfigFuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }; + VehiclePropConfig configTirePressure = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .areaConfigs = {VehicleAreaConfig{.areaId = WHEEL_FRONT_LEFT}, + VehicleAreaConfig{.areaId = WHEEL_FRONT_RIGHT}, + VehicleAreaConfig{.areaId = WHEEL_REAR_LEFT}, + VehicleAreaConfig{.areaId = WHEEL_REAR_RIGHT}}, + }; + mValuePool = std::make_shared(); + mStore.reset(new VehiclePropertyStore(mValuePool)); + mStore->registerProperty(mConfigFuelCapacity); + mStore->registerProperty(configTirePressure); + } + + VehiclePropConfig mConfigFuelCapacity; + std::shared_ptr mValuePool; + std::unique_ptr mStore; +}; + +TEST_F(VehiclePropertyStoreTest, testGetAllConfigs) { + std::vector configs = mStore->getAllConfigs(); + + ASSERT_EQ(configs.size(), static_cast(2)); +} + +TEST_F(VehiclePropertyStoreTest, testGetConfig) { + VhalResult result = + mStore->getConfig(toInt(VehicleProperty::INFO_FUEL_CAPACITY)); + + ASSERT_RESULT_OK(result); + ASSERT_EQ(*(result.value()), mConfigFuelCapacity); +} + +TEST_F(VehiclePropertyStoreTest, testGetConfigWithInvalidPropId) { + VhalResult result = mStore->getConfig(INVALID_PROP_ID); + + EXPECT_FALSE(result.ok()) << "expect error when getting a config for an invalid property ID"; + EXPECT_EQ(result.error().code(), StatusCode::INVALID_ARG); +} + +std::vector getTestPropValues() { + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + + VehiclePropValue leftTirePressure = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .value = {.floatValues = {170.0}}, + .areaId = WHEEL_FRONT_LEFT, + }; + + VehiclePropValue rightTirePressure = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .value = {.floatValues = {180.0}}, + .areaId = WHEEL_FRONT_RIGHT, + }; + + return {fuelCapacity, leftTirePressure, rightTirePressure}; +} + +TEST_F(VehiclePropertyStoreTest, testWriteValueOk) { + auto values = getTestPropValues(); + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(values[0]))); +} + +TEST_F(VehiclePropertyStoreTest, testReadAllValues) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value))); + } + + auto gotValues = mStore->readAllValues(); + + ASSERT_THAT(convertValuePtrsToValues(gotValues), WhenSortedBy(propValueCmp, Eq(values))); +} + +TEST_F(VehiclePropertyStoreTest, testReadValuesForPropertyOneValue) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value))); + } + + auto result = mStore->readValuesForProperty(toInt(VehicleProperty::INFO_FUEL_CAPACITY)); + + ASSERT_RESULT_OK(result); + ASSERT_THAT(convertValuePtrsToValues(result.value()), ElementsAre(values[0])); +} + +TEST_F(VehiclePropertyStoreTest, testReadValuesForPropertyMultipleValues) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value))); + } + + auto result = mStore->readValuesForProperty(toInt(VehicleProperty::TIRE_PRESSURE)); + + ASSERT_RESULT_OK(result); + ASSERT_THAT(convertValuePtrsToValues(result.value()), + WhenSortedBy(propValueCmp, ElementsAre(values[1], values[2]))); +} + +TEST_F(VehiclePropertyStoreTest, testReadValuesForPropertyError) { + auto result = mStore->readValuesForProperty(INVALID_PROP_ID); + + EXPECT_FALSE(result.ok()) << "expect error when reading values for an invalid property"; + EXPECT_EQ(result.error().code(), StatusCode::INVALID_ARG); +} + +TEST_F(VehiclePropertyStoreTest, testReadValueOk) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value))); + } + + VehiclePropValue requestValue = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .areaId = WHEEL_FRONT_LEFT, + }; + + auto result = mStore->readValue(requestValue); + + ASSERT_RESULT_OK(result); + ASSERT_EQ(*(result.value()), values[1]); +} + +TEST_F(VehiclePropertyStoreTest, testReadValueByPropIdOk) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value))); + } + + auto result = mStore->readValue(toInt(VehicleProperty::TIRE_PRESSURE), WHEEL_FRONT_RIGHT); + + ASSERT_EQ(*(result.value()), values[2]); +} + +TEST_F(VehiclePropertyStoreTest, testReadValueError) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value))); + } + + auto result = mStore->readValue(toInt(VehicleProperty::TIRE_PRESSURE), WHEEL_REAR_LEFT); + + EXPECT_FALSE(result.ok()) << "expect error when reading a value that has not been written"; + EXPECT_EQ(result.error().code(), StatusCode::NOT_AVAILABLE); +} + +TEST_F(VehiclePropertyStoreTest, testWriteValueError) { + auto v = mValuePool->obtain(VehiclePropertyType::FLOAT); + v->prop = INVALID_PROP_ID; + v->value.floatValues = {1.0}; + + auto result = mStore->writeValue(std::move(v)); + + EXPECT_FALSE(result.ok()) << "expect error when writing value for an invalid property ID"; + EXPECT_EQ(result.error().code(), StatusCode::INVALID_ARG); +} + +TEST_F(VehiclePropertyStoreTest, testWriteValueNoAreaConfig) { + auto v = mValuePool->obtain(VehiclePropertyType::FLOAT); + v->prop = toInt(VehicleProperty::TIRE_PRESSURE); + v->value.floatValues = {1.0}; + // There is no config for ALL_WHEELS. + v->areaId = ALL_WHEELS; + + auto result = mStore->writeValue(std::move(v)); + + EXPECT_FALSE(result.ok()) << "expect error when writing value for an area without config"; + EXPECT_EQ(result.error().code(), StatusCode::INVALID_ARG); +} + +TEST_F(VehiclePropertyStoreTest, testWriteOutdatedValue) { + auto v = mValuePool->obtain(VehiclePropertyType::FLOAT); + v->timestamp = 1; + v->prop = toInt(VehicleProperty::TIRE_PRESSURE); + v->value.floatValues = {180.0}; + v->areaId = WHEEL_FRONT_LEFT; + ASSERT_RESULT_OK(mStore->writeValue(std::move(v))); + + // Write an older value. + auto v2 = mValuePool->obtain(VehiclePropertyType::FLOAT); + v2->timestamp = 0; + v2->prop = toInt(VehicleProperty::TIRE_PRESSURE); + v2->value.floatValues = {180.0}; + v2->areaId = WHEEL_FRONT_LEFT; + + auto result = mStore->writeValue(std::move(v2)); + + EXPECT_FALSE(result.ok()) << "expect error when writing an outdated value"; + EXPECT_EQ(result.error().code(), StatusCode::INVALID_ARG); +} + +TEST_F(VehiclePropertyStoreTest, testToken) { + int propId = toInt(VehicleProperty::INFO_FUEL_CAPACITY); + VehiclePropConfig config = { + .prop = propId, + }; + + // Replace existing config. + mStore->registerProperty(config, timestampToken); + + VehiclePropValue fuelCapacityValueToken1 = { + .timestamp = 1, + .prop = propId, + .value = {.floatValues = {1.0}}, + }; + + VehiclePropValue fuelCapacityValueToken2 = { + .timestamp = 2, + .prop = propId, + .value = {.floatValues = {2.0}}, + }; + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacityValueToken1))); + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacityValueToken2))); + + auto result = mStore->readValuesForProperty(propId); + + ASSERT_RESULT_OK(result); + ASSERT_EQ(result.value().size(), static_cast(2)); + + auto tokenResult = mStore->readValue(propId, /*areaId=*/0, /*token=*/2); + + ASSERT_RESULT_OK(tokenResult); + ASSERT_EQ(*(tokenResult.value()), fuelCapacityValueToken2); +} + +TEST_F(VehiclePropertyStoreTest, testRemoveValue) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(value))); + } + + mStore->removeValue(values[0]); + auto result = mStore->readValue(values[0]); + + EXPECT_FALSE(result.ok()) << "expect error when reading a removed value"; + EXPECT_EQ(result.error().code(), StatusCode::NOT_AVAILABLE); + + auto leftTirePressureResult = mStore->readValue(values[1]); + + ASSERT_RESULT_OK(leftTirePressureResult); + ASSERT_EQ(*(leftTirePressureResult.value()), values[1]); +} + +TEST_F(VehiclePropertyStoreTest, testRemoveValuesForProperty) { + auto values = getTestPropValues(); + for (const auto& value : values) { + ASSERT_RESULT_OK(mStore->writeValue(std::move(mValuePool->obtain(value)))); + } + + mStore->removeValuesForProperty(toInt(VehicleProperty::INFO_FUEL_CAPACITY)); + mStore->removeValuesForProperty(toInt(VehicleProperty::TIRE_PRESSURE)); + + auto gotValues = mStore->readAllValues(); + ASSERT_TRUE(gotValues.empty()); +} + +TEST_F(VehiclePropertyStoreTest, testWriteValueUpdateStatus) { + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), true)); + + fuelCapacity.status = VehiclePropertyStatus::UNAVAILABLE; + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), true)); + + VehiclePropValue requestValue = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + }; + + auto result = mStore->readValue(requestValue); + + ASSERT_RESULT_OK(result); + ASSERT_EQ(result.value()->status, VehiclePropertyStatus::UNAVAILABLE); +} + +TEST_F(VehiclePropertyStoreTest, testWriteValueNoUpdateStatus) { + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), true)); + + fuelCapacity.status = VehiclePropertyStatus::UNAVAILABLE; + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), false)); + + VehiclePropValue requestValue = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + }; + + auto result = mStore->readValue(requestValue); + + ASSERT_RESULT_OK(result); + ASSERT_EQ(result.value()->status, VehiclePropertyStatus::AVAILABLE); +} + +TEST_F(VehiclePropertyStoreTest, testWriteValueNoUpdateStatusForNewValue) { + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + .status = VehiclePropertyStatus::UNAVAILABLE, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), false)); + + VehiclePropValue requestValue = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + }; + + auto result = mStore->readValue(requestValue); + + ASSERT_RESULT_OK(result); + ASSERT_EQ(result.value()->status, VehiclePropertyStatus::AVAILABLE); +} + +TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackNewValue) { + VehiclePropValue updatedValue; + mStore->setOnValueChangeCallback( + [&updatedValue](const VehiclePropValue& value) { updatedValue = value; }); + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + ASSERT_EQ(updatedValue, fuelCapacity); +} + +TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackUpdateValue) { + VehiclePropValue updatedValue; + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + mStore->setOnValueChangeCallback( + [&updatedValue](const VehiclePropValue& value) { updatedValue = value; }); + + fuelCapacity.value.floatValues[0] = 2.0; + fuelCapacity.timestamp = 1; + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + ASSERT_EQ(updatedValue, fuelCapacity); +} + +TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackNoUpdate) { + VehiclePropValue updatedValue{ + .prop = INVALID_PROP_ID, + }; + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + mStore->setOnValueChangeCallback( + [&updatedValue](const VehiclePropValue& value) { updatedValue = value; }); + + // Write the same value again should succeed but should not trigger callback. + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + ASSERT_EQ(updatedValue.prop, INVALID_PROP_ID); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..411539b38f1ed6a4236820356172fe5cf1e3f79a --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/common/test/VehicleUtilsTest.cpp @@ -0,0 +1,808 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehicleArea; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::Error; +using ::android::base::Result; + +struct InvalidPropValueTestCase { + std::string name; + VehiclePropValue value; + bool valid = false; + VehiclePropConfig config; +}; + +constexpr int32_t int32Prop = toInt(VehicleProperty::INFO_MODEL_YEAR); +constexpr int32_t int32VecProp = toInt(VehicleProperty::INFO_FUEL_TYPE); +constexpr int32_t int64Prop = toInt(VehicleProperty::ANDROID_EPOCH_TIME); +constexpr int32_t int64VecProp = toInt(VehicleProperty::WHEEL_TICK); +constexpr int32_t floatProp = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE); +constexpr int32_t floatVecProp = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION); + +std::vector getInvalidPropValuesTestCases() { + return std::vector( + { + InvalidPropValueTestCase{ + .name = "int32_normal", + .value = + { + .prop = int32Prop, + .value.int32Values = {0}, + }, + .valid = true, + }, + InvalidPropValueTestCase{ + .name = "int32_no_value", + .value = + { + .prop = int32Prop, + }, + }, + InvalidPropValueTestCase{ + .name = "int32_more_than_one_value", + .value = + { + .prop = int32Prop, + .value.int32Values = {0, 1}, + }, + }, + InvalidPropValueTestCase{ + .name = "int32_vec_normal", + .value = + { + .prop = int32VecProp, + .value.int32Values = {0, 1}, + }, + .valid = true, + }, + InvalidPropValueTestCase{ + .name = "int32_vec_no_value", + .value = + { + .prop = int32VecProp, + }, + }, + InvalidPropValueTestCase{ + .name = "int64_normal", + .value = + { + .prop = int64Prop, + .value.int64Values = {0}, + }, + .valid = true, + }, + InvalidPropValueTestCase{ + .name = "int64_no_value", + .value = + { + .prop = int64Prop, + }, + }, + InvalidPropValueTestCase{ + .name = "int64_more_than_one_value", + .value = + { + .prop = int64Prop, + .value.int64Values = {0, 1}, + }, + }, + InvalidPropValueTestCase{ + .name = "int64_vec_normal", + .value = + { + .prop = int64VecProp, + .value.int64Values = {0, 1}, + }, + .valid = true, + }, + InvalidPropValueTestCase{ + .name = "int64_vec_no_value", + .value = + { + .prop = int64VecProp, + }, + }, + InvalidPropValueTestCase{ + .name = "float_normal", + .value = + { + .prop = floatProp, + .value.floatValues = {0.0}, + }, + .valid = true, + }, + InvalidPropValueTestCase{ + .name = "float_no_value", + .value = + { + .prop = floatProp, + }, + }, + InvalidPropValueTestCase{ + .name = "float_more_than_one_value", + .value = + { + .prop = floatProp, + .value.floatValues = {0.0, 1.0}, + }, + }, + InvalidPropValueTestCase{ + .name = "float_vec_normal", + .value = + { + .prop = floatVecProp, + .value.floatValues = {0.0, 1.0}, + }, + .valid = true, + }, + InvalidPropValueTestCase{ + .name = "float_vec_no_value", + .value = + { + .prop = floatVecProp, + }, + }, + InvalidPropValueTestCase{ + .name = "mixed_normal", + .value = + { + .prop = kMixedTypePropertyForTest, + // Expect 3 values. + .value.int32Values = {0, 1, 2}, + // Expect 2 values. + .value.int64Values = {0, 1}, + // Expect 2 values. + .value.floatValues = {0.0, 1.0}, + // Expect 1 value. + .value.byteValues = {static_cast(0)}, + }, + .config = + { + .prop = kMixedTypePropertyForTest, + .configArray = {0, 1, 1, 1, 1, 1, 1, 1, 1}, + }, + .valid = true, + }, + InvalidPropValueTestCase{ + .name = "mixed_mismatch_int32_values_count", + .value = + { + .prop = kMixedTypePropertyForTest, + // Expect 3 values. + .value.int32Values = {0, 1}, + // Expect 2 values. + .value.int64Values = {0, 1}, + // Expect 2 values. + .value.floatValues = {0.0, 1.0}, + // Expect 1 value. + .value.byteValues = {static_cast(0)}, + }, + .config = + { + .prop = kMixedTypePropertyForTest, + .configArray = {0, 1, 1, 1, 1, 1, 1, 1, 1}, + }, + }, + InvalidPropValueTestCase{ + .name = "mixed_mismatch_int64_values_count", + .value = + { + .prop = kMixedTypePropertyForTest, + // Expect 3 values. + .value.int32Values = {0, 1, 2}, + // Expect 2 values. + .value.int64Values = {0}, + // Expect 2 values. + .value.floatValues = {0.0, 1.0}, + // Expect 1 value. + .value.byteValues = {static_cast(0)}, + }, + .config = + { + .prop = kMixedTypePropertyForTest, + .configArray = {0, 1, 1, 1, 1, 1, 1, 1, 1}, + }, + }, + InvalidPropValueTestCase{ + .name = "mixed_mismatch_float_values_count", + .value = + { + .prop = kMixedTypePropertyForTest, + // Expect 3 values. + .value.int32Values = {0, 1, 2}, + // Expect 2 values. + .value.int64Values = {0, 1}, + // Expect 2 values. + .value.floatValues = {0.0}, + // Expect 1 value. + .value.byteValues = {static_cast(0)}, + }, + .config = + { + .prop = kMixedTypePropertyForTest, + .configArray = {0, 1, 1, 1, 1, 1, 1, 1, 1}, + }, + }, + InvalidPropValueTestCase{ + .name = "mixed_mismatch_byte_values_count", + .value = + { + .prop = kMixedTypePropertyForTest, + // Expect 3 values. + .value.int32Values = {0, 1, 2}, + // Expect 2 values. + .value.int64Values = {0, 1}, + // Expect 2 values. + .value.floatValues = {0.0, 1.0}, + // Expect 1 value. + .value.byteValues = {static_cast(0), + static_cast(1)}, + }, + .config = + { + .prop = kMixedTypePropertyForTest, + .configArray = {0, 1, 1, 1, 1, 1, 1, 1, 1}, + }, + }, + }); +} + +struct InvalidValueRangeTestCase { + std::string name; + VehiclePropValue value; + bool valid = false; + VehicleAreaConfig config; +}; + +std::vector getInvalidValueRangeTestCases() { + return std::vector({{ + InvalidValueRangeTestCase{ + .name = "int32_normal", + .value = + { + .prop = int32Prop, + .value.int32Values = {0}, + }, + .valid = true, + .config = + { + .minInt32Value = 0, + .maxInt32Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "int32_vec_normal", + .value = + { + .prop = int32VecProp, + .value.int32Values = {0, 1}, + }, + .valid = true, + .config = + { + .minInt32Value = 0, + .maxInt32Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "int32_vec_underflow", + .value = + { + .prop = int32VecProp, + .value.int32Values = {-1, 1}, + }, + + .config = + { + .minInt32Value = 0, + .maxInt32Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "int32_vec_overflow", + .value = + { + .prop = int32VecProp, + .value.int32Values = {0, 100}, + }, + .config = + { + .minInt32Value = 0, + .maxInt32Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "int64_normal", + .value = + { + .prop = int64Prop, + .value.int64Values = {0}, + }, + .valid = true, + .config = + { + .minInt64Value = 0, + .maxInt64Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "int64_vec_normal", + .value = + { + .prop = int64VecProp, + .value.int64Values = {0, 1}, + }, + .valid = true, + .config = + { + .minInt64Value = 0, + .maxInt64Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "int64_vec_underflow", + .value = + { + .prop = int64VecProp, + .value.int64Values = {-1, 1}, + }, + + .config = + { + .minInt64Value = 0, + .maxInt64Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "int64_vec_overflow", + .value = + { + .prop = int64VecProp, + .value.int64Values = {0, 100}, + }, + .config = + { + .minInt64Value = 0, + .maxInt64Value = 10, + }, + }, + InvalidValueRangeTestCase{ + .name = "float_normal", + .value = + { + .prop = floatProp, + .value.floatValues = {0.0}, + }, + .valid = true, + .config = + { + .minFloatValue = 0.0, + .maxFloatValue = 10.0, + }, + }, + InvalidValueRangeTestCase{ + .name = "float_vec_normal", + .value = + { + .prop = floatVecProp, + .value.floatValues = {0.0, 10.0}, + }, + .valid = true, + .config = + { + .minFloatValue = 0.0, + .maxFloatValue = 10.0, + }, + }, + InvalidValueRangeTestCase{ + .name = "float_vec_underflow", + .value = + { + .prop = floatVecProp, + .value.floatValues = {-0.1, 1.1}, + }, + + .config = + { + .minFloatValue = 0.0, + .maxFloatValue = 10.0, + }, + }, + InvalidValueRangeTestCase{ + .name = "float_vec_overflow", + .value = + { + .prop = floatVecProp, + .value.floatValues = {0.0, 10.1}, + }, + .config = + { + .minFloatValue = 0.0, + .maxFloatValue = 10.0, + }, + }, + }}); +} + +} // namespace + +TEST(VehicleUtilsTest, testToInt) { + int areaGlobal = toInt(VehicleArea::GLOBAL); + + ASSERT_EQ(areaGlobal, 0x01000000); +} + +TEST(VehicleUtilsTest, testGetPropType) { + VehiclePropertyType type = getPropType(toInt(VehicleProperty::INFO_VIN)); + + ASSERT_EQ(type, VehiclePropertyType::STRING); +} + +TEST(VehicleUtilsTest, testGetPropGroup) { + VehiclePropertyGroup group = getPropGroup(toInt(VehicleProperty::INFO_VIN)); + + ASSERT_EQ(group, VehiclePropertyGroup::SYSTEM); +} + +TEST(VehicleUtilsTest, testGetPropArea) { + VehicleArea area = getPropArea(toInt(VehicleProperty::INFO_VIN)); + + ASSERT_EQ(area, VehicleArea::GLOBAL); +} + +TEST(VehicleUtilsTest, testIsGlobalPropTrue) { + ASSERT_TRUE(isGlobalProp(toInt(VehicleProperty::INFO_VIN))); +} + +TEST(VehicleUtilsTest, testIsGlobalPropFalse) { + ASSERT_FALSE(isGlobalProp(toInt(VehicleProperty::TIRE_PRESSURE))); +} + +TEST(VehicleUtilsTest, testIsSystemPropTrue) { + ASSERT_TRUE(isSystemProp(toInt(VehicleProperty::INFO_VIN))); +} + +TEST(VehicleUtilsTest, testIsSystemPropFalse) { + // VehiclePropertyGroup:VENDOR,VehicleArea:GLOBAL,VehiclePropertyType:STRING + int vendorProp = 0x0100 + 0x20000000 + 0x01000000 + 0x00100000; + + ASSERT_FALSE(isSystemProp(vendorProp)); +} + +TEST(VehicleUtilsTest, testGetAreaConfigGlobal) { + VehiclePropValue testPropValue{.prop = toInt(VehicleProperty::INFO_VIN)}; + VehicleAreaConfig testAreaConfig{.areaId = 0, .minInt32Value = 1}; + VehiclePropConfig testConfig{.areaConfigs = {testAreaConfig}}; + + const VehicleAreaConfig* gotConfig = getAreaConfig(testPropValue, testConfig); + + ASSERT_EQ(*gotConfig, testAreaConfig); +} + +TEST(VehicleUtilsTest, testGetAreaConfigGlobalNoAreaConfig) { + VehiclePropValue testPropValue{.prop = toInt(VehicleProperty::INFO_VIN)}; + VehiclePropConfig testConfig{}; + + const VehicleAreaConfig* gotConfig = getAreaConfig(testPropValue, testConfig); + + ASSERT_EQ(gotConfig, nullptr); +} + +TEST(VehicleUtilsTest, testGetAreaConfigNonGlobal) { + VehiclePropValue testPropValue = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + }; + VehicleAreaConfig leftConfig{.areaId = WHEEL_FRONT_LEFT, .minInt32Value = 1}; + VehicleAreaConfig rightConfig{.areaId = WHEEL_FRONT_RIGHT, .minInt32Value = 2}; + VehiclePropConfig testConfig{.areaConfigs = {leftConfig, rightConfig}}; + + testPropValue.areaId = WHEEL_FRONT_LEFT; + const VehicleAreaConfig* gotConfig = getAreaConfig(testPropValue, testConfig); + + ASSERT_EQ(*gotConfig, leftConfig); +} + +TEST(VehicleUtilsTest, testGetAreaConfigNonGlobalNull) { + VehiclePropValue testPropValue = { + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + }; + VehicleAreaConfig leftConfig{.areaId = WHEEL_FRONT_LEFT, .minInt32Value = 1}; + VehicleAreaConfig rightConfig{.areaId = WHEEL_FRONT_RIGHT, .minInt32Value = 2}; + VehiclePropConfig testConfig{.areaConfigs = {leftConfig, rightConfig}}; + + // No config for this area. + testPropValue.areaId = 0; + const VehicleAreaConfig* gotConfig = getAreaConfig(testPropValue, testConfig); + + ASSERT_EQ(gotConfig, nullptr); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueInt32) { + std::unique_ptr value = createVehiclePropValue(VehiclePropertyType::INT32); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.int32Values.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueInt32Vec) { + std::unique_ptr value = + createVehiclePropValue(VehiclePropertyType::INT32_VEC); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.int32Values.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueInt64) { + std::unique_ptr value = createVehiclePropValue(VehiclePropertyType::INT64); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.int64Values.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueInt64Vec) { + std::unique_ptr value = + createVehiclePropValue(VehiclePropertyType::INT64_VEC); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.int64Values.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueFloat) { + std::unique_ptr value = createVehiclePropValue(VehiclePropertyType::FLOAT); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.floatValues.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueFloatVec) { + std::unique_ptr value = + createVehiclePropValue(VehiclePropertyType::FLOAT_VEC); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.floatValues.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueBytes) { + std::unique_ptr value = createVehiclePropValue(VehiclePropertyType::BYTES); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.byteValues.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueString) { + std::unique_ptr value = createVehiclePropValue(VehiclePropertyType::STRING); + + ASSERT_NE(value, nullptr); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueMixed) { + std::unique_ptr value = createVehiclePropValue(VehiclePropertyType::MIXED); + + ASSERT_NE(value, nullptr); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueVecInt32) { + std::unique_ptr value = + createVehiclePropValueVec(VehiclePropertyType::INT32, /*vecSize=*/2); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.int32Values.size()) + << "vector size should always be 1 for single value type"; +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueIntVec32Vec) { + std::unique_ptr value = + createVehiclePropValueVec(VehiclePropertyType::INT32_VEC, /*vecSize=*/2); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(2u, value->value.int32Values.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueVecInt64) { + std::unique_ptr value = + createVehiclePropValueVec(VehiclePropertyType::INT64, /*vecSize=*/2); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.int64Values.size()) + << "vector size should always be 1 for single value type"; +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueIntVec64Vec) { + std::unique_ptr value = + createVehiclePropValueVec(VehiclePropertyType::INT64_VEC, /*vecSize=*/2); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(2u, value->value.int64Values.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueVecFloat) { + std::unique_ptr value = + createVehiclePropValueVec(VehiclePropertyType::FLOAT, /*vecSize=*/2); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(1u, value->value.floatValues.size()) + << "vector size should always be 1 for single value type"; +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueFloatVecMultiValues) { + std::unique_ptr value = + createVehiclePropValueVec(VehiclePropertyType::FLOAT_VEC, /*vecSize=*/2); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(2u, value->value.floatValues.size()); +} + +TEST(VehicleUtilsTest, testCreateVehiclePropValueVecBytes) { + std::unique_ptr value = + createVehiclePropValueVec(VehiclePropertyType::BYTES, /*vecSize=*/2); + + ASSERT_NE(value, nullptr); + ASSERT_EQ(2u, value->value.byteValues.size()); +} + +TEST(VehicleUtilsTest, testConcurrentQueueOneThread) { + ConcurrentQueue queue; + + queue.push(1); + queue.push(2); + auto result = queue.flush(); + + ASSERT_EQ(result, std::vector({1, 2})); +} + +TEST(VehicleUtilsTest, testConcurrentQueueMultipleThreads) { + ConcurrentQueue queue; + std::vector results; + std::atomic stop = false; + + std::thread t1([&queue]() { + for (int i = 0; i < 100; i++) { + queue.push(0); + } + }); + std::thread t2([&queue]() { + for (int i = 0; i < 100; i++) { + queue.push(1); + } + }); + std::thread t3([&queue, &results, &stop]() { + while (!stop) { + queue.waitForItems(); + for (int i : queue.flush()) { + results.push_back(i); + } + } + + // After we stop, get all the remaining values in the queue. + for (int i : queue.flush()) { + results.push_back(i); + } + }); + + t1.join(); + t2.join(); + + stop = true; + queue.deactivate(); + t3.join(); + + size_t zeroCount = 0; + size_t oneCount = 0; + for (int i : results) { + if (i == 0) { + zeroCount++; + } + if (i == 1) { + oneCount++; + } + } + + EXPECT_EQ(results.size(), static_cast(200)); + EXPECT_EQ(zeroCount, static_cast(100)); + EXPECT_EQ(oneCount, static_cast(100)); +} + +TEST(VehicleUtilsTest, testConcurrentQueuePushAfterDeactivate) { + ConcurrentQueue queue; + + queue.deactivate(); + queue.push(1); + + ASSERT_TRUE(queue.flush().empty()); +} + +TEST(VehicleUtilsTest, testConcurrentQueueDeactivateNotifyWaitingThread) { + ConcurrentQueue queue; + + std::thread t([&queue]() { + // This would block until queue is deactivated. + queue.waitForItems(); + }); + + queue.deactivate(); + + t.join(); +} + +TEST(VehicleUtilsTest, testVhalError) { + VhalResult result = Error(StatusCode::INVALID_ARG) << "error message"; + + ASSERT_EQ(result.error().message(), "error message: INVALID_ARG"); +} + +class InvalidPropValueTest : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(InvalidPropValueTests, InvalidPropValueTest, + testing::ValuesIn(getInvalidPropValuesTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(InvalidPropValueTest, testCheckPropValue) { + InvalidPropValueTestCase tc = GetParam(); + + // Config is not used for non-mixed types. + auto result = checkPropValue(tc.value, &tc.config); + + ASSERT_EQ(tc.valid, result.ok()); +} + +class InvalidValueRangeTest : public testing::TestWithParam {}; + +INSTANTIATE_TEST_SUITE_P(InvalidValueRangeTests, InvalidValueRangeTest, + testing::ValuesIn(getInvalidValueRangeTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(InvalidValueRangeTest, testCheckValueRange) { + InvalidValueRangeTestCase tc = GetParam(); + + // Config is not used for non-mixed types. + auto result = checkValueRange(tc.value, &tc.config); + + ASSERT_EQ(tc.valid, result.ok()); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/utils/test/Android.bp b/automotive/vehicle/aidl/impl/utils/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..ad9954fbf2b70c0eb729421efd38bfcb8f387cbf --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/test/Android.bp @@ -0,0 +1,26 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_headers { + name: "VehicleHalTestUtilHeaders", + vendor: true, + header_libs: ["VehicleHalUtilHeaders"], + export_include_dirs: ["include"], +} diff --git a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..d512713cc948140d601c982a77c7cad368a233ab --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h @@ -0,0 +1,100 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_utils_test_include_TestPropertyUtils_H_ +#define android_hardware_automotive_vehicle_utils_test_include_TestPropertyUtils_H_ + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace testpropertyutils_impl { + +// These names are not part of the API since we only expose ints. +using ::aidl::android::hardware::automotive::vehicle::VehicleArea; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; + +} // namespace testpropertyutils_impl + +#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING +// Converts the system property to the vendor property. +// WARNING: This is only for the end-to-end testing, Should NOT include in the user build. +inline constexpr int32_t toVendor( + const aidl::android::hardware::automotive::vehicle::VehicleProperty& prop) { + return (toInt(prop) & ~toInt(testpropertyutils_impl::VehiclePropertyGroup::MASK)) | + toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR); +} + +// These properties are used for the end-to-end testing of ClusterHomeService. +constexpr int32_t VENDOR_CLUSTER_SWITCH_UI = + toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_SWITCH_UI); +constexpr int32_t VENDOR_CLUSTER_DISPLAY_STATE = + toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_DISPLAY_STATE); +constexpr int32_t VENDOR_CLUSTER_REPORT_STATE = + toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_REPORT_STATE); +constexpr int32_t VENDOR_CLUSTER_REQUEST_DISPLAY = + toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_REQUEST_DISPLAY); +constexpr int32_t VENDOR_CLUSTER_NAVIGATION_STATE = + toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_NAVIGATION_STATE); +#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING + +// These properties are placeholder properties for developers to test new features without +// implementing a real property. +constexpr int32_t PLACEHOLDER_PROPERTY_INT = + 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::INT32); +constexpr int32_t PLACEHOLDER_PROPERTY_FLOAT = + 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::FLOAT); +constexpr int32_t PLACEHOLDER_PROPERTY_BOOLEAN = + 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::BOOLEAN); +constexpr int32_t PLACEHOLDER_PROPERTY_STRING = + 0x2a11 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::STRING); + +// This property is used for testing LargeParcelable marshalling/unmarhsalling end to end. +// It acts as an regular property that stores the property value when setting and return the value +// when getting, except that all the byteValues used in the setValue response would be filled in +// the reverse order. +// 0x21702a12 +constexpr int32_t ECHO_REVERSE_BYTES = 0x2a12 | + toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::BYTES); + +// This property is used for test purpose. End to end tests use this property to test set and get +// method for MIXED type properties. +constexpr int32_t kMixedTypePropertyForTest = + 0x1111 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::MIXED); +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_utils_test_include_TestPropertyUtils_H_ diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..5abcaf69803563a3383c03ec883bbc68c8f04a70 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/Android.bp @@ -0,0 +1,68 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_binary { + name: "android.hardware.automotive.vehicle@V1-default-service", + vendor: true, + defaults: [ + "FakeVehicleHardwareDefaults", + "VehicleHalDefaults", + "android-automotive-large-parcelable-defaults", + ], + vintf_fragments: ["vhal-default-service.xml"], + init_rc: ["vhal-default-service.rc"], + relative_install_path: "hw", + srcs: ["src/VehicleService.cpp"], + static_libs: [ + "DefaultVehicleHal", + "FakeVehicleHardware", + "VehicleHalUtils", + ], + header_libs: [ + "IVehicleHardware", + ], + shared_libs: [ + "libbinder_ndk", + ], +} + +cc_library { + name: "DefaultVehicleHal", + vendor: true, + defaults: [ + "VehicleHalDefaults", + ], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + srcs: [ + "src/ConnectedClient.cpp", + "src/DefaultVehicleHal.cpp", + "src/SubscriptionManager.cpp", + ], + static_libs: [ + "VehicleHalUtils", + ], + header_libs: [ + "IVehicleHardware", + ], + shared_libs: [ + "libbinder_ndk", + ], +} diff --git a/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h b/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h new file mode 100644 index 0000000000000000000000000000000000000000..2e7298ff0bd1b6bb1d1c25b112f62ede480604d2 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/include/ConnectedClient.h @@ -0,0 +1,138 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_ConnectedClient_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_include_ConnectedClient_H_ + +#include "PendingRequestPool.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// A class to represent a binder client with a callback interface. Each callback function, e.g. +// GetValues or SetValues for a specific binder client is a separate {@code ConnectedClient}. +// For one {@code ConnectedClient}, we use one pending request pool to manage all pending requests, +// so the request IDs must be unique for one client. We also manage a set of callback functions +// for one client, e.g. timeoutCallback which could be passed to hardware. +// This class is thread-safe. +class ConnectedClient { + public: + using CallbackType = + std::shared_ptr; + + ConnectedClient(std::shared_ptr requestPool, CallbackType callback); + + virtual ~ConnectedClient() = default; + + // Gets the unique ID for this client. + const void* id(); + + // Adds client requests. The requests would be registered as pending requests until + // {@code tryFinishRequests} is called for them. + // Returns {@code INVALID_ARG} error if any of the requestIds are duplicate with one of the + // pending request IDs or {@code TRY_AGAIN} error if the pending request pool is full and could + // no longer add requests. + VhalResult addRequests(const std::unordered_set& requestIds); + + // Marks the requests as finished. Returns a list of request IDs that was pending and has been + // finished. It must be a set of the requested request IDs. + std::unordered_set tryFinishRequests(const std::unordered_set& requestIds); + + protected: + // Gets the callback to be called when the request for this client has timeout. + virtual std::shared_ptr getTimeoutCallback() = 0; + + const std::shared_ptr mRequestPool; + const CallbackType mCallback; +}; + +// A class to represent a client that calls {@code IVehicle.setValues} or {@code +// IVehicle.getValues}. +template +class GetSetValuesClient final : public ConnectedClient { + public: + GetSetValuesClient(std::shared_ptr requestPool, CallbackType callback); + + // Sends the results to this client. + void sendResults(std::vector&& results); + + // Sends each result separately to this client. Each result would be sent through one callback + // invocation. + void sendResultsSeparately(const std::vector& results); + + // Gets the callback to be called when the request for this client has finished. + std::shared_ptr)>> getResultCallback(); + + protected: + // Gets the callback to be called when the request for this client has timeout. + std::shared_ptr getTimeoutCallback() override; + + private: + // The following members are only initialized during construction. + std::shared_ptr mTimeoutCallback; + std::shared_ptr)>> mResultCallback; +}; + +// A class to represent a client that calls {@code IVehicle.subscribe}. +class SubscriptionClient final : public ConnectedClient { + public: + SubscriptionClient(std::shared_ptr requestPool, CallbackType callback); + + // Gets the callback to be called when the request for this client has finished. + std::shared_ptr getResultCallback(); + + // Marshals the updated values into largeParcelable and sents it through {@code onPropertyEvent} + // callback. + static void sendUpdatedValues( + CallbackType callback, + std::vector&& + updatedValues); + + protected: + // Gets the callback to be called when the request for this client has timeout. + std::shared_ptr getTimeoutCallback() override; + + private: + // The following members are only initialized during construction. + std::shared_ptr mTimeoutCallback; + std::shared_ptr mResultCallback; + std::shared_ptr mPropertyChangeCallback; + + static void onGetValueResults( + const void* clientId, CallbackType callback, + std::shared_ptr requestPool, + std::vector results); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_ConnectedClient_H_ diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h new file mode 100644 index 0000000000000000000000000000000000000000..9c29816fafb896b6d592649cbb07bb5ff8cb5585 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h @@ -0,0 +1,274 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehicle::BnVehicle { + public: + using CallbackType = + std::shared_ptr; + + explicit DefaultVehicleHal(std::unique_ptr hardware); + + ~DefaultVehicleHal(); + + ndk::ScopedAStatus getAllPropConfigs( + aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) + override; + ndk::ScopedAStatus getValues( + const CallbackType& callback, + const aidl::android::hardware::automotive::vehicle::GetValueRequests& requests) + override; + ndk::ScopedAStatus setValues( + const CallbackType& callback, + const aidl::android::hardware::automotive::vehicle::SetValueRequests& requests) + override; + ndk::ScopedAStatus getPropConfigs( + const std::vector& props, + aidl::android::hardware::automotive::vehicle::VehiclePropConfigs* returnConfigs) + override; + ndk::ScopedAStatus subscribe( + const CallbackType& callback, + const std::vector& + options, + int32_t maxSharedMemoryFileCount) override; + ndk::ScopedAStatus unsubscribe(const CallbackType& callback, + const std::vector& propIds) override; + ndk::ScopedAStatus returnSharedMemory(const CallbackType& callback, + int64_t sharedMemoryId) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + + IVehicleHardware* getHardware(); + + private: + // friend class for unit testing. + friend class DefaultVehicleHalTest; + + using GetValuesClient = + GetSetValuesClient; + using SetValuesClient = + GetSetValuesClient; + + // A thread safe class to maintain an increasing request ID for each subscribe client. This + // class is safe to pass to async callbacks. + class SubscribeIdByClient { + public: + int64_t getId(const CallbackType& callback); + + private: + std::mutex mLock; + std::unordered_map mIds GUARDED_BY(mLock); + }; + + // A thread safe class to store all subscribe clients. This class is safe to pass to async + // callbacks. + class SubscriptionClients { + public: + SubscriptionClients(std::shared_ptr pool) : mPendingRequestPool(pool) {} + + std::shared_ptr maybeAddClient(const CallbackType& callback); + + std::shared_ptr getClient(const CallbackType& callback); + + void removeClient(const AIBinder* clientId); + + size_t countClients(); + + private: + std::mutex mLock; + std::unordered_map> mClients + GUARDED_BY(mLock); + // PendingRequestPool is thread-safe. + std::shared_ptr mPendingRequestPool; + }; + + // A wrapper for binder operations to enable stubbing for test. + class IBinder { + public: + virtual ~IBinder() = default; + + virtual binder_status_t linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, + void* cookie) = 0; + + virtual bool isAlive(const AIBinder* binder) = 0; + }; + + // A real implementation for IBinder. + class AIBinderImpl final : public IBinder { + public: + binder_status_t linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, + void* cookie) override; + + bool isAlive(const AIBinder* binder) override; + }; + + // OnBinderDiedContext is a type used as a cookie passed deathRecipient. The deathRecipient's + // onBinderDied function takes only a cookie as input and we have to store all the contexts + // as the cookie. + struct OnBinderDiedContext { + DefaultVehicleHal* vhal; + const AIBinder* clientId; + }; + + // BinderDiedUnlinkedEvent represents either an onBinderDied or an onBinderUnlinked event. + struct BinderDiedUnlinkedEvent { + // true for onBinderDied, false for onBinderUnlinked. + bool onBinderDied; + const AIBinder* clientId; + }; + + // The default timeout of get or set value requests is 30s. + // TODO(b/214605968): define TIMEOUT_IN_NANO in IVehicle and allow getValues/setValues/subscribe + // to specify custom timeouts. + static constexpr int64_t TIMEOUT_IN_NANO = 30'000'000'000; + // heart beat event interval: 3s + static constexpr int64_t HEART_BEAT_INTERVAL_IN_NANO = 3'000'000'000; + std::unique_ptr mVehicleHardware; + + // mConfigsByPropId and mConfigFile are only modified during initialization, so no need to + // lock guard them. + std::unordered_map + mConfigsByPropId; + // Only modified in constructor, so thread-safe. + std::unique_ptr mConfigFile; + // PendingRequestPool is thread-safe. + std::shared_ptr mPendingRequestPool; + // SubscriptionManager is thread-safe. + std::shared_ptr mSubscriptionManager; + + std::mutex mLock; + std::unordered_map> mOnBinderDiedContexts + GUARDED_BY(mLock); + std::unordered_map> mGetValuesClients + GUARDED_BY(mLock); + std::unordered_map> mSetValuesClients + GUARDED_BY(mLock); + // SubscriptionClients is thread-safe. + std::shared_ptr mSubscriptionClients; + // mBinderImpl is only going to be changed in test. + std::unique_ptr mBinderImpl; + + // Only initialized once. + std::shared_ptr> mRecurrentAction; + // RecurrentTimer is thread-safe. + RecurrentTimer mRecurrentTimer; + + ndk::ScopedAIBinder_DeathRecipient mDeathRecipient; + + // ConcurrentQueue is thread-safe. + ConcurrentQueue mBinderEvents; + + // A thread to handle onBinderDied or onBinderUnlinked event. + std::thread mOnBinderDiedUnlinkedHandlerThread; + + android::base::Result checkProperty( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& propValue); + + android::base::Result> checkDuplicateRequests( + const std::vector& + requests); + + android::base::Result> checkDuplicateRequests( + const std::vector& + requests); + + VhalResult checkSubscribeOptions( + const std::vector& + options); + + VhalResult checkReadPermission( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + + VhalResult checkWritePermission( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; + + android::base::Result + getConfig(int32_t propId) const; + + void onBinderDiedWithContext(const AIBinder* clientId); + + void onBinderUnlinkedWithContext(const AIBinder* clientId); + + // Registers a onBinderDied callback for the client if not already registered. + // Returns true if the client Binder is alive, false otherwise. + bool monitorBinderLifeCycleLocked(const AIBinder* clientId) REQUIRES(mLock); + + bool checkDumpPermission(); + + // The looping handler function to process all onBinderDied or onBinderUnlinked events in + // mBinderEvents. + void onBinderDiedUnlinkedHandler(); + + // Gets or creates a {@code T} object for the client to or from {@code clients}. + template + static std::shared_ptr getOrCreateClient( + std::unordered_map>* clients, + const CallbackType& callback, std::shared_ptr pendingRequestPool); + + static void onPropertyChangeEvent( + std::weak_ptr subscriptionManager, + const std::vector& + updatedValues); + + static void checkHealth(IVehicleHardware* hardware, + std::weak_ptr subscriptionManager); + + static void onBinderDied(void* cookie); + + static void onBinderUnlinked(void* cookie); + + // Test-only + // Set the default timeout for pending requests. + void setTimeout(int64_t timeoutInNano); + + // Test-only + void setBinderImpl(std::unique_ptr impl); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_DefaultVehicleHal_H_ diff --git a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h new file mode 100644 index 0000000000000000000000000000000000000000..7c8f1b4672be5883e967caaccaa82a8d1268c962 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h @@ -0,0 +1,143 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_include_SubscriptionManager_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_include_SubscriptionManager_H_ + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// A class to represent all the subscription configs for a continuous [propId, areaId]. +class ContSubConfigs final { + public: + using ClientIdType = const AIBinder*; + + void addClient(const ClientIdType& clientId, float sampleRate); + void removeClient(const ClientIdType& clientId); + float getMaxSampleRate(); + + private: + float mMaxSampleRate = 0.; + std::unordered_map mSampleRates; + + void refreshMaxSampleRate(); +}; + +// A thread-safe subscription manager that manages all VHAL subscriptions. +class SubscriptionManager final { + public: + using ClientIdType = const AIBinder*; + using CallbackType = + std::shared_ptr; + + explicit SubscriptionManager(IVehicleHardware* hardware); + ~SubscriptionManager(); + + // Subscribes to properties according to {@code SubscribeOptions}. Note that all option must + // contain non-empty areaIds field, which contains all area IDs to subscribe. As a result, + // the options here is different from the options passed from VHAL client. + // Returns error if any of the subscribe options is not valid or one of the properties failed + // to subscribe. Part of the properties maybe be subscribed successfully if this function + // returns error. Caller is safe to retry since subscribing to an already subscribed property + // is okay. + // Returns ok if all the options are parsed correctly and all the properties are subscribed. + VhalResult subscribe( + const CallbackType& callback, + const std::vector& + options, + bool isContinuousProperty); + + // Unsubscribes from the properties for the client. + // Returns error if the client was not subscribed before, or one of the given property was not + // subscribed, or one of the property failed to unsubscribe. Caller is safe to retry since + // unsubscribing to an already unsubscribed property is okay (it would be ignored). + // Returns ok if all the requested properties for the client are unsubscribed. + VhalResult unsubscribe(ClientIdType client, const std::vector& propIds); + + // Unsubscribes from all the properties for the client. + // Returns error if the client was not subscribed before or one of the subscribed properties + // for the client failed to unsubscribe. Caller is safe to retry. + // Returns ok if all the properties for the client are unsubscribed. + VhalResult unsubscribe(ClientIdType client); + + // For a list of updated properties, returns a map that maps clients subscribing to + // the updated properties to a list of updated values. This would only return on-change property + // clients that should be informed for the given updated values. + std::unordered_map< + CallbackType, + std::vector> + getSubscribedClients( + const std::vector& + updatedValues); + + // Gets the sample rate for the continuous property. Returns {@code std::nullopt} if the + // property has not been subscribed before or is not a continuous property. + std::optional getSampleRate(const ClientIdType& clientId, int32_t propId, + int32_t areaId); + + // Checks whether the sample rate is valid. + static bool checkSampleRate(float sampleRate); + + private: + // Friend class for testing. + friend class DefaultVehicleHalTest; + + IVehicleHardware* mVehicleHardware; + + mutable std::mutex mLock; + std::unordered_map, + PropIdAreaIdHash> + mClientsByPropIdArea GUARDED_BY(mLock); + std::unordered_map> + mSubscribedPropsByClient GUARDED_BY(mLock); + std::unordered_map mContSubConfigsByPropIdArea + GUARDED_BY(mLock); + + VhalResult updateSampleRateLocked(const ClientIdType& clientId, + const PropIdAreaId& propIdAreaId, float sampleRate) + REQUIRES(mLock); + VhalResult removeSampleRateLocked(const ClientIdType& clientId, + const PropIdAreaId& propIdAreaId) REQUIRES(mLock); + + // Checks whether the manager is empty. For testing purpose. + bool isEmpty(); + + // Get the interval in nanoseconds accroding to sample rate. + static android::base::Result getInterval(float sampleRate); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_include_SubscriptionManager_H_ diff --git a/automotive/vehicle/aidl/impl/vhal/src/ConnectedClient.cpp b/automotive/vehicle/aidl/impl/vhal/src/ConnectedClient.cpp new file mode 100644 index 0000000000000000000000000000000000000000..81d231c87ff6f151ff8ea252d7cc4bd0305a6952 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/src/ConnectedClient.cpp @@ -0,0 +1,350 @@ +/* + * 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. + */ + +#include "ConnectedClient.h" +#include "ParcelableUtils.h" + +#include + +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::GetValueResult; +using ::aidl::android::hardware::automotive::vehicle::GetValueResults; +using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; +using ::aidl::android::hardware::automotive::vehicle::SetValueResult; +using ::aidl::android::hardware::automotive::vehicle::SetValueResults; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues; +using ::android::base::Result; +using ::ndk::ScopedAStatus; + +// A function to call the specific callback based on results type. +template +ScopedAStatus callCallback(std::shared_ptr callback, const T& results); + +template <> +ScopedAStatus callCallback(std::shared_ptr callback, + const GetValueResults& results) { + return callback->onGetValues(results); +} + +template <> +ScopedAStatus callCallback(std::shared_ptr callback, + const SetValueResults& results) { + return callback->onSetValues(results); +} + +// Send a single GetValue/SetValue result through the callback. +template +void sendGetOrSetValueResult(std::shared_ptr callback, const ResultType& result) { + ResultsType parcelableResults; + parcelableResults.payloads.resize(1); + parcelableResults.payloads[0] = result; + if (ScopedAStatus callbackStatus = callCallback(callback, parcelableResults); + !callbackStatus.isOk()) { + ALOGE("failed to call GetOrSetValueResult callback, client ID: %p, error: %s, " + "exception: %d, service specific error: %d", + callback->asBinder().get(), callbackStatus.getMessage(), + callbackStatus.getExceptionCode(), callbackStatus.getServiceSpecificError()); + } +} + +// Send all the GetValue/SetValue results through callback, one result in each callback invocation. +template +void sendGetOrSetValueResultsSeparately(std::shared_ptr callback, + const std::vector& results) { + for (const auto& result : results) { + sendGetOrSetValueResult(callback, result); + } +} + +// Send all the GetValue/SetValue results through callback in a single callback invocation. +template +void sendGetOrSetValueResults(std::shared_ptr callback, + std::vector&& results) { + ResultsType parcelableResults; + ScopedAStatus status = vectorToStableLargeParcelable(std::move(results), &parcelableResults); + if (status.isOk()) { + if (ScopedAStatus callbackStatus = callCallback(callback, parcelableResults); + !callbackStatus.isOk()) { + ALOGE("failed to call GetOrSetValueResults callback, client ID: %p, error: %s, " + "exception: %d, service specific error: %d", + callback->asBinder().get(), callbackStatus.getMessage(), + callbackStatus.getExceptionCode(), callbackStatus.getServiceSpecificError()); + } + return; + } + int statusCode = status.getServiceSpecificError(); + ALOGE("failed to marshal result into large parcelable, error: " + "%s, code: %d", + status.getMessage(), statusCode); + sendGetOrSetValueResultsSeparately(callback, + parcelableResults.payloads); +} + +// The timeout callback for GetValues/SetValues. +template +void onTimeout( + std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback> callback, + const std::unordered_set& timeoutIds) { + std::vector timeoutResults; + for (int64_t requestId : timeoutIds) { + ALOGD("hardware request timeout, request ID: %" PRId64, requestId); + timeoutResults.push_back({ + .requestId = requestId, + .status = StatusCode::TRY_AGAIN, + }); + } + sendGetOrSetValueResults(callback, std::move(timeoutResults)); +} + +// The on-results callback for GetValues/SetValues. +template +void getOrSetValuesCallback( + const void* clientId, + std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback> callback, + std::vector&& results, std::shared_ptr requestPool) { + std::unordered_set requestIds; + for (const auto& result : results) { + requestIds.insert(result.requestId); + } + + auto finishedRequests = requestPool->tryFinishRequests(clientId, requestIds); + + auto it = results.begin(); + while (it != results.end()) { + int64_t requestId = it->requestId; + if (finishedRequests.find(requestId) == finishedRequests.end()) { + ALOGD("no pending request for the result from hardware, " + "possibly already time-out, ID: %" PRId64, + requestId); + it = results.erase(it); + } else { + it++; + } + } + + if (!results.empty()) { + sendGetOrSetValueResults(callback, std::move(results)); + } +} + +// Specify the functions for GetValues and SetValues types. +template void sendGetOrSetValueResult( + std::shared_ptr callback, const GetValueResult& result); +template void sendGetOrSetValueResult( + std::shared_ptr callback, const SetValueResult& result); + +template void sendGetOrSetValueResults( + std::shared_ptr callback, std::vector&& results); +template void sendGetOrSetValueResults( + std::shared_ptr callback, std::vector&& results); + +template void sendGetOrSetValueResultsSeparately( + std::shared_ptr callback, const std::vector& results); +template void sendGetOrSetValueResultsSeparately( + std::shared_ptr callback, const std::vector& results); + +template void onTimeout( + std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback> callback, + const std::unordered_set& timeoutIds); +template void onTimeout( + std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback> callback, + const std::unordered_set& timeoutIds); + +template void getOrSetValuesCallback( + const void* clientId, + std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback> callback, + std::vector&& results, std::shared_ptr requestPool); +template void getOrSetValuesCallback( + const void* clientId, + std::shared_ptr<::aidl::android::hardware::automotive::vehicle::IVehicleCallback> callback, + std::vector&& results, std::shared_ptr requestPool); + +} // namespace + +ConnectedClient::ConnectedClient(std::shared_ptr requestPool, + std::shared_ptr callback) + : mRequestPool(requestPool), mCallback(callback) {} + +const void* ConnectedClient::id() { + return reinterpret_cast(this); +} + +VhalResult ConnectedClient::addRequests(const std::unordered_set& requestIds) { + return mRequestPool->addRequests(id(), requestIds, getTimeoutCallback()); +} + +std::unordered_set ConnectedClient::tryFinishRequests( + const std::unordered_set& requestIds) { + return mRequestPool->tryFinishRequests(id(), requestIds); +} + +template +GetSetValuesClient::GetSetValuesClient( + std::shared_ptr requestPool, std::shared_ptr callback) + : ConnectedClient(requestPool, callback) { + mTimeoutCallback = std::make_shared( + [callback](const std::unordered_set& timeoutIds) { + return onTimeout(callback, timeoutIds); + }); + auto requestPoolCopy = mRequestPool; + const void* clientId = id(); + mResultCallback = std::make_shared)>>( + [clientId, callback, requestPoolCopy](std::vector results) { + return getOrSetValuesCallback( + clientId, callback, std::move(results), requestPoolCopy); + }); +} + +template +std::shared_ptr)>> +GetSetValuesClient::getResultCallback() { + return mResultCallback; +} + +template +std::shared_ptr +GetSetValuesClient::getTimeoutCallback() { + return mTimeoutCallback; +} + +template +void GetSetValuesClient::sendResults(std::vector&& results) { + return sendGetOrSetValueResults(mCallback, std::move(results)); +} + +template +void GetSetValuesClient::sendResultsSeparately( + const std::vector& results) { + return sendGetOrSetValueResultsSeparately(mCallback, results); +} + +template class GetSetValuesClient; +template class GetSetValuesClient; + +SubscriptionClient::SubscriptionClient(std::shared_ptr requestPool, + std::shared_ptr callback) + : ConnectedClient(requestPool, callback) { + mTimeoutCallback = std::make_shared( + [](std::unordered_set timeoutIds) { + for (int64_t id : timeoutIds) { + ALOGW("subscribe: requests with IDs: %" PRId64 + " has timed-out, not client informed, " + "possibly one of recurrent requests for this subscription failed", + id); + } + }); + auto requestPoolCopy = mRequestPool; + const void* clientId = reinterpret_cast(this); + mResultCallback = std::make_shared( + [clientId, callback, requestPoolCopy](std::vector results) { + onGetValueResults(clientId, callback, requestPoolCopy, results); + }); +} + +std::shared_ptr)>> +SubscriptionClient::getResultCallback() { + return mResultCallback; +} + +std::shared_ptr +SubscriptionClient::getTimeoutCallback() { + return mTimeoutCallback; +} + +void SubscriptionClient::sendUpdatedValues(std::shared_ptr callback, + std::vector&& updatedValues) { + if (updatedValues.empty()) { + return; + } + + // TODO(b/205189110): Use memory pool here and fill in sharedMemoryId. + VehiclePropValues vehiclePropValues; + int32_t sharedMemoryFileCount = 0; + ScopedAStatus status = + vectorToStableLargeParcelable(std::move(updatedValues), &vehiclePropValues); + if (!status.isOk()) { + int statusCode = status.getServiceSpecificError(); + ALOGE("subscribe: failed to marshal result into large parcelable, error: " + "%s, code: %d", + status.getMessage(), statusCode); + return; + } + + if (ScopedAStatus callbackStatus = + callback->onPropertyEvent(vehiclePropValues, sharedMemoryFileCount); + !callbackStatus.isOk()) { + ALOGE("subscribe: failed to call UpdateValues callback, client ID: %p, error: %s, " + "exception: %d, service specific error: %d", + callback->asBinder().get(), callbackStatus.getMessage(), + callbackStatus.getExceptionCode(), callbackStatus.getServiceSpecificError()); + } +} + +void SubscriptionClient::onGetValueResults(const void* clientId, + std::shared_ptr callback, + std::shared_ptr requestPool, + std::vector results) { + std::unordered_set requestIds; + for (const auto& result : results) { + requestIds.insert(result.requestId); + } + + auto finishedRequests = requestPool->tryFinishRequests(clientId, requestIds); + std::vector propValues; + for (auto& result : results) { + int64_t requestId = result.requestId; + if (finishedRequests.find(requestId) == finishedRequests.end()) { + ALOGE("subscribe[%" PRId64 + "]: no pending request for the result from hardware, " + "possibly already time-out", + requestId); + continue; + } + if (result.status != StatusCode::OK) { + ALOGE("subscribe[%" PRId64 + "]: hardware returns non-ok status for getValues, status: " + "%d", + requestId, toInt(result.status)); + continue; + } + if (!result.prop.has_value()) { + ALOGE("subscribe[%" PRId64 "]: no prop value in getValues result", requestId); + continue; + } + propValues.push_back(std::move(result.prop.value())); + } + + sendUpdatedValues(callback, std::move(propValues)); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b191aef9b344764ac8ae786be43c9136d0514ca4 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -0,0 +1,799 @@ +/* + * 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_TAG "DefaultVehicleHal" + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::GetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::GetValueRequests; +using ::aidl::android::hardware::automotive::vehicle::GetValueResult; +using ::aidl::android::hardware::automotive::vehicle::GetValueResults; +using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::SetValueRequests; +using ::aidl::android::hardware::automotive::vehicle::SetValueResult; +using ::aidl::android::hardware::automotive::vehicle::SetValueResults; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::automotive::car_binder_lib::LargeParcelableBase; +using ::android::base::Error; +using ::android::base::expected; +using ::android::base::Result; +using ::android::base::StringPrintf; + +using ::ndk::ScopedAIBinder_DeathRecipient; +using ::ndk::ScopedAStatus; + +std::string toString(const std::unordered_set& values) { + std::string str = ""; + for (auto it = values.begin(); it != values.end(); it++) { + str += std::to_string(*it); + if (std::next(it, 1) != values.end()) { + str += ", "; + } + } + return str; +} + +float getDefaultSampleRate(float sampleRate, float minSampleRate, float maxSampleRate) { + if (sampleRate < minSampleRate) { + return minSampleRate; + } + if (sampleRate > maxSampleRate) { + return maxSampleRate; + } + return sampleRate; +} + +} // namespace + +std::shared_ptr DefaultVehicleHal::SubscriptionClients::maybeAddClient( + const CallbackType& callback) { + std::scoped_lock lockGuard(mLock); + return getOrCreateClient(&mClients, callback, mPendingRequestPool); +} + +std::shared_ptr DefaultVehicleHal::SubscriptionClients::getClient( + const CallbackType& callback) { + std::scoped_lock lockGuard(mLock); + const AIBinder* clientId = callback->asBinder().get(); + if (mClients.find(clientId) == mClients.end()) { + return nullptr; + } + return mClients[clientId]; +} + +int64_t DefaultVehicleHal::SubscribeIdByClient::getId(const CallbackType& callback) { + std::scoped_lock lockGuard(mLock); + // This would be initialized to 0 if callback does not exist in the map. + int64_t subscribeId = (mIds[callback->asBinder().get()])++; + return subscribeId; +} + +void DefaultVehicleHal::SubscriptionClients::removeClient(const AIBinder* clientId) { + std::scoped_lock lockGuard(mLock); + mClients.erase(clientId); +} + +size_t DefaultVehicleHal::SubscriptionClients::countClients() { + std::scoped_lock lockGuard(mLock); + return mClients.size(); +} + +DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr hardware) + : mVehicleHardware(std::move(hardware)), + mPendingRequestPool(std::make_shared(TIMEOUT_IN_NANO)) { + auto configs = mVehicleHardware->getAllPropertyConfigs(); + for (auto& config : configs) { + mConfigsByPropId[config.prop] = config; + } + VehiclePropConfigs vehiclePropConfigs; + vehiclePropConfigs.payloads = std::move(configs); + auto result = LargeParcelableBase::parcelableToStableLargeParcelable(vehiclePropConfigs); + if (!result.ok()) { + ALOGE("failed to convert configs to shared memory file, error: %s, code: %d", + result.error().message().c_str(), static_cast(result.error().code())); + return; + } + + if (result.value() != nullptr) { + mConfigFile = std::move(result.value()); + } + + mSubscriptionClients = std::make_shared(mPendingRequestPool); + mSubscriptionClients = std::make_shared(mPendingRequestPool); + + auto subscribeIdByClient = std::make_shared(); + IVehicleHardware* hardwarePtr = mVehicleHardware.get(); + mSubscriptionManager = std::make_shared(hardwarePtr); + + std::weak_ptr subscriptionManagerCopy = mSubscriptionManager; + mVehicleHardware->registerOnPropertyChangeEvent( + std::make_unique( + [subscriptionManagerCopy](std::vector updatedValues) { + onPropertyChangeEvent(subscriptionManagerCopy, updatedValues); + })); + + // Register heartbeat event. + mRecurrentAction = + std::make_shared>([hardwarePtr, subscriptionManagerCopy]() { + checkHealth(hardwarePtr, subscriptionManagerCopy); + }); + mRecurrentTimer.registerTimerCallback(HEART_BEAT_INTERVAL_IN_NANO, mRecurrentAction); + + mBinderImpl = std::make_unique(); + mOnBinderDiedUnlinkedHandlerThread = std::thread([this] { onBinderDiedUnlinkedHandler(); }); + mDeathRecipient = ScopedAIBinder_DeathRecipient( + AIBinder_DeathRecipient_new(&DefaultVehicleHal::onBinderDied)); + AIBinder_DeathRecipient_setOnUnlinked(mDeathRecipient.get(), + &DefaultVehicleHal::onBinderUnlinked); +} + +DefaultVehicleHal::~DefaultVehicleHal() { + // Delete the deathRecipient so that onBinderDied would not be called to reference 'this'. + mDeathRecipient = ScopedAIBinder_DeathRecipient(); + mBinderEvents.deactivate(); + if (mOnBinderDiedUnlinkedHandlerThread.joinable()) { + mOnBinderDiedUnlinkedHandlerThread.join(); + } + // mRecurrentAction uses pointer to mVehicleHardware, so it has to be unregistered before + // mVehicleHardware. + mRecurrentTimer.unregisterTimerCallback(mRecurrentAction); + // mSubscriptionManager uses pointer to mVehicleHardware, so it has to be destroyed before + // mVehicleHardware. + mSubscriptionManager.reset(); + mVehicleHardware.reset(); +} + +void DefaultVehicleHal::onPropertyChangeEvent( + std::weak_ptr subscriptionManager, + const std::vector& updatedValues) { + auto manager = subscriptionManager.lock(); + if (manager == nullptr) { + ALOGW("the SubscriptionManager is destroyed, DefaultVehicleHal is ending"); + return; + } + auto updatedValuesByClients = manager->getSubscribedClients(updatedValues); + for (const auto& [callback, valuePtrs] : updatedValuesByClients) { + std::vector values; + for (const VehiclePropValue* valuePtr : valuePtrs) { + values.push_back(*valuePtr); + } + SubscriptionClient::sendUpdatedValues(callback, std::move(values)); + } +} + +template +std::shared_ptr DefaultVehicleHal::getOrCreateClient( + std::unordered_map>* clients, + const CallbackType& callback, std::shared_ptr pendingRequestPool) { + const AIBinder* clientId = callback->asBinder().get(); + if (clients->find(clientId) == clients->end()) { + (*clients)[clientId] = std::make_shared(pendingRequestPool, callback); + } + return (*clients)[clientId]; +} + +bool DefaultVehicleHal::monitorBinderLifeCycleLocked(const AIBinder* clientId) { + OnBinderDiedContext* contextPtr = nullptr; + if (mOnBinderDiedContexts.find(clientId) != mOnBinderDiedContexts.end()) { + return mBinderImpl->isAlive(clientId); + } else { + std::unique_ptr context = std::make_unique( + OnBinderDiedContext{.vhal = this, .clientId = clientId}); + // We know context must be alive when we use contextPtr because context would only + // be removed in OnBinderUnlinked, which must be called after OnBinderDied. + contextPtr = context.get(); + // Insert into a map to keep the context object alive. + mOnBinderDiedContexts[clientId] = std::move(context); + } + + // If this function fails, onBinderUnlinked would be called to remove the added context. + binder_status_t status = mBinderImpl->linkToDeath( + const_cast(clientId), mDeathRecipient.get(), static_cast(contextPtr)); + if (status == STATUS_OK) { + return true; + } + ALOGE("failed to call linkToDeath on client binder, client may already died, status: %d", + static_cast(status)); + return false; +} + +void DefaultVehicleHal::onBinderDied(void* cookie) { + OnBinderDiedContext* context = reinterpret_cast(cookie); + // To be handled in mOnBinderDiedUnlinkedHandlerThread. We cannot handle the event in the same + // thread because we might be holding the mLock the handler requires. + context->vhal->mBinderEvents.push(BinderDiedUnlinkedEvent{true, context->clientId}); +} + +void DefaultVehicleHal::onBinderDiedWithContext(const AIBinder* clientId) { + std::scoped_lock lockGuard(mLock); + ALOGD("binder died, client ID: %p", clientId); + mSetValuesClients.erase(clientId); + mGetValuesClients.erase(clientId); + mSubscriptionClients->removeClient(clientId); + mSubscriptionManager->unsubscribe(clientId); +} + +void DefaultVehicleHal::onBinderUnlinked(void* cookie) { + OnBinderDiedContext* context = reinterpret_cast(cookie); + // To be handled in mOnBinderDiedUnlinkedHandlerThread. We cannot handle the event in the same + // thread because we might be holding the mLock the handler requires. + context->vhal->mBinderEvents.push(BinderDiedUnlinkedEvent{false, context->clientId}); +} + +void DefaultVehicleHal::onBinderUnlinkedWithContext(const AIBinder* clientId) { + ALOGD("binder unlinked"); + std::scoped_lock lockGuard(mLock); + // Delete the context associated with this cookie. + mOnBinderDiedContexts.erase(clientId); +} + +void DefaultVehicleHal::onBinderDiedUnlinkedHandler() { + while (mBinderEvents.waitForItems()) { + for (BinderDiedUnlinkedEvent& event : mBinderEvents.flush()) { + if (event.onBinderDied) { + onBinderDiedWithContext(event.clientId); + } else { + onBinderUnlinkedWithContext(event.clientId); + } + } + } +} + +template std::shared_ptr +DefaultVehicleHal::getOrCreateClient( + std::unordered_map>* clients, + const CallbackType& callback, std::shared_ptr pendingRequestPool); +template std::shared_ptr +DefaultVehicleHal::getOrCreateClient( + std::unordered_map>* clients, + const CallbackType& callback, std::shared_ptr pendingRequestPool); +template std::shared_ptr +DefaultVehicleHal::getOrCreateClient( + std::unordered_map>* clients, + const CallbackType& callback, std::shared_ptr pendingRequestPool); + +void DefaultVehicleHal::setTimeout(int64_t timeoutInNano) { + mPendingRequestPool = std::make_unique(timeoutInNano); +} + +ScopedAStatus DefaultVehicleHal::getAllPropConfigs(VehiclePropConfigs* output) { + if (mConfigFile != nullptr) { + output->payloads.clear(); + output->sharedMemoryFd.set(dup(mConfigFile->get())); + return ScopedAStatus::ok(); + } + output->payloads.reserve(mConfigsByPropId.size()); + for (const auto& [_, config] : mConfigsByPropId) { + output->payloads.push_back(config); + } + return ScopedAStatus::ok(); +} + +Result DefaultVehicleHal::getConfig(int32_t propId) const { + auto it = mConfigsByPropId.find(propId); + if (it == mConfigsByPropId.end()) { + return Error() << "no config for property, ID: " << propId; + } + return &(it->second); +} + +Result DefaultVehicleHal::checkProperty(const VehiclePropValue& propValue) { + int32_t propId = propValue.prop; + auto result = getConfig(propId); + if (!result.ok()) { + return result.error(); + } + const VehiclePropConfig* config = result.value(); + const VehicleAreaConfig* areaConfig = getAreaConfig(propValue, *config); + if (!isGlobalProp(propId) && areaConfig == nullptr) { + // Ignore areaId for global property. For non global property, check whether areaId is + // allowed. areaId must appear in areaConfig. + return Error() << "invalid area ID: " << propValue.areaId << " for prop ID: " << propId + << ", not listed in config"; + } + if (auto result = checkPropValue(propValue, config); !result.ok()) { + return Error() << "invalid property value: " << propValue.toString() + << ", error: " << getErrorMsg(result); + } + if (auto result = checkValueRange(propValue, areaConfig); !result.ok()) { + return Error() << "property value out of range: " << propValue.toString() + << ", error: " << getErrorMsg(result); + } + return {}; +} + +ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback, + const GetValueRequests& requests) { + expected, ScopedAStatus> + deserializedResults = fromStableLargeParcelable(requests); + if (!deserializedResults.ok()) { + ALOGE("getValues: failed to parse getValues requests"); + return std::move(deserializedResults.error()); + } + const std::vector& getValueRequests = + deserializedResults.value().getObject()->payloads; + + auto maybeRequestIds = checkDuplicateRequests(getValueRequests); + if (!maybeRequestIds.ok()) { + ALOGE("getValues: duplicate request ID"); + return toScopedAStatus(maybeRequestIds, StatusCode::INVALID_ARG); + } + + // A list of failed result we already know before sending to hardware. + std::vector failedResults; + // The list of requests that we would send to hardware. + std::vector hardwareRequests; + + for (const auto& request : getValueRequests) { + if (auto result = checkReadPermission(request.prop); !result.ok()) { + ALOGW("property does not support reading: %s", getErrorMsg(result).c_str()); + failedResults.push_back(GetValueResult{ + .requestId = request.requestId, + .status = getErrorCode(result), + .prop = {}, + }); + } else { + hardwareRequests.push_back(request); + } + } + + // The set of request Ids that we would send to hardware. + std::unordered_set hardwareRequestIds; + for (const auto& request : hardwareRequests) { + hardwareRequestIds.insert(request.requestId); + } + + std::shared_ptr client; + { + // Lock to make sure onBinderDied would not be called concurrently. + std::scoped_lock lockGuard(mLock); + if (!monitorBinderLifeCycleLocked(callback->asBinder().get())) { + return ScopedAStatus::fromExceptionCodeWithMessage(EX_TRANSACTION_FAILED, + "client died"); + } + + client = getOrCreateClient(&mGetValuesClients, callback, mPendingRequestPool); + } + + // Register the pending hardware requests and also check for duplicate request Ids. + if (auto addRequestResult = client->addRequests(hardwareRequestIds); !addRequestResult.ok()) { + ALOGE("getValues[%s]: failed to add pending requests, error: %s", + toString(hardwareRequestIds).c_str(), getErrorMsg(addRequestResult).c_str()); + return toScopedAStatus(addRequestResult); + } + + if (!failedResults.empty()) { + // First send the failed results we already know back to the client. + client->sendResults(std::move(failedResults)); + } + + if (hardwareRequests.empty()) { + return ScopedAStatus::ok(); + } + + if (StatusCode status = + mVehicleHardware->getValues(client->getResultCallback(), hardwareRequests); + status != StatusCode::OK) { + // If the hardware returns error, finish all the pending requests for this request because + // we never expect hardware to call callback for these requests. + client->tryFinishRequests(hardwareRequestIds); + ALOGE("getValues[%s]: failed to get value from VehicleHardware, status: %d", + toString(hardwareRequestIds).c_str(), toInt(status)); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + toInt(status), "failed to get value from VehicleHardware"); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultVehicleHal::setValues(const CallbackType& callback, + const SetValueRequests& requests) { + expected, ScopedAStatus> + deserializedResults = fromStableLargeParcelable(requests); + if (!deserializedResults.ok()) { + ALOGE("setValues: failed to parse setValues requests"); + return std::move(deserializedResults.error()); + } + const std::vector& setValueRequests = + deserializedResults.value().getObject()->payloads; + + // A list of failed result we already know before sending to hardware. + std::vector failedResults; + // The list of requests that we would send to hardware. + std::vector hardwareRequests; + + auto maybeRequestIds = checkDuplicateRequests(setValueRequests); + if (!maybeRequestIds.ok()) { + ALOGE("setValues: duplicate request ID"); + return toScopedAStatus(maybeRequestIds, StatusCode::INVALID_ARG); + } + + for (auto& request : setValueRequests) { + int64_t requestId = request.requestId; + if (auto result = checkWritePermission(request.value); !result.ok()) { + ALOGW("property does not support writing: %s", getErrorMsg(result).c_str()); + failedResults.push_back(SetValueResult{ + .requestId = requestId, + .status = getErrorCode(result), + }); + continue; + } + if (auto result = checkProperty(request.value); !result.ok()) { + ALOGW("setValues[%" PRId64 "]: property is not valid: %s", requestId, + getErrorMsg(result).c_str()); + failedResults.push_back(SetValueResult{ + .requestId = requestId, + .status = StatusCode::INVALID_ARG, + }); + continue; + } + + hardwareRequests.push_back(request); + } + + // The set of request Ids that we would send to hardware. + std::unordered_set hardwareRequestIds; + for (const auto& request : hardwareRequests) { + hardwareRequestIds.insert(request.requestId); + } + + std::shared_ptr client; + { + // Lock to make sure onBinderDied would not be called concurrently. + std::scoped_lock lockGuard(mLock); + if (!monitorBinderLifeCycleLocked(callback->asBinder().get())) { + return ScopedAStatus::fromExceptionCodeWithMessage(EX_TRANSACTION_FAILED, + "client died"); + } + client = getOrCreateClient(&mSetValuesClients, callback, mPendingRequestPool); + } + + // Register the pending hardware requests and also check for duplicate request Ids. + if (auto addRequestResult = client->addRequests(hardwareRequestIds); !addRequestResult.ok()) { + ALOGE("setValues[%s], failed to add pending requests, error: %s", + toString(hardwareRequestIds).c_str(), getErrorMsg(addRequestResult).c_str()); + return toScopedAStatus(addRequestResult); + } + + if (!failedResults.empty()) { + // First send the failed results we already know back to the client. + client->sendResults(std::move(failedResults)); + } + + if (hardwareRequests.empty()) { + return ScopedAStatus::ok(); + } + + if (StatusCode status = + mVehicleHardware->setValues(client->getResultCallback(), hardwareRequests); + status != StatusCode::OK) { + // If the hardware returns error, finish all the pending requests for this request because + // we never expect hardware to call callback for these requests. + client->tryFinishRequests(hardwareRequestIds); + ALOGE("setValues[%s], failed to set value to VehicleHardware, status: %d", + toString(hardwareRequestIds).c_str(), toInt(status)); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + toInt(status), "failed to set value to VehicleHardware"); + } + + return ScopedAStatus::ok(); +} + +#define CHECK_DUPLICATE_REQUESTS(PROP_NAME) \ + do { \ + std::vector requestIds; \ + std::set<::aidl::android::hardware::automotive::vehicle::VehiclePropValue> requestProps; \ + for (const auto& request : requests) { \ + const auto& prop = request.PROP_NAME; \ + if (requestProps.count(prop) != 0) { \ + return ::android::base::Error() \ + << "duplicate request for property: " << prop.toString(); \ + } \ + requestProps.insert(prop); \ + requestIds.push_back(request.requestId); \ + } \ + return requestIds; \ + } while (0); + +::android::base::Result> DefaultVehicleHal::checkDuplicateRequests( + const std::vector& requests) { + CHECK_DUPLICATE_REQUESTS(prop); +} + +::android::base::Result> DefaultVehicleHal::checkDuplicateRequests( + const std::vector& requests) { + CHECK_DUPLICATE_REQUESTS(value); +} + +#undef CHECK_DUPLICATE_REQUESTS + +ScopedAStatus DefaultVehicleHal::getPropConfigs(const std::vector& props, + VehiclePropConfigs* output) { + std::vector configs; + for (int32_t prop : props) { + if (mConfigsByPropId.find(prop) != mConfigsByPropId.end()) { + configs.push_back(mConfigsByPropId[prop]); + } else { + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + toInt(StatusCode::INVALID_ARG), + StringPrintf("no config for property, ID: %" PRId32, prop).c_str()); + } + } + return vectorToStableLargeParcelable(std::move(configs), output); +} + +VhalResult DefaultVehicleHal::checkSubscribeOptions( + const std::vector& options) { + for (const auto& option : options) { + int32_t propId = option.propId; + if (mConfigsByPropId.find(propId) == mConfigsByPropId.end()) { + return StatusError(StatusCode::INVALID_ARG) + << StringPrintf("no config for property, ID: %" PRId32, propId); + } + const VehiclePropConfig& config = mConfigsByPropId[propId]; + + if (config.changeMode != VehiclePropertyChangeMode::ON_CHANGE && + config.changeMode != VehiclePropertyChangeMode::CONTINUOUS) { + return StatusError(StatusCode::INVALID_ARG) + << "only support subscribing to ON_CHANGE or CONTINUOUS property"; + } + + if (config.access != VehiclePropertyAccess::READ && + config.access != VehiclePropertyAccess::READ_WRITE) { + return StatusError(StatusCode::ACCESS_DENIED) + << StringPrintf("Property %" PRId32 " has no read access", propId); + } + + if (config.changeMode == VehiclePropertyChangeMode::CONTINUOUS) { + float sampleRate = option.sampleRate; + float minSampleRate = config.minSampleRate; + float maxSampleRate = config.maxSampleRate; + if (sampleRate < minSampleRate || sampleRate > maxSampleRate) { + float defaultRate = getDefaultSampleRate(sampleRate, minSampleRate, maxSampleRate); + ALOGW("sample rate: %f out of range, must be within %f and %f, set to %f", + sampleRate, minSampleRate, maxSampleRate, defaultRate); + sampleRate = defaultRate; + } + if (!SubscriptionManager::checkSampleRate(sampleRate)) { + return StatusError(StatusCode::INVALID_ARG) + << "invalid sample rate: " << sampleRate; + } + } + + if (isGlobalProp(propId)) { + continue; + } + + // Non-global property. + for (int32_t areaId : option.areaIds) { + if (auto areaConfig = getAreaConfig(propId, areaId, config); areaConfig == nullptr) { + return StatusError(StatusCode::INVALID_ARG) + << StringPrintf("invalid area ID: %" PRId32 " for prop ID: %" PRId32 + ", not listed in config", + areaId, propId); + } + } + } + return {}; +} + +ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, + const std::vector& options, + [[maybe_unused]] int32_t maxSharedMemoryFileCount) { + // TODO(b/205189110): Use shared memory file count. + if (auto result = checkSubscribeOptions(options); !result.ok()) { + ALOGE("subscribe: invalid subscribe options: %s", getErrorMsg(result).c_str()); + return toScopedAStatus(result); + } + + std::vector onChangeSubscriptions; + std::vector continuousSubscriptions; + for (const auto& option : options) { + int32_t propId = option.propId; + // We have already validate config exists. + const VehiclePropConfig& config = mConfigsByPropId[propId]; + + SubscribeOptions optionCopy = option; + // If areaIds is empty, subscribe to all areas. + if (optionCopy.areaIds.empty() && !isGlobalProp(propId)) { + for (const auto& areaConfig : config.areaConfigs) { + optionCopy.areaIds.push_back(areaConfig.areaId); + } + } + + if (isGlobalProp(propId)) { + optionCopy.areaIds = {0}; + } + + if (config.changeMode == VehiclePropertyChangeMode::CONTINUOUS) { + optionCopy.sampleRate = getDefaultSampleRate( + optionCopy.sampleRate, config.minSampleRate, config.maxSampleRate); + continuousSubscriptions.push_back(std::move(optionCopy)); + } else { + onChangeSubscriptions.push_back(std::move(optionCopy)); + } + } + + { + // Lock to make sure onBinderDied would not be called concurrently. + std::scoped_lock lockGuard(mLock); + if (!monitorBinderLifeCycleLocked(callback->asBinder().get())) { + return ScopedAStatus::fromExceptionCodeWithMessage(EX_TRANSACTION_FAILED, + "client died"); + } + + // Create a new SubscriptionClient if there isn't an existing one. + mSubscriptionClients->maybeAddClient(callback); + + // Since we have already check the sample rates, the following functions must succeed. + if (!onChangeSubscriptions.empty()) { + return toScopedAStatus(mSubscriptionManager->subscribe(callback, onChangeSubscriptions, + /*isContinuousProperty=*/false)); + } + if (!continuousSubscriptions.empty()) { + return toScopedAStatus(mSubscriptionManager->subscribe(callback, + continuousSubscriptions, + /*isContinuousProperty=*/true)); + } + } + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultVehicleHal::unsubscribe(const CallbackType& callback, + const std::vector& propIds) { + return toScopedAStatus(mSubscriptionManager->unsubscribe(callback->asBinder().get(), propIds)); +} + +ScopedAStatus DefaultVehicleHal::returnSharedMemory(const CallbackType&, int64_t) { + // TODO(b/200737967): implement this. + return ScopedAStatus::ok(); +} + +IVehicleHardware* DefaultVehicleHal::getHardware() { + return mVehicleHardware.get(); +} + +VhalResult DefaultVehicleHal::checkWritePermission(const VehiclePropValue& value) const { + int32_t propId = value.prop; + auto result = getConfig(propId); + if (!result.ok()) { + return StatusError(StatusCode::INVALID_ARG) << getErrorMsg(result); + } + const VehiclePropConfig* config = result.value(); + + if (config->access != VehiclePropertyAccess::WRITE && + config->access != VehiclePropertyAccess::READ_WRITE) { + return StatusError(StatusCode::ACCESS_DENIED) + << StringPrintf("Property %" PRId32 " has no write access", propId); + } + return {}; +} + +VhalResult DefaultVehicleHal::checkReadPermission(const VehiclePropValue& value) const { + int32_t propId = value.prop; + auto result = getConfig(propId); + if (!result.ok()) { + return StatusError(StatusCode::INVALID_ARG) << getErrorMsg(result); + } + const VehiclePropConfig* config = result.value(); + + if (config->access != VehiclePropertyAccess::READ && + config->access != VehiclePropertyAccess::READ_WRITE) { + return StatusError(StatusCode::ACCESS_DENIED) + << StringPrintf("Property %" PRId32 " has no read access", propId); + } + return {}; +} + +void DefaultVehicleHal::checkHealth(IVehicleHardware* hardware, + std::weak_ptr subscriptionManager) { + StatusCode status = hardware->checkHealth(); + if (status != StatusCode::OK) { + ALOGE("VHAL check health returns non-okay status"); + return; + } + std::vector values = {{ + .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), + .areaId = 0, + .status = VehiclePropertyStatus::AVAILABLE, + .value.int64Values = {uptimeMillis()}, + }}; + onPropertyChangeEvent(subscriptionManager, values); + return; +} + +binder_status_t DefaultVehicleHal::AIBinderImpl::linkToDeath(AIBinder* binder, + AIBinder_DeathRecipient* recipient, + void* cookie) { + return AIBinder_linkToDeath(binder, recipient, cookie); +} + +bool DefaultVehicleHal::AIBinderImpl::isAlive(const AIBinder* binder) { + return AIBinder_isAlive(binder); +} + +void DefaultVehicleHal::setBinderImpl(std::unique_ptr impl) { + mBinderImpl = std::move(impl); +} + +bool DefaultVehicleHal::checkDumpPermission() { + uid_t uid = AIBinder_getCallingUid(); + return uid == AID_ROOT || uid == AID_SHELL || uid == AID_SYSTEM; +} + +binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numArgs) { + if (!checkDumpPermission()) { + dprintf(fd, "Caller must be root, system or shell"); + return STATUS_PERMISSION_DENIED; + } + + std::vector options; + for (uint32_t i = 0; i < numArgs; i++) { + options.push_back(args[i]); + } + DumpResult result = mVehicleHardware->dump(options); + dprintf(fd, "%s", (result.buffer + "\n").c_str()); + if (!result.callerShouldDumpState) { + dprintf(fd, "Skip dumping Vehicle HAL State.\n"); + return STATUS_OK; + } + dprintf(fd, "Vehicle HAL State: \n"); + { + std::scoped_lock lockGuard(mLock); + dprintf(fd, "Containing %zu property configs\n", mConfigsByPropId.size()); + dprintf(fd, "Currently have %zu getValues clients\n", mGetValuesClients.size()); + dprintf(fd, "Currently have %zu setValues clients\n", mSetValuesClients.size()); + dprintf(fd, "Currently have %zu subscription clients\n", + mSubscriptionClients->countClients()); + } + return STATUS_OK; +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..26944018df336c60888ae7500a268e38bc6982e9 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp @@ -0,0 +1,292 @@ +/* + * 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. + */ + +#include "SubscriptionManager.h" + +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +constexpr float ONE_SECOND_IN_NANO = 1'000'000'000.; + +} // namespace + +using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::Error; +using ::android::base::Result; +using ::android::base::StringPrintf; +using ::ndk::ScopedAStatus; + +SubscriptionManager::SubscriptionManager(IVehicleHardware* hardware) : mVehicleHardware(hardware) {} + +SubscriptionManager::~SubscriptionManager() { + std::scoped_lock lockGuard(mLock); + + mClientsByPropIdArea.clear(); + mSubscribedPropsByClient.clear(); +} + +bool SubscriptionManager::checkSampleRate(float sampleRate) { + return getInterval(sampleRate).ok(); +} + +Result SubscriptionManager::getInterval(float sampleRate) { + int64_t interval = 0; + if (sampleRate <= 0) { + return Error() << "invalid sample rate, must be a positive number"; + } + if (sampleRate <= (ONE_SECOND_IN_NANO / static_cast(INT64_MAX))) { + return Error() << "invalid sample rate: " << sampleRate << ", too small"; + } + interval = static_cast(ONE_SECOND_IN_NANO / sampleRate); + return interval; +} + +void ContSubConfigs::refreshMaxSampleRate() { + float maxSampleRate = 0.; + // This is not called frequently so a brute-focre is okay. More efficient way exists but this + // is simpler. + for (const auto& [_, sampleRate] : mSampleRates) { + if (sampleRate > maxSampleRate) { + maxSampleRate = sampleRate; + } + } + mMaxSampleRate = maxSampleRate; +} + +void ContSubConfigs::addClient(const ClientIdType& clientId, float sampleRate) { + mSampleRates[clientId] = sampleRate; + refreshMaxSampleRate(); +} + +void ContSubConfigs::removeClient(const ClientIdType& clientId) { + mSampleRates.erase(clientId); + refreshMaxSampleRate(); +} + +float ContSubConfigs::getMaxSampleRate() { + return mMaxSampleRate; +} + +VhalResult SubscriptionManager::updateSampleRateLocked(const ClientIdType& clientId, + const PropIdAreaId& propIdAreaId, + float sampleRate) { + // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases. + ContSubConfigs infoCopy = mContSubConfigsByPropIdArea[propIdAreaId]; + infoCopy.addClient(clientId, sampleRate); + if (infoCopy.getMaxSampleRate() == + mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRate()) { + mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; + return {}; + } + float newRate = infoCopy.getMaxSampleRate(); + int32_t propId = propIdAreaId.propId; + int32_t areaId = propIdAreaId.areaId; + if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRate); + status != StatusCode::OK) { + return StatusError(status) << StringPrintf("failed to update sample rate for prop: %" PRId32 + ", area" + ": %" PRId32 ", sample rate: %f", + propId, areaId, newRate); + } + mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; + return {}; +} + +VhalResult SubscriptionManager::removeSampleRateLocked(const ClientIdType& clientId, + const PropIdAreaId& propIdAreaId) { + // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases. + ContSubConfigs infoCopy = mContSubConfigsByPropIdArea[propIdAreaId]; + infoCopy.removeClient(clientId); + if (infoCopy.getMaxSampleRate() == + mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRate()) { + mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; + return {}; + } + float newRate = infoCopy.getMaxSampleRate(); + int32_t propId = propIdAreaId.propId; + int32_t areaId = propIdAreaId.areaId; + if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRate); + status != StatusCode::OK) { + return StatusError(status) << StringPrintf("failed to update sample rate for prop: %" PRId32 + ", area" + ": %" PRId32 ", sample rate: %f", + propId, areaId, newRate); + } + mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; + return {}; +} + +VhalResult SubscriptionManager::subscribe(const std::shared_ptr& callback, + const std::vector& options, + bool isContinuousProperty) { + std::scoped_lock lockGuard(mLock); + + std::vector intervals; + for (const auto& option : options) { + float sampleRate = option.sampleRate; + + if (isContinuousProperty) { + auto intervalResult = getInterval(sampleRate); + if (!intervalResult.ok()) { + return StatusError(StatusCode::INVALID_ARG) << intervalResult.error().message(); + } + } + + if (option.areaIds.empty()) { + ALOGE("area IDs to subscribe must not be empty"); + return StatusError(StatusCode::INVALID_ARG) + << "area IDs to subscribe must not be empty"; + } + } + + ClientIdType clientId = callback->asBinder().get(); + + for (const auto& option : options) { + int32_t propId = option.propId; + const std::vector& areaIds = option.areaIds; + for (int32_t areaId : areaIds) { + PropIdAreaId propIdAreaId = { + .propId = propId, + .areaId = areaId, + }; + if (isContinuousProperty) { + if (auto result = updateSampleRateLocked(clientId, propIdAreaId, option.sampleRate); + !result.ok()) { + return result; + } + } + + mSubscribedPropsByClient[clientId].insert(propIdAreaId); + mClientsByPropIdArea[propIdAreaId][clientId] = callback; + } + } + return {}; +} + +VhalResult SubscriptionManager::unsubscribe(SubscriptionManager::ClientIdType clientId, + const std::vector& propIds) { + std::scoped_lock lockGuard(mLock); + + if (mSubscribedPropsByClient.find(clientId) == mSubscribedPropsByClient.end()) { + return StatusError(StatusCode::INVALID_ARG) + << "No property was subscribed for the callback"; + } + std::unordered_set subscribedPropIds; + for (auto const& propIdAreaId : mSubscribedPropsByClient[clientId]) { + subscribedPropIds.insert(propIdAreaId.propId); + } + + for (int32_t propId : propIds) { + if (subscribedPropIds.find(propId) == subscribedPropIds.end()) { + return StatusError(StatusCode::INVALID_ARG) + << "property ID: " << propId << " is not subscribed"; + } + } + + auto& propIdAreaIds = mSubscribedPropsByClient[clientId]; + auto it = propIdAreaIds.begin(); + while (it != propIdAreaIds.end()) { + int32_t propId = it->propId; + if (std::find(propIds.begin(), propIds.end(), propId) != propIds.end()) { + if (auto result = removeSampleRateLocked(clientId, *it); !result.ok()) { + return result; + } + + auto& clients = mClientsByPropIdArea[*it]; + clients.erase(clientId); + if (clients.empty()) { + mClientsByPropIdArea.erase(*it); + mContSubConfigsByPropIdArea.erase(*it); + } + it = propIdAreaIds.erase(it); + } else { + it++; + } + } + if (propIdAreaIds.empty()) { + mSubscribedPropsByClient.erase(clientId); + } + return {}; +} + +VhalResult SubscriptionManager::unsubscribe(SubscriptionManager::ClientIdType clientId) { + std::scoped_lock lockGuard(mLock); + + if (mSubscribedPropsByClient.find(clientId) == mSubscribedPropsByClient.end()) { + return StatusError(StatusCode::INVALID_ARG) << "No property was subscribed for this client"; + } + + auto& subscriptions = mSubscribedPropsByClient[clientId]; + for (auto const& propIdAreaId : subscriptions) { + if (auto result = removeSampleRateLocked(clientId, propIdAreaId); !result.ok()) { + return result; + } + + auto& clients = mClientsByPropIdArea[propIdAreaId]; + clients.erase(clientId); + if (clients.empty()) { + mClientsByPropIdArea.erase(propIdAreaId); + mContSubConfigsByPropIdArea.erase(propIdAreaId); + } + } + mSubscribedPropsByClient.erase(clientId); + return {}; +} + +std::unordered_map, std::vector> +SubscriptionManager::getSubscribedClients(const std::vector& updatedValues) { + std::scoped_lock lockGuard(mLock); + std::unordered_map, std::vector> + clients; + + for (const auto& value : updatedValues) { + PropIdAreaId propIdAreaId{ + .propId = value.prop, + .areaId = value.areaId, + }; + if (mClientsByPropIdArea.find(propIdAreaId) == mClientsByPropIdArea.end()) { + continue; + } + + for (const auto& [_, client] : mClientsByPropIdArea[propIdAreaId]) { + clients[client].push_back(&value); + } + } + return clients; +} + +bool SubscriptionManager::isEmpty() { + std::scoped_lock lockGuard(mLock); + return mSubscribedPropsByClient.empty() && mClientsByPropIdArea.empty(); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp b/automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c8b5c658dd6659e353b6d2b56a7b87ae7a7c924f --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp @@ -0,0 +1,55 @@ +/* + * 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_TAG "VehicleService" + +#include +#include + +#include +#include +#include + +using ::android::hardware::automotive::vehicle::DefaultVehicleHal; +using ::android::hardware::automotive::vehicle::fake::FakeVehicleHardware; + +int main(int /* argc */, char* /* argv */[]) { + std::unique_ptr hardware = std::make_unique(); + std::shared_ptr vhal = + ::ndk::SharedRefBase::make(std::move(hardware)); + + ALOGI("Registering as service..."); + binder_exception_t err = AServiceManager_addService( + vhal->asBinder().get(), "android.hardware.automotive.vehicle.IVehicle/default"); + if (err != EX_NONE) { + ALOGE("failed to register android.hardware.automotive.vehicle service, exception: %d", err); + return 1; + } + + if (!ABinderProcess_setThreadPoolMaxThreadCount(4)) { + ALOGE("%s", "failed to set thread pool max thread count"); + return 1; + } + ABinderProcess_startThreadPool(); + + ALOGI("Vehicle Service Ready"); + + ABinderProcess_joinThreadPool(); + + ALOGI("Vehicle Service Exiting"); + + return 0; +} diff --git a/automotive/vehicle/aidl/impl/vhal/test/Android.bp b/automotive/vehicle/aidl/impl/vhal/test/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..7122aa5230fbd6ef77b3865087861f23bc7c0b2a --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/Android.bp @@ -0,0 +1,44 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "DefaultVehicleHalTest", + vendor: true, + srcs: ["*.cpp"], + static_libs: [ + "DefaultVehicleHal", + "VehicleHalUtils", + "libgtest", + "libgmock", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "liblog", + "libutils", + ], + header_libs: [ + "IVehicleHardware", + ], + defaults: [ + "VehicleHalDefaults", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/vhal/test/ConnectedClientTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/ConnectedClientTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..682e9e6a0658a3b33aaf12d71772a65a01b53239 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/ConnectedClientTest.cpp @@ -0,0 +1,220 @@ +/* + * 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. + */ + +#include "ConnectedClient.h" +#include "MockVehicleCallback.h" + +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::GetValueResult; +using ::aidl::android::hardware::automotive::vehicle::GetValueResults; +using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; +using ::aidl::android::hardware::automotive::vehicle::SetValueResult; +using ::aidl::android::hardware::automotive::vehicle::SetValueResults; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +class ConnectedClientTest : public testing::Test { + public: + void SetUp() override { + mCallback = ndk::SharedRefBase::make(); + mCallbackClient = IVehicleCallback::fromBinder(mCallback->asBinder()); + // timeout: 1s. + int64_t timeout = 1000000000; + mPool = std::make_shared(timeout); + } + + std::shared_ptr getCallbackClient() { return mCallbackClient; } + + MockVehicleCallback* getCallback() { return mCallback.get(); } + + std::shared_ptr getPool() { return mPool; } + + protected: + using GetValuesClient = GetSetValuesClient; + using SetValuesClient = GetSetValuesClient; + + private: + std::shared_ptr mCallback; + std::shared_ptr mCallbackClient; + std::shared_ptr mPool; +}; + +TEST_F(ConnectedClientTest, testSendGetValueResults) { + std::vector results = {{ + .requestId = 0, + .status = StatusCode::OK, + .prop = + VehiclePropValue{ + .prop = 0, + }, + }, + { + .requestId = 1, + .status = StatusCode::OK, + .prop = + VehiclePropValue{ + .prop = 1, + }, + }}; + + GetValuesClient client(getPool(), getCallbackClient()); + + auto resultsCopy = results; + client.sendResults(std::move(resultsCopy)); + + auto maybeGetValueResults = getCallback()->nextGetValueResults(); + ASSERT_TRUE(maybeGetValueResults.has_value()); + ASSERT_EQ(maybeGetValueResults.value().payloads, results); +} + +TEST_F(ConnectedClientTest, testSendGetValueResultsSeparately) { + std::vector results = {{ + .requestId = 0, + .status = StatusCode::OK, + .prop = + VehiclePropValue{ + .prop = 0, + }, + }, + { + .requestId = 1, + .status = StatusCode::OK, + .prop = + VehiclePropValue{ + .prop = 1, + }, + }}; + + GetValuesClient client(getPool(), getCallbackClient()); + + client.sendResultsSeparately(results); + + for (auto& result : results) { + auto maybeGetValueResults = getCallback()->nextGetValueResults(); + EXPECT_TRUE(maybeGetValueResults.has_value()); + if (!maybeGetValueResults.has_value()) { + continue; + } + EXPECT_EQ(maybeGetValueResults.value().payloads, std::vector({result})); + } +} + +TEST_F(ConnectedClientTest, testGetValuesGnResultCallback) { + std::vector results = {{ + .requestId = 0, + .status = StatusCode::OK, + .prop = + VehiclePropValue{ + .prop = 0, + }, + }, + { + .requestId = 1, + .status = StatusCode::OK, + .prop = + VehiclePropValue{ + .prop = 1, + }, + }}; + + GetValuesClient client(getPool(), getCallbackClient()); + + client.addRequests({0, 1}); + + (*(client.getResultCallback()))(results); + + auto maybeGetValueResults = getCallback()->nextGetValueResults(); + ASSERT_TRUE(maybeGetValueResults.has_value()); + ASSERT_EQ(maybeGetValueResults.value().payloads, results); +} + +TEST_F(ConnectedClientTest, testSendSetValueResults) { + std::vector results = {{ + .requestId = 0, + .status = StatusCode::OK, + }, + { + .requestId = 1, + .status = StatusCode::OK, + }}; + + SetValuesClient client(getPool(), getCallbackClient()); + + auto resultsCopy = results; + client.sendResults(std::move(resultsCopy)); + + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()); + ASSERT_EQ(maybeSetValueResults.value().payloads, results); +} + +TEST_F(ConnectedClientTest, testSendSetValueResultsSeparately) { + std::vector results = {{ + .requestId = 0, + .status = StatusCode::OK, + }, + { + .requestId = 1, + .status = StatusCode::OK, + }}; + + SetValuesClient client(getPool(), getCallbackClient()); + + client.sendResultsSeparately(results); + + for (auto& result : results) { + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + EXPECT_TRUE(maybeSetValueResults.has_value()); + if (!maybeSetValueResults.has_value()) { + continue; + } + EXPECT_EQ(maybeSetValueResults.value().payloads, std::vector({result})); + } +} + +TEST_F(ConnectedClientTest, testSetValuesGetResultCallback) { + std::vector results = {{ + .requestId = 0, + .status = StatusCode::OK, + }, + { + .requestId = 1, + .status = StatusCode::OK, + }}; + + SetValuesClient client(getPool(), getCallbackClient()); + + client.addRequests({0, 1}); + + (*(client.getResultCallback()))(results); + + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()); + ASSERT_EQ(maybeSetValueResults.value().payloads, results); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f48b9065037d3afa865e6c115555191a632c1d60 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp @@ -0,0 +1,1662 @@ +/* + * 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. + */ + +#include "ConnectedClient.h" +#include "DefaultVehicleHal.h" +#include "MockVehicleCallback.h" +#include "MockVehicleHardware.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::GetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::GetValueRequests; +using ::aidl::android::hardware::automotive::vehicle::GetValueResult; +using ::aidl::android::hardware::automotive::vehicle::GetValueResults; +using ::aidl::android::hardware::automotive::vehicle::IVehicle; +using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; +using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::SetValueRequests; +using ::aidl::android::hardware::automotive::vehicle::SetValueResult; +using ::aidl::android::hardware::automotive::vehicle::SetValueResults; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfigs; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues; + +using ::android::automotive::car_binder_lib::LargeParcelableBase; +using ::android::base::Result; + +using ::ndk::ScopedAStatus; +using ::ndk::ScopedFileDescriptor; +using ::ndk::SpAIBinder; + +using ::testing::ContainsRegex; +using ::testing::Eq; +using ::testing::UnorderedElementsAre; +using ::testing::UnorderedElementsAreArray; +using ::testing::WhenSortedBy; + +constexpr int32_t INVALID_PROP_ID = 0; +// VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 +constexpr int32_t INT32_WINDOW_PROP = 10001 + 0x10000000 + 0x03000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 +constexpr int32_t GLOBAL_ON_CHANGE_PROP = 10002 + 0x10000000 + 0x01000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 +constexpr int32_t GLOBAL_CONTINUOUS_PROP = 10003 + 0x10000000 + 0x01000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 +constexpr int32_t AREA_ON_CHANGE_PROP = 10004 + 0x10000000 + 0x03000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 +constexpr int32_t AREA_CONTINUOUS_PROP = 10005 + 0x10000000 + 0x03000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 +constexpr int32_t READ_ONLY_PROP = 10006 + 0x10000000 + 0x01000000 + 0x00400000; +// VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 +constexpr int32_t WRITE_ONLY_PROP = 10007 + 0x10000000 + 0x01000000 + 0x00400000; + +int32_t testInt32VecProp(size_t i) { + // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + return static_cast(i) + 0x10000000 + 0x01000000 + 0x00410000; +} + +struct PropConfigCmp { + bool operator()(const VehiclePropConfig& a, const VehiclePropConfig& b) const { + return (a.prop < b.prop); + } +} propConfigCmp; + +struct SetValuesInvalidRequestTestCase { + std::string name; + VehiclePropValue request; + StatusCode expectedStatus; +}; + +std::vector getSetValuesInvalidRequestTestCases() { + return {{ + .name = "config_not_found", + .request = + { + // No config for INVALID_PROP_ID. + .prop = INVALID_PROP_ID, + }, + .expectedStatus = StatusCode::INVALID_ARG, + }, + { + .name = "invalid_prop_value", + .request = + { + .prop = testInt32VecProp(0), + // No int32Values for INT32_VEC property. + .value.int32Values = {}, + }, + .expectedStatus = StatusCode::INVALID_ARG, + }, + { + .name = "value_out_of_range", + .request = + { + .prop = testInt32VecProp(0), + // We configured the range to be 0-100. + .value.int32Values = {0, -1}, + }, + .expectedStatus = StatusCode::INVALID_ARG, + }, + { + .name = "invalid_area", + .request = + { + .prop = INT32_WINDOW_PROP, + .value.int32Values = {0}, + // Only ROW_1_LEFT is allowed. + .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + }, + .expectedStatus = StatusCode::INVALID_ARG, + }, + { + .name = "no_write_permission", + .request = + { + .prop = READ_ONLY_PROP, + .value.int32Values = {0}, + }, + .expectedStatus = StatusCode::ACCESS_DENIED, + }}; +} + +struct SubscribeInvalidOptionsTestCase { + std::string name; + SubscribeOptions option; +}; + +std::vector getSubscribeInvalidOptionsTestCases() { + return {{ + .name = "invalid_prop", + .option = + { + .propId = INVALID_PROP_ID, + }, + }, + { + .name = "invalid_area_ID", + .option = + { + .propId = AREA_ON_CHANGE_PROP, + .areaIds = {0}, + }, + }, + { + .name = "invalid_sample_rate", + .option = + { + .propId = GLOBAL_CONTINUOUS_PROP, + .sampleRate = 0.0, + }, + }, + { + .name = "static_property", + .option = + { + // Default change mode is static. + .propId = testInt32VecProp(0), + }, + }}; +} + +} // namespace + +class DefaultVehicleHalTest : public testing::Test { + public: + void SetUp() override { + auto hardware = std::make_unique(); + std::vector testConfigs; + for (size_t i = 0; i < 10000; i++) { + testConfigs.push_back(VehiclePropConfig{ + .prop = testInt32VecProp(i), + .access = VehiclePropertyAccess::READ_WRITE, + .areaConfigs = + { + { + .areaId = 0, + .minInt32Value = 0, + .maxInt32Value = 100, + }, + }, + }); + } + // A property with area config. + testConfigs.push_back( + VehiclePropConfig{.prop = INT32_WINDOW_PROP, + .access = VehiclePropertyAccess::READ_WRITE, + .areaConfigs = {{ + .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .minInt32Value = 0, + .maxInt32Value = 100, + }}}); + // A global on-change property. + testConfigs.push_back(VehiclePropConfig{ + .prop = GLOBAL_ON_CHANGE_PROP, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }); + // A global continuous property. + testConfigs.push_back(VehiclePropConfig{ + .prop = GLOBAL_CONTINUOUS_PROP, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.0, + .maxSampleRate = 100.0, + }); + // A per-area on-change property. + testConfigs.push_back(VehiclePropConfig{ + .prop = AREA_ON_CHANGE_PROP, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + { + { + + .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .minInt32Value = 0, + .maxInt32Value = 100, + }, + { + .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + .minInt32Value = 0, + .maxInt32Value = 100, + }, + }, + }); + // A per-area continuous property. + testConfigs.push_back(VehiclePropConfig{ + .prop = AREA_CONTINUOUS_PROP, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.0, + .maxSampleRate = 1000.0, + .areaConfigs = + { + { + + .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .minInt32Value = 0, + .maxInt32Value = 100, + }, + { + .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + .minInt32Value = 0, + .maxInt32Value = 100, + }, + }, + }); + // A read-only property. + testConfigs.push_back(VehiclePropConfig{ + .prop = READ_ONLY_PROP, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.0, + .maxSampleRate = 1000.0, + }); + // A write-only property. + testConfigs.push_back(VehiclePropConfig{ + .prop = WRITE_ONLY_PROP, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 0.0, + .maxSampleRate = 1000.0, + }); + // Register the heartbeat event property. + testConfigs.push_back(VehiclePropConfig{ + .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }); + hardware->setPropertyConfigs(testConfigs); + mHardwarePtr = hardware.get(); + mVhal = ndk::SharedRefBase::make(std::move(hardware)); + mVhalClient = IVehicle::fromBinder(mVhal->asBinder()); + mCallback = ndk::SharedRefBase::make(); + // Keep the local binder alive. + mBinder = mCallback->asBinder(); + mCallbackClient = IVehicleCallback::fromBinder(mBinder); + + // Set the linkToDeath to a fake implementation that always returns OK. + auto binderImpl = std::make_unique(); + mBinderImpl = binderImpl.get(); + mVhal->setBinderImpl(std::move(binderImpl)); + } + + void TearDown() override { + ASSERT_EQ(countPendingRequests(), static_cast(0)) + << "must have no pending requests when test finishes"; + } + + MockVehicleHardware* getHardware() { return mHardwarePtr; } + + std::shared_ptr getClient() { return mVhal; } + + std::shared_ptr getCallbackClient() { return mCallbackClient; } + + MockVehicleCallback* getCallback() { return mCallback.get(); } + + void setTimeout(int64_t timeoutInNano) { mVhal->setTimeout(timeoutInNano); } + + size_t countPendingRequests() { return mVhal->mPendingRequestPool->countPendingRequests(); } + + size_t countClients() { + std::scoped_lock lockGuard(mVhal->mLock); + return mVhal->mGetValuesClients.size() + mVhal->mSetValuesClients.size() + + mVhal->mSubscriptionClients->countClients(); + } + + std::shared_ptr getPool() { return mVhal->mPendingRequestPool; } + + void onBinderDied(void* cookie) { return mVhal->onBinderDied(cookie); } + + void onBinderUnlinked(void* cookie) { return mVhal->onBinderUnlinked(cookie); } + + void* getOnBinderDiedContexts(AIBinder* clientId) { + std::scoped_lock lockGuard(mVhal->mLock); + return mVhal->mOnBinderDiedContexts[clientId].get(); + } + + size_t countOnBinderDiedContexts() { + std::scoped_lock lockGuard(mVhal->mLock); + return mVhal->mOnBinderDiedContexts.size(); + } + + bool hasNoSubscriptions() { return mVhal->mSubscriptionManager->isEmpty(); } + + void setBinderAlive(bool isAlive) { mBinderImpl->setAlive(isAlive); }; + + static Result getValuesTestCases(size_t size, GetValueRequests& requests, + std::vector& expectedResults, + std::vector& expectedHardwareRequests) { + expectedHardwareRequests.clear(); + for (size_t i = 0; i < size; i++) { + int64_t requestId = static_cast(i); + int32_t propId = testInt32VecProp(i); + expectedHardwareRequests.push_back(GetValueRequest{ + .prop = + VehiclePropValue{ + .prop = propId, + }, + .requestId = requestId, + }); + expectedResults.push_back(GetValueResult{ + .requestId = requestId, + .status = StatusCode::OK, + .prop = + VehiclePropValue{ + .prop = propId, + .value.int32Values = {1, 2, 3, 4}, + }, + }); + } + + requests.payloads = expectedHardwareRequests; + auto result = LargeParcelableBase::parcelableToStableLargeParcelable(requests); + if (!result.ok()) { + return result.error(); + } + if (result.value() != nullptr) { + requests.sharedMemoryFd = std::move(*result.value()); + requests.payloads.clear(); + } + return {}; + } + + static Result setValuesTestCases(size_t size, SetValueRequests& requests, + std::vector& expectedResults, + std::vector& expectedHardwareRequests) { + expectedHardwareRequests.clear(); + for (size_t i = 0; i < size; i++) { + int64_t requestId = static_cast(i); + int32_t propId = testInt32VecProp(i); + expectedHardwareRequests.push_back(SetValueRequest{ + .value = + VehiclePropValue{ + .prop = propId, + .value.int32Values = {1, 2, 3, 4}, + }, + .requestId = requestId, + }); + expectedResults.push_back(SetValueResult{ + .requestId = requestId, + .status = StatusCode::OK, + }); + } + + requests.payloads = expectedHardwareRequests; + auto result = LargeParcelableBase::parcelableToStableLargeParcelable(requests); + if (!result.ok()) { + return result.error(); + } + if (result.value() != nullptr) { + requests.payloads.clear(); + requests.sharedMemoryFd = std::move(*result.value()); + requests.payloads.clear(); + } + return {}; + } + + private: + class TestBinderImpl final : public DefaultVehicleHal::IBinder { + public: + binder_status_t linkToDeath(AIBinder*, AIBinder_DeathRecipient*, void*) override { + if (mIsAlive) { + return STATUS_OK; + } else { + return STATUS_FAILED_TRANSACTION; + } + } + + bool isAlive(const AIBinder*) override { return mIsAlive; } + + void setAlive(bool isAlive) { mIsAlive = isAlive; } + + private: + bool mIsAlive = true; + }; + + std::shared_ptr mVhal; + std::shared_ptr mVhalClient; + MockVehicleHardware* mHardwarePtr; + std::shared_ptr mCallback; + std::shared_ptr mCallbackClient; + SpAIBinder mBinder; + TestBinderImpl* mBinderImpl; +}; + +TEST_F(DefaultVehicleHalTest, testGetAllPropConfigsSmall) { + auto testConfigs = std::vector({ + VehiclePropConfig{ + .prop = 1, + }, + VehiclePropConfig{ + .prop = 2, + }, + }); + + auto hardware = std::make_unique(); + hardware->setPropertyConfigs(testConfigs); + auto vhal = ndk::SharedRefBase::make(std::move(hardware)); + std::shared_ptr client = IVehicle::fromBinder(vhal->asBinder()); + + VehiclePropConfigs output; + auto status = client->getAllPropConfigs(&output); + + ASSERT_TRUE(status.isOk()) << "getAllPropConfigs failed: " << status.getMessage(); + ASSERT_THAT(output.payloads, WhenSortedBy(propConfigCmp, Eq(testConfigs))); +} + +TEST_F(DefaultVehicleHalTest, testGetAllPropConfigsLarge) { + std::vector testConfigs; + // 5000 VehiclePropConfig exceeds 4k memory limit, so it would be sent through shared memory. + for (size_t i = 0; i < 5000; i++) { + testConfigs.push_back(VehiclePropConfig{ + .prop = static_cast(i), + }); + } + + auto hardware = std::make_unique(); + hardware->setPropertyConfigs(testConfigs); + auto vhal = ndk::SharedRefBase::make(std::move(hardware)); + std::shared_ptr client = IVehicle::fromBinder(vhal->asBinder()); + + VehiclePropConfigs output; + auto status = client->getAllPropConfigs(&output); + + ASSERT_TRUE(status.isOk()) << "getAllPropConfigs failed: " << status.getMessage(); + ASSERT_TRUE(output.payloads.empty()); + auto result = LargeParcelableBase::stableLargeParcelableToParcelable(output); + ASSERT_TRUE(result.ok()) << "failed to parse result shared memory file: " + << result.error().message(); + ASSERT_EQ(result.value().getObject()->payloads, testConfigs); +} + +TEST_F(DefaultVehicleHalTest, testGetPropConfigs) { + auto testConfigs = std::vector({ + VehiclePropConfig{ + .prop = 1, + }, + VehiclePropConfig{ + .prop = 2, + }, + }); + + auto hardware = std::make_unique(); + hardware->setPropertyConfigs(testConfigs); + auto vhal = ndk::SharedRefBase::make(std::move(hardware)); + std::shared_ptr client = IVehicle::fromBinder(vhal->asBinder()); + + VehiclePropConfigs output; + auto status = client->getPropConfigs(std::vector({1, 2}), &output); + + ASSERT_TRUE(status.isOk()) << "getPropConfigs failed: " << status.getMessage(); + ASSERT_EQ(output.payloads, testConfigs); +} + +TEST_F(DefaultVehicleHalTest, testGetPropConfigsInvalidArg) { + auto testConfigs = std::vector({ + VehiclePropConfig{ + .prop = 1, + }, + VehiclePropConfig{ + .prop = 2, + }, + }); + + auto hardware = std::make_unique(); + hardware->setPropertyConfigs(testConfigs); + auto vhal = ndk::SharedRefBase::make(std::move(hardware)); + std::shared_ptr client = IVehicle::fromBinder(vhal->asBinder()); + + VehiclePropConfigs output; + auto status = client->getPropConfigs(std::vector({1, 2, 3}), &output); + + ASSERT_FALSE(status.isOk()) << "getPropConfigs must fail with invalid prop ID"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::INVALID_ARG)); +} + +TEST_F(DefaultVehicleHalTest, testGetValuesSmall) { + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->addGetValueResponses(expectedResults); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); + + EXPECT_EQ(getHardware()->nextGetValueRequests(), expectedHardwareRequests) + << "requests to hardware mismatch"; + + auto maybeGetValueResults = getCallback()->nextGetValueResults(); + ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback"; + EXPECT_EQ(maybeGetValueResults.value().payloads, expectedResults) << "results mismatch"; + EXPECT_EQ(countClients(), static_cast(1)); +} + +TEST_F(DefaultVehicleHalTest, testGetValuesLarge) { + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(5000, requests, expectedResults, expectedHardwareRequests).ok()) + << "requests to hardware mismatch"; + + getHardware()->addGetValueResponses(expectedResults); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); + + EXPECT_EQ(getHardware()->nextGetValueRequests(), expectedHardwareRequests); + + auto maybeGetValueResults = getCallback()->nextGetValueResults(); + ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback"; + const GetValueResults& getValueResults = maybeGetValueResults.value(); + ASSERT_TRUE(getValueResults.payloads.empty()) + << "payload should be empty, shared memory file should be used"; + + auto result = LargeParcelableBase::stableLargeParcelableToParcelable(getValueResults); + ASSERT_TRUE(result.ok()) << "failed to parse shared memory file"; + ASSERT_EQ(result.value().getObject()->payloads, expectedResults) << "results mismatch"; + EXPECT_EQ(countClients(), static_cast(1)); +} + +TEST_F(DefaultVehicleHalTest, testGetValuesErrorFromHardware) { + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->setStatus("getValues", StatusCode::INTERNAL_ERROR); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "expect getValues to fail when hardware returns error"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::INTERNAL_ERROR)); +} + +TEST_F(DefaultVehicleHalTest, testGetValuesInvalidLargeParcelableInput) { + GetValueRequests requests; + requests.sharedMemoryFd = ScopedFileDescriptor(0); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "expect getValues to fail when input parcelable is not valid"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::INVALID_ARG)); +} + +TEST_F(DefaultVehicleHalTest, testGetValuesNoReadPermission) { + GetValueRequests requests = { + .sharedMemoryFd = {}, + .payloads = + { + { + .requestId = 0, + .prop = + { + .prop = WRITE_ONLY_PROP, + }, + }, + }, + }; + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "getValue with no read permission should return okay with error " + "returned from callback" + << ", error: " << status.getMessage(); + EXPECT_TRUE(getHardware()->nextGetValueRequests().empty()) << "expect no request to hardware"; + + auto maybeResult = getCallback()->nextGetValueResults(); + ASSERT_TRUE(maybeResult.has_value()) << "no results in callback"; + EXPECT_EQ(maybeResult.value().payloads, std::vector({ + { + .requestId = 0, + .status = StatusCode::ACCESS_DENIED, + }, + })) + << "expect to get ACCESS_DENIED status if no read permission"; +} + +TEST_F(DefaultVehicleHalTest, testGetValuesFinishBeforeTimeout) { + // timeout: 0.1s + int64_t timeout = 100000000; + setTimeout(timeout); + + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + // The response would be returned after 0.05s. + getHardware()->setSleepTime(timeout / 2); + getHardware()->addGetValueResponses(expectedResults); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); + + // Wait for the response. + std::this_thread::sleep_for(std::chrono::nanoseconds(timeout)); + + auto maybeGetValueResults = getCallback()->nextGetValueResults(); + ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback"; + EXPECT_EQ(maybeGetValueResults.value().payloads, expectedResults) << "results mismatch"; + ASSERT_FALSE(getCallback()->nextGetValueResults().has_value()) << "more results than expected"; +} + +TEST_F(DefaultVehicleHalTest, testGetValuesFinishAfterTimeout) { + // timeout: 0.1s + int64_t timeout = 100000000; + setTimeout(timeout); + + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + // The response would be returned after 0.2s. + getHardware()->setSleepTime(timeout * 2); + getHardware()->addGetValueResponses(expectedResults); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); + + // Wait for the response. + std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5)); + + for (size_t i = 0; i < expectedResults.size(); i++) { + expectedResults[i] = { + .requestId = expectedResults[i].requestId, + .status = StatusCode::TRY_AGAIN, + .prop = std::nullopt, + }; + } + + auto maybeGetValueResults = getCallback()->nextGetValueResults(); + ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback"; + ASSERT_THAT(maybeGetValueResults.value().payloads, UnorderedElementsAreArray(expectedResults)) + << "results mismatch, expect TRY_AGAIN error."; + ASSERT_FALSE(getCallback()->nextGetValueResults().has_value()) << "more results than expected"; +} + +TEST_F(DefaultVehicleHalTest, testGetValuesDuplicateRequestIdsInTwoRequests) { + // timeout: 0.1s + int64_t timeout = 100000000; + setTimeout(timeout); + + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(1, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->setSleepTime(timeout * 2); + getHardware()->addGetValueResponses(expectedResults); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); + + // Use the same request ID again. + status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) + << "Use the same request ID before the previous request finishes must fail"; + + // Wait for the request to finish. + std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5)); +} + +TEST_F(DefaultVehicleHalTest, testGetValuesDuplicateRequestIdsInOneRequest) { + GetValueRequests requests = {.payloads = { + { + .requestId = 0, + .prop = + VehiclePropValue{ + .prop = testInt32VecProp(0), + }, + }, + { + .requestId = 0, + .prop = + VehiclePropValue{ + .prop = testInt32VecProp(1), + }, + }, + }}; + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "duplicate Ids in one request must fail"; +} + +TEST_F(DefaultVehicleHalTest, testGetValuesDuplicateRequestProps) { + GetValueRequests requests = {.payloads = { + { + .requestId = 0, + .prop = + VehiclePropValue{ + .prop = testInt32VecProp(0), + }, + }, + { + .requestId = 1, + .prop = + VehiclePropValue{ + .prop = testInt32VecProp(0), + }, + }, + }}; + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "duplicate request properties in one request must fail"; +} + +TEST_F(DefaultVehicleHalTest, testGetValuesNewClientDied) { + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->addGetValueResponses(expectedResults); + + setBinderAlive(false); + + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "getValues must fail if client died"; + ASSERT_EQ(status.getExceptionCode(), EX_TRANSACTION_FAILED); + EXPECT_EQ(countClients(), static_cast(0)) + << "No client should be created if the client binder died"; +} + +TEST_F(DefaultVehicleHalTest, testGetValuesExistingClientDied) { + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->addGetValueResponses(expectedResults); + + // Try a normal getValue request to cache a GetValueClient first. + auto status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); + EXPECT_EQ(countClients(), static_cast(1)); + + // The client binder died before onBinderUnlinked clean up the GetValueClient. + setBinderAlive(false); + + status = getClient()->getValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "getValues must fail if client died"; + ASSERT_EQ(status.getExceptionCode(), EX_TRANSACTION_FAILED); + // The client count should still be 1 but onBinderUnlinked will remove this later. + EXPECT_EQ(countClients(), static_cast(1)); +} + +TEST_F(DefaultVehicleHalTest, testSetValuesSmall) { + SetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(setValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->addSetValueResponses(expectedResults); + + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + EXPECT_EQ(getHardware()->nextSetValueRequests(), expectedHardwareRequests) + << "requests to hardware mismatch"; + + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback"; + ASSERT_EQ(maybeSetValueResults.value().payloads, expectedResults) << "results mismatch"; + EXPECT_EQ(countClients(), static_cast(1)); +} + +TEST_F(DefaultVehicleHalTest, testSetValuesLarge) { + SetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(setValuesTestCases(5000, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->addSetValueResponses(expectedResults); + + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + EXPECT_EQ(getHardware()->nextSetValueRequests(), expectedHardwareRequests) + << "requests to hardware mismatch"; + + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback"; + const SetValueResults& setValueResults = maybeSetValueResults.value(); + ASSERT_TRUE(setValueResults.payloads.empty()) + << "payload should be empty, shared memory file should be used"; + + auto result = LargeParcelableBase::stableLargeParcelableToParcelable(setValueResults); + ASSERT_TRUE(result.ok()) << "failed to parse shared memory file"; + ASSERT_EQ(result.value().getObject()->payloads, expectedResults) << "results mismatch"; + EXPECT_EQ(countClients(), static_cast(1)); +} + +class SetValuesInvalidRequestTest + : public DefaultVehicleHalTest, + public testing::WithParamInterface {}; + +INSTANTIATE_TEST_SUITE_P( + SetValuesInvalidRequestTests, SetValuesInvalidRequestTest, + testing::ValuesIn(getSetValuesInvalidRequestTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(SetValuesInvalidRequestTest, testSetValuesInvalidRequest) { + SetValuesInvalidRequestTestCase tc = GetParam(); + std::vector expectedHardwareResults{ + SetValueResult{ + .requestId = 1, + .status = StatusCode::OK, + }, + }; + getHardware()->addSetValueResponses(expectedHardwareResults); + + SetValueRequests requests; + SetValueRequest invalidRequest{ + .requestId = 0, + .value = tc.request, + }; + SetValueRequest normalRequest{.requestId = 1, + .value = { + .prop = testInt32VecProp(0), + .value.int32Values = {0}, + }}; + requests.payloads = {invalidRequest, normalRequest}; + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + EXPECT_EQ(getHardware()->nextSetValueRequests(), std::vector({normalRequest})) + << "requests to hardware mismatch"; + + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback"; + EXPECT_EQ(maybeSetValueResults.value().payloads, std::vector({ + { + .requestId = 0, + .status = tc.expectedStatus, + }, + })) + << "invalid argument result mismatch"; + + maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results from hardware in callback"; + EXPECT_EQ(maybeSetValueResults.value().payloads, expectedHardwareResults) + << "results from hardware mismatch"; +} + +TEST_F(DefaultVehicleHalTest, testSetValuesFinishBeforeTimeout) { + // timeout: 0.1s + int64_t timeout = 100000000; + setTimeout(timeout); + + SetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(setValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + // The response would be returned after 0.05s. + getHardware()->setSleepTime(timeout / 2); + getHardware()->addSetValueResponses(expectedResults); + + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + // Wait for the response. + std::this_thread::sleep_for(std::chrono::nanoseconds(timeout)); + + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback"; + EXPECT_EQ(maybeSetValueResults.value().payloads, expectedResults) << "results mismatch"; + ASSERT_FALSE(getCallback()->nextSetValueResults().has_value()) << "more results than expected"; +} + +TEST_F(DefaultVehicleHalTest, testSetValuesFinishAfterTimeout) { + // timeout: 0.1s + int64_t timeout = 100000000; + setTimeout(timeout); + + SetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(setValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); + + // The response would be returned after 0.2s. + getHardware()->setSleepTime(timeout * 2); + getHardware()->addSetValueResponses(expectedResults); + + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + // Wait for the response. + std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5)); + + for (size_t i = 0; i < expectedResults.size(); i++) { + expectedResults[i] = { + .requestId = expectedResults[i].requestId, + .status = StatusCode::TRY_AGAIN, + }; + } + + auto maybeSetValueResults = getCallback()->nextSetValueResults(); + ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback"; + ASSERT_THAT(maybeSetValueResults.value().payloads, UnorderedElementsAreArray(expectedResults)) + << "results mismatch, expect TRY_AGAIN error."; + ASSERT_FALSE(getCallback()->nextSetValueResults().has_value()) << "more results than expected"; +} + +TEST_F(DefaultVehicleHalTest, testSetValuesDuplicateRequestIdsInTwoRequests) { + // timeout: 0.1s + int64_t timeout = 100000000; + setTimeout(timeout); + + SetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + + ASSERT_TRUE(setValuesTestCases(1, requests, expectedResults, expectedHardwareRequests).ok()); + + getHardware()->setSleepTime(timeout * 2); + getHardware()->addSetValueResponses(expectedResults); + + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + // Use the same request ID again. + status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) + << "Use the same request ID before the previous request finishes must fail"; + + // Wait for the request to finish. + std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5)); +} + +TEST_F(DefaultVehicleHalTest, testSetValuesDuplicateRequestIdsInOneRequest) { + SetValueRequests requests = {.payloads = { + { + .requestId = 0, + .value = + VehiclePropValue{ + .prop = testInt32VecProp(0), + .value.int32Values = {0}, + }, + }, + { + .requestId = 0, + .value = + VehiclePropValue{ + .prop = testInt32VecProp(1), + .value.int32Values = {0}, + }, + }, + }}; + + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "duplicate Ids in one request must fail"; +} + +TEST_F(DefaultVehicleHalTest, testSetValuesDuplicateRequestProps) { + SetValueRequests requests = {.payloads = { + { + .requestId = 0, + .value = + VehiclePropValue{ + .prop = testInt32VecProp(0), + .value.int32Values = {0}, + }, + }, + { + .requestId = 1, + .value = + VehiclePropValue{ + .prop = testInt32VecProp(0), + .value.int32Values = {0}, + }, + }, + }}; + + auto status = getClient()->setValues(getCallbackClient(), requests); + + ASSERT_FALSE(status.isOk()) << "duplicate request properties in one request must fail"; +} + +TEST_F(DefaultVehicleHalTest, testSubscribeUnsubscribe) { + std::vector options = { + { + .propId = GLOBAL_ON_CHANGE_PROP, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + status = getClient()->unsubscribe(getCallbackClient(), + std::vector({GLOBAL_ON_CHANGE_PROP})); + + ASSERT_TRUE(status.isOk()) << "unsubscribe failed: " << status.getMessage(); +} + +TEST_F(DefaultVehicleHalTest, testSubscribeGlobalOnChangeNormal) { + std::vector options = { + { + .propId = GLOBAL_ON_CHANGE_PROP, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + VehiclePropValue testValue{ + .prop = GLOBAL_ON_CHANGE_PROP, + .value.int32Values = {0}, + }; + SetValueRequests setValueRequests = { + .payloads = + { + SetValueRequest{ + .requestId = 0, + .value = testValue, + }, + }, + }; + std::vector setValueResults = {{ + .requestId = 0, + .status = StatusCode::OK, + }}; + + // Set the value to trigger a property change event. + getHardware()->addSetValueResponses(setValueResults); + status = getClient()->setValues(getCallbackClient(), setValueRequests); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + auto maybeResults = getCallback()->nextOnPropertyEventResults(); + ASSERT_TRUE(maybeResults.has_value()) << "no results in callback"; + ASSERT_THAT(maybeResults.value().payloads, UnorderedElementsAre(testValue)) + << "results mismatch, expect on change event for the updated value"; + ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) + << "more results than expected"; + EXPECT_EQ(countClients(), static_cast(2)) + << "expect 2 clients, 1 subscribe client and 1 setvalue client"; +} + +TEST_F(DefaultVehicleHalTest, testSubscribeGlobalOnchangeUnrelatedEventIgnored) { + std::vector options = { + { + .propId = GLOBAL_ON_CHANGE_PROP, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + VehiclePropValue testValue{ + .prop = GLOBAL_CONTINUOUS_PROP, + .value.int32Values = {0}, + }; + + // Set the value to trigger a property change event. This event should be ignored because we + // have not subscribed to it. + getHardware()->addSetValueResponses({{ + .requestId = 0, + .status = StatusCode::OK, + }}); + status = getClient()->setValues(getCallbackClient(), + { + .payloads = + { + SetValueRequest{ + .requestId = 0, + .value = testValue, + }, + }, + }); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) + << "must receive no property update event if the property is not subscribed"; +} + +TEST_F(DefaultVehicleHalTest, testSubscribeAreaOnChange) { + int testAreaId = toInt(VehicleAreaWindow::ROW_1_LEFT); + std::vector options = { + { + .propId = AREA_ON_CHANGE_PROP, + .areaIds = {testAreaId}, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + VehiclePropValue testValue{ + .prop = AREA_ON_CHANGE_PROP, + .areaId = testAreaId, + .value.int32Values = {0}, + }; + + // Set the value to trigger a property change event. + getHardware()->addSetValueResponses({{ + .requestId = 0, + .status = StatusCode::OK, + }}); + status = getClient()->setValues(getCallbackClient(), + { + .payloads = + { + SetValueRequest{ + .requestId = 0, + .value = testValue, + }, + }, + }); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + auto maybeResults = getCallback()->nextOnPropertyEventResults(); + ASSERT_TRUE(maybeResults.has_value()) << "no results in callback"; + ASSERT_THAT(maybeResults.value().payloads, UnorderedElementsAre(testValue)) + << "results mismatch, expect on change event for the updated value"; + ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) + << "more results than expected"; +} + +TEST_F(DefaultVehicleHalTest, testSubscribeAreaOnChangeAllAreas) { + std::vector options = { + { + .propId = AREA_ON_CHANGE_PROP, + // No areaIds means subscribing to all area IDs. + .areaIds = {}, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + VehiclePropValue testValue1{ + .prop = AREA_ON_CHANGE_PROP, + .areaId = toInt(VehicleAreaWindow::ROW_1_LEFT), + .value.int32Values = {0}, + }; + VehiclePropValue testValue2{ + .prop = AREA_ON_CHANGE_PROP, + .areaId = toInt(VehicleAreaWindow::ROW_1_RIGHT), + .value.int32Values = {0}, + }; + + // Set the values to trigger property change events for two areas. + getHardware()->addSetValueResponses({{ + .requestId = 0, + .status = StatusCode::OK, + }, + { + .requestId = 1, + .status = StatusCode::OK, + }}); + status = getClient()->setValues(getCallbackClient(), + { + .payloads = + { + SetValueRequest{ + .requestId = 0, + .value = testValue1, + }, + SetValueRequest{ + .requestId = 1, + .value = testValue2, + }, + }, + }); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + auto maybeResults = getCallback()->nextOnPropertyEventResults(); + ASSERT_TRUE(maybeResults.has_value()) << "no results in callback"; + ASSERT_THAT(maybeResults.value().payloads, UnorderedElementsAre(testValue1, testValue2)) + << "results mismatch, expect two on-change events for all updated areas"; + ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) + << "more results than expected"; +} + +TEST_F(DefaultVehicleHalTest, testSubscribeGlobalContinuous) { + VehiclePropValue testValue{ + .prop = GLOBAL_CONTINUOUS_PROP, + }; + + std::vector options = { + { + .propId = GLOBAL_CONTINUOUS_PROP, + .sampleRate = 20.0, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + // Sleep for 1s, which should generate ~20 events. + std::this_thread::sleep_for(std::chrono::seconds(1)); + + // Should trigger about 20 times, check for at least 15 events to be safe. + for (size_t i = 0; i < 15; i++) { + auto maybeResults = getCallback()->nextOnPropertyEventResults(); + ASSERT_TRUE(maybeResults.has_value()) << "no results in callback"; + ASSERT_THAT(maybeResults.value().payloads, UnorderedElementsAre(testValue)) + << "results mismatch, expect to get the updated value"; + } + EXPECT_EQ(countClients(), static_cast(1)); +} + +TEST_F(DefaultVehicleHalTest, testSubscribeGlobalContinuousRateOutOfRange) { + // The maxSampleRate is 100, so the sample rate should be the default max 100. + std::vector options = { + { + .propId = GLOBAL_CONTINUOUS_PROP, + .sampleRate = 1000.0, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + // Sleep for 1s, which should generate ~100 events. + std::this_thread::sleep_for(std::chrono::seconds(1)); + + size_t eventCount = getCallback()->countOnPropertyEventResults(); + ASSERT_GE(eventCount, 50u) << "expect at least 50 events to be generated"; + ASSERT_LE(eventCount, 150u) << "expect no more than 150 events to be generated"; + + EXPECT_EQ(countClients(), static_cast(1)); +} + +TEST_F(DefaultVehicleHalTest, testSubscribeAreaContinuous) { + std::vector options = { + { + .propId = AREA_CONTINUOUS_PROP, + .sampleRate = 20.0, + .areaIds = {toInt(VehicleAreaWindow::ROW_1_LEFT)}, + }, + { + .propId = AREA_CONTINUOUS_PROP, + .sampleRate = 10.0, + .areaIds = {toInt(VehicleAreaWindow::ROW_1_RIGHT)}, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + // Sleep for 1s, which should generate ~20 events. + std::this_thread::sleep_for(std::chrono::seconds(1)); + + getClient()->unsubscribe(getCallbackClient(), std::vector({AREA_CONTINUOUS_PROP})); + + std::vector events; + while (true) { + auto maybeResults = getCallback()->nextOnPropertyEventResults(); + if (!maybeResults.has_value()) { + break; + } + for (const auto& value : maybeResults.value().payloads) { + events.push_back(value); + } + } + + size_t leftCount = 0; + size_t rightCount = 0; + + for (const auto& event : events) { + ASSERT_EQ(event.prop, AREA_CONTINUOUS_PROP); + if (event.areaId == toInt(VehicleAreaWindow::ROW_1_LEFT)) { + leftCount++; + continue; + } + rightCount++; + } + + // Should trigger about 20 times, check for at least 15 events to be safe. + ASSERT_GE(leftCount, static_cast(15)); + // Should trigger about 10 times, check for at least 5 events to be safe. + ASSERT_GE(rightCount, static_cast(5)); +} + +TEST_F(DefaultVehicleHalTest, testUnsubscribeOnChange) { + std::vector options = { + { + .propId = GLOBAL_ON_CHANGE_PROP, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + status = getClient()->unsubscribe(getCallbackClient(), + std::vector({GLOBAL_ON_CHANGE_PROP})); + + ASSERT_TRUE(status.isOk()) << "unsubscribe failed: " << status.getMessage(); + + VehiclePropValue testValue{ + .prop = GLOBAL_ON_CHANGE_PROP, + .value.int32Values = {0}, + }; + + // Set the value to trigger a property change event. + getHardware()->addSetValueResponses({{ + .requestId = 0, + .status = StatusCode::OK, + }}); + status = getClient()->setValues(getCallbackClient(), + { + .payloads = + { + SetValueRequest{ + .requestId = 0, + .value = testValue, + }, + }, + }); + + ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); + + ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) + << "No property event should be generated after unsubscription"; +} + +TEST_F(DefaultVehicleHalTest, testUnsubscribeContinuous) { + std::vector options = { + { + .propId = GLOBAL_CONTINUOUS_PROP, + .sampleRate = 20.0, + }, + }; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + + status = getClient()->unsubscribe(getCallbackClient(), + std::vector({GLOBAL_CONTINUOUS_PROP})); + + ASSERT_TRUE(status.isOk()) << "unsubscribe failed: " << status.getMessage(); + + // Clear existing events. + while (getCallback()->nextOnPropertyEventResults().has_value()) { + // Do nothing. + } + + // Wait for a while, make sure no new events are generated. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) + << "No property event should be generated after unsubscription"; +} + +class SubscribeInvalidOptionsTest + : public DefaultVehicleHalTest, + public testing::WithParamInterface {}; + +INSTANTIATE_TEST_SUITE_P( + SubscribeInvalidOptionsTests, SubscribeInvalidOptionsTest, + testing::ValuesIn(getSubscribeInvalidOptionsTestCases()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_P(SubscribeInvalidOptionsTest, testSubscribeInvalidOptions) { + std::vector options = {GetParam().option}; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_FALSE(status.isOk()) << "invalid subscribe options must fail"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::INVALID_ARG)); +} + +TEST_F(DefaultVehicleHalTest, testSubscribeNoReadPermission) { + std::vector options = {{ + .propId = WRITE_ONLY_PROP, + }}; + + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_FALSE(status.isOk()) << "subscribe to a write-only property must fail"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::ACCESS_DENIED)); +} + +TEST_F(DefaultVehicleHalTest, testUnsubscribeFailure) { + auto status = getClient()->unsubscribe(getCallbackClient(), + std::vector({GLOBAL_ON_CHANGE_PROP})); + + ASSERT_FALSE(status.isOk()) << "unsubscribe to a not-subscribed property must fail"; + ASSERT_EQ(status.getServiceSpecificError(), toInt(StatusCode::INVALID_ARG)); +} + +TEST_F(DefaultVehicleHalTest, testHeartbeatEvent) { + std::vector options = {{ + .propId = toInt(VehicleProperty::VHAL_HEARTBEAT), + }}; + int64_t currentTime = uptimeMillis(); + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + + ASSERT_TRUE(status.isOk()) << "unable to subscribe to heartbeat event: " << status.getMessage(); + + // We send out a heartbeat event every 3s, so sleep for 3s. + std::this_thread::sleep_for(std::chrono::seconds(3)); + + auto maybeResults = getCallback()->nextOnPropertyEventResults(); + ASSERT_TRUE(maybeResults.has_value()) << "no results in callback"; + ASSERT_EQ(maybeResults.value().payloads.size(), static_cast(1)); + VehiclePropValue gotValue = maybeResults.value().payloads[0]; + ASSERT_EQ(gotValue.prop, toInt(VehicleProperty::VHAL_HEARTBEAT)); + ASSERT_EQ(gotValue.value.int64Values.size(), static_cast(1)); + ASSERT_GE(gotValue.value.int64Values[0], currentTime) + << "expect to get the latest timestamp with the heartbeat event"; +} + +TEST_F(DefaultVehicleHalTest, testOnBinderDiedUnlinked) { + // Set responses for all the hardware getValues requests. + getHardware()->setGetValueResponder( + [](std::shared_ptr callback, + const std::vector& requests) { + std::vector results; + for (auto& request : requests) { + VehiclePropValue prop = request.prop; + prop.value.int32Values = {0}; + results.push_back({ + .requestId = request.requestId, + .status = StatusCode::OK, + .prop = prop, + }); + } + (*callback)(results); + return StatusCode::OK; + }); + std::vector options = { + { + .propId = GLOBAL_CONTINUOUS_PROP, + .sampleRate = 20.0, + }, + }; + auto status = getClient()->subscribe(getCallbackClient(), options, 0); + ASSERT_TRUE(status.isOk()) << "subscribe failed: " << status.getMessage(); + // Sleep for 100ms so that the subscriptionClient gets created because we would at least try to + // get value once. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + // Issue another getValue request on the same client. + GetValueRequests requests; + std::vector expectedResults; + std::vector expectedHardwareRequests; + ASSERT_TRUE(getValuesTestCases(1, requests, expectedResults, expectedHardwareRequests).ok()); + getHardware()->addGetValueResponses(expectedResults); + status = getClient()->getValues(getCallbackClient(), requests); + ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); + + ASSERT_EQ(countOnBinderDiedContexts(), static_cast(1)) + << "expect one OnBinderDied context when one client is registered"; + + // Get the death recipient cookie for our callback that would be used in onBinderDied and + // onBinderUnlinked. + AIBinder* clientId = getCallbackClient()->asBinder().get(); + void* context = getOnBinderDiedContexts(clientId); + + onBinderDied(context); + + // Sleep for 100ms between checks. + int64_t sleep = 100; + // Timeout: 10s. + int64_t timeout = 10'000'000'000; + int64_t stopTime = elapsedRealtimeNano() + timeout; + // Wait until the onBinderDied event is handled. + while (countClients() != 0u && elapsedRealtimeNano() <= stopTime) { + std::this_thread::sleep_for(std::chrono::milliseconds(sleep)); + } + + ASSERT_EQ(countClients(), static_cast(0)) + << "expect all clients to be removed when binder died"; + ASSERT_TRUE(hasNoSubscriptions()) << "expect no subscriptions when binder died"; + + onBinderUnlinked(context); + + stopTime = elapsedRealtimeNano() + timeout; + // Wait until the onBinderUnlinked event is handled. + while (countOnBinderDiedContexts() != 0u && elapsedRealtimeNano() <= stopTime) { + std::this_thread::sleep_for(std::chrono::milliseconds(sleep)); + } + + ASSERT_EQ(countOnBinderDiedContexts(), static_cast(0)) + << "expect OnBinderDied context to be deleted when binder is unlinked"; +} + +TEST_F(DefaultVehicleHalTest, testDumpCallerShouldDump) { + std::string buffer = "Dump from hardware"; + getHardware()->setDumpResult({ + .callerShouldDumpState = true, + .buffer = buffer, + }); + int fd = memfd_create("memfile", 0); + getClient()->dump(fd, nullptr, 0); + + lseek(fd, 0, SEEK_SET); + char buf[10240] = {}; + read(fd, buf, sizeof(buf)); + close(fd); + + std::string msg(buf); + + ASSERT_THAT(msg, ContainsRegex(buffer + "\nVehicle HAL State: \n")); +} + +TEST_F(DefaultVehicleHalTest, testDumpCallerShouldNotDump) { + std::string buffer = "Dump from hardware"; + getHardware()->setDumpResult({ + .callerShouldDumpState = false, + .buffer = buffer, + }); + int fd = memfd_create("memfile", 0); + getClient()->dump(fd, nullptr, 0); + + lseek(fd, 0, SEEK_SET); + char buf[10240] = {}; + read(fd, buf, sizeof(buf)); + close(fd); + + std::string msg(buf); + + ASSERT_THAT(msg, ContainsRegex(buffer)); + ASSERT_EQ(msg.find("Vehicle HAL State: "), std::string::npos); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e463571d9431820afcefbab55b9fa261b518bbc --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp @@ -0,0 +1,93 @@ +/* + * 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. + */ + +#include "MockVehicleCallback.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace { + +using ::aidl::android::hardware::automotive::vehicle::GetValueResults; +using ::aidl::android::hardware::automotive::vehicle::SetValueResults; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues; +using ::ndk::ScopedAStatus; +using ::ndk::ScopedFileDescriptor; + +template +static ScopedAStatus storeResults(const T& results, std::list* storedResults) { + T resultsCopy{ + .payloads = results.payloads, + }; + int fd = results.sharedMemoryFd.get(); + if (fd != -1) { + resultsCopy.sharedMemoryFd = ScopedFileDescriptor(dup(fd)); + } + storedResults->push_back(std::move(resultsCopy)); + return ScopedAStatus::ok(); +} + +} // namespace + +ScopedAStatus MockVehicleCallback::onGetValues(const GetValueResults& results) { + std::scoped_lock lockGuard(mLock); + return storeResults(results, &mGetValueResults); +} + +ScopedAStatus MockVehicleCallback::onSetValues(const SetValueResults& results) { + std::scoped_lock lockGuard(mLock); + return storeResults(results, &mSetValueResults); +} + +ScopedAStatus MockVehicleCallback::onPropertyEvent(const VehiclePropValues& results, + int32_t sharedMemoryFileCount) { + std::scoped_lock lockGuard(mLock); + + mSharedMemoryFileCount = sharedMemoryFileCount; + return storeResults(results, &mOnPropertyEventResults); +} + +ScopedAStatus MockVehicleCallback::onPropertySetError(const VehiclePropErrors&) { + return ScopedAStatus::ok(); +} + +std::optional MockVehicleCallback::nextGetValueResults() { + std::scoped_lock lockGuard(mLock); + return pop(mGetValueResults); +} + +std::optional MockVehicleCallback::nextSetValueResults() { + std::scoped_lock lockGuard(mLock); + return pop(mSetValueResults); +} + +std::optional MockVehicleCallback::nextOnPropertyEventResults() { + std::scoped_lock lockGuard(mLock); + return pop(mOnPropertyEventResults); +} + +size_t MockVehicleCallback::countOnPropertyEventResults() { + std::scoped_lock lockGuard(mLock); + return mOnPropertyEventResults.size(); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h new file mode 100644 index 0000000000000000000000000000000000000000..0faaa1f670ba117d4cc4535abfce718847966b02 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_test_MockVehicleCallback_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_test_MockVehicleCallback_H_ + +#include + +#include +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +template +std::optional pop(std::list& items) { + if (items.size() > 0) { + auto item = std::move(items.front()); + items.pop_front(); + return item; + } + return std::nullopt; +} + +// MockVehicleCallback is a mock VehicleCallback implementation that simply stores the results. +class MockVehicleCallback final + : public aidl::android::hardware::automotive::vehicle::BnVehicleCallback { + public: + ndk::ScopedAStatus onGetValues( + const aidl::android::hardware::automotive::vehicle::GetValueResults& results) override; + ndk::ScopedAStatus onSetValues( + const aidl::android::hardware::automotive::vehicle::SetValueResults& results) override; + ndk::ScopedAStatus onPropertyEvent( + const aidl::android::hardware::automotive::vehicle::VehiclePropValues&, + int32_t) override; + ndk::ScopedAStatus onPropertySetError( + const aidl::android::hardware::automotive::vehicle::VehiclePropErrors&) override; + + // Test functions + std::optional + nextGetValueResults(); + std::optional + nextSetValueResults(); + std::optional + nextOnPropertyEventResults(); + size_t countOnPropertyEventResults(); + + private: + std::mutex mLock; + std::list mGetValueResults + GUARDED_BY(mLock); + std::list mSetValueResults + GUARDED_BY(mLock); + std::list + mOnPropertyEventResults GUARDED_BY(mLock); + int32_t mSharedMemoryFileCount GUARDED_BY(mLock); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_test_MockVehicleCallback_H_ diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.cpp b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4df4e1aea57eb16c24fb6f2184237ae25d37454d --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.cpp @@ -0,0 +1,260 @@ +/* + * 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. + */ + +#include "MockVehicleHardware.h" +#include "MockVehicleCallback.h" + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::GetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::GetValueResult; +using ::aidl::android::hardware::automotive::vehicle::SetValueRequest; +using ::aidl::android::hardware::automotive::vehicle::SetValueResult; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; + +MockVehicleHardware::MockVehicleHardware() { + mRecurrentTimer = std::make_unique(); +} + +MockVehicleHardware::~MockVehicleHardware() { + std::unique_lock lk(mLock); + mCv.wait(lk, [this] { return mThreadCount == 0; }); + mRecurrentTimer.reset(); +} + +std::vector MockVehicleHardware::getAllPropertyConfigs() const { + std::scoped_lock lockGuard(mLock); + return mPropertyConfigs; +} + +StatusCode MockVehicleHardware::setValues(std::shared_ptr callback, + const std::vector& requests) { + std::scoped_lock lockGuard(mLock); + if (StatusCode status = handleRequestsLocked(__func__, callback, requests, &mSetValueRequests, + &mSetValueResponses); + status != StatusCode::OK) { + return status; + } + if (mPropertyChangeCallback == nullptr) { + return StatusCode::OK; + } + std::vector values; + for (auto& request : requests) { + values.push_back(request.value); + } + (*mPropertyChangeCallback)(values); + return StatusCode::OK; +} + +StatusCode MockVehicleHardware::getValues(std::shared_ptr callback, + const std::vector& requests) const { + std::scoped_lock lockGuard(mLock); + if (mGetValueResponder != nullptr) { + return mGetValueResponder(callback, requests); + } + return handleRequestsLocked(__func__, callback, requests, &mGetValueRequests, + &mGetValueResponses); +} + +void MockVehicleHardware::setDumpResult(DumpResult result) { + mDumpResult = result; +} + +DumpResult MockVehicleHardware::dump(const std::vector&) { + return mDumpResult; +} + +StatusCode MockVehicleHardware::checkHealth() { + return StatusCode::OK; +} + +StatusCode MockVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, float sampleRate) { + std::shared_ptr> action; + + { + std::scoped_lock lockGuard(mLock); + if (mRecurrentActions[propId][areaId] != nullptr) { + // Remove the previous action register for this [propId, areaId]. + mRecurrentTimer->unregisterTimerCallback(mRecurrentActions[propId][areaId]); + } + if (sampleRate == 0) { + return StatusCode::OK; + } + + // We are sure 'propertyChangeCallback' would be alive because we would unregister timer + // before destroying 'this' which owns mPropertyChangeCallback. + const PropertyChangeCallback* propertyChangeCallback = mPropertyChangeCallback.get(); + action = std::make_shared>([propertyChangeCallback, propId, areaId] { + std::vector values = { + { + .prop = propId, + .areaId = areaId, + }, + }; + (*propertyChangeCallback)(values); + }); + // Store the action in a map so that we could remove the action later. + mRecurrentActions[propId][areaId] = action; + } + + // In mock implementation, we generate a new property change event for this property at sample + // rate. + int64_t interval = static_cast(1'000'000'000. / sampleRate); + mRecurrentTimer->registerTimerCallback(interval, action); + return StatusCode::OK; +} + +void MockVehicleHardware::registerOnPropertyChangeEvent( + std::unique_ptr callback) { + std::scoped_lock lockGuard(mLock); + mPropertyChangeCallback = std::move(callback); +} + +void MockVehicleHardware::registerOnPropertySetErrorEvent( + std::unique_ptr) { + // TODO(b/200737967): mock this. +} + +void MockVehicleHardware::setPropertyConfigs(const std::vector& configs) { + std::scoped_lock lockGuard(mLock); + mPropertyConfigs = configs; +} + +void MockVehicleHardware::addGetValueResponses(const std::vector& responses) { + std::scoped_lock lockGuard(mLock); + mGetValueResponses.push_back(responses); +} + +void MockVehicleHardware::addSetValueResponses(const std::vector& responses) { + std::scoped_lock lockGuard(mLock); + mSetValueResponses.push_back(responses); +} + +void MockVehicleHardware::setGetValueResponder( + std::function, + const std::vector&)>&& responder) { + std::scoped_lock lockGuard(mLock); + mGetValueResponder = responder; +} + +std::vector MockVehicleHardware::nextGetValueRequests() { + std::scoped_lock lockGuard(mLock); + std::optional> request = pop(mGetValueRequests); + if (!request.has_value()) { + return std::vector(); + } + return std::move(request.value()); +} + +std::vector MockVehicleHardware::nextSetValueRequests() { + std::scoped_lock lockGuard(mLock); + std::optional> request = pop(mSetValueRequests); + if (!request.has_value()) { + return std::vector(); + } + return std::move(request.value()); +} + +void MockVehicleHardware::setStatus(const char* functionName, StatusCode status) { + std::scoped_lock lockGuard(mLock); + mStatusByFunctions[functionName] = status; +} + +void MockVehicleHardware::setSleepTime(int64_t timeInNano) { + std::scoped_lock lockGuard(mLock); + mSleepTime = timeInNano; +} + +template +StatusCode MockVehicleHardware::returnResponse( + std::shared_ptr)>> callback, + std::list>* storedResponses) const { + if (storedResponses->size() > 0) { + (*callback)(std::move(storedResponses->front())); + storedResponses->pop_front(); + return StatusCode::OK; + } else { + ALOGE("no more response"); + return StatusCode::INTERNAL_ERROR; + } +} + +template StatusCode MockVehicleHardware::returnResponse( + std::shared_ptr)>> callback, + std::list>* storedResponses) const; + +template StatusCode MockVehicleHardware::returnResponse( + std::shared_ptr)>> callback, + std::list>* storedResponses) const; + +template +StatusCode MockVehicleHardware::handleRequestsLocked( + const char* functionName, + std::shared_ptr)>> callback, + const std::vector& requests, + std::list>* storedRequests, + std::list>* storedResponses) const { + storedRequests->push_back(requests); + if (auto it = mStatusByFunctions.find(functionName); it != mStatusByFunctions.end()) { + if (StatusCode status = it->second; status != StatusCode::OK) { + return status; + } + } + + if (mSleepTime != 0) { + int64_t sleepTime = mSleepTime; + mThreadCount++; + std::thread t([this, callback, sleepTime, storedResponses]() { + std::this_thread::sleep_for(std::chrono::nanoseconds(sleepTime)); + returnResponse(callback, storedResponses); + mThreadCount--; + mCv.notify_one(); + }); + // Detach the thread here so we do not have to maintain the thread object. mThreadCount + // and mCv make sure we wait for all threads to end before we exit. + t.detach(); + return StatusCode::OK; + + } else { + return returnResponse(callback, storedResponses); + } +} + +template StatusCode MockVehicleHardware::handleRequestsLocked( + const char* functionName, + std::shared_ptr)>> callback, + const std::vector& requests, + std::list>* storedRequests, + std::list>* storedResponses) const; + +template StatusCode MockVehicleHardware::handleRequestsLocked( + const char* functionName, + std::shared_ptr)>> callback, + const std::vector& requests, + std::list>* storedRequests, + std::list>* storedResponses) const; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h new file mode 100644 index 0000000000000000000000000000000000000000..743841c216f918189528ad6a201f02ff52d74b95 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleHardware.h @@ -0,0 +1,137 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_vhal_test_MockVehicleHardware_H_ +#define android_hardware_automotive_vehicle_aidl_impl_vhal_test_MockVehicleHardware_H_ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +class MockVehicleHardware final : public IVehicleHardware { + public: + MockVehicleHardware(); + + ~MockVehicleHardware(); + + std::vector + getAllPropertyConfigs() const override; + aidl::android::hardware::automotive::vehicle::StatusCode setValues( + std::shared_ptr callback, + const std::vector& + requests) override; + aidl::android::hardware::automotive::vehicle::StatusCode getValues( + std::shared_ptr callback, + const std::vector& + requests) const override; + DumpResult dump(const std::vector&) override; + aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override; + void registerOnPropertyChangeEvent( + std::unique_ptr callback) override; + void registerOnPropertySetErrorEvent(std::unique_ptr) override; + aidl::android::hardware::automotive::vehicle::StatusCode updateSampleRate( + int32_t propId, int32_t areaId, float sampleRate) override; + + // Test functions. + void setPropertyConfigs( + const std::vector& + configs); + void addGetValueResponses( + const std::vector& + responses); + void addSetValueResponses( + const std::vector& + responses); + void setGetValueResponder( + std::function, + const std::vector< + aidl::android::hardware::automotive::vehicle::GetValueRequest>&)>&& + responder); + std::vector + nextGetValueRequests(); + std::vector + nextSetValueRequests(); + void setStatus(const char* functionName, + aidl::android::hardware::automotive::vehicle::StatusCode status); + void setSleepTime(int64_t timeInNano); + void setDumpResult(DumpResult result); + + private: + mutable std::mutex mLock; + mutable std::condition_variable mCv; + mutable std::atomic mThreadCount; + std::vector mPropertyConfigs + GUARDED_BY(mLock); + mutable std::list> + mGetValueRequests GUARDED_BY(mLock); + mutable std::list> + mGetValueResponses GUARDED_BY(mLock); + mutable std::list> + mSetValueRequests GUARDED_BY(mLock); + mutable std::list> + mSetValueResponses GUARDED_BY(mLock); + std::unordered_map + mStatusByFunctions GUARDED_BY(mLock); + int64_t mSleepTime GUARDED_BY(mLock) = 0; + std::unique_ptr mPropertyChangeCallback GUARDED_BY(mLock); + std::function, + const std::vector&)> + mGetValueResponder GUARDED_BY(mLock); + + template + aidl::android::hardware::automotive::vehicle::StatusCode returnResponse( + std::shared_ptr)>> callback, + std::list>* storedResponses) const; + template + aidl::android::hardware::automotive::vehicle::StatusCode handleRequestsLocked( + const char* functionName, + std::shared_ptr)>> callback, + const std::vector& requests, + std::list>* storedRequests, + std::list>* storedResponses) const REQUIRES(mLock); + + DumpResult mDumpResult; + + // RecurrentTimer is thread-safe. + std::shared_ptr mRecurrentTimer; + std::unordered_map>>> + mRecurrentActions GUARDED_BY(mLock); +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_vhal_test_MockVehicleHardware_H_ diff --git a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3f593633f9c5fb939c3b7429f05533bda2444468 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp @@ -0,0 +1,495 @@ +/* + * 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. + */ + +#include "SubscriptionManager.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::BnVehicleCallback; +using ::aidl::android::hardware::automotive::vehicle::GetValueResults; +using ::aidl::android::hardware::automotive::vehicle::IVehicleCallback; +using ::aidl::android::hardware::automotive::vehicle::SetValueResults; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues; +using ::ndk::ScopedAStatus; +using ::ndk::SpAIBinder; +using ::testing::ElementsAre; +using ::testing::WhenSorted; + +class PropertyCallback final : public BnVehicleCallback { + public: + ScopedAStatus onGetValues(const GetValueResults&) override { return ScopedAStatus::ok(); } + + ScopedAStatus onSetValues(const SetValueResults&) override { return ScopedAStatus::ok(); } + + ScopedAStatus onPropertyEvent(const VehiclePropValues& values, int32_t) override { + std::scoped_lock lockGuard(mLock); + for (const auto& value : values.payloads) { + mEvents.push_back(value); + } + return ScopedAStatus::ok(); + } + + ScopedAStatus onPropertySetError(const VehiclePropErrors&) override { + return ScopedAStatus::ok(); + } + + // Test functions. + std::list getEvents() { + std::scoped_lock lockGuard(mLock); + return mEvents; + } + + void clearEvents() { + std::scoped_lock lockGuard(mLock); + mEvents.clear(); + } + + private: + std::mutex mLock; + std::list mEvents GUARDED_BY(mLock); +}; + +class SubscriptionManagerTest : public testing::Test { + public: + void SetUp() override { + mHardware = std::make_shared(); + mManager = std::make_unique(mHardware.get()); + mCallback = ndk::SharedRefBase::make(); + // Keep the local binder alive. + mBinder = mCallback->asBinder(); + mCallbackClient = IVehicleCallback::fromBinder(mBinder); + std::shared_ptr callbackClient = mCallbackClient; + mHardware->registerOnPropertyChangeEvent( + std::make_unique( + [callbackClient](std::vector updatedValues) { + VehiclePropValues values = { + .payloads = std::move(updatedValues), + }; + callbackClient->onPropertyEvent(values, 0); + })); + } + + SubscriptionManager* getManager() { return mManager.get(); } + + std::shared_ptr getCallbackClient() { return mCallbackClient; } + + PropertyCallback* getCallback() { return mCallback.get(); } + + std::list getEvents() { return getCallback()->getEvents(); } + + void clearEvents() { return getCallback()->clearEvents(); } + + private: + std::unique_ptr mManager; + std::shared_ptr mCallback; + std::shared_ptr mCallbackClient; + std::shared_ptr mHardware; + SpAIBinder mBinder; +}; + +TEST_F(SubscriptionManagerTest, testSubscribeGlobalContinuous) { + std::vector options = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + }}; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + ASSERT_GE(getEvents().size(), static_cast(9)); + EXPECT_EQ(getEvents().back().prop, 0); + EXPECT_EQ(getEvents().back().areaId, 0); +} + +TEST_F(SubscriptionManagerTest, testSubscribeMultiplePropsGlobalContinuous) { + std::vector options = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + }, + { + .propId = 1, + .areaIds = {0}, + .sampleRate = 20.0, + }}; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + size_t event0Count = 0; + size_t event1Count = 0; + + for (const auto& event : getEvents()) { + if (event.prop == 0) { + event0Count++; + } else { + event1Count++; + } + } + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + EXPECT_GE(event0Count, static_cast(9)); + // Theoretically trigger 20 times, but check for at least 15 times to be stable. + EXPECT_GE(event1Count, static_cast(15)); +} + +TEST_F(SubscriptionManagerTest, testOverrideSubscriptionContinuous) { + std::vector options = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 20.0, + }}; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + // Override sample rate to be 10.0. + options[0].sampleRate = 10.0; + result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + EXPECT_GE(getEvents().size(), static_cast(9)); + EXPECT_LE(getEvents().size(), static_cast(15)); +} + +TEST_F(SubscriptionManagerTest, testSubscribeMultipleAreasContinuous) { + std::vector options = { + { + .propId = 0, + .areaIds = {0, 1}, + .sampleRate = 10.0, + }, + }; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + size_t area0Count = 0; + size_t area1Count = 0; + + for (const auto& event : getEvents()) { + if (event.areaId == 0) { + area0Count++; + } else { + area1Count++; + } + } + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + EXPECT_GE(area0Count, static_cast(9)); + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + EXPECT_GE(area1Count, static_cast(9)); +} + +TEST_F(SubscriptionManagerTest, testUnsubscribeGlobalContinuous) { + std::vector options = {{ + .propId = 0, + .areaIds = {0}, + .sampleRate = 10.0, + }}; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + result = getManager()->unsubscribe(getCallbackClient()->asBinder().get()); + ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + + clearEvents(); + + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + ASSERT_TRUE(getEvents().empty()); +} + +TEST_F(SubscriptionManagerTest, testUnsubscribeMultipleAreas) { + std::vector options = { + { + .propId = 0, + .areaIds = {0, 1, 2, 3, 4}, + .sampleRate = 10.0, + }, + { + .propId = 1, + .areaIds = {0}, + .sampleRate = 10.0, + }, + }; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + result = getManager()->unsubscribe(getCallbackClient()->asBinder().get(), + std::vector({0})); + ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + + clearEvents(); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + // Theoretically trigger 10 times, but check for at least 9 times to be stable. + EXPECT_GE(getEvents().size(), static_cast(9)); + + for (const auto& event : getEvents()) { + EXPECT_EQ(event.prop, 1); + } +} + +TEST_F(SubscriptionManagerTest, testUnsubscribeByCallback) { + std::vector options = { + { + .propId = 0, + .areaIds = {0, 1, 2, 3, 4}, + .sampleRate = 10.0, + }, + { + .propId = 1, + .areaIds = {0}, + .sampleRate = 10.0, + }, + }; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + result = getManager()->unsubscribe(getCallbackClient()->asBinder().get()); + ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + + clearEvents(); + + std::this_thread::sleep_for(std::chrono::seconds(1)); + + EXPECT_TRUE(getEvents().empty()); +} + +TEST_F(SubscriptionManagerTest, testUnsubscribeFailure) { + std::vector options = { + { + .propId = 0, + .areaIds = {0, 1, 2, 3, 4}, + }, + { + .propId = 1, + .areaIds = {0}, + }, + }; + + auto result = getManager()->subscribe(getCallbackClient(), options, false); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + // Property ID: 2 was not subscribed. + result = getManager()->unsubscribe(getCallbackClient()->asBinder().get(), + std::vector({0, 1, 2})); + ASSERT_FALSE(result.ok()) << "unsubscribe an unsubscribed property must fail"; + + // Since property 0 and property 1 was not unsubscribed successfully, we should be able to + // unsubscribe them again. + result = getManager()->unsubscribe(getCallbackClient()->asBinder().get(), + std::vector({0, 1})); + ASSERT_TRUE(result.ok()) << "a failed unsubscription must not unsubscribe any properties" + << result.error().message(); +} + +TEST_F(SubscriptionManagerTest, testSubscribeOnchange) { + std::vector options1 = { + { + .propId = 0, + .areaIds = {0, 1}, + }, + { + .propId = 1, + .areaIds = {0}, + }, + }; + std::vector options2 = { + { + .propId = 0, + .areaIds = {0}, + }, + }; + + SpAIBinder binder1 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client1 = IVehicleCallback::fromBinder(binder1); + SpAIBinder binder2 = ndk::SharedRefBase::make()->asBinder(); + std::shared_ptr client2 = IVehicleCallback::fromBinder(binder2); + auto result = getManager()->subscribe(client1, options1, false); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + result = getManager()->subscribe(client2, options2, false); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + std::vector updatedValues = { + { + .prop = 0, + .areaId = 0, + }, + { + .prop = 0, + .areaId = 1, + }, + { + .prop = 1, + .areaId = 0, + }, + { + .prop = 1, + .areaId = 1, + }, + }; + auto clients = getManager()->getSubscribedClients(updatedValues); + + ASSERT_THAT(clients[client1], + WhenSorted(ElementsAre(&updatedValues[0], &updatedValues[1], &updatedValues[2]))); + ASSERT_THAT(clients[client2], ElementsAre(&updatedValues[0])); +} + +TEST_F(SubscriptionManagerTest, testSubscribeInvalidOption) { + std::vector options = { + { + .propId = 0, + .areaIds = {0, 1, 2, 3, 4}, + // invalid sample rate. + .sampleRate = 0.0, + }, + { + .propId = 1, + .areaIds = {0}, + .sampleRate = 10.0, + }, + }; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_FALSE(result.ok()) << "subscribe with invalid sample rate must fail"; + ASSERT_TRUE(getManager() + ->getSubscribedClients({{ + .prop = 0, + .areaId = 0, + }, + { + .prop = 1, + .areaId = 0, + }}) + .empty()) + << "no property should be subscribed if error is returned"; +} + +TEST_F(SubscriptionManagerTest, testSubscribeNoAreaIds) { + std::vector options = { + { + .propId = 0, + .areaIds = {}, + .sampleRate = 1.0, + }, + { + .propId = 1, + .areaIds = {0}, + .sampleRate = 10.0, + }, + }; + + auto result = getManager()->subscribe(getCallbackClient(), options, true); + ASSERT_FALSE(result.ok()) << "subscribe with invalid sample rate must fail"; + ASSERT_TRUE(getManager() + ->getSubscribedClients({{ + .prop = 1, + .areaId = 0, + }}) + .empty()) + << "no property should be subscribed if error is returned"; +} + +TEST_F(SubscriptionManagerTest, testUnsubscribeOnchange) { + std::vector options = { + { + .propId = 0, + .areaIds = {0, 1}, + }, + { + .propId = 1, + .areaIds = {0}, + }, + }; + + auto result = getManager()->subscribe(getCallbackClient(), options, false); + ASSERT_TRUE(result.ok()) << "failed to subscribe: " << result.error().message(); + + result = getManager()->unsubscribe(getCallbackClient()->asBinder().get(), + std::vector({0})); + ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + + std::vector updatedValues = { + { + .prop = 0, + .areaId = 0, + }, + { + .prop = 1, + .areaId = 0, + }, + }; + auto clients = getManager()->getSubscribedClients(updatedValues); + + ASSERT_THAT(clients[getCallbackClient()], ElementsAre(&updatedValues[1])); +} + +TEST_F(SubscriptionManagerTest, testCheckSampleRateValid) { + ASSERT_TRUE(SubscriptionManager::checkSampleRate(1.0)); +} + +TEST_F(SubscriptionManagerTest, testCheckSampleRateInvalidTooSmall) { + ASSERT_FALSE(SubscriptionManager::checkSampleRate(FLT_MIN)); +} + +TEST_F(SubscriptionManagerTest, testCheckSampleRateInvalidZero) { + ASSERT_FALSE(SubscriptionManager::checkSampleRate(0)); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.rc b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.rc new file mode 100644 index 0000000000000000000000000000000000000000..19267cd383af99e5fb948d3f8f62cd28ef2a472a --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.rc @@ -0,0 +1,4 @@ +service vendor.vehicle-hal-default /vendor/bin/hw/android.hardware.automotive.vehicle@V1-default-service + class early_hal + user vehicle_network + group system inet diff --git a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml new file mode 100644 index 0000000000000000000000000000000000000000..4d587eeba8552fa5ff4b96d6cacafcbaea5f521b --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml @@ -0,0 +1,7 @@ + + + android.hardware.automotive.vehicle + 1 + IVehicle/default + + diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp b/automotive/vehicle/proto/Android.bp similarity index 94% rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp rename to automotive/vehicle/proto/Android.bp index 6e85ae96ee1c73258f6edbb99fc311e63864dd0c..683f1281c439d0f66c0040600432496b876c0a76 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp +++ b/automotive/vehicle/proto/Android.bp @@ -24,6 +24,10 @@ package { cc_library_static { name: "android.hardware.automotive.vehicle@2.0-libproto-native", + visibility: [ + "//hardware/interfaces/automotive/vehicle:__subpackages__", + "//device/generic/car/emulator:__subpackages__", + ], vendor: true, host_supported: true, proto: { diff --git a/automotive/vehicle/proto/VehicleHalProto.proto b/automotive/vehicle/proto/VehicleHalProto.proto new file mode 100644 index 0000000000000000000000000000000000000000..0dafe8c4a6058b9a41703c4ebb040eebe5f947cb --- /dev/null +++ b/automotive/vehicle/proto/VehicleHalProto.proto @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2015 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. + */ + +syntax = "proto2"; + +package vhal_proto; + +// CMD messages are from workstation --> VHAL +// RESP messages are from VHAL --> workstation +enum MsgType { + GET_CONFIG_CMD = 0; + GET_CONFIG_RESP = 1; + GET_CONFIG_ALL_CMD = 2; + GET_CONFIG_ALL_RESP = 3; + GET_PROPERTY_CMD = 4; + GET_PROPERTY_RESP = 5; + GET_PROPERTY_ALL_CMD = 6; + GET_PROPERTY_ALL_RESP = 7; + SET_PROPERTY_CMD = 8; + SET_PROPERTY_RESP = 9; + SET_PROPERTY_ASYNC = 10; + DEBUG_CMD = 11; + DEBUG_RESP = 12; +} +enum Status { + RESULT_OK = 0; + ERROR_UNKNOWN = 1; + ERROR_UNIMPLEMENTED_CMD = 2; + ERROR_INVALID_PROPERTY = 3; + ERROR_INVALID_AREA_ID = 4; + ERROR_PROPERTY_UNINITIALIZED = 5; + ERROR_WRITE_ONLY_PROPERTY = 6; + ERROR_MEMORY_ALLOC_FAILED = 7; + ERROR_INVALID_OPERATION = 8; +} + +enum VehiclePropStatus { + AVAILABLE = 0; + UNAVAILABLE = 1; + ERROR = 2; +} + +message VehicleAreaConfig { + required int32 area_id = 1; + optional sint32 min_int32_value = 2; + optional sint32 max_int32_value = 3; + optional sint64 min_int64_value = 4; + optional sint64 max_int64_value = 5; + optional float min_float_value = 6; + optional float max_float_value = 7; +} + +message VehiclePropConfig { + required int32 prop = 1; + optional int32 access = 2; + optional int32 change_mode = 3; + optional int32 value_type = 4; + optional int32 supported_areas = 5; // Deprecated - DO NOT USE + repeated VehicleAreaConfig area_configs = 6; + optional int32 config_flags = 7; + repeated int32 config_array = 8; + optional string config_string = 9; + optional float min_sample_rate = 10; + optional float max_sample_rate = 11; +}; + +message VehiclePropValue { + // common data + required int32 prop = 1; + optional int32 value_type = 2; + optional int64 timestamp = 3; // required for valid data from HAL, skipped for set + optional VehiclePropStatus status = 10; // required for valid data from HAL, skipped for set + + // values + optional int32 area_id = 4; + repeated sint32 int32_values = 5; // this also covers boolean value. + repeated sint64 int64_values = 6; + repeated float float_values = 7; + optional string string_value = 8; + optional bytes bytes_value = 9; +}; + +// This structure is used to notify what values to get from the Vehicle HAL +message VehiclePropGet { + required int32 prop = 1; + optional int32 area_id = 2; +}; + +message EmulatorMessage { + required MsgType msg_type = 1; + optional Status status = 2; // Only for RESP messages + repeated VehiclePropGet prop = 3; // Provided for getConfig, getProperty commands + repeated VehiclePropConfig config = 4; + repeated VehiclePropValue value = 5; + repeated string debug_commands = 6; // Required for debug command + optional string debug_result = 7; // Required for debug RESP messages +}; diff --git a/automotive/vehicle/tools/translate_vehicle_props.py b/automotive/vehicle/tools/translate_vehicle_props.py new file mode 100644 index 0000000000000000000000000000000000000000..59eb17d9818a148fddf0105c40ddac5b5852f5ac --- /dev/null +++ b/automotive/vehicle/tools/translate_vehicle_props.py @@ -0,0 +1,151 @@ +#!/usr/bin/python + +# 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. +# +"""Tools to translate VehicleProperty from types.hal into AIDL format. + To store it to a file: + $ python translate_vehicle_props.py types.hal > VehicleProperty.aidl +""" +import re +import sys + +ENUM_TYPE_TO_PARSE = [ "VehiclePropertyType", "VehiclePropertyGroup", "VehicleArea" ] +VEHICLE_PROP_ENUM = "VehicleProperty" + +RE_COMMENT_BEGIN = re.compile("\s*\/\*\*") +RE_COMMENT_END = re.compile("\s*\*\/") +RE_COMMENT_SINGLE_LINE = re.compile("\s*\/\*\*.*\*\/") + +RE_ENUM_START = re.compile("\s*enum\s*(\w+)\s?.*\{") +RE_ENUM_END = re.compile("\s*\}\;") + +RE_ENUM_ELEMENT = re.compile("\s*(\w+)\s*\=\s*(\w+),") + +RE_VEHICLE_PROP_ELEMENT = re.compile("\s*(\w+)\s*\=\s*\(?\s*(\w+)\s*\|?\s*(\w+\:\w+)?\s*\|?\s*(\w+:\w+)?\s*\|?\s*(\w+:\w+)?\s*\)?,") + +DBG_COMMENT = False +DBG_ENUM = False + +class HIDLParser: + def __init__(self): + self.inEnum = False + self.currentEnumName = None + self.inVehicleProperty = False + self.inComment = False + self.recentComments = [] + self.currentType = None + self.enumMap = {} + self.outputMsg = [] + self.multilineFormat = [] + self.outputMsg.append("package android.hardware.automotive.vehicle\n\n") + + def addRecentCommentToMsg(self): + self.outputMsg.extend(self.recentComments) + self.recentComments = [] + + def addToMsg(self, msg): + self.outputMsg.append(msg) + + def printOutputMsg(self): + msg = "".join(self.outputMsg) + print(msg) + + def parseLine(self, line): + if self.inComment: + self.recentComments.append(line) + if RE_COMMENT_END.match(line): + self.inComment = False + if DBG_COMMENT: + print("Comment end:{}".format(self.recentComments)) + return + elif RE_COMMENT_BEGIN.match(line): + self.recentComments = [] + self.recentComments.append(line) + if RE_COMMENT_SINGLE_LINE.match(line): + if DBG_COMMENT: + print("Single line Comment:{}".format(self.recentComments)) + return + self.inComment = True + if DBG_COMMENT: + print("Comment start") + return + + if self.inEnum: + if RE_ENUM_END.match(line): + self.inEnum = False + if DBG_ENUM: + print("End enum {}".format(self.currentEnumName)) + else: + matchElement = RE_ENUM_ELEMENT.match(line); + if matchElement: + elementName = matchElement.group(1) + elementValue = matchElement.group(2) + self.enumMap[self.currentEnumName + ':' + elementName] = elementValue + elif self.inVehicleProperty: + if RE_ENUM_END.match(line): + self.inVehicleProperty = False + self.addToMsg("}\n") + else: + text = line.strip() + if len(text) == 0: + self.multilineFormat = [] + else: + self.multilineFormat.append(text) + textToMatch = "".join(self.multilineFormat) + match = RE_VEHICLE_PROP_ELEMENT.match(textToMatch) + if match: + self.multilineFormat = [] + name = match.group(1) + val = match.group(2) + type1 = match.group(3) + self.addRecentCommentToMsg() + if type1 == None: # one line case + self.addToMsg(" {} = {},\n".format(name, val)) + else: + type2 = match.group(4) + type3 = match.group(5) + self.addToMsg(" {} = {} + {} + {} + {}, // {},{},{}\n".\ + format(name, val, self.enumMap[type1], self.enumMap[type3],\ + self.enumMap[type2], type1, type3, type2)) + else: + matchEnum = RE_ENUM_START.match(line) + if matchEnum: + enumName = matchEnum.group(1) + if enumName in ENUM_TYPE_TO_PARSE: + self.currentEnumName = enumName + self.inEnum = True + if DBG_ENUM: + print("enum {}".format(enumName)) + elif enumName == VEHICLE_PROP_ENUM: + self.inVehicleProperty = True + self.addRecentCommentToMsg() + self.addToMsg("@Backing(type=\"int\")\nenum VehicleProperty {\n") + if DBG_ENUM: + print("VehicleProperty starts, all enum values {}".format(self.enumMap)) + + +def main(): + if len(sys.argv) != 2: + print("Usage: {} types_hal_file".format(sys.argv[0])) + sys.exit(1) + file_name = sys.argv[1] + with open(file_name, 'r') as f: + parser = HIDLParser() + for line in f.readlines(): + parser.parseLine(line) + parser.printOutputMsg() + +if __name__ == "__main__": + main() diff --git a/automotive/vehicle/vts/Android.bp b/automotive/vehicle/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..b78e0ff7c4825f3f0f03c43be124338dea252d4d --- /dev/null +++ b/automotive/vehicle/vts/Android.bp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 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. + */ + +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: "VtsHalAutomotiveVehicle_TargetTest", + srcs: [ + "src/*.cpp", + ], + static_libs: [ + "libgtest", + "libvhalclient", + ], + shared_libs: [ + "libhidlbase", + "libvndksupport", + ], + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + "vhalclient_defaults", + ], + test_suites: [ + "general-tests", + "vts", + ], + require_root: true, +} diff --git a/automotive/vehicle/2.0/vts/functional/OWNERS b/automotive/vehicle/vts/OWNERS similarity index 71% rename from automotive/vehicle/2.0/vts/functional/OWNERS rename to automotive/vehicle/vts/OWNERS index 8a0f2afdb8891c2891597c7b6139ad8cf99b1ddc..c93a8439ee9032afa5a2f69a132c7e8c25540c71 100644 --- a/automotive/vehicle/2.0/vts/functional/OWNERS +++ b/automotive/vehicle/vts/OWNERS @@ -1,2 +1,3 @@ # Bug component: 533426 +shanyu@google.com kwangsudo@google.com diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c431d85eef220ebf695fc80f5f0e9af4194af405 --- /dev/null +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -0,0 +1,458 @@ +/* + * Copyright (C) 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 "VtsHalAutomotiveVehicle" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using ::aidl::android::hardware::automotive::vehicle::IVehicle; +using ::aidl::android::hardware::automotive::vehicle::StatusCode; +using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; +using ::aidl::android::hardware::automotive::vehicle::VehicleArea; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; +using ::android::getAidlHalInstanceNames; +using ::android::base::ScopedLockAssertion; +using ::android::base::StringPrintf; +using ::android::frameworks::automotive::vhal::HalPropError; +using ::android::frameworks::automotive::vhal::IHalPropConfig; +using ::android::frameworks::automotive::vhal::IHalPropValue; +using ::android::frameworks::automotive::vhal::ISubscriptionCallback; +using ::android::frameworks::automotive::vhal::IVhalClient; +using ::android::hardware::getAllHalInstanceNames; +using ::android::hardware::Sanitize; +using ::android::hardware::automotive::vehicle::toInt; + +constexpr int32_t kInvalidProp = 0x31600207; + +struct ServiceDescriptor { + std::string name; + bool isAidlService; +}; + +class VtsVehicleCallback final : public ISubscriptionCallback { + private: + std::mutex mLock; + std::unordered_map mEventsCount GUARDED_BY(mLock); + std::unordered_map> mEventTimestamps GUARDED_BY(mLock); + std::condition_variable mEventCond; + + public: + void onPropertyEvent(const std::vector>& values) override { + { + std::lock_guard lockGuard(mLock); + for (auto& value : values) { + int32_t propId = value->getPropId(); + mEventsCount[propId] += 1; + mEventTimestamps[propId].push_back(value->getTimestamp()); + } + } + mEventCond.notify_one(); + } + + void onPropertySetError([[maybe_unused]] const std::vector& errors) override { + // Do nothing. + } + + template + bool waitForExpectedEvents(int32_t propId, size_t expectedEvents, + const std::chrono::duration& timeout) { + std::unique_lock uniqueLock(mLock); + return mEventCond.wait_for(uniqueLock, timeout, [this, propId, expectedEvents] { + ScopedLockAssertion lockAssertion(mLock); + return mEventsCount[propId] >= expectedEvents; + }); + } + + std::vector getEventTimestamps(int32_t propId) { + { + std::lock_guard lockGuard(mLock); + return mEventTimestamps[propId]; + } + } + + void reset() { + std::lock_guard lockGuard(mLock); + mEventsCount.clear(); + } +}; + +class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam { + public: + virtual void SetUp() override { + auto descriptor = GetParam(); + if (descriptor.isAidlService) { + mVhalClient = IVhalClient::tryCreateAidlClient(descriptor.name.c_str()); + } else { + mVhalClient = IVhalClient::tryCreateHidlClient(descriptor.name.c_str()); + } + + ASSERT_NE(mVhalClient, nullptr) << "Failed to connect to VHAL"; + + mCallback = std::make_shared(); + } + + static bool isBooleanGlobalProp(int32_t property) { + return (property & toInt(VehiclePropertyType::MASK)) == + toInt(VehiclePropertyType::BOOLEAN) && + (property & toInt(VehicleArea::MASK)) == toInt(VehicleArea::GLOBAL); + } + + protected: + std::shared_ptr mVhalClient; + std::shared_ptr mCallback; +}; + +TEST_P(VtsHalAutomotiveVehicleTargetTest, useAidlBackend) { + if (!mVhalClient->isAidlVhal()) { + GTEST_SKIP() << "AIDL backend is not available, HIDL backend is used instead"; + } +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, useHidlBackend) { + if (mVhalClient->isAidlVhal()) { + GTEST_SKIP() << "AIDL backend is available, HIDL backend is not used"; + } +} + +// Test getAllPropConfig() returns at least 4 property configs. +TEST_P(VtsHalAutomotiveVehicleTargetTest, getAllPropConfigs) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::getAllPropConfigs"); + + auto result = mVhalClient->getAllPropConfigs(); + + ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " + << result.error().message(); + ASSERT_GE(result.value().size(), 4u) << StringPrintf( + "Expect to get at least 4 property configs, got %zu", result.value().size()); +} + +// Test getPropConfigs() can query all properties listed in CDD. +TEST_P(VtsHalAutomotiveVehicleTargetTest, getRequiredPropConfigs) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::getRequiredPropConfigs"); + + // Check the properties listed in CDD + std::vector properties = { + toInt(VehicleProperty::GEAR_SELECTION), toInt(VehicleProperty::NIGHT_MODE), + toInt(VehicleProperty::PARKING_BRAKE_ON), toInt(VehicleProperty::PERF_VEHICLE_SPEED)}; + + auto result = mVhalClient->getPropConfigs(properties); + + ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " + << result.error().message(); + ASSERT_EQ(result.value().size(), 4u) + << StringPrintf("Expect to get exactly 4 configs, got %zu", result.value().size()); +} + +// Test getPropConfig() with an invalid propertyId returns an error code. +TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithInvalidProp) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::getPropConfigsWithInvalidProp"); + + auto result = mVhalClient->getPropConfigs({kInvalidProp}); + + ASSERT_FALSE(result.ok()) << StringPrintf( + "Expect failure to get prop configs for invalid prop: %" PRId32, kInvalidProp); + ASSERT_NE(result.error().message(), "") << "Expect error message not to be empty"; +} + +// Test get() return current value for properties. +TEST_P(VtsHalAutomotiveVehicleTargetTest, get) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::get"); + + int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); + + ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 + ", error: %s", + propId, result.error().message().c_str()); + ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; +} + +// Test get() with an invalid propertyId return an error codes. +TEST_P(VtsHalAutomotiveVehicleTargetTest, getInvalidProp) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::getInvalidProp"); + + auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(kInvalidProp)); + + ASSERT_FALSE(result.ok()) << StringPrintf( + "Expect failure to get property for invalid prop: %" PRId32, kInvalidProp); +} + +// Test set() on read_write properties. +TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::setProp"); + + // skip hvac related properties + std::unordered_set hvacProps = {toInt(VehicleProperty::HVAC_DEFROSTER), + toInt(VehicleProperty::HVAC_AC_ON), + toInt(VehicleProperty::HVAC_MAX_AC_ON), + toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), + toInt(VehicleProperty::HVAC_RECIRC_ON), + toInt(VehicleProperty::HVAC_DUAL_ON), + toInt(VehicleProperty::HVAC_AUTO_ON), + toInt(VehicleProperty::HVAC_POWER_ON), + toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON), + toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON)}; + auto result = mVhalClient->getAllPropConfigs(); + ASSERT_TRUE(result.ok()); + + for (const auto& cfgPtr : result.value()) { + const IHalPropConfig& cfg = *cfgPtr; + int32_t propId = cfg.getPropId(); + // test on boolean and writable property + if (cfg.getAccess() == toInt(VehiclePropertyAccess::READ_WRITE) && + isBooleanGlobalProp(propId) && !hvacProps.count(propId)) { + auto propToGet = mVhalClient->createHalPropValue(propId); + auto getValueResult = mVhalClient->getValueSync(*propToGet); + + ASSERT_TRUE(getValueResult.ok()) + << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", + propId, getValueResult.error().message().c_str()); + ASSERT_NE(getValueResult.value(), nullptr) + << StringPrintf("Result value must not be null for property: %" PRId32, propId); + + const IHalPropValue& value = *getValueResult.value(); + size_t intValueSize = value.getInt32Values().size(); + ASSERT_EQ(intValueSize, 1u) << StringPrintf( + "Expect exactly 1 int value for boolean property: %" PRId32 ", got %zu", propId, + intValueSize); + + int setValue = value.getInt32Values()[0] == 1 ? 0 : 1; + auto propToSet = mVhalClient->createHalPropValue(propId); + propToSet->setInt32Values({setValue}); + auto setValueResult = mVhalClient->setValueSync(*propToSet); + + ASSERT_TRUE(setValueResult.ok()) + << StringPrintf("Failed to set value for property: %" PRId32 ", error: %s", + propId, setValueResult.error().message().c_str()); + + // check set success + getValueResult = mVhalClient->getValueSync(*propToGet); + ASSERT_TRUE(getValueResult.ok()) + << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", + propId, getValueResult.error().message().c_str()); + ASSERT_NE(getValueResult.value(), nullptr) + << StringPrintf("Result value must not be null for property: %" PRId32, propId); + ASSERT_EQ(getValueResult.value()->getInt32Values(), std::vector({setValue})) + << StringPrintf("Boolean value not updated after set for property: %" PRId32, + propId); + } + } +} + +// Test set() on an read_only property. +TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::setNotWritableProp"); + + int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); + ASSERT_TRUE(getValueResult.ok()) + << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", propId, + getValueResult.error().message().c_str()); + + auto setValueResult = mVhalClient->setValueSync(*getValueResult.value()); + + ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail"; + ASSERT_EQ(setValueResult.error().code(), StatusCode::ACCESS_DENIED); +} + +// Test subscribe() and unsubscribe(). +TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeAndUnsubscribe) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe"); + + int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + + auto propConfigsResult = mVhalClient->getPropConfigs({propId}); + + ASSERT_TRUE(propConfigsResult.ok()) << "Failed to get property config for PERF_VEHICLE_SPEED: " + << "error: " << propConfigsResult.error().message(); + ASSERT_EQ(propConfigsResult.value().size(), 1u) + << "Expect to return 1 config for PERF_VEHICLE_SPEED"; + auto& propConfig = propConfigsResult.value()[0]; + float minSampleRate = propConfig->getMinSampleRate(); + float maxSampleRate = propConfig->getMaxSampleRate(); + + if (minSampleRate < 1) { + GTEST_SKIP() << "Sample rate for vehicle speed < 1 times/sec, skip test since it would " + "take too long"; + } + + auto client = mVhalClient->getSubscriptionClient(mCallback); + ASSERT_NE(client, nullptr) << "Failed to get subscription client"; + + auto result = client->subscribe({{.propId = propId, .sampleRate = minSampleRate}}); + + ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32 + ", error: %s", + propId, result.error().message().c_str()); + + if (mVhalClient->isAidlVhal()) { + // Skip checking timestamp for HIDL because the behavior for sample rate and timestamp is + // only specified clearly for AIDL. + + // Timeout is 2 seconds, which gives a 1 second buffer. + ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(minSampleRate), + std::chrono::seconds(2))) + << "Didn't get enough events for subscribing to minSampleRate"; + } + + result = client->subscribe({{.propId = propId, .sampleRate = maxSampleRate}}); + + ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32 + ", error: %s", + propId, result.error().message().c_str()); + + if (mVhalClient->isAidlVhal()) { + ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(maxSampleRate), + std::chrono::seconds(2))) + << "Didn't get enough events for subscribing to maxSampleRate"; + + std::unordered_set timestamps; + // Event event should have a different timestamp. + for (const int64_t& eventTimestamp : mCallback->getEventTimestamps(propId)) { + ASSERT_TRUE(timestamps.find(eventTimestamp) == timestamps.end()) + << "two events for the same property must not have the same timestamp"; + timestamps.insert(eventTimestamp); + } + } + + result = client->unsubscribe({propId}); + ASSERT_TRUE(result.ok()) << StringPrintf("Failed to unsubscribe to property: %" PRId32 + ", error: %s", + propId, result.error().message().c_str()); + + mCallback->reset(); + ASSERT_FALSE(mCallback->waitForExpectedEvents(propId, 10, std::chrono::seconds(1))) + << "Expect not to get events after unsubscription"; +} + +// Test subscribe() with an invalid property. +TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeInvalidProp) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeInvalidProp"); + + std::vector options = { + SubscribeOptions{.propId = kInvalidProp, .sampleRate = 10.0}}; + + auto client = mVhalClient->getSubscriptionClient(mCallback); + ASSERT_NE(client, nullptr) << "Failed to get subscription client"; + + auto result = client->subscribe(options); + + ASSERT_FALSE(result.ok()) << StringPrintf("Expect subscribing to property: %" PRId32 " to fail", + kInvalidProp); +} + +// Test the timestamp returned in GetValues results is the timestamp when the value is retrieved. +TEST_P(VtsHalAutomotiveVehicleTargetTest, testGetValuesTimestampAIDL) { + if (!mVhalClient->isAidlVhal()) { + GTEST_SKIP() << "Skip checking timestamp for HIDL because the behavior is only specified " + "for AIDL"; + } + + int32_t propId = toInt(VehicleProperty::PARKING_BRAKE_ON); + auto prop = mVhalClient->createHalPropValue(propId); + + auto result = mVhalClient->getValueSync(*prop); + + ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 + ", error: %s", + propId, result.error().message().c_str()); + ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; + ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value"; + + bool parkBrakeOnValue1 = (result.value()->getInt32Values()[0] == 1); + int64_t timestampValue1 = result.value()->getTimestamp(); + + result = mVhalClient->getValueSync(*prop); + + ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 + ", error: %s", + propId, result.error().message().c_str()); + ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; + ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value"; + + bool parkBarkeOnValue2 = (result.value()->getInt32Values()[0] == 1); + int64_t timestampValue2 = result.value()->getTimestamp(); + + if (parkBarkeOnValue2 == parkBrakeOnValue1) { + ASSERT_EQ(timestampValue2, timestampValue1) + << "getValue result must contain a timestamp updated when the value was updated, if" + "the value does not change, expect the same timestamp"; + } else { + ASSERT_GT(timestampValue2, timestampValue1) + << "getValue result must contain a timestamp updated when the value was updated, if" + "the value changes, expect the newer value has a larger timestamp"; + } +} + +std::vector getDescriptors() { + std::vector descriptors; + for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { + descriptors.push_back({ + .name = name, + .isAidlService = true, + }); + } + for (std::string name : getAllHalInstanceNames(IVehicle::descriptor)) { + descriptors.push_back({ + .name = name, + .isAidlService = false, + }); + } + return descriptors; +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalAutomotiveVehicleTargetTest); + +INSTANTIATE_TEST_SUITE_P(PerInstance, VtsHalAutomotiveVehicleTargetTest, + testing::ValuesIn(getDescriptors()), + [](const testing::TestParamInfo& info) { + std::string name = ""; + if (info.param.isAidlService) { + name += "aidl_"; + } else { + name += "hidl_"; + } + name += info.param.name; + return Sanitize(name); + }); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(1); + return RUN_ALL_TESTS(); +} diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp index 05028c4e5053e69ed3fc668553e0605c18f6f584..167e0c78da52dc5baaaf8eb23ee2a3c3d2048044 100644 --- a/biometrics/common/aidl/Android.bp +++ b/biometrics/common/aidl/Android.bp @@ -22,5 +22,16 @@ aidl_interface { enabled: false, }, }, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: [], + }, + { + version: "2", + imports: [], + }, + + ], + } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/.hash b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..2771cb1d44dea5fb3f33b738fa560d1bd4e1d921 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/.hash @@ -0,0 +1 @@ +a6d4d8e7b26408ab30a3d87cf6b7ffd9e067e4d8 diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/CommonProps.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d4433c5bdeaceaf497141d6ca038ac39cd6b3951 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/CommonProps.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.biometrics.common; +@VintfStability +parcelable CommonProps { + int sensorId; + android.hardware.biometrics.common.SensorStrength sensorStrength = android.hardware.biometrics.common.SensorStrength.CONVENIENCE; + int maxEnrollmentsPerUser; + android.hardware.biometrics.common.ComponentInfo[] componentInfo; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/ComponentInfo.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/ComponentInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ad11ddaa6d471924f138536e30ff7b532ec6e79b --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/ComponentInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.biometrics.common; +@VintfStability +parcelable ComponentInfo { + String componentId; + String hardwareVersion; + String firmwareVersion; + String serialNumber; + String softwareVersion; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/ICancellationSignal.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/ICancellationSignal.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2bc6a6df05d554536affd38619a47a0d69c1220b --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/ICancellationSignal.aidl @@ -0,0 +1,38 @@ +/* + * 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 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 -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.biometrics.common; +@VintfStability +interface ICancellationSignal { + oneway void cancel(); +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/OperationContext.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9d1cb8ff8628b824cad5e05ba8221a25fa7b0606 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/OperationContext.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 -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.biometrics.common; +@VintfStability +parcelable OperationContext { + int id = 0; + android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN; + boolean isAod = false; + boolean isCrypto = false; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/OperationReason.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3da3a6ab0be5cd675471faa621dfe945cbd8cd85 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/OperationReason.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.biometrics.common; +@Backing(type="byte") @VintfStability +enum OperationReason { + UNKNOWN = 0, + BIOMETRIC_PROMPT = 1, + KEYGUARD = 2, +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/SensorStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6675d091e5462d392f517f87e35ac89b4ae476d5 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/2/android/hardware/biometrics/common/SensorStrength.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.biometrics.common; +@Backing(type="byte") @VintfStability +enum SensorStrength { + CONVENIENCE = 0, + WEAK = 1, + STRONG = 2, +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9d1cb8ff8628b824cad5e05ba8221a25fa7b0606 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.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 -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.biometrics.common; +@VintfStability +parcelable OperationContext { + int id = 0; + android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN; + boolean isAod = false; + boolean isCrypto = false; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3da3a6ab0be5cd675471faa621dfe945cbd8cd85 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.biometrics.common; +@Backing(type="byte") @VintfStability +enum OperationReason { + UNKNOWN = 0, + BIOMETRIC_PROMPT = 1, + KEYGUARD = 2, +} diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl new file mode 100644 index 0000000000000000000000000000000000000000..72fe660126b5d4a0173c6d89ebf25de25a7e7ff3 --- /dev/null +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl @@ -0,0 +1,49 @@ +/* + * 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 android.hardware.biometrics.common; + +import android.hardware.biometrics.common.OperationReason; + +/** + * Additional context associated with an operation. + */ +@VintfStability +parcelable OperationContext { + /** + * An identifier for the logical action that the user is engaged in. These identifiers are + * not guaranteed to be unique. However, the framework will not reuse identifiers within + * short periods of time so they can be made unique, if needed, by appending a timestamp. + * + * Zero if the reason is OperationReason.UNKNOWN. + */ + int id = 0; + + /** + * A logical reason for this operation. + * + * This should be interpreted as a hint to enable optimizations or tracing. The + * framework may choose to use OperationReason.UNKNOWN at any time based on the device's + * policy. + */ + OperationReason reason = OperationReason.UNKNOWN; + + /* Flag indicating that the display is in AOD mode. */ + boolean isAod = false; + + /** Flag indicating that crypto was requested. */ + boolean isCrypto = false; +} diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl new file mode 100644 index 0000000000000000000000000000000000000000..abc25ed663807eb75703d4f9b1d1cf122e6de589 --- /dev/null +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl @@ -0,0 +1,37 @@ +/* + * 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 android.hardware.biometrics.common; + +@VintfStability +@Backing(type="byte") +enum OperationReason { + /** + * A normal operation without an explicit reason. + */ + UNKNOWN, + + /** + * An operation associated with biometric prompt. This may be due to either application or + * system use, but it is not related to KEYGUARD device entry. + */ + BIOMETRIC_PROMPT, + + /** + * An operation associated with device entry. + */ + KEYGUARD, +} diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp index 54d3ecd1e1e9db846999262dee86af092a93cee6..0bec0c54caede569602248e9cea3188487b8f4c5 100644 --- a/biometrics/face/aidl/Android.bp +++ b/biometrics/face/aidl/Android.bp @@ -15,8 +15,8 @@ aidl_interface { ], imports: [ "android.hardware.biometrics.common", - "android.hardware.common", - "android.hardware.keymaster", + "android.hardware.common-V2", + "android.hardware.keymaster-V3", ], stability: "vintf", backend: { @@ -27,5 +27,24 @@ aidl_interface { enabled: false, }, }, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.biometrics.common-V1", + "android.hardware.common-V2", + "android.hardware.keymaster-V3", + ], + }, + { + version: "2", + imports: [ + "android.hardware.biometrics.common-V2", + "android.hardware.common-V2", + "android.hardware.keymaster-V3", + ], + }, + + ], + } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/.hash b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..6440018a7a1382a093bcc342a20c4336393a0413 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/.hash @@ -0,0 +1 @@ +74b0b7cb149ee205b12cd2254d216725c6e5429c diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/AcquiredInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..eaa43f3f9e0ad776d09f74ad5422a84c4c118989 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/AcquiredInfo.aidl @@ -0,0 +1,64 @@ +/* + * 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 -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.biometrics.face; +@Backing(type="byte") @VintfStability +enum AcquiredInfo { + UNKNOWN = 0, + GOOD = 1, + INSUFFICIENT = 2, + TOO_BRIGHT = 3, + TOO_DARK = 4, + TOO_CLOSE = 5, + TOO_FAR = 6, + FACE_TOO_HIGH = 7, + FACE_TOO_LOW = 8, + FACE_TOO_RIGHT = 9, + FACE_TOO_LEFT = 10, + POOR_GAZE = 11, + NOT_DETECTED = 12, + TOO_MUCH_MOTION = 13, + RECALIBRATE = 14, + TOO_DIFFERENT = 15, + TOO_SIMILAR = 16, + PAN_TOO_EXTREME = 17, + TILT_TOO_EXTREME = 18, + ROLL_TOO_EXTREME = 19, + FACE_OBSCURED = 20, + START = 21, + SENSOR_DIRTY = 22, + VENDOR = 23, + FIRST_FRAME_RECEIVED = 24, + DARK_GLASSES_DETECTED = 25, + MOUTH_COVERING_DETECTED = 26, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/AuthenticationFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/AuthenticationFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..20bc76779bae4770bb02f9fa0d576d09f1bf9e35 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/AuthenticationFrame.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +parcelable AuthenticationFrame { + android.hardware.biometrics.face.BaseFrame data; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/BaseFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/BaseFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..67b5cf41692df6234e13d7e724fd360b25e45dfc --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/BaseFrame.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +parcelable BaseFrame { + android.hardware.biometrics.face.AcquiredInfo acquiredInfo = android.hardware.biometrics.face.AcquiredInfo.UNKNOWN; + int vendorCode; + float pan; + float tilt; + float distance; + boolean isCancellable; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Cell.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Cell.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6be8c8e97518d1605c251ddb3679a51288999c09 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Cell.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +parcelable Cell { + int x; + int y; + int z; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0ea10d6ddb0ef2c0198480f551a84988316cca13 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentFrame.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +parcelable EnrollmentFrame { + @nullable android.hardware.biometrics.face.Cell cell; + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.UNKNOWN; + android.hardware.biometrics.face.BaseFrame data; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentStage.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentStage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ce5679ab31b2ce933c8591b53ccd2db9847d635f --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentStage.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.biometrics.face; +@Backing(type="byte") @VintfStability +enum EnrollmentStage { + UNKNOWN = 0, + FIRST_FRAME_RECEIVED = 1, + WAITING_FOR_CENTERING = 2, + HOLD_STILL_IN_CENTER = 3, + ENROLLING_MOVEMENT_1 = 4, + ENROLLING_MOVEMENT_2 = 5, + ENROLLMENT_FINISHED = 6, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentStageConfig.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentStageConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..48db2cf615675a9aa06679c22a0276f3741e361c --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentStageConfig.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +parcelable EnrollmentStageConfig { + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.UNKNOWN; + List cells; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8e99ad6529fd7f8a7997d9c1effb49384f93787f --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/EnrollmentType.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.biometrics.face; +@Backing(type="byte") @VintfStability +enum EnrollmentType { + DEFAULT = 0, + ACCESSIBILITY = 1, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Error.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1a2166193265e9377fbc54514086bd27b7d1921f --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Error.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.biometrics.face; +@Backing(type="byte") @VintfStability +enum Error { + UNKNOWN = 0, + HW_UNAVAILABLE = 1, + UNABLE_TO_PROCESS = 2, + TIMEOUT = 3, + NO_SPACE = 4, + CANCELED = 5, + UNABLE_TO_REMOVE = 6, + VENDOR = 7, + REENROLL_REQUIRED = 8, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/FaceSensorType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/FaceSensorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a215b99f72e1854ac79dd905af61f94b7cde94a5 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/FaceSensorType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.biometrics.face; +@Backing(type="byte") @VintfStability +enum FaceSensorType { + UNKNOWN = 0, + RGB = 1, + IR = 2, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Feature.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Feature.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1875b97431990bef2d5a3b5ace56f27de8c92cc2 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/Feature.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.biometrics.face; +@Backing(type="byte") @VintfStability +enum Feature { + REQUIRE_ATTENTION = 0, + REQUIRE_DIVERSE_POSES = 1, + DEBUG = 2, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/IFace.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc4a4d04bb0a68dc6d19dc7fcacddf682fbd6a0e --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/IFace.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +interface IFace { + android.hardware.biometrics.face.SensorProps[] getSensorProps(); + android.hardware.biometrics.face.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.face.ISessionCallback cb); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/ISession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..366553485a83d0e583f7a89ef624cde0d5ef24aa --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/ISession.aidl @@ -0,0 +1,55 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +interface ISession { + void generateChallenge(); + void revokeChallenge(in long challenge); + android.hardware.biometrics.face.EnrollmentStageConfig[] getEnrollmentConfig(in android.hardware.biometrics.face.EnrollmentType enrollmentType); + android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface); + android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId); + android.hardware.biometrics.common.ICancellationSignal detectInteraction(); + void enumerateEnrollments(); + void removeEnrollments(in int[] enrollmentIds); + void getFeatures(); + void setFeature(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.Feature feature, boolean enabled); + void getAuthenticatorId(); + void invalidateAuthenticatorId(); + void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); + void close(); + android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/ISessionCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bbace29aa0f012060bf483af8efaef62c672c0e1 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/ISessionCallback.aidl @@ -0,0 +1,56 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +interface ISessionCallback { + void onChallengeGenerated(in long challenge); + void onChallengeRevoked(in long challenge); + void onAuthenticationFrame(in android.hardware.biometrics.face.AuthenticationFrame frame); + void onEnrollmentFrame(in android.hardware.biometrics.face.EnrollmentFrame frame); + void onError(in android.hardware.biometrics.face.Error error, in int vendorCode); + void onEnrollmentProgress(in int enrollmentId, int remaining); + void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat); + void onAuthenticationFailed(); + void onLockoutTimed(in long durationMillis); + void onLockoutPermanent(); + void onLockoutCleared(); + void onInteractionDetected(); + void onEnrollmentsEnumerated(in int[] enrollmentIds); + void onFeaturesRetrieved(in android.hardware.biometrics.face.Feature[] features); + void onFeatureSet(android.hardware.biometrics.face.Feature feature); + void onEnrollmentsRemoved(in int[] enrollmentIds); + void onAuthenticatorIdRetrieved(in long authenticatorId); + void onAuthenticatorIdInvalidated(in long newAuthenticatorId); + void onSessionClosed(); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/SensorProps.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b3c51bb1270f891c3768dd9e332ee9166c7a521 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/2/android/hardware/biometrics/face/SensorProps.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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.biometrics.face; +@VintfStability +parcelable SensorProps { + android.hardware.biometrics.common.CommonProps commonProps; + android.hardware.biometrics.face.FaceSensorType sensorType = android.hardware.biometrics.face.FaceSensorType.UNKNOWN; + boolean halControlsPreview; + int previewDisplayId; + int enrollPreviewWidth; + int enrollPreviewHeight; + float enrollTranslationX; + float enrollTranslationY; + float enrollPreviewScale; + boolean supportsDetectInteraction; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl index 78178642cd9ec4fdd844158a23d58a82b82f87b7..366553485a83d0e583f7a89ef624cde0d5ef24aa 100644 --- a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/current/android/hardware/biometrics/face/ISession.aidl @@ -48,4 +48,8 @@ interface ISession { void invalidateAuthenticatorId(); void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); void close(); + android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); } diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl index 4d7e59ebb76e657d92c6bc7d685127bdceef8224..65c589f19299f667660436d4dffee200bb6f4982 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/IFace.aidl @@ -46,6 +46,10 @@ interface IFace { * vold_prepare_subdirs.cpp). Implementations may store additional user-specific data, such as * embeddings or templates, in StrongBox. * + * During create session it is expected that the HAL will call linkToDeath with the callee's + * binder token. The recommended implementation is to close this session if the callee dies, + * to prevent subsequent createSession calls from failing. + * * @param sensorId The sensorId for which this session is being created. * @param userId The userId for which this session is being created. * @param cb A callback to notify the framework about the session's events. diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl index 5f06b408e81030280fc45c0dfd87d6f5f0d12134..a92b3667fec4ee3d9b8572e7ae89b6219cde9c15 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl @@ -17,6 +17,7 @@ package android.hardware.biometrics.face; import android.hardware.biometrics.common.ICancellationSignal; +import android.hardware.biometrics.common.OperationContext; import android.hardware.biometrics.face.EnrollmentStageConfig; import android.hardware.biometrics.face.EnrollmentType; import android.hardware.biometrics.face.Feature; @@ -441,4 +442,29 @@ interface ISession { * - ISessionCallback#onSessionClosed */ void close(); + + /** + * These are alternative methods for some operations to allow the HAL to make optional + * optimizations during execution. + * + * HALs may ignore the additional context and treat all *WithContext methods the same as + * the original methods. + */ + + /* See ISession#authenticateWithContext(long) */ + ICancellationSignal authenticateWithContext(in long operationId, in OperationContext context); + + /* See ISession#enroll(HardwareAuthToken, EnrollmentType, Feature[], NativeHandle) */ + ICancellationSignal enrollWithContext(in HardwareAuthToken hat, in EnrollmentType type, + in Feature[] features, in @nullable NativeHandle previewSurface, + in OperationContext context); + + /* See ISession#detectInteraction() */ + ICancellationSignal detectInteractionWithContext(in OperationContext context); + + /** + * This may be called while an authenticate, detect interaction, or enrollment operation is + * running when the context changes. + */ + void onContextChanged(in OperationContext context); } diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp index 509231859d604af8c91c746c6dadd3ac59fa8c5b..7f66ecaf83acc21f8aadc84ad3c3a3d20c070855 100644 --- a/biometrics/face/aidl/default/Android.bp +++ b/biometrics/face/aidl/default/Android.bp @@ -16,8 +16,8 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.biometrics.face-V1-ndk", - "android.hardware.biometrics.common-V1-ndk", + "android.hardware.biometrics.face-V2-ndk", + "android.hardware.biometrics.common-V2-ndk", ], srcs: [ "main.cpp", diff --git a/biometrics/face/aidl/default/Session.cpp b/biometrics/face/aidl/default/Session.cpp index 01cb620b351ebe3ed59e81dff225676684f17fe6..984a1a99dc0fd1e7667c7c64d303197c95b90834 100644 --- a/biometrics/face/aidl/default/Session.cpp +++ b/biometrics/face/aidl/default/Session.cpp @@ -151,4 +151,29 @@ ndk::ScopedAStatus Session::close() { return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Session::authenticateWithContext( + int64_t operationId, const common::OperationContext& /*context*/, + std::shared_ptr* out) { + return authenticate(operationId, out); +} + +ndk::ScopedAStatus Session::enrollWithContext(const keymaster::HardwareAuthToken& hat, + EnrollmentType enrollmentType, + const std::vector& features, + const std::optional& previewSurface, + const common::OperationContext& /*context*/, + std::shared_ptr* out) { + return enroll(hat, enrollmentType, features, previewSurface, out); +} + +ndk::ScopedAStatus Session::detectInteractionWithContext( + const common::OperationContext& /*context*/, + std::shared_ptr* out) { + return detectInteraction(out); +} + +ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*context*/) { + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/Session.h b/biometrics/face/aidl/default/Session.h index 4152909a4945e2e7333d55813037a60286fd8e36..9db17d2df982efc81d526d643d5e161c22220964 100644 --- a/biometrics/face/aidl/default/Session.h +++ b/biometrics/face/aidl/default/Session.h @@ -68,6 +68,22 @@ class Session : public BnSession { ndk::ScopedAStatus close() override; + ndk::ScopedAStatus authenticateWithContext( + int64_t operationId, const common::OperationContext& context, + std::shared_ptr* out) override; + + ndk::ScopedAStatus enrollWithContext( + const keymaster::HardwareAuthToken& hat, EnrollmentType enrollmentType, + const std::vector& features, const std::optional& previewSurface, + const common::OperationContext& context, + std::shared_ptr* out) override; + + ndk::ScopedAStatus detectInteractionWithContext( + const common::OperationContext& context, + std::shared_ptr* out) override; + + ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; + private: std::shared_ptr cb_; std::mt19937 mRandom; diff --git a/biometrics/face/aidl/default/face-default.xml b/biometrics/face/aidl/default/face-default.xml index 6915ad0a4d346dfa7eea197b2e0f30140ee002b7..e6ef84273489d34527b0d73b6df30886cfde5d6d 100644 --- a/biometrics/face/aidl/default/face-default.xml +++ b/biometrics/face/aidl/default/face-default.xml @@ -1,6 +1,7 @@ android.hardware.biometrics.face + 2 IFace/default diff --git a/biometrics/face/aidl/vts/Android.bp b/biometrics/face/aidl/vts/Android.bp index 09ec4d06e31352733dc8807477458f4de0148dc1..4171ac33640012f44a359c8d74d6965e5cb8a5c0 100644 --- a/biometrics/face/aidl/vts/Android.bp +++ b/biometrics/face/aidl/vts/Android.bp @@ -15,8 +15,8 @@ cc_test { ], srcs: ["VtsHalBiometricsFaceTargetTest.cpp"], static_libs: [ - "android.hardware.biometrics.common-V1-ndk", - "android.hardware.biometrics.face-V1-ndk", + "android.hardware.biometrics.common-V2-ndk", + "android.hardware.biometrics.face-V2-ndk", "android.hardware.common-V2-ndk", "android.hardware.keymaster-V3-ndk", ], diff --git a/biometrics/fingerprint/2.2/default/Android.bp b/biometrics/fingerprint/2.2/default/Android.bp index f4fb57f20c57c587956ae189401238d08e7206ee..2d262f01f56677807de65da6ec06de2744e5cd40 100644 --- a/biometrics/fingerprint/2.2/default/Android.bp +++ b/biometrics/fingerprint/2.2/default/Android.bp @@ -25,6 +25,7 @@ cc_binary { "libhidlbase", "libhardware", "libutils", + "android.hardware.biometrics.fingerprint@2.1", "android.hardware.biometrics.fingerprint@2.2", ], diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp index 5295098c79b8c4c35366b95ab5d537b8467f3742..0bd642237cf2c6ffb766fc92780872c465b888bc 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { ], imports: [ "android.hardware.biometrics.common", - "android.hardware.keymaster", + "android.hardware.keymaster-V3", ], stability: "vintf", backend: { @@ -26,5 +26,22 @@ aidl_interface { enabled: false, }, }, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.biometrics.common-V1", + "android.hardware.keymaster-V3", + ], + }, + { + version: "2", + imports: [ + "android.hardware.biometrics.common-V2", + "android.hardware.keymaster-V3", + ], + }, + + ], + } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/.hash b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..5d0d717241b23905ab6df2944aa5fa1e91847e15 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/.hash @@ -0,0 +1 @@ +c2f3b863b6dff925bc4451473ee6caa1aa304b8f diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c51aa033d4cd5a5de4562b526b357061ad37d711 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -0,0 +1,50 @@ +/* + * 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 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 -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.biometrics.fingerprint; +@Backing(type="byte") @VintfStability +enum AcquiredInfo { + UNKNOWN = 0, + GOOD = 1, + PARTIAL = 2, + INSUFFICIENT = 3, + SENSOR_DIRTY = 4, + TOO_SLOW = 5, + TOO_FAST = 6, + VENDOR = 7, + START = 8, + TOO_DARK = 9, + TOO_BRIGHT = 10, + IMMOBILE = 11, + RETRYING_CAPTURE = 12, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/Error.aidl new file mode 100644 index 0000000000000000000000000000000000000000..af7bc3c56bb359b81b856630bd58fa39913da448 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/Error.aidl @@ -0,0 +1,46 @@ +/* + * 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 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 -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.biometrics.fingerprint; +@Backing(type="byte") @VintfStability +enum Error { + UNKNOWN = 0, + HW_UNAVAILABLE = 1, + UNABLE_TO_PROCESS = 2, + TIMEOUT = 3, + NO_SPACE = 4, + CANCELED = 5, + UNABLE_TO_REMOVE = 6, + VENDOR = 7, + BAD_CALIBRATION = 8, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9c208c4e7c20cb5301f75dc38d0ddf303871b057 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.biometrics.fingerprint; +@Backing(type="byte") @VintfStability +enum FingerprintSensorType { + UNKNOWN = 0, + REAR = 1, + UNDER_DISPLAY_ULTRASONIC = 2, + UNDER_DISPLAY_OPTICAL = 3, + POWER_BUTTON = 4, + HOME_BUTTON = 5, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/IFingerprint.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/IFingerprint.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5d3df6fbaa2b1a403e90d42173ff1f971f4e452b --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/IFingerprint.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.biometrics.fingerprint; +@VintfStability +interface IFingerprint { + android.hardware.biometrics.fingerprint.SensorProps[] getSensorProps(); + android.hardware.biometrics.fingerprint.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.fingerprint.ISessionCallback cb); +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/ISession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..30f299d1fc89ae3e53f81be9dee20f99a80953ba --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/ISession.aidl @@ -0,0 +1,57 @@ +/* + * 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 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 -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.biometrics.fingerprint; +@VintfStability +interface ISession { + void generateChallenge(); + void revokeChallenge(in long challenge); + android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat); + android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId); + android.hardware.biometrics.common.ICancellationSignal detectInteraction(); + void enumerateEnrollments(); + void removeEnrollments(in int[] enrollmentIds); + void getAuthenticatorId(); + void invalidateAuthenticatorId(); + void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); + void close(); + void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major); + void onPointerUp(in int pointerId); + void onUiReady(); + android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); + void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/ISessionCallback.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/ISessionCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3c40ad63bff3c586cf4c98915f26d80f4591031f --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/ISessionCallback.aidl @@ -0,0 +1,53 @@ +/* + * 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 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 -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.biometrics.fingerprint; +@VintfStability +interface ISessionCallback { + void onChallengeGenerated(in long challenge); + void onChallengeRevoked(in long challenge); + void onAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfo info, in int vendorCode); + void onError(in android.hardware.biometrics.fingerprint.Error error, in int vendorCode); + void onEnrollmentProgress(in int enrollmentId, int remaining); + void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat); + void onAuthenticationFailed(); + void onLockoutTimed(in long durationMillis); + void onLockoutPermanent(); + void onLockoutCleared(); + void onInteractionDetected(); + void onEnrollmentsEnumerated(in int[] enrollmentIds); + void onEnrollmentsRemoved(in int[] enrollmentIds); + void onAuthenticatorIdRetrieved(in long authenticatorId); + void onAuthenticatorIdInvalidated(in long newAuthenticatorId); + void onSessionClosed(); +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/PointerContext.aidl new file mode 100644 index 0000000000000000000000000000000000000000..43db6cfb510ea483c5a7b91465489a7813c9fba1 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.biometrics.fingerprint; +@VintfStability +parcelable PointerContext { + int pointerId = -1; + float x = 0.000000f; + float y = 0.000000f; + float minor = 0.000000f; + float major = 0.000000f; + float orientation = 0.000000f; + boolean isAod = false; + long time = 0; + long gestureStart = 0; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/SensorLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..295fde9f5f70942d84147ce0c699c4d67325fc3c --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.biometrics.fingerprint; +@VintfStability +parcelable SensorLocation { + int displayId; + int sensorLocationX; + int sensorLocationY; + int sensorRadius; + String display = ""; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/SensorProps.aidl new file mode 100644 index 0000000000000000000000000000000000000000..782d2899d3d0cacc3d2a8918743e68fb44c2da29 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/2/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -0,0 +1,44 @@ +/* + * 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 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 -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.biometrics.fingerprint; +@VintfStability +parcelable SensorProps { + android.hardware.biometrics.common.CommonProps commonProps; + android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType = android.hardware.biometrics.fingerprint.FingerprintSensorType.UNKNOWN; + android.hardware.biometrics.fingerprint.SensorLocation[] sensorLocations; + boolean supportsNavigationGestures; + boolean supportsDetectInteraction; + boolean halHandlesDisplayTouches; + boolean halControlsIllumination; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl index 9934a763e785191c18dd86e54149113bf73327f3..30f299d1fc89ae3e53f81be9dee20f99a80953ba 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl @@ -48,4 +48,10 @@ interface ISession { void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major); void onPointerUp(in int pointerId); void onUiReady(); + android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); + void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl new file mode 100644 index 0000000000000000000000000000000000000000..43db6cfb510ea483c5a7b91465489a7813c9fba1 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.biometrics.fingerprint; +@VintfStability +parcelable PointerContext { + int pointerId = -1; + float x = 0.000000f; + float y = 0.000000f; + float minor = 0.000000f; + float major = 0.000000f; + float orientation = 0.000000f; + boolean isAod = false; + long time = 0; + long gestureStart = 0; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl index 515ddaa3583619a5afb88618304d90b89e818df8..295fde9f5f70942d84147ce0c699c4d67325fc3c 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -38,4 +38,5 @@ parcelable SensorLocation { int sensorLocationX; int sensorLocationY; int sensorRadius; + String display = ""; } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl index f1d96d3039cce175b5140b41c7a26df7ad843f16..db0114514e1d45249f689b2a1af80e81bb62ebc1 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl @@ -17,6 +17,8 @@ package android.hardware.biometrics.fingerprint; import android.hardware.biometrics.common.ICancellationSignal; +import android.hardware.biometrics.common.OperationContext; +import android.hardware.biometrics.fingerprint.PointerContext; import android.hardware.keymaster.HardwareAuthToken; /** @@ -140,7 +142,7 @@ interface ISession { * * @param hat See above documentation. * @return ICancellationSignal An object that can be used by the framework to cancel this - * operation. + * operation. */ ICancellationSignal enroll(in HardwareAuthToken hat); @@ -234,7 +236,7 @@ interface ISession { * - ISessionCallback#onAcquired * * @return ICancellationSignal An object that can be used by the framework to cancel this - * operation. + * operation. */ ICancellationSignal detectInteraction(); @@ -448,4 +450,33 @@ interface ISession { * HAL, the framework will invoke this operation to notify when the illumination is showing. */ void onUiReady(); + + /** + * These are alternative methods for some operations to allow the HAL to make optional + * optimizations during execution. + * + * HALs may ignore the additional context and treat all *WithContext methods the same as + * the original methods. + */ + + /** See ISession#authenticate(long) */ + ICancellationSignal authenticateWithContext(in long operationId, in OperationContext context); + + /** See ISession#enroll(HardwareAuthToken) */ + ICancellationSignal enrollWithContext(in HardwareAuthToken hat, in OperationContext context); + + /** See ISession#detectInteraction() */ + ICancellationSignal detectInteractionWithContext(in OperationContext context); + + /** See ISession#onPointerDown(int, int, int, float, float) */ + void onPointerDownWithContext(in PointerContext context); + + /** See ISession#onPointerUp(int) */ + void onPointerUpWithContext(in PointerContext context); + + /** + * This may be called while an authenticate, detect interaction, or enrollment operation is + * running when the context changes. + */ + void onContextChanged(in OperationContext context); } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e025d3440d8b1620f9af2cb4d29ad3ad8a46c8d5 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -0,0 +1,88 @@ +/* + * 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 android.hardware.biometrics.fingerprint; + +/** + * Additional context associated with a pointer event. + */ +@VintfStability +parcelable PointerContext { + /** + * Pointer ID obtained from MotionEvent#getPointerId or -1 if the ID cannot be obtained, for + * example if this event originated from a low-level wake-up gesture. + * + * See android.view.MotionEvent#getPointerId. + */ + int pointerId = -1; + + /** + * The distance in pixels from the left edge of the display. + * + * This is obtained from MotionEvent#getRawX and translated relative to Surface#ROTATION_0. + * Meaning, this value is always reported as if the device is in its natural (e.g. portrait) + * orientation. + * + * See android.view.MotionEvent#getRawX. + */ + float x = 0f; + + /** + * The distance in pixels from the top edge of the display. + * + * This is obtained from MotionEvent#getRawY and translated relative to Surface#ROTATION_0. + * Meaning, this value is always reported as if the device is in its natural (e.g. portrait) + * orientation. + * + * See android.view.MotionEvent#getRawY. + */ + float y = 0f; + + /* See android.view.MotionEvent#getTouchMinor. */ + float minor = 0f; + + /* See android.view.MotionEvent#getTouchMajor. */ + float major = 0f; + + /* See android.view.MotionEvent#getOrientation. */ + float orientation = 0f; + + /* Flag indicating that the display is in AOD mode. */ + boolean isAod = false; + + /** + * The time of the user interaction that produced this event, in milliseconds. + * + * This is obtained from MotionEvent#getEventTime, which uses SystemClock.uptimeMillis() as + * the clock. + * + * See android.view.MotionEvent#getEventTime + */ + long time = 0; + + /** + * The time of the first user interaction in this gesture, in milliseconds. + * + * If this event is MotionEvent#ACTION_DOWN, it means it's the first event in this gesture, + * and `gestureStart` will be equal to `time`. + * + * This is obtained from MotionEvent#getDownTime, which uses SystemClock.uptimeMillis() as + * the clock. + * + * See android.view.MotionEvent#getDownTime + */ + long gestureStart = 0; +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl index b1618b2d0c66cee9ab92665ec7f2935fa40483fd..d12605c521bce6b8bb14324ea1b05d5fad928e46 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -19,15 +19,7 @@ package android.hardware.biometrics.fingerprint; @VintfStability parcelable SensorLocation { /** - * The display to which the following measurements are relative to. This must correspond to the - * android.hardware.DisplayManager#getDisplay Android API. - * - * A few examples: - * 1) A capacitive rear fingerprint sensor would specify the display to which it is behind. - * 2) An under-display fingerprint sensor would specify the display on which the sensor is - * located. - * 3) A foldable device would specify multiple locations and have a SensorLocation entry - * for each display from which the sensor is accessible from. + * Deprecated use the display field instead. This field was never used. */ int displayId; @@ -51,4 +43,18 @@ parcelable SensorLocation { * in pixels. */ int sensorRadius; + + /** + * The display to which all of the measurements are relative to. This must correspond to the + * android.view.Display#getUniqueId Android API. The default display is used if this field is + * empty. + * + * A few examples: + * 1) A capacitive rear fingerprint sensor would specify the display to which it is behind. + * 2) An under-display fingerprint sensor would specify the display on which the sensor is + * located. + * 3) A foldable device would specify multiple locations and have a SensorLocation entry + * for each display from which the sensor is accessible from. + */ + String display = ""; } diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 08fe4b04b75e48d35f5ba6154e62c6b47826a888..430bf3cd8291306dec672d50a2b00a1b4b554313 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -24,8 +24,8 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.biometrics.fingerprint-V1-ndk", - "android.hardware.biometrics.common-V1-ndk", + "android.hardware.biometrics.fingerprint-V2-ndk", + "android.hardware.biometrics.common-V2-ndk", ], } diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index fbfa52f0e7c4d523e72f4ca6b351598396bbd715..1f14de63acef1ca9bffbdd29c65cf8efaf7e17f6 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -47,8 +47,9 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, MAX_ENROLLMENTS_PER_USER, componentInfo}; - SensorLocation sensorLocation = {0 /* displayId */, 0 /* sensorLocationX */, - 0 /* sensorLocationY */, 0 /* sensorRadius */}; + SensorLocation sensorLocation = {0 /* displayId (not used) */, 0 /* sensorLocationX */, + 0 /* sensorLocationY */, 0 /* sensorRadius */, + "" /* display */}; *out = {{commonProps, SENSOR_TYPE, diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index ca481e7cf0301eb0bebe308b911123b02a53e87d..452ed12b9542e26ffc36ae6adf508af68b2aeb93 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -244,4 +244,34 @@ ndk::ScopedAStatus Session::onUiReady() { return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Session::authenticateWithContext( + int64_t operationId, const common::OperationContext& /*context*/, + std::shared_ptr* out) { + return authenticate(operationId, out); +} + +ndk::ScopedAStatus Session::enrollWithContext(const keymaster::HardwareAuthToken& hat, + const common::OperationContext& /*context*/, + std::shared_ptr* out) { + return enroll(hat, out); +} + +ndk::ScopedAStatus Session::detectInteractionWithContext( + const common::OperationContext& /*context*/, + std::shared_ptr* out) { + return detectInteraction(out); +} + +ndk::ScopedAStatus Session::onPointerDownWithContext(const PointerContext& context) { + return onPointerDown(context.pointerId, context.x, context.y, context.minor, context.major); +} + +ndk::ScopedAStatus Session::onPointerUpWithContext(const PointerContext& context) { + return onPointerUp(context.pointerId); +} + +ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*context*/) { + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.xml b/biometrics/fingerprint/aidl/default/fingerprint-default.xml index 89da765616dae4415691998c65ad1c53a924d150..d322eb65b369954d3adc648a4db0b3308f5b33b5 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-default.xml +++ b/biometrics/fingerprint/aidl/default/fingerprint-default.xml @@ -1,6 +1,7 @@ android.hardware.biometrics.fingerprint + 2 IFingerprint/default diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h index 9e464229e1ec7f803e3b6b58e2b3ae0217160974..acd5def832888afaca5b9a110b00044ff9467e58 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -79,6 +79,24 @@ class Session : public BnSession { ndk::ScopedAStatus onUiReady() override; + ndk::ScopedAStatus authenticateWithContext( + int64_t operationId, const common::OperationContext& context, + std::shared_ptr* out) override; + + ndk::ScopedAStatus enrollWithContext( + const keymaster::HardwareAuthToken& hat, const common::OperationContext& context, + std::shared_ptr* out) override; + + ndk::ScopedAStatus detectInteractionWithContext( + const common::OperationContext& context, + std::shared_ptr* out) override; + + ndk::ScopedAStatus onPointerDownWithContext(const PointerContext& context) override; + + ndk::ScopedAStatus onPointerUpWithContext(const PointerContext& context) override; + + ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; + bool isClosed(); private: diff --git a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp b/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp index b2417bd2425cd30c752bdea5bdd956fc6fdc5e32..902fb40c6bf6a652885825398e4e6ee02076201f 100644 --- a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp @@ -71,7 +71,7 @@ TEST(WorkerThreadTest, ScheduleReturnsFalseWhenQueueIsFull) { TEST(WorkerThreadTest, TasksExecuteInOrder) { constexpr int NUM_TASKS = 10000; - WorkerThread worker(NUM_TASKS); + WorkerThread worker(NUM_TASKS + 1); std::mutex mut; std::condition_variable cv; diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp index 8d023c01d773935b03c4754a4195b0e60e0da767..20775dd282c9a9fa8379f01463b0ba7c3e3b4f07 100644 --- a/bluetooth/1.0/Android.bp +++ b/bluetooth/1.0/Android.bp @@ -21,4 +21,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + ], } diff --git a/bluetooth/1.1/Android.bp b/bluetooth/1.1/Android.bp index 4feb28bd96723c551c91daef39955b774db8b11f..4ac20094bdf7a385bdc9a17e75a949926c9a0036 100644 --- a/bluetooth/1.1/Android.bp +++ b/bluetooth/1.1/Android.bp @@ -21,4 +21,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + ], } diff --git a/bluetooth/a2dp/1.0/Android.bp b/bluetooth/a2dp/1.0/Android.bp index 7f39d4f55c243d8b634c9ef46e2e8c9b703cd588..20776dccb83a459944f417af3a9b65dfab1dea0b 100644 --- a/bluetooth/a2dp/1.0/Android.bp +++ b/bluetooth/a2dp/1.0/Android.bp @@ -21,4 +21,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + ], } diff --git a/bluetooth/audio/2.0/Android.bp b/bluetooth/audio/2.0/Android.bp index dd39f9f9d3cc6a6a0e88ad8ff8ce9549e90cdc4d..e4d48c1b3fb2031222aaddd7259d96d323568cbb 100644 --- a/bluetooth/audio/2.0/Android.bp +++ b/bluetooth/audio/2.0/Android.bp @@ -24,4 +24,8 @@ hidl_interface { "android.hidl.safe_union@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + ], } diff --git a/bluetooth/audio/aidl/Android.bp b/bluetooth/audio/aidl/Android.bp index aca301c657e38a682ffe077be862acea10170e3c..a6871624d575d09c7479cf7c4d823305d1e35b42 100644 --- a/bluetooth/audio/aidl/Android.bp +++ b/bluetooth/audio/aidl/Android.bp @@ -47,4 +47,24 @@ aidl_interface { min_sdk_version: "31", }, }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.audio.common-V1", + ], + }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.audio.common-V1", + ], + }, + + ], + } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/.hash b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..6d86950c3b837698f0d30228d1869b6fa25db724 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/.hash @@ -0,0 +1 @@ +f8e3fbe6eb69d5ee54f70c8af2f8168b6badc86d diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..899b8ca6db323e1779230f9454fa5f2262dbb2a3 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacCapabilities.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AacCapabilities { + android.hardware.bluetooth.audio.AacObjectType[] objectType; + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + boolean variableBitRateSupported; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6adef6df162abf5d85a92643cf3b25ee9340f812 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacConfiguration.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AacConfiguration { + android.hardware.bluetooth.audio.AacObjectType objectType; + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + boolean variableBitRateEnabled; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacObjectType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacObjectType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2148244d0660408ba5bd532d0f8cbab6ffd46b3e --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AacObjectType.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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum AacObjectType { + MPEG2_LC = 0, + MPEG4_LC = 1, + MPEG4_LTP = 2, + MPEG4_SCALABLE = 3, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4e5dfe66c29121a2d642f345b9aa66b21192619b --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.AptxAdaptiveChannelMode[] channelMode; + byte[] bitsPerSample; + android.hardware.bluetooth.audio.AptxMode[] aptxMode; + android.hardware.bluetooth.audio.AptxSinkBuffering sinkBufferingMs; + android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay ttp; + android.hardware.bluetooth.audio.AptxAdaptiveInputMode inputMode; + int inputFadeDurationMs; + byte[] aptxAdaptiveConfigStream; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0499b706ffe529e35bb16ff28c7d077a70484d16 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxAdaptiveChannelMode { + JOINT_STEREO = 0, + MONO = 1, + DUAL_MONO = 2, + TWS_STEREO = 4, + UNKNOWN = 255, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aab05213b45cf7729d233cc8e7a7940b26b8ed95 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.AptxAdaptiveChannelMode channelMode; + byte bitsPerSample; + android.hardware.bluetooth.audio.AptxMode aptxMode; + android.hardware.bluetooth.audio.AptxSinkBuffering sinkBufferingMs; + android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay ttp; + android.hardware.bluetooth.audio.AptxAdaptiveInputMode inputMode; + int inputFadeDurationMs; + byte[] aptxAdaptiveConfigStream; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f7029396c66ed2bfe596efeab6d30e127f93ef06 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxAdaptiveInputMode { + STEREO = 0, + DUAL_MONO = 1, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35606667cb6ec9fd7ee39b8cedb14e29e2e660ba --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveTimeToPlay { + byte lowLowLatency; + byte highLowLatency; + byte lowHighQuality; + byte highHighQuality; + byte lowTws; + byte highTws; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..08a38e26e1e8dea6d64b6a5f61ea8216f4009f7a --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91e88b32f3d853ddb36d5422d5ef06c4dce57d70 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxConfiguration.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d5dd9d9deb818a1865f3f5f1981ed6fe7e341422 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxMode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxMode { + UNKNOWN = 0, + HIGH_QUALITY = 4096, + LOW_LATENCY = 8192, + ULTRA_LOW_LATENCY = 16384, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl new file mode 100644 index 0000000000000000000000000000000000000000..527418e308ef57b45d73ff6424ac03e1df7a46a5 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxSinkBuffering { + byte minLowLatency; + byte maxLowLatency; + byte minHighQuality; + byte maxHighQuality; + byte minTws; + byte maxTws; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8ae716ff23299651bb3e1f27d23c3893d00698c1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +union AudioCapabilities { + android.hardware.bluetooth.audio.PcmCapabilities pcmCapabilities; + android.hardware.bluetooth.audio.CodecCapabilities a2dpCapabilities; + android.hardware.bluetooth.audio.LeAudioCodecCapabilitiesSetting leAudioCapabilities; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3abfb31b7b80f80c707cef934dfe4c92c835ca53 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +union AudioConfiguration { + android.hardware.bluetooth.audio.PcmConfiguration pcmConfig; + android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig; + android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig; + android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration leAudioBroadcastConfig; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioLocation.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..319a5e2ad0c767d0b7171efdbcbd2d3bb5222480 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/AudioLocation.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AudioLocation { + UNKNOWN = 1, + FRONT_LEFT = 2, + FRONT_RIGHT = 4, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c20c0576262f03ac0f182ccc6f378dab462ef120 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum BluetoothAudioStatus { + UNKNOWN = 0, + SUCCESS = 1, + UNSUPPORTED_CODEC_CONFIGURATION = 2, + FAILURE = 3, + RECONFIGURATION = 4, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/BroadcastCapability.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/BroadcastCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..58710effe7f90a7fa8a5abd60f514ce86a722c3e --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/BroadcastCapability.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable BroadcastCapability { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.AudioLocation supportedChannel; + int channelCountPerStream; + android.hardware.bluetooth.audio.BroadcastCapability.LeAudioCodecCapabilities leAudioCodecCapabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union LeAudioCodecCapabilities { + @nullable android.hardware.bluetooth.audio.Lc3Capabilities[] lc3Capabilities; + @nullable android.hardware.bluetooth.audio.BroadcastCapability.VendorCapabilities[] vendorCapabillities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/ChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/ChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c3bc7410e4ddc2bfd228fbc1b0e01847ebf4b280 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/ChannelMode.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum ChannelMode { + UNKNOWN = 0, + MONO = 1, + STEREO = 2, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6efdcb745eb60a504d5953034e59a6685449b199 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecCapabilities.aidl @@ -0,0 +1,53 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable CodecCapabilities { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.CodecCapabilities.Capabilities capabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union Capabilities { + android.hardware.bluetooth.audio.SbcCapabilities sbcCapabilities; + android.hardware.bluetooth.audio.AacCapabilities aacCapabilities; + android.hardware.bluetooth.audio.LdacCapabilities ldacCapabilities; + android.hardware.bluetooth.audio.AptxCapabilities aptxCapabilities; + android.hardware.bluetooth.audio.AptxAdaptiveCapabilities aptxAdaptiveCapabilities; + android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities; + android.hardware.bluetooth.audio.CodecCapabilities.VendorCapabilities vendorCapabilities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..77a6b1b0f212e38302aee9a33f1d78bb03c8766d --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecConfiguration.aidl @@ -0,0 +1,58 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable CodecConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + int encodedAudioBitrate; + int peerMtu; + boolean isScmstEnabled; + android.hardware.bluetooth.audio.CodecConfiguration.CodecSpecific config; + @VintfStability + parcelable VendorConfiguration { + int vendorId; + char codecId; + ParcelableHolder codecConfig; + } + @VintfStability + union CodecSpecific { + android.hardware.bluetooth.audio.SbcConfiguration sbcConfig; + android.hardware.bluetooth.audio.AacConfiguration aacConfig; + android.hardware.bluetooth.audio.LdacConfiguration ldacConfig; + android.hardware.bluetooth.audio.AptxConfiguration aptxConfig; + android.hardware.bluetooth.audio.AptxAdaptiveConfiguration aptxAdaptiveConfig; + android.hardware.bluetooth.audio.Lc3Configuration lc3Config; + android.hardware.bluetooth.audio.CodecConfiguration.VendorConfiguration vendorConfig; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1522cb4fd6138a348e38b501785af2cbb4b38379 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/CodecType.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum CodecType { + UNKNOWN = 0, + SBC = 1, + AAC = 2, + APTX = 3, + APTX_HD = 4, + LDAC = 5, + LC3 = 6, + VENDOR = 7, + APTX_ADAPTIVE = 8, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d364371707c3b40bb9a292d6397058e78c5a94fe --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +interface IBluetoothAudioPort { + android.hardware.bluetooth.audio.PresentationPosition getPresentationPosition(); + void startStream(boolean isLowLatency); + void stopStream(); + void suspendStream(); + void updateSourceMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata); + void updateSinkMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata); + void setLatencyMode(in android.hardware.bluetooth.audio.LatencyMode latencyMode); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl new file mode 100644 index 0000000000000000000000000000000000000000..267af0f4b42210e9b105c8ff694633e467afe2b1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +interface IBluetoothAudioProvider { + void endSession(); + android.hardware.common.fmq.MQDescriptor startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig, in android.hardware.bluetooth.audio.LatencyMode[] supportedLatencyModes); + void streamStarted(in android.hardware.bluetooth.audio.BluetoothAudioStatus status); + void streamSuspended(in android.hardware.bluetooth.audio.BluetoothAudioStatus status); + void updateAudioConfiguration(in android.hardware.bluetooth.audio.AudioConfiguration audioConfig); + void setLowLatencyModeAllowed(in boolean allowed); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5e33deb8565f94efb69a4c0eb05b54cb1bb166f4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +interface IBluetoothAudioProviderFactory { + android.hardware.bluetooth.audio.AudioCapabilities[] getProviderCapabilities(in android.hardware.bluetooth.audio.SessionType sessionType); + android.hardware.bluetooth.audio.IBluetoothAudioProvider openProvider(in android.hardware.bluetooth.audio.SessionType sessionType); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LatencyMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LatencyMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..558367941200c0600faa2e27b6cfede62aa74a47 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LatencyMode.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum LatencyMode { + UNKNOWN = 0, + LOW_LATENCY = 1, + FREE = 2, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/Lc3Capabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/Lc3Capabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc4449aea9459580d3bdf77a28d0ae456964f61a --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/Lc3Capabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable Lc3Capabilities { + byte[] pcmBitDepth; + int[] samplingFrequencyHz; + int[] frameDurationUs; + int[] octetsPerFrame; + byte[] blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/Lc3Configuration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/Lc3Configuration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e8dccff5f924399742a3020777e4d0dc7459a90 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/Lc3Configuration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable Lc3Configuration { + byte pcmBitDepth; + int samplingFrequencyHz; + int frameDurationUs; + int octetsPerFrame; + byte blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aa4e4c8793c9b747725dfce84bad451bc0e5161c --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LdacCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.LdacChannelMode[] channelMode; + android.hardware.bluetooth.audio.LdacQualityIndex[] qualityIndex; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..88d6faff53b66ebc8155861da7a26e66398b82e2 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacChannelMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum LdacChannelMode { + UNKNOWN = 0, + STEREO = 1, + DUAL = 2, + MONO = 3, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8a3763800b699ac80ff2b0d334604a544bef2c78 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LdacConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.LdacChannelMode channelMode; + android.hardware.bluetooth.audio.LdacQualityIndex qualityIndex; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacQualityIndex.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacQualityIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35e435867e2374905cc4bcccab44bcdcdbf4c4ef --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LdacQualityIndex.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum LdacQualityIndex { + HIGH = 0, + MID = 1, + LOW = 2, + ABR = 3, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7d53b0ca8e33b594599f8fde3d0b22735f6c78fc --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LeAudioBroadcastConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap; + @VintfStability + parcelable BroadcastStreamMap { + char streamHandle; + int audioChannelAllocation; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9818d543ac5cc023786b02e851e8724165c3fd47 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable LeAudioCodecCapabilitiesSetting { + android.hardware.bluetooth.audio.UnicastCapability unicastEncodeCapability; + android.hardware.bluetooth.audio.UnicastCapability unicastDecodeCapability; + android.hardware.bluetooth.audio.BroadcastCapability broadcastCapability; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bb3d7e4b1e32d708cdaac387416ad6a23561eaf4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +union LeAudioCodecConfiguration { + android.hardware.bluetooth.audio.Lc3Configuration lc3Config; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration.VendorConfiguration vendorConfig; + @VintfStability + parcelable VendorConfiguration { + ParcelableHolder extension; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..edb6795ddc6764a04c443a847fc47cf2de8da1a2 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LeAudioConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap; + int peerDelayUs; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig; + @VintfStability + parcelable StreamMap { + char streamHandle; + int audioChannelAllocation; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PcmCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PcmCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c2f87d5999e9f0cde8b5a75f43d7862f6b992ba --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PcmCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable PcmCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + byte[] bitsPerSample; + int[] dataIntervalUs; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PcmConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PcmConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..93d7805a336cdc651dc1f3db0fdcaf97579a4631 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PcmConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable PcmConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + byte bitsPerSample; + int dataIntervalUs; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PresentationPosition.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PresentationPosition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e997e8c8f7f0432cf2c1a819152e734f57cd2cf --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/PresentationPosition.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.bluetooth.audio; +@VintfStability +parcelable PresentationPosition { + long remoteDeviceAudioDelayNanos; + long transmittedOctets; + android.hardware.bluetooth.audio.PresentationPosition.TimeSpec transmittedOctetsTimestamp; + @VintfStability + parcelable TimeSpec { + long tvSec; + long tvNSec; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcAllocMethod.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcAllocMethod.aidl new file mode 100644 index 0000000000000000000000000000000000000000..091f6d7246b1af87ffde57fd41120ded54814fda --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcAllocMethod.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SbcAllocMethod { + ALLOC_MD_S = 0, + ALLOC_MD_L = 1, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c8d7e7e74ed197889ee2aef050d2eb8367c2719d --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcCapabilities.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable SbcCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.SbcChannelMode[] channelMode; + byte[] blockLength; + byte[] numSubbands; + android.hardware.bluetooth.audio.SbcAllocMethod[] allocMethod; + byte[] bitsPerSample; + int minBitpool; + int maxBitpool; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6441a99877f7e2b743f482db43e7a88ca8dcabd2 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcChannelMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SbcChannelMode { + UNKNOWN = 0, + JOINT_STEREO = 1, + STEREO = 2, + DUAL = 3, + MONO = 4, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8eab9c3d96f7842905a7c21796732265b73157f4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SbcConfiguration.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable SbcConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.SbcChannelMode channelMode; + byte blockLength; + byte numSubbands; + android.hardware.bluetooth.audio.SbcAllocMethod allocMethod; + byte bitsPerSample; + int minBitpool; + int maxBitpool; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SessionType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..33a3187c3b98df6a0ca1cec74388bc4acc0050aa --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/SessionType.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SessionType { + UNKNOWN = 0, + A2DP_SOFTWARE_ENCODING_DATAPATH = 1, + A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 2, + HEARING_AID_SOFTWARE_ENCODING_DATAPATH = 3, + LE_AUDIO_SOFTWARE_ENCODING_DATAPATH = 4, + LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5, + LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 6, + LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH = 7, + LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH = 8, + LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 9, + A2DP_SOFTWARE_DECODING_DATAPATH = 10, + A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH = 11, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/UnicastCapability.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/UnicastCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..130fef971c17f526df27f9066b674cf261e0c2d1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/1/android/hardware/bluetooth/audio/UnicastCapability.aidl @@ -0,0 +1,51 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable UnicastCapability { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.AudioLocation supportedChannel; + int deviceCount; + int channelCountPerDevice; + android.hardware.bluetooth.audio.UnicastCapability.LeAudioCodecCapabilities leAudioCodecCapabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union LeAudioCodecCapabilities { + android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities; + android.hardware.bluetooth.audio.UnicastCapability.VendorCapabilities vendorCapabillities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/.hash b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..52e693338469fa6d70fb50def4f8f2b6df45fcc8 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/.hash @@ -0,0 +1 @@ +b82d5b9f717bbf63bef774ee8f72572065ca61ce diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..899b8ca6db323e1779230f9454fa5f2262dbb2a3 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacCapabilities.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AacCapabilities { + android.hardware.bluetooth.audio.AacObjectType[] objectType; + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + boolean variableBitRateSupported; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6adef6df162abf5d85a92643cf3b25ee9340f812 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacConfiguration.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AacConfiguration { + android.hardware.bluetooth.audio.AacObjectType objectType; + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + boolean variableBitRateEnabled; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacObjectType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacObjectType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2148244d0660408ba5bd532d0f8cbab6ffd46b3e --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AacObjectType.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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum AacObjectType { + MPEG2_LC = 0, + MPEG4_LC = 1, + MPEG4_LTP = 2, + MPEG4_SCALABLE = 3, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4e5dfe66c29121a2d642f345b9aa66b21192619b --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.AptxAdaptiveChannelMode[] channelMode; + byte[] bitsPerSample; + android.hardware.bluetooth.audio.AptxMode[] aptxMode; + android.hardware.bluetooth.audio.AptxSinkBuffering sinkBufferingMs; + android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay ttp; + android.hardware.bluetooth.audio.AptxAdaptiveInputMode inputMode; + int inputFadeDurationMs; + byte[] aptxAdaptiveConfigStream; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0499b706ffe529e35bb16ff28c7d077a70484d16 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxAdaptiveChannelMode { + JOINT_STEREO = 0, + MONO = 1, + DUAL_MONO = 2, + TWS_STEREO = 4, + UNKNOWN = 255, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aab05213b45cf7729d233cc8e7a7940b26b8ed95 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.AptxAdaptiveChannelMode channelMode; + byte bitsPerSample; + android.hardware.bluetooth.audio.AptxMode aptxMode; + android.hardware.bluetooth.audio.AptxSinkBuffering sinkBufferingMs; + android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay ttp; + android.hardware.bluetooth.audio.AptxAdaptiveInputMode inputMode; + int inputFadeDurationMs; + byte[] aptxAdaptiveConfigStream; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f7029396c66ed2bfe596efeab6d30e127f93ef06 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxAdaptiveInputMode { + STEREO = 0, + DUAL_MONO = 1, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35606667cb6ec9fd7ee39b8cedb14e29e2e660ba --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveTimeToPlay { + byte lowLowLatency; + byte highLowLatency; + byte lowHighQuality; + byte highHighQuality; + byte lowTws; + byte highTws; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..08a38e26e1e8dea6d64b6a5f61ea8216f4009f7a --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91e88b32f3d853ddb36d5422d5ef06c4dce57d70 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxConfiguration.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d5dd9d9deb818a1865f3f5f1981ed6fe7e341422 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxMode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxMode { + UNKNOWN = 0, + HIGH_QUALITY = 4096, + LOW_LATENCY = 8192, + ULTRA_LOW_LATENCY = 16384, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl new file mode 100644 index 0000000000000000000000000000000000000000..527418e308ef57b45d73ff6424ac03e1df7a46a5 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable AptxSinkBuffering { + byte minLowLatency; + byte maxLowLatency; + byte minHighQuality; + byte maxHighQuality; + byte minTws; + byte maxTws; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8ae716ff23299651bb3e1f27d23c3893d00698c1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +union AudioCapabilities { + android.hardware.bluetooth.audio.PcmCapabilities pcmCapabilities; + android.hardware.bluetooth.audio.CodecCapabilities a2dpCapabilities; + android.hardware.bluetooth.audio.LeAudioCodecCapabilitiesSetting leAudioCapabilities; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3abfb31b7b80f80c707cef934dfe4c92c835ca53 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +union AudioConfiguration { + android.hardware.bluetooth.audio.PcmConfiguration pcmConfig; + android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig; + android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig; + android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration leAudioBroadcastConfig; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioLocation.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..319a5e2ad0c767d0b7171efdbcbd2d3bb5222480 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/AudioLocation.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AudioLocation { + UNKNOWN = 1, + FRONT_LEFT = 2, + FRONT_RIGHT = 4, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c20c0576262f03ac0f182ccc6f378dab462ef120 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum BluetoothAudioStatus { + UNKNOWN = 0, + SUCCESS = 1, + UNSUPPORTED_CODEC_CONFIGURATION = 2, + FAILURE = 3, + RECONFIGURATION = 4, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/BroadcastCapability.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/BroadcastCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..58710effe7f90a7fa8a5abd60f514ce86a722c3e --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/BroadcastCapability.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable BroadcastCapability { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.AudioLocation supportedChannel; + int channelCountPerStream; + android.hardware.bluetooth.audio.BroadcastCapability.LeAudioCodecCapabilities leAudioCodecCapabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union LeAudioCodecCapabilities { + @nullable android.hardware.bluetooth.audio.Lc3Capabilities[] lc3Capabilities; + @nullable android.hardware.bluetooth.audio.BroadcastCapability.VendorCapabilities[] vendorCapabillities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/ChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/ChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..feacb804385433ed4edeff71dc97ed4942589d5e --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/ChannelMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum ChannelMode { + UNKNOWN = 0, + MONO = 1, + STEREO = 2, + DUALMONO = 3, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b00649a62dd03b5fe19706b7e1a3690df3d01d76 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecCapabilities.aidl @@ -0,0 +1,54 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable CodecCapabilities { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.CodecCapabilities.Capabilities capabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union Capabilities { + android.hardware.bluetooth.audio.SbcCapabilities sbcCapabilities; + android.hardware.bluetooth.audio.AacCapabilities aacCapabilities; + android.hardware.bluetooth.audio.LdacCapabilities ldacCapabilities; + android.hardware.bluetooth.audio.AptxCapabilities aptxCapabilities; + android.hardware.bluetooth.audio.AptxAdaptiveCapabilities aptxAdaptiveCapabilities; + android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities; + android.hardware.bluetooth.audio.CodecCapabilities.VendorCapabilities vendorCapabilities; + @nullable android.hardware.bluetooth.audio.OpusCapabilities opusCapabilities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7f5ea48d8ae1f41f2ebbdc66c0453411672077b3 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecConfiguration.aidl @@ -0,0 +1,59 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable CodecConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + int encodedAudioBitrate; + int peerMtu; + boolean isScmstEnabled; + android.hardware.bluetooth.audio.CodecConfiguration.CodecSpecific config; + @VintfStability + parcelable VendorConfiguration { + int vendorId; + char codecId; + ParcelableHolder codecConfig; + } + @VintfStability + union CodecSpecific { + android.hardware.bluetooth.audio.SbcConfiguration sbcConfig; + android.hardware.bluetooth.audio.AacConfiguration aacConfig; + android.hardware.bluetooth.audio.LdacConfiguration ldacConfig; + android.hardware.bluetooth.audio.AptxConfiguration aptxConfig; + android.hardware.bluetooth.audio.AptxAdaptiveConfiguration aptxAdaptiveConfig; + android.hardware.bluetooth.audio.Lc3Configuration lc3Config; + android.hardware.bluetooth.audio.CodecConfiguration.VendorConfiguration vendorConfig; + @nullable android.hardware.bluetooth.audio.OpusConfiguration opusConfig; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d1723e6dab0969c34d00ccb78af2557584f3df6b --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/CodecType.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum CodecType { + UNKNOWN = 0, + SBC = 1, + AAC = 2, + APTX = 3, + APTX_HD = 4, + LDAC = 5, + LC3 = 6, + VENDOR = 7, + APTX_ADAPTIVE = 8, + OPUS = 9, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d364371707c3b40bb9a292d6397058e78c5a94fe --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +interface IBluetoothAudioPort { + android.hardware.bluetooth.audio.PresentationPosition getPresentationPosition(); + void startStream(boolean isLowLatency); + void stopStream(); + void suspendStream(); + void updateSourceMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata); + void updateSinkMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata); + void setLatencyMode(in android.hardware.bluetooth.audio.LatencyMode latencyMode); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl new file mode 100644 index 0000000000000000000000000000000000000000..267af0f4b42210e9b105c8ff694633e467afe2b1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +interface IBluetoothAudioProvider { + void endSession(); + android.hardware.common.fmq.MQDescriptor startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig, in android.hardware.bluetooth.audio.LatencyMode[] supportedLatencyModes); + void streamStarted(in android.hardware.bluetooth.audio.BluetoothAudioStatus status); + void streamSuspended(in android.hardware.bluetooth.audio.BluetoothAudioStatus status); + void updateAudioConfiguration(in android.hardware.bluetooth.audio.AudioConfiguration audioConfig); + void setLowLatencyModeAllowed(in boolean allowed); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5e33deb8565f94efb69a4c0eb05b54cb1bb166f4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +interface IBluetoothAudioProviderFactory { + android.hardware.bluetooth.audio.AudioCapabilities[] getProviderCapabilities(in android.hardware.bluetooth.audio.SessionType sessionType); + android.hardware.bluetooth.audio.IBluetoothAudioProvider openProvider(in android.hardware.bluetooth.audio.SessionType sessionType); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LatencyMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LatencyMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..558367941200c0600faa2e27b6cfede62aa74a47 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LatencyMode.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@Backing(type="int") @VintfStability +enum LatencyMode { + UNKNOWN = 0, + LOW_LATENCY = 1, + FREE = 2, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/Lc3Capabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/Lc3Capabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc4449aea9459580d3bdf77a28d0ae456964f61a --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/Lc3Capabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable Lc3Capabilities { + byte[] pcmBitDepth; + int[] samplingFrequencyHz; + int[] frameDurationUs; + int[] octetsPerFrame; + byte[] blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/Lc3Configuration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/Lc3Configuration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e8dccff5f924399742a3020777e4d0dc7459a90 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/Lc3Configuration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable Lc3Configuration { + byte pcmBitDepth; + int samplingFrequencyHz; + int frameDurationUs; + int octetsPerFrame; + byte blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aa4e4c8793c9b747725dfce84bad451bc0e5161c --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LdacCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.LdacChannelMode[] channelMode; + android.hardware.bluetooth.audio.LdacQualityIndex[] qualityIndex; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..88d6faff53b66ebc8155861da7a26e66398b82e2 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacChannelMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum LdacChannelMode { + UNKNOWN = 0, + STEREO = 1, + DUAL = 2, + MONO = 3, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8a3763800b699ac80ff2b0d334604a544bef2c78 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LdacConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.LdacChannelMode channelMode; + android.hardware.bluetooth.audio.LdacQualityIndex qualityIndex; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacQualityIndex.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacQualityIndex.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35e435867e2374905cc4bcccab44bcdcdbf4c4ef --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LdacQualityIndex.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum LdacQualityIndex { + HIGH = 0, + MID = 1, + LOW = 2, + ABR = 3, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7d53b0ca8e33b594599f8fde3d0b22735f6c78fc --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LeAudioBroadcastConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap; + @VintfStability + parcelable BroadcastStreamMap { + char streamHandle; + int audioChannelAllocation; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9818d543ac5cc023786b02e851e8724165c3fd47 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.bluetooth.audio; +@VintfStability +parcelable LeAudioCodecCapabilitiesSetting { + android.hardware.bluetooth.audio.UnicastCapability unicastEncodeCapability; + android.hardware.bluetooth.audio.UnicastCapability unicastDecodeCapability; + android.hardware.bluetooth.audio.BroadcastCapability broadcastCapability; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bb3d7e4b1e32d708cdaac387416ad6a23561eaf4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +union LeAudioCodecConfiguration { + android.hardware.bluetooth.audio.Lc3Configuration lc3Config; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration.VendorConfiguration vendorConfig; + @VintfStability + parcelable VendorConfiguration { + ParcelableHolder extension; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..edb6795ddc6764a04c443a847fc47cf2de8da1a2 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable LeAudioConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap; + int peerDelayUs; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig; + @VintfStability + parcelable StreamMap { + char streamHandle; + int audioChannelAllocation; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/OpusCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/OpusCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..27818939733a4f2f53801eda196fd79b2608402f --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/OpusCapabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable OpusCapabilities { + byte[] pcmBitDepth; + int[] samplingFrequencyHz; + int[] frameDurationUs; + int[] octetsPerFrame; + byte[] blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/OpusConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/OpusConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..067690ede2cc48eb3c0b5b40b831059de1a980c3 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/OpusConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable OpusConfiguration { + byte pcmBitDepth; + int samplingFrequencyHz; + int frameDurationUs; + int octetsPerFrame; + byte blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PcmCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PcmCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c2f87d5999e9f0cde8b5a75f43d7862f6b992ba --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PcmCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable PcmCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + byte[] bitsPerSample; + int[] dataIntervalUs; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PcmConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PcmConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..93d7805a336cdc651dc1f3db0fdcaf97579a4631 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PcmConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable PcmConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + byte bitsPerSample; + int dataIntervalUs; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PresentationPosition.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PresentationPosition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e997e8c8f7f0432cf2c1a819152e734f57cd2cf --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/PresentationPosition.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.bluetooth.audio; +@VintfStability +parcelable PresentationPosition { + long remoteDeviceAudioDelayNanos; + long transmittedOctets; + android.hardware.bluetooth.audio.PresentationPosition.TimeSpec transmittedOctetsTimestamp; + @VintfStability + parcelable TimeSpec { + long tvSec; + long tvNSec; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcAllocMethod.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcAllocMethod.aidl new file mode 100644 index 0000000000000000000000000000000000000000..091f6d7246b1af87ffde57fd41120ded54814fda --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcAllocMethod.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SbcAllocMethod { + ALLOC_MD_S = 0, + ALLOC_MD_L = 1, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c8d7e7e74ed197889ee2aef050d2eb8367c2719d --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcCapabilities.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable SbcCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.SbcChannelMode[] channelMode; + byte[] blockLength; + byte[] numSubbands; + android.hardware.bluetooth.audio.SbcAllocMethod[] allocMethod; + byte[] bitsPerSample; + int minBitpool; + int maxBitpool; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcChannelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6441a99877f7e2b743f482db43e7a88ca8dcabd2 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcChannelMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SbcChannelMode { + UNKNOWN = 0, + JOINT_STEREO = 1, + STEREO = 2, + DUAL = 3, + MONO = 4, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8eab9c3d96f7842905a7c21796732265b73157f4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SbcConfiguration.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable SbcConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.SbcChannelMode channelMode; + byte blockLength; + byte numSubbands; + android.hardware.bluetooth.audio.SbcAllocMethod allocMethod; + byte bitsPerSample; + int minBitpool; + int maxBitpool; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SessionType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..33a3187c3b98df6a0ca1cec74388bc4acc0050aa --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/SessionType.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SessionType { + UNKNOWN = 0, + A2DP_SOFTWARE_ENCODING_DATAPATH = 1, + A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 2, + HEARING_AID_SOFTWARE_ENCODING_DATAPATH = 3, + LE_AUDIO_SOFTWARE_ENCODING_DATAPATH = 4, + LE_AUDIO_SOFTWARE_DECODING_DATAPATH = 5, + LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 6, + LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH = 7, + LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH = 8, + LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH = 9, + A2DP_SOFTWARE_DECODING_DATAPATH = 10, + A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH = 11, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/UnicastCapability.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/UnicastCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..130fef971c17f526df27f9066b674cf261e0c2d1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/2/android/hardware/bluetooth/audio/UnicastCapability.aidl @@ -0,0 +1,51 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable UnicastCapability { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.AudioLocation supportedChannel; + int deviceCount; + int channelCountPerDevice; + android.hardware.bluetooth.audio.UnicastCapability.LeAudioCodecCapabilities leAudioCodecCapabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union LeAudioCodecCapabilities { + android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities; + android.hardware.bluetooth.audio.UnicastCapability.VendorCapabilities vendorCapabillities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ChannelMode.aidl index c3bc7410e4ddc2bfd228fbc1b0e01847ebf4b280..feacb804385433ed4edeff71dc97ed4942589d5e 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ChannelMode.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ChannelMode.aidl @@ -37,4 +37,5 @@ enum ChannelMode { UNKNOWN = 0, MONO = 1, STEREO = 2, + DUALMONO = 3, } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl index 6efdcb745eb60a504d5953034e59a6685449b199..b00649a62dd03b5fe19706b7e1a3690df3d01d76 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecCapabilities.aidl @@ -49,5 +49,6 @@ parcelable CodecCapabilities { android.hardware.bluetooth.audio.AptxAdaptiveCapabilities aptxAdaptiveCapabilities; android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities; android.hardware.bluetooth.audio.CodecCapabilities.VendorCapabilities vendorCapabilities; + @nullable android.hardware.bluetooth.audio.OpusCapabilities opusCapabilities; } } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl index 77a6b1b0f212e38302aee9a33f1d78bb03c8766d..7f5ea48d8ae1f41f2ebbdc66c0453411672077b3 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecConfiguration.aidl @@ -54,5 +54,6 @@ parcelable CodecConfiguration { android.hardware.bluetooth.audio.AptxAdaptiveConfiguration aptxAdaptiveConfig; android.hardware.bluetooth.audio.Lc3Configuration lc3Config; android.hardware.bluetooth.audio.CodecConfiguration.VendorConfiguration vendorConfig; + @nullable android.hardware.bluetooth.audio.OpusConfiguration opusConfig; } } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl index 1522cb4fd6138a348e38b501785af2cbb4b38379..d1723e6dab0969c34d00ccb78af2557584f3df6b 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecType.aidl @@ -43,4 +43,5 @@ enum CodecType { LC3 = 6, VENDOR = 7, APTX_ADAPTIVE = 8, + OPUS = 9, } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/OpusCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/OpusCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..27818939733a4f2f53801eda196fd79b2608402f --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/OpusCapabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable OpusCapabilities { + byte[] pcmBitDepth; + int[] samplingFrequencyHz; + int[] frameDurationUs; + int[] octetsPerFrame; + byte[] blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/OpusConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/OpusConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..067690ede2cc48eb3c0b5b40b831059de1a980c3 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/OpusConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 -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.bluetooth.audio; +@VintfStability +parcelable OpusConfiguration { + byte pcmBitDepth; + int samplingFrequencyHz; + int frameDurationUs; + int octetsPerFrame; + byte blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode channelMode; +} diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ChannelMode.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ChannelMode.aidl index 66138724ae49eec26111467bb7f93c0788c09dfe..128089edd882cb01381d11090b17009f6d52456b 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ChannelMode.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ChannelMode.aidl @@ -22,4 +22,5 @@ enum ChannelMode { UNKNOWN, MONO, STEREO, + DUALMONO, } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl index 9fcdf1c3624ae96fc14860354ea23d3409a29745..641e2d664a59e30348690423d07a252d625bc632 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecCapabilities.aidl @@ -17,11 +17,12 @@ package android.hardware.bluetooth.audio; import android.hardware.bluetooth.audio.AacCapabilities; -import android.hardware.bluetooth.audio.AptxCapabilities; import android.hardware.bluetooth.audio.AptxAdaptiveCapabilities; +import android.hardware.bluetooth.audio.AptxCapabilities; import android.hardware.bluetooth.audio.CodecType; import android.hardware.bluetooth.audio.Lc3Capabilities; import android.hardware.bluetooth.audio.LdacCapabilities; +import android.hardware.bluetooth.audio.OpusCapabilities; import android.hardware.bluetooth.audio.SbcCapabilities; /** @@ -43,6 +44,7 @@ parcelable CodecCapabilities { AptxAdaptiveCapabilities aptxAdaptiveCapabilities; Lc3Capabilities lc3Capabilities; VendorCapabilities vendorCapabilities; + @nullable OpusCapabilities opusCapabilities; } CodecType codecType; Capabilities capabilities; diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl index 5ed12e3179512a122d680d0318cd4585f2d4e0ae..8f7e4190e0b1dc8c3cd8d301b590e8bfd770129c 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecConfiguration.aidl @@ -17,11 +17,12 @@ package android.hardware.bluetooth.audio; import android.hardware.bluetooth.audio.AacConfiguration; -import android.hardware.bluetooth.audio.AptxConfiguration; import android.hardware.bluetooth.audio.AptxAdaptiveConfiguration; +import android.hardware.bluetooth.audio.AptxConfiguration; import android.hardware.bluetooth.audio.CodecType; import android.hardware.bluetooth.audio.Lc3Configuration; import android.hardware.bluetooth.audio.LdacConfiguration; +import android.hardware.bluetooth.audio.OpusConfiguration; import android.hardware.bluetooth.audio.SbcConfiguration; /** @@ -45,6 +46,7 @@ parcelable CodecConfiguration { AptxAdaptiveConfiguration aptxAdaptiveConfig; Lc3Configuration lc3Config; VendorConfiguration vendorConfig; + @nullable OpusConfiguration opusConfig; } CodecType codecType; /** diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl index 386876e295a38782611fa81df6204a8bbaea60a1..34991558de0fa7dfab6ab98bb1dcc7ea3b4af827 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecType.aidl @@ -28,4 +28,5 @@ enum CodecType { LC3, VENDOR, APTX_ADAPTIVE, + OPUS, } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/OpusCapabilities.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/OpusCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5f05b3c2ab75269bf42eb0f93b99aff578911f5d --- /dev/null +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/OpusCapabilities.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +package android.hardware.bluetooth.audio; + +import android.hardware.bluetooth.audio.ChannelMode; + +/** + * Used for Hardware Encoding/Decoding Opus codec capabilities. + */ +@VintfStability +parcelable OpusCapabilities { + /* + * PCM is Input for encoder, Output for decoder + */ + byte[] pcmBitDepth; + /* + * codec-specific parameters + */ + int[] samplingFrequencyHz; + /* + * FrameDuration based on microseconds. + */ + int[] frameDurationUs; + /* + * length in octets of a codec frame + */ + int[] octetsPerFrame; + /* + * Number of blocks of codec frames per single SDU (Service Data Unit) + */ + byte[] blocksPerSdu; + /* + * Channel mode used in A2DP special audio, ignored in standard LE Audio mode + */ + ChannelMode[] channelMode; +} diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/OpusConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/OpusConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6d35a54411c7f96051152a8dc7f75faae74ec1ee --- /dev/null +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/OpusConfiguration.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +package android.hardware.bluetooth.audio; + +import android.hardware.bluetooth.audio.ChannelMode; + +/** + * Used for Hardware Encoding/Decoding Opus codec configuration. + */ +@VintfStability +parcelable OpusConfiguration { + /* + * PCM is Input for encoder, Output for decoder + */ + byte pcmBitDepth; + /* + * codec-specific parameters + */ + int samplingFrequencyHz; + /* + * FrameDuration based on microseconds. + */ + int frameDurationUs; + /* + * length in octets of a codec frame + */ + int octetsPerFrame; + /* + * Number of blocks of codec frames per single SDU (Service Data Unit) + */ + byte blocksPerSdu; + /* + * Channel mode used in A2DP special audio, ignored in standard LE Audio mode + */ + ChannelMode channelMode; +} diff --git a/bluetooth/audio/aidl/default/Android.bp b/bluetooth/audio/aidl/default/Android.bp index 13a5440861b06afb512d3c6c67697d2a663bc4bb..cbf23dce46457270d1dc3b87409213c6383f65fb 100644 --- a/bluetooth/audio/aidl/default/Android.bp +++ b/bluetooth/audio/aidl/default/Android.bp @@ -29,7 +29,7 @@ cc_library_shared { "libcutils", "libfmq", "liblog", - "android.hardware.bluetooth.audio-V1-ndk", + "android.hardware.bluetooth.audio-V2-ndk", "libbluetooth_audio_session_aidl", ], } diff --git a/bluetooth/audio/aidl/default/bluetooth_audio.xml b/bluetooth/audio/aidl/default/bluetooth_audio.xml index 1859a1a3661e5bc1faaed80beb46c4c91331da23..c4b187233365d2e3518928397b4806fbf50a7c3d 100644 --- a/bluetooth/audio/aidl/default/bluetooth_audio.xml +++ b/bluetooth/audio/aidl/default/bluetooth_audio.xml @@ -1,6 +1,7 @@ android.hardware.bluetooth.audio + 2 IBluetoothAudioProviderFactory/default - \ No newline at end of file + diff --git a/bluetooth/audio/aidl/vts/Android.bp b/bluetooth/audio/aidl/vts/Android.bp index feb952edf76f387ff5918791cfd2064ca0cc9646..3aed1b38ffb756d1f244986933b0869e02253c33 100644 --- a/bluetooth/audio/aidl/vts/Android.bp +++ b/bluetooth/audio/aidl/vts/Android.bp @@ -17,7 +17,7 @@ cc_test { srcs: ["VtsHalBluetoothAudioTargetTest.cpp"], shared_libs: [ "android.hardware.audio.common-V1-ndk", - "android.hardware.bluetooth.audio-V1-ndk", + "android.hardware.bluetooth.audio-V2-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", "libbase", diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp index b599365d2169bb129d2b50af99a2025dd3e5d4f0..ebd728db3494c1917aba11f3c793f69533a44736 100644 --- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp +++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp @@ -57,6 +57,8 @@ using aidl::android::hardware::bluetooth::audio:: LeAudioCodecCapabilitiesSetting; using aidl::android::hardware::bluetooth::audio::LeAudioCodecConfiguration; using aidl::android::hardware::bluetooth::audio::LeAudioConfiguration; +using aidl::android::hardware::bluetooth::audio::OpusCapabilities; +using aidl::android::hardware::bluetooth::audio::OpusConfiguration; using aidl::android::hardware::bluetooth::audio::PcmConfiguration; using aidl::android::hardware::bluetooth::audio::PresentationPosition; using aidl::android::hardware::bluetooth::audio::SbcAllocMethod; @@ -121,9 +123,9 @@ void copy_codec_specific(CodecConfiguration::CodecSpecific& dst, dst.set( src.get()); break; - case CodecConfiguration::CodecSpecific::lc3Config: - dst.set( - src.get()); + case CodecConfiguration::CodecSpecific::opusConfig: + dst.set( + src.get()); break; case CodecConfiguration::CodecSpecific::aptxAdaptiveConfig: dst.set( @@ -230,11 +232,12 @@ class BluetoothAudioProviderFactoryAidl ASSERT_EQ(codec_capabilities.capabilities.getTag(), CodecCapabilities::Capabilities::ldacCapabilities); break; - case CodecType::LC3: + case CodecType::OPUS: ASSERT_EQ(codec_capabilities.capabilities.getTag(), - CodecCapabilities::Capabilities::lc3Capabilities); + CodecCapabilities::Capabilities::opusCapabilities); break; case CodecType::APTX_ADAPTIVE: + case CodecType::LC3: case CodecType::VENDOR: case CodecType::UNKNOWN: break; @@ -484,39 +487,40 @@ class BluetoothAudioProviderFactoryAidl } std::vector - GetLc3CodecSpecificSupportedList(bool supported) { - std::vector lc3_codec_specifics; + GetOpusCodecSpecificSupportedList(bool supported) { + std::vector opus_codec_specifics; if (!supported) { - Lc3Configuration lc3_config{.samplingFrequencyHz = 0, - .frameDurationUs = 0}; - lc3_codec_specifics.push_back( - CodecConfiguration::CodecSpecific(lc3_config)); - return lc3_codec_specifics; + OpusConfiguration opus_config{.samplingFrequencyHz = 0, + .frameDurationUs = 0}; + opus_codec_specifics.push_back( + CodecConfiguration::CodecSpecific(opus_config)); + return opus_codec_specifics; } - GetA2dpOffloadCapabilityHelper(CodecType::LC3); + GetA2dpOffloadCapabilityHelper(CodecType::OPUS); if (temp_codec_capabilities_ == nullptr || - temp_codec_capabilities_->codecType != CodecType::LC3) { - return lc3_codec_specifics; + temp_codec_capabilities_->codecType != CodecType::OPUS) { + return opus_codec_specifics; } // parse the capability - auto& lc3_capability = + auto& opus_capability = temp_codec_capabilities_->capabilities - .get(); + .get(); // combine those parameters into one list of // CodecConfiguration::CodecSpecific - for (int32_t samplingFrequencyHz : lc3_capability.samplingFrequencyHz) { - for (int32_t frameDurationUs : lc3_capability.frameDurationUs) { - for (auto channel_mode : lc3_capability.channelMode) { - Lc3Configuration lc3_data{.samplingFrequencyHz = samplingFrequencyHz, - .channelMode = channel_mode, - .frameDurationUs = frameDurationUs}; - lc3_codec_specifics.push_back( - CodecConfiguration::CodecSpecific(lc3_data)); + for (int32_t samplingFrequencyHz : opus_capability->samplingFrequencyHz) { + for (int32_t frameDurationUs : opus_capability->frameDurationUs) { + for (auto channel_mode : opus_capability->channelMode) { + OpusConfiguration opus_data{ + .samplingFrequencyHz = samplingFrequencyHz, + .channelMode = channel_mode, + .frameDurationUs = frameDurationUs}; + opus_codec_specifics.push_back( + CodecConfiguration::CodecSpecific(opus_data)); } } } - return lc3_codec_specifics; + return opus_codec_specifics; } bool IsPcmConfigSupported(const PcmConfiguration& pcm_config) { @@ -762,23 +766,23 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, /** * Test whether each provider of type * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with - * LDAC hardware encoding config + * Opus hardware encoding config */ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, - StartAndEndA2dpLc3EncodingHardwareSession) { + StartAndEndA2dpOpusEncodingHardwareSession) { if (!IsOffloadSupported()) { return; } CodecConfiguration codec_config = { - .codecType = CodecType::LC3, + .codecType = CodecType::OPUS, .encodedAudioBitrate = 990000, .peerMtu = 1005, .isScmstEnabled = false, }; - auto lc3_codec_specifics = GetLc3CodecSpecificSupportedList(true); + auto opus_codec_specifics = GetOpusCodecSpecificSupportedList(true); - for (auto& codec_specific : lc3_codec_specifics) { + for (auto& codec_specific : opus_codec_specifics) { copy_codec_specific(codec_config.config, codec_specific); DataMQDesc mq_desc; auto aidl_retval = audio_provider_->startSession( @@ -855,10 +859,11 @@ TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl, case CodecType::APTX_HD: codec_specifics = GetAptxCodecSpecificSupportedList(true, false); break; - case CodecType::LC3: - codec_specifics = GetLc3CodecSpecificSupportedList(false); + case CodecType::OPUS: + codec_specifics = GetOpusCodecSpecificSupportedList(false); continue; case CodecType::APTX_ADAPTIVE: + case CodecType::LC3: case CodecType::VENDOR: case CodecType::UNKNOWN: codec_specifics.clear(); @@ -1788,23 +1793,23 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, /** * Test whether each provider of type * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped with - * LDAC hardware encoding config + * Opus hardware encoding config */ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, - StartAndEndA2dpLc3DecodingHardwareSession) { + StartAndEndA2dpOpusDecodingHardwareSession) { if (!IsOffloadSupported()) { return; } CodecConfiguration codec_config = { - .codecType = CodecType::LC3, + .codecType = CodecType::OPUS, .encodedAudioBitrate = 990000, .peerMtu = 1005, .isScmstEnabled = false, }; - auto lc3_codec_specifics = GetLc3CodecSpecificSupportedList(true); + auto opus_codec_specifics = GetOpusCodecSpecificSupportedList(true); - for (auto& codec_specific : lc3_codec_specifics) { + for (auto& codec_specific : opus_codec_specifics) { copy_codec_specific(codec_config.config, codec_specific); DataMQDesc mq_desc; auto aidl_retval = audio_provider_->startSession( @@ -1881,10 +1886,11 @@ TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl, case CodecType::APTX_HD: codec_specifics = GetAptxCodecSpecificSupportedList(true, false); break; - case CodecType::LC3: - codec_specifics = GetLc3CodecSpecificSupportedList(false); + case CodecType::OPUS: + codec_specifics = GetOpusCodecSpecificSupportedList(false); continue; case CodecType::APTX_ADAPTIVE: + case CodecType::LC3: case CodecType::VENDOR: case CodecType::UNKNOWN: codec_specifics.clear(); diff --git a/bluetooth/audio/utils/Android.bp b/bluetooth/audio/utils/Android.bp index 42f9455623789623e04b6aae13ca15e1975bc2ea..d08cb0a8e66d2af3fba05ddd6886e7976c86c31c 100644 --- a/bluetooth/audio/utils/Android.bp +++ b/bluetooth/audio/utils/Android.bp @@ -51,7 +51,7 @@ cc_library_shared { "libbinder_ndk", "libfmq", "liblog", - "android.hardware.bluetooth.audio-V1-ndk", + "android.hardware.bluetooth.audio-V2-ndk", "libhidlbase", ], } diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp index 8c42e91ea7a0ed71f78a544c8a8236d9f22b9f08..036d6cd60e124329237d10af31a23333aa2571eb 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include #include @@ -78,9 +80,9 @@ static const AptxCapabilities kDefaultOffloadAptxHdCapability = { .bitsPerSample = {24}, }; -static const Lc3Capabilities kDefaultA2dpOffloadLc3Capability = { - .samplingFrequencyHz = {44100, 48000}, - .frameDurationUs = {7500, 10000}, +static const OpusCapabilities kDefaultOffloadOpusCapability = { + .samplingFrequencyHz = {48000}, + .frameDurationUs = {10000, 20000}, .channelMode = {ChannelMode::MONO, ChannelMode::STEREO}, }; @@ -90,7 +92,7 @@ const std::vector kDefaultOffloadA2dpCodecCapabilities = { {.codecType = CodecType::LDAC, .capabilities = {}}, {.codecType = CodecType::APTX, .capabilities = {}}, {.codecType = CodecType::APTX_HD, .capabilities = {}}, - {.codecType = CodecType::LC3, .capabilities = {}}}; + {.codecType = CodecType::OPUS, .capabilities = {}}}; std::vector kDefaultOffloadLeAudioCapabilities; @@ -294,22 +296,24 @@ bool BluetoothAudioCodecs::IsOffloadAptxHdConfigurationValid( return false; } -bool BluetoothAudioCodecs::IsOffloadLc3ConfigurationValid( +bool BluetoothAudioCodecs::IsOffloadOpusConfigurationValid( const CodecConfiguration::CodecSpecific& codec_specific) { - if (codec_specific.getTag() != CodecConfiguration::CodecSpecific::lc3Config) { + if (codec_specific.getTag() != + CodecConfiguration::CodecSpecific::opusConfig) { LOG(WARNING) << __func__ << ": Invalid CodecSpecific=" << codec_specific.toString(); return false; } - const Lc3Configuration lc3_data = - codec_specific.get(); - - if (ContainedInVector(kDefaultA2dpOffloadLc3Capability.samplingFrequencyHz, - lc3_data.samplingFrequencyHz) && - ContainedInVector(kDefaultA2dpOffloadLc3Capability.frameDurationUs, - lc3_data.frameDurationUs) && - ContainedInVector(kDefaultA2dpOffloadLc3Capability.channelMode, - lc3_data.channelMode)) { + std::optional opus_data = + codec_specific.get(); + + if (opus_data.has_value() && + ContainedInVector(kDefaultOffloadOpusCapability.samplingFrequencyHz, + opus_data->samplingFrequencyHz) && + ContainedInVector(kDefaultOffloadOpusCapability.frameDurationUs, + opus_data->frameDurationUs) && + ContainedInVector(kDefaultOffloadOpusCapability.channelMode, + opus_data->channelMode)) { return true; } LOG(WARNING) << __func__ @@ -358,13 +362,14 @@ BluetoothAudioCodecs::GetA2dpOffloadCodecCapabilities( .set( kDefaultOffloadAptxHdCapability); break; - case CodecType::LC3: + case CodecType::OPUS: codec_capability.capabilities - .set( - kDefaultA2dpOffloadLc3Capability); + .set( + kDefaultOffloadOpusCapability); break; case CodecType::UNKNOWN: case CodecType::VENDOR: + case CodecType::LC3: case CodecType::APTX_ADAPTIVE: break; } @@ -425,12 +430,13 @@ bool BluetoothAudioCodecs::IsOffloadCodecConfigurationValid( return true; } break; - case CodecType::LC3: - if (IsOffloadLc3ConfigurationValid(codec_specific)) { + case CodecType::OPUS: + if (IsOffloadOpusConfigurationValid(codec_specific)) { return true; } break; case CodecType::APTX_ADAPTIVE: + case CodecType::LC3: case CodecType::UNKNOWN: case CodecType::VENDOR: break; diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h index c5e08d399179f60caa4cd260eb9791e0e72b4266..e3d657b49730dc7522078967d3d11ce114245125 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h @@ -18,9 +18,9 @@ #include #include -#include #include #include +#include #include #include #include @@ -68,7 +68,7 @@ class BluetoothAudioCodecs { const CodecConfiguration::CodecSpecific& codec_specific); static bool IsOffloadAptxHdConfigurationValid( const CodecConfiguration::CodecSpecific& codec_specific); - static bool IsOffloadLc3ConfigurationValid( + static bool IsOffloadOpusConfigurationValid( const CodecConfiguration::CodecSpecific& codec_specific); }; diff --git a/camera/common/1.0/default/HandleImporter.cpp b/camera/common/1.0/default/HandleImporter.cpp index 7fcf52330c7135293921a55f07291c0081476fa3..fbe8686766a2ab0c319d2244859f2da1cb55ed14 100644 --- a/camera/common/1.0/default/HandleImporter.cpp +++ b/camera/common/1.0/default/HandleImporter.cpp @@ -30,6 +30,7 @@ namespace helper { using aidl::android::hardware::graphics::common::PlaneLayout; using aidl::android::hardware::graphics::common::PlaneLayoutComponent; using aidl::android::hardware::graphics::common::PlaneLayoutComponentType; +using MetadataType = android::hardware::graphics::mapper::V4_0::IMapper::MetadataType; using MapperErrorV2 = android::hardware::graphics::mapper::V2_0::Error; using MapperErrorV3 = android::hardware::graphics::mapper::V3_0::Error; using MapperErrorV4 = android::hardware::graphics::mapper::V4_0::Error; @@ -123,6 +124,21 @@ YCbCrLayout HandleImporter::lockYCbCrInternal(const sp mapper, buffer_handle_ return layout; } +bool isMetadataPesent(const sp mapper, const buffer_handle_t& buf, + MetadataType metadataType) { + auto buffer = const_cast(buf); + mapper->get(buffer, metadataType, [] (const auto& tmpError, + const auto& tmpMetadata) { + if (tmpError == MapperErrorV4::NONE) { + return tmpMetadata.size() > 0; + } else { + ALOGE("%s: failed to get metadata %d!", __FUNCTION__, tmpError); + return false; + }}); + + return false; +} + std::vector getPlaneLayouts(const sp mapper, buffer_handle_t& buf) { auto buffer = const_cast(buf); std::vector planeLayouts; @@ -449,6 +465,55 @@ int HandleImporter::unlock(buffer_handle_t& buf) { return -1; } +bool HandleImporter::isSmpte2086Present(const buffer_handle_t& buf) { + Mutex::Autolock lock(mLock); + + if (!mInitialized) { + initializeLocked(); + } + + if (mMapperV4 != nullptr) { + return isMetadataPesent(mMapperV4, buf, gralloc4::MetadataType_Smpte2086); + } else { + ALOGE("%s: mMapperV4 is null! Query not supported!", __FUNCTION__); + } + + return false; +} + +bool HandleImporter::isSmpte2094_10Present(const buffer_handle_t& buf) { + Mutex::Autolock lock(mLock); + + if (!mInitialized) { + initializeLocked(); + } + + if (mMapperV4 != nullptr) { + return isMetadataPesent(mMapperV4, buf, gralloc4::MetadataType_Smpte2094_10); + } else { + ALOGE("%s: mMapperV4 is null! Query not supported!", __FUNCTION__); + } + + return false; +} + +bool HandleImporter::isSmpte2094_40Present(const buffer_handle_t& buf) { + Mutex::Autolock lock(mLock); + + if (!mInitialized) { + initializeLocked(); + } + + if (mMapperV4 != nullptr) { + return isMetadataPesent(mMapperV4, buf, gralloc4::MetadataType_Smpte2094_40); + } else { + ALOGE("%s: mMapperV4 is null! Query not supported!", __FUNCTION__); + } + + return false; +} + + } // namespace helper } // namespace V1_0 } // namespace common diff --git a/camera/common/1.0/default/include/HandleImporter.h b/camera/common/1.0/default/include/HandleImporter.h index e404439cb66453495642c3f9609a26c550ba0198..83fa755c994ca42d43eb4db1de8f72cf99d8332e 100644 --- a/camera/common/1.0/default/include/HandleImporter.h +++ b/camera/common/1.0/default/include/HandleImporter.h @@ -61,6 +61,11 @@ public: int unlock(buffer_handle_t& buf); // returns release fence + // Query Gralloc4 metadata + bool isSmpte2086Present(const buffer_handle_t& buf); + bool isSmpte2094_10Present(const buffer_handle_t& buf); + bool isSmpte2094_40Present(const buffer_handle_t& buf); + private: void initializeLocked(); void cleanup(); diff --git a/camera/common/aidl/Android.bp b/camera/common/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..d21ae581fb6331dc0edc0dd74993a568993e45f5 --- /dev/null +++ b/camera/common/aidl/Android.bp @@ -0,0 +1,30 @@ +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"], +} + +aidl_interface { + name: "android.hardware.camera.common", + vendor_available: true, + srcs: ["android/hardware/camera/common/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/.hash b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..84cd552c29a11c0eff8d5d8bf1707290a07f354f --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/.hash @@ -0,0 +1 @@ +d1a423213d80e15de2b10e54d908ac5c29644fef diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraDeviceStatus.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraDeviceStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a53a91488477c3903829021c8e04f62d65feb4de --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraDeviceStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum CameraDeviceStatus { + NOT_PRESENT = 0, + PRESENT = 1, + ENUMERATING = 2, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraMetadataType.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraMetadataType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..287dea3ffcddb9a648b2475b57be6027b3c08aee --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraMetadataType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum CameraMetadataType { + BYTE = 0, + INT32 = 1, + FLOAT = 2, + INT64 = 3, + DOUBLE = 4, + RATIONAL = 5, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraResourceCost.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraResourceCost.aidl new file mode 100644 index 0000000000000000000000000000000000000000..467f4510afa2140ad0444c9f78f52ff59b02050b --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/CameraResourceCost.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.camera.common; +@VintfStability +parcelable CameraResourceCost { + int resourceCost; + String[] conflictingDevices; +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/Status.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/Status.aidl new file mode 100644 index 0000000000000000000000000000000000000000..86589276e7842da99371cdd61e6557f2aad53e4e --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/Status.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum Status { + OK = 0, + ILLEGAL_ARGUMENT = 1, + CAMERA_IN_USE = 2, + MAX_CAMERAS_IN_USE = 3, + OPERATION_NOT_SUPPORTED = 4, + CAMERA_DISCONNECTED = 5, + INTERNAL_ERROR = 6, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/TagBoundaryId.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/TagBoundaryId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd5048347ecb7b41cc11b73830f3a057744cac6c --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/TagBoundaryId.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.camera.common; +@Backing(type="long") @VintfStability +enum TagBoundaryId { + AOSP = 0, + VENDOR = 2147483648, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/TorchModeStatus.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/TorchModeStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cb1a2ae3d32abc7851978168fc1ab56989f8d57a --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/TorchModeStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum TorchModeStatus { + NOT_AVAILABLE = 0, + AVAILABLE_OFF = 1, + AVAILABLE_ON = 2, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/VendorTag.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/VendorTag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b8b4ef4a38cb67d70b23e27d38297acbe56901ab --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/VendorTag.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.camera.common; +@VintfStability +parcelable VendorTag { + int tagId; + String tagName; + android.hardware.camera.common.CameraMetadataType tagType; +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/VendorTagSection.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/VendorTagSection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..140fba45453a46966e3b1c2cb9d48ea1df345cad --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/1/android/hardware/camera/common/VendorTagSection.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.camera.common; +@VintfStability +parcelable VendorTagSection { + String sectionName; + android.hardware.camera.common.VendorTag[] tags; +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraDeviceStatus.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraDeviceStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a53a91488477c3903829021c8e04f62d65feb4de --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraDeviceStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum CameraDeviceStatus { + NOT_PRESENT = 0, + PRESENT = 1, + ENUMERATING = 2, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraMetadataType.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraMetadataType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..287dea3ffcddb9a648b2475b57be6027b3c08aee --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraMetadataType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum CameraMetadataType { + BYTE = 0, + INT32 = 1, + FLOAT = 2, + INT64 = 3, + DOUBLE = 4, + RATIONAL = 5, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraResourceCost.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraResourceCost.aidl new file mode 100644 index 0000000000000000000000000000000000000000..467f4510afa2140ad0444c9f78f52ff59b02050b --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/CameraResourceCost.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.camera.common; +@VintfStability +parcelable CameraResourceCost { + int resourceCost; + String[] conflictingDevices; +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/Status.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/Status.aidl new file mode 100644 index 0000000000000000000000000000000000000000..86589276e7842da99371cdd61e6557f2aad53e4e --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/Status.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum Status { + OK = 0, + ILLEGAL_ARGUMENT = 1, + CAMERA_IN_USE = 2, + MAX_CAMERAS_IN_USE = 3, + OPERATION_NOT_SUPPORTED = 4, + CAMERA_DISCONNECTED = 5, + INTERNAL_ERROR = 6, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/TagBoundaryId.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/TagBoundaryId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd5048347ecb7b41cc11b73830f3a057744cac6c --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/TagBoundaryId.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.camera.common; +@Backing(type="long") @VintfStability +enum TagBoundaryId { + AOSP = 0, + VENDOR = 2147483648, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/TorchModeStatus.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/TorchModeStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cb1a2ae3d32abc7851978168fc1ab56989f8d57a --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/TorchModeStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.camera.common; +@Backing(type="int") @VintfStability +enum TorchModeStatus { + NOT_AVAILABLE = 0, + AVAILABLE_OFF = 1, + AVAILABLE_ON = 2, +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/VendorTag.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/VendorTag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b8b4ef4a38cb67d70b23e27d38297acbe56901ab --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/VendorTag.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.camera.common; +@VintfStability +parcelable VendorTag { + int tagId; + String tagName; + android.hardware.camera.common.CameraMetadataType tagType; +} diff --git a/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/VendorTagSection.aidl b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/VendorTagSection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..140fba45453a46966e3b1c2cb9d48ea1df345cad --- /dev/null +++ b/camera/common/aidl/aidl_api/android.hardware.camera.common/current/android/hardware/camera/common/VendorTagSection.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.camera.common; +@VintfStability +parcelable VendorTagSection { + String sectionName; + android.hardware.camera.common.VendorTag[] tags; +} diff --git a/camera/common/aidl/android/hardware/camera/common/CameraDeviceStatus.aidl b/camera/common/aidl/android/hardware/camera/common/CameraDeviceStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0e88ea8930d298829af3146a29751e99862b79d5 --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/CameraDeviceStatus.aidl @@ -0,0 +1,64 @@ +/* + * 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 android.hardware.camera.common; + +/** + * CameraDeviceStatus + * + * The current status of a camera device, as sent by a camera provider HAL + * through the ICameraProviderCallback::cameraDeviceStatusChange() call. + * + * At startup, the camera service must assume all internal camera devices listed + * by ICameraProvider::getCameraIdList() are in the PRESENT state. The provider + * must invoke ICameraProviderCallback::cameraDeviceStatusChange to inform the + * service of any initially NOT_PRESENT internal devices, and of any PRESENT + * external camera devices, as soon as the camera service has called + * ICameraProvider::setCallback(). + * + * Allowed state transitions: + * PRESENT -> NOT_PRESENT + * NOT_PRESENT -> ENUMERATING + * NOT_PRESENT -> PRESENT + * ENUMERATING -> PRESENT + * ENUMERATING -> NOT_PRESENT + */ +@VintfStability +@Backing(type="int") +enum CameraDeviceStatus { + /** + * The camera device is not currently connected, and trying to reference it + * in provider method calls must return status code ILLEGAL_ARGUMENT. + * + */ + NOT_PRESENT = 0, + /** + * The camera device is connected, and opening it is possible, as long as + * sufficient resources are available. + * + * By default, the framework must assume all devices returned by + * ICameraProvider::getCameraIdList() are in this state. + */ + PRESENT = 1, + /** + * The camera device is connected, but it is undergoing enumeration and + * startup, and so opening the device must return CAMERA_IN_USE. + * + * Attempting to call ICameraProvider::getCameraCharacteristics() must + * succeed, however. + */ + ENUMERATING = 2, +} diff --git a/camera/common/aidl/android/hardware/camera/common/CameraMetadataType.aidl b/camera/common/aidl/android/hardware/camera/common/CameraMetadataType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..522bf9c32f038734e9514a949d3c15ba4d073c50 --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/CameraMetadataType.aidl @@ -0,0 +1,32 @@ +/* + * 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 android.hardware.camera.common; + +/** + * Camera metadata type - duplicated from VNDK libcamera_metadata for vendor tag + * definitions. + */ +@VintfStability +@Backing(type="int") +enum CameraMetadataType { + BYTE = 0, + INT32 = 1, + FLOAT = 2, + INT64 = 3, + DOUBLE = 4, + RATIONAL = 5, +} diff --git a/camera/common/aidl/android/hardware/camera/common/CameraResourceCost.aidl b/camera/common/aidl/android/hardware/camera/common/CameraResourceCost.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a471c994de14d38d545b9a7da4be815d4f38872f --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/CameraResourceCost.aidl @@ -0,0 +1,172 @@ +/* + * 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 android.hardware.camera.common; + +/** + * CameraResourceCost: + * + * Structure defining the abstract resource cost of opening a camera device, + * and any usage conflicts between multiple camera devices. + * + * Obtainable via ICameraDevice::getResourceCost() + */ +@VintfStability +parcelable CameraResourceCost { + /** + * The total resource "cost" of using this camera, represented as an integer + * value in the range [0, 100] where 100 represents total usage of the + * shared resource that is the limiting bottleneck of the camera subsystem. + * This may be a very rough estimate, and is used as a hint to the camera + * service to determine when to disallow multiple applications from + * simultaneously opening different cameras advertised by the camera + * service. + * + * The camera service must be able to simultaneously open and use any + * combination of camera devices exposed by the HAL where the sum of + * the resource costs of these cameras is <= 100. For determining cost, + * each camera device must be assumed to be configured and operating at + * the maximally resource-consuming framerate and stream size settings + * available in the configuration settings exposed for that device through + * the camera metadata. + * + * The camera service may still attempt to simultaneously open combinations + * of camera devices with a total resource cost > 100. This may succeed or + * fail. If this succeeds, combinations of configurations that are not + * supported due to resource constraints from having multiple open devices + * must fail during the configure calls. If the total resource cost is <= + * 100, open and configure must never fail for any stream configuration + * settings or other device capabilities that would normally succeed for a + * device when it is the only open camera device. + * + * This field may be used to determine whether background applications are + * allowed to use this camera device while other applications are using + * other camera devices. Note: multiple applications must never be allowed + * by the camera service to simultaneously open the same camera device. + * + * Example use cases: + * + * Ex. 1: Camera Device 0 = Back Camera + * Camera Device 1 = Front Camera + * - Using both camera devices causes a large framerate slowdown due to + * limited ISP bandwidth. + * + * Configuration: + * + * Camera Device 0 - resourceCost = 51 + * conflicting_devices = empty + * Camera Device 1 - resourceCost = 51 + * conflicting_devices = empty + * + * Result: + * + * Since the sum of the resource costs is > 100, if a higher-priority + * application has either device open, no lower-priority applications must + * be allowed by the camera service to open either device. If a + * lower-priority application is using a device that a higher-priority + * subsequently attempts to open, the lower-priority application must be + * forced to disconnect the device. + * + * If the highest-priority application chooses, it may still attempt to + * open both devices (since these devices are not listed as conflicting in + * the conflicting_devices fields), but usage of these devices may fail in + * the open or configure calls. + * + * Ex. 2: Camera Device 0 = Left Back Camera + * Camera Device 1 = Right Back Camera + * Camera Device 2 = Combined stereo camera using both right and left + * back camera sensors used by devices 0, and 1 + * Camera Device 3 = Front Camera + * - Due to do hardware constraints, up to two cameras may be open at + * once. The combined stereo camera may never be used at the same time + * as either of the two back camera devices (device 0, 1), and typically + * requires too much bandwidth to use at the same time as the front + * camera (device 3). + * + * Configuration: + * + * Camera Device 0 - resourceCost = 50 + * conflicting_devices = { 2 } + * Camera Device 1 - resourceCost = 50 + * conflicting_devices = { 2 } + * Camera Device 2 - resourceCost = 100 + * conflicting_devices = { 0, 1 } + * Camera Device 3 - resourceCost = 50 + * conflicting_devices = empty + * + * Result: + * + * Based on the conflicting_devices fields, the camera service guarantees + * that the following sets of open devices must never be allowed: { 1, 2 + * }, { 0, 2 }. + * + * Based on the resourceCost fields, if a high-priority foreground + * application is using camera device 0, a background application would be + * allowed to open camera device 1 or 3 (but would be forced to disconnect + * it again if the foreground application opened another device). + * + * The highest priority application may still attempt to simultaneously + * open devices 0, 2, and 3, but the HAL may fail in open or configure + * calls for this combination. + * + * Ex. 3: Camera Device 0 = Back Camera + * Camera Device 1 = Front Camera + * Camera Device 2 = Low-power Front Camera that uses the same sensor + * as device 1, but only exposes image stream + * resolutions that can be used in low-power mode + * - Using both front cameras (device 1, 2) at the same time is impossible + * due a shared physical sensor. Using the back and "high-power" front + * camera (device 1) may be impossible for some stream configurations due + * to hardware limitations, but the "low-power" front camera option may + * always be used as it has special dedicated hardware. + * + * Configuration: + * + * Camera Device 0 - resourceCost = 100 + * conflicting_devices = empty + * Camera Device 1 - resourceCost = 100 + * conflicting_devices = { 2 } + * Camera Device 2 - resourceCost = 0 + * conflicting_devices = { 1 } + * Result: + * + * Based on the conflicting_devices fields, the camera service guarantees + * that the following sets of open devices must never be allowed: + * { 1, 2 }. + * + * Based on the resourceCost fields, only the highest priority application + * may attempt to open both device 0 and 1 at the same time. If a + * higher-priority application is not using device 1 or 2, a low-priority + * background application may open device 2 (but must be forced to + * disconnect it if a higher-priority application subsequently opens + * device 1 or 2). + */ + int resourceCost; + /** + * An array of camera device IDs indicating other devices that cannot be + * simultaneously opened while this camera device is in use. + * + * This field is intended to be used to indicate that this camera device + * is a composite of several other camera devices, or otherwise has + * hardware dependencies that prohibit simultaneous usage. If there are no + * dependencies, an empty list may be returned to indicate this. + * + * The camera service must never simultaneously open any of the devices + * in this list while this camera device is open. + * + */ + String[] conflictingDevices; +} diff --git a/camera/common/aidl/android/hardware/camera/common/Status.aidl b/camera/common/aidl/android/hardware/camera/common/Status.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4341d40be625ac5d63eccc7bca58ed180a9d73a6 --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/Status.aidl @@ -0,0 +1,60 @@ +/* + * 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 android.hardware.camera.common; + +/** + * Common enumeration and structure definitions for all HALs under + * android.hardware.camera + * + * + * Status codes for camera HAL method service specific errors. + * + */ +@VintfStability +@Backing(type="int") +enum Status { + /** + * Method call succeeded + */ + OK = 0, + /** + * One of the arguments to the method call is invalid. For example, + * the camera ID is unknown. + */ + ILLEGAL_ARGUMENT, + /** + * The specified camera device is already in use + */ + CAMERA_IN_USE, + /** + * The HAL cannot support more simultaneous cameras in use. + */ + MAX_CAMERAS_IN_USE, + /** + * The specified camera device does not support this operation. + */ + OPERATION_NOT_SUPPORTED, + /** + * This camera device is no longer connected or otherwise available for use + */ + CAMERA_DISCONNECTED, + /** + * The HAL has encountered an internal error and cannot complete the + * request. + */ + INTERNAL_ERROR, +} diff --git a/camera/common/aidl/android/hardware/camera/common/TagBoundaryId.aidl b/camera/common/aidl/android/hardware/camera/common/TagBoundaryId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6c4ef3c0ff7de9824b8ace4dfa9c76c387418e98 --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/TagBoundaryId.aidl @@ -0,0 +1,24 @@ +/* + * 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 android.hardware.camera.common; + +@VintfStability +@Backing(type="long") +enum TagBoundaryId { + AOSP = 0x0, + VENDOR = 0x80000000L, +} diff --git a/camera/common/aidl/android/hardware/camera/common/TorchModeStatus.aidl b/camera/common/aidl/android/hardware/camera/common/TorchModeStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..42a8816a6c876e61266e86835779ede802a7e754 --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/TorchModeStatus.aidl @@ -0,0 +1,104 @@ +/* + * 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 android.hardware.camera.common; + +/** + * TorchModeStatus: + * + * The current status of the torch mode on a given camera device, sent by a + * camera provider HAL via the ICameraProviderCallback::TorchModeStatusChange() + * call. + * + * The torch mode status of a camera device is applicable only when the camera + * device is present. The camera service must not call + * ICameraProvider::setTorchMode() to turn on torch mode of a camera device if + * the camera device is not present. At camera service startup time, the + * framework must assume torch modes are in the AVAILABLE_OFF state if the + * camera device is present and the camera characteristics entry + * android.flash.info.available is reported as true via + * ICameraProvider::getCameraCharacteristics() call. The same is assumed for + * external camera devices when they are initially connected. + * + * The camera service requires the following behaviors from the camera provider + * HAL when a camera device's status changes: + * + * 1. A previously-disconnected camera device becomes connected. After + * ICameraProviderCallback::CameraDeviceStatusChange() is invoked to inform + * the camera service that the camera device is present, the framework must + * assume the camera device's torch mode is in AVAILABLE_OFF state if it + * has a flash unit. The camera provider HAL does not need to invoke + * ICameraProviderCallback::TorchModeStatusChange() unless the flash unit + * is unavailable to use by ICameraProvider::setTorchMode(). + * + * 2. A previously-connected camera becomes disconnected. After + * ICameraProviderCallback::CameraDeviceStatusChange() is invoked to inform + * the camera service that the camera device is not present, the framework + * must not call ICameraProvider::setTorchMode() for the disconnected camera + * device until it is connected again. The camera provider HAL does not + * need to invoke ICameraProviderCallback::TorchModeStatusChange() + * separately to inform that the flash unit has become NOT_AVAILABLE. + * + * 3. openCameraDevice() or openCameraDeviceVersion() is called to open a + * camera device. The camera provider HAL must invoke + * ICameraProviderCallback::TorchModeStatusChange() for all flash units + * that have entered NOT_AVAILABLE state and can not be turned on by + * calling ICameraProvider::setTorchMode() due to this open() call. + * openCameraDevice() must not trigger AVAILABLE_OFF before NOT_AVAILABLE + * for all flash units that have become unavailable. + * + * 4. ICameraDevice.close() is called to close a camera device. The camera + * provider HAL must call ICameraProviderCallback::torchModeStatusChange() + * for all flash units that have now entered the AVAILABLE_OFF state and + * can be turned on by calling ICameraProvider::setTorchMode() again because + * of sufficient new camera resources being freed up by this close() call. + * + * Note that the camera service calling ICameraProvider::setTorchMode() + * successfully must trigger AVAILABLE_OFF or AVAILABLE_ON callback for the + * given camera device. Additionally it must trigger AVAILABLE_OFF callbacks + * for other previously-on torch modes if HAL cannot keep multiple devices' + * flashlights on simultaneously. + */ +@VintfStability +@Backing(type="int") +enum TorchModeStatus { + /** + * The flash unit is no longer available and the torch mode can not be + * turned on by calling setTorchMode(). If the torch mode was AVAILABLE_ON, + * the flashlight must be turned off by the provider HAL before the provider + * HAL calls torchModeStatusChange(). + */ + NOT_AVAILABLE = 0, + /** + * A torch mode has become off and is available to be turned on via + * ICameraProvider::setTorchMode(). This may happen in the following + * cases: + * 1. After the resources to turn on the torch mode have become available. + * 2. After ICameraProvider::setTorchMode() is called to turn off the torch + * mode. + * 3. After the camera service turned on the torch mode for some other + * camera device and the provider HAL had to turn off the torch modes + * of other camera device(s) that were previously on, due to lack of + * resources to keep them all on. + */ + AVAILABLE_OFF = 1, + /** + * A torch mode has become on and is available to be turned off via + * ICameraProvider::setTorchMode(). This can happen only after + * ICameraProvider::setTorchMode() has been called to turn on the torch mode. + */ + AVAILABLE_ON = 2, +} diff --git a/camera/common/aidl/android/hardware/camera/common/VendorTag.aidl b/camera/common/aidl/android/hardware/camera/common/VendorTag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1de2fbfda28fec7d85fcb05e82a967a4436dd0c2 --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/VendorTag.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.camera.common; + +import android.hardware.camera.common.CameraMetadataType; + +/** + * A single vendor-unique metadata tag. + * The full name of the tag is . + */ +@VintfStability +parcelable VendorTag { + int tagId; + String tagName; + CameraMetadataType tagType; +} diff --git a/camera/common/aidl/android/hardware/camera/common/VendorTagSection.aidl b/camera/common/aidl/android/hardware/camera/common/VendorTagSection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..010eebcbd0e225e64ec98bbaffbbf18f92cc6cf8 --- /dev/null +++ b/camera/common/aidl/android/hardware/camera/common/VendorTagSection.aidl @@ -0,0 +1,28 @@ +/* + * 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 android.hardware.camera.common; + +import android.hardware.camera.common.VendorTag; + +/** + * A set of related vendor tags. + */ +@VintfStability +parcelable VendorTagSection { + String sectionName; + VendorTag[] tags; +} diff --git a/camera/device/3.4/default/ExternalCameraDevice.cpp b/camera/device/3.4/default/ExternalCameraDevice.cpp index 677b4963246e90ba49d97b85f459cc3a877686d4..311c688a2cb128a3b59a47fd02bc5ff018ca8424 100644 --- a/camera/device/3.4/default/ExternalCameraDevice.cpp +++ b/camera/device/3.4/default/ExternalCameraDevice.cpp @@ -413,8 +413,8 @@ status_t ExternalCameraDevice::initDefaultCharsKeys( const uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY; UPDATE(ANDROID_SCALER_CROPPING_TYPE, &croppingType, 1); - const int32_t testPatternModes[] = { - ANDROID_SENSOR_TEST_PATTERN_MODE_OFF}; + const int32_t testPatternModes[] = {ANDROID_SENSOR_TEST_PATTERN_MODE_OFF, + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR}; UPDATE(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, testPatternModes, ARRAY_SIZE(testPatternModes)); diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp index 5f8674219cbe127d42bd4210536de99ed738a1fe..ca7186b18db6a4460524fa2b118e51728060578e 100644 --- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp +++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp @@ -1462,14 +1462,50 @@ bool ExternalCameraDeviceSession::OutputThread::threadLoop() { return onDeviceError("%s: V4L2 buffer map failed", __FUNCTION__); } + // Process camera mute state + auto testPatternMode = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_MODE); + if (testPatternMode.count == 1) { + if (mCameraMuted != (testPatternMode.data.u8[0] != ANDROID_SENSOR_TEST_PATTERN_MODE_OFF)) { + mCameraMuted = !mCameraMuted; + // Get solid color for test pattern, if any was set + if (testPatternMode.data.u8[0] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) { + auto entry = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_DATA); + if (entry.count == 4) { + // Update the mute frame if the pattern color has changed + if (memcmp(entry.data.i32, mTestPatternData, sizeof(mTestPatternData)) != 0) { + memcpy(mTestPatternData, entry.data.i32, sizeof(mTestPatternData)); + // Fill the mute frame with the solid color, use only 8 MSB of RGGB as RGB + for (int i = 0; i < mMuteTestPatternFrame.size(); i += 3) { + mMuteTestPatternFrame[i] = entry.data.i32[0] >> 24; + mMuteTestPatternFrame[i + 1] = entry.data.i32[1] >> 24; + mMuteTestPatternFrame[i + 2] = entry.data.i32[3] >> 24; + } + } + } + } + } + } + // TODO: in some special case maybe we can decode jpg directly to gralloc output? if (req->frameIn->mFourcc == V4L2_PIX_FMT_MJPEG) { ATRACE_BEGIN("MJPGtoI420"); - int res = libyuv::MJPGToI420( - inData, inDataSize, static_cast(mYu12FrameLayout.y), mYu12FrameLayout.yStride, - static_cast(mYu12FrameLayout.cb), mYu12FrameLayout.cStride, - static_cast(mYu12FrameLayout.cr), mYu12FrameLayout.cStride, - mYu12Frame->mWidth, mYu12Frame->mHeight, mYu12Frame->mWidth, mYu12Frame->mHeight); + int res = 0; + if (mCameraMuted) { + res = libyuv::ConvertToI420( + mMuteTestPatternFrame.data(), mMuteTestPatternFrame.size(), + static_cast(mYu12FrameLayout.y), mYu12FrameLayout.yStride, + static_cast(mYu12FrameLayout.cb), mYu12FrameLayout.cStride, + static_cast(mYu12FrameLayout.cr), mYu12FrameLayout.cStride, 0, 0, + mYu12Frame->mWidth, mYu12Frame->mHeight, mYu12Frame->mWidth, + mYu12Frame->mHeight, libyuv::kRotate0, libyuv::FOURCC_RAW); + } else { + res = libyuv::MJPGToI420( + inData, inDataSize, static_cast(mYu12FrameLayout.y), + mYu12FrameLayout.yStride, static_cast(mYu12FrameLayout.cb), + mYu12FrameLayout.cStride, static_cast(mYu12FrameLayout.cr), + mYu12FrameLayout.cStride, mYu12Frame->mWidth, mYu12Frame->mHeight, + mYu12Frame->mWidth, mYu12Frame->mHeight); + } ATRACE_END(); if (res != 0) { @@ -1670,6 +1706,9 @@ Status ExternalCameraDeviceSession::OutputThread::allocateIntermediateBuffers( } } + // Allocate mute test pattern frame + mMuteTestPatternFrame.resize(mYu12Frame->mWidth * mYu12Frame->mHeight * 3); + mBlobBufferSize = blobBufferSize; return Status::OK; } @@ -1679,6 +1718,7 @@ void ExternalCameraDeviceSession::OutputThread::clearIntermediateBuffers() { mYu12Frame.clear(); mYu12ThumbFrame.clear(); mIntermediateBuffers.clear(); + mMuteTestPatternFrame.clear(); mBlobBufferSize = 0; } diff --git a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h index 180f0c155ad5036d9fe73c296d06ecf081ffdfd0..184c16e591171b566690cf49f77da2fa51395756 100644 --- a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h +++ b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h @@ -181,6 +181,9 @@ struct ExternalCameraDeviceSession : public virtual RefBase, std::unordered_map, SizeHasher> mScaledYu12Frames; YCbCrLayout mYu12FrameLayout; YCbCrLayout mYu12ThumbFrameLayout; + std::vector mMuteTestPatternFrame; + uint32_t mTestPatternData[4] = {0, 0, 0, 0}; + bool mCameraMuted = false; uint32_t mBlobBufferSize = 0; // 0 -> HAL derive buffer size, else: use given size std::string mExifMake; diff --git a/camera/device/3.7/ICameraInjectionSession.hal b/camera/device/3.7/ICameraInjectionSession.hal index f5797c3b175b978e1e0bf9d7dfdb2540e884ca85..9be9b2548b1f78ba1057ef52c5111b0303803105 100644 --- a/camera/device/3.7/ICameraInjectionSession.hal +++ b/camera/device/3.7/ICameraInjectionSession.hal @@ -24,7 +24,10 @@ import @3.6::HalStreamConfiguration; import @3.7::ICameraDeviceSession; /** - * Injection Camera device active session interface. + * Injection camera device active session interface. + * + * Note that this is implemented on a special camera injection hal, if it is a + * general camera hal, it is not necessary to implement this interface. * * When an external camera is injected to replace the internal camera session, the * injection session will be established in camera framework, and then diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..365a5ff07f0259e8bd7b651d0c725656c0f87103 --- /dev/null +++ b/camera/device/aidl/Android.bp @@ -0,0 +1,44 @@ +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"], +} + +aidl_interface { + name: "android.hardware.camera.device", + vendor_available: true, + srcs: ["android/hardware/camera/device/*.aidl"], + stability: "vintf", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.camera.common", + "android.hardware.camera.metadata", + "android.hardware.graphics.common", + ], + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.camera.common-V1", + "android.hardware.camera.metadata-V1", + "android.hardware.graphics.common-V3", + ], + }, + ], + +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/.hash b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..4405ef5e1eef2ea90c999f2d039df10535abb121 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/.hash @@ -0,0 +1 @@ +ef5889d8da1473ff5dfc481b9ce32a3f173ea048 diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferCache.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferCache.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9439172d6b02b44080432cd5893e63edef4eb70d --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferCache.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable BufferCache { + int streamId; + long bufferId; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c40a24aa79a3473cff4249dd80bc52b769f93e6e --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferRequest.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable BufferRequest { + int streamId; + int numBuffersRequested; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferRequestStatus.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferRequestStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..72fb61ba29ee632bdc0e8f7e3e4481b87e67d2ff --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferRequestStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum BufferRequestStatus { + OK = 0, + FAILED_PARTIAL = 1, + FAILED_CONFIGURING = 2, + FAILED_ILLEGAL_ARGUMENTS = 3, + FAILED_UNKNOWN = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferStatus.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..43a2b35e74a38664fcf80b1a6fbc79fbc6b9ad22 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/BufferStatus.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum BufferStatus { + OK = 0, + ERROR = 1, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraBlob.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraBlob.aidl new file mode 100644 index 0000000000000000000000000000000000000000..520181c87fc6add1341aba22240ace48f1e13299 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraBlob.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CameraBlob { + android.hardware.camera.device.CameraBlobId blobId; + int blobSizeBytes; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraBlobId.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraBlobId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..632499d55d4fafe0858ad10771f622d95dcc4803 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraBlobId.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum CameraBlobId { + JPEG = 255, + JPEG_APP_SEGMENTS = 256, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraMetadata.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b96d69e1b8a1b29d8585d290fe35e1c5816ee9d4 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraMetadata.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CameraMetadata { + byte[] metadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraOfflineSessionInfo.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraOfflineSessionInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1ad8e115c80c788bfdc93025e48dd7bd94bf02a4 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CameraOfflineSessionInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CameraOfflineSessionInfo { + android.hardware.camera.device.OfflineStream[] offlineStreams; + android.hardware.camera.device.OfflineRequest[] offlineRequests; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CaptureRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CaptureRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6b5b256571e8f080b6beeee150b868110c3fb902 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CaptureRequest.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CaptureRequest { + int frameNumber; + long fmqSettingsSize; + android.hardware.camera.device.CameraMetadata settings; + android.hardware.camera.device.StreamBuffer inputBuffer; + int inputWidth; + int inputHeight; + android.hardware.camera.device.StreamBuffer[] outputBuffers; + android.hardware.camera.device.PhysicalCameraSetting[] physicalCameraSettings; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CaptureResult.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CaptureResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a820e2c4633d7a16ab8450925346a76c11fa47cb --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/CaptureResult.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CaptureResult { + int frameNumber; + long fmqResultSize; + android.hardware.camera.device.CameraMetadata result; + android.hardware.camera.device.StreamBuffer[] outputBuffers; + android.hardware.camera.device.StreamBuffer inputBuffer; + int partialResult; + android.hardware.camera.device.PhysicalCameraMetadata[] physicalCameraMetadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ErrorCode.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ErrorCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2f9887a7a521636a81e7b5ba9869b1c66fb4091e --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ErrorCode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum ErrorCode { + ERROR_DEVICE = 1, + ERROR_REQUEST = 2, + ERROR_RESULT = 3, + ERROR_BUFFER = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ErrorMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ErrorMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b2e9512bbfd10e8a971caf3a8b92428f1661b000 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ErrorMsg.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable ErrorMsg { + int frameNumber; + int errorStreamId; + android.hardware.camera.device.ErrorCode errorCode; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/HalStream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/HalStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a5784bcf32eab4592abe0b8669cb1aa2472ef563 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/HalStream.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable HalStream { + int id; + android.hardware.graphics.common.PixelFormat overrideFormat; + android.hardware.graphics.common.BufferUsage producerUsage; + android.hardware.graphics.common.BufferUsage consumerUsage; + int maxBuffers; + android.hardware.graphics.common.Dataspace overrideDataSpace; + String physicalCameraId; + boolean supportOffline; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDevice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..51c60676beefbc89baa0a0cd7e2bddad3d7ea216 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDevice.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraDevice { + android.hardware.camera.device.CameraMetadata getCameraCharacteristics(); + android.hardware.camera.device.CameraMetadata getPhysicalCameraCharacteristics(in String physicalCameraId); + android.hardware.camera.common.CameraResourceCost getResourceCost(); + boolean isStreamCombinationSupported(in android.hardware.camera.device.StreamConfiguration streams); + android.hardware.camera.device.ICameraDeviceSession open(in android.hardware.camera.device.ICameraDeviceCallback callback); + android.hardware.camera.device.ICameraInjectionSession openInjectionSession(in android.hardware.camera.device.ICameraDeviceCallback callback); + void setTorchMode(boolean on); + void turnOnTorchWithStrengthLevel(int torchStrength); + int getTorchStrengthLevel(); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDeviceCallback.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDeviceCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7b79c6c87ae1aeef9a44db990a74e65d2fe11e96 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDeviceCallback.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraDeviceCallback { + void notify(in android.hardware.camera.device.NotifyMsg[] msgs); + void processCaptureResult(in android.hardware.camera.device.CaptureResult[] results); + android.hardware.camera.device.BufferRequestStatus requestStreamBuffers(in android.hardware.camera.device.BufferRequest[] bufReqs, out android.hardware.camera.device.StreamBufferRet[] buffers); + void returnStreamBuffers(in android.hardware.camera.device.StreamBuffer[] buffers); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDeviceSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDeviceSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2196d37a6c6f051c2cd9988682875d5c413de3dc --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraDeviceSession.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraDeviceSession { + void close(); + android.hardware.camera.device.HalStream[] configureStreams(in android.hardware.camera.device.StreamConfiguration requestedConfiguration); + android.hardware.camera.device.CameraMetadata constructDefaultRequestSettings(in android.hardware.camera.device.RequestTemplate type); + void flush(); + android.hardware.common.fmq.MQDescriptor getCaptureRequestMetadataQueue(); + android.hardware.common.fmq.MQDescriptor getCaptureResultMetadataQueue(); + boolean isReconfigurationRequired(in android.hardware.camera.device.CameraMetadata oldSessionParams, in android.hardware.camera.device.CameraMetadata newSessionParams); + int processCaptureRequest(in android.hardware.camera.device.CaptureRequest[] requests, in android.hardware.camera.device.BufferCache[] cachesToRemove); + oneway void signalStreamFlush(in int[] streamIds, in int streamConfigCounter); + android.hardware.camera.device.ICameraOfflineSession switchToOffline(in int[] streamsToKeep, out android.hardware.camera.device.CameraOfflineSessionInfo offlineSessionInfo); + void repeatingRequestEnd(in int frameNumber, in int[] streamIds); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraInjectionSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraInjectionSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..80f74f331cec4b9b697f769edfd94c634f025a5a --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraInjectionSession.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraInjectionSession { + void configureInjectionStreams(in android.hardware.camera.device.StreamConfiguration requestedConfiguration, in android.hardware.camera.device.CameraMetadata characteristics); + android.hardware.camera.device.ICameraDeviceSession getCameraDeviceSession(); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraOfflineSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraOfflineSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..727d856fc8c25e9e6c362bbf6e8dde028e032a6b --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ICameraOfflineSession.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraOfflineSession { + void close(); + android.hardware.common.fmq.MQDescriptor getCaptureResultMetadataQueue(); + void setCallback(in android.hardware.camera.device.ICameraDeviceCallback cb); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/NotifyMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/NotifyMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3ad7e52e6395896c9676c9ed765e36b648abf90b --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/NotifyMsg.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +union NotifyMsg { + android.hardware.camera.device.ErrorMsg error; + android.hardware.camera.device.ShutterMsg shutter; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/OfflineRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/OfflineRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e6f29d6fc3771e31334aa8e9da55c865eb46d51 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/OfflineRequest.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable OfflineRequest { + int frameNumber; + int[] pendingStreams; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/OfflineStream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/OfflineStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..54cb1fed0ebee855a6f94223ff58b87e03061e78 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/OfflineStream.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable OfflineStream { + int id; + int numOutstandingBuffers; + long[] circulatingBufferIds; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/PhysicalCameraMetadata.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/PhysicalCameraMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3d66ab87138f0189982ee4fd8658feabc9acc3b6 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/PhysicalCameraMetadata.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable PhysicalCameraMetadata { + long fmqMetadataSize; + String physicalCameraId; + android.hardware.camera.device.CameraMetadata metadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/PhysicalCameraSetting.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/PhysicalCameraSetting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6c241d453df681bc42d9ae52aa55160c0f530f0 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/PhysicalCameraSetting.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable PhysicalCameraSetting { + long fmqSettingsSize; + String physicalCameraId; + android.hardware.camera.device.CameraMetadata settings; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/RequestTemplate.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/RequestTemplate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b70b8997d9856747672e5c2e5b0441a8f002309b --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/RequestTemplate.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum RequestTemplate { + PREVIEW = 1, + STILL_CAPTURE = 2, + VIDEO_RECORD = 3, + VIDEO_SNAPSHOT = 4, + ZERO_SHUTTER_LAG = 5, + MANUAL = 6, + VENDOR_TEMPLATE_START = 1073741824, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ShutterMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ShutterMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ce059ac0db4d71bcb08dbd39071da939623aeddb --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/ShutterMsg.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable ShutterMsg { + int frameNumber; + long timestamp; + long readoutTimestamp; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/Stream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d2f295a1601350b53058e29d99b6357c5a10fb93 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/Stream.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable Stream { + int id; + android.hardware.camera.device.StreamType streamType; + int width; + int height; + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.BufferUsage usage; + android.hardware.graphics.common.Dataspace dataSpace; + android.hardware.camera.device.StreamRotation rotation; + String physicalCameraId; + int bufferSize; + int groupId; + android.hardware.camera.metadata.SensorPixelMode[] sensorPixelModesUsed; + android.hardware.camera.metadata.RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile; + android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBuffer.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8fabf032db469ae6181d9fc0a88c16ff869a3c1e --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBuffer.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable StreamBuffer { + int streamId; + long bufferId; + android.hardware.common.NativeHandle buffer; + android.hardware.camera.device.BufferStatus status; + android.hardware.common.NativeHandle acquireFence; + android.hardware.common.NativeHandle releaseFence; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBufferRequestError.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBufferRequestError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f4501496359dbb852077a6daea8994805e669053 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBufferRequestError.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamBufferRequestError { + NO_BUFFER_AVAILABLE = 1, + MAX_BUFFER_EXCEEDED = 2, + STREAM_DISCONNECTED = 3, + UNKNOWN_ERROR = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBufferRet.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBufferRet.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3998cc34fad78f095abf6f1e1efc87a591fc84d8 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBufferRet.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable StreamBufferRet { + int streamId; + android.hardware.camera.device.StreamBuffersVal val; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBuffersVal.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBuffersVal.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bebc9fcced11219fe675ba2d87a662382f1acb4d --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamBuffersVal.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +union StreamBuffersVal { + android.hardware.camera.device.StreamBufferRequestError error = android.hardware.camera.device.StreamBufferRequestError.UNKNOWN_ERROR; + android.hardware.camera.device.StreamBuffer[] buffers; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamConfiguration.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f3405780befdb834446fef9b3d993a66f1f66a48 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamConfiguration.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable StreamConfiguration { + android.hardware.camera.device.Stream[] streams; + android.hardware.camera.device.StreamConfigurationMode operationMode; + android.hardware.camera.device.CameraMetadata sessionParams; + int streamConfigCounter; + boolean multiResolutionInputImage; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamConfigurationMode.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamConfigurationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bdef41209dc006fbc2903b0da632e7d3b91f8a98 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamConfigurationMode.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamConfigurationMode { + NORMAL_MODE = 0, + CONSTRAINED_HIGH_SPEED_MODE = 1, + VENDOR_MODE_0 = 32768, + VENDOR_MODE_1 = 32769, + VENDOR_MODE_2 = 32770, + VENDOR_MODE_3 = 32771, + VENDOR_MODE_4 = 32772, + VENDOR_MODE_5 = 32773, + VENDOR_MODE_6 = 32774, + VENDOR_MODE_7 = 32775, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamRotation.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamRotation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2ef4274f88b287624e516d583b3392f968016559 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamRotation.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamRotation { + ROTATION_0 = 0, + ROTATION_90 = 1, + ROTATION_180 = 2, + ROTATION_270 = 3, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamType.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0f13fe8be708112dc6819c2134576ecb07769b57 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/1/android/hardware/camera/device/StreamType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamType { + OUTPUT = 0, + INPUT = 1, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferCache.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferCache.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9439172d6b02b44080432cd5893e63edef4eb70d --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferCache.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable BufferCache { + int streamId; + long bufferId; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c40a24aa79a3473cff4249dd80bc52b769f93e6e --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferRequest.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable BufferRequest { + int streamId; + int numBuffersRequested; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferRequestStatus.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferRequestStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..72fb61ba29ee632bdc0e8f7e3e4481b87e67d2ff --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferRequestStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum BufferRequestStatus { + OK = 0, + FAILED_PARTIAL = 1, + FAILED_CONFIGURING = 2, + FAILED_ILLEGAL_ARGUMENTS = 3, + FAILED_UNKNOWN = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferStatus.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..43a2b35e74a38664fcf80b1a6fbc79fbc6b9ad22 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/BufferStatus.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum BufferStatus { + OK = 0, + ERROR = 1, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlob.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlob.aidl new file mode 100644 index 0000000000000000000000000000000000000000..520181c87fc6add1341aba22240ace48f1e13299 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlob.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CameraBlob { + android.hardware.camera.device.CameraBlobId blobId; + int blobSizeBytes; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlobId.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlobId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..632499d55d4fafe0858ad10771f622d95dcc4803 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlobId.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum CameraBlobId { + JPEG = 255, + JPEG_APP_SEGMENTS = 256, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraMetadata.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b96d69e1b8a1b29d8585d290fe35e1c5816ee9d4 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraMetadata.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CameraMetadata { + byte[] metadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraOfflineSessionInfo.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraOfflineSessionInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1ad8e115c80c788bfdc93025e48dd7bd94bf02a4 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraOfflineSessionInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CameraOfflineSessionInfo { + android.hardware.camera.device.OfflineStream[] offlineStreams; + android.hardware.camera.device.OfflineRequest[] offlineRequests; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CaptureRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CaptureRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6b5b256571e8f080b6beeee150b868110c3fb902 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CaptureRequest.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CaptureRequest { + int frameNumber; + long fmqSettingsSize; + android.hardware.camera.device.CameraMetadata settings; + android.hardware.camera.device.StreamBuffer inputBuffer; + int inputWidth; + int inputHeight; + android.hardware.camera.device.StreamBuffer[] outputBuffers; + android.hardware.camera.device.PhysicalCameraSetting[] physicalCameraSettings; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CaptureResult.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CaptureResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a820e2c4633d7a16ab8450925346a76c11fa47cb --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CaptureResult.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable CaptureResult { + int frameNumber; + long fmqResultSize; + android.hardware.camera.device.CameraMetadata result; + android.hardware.camera.device.StreamBuffer[] outputBuffers; + android.hardware.camera.device.StreamBuffer inputBuffer; + int partialResult; + android.hardware.camera.device.PhysicalCameraMetadata[] physicalCameraMetadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ErrorCode.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ErrorCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2f9887a7a521636a81e7b5ba9869b1c66fb4091e --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ErrorCode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum ErrorCode { + ERROR_DEVICE = 1, + ERROR_REQUEST = 2, + ERROR_RESULT = 3, + ERROR_BUFFER = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ErrorMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ErrorMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b2e9512bbfd10e8a971caf3a8b92428f1661b000 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ErrorMsg.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable ErrorMsg { + int frameNumber; + int errorStreamId; + android.hardware.camera.device.ErrorCode errorCode; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/HalStream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/HalStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a5784bcf32eab4592abe0b8669cb1aa2472ef563 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/HalStream.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable HalStream { + int id; + android.hardware.graphics.common.PixelFormat overrideFormat; + android.hardware.graphics.common.BufferUsage producerUsage; + android.hardware.graphics.common.BufferUsage consumerUsage; + int maxBuffers; + android.hardware.graphics.common.Dataspace overrideDataSpace; + String physicalCameraId; + boolean supportOffline; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDevice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..51c60676beefbc89baa0a0cd7e2bddad3d7ea216 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDevice.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraDevice { + android.hardware.camera.device.CameraMetadata getCameraCharacteristics(); + android.hardware.camera.device.CameraMetadata getPhysicalCameraCharacteristics(in String physicalCameraId); + android.hardware.camera.common.CameraResourceCost getResourceCost(); + boolean isStreamCombinationSupported(in android.hardware.camera.device.StreamConfiguration streams); + android.hardware.camera.device.ICameraDeviceSession open(in android.hardware.camera.device.ICameraDeviceCallback callback); + android.hardware.camera.device.ICameraInjectionSession openInjectionSession(in android.hardware.camera.device.ICameraDeviceCallback callback); + void setTorchMode(boolean on); + void turnOnTorchWithStrengthLevel(int torchStrength); + int getTorchStrengthLevel(); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceCallback.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7b79c6c87ae1aeef9a44db990a74e65d2fe11e96 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceCallback.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraDeviceCallback { + void notify(in android.hardware.camera.device.NotifyMsg[] msgs); + void processCaptureResult(in android.hardware.camera.device.CaptureResult[] results); + android.hardware.camera.device.BufferRequestStatus requestStreamBuffers(in android.hardware.camera.device.BufferRequest[] bufReqs, out android.hardware.camera.device.StreamBufferRet[] buffers); + void returnStreamBuffers(in android.hardware.camera.device.StreamBuffer[] buffers); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2196d37a6c6f051c2cd9988682875d5c413de3dc --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraDeviceSession.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraDeviceSession { + void close(); + android.hardware.camera.device.HalStream[] configureStreams(in android.hardware.camera.device.StreamConfiguration requestedConfiguration); + android.hardware.camera.device.CameraMetadata constructDefaultRequestSettings(in android.hardware.camera.device.RequestTemplate type); + void flush(); + android.hardware.common.fmq.MQDescriptor getCaptureRequestMetadataQueue(); + android.hardware.common.fmq.MQDescriptor getCaptureResultMetadataQueue(); + boolean isReconfigurationRequired(in android.hardware.camera.device.CameraMetadata oldSessionParams, in android.hardware.camera.device.CameraMetadata newSessionParams); + int processCaptureRequest(in android.hardware.camera.device.CaptureRequest[] requests, in android.hardware.camera.device.BufferCache[] cachesToRemove); + oneway void signalStreamFlush(in int[] streamIds, in int streamConfigCounter); + android.hardware.camera.device.ICameraOfflineSession switchToOffline(in int[] streamsToKeep, out android.hardware.camera.device.CameraOfflineSessionInfo offlineSessionInfo); + void repeatingRequestEnd(in int frameNumber, in int[] streamIds); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraInjectionSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraInjectionSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..80f74f331cec4b9b697f769edfd94c634f025a5a --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraInjectionSession.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraInjectionSession { + void configureInjectionStreams(in android.hardware.camera.device.StreamConfiguration requestedConfiguration, in android.hardware.camera.device.CameraMetadata characteristics); + android.hardware.camera.device.ICameraDeviceSession getCameraDeviceSession(); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraOfflineSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraOfflineSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..727d856fc8c25e9e6c362bbf6e8dde028e032a6b --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ICameraOfflineSession.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +interface ICameraOfflineSession { + void close(); + android.hardware.common.fmq.MQDescriptor getCaptureResultMetadataQueue(); + void setCallback(in android.hardware.camera.device.ICameraDeviceCallback cb); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/NotifyMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/NotifyMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3ad7e52e6395896c9676c9ed765e36b648abf90b --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/NotifyMsg.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +union NotifyMsg { + android.hardware.camera.device.ErrorMsg error; + android.hardware.camera.device.ShutterMsg shutter; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/OfflineRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/OfflineRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e6f29d6fc3771e31334aa8e9da55c865eb46d51 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/OfflineRequest.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable OfflineRequest { + int frameNumber; + int[] pendingStreams; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/OfflineStream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/OfflineStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..54cb1fed0ebee855a6f94223ff58b87e03061e78 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/OfflineStream.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable OfflineStream { + int id; + int numOutstandingBuffers; + long[] circulatingBufferIds; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/PhysicalCameraMetadata.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/PhysicalCameraMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3d66ab87138f0189982ee4fd8658feabc9acc3b6 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/PhysicalCameraMetadata.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable PhysicalCameraMetadata { + long fmqMetadataSize; + String physicalCameraId; + android.hardware.camera.device.CameraMetadata metadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/PhysicalCameraSetting.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/PhysicalCameraSetting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6c241d453df681bc42d9ae52aa55160c0f530f0 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/PhysicalCameraSetting.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable PhysicalCameraSetting { + long fmqSettingsSize; + String physicalCameraId; + android.hardware.camera.device.CameraMetadata settings; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/RequestTemplate.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/RequestTemplate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b70b8997d9856747672e5c2e5b0441a8f002309b --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/RequestTemplate.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum RequestTemplate { + PREVIEW = 1, + STILL_CAPTURE = 2, + VIDEO_RECORD = 3, + VIDEO_SNAPSHOT = 4, + ZERO_SHUTTER_LAG = 5, + MANUAL = 6, + VENDOR_TEMPLATE_START = 1073741824, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ShutterMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ShutterMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ce059ac0db4d71bcb08dbd39071da939623aeddb --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/ShutterMsg.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable ShutterMsg { + int frameNumber; + long timestamp; + long readoutTimestamp; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d2f295a1601350b53058e29d99b6357c5a10fb93 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable Stream { + int id; + android.hardware.camera.device.StreamType streamType; + int width; + int height; + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.BufferUsage usage; + android.hardware.graphics.common.Dataspace dataSpace; + android.hardware.camera.device.StreamRotation rotation; + String physicalCameraId; + int bufferSize; + int groupId; + android.hardware.camera.metadata.SensorPixelMode[] sensorPixelModesUsed; + android.hardware.camera.metadata.RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile; + android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBuffer.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8fabf032db469ae6181d9fc0a88c16ff869a3c1e --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBuffer.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable StreamBuffer { + int streamId; + long bufferId; + android.hardware.common.NativeHandle buffer; + android.hardware.camera.device.BufferStatus status; + android.hardware.common.NativeHandle acquireFence; + android.hardware.common.NativeHandle releaseFence; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBufferRequestError.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBufferRequestError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f4501496359dbb852077a6daea8994805e669053 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBufferRequestError.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamBufferRequestError { + NO_BUFFER_AVAILABLE = 1, + MAX_BUFFER_EXCEEDED = 2, + STREAM_DISCONNECTED = 3, + UNKNOWN_ERROR = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBufferRet.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBufferRet.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3998cc34fad78f095abf6f1e1efc87a591fc84d8 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBufferRet.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable StreamBufferRet { + int streamId; + android.hardware.camera.device.StreamBuffersVal val; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBuffersVal.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBuffersVal.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bebc9fcced11219fe675ba2d87a662382f1acb4d --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamBuffersVal.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +union StreamBuffersVal { + android.hardware.camera.device.StreamBufferRequestError error = android.hardware.camera.device.StreamBufferRequestError.UNKNOWN_ERROR; + android.hardware.camera.device.StreamBuffer[] buffers; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfiguration.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f3405780befdb834446fef9b3d993a66f1f66a48 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfiguration.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@VintfStability +parcelable StreamConfiguration { + android.hardware.camera.device.Stream[] streams; + android.hardware.camera.device.StreamConfigurationMode operationMode; + android.hardware.camera.device.CameraMetadata sessionParams; + int streamConfigCounter; + boolean multiResolutionInputImage; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfigurationMode.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfigurationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bdef41209dc006fbc2903b0da632e7d3b91f8a98 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfigurationMode.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamConfigurationMode { + NORMAL_MODE = 0, + CONSTRAINED_HIGH_SPEED_MODE = 1, + VENDOR_MODE_0 = 32768, + VENDOR_MODE_1 = 32769, + VENDOR_MODE_2 = 32770, + VENDOR_MODE_3 = 32771, + VENDOR_MODE_4 = 32772, + VENDOR_MODE_5 = 32773, + VENDOR_MODE_6 = 32774, + VENDOR_MODE_7 = 32775, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamRotation.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamRotation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2ef4274f88b287624e516d583b3392f968016559 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamRotation.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamRotation { + ROTATION_0 = 0, + ROTATION_90 = 1, + ROTATION_180 = 2, + ROTATION_270 = 3, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamType.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0f13fe8be708112dc6819c2134576ecb07769b57 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.device; +@Backing(type="int") @VintfStability +enum StreamType { + OUTPUT = 0, + INPUT = 1, +} diff --git a/camera/device/aidl/android/hardware/camera/device/BufferCache.aidl b/camera/device/aidl/android/hardware/camera/device/BufferCache.aidl new file mode 100644 index 0000000000000000000000000000000000000000..660250db24a6a34bea476eaac8504d12101ea5ba --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/BufferCache.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * BufferCache: + * + * A bufferId associated with a certain stream. + * Buffers are passed between camera service and camera HAL via bufferId except + * the first time a new buffer is being passed to HAL in CaptureRequest. Camera + * service and camera HAL therefore need to maintain a cached map of bufferId + * and corresponing native handle. + * + */ +@VintfStability +parcelable BufferCache { + /** + * The ID of the stream this list is associated with. + */ + + int streamId; + /** + * A cached buffer ID associated with streamId. + */ + long bufferId; +} diff --git a/camera/device/aidl/android/hardware/camera/device/BufferRequest.aidl b/camera/device/aidl/android/hardware/camera/device/BufferRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4a26db97df8c5ef3c75beab57d2bff32d5e3dc42 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/BufferRequest.aidl @@ -0,0 +1,24 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +@VintfStability +parcelable BufferRequest { + int streamId; + + int numBuffersRequested; +} diff --git a/camera/device/aidl/android/hardware/camera/device/BufferRequestStatus.aidl b/camera/device/aidl/android/hardware/camera/device/BufferRequestStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0530173f25779433895ec48be3b25cca8acb287d --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/BufferRequestStatus.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +@VintfStability +@Backing(type="int") +enum BufferRequestStatus { + /** + * Method call succeeded and all requested buffers are returned. + */ + OK = 0, + /** + * Method call failed for some streams. Check per stream status for each + * returned StreamBufferRet. + */ + FAILED_PARTIAL = 1, + /** + * Method call failed for all streams and no buffers are returned at all. + * Camera service is about to or is performing configureStreams. HAL must + * wait until next configureStreams call is finished before requesting + * buffers again. + */ + FAILED_CONFIGURING = 2, + /** + * Method call failed for all streams and no buffers are returned at all. + * Failure due to bad BufferRequest input, eg: unknown streamId or repeated + * streamId. + */ + FAILED_ILLEGAL_ARGUMENTS = 3, + /** + * Method call failed for all streams and no buffers are returned at all. + * Failure due to unknown reason, or all streams has individual failing + * reason. For the latter case, check per stream status for each returned + * StreamBufferRet. + */ + FAILED_UNKNOWN = 4, +} diff --git a/camera/device/aidl/android/hardware/camera/device/BufferStatus.aidl b/camera/device/aidl/android/hardware/camera/device/BufferStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9439e703ffa2c91e8c3398970accbaa077d5f349 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/BufferStatus.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * BufferStatus: + * + * The current status of a single stream buffer. + */ +@VintfStability +@Backing(type="int") +enum BufferStatus { + /** + * The buffer is in a normal state, and can be used after waiting on its + * sync fence. + */ + OK = 0, + + /** + * The buffer does not contain valid data, and the data in it must not be + * used. The sync fence must still be waited on before reusing the buffer. + */ + ERROR = 1, +} diff --git a/camera/device/aidl/android/hardware/camera/device/CameraBlob.aidl b/camera/device/aidl/android/hardware/camera/device/CameraBlob.aidl new file mode 100644 index 0000000000000000000000000000000000000000..085efa6a50e2aceae06015c2d0ea2f3f7f5cf58c --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/CameraBlob.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.CameraBlobId; + +@VintfStability +parcelable CameraBlob { + CameraBlobId blobId; + + int blobSizeBytes; +} diff --git a/camera/device/aidl/android/hardware/camera/device/CameraBlobId.aidl b/camera/device/aidl/android/hardware/camera/device/CameraBlobId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8c303d91917e75a60d6f18d002bd1286b4d5de07 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/CameraBlobId.aidl @@ -0,0 +1,67 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * CameraBlob: + * + * Transport header for camera blob types; generally compressed JPEG buffers in + * output streams. + * + * To capture JPEG images, a stream is created using the pixel format + * HAL_PIXEL_FORMAT_BLOB and dataspace HAL_DATASPACE_V0_JFIF. The buffer size + * for the stream is calculated by the framework, based on the static metadata + * field android.jpeg.maxSize. Since compressed JPEG images are of variable + * size, the HAL needs to include the final size of the compressed image using + * this structure inside the output stream buffer. The camera blob ID field must + * be set to CameraBlobId::JPEG. + * + * The transport header must be at the end of the JPEG output stream + * buffer. That means the jpegBlobId must start at byte[buffer_size - + * sizeof(CameraBlob)], where the buffer_size is the size of gralloc + * buffer. Any HAL using this transport header must account for it in + * android.jpeg.maxSize. The JPEG data itself starts at the beginning of the + * buffer and must be blobSize bytes long. + * + * It also supports transport of JPEG APP segments blob, which contains JPEG APP1 to + * APPn (Application Marker) segments as specified in JEITA CP-3451. + * + * To capture a JPEG APP segments blob, a stream is created using the pixel format + * HAL_PIXEL_FORMAT_BLOB and dataspace HAL_DATASPACE_JPEG_APP_SEGMENTS. The buffer + * size for the stream is calculated by the framework, based on the static + * metadata field android.heic.maxAppSegmentsCount, and is assigned to both + * Stream width and Stream bufferSize. Camera framework sets + * Stream height to 1. + * + * Similar to JPEG image, the JPEG APP segment images can be of variable size, + * so the HAL needs to include the final size of all APP segments using this + * structure inside the output stream buffer. The camera blob ID field must be + * set to CameraBlobId::JPEG_APP_SEGMENTS. + * + * The transport header must be at the end of the JPEG APP segments output stream + * buffer. That means the blobId must start at byte[buffer_size - + * sizeof(CameraBlob)], where the buffer_size is the size of gralloc + * buffer. The JPEG APP segments data itself starts at the beginning of the + * buffer and must be blobSize bytes long. + */ +@VintfStability +@Backing(type="int") +enum CameraBlobId { + JPEG = 0x00FF, + + JPEG_APP_SEGMENTS = 0x100, +} diff --git a/camera/device/aidl/android/hardware/camera/device/CameraMetadata.aidl b/camera/device/aidl/android/hardware/camera/device/CameraMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dd8bb545fd207c8c9bbda5cfc96ae17f520a51e4 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/CameraMetadata.aidl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * Wrapper parcelable for CameraMetadata + */ +@VintfStability +parcelable CameraMetadata { + /** + * A serialized metadata buffer created by libcamera_metadata. + * Access by casting to a camera_metadata* and using libcamera_metadata methods + */ + byte[] metadata; +} diff --git a/camera/device/aidl/android/hardware/camera/device/CameraOfflineSessionInfo.aidl b/camera/device/aidl/android/hardware/camera/device/CameraOfflineSessionInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f635fe29f8def0c9d2cc8945ff776a335efb6f79 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/CameraOfflineSessionInfo.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.OfflineRequest; +import android.hardware.camera.device.OfflineStream; + +/** + * CameraOfflineSessionInfo: + * + * Information about pending outputs that's being transferred to an offline + * session from an active session using the + * ICameraDeviceSession#switchToOffline method. + * + */ +@VintfStability +parcelable CameraOfflineSessionInfo { + /** + * Information on what streams will be preserved in offline session. + * Streams not listed here will be removed by camera service after + * switchToOffline call returns. + */ + OfflineStream[] offlineStreams; + + /** + * Information for requests that will be handled by offline session + * Camera service will validate this matches what camera service has on + * record. + */ + OfflineRequest[] offlineRequests; +} diff --git a/camera/device/aidl/android/hardware/camera/device/CaptureRequest.aidl b/camera/device/aidl/android/hardware/camera/device/CaptureRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1dad07a4ac28d0b377c2ae845ead65b7432c8c02 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/CaptureRequest.aidl @@ -0,0 +1,128 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.CameraMetadata; +import android.hardware.camera.device.PhysicalCameraSetting; +import android.hardware.camera.device.StreamBuffer; + +/** + * CaptureRequest: + * + * A single request for image capture/buffer reprocessing, sent to the Camera + * HAL device by the framework in processCaptureRequest(). + * + * The request contains the settings to be used for this capture, and the set of + * output buffers to write the resulting image data in. It may optionally + * contain an input buffer, in which case the request is for reprocessing that + * input buffer instead of capturing a new image with the camera sensor. The + * capture is identified by the frameNumber. + * + * In response, the camera HAL device must send a CaptureResult + * structure asynchronously to the framework, using the processCaptureResult() + * callback. + */ +@VintfStability +parcelable CaptureRequest { + /** + * The frame number is an incrementing integer set by the framework to + * uniquely identify this capture. It needs to be returned in the result + * call, and is also used to identify the request in asynchronous + * notifications sent to ICameraDevice3Callback::notify(). + */ + int frameNumber; + + /** + * If non-zero, read settings from request queue instead + * (see ICameraDeviceSession.getCaptureRequestMetadataQueue). + * If zero, read settings from .settings field. + */ + long fmqSettingsSize; + + /** + * If fmqSettingsSize is zero, + * the settings buffer contains the capture and processing parameters for + * the request. As a special case, an empty settings buffer indicates that + * the settings are identical to the most-recently submitted capture + * request. A empty buffer cannot be used as the first submitted request + * after a configureStreams() call. + * + * This field must be used if fmqSettingsSize is zero. It must not be used + * if fmqSettingsSize is non-zero. + */ + CameraMetadata settings; + + /** + * The input stream buffer to use for this request, if any. + * + * An invalid inputBuffer is signified by a null inputBuffer::buffer, in + * which case the value of all other members of inputBuffer must be ignored. + * + * If inputBuffer is invalid, then the request is for a new capture from the + * imager. If inputBuffer is valid, the request is for reprocessing the + * image contained in inputBuffer, and the HAL must release the inputBuffer + * back to the client in a subsequent processCaptureResult call. + * + * The HAL is required to wait on the acquire sync fence of the input buffer + * before accessing it. + * + */ + StreamBuffer inputBuffer; + /** + * The width and height of the input buffer for this capture request. + * + * These fields will be [0, 0] if no input buffer exists in the capture + * request. + * + * If the stream configuration contains an input stream and has the + * multiResolutionInputImage flag set to true, the camera client may submit a + * reprocessing request with input buffer size different than the + * configured input stream size. In that case, the inputWith and inputHeight + * fields will be the actual size of the input image. + * + * If the stream configuration contains an input stream and the + * multiResolutionInputImage flag is false, the inputWidth and inputHeight must + * match the input stream size. + */ + int inputWidth; + + int inputHeight; + + /** + * An array of at least 1 stream buffers, to be filled with image + * data from this capture/reprocess. The HAL must wait on the acquire fences + * of each stream buffer before writing to them. + * + * The HAL takes ownership of the handles in outputBuffers; the client + * must not access them until they are returned in a CaptureResult. + * + * Any or all of the buffers included here may be brand new in this + * request (having never before seen by the HAL). + */ + StreamBuffer[] outputBuffers; + + /** + * A vector containing individual camera settings for logical camera backed by multiple physical + * devices. In case the vector is empty, Hal should use the settings field. The + * individual settings should only be honored for physical devices that have respective Hal + * stream. Physical devices that have a corresponding Hal stream but don't have attached + * settings here should use the settings field. + * If any of the physical settings in the array are applied on one or more devices, then the + * visual effect on any Hal streams attached to the logical camera is undefined. + */ + PhysicalCameraSetting[] physicalCameraSettings; +} diff --git a/camera/device/aidl/android/hardware/camera/device/CaptureResult.aidl b/camera/device/aidl/android/hardware/camera/device/CaptureResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1522439c0404049ab96302cceed6814d180956b7 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/CaptureResult.aidl @@ -0,0 +1,209 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.CameraMetadata; +import android.hardware.camera.device.PhysicalCameraMetadata; +import android.hardware.camera.device.StreamBuffer; + +/** + * CaptureResult: + * + * The result of a single capture/reprocess by the camera HAL device. This is + * sent to the framework asynchronously with processCaptureResult(), in + * response to a single capture request sent to the HAL with + * processCaptureRequest(). Multiple processCaptureResult() calls may be + * performed by the HAL for each request. + * + * Each call, all with the same frame + * number, may contain some subset of the output buffers, and/or the result + * metadata. + * + * The result structure contains the output metadata from this capture, and the + * set of output buffers that have been/will be filled for this capture. Each + * output buffer may come with a release sync fence that the framework must wait + * on before reading, in case the buffer has not yet been filled by the HAL. + * + * The metadata may be provided multiple times for a single frame number. The + * framework must accumulate together the final result set by combining each + * partial result together into the total result set. + * + * If an input buffer is given in a request, the HAL must return it in one of + * the processCaptureResult calls, and the call may be to just return the + * input buffer, without metadata and output buffers; the sync fences must be + * handled the same way they are done for output buffers. + * + * Performance considerations: + * + * Applications receive these partial results immediately, so sending partial + * results is a highly recommended performance optimization to avoid the total + * pipeline latency before sending the results for what is known very early on + * in the pipeline. + * + * A typical use case might be calculating the AF state halfway through the + * pipeline; by sending the state back to the framework immediately, we get a + * 50% performance increase and perceived responsiveness of the auto-focus. + * + * Physical camera metadata needs to be generated if and only if a + * request is pending on a stream from that physical camera. For example, + * if the processCaptureRequest call doesn't request on physical camera + * streams, the physicalCameraMetadata field of the CaptureResult being returned + * should be an 0-size vector. If the processCaptureRequest call requests on + * streams from one of the physical camera, the physicalCameraMetadata field + * should contain one metadata describing the capture from that physical camera. + * + * For a CaptureResult that contains physical camera metadata, its + * partialResult field must be android.request.partialResultCount. In other + * words, the physicalCameraMetadata must only be contained in a final capture + * result. + */ +@VintfStability +parcelable CaptureResult { + /** + * The frame number is an incrementing integer set by the framework in the + * submitted request to uniquely identify this capture. It is also used to + * identify the request in asynchronous notifications sent to + * ICameraDevice3Callback::notify(). + */ + int frameNumber; + + /** + * If non-zero, read result from result queue instead + * (see ICameraDeviceSession.getCaptureResultMetadataQueue). + * If zero, read result from .result field. + */ + long fmqResultSize; + + /** + * The result metadata for this capture. This contains information about the + * final capture parameters, the state of the capture and post-processing + * hardware, the state of the 3A algorithms, if enabled, and the output of + * any enabled statistics units. + * + * If there was an error producing the result metadata, result must be an + * empty metadata buffer, and notify() must be called with + * ErrorCode::ERROR_RESULT. + * + * Multiple calls to processCaptureResult() with a given frameNumber + * may include (partial) result metadata. + * + * Partial metadata submitted must not include any metadata key returned + * in a previous partial result for a given frame. Each new partial result + * for that frame must also set a distinct partialResult value. + * + * If notify has been called with ErrorCode::ERROR_RESULT, all further + * partial results for that frame are ignored by the framework. + */ + CameraMetadata result; + + /** + * The completed output stream buffers for this capture. + * + * They may not yet be filled at the time the HAL calls + * processCaptureResult(); the framework must wait on the release sync + * fences provided by the HAL before reading the buffers. + * + * The StreamBuffer::buffer handle must be null for all returned buffers; + * the client must cache the handle and look it up via the combination of + * frame number and stream ID. + * + * The number of output buffers returned must be less than or equal to the + * matching capture request's count. If this is less than the buffer count + * in the capture request, at least one more call to processCaptureResult + * with the same frameNumber must be made, to return the remaining output + * buffers to the framework. This may only be zero if the structure includes + * valid result metadata or an input buffer is returned in this result. + * + * The HAL must set the stream buffer's release sync fence to a valid sync + * fd, or to null if the buffer has already been filled. + * + * If the HAL encounters an error while processing the buffer, and the + * buffer is not filled, the buffer's status field must be set to ERROR. If + * the HAL did not wait on the acquire fence before encountering the error, + * the acquire fence must be copied into the release fence, to allow the + * framework to wait on the fence before reusing the buffer. + * + * The acquire fence must be set to null for all output buffers. + * + * This vector may be empty; if so, at least one other processCaptureResult + * call must be made (or have been made) by the HAL to provide the filled + * output buffers. + * + * When processCaptureResult is called with a new buffer for a frame, + * all previous frames' buffers for that corresponding stream must have been + * already delivered (the fences need not have yet been signaled). + * + * Buffers for a frame may be sent to framework before the corresponding + * SHUTTER-notify call is made by the HAL. + * + * Performance considerations: + * + * Buffers delivered to the framework are not dispatched to the + * application layer until a start of exposure timestamp has been received + * via a SHUTTER notify() call. It is highly recommended to + * dispatch that call as early as possible. + */ + StreamBuffer[] outputBuffers; + + /** + * The handle for the input stream buffer for this capture, if any. + * + * It may not yet be consumed at the time the HAL calls + * processCaptureResult(); the framework must wait on the release sync fence + * provided by the HAL before reusing the buffer. + * + * The HAL must handle the sync fences the same way they are done for + * outputBuffers. + * + * Only one input buffer is allowed to be sent per request. Similarly to + * output buffers, the ordering of returned input buffers must be + * maintained by the HAL. + * + * Performance considerations: + * + * The input buffer should be returned as early as possible. If the HAL + * supports sync fences, it can call processCaptureResult to hand it back + * with sync fences being set appropriately. If the sync fences are not + * supported, the buffer can only be returned when it is consumed, which + * may take long time; the HAL may choose to copy this input buffer to make + * the buffer return sooner. + */ + StreamBuffer inputBuffer; + + /** + * In order to take advantage of partial results, the HAL must set the + * static metadata android.request.partialResultCount to the number of + * partial results it sends for each frame. + * + * Each new capture result with a partial result must set + * this field to a distinct inclusive value between + * 1 and android.request.partialResultCount. + * + * HALs not wishing to take advantage of this feature must not + * set an android.request.partialResultCount or partial_result to a value + * other than 1. + * + * This value must be set to 0 when a capture result contains buffers only + * and no metadata. + */ + int partialResult; + + /** + * The physical metadata for logical multi-camera. + */ + PhysicalCameraMetadata[] physicalCameraMetadata; +} diff --git a/camera/device/aidl/android/hardware/camera/device/ErrorCode.aidl b/camera/device/aidl/android/hardware/camera/device/ErrorCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9a0f26c19d0ac6bfdcf20694ca23c1a4b3b2b58b --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ErrorCode.aidl @@ -0,0 +1,59 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * Defined error codes for the NotifyMsg union in ICameraDeviceCallback.notify callbacks. + */ +@VintfStability +@Backing(type="int") +enum ErrorCode { + /** + * A serious failure occurred. No further frames or buffer streams must + * be produced by the device. Device must be treated as closed. The + * client must reopen the device to use it again. The frameNumber field + * is unused. + */ + ERROR_DEVICE = 1, + + /** + * An error has occurred in processing a request. No output (metadata or + * buffers) must be produced for this request. The frameNumber field + * specifies which request has been dropped. Subsequent requests are + * unaffected, and the device remains operational. + */ + ERROR_REQUEST = 2, + + /** + * An error has occurred in producing an output result metadata buffer + * for a request, but output stream buffers for it must still be + * available. Subsequent requests are unaffected, and the device remains + * operational. The frameNumber field specifies the request for which + * result metadata won't be available. + */ + ERROR_RESULT = 3, + + /** + * An error has occurred in placing an output buffer into a stream for a + * request. The frame metadata and other buffers may still be + * available. Subsequent requests are unaffected, and the device remains + * operational. The frameNumber field specifies the request for which the + * buffer was dropped, and errorStreamId indicates the stream + * that dropped the frame. + */ + ERROR_BUFFER = 4, +} diff --git a/camera/device/aidl/android/hardware/camera/device/ErrorMsg.aidl b/camera/device/aidl/android/hardware/camera/device/ErrorMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..56bc9f1256deead78ef8c59b255d3fe74f8f0b76 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ErrorMsg.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.ErrorCode; + +/** + * ErrorMsg: + * + * Message contents for MsgType::ERROR + */ +@VintfStability +parcelable ErrorMsg { + /** + * Frame number of the request the error applies to. 0 if the frame number + * isn't applicable to the error. + */ + int frameNumber; + + /** + * Pointer to the stream that had a failure. -1 if the stream isn't + * applicable to the error. + */ + int errorStreamId; + + /** + * The code for this error. + */ + ErrorCode errorCode; +} diff --git a/camera/device/aidl/android/hardware/camera/device/HalStream.aidl b/camera/device/aidl/android/hardware/camera/device/HalStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b8ec3deec5fb531940b9400f0fe7c0b458632c4a --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/HalStream.aidl @@ -0,0 +1,127 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * HalStream: + * + * The camera HAL's response to each requested stream configuration. + * + * The HAL may specify the desired format, maximum buffers, usage flags, physical camera id for + * each stream. + * + */ +@VintfStability +parcelable HalStream { + /** + * Stream ID - a nonnegative integer identifier for a stream. + * + * The ID must be one of the stream IDs passed into configureStreams. + */ + int id; + + /** + * An override pixel format for the buffers in this stream. + * + * The HAL must respect the requested format in Stream unless it is + * IMPLEMENTATION_DEFINED, in which case the override format here must be + * used by the client instead, for this stream. This allows cross-platform + * HALs to use a standard format since IMPLEMENTATION_DEFINED formats often + * require device-specific information. In all other cases, the + * overrideFormat must match the requested format. + * + * When HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED is used, then the platform + * gralloc module must select a format based on the usage flags provided by + * the camera device and the other endpoint of the stream. + */ + android.hardware.graphics.common.PixelFormat overrideFormat; + + /** + * The bitfield gralloc usage flags for this stream, as needed by the HAL. + * + * For output streams, these are the HAL's producer usage flags. For input + * streams, these are the HAL's consumer usage flags. The usage flags from + * the producer and the consumer must be combined together and then passed + * to the platform graphics allocator HAL for allocating the gralloc buffers + * for each stream. + * + * If the stream's type is INPUT, then producerUsage must be 0, and + * consumerUsage must be set. For other types, producerUsage must be set, + * and consumerUsage must be 0. + */ + android.hardware.graphics.common.BufferUsage producerUsage; + + android.hardware.graphics.common.BufferUsage consumerUsage; + + /** + * The maximum number of buffers the HAL device may need to have dequeued at + * the same time. The HAL device may not have more buffers in-flight from + * this stream than this value. + */ + int maxBuffers; + + /** + * A bitfield override dataSpace for the buffers in this stream. + * + * The HAL must respect the requested dataSpace in Stream unless it is + * IMPLEMENTATION_DEFINED, in which case the override dataSpace here must be + * used by the client instead, for this stream. This allows cross-platform + * HALs to use a specific dataSpace since IMPLEMENTATION_DEFINED formats often + * require device-specific information for correct selection. In all other cases, the + * overrideFormat must match the requested format. + */ + android.hardware.graphics.common.Dataspace overrideDataSpace; + + /** + * The physical camera id the current Hal stream belongs to. + * + * If current camera device isn't a logical camera, or the Hal stream isn't + * from a physical camera of the logical camera, this must be an empty + * string. + * + * A logical camera is a camera device backed by multiple physical camera + * devices. + * + * When not empty, this field is the field of one of the full-qualified device + * instance names returned by getCameraIdList(). + */ + String physicalCameraId; + + /** + * Whether this stream can be switch to offline mode. + * + * For devices that does not support the OFFLINE_PROCESSING capability, this + * fields will always be false. + * + * For backward compatible camera devices that support the + * OFFLINE_PROCESSING capability: any input stream and any output stream + * that can be output of the input stream must set this field to true. Also + * any stream of YUV420_888 format or JPEG format, with CPU_READ usage flag, + * must set this field to true. + * + * For depth only camera devices that support the OFFLINE_PROCESSING + * capability: any DEPTH16 output stream must set this field to true. + * + * All other streams are up to camera HAL to advertise support or not, + * though it is not recommended to list support for streams with + * hardware composer or video encoder usage flags as these streams tend + * to be targeted continuously and can lead to long latency when trying to + * switch to offline. + * + */ + boolean supportOffline; +} diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57705bc6211b142b25c4f8599277a515dc4ed3b1 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl @@ -0,0 +1,347 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.common.CameraResourceCost; +import android.hardware.camera.device.CameraMetadata; +import android.hardware.camera.device.ICameraDeviceCallback; +import android.hardware.camera.device.ICameraDeviceSession; +import android.hardware.camera.device.ICameraInjectionSession; +import android.hardware.camera.device.StreamConfiguration; +import android.os.ParcelFileDescriptor; + +/** + * Camera device interface + * + * Supports the android.hardware.Camera API, and the android.hardware.camera2 + * API at LIMITED or better hardware level. + * + */ +@VintfStability +interface ICameraDevice { + /** + * getCameraCharacteristics: + * + * Return the static camera information for this camera device. This + * information may not change between consecutive calls. + * + * When an external camera is disconnected, its camera id becomes + * invalid. Calling this method with this invalid camera id must result in an + * ILLEGAL_ARGUMENT ServiceSpecificException on returning; this may happen even before the + * device status callback is invoked by the HAL. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * The camera device cannot be opened due to an internal + * error. + * CAMERA_DISCONNECTED: + * An external camera device has been disconnected, and is no longer + * available. This camera device interface is now stale, and a new + * instance must be acquired if the device is reconnected. All + * subsequent calls on this interface must return + * CAMERA_DISCONNECTED. + * + * @return The static metadata for this camera device, or an empty metadata + * structure if status is not OK. + * + */ + CameraMetadata getCameraCharacteristics(); + + /** + * getPhysicalCameraCharacteristics: + * + * Return the static camera information for a physical camera ID backing + * this logical camera device. This information may not change between consecutive calls. + * + * The characteristics of all cameras returned by + * ICameraProvider::getCameraIdList() must be queried via + * getCameraCharacteristics(). Calling getPhysicalCameraCharacteristics() on + * those cameras must return ILLEGAL_ARGUMENT ServiceSpecificException. + * + * @param physicalCameraId The physical camera id parsed from the logical + * camera's ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS static metadata + * key. The framework assumes that this ID is just the part of fully + * qualified camera device name "device@.//". And + * the physical camera must be of the same version and type as the parent + * logical camera device. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * The camera device cannot be opened due to an internal + * error. + * CAMERA_DISCONNECTED: + * An external camera device has been disconnected, and is no longer + * available. This camera device interface is now stale, and a new + * instance must be acquired if the device is reconnected. All + * subsequent calls on this interface must return + * CAMERA_DISCONNECTED. + * ILLEGAL_ARGUMENT: + * If the physicalCameraId is not a valid physical camera Id outside + * of ICameraProvider::getCameraIdList(). + * + * @return The static metadata for this logical camera device's physical device, or an empty + * metadata structure if a service specific error is returned. + * + */ + CameraMetadata getPhysicalCameraCharacteristics(in String physicalCameraId); + + /** + * Get camera device resource cost information. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * An unexpected internal camera HAL error occurred, and the + * resource cost is not available. + * CAMERA_DISCONNECTED: + * An external camera device has been disconnected, and is no longer + * available. This camera device interface is now stale, and a new + * instance must be acquired if the device is reconnected. All + * subsequent calls on this interface must return + * CAMERA_DISCONNECTED. + * @return resourceCost + * The resources required to open this camera device, or unspecified + * values if status is not OK. + */ + CameraResourceCost getResourceCost(); + + /** + * isStreamCombinationSupported: + * + * Check for device support of specific camera stream combination. + * + * The streamList must contain at least one output-capable stream, and may + * not contain more than one input-capable stream. + * In contrast to regular stream configuration the framework does not create + * or initialize any actual streams. This means that Hal must not use or + * consider the stream "id" value. + * + * ------------------------------------------------------------------------ + * + * Preconditions: + * + * The framework can call this method at any time before, during and + * after active session configuration. This means that calls must not + * impact the performance of pending camera requests in any way. In + * particular there must not be any glitches or delays during normal + * camera streaming. + * + * Performance requirements: + * This call is expected to be significantly faster than stream + * configuration. In general HW and SW camera settings must not be + * changed and there must not be a user-visible impact on camera performance. + * + * + * A service specific error will be returned on the following conditions + * + * INTERNAL_ERROR: + * The stream combination query cannot complete due to internal + * error. + * @param streams The StreamConfiguration to be tested for support. + * @return true in case the stream combination is supported, false otherwise. + * + */ + boolean isStreamCombinationSupported(in StreamConfiguration streams); + + /** + * open: + * + * Power on and initialize this camera device for active use, returning a + * session handle for active operations. + * + * @param callback Interface to invoke by the HAL for device asynchronous + * events. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * The camera device cannot be opened due to an internal + * error. + * ILLEGAL_ARGUMENT: + * The callbacks handle is invalid (for example, it is null). + * CAMERA_IN_USE: + * This camera device is already open. + * MAX_CAMERAS_IN_USE: + * The maximal number of camera devices that can be + * opened concurrently were opened already. + * CAMERA_DISCONNECTED: + * This external camera device has been disconnected, and is no + * longer available. This interface is now stale, and a new instance + * must be acquired if the device is reconnected. All subsequent + * calls on this interface must return CAMERA_DISCONNECTED. + * @return The interface to the newly-opened camera session, + * or null if status is not OK. + */ + ICameraDeviceSession open(in ICameraDeviceCallback callback); + + /** + * openInjection: + * + * Similar to open, except that this return an ICameraInjectionSession instead. + * Details about ICameraInjectionSession can be found in ICameraInjectionSession.aidl + * + * @param callback Interface to invoke by the HAL for device asynchronous + * events. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * The camera device cannot be opened due to an internal + * error. + * OPERATION_NOT_SUPPORTED: + * This camera device does not support opening an injection session. + * ILLEGAL_ARGUMENT: + * The callbacks handle is invalid (for example, it is null). + * CAMERA_IN_USE: + * This camera device is already open. + * MAX_CAMERAS_IN_USE: + * The maximal number of camera devices that can be + * opened concurrently were opened already. + * CAMERA_DISCONNECTED: + * This external camera device has been disconnected, and is no + * longer available. This interface is now stale, and a new instance + * must be acquired if the device is reconnected. All subsequent + * calls on this interface must return CAMERA_DISCONNECTED. + * @return The interface to the newly-opened camera session, or null if status is not OK. + */ + ICameraInjectionSession openInjectionSession(in ICameraDeviceCallback callback); + + /** + * setTorchMode: + * + * Turn on or off the torch mode of the flash unit associated with this + * camera device. If the operation is successful, HAL must notify the + * framework torch state by invoking + * ICameraProviderCallback::torchModeStatusChange() with the new state. + * + * An active camera session has a higher priority accessing the flash + * unit. When there are any resource conflicts, such as when open() is + * called to fully activate a camera device, the provider must notify the + * framework through ICameraProviderCallback::torchModeStatusChange() that + * the torch mode has been turned off and the torch mode state has become + * TORCH_MODE_STATUS_NOT_AVAILABLE. When resources to turn on torch mode + * become available again, the provider must notify the framework through + * ICameraProviderCallback::torchModeStatusChange() that the torch mode + * state has become TORCH_MODE_STATUS_AVAILABLE_OFF for set_torch_mode() to + * be called. + * + * When the client calls setTorchMode() to turn on the torch mode of a flash + * unit, if the HAL cannot keep multiple torch modes on simultaneously, the + * HAL must turn off the torch mode(s) that were turned on by previous + * setTorchMode() calls and notify the framework that the torch mode state + * of those flash unit(s) has become TORCH_MODE_STATUS_AVAILABLE_OFF. + * + * @param on Whether to turn the turn mode ON - specified by true or OFF, specified by false + * + * A service specific error will be returned on the following conditions + * + * INTERNAL_ERROR: + * The flash unit cannot be operated due to an unexpected internal + * error. + * ILLEGAL_ARGUMENT: + * The camera ID is unknown. + * CAMERA_IN_USE: + * This camera device has been opened, so the torch cannot be + * controlled until it is closed. + * MAX_CAMERAS_IN_USE: + * Due to other camera devices being open, or due to other + * resource constraints, the torch cannot be controlled currently. + * OPERATION_NOT_SUPPORTED: + * This camera device does not have a flash unit. This can + * be returned if and only if android.flash.info.available is + * false. + * CAMERA_DISCONNECTED: + * An external camera device has been disconnected, and is no longer + * available. This camera device interface is now stale, and a new + * instance must be acquired if the device is reconnected. All + * subsequent calls on this interface must return + * CAMERA_DISCONNECTED. + * + */ + void setTorchMode(boolean on); + + /** + * turnOnTorchWithStrengthLevel: + * + * Change the brightness level of the flash unit associated with this camera device + * and set it to value in torchStrength. This function also turns ON the torch + * with specified torchStrength if the torch is OFF. + * + * The torchStrength value must be within the valid range i.e. >=1 and + * <= FLASH_INFO_STRENGTH_MAXIMUM_LEVEL. Whenever the torch is turned OFF, + * the brightness level will reset to FLASH_INFO_STRENGTH_DEFAULT_LEVEL. + * When the client calls setTorchMode(ON) after turnOnTorchWithStrengthLevel(N), + * the flash unit will have brightness level equal to N. This level does not + * represent the real brightness units. It is linear in nature i.e. flashlight + * at level 10 is twice as bright as at level 5. + * + * @param torchStrength Brightness level to be set for the flashlight. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * The flash unit cannot be operated due to an unexpected internal + * error. + * CAMERA_IN_USE: + * This status code is returned when: + * - This camera device has been opened, so the torch cannot be + * controlled until it is closed. + * - Due to other camera devices being open, or due to other + * resource constraints, the torch cannot be controlled currently. + * ILLEGAL_ARGUMENT: + * If the torchStrength value is not within the range i.e. < 1 or + * > FLASH_INFO_STRENGTH_MAXIMUM_LEVEL. + * OPERATION_NOT_SUPPORTED: + * This status code is returned when: + * - This camera device does not support direct operation of flashlight + * torch mode. The framework must open the camera device and turn + * the torch on through the device interface. + * - This camera device does not have a flash unit. + * - This camera device has flash unit but does not support torch + * strength control. + * CAMERA_DISCONNECTED: + * An external camera device has been disconnected, and is no longer + * available. This camera device interface is now stale, and a new + * instance must be acquired if the device is reconnected. All + * subsequent calls on this interface must return + * CAMERA_DISCONNECTED. + * + */ + void turnOnTorchWithStrengthLevel(int torchStrength); + + /** + * getTorchStrengthLevel: + * + * Get current torch strength level. + * If the device supports torch strength control, when the torch is OFF the + * strength level will reset to default level, so the return + * value in this case will be equal to FLASH_INFO_STRENGTH_DEFAULT_LEVEL. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * An unexpected error occurred and the information is not + * available. + * OPERATION_NOT_SUPPORTED: + * This status code is returned when: + * - This camera device does not support direct operation of flashlight + * torch mode. The framework must open the camera device and turn + * the torch on through the device interface. + * - This camera device does not have a flash unit. + * - This camera device has flash unit but does not support torch + * strength control. + * + * @return torchStrength Current torch strength level. + * + */ + int getTorchStrengthLevel(); +} diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraDeviceCallback.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraDeviceCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..83ff823af6815683328620f2c06968855b283221 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ICameraDeviceCallback.aidl @@ -0,0 +1,202 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.BufferRequest; +import android.hardware.camera.device.BufferRequestStatus; +import android.hardware.camera.device.CaptureResult; +import android.hardware.camera.device.NotifyMsg; +import android.hardware.camera.device.StreamBuffer; +import android.hardware.camera.device.StreamBufferRet; + +/** + * Callback methods for the HAL to call into the framework. + */ +@VintfStability +interface ICameraDeviceCallback { + /** + * notify: + * + * Asynchronous notification callback from the HAL, fired for various + * reasons. Only for information independent of frame capture, or that + * require specific timing. Multiple messages may be sent in one call; a + * message with a higher index must be considered to have occurred after a + * message with a lower index. + * + * Multiple threads may call notify() simultaneously. + * + * Buffers delivered to the framework must not be dispatched to the + * application layer until a start of exposure timestamp (or input image's + * start of exposure timestamp for a reprocess request) has been received + * via a SHUTTER notify() call. It is highly recommended to dispatch this + * call as early as possible. + * + * The SHUTTER notify calls for requests with android.control.enableZsl + * set to TRUE and ANDROID_CONTROL_CAPTURE_INTENT == STILL_CAPTURE may be + * out-of-order compared to SHUTTER notify for other kinds of requests + * (including regular, reprocess, or zero-shutter-lag requests with + * different capture intents). + * + * As a result, the capture results of zero-shutter-lag requests with + * ANDROID_CONTROL_CAPTURE_INTENT == STILL_CAPTURE may be out-of-order + * compared to capture results for other kinds of requests. + * + * Different SHUTTER notify calls for zero-shutter-lag requests with + * ANDROID_CONTROL_CAPTURE_INTENT == STILL_CAPTURE must be in order between + * them, as is for other kinds of requests. SHUTTER notify calls for + * zero-shutter-lag requests with non STILL_CAPTURE intent must be in order + * with SHUTTER notify calls for regular requests. + * ------------------------------------------------------------------------ + * Performance requirements: + * + * This is a non-blocking call. The framework must handle each message in 5ms. + * @param msgs List of notification msgs to be processed by camera framework + */ + void notify(in NotifyMsg[] msgs); + + /** + * processCaptureResult: + * + * Send results from one or more completed or partially completed captures + * to the framework. + * processCaptureResult() may be invoked multiple times by the HAL in + * response to a single capture request. This allows, for example, the + * metadata and low-resolution buffers to be returned in one call, and + * post-processed JPEG buffers in a later call, once it is available. Each + * call must include the frame number of the request it is returning + * metadata or buffers for. Only one call to processCaptureResult + * may be made at a time by the HAL although the calls may come from + * different threads in the HAL. + * + * A component (buffer or metadata) of the complete result may only be + * included in one process_capture_result call. A buffer for each stream, + * and the result metadata, must be returned by the HAL for each request in + * one of the processCaptureResult calls, even in case of errors producing + * some of the output. A call to processCaptureResult() with neither + * output buffers or result metadata is not allowed. + * + * The order of returning metadata and buffers for a single result does not + * matter, but buffers for a given stream must be returned in FIFO order. So + * the buffer for request 5 for stream A must always be returned before the + * buffer for request 6 for stream A. This also applies to the result + * metadata; the metadata for request 5 must be returned before the metadata + * for request 6. + * + * However, different streams are independent of each other, so it is + * acceptable and expected that the buffer for request 5 for stream A may be + * returned after the buffer for request 6 for stream B is. And it is + * acceptable that the result metadata for request 6 for stream B is + * returned before the buffer for request 5 for stream A is. If multiple + * capture results are included in a single call, camera framework must + * process results sequentially from lower index to higher index, as if + * these results were sent to camera framework one by one, from lower index + * to higher index. + * + * The HAL retains ownership of result structure, which only needs to be + * valid to access during this call. + * + * The output buffers do not need to be filled yet; the framework must wait + * on the stream buffer release sync fence before reading the buffer + * data. Therefore, this method should be called by the HAL as soon as + * possible, even if some or all of the output buffers are still in + * being filled. The HAL must include valid release sync fences into each + * output_buffers stream buffer entry, or -1 if that stream buffer is + * already filled. + * + * If the result buffer cannot be constructed for a request, the HAL must + * return an empty metadata buffer, but still provide the output buffers and + * their sync fences. In addition, notify() must be called with an + * ERROR_RESULT message. + * + * If an output buffer cannot be filled, its status field must be set to + * STATUS_ERROR. In this case, notify() isn't required to be called with + * an ERROR_BUFFER message. The framework will simply treat the notify() + * call with ERROR_BUFFER as a no-op, and derive whether and when to notify + * the application of buffer loss based on the buffer status and whether or not + * the entire capture has failed. + * + * If the entire capture has failed, then this method still needs to be + * called to return the output buffers to the framework. All the buffer + * statuses must be STATUS_ERROR, and the result metadata must be an + * empty buffer. In addition, notify() must be called with a ERROR_REQUEST + * message. In this case, individual ERROR_RESULT/ERROR_BUFFER messages + * must not be sent. Note that valid partial results are still allowed + * as long as the final result metadata fails to be generated. + * + * Performance requirements: + * + * This is a non-blocking call. The framework must handle each CaptureResult + * within 5ms. + * + * The pipeline latency (see ICameraDeviceSession for definition) should be less than or equal + * to 4 frame intervals, and must be less than or equal to 8 frame intervals. + * + * @param results to be processed by the camera framework + * + */ + void processCaptureResult(in CaptureResult[] results); + + /** + * requestStreamBuffers: + * + * Synchronous callback for HAL to ask for output buffers from camera service. + * + * This call may be serialized in camera service so it is strongly + * recommended to only call this method from one thread. + * + * When camera device advertises + * InfoSupportedBufferManagementVersion == + * ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5), HAL + * can use this method to request buffers from camera service. + * + * A BufferRequestStatus will be returned + * OK: All the requests succeeded + * FAILED_PARTIAL: some streams failed while some succeeds. Check + * individual StreamBufferRet for details. + * FAILED_CONFIGURING: the request failed because camera servicve is + * performing configureStreams and no buffers are returned. + * FAILED_UNKNOWN: the request failed for unknown reason and no buffers + * are returned. + * A service specific exception will be returned in the following case: + * + * ILLEGAL_ARGUMENT: If the buffer requests through bufReqs are not legal, do not correspond + * to a configured stream. + * + * Performance requirements: + * This is a blocking call that takes more time with more buffers requested. + * HAL must not request large amount of buffers on a latency critical code + * path. It is highly recommended to use a dedicated thread to perform + * all requestStreamBuffers calls, and adjust the thread priority and/or + * timing of making the call in order for buffers to arrive before HAL is + * ready to fill the buffer. + * @param bufReqs Buffers requested by the camera HAL + * @param buffers the buffers returned to the camera HAL by the camera framework + */ + BufferRequestStatus requestStreamBuffers( + in BufferRequest[] bufReqs, out StreamBufferRet[] buffers); + + /** + * returnStreamBuffers: + * + * Synchronous callback for HAL to return output buffers to camera service. + * + * If this method is called during a configureStreams call, it must be blocked + * until camera service finishes the ongoing configureStreams call. + * @param buffers The stream buffers returned to the camera framework + */ + void returnStreamBuffers(in StreamBuffer[] buffers); +} diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..885c71a84893f07781e9d343732f25a94e35264f --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl @@ -0,0 +1,579 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.BufferCache; +import android.hardware.camera.device.CameraMetadata; +import android.hardware.camera.device.CameraOfflineSessionInfo; +import android.hardware.camera.device.CaptureRequest; +import android.hardware.camera.device.HalStream; +import android.hardware.camera.device.ICameraOfflineSession; +import android.hardware.camera.device.RequestTemplate; +import android.hardware.camera.device.StreamConfiguration; +import android.hardware.common.fmq.MQDescriptor; +import android.hardware.common.fmq.SynchronizedReadWrite; + +/** + * Camera device active session interface. + * + * Obtained via ICameraDevice::open(), this interface contains the methods to + * configure and request captures from an active camera device. + */ +@VintfStability +interface ICameraDeviceSession { + /** + * close: + * + * Shut down the camera device. + * + * After this call, all calls to this session instance must set a + * INTERNAL_ERROR ServiceSpecificException. + * + * This method must always succeed, even if the device has encountered a + * serious error. + */ + void close(); + + /** + * + * configureStreams: + * + * Reset the HAL camera device processing pipeline and set up new input and + * output streams. This call replaces any existing stream configuration with + * the streams defined in the streamList. This method must be called at + * least once before a request is submitted with processCaptureRequest(). + * + * The streamList must contain at least one output-capable stream, and may + * not contain more than one input-capable stream. + * + * The streamList may contain streams that are also in the currently-active + * set of streams (from the previous call to configureStreams()). These + * streams must already have valid values for usage, maxBuffers, and the + * private pointer. + * + * If the HAL needs to change the stream configuration for an existing + * stream due to the new configuration, it may rewrite the values of usage + * and/or maxBuffers during the configure call. + * + * The framework must detect such a change, and may then reallocate the + * stream buffers before using buffers from that stream in a request. + * + * If a currently-active stream is not included in streamList, the HAL may + * safely remove any references to that stream. It must not be reused in a + * later configureStreams() call by the framework, and all the gralloc + * buffers for it must be freed after the configureStreams() call returns. + * + * If the stream is new, the client must set the consumer usage flags in + * requestedConfiguration. Upon return, the HAL device must set producerUsage, + * maxBuffers, and other fields in the configureStreams() return values. These + * fields are then used by the framework and the platform gralloc module to + * allocate the gralloc buffers for each stream. + * + * Newly allocated buffers may be included in a capture request at any time + * by the framework. Once a gralloc buffer is returned to the framework + * with processCaptureResult (and its respective releaseFence has been + * signaled) the framework may free or reuse it at any time. + * + * ------------------------------------------------------------------------ + * + * Preconditions: + * + * The framework must only call this method when no captures are being + * processed. That is, all results have been returned to the framework, and + * all in-flight input and output buffers have been returned and their + * release sync fences have been signaled by the HAL. The framework must not + * submit new requests for capture while the configureStreams() call is + * underway. + * + * Postconditions: + * + * The HAL device must configure itself to provide maximum possible output + * frame rate given the sizes and formats of the output streams, as + * documented in the camera device's static metadata. + * + * Performance requirements: + * + * This call is expected to be heavyweight and possibly take several hundred + * milliseconds to complete, since it may require resetting and + * reconfiguring the image sensor and the camera processing pipeline. + * Nevertheless, the HAL device should attempt to minimize the + * reconfiguration delay to minimize the user-visible pauses during + * application operational mode changes (such as switching from still + * capture to video recording). + * + * The HAL should return from this call in 500ms, and must return from this + * call in 1000ms. + * + * A service specific error will be returned on the following conditions + * + * INTERNAL_ERROR: + * If there has been a fatal error and the device is no longer + * operational. Only close() can be called successfully by the + * framework after this error is returned. + * ILLEGAL_ARGUMENT: + * If the requested stream configuration is invalid. Some examples + * of invalid stream configurations include: + * - Including more than 1 INPUT stream + * - Not including any OUTPUT streams + * - Including streams with unsupported formats, or an unsupported + * size for that format. + * - Including too many output streams of a certain format. + * - Unsupported rotation configuration + * - Stream sizes/formats don't satisfy the + * StreamConfigurationMode requirements for non-NORMAL mode, or + * the requested operation_mode is not supported by the HAL. + * - Unsupported usage flag + * The camera service cannot filter out all possible illegal stream + * configurations, since some devices may support more simultaneous + * streams or larger stream resolutions than the minimum required + * for a given camera device hardware level. The HAL must return an + * ILLEGAL_ARGUMENT for any unsupported stream set, and then be + * ready to accept a future valid stream configuration in a later + * configureStreams call. + * @param requestedConfiguration The stream configuration requested by the camera framework to + * be configured by the camera HAL. + * @return A list of the stream parameters desired by the HAL for + * each stream, including maximum buffers, the usage flags, and the + * override format. + * + */ + HalStream[] configureStreams(in StreamConfiguration requestedConfiguration); + + /** + * constructDefaultRequestSettings: + * + * Create capture settings for standard camera use cases. + * + * The device must return a settings buffer that is configured to meet the + * requested use case, which must be one of the RequestTemplate enums. + * All request control fields must be included. + * + * Performance requirements: + * + * This must be a non-blocking call. The HAL should return from this call + * in 1ms, and must return from this call in 5ms. + * + * A service specific error will be returned on the following conditions + * Return values: + * + * INTERNAL_ERROR: + * An unexpected internal error occurred, and the default settings + * are not available. + * ILLEGAL_ARGUMENT: + * The camera HAL does not support the input template type + * CAMERA_DISCONNECTED: + * An external camera device has been disconnected, and is no longer + * available. This camera device interface is now stale, and a new + * instance must be acquired if the device is reconnected. All + * subsequent calls on this interface must return + * CAMERA_DISCONNECTED. + * @param type The requested template CaptureRequest type to create the default settings for. + * + * @return capture settings for the requested use case. + * + */ + + CameraMetadata constructDefaultRequestSettings(in RequestTemplate type); + + /** + * flush: + * + * Flush all currently in-process captures and all buffers in the pipeline + * on the given device. Generally, this method is used to dump all state as + * quickly as possible in order to prepare for a configure_streams() call. + * + * No buffers are required to be successfully returned, so every buffer + * held at the time of flush() (whether successfully filled or not) may be + * returned with BufferStatus.ERROR. Note the HAL is still allowed + * to return valid (BufferStatus.OK) buffers during this call, + * provided they are successfully filled. + * + * All requests currently in the HAL are expected to be returned as soon as + * possible. Not-in-process requests must return errors immediately. Any + * interruptible hardware blocks must be stopped, and any uninterruptible + * blocks must be waited on. + * + * flush() may be called concurrently to processCaptureRequest(), with the + * expectation that processCaptureRequest returns quickly and the + * request submitted in that processCaptureRequest call is treated like + * all other in-flight requests. Due to concurrency issues, it is possible + * that from the HAL's point of view, a processCaptureRequest() call may + * be started after flush has been invoked but has not returned yet. If such + * a call happens before flush() returns, the HAL must treat the new + * capture request like other in-flight pending requests (see #4 below). + * + * More specifically, the HAL must follow below requirements for various + * cases: + * + * 1. For captures that are too late for the HAL to cancel/stop, and must be + * completed normally by the HAL; i.e. the HAL can send shutter/notify + * and processCaptureResult and buffers as normal. + * + * 2. For pending requests that have not done any processing, the HAL must + * call notify with ErrorMsg set, and return all the output + * buffers with processCaptureResult in the error state + * (BufferStatus.ERROR). The HAL must not place the release + * fence into an error state, instead, the release fences must be set to + * the acquire fences passed by the framework, or -1 if they have been + * waited on by the HAL already. This is also the path to follow for any + * captures for which the HAL already called notify() with + * ShutterMsg set, but won't be producing any metadata/valid buffers + * for. After ErrorMsg is set, for a given frame, only + * processCaptureResults with buffers in BufferStatus.ERROR + * are allowed. No further notifys or processCaptureResult with + * non-empty metadata is allowed. + * + * 3. For partially completed pending requests that do not have all the + * output buffers or perhaps missing metadata, the HAL must follow + * below: + * + * 3.1. Call notify with ErrorMsg set with ErrorCode.ERROR_RESULT if some of the expected + * result metadata (i.e. one or more partial metadata) won't be + * available for the capture. + * + * 3.2. Call notify with ErrorMsg set with ErrorCode.ERROR_BUFFER for every buffer that + * won't be produced for the capture. + * + * 3.3. Call notify with ShutterMsg with the capture timestamp + * before any buffers/metadata are returned with + * processCaptureResult. + * + * 3.4. For captures that will produce some results, the HAL must not + * call notify with ErrorCode.ERROR_REQUEST, since that indicates complete + * failure. + * + * 3.5. Valid buffers/metadata must be passed to the framework as + * normal. + * + * 3.6. Failed buffers must be returned to the framework as described + * for case 2. But failed buffers do not have to follow the strict + * ordering valid buffers do, and may be out-of-order with respect + * to valid buffers. For example, if buffers A, B, C, D, E are sent, + * D and E are failed, then A, E, B, D, C is an acceptable return + * order. + * + * 3.7. For fully-missing metadata, calling ErrorCode.ERROR_RESULT is + * sufficient, no need to call processCaptureResult with empty + * metadata or equivalent. + * + * 4. If a flush() is invoked while a processCaptureRequest() invocation + * is active, that process call must return as soon as possible. In + * addition, if a processCaptureRequest() call is made after flush() + * has been invoked but before flush() has returned, the capture request + * provided by the late processCaptureRequest call must be treated + * like a pending request in case #2 above. + * + * flush() must only return when there are no more outstanding buffers or + * requests left in the HAL. The framework may call configure_streams (as + * the HAL state is now quiesced) or may issue new requests. + * + * Note that it's sufficient to only support fully-succeeded and + * fully-failed result cases. However, it is highly desirable to support + * the partial failure cases as well, as it could help improve the flush + * call overall performance. + * + * Performance requirements: + * + * The HAL should return from this call in 100ms, and must return from this + * call in 1000ms. And this call must not be blocked longer than pipeline + * latency (see below for definition). + * + * Pipeline Latency: + * For a given capture request, the duration from the framework calling + * process_capture_request to the HAL sending capture result and all buffers + * back by process_capture_result call. To make the Pipeline Latency measure + * independent of frame rate, it is measured by frame count. + * + * For example, when frame rate is 30 (fps), the frame duration (time interval + * between adjacent frame capture time) is 33 (ms). + * If it takes 5 frames for framework to get the result and buffers back for + * a given request, then the Pipeline Latency is 5 (frames), instead of + * 5 x 33 = 165 (ms). + * + * The Pipeline Latency is determined by android.request.pipelineDepth and + * android.request.pipelineMaxDepth, see their definitions for more details. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * If the camera device has encountered a serious error. After this + * error is returned, only the close() method can be successfully + * called by the framework. + */ + void flush(); + + /** + * getCaptureRequestMetadataQueue: + * + * Retrieves the queue used along with processCaptureRequest. If + * client decides to use fast message queue to pass request metadata, + * it must: + * - Call getCaptureRequestMetadataQueue to retrieve the fast message queue; + * - In each of the requests sent in processCaptureRequest, set + * fmqSettingsSize field of CaptureRequest to be the size to read from the + * fast message queue; leave settings field of CaptureRequest empty. + * + * @return the queue that client writes request metadata to. + */ + MQDescriptor getCaptureRequestMetadataQueue(); + + /** + * getCaptureResultMetadataQueue: + * + * Retrieves the queue used along with + * ICameraDeviceCallback.processCaptureResult. + * + * Clients to ICameraDeviceSession must: + * - Call getCaptureRequestMetadataQueue to retrieve the fast message queue; + * - In implementation of ICameraDeviceCallback, test whether + * .fmqResultSize field is zero. + * - If .fmqResultSize != 0, read result metadata from the fast message + * queue; + * - otherwise, read result metadata in CaptureResult.result. + * + * @return the queue that implementation writes result metadata to. + */ + MQDescriptor getCaptureResultMetadataQueue(); + + /** + * isReconfigurationRequired: + * + * Check whether complete stream reconfiguration is required for possible new session + * parameter values. + * + * This method must be called by the camera framework in case the client changes + * the value of any advertised session parameters. Depending on the specific values + * the HAL can decide whether a complete stream reconfiguration is required. In case + * the HAL returns false, the camera framework must skip the internal reconfiguration. + * In case Hal returns true, the framework must reconfigure the streams and pass the + * new session parameter values accordingly. + * This call may be done by the framework some time before the request with new parameters + * is submitted to the HAL, and the request may be cancelled before it ever gets submitted. + * Therefore, the HAL must not use this query as an indication to change its behavior in any + * way. + * ------------------------------------------------------------------------ + * + * Preconditions: + * + * The framework can call this method at any time after active + * session configuration. There must be no impact on the performance of + * pending camera requests in any way. In particular there must not be + * any glitches or delays during normal camera streaming. + * + * Performance requirements: + * HW and SW camera settings must not be changed and there must not be + * a user-visible impact on camera performance. + * + * @param oldSessionParams Before session parameters, usually the current session parameters. + * @param newSessionParams The new session parameters which may be set by client. + * A service specific error will be returned in the following case: + * + * INTERNAL_ERROR: + * The reconfiguration query cannot complete due to internal + * error. + * @return true in case the stream reconfiguration is required, false otherwise. + */ + boolean isReconfigurationRequired(in CameraMetadata oldSessionParams, + in CameraMetadata newSessionParams); + + /** + * processCaptureRequest: + * + * Send a list of capture requests to the HAL. The HAL must not return from + * this call until it is ready to accept the next set of requests to + * process. Only one call to processCaptureRequest() must be made at a time + * by the framework, and the calls must all be from the same thread. The + * next call to processCaptureRequest() must be made as soon as a new + * request and its associated buffers are available. In a normal preview + * scenario, this means the function is generally called again by the + * framework almost instantly. If more than one request is provided by the + * client, the HAL must process the requests in order of lowest index to + * highest index. + * + * The cachesToRemove argument contains a list of buffer caches (see + * StreamBuffer document for more information on buffer cache) to be removed + * by camera HAL. Camera HAL must remove these cache entries whether or not + * this method returns OK. + * + * The actual request processing is asynchronous, with the results of + * capture being returned by the HAL through the processCaptureResult() + * call. This call requires the result metadata to be available, but output + * buffers may simply provide sync fences to wait on. Multiple requests are + * expected to be in flight at once, to maintain full output frame rate. + * + * The framework retains ownership of the request structure. It is only + * guaranteed to be valid during this call. The HAL device must make copies + * of the information it needs to retain for the capture processing. The HAL + * is responsible for waiting on and closing the buffers' fences and + * returning the buffer handles to the framework. + * + * The HAL must write the file descriptor for the input buffer's release + * sync fence into input_buffer->release_fence, if input_buffer is not + * valid. If the HAL returns -1 for the input buffer release sync fence, the + * framework is free to immediately reuse the input buffer. Otherwise, the + * framework must wait on the sync fence before refilling and reusing the + * input buffer. + * + * The input/output buffers provided by the framework in each request + * may be brand new (having never before seen by the HAL). + * + * ------------------------------------------------------------------------ + * Performance considerations: + * + * Handling a new buffer should be extremely lightweight and there must be + * no frame rate degradation or frame jitter introduced. + * + * This call must return fast enough to ensure that the requested frame + * rate can be sustained, especially for streaming cases (post-processing + * quality settings set to FAST). The HAL should return this call in 1 + * frame interval, and must return from this call in 4 frame intervals. + * + * - The capture request can include individual settings for physical camera devices + * backing a logical multi-camera. + * + * - The capture request can include width and height of the input buffer for + * a reprocessing request. + * + * A service specific error will be returned on the following conditions + * ILLEGAL_ARGUMENT: + * If the input is malformed (the settings are empty when not + * allowed, the physical camera settings are invalid, there are 0 + * output buffers, etc) and capture processing + * cannot start. Failures during request processing must be + * handled by calling ICameraDeviceCallback::notify(). In case of + * this error, the framework retains responsibility for the + * stream buffers' fences and the buffer handles; the HAL must not + * close the fences or return these buffers with + * ICameraDeviceCallback::processCaptureResult(). + * In case of multi-resolution input image, this error must be returned + * if the caller passes in a CaptureRequest with an invalid + * [inputWith, inputHeight]. + * INTERNAL_ERROR: + * If the camera device has encountered a serious error. After this + * error is returned, only the close() method can be successfully + * called by the framework. + * + * @param requests The capture requests to be processed by the camera HAL + * @param cachesToRemove list of buffer caches to be removed by the camera HAL + * @return Number of requests successfully processed by + * camera HAL. On success, this must be equal to the size of + * requests. When the call fails, this number is the number of requests + * that HAL processed successfully before HAL runs into an error and a service specific + * error is also set. + * + */ + int processCaptureRequest(in CaptureRequest[] requests, in BufferCache[] cachesToRemove); + + /** + * signalStreamFlush: + * + * Signaling to the HAL, camera service is about to perform configureStreams and + * HAL must return all buffers of designated streams. HAL must finish + * inflight requests normally and return all buffers that belongs to the + * designated streams through processCaptureResult or returnStreamBuffer + * API in a timely manner, or camera service will run into a fatal error. + * + * Note that this call serves as an optional hint and camera service may + * skip sending this call if all buffers are already returned. + * + * @param streamIds The ID of streams camera service need all of its + * buffers returned. + * + * @param streamConfigCounter Note that due to concurrency nature, it is + * possible the signalStreamFlush call arrives later than the + * corresponding configureStreams() call, HAL must check + * streamConfigCounter for such race condition. If the counter is less + * than the counter in the last configureStreams() call HAL last + * received, the call is stale and HAL should just return this call. + */ + oneway void signalStreamFlush(in int[] streamIds, in int streamConfigCounter); + + /** + * switchToOffline: + * + * Switch the current running session from actively streaming mode to the + * offline mode. See ICameraOfflineSession for more details. + * + * The streamsToKeep argument contains list of streams IDs where application + * still needs its output. For all streams application does not need anymore, + * camera HAL can send ERROR_BUFFER to speed up the transition, or even send + * ERROR_REQUEST if all output targets of a request is not needed. By the + * time this call returns, camera HAL must have returned all buffers coming + * from streams no longer needed and have erased buffer caches of such streams. + * + * For all requests that are going to be transferred to offline session, + * the ICameraDeviceSession is responsible to capture all input buffers from + * the image sensor before the switchToOffline call returns. Before + * switchToOffline returns, camera HAL must have completed all requests not + * switching to offline mode, and collected information on what streams and + * requests are going to continue in the offline session, in the + * offlineSessionInfo output argument. + * + * If there are no requests qualified to be transferred to offline session, + * the camera HAL must return a null ICameraOfflineSession object with OK + * status. In this scenario, the camera HAL still must flush all inflight + * requests and unconfigure all streams before returning this call. + * + * After switchToOffline returns, the ICameraDeviceSession must be back to + * unconfigured state as if it is just created and no streams are configured. + * Also, camera HAL must not call any methods in ICameraDeviceCallback since + * all unfinished requests are now transferred to the offline session. + * After the call returns, camera service may then call close to close + * the camera device, or call configureStream* again to reconfigure the + * camera and then send new capture requests with processCaptureRequest. In + * the latter case, it is legitimate for camera HAL to call methods in + * ICameraDeviceCallback again in response to the newly submitted capture + * requests. + * + * A service specific error will be returned on the following conditions + * ILLEGAL_ARGUMENT: + * If camera does not support offline mode in any one of streams + * in streamsToKeep argument. Note that the camera HAL must report + * if a stream supports offline mode in HalStreamConfiguration + * output of configureStreams_3_6 method. If all streams in + * streamsToKeep argument support offline mode, then the camera HAL + * must not return this error. + * + * @param in streamsToKeep The streamIds of the streams that will continue in the offline + * session + * @param out offlineSessionInfo Information on what streams and requests will + * be transferred to offline session to continue processing. + * + * @return offlineSession The offline session object camera service will use + * to interact with. + */ + ICameraOfflineSession switchToOffline( + in int[] streamsToKeep, out CameraOfflineSessionInfo offlineSessionInfo); + + /** + * repeatingRequestEnd: + * + * Notification about the last frame number in a repeating request along with the + * ids of all streams included in the repeating request. + * + * This can be called at any point after 'processCaptureRequest' in response + * to camera clients disabling an active repeating request. + * + * Performance requirements: + * The call must not be blocked for extensive periods and should be extremely lightweight. There + * must be no frame rate degradation or frame jitter introduced. + * + * This method must always succeed, even if the device has encountered a + * serious error. + */ + void repeatingRequestEnd(in int frameNumber, in int[] streamIds); + +} diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraInjectionSession.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraInjectionSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ecb8a27d3b8ac55e73a4e3420c3799bb81242452 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ICameraInjectionSession.aidl @@ -0,0 +1,81 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.CameraMetadata; +import android.hardware.camera.device.ICameraDeviceSession; +import android.hardware.camera.device.StreamConfiguration; + +/** + * Camera device active session interface. + * + * Obtained via ICameraDevice::open(), this interface contains the methods to + * configure and request captures from an active camera device. + */ +@VintfStability +interface ICameraInjectionSession { + /** + * configureInjectionStreams: + * + * Identical to ICameraDeviceSession.configureStreams, except that: + * + * @param requestedConfiguration + * The current stream configuration of the internal camera session and + * the injection camera must follow the configuration without overriding + * any part of it. + * @param characteristics + * The characteristics of internal camera contains a list of keys so that + * the stream continuity can be maintained after the external camera is + * injected. + * + * A service specific error will be returned on the following conditions + * + * INTERNAL_ERROR: + * If there has been a fatal error and the device is no longer + * operational. Only close() can be called successfully by the + * framework after this error is returned. + * ILLEGAL_ARGUMENT: + * If the requested stream configuration is invalid. Some examples + * of invalid stream configurations include: + * - Not including any OUTPUT streams + * - Including streams with unsupported formats, or an unsupported + * size for that format. + * - Including too many output streams of a certain format. + * - Unsupported rotation configuration + * - Stream sizes/formats don't satisfy the + * StreamConfigurationMode requirements + * for non-NORMAL mode, or the requested operation_mode is not + * supported by the HAL. + * - Unsupported usage flag + * The camera service cannot filter out all possible illegal stream + * configurations, since some devices may support more simultaneous + * streams or larger stream resolutions than the minimum required + * for a given camera device hardware level. The HAL must return an + * ILLEGAL_ARGUMENT for any unsupported stream set, and then be + * ready to accept a future valid stream configuration in a later + * configureInjectionStreams call. + */ + void configureInjectionStreams( + in StreamConfiguration requestedConfiguration, in CameraMetadata characteristics); + + /** + * Retrieves the ICameraDeviceSession interface in order for the camera framework to be able + * to use the injection session for all of the operations that a non-injected + * ICameraDeviceSession would be able to perform. + */ + ICameraDeviceSession getCameraDeviceSession(); +} diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraOfflineSession.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraOfflineSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec35b36d754d29deb6c788d9ecdd299b6e87b3de --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ICameraOfflineSession.aidl @@ -0,0 +1,83 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.ICameraDeviceCallback; +import android.hardware.common.fmq.MQDescriptor; +import android.hardware.common.fmq.SynchronizedReadWrite; + +/** + * Camera device offline session interface. + * + * Obtained via ICameraDeviceSession::switchToOffline(), this interface contains + * the methods and callback interfaces that define how camera service interacts + * with an offline session. + * + * An offline session contains some unfinished capture requests that were submitted + * to the parent ICameraDeviceSession before calling switchToOffline, and is + * responsible for delivering these capture results back to camera service regardless + * of whether the parent camera device is still opened or not. An offline session must + * not have access to the camera device's image sensor. During switchToOffline + * call, camera HAL must capture all necessary frames from the image sensor that + * is needed for completing the requests offline later. + */ +@VintfStability +interface ICameraOfflineSession { + /** + * Close the offline session and release all resources. + * + * Camera service may call this method before or after the offline session + * has finished all requests it needs to handle. If there are still unfinished + * requests when close is called, camera HAL must send ERROR_REQUEST for + * all unfinished requests and return all buffers via + * ICameraDeviceCallback#processCaptureResult or + * ICameraDeviceCallback#returnStreamBuffers. + * Also, all buffer caches maintained by the offline session must be erased + * before the close call returns. + */ + void close(); + + /** + * getCaptureResultMetadataQueue: + * + * Retrieves the queue used along with + * ICameraDeviceCallback#processCaptureResult. + * + * Clients to ICameraOfflineSession must: + * - Call getCaptureRequestMetadataQueue to retrieve the fast message queue; + * - In implementation of ICameraDeviceCallback, test whether + * .fmqResultSize field is zero. + * - If .fmqResultSize != 0, read result metadata from the fast message + * queue; + * - otherwise, read result metadata in CaptureResult.result. + * + * @return the queue that implementation writes result metadata to. + */ + MQDescriptor getCaptureResultMetadataQueue(); + + /** + * Set the callbacks for offline session to communicate with camera service. + * + * Offline session is responsible to store all callbacks the camera HAL + * generated after the return of ICameraDeviceSession::switchToOffline, and + * send them to camera service once this method is called. + * + * Camera service must not call this method more than once, so these + * callbacks can be assumed to be constant after the first setCallback call. + */ + void setCallback(in ICameraDeviceCallback cb); +} diff --git a/camera/device/aidl/android/hardware/camera/device/NotifyMsg.aidl b/camera/device/aidl/android/hardware/camera/device/NotifyMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..79109673bef8e072dc276e2b66dd5098b637edf3 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/NotifyMsg.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.ErrorMsg; +import android.hardware.camera.device.ShutterMsg; + +/** + * NotifyMsg: + * + * The message structure sent to ICameraDeviceCallback::notify() + */ +@VintfStability +union NotifyMsg { + /** + * Error message contents. + */ + ErrorMsg error; + + /** + * Shutter message contents. + */ + ShutterMsg shutter; + +} diff --git a/camera/device/aidl/android/hardware/camera/device/OfflineRequest.aidl b/camera/device/aidl/android/hardware/camera/device/OfflineRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ccfc50f90d002a850368391a72a757cb416b5896 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/OfflineRequest.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * OfflineRequest: + * + * Information about a capture request being switched to offline mode via the + * ICameraDeviceSession#switchToOffline method. + * + */ +@VintfStability +parcelable OfflineRequest { + /** + * Must match a inflight CaptureRequest sent by camera service + */ + int frameNumber; + + /** + * Stream IDs for outputs that will be returned via ICameraDeviceCallback. + * The stream ID must be within one of offline stream listed in + * CameraOfflineSessionInfo. + * Camera service will validate these pending buffers are matching camera + * service's record to make sure no buffers are leaked during the + * switchToOffline call. + */ + int[] pendingStreams; +} diff --git a/camera/device/aidl/android/hardware/camera/device/OfflineStream.aidl b/camera/device/aidl/android/hardware/camera/device/OfflineStream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0b954492fc4f018c1bca44e2573b3271fe4ec29a --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/OfflineStream.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * OfflineStream: + * + * Information about a stream being switched to offline mode via the + * ICameraDeviceSession#switchToOffline method. + * + */ +@VintfStability +parcelable OfflineStream { + /** + * IDs of a stream to be transferred to offline session. + * + * For devices that do not support HAL buffer management, this must be + * one of stream ID listed in streamsToKeep argument of the + * switchToOffline call. + * For devices that support HAL buffer management, this could be any stream + * that was configured right before calling switchToOffline. + */ + int id; + + /** + * Number of outstanding buffers that will be returned via offline session + */ + int numOutstandingBuffers; + + /** + * Buffer ID of buffers currently cached between camera service and this + * stream, which may or may not be owned by the camera HAL right now. + * See StreamBuffer#bufferId for more details. + */ + long[] circulatingBufferIds; +} diff --git a/camera/device/aidl/android/hardware/camera/device/PhysicalCameraMetadata.aidl b/camera/device/aidl/android/hardware/camera/device/PhysicalCameraMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ea888021b9ae9a128871cf0153fa49d402f6d1e2 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/PhysicalCameraMetadata.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.CameraMetadata; + +/** + * PhysicalCameraMetadata: + * + * Individual camera metadata for a physical camera as part of a logical + * multi-camera. Camera HAL should return one such metadata for each physical + * camera being requested on. + */ +@VintfStability +parcelable PhysicalCameraMetadata { + /** + * If non-zero, read metadata from result metadata queue instead + * (see ICameraDeviceSession.getCaptureResultMetadataQueue). + * If zero, read metadata from .metadata field. + * + * The logical CaptureResult metadata is read first from the FMQ, followed by + * the physical cameras' metadata starting from index 0. + */ + long fmqMetadataSize; + + /** + * Contains the physical device camera id. As long as the corresponding + * processCaptureRequest requests on a particular physical camera stream, + * the metadata for that physical camera should be generated for the capture + * result. + */ + String physicalCameraId; + + /** + * If fmqMetadataSize is zero, the metadata buffer contains the metadata + * for the physical device with physicalCameraId. + */ + CameraMetadata metadata; +} diff --git a/camera/device/aidl/android/hardware/camera/device/PhysicalCameraSetting.aidl b/camera/device/aidl/android/hardware/camera/device/PhysicalCameraSetting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a8c235fb5750c07654865de2527e3fe679eba204 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/PhysicalCameraSetting.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.CameraMetadata; + +/** + * PhysicalCameraSetting: + * + * Individual camera settings for logical camera backed by multiple physical devices. + * Clients are allowed to pass separate settings for each physical device that has + * corresponding configured HalStream and the respective stream id is present in the + * output buffers of the capture request. + */ +@VintfStability +parcelable PhysicalCameraSetting { + /** + * If non-zero, read settings from request queue instead + * (see ICameraDeviceSession.getCaptureRequestMetadataQueue). + * If zero, read settings from .settings field. + * + * The logical settings metadata is read first from the FMQ, followed by + * the physical cameras' settings metadata starting from index 0. + */ + long fmqSettingsSize; + + /** + * Contains the physical device camera id. Any settings passed by client here + * should be applied for this physical device. In case the physical id is invalid or + * it is not present among the last configured streams, Hal should fail the process + * request and return Status::ILLEGAL_ARGUMENT. + */ + String physicalCameraId; + + /** + * If fmqSettingsSize is zero, the settings buffer contains the capture and + * processing parameters for the physical device with id 'physicalCameraId'. + * As a special case, an empty settings buffer indicates that the + * settings are identical to the most-recently submitted capture request. + * An empty buffer cannot be used as the first submitted request after + * a configureStreams() call. + * + * This field must be used if fmqSettingsSize is zero. It must not be used + * if fmqSettingsSize is non-zero. + */ + CameraMetadata settings; +} diff --git a/camera/device/aidl/android/hardware/camera/device/RequestTemplate.aidl b/camera/device/aidl/android/hardware/camera/device/RequestTemplate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0235d8a465be42b76b85b5e5ec15365d27099ab0 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/RequestTemplate.aidl @@ -0,0 +1,73 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * RequestTemplate: + * + * Available template types for + * ICameraDevice::constructDefaultRequestSettings() + */ +@VintfStability +@Backing(type="int") +enum RequestTemplate { + /** + * Standard camera preview operation with 3A on auto. + */ + PREVIEW = 1, + + /** + * Standard camera high-quality still capture with 3A and flash on auto. + */ + STILL_CAPTURE = 2, + + /** + * Standard video recording plus preview with 3A on auto, torch off. + */ + VIDEO_RECORD = 3, + + /** + * High-quality still capture while recording video. Applications typically + * include preview, video record, and full-resolution YUV or JPEG streams in + * request. Must not cause stuttering on video stream. 3A on auto. + */ + VIDEO_SNAPSHOT = 4, + + /** + * Zero-shutter-lag mode. Application typically request preview and + * full-resolution data for each frame, and reprocess it to JPEG when a + * still image is requested by user. Settings must provide highest-quality + * full-resolution images without compromising preview frame rate. 3A on + * auto. + */ + ZERO_SHUTTER_LAG = 5, + + /** + * A basic template for direct application control of capture + * parameters. All automatic control is disabled (auto-exposure, auto-white + * balance, auto-focus), and post-processing parameters are set to preview + * quality. The manual capture parameters (exposure, sensitivity, etc.) + * are set to reasonable defaults, but may be overridden by the + * application depending on the intended use case. + */ + MANUAL = 6, + + /** + * First value for vendor-defined request templates + */ + VENDOR_TEMPLATE_START = 0x40000000, +} diff --git a/camera/device/aidl/android/hardware/camera/device/ShutterMsg.aidl b/camera/device/aidl/android/hardware/camera/device/ShutterMsg.aidl new file mode 100644 index 0000000000000000000000000000000000000000..24ae1a0292f9855bb1e2a2c7ef25b177ba154988 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/ShutterMsg.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * ShutterMsg: + * + * Message contents for MsgType::SHUTTER + */ +@VintfStability +parcelable ShutterMsg { + /** + * Frame number of the request that has begun exposure or reprocessing. + */ + int frameNumber; + + /** + * Timestamp for the start of capture. For a reprocess request, this must + * be input image's start of capture. This must match the capture result + * metadata's sensor exposure start timestamp. + */ + long timestamp; + + /** + * Timestamp for the capture readout. This must be in the same time domain + * as timestamp, and for a rolling shutter sensor, the value must be + * timestamp + exposureTime + t_crop_top where t_crop_top is the exposure time + * skew of the cropped lines on the top. + */ + long readoutTimestamp; +} diff --git a/camera/device/aidl/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/android/hardware/camera/device/Stream.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e35e4ff6e6a92daf07d6094fac33e2ac1f55d9f5 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/Stream.aidl @@ -0,0 +1,225 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.StreamRotation; +import android.hardware.camera.device.StreamType; + +/** + * Stream: + * + * A descriptor for a single camera input or output stream. A stream is defined + * by the framework by its buffer resolution and format, and additionally by the + * HAL with the gralloc usage flags and the maximum in-flight buffer count. + * + * Also contains the multi-resolution output surface group Id field, sensor pixel modes and + * dynamic range profile. + */ +@VintfStability +parcelable Stream { + /** + * Stream ID - a nonnegative integer identifier for a stream. + * + * The identical stream ID must reference the same stream, with the same + * width/height/format, across consecutive calls to configureStreams. + * + * If previously-used stream ID is not used in a new call to + * configureStreams, then that stream is no longer active. Such a stream ID + * may be reused in a future configureStreams with a new + * width/height/format. + * + */ + int id; + + /** + * The type of the stream (input vs output, etc). + */ + StreamType streamType; + + /** + * The width in pixels of the buffers in this stream + */ + int width; + + /** + * The height in pixels of the buffers in this stream + */ + int height; + + /** + * The pixel format for the buffers in this stream. + * + * If IMPLEMENTATION_DEFINED is used, then the platform + * gralloc module must select a format based on the usage flags provided by + * the camera device and the other endpoint of the stream. + * + */ + android.hardware.graphics.common.PixelFormat format; + + /** + * The bitfield of gralloc usage flags for this stream, as needed by the consumer of + * the stream. + * + * The usage flags from the producer and the consumer must be combined + * together and then passed to the platform gralloc HAL module for + * allocating the gralloc buffers for each stream. + * + * The HAL may use these consumer flags to decide stream configuration. For + * streamType INPUT, the value of this field is always 0. For all streams + * passed via configureStreams(), the HAL must set its own + * additional usage flags in its output HalStreamConfiguration. + * + * The usage flag for an output stream may be bitwise combination of usage + * flags for multiple consumers, for the purpose of sharing one camera + * stream between those consumers. The HAL must fail configureStreams call + * with ILLEGAL_ARGUMENT if the combined flags cannot be supported due to + * imcompatible buffer format, dataSpace, or other hardware limitations. + */ + android.hardware.graphics.common.BufferUsage usage; + + /** + * A bitfield that describes the contents of the buffer. The format and buffer + * dimensions define the memory layout and structure of the stream buffers, + * while dataSpace defines the meaning of the data within the buffer. + * + * For most formats, dataSpace defines the color space of the image data. + * In addition, for some formats, dataSpace indicates whether image- or + * depth-based data is requested. See + * android.hardware.graphics.common@1.0::types for details of formats and + * valid dataSpace values for each format. + * + * The HAL must use this dataSpace to configure the stream to the correct + * colorspace, or to select between color and depth outputs if + * supported. The dataspace values are set using the V0 dataspace + * definitions. + */ + android.hardware.graphics.common.Dataspace dataSpace; + + /** + * The required output rotation of the stream. + * + * This must be inspected by HAL along with stream width and height. For + * example, if the rotation is 90 degree and the stream width and height is + * 720 and 1280 respectively, camera service must supply buffers of size + * 720x1280, and HAL must capture a 1280x720 image and rotate the image by + * 90 degree counterclockwise. The rotation field must be ignored when the + * stream type is input. + * + * The HAL must inspect this field during stream configuration and return + * IllegalArgument if HAL cannot perform such rotation. HAL must always + * support ROTATION_0, so a configureStreams() call must not fail for + * unsupported rotation if rotation field of all streams is ROTATION_0. + * + */ + StreamRotation rotation; + + /** + * The physical camera id this stream belongs to. + * + * If the camera device is not a logical multi camera, or if the camera is a logical + * multi camera but the stream is not a physical output stream, this field will point to a + * 0-length string. + * + * A logical multi camera is a camera device backed by multiple physical cameras that + * are also exposed to the application. And for a logical multi camera, a physical output + * stream is an output stream specifically requested on an underlying physical camera. + * + * A logical camera is a camera device backed by multiple physical camera + * devices. And a physical stream is a stream specifically requested on a + * underlying physical camera device. + * + * For an input stream, this field is guaranteed to be a 0-length string. + * + * When not empty, this field is the field of one of the full-qualified device + * instance names returned by getCameraIdList(). + */ + String physicalCameraId; + + /** + * The size of a buffer from this Stream, in bytes. + * + * For non PixelFormat::BLOB formats, this entry must be 0 and HAL should use + * android.hardware.graphics.mapper lockYCbCr API to get buffer layout. + * + * For BLOB format with dataSpace Dataspace::DEPTH, this must be zero and HAL must + * determine the buffer size based on ANDROID_DEPTH_MAX_DEPTH_SAMPLES. + * + * For BLOB format with dataSpace Dataspace::JFIF, this must be non-zero and represent the + * maximal size HAL can lock using android.hardware.graphics.mapper lock API. + * + */ + int bufferSize; + + /** + * The surface group id used for multi-resolution output streams. + * + * This works similar to the surfaceGroupId of OutputConfiguration in the + * public API, with the exception that this is for multi-resolution image + * reader and is used by the camera HAL to choose a target stream within + * the same group to which images are written. All streams in the same group + * will have the same image format, data space, and usage flag. + * + * The framework must only call processCaptureRequest on at most one of the + * streams within a surface group. Depending on current active physical + * camera backing the logical multi-camera, or the pixel mode the camera is + * running in, the HAL can choose to request and return a buffer from any + * stream within the same group. -1 means that this stream is an input + * stream, or is an output stream which doesn't belong to any group. + * + * Streams with the same non-negative group id must have the same format and + * usage flag. + */ + int groupId; + + /** + * The sensor pixel modes used by this stream. This can assist the camera + * HAL in decision making about stream combination support. + * If this is empty, the HAL must assume that this stream will only be used + * with ANDROID_SENSOR_PIXEL_MODE set to ANDROID_SENSOR_PIXEL_MODE_DEFAULT. + */ + android.hardware.camera.metadata.SensorPixelMode[] sensorPixelModesUsed; + + /** + * The dynamic range profile for this stream. + * + * This field is valid and must only be considered for streams with format + * android.hardware.graphics.common.PixelFormat.YCBCR_P010 or + * android.hardware.graphics.common.PixelFormat.IMPLEMENTATION_DEFINED on devices supporting the + * ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_10_BIT capability. + * + */ + android.hardware.camera.metadata.RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile; + + /** + * The stream use case describing the stream's purpose + * + * This flag provides the camera device a hint on what user scenario this + * stream is intended for. With this flag, the camera device can optimize + * camera pipeline parameters, such as tuning, sensor mode, and ISP settings, + * for the intended use case. + * + * When this field is set to DEFAULT, the camera device should behave in + * the same way as in previous HAL versions, and optimize the camera pipeline + * based on stream format, data space, usage flag, and other stream properties. + * + * The HAL reports supported stream use cases in + * ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES. If the HAL doesn't support + * setting stream use cases, the camera framework leaves this field as + * DEFAULT. + */ + android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase; +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamBuffer.aidl b/camera/device/aidl/android/hardware/camera/device/StreamBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e487494ee6034c9e1047c8260c7ace7faee86699 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamBuffer.aidl @@ -0,0 +1,114 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.BufferStatus; +import android.hardware.common.NativeHandle; + +/** + * StreamBuffer: + * + * A single buffer from a camera HAL stream. It includes a handle to its parent + * stream, the handle to the gralloc buffer itself, and sync fences + * + * The buffer does not specify whether it is to be used for input or output; + * that is determined by its parent stream type and how the buffer is passed to + * the HAL device. + */ +@VintfStability +parcelable StreamBuffer { + /** + * The ID of the stream this buffer is associated with. -1 indicates an + * invalid (empty) StreamBuffer, in which case buffer must also point to + * null and bufferId must be 0. + */ + int streamId; + + /** + * The unique ID of the buffer within this StreamBuffer. 0 indicates this + * StreamBuffer contains no buffer. + * For StreamBuffers sent to the HAL in a CaptureRequest, this ID uniquely + * identifies a buffer. When a buffer is sent to HAL for the first time, + * both bufferId and buffer handle must be filled. HAL must keep track of + * the mapping between bufferId and corresponding buffer until the + * corresponding stream is removed from stream configuration or until camera + * device session is closed. After the first time a buffer is introduced to + * HAL, in the future camera service must refer to the same buffer using + * only bufferId, and keep the buffer handle null. + */ + long bufferId; + + /** + * The graphics buffer handle to the buffer. + * + * For StreamBuffers sent to the HAL in a CaptureRequest, if the bufferId + * is not seen by the HAL before, this buffer handle is guaranteed to be a + * valid handle to a graphics buffer, with dimensions and format matching + * that of the stream. If the bufferId has been sent to the HAL before, this + * buffer handle must be null and HAL must look up the actual buffer handle + * to use from its own bufferId to buffer handle map. + * + * For StreamBuffers returned in a CaptureResult, this must be null, since + * the handle to the buffer is already known to the client (since the client + * sent it in the matching CaptureRequest), and the handle can be identified + * by the combination of frame number and stream ID. + */ + NativeHandle buffer; + + /** + * Current state of the buffer. The framework must not pass buffers to the + * HAL that are in an error state. In case a buffer could not be filled by + * the HAL, it must have its status set to ERROR when returned to the + * framework with processCaptureResult(). + */ + BufferStatus status; + + /** + * The acquire sync fence for this buffer. The HAL must wait on this fence + * fd before attempting to read from or write to this buffer. + * + * In a buffer included in a CaptureRequest, the client may set this to null + * to indicate that no waiting is necessary for this buffer. + * + * When the HAL returns an input or output buffer to the framework with + * processCaptureResult(), the acquireFence must be set to null. If the HAL + * never waits on the acquireFence due to an error in filling or reading a + * buffer, when calling processCaptureResult() the HAL must set the + * releaseFence of the buffer to be the acquireFence passed to it by the + * client. This allows the client to wait on the fence before reusing the + * buffer. + */ + NativeHandle acquireFence; + + /** + * The release sync fence for this buffer. The HAL must set this to a valid + * fence fd when returning the input buffer or output buffers to the client + * in a CaptureResult, or set it to null to indicate that no waiting is + * required for this buffer. + * + * The client must set this to be null for all buffers included in a + * processCaptureRequest call. + * + * After signaling the releaseFence for this buffer, the HAL + * must not make any further attempts to access this buffer as the + * ownership has been fully transferred back to the client. + * + * If this is null, then the ownership of this buffer is transferred back + * immediately upon the call of processCaptureResult. + */ + NativeHandle releaseFence; +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamBufferRequestError.aidl b/camera/device/aidl/android/hardware/camera/device/StreamBufferRequestError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ba00459002c8e83b1fc569b49d1e2bbef35c16b --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamBufferRequestError.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +@VintfStability +@Backing(type="int") +enum StreamBufferRequestError { + /** + * Get buffer failed due to timeout waiting for an available buffer. This is + * likely due to the client application holding too many buffers, or the + * system is under memory pressure. + * This is not a fatal error. HAL may try to request buffer for this stream + * later. If HAL cannot get a buffer for certain capture request in time + * due to this error, HAL can send an ERROR_REQUEST to camera service and + * drop processing that request. + */ + NO_BUFFER_AVAILABLE = 1, + /** + * Get buffer failed due to HAL has reached its maxBuffer count. This is not + * a fatal error. HAL may try to request buffer for this stream again after + * it returns at least one buffer of that stream to camera service. + */ + MAX_BUFFER_EXCEEDED = 2, + /** + * Get buffer failed due to the stream is disconnected by client + * application, has been removed, or not recognized by camera service. + * This means application is no longer interested in this stream. + * Requesting buffer for this stream must never succeed after this error is + * returned. HAL must safely return all buffers of this stream after + * getting this error. If HAL gets another capture request later targeting + * a disconnected stream, HAL must send an ERROR_REQUEST to camera service + * and drop processing that request. + */ + STREAM_DISCONNECTED = 3, + /** + * Get buffer failed for unknown reasons. This is a fatal error and HAL must + * send ERROR_DEVICE to camera service and be ready to be closed. + */ + UNKNOWN_ERROR = 4, +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamBufferRet.aidl b/camera/device/aidl/android/hardware/camera/device/StreamBufferRet.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b6d85c252cce9fc7acf67df82499dff26e777d74 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamBufferRet.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.StreamBuffersVal; + +@VintfStability +parcelable StreamBufferRet { + int streamId; + + StreamBuffersVal val; +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamBuffersVal.aidl b/camera/device/aidl/android/hardware/camera/device/StreamBuffersVal.aidl new file mode 100644 index 0000000000000000000000000000000000000000..125d9c76d3e4e186532eabe804504247832d6bac --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamBuffersVal.aidl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.StreamBuffer; +import android.hardware.camera.device.StreamBufferRequestError; + +/** + * Per-stream return value for requestStreamBuffers. + * For each stream, either an StreamBufferRequestError error code, or all + * requested buffers for this stream is returned, so buffers.size() must be + * equal to BufferRequest::numBuffersRequested of corresponding stream. + */ +@VintfStability +union StreamBuffersVal { + StreamBufferRequestError error = StreamBufferRequestError.UNKNOWN_ERROR; + + StreamBuffer[] buffers; +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamConfiguration.aidl b/camera/device/aidl/android/hardware/camera/device/StreamConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cacd32c1716292fbf2b865169da37b0c99ab11f6 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamConfiguration.aidl @@ -0,0 +1,86 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +import android.hardware.camera.device.CameraMetadata; +import android.hardware.camera.device.Stream; +import android.hardware.camera.device.StreamConfigurationMode; + +/** + * StreamConfiguration: + * + * A structure of stream definitions, used by configureStreams(). This + * structure defines all the output streams and the reprocessing input + * stream for the current camera use case. + */ +@VintfStability +parcelable StreamConfiguration { + /** + * An array of camera stream pointers, defining the input/output + * configuration for the camera HAL device. + */ + Stream[] streams; + + /** + * The operation mode of streams in this configuration. The HAL can use this + * mode as an indicator to set the stream property (e.g., + * HalStream.maxBuffers) appropriately. For example, if the + * configuration is + * CONSTRAINED_HIGH_SPEED_MODE, the HAL may + * want to set aside more buffers for batch mode operation (see + * android.control.availableHighSpeedVideoConfigurations for batch mode + * definition). + * + */ + StreamConfigurationMode operationMode; + + /** + * Session wide camera parameters. + * + * The session parameters contain the initial values of any request keys that were + * made available via ANDROID_REQUEST_AVAILABLE_SESSION_KEYS. The Hal implementation + * can advertise any settings that can potentially introduce unexpected delays when + * their value changes during active process requests. Typical examples are + * parameters that trigger time-consuming HW re-configurations or internal camera + * pipeline updates. The field is optional, clients can choose to ignore it and avoid + * including any initial settings. If parameters are present, then hal must examine + * their values and configure the internal camera pipeline accordingly. + */ + CameraMetadata sessionParams; + + /** + * An incrementing counter used for HAL to keep track of the stream + * configuration and the paired oneway signalStreamFlush call. When the + * counter in signalStreamFlush call is less than the counter here, that + * signalStreamFlush call is stale. + */ + int streamConfigCounter; + + /** + * If an input stream is configured, whether the input stream is expected to + * receive variable resolution images. + * + * This flag can only be set to true if the camera device supports + * multi-resolution input streams by advertising input stream configurations in + * physicalCameraMultiResolutionStreamConfigurations in its physical cameras' + * characteristics. + * + * When this flag is set to true, the input stream's width and height can be + * any one of the supported multi-resolution input stream sizes. + */ + boolean multiResolutionInputImage; +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamConfigurationMode.aidl b/camera/device/aidl/android/hardware/camera/device/StreamConfigurationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10feecb2946fa866b9518cf621ca012a0da40385 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamConfigurationMode.aidl @@ -0,0 +1,122 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * StreamConfigurationMode: + * + * This defines the general operation mode for the HAL (for a given stream + * configuration) where modes besides NORMAL have different semantics, and + * usually limit the generality of the API in exchange for higher performance in + * some particular area. + */ +@VintfStability +@Backing(type="int") +enum StreamConfigurationMode { + /** + * Normal stream configuration operation mode. This is the default camera + * operation mode, where all semantics of HAL APIs and metadata controls + * apply. + */ + NORMAL_MODE = 0, + + /** + * Special constrained high speed operation mode for devices that can not + * support high speed output in NORMAL mode. All streams in this + * configuration are operating at high speed mode and have different + * characteristics and limitations to achieve high speed output. The NORMAL + * mode can still be used for high speed output if the HAL can support high + * speed output while satisfying all the semantics of HAL APIs and metadata + * controls. It is recommended for the HAL to support high speed output in + * NORMAL mode (by advertising the high speed FPS ranges in + * android.control.aeAvailableTargetFpsRanges) if possible. + * + * This mode has below limitations/requirements: + * + * 1. The HAL must support up to 2 streams with sizes reported by + * android.control.availableHighSpeedVideoConfigurations. + * 2. In this mode, the HAL is expected to output up to 120fps or + * higher. This mode must support the targeted FPS range and size + * configurations reported by + * android.control.availableHighSpeedVideoConfigurations. + * 3. The HAL must support IMPLEMENTATION_DEFINED output + * stream format. + * 4. To achieve efficient high speed streaming, the HAL may have to + * aggregate multiple frames together and send to camera device for + * processing where the request controls are same for all the frames in + * this batch (batch mode). The HAL must support max batch size and the + * max batch size requirements defined by + * android.control.availableHighSpeedVideoConfigurations. + * 5. In this mode, the HAL must override aeMode, awbMode, and afMode to + * ON, ON, and CONTINUOUS_VIDEO, respectively. All post-processing + * block mode controls must be overridden to be FAST. Therefore, no + * manual control of capture and post-processing parameters is + * possible. All other controls operate the same as when + * android.control.mode == AUTO. This means that all other + * android.control.* fields must continue to work, such as + * + * android.control.aeTargetFpsRange + * android.control.aeExposureCompensation + * android.control.aeLock + * android.control.awbLock + * android.control.effectMode + * android.control.aeRegions + * android.control.afRegions + * android.control.awbRegions + * android.control.afTrigger + * android.control.aePrecaptureTrigger + * + * Outside of android.control.*, the following controls must work: + * + * android.flash.mode (TORCH mode only, automatic flash for still + * capture must not work since aeMode is ON) + * android.lens.opticalStabilizationMode (if it is supported) + * android.scaler.cropRegion + * android.statistics.faceDetectMode (if it is supported) + * 6. To reduce the amount of data passed across process boundaries at + * high frame rate, within one batch, camera framework only propagates + * the last shutter notify and the last capture results (including partial + * results and final result) to the app. The shutter notifies and capture + * results for the other requests in the batch are derived by + * the camera framework. As a result, the HAL can return empty metadata + * except for the last result in the batch. + * + * For more details about high speed stream requirements, see + * android.control.availableHighSpeedVideoConfigurations and + * CONSTRAINED_HIGH_SPEED_VIDEO capability defined in + * android.request.availableCapabilities. + * + * This mode only needs to be supported by HALs that include + * CONSTRAINED_HIGH_SPEED_VIDEO in the android.request.availableCapabilities + * static metadata. + */ + CONSTRAINED_HIGH_SPEED_MODE = 1, + + /** + * A set of vendor-defined operating modes, for custom default camera + * application features that can't be implemented in the fully flexible fashion + * required for NORMAL_MODE. + */ + VENDOR_MODE_0 = 0x8000, + VENDOR_MODE_1, + VENDOR_MODE_2, + VENDOR_MODE_3, + VENDOR_MODE_4, + VENDOR_MODE_5, + VENDOR_MODE_6, + VENDOR_MODE_7, +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamRotation.aidl b/camera/device/aidl/android/hardware/camera/device/StreamRotation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1eee97c5fda5bd4945e7fde464e119e6257dd5cb --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamRotation.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * StreamRotation: + * + * The required counterclockwise rotation of camera stream. + */ +@VintfStability +@Backing(type="int") +enum StreamRotation { + /** + * No rotation + */ + ROTATION_0 = 0, + + /** + * Rotate by 90 degree counterclockwise + */ + ROTATION_90 = 1, + + /** + * Rotate by 180 degree counterclockwise + */ + ROTATION_180 = 2, + + /** + * Rotate by 270 degree counterclockwise + */ + ROTATION_270 = 3, +} diff --git a/camera/device/aidl/android/hardware/camera/device/StreamType.aidl b/camera/device/aidl/android/hardware/camera/device/StreamType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4a876c7a15601bfc999a8bdf04d6a6ec826fac02 --- /dev/null +++ b/camera/device/aidl/android/hardware/camera/device/StreamType.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.device; + +/** + * StreamType: + * + * The type of the camera stream, which defines whether the camera HAL device is + * the producer or the consumer for that stream, and how the buffers of the + * stream relate to the other streams. + */ +@VintfStability +@Backing(type="int") +enum StreamType { + /** + * This stream is an output stream; the camera HAL device must fill buffers + * from this stream with newly captured or reprocessed image data. + */ + OUTPUT = 0, + + /** + * This stream is an input stream; the camera HAL device must read buffers + * from this stream and send them through the camera processing pipeline, + * as if the buffer was a newly captured image from the imager. + * + * The pixel format for input stream can be any format reported by + * android.scaler.availableInputOutputFormatsMap. The pixel format of the + * output stream that is used to produce the reprocessing data may be any + * format reported by android.scaler.availableStreamConfigurations. The + * supported input/output stream combinations depends the camera device + * capabilities, see android.scaler.availableInputOutputFormatsMap for + * stream map details. + * + * This kind of stream is generally used to reprocess data into higher + * quality images (that otherwise would cause a frame rate performance + * loss), or to do off-line reprocessing. + * + * The typical use cases are OPAQUE (typically ZSL) and YUV reprocessing, + * see S8.2, S8.3 and S10 for more details. + */ + INPUT = 1, +} diff --git a/camera/metadata/3.7/Android.bp b/camera/metadata/3.7/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..14981b850fd1106b1123614bec383b5251f1eb7a --- /dev/null +++ b/camera/metadata/3.7/Android.bp @@ -0,0 +1,26 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +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"], +} + +hidl_interface { + name: "android.hardware.camera.metadata@3.7", + root: "android.hardware", + srcs: [ + "types.hal", + ], + interfaces: [ + "android.hardware.camera.metadata@3.2", + "android.hardware.camera.metadata@3.3", + "android.hardware.camera.metadata@3.4", + "android.hardware.camera.metadata@3.5", + "android.hardware.camera.metadata@3.6", + ], + gen_java: true, +} diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..301a9435cf8200669c58de7a98fded27cb7ee4c5 --- /dev/null +++ b/camera/metadata/aidl/Android.bp @@ -0,0 +1,30 @@ +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"], +} + +aidl_interface { + name: "android.hardware.camera.metadata", + vendor_available: true, + srcs: ["android/hardware/camera/metadata/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/.hash b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..337c8695906ebb5aa100a95b0e084b7813f3d9b0 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/.hash @@ -0,0 +1 @@ +070719d32c4dd88360ee5ccc25f70280374a0a89 diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/AutomotiveLensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/AutomotiveLensFacing.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14ad26e08afdb4758306b844b5e02cd714cbc768 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/AutomotiveLensFacing.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum AutomotiveLensFacing { + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER = 0, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT = 1, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR = 2, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT = 3, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT = 4, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER = 5, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT = 6, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER = 7, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT = 8, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT = 9, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER = 10, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT = 11, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT = 12, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER = 13, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT = 14, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/AutomotiveLocation.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/AutomotiveLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5417bdbf445b3e301ffc0e710c55d618079b03b5 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/AutomotiveLocation.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum AutomotiveLocation { + ANDROID_AUTOMOTIVE_LOCATION_INTERIOR = 0, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER = 1, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT = 2, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_REAR = 3, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT = 4, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT = 5, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_OTHER = 6, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_FRONT = 7, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_REAR = 8, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_LEFT = 9, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_RIGHT = 10, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/BlackLevelLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/BlackLevelLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dcefa2f6975d02c3ff5ed103c11243abeb1b7a3e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/BlackLevelLock.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum BlackLevelLock { + ANDROID_BLACK_LEVEL_LOCK_OFF = 0, + ANDROID_BLACK_LEVEL_LOCK_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataSection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8bed156d8f67e6f43bdfa0cc59a8a4de6ce0fd44 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -0,0 +1,74 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataSection { + ANDROID_COLOR_CORRECTION = 0, + ANDROID_CONTROL = 1, + ANDROID_DEMOSAIC = 2, + ANDROID_EDGE = 3, + ANDROID_FLASH = 4, + ANDROID_FLASH_INFO = 5, + ANDROID_HOT_PIXEL = 6, + ANDROID_JPEG = 7, + ANDROID_LENS = 8, + ANDROID_LENS_INFO = 9, + ANDROID_NOISE_REDUCTION = 10, + ANDROID_QUIRKS = 11, + ANDROID_REQUEST = 12, + ANDROID_SCALER = 13, + ANDROID_SENSOR = 14, + ANDROID_SENSOR_INFO = 15, + ANDROID_SHADING = 16, + ANDROID_STATISTICS = 17, + ANDROID_STATISTICS_INFO = 18, + ANDROID_TONEMAP = 19, + ANDROID_LED = 20, + ANDROID_INFO = 21, + ANDROID_BLACK_LEVEL = 22, + ANDROID_SYNC = 23, + ANDROID_REPROCESS = 24, + ANDROID_DEPTH = 25, + ANDROID_LOGICAL_MULTI_CAMERA = 26, + ANDROID_DISTORTION_CORRECTION = 27, + ANDROID_HEIC = 28, + ANDROID_HEIC_INFO = 29, + ANDROID_AUTOMOTIVE = 30, + ANDROID_AUTOMOTIVE_LENS = 31, + VENDOR_SECTION = 32768, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl new file mode 100644 index 0000000000000000000000000000000000000000..17253476989fb8e9137fb7b322b057837648d214 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -0,0 +1,74 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataSectionStart { + ANDROID_COLOR_CORRECTION_START = 0, + ANDROID_CONTROL_START = 65536, + ANDROID_DEMOSAIC_START = 131072, + ANDROID_EDGE_START = 196608, + ANDROID_FLASH_START = 262144, + ANDROID_FLASH_INFO_START = 327680, + ANDROID_HOT_PIXEL_START = 393216, + ANDROID_JPEG_START = 458752, + ANDROID_LENS_START = 524288, + ANDROID_LENS_INFO_START = 589824, + ANDROID_NOISE_REDUCTION_START = 655360, + ANDROID_QUIRKS_START = 720896, + ANDROID_REQUEST_START = 786432, + ANDROID_SCALER_START = 851968, + ANDROID_SENSOR_START = 917504, + ANDROID_SENSOR_INFO_START = 983040, + ANDROID_SHADING_START = 1048576, + ANDROID_STATISTICS_START = 1114112, + ANDROID_STATISTICS_INFO_START = 1179648, + ANDROID_TONEMAP_START = 1245184, + ANDROID_LED_START = 1310720, + ANDROID_INFO_START = 1376256, + ANDROID_BLACK_LEVEL_START = 1441792, + ANDROID_SYNC_START = 1507328, + ANDROID_REPROCESS_START = 1572864, + ANDROID_DEPTH_START = 1638400, + ANDROID_LOGICAL_MULTI_CAMERA_START = 1703936, + ANDROID_DISTORTION_CORRECTION_START = 1769472, + ANDROID_HEIC_START = 1835008, + ANDROID_HEIC_INFO_START = 1900544, + ANDROID_AUTOMOTIVE_START = 1966080, + ANDROID_AUTOMOTIVE_LENS_START = 2031616, + VENDOR_SECTION_START = -2147483648, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataTag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9bb55d27df357173a91cea30b2170b3a6af46ded --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -0,0 +1,331 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataTag { + ANDROID_COLOR_CORRECTION_MODE = 0, + ANDROID_COLOR_CORRECTION_TRANSFORM = 1, + ANDROID_COLOR_CORRECTION_GAINS = 2, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE = 3, + ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES = 4, + ANDROID_CONTROL_AE_ANTIBANDING_MODE = 65536, + ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION = 65537, + ANDROID_CONTROL_AE_LOCK = 65538, + ANDROID_CONTROL_AE_MODE = 65539, + ANDROID_CONTROL_AE_REGIONS = 65540, + ANDROID_CONTROL_AE_TARGET_FPS_RANGE = 65541, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER = 65542, + ANDROID_CONTROL_AF_MODE = 65543, + ANDROID_CONTROL_AF_REGIONS = 65544, + ANDROID_CONTROL_AF_TRIGGER = 65545, + ANDROID_CONTROL_AWB_LOCK = 65546, + ANDROID_CONTROL_AWB_MODE = 65547, + ANDROID_CONTROL_AWB_REGIONS = 65548, + ANDROID_CONTROL_CAPTURE_INTENT = 65549, + ANDROID_CONTROL_EFFECT_MODE = 65550, + ANDROID_CONTROL_MODE = 65551, + ANDROID_CONTROL_SCENE_MODE = 65552, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE = 65553, + ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES = 65554, + ANDROID_CONTROL_AE_AVAILABLE_MODES = 65555, + ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES = 65556, + ANDROID_CONTROL_AE_COMPENSATION_RANGE = 65557, + ANDROID_CONTROL_AE_COMPENSATION_STEP = 65558, + ANDROID_CONTROL_AF_AVAILABLE_MODES = 65559, + ANDROID_CONTROL_AVAILABLE_EFFECTS = 65560, + ANDROID_CONTROL_AVAILABLE_SCENE_MODES = 65561, + ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES = 65562, + ANDROID_CONTROL_AWB_AVAILABLE_MODES = 65563, + ANDROID_CONTROL_MAX_REGIONS = 65564, + ANDROID_CONTROL_SCENE_MODE_OVERRIDES = 65565, + ANDROID_CONTROL_AE_PRECAPTURE_ID = 65566, + ANDROID_CONTROL_AE_STATE = 65567, + ANDROID_CONTROL_AF_STATE = 65568, + ANDROID_CONTROL_AF_TRIGGER_ID = 65569, + ANDROID_CONTROL_AWB_STATE = 65570, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS = 65571, + ANDROID_CONTROL_AE_LOCK_AVAILABLE = 65572, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE = 65573, + ANDROID_CONTROL_AVAILABLE_MODES = 65574, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE = 65575, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST = 65576, + ANDROID_CONTROL_ENABLE_ZSL = 65577, + ANDROID_CONTROL_AF_SCENE_CHANGE = 65578, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES = 65579, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES = 65580, + ANDROID_CONTROL_EXTENDED_SCENE_MODE = 65581, + ANDROID_CONTROL_ZOOM_RATIO_RANGE = 65582, + ANDROID_CONTROL_ZOOM_RATIO = 65583, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION = 65584, + ANDROID_DEMOSAIC_MODE = 131072, + ANDROID_EDGE_MODE = 196608, + ANDROID_EDGE_STRENGTH = 196609, + ANDROID_EDGE_AVAILABLE_EDGE_MODES = 196610, + ANDROID_FLASH_FIRING_POWER = 262144, + ANDROID_FLASH_FIRING_TIME = 262145, + ANDROID_FLASH_MODE = 262146, + ANDROID_FLASH_COLOR_TEMPERATURE = 262147, + ANDROID_FLASH_MAX_ENERGY = 262148, + ANDROID_FLASH_STATE = 262149, + ANDROID_FLASH_INFO_AVAILABLE = 327680, + ANDROID_FLASH_INFO_CHARGE_DURATION = 327681, + ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL = 327682, + ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL = 327683, + ANDROID_HOT_PIXEL_MODE = 393216, + ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES = 393217, + ANDROID_JPEG_GPS_COORDINATES = 458752, + ANDROID_JPEG_GPS_PROCESSING_METHOD = 458753, + ANDROID_JPEG_GPS_TIMESTAMP = 458754, + ANDROID_JPEG_ORIENTATION = 458755, + ANDROID_JPEG_QUALITY = 458756, + ANDROID_JPEG_THUMBNAIL_QUALITY = 458757, + ANDROID_JPEG_THUMBNAIL_SIZE = 458758, + ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES = 458759, + ANDROID_JPEG_MAX_SIZE = 458760, + ANDROID_JPEG_SIZE = 458761, + ANDROID_LENS_APERTURE = 524288, + ANDROID_LENS_FILTER_DENSITY = 524289, + ANDROID_LENS_FOCAL_LENGTH = 524290, + ANDROID_LENS_FOCUS_DISTANCE = 524291, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE = 524292, + ANDROID_LENS_FACING = 524293, + ANDROID_LENS_POSE_ROTATION = 524294, + ANDROID_LENS_POSE_TRANSLATION = 524295, + ANDROID_LENS_FOCUS_RANGE = 524296, + ANDROID_LENS_STATE = 524297, + ANDROID_LENS_INTRINSIC_CALIBRATION = 524298, + ANDROID_LENS_RADIAL_DISTORTION = 524299, + ANDROID_LENS_POSE_REFERENCE = 524300, + ANDROID_LENS_DISTORTION = 524301, + ANDROID_LENS_DISTORTION_MAXIMUM_RESOLUTION = 524302, + ANDROID_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION = 524303, + ANDROID_LENS_INFO_AVAILABLE_APERTURES = 589824, + ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES = 589825, + ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS = 589826, + ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION = 589827, + ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE = 589828, + ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE = 589829, + ANDROID_LENS_INFO_SHADING_MAP_SIZE = 589830, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION = 589831, + ANDROID_NOISE_REDUCTION_MODE = 655360, + ANDROID_NOISE_REDUCTION_STRENGTH = 655361, + ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES = 655362, + ANDROID_QUIRKS_METERING_CROP_REGION = 720896, + ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO = 720897, + ANDROID_QUIRKS_USE_ZSL_FORMAT = 720898, + ANDROID_QUIRKS_USE_PARTIAL_RESULT = 720899, + ANDROID_QUIRKS_PARTIAL_RESULT = 720900, + ANDROID_REQUEST_FRAME_COUNT = 786432, + ANDROID_REQUEST_ID = 786433, + ANDROID_REQUEST_INPUT_STREAMS = 786434, + ANDROID_REQUEST_METADATA_MODE = 786435, + ANDROID_REQUEST_OUTPUT_STREAMS = 786436, + ANDROID_REQUEST_TYPE = 786437, + ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS = 786438, + ANDROID_REQUEST_MAX_NUM_REPROCESS_STREAMS = 786439, + ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS = 786440, + ANDROID_REQUEST_PIPELINE_DEPTH = 786441, + ANDROID_REQUEST_PIPELINE_MAX_DEPTH = 786442, + ANDROID_REQUEST_PARTIAL_RESULT_COUNT = 786443, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES = 786444, + ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS = 786445, + ANDROID_REQUEST_AVAILABLE_RESULT_KEYS = 786446, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS = 786447, + ANDROID_REQUEST_AVAILABLE_SESSION_KEYS = 786448, + ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS = 786449, + ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION = 786450, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = 786451, + ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE = 786452, + ANDROID_SCALER_CROP_REGION = 851968, + ANDROID_SCALER_AVAILABLE_FORMATS = 851969, + ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS = 851970, + ANDROID_SCALER_AVAILABLE_JPEG_SIZES = 851971, + ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM = 851972, + ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS = 851973, + ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES = 851974, + ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS = 851975, + ANDROID_SCALER_AVAILABLE_RAW_SIZES = 851976, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP = 851977, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS = 851978, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS = 851979, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS = 851980, + ANDROID_SCALER_CROPPING_TYPE = 851981, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS = 851982, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP = 851983, + ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES = 851984, + ANDROID_SCALER_ROTATE_AND_CROP = 851985, + ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE = 851986, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS = 851987, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 851988, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 851989, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION = 851990, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP_MAXIMUM_RESOLUTION = 851991, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED = 851992, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = 851994, + ANDROID_SENSOR_EXPOSURE_TIME = 917504, + ANDROID_SENSOR_FRAME_DURATION = 917505, + ANDROID_SENSOR_SENSITIVITY = 917506, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1 = 917507, + ANDROID_SENSOR_REFERENCE_ILLUMINANT2 = 917508, + ANDROID_SENSOR_CALIBRATION_TRANSFORM1 = 917509, + ANDROID_SENSOR_CALIBRATION_TRANSFORM2 = 917510, + ANDROID_SENSOR_COLOR_TRANSFORM1 = 917511, + ANDROID_SENSOR_COLOR_TRANSFORM2 = 917512, + ANDROID_SENSOR_FORWARD_MATRIX1 = 917513, + ANDROID_SENSOR_FORWARD_MATRIX2 = 917514, + ANDROID_SENSOR_BASE_GAIN_FACTOR = 917515, + ANDROID_SENSOR_BLACK_LEVEL_PATTERN = 917516, + ANDROID_SENSOR_MAX_ANALOG_SENSITIVITY = 917517, + ANDROID_SENSOR_ORIENTATION = 917518, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP_DIMENSIONS = 917519, + ANDROID_SENSOR_TIMESTAMP = 917520, + ANDROID_SENSOR_TEMPERATURE = 917521, + ANDROID_SENSOR_NEUTRAL_COLOR_POINT = 917522, + ANDROID_SENSOR_NOISE_PROFILE = 917523, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP = 917524, + ANDROID_SENSOR_PROFILE_TONE_CURVE = 917525, + ANDROID_SENSOR_GREEN_SPLIT = 917526, + ANDROID_SENSOR_TEST_PATTERN_DATA = 917527, + ANDROID_SENSOR_TEST_PATTERN_MODE = 917528, + ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES = 917529, + ANDROID_SENSOR_ROLLING_SHUTTER_SKEW = 917530, + ANDROID_SENSOR_OPTICAL_BLACK_REGIONS = 917531, + ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL = 917532, + ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL = 917533, + ANDROID_SENSOR_OPAQUE_RAW_SIZE = 917534, + ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION = 917535, + ANDROID_SENSOR_PIXEL_MODE = 917536, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED = 917537, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE = 983040, + ANDROID_SENSOR_INFO_SENSITIVITY_RANGE = 983041, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT = 983042, + ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE = 983043, + ANDROID_SENSOR_INFO_MAX_FRAME_DURATION = 983044, + ANDROID_SENSOR_INFO_PHYSICAL_SIZE = 983045, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE = 983046, + ANDROID_SENSOR_INFO_WHITE_LEVEL = 983047, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE = 983048, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED = 983049, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE = 983050, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983051, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983052, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983053, + ANDROID_SENSOR_INFO_BINNING_FACTOR = 983054, + ANDROID_SHADING_MODE = 1048576, + ANDROID_SHADING_STRENGTH = 1048577, + ANDROID_SHADING_AVAILABLE_MODES = 1048578, + ANDROID_STATISTICS_FACE_DETECT_MODE = 1114112, + ANDROID_STATISTICS_HISTOGRAM_MODE = 1114113, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE = 1114114, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE = 1114115, + ANDROID_STATISTICS_FACE_IDS = 1114116, + ANDROID_STATISTICS_FACE_LANDMARKS = 1114117, + ANDROID_STATISTICS_FACE_RECTANGLES = 1114118, + ANDROID_STATISTICS_FACE_SCORES = 1114119, + ANDROID_STATISTICS_HISTOGRAM = 1114120, + ANDROID_STATISTICS_SHARPNESS_MAP = 1114121, + ANDROID_STATISTICS_LENS_SHADING_CORRECTION_MAP = 1114122, + ANDROID_STATISTICS_LENS_SHADING_MAP = 1114123, + ANDROID_STATISTICS_PREDICTED_COLOR_GAINS = 1114124, + ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM = 1114125, + ANDROID_STATISTICS_SCENE_FLICKER = 1114126, + ANDROID_STATISTICS_HOT_PIXEL_MAP = 1114127, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE = 1114128, + ANDROID_STATISTICS_OIS_DATA_MODE = 1114129, + ANDROID_STATISTICS_OIS_TIMESTAMPS = 1114130, + ANDROID_STATISTICS_OIS_X_SHIFTS = 1114131, + ANDROID_STATISTICS_OIS_Y_SHIFTS = 1114132, + ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = 1179648, + ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT = 1179649, + ANDROID_STATISTICS_INFO_MAX_FACE_COUNT = 1179650, + ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT = 1179651, + ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE = 1179652, + ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE = 1179653, + ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES = 1179654, + ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES = 1179655, + ANDROID_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES = 1179656, + ANDROID_TONEMAP_CURVE_BLUE = 1245184, + ANDROID_TONEMAP_CURVE_GREEN = 1245185, + ANDROID_TONEMAP_CURVE_RED = 1245186, + ANDROID_TONEMAP_MODE = 1245187, + ANDROID_TONEMAP_MAX_CURVE_POINTS = 1245188, + ANDROID_TONEMAP_AVAILABLE_TONE_MAP_MODES = 1245189, + ANDROID_TONEMAP_GAMMA = 1245190, + ANDROID_TONEMAP_PRESET_CURVE = 1245191, + ANDROID_LED_TRANSMIT = 1310720, + ANDROID_LED_AVAILABLE_LEDS = 1310721, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL = 1376256, + ANDROID_INFO_VERSION = 1376257, + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION = 1376258, + ANDROID_INFO_DEVICE_STATE_ORIENTATIONS = 1376259, + ANDROID_BLACK_LEVEL_LOCK = 1441792, + ANDROID_SYNC_FRAME_NUMBER = 1507328, + ANDROID_SYNC_MAX_LATENCY = 1507329, + ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = 1572864, + ANDROID_REPROCESS_MAX_CAPTURE_STALL = 1572865, + ANDROID_DEPTH_MAX_DEPTH_SAMPLES = 1638400, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS = 1638401, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS = 1638402, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS = 1638403, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE = 1638404, + ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS = 1638405, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS = 1638406, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS = 1638407, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS = 1638408, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1638409, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1638410, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1638411, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1638412, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1638413, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1638414, + ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS = 1703936, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE = 1703937, + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID = 1703938, + ANDROID_DISTORTION_CORRECTION_MODE = 1769472, + ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES = 1769473, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = 1835008, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS = 1835009, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS = 1835010, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1835011, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1835012, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1835013, + ANDROID_HEIC_INFO_SUPPORTED = 1900544, + ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT = 1900545, + ANDROID_AUTOMOTIVE_LOCATION = 1966080, + ANDROID_AUTOMOTIVE_LENS_FACING = 2031616, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d04ffe390676045e16f69149d70e26485cd2e86e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ColorCorrectionAberrationMode { + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF = 0, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_FAST = 1, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ColorCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ColorCorrectionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..219c802bb84018a8685794647f23e57d22d2584c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ColorCorrectionMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ColorCorrectionMode { + ANDROID_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0, + ANDROID_COLOR_CORRECTION_MODE_FAST = 1, + ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84fd718c53071cb5184bc0acd51bbf45575fd97c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeAntibandingMode { + ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF = 0, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_50HZ = 1, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_60HZ = 2, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f825f112a14acb11169040f46226448861684bc9 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeLock.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeLock { + ANDROID_CONTROL_AE_LOCK_OFF = 0, + ANDROID_CONTROL_AE_LOCK_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeLockAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df7924ed4993a5edd29309e07a81d66d287ec20d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeLockAvailable.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeLockAvailable { + ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE = 0, + ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..75a3486b3722a3207b4fea5779d2fdc907c4e606 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeMode.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeMode { + ANDROID_CONTROL_AE_MODE_OFF = 0, + ANDROID_CONTROL_AE_MODE_ON = 1, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH = 2, + ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH = 3, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE = 4, + ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH = 5, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4678e018804a6bf284721344aefb8c22b588e3bf --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAePrecaptureTrigger { + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE = 0, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START = 1, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3be64ea802715c9c48e42c214e990a3f81d015bc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAeState.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeState { + ANDROID_CONTROL_AE_STATE_INACTIVE = 0, + ANDROID_CONTROL_AE_STATE_SEARCHING = 1, + ANDROID_CONTROL_AE_STATE_CONVERGED = 2, + ANDROID_CONTROL_AE_STATE_LOCKED = 3, + ANDROID_CONTROL_AE_STATE_FLASH_REQUIRED = 4, + ANDROID_CONTROL_AE_STATE_PRECAPTURE = 5, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..155d3c9f929fdc71f42f32efe9330ad5f565d77d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfMode.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfMode { + ANDROID_CONTROL_AF_MODE_OFF = 0, + ANDROID_CONTROL_AF_MODE_AUTO = 1, + ANDROID_CONTROL_AF_MODE_MACRO = 2, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO = 3, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE = 4, + ANDROID_CONTROL_AF_MODE_EDOF = 5, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfSceneChange.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfSceneChange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b31c84fb294d233f84ef7b093251e77be5beb3b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfSceneChange.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfSceneChange { + ANDROID_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED = 0, + ANDROID_CONTROL_AF_SCENE_CHANGE_DETECTED = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4aac8c8a9d7827b5536874923f0f57a65befa253 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfState.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfState { + ANDROID_CONTROL_AF_STATE_INACTIVE = 0, + ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN = 1, + ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED = 2, + ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN = 3, + ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED = 4, + ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED = 5, + ANDROID_CONTROL_AF_STATE_PASSIVE_UNFOCUSED = 6, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfTrigger.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3fbf94b7244fa80be6b43fc7c96ee7d88db4d575 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAfTrigger.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfTrigger { + ANDROID_CONTROL_AF_TRIGGER_IDLE = 0, + ANDROID_CONTROL_AF_TRIGGER_START = 1, + ANDROID_CONTROL_AF_TRIGGER_CANCEL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0e297a51a37827164d495594c5ac199a97767261 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbLock.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbLock { + ANDROID_CONTROL_AWB_LOCK_OFF = 0, + ANDROID_CONTROL_AWB_LOCK_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d471d190bd35d27f01d4ebdf1e3d44858220aa17 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbLockAvailable { + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE = 0, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a3463f835f0f5bba244856216abfdf5450df1626 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbMode.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbMode { + ANDROID_CONTROL_AWB_MODE_OFF = 0, + ANDROID_CONTROL_AWB_MODE_AUTO = 1, + ANDROID_CONTROL_AWB_MODE_INCANDESCENT = 2, + ANDROID_CONTROL_AWB_MODE_FLUORESCENT = 3, + ANDROID_CONTROL_AWB_MODE_WARM_FLUORESCENT = 4, + ANDROID_CONTROL_AWB_MODE_DAYLIGHT = 5, + ANDROID_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = 6, + ANDROID_CONTROL_AWB_MODE_TWILIGHT = 7, + ANDROID_CONTROL_AWB_MODE_SHADE = 8, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f1b0e40d2b83bb81b514f2ce0714f7fa5197426d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlAwbState.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbState { + ANDROID_CONTROL_AWB_STATE_INACTIVE = 0, + ANDROID_CONTROL_AWB_STATE_SEARCHING = 1, + ANDROID_CONTROL_AWB_STATE_CONVERGED = 2, + ANDROID_CONTROL_AWB_STATE_LOCKED = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlCaptureIntent.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlCaptureIntent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..283bb1be026105bd54544154d1dbe44abd0bf6fb --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlCaptureIntent.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlCaptureIntent { + ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM = 0, + ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW = 1, + ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE = 2, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD = 3, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4, + ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG = 5, + ANDROID_CONTROL_CAPTURE_INTENT_MANUAL = 6, + ANDROID_CONTROL_CAPTURE_INTENT_MOTION_TRACKING = 7, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlEffectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlEffectMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..911223dcf3414c97e4e2fe144c9623f2b15d938d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlEffectMode.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlEffectMode { + ANDROID_CONTROL_EFFECT_MODE_OFF = 0, + ANDROID_CONTROL_EFFECT_MODE_MONO = 1, + ANDROID_CONTROL_EFFECT_MODE_NEGATIVE = 2, + ANDROID_CONTROL_EFFECT_MODE_SOLARIZE = 3, + ANDROID_CONTROL_EFFECT_MODE_SEPIA = 4, + ANDROID_CONTROL_EFFECT_MODE_POSTERIZE = 5, + ANDROID_CONTROL_EFFECT_MODE_WHITEBOARD = 6, + ANDROID_CONTROL_EFFECT_MODE_BLACKBOARD = 7, + ANDROID_CONTROL_EFFECT_MODE_AQUA = 8, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlEnableZsl.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlEnableZsl.aidl new file mode 100644 index 0000000000000000000000000000000000000000..920def7c2006f3aa304500b9c9635ba495f22d58 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlEnableZsl.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlEnableZsl { + ANDROID_CONTROL_ENABLE_ZSL_FALSE = 0, + ANDROID_CONTROL_ENABLE_ZSL_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2655d6144a2e67da51a05d7dd4cd6bdb2f5ac94c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlExtendedSceneMode { + ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE = 1, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS = 2, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_VENDOR_START = 64, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f58491e5366649a62c6cf4dc4f965198d114dc3d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlMode { + ANDROID_CONTROL_MODE_OFF = 0, + ANDROID_CONTROL_MODE_AUTO = 1, + ANDROID_CONTROL_MODE_USE_SCENE_MODE = 2, + ANDROID_CONTROL_MODE_OFF_KEEP_STATE = 3, + ANDROID_CONTROL_MODE_USE_EXTENDED_SCENE_MODE = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlSceneMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..994bbf3aa777ea9c24c61608b024cda538f429c5 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlSceneMode.aidl @@ -0,0 +1,63 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlSceneMode { + ANDROID_CONTROL_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY = 1, + ANDROID_CONTROL_SCENE_MODE_ACTION = 2, + ANDROID_CONTROL_SCENE_MODE_PORTRAIT = 3, + ANDROID_CONTROL_SCENE_MODE_LANDSCAPE = 4, + ANDROID_CONTROL_SCENE_MODE_NIGHT = 5, + ANDROID_CONTROL_SCENE_MODE_NIGHT_PORTRAIT = 6, + ANDROID_CONTROL_SCENE_MODE_THEATRE = 7, + ANDROID_CONTROL_SCENE_MODE_BEACH = 8, + ANDROID_CONTROL_SCENE_MODE_SNOW = 9, + ANDROID_CONTROL_SCENE_MODE_SUNSET = 10, + ANDROID_CONTROL_SCENE_MODE_STEADYPHOTO = 11, + ANDROID_CONTROL_SCENE_MODE_FIREWORKS = 12, + ANDROID_CONTROL_SCENE_MODE_SPORTS = 13, + ANDROID_CONTROL_SCENE_MODE_PARTY = 14, + ANDROID_CONTROL_SCENE_MODE_CANDLELIGHT = 15, + ANDROID_CONTROL_SCENE_MODE_BARCODE = 16, + ANDROID_CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO = 17, + ANDROID_CONTROL_SCENE_MODE_HDR = 18, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT = 19, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_START = 100, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_END = 127, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b3b24f750bf3b7867f4cbcaf56619b7bd6a39372 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlVideoStabilizationMode { + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF = 0, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON = 1, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DemosaicMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DemosaicMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..26874a2f851735db77157fe008a0bbe1fc80281e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DemosaicMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DemosaicMode { + ANDROID_DEMOSAIC_MODE_FAST = 0, + ANDROID_DEMOSAIC_MODE_HIGH_QUALITY = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6a154ca0c997017c22862d561c852710b0dd9564 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..23d6589a1cec8e939f2dbb01ccfed282ea38a21a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f3ca03964f7957997ad0ac8ca567ba9df78c8f15 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDynamicDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46a4ce61e6991fcb3a76b102e0d7dfc96dc0ee70 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f5fc218318633a8cff459a7da804e1cf75abafca --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthDepthIsExclusive { + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE = 0, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DistortionCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DistortionCorrectionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46327e0beaf4248d36c2b907ee96bc35105fb2de --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/DistortionCorrectionMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DistortionCorrectionMode { + ANDROID_DISTORTION_CORRECTION_MODE_OFF = 0, + ANDROID_DISTORTION_CORRECTION_MODE_FAST = 1, + ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/EdgeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/EdgeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b02e194bc3d7944ea34e527fa961f220694ce5b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/EdgeMode.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum EdgeMode { + ANDROID_EDGE_MODE_OFF = 0, + ANDROID_EDGE_MODE_FAST = 1, + ANDROID_EDGE_MODE_HIGH_QUALITY = 2, + ANDROID_EDGE_MODE_ZERO_SHUTTER_LAG = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashInfoAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashInfoAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10d07a5c9669dc51d32ea1050e097586c67d4e28 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashInfoAvailable.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashInfoAvailable { + ANDROID_FLASH_INFO_AVAILABLE_FALSE = 0, + ANDROID_FLASH_INFO_AVAILABLE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1ab056067e5ad1660161c01a21ff9d63189860d1 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashMode { + ANDROID_FLASH_MODE_OFF = 0, + ANDROID_FLASH_MODE_SINGLE = 1, + ANDROID_FLASH_MODE_TORCH = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a571e6608d9a1475ea90c6956b343491efb41760 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/FlashState.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashState { + ANDROID_FLASH_STATE_UNAVAILABLE = 0, + ANDROID_FLASH_STATE_CHARGING = 1, + ANDROID_FLASH_STATE_READY = 2, + ANDROID_FLASH_STATE_FIRED = 3, + ANDROID_FLASH_STATE_PARTIAL = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d92c2db86d5aa0b89a9af11d85c1c04d43ae6fb5 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicAvailableHeicStreamConfigurations { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f02cf588bf303ad9aa3a2a7d6c62299a0793c6be --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicAvailableHeicStreamConfigurationsMaximumResolution { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicInfoSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicInfoSupported.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae5a8e784ecd83dd94253098fceae869b3eb53bc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HeicInfoSupported.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicInfoSupported { + ANDROID_HEIC_INFO_SUPPORTED_FALSE = 0, + ANDROID_HEIC_INFO_SUPPORTED_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HotPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HotPixelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1248c6040f6fe620be0b3413cf72b7762c2617ee --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/HotPixelMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HotPixelMode { + ANDROID_HOT_PIXEL_MODE_OFF = 0, + ANDROID_HOT_PIXEL_MODE_FAST = 1, + ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1272f27944813de38ce20635919d3e29acf8e13d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum InfoSupportedBufferManagementVersion { + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE = 0, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8ae39b09844a0ad4b08861abae69d459f1949c90 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum InfoSupportedHardwareLevel { + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3 = 3, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LedAvailableLeds.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LedAvailableLeds.aidl new file mode 100644 index 0000000000000000000000000000000000000000..da558d205653d10bea15c5137296e7fc2153d591 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LedAvailableLeds.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LedAvailableLeds { + ANDROID_LED_AVAILABLE_LEDS_TRANSMIT = 0, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LedTransmit.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LedTransmit.aidl new file mode 100644 index 0000000000000000000000000000000000000000..658b3cd3b2e1821a4658b1f2bf2077edc6407f72 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LedTransmit.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LedTransmit { + ANDROID_LED_TRANSMIT_OFF = 0, + ANDROID_LED_TRANSMIT_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensFacing.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4db987bc6737ca3371e88bd29966f760ad3931b8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensFacing.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensFacing { + ANDROID_LENS_FACING_FRONT = 0, + ANDROID_LENS_FACING_BACK = 1, + ANDROID_LENS_FACING_EXTERNAL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d83d67f103b34ddea4e75e51d70a0ee1b762b2fc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensInfoFocusDistanceCalibration { + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED = 0, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE = 1, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2f039c39a3ed6cb31e1d69e281a4d02fa393d63 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensOpticalStabilizationMode { + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF = 0, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensPoseReference.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensPoseReference.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b2d837a0ff310b617b8b288d773e93d668f886df --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensPoseReference.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensPoseReference { + ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA = 0, + ANDROID_LENS_POSE_REFERENCE_GYROSCOPE = 1, + ANDROID_LENS_POSE_REFERENCE_UNDEFINED = 2, + ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b15b0fe2026dc451e3e938e71b55926d5fa2195 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LensState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensState { + ANDROID_LENS_STATE_STATIONARY = 0, + ANDROID_LENS_STATE_MOVING = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..224a7fab64e3909ae963598d466d07371d1321b3 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LogicalMultiCameraSensorSyncType { + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE = 0, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/NoiseReductionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/NoiseReductionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ed0ebc164a4c70dc71c1de5af8c67ea3c1576f26 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/NoiseReductionMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum NoiseReductionMode { + ANDROID_NOISE_REDUCTION_MODE_OFF = 0, + ANDROID_NOISE_REDUCTION_MODE_FAST = 1, + ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY = 2, + ANDROID_NOISE_REDUCTION_MODE_MINIMAL = 3, + ANDROID_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/QuirksPartialResult.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/QuirksPartialResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d217fe805587f9af4de372866c8f316dd763d665 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/QuirksPartialResult.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum QuirksPartialResult { + ANDROID_QUIRKS_PARTIAL_RESULT_FINAL = 0, + ANDROID_QUIRKS_PARTIAL_RESULT_PARTIAL = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8dc2aa2010be125c11e35082a626738fe14c494a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestAvailableCapabilities { + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 1, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 2, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW = 3, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING = 4, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS = 5, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE = 6, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING = 7, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT = 8, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO = 9, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING = 10, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA = 11, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME = 12, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA = 13, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA = 14, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING = 15, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR = 16, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING = 17, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT = 18, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE = 19, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl new file mode 100644 index 0000000000000000000000000000000000000000..16e38ba90f0f5c7b1ec2eb07b7be8d30061efd0d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="long") @VintfStability +enum RequestAvailableDynamicRangeProfilesMap { + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD = 1, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 = 2, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 = 4, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS = 8, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF = 16, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO = 32, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM = 64, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO = 128, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF = 256, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO = 512, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM = 1024, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO = 2048, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 4096, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestMetadataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestMetadataMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..90fba00fe0787ab9a4faf1863a6b260ad00953d3 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestMetadataMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestMetadataMode { + ANDROID_REQUEST_METADATA_MODE_NONE = 0, + ANDROID_REQUEST_METADATA_MODE_FULL = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f38cfbb4d9f4761d09e625162a6d9ab943006e8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/RequestType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestType { + ANDROID_REQUEST_TYPE_CAPTURE = 0, + ANDROID_REQUEST_TYPE_REPROCESS = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableFormats.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableFormats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..41fd2c234004948f1c0fc8b832008a34dd02eb7d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableFormats.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableFormats { + ANDROID_SCALER_AVAILABLE_FORMATS_RAW16 = 32, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW_OPAQUE = 36, + ANDROID_SCALER_AVAILABLE_FORMATS_YV12 = 842094169, + ANDROID_SCALER_AVAILABLE_FORMATS_YCrCb_420_SP = 17, + ANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED = 34, + ANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888 = 35, + ANDROID_SCALER_AVAILABLE_FORMATS_BLOB = 33, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW10 = 37, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW12 = 38, + ANDROID_SCALER_AVAILABLE_FORMATS_Y8 = 538982489, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..85daa858497bd239e0ee1dc03060a54769216306 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableRecommendedStreamConfigurations { + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW = 0, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD = 1, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT = 2, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT = 3, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL = 4, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW = 5, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT = 6, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT = 8, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START = 24, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1515ad5552797b3ae3010869ff8bf89b05565c7d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableStreamConfigurations { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b9c3374e907433ca9088814627b2e84b46b5c292 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableStreamConfigurationsMaximumResolution { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bfa4f1ae8b0f1594053bcc371f556ce3c92e9fcc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="long") @VintfStability +enum ScalerAvailableStreamUseCases { + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT = 0, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW = 1, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE = 2, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 3, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 4, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 5, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 65536, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerCroppingType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerCroppingType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0487196937d1546f44621cd70ec167fff6837022 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerCroppingType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerCroppingType { + ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY = 0, + ANDROID_SCALER_CROPPING_TYPE_FREEFORM = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl new file mode 100644 index 0000000000000000000000000000000000000000..711243f58c8d4ddcfee85c178008ddbcf14cc4c0 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerMultiResolutionStreamSupported { + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE = 0, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..50bc09780e862fe5a3a8885e641abcc95ea4804e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerPhysicalCameraMultiResolutionStreamConfigurations { + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3b9c5b8ef9eaae120d045a36fd92b476b2cb3e8f --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerRotateAndCrop { + ANDROID_SCALER_ROTATE_AND_CROP_NONE = 0, + ANDROID_SCALER_ROTATE_AND_CROP_90 = 1, + ANDROID_SCALER_ROTATE_AND_CROP_180 = 2, + ANDROID_SCALER_ROTATE_AND_CROP_270 = 3, + ANDROID_SCALER_ROTATE_AND_CROP_AUTO = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3400233f0c44e3f1a5618063364bb48b541128b0 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoColorFilterArrangement { + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB = 0, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG = 1, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG = 2, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR = 3, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB = 4, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO = 5, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR = 6, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c8faaee8bcd221bd85ff2fdddc20bf3c27efc729 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoLensShadingApplied { + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE = 0, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2a4b3dd08b668b73530a126a2e851d8af620891a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoTimestampSource { + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN = 0, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorPixelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e0214341cf5bc536d49549486a7caf5d1d598cb8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorPixelMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorPixelMode { + ANDROID_SENSOR_PIXEL_MODE_DEFAULT = 0, + ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a1f0c5fed59a20eae6ab2ef6e0ae32b3ccfdeacb --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorRawBinningFactorUsed { + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_TRUE = 0, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_FALSE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd22d2e35dadf728cfe857fadc4121c569791359 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl @@ -0,0 +1,60 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorReferenceIlluminant1 { + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT = 1, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT = 2, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN = 3, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLASH = 4, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER = 9, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER = 10, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_SHADE = 11, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT = 12, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT = 13, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT = 14, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT = 15, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A = 17, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B = 18, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C = 19, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D55 = 20, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D65 = 21, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D75 = 22, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D50 = 23, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN = 24, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorTestPatternMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorTestPatternMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3f49b9a731f3495a6c3430d13bfdb68fc60113a4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SensorTestPatternMode.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorTestPatternMode { + ANDROID_SENSOR_TEST_PATTERN_MODE_OFF = 0, + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR = 1, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS = 2, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY = 3, + ANDROID_SENSOR_TEST_PATTERN_MODE_PN9 = 4, + ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK = 5, + ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1 = 256, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ShadingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ShadingMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a2d2a320fc565ba7bd7ce40b21749cd756cac220 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/ShadingMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ShadingMode { + ANDROID_SHADING_MODE_OFF = 0, + ANDROID_SHADING_MODE_FAST = 1, + ANDROID_SHADING_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1c65f990be3fb689bdf7a5705aa37938b53b3649 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsFaceDetectMode { + ANDROID_STATISTICS_FACE_DETECT_MODE_OFF = 0, + ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE = 1, + ANDROID_STATISTICS_FACE_DETECT_MODE_FULL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsHistogramMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsHistogramMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..39a013e32f1635c09fd0d63c63f552c2a6cecd72 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsHistogramMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsHistogramMode { + ANDROID_STATISTICS_HISTOGRAM_MODE_OFF = 0, + ANDROID_STATISTICS_HISTOGRAM_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3a8c6c2a03d7fe53f49d74f38ba9c663bcfee7e4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsHotPixelMapMode { + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF = 0, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc280caca691c5cf9d6288ac991606686fdf8a63 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsLensShadingMapMode { + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF = 0, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsOisDataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsOisDataMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6607037cb9ab6b6730745a11dfac5edf055630a3 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsOisDataMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsOisDataMode { + ANDROID_STATISTICS_OIS_DATA_MODE_OFF = 0, + ANDROID_STATISTICS_OIS_DATA_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bc286c36cda33d5716d2791c038db6427e21719c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsSceneFlicker { + ANDROID_STATISTICS_SCENE_FLICKER_NONE = 0, + ANDROID_STATISTICS_SCENE_FLICKER_50HZ = 1, + ANDROID_STATISTICS_SCENE_FLICKER_60HZ = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..774a43a76da79cc107357941b4f0ca83855e61df --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsSharpnessMapMode { + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_OFF = 0, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SyncFrameNumber.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SyncFrameNumber.aidl new file mode 100644 index 0000000000000000000000000000000000000000..12ccbb9479bd1fe21c2dd5dfe9f6f8b6c3fc1662 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SyncFrameNumber.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SyncFrameNumber { + ANDROID_SYNC_FRAME_NUMBER_CONVERGING = -1, + ANDROID_SYNC_FRAME_NUMBER_UNKNOWN = -2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SyncMaxLatency.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SyncMaxLatency.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e0116e7117e8f9f732a475517a8ad4c96223d41d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/SyncMaxLatency.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SyncMaxLatency { + ANDROID_SYNC_MAX_LATENCY_PER_FRAME_CONTROL = 0, + ANDROID_SYNC_MAX_LATENCY_UNKNOWN = -1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/TonemapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/TonemapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..728b2987ee89c48ba711f8c83010d2ca65162210 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/TonemapMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum TonemapMode { + ANDROID_TONEMAP_MODE_CONTRAST_CURVE = 0, + ANDROID_TONEMAP_MODE_FAST = 1, + ANDROID_TONEMAP_MODE_HIGH_QUALITY = 2, + ANDROID_TONEMAP_MODE_GAMMA_VALUE = 3, + ANDROID_TONEMAP_MODE_PRESET_CURVE = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/TonemapPresetCurve.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/TonemapPresetCurve.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc2e39bc3e60b8ca59a597fd9e44b2fc3b5bfce4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/1/android/hardware/camera/metadata/TonemapPresetCurve.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum TonemapPresetCurve { + ANDROID_TONEMAP_PRESET_CURVE_SRGB = 0, + ANDROID_TONEMAP_PRESET_CURVE_REC709 = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLensFacing.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14ad26e08afdb4758306b844b5e02cd714cbc768 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLensFacing.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum AutomotiveLensFacing { + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER = 0, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT = 1, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR = 2, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT = 3, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT = 4, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER = 5, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT = 6, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER = 7, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT = 8, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT = 9, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER = 10, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT = 11, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT = 12, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER = 13, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT = 14, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLocation.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5417bdbf445b3e301ffc0e710c55d618079b03b5 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLocation.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum AutomotiveLocation { + ANDROID_AUTOMOTIVE_LOCATION_INTERIOR = 0, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER = 1, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT = 2, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_REAR = 3, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT = 4, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT = 5, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_OTHER = 6, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_FRONT = 7, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_REAR = 8, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_LEFT = 9, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_RIGHT = 10, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/BlackLevelLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/BlackLevelLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dcefa2f6975d02c3ff5ed103c11243abeb1b7a3e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/BlackLevelLock.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum BlackLevelLock { + ANDROID_BLACK_LEVEL_LOCK_OFF = 0, + ANDROID_BLACK_LEVEL_LOCK_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8bed156d8f67e6f43bdfa0cc59a8a4de6ce0fd44 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -0,0 +1,74 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataSection { + ANDROID_COLOR_CORRECTION = 0, + ANDROID_CONTROL = 1, + ANDROID_DEMOSAIC = 2, + ANDROID_EDGE = 3, + ANDROID_FLASH = 4, + ANDROID_FLASH_INFO = 5, + ANDROID_HOT_PIXEL = 6, + ANDROID_JPEG = 7, + ANDROID_LENS = 8, + ANDROID_LENS_INFO = 9, + ANDROID_NOISE_REDUCTION = 10, + ANDROID_QUIRKS = 11, + ANDROID_REQUEST = 12, + ANDROID_SCALER = 13, + ANDROID_SENSOR = 14, + ANDROID_SENSOR_INFO = 15, + ANDROID_SHADING = 16, + ANDROID_STATISTICS = 17, + ANDROID_STATISTICS_INFO = 18, + ANDROID_TONEMAP = 19, + ANDROID_LED = 20, + ANDROID_INFO = 21, + ANDROID_BLACK_LEVEL = 22, + ANDROID_SYNC = 23, + ANDROID_REPROCESS = 24, + ANDROID_DEPTH = 25, + ANDROID_LOGICAL_MULTI_CAMERA = 26, + ANDROID_DISTORTION_CORRECTION = 27, + ANDROID_HEIC = 28, + ANDROID_HEIC_INFO = 29, + ANDROID_AUTOMOTIVE = 30, + ANDROID_AUTOMOTIVE_LENS = 31, + VENDOR_SECTION = 32768, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl new file mode 100644 index 0000000000000000000000000000000000000000..17253476989fb8e9137fb7b322b057837648d214 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -0,0 +1,74 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataSectionStart { + ANDROID_COLOR_CORRECTION_START = 0, + ANDROID_CONTROL_START = 65536, + ANDROID_DEMOSAIC_START = 131072, + ANDROID_EDGE_START = 196608, + ANDROID_FLASH_START = 262144, + ANDROID_FLASH_INFO_START = 327680, + ANDROID_HOT_PIXEL_START = 393216, + ANDROID_JPEG_START = 458752, + ANDROID_LENS_START = 524288, + ANDROID_LENS_INFO_START = 589824, + ANDROID_NOISE_REDUCTION_START = 655360, + ANDROID_QUIRKS_START = 720896, + ANDROID_REQUEST_START = 786432, + ANDROID_SCALER_START = 851968, + ANDROID_SENSOR_START = 917504, + ANDROID_SENSOR_INFO_START = 983040, + ANDROID_SHADING_START = 1048576, + ANDROID_STATISTICS_START = 1114112, + ANDROID_STATISTICS_INFO_START = 1179648, + ANDROID_TONEMAP_START = 1245184, + ANDROID_LED_START = 1310720, + ANDROID_INFO_START = 1376256, + ANDROID_BLACK_LEVEL_START = 1441792, + ANDROID_SYNC_START = 1507328, + ANDROID_REPROCESS_START = 1572864, + ANDROID_DEPTH_START = 1638400, + ANDROID_LOGICAL_MULTI_CAMERA_START = 1703936, + ANDROID_DISTORTION_CORRECTION_START = 1769472, + ANDROID_HEIC_START = 1835008, + ANDROID_HEIC_INFO_START = 1900544, + ANDROID_AUTOMOTIVE_START = 1966080, + ANDROID_AUTOMOTIVE_LENS_START = 2031616, + VENDOR_SECTION_START = -2147483648, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9bb55d27df357173a91cea30b2170b3a6af46ded --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -0,0 +1,331 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataTag { + ANDROID_COLOR_CORRECTION_MODE = 0, + ANDROID_COLOR_CORRECTION_TRANSFORM = 1, + ANDROID_COLOR_CORRECTION_GAINS = 2, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE = 3, + ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES = 4, + ANDROID_CONTROL_AE_ANTIBANDING_MODE = 65536, + ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION = 65537, + ANDROID_CONTROL_AE_LOCK = 65538, + ANDROID_CONTROL_AE_MODE = 65539, + ANDROID_CONTROL_AE_REGIONS = 65540, + ANDROID_CONTROL_AE_TARGET_FPS_RANGE = 65541, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER = 65542, + ANDROID_CONTROL_AF_MODE = 65543, + ANDROID_CONTROL_AF_REGIONS = 65544, + ANDROID_CONTROL_AF_TRIGGER = 65545, + ANDROID_CONTROL_AWB_LOCK = 65546, + ANDROID_CONTROL_AWB_MODE = 65547, + ANDROID_CONTROL_AWB_REGIONS = 65548, + ANDROID_CONTROL_CAPTURE_INTENT = 65549, + ANDROID_CONTROL_EFFECT_MODE = 65550, + ANDROID_CONTROL_MODE = 65551, + ANDROID_CONTROL_SCENE_MODE = 65552, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE = 65553, + ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES = 65554, + ANDROID_CONTROL_AE_AVAILABLE_MODES = 65555, + ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES = 65556, + ANDROID_CONTROL_AE_COMPENSATION_RANGE = 65557, + ANDROID_CONTROL_AE_COMPENSATION_STEP = 65558, + ANDROID_CONTROL_AF_AVAILABLE_MODES = 65559, + ANDROID_CONTROL_AVAILABLE_EFFECTS = 65560, + ANDROID_CONTROL_AVAILABLE_SCENE_MODES = 65561, + ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES = 65562, + ANDROID_CONTROL_AWB_AVAILABLE_MODES = 65563, + ANDROID_CONTROL_MAX_REGIONS = 65564, + ANDROID_CONTROL_SCENE_MODE_OVERRIDES = 65565, + ANDROID_CONTROL_AE_PRECAPTURE_ID = 65566, + ANDROID_CONTROL_AE_STATE = 65567, + ANDROID_CONTROL_AF_STATE = 65568, + ANDROID_CONTROL_AF_TRIGGER_ID = 65569, + ANDROID_CONTROL_AWB_STATE = 65570, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS = 65571, + ANDROID_CONTROL_AE_LOCK_AVAILABLE = 65572, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE = 65573, + ANDROID_CONTROL_AVAILABLE_MODES = 65574, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE = 65575, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST = 65576, + ANDROID_CONTROL_ENABLE_ZSL = 65577, + ANDROID_CONTROL_AF_SCENE_CHANGE = 65578, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES = 65579, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES = 65580, + ANDROID_CONTROL_EXTENDED_SCENE_MODE = 65581, + ANDROID_CONTROL_ZOOM_RATIO_RANGE = 65582, + ANDROID_CONTROL_ZOOM_RATIO = 65583, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION = 65584, + ANDROID_DEMOSAIC_MODE = 131072, + ANDROID_EDGE_MODE = 196608, + ANDROID_EDGE_STRENGTH = 196609, + ANDROID_EDGE_AVAILABLE_EDGE_MODES = 196610, + ANDROID_FLASH_FIRING_POWER = 262144, + ANDROID_FLASH_FIRING_TIME = 262145, + ANDROID_FLASH_MODE = 262146, + ANDROID_FLASH_COLOR_TEMPERATURE = 262147, + ANDROID_FLASH_MAX_ENERGY = 262148, + ANDROID_FLASH_STATE = 262149, + ANDROID_FLASH_INFO_AVAILABLE = 327680, + ANDROID_FLASH_INFO_CHARGE_DURATION = 327681, + ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL = 327682, + ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL = 327683, + ANDROID_HOT_PIXEL_MODE = 393216, + ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES = 393217, + ANDROID_JPEG_GPS_COORDINATES = 458752, + ANDROID_JPEG_GPS_PROCESSING_METHOD = 458753, + ANDROID_JPEG_GPS_TIMESTAMP = 458754, + ANDROID_JPEG_ORIENTATION = 458755, + ANDROID_JPEG_QUALITY = 458756, + ANDROID_JPEG_THUMBNAIL_QUALITY = 458757, + ANDROID_JPEG_THUMBNAIL_SIZE = 458758, + ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES = 458759, + ANDROID_JPEG_MAX_SIZE = 458760, + ANDROID_JPEG_SIZE = 458761, + ANDROID_LENS_APERTURE = 524288, + ANDROID_LENS_FILTER_DENSITY = 524289, + ANDROID_LENS_FOCAL_LENGTH = 524290, + ANDROID_LENS_FOCUS_DISTANCE = 524291, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE = 524292, + ANDROID_LENS_FACING = 524293, + ANDROID_LENS_POSE_ROTATION = 524294, + ANDROID_LENS_POSE_TRANSLATION = 524295, + ANDROID_LENS_FOCUS_RANGE = 524296, + ANDROID_LENS_STATE = 524297, + ANDROID_LENS_INTRINSIC_CALIBRATION = 524298, + ANDROID_LENS_RADIAL_DISTORTION = 524299, + ANDROID_LENS_POSE_REFERENCE = 524300, + ANDROID_LENS_DISTORTION = 524301, + ANDROID_LENS_DISTORTION_MAXIMUM_RESOLUTION = 524302, + ANDROID_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION = 524303, + ANDROID_LENS_INFO_AVAILABLE_APERTURES = 589824, + ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES = 589825, + ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS = 589826, + ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION = 589827, + ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE = 589828, + ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE = 589829, + ANDROID_LENS_INFO_SHADING_MAP_SIZE = 589830, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION = 589831, + ANDROID_NOISE_REDUCTION_MODE = 655360, + ANDROID_NOISE_REDUCTION_STRENGTH = 655361, + ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES = 655362, + ANDROID_QUIRKS_METERING_CROP_REGION = 720896, + ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO = 720897, + ANDROID_QUIRKS_USE_ZSL_FORMAT = 720898, + ANDROID_QUIRKS_USE_PARTIAL_RESULT = 720899, + ANDROID_QUIRKS_PARTIAL_RESULT = 720900, + ANDROID_REQUEST_FRAME_COUNT = 786432, + ANDROID_REQUEST_ID = 786433, + ANDROID_REQUEST_INPUT_STREAMS = 786434, + ANDROID_REQUEST_METADATA_MODE = 786435, + ANDROID_REQUEST_OUTPUT_STREAMS = 786436, + ANDROID_REQUEST_TYPE = 786437, + ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS = 786438, + ANDROID_REQUEST_MAX_NUM_REPROCESS_STREAMS = 786439, + ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS = 786440, + ANDROID_REQUEST_PIPELINE_DEPTH = 786441, + ANDROID_REQUEST_PIPELINE_MAX_DEPTH = 786442, + ANDROID_REQUEST_PARTIAL_RESULT_COUNT = 786443, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES = 786444, + ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS = 786445, + ANDROID_REQUEST_AVAILABLE_RESULT_KEYS = 786446, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS = 786447, + ANDROID_REQUEST_AVAILABLE_SESSION_KEYS = 786448, + ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS = 786449, + ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION = 786450, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = 786451, + ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE = 786452, + ANDROID_SCALER_CROP_REGION = 851968, + ANDROID_SCALER_AVAILABLE_FORMATS = 851969, + ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS = 851970, + ANDROID_SCALER_AVAILABLE_JPEG_SIZES = 851971, + ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM = 851972, + ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS = 851973, + ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES = 851974, + ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS = 851975, + ANDROID_SCALER_AVAILABLE_RAW_SIZES = 851976, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP = 851977, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS = 851978, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS = 851979, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS = 851980, + ANDROID_SCALER_CROPPING_TYPE = 851981, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS = 851982, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP = 851983, + ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES = 851984, + ANDROID_SCALER_ROTATE_AND_CROP = 851985, + ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE = 851986, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS = 851987, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 851988, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 851989, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION = 851990, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP_MAXIMUM_RESOLUTION = 851991, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED = 851992, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = 851994, + ANDROID_SENSOR_EXPOSURE_TIME = 917504, + ANDROID_SENSOR_FRAME_DURATION = 917505, + ANDROID_SENSOR_SENSITIVITY = 917506, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1 = 917507, + ANDROID_SENSOR_REFERENCE_ILLUMINANT2 = 917508, + ANDROID_SENSOR_CALIBRATION_TRANSFORM1 = 917509, + ANDROID_SENSOR_CALIBRATION_TRANSFORM2 = 917510, + ANDROID_SENSOR_COLOR_TRANSFORM1 = 917511, + ANDROID_SENSOR_COLOR_TRANSFORM2 = 917512, + ANDROID_SENSOR_FORWARD_MATRIX1 = 917513, + ANDROID_SENSOR_FORWARD_MATRIX2 = 917514, + ANDROID_SENSOR_BASE_GAIN_FACTOR = 917515, + ANDROID_SENSOR_BLACK_LEVEL_PATTERN = 917516, + ANDROID_SENSOR_MAX_ANALOG_SENSITIVITY = 917517, + ANDROID_SENSOR_ORIENTATION = 917518, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP_DIMENSIONS = 917519, + ANDROID_SENSOR_TIMESTAMP = 917520, + ANDROID_SENSOR_TEMPERATURE = 917521, + ANDROID_SENSOR_NEUTRAL_COLOR_POINT = 917522, + ANDROID_SENSOR_NOISE_PROFILE = 917523, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP = 917524, + ANDROID_SENSOR_PROFILE_TONE_CURVE = 917525, + ANDROID_SENSOR_GREEN_SPLIT = 917526, + ANDROID_SENSOR_TEST_PATTERN_DATA = 917527, + ANDROID_SENSOR_TEST_PATTERN_MODE = 917528, + ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES = 917529, + ANDROID_SENSOR_ROLLING_SHUTTER_SKEW = 917530, + ANDROID_SENSOR_OPTICAL_BLACK_REGIONS = 917531, + ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL = 917532, + ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL = 917533, + ANDROID_SENSOR_OPAQUE_RAW_SIZE = 917534, + ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION = 917535, + ANDROID_SENSOR_PIXEL_MODE = 917536, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED = 917537, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE = 983040, + ANDROID_SENSOR_INFO_SENSITIVITY_RANGE = 983041, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT = 983042, + ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE = 983043, + ANDROID_SENSOR_INFO_MAX_FRAME_DURATION = 983044, + ANDROID_SENSOR_INFO_PHYSICAL_SIZE = 983045, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE = 983046, + ANDROID_SENSOR_INFO_WHITE_LEVEL = 983047, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE = 983048, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED = 983049, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE = 983050, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983051, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983052, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983053, + ANDROID_SENSOR_INFO_BINNING_FACTOR = 983054, + ANDROID_SHADING_MODE = 1048576, + ANDROID_SHADING_STRENGTH = 1048577, + ANDROID_SHADING_AVAILABLE_MODES = 1048578, + ANDROID_STATISTICS_FACE_DETECT_MODE = 1114112, + ANDROID_STATISTICS_HISTOGRAM_MODE = 1114113, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE = 1114114, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE = 1114115, + ANDROID_STATISTICS_FACE_IDS = 1114116, + ANDROID_STATISTICS_FACE_LANDMARKS = 1114117, + ANDROID_STATISTICS_FACE_RECTANGLES = 1114118, + ANDROID_STATISTICS_FACE_SCORES = 1114119, + ANDROID_STATISTICS_HISTOGRAM = 1114120, + ANDROID_STATISTICS_SHARPNESS_MAP = 1114121, + ANDROID_STATISTICS_LENS_SHADING_CORRECTION_MAP = 1114122, + ANDROID_STATISTICS_LENS_SHADING_MAP = 1114123, + ANDROID_STATISTICS_PREDICTED_COLOR_GAINS = 1114124, + ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM = 1114125, + ANDROID_STATISTICS_SCENE_FLICKER = 1114126, + ANDROID_STATISTICS_HOT_PIXEL_MAP = 1114127, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE = 1114128, + ANDROID_STATISTICS_OIS_DATA_MODE = 1114129, + ANDROID_STATISTICS_OIS_TIMESTAMPS = 1114130, + ANDROID_STATISTICS_OIS_X_SHIFTS = 1114131, + ANDROID_STATISTICS_OIS_Y_SHIFTS = 1114132, + ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = 1179648, + ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT = 1179649, + ANDROID_STATISTICS_INFO_MAX_FACE_COUNT = 1179650, + ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT = 1179651, + ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE = 1179652, + ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE = 1179653, + ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES = 1179654, + ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES = 1179655, + ANDROID_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES = 1179656, + ANDROID_TONEMAP_CURVE_BLUE = 1245184, + ANDROID_TONEMAP_CURVE_GREEN = 1245185, + ANDROID_TONEMAP_CURVE_RED = 1245186, + ANDROID_TONEMAP_MODE = 1245187, + ANDROID_TONEMAP_MAX_CURVE_POINTS = 1245188, + ANDROID_TONEMAP_AVAILABLE_TONE_MAP_MODES = 1245189, + ANDROID_TONEMAP_GAMMA = 1245190, + ANDROID_TONEMAP_PRESET_CURVE = 1245191, + ANDROID_LED_TRANSMIT = 1310720, + ANDROID_LED_AVAILABLE_LEDS = 1310721, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL = 1376256, + ANDROID_INFO_VERSION = 1376257, + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION = 1376258, + ANDROID_INFO_DEVICE_STATE_ORIENTATIONS = 1376259, + ANDROID_BLACK_LEVEL_LOCK = 1441792, + ANDROID_SYNC_FRAME_NUMBER = 1507328, + ANDROID_SYNC_MAX_LATENCY = 1507329, + ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = 1572864, + ANDROID_REPROCESS_MAX_CAPTURE_STALL = 1572865, + ANDROID_DEPTH_MAX_DEPTH_SAMPLES = 1638400, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS = 1638401, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS = 1638402, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS = 1638403, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE = 1638404, + ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS = 1638405, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS = 1638406, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS = 1638407, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS = 1638408, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1638409, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1638410, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1638411, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1638412, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1638413, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1638414, + ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS = 1703936, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE = 1703937, + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID = 1703938, + ANDROID_DISTORTION_CORRECTION_MODE = 1769472, + ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES = 1769473, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = 1835008, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS = 1835009, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS = 1835010, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1835011, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1835012, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1835013, + ANDROID_HEIC_INFO_SUPPORTED = 1900544, + ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT = 1900545, + ANDROID_AUTOMOTIVE_LOCATION = 1966080, + ANDROID_AUTOMOTIVE_LENS_FACING = 2031616, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d04ffe390676045e16f69149d70e26485cd2e86e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ColorCorrectionAberrationMode { + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF = 0, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_FAST = 1, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..219c802bb84018a8685794647f23e57d22d2584c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ColorCorrectionMode { + ANDROID_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0, + ANDROID_COLOR_CORRECTION_MODE_FAST = 1, + ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84fd718c53071cb5184bc0acd51bbf45575fd97c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeAntibandingMode { + ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF = 0, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_50HZ = 1, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_60HZ = 2, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f825f112a14acb11169040f46226448861684bc9 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLock.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeLock { + ANDROID_CONTROL_AE_LOCK_OFF = 0, + ANDROID_CONTROL_AE_LOCK_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLockAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df7924ed4993a5edd29309e07a81d66d287ec20d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLockAvailable.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeLockAvailable { + ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE = 0, + ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..75a3486b3722a3207b4fea5779d2fdc907c4e606 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeMode { + ANDROID_CONTROL_AE_MODE_OFF = 0, + ANDROID_CONTROL_AE_MODE_ON = 1, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH = 2, + ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH = 3, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE = 4, + ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH = 5, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4678e018804a6bf284721344aefb8c22b588e3bf --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAePrecaptureTrigger { + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE = 0, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START = 1, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3be64ea802715c9c48e42c214e990a3f81d015bc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeState.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeState { + ANDROID_CONTROL_AE_STATE_INACTIVE = 0, + ANDROID_CONTROL_AE_STATE_SEARCHING = 1, + ANDROID_CONTROL_AE_STATE_CONVERGED = 2, + ANDROID_CONTROL_AE_STATE_LOCKED = 3, + ANDROID_CONTROL_AE_STATE_FLASH_REQUIRED = 4, + ANDROID_CONTROL_AE_STATE_PRECAPTURE = 5, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..155d3c9f929fdc71f42f32efe9330ad5f565d77d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfMode.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfMode { + ANDROID_CONTROL_AF_MODE_OFF = 0, + ANDROID_CONTROL_AF_MODE_AUTO = 1, + ANDROID_CONTROL_AF_MODE_MACRO = 2, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO = 3, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE = 4, + ANDROID_CONTROL_AF_MODE_EDOF = 5, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfSceneChange.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfSceneChange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b31c84fb294d233f84ef7b093251e77be5beb3b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfSceneChange.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfSceneChange { + ANDROID_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED = 0, + ANDROID_CONTROL_AF_SCENE_CHANGE_DETECTED = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4aac8c8a9d7827b5536874923f0f57a65befa253 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfState.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfState { + ANDROID_CONTROL_AF_STATE_INACTIVE = 0, + ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN = 1, + ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED = 2, + ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN = 3, + ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED = 4, + ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED = 5, + ANDROID_CONTROL_AF_STATE_PASSIVE_UNFOCUSED = 6, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfTrigger.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3fbf94b7244fa80be6b43fc7c96ee7d88db4d575 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfTrigger.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfTrigger { + ANDROID_CONTROL_AF_TRIGGER_IDLE = 0, + ANDROID_CONTROL_AF_TRIGGER_START = 1, + ANDROID_CONTROL_AF_TRIGGER_CANCEL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0e297a51a37827164d495594c5ac199a97767261 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLock.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbLock { + ANDROID_CONTROL_AWB_LOCK_OFF = 0, + ANDROID_CONTROL_AWB_LOCK_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d471d190bd35d27f01d4ebdf1e3d44858220aa17 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbLockAvailable { + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE = 0, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a3463f835f0f5bba244856216abfdf5450df1626 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbMode.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbMode { + ANDROID_CONTROL_AWB_MODE_OFF = 0, + ANDROID_CONTROL_AWB_MODE_AUTO = 1, + ANDROID_CONTROL_AWB_MODE_INCANDESCENT = 2, + ANDROID_CONTROL_AWB_MODE_FLUORESCENT = 3, + ANDROID_CONTROL_AWB_MODE_WARM_FLUORESCENT = 4, + ANDROID_CONTROL_AWB_MODE_DAYLIGHT = 5, + ANDROID_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = 6, + ANDROID_CONTROL_AWB_MODE_TWILIGHT = 7, + ANDROID_CONTROL_AWB_MODE_SHADE = 8, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f1b0e40d2b83bb81b514f2ce0714f7fa5197426d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbState.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbState { + ANDROID_CONTROL_AWB_STATE_INACTIVE = 0, + ANDROID_CONTROL_AWB_STATE_SEARCHING = 1, + ANDROID_CONTROL_AWB_STATE_CONVERGED = 2, + ANDROID_CONTROL_AWB_STATE_LOCKED = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlCaptureIntent.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlCaptureIntent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..283bb1be026105bd54544154d1dbe44abd0bf6fb --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlCaptureIntent.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlCaptureIntent { + ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM = 0, + ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW = 1, + ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE = 2, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD = 3, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4, + ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG = 5, + ANDROID_CONTROL_CAPTURE_INTENT_MANUAL = 6, + ANDROID_CONTROL_CAPTURE_INTENT_MOTION_TRACKING = 7, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEffectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEffectMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..911223dcf3414c97e4e2fe144c9623f2b15d938d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEffectMode.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlEffectMode { + ANDROID_CONTROL_EFFECT_MODE_OFF = 0, + ANDROID_CONTROL_EFFECT_MODE_MONO = 1, + ANDROID_CONTROL_EFFECT_MODE_NEGATIVE = 2, + ANDROID_CONTROL_EFFECT_MODE_SOLARIZE = 3, + ANDROID_CONTROL_EFFECT_MODE_SEPIA = 4, + ANDROID_CONTROL_EFFECT_MODE_POSTERIZE = 5, + ANDROID_CONTROL_EFFECT_MODE_WHITEBOARD = 6, + ANDROID_CONTROL_EFFECT_MODE_BLACKBOARD = 7, + ANDROID_CONTROL_EFFECT_MODE_AQUA = 8, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEnableZsl.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEnableZsl.aidl new file mode 100644 index 0000000000000000000000000000000000000000..920def7c2006f3aa304500b9c9635ba495f22d58 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEnableZsl.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlEnableZsl { + ANDROID_CONTROL_ENABLE_ZSL_FALSE = 0, + ANDROID_CONTROL_ENABLE_ZSL_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2655d6144a2e67da51a05d7dd4cd6bdb2f5ac94c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlExtendedSceneMode { + ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE = 1, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS = 2, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_VENDOR_START = 64, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f58491e5366649a62c6cf4dc4f965198d114dc3d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlMode { + ANDROID_CONTROL_MODE_OFF = 0, + ANDROID_CONTROL_MODE_AUTO = 1, + ANDROID_CONTROL_MODE_USE_SCENE_MODE = 2, + ANDROID_CONTROL_MODE_OFF_KEEP_STATE = 3, + ANDROID_CONTROL_MODE_USE_EXTENDED_SCENE_MODE = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSceneMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..994bbf3aa777ea9c24c61608b024cda538f429c5 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSceneMode.aidl @@ -0,0 +1,63 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlSceneMode { + ANDROID_CONTROL_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY = 1, + ANDROID_CONTROL_SCENE_MODE_ACTION = 2, + ANDROID_CONTROL_SCENE_MODE_PORTRAIT = 3, + ANDROID_CONTROL_SCENE_MODE_LANDSCAPE = 4, + ANDROID_CONTROL_SCENE_MODE_NIGHT = 5, + ANDROID_CONTROL_SCENE_MODE_NIGHT_PORTRAIT = 6, + ANDROID_CONTROL_SCENE_MODE_THEATRE = 7, + ANDROID_CONTROL_SCENE_MODE_BEACH = 8, + ANDROID_CONTROL_SCENE_MODE_SNOW = 9, + ANDROID_CONTROL_SCENE_MODE_SUNSET = 10, + ANDROID_CONTROL_SCENE_MODE_STEADYPHOTO = 11, + ANDROID_CONTROL_SCENE_MODE_FIREWORKS = 12, + ANDROID_CONTROL_SCENE_MODE_SPORTS = 13, + ANDROID_CONTROL_SCENE_MODE_PARTY = 14, + ANDROID_CONTROL_SCENE_MODE_CANDLELIGHT = 15, + ANDROID_CONTROL_SCENE_MODE_BARCODE = 16, + ANDROID_CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO = 17, + ANDROID_CONTROL_SCENE_MODE_HDR = 18, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT = 19, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_START = 100, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_END = 127, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b3b24f750bf3b7867f4cbcaf56619b7bd6a39372 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlVideoStabilizationMode { + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF = 0, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON = 1, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DemosaicMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DemosaicMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..26874a2f851735db77157fe008a0bbe1fc80281e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DemosaicMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DemosaicMode { + ANDROID_DEMOSAIC_MODE_FAST = 0, + ANDROID_DEMOSAIC_MODE_HIGH_QUALITY = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6a154ca0c997017c22862d561c852710b0dd9564 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..23d6589a1cec8e939f2dbb01ccfed282ea38a21a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f3ca03964f7957997ad0ac8ca567ba9df78c8f15 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDynamicDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46a4ce61e6991fcb3a76b102e0d7dfc96dc0ee70 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f5fc218318633a8cff459a7da804e1cf75abafca --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthDepthIsExclusive { + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE = 0, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DistortionCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DistortionCorrectionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46327e0beaf4248d36c2b907ee96bc35105fb2de --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DistortionCorrectionMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum DistortionCorrectionMode { + ANDROID_DISTORTION_CORRECTION_MODE_OFF = 0, + ANDROID_DISTORTION_CORRECTION_MODE_FAST = 1, + ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/EdgeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/EdgeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b02e194bc3d7944ea34e527fa961f220694ce5b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/EdgeMode.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum EdgeMode { + ANDROID_EDGE_MODE_OFF = 0, + ANDROID_EDGE_MODE_FAST = 1, + ANDROID_EDGE_MODE_HIGH_QUALITY = 2, + ANDROID_EDGE_MODE_ZERO_SHUTTER_LAG = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashInfoAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashInfoAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10d07a5c9669dc51d32ea1050e097586c67d4e28 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashInfoAvailable.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashInfoAvailable { + ANDROID_FLASH_INFO_AVAILABLE_FALSE = 0, + ANDROID_FLASH_INFO_AVAILABLE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1ab056067e5ad1660161c01a21ff9d63189860d1 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashMode { + ANDROID_FLASH_MODE_OFF = 0, + ANDROID_FLASH_MODE_SINGLE = 1, + ANDROID_FLASH_MODE_TORCH = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a571e6608d9a1475ea90c6956b343491efb41760 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashState.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashState { + ANDROID_FLASH_STATE_UNAVAILABLE = 0, + ANDROID_FLASH_STATE_CHARGING = 1, + ANDROID_FLASH_STATE_READY = 2, + ANDROID_FLASH_STATE_FIRED = 3, + ANDROID_FLASH_STATE_PARTIAL = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d92c2db86d5aa0b89a9af11d85c1c04d43ae6fb5 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicAvailableHeicStreamConfigurations { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f02cf588bf303ad9aa3a2a7d6c62299a0793c6be --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicAvailableHeicStreamConfigurationsMaximumResolution { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicInfoSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicInfoSupported.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae5a8e784ecd83dd94253098fceae869b3eb53bc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicInfoSupported.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicInfoSupported { + ANDROID_HEIC_INFO_SUPPORTED_FALSE = 0, + ANDROID_HEIC_INFO_SUPPORTED_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HotPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HotPixelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1248c6040f6fe620be0b3413cf72b7762c2617ee --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HotPixelMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum HotPixelMode { + ANDROID_HOT_PIXEL_MODE_OFF = 0, + ANDROID_HOT_PIXEL_MODE_FAST = 1, + ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1272f27944813de38ce20635919d3e29acf8e13d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum InfoSupportedBufferManagementVersion { + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE = 0, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8ae39b09844a0ad4b08861abae69d459f1949c90 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum InfoSupportedHardwareLevel { + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3 = 3, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedAvailableLeds.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedAvailableLeds.aidl new file mode 100644 index 0000000000000000000000000000000000000000..da558d205653d10bea15c5137296e7fc2153d591 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedAvailableLeds.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LedAvailableLeds { + ANDROID_LED_AVAILABLE_LEDS_TRANSMIT = 0, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedTransmit.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedTransmit.aidl new file mode 100644 index 0000000000000000000000000000000000000000..658b3cd3b2e1821a4658b1f2bf2077edc6407f72 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedTransmit.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LedTransmit { + ANDROID_LED_TRANSMIT_OFF = 0, + ANDROID_LED_TRANSMIT_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensFacing.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4db987bc6737ca3371e88bd29966f760ad3931b8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensFacing.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensFacing { + ANDROID_LENS_FACING_FRONT = 0, + ANDROID_LENS_FACING_BACK = 1, + ANDROID_LENS_FACING_EXTERNAL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d83d67f103b34ddea4e75e51d70a0ee1b762b2fc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensInfoFocusDistanceCalibration { + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED = 0, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE = 1, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2f039c39a3ed6cb31e1d69e281a4d02fa393d63 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensOpticalStabilizationMode { + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF = 0, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensPoseReference.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensPoseReference.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b2d837a0ff310b617b8b288d773e93d668f886df --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensPoseReference.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensPoseReference { + ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA = 0, + ANDROID_LENS_POSE_REFERENCE_GYROSCOPE = 1, + ANDROID_LENS_POSE_REFERENCE_UNDEFINED = 2, + ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE = 3, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b15b0fe2026dc451e3e938e71b55926d5fa2195 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LensState { + ANDROID_LENS_STATE_STATIONARY = 0, + ANDROID_LENS_STATE_MOVING = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..224a7fab64e3909ae963598d466d07371d1321b3 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum LogicalMultiCameraSensorSyncType { + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE = 0, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/NoiseReductionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/NoiseReductionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ed0ebc164a4c70dc71c1de5af8c67ea3c1576f26 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/NoiseReductionMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum NoiseReductionMode { + ANDROID_NOISE_REDUCTION_MODE_OFF = 0, + ANDROID_NOISE_REDUCTION_MODE_FAST = 1, + ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY = 2, + ANDROID_NOISE_REDUCTION_MODE_MINIMAL = 3, + ANDROID_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/QuirksPartialResult.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/QuirksPartialResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d217fe805587f9af4de372866c8f316dd763d665 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/QuirksPartialResult.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum QuirksPartialResult { + ANDROID_QUIRKS_PARTIAL_RESULT_FINAL = 0, + ANDROID_QUIRKS_PARTIAL_RESULT_PARTIAL = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8dc2aa2010be125c11e35082a626738fe14c494a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestAvailableCapabilities { + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 1, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 2, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW = 3, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING = 4, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS = 5, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE = 6, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING = 7, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT = 8, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO = 9, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING = 10, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA = 11, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME = 12, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA = 13, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA = 14, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING = 15, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR = 16, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING = 17, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT = 18, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE = 19, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl new file mode 100644 index 0000000000000000000000000000000000000000..16e38ba90f0f5c7b1ec2eb07b7be8d30061efd0d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="long") @VintfStability +enum RequestAvailableDynamicRangeProfilesMap { + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD = 1, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 = 2, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 = 4, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS = 8, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF = 16, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO = 32, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM = 64, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO = 128, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF = 256, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO = 512, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM = 1024, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO = 2048, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 4096, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestMetadataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestMetadataMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..90fba00fe0787ab9a4faf1863a6b260ad00953d3 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestMetadataMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestMetadataMode { + ANDROID_REQUEST_METADATA_MODE_NONE = 0, + ANDROID_REQUEST_METADATA_MODE_FULL = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f38cfbb4d9f4761d09e625162a6d9ab943006e8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestType { + ANDROID_REQUEST_TYPE_CAPTURE = 0, + ANDROID_REQUEST_TYPE_REPROCESS = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableFormats.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableFormats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..41fd2c234004948f1c0fc8b832008a34dd02eb7d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableFormats.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableFormats { + ANDROID_SCALER_AVAILABLE_FORMATS_RAW16 = 32, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW_OPAQUE = 36, + ANDROID_SCALER_AVAILABLE_FORMATS_YV12 = 842094169, + ANDROID_SCALER_AVAILABLE_FORMATS_YCrCb_420_SP = 17, + ANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED = 34, + ANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888 = 35, + ANDROID_SCALER_AVAILABLE_FORMATS_BLOB = 33, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW10 = 37, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW12 = 38, + ANDROID_SCALER_AVAILABLE_FORMATS_Y8 = 538982489, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..85daa858497bd239e0ee1dc03060a54769216306 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableRecommendedStreamConfigurations { + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW = 0, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD = 1, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT = 2, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT = 3, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL = 4, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW = 5, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT = 6, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT = 8, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START = 24, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1515ad5552797b3ae3010869ff8bf89b05565c7d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableStreamConfigurations { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b9c3374e907433ca9088814627b2e84b46b5c292 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableStreamConfigurationsMaximumResolution { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bfa4f1ae8b0f1594053bcc371f556ce3c92e9fcc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="long") @VintfStability +enum ScalerAvailableStreamUseCases { + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT = 0, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW = 1, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE = 2, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 3, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 4, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 5, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 65536, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerCroppingType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerCroppingType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0487196937d1546f44621cd70ec167fff6837022 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerCroppingType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerCroppingType { + ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY = 0, + ANDROID_SCALER_CROPPING_TYPE_FREEFORM = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl new file mode 100644 index 0000000000000000000000000000000000000000..711243f58c8d4ddcfee85c178008ddbcf14cc4c0 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerMultiResolutionStreamSupported { + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE = 0, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..50bc09780e862fe5a3a8885e641abcc95ea4804e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerPhysicalCameraMultiResolutionStreamConfigurations { + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3b9c5b8ef9eaae120d045a36fd92b476b2cb3e8f --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerRotateAndCrop { + ANDROID_SCALER_ROTATE_AND_CROP_NONE = 0, + ANDROID_SCALER_ROTATE_AND_CROP_90 = 1, + ANDROID_SCALER_ROTATE_AND_CROP_180 = 2, + ANDROID_SCALER_ROTATE_AND_CROP_270 = 3, + ANDROID_SCALER_ROTATE_AND_CROP_AUTO = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3400233f0c44e3f1a5618063364bb48b541128b0 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoColorFilterArrangement { + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB = 0, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG = 1, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG = 2, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR = 3, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB = 4, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO = 5, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR = 6, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c8faaee8bcd221bd85ff2fdddc20bf3c27efc729 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoLensShadingApplied { + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE = 0, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2a4b3dd08b668b73530a126a2e851d8af620891a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoTimestampSource { + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN = 0, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorPixelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e0214341cf5bc536d49549486a7caf5d1d598cb8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorPixelMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorPixelMode { + ANDROID_SENSOR_PIXEL_MODE_DEFAULT = 0, + ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a1f0c5fed59a20eae6ab2ef6e0ae32b3ccfdeacb --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorRawBinningFactorUsed { + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_TRUE = 0, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_FALSE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd22d2e35dadf728cfe857fadc4121c569791359 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl @@ -0,0 +1,60 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorReferenceIlluminant1 { + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT = 1, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT = 2, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN = 3, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLASH = 4, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER = 9, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER = 10, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_SHADE = 11, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT = 12, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT = 13, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT = 14, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT = 15, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A = 17, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B = 18, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C = 19, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D55 = 20, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D65 = 21, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D75 = 22, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D50 = 23, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN = 24, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorTestPatternMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorTestPatternMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3f49b9a731f3495a6c3430d13bfdb68fc60113a4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorTestPatternMode.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorTestPatternMode { + ANDROID_SENSOR_TEST_PATTERN_MODE_OFF = 0, + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR = 1, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS = 2, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY = 3, + ANDROID_SENSOR_TEST_PATTERN_MODE_PN9 = 4, + ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK = 5, + ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1 = 256, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ShadingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ShadingMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a2d2a320fc565ba7bd7ce40b21749cd756cac220 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ShadingMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum ShadingMode { + ANDROID_SHADING_MODE_OFF = 0, + ANDROID_SHADING_MODE_FAST = 1, + ANDROID_SHADING_MODE_HIGH_QUALITY = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1c65f990be3fb689bdf7a5705aa37938b53b3649 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsFaceDetectMode { + ANDROID_STATISTICS_FACE_DETECT_MODE_OFF = 0, + ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE = 1, + ANDROID_STATISTICS_FACE_DETECT_MODE_FULL = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHistogramMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHistogramMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..39a013e32f1635c09fd0d63c63f552c2a6cecd72 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHistogramMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsHistogramMode { + ANDROID_STATISTICS_HISTOGRAM_MODE_OFF = 0, + ANDROID_STATISTICS_HISTOGRAM_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3a8c6c2a03d7fe53f49d74f38ba9c663bcfee7e4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsHotPixelMapMode { + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF = 0, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc280caca691c5cf9d6288ac991606686fdf8a63 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsLensShadingMapMode { + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF = 0, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsOisDataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsOisDataMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6607037cb9ab6b6730745a11dfac5edf055630a3 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsOisDataMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsOisDataMode { + ANDROID_STATISTICS_OIS_DATA_MODE_OFF = 0, + ANDROID_STATISTICS_OIS_DATA_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bc286c36cda33d5716d2791c038db6427e21719c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsSceneFlicker { + ANDROID_STATISTICS_SCENE_FLICKER_NONE = 0, + ANDROID_STATISTICS_SCENE_FLICKER_50HZ = 1, + ANDROID_STATISTICS_SCENE_FLICKER_60HZ = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..774a43a76da79cc107357941b4f0ca83855e61df --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsSharpnessMapMode { + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_OFF = 0, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_ON = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncFrameNumber.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncFrameNumber.aidl new file mode 100644 index 0000000000000000000000000000000000000000..12ccbb9479bd1fe21c2dd5dfe9f6f8b6c3fc1662 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncFrameNumber.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SyncFrameNumber { + ANDROID_SYNC_FRAME_NUMBER_CONVERGING = -1, + ANDROID_SYNC_FRAME_NUMBER_UNKNOWN = -2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncMaxLatency.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncMaxLatency.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e0116e7117e8f9f732a475517a8ad4c96223d41d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncMaxLatency.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum SyncMaxLatency { + ANDROID_SYNC_MAX_LATENCY_PER_FRAME_CONTROL = 0, + ANDROID_SYNC_MAX_LATENCY_UNKNOWN = -1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..728b2987ee89c48ba711f8c83010d2ca65162210 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum TonemapMode { + ANDROID_TONEMAP_MODE_CONTRAST_CURVE = 0, + ANDROID_TONEMAP_MODE_FAST = 1, + ANDROID_TONEMAP_MODE_HIGH_QUALITY = 2, + ANDROID_TONEMAP_MODE_GAMMA_VALUE = 3, + ANDROID_TONEMAP_MODE_PRESET_CURVE = 4, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapPresetCurve.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapPresetCurve.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc2e39bc3e60b8ca59a597fd9e44b2fc3b5bfce4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapPresetCurve.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.metadata; +@Backing(type="int") @VintfStability +enum TonemapPresetCurve { + ANDROID_TONEMAP_PRESET_CURVE_SRGB = 0, + ANDROID_TONEMAP_PRESET_CURVE_REC709 = 1, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/AutomotiveLensFacing.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/AutomotiveLensFacing.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8cd222948ce435f8daf111f931a92a5141045e33 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/AutomotiveLensFacing.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.automotive.lens.facing enumeration values + * @see ANDROID_AUTOMOTIVE_LENS_FACING + */ +@VintfStability +@Backing(type="int") +enum AutomotiveLensFacing { + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/AutomotiveLocation.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/AutomotiveLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0ef64b4c437c49a65cf4d820e37edea423dcfb9e --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/AutomotiveLocation.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.automotive.location enumeration values + * @see ANDROID_AUTOMOTIVE_LOCATION + */ +@VintfStability +@Backing(type="int") +enum AutomotiveLocation { + ANDROID_AUTOMOTIVE_LOCATION_INTERIOR, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_REAR, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_OTHER, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_FRONT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_REAR, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_LEFT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_RIGHT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/BlackLevelLock.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/BlackLevelLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4746cf3e4de17c5d13ecee0498eb1aed7b45f5a2 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/BlackLevelLock.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.blackLevel.lock enumeration values + * @see ANDROID_BLACK_LEVEL_LOCK + */ +@VintfStability +@Backing(type="int") +enum BlackLevelLock { + ANDROID_BLACK_LEVEL_LOCK_OFF, + ANDROID_BLACK_LEVEL_LOCK_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..99e28b9cc7c9fa4bfb0f8fd8f8d06e02a27f8e4f --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * Top level hierarchy definitions for camera metadata. *_INFO sections are for + * the static metadata that can be retrieved without opening the camera device. + */ +@VintfStability +@Backing(type="int") +enum CameraMetadataSection { + ANDROID_COLOR_CORRECTION, + ANDROID_CONTROL, + ANDROID_DEMOSAIC, + ANDROID_EDGE, + ANDROID_FLASH, + ANDROID_FLASH_INFO, + ANDROID_HOT_PIXEL, + ANDROID_JPEG, + ANDROID_LENS, + ANDROID_LENS_INFO, + ANDROID_NOISE_REDUCTION, + ANDROID_QUIRKS, + ANDROID_REQUEST, + ANDROID_SCALER, + ANDROID_SENSOR, + ANDROID_SENSOR_INFO, + ANDROID_SHADING, + ANDROID_STATISTICS, + ANDROID_STATISTICS_INFO, + ANDROID_TONEMAP, + ANDROID_LED, + ANDROID_INFO, + ANDROID_BLACK_LEVEL, + ANDROID_SYNC, + ANDROID_REPROCESS, + ANDROID_DEPTH, + ANDROID_LOGICAL_MULTI_CAMERA, + ANDROID_DISTORTION_CORRECTION, + ANDROID_HEIC, + ANDROID_HEIC_INFO, + ANDROID_AUTOMOTIVE, + ANDROID_AUTOMOTIVE_LENS, + VENDOR_SECTION = 0x8000, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl new file mode 100644 index 0000000000000000000000000000000000000000..62c71e9a74c49bbd590ac432adeb0dd2b6fa6b77 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -0,0 +1,67 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +import android.hardware.camera.metadata.CameraMetadataSection; + +/** + * Hierarchy positions in enum space. All vendor extension sections must be + * defined with tag >= VENDOR_SECTION_START + */ +@VintfStability +@Backing(type="int") +enum CameraMetadataSectionStart { + ANDROID_COLOR_CORRECTION_START = CameraMetadataSection.ANDROID_COLOR_CORRECTION << 16, + ANDROID_CONTROL_START = CameraMetadataSection.ANDROID_CONTROL << 16, + ANDROID_DEMOSAIC_START = CameraMetadataSection.ANDROID_DEMOSAIC << 16, + ANDROID_EDGE_START = CameraMetadataSection.ANDROID_EDGE << 16, + ANDROID_FLASH_START = CameraMetadataSection.ANDROID_FLASH << 16, + ANDROID_FLASH_INFO_START = CameraMetadataSection.ANDROID_FLASH_INFO << 16, + ANDROID_HOT_PIXEL_START = CameraMetadataSection.ANDROID_HOT_PIXEL << 16, + ANDROID_JPEG_START = CameraMetadataSection.ANDROID_JPEG << 16, + ANDROID_LENS_START = CameraMetadataSection.ANDROID_LENS << 16, + ANDROID_LENS_INFO_START = CameraMetadataSection.ANDROID_LENS_INFO << 16, + ANDROID_NOISE_REDUCTION_START = CameraMetadataSection.ANDROID_NOISE_REDUCTION << 16, + ANDROID_QUIRKS_START = CameraMetadataSection.ANDROID_QUIRKS << 16, + ANDROID_REQUEST_START = CameraMetadataSection.ANDROID_REQUEST << 16, + ANDROID_SCALER_START = CameraMetadataSection.ANDROID_SCALER << 16, + ANDROID_SENSOR_START = CameraMetadataSection.ANDROID_SENSOR << 16, + ANDROID_SENSOR_INFO_START = CameraMetadataSection.ANDROID_SENSOR_INFO << 16, + ANDROID_SHADING_START = CameraMetadataSection.ANDROID_SHADING << 16, + ANDROID_STATISTICS_START = CameraMetadataSection.ANDROID_STATISTICS << 16, + ANDROID_STATISTICS_INFO_START = CameraMetadataSection.ANDROID_STATISTICS_INFO << 16, + ANDROID_TONEMAP_START = CameraMetadataSection.ANDROID_TONEMAP << 16, + ANDROID_LED_START = CameraMetadataSection.ANDROID_LED << 16, + ANDROID_INFO_START = CameraMetadataSection.ANDROID_INFO << 16, + ANDROID_BLACK_LEVEL_START = CameraMetadataSection.ANDROID_BLACK_LEVEL << 16, + ANDROID_SYNC_START = CameraMetadataSection.ANDROID_SYNC << 16, + ANDROID_REPROCESS_START = CameraMetadataSection.ANDROID_REPROCESS << 16, + ANDROID_DEPTH_START = CameraMetadataSection.ANDROID_DEPTH << 16, + ANDROID_LOGICAL_MULTI_CAMERA_START = CameraMetadataSection.ANDROID_LOGICAL_MULTI_CAMERA << 16, + ANDROID_DISTORTION_CORRECTION_START = CameraMetadataSection.ANDROID_DISTORTION_CORRECTION << 16, + ANDROID_HEIC_START = CameraMetadataSection.ANDROID_HEIC << 16, + ANDROID_HEIC_INFO_START = CameraMetadataSection.ANDROID_HEIC_INFO << 16, + ANDROID_AUTOMOTIVE_START = CameraMetadataSection.ANDROID_AUTOMOTIVE << 16, + ANDROID_AUTOMOTIVE_LENS_START = CameraMetadataSection.ANDROID_AUTOMOTIVE_LENS << 16, + VENDOR_SECTION_START = CameraMetadataSection.VENDOR_SECTION << 16, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..48b1ee49578792a6dbf2b17add4693a70fc3d323 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -0,0 +1,2255 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +import android.hardware.camera.metadata.CameraMetadataSectionStart; + +/** + * Main enumeration for defining camera metadata tags added in this revision + * + *

Partial documentation is included for each tag; for complete documentation, reference + * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.

+ */ +@VintfStability +@Backing(type="int") +enum CameraMetadataTag { + /** + * android.colorCorrection.mode [dynamic, enum, public] + * + *

The mode control selects how the image data is converted from the + * sensor's native color into linear sRGB color.

+ */ + ANDROID_COLOR_CORRECTION_MODE = CameraMetadataSectionStart.ANDROID_COLOR_CORRECTION_START, + /** + * android.colorCorrection.transform [dynamic, rational[], public] + * + *

A color transform matrix to use to transform + * from sensor RGB color space to output linear sRGB color space.

+ */ + ANDROID_COLOR_CORRECTION_TRANSFORM, + /** + * android.colorCorrection.gains [dynamic, float[], public] + * + *

Gains applying to Bayer raw color channels for + * white-balance.

+ */ + ANDROID_COLOR_CORRECTION_GAINS, + /** + * android.colorCorrection.aberrationMode [dynamic, enum, public] + * + *

Mode of operation for the chromatic aberration correction algorithm.

+ */ + ANDROID_COLOR_CORRECTION_ABERRATION_MODE, + /** + * android.colorCorrection.availableAberrationModes [static, byte[], public] + * + *

List of aberration correction modes for ANDROID_COLOR_CORRECTION_ABERRATION_MODE that are + * supported by this camera device.

+ * + * @see ANDROID_COLOR_CORRECTION_ABERRATION_MODE + */ + ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, + /** + * android.control.aeAntibandingMode [dynamic, enum, public] + * + *

The desired setting for the camera device's auto-exposure + * algorithm's antibanding compensation.

+ */ + ANDROID_CONTROL_AE_ANTIBANDING_MODE = CameraMetadataSectionStart.ANDROID_CONTROL_START, + /** + * android.control.aeExposureCompensation [dynamic, int32, public] + * + *

Adjustment to auto-exposure (AE) target image + * brightness.

+ */ + ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, + /** + * android.control.aeLock [dynamic, enum, public] + * + *

Whether auto-exposure (AE) is currently locked to its latest + * calculated values.

+ */ + ANDROID_CONTROL_AE_LOCK, + /** + * android.control.aeMode [dynamic, enum, public] + * + *

The desired mode for the camera device's + * auto-exposure routine.

+ */ + ANDROID_CONTROL_AE_MODE, + /** + * android.control.aeRegions [dynamic, int32[], public] + * + *

List of metering areas to use for auto-exposure adjustment.

+ */ + ANDROID_CONTROL_AE_REGIONS, + /** + * android.control.aeTargetFpsRange [dynamic, int32[], public] + * + *

Range over which the auto-exposure routine can + * adjust the capture frame rate to maintain good + * exposure.

+ */ + ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + /** + * android.control.aePrecaptureTrigger [dynamic, enum, public] + * + *

Whether the camera device will trigger a precapture + * metering sequence when it processes this request.

+ */ + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, + /** + * android.control.afMode [dynamic, enum, public] + * + *

Whether auto-focus (AF) is currently enabled, and what + * mode it is set to.

+ */ + ANDROID_CONTROL_AF_MODE, + /** + * android.control.afRegions [dynamic, int32[], public] + * + *

List of metering areas to use for auto-focus.

+ */ + ANDROID_CONTROL_AF_REGIONS, + /** + * android.control.afTrigger [dynamic, enum, public] + * + *

Whether the camera device will trigger autofocus for this request.

+ */ + ANDROID_CONTROL_AF_TRIGGER, + /** + * android.control.awbLock [dynamic, enum, public] + * + *

Whether auto-white balance (AWB) is currently locked to its + * latest calculated values.

+ */ + ANDROID_CONTROL_AWB_LOCK, + /** + * android.control.awbMode [dynamic, enum, public] + * + *

Whether auto-white balance (AWB) is currently setting the color + * transform fields, and what its illumination target + * is.

+ */ + ANDROID_CONTROL_AWB_MODE, + /** + * android.control.awbRegions [dynamic, int32[], public] + * + *

List of metering areas to use for auto-white-balance illuminant + * estimation.

+ */ + ANDROID_CONTROL_AWB_REGIONS, + /** + * android.control.captureIntent [dynamic, enum, public] + * + *

Information to the camera device 3A (auto-exposure, + * auto-focus, auto-white balance) routines about the purpose + * of this capture, to help the camera device to decide optimal 3A + * strategy.

+ */ + ANDROID_CONTROL_CAPTURE_INTENT, + /** + * android.control.effectMode [dynamic, enum, public] + * + *

A special color effect to apply.

+ */ + ANDROID_CONTROL_EFFECT_MODE, + /** + * android.control.mode [dynamic, enum, public] + * + *

Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control + * routines.

+ */ + ANDROID_CONTROL_MODE, + /** + * android.control.sceneMode [dynamic, enum, public] + * + *

Control for which scene mode is currently active.

+ */ + ANDROID_CONTROL_SCENE_MODE, + /** + * android.control.videoStabilizationMode [dynamic, enum, public] + * + *

Whether video stabilization is + * active.

+ */ + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + /** + * android.control.aeAvailableAntibandingModes [static, byte[], public] + * + *

List of auto-exposure antibanding modes for ANDROID_CONTROL_AE_ANTIBANDING_MODE that are + * supported by this camera device.

+ * + * @see ANDROID_CONTROL_AE_ANTIBANDING_MODE + */ + ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, + /** + * android.control.aeAvailableModes [static, byte[], public] + * + *

List of auto-exposure modes for ANDROID_CONTROL_AE_MODE that are supported by this camera + * device.

+ * + * @see ANDROID_CONTROL_AE_MODE + */ + ANDROID_CONTROL_AE_AVAILABLE_MODES, + /** + * android.control.aeAvailableTargetFpsRanges [static, int32[], public] + * + *

List of frame rate ranges for ANDROID_CONTROL_AE_TARGET_FPS_RANGE supported by + * this camera device.

+ * + * @see ANDROID_CONTROL_AE_TARGET_FPS_RANGE + */ + ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, + /** + * android.control.aeCompensationRange [static, int32[], public] + * + *

Maximum and minimum exposure compensation values for + * ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, in counts of ANDROID_CONTROL_AE_COMPENSATION_STEP, + * that are supported by this camera device.

+ * + * @see ANDROID_CONTROL_AE_COMPENSATION_STEP + * @see ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION + */ + ANDROID_CONTROL_AE_COMPENSATION_RANGE, + /** + * android.control.aeCompensationStep [static, rational, public] + * + *

Smallest step by which the exposure compensation + * can be changed.

+ */ + ANDROID_CONTROL_AE_COMPENSATION_STEP, + /** + * android.control.afAvailableModes [static, byte[], public] + * + *

List of auto-focus (AF) modes for ANDROID_CONTROL_AF_MODE that are + * supported by this camera device.

+ * + * @see ANDROID_CONTROL_AF_MODE + */ + ANDROID_CONTROL_AF_AVAILABLE_MODES, + /** + * android.control.availableEffects [static, byte[], public] + * + *

List of color effects for ANDROID_CONTROL_EFFECT_MODE that are supported by this camera + * device.

+ * + * @see ANDROID_CONTROL_EFFECT_MODE + */ + ANDROID_CONTROL_AVAILABLE_EFFECTS, + /** + * android.control.availableSceneModes [static, byte[], public] + * + *

List of scene modes for ANDROID_CONTROL_SCENE_MODE that are supported by this camera + * device.

+ * + * @see ANDROID_CONTROL_SCENE_MODE + */ + ANDROID_CONTROL_AVAILABLE_SCENE_MODES, + /** + * android.control.availableVideoStabilizationModes [static, byte[], public] + * + *

List of video stabilization modes for ANDROID_CONTROL_VIDEO_STABILIZATION_MODE + * that are supported by this camera device.

+ * + * @see ANDROID_CONTROL_VIDEO_STABILIZATION_MODE + */ + ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, + /** + * android.control.awbAvailableModes [static, byte[], public] + * + *

List of auto-white-balance modes for ANDROID_CONTROL_AWB_MODE that are supported by this + * camera device.

+ * + * @see ANDROID_CONTROL_AWB_MODE + */ + ANDROID_CONTROL_AWB_AVAILABLE_MODES, + /** + * android.control.maxRegions [static, int32[], ndk_public] + * + *

List of the maximum number of regions that can be used for metering in + * auto-exposure (AE), auto-white balance (AWB), and auto-focus (AF); + * this corresponds to the maximum number of elements in + * ANDROID_CONTROL_AE_REGIONS, ANDROID_CONTROL_AWB_REGIONS, + * and ANDROID_CONTROL_AF_REGIONS.

+ * + * @see ANDROID_CONTROL_AE_REGIONS + * @see ANDROID_CONTROL_AF_REGIONS + * @see ANDROID_CONTROL_AWB_REGIONS + */ + ANDROID_CONTROL_MAX_REGIONS, + /** + * android.control.sceneModeOverrides [static, byte[], system] + * + *

Ordered list of auto-exposure, auto-white balance, and auto-focus + * settings to use with each available scene mode.

+ */ + ANDROID_CONTROL_SCENE_MODE_OVERRIDES, + /** + * android.control.aePrecaptureId [dynamic, int32, system] + * + *

The ID sent with the latest + * CAMERA2_TRIGGER_PRECAPTURE_METERING call

+ */ + ANDROID_CONTROL_AE_PRECAPTURE_ID, + /** + * android.control.aeState [dynamic, enum, public] + * + *

Current state of the auto-exposure (AE) algorithm.

+ */ + ANDROID_CONTROL_AE_STATE, + /** + * android.control.afState [dynamic, enum, public] + * + *

Current state of auto-focus (AF) algorithm.

+ */ + ANDROID_CONTROL_AF_STATE, + /** + * android.control.afTriggerId [dynamic, int32, system] + * + *

The ID sent with the latest + * CAMERA2_TRIGGER_AUTOFOCUS call

+ */ + ANDROID_CONTROL_AF_TRIGGER_ID, + /** + * android.control.awbState [dynamic, enum, public] + * + *

Current state of auto-white balance (AWB) algorithm.

+ */ + ANDROID_CONTROL_AWB_STATE, + /** + * android.control.availableHighSpeedVideoConfigurations [static, int32[], hidden] + * + *

List of available high speed video size, fps range and max batch size configurations + * supported by the camera device, in the format of (width, height, fps_min, fps_max, batch_size_max).

+ */ + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, + /** + * android.control.aeLockAvailable [static, enum, public] + * + *

Whether the camera device supports ANDROID_CONTROL_AE_LOCK

+ * + * @see ANDROID_CONTROL_AE_LOCK + */ + ANDROID_CONTROL_AE_LOCK_AVAILABLE, + /** + * android.control.awbLockAvailable [static, enum, public] + * + *

Whether the camera device supports ANDROID_CONTROL_AWB_LOCK

+ * + * @see ANDROID_CONTROL_AWB_LOCK + */ + ANDROID_CONTROL_AWB_LOCK_AVAILABLE, + /** + * android.control.availableModes [static, byte[], public] + * + *

List of control modes for ANDROID_CONTROL_MODE that are supported by this camera + * device.

+ * + * @see ANDROID_CONTROL_MODE + */ + ANDROID_CONTROL_AVAILABLE_MODES, + /** + * android.control.postRawSensitivityBoostRange [static, int32[], public] + * + *

Range of boosts for ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST supported + * by this camera device.

+ * + * @see ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST + */ + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE, + /** + * android.control.postRawSensitivityBoost [dynamic, int32, public] + * + *

The amount of additional sensitivity boost applied to output images + * after RAW sensor data is captured.

+ */ + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST, + /** + * android.control.enableZsl [dynamic, enum, public] + * + *

Allow camera device to enable zero-shutter-lag mode for requests with + * ANDROID_CONTROL_CAPTURE_INTENT == STILL_CAPTURE.

+ * + * @see ANDROID_CONTROL_CAPTURE_INTENT + */ + ANDROID_CONTROL_ENABLE_ZSL, + /** + * android.control.afSceneChange [dynamic, enum, public] + * + *

Whether a significant scene change is detected within the currently-set AF + * region(s).

+ */ + ANDROID_CONTROL_AF_SCENE_CHANGE, + /** + * android.control.availableExtendedSceneModeMaxSizes [static, int32[], ndk_public] + * + *

The list of extended scene modes for ANDROID_CONTROL_EXTENDED_SCENE_MODE that are supported + * by this camera device, and each extended scene mode's maximum streaming (non-stall) size + * with effect.

+ * + * @see ANDROID_CONTROL_EXTENDED_SCENE_MODE + */ + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES, + /** + * android.control.availableExtendedSceneModeZoomRatioRanges [static, float[], ndk_public] + * + *

The ranges of supported zoom ratio for non-DISABLED ANDROID_CONTROL_EXTENDED_SCENE_MODE.

+ * + * @see ANDROID_CONTROL_EXTENDED_SCENE_MODE + */ + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES, + /** + * android.control.extendedSceneMode [dynamic, enum, public] + * + *

Whether extended scene mode is enabled for a particular capture request.

+ */ + ANDROID_CONTROL_EXTENDED_SCENE_MODE, + /** + * android.control.zoomRatioRange [static, float[], public] + * + *

Minimum and maximum zoom ratios supported by this camera device.

+ */ + ANDROID_CONTROL_ZOOM_RATIO_RANGE, + /** + * android.control.zoomRatio [dynamic, float, public] + * + *

The desired zoom ratio

+ */ + ANDROID_CONTROL_ZOOM_RATIO, + /** + * android.control.availableHighSpeedVideoConfigurationsMaximumResolution [static, int32[], hidden] + * + *

List of available high speed video size, fps range and max batch size configurations + * supported by the camera device, in the format of + * (width, height, fps_min, fps_max, batch_size_max), + * when ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION, + /** + * android.demosaic.mode [controls, enum, system] + * + *

Controls the quality of the demosaicing + * processing.

+ */ + ANDROID_DEMOSAIC_MODE = CameraMetadataSectionStart.ANDROID_DEMOSAIC_START, + /** + * android.edge.mode [dynamic, enum, public] + * + *

Operation mode for edge + * enhancement.

+ */ + ANDROID_EDGE_MODE = CameraMetadataSectionStart.ANDROID_EDGE_START, + /** + * android.edge.strength [controls, byte, system] + * + *

Control the amount of edge enhancement + * applied to the images

+ */ + ANDROID_EDGE_STRENGTH, + /** + * android.edge.availableEdgeModes [static, byte[], public] + * + *

List of edge enhancement modes for ANDROID_EDGE_MODE that are supported by this camera + * device.

+ * + * @see ANDROID_EDGE_MODE + */ + ANDROID_EDGE_AVAILABLE_EDGE_MODES, + /** + * android.flash.firingPower [dynamic, byte, system] + * + *

Power for flash firing/torch

+ */ + ANDROID_FLASH_FIRING_POWER = CameraMetadataSectionStart.ANDROID_FLASH_START, + /** + * android.flash.firingTime [dynamic, int64, system] + * + *

Firing time of flash relative to start of + * exposure

+ */ + ANDROID_FLASH_FIRING_TIME, + /** + * android.flash.mode [dynamic, enum, public] + * + *

The desired mode for for the camera device's flash control.

+ */ + ANDROID_FLASH_MODE, + /** + * android.flash.colorTemperature [static, byte, system] + * + *

The x,y whitepoint of the + * flash

+ */ + ANDROID_FLASH_COLOR_TEMPERATURE, + /** + * android.flash.maxEnergy [static, byte, system] + * + *

Max energy output of the flash for a full + * power single flash

+ */ + ANDROID_FLASH_MAX_ENERGY, + /** + * android.flash.state [dynamic, enum, public] + * + *

Current state of the flash + * unit.

+ */ + ANDROID_FLASH_STATE, + /** + * android.flash.info.available [static, enum, public] + * + *

Whether this camera device has a + * flash unit.

+ */ + ANDROID_FLASH_INFO_AVAILABLE = CameraMetadataSectionStart.ANDROID_FLASH_INFO_START, + /** + * android.flash.info.chargeDuration [static, int64, system] + * + *

Time taken before flash can fire + * again

+ */ + ANDROID_FLASH_INFO_CHARGE_DURATION, + /** + * android.flash.info.strengthMaximumLevel [static, int32, public] + * + *

Maximum flashlight brightness level.

+ */ + ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, + /** + * android.flash.info.strengthDefaultLevel [static, int32, public] + * + *

Default flashlight brightness level to be set via + * CameraManager#turnOnTorchWithStrengthLevel.

+ */ + ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, + /** + * android.hotPixel.mode [dynamic, enum, public] + * + *

Operational mode for hot pixel correction.

+ */ + ANDROID_HOT_PIXEL_MODE = CameraMetadataSectionStart.ANDROID_HOT_PIXEL_START, + /** + * android.hotPixel.availableHotPixelModes [static, byte[], public] + * + *

List of hot pixel correction modes for ANDROID_HOT_PIXEL_MODE that are supported by this + * camera device.

+ * + * @see ANDROID_HOT_PIXEL_MODE + */ + ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES, + /** + * android.jpeg.gpsCoordinates [dynamic, double[], ndk_public] + * + *

GPS coordinates to include in output JPEG + * EXIF.

+ */ + ANDROID_JPEG_GPS_COORDINATES = CameraMetadataSectionStart.ANDROID_JPEG_START, + /** + * android.jpeg.gpsProcessingMethod [dynamic, byte, ndk_public] + * + *

32 characters describing GPS algorithm to + * include in EXIF.

+ */ + ANDROID_JPEG_GPS_PROCESSING_METHOD, + /** + * android.jpeg.gpsTimestamp [dynamic, int64, ndk_public] + * + *

Time GPS fix was made to include in + * EXIF.

+ */ + ANDROID_JPEG_GPS_TIMESTAMP, + /** + * android.jpeg.orientation [dynamic, int32, public] + * + *

The orientation for a JPEG image.

+ */ + ANDROID_JPEG_ORIENTATION, + /** + * android.jpeg.quality [dynamic, byte, public] + * + *

Compression quality of the final JPEG + * image.

+ */ + ANDROID_JPEG_QUALITY, + /** + * android.jpeg.thumbnailQuality [dynamic, byte, public] + * + *

Compression quality of JPEG + * thumbnail.

+ */ + ANDROID_JPEG_THUMBNAIL_QUALITY, + /** + * android.jpeg.thumbnailSize [dynamic, int32[], public] + * + *

Resolution of embedded JPEG thumbnail.

+ */ + ANDROID_JPEG_THUMBNAIL_SIZE, + /** + * android.jpeg.availableThumbnailSizes [static, int32[], public] + * + *

List of JPEG thumbnail sizes for ANDROID_JPEG_THUMBNAIL_SIZE supported by this + * camera device.

+ * + * @see ANDROID_JPEG_THUMBNAIL_SIZE + */ + ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, + /** + * android.jpeg.maxSize [static, int32, system] + * + *

Maximum size in bytes for the compressed + * JPEG buffer, in default sensor pixel mode (see ANDROID_SENSOR_PIXEL_MODE)

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_JPEG_MAX_SIZE, + /** + * android.jpeg.size [dynamic, int32, system] + * + *

The size of the compressed JPEG image, in + * bytes

+ */ + ANDROID_JPEG_SIZE, + /** + * android.lens.aperture [dynamic, float, public] + * + *

The desired lens aperture size, as a ratio of lens focal length to the + * effective aperture diameter.

+ */ + ANDROID_LENS_APERTURE = CameraMetadataSectionStart.ANDROID_LENS_START, + /** + * android.lens.filterDensity [dynamic, float, public] + * + *

The desired setting for the lens neutral density filter(s).

+ */ + ANDROID_LENS_FILTER_DENSITY, + /** + * android.lens.focalLength [dynamic, float, public] + * + *

The desired lens focal length; used for optical zoom.

+ */ + ANDROID_LENS_FOCAL_LENGTH, + /** + * android.lens.focusDistance [dynamic, float, public] + * + *

Desired distance to plane of sharpest focus, + * measured from frontmost surface of the lens.

+ */ + ANDROID_LENS_FOCUS_DISTANCE, + /** + * android.lens.opticalStabilizationMode [dynamic, enum, public] + * + *

Sets whether the camera device uses optical image stabilization (OIS) + * when capturing images.

+ */ + ANDROID_LENS_OPTICAL_STABILIZATION_MODE, + /** + * android.lens.facing [static, enum, public] + * + *

Direction the camera faces relative to + * device screen.

+ */ + ANDROID_LENS_FACING, + /** + * android.lens.poseRotation [dynamic, float[], public] + * + *

The orientation of the camera relative to the sensor + * coordinate system.

+ */ + ANDROID_LENS_POSE_ROTATION, + /** + * android.lens.poseTranslation [dynamic, float[], public] + * + *

Position of the camera optical center.

+ */ + ANDROID_LENS_POSE_TRANSLATION, + /** + * android.lens.focusRange [dynamic, float[], public] + * + *

The range of scene distances that are in + * sharp focus (depth of field).

+ */ + ANDROID_LENS_FOCUS_RANGE, + /** + * android.lens.state [dynamic, enum, public] + * + *

Current lens status.

+ */ + ANDROID_LENS_STATE, + /** + * android.lens.intrinsicCalibration [dynamic, float[], public] + * + *

The parameters for this camera device's intrinsic + * calibration.

+ */ + ANDROID_LENS_INTRINSIC_CALIBRATION, + /** + * android.lens.radialDistortion [dynamic, float[], public] + * + *

The correction coefficients to correct for this camera device's + * radial and tangential lens distortion.

+ */ + ANDROID_LENS_RADIAL_DISTORTION, + /** + * android.lens.poseReference [static, enum, public] + * + *

The origin for ANDROID_LENS_POSE_TRANSLATION, and the accuracy of + * ANDROID_LENS_POSE_TRANSLATION and ANDROID_LENS_POSE_ROTATION.

+ * + * @see ANDROID_LENS_POSE_ROTATION + * @see ANDROID_LENS_POSE_TRANSLATION + */ + ANDROID_LENS_POSE_REFERENCE, + /** + * android.lens.distortion [dynamic, float[], public] + * + *

The correction coefficients to correct for this camera device's + * radial and tangential lens distortion.

+ *

Replaces the deprecated ANDROID_LENS_RADIAL_DISTORTION field, which was + * inconsistently defined.

+ * + * @see ANDROID_LENS_RADIAL_DISTORTION + */ + ANDROID_LENS_DISTORTION, + /** + * android.lens.distortionMaximumResolution [static, float[], public] + * + *

The correction coefficients to correct for this camera device's + * radial and tangential lens distortion for a + * CaptureRequest with ANDROID_SENSOR_PIXEL_MODE set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_LENS_DISTORTION_MAXIMUM_RESOLUTION, + /** + * android.lens.intrinsicCalibrationMaximumResolution [static, float[], public] + * + *

The parameters for this camera device's intrinsic + * calibration when ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION, + /** + * android.lens.info.availableApertures [static, float[], public] + * + *

List of aperture size values for ANDROID_LENS_APERTURE that are + * supported by this camera device.

+ * + * @see ANDROID_LENS_APERTURE + */ + ANDROID_LENS_INFO_AVAILABLE_APERTURES = CameraMetadataSectionStart.ANDROID_LENS_INFO_START, + /** + * android.lens.info.availableFilterDensities [static, float[], public] + * + *

List of neutral density filter values for + * ANDROID_LENS_FILTER_DENSITY that are supported by this camera device.

+ * + * @see ANDROID_LENS_FILTER_DENSITY + */ + ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES, + /** + * android.lens.info.availableFocalLengths [static, float[], public] + * + *

List of focal lengths for ANDROID_LENS_FOCAL_LENGTH that are supported by this camera + * device.

+ * + * @see ANDROID_LENS_FOCAL_LENGTH + */ + ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, + /** + * android.lens.info.availableOpticalStabilization [static, byte[], public] + * + *

List of optical image stabilization (OIS) modes for + * ANDROID_LENS_OPTICAL_STABILIZATION_MODE that are supported by this camera device.

+ * + * @see ANDROID_LENS_OPTICAL_STABILIZATION_MODE + */ + ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, + /** + * android.lens.info.hyperfocalDistance [static, float, public] + * + *

Hyperfocal distance for this lens.

+ */ + ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE, + /** + * android.lens.info.minimumFocusDistance [static, float, public] + * + *

Shortest distance from frontmost surface + * of the lens that can be brought into sharp focus.

+ */ + ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE, + /** + * android.lens.info.shadingMapSize [static, int32[], ndk_public] + * + *

Dimensions of lens shading map.

+ */ + ANDROID_LENS_INFO_SHADING_MAP_SIZE, + /** + * android.lens.info.focusDistanceCalibration [static, enum, public] + * + *

The lens focus distance calibration quality.

+ */ + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION, + /** + * android.noiseReduction.mode [dynamic, enum, public] + * + *

Mode of operation for the noise reduction algorithm.

+ */ + ANDROID_NOISE_REDUCTION_MODE = CameraMetadataSectionStart.ANDROID_NOISE_REDUCTION_START, + /** + * android.noiseReduction.strength [controls, byte, system] + * + *

Control the amount of noise reduction + * applied to the images

+ */ + ANDROID_NOISE_REDUCTION_STRENGTH, + /** + * android.noiseReduction.availableNoiseReductionModes [static, byte[], public] + * + *

List of noise reduction modes for ANDROID_NOISE_REDUCTION_MODE that are supported + * by this camera device.

+ * + * @see ANDROID_NOISE_REDUCTION_MODE + */ + ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, + /** + * android.quirks.meteringCropRegion [static, byte, system] + * + *

If set to 1, the camera service does not + * scale 'normalized' coordinates with respect to the crop + * region. This applies to metering input (a{e,f,wb}Region + * and output (face rectangles).

+ */ + ANDROID_QUIRKS_METERING_CROP_REGION = CameraMetadataSectionStart.ANDROID_QUIRKS_START, + /** + * android.quirks.triggerAfWithAuto [static, byte, system] + * + *

If set to 1, then the camera service always + * switches to FOCUS_MODE_AUTO before issuing a AF + * trigger.

+ */ + ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO, + /** + * android.quirks.useZslFormat [static, byte, system] + * + *

If set to 1, the camera service uses + * CAMERA2_PIXEL_FORMAT_ZSL instead of + * HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED for the zero + * shutter lag stream

+ */ + ANDROID_QUIRKS_USE_ZSL_FORMAT, + /** + * android.quirks.usePartialResult [static, byte, hidden] + * + *

If set to 1, the HAL will always split result + * metadata for a single capture into multiple buffers, + * returned using multiple process_capture_result calls.

+ */ + ANDROID_QUIRKS_USE_PARTIAL_RESULT, + /** + * android.quirks.partialResult [dynamic, enum, hidden] + * + *

Whether a result given to the framework is the + * final one for the capture, or only a partial that contains a + * subset of the full set of dynamic metadata + * values.

+ */ + ANDROID_QUIRKS_PARTIAL_RESULT, + /** + * android.request.frameCount [dynamic, int32, hidden] + * + *

A frame counter set by the framework. This value monotonically + * increases with every new result (that is, each new result has a unique + * frameCount value).

+ */ + ANDROID_REQUEST_FRAME_COUNT = CameraMetadataSectionStart.ANDROID_REQUEST_START, + /** + * android.request.id [dynamic, int32, hidden] + * + *

An application-specified ID for the current + * request. Must be maintained unchanged in output + * frame

+ */ + ANDROID_REQUEST_ID, + /** + * android.request.inputStreams [controls, int32[], system] + * + *

List which camera reprocess stream is used + * for the source of reprocessing data.

+ */ + ANDROID_REQUEST_INPUT_STREAMS, + /** + * android.request.metadataMode [dynamic, enum, system] + * + *

How much metadata to produce on + * output

+ */ + ANDROID_REQUEST_METADATA_MODE, + /** + * android.request.outputStreams [dynamic, int32[], system] + * + *

Lists which camera output streams image data + * from this capture must be sent to

+ */ + ANDROID_REQUEST_OUTPUT_STREAMS, + /** + * android.request.type [controls, enum, system] + * + *

The type of the request; either CAPTURE or + * REPROCESS. For legacy HAL3, this tag is redundant.

+ */ + ANDROID_REQUEST_TYPE, + /** + * android.request.maxNumOutputStreams [static, int32[], ndk_public] + * + *

The maximum numbers of different types of output streams + * that can be configured and used simultaneously by a camera device.

+ */ + ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, + /** + * android.request.maxNumReprocessStreams [static, int32[], system] + * + *

How many reprocessing streams of any type + * can be allocated at the same time.

+ */ + ANDROID_REQUEST_MAX_NUM_REPROCESS_STREAMS, + /** + * android.request.maxNumInputStreams [static, int32, java_public] + * + *

The maximum numbers of any type of input streams + * that can be configured and used simultaneously by a camera device.

+ */ + ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS, + /** + * android.request.pipelineDepth [dynamic, byte, public] + * + *

Specifies the number of pipeline stages the frame went + * through from when it was exposed to when the final completed result + * was available to the framework.

+ */ + ANDROID_REQUEST_PIPELINE_DEPTH, + /** + * android.request.pipelineMaxDepth [static, byte, public] + * + *

Specifies the number of maximum pipeline stages a frame + * has to go through from when it's exposed to when it's available + * to the framework.

+ */ + ANDROID_REQUEST_PIPELINE_MAX_DEPTH, + /** + * android.request.partialResultCount [static, int32, public] + * + *

Defines how many sub-components + * a result will be composed of.

+ */ + ANDROID_REQUEST_PARTIAL_RESULT_COUNT, + /** + * android.request.availableCapabilities [static, enum[], public] + * + *

List of capabilities that this camera device + * advertises as fully supporting.

+ */ + ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + /** + * android.request.availableRequestKeys [static, int32[], ndk_public] + * + *

A list of all keys that the camera device has available + * to use with {@link ACaptureRequest }.

+ */ + ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, + /** + * android.request.availableResultKeys [static, int32[], ndk_public] + * + *

A list of all keys that the camera device has available to use with {@link ACameraCaptureSession_captureCallback_result }.

+ */ + ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, + /** + * android.request.availableCharacteristicsKeys [static, int32[], ndk_public] + * + *

A list of all keys that the camera device has available to use with {@link ACameraManager_getCameraCharacteristics }.

+ */ + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, + /** + * android.request.availableSessionKeys [static, int32[], ndk_public] + * + *

A subset of the available request keys that the camera device + * can pass as part of the capture session initialization.

+ */ + ANDROID_REQUEST_AVAILABLE_SESSION_KEYS, + /** + * android.request.availablePhysicalCameraRequestKeys [static, int32[], ndk_public] + * + *

A subset of the available request keys that can be overridden for + * physical devices backing a logical multi-camera.

+ */ + ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS, + /** + * android.request.characteristicKeysNeedingPermission [static, int32[], hidden] + * + *

A list of camera characteristics keys that are only available + * in case the camera client has camera permission.

+ */ + ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION, + /** + * android.request.availableDynamicRangeProfilesMap [static, enum[], ndk_public] + * + *

A map of all available 10-bit dynamic range profiles along with their + * capture request constraints.

+ */ + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP, + /** + * android.request.recommendedTenBitDynamicRangeProfile [static, int64, java_public] + * + *

Recommended 10-bit dynamic range profile.

+ */ + ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE, + /** + * android.scaler.cropRegion [dynamic, int32[], public] + * + *

The desired region of the sensor to read out for this capture.

+ */ + ANDROID_SCALER_CROP_REGION = CameraMetadataSectionStart.ANDROID_SCALER_START, + /** + * android.scaler.availableFormats [static, enum[], hidden] + * + *

The list of image formats that are supported by this + * camera device for output streams.

+ */ + ANDROID_SCALER_AVAILABLE_FORMATS, + /** + * android.scaler.availableJpegMinDurations [static, int64[], hidden] + * + *

The minimum frame duration that is supported + * for each resolution in ANDROID_SCALER_AVAILABLE_JPEG_SIZES.

+ * + * @see ANDROID_SCALER_AVAILABLE_JPEG_SIZES + */ + ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS, + /** + * android.scaler.availableJpegSizes [static, int32[], hidden] + * + *

The JPEG resolutions that are supported by this camera device.

+ */ + ANDROID_SCALER_AVAILABLE_JPEG_SIZES, + /** + * android.scaler.availableMaxDigitalZoom [static, float, public] + * + *

The maximum ratio between both active area width + * and crop region width, and active area height and + * crop region height, for ANDROID_SCALER_CROP_REGION.

+ * + * @see ANDROID_SCALER_CROP_REGION + */ + ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, + /** + * android.scaler.availableProcessedMinDurations [static, int64[], hidden] + * + *

For each available processed output size (defined in + * ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES), this property lists the + * minimum supportable frame duration for that size.

+ * + * @see ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES + */ + ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS, + /** + * android.scaler.availableProcessedSizes [static, int32[], hidden] + * + *

The resolutions available for use with + * processed output streams, such as YV12, NV12, and + * platform opaque YUV/RGB streams to the GPU or video + * encoders.

+ */ + ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES, + /** + * android.scaler.availableRawMinDurations [static, int64[], system] + * + *

For each available raw output size (defined in + * ANDROID_SCALER_AVAILABLE_RAW_SIZES), this property lists the minimum + * supportable frame duration for that size.

+ * + * @see ANDROID_SCALER_AVAILABLE_RAW_SIZES + */ + ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS, + /** + * android.scaler.availableRawSizes [static, int32[], system] + * + *

The resolutions available for use with raw + * sensor output streams, listed as width, + * height

+ */ + ANDROID_SCALER_AVAILABLE_RAW_SIZES, + /** + * android.scaler.availableInputOutputFormatsMap [static, int32, hidden] + * + *

The mapping of image formats that are supported by this + * camera device for input streams, to their corresponding output formats.

+ */ + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP, + /** + * android.scaler.availableStreamConfigurations [static, enum[], ndk_public] + * + *

The available stream configurations that this + * camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + /** + * android.scaler.availableMinFrameDurations [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination.

+ */ + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, + /** + * android.scaler.availableStallDurations [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination.

+ */ + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS, + /** + * android.scaler.croppingType [static, enum, public] + * + *

The crop type that this camera device supports.

+ */ + ANDROID_SCALER_CROPPING_TYPE, + /** + * android.scaler.availableRecommendedStreamConfigurations [static, enum[], ndk_public] + * + *

Recommended stream configurations for common client use cases.

+ */ + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS, + /** + * android.scaler.availableRecommendedInputOutputFormatsMap [static, int32, ndk_public] + * + *

Recommended mappings of image formats that are supported by this + * camera device for input streams, to their corresponding output formats.

+ */ + ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP, + /** + * android.scaler.availableRotateAndCropModes [static, byte[], public] + * + *

List of rotate-and-crop modes for ANDROID_SCALER_ROTATE_AND_CROP that are supported by this camera device.

+ * + * @see ANDROID_SCALER_ROTATE_AND_CROP + */ + ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES, + /** + * android.scaler.rotateAndCrop [dynamic, enum, public] + * + *

Whether a rotation-and-crop operation is applied to processed + * outputs from the camera.

+ */ + ANDROID_SCALER_ROTATE_AND_CROP, + /** + * android.scaler.defaultSecureImageSize [static, int32[], public] + * + *

Default YUV/PRIVATE size to use for requesting secure image buffers.

+ */ + ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE, + /** + * android.scaler.physicalCameraMultiResolutionStreamConfigurations [static, enum[], ndk_public] + * + *

The available multi-resolution stream configurations that this + * physical camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS, + /** + * android.scaler.availableStreamConfigurationsMaximumResolution [static, enum[], ndk_public] + * + *

The available stream configurations that this + * camera device supports (i.e. format, width, height, output/input stream) for a + * CaptureRequest with ANDROID_SENSOR_PIXEL_MODE set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + /** + * android.scaler.availableMinFrameDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination when the camera device is sent a CaptureRequest with + * ANDROID_SENSOR_PIXEL_MODE set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.scaler.availableStallDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination when CaptureRequests are submitted with + * ANDROID_SENSOR_PIXEL_MODE set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.scaler.availableInputOutputFormatsMapMaximumResolution [static, int32, hidden] + * + *

The mapping of image formats that are supported by this + * camera device for input streams, to their corresponding output formats, when + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP_MAXIMUM_RESOLUTION, + /** + * android.scaler.multiResolutionStreamSupported [static, enum, ndk_public] + * + *

Whether the camera device supports multi-resolution input or output streams

+ */ + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED, + /** + * android.scaler.availableStreamUseCases [static, enum[], public] + * + *

The stream use cases supported by this camera device.

+ */ + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = 851994, + /** + * android.sensor.exposureTime [dynamic, int64, public] + * + *

Duration each pixel is exposed to + * light.

+ */ + ANDROID_SENSOR_EXPOSURE_TIME = CameraMetadataSectionStart.ANDROID_SENSOR_START, + /** + * android.sensor.frameDuration [dynamic, int64, public] + * + *

Duration from start of frame exposure to + * start of next frame exposure.

+ */ + ANDROID_SENSOR_FRAME_DURATION, + /** + * android.sensor.sensitivity [dynamic, int32, public] + * + *

The amount of gain applied to sensor data + * before processing.

+ */ + ANDROID_SENSOR_SENSITIVITY, + /** + * android.sensor.referenceIlluminant1 [static, enum, public] + * + *

The standard reference illuminant used as the scene light source when + * calculating the ANDROID_SENSOR_COLOR_TRANSFORM1, + * ANDROID_SENSOR_CALIBRATION_TRANSFORM1, and + * ANDROID_SENSOR_FORWARD_MATRIX1 matrices.

+ * + * @see ANDROID_SENSOR_CALIBRATION_TRANSFORM1 + * @see ANDROID_SENSOR_COLOR_TRANSFORM1 + * @see ANDROID_SENSOR_FORWARD_MATRIX1 + */ + ANDROID_SENSOR_REFERENCE_ILLUMINANT1, + /** + * android.sensor.referenceIlluminant2 [static, byte, public] + * + *

The standard reference illuminant used as the scene light source when + * calculating the ANDROID_SENSOR_COLOR_TRANSFORM2, + * ANDROID_SENSOR_CALIBRATION_TRANSFORM2, and + * ANDROID_SENSOR_FORWARD_MATRIX2 matrices.

+ * + * @see ANDROID_SENSOR_CALIBRATION_TRANSFORM2 + * @see ANDROID_SENSOR_COLOR_TRANSFORM2 + * @see ANDROID_SENSOR_FORWARD_MATRIX2 + */ + ANDROID_SENSOR_REFERENCE_ILLUMINANT2, + /** + * android.sensor.calibrationTransform1 [static, rational[], public] + * + *

A per-device calibration transform matrix that maps from the + * reference sensor colorspace to the actual device sensor colorspace.

+ */ + ANDROID_SENSOR_CALIBRATION_TRANSFORM1, + /** + * android.sensor.calibrationTransform2 [static, rational[], public] + * + *

A per-device calibration transform matrix that maps from the + * reference sensor colorspace to the actual device sensor colorspace + * (this is the colorspace of the raw buffer data).

+ */ + ANDROID_SENSOR_CALIBRATION_TRANSFORM2, + /** + * android.sensor.colorTransform1 [static, rational[], public] + * + *

A matrix that transforms color values from CIE XYZ color space to + * reference sensor color space.

+ */ + ANDROID_SENSOR_COLOR_TRANSFORM1, + /** + * android.sensor.colorTransform2 [static, rational[], public] + * + *

A matrix that transforms color values from CIE XYZ color space to + * reference sensor color space.

+ */ + ANDROID_SENSOR_COLOR_TRANSFORM2, + /** + * android.sensor.forwardMatrix1 [static, rational[], public] + * + *

A matrix that transforms white balanced camera colors from the reference + * sensor colorspace to the CIE XYZ colorspace with a D50 whitepoint.

+ */ + ANDROID_SENSOR_FORWARD_MATRIX1, + /** + * android.sensor.forwardMatrix2 [static, rational[], public] + * + *

A matrix that transforms white balanced camera colors from the reference + * sensor colorspace to the CIE XYZ colorspace with a D50 whitepoint.

+ */ + ANDROID_SENSOR_FORWARD_MATRIX2, + /** + * android.sensor.baseGainFactor [static, rational, system] + * + *

Gain factor from electrons to raw units when + * ISO=100

+ */ + ANDROID_SENSOR_BASE_GAIN_FACTOR, + /** + * android.sensor.blackLevelPattern [static, int32[], public] + * + *

A fixed black level offset for each of the color filter arrangement + * (CFA) mosaic channels.

+ */ + ANDROID_SENSOR_BLACK_LEVEL_PATTERN, + /** + * android.sensor.maxAnalogSensitivity [static, int32, public] + * + *

Maximum sensitivity that is implemented + * purely through analog gain.

+ */ + ANDROID_SENSOR_MAX_ANALOG_SENSITIVITY, + /** + * android.sensor.orientation [static, int32, public] + * + *

Clockwise angle through which the output image needs to be rotated to be + * upright on the device screen in its native orientation.

+ */ + ANDROID_SENSOR_ORIENTATION, + /** + * android.sensor.profileHueSatMapDimensions [static, int32[], system] + * + *

The number of input samples for each dimension of + * ANDROID_SENSOR_PROFILE_HUE_SAT_MAP.

+ * + * @see ANDROID_SENSOR_PROFILE_HUE_SAT_MAP + */ + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP_DIMENSIONS, + /** + * android.sensor.timestamp [dynamic, int64, public] + * + *

Time at start of exposure of first + * row of the image sensor active array, in nanoseconds.

+ */ + ANDROID_SENSOR_TIMESTAMP, + /** + * android.sensor.temperature [dynamic, float, system] + * + *

The temperature of the sensor, sampled at the time + * exposure began for this frame.

+ *

The thermal diode being queried should be inside the sensor PCB, or + * somewhere close to it.

+ */ + ANDROID_SENSOR_TEMPERATURE, + /** + * android.sensor.neutralColorPoint [dynamic, rational[], public] + * + *

The estimated camera neutral color in the native sensor colorspace at + * the time of capture.

+ */ + ANDROID_SENSOR_NEUTRAL_COLOR_POINT, + /** + * android.sensor.noiseProfile [dynamic, double[], public] + * + *

Noise model coefficients for each CFA mosaic channel.

+ */ + ANDROID_SENSOR_NOISE_PROFILE, + /** + * android.sensor.profileHueSatMap [dynamic, float[], system] + * + *

A mapping containing a hue shift, saturation scale, and value scale + * for each pixel.

+ */ + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP, + /** + * android.sensor.profileToneCurve [dynamic, float[], system] + * + *

A list of x,y samples defining a tone-mapping curve for gamma adjustment.

+ */ + ANDROID_SENSOR_PROFILE_TONE_CURVE, + /** + * android.sensor.greenSplit [dynamic, float, public] + * + *

The worst-case divergence between Bayer green channels.

+ */ + ANDROID_SENSOR_GREEN_SPLIT, + /** + * android.sensor.testPatternData [dynamic, int32[], public] + * + *

A pixel [R, G_even, G_odd, B] that supplies the test pattern + * when ANDROID_SENSOR_TEST_PATTERN_MODE is SOLID_COLOR.

+ * + * @see ANDROID_SENSOR_TEST_PATTERN_MODE + */ + ANDROID_SENSOR_TEST_PATTERN_DATA, + /** + * android.sensor.testPatternMode [dynamic, enum, public] + * + *

When enabled, the sensor sends a test pattern instead of + * doing a real exposure from the camera.

+ */ + ANDROID_SENSOR_TEST_PATTERN_MODE, + /** + * android.sensor.availableTestPatternModes [static, int32[], public] + * + *

List of sensor test pattern modes for ANDROID_SENSOR_TEST_PATTERN_MODE + * supported by this camera device.

+ * + * @see ANDROID_SENSOR_TEST_PATTERN_MODE + */ + ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, + /** + * android.sensor.rollingShutterSkew [dynamic, int64, public] + * + *

Duration between the start of exposure for the first row of the image sensor, + * and the start of exposure for one past the last row of the image sensor.

+ */ + ANDROID_SENSOR_ROLLING_SHUTTER_SKEW, + /** + * android.sensor.opticalBlackRegions [static, int32[], public] + * + *

List of disjoint rectangles indicating the sensor + * optically shielded black pixel regions.

+ */ + ANDROID_SENSOR_OPTICAL_BLACK_REGIONS, + /** + * android.sensor.dynamicBlackLevel [dynamic, float[], public] + * + *

A per-frame dynamic black level offset for each of the color filter + * arrangement (CFA) mosaic channels.

+ */ + ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL, + /** + * android.sensor.dynamicWhiteLevel [dynamic, int32, public] + * + *

Maximum raw value output by sensor for this frame.

+ */ + ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL, + /** + * android.sensor.opaqueRawSize [static, int32[], system] + * + *

Size in bytes for all the listed opaque RAW buffer sizes

+ */ + ANDROID_SENSOR_OPAQUE_RAW_SIZE, + /** + * android.sensor.opaqueRawSizeMaximumResolution [static, int32[], system] + * + *

Size in bytes for all the listed opaque RAW buffer sizes when + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION, + /** + * android.sensor.pixelMode [dynamic, enum, public] + * + *

Switches sensor pixel mode between maximum resolution mode and default mode.

+ */ + ANDROID_SENSOR_PIXEL_MODE, + /** + * android.sensor.rawBinningFactorUsed [dynamic, enum, public] + * + *

Whether RAW images requested have their bayer pattern as described by + * ANDROID_SENSOR_INFO_BINNING_FACTOR.

+ * + * @see ANDROID_SENSOR_INFO_BINNING_FACTOR + */ + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED, + /** + * android.sensor.info.activeArraySize [static, int32[], public] + * + *

The area of the image sensor which corresponds to active pixels after any geometric + * distortion correction has been applied.

+ */ + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE = CameraMetadataSectionStart.ANDROID_SENSOR_INFO_START, + /** + * android.sensor.info.sensitivityRange [static, int32[], public] + * + *

Range of sensitivities for ANDROID_SENSOR_SENSITIVITY supported by this + * camera device.

+ * + * @see ANDROID_SENSOR_SENSITIVITY + */ + ANDROID_SENSOR_INFO_SENSITIVITY_RANGE, + /** + * android.sensor.info.colorFilterArrangement [static, enum, public] + * + *

The arrangement of color filters on sensor; + * represents the colors in the top-left 2x2 section of + * the sensor, in reading order, for a Bayer camera, or the + * light spectrum it captures for MONOCHROME camera.

+ */ + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, + /** + * android.sensor.info.exposureTimeRange [static, int64[], public] + * + *

The range of image exposure times for ANDROID_SENSOR_EXPOSURE_TIME supported + * by this camera device.

+ * + * @see ANDROID_SENSOR_EXPOSURE_TIME + */ + ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, + /** + * android.sensor.info.maxFrameDuration [static, int64, public] + * + *

The maximum possible frame duration (minimum frame rate) for + * ANDROID_SENSOR_FRAME_DURATION that is supported this camera device.

+ * + * @see ANDROID_SENSOR_FRAME_DURATION + */ + ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, + /** + * android.sensor.info.physicalSize [static, float[], public] + * + *

The physical dimensions of the full pixel + * array.

+ */ + ANDROID_SENSOR_INFO_PHYSICAL_SIZE, + /** + * android.sensor.info.pixelArraySize [static, int32[], public] + * + *

Dimensions of the full pixel array, possibly + * including black calibration pixels.

+ */ + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, + /** + * android.sensor.info.whiteLevel [static, int32, public] + * + *

Maximum raw value output by sensor.

+ */ + ANDROID_SENSOR_INFO_WHITE_LEVEL, + /** + * android.sensor.info.timestampSource [static, enum, public] + * + *

The time base source for sensor capture start timestamps.

+ */ + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, + /** + * android.sensor.info.lensShadingApplied [static, enum, public] + * + *

Whether the RAW images output from this camera device are subject to + * lens shading correction.

+ */ + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED, + /** + * android.sensor.info.preCorrectionActiveArraySize [static, int32[], public] + * + *

The area of the image sensor which corresponds to active pixels prior to the + * application of any geometric distortion correction.

+ */ + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, + /** + * android.sensor.info.activeArraySizeMaximumResolution [static, int32[], public] + * + *

The area of the image sensor which corresponds to active pixels after any geometric + * distortion correction has been applied, when the sensor runs in maximum resolution mode.

+ */ + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION, + /** + * android.sensor.info.pixelArraySizeMaximumResolution [static, int32[], public] + * + *

Dimensions of the full pixel array, possibly + * including black calibration pixels, when the sensor runs in maximum resolution mode. + * Analogous to ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, when ANDROID_SENSOR_PIXEL_MODE is + * set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION, + /** + * android.sensor.info.preCorrectionActiveArraySizeMaximumResolution [static, int32[], public] + * + *

The area of the image sensor which corresponds to active pixels prior to the + * application of any geometric distortion correction, when the sensor runs in maximum + * resolution mode. This key must be used for crop / metering regions, only when + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION, + /** + * android.sensor.info.binningFactor [static, int32[], public] + * + *

Dimensions of the group of pixels which are under the same color filter. + * This specifies the width and height (pair of integers) of the group of pixels which fall + * under the same color filter for ULTRA_HIGH_RESOLUTION sensors.

+ */ + ANDROID_SENSOR_INFO_BINNING_FACTOR, + /** + * android.shading.mode [dynamic, enum, public] + * + *

Quality of lens shading correction applied + * to the image data.

+ */ + ANDROID_SHADING_MODE = CameraMetadataSectionStart.ANDROID_SHADING_START, + /** + * android.shading.strength [controls, byte, system] + * + *

Control the amount of shading correction + * applied to the images

+ */ + ANDROID_SHADING_STRENGTH, + /** + * android.shading.availableModes [static, byte[], public] + * + *

List of lens shading modes for ANDROID_SHADING_MODE that are supported by this camera device.

+ * + * @see ANDROID_SHADING_MODE + */ + ANDROID_SHADING_AVAILABLE_MODES, + /** + * android.statistics.faceDetectMode [dynamic, enum, public] + * + *

Operating mode for the face detector + * unit.

+ */ + ANDROID_STATISTICS_FACE_DETECT_MODE = CameraMetadataSectionStart.ANDROID_STATISTICS_START, + /** + * android.statistics.histogramMode [dynamic, enum, system] + * + *

Operating mode for histogram + * generation

+ */ + ANDROID_STATISTICS_HISTOGRAM_MODE, + /** + * android.statistics.sharpnessMapMode [dynamic, enum, system] + * + *

Operating mode for sharpness map + * generation

+ */ + ANDROID_STATISTICS_SHARPNESS_MAP_MODE, + /** + * android.statistics.hotPixelMapMode [dynamic, enum, public] + * + *

Operating mode for hot pixel map generation.

+ */ + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE, + /** + * android.statistics.faceIds [dynamic, int32[], ndk_public] + * + *

List of unique IDs for detected faces.

+ */ + ANDROID_STATISTICS_FACE_IDS, + /** + * android.statistics.faceLandmarks [dynamic, int32[], ndk_public] + * + *

List of landmarks for detected + * faces.

+ */ + ANDROID_STATISTICS_FACE_LANDMARKS, + /** + * android.statistics.faceRectangles [dynamic, int32[], ndk_public] + * + *

List of the bounding rectangles for detected + * faces.

+ */ + ANDROID_STATISTICS_FACE_RECTANGLES, + /** + * android.statistics.faceScores [dynamic, byte[], ndk_public] + * + *

List of the face confidence scores for + * detected faces

+ */ + ANDROID_STATISTICS_FACE_SCORES, + /** + * android.statistics.histogram [dynamic, int32[], system] + * + *

A 3-channel histogram based on the raw + * sensor data

+ */ + ANDROID_STATISTICS_HISTOGRAM, + /** + * android.statistics.sharpnessMap [dynamic, int32[], system] + * + *

A 3-channel sharpness map, based on the raw + * sensor data

+ */ + ANDROID_STATISTICS_SHARPNESS_MAP, + /** + * android.statistics.lensShadingCorrectionMap [dynamic, byte, java_public] + * + *

The shading map is a low-resolution floating-point map + * that lists the coefficients used to correct for vignetting, for each + * Bayer color channel.

+ */ + ANDROID_STATISTICS_LENS_SHADING_CORRECTION_MAP, + /** + * android.statistics.lensShadingMap [dynamic, float[], ndk_public] + * + *

The shading map is a low-resolution floating-point map + * that lists the coefficients used to correct for vignetting and color shading, + * for each Bayer color channel of RAW image data.

+ */ + ANDROID_STATISTICS_LENS_SHADING_MAP, + /** + * android.statistics.predictedColorGains [dynamic, float[], hidden] + * + *

The best-fit color channel gains calculated + * by the camera device's statistics units for the current output frame.

+ */ + ANDROID_STATISTICS_PREDICTED_COLOR_GAINS, + /** + * android.statistics.predictedColorTransform [dynamic, rational[], hidden] + * + *

The best-fit color transform matrix estimate + * calculated by the camera device's statistics units for the current + * output frame.

+ */ + ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM, + /** + * android.statistics.sceneFlicker [dynamic, enum, public] + * + *

The camera device estimated scene illumination lighting + * frequency.

+ */ + ANDROID_STATISTICS_SCENE_FLICKER, + /** + * android.statistics.hotPixelMap [dynamic, int32[], public] + * + *

List of (x, y) coordinates of hot/defective pixels on the sensor.

+ */ + ANDROID_STATISTICS_HOT_PIXEL_MAP, + /** + * android.statistics.lensShadingMapMode [dynamic, enum, public] + * + *

Whether the camera device will output the lens + * shading map in output result metadata.

+ */ + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, + /** + * android.statistics.oisDataMode [dynamic, enum, public] + * + *

A control for selecting whether optical stabilization (OIS) position + * information is included in output result metadata.

+ */ + ANDROID_STATISTICS_OIS_DATA_MODE, + /** + * android.statistics.oisTimestamps [dynamic, int64[], ndk_public] + * + *

An array of timestamps of OIS samples, in nanoseconds.

+ */ + ANDROID_STATISTICS_OIS_TIMESTAMPS, + /** + * android.statistics.oisXShifts [dynamic, float[], ndk_public] + * + *

An array of shifts of OIS samples, in x direction.

+ */ + ANDROID_STATISTICS_OIS_X_SHIFTS, + /** + * android.statistics.oisYShifts [dynamic, float[], ndk_public] + * + *

An array of shifts of OIS samples, in y direction.

+ */ + ANDROID_STATISTICS_OIS_Y_SHIFTS, + /** + * android.statistics.info.availableFaceDetectModes [static, byte[], public] + * + *

List of face detection modes for ANDROID_STATISTICS_FACE_DETECT_MODE that are + * supported by this camera device.

+ * + * @see ANDROID_STATISTICS_FACE_DETECT_MODE + */ + ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = CameraMetadataSectionStart.ANDROID_STATISTICS_INFO_START, + /** + * android.statistics.info.histogramBucketCount [static, int32, system] + * + *

Number of histogram buckets + * supported

+ */ + ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT, + /** + * android.statistics.info.maxFaceCount [static, int32, public] + * + *

The maximum number of simultaneously detectable + * faces.

+ */ + ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, + /** + * android.statistics.info.maxHistogramCount [static, int32, system] + * + *

Maximum value possible for a histogram + * bucket

+ */ + ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT, + /** + * android.statistics.info.maxSharpnessMapValue [static, int32, system] + * + *

Maximum value possible for a sharpness map + * region.

+ */ + ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE, + /** + * android.statistics.info.sharpnessMapSize [static, int32[], system] + * + *

Dimensions of the sharpness + * map

+ */ + ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE, + /** + * android.statistics.info.availableHotPixelMapModes [static, byte[], public] + * + *

List of hot pixel map output modes for ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE that are + * supported by this camera device.

+ * + * @see ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE + */ + ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES, + /** + * android.statistics.info.availableLensShadingMapModes [static, byte[], public] + * + *

List of lens shading map output modes for ANDROID_STATISTICS_LENS_SHADING_MAP_MODE that + * are supported by this camera device.

+ * + * @see ANDROID_STATISTICS_LENS_SHADING_MAP_MODE + */ + ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, + /** + * android.statistics.info.availableOisDataModes [static, byte[], public] + * + *

List of OIS data output modes for ANDROID_STATISTICS_OIS_DATA_MODE that + * are supported by this camera device.

+ * + * @see ANDROID_STATISTICS_OIS_DATA_MODE + */ + ANDROID_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES, + /** + * android.tonemap.curveBlue [dynamic, float[], ndk_public] + * + *

Tonemapping / contrast / gamma curve for the blue + * channel, to use when ANDROID_TONEMAP_MODE is + * CONTRAST_CURVE.

+ * + * @see ANDROID_TONEMAP_MODE + */ + ANDROID_TONEMAP_CURVE_BLUE = CameraMetadataSectionStart.ANDROID_TONEMAP_START, + /** + * android.tonemap.curveGreen [dynamic, float[], ndk_public] + * + *

Tonemapping / contrast / gamma curve for the green + * channel, to use when ANDROID_TONEMAP_MODE is + * CONTRAST_CURVE.

+ * + * @see ANDROID_TONEMAP_MODE + */ + ANDROID_TONEMAP_CURVE_GREEN, + /** + * android.tonemap.curveRed [dynamic, float[], ndk_public] + * + *

Tonemapping / contrast / gamma curve for the red + * channel, to use when ANDROID_TONEMAP_MODE is + * CONTRAST_CURVE.

+ * + * @see ANDROID_TONEMAP_MODE + */ + ANDROID_TONEMAP_CURVE_RED, + /** + * android.tonemap.mode [dynamic, enum, public] + * + *

High-level global contrast/gamma/tonemapping control.

+ */ + ANDROID_TONEMAP_MODE, + /** + * android.tonemap.maxCurvePoints [static, int32, public] + * + *

Maximum number of supported points in the + * tonemap curve that can be used for ANDROID_TONEMAP_CURVE.

+ * + * @see ANDROID_TONEMAP_CURVE + */ + ANDROID_TONEMAP_MAX_CURVE_POINTS, + /** + * android.tonemap.availableToneMapModes [static, byte[], public] + * + *

List of tonemapping modes for ANDROID_TONEMAP_MODE that are supported by this camera + * device.

+ * + * @see ANDROID_TONEMAP_MODE + */ + ANDROID_TONEMAP_AVAILABLE_TONE_MAP_MODES, + /** + * android.tonemap.gamma [dynamic, float, public] + * + *

Tonemapping curve to use when ANDROID_TONEMAP_MODE is + * GAMMA_VALUE

+ * + * @see ANDROID_TONEMAP_MODE + */ + ANDROID_TONEMAP_GAMMA, + /** + * android.tonemap.presetCurve [dynamic, enum, public] + * + *

Tonemapping curve to use when ANDROID_TONEMAP_MODE is + * PRESET_CURVE

+ * + * @see ANDROID_TONEMAP_MODE + */ + ANDROID_TONEMAP_PRESET_CURVE, + /** + * android.led.transmit [dynamic, enum, hidden] + * + *

This LED is nominally used to indicate to the user + * that the camera is powered on and may be streaming images back to the + * Application Processor. In certain rare circumstances, the OS may + * disable this when video is processed locally and not transmitted to + * any untrusted applications.

+ *

In particular, the LED must always be on when the data could be + * transmitted off the device. The LED should always be on whenever + * data is stored locally on the device.

+ *

The LED may be off if a trusted application is using the data that + * doesn't violate the above rules.

+ */ + ANDROID_LED_TRANSMIT = CameraMetadataSectionStart.ANDROID_LED_START, + /** + * android.led.availableLeds [static, enum[], hidden] + * + *

A list of camera LEDs that are available on this system.

+ */ + ANDROID_LED_AVAILABLE_LEDS, + /** + * android.info.supportedHardwareLevel [static, enum, public] + * + *

Generally classifies the overall set of the camera device functionality.

+ */ + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL = CameraMetadataSectionStart.ANDROID_INFO_START, + /** + * android.info.version [static, byte, public] + * + *

A short string for manufacturer version information about the camera device, such as + * ISP hardware, sensors, etc.

+ */ + ANDROID_INFO_VERSION, + /** + * android.info.supportedBufferManagementVersion [static, enum, system] + * + *

The version of buffer management API this camera device supports and opts into.

+ */ + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, + /** + * android.info.deviceStateOrientations [static, int64[], ndk_public] + */ + ANDROID_INFO_DEVICE_STATE_ORIENTATIONS, + /** + * android.blackLevel.lock [dynamic, enum, public] + * + *

Whether black-level compensation is locked + * to its current values, or is free to vary.

+ */ + ANDROID_BLACK_LEVEL_LOCK = CameraMetadataSectionStart.ANDROID_BLACK_LEVEL_START, + /** + * android.sync.frameNumber [dynamic, enum, ndk_public] + * + *

The frame number corresponding to the last request + * with which the output result (metadata + buffers) has been fully + * synchronized.

+ */ + ANDROID_SYNC_FRAME_NUMBER = CameraMetadataSectionStart.ANDROID_SYNC_START, + /** + * android.sync.maxLatency [static, enum, public] + * + *

The maximum number of frames that can occur after a request + * (different than the previous) has been submitted, and before the + * result's state becomes synchronized.

+ */ + ANDROID_SYNC_MAX_LATENCY, + /** + * android.reprocess.effectiveExposureFactor [dynamic, float, java_public] + * + *

The amount of exposure time increase factor applied to the original output + * frame by the application processing before sending for reprocessing.

+ */ + ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = CameraMetadataSectionStart.ANDROID_REPROCESS_START, + /** + * android.reprocess.maxCaptureStall [static, int32, java_public] + * + *

The maximal camera capture pipeline stall (in unit of frame count) introduced by a + * reprocess capture request.

+ */ + ANDROID_REPROCESS_MAX_CAPTURE_STALL, + /** + * android.depth.maxDepthSamples [static, int32, system] + * + *

Maximum number of points that a depth point cloud may contain.

+ */ + ANDROID_DEPTH_MAX_DEPTH_SAMPLES = CameraMetadataSectionStart.ANDROID_DEPTH_START, + /** + * android.depth.availableDepthStreamConfigurations [static, enum[], ndk_public] + * + *

The available depth dataspace stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, + /** + * android.depth.availableDepthMinFrameDurations [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for depth output formats.

+ */ + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS, + /** + * android.depth.availableDepthStallDurations [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for depth streams.

+ */ + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS, + /** + * android.depth.depthIsExclusive [static, enum, public] + * + *

Indicates whether a capture request may target both a + * DEPTH16 / DEPTH_POINT_CLOUD output, and normal color outputs (such as + * YUV_420_888, JPEG, or RAW) simultaneously.

+ */ + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE, + /** + * android.depth.availableRecommendedDepthStreamConfigurations [static, int32[], ndk_public] + * + *

Recommended depth stream configurations for common client use cases.

+ */ + ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS, + /** + * android.depth.availableDynamicDepthStreamConfigurations [static, enum[], ndk_public] + * + *

The available dynamic depth dataspace stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS, + /** + * android.depth.availableDynamicDepthMinFrameDurations [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for dynamic depth output streams.

+ */ + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS, + /** + * android.depth.availableDynamicDepthStallDurations [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for dynamic depth streams.

+ */ + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS, + /** + * android.depth.availableDepthStreamConfigurationsMaximumResolution [static, enum[], ndk_public] + * + *

The available depth dataspace stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream) when a CaptureRequest is submitted with + * ANDROID_SENSOR_PIXEL_MODE set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + /** + * android.depth.availableDepthMinFrameDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for depth output formats when a CaptureRequest is submitted with + * ANDROID_SENSOR_PIXEL_MODE set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.depth.availableDepthStallDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for depth streams for CaptureRequests where + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.depth.availableDynamicDepthStreamConfigurationsMaximumResolution [static, enum[], ndk_public] + * + *

The available dynamic depth dataspace stream + * configurations that this camera device supports (i.e. format, width, height, + * output/input stream) for CaptureRequests where ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + /** + * android.depth.availableDynamicDepthMinFrameDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for dynamic depth output streams for CaptureRequests where + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.depth.availableDynamicDepthStallDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for dynamic depth streams for CaptureRequests where + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.logicalMultiCamera.physicalIds [static, byte[], ndk_public] + * + *

String containing the ids of the underlying physical cameras.

+ */ + ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS = CameraMetadataSectionStart.ANDROID_LOGICAL_MULTI_CAMERA_START, + /** + * android.logicalMultiCamera.sensorSyncType [static, enum, public] + * + *

The accuracy of frame timestamp synchronization between physical cameras

+ */ + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE, + /** + * android.logicalMultiCamera.activePhysicalId [dynamic, byte, public] + * + *

String containing the ID of the underlying active physical camera.

+ */ + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID, + /** + * android.distortionCorrection.mode [dynamic, enum, public] + * + *

Mode of operation for the lens distortion correction block.

+ */ + ANDROID_DISTORTION_CORRECTION_MODE = CameraMetadataSectionStart.ANDROID_DISTORTION_CORRECTION_START, + /** + * android.distortionCorrection.availableModes [static, byte[], public] + * + *

List of distortion correction modes for ANDROID_DISTORTION_CORRECTION_MODE that are + * supported by this camera device.

+ * + * @see ANDROID_DISTORTION_CORRECTION_MODE + */ + ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES, + /** + * android.heic.availableHeicStreamConfigurations [static, enum[], ndk_public] + * + *

The available HEIC (ISO/IEC 23008-12) stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = CameraMetadataSectionStart.ANDROID_HEIC_START, + /** + * android.heic.availableHeicMinFrameDurations [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for HEIC output formats.

+ */ + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS, + /** + * android.heic.availableHeicStallDurations [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for HEIC streams.

+ */ + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS, + /** + * android.heic.availableHeicStreamConfigurationsMaximumResolution [static, enum[], ndk_public] + * + *

The available HEIC (ISO/IEC 23008-12) stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + /** + * android.heic.availableHeicMinFrameDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for HEIC output formats for CaptureRequests where + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.heic.availableHeicStallDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for HEIC streams for CaptureRequests where + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.heic.info.supported [static, enum, system] + * + *

Whether this camera device can support identical set of stream combinations + * involving HEIC image format, compared to the + * table of combinations + * involving JPEG image format required for the device's hardware level and capabilities.

+ */ + ANDROID_HEIC_INFO_SUPPORTED = CameraMetadataSectionStart.ANDROID_HEIC_INFO_START, + /** + * android.heic.info.maxJpegAppSegmentsCount [static, byte, system] + * + *

The maximum number of Jpeg APP segments supported by the camera HAL device.

+ */ + ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT, + /** + * android.automotive.location [static, enum, public] + * + *

Location of the cameras on the automotive devices.

+ */ + ANDROID_AUTOMOTIVE_LOCATION = CameraMetadataSectionStart.ANDROID_AUTOMOTIVE_START, + /** + * android.automotive.lens.facing [static, enum[], public] + * + *

The direction of the camera faces relative to the vehicle body frame and the + * passenger seats.

+ */ + ANDROID_AUTOMOTIVE_LENS_FACING = CameraMetadataSectionStart.ANDROID_AUTOMOTIVE_LENS_START, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..890ac0eac00acb6399a070948e1280bf8a9a4e87 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.colorCorrection.aberrationMode enumeration values + * @see ANDROID_COLOR_CORRECTION_ABERRATION_MODE + */ +@VintfStability +@Backing(type="int") +enum ColorCorrectionAberrationMode { + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_FAST, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ColorCorrectionMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ColorCorrectionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..080ca027f68fae1ce55de50bbfe3683f96450858 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ColorCorrectionMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.colorCorrection.mode enumeration values + * @see ANDROID_COLOR_CORRECTION_MODE + */ +@VintfStability +@Backing(type="int") +enum ColorCorrectionMode { + ANDROID_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX, + ANDROID_COLOR_CORRECTION_MODE_FAST, + ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8a2f501d8160ebb7137c200fd9d99bd7576739eb --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.aeAntibandingMode enumeration values + * @see ANDROID_CONTROL_AE_ANTIBANDING_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlAeAntibandingMode { + ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_50HZ, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_60HZ, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeLock.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ab56fdc5f2640cbfcc9e165db54a4439cf9bb48a --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeLock.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.aeLock enumeration values + * @see ANDROID_CONTROL_AE_LOCK + */ +@VintfStability +@Backing(type="int") +enum ControlAeLock { + ANDROID_CONTROL_AE_LOCK_OFF, + ANDROID_CONTROL_AE_LOCK_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeLockAvailable.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeLockAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b846fc182a10d14c1364a2dfff193a2fcf79ba56 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeLockAvailable.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.aeLockAvailable enumeration values + * @see ANDROID_CONTROL_AE_LOCK_AVAILABLE + */ +@VintfStability +@Backing(type="int") +enum ControlAeLockAvailable { + ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE, + ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e2f5553aee3ffb883a78acd0174930f8bfdb37b9 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeMode.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.aeMode enumeration values + * @see ANDROID_CONTROL_AE_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlAeMode { + ANDROID_CONTROL_AE_MODE_OFF, + ANDROID_CONTROL_AE_MODE_ON, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH, + ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE, + ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2229712d9a7056f162ed6284d92d93d22d9adfc1 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.aePrecaptureTrigger enumeration values + * @see ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER + */ +@VintfStability +@Backing(type="int") +enum ControlAePrecaptureTrigger { + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeState.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..af8c2cf38d10d0f5e3ff599fa9700b909b3e83c4 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAeState.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.aeState enumeration values + * @see ANDROID_CONTROL_AE_STATE + */ +@VintfStability +@Backing(type="int") +enum ControlAeState { + ANDROID_CONTROL_AE_STATE_INACTIVE, + ANDROID_CONTROL_AE_STATE_SEARCHING, + ANDROID_CONTROL_AE_STATE_CONVERGED, + ANDROID_CONTROL_AE_STATE_LOCKED, + ANDROID_CONTROL_AE_STATE_FLASH_REQUIRED, + ANDROID_CONTROL_AE_STATE_PRECAPTURE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..344f2de3f949bf14d80d250293cb373cf3cc5b76 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfMode.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.afMode enumeration values + * @see ANDROID_CONTROL_AF_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlAfMode { + ANDROID_CONTROL_AF_MODE_OFF, + ANDROID_CONTROL_AF_MODE_AUTO, + ANDROID_CONTROL_AF_MODE_MACRO, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE, + ANDROID_CONTROL_AF_MODE_EDOF, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfSceneChange.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfSceneChange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..153611a0284ea840d6c2ea4ce5701075ad13c5a1 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfSceneChange.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.afSceneChange enumeration values + * @see ANDROID_CONTROL_AF_SCENE_CHANGE + */ +@VintfStability +@Backing(type="int") +enum ControlAfSceneChange { + ANDROID_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED, + ANDROID_CONTROL_AF_SCENE_CHANGE_DETECTED, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfState.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c8d60201b7862ffa98d6e753510151fd38dc970 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfState.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.afState enumeration values + * @see ANDROID_CONTROL_AF_STATE + */ +@VintfStability +@Backing(type="int") +enum ControlAfState { + ANDROID_CONTROL_AF_STATE_INACTIVE, + ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN, + ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED, + ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN, + ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED, + ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED, + ANDROID_CONTROL_AF_STATE_PASSIVE_UNFOCUSED, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfTrigger.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfTrigger.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b68d4c7528652689674066f2cd570b631d297453 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAfTrigger.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.afTrigger enumeration values + * @see ANDROID_CONTROL_AF_TRIGGER + */ +@VintfStability +@Backing(type="int") +enum ControlAfTrigger { + ANDROID_CONTROL_AF_TRIGGER_IDLE, + ANDROID_CONTROL_AF_TRIGGER_START, + ANDROID_CONTROL_AF_TRIGGER_CANCEL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbLock.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbLock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f7229f2034a99c75d6678b3670c4e9bb640e0f63 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbLock.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.awbLock enumeration values + * @see ANDROID_CONTROL_AWB_LOCK + */ +@VintfStability +@Backing(type="int") +enum ControlAwbLock { + ANDROID_CONTROL_AWB_LOCK_OFF, + ANDROID_CONTROL_AWB_LOCK_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0cb6ebed7f52525c445f4782f25f4944866f2e4a --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.awbLockAvailable enumeration values + * @see ANDROID_CONTROL_AWB_LOCK_AVAILABLE + */ +@VintfStability +@Backing(type="int") +enum ControlAwbLockAvailable { + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2f9b801eec925c1f7e4b18de5e8a669a4fb95ddc --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.awbMode enumeration values + * @see ANDROID_CONTROL_AWB_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlAwbMode { + ANDROID_CONTROL_AWB_MODE_OFF, + ANDROID_CONTROL_AWB_MODE_AUTO, + ANDROID_CONTROL_AWB_MODE_INCANDESCENT, + ANDROID_CONTROL_AWB_MODE_FLUORESCENT, + ANDROID_CONTROL_AWB_MODE_WARM_FLUORESCENT, + ANDROID_CONTROL_AWB_MODE_DAYLIGHT, + ANDROID_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT, + ANDROID_CONTROL_AWB_MODE_TWILIGHT, + ANDROID_CONTROL_AWB_MODE_SHADE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbState.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1a93191487a46a9293b413451d7a941dacdde0e3 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAwbState.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.awbState enumeration values + * @see ANDROID_CONTROL_AWB_STATE + */ +@VintfStability +@Backing(type="int") +enum ControlAwbState { + ANDROID_CONTROL_AWB_STATE_INACTIVE, + ANDROID_CONTROL_AWB_STATE_SEARCHING, + ANDROID_CONTROL_AWB_STATE_CONVERGED, + ANDROID_CONTROL_AWB_STATE_LOCKED, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlCaptureIntent.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlCaptureIntent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..132d98c1d77cf6bd44b387adfa6201dab27ef986 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlCaptureIntent.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.captureIntent enumeration values + * @see ANDROID_CONTROL_CAPTURE_INTENT + */ +@VintfStability +@Backing(type="int") +enum ControlCaptureIntent { + ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM, + ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW, + ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT, + ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG, + ANDROID_CONTROL_CAPTURE_INTENT_MANUAL, + ANDROID_CONTROL_CAPTURE_INTENT_MOTION_TRACKING, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlEffectMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlEffectMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1668cb390bfd29e8845493a00ab77b96ae346b5c --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlEffectMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.effectMode enumeration values + * @see ANDROID_CONTROL_EFFECT_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlEffectMode { + ANDROID_CONTROL_EFFECT_MODE_OFF, + ANDROID_CONTROL_EFFECT_MODE_MONO, + ANDROID_CONTROL_EFFECT_MODE_NEGATIVE, + ANDROID_CONTROL_EFFECT_MODE_SOLARIZE, + ANDROID_CONTROL_EFFECT_MODE_SEPIA, + ANDROID_CONTROL_EFFECT_MODE_POSTERIZE, + ANDROID_CONTROL_EFFECT_MODE_WHITEBOARD, + ANDROID_CONTROL_EFFECT_MODE_BLACKBOARD, + ANDROID_CONTROL_EFFECT_MODE_AQUA, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlEnableZsl.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlEnableZsl.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a83c05164c03aaf6df3716d5c4e4e5bd8f10c5c0 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlEnableZsl.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.enableZsl enumeration values + * @see ANDROID_CONTROL_ENABLE_ZSL + */ +@VintfStability +@Backing(type="int") +enum ControlEnableZsl { + ANDROID_CONTROL_ENABLE_ZSL_FALSE, + ANDROID_CONTROL_ENABLE_ZSL_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2fe66cffd715c5211a1a444ba1da9c889775a052 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.extendedSceneMode enumeration values + * @see ANDROID_CONTROL_EXTENDED_SCENE_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlExtendedSceneMode { + ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_VENDOR_START = 0x40, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d9ab9ab10a03a4522924252db1aa02e7d91b936a --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlMode.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.mode enumeration values + * @see ANDROID_CONTROL_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlMode { + ANDROID_CONTROL_MODE_OFF, + ANDROID_CONTROL_MODE_AUTO, + ANDROID_CONTROL_MODE_USE_SCENE_MODE, + ANDROID_CONTROL_MODE_OFF_KEEP_STATE, + ANDROID_CONTROL_MODE_USE_EXTENDED_SCENE_MODE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlSceneMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlSceneMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0f90aaad2b6a62b38796761cf5adb10e8b327ae5 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlSceneMode.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.sceneMode enumeration values + * @see ANDROID_CONTROL_SCENE_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlSceneMode { + ANDROID_CONTROL_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY, + ANDROID_CONTROL_SCENE_MODE_ACTION, + ANDROID_CONTROL_SCENE_MODE_PORTRAIT, + ANDROID_CONTROL_SCENE_MODE_LANDSCAPE, + ANDROID_CONTROL_SCENE_MODE_NIGHT, + ANDROID_CONTROL_SCENE_MODE_NIGHT_PORTRAIT, + ANDROID_CONTROL_SCENE_MODE_THEATRE, + ANDROID_CONTROL_SCENE_MODE_BEACH, + ANDROID_CONTROL_SCENE_MODE_SNOW, + ANDROID_CONTROL_SCENE_MODE_SUNSET, + ANDROID_CONTROL_SCENE_MODE_STEADYPHOTO, + ANDROID_CONTROL_SCENE_MODE_FIREWORKS, + ANDROID_CONTROL_SCENE_MODE_SPORTS, + ANDROID_CONTROL_SCENE_MODE_PARTY, + ANDROID_CONTROL_SCENE_MODE_CANDLELIGHT, + ANDROID_CONTROL_SCENE_MODE_BARCODE, + ANDROID_CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO, + ANDROID_CONTROL_SCENE_MODE_HDR, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_START = 100, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_END = 127, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..497846c71f33c540d3de0087930405f40ca8f28b --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.videoStabilizationMode enumeration values + * @see ANDROID_CONTROL_VIDEO_STABILIZATION_MODE + */ +@VintfStability +@Backing(type="int") +enum ControlVideoStabilizationMode { + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/DemosaicMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/DemosaicMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7d8cdcf588985b0e75ab727178efa549f82a11c2 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/DemosaicMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.demosaic.mode enumeration values + * @see ANDROID_DEMOSAIC_MODE + */ +@VintfStability +@Backing(type="int") +enum DemosaicMode { + ANDROID_DEMOSAIC_MODE_FAST, + ANDROID_DEMOSAIC_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7deb35004553b84a08018d4a609d82b1d0cdbda8 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.depth.availableDepthStreamConfigurations enumeration values + * @see ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS + */ +@VintfStability +@Backing(type="int") +enum DepthAvailableDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5d06be178261e1354d339d2dc53ebd76badcd422 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.depth.availableDepthStreamConfigurationsMaximumResolution enumeration values + * @see ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION + */ +@VintfStability +@Backing(type="int") +enum DepthAvailableDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..39a99b963e5360247ed4bf1ada5aad0801ee7e74 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.depth.availableDynamicDepthStreamConfigurations enumeration values + * @see ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS + */ +@VintfStability +@Backing(type="int") +enum DepthAvailableDynamicDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..30ea9b71b57a2b87dcd6a89aaac649fa03b485e5 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.depth.availableDynamicDepthStreamConfigurationsMaximumResolution enumeration values + * @see ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION + */ +@VintfStability +@Backing(type="int") +enum DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4af81d9c89f701bd62c629ffe13d7cf0b8be7531 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.depth.depthIsExclusive enumeration values + * @see ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE + */ +@VintfStability +@Backing(type="int") +enum DepthDepthIsExclusive { + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/DistortionCorrectionMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/DistortionCorrectionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3456207757772bb7419d4939dceb4449af7050ab --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/DistortionCorrectionMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.distortionCorrection.mode enumeration values + * @see ANDROID_DISTORTION_CORRECTION_MODE + */ +@VintfStability +@Backing(type="int") +enum DistortionCorrectionMode { + ANDROID_DISTORTION_CORRECTION_MODE_OFF, + ANDROID_DISTORTION_CORRECTION_MODE_FAST, + ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/EdgeMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/EdgeMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1e155233a3e67eee19c2c500bb5e52e6bae59081 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/EdgeMode.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.edge.mode enumeration values + * @see ANDROID_EDGE_MODE + */ +@VintfStability +@Backing(type="int") +enum EdgeMode { + ANDROID_EDGE_MODE_OFF, + ANDROID_EDGE_MODE_FAST, + ANDROID_EDGE_MODE_HIGH_QUALITY, + ANDROID_EDGE_MODE_ZERO_SHUTTER_LAG, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/FlashInfoAvailable.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/FlashInfoAvailable.aidl new file mode 100644 index 0000000000000000000000000000000000000000..05280377c7f943eff523cafc942b2b42f03364d5 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/FlashInfoAvailable.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.flash.info.available enumeration values + * @see ANDROID_FLASH_INFO_AVAILABLE + */ +@VintfStability +@Backing(type="int") +enum FlashInfoAvailable { + ANDROID_FLASH_INFO_AVAILABLE_FALSE, + ANDROID_FLASH_INFO_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/FlashMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/FlashMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e17559699d0dd266bbcaf03171d8595db4096bdd --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/FlashMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.flash.mode enumeration values + * @see ANDROID_FLASH_MODE + */ +@VintfStability +@Backing(type="int") +enum FlashMode { + ANDROID_FLASH_MODE_OFF, + ANDROID_FLASH_MODE_SINGLE, + ANDROID_FLASH_MODE_TORCH, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/FlashState.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/FlashState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc398f8f06b4692787d4a2918888d9d061d23300 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/FlashState.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.flash.state enumeration values + * @see ANDROID_FLASH_STATE + */ +@VintfStability +@Backing(type="int") +enum FlashState { + ANDROID_FLASH_STATE_UNAVAILABLE, + ANDROID_FLASH_STATE_CHARGING, + ANDROID_FLASH_STATE_READY, + ANDROID_FLASH_STATE_FIRED, + ANDROID_FLASH_STATE_PARTIAL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fc9b6ecc4f029456dd8c0cad21dd03e08d275807 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.heic.availableHeicStreamConfigurations enumeration values + * @see ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS + */ +@VintfStability +@Backing(type="int") +enum HeicAvailableHeicStreamConfigurations { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..13b50ab5ad27196cb09c4f49c02d1f3544c3b445 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.heic.availableHeicStreamConfigurationsMaximumResolution enumeration values + * @see ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION + */ +@VintfStability +@Backing(type="int") +enum HeicAvailableHeicStreamConfigurationsMaximumResolution { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/HeicInfoSupported.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/HeicInfoSupported.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c4e04f1ac0cb0a368452600746b09ac421155ea0 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/HeicInfoSupported.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.heic.info.supported enumeration values + * @see ANDROID_HEIC_INFO_SUPPORTED + */ +@VintfStability +@Backing(type="int") +enum HeicInfoSupported { + ANDROID_HEIC_INFO_SUPPORTED_FALSE, + ANDROID_HEIC_INFO_SUPPORTED_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/HotPixelMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/HotPixelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7b7aa215a9db7d99dbe3a78d4c2c029c9c6658dc --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/HotPixelMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.hotPixel.mode enumeration values + * @see ANDROID_HOT_PIXEL_MODE + */ +@VintfStability +@Backing(type="int") +enum HotPixelMode { + ANDROID_HOT_PIXEL_MODE_OFF, + ANDROID_HOT_PIXEL_MODE_FAST, + ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9522377c6cda36662784c0ba9df12ca4f28abf9b --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.info.supportedBufferManagementVersion enumeration values + * @see ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION + */ +@VintfStability +@Backing(type="int") +enum InfoSupportedBufferManagementVersion { + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2420099431e02d03704680fc073f55551047dd5 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.info.supportedHardwareLevel enumeration values + * @see ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL + */ +@VintfStability +@Backing(type="int") +enum InfoSupportedHardwareLevel { + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LedAvailableLeds.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LedAvailableLeds.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f26fcde890d1056b958d225f0e28e090dd9dca1a --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LedAvailableLeds.aidl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.led.availableLeds enumeration values + * @see ANDROID_LED_AVAILABLE_LEDS + */ +@VintfStability +@Backing(type="int") +enum LedAvailableLeds { + ANDROID_LED_AVAILABLE_LEDS_TRANSMIT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LedTransmit.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LedTransmit.aidl new file mode 100644 index 0000000000000000000000000000000000000000..62c9bd787595afca467f90801f5f31270de0dc3b --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LedTransmit.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.led.transmit enumeration values + * @see ANDROID_LED_TRANSMIT + */ +@VintfStability +@Backing(type="int") +enum LedTransmit { + ANDROID_LED_TRANSMIT_OFF, + ANDROID_LED_TRANSMIT_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LensFacing.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LensFacing.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0677ea9372a620153d5393f06b5112436434f11a --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LensFacing.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.lens.facing enumeration values + * @see ANDROID_LENS_FACING + */ +@VintfStability +@Backing(type="int") +enum LensFacing { + ANDROID_LENS_FACING_FRONT, + ANDROID_LENS_FACING_BACK, + ANDROID_LENS_FACING_EXTERNAL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1c82bb03e4fc95122cc24079db8469e737e0646d --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.lens.info.focusDistanceCalibration enumeration values + * @see ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION + */ +@VintfStability +@Backing(type="int") +enum LensInfoFocusDistanceCalibration { + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e350e1599d4ea21ff4caa3ce85405ec109308fbc --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.lens.opticalStabilizationMode enumeration values + * @see ANDROID_LENS_OPTICAL_STABILIZATION_MODE + */ +@VintfStability +@Backing(type="int") +enum LensOpticalStabilizationMode { + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LensPoseReference.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LensPoseReference.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3e6034b0677edf87c3de74a808467744184af506 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LensPoseReference.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.lens.poseReference enumeration values + * @see ANDROID_LENS_POSE_REFERENCE + */ +@VintfStability +@Backing(type="int") +enum LensPoseReference { + ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA, + ANDROID_LENS_POSE_REFERENCE_GYROSCOPE, + ANDROID_LENS_POSE_REFERENCE_UNDEFINED, + ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LensState.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LensState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0e5a04c45cf5808c1d662e8d60798a59a40690ff --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LensState.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.lens.state enumeration values + * @see ANDROID_LENS_STATE + */ +@VintfStability +@Backing(type="int") +enum LensState { + ANDROID_LENS_STATE_STATIONARY, + ANDROID_LENS_STATE_MOVING, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..623a15cc0f0dbc6f3c4cf180740a19899901d2b6 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.logicalMultiCamera.sensorSyncType enumeration values + * @see ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE + */ +@VintfStability +@Backing(type="int") +enum LogicalMultiCameraSensorSyncType { + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/NoiseReductionMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/NoiseReductionMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..947361d41c8304f0c6ab08c629e87595498331b2 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/NoiseReductionMode.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.noiseReduction.mode enumeration values + * @see ANDROID_NOISE_REDUCTION_MODE + */ +@VintfStability +@Backing(type="int") +enum NoiseReductionMode { + ANDROID_NOISE_REDUCTION_MODE_OFF, + ANDROID_NOISE_REDUCTION_MODE_FAST, + ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY, + ANDROID_NOISE_REDUCTION_MODE_MINIMAL, + ANDROID_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/QuirksPartialResult.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/QuirksPartialResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..15a79b0969cc3943d24bc06cfb8c33a89a18a47e --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/QuirksPartialResult.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.quirks.partialResult enumeration values + * @see ANDROID_QUIRKS_PARTIAL_RESULT + */ +@VintfStability +@Backing(type="int") +enum QuirksPartialResult { + ANDROID_QUIRKS_PARTIAL_RESULT_FINAL, + ANDROID_QUIRKS_PARTIAL_RESULT_PARTIAL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f5c77eb28ca87d89c550b2ab988c6f42c89af278 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.request.availableCapabilities enumeration values + * @see ANDROID_REQUEST_AVAILABLE_CAPABILITIES + */ +@VintfStability +@Backing(type="int") +enum RequestAvailableCapabilities { + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f04fae3e43ba5c6877414e9cdf85fd17838c8214 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.request.availableDynamicRangeProfilesMap enumeration values + * @see ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP + */ +@VintfStability +@Backing(type="long") +enum RequestAvailableDynamicRangeProfilesMap { + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD = 0x1L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 = 0x2L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 = 0x4L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS = 0x8L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF = 0x10L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO = 0x20L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM = 0x40L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO = 0x80L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF = 0x100L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO = 0x200L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM = 0x400L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO = 0x800L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 0x1000L, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestMetadataMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestMetadataMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..37d40957e50cc659e5d9b36bb9b39eaa6f32becc --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestMetadataMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.request.metadataMode enumeration values + * @see ANDROID_REQUEST_METADATA_MODE + */ +@VintfStability +@Backing(type="int") +enum RequestMetadataMode { + ANDROID_REQUEST_METADATA_MODE_NONE, + ANDROID_REQUEST_METADATA_MODE_FULL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestType.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5010a37c9374a430e3c0c16114547db6525208cf --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestType.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.request.type enumeration values + * @see ANDROID_REQUEST_TYPE + */ +@VintfStability +@Backing(type="int") +enum RequestType { + ANDROID_REQUEST_TYPE_CAPTURE, + ANDROID_REQUEST_TYPE_REPROCESS, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableFormats.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableFormats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a8e67bbab951e085bb23c1e38b4b57c5b868ccc5 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableFormats.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.availableFormats enumeration values + * @see ANDROID_SCALER_AVAILABLE_FORMATS + */ +@VintfStability +@Backing(type="int") +enum ScalerAvailableFormats { + ANDROID_SCALER_AVAILABLE_FORMATS_RAW16 = 0x20, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW_OPAQUE = 0x24, + ANDROID_SCALER_AVAILABLE_FORMATS_YV12 = 0x32315659, + ANDROID_SCALER_AVAILABLE_FORMATS_YCrCb_420_SP = 0x11, + ANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED = 0x22, + ANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888 = 0x23, + ANDROID_SCALER_AVAILABLE_FORMATS_BLOB = 0x21, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW10 = 0x25, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW12 = 0x26, + ANDROID_SCALER_AVAILABLE_FORMATS_Y8 = 0x20203859, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57c398928a0ef5cb0e88b341258b188f917f428b --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.availableRecommendedStreamConfigurations enumeration values + * @see ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS + */ +@VintfStability +@Backing(type="int") +enum ScalerAvailableRecommendedStreamConfigurations { + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW = 0x0, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD = 0x1, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT = 0x2, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT = 0x3, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL = 0x4, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW = 0x5, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT = 0x6, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT = 0x8, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START = 0x18, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b493ae6eb7309b5b819a67da8d8132707259bd0 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.availableStreamConfigurations enumeration values + * @see ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS + */ +@VintfStability +@Backing(type="int") +enum ScalerAvailableStreamConfigurations { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f6cb5eedcfe51438a7df6b38e5d079a27f0f86f --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.availableStreamConfigurationsMaximumResolution enumeration values + * @see ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION + */ +@VintfStability +@Backing(type="int") +enum ScalerAvailableStreamConfigurationsMaximumResolution { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl new file mode 100644 index 0000000000000000000000000000000000000000..daa0fd3028978b67db889b286abcb2e23483ca67 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.availableStreamUseCases enumeration values + * @see ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES + */ +@VintfStability +@Backing(type="long") +enum ScalerAvailableStreamUseCases { + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT = 0x0L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW = 0x1L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE = 0x2L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 0x3L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 0x4L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 0x5L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 0x10000L, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerCroppingType.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerCroppingType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e44eff16e45583382c9148ea24efe3f11685f11c --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerCroppingType.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.croppingType enumeration values + * @see ANDROID_SCALER_CROPPING_TYPE + */ +@VintfStability +@Backing(type="int") +enum ScalerCroppingType { + ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY, + ANDROID_SCALER_CROPPING_TYPE_FREEFORM, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f7cbc0fe162ae77928b0ef2f12ad03b880239c92 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.multiResolutionStreamSupported enumeration values + * @see ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED + */ +@VintfStability +@Backing(type="int") +enum ScalerMultiResolutionStreamSupported { + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9427854a6311a3b87cd2315d8ae70be133f047d0 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.physicalCameraMultiResolutionStreamConfigurations enumeration values + * @see ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS + */ +@VintfStability +@Backing(type="int") +enum ScalerPhysicalCameraMultiResolutionStreamConfigurations { + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl new file mode 100644 index 0000000000000000000000000000000000000000..905015374c097d35dd6dc8d384a394dcf76e9311 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.scaler.rotateAndCrop enumeration values + * @see ANDROID_SCALER_ROTATE_AND_CROP + */ +@VintfStability +@Backing(type="int") +enum ScalerRotateAndCrop { + ANDROID_SCALER_ROTATE_AND_CROP_NONE, + ANDROID_SCALER_ROTATE_AND_CROP_90, + ANDROID_SCALER_ROTATE_AND_CROP_180, + ANDROID_SCALER_ROTATE_AND_CROP_270, + ANDROID_SCALER_ROTATE_AND_CROP_AUTO, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl new file mode 100644 index 0000000000000000000000000000000000000000..59a4038ea084ac8f5a0aaba4e6e513741e12023c --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sensor.info.colorFilterArrangement enumeration values + * @see ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT + */ +@VintfStability +@Backing(type="int") +enum SensorInfoColorFilterArrangement { + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8892ad33d144ff1ad21b2dc802b2f1027491423f --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sensor.info.lensShadingApplied enumeration values + * @see ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED + */ +@VintfStability +@Backing(type="int") +enum SensorInfoLensShadingApplied { + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2a5860b023b5f2c1e44f50e756bb8a932053556e --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sensor.info.timestampSource enumeration values + * @see ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE + */ +@VintfStability +@Backing(type="int") +enum SensorInfoTimestampSource { + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorPixelMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorPixelMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3dda07ba1eebac10e4fab2d94f47d13e444fa2ac --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorPixelMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sensor.pixelMode enumeration values + * @see ANDROID_SENSOR_PIXEL_MODE + */ +@VintfStability +@Backing(type="int") +enum SensorPixelMode { + ANDROID_SENSOR_PIXEL_MODE_DEFAULT, + ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl new file mode 100644 index 0000000000000000000000000000000000000000..20e92e4311f0adfa520eb6c4664f9b16b12b05a5 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sensor.rawBinningFactorUsed enumeration values + * @see ANDROID_SENSOR_RAW_BINNING_FACTOR_USED + */ +@VintfStability +@Backing(type="int") +enum SensorRawBinningFactorUsed { + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_TRUE, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_FALSE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c8c92167d5c8d443ed2c64da575a94baaad5b637 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sensor.referenceIlluminant1 enumeration values + * @see ANDROID_SENSOR_REFERENCE_ILLUMINANT1 + */ +@VintfStability +@Backing(type="int") +enum SensorReferenceIlluminant1 { + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT = 1, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT = 2, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN = 3, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLASH = 4, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER = 9, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER = 10, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_SHADE = 11, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT = 12, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT = 13, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT = 14, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT = 15, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A = 17, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B = 18, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C = 19, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D55 = 20, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D65 = 21, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D75 = 22, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D50 = 23, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN = 24, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SensorTestPatternMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SensorTestPatternMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..29aede4bbc3a2f4dfb621b4fc600e00700bd768b --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SensorTestPatternMode.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sensor.testPatternMode enumeration values + * @see ANDROID_SENSOR_TEST_PATTERN_MODE + */ +@VintfStability +@Backing(type="int") +enum SensorTestPatternMode { + ANDROID_SENSOR_TEST_PATTERN_MODE_OFF, + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY, + ANDROID_SENSOR_TEST_PATTERN_MODE_PN9, + ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK, + ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1 = 256, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ShadingMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ShadingMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6939b72fdca0e739afb207b60e37648c2ca160fe --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ShadingMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.shading.mode enumeration values + * @see ANDROID_SHADING_MODE + */ +@VintfStability +@Backing(type="int") +enum ShadingMode { + ANDROID_SHADING_MODE_OFF, + ANDROID_SHADING_MODE_FAST, + ANDROID_SHADING_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0d177919d69d9cf40c707103e54660c8fa31539b --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.statistics.faceDetectMode enumeration values + * @see ANDROID_STATISTICS_FACE_DETECT_MODE + */ +@VintfStability +@Backing(type="int") +enum StatisticsFaceDetectMode { + ANDROID_STATISTICS_FACE_DETECT_MODE_OFF, + ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE, + ANDROID_STATISTICS_FACE_DETECT_MODE_FULL, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsHistogramMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsHistogramMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a9b6f68dad16e47c869bf219844db9d702893e06 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsHistogramMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.statistics.histogramMode enumeration values + * @see ANDROID_STATISTICS_HISTOGRAM_MODE + */ +@VintfStability +@Backing(type="int") +enum StatisticsHistogramMode { + ANDROID_STATISTICS_HISTOGRAM_MODE_OFF, + ANDROID_STATISTICS_HISTOGRAM_MODE_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..286291a851fc13de4241382ebe5e98e825eb3270 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.statistics.hotPixelMapMode enumeration values + * @see ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE + */ +@VintfStability +@Backing(type="int") +enum StatisticsHotPixelMapMode { + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d21b2227f9d18774b225303a378f40e821cff25f --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.statistics.lensShadingMapMode enumeration values + * @see ANDROID_STATISTICS_LENS_SHADING_MAP_MODE + */ +@VintfStability +@Backing(type="int") +enum StatisticsLensShadingMapMode { + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsOisDataMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsOisDataMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..afb281f9097689a16b820f11ae57e55396b03be3 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsOisDataMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.statistics.oisDataMode enumeration values + * @see ANDROID_STATISTICS_OIS_DATA_MODE + */ +@VintfStability +@Backing(type="int") +enum StatisticsOisDataMode { + ANDROID_STATISTICS_OIS_DATA_MODE_OFF, + ANDROID_STATISTICS_OIS_DATA_MODE_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl new file mode 100644 index 0000000000000000000000000000000000000000..da2402af070895dfe1f29e158cf7e30f62eb7e27 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.statistics.sceneFlicker enumeration values + * @see ANDROID_STATISTICS_SCENE_FLICKER + */ +@VintfStability +@Backing(type="int") +enum StatisticsSceneFlicker { + ANDROID_STATISTICS_SCENE_FLICKER_NONE, + ANDROID_STATISTICS_SCENE_FLICKER_50HZ, + ANDROID_STATISTICS_SCENE_FLICKER_60HZ, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ed6c65ccb3251f5f0336ba5f226b785891ac04d3 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.statistics.sharpnessMapMode enumeration values + * @see ANDROID_STATISTICS_SHARPNESS_MAP_MODE + */ +@VintfStability +@Backing(type="int") +enum StatisticsSharpnessMapMode { + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_OFF, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_ON, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SyncFrameNumber.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SyncFrameNumber.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e33319e3d01140fffc7c47ba40f4907a1a07976c --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SyncFrameNumber.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sync.frameNumber enumeration values + * @see ANDROID_SYNC_FRAME_NUMBER + */ +@VintfStability +@Backing(type="int") +enum SyncFrameNumber { + ANDROID_SYNC_FRAME_NUMBER_CONVERGING = -1, + ANDROID_SYNC_FRAME_NUMBER_UNKNOWN = -2, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/SyncMaxLatency.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/SyncMaxLatency.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cb0668fcab5b7037f3f868006a0e4f7411049648 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/SyncMaxLatency.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.sync.maxLatency enumeration values + * @see ANDROID_SYNC_MAX_LATENCY + */ +@VintfStability +@Backing(type="int") +enum SyncMaxLatency { + ANDROID_SYNC_MAX_LATENCY_PER_FRAME_CONTROL = 0, + ANDROID_SYNC_MAX_LATENCY_UNKNOWN = -1, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/TonemapMode.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/TonemapMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d4b7e0ebce22871060f2387705694d52b75f1de1 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/TonemapMode.aidl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.tonemap.mode enumeration values + * @see ANDROID_TONEMAP_MODE + */ +@VintfStability +@Backing(type="int") +enum TonemapMode { + ANDROID_TONEMAP_MODE_CONTRAST_CURVE, + ANDROID_TONEMAP_MODE_FAST, + ANDROID_TONEMAP_MODE_HIGH_QUALITY, + ANDROID_TONEMAP_MODE_GAMMA_VALUE, + ANDROID_TONEMAP_MODE_PRESET_CURVE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/TonemapPresetCurve.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/TonemapPresetCurve.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2da37043488798a1a95c42ad787b8874bb8e4b6e --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/TonemapPresetCurve.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.tonemap.presetCurve enumeration values + * @see ANDROID_TONEMAP_PRESET_CURVE + */ +@VintfStability +@Backing(type="int") +enum TonemapPresetCurve { + ANDROID_TONEMAP_PRESET_CURVE_SRGB, + ANDROID_TONEMAP_PRESET_CURVE_REC709, +} diff --git a/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp index 64a51f61417f07317ff8f9f027e7cb1d0da7f8de..4fc743748a9eb8bb1275adb4a8fe8996cdd1920e 100644 --- a/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp +++ b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.cpp @@ -65,10 +65,10 @@ bool matchDeviceName(int cameraIdOffset, } // anonymous namespace -ExternalCameraProviderImpl_2_4::ExternalCameraProviderImpl_2_4() : - mCfg(ExternalCameraConfig::loadFromCfg()), - mHotPlugThread(this) { - mHotPlugThread.run("ExtCamHotPlug", PRIORITY_BACKGROUND); +ExternalCameraProviderImpl_2_4::ExternalCameraProviderImpl_2_4() + : mCfg(ExternalCameraConfig::loadFromCfg()) { + mHotPlugThread = sp::make(this); + mHotPlugThread->run("ExtCamHotPlug", PRIORITY_BACKGROUND); mPreferredHal3MinorVersion = property_get_int32("ro.vendor.camera.external.hal3TrebleMinorVersion", 4); @@ -88,7 +88,7 @@ ExternalCameraProviderImpl_2_4::ExternalCameraProviderImpl_2_4() : } ExternalCameraProviderImpl_2_4::~ExternalCameraProviderImpl_2_4() { - mHotPlugThread.requestExit(); + mHotPlugThread->requestExit(); } diff --git a/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.h b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.h index 8c79f68f100f38d5ba7c046944e5d8f126f10939..f1d8003bf919846d42cbe12641cd11ea886c1b1f 100644 --- a/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.h +++ b/camera/provider/2.4/default/ExternalCameraProviderImpl_2_4.h @@ -102,7 +102,7 @@ private: sp mCallbacks = nullptr; std::unordered_map mCameraStatusMap; // camera id -> status const ExternalCameraConfig mCfg; - HotplugThread mHotPlugThread; + sp mHotPlugThread; int mPreferredHal3MinorVersion; }; diff --git a/camera/provider/2.4/vts/OWNERS b/camera/provider/2.4/vts/OWNERS index b8f6b048d265f6f2d76041e05d1313b9049b0bc1..eb4f0e4b6cc19d1f5e84fa9b53f766da81bf78ee 100644 --- a/camera/provider/2.4/vts/OWNERS +++ b/camera/provider/2.4/vts/OWNERS @@ -1,3 +1,5 @@ +# Bug component: 41727 + # Camera team include platform/frameworks/av:/camera/OWNERS diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp index d2f61a54847098e1f9565a0caab8a4b2de8ce339..85e69eb866a5ac8440f239b3503501c3005e331b 100644 --- a/camera/provider/2.4/vts/functional/Android.bp +++ b/camera/provider/2.4/vts/functional/Android.bp @@ -56,10 +56,17 @@ cc_test { "android.hardware.camera.provider@2.6", "android.hardware.camera.provider@2.7", "android.hardware.graphics.common@1.0", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", "android.hidl.allocator@1.0", "libgrallocusage", "libhidlmemory", "libgralloctypes", ], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], + } diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 052103d78477c2923cd4642c00c931834b645e12..6866776ba5e91b9cfe794b056231687b4350dba3 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -95,6 +96,7 @@ using ::android::hardware::camera::common::V1_0::Status; using ::android::hardware::camera::common::V1_0::TorchMode; using ::android::hardware::camera::common::V1_0::TorchModeStatus; using ::android::hardware::camera::common::V1_0::helper::CameraParameters; +using ::android::hardware::camera::common::V1_0::helper::HandleImporter; using ::android::hardware::camera::common::V1_0::helper::Size; using ::android::hardware::camera::device::V1_0::CameraFacing; using ::android::hardware::camera::device::V1_0::CameraFrameMetadata; @@ -134,7 +136,6 @@ using ::android::hardware::graphics::common::V1_0::BufferUsage; using ::android::hardware::graphics::common::V1_0::Dataspace; using ::android::hardware::graphics::common::V1_0::PixelFormat; using ::android::hidl::allocator::V1_0::IAllocator; -using ::android::hidl::memory::V1_0::IMapper; using ::android::hidl::memory::V1_0::IMemory; using ResultMetadataQueue = MessageQueue; using ::android::hidl::manager::V1_0::IServiceManager; @@ -161,6 +162,27 @@ struct AvailableStream { int32_t format; }; +struct RecordingRateSizePair { + int32_t recordingRate; + int32_t width; + int32_t height; + + bool operator==(const RecordingRateSizePair &p) const{ + return p.recordingRate == recordingRate && + p.width == width && + p.height == height; + } +}; + +struct RecordingRateSizePairHasher { + size_t operator()(const RecordingRateSizePair& p) const { + std::size_t p1 = std::hash()(p.recordingRate); + std::size_t p2 = std::hash()(p.width); + std::size_t p3 = std::hash()(p.height); + return p1 ^ p2 ^ p3; + } +}; + struct AvailableZSLInputOutput { int32_t inputFormat; int32_t outputFormat; @@ -191,9 +213,18 @@ enum SystemCameraKind { HIDDEN_SECURE_CAMERA }; +const static std::vector kMandatoryUseCases = { + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL +}; + namespace { // "device@/legacy/" - const char *kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/%s/(.+)"; + const char* kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/%s/(.+)"; const int CAMERA_DEVICE_API_VERSION_3_7 = 0x307; const int CAMERA_DEVICE_API_VERSION_3_6 = 0x306; const int CAMERA_DEVICE_API_VERSION_3_5 = 0x305; @@ -201,18 +232,16 @@ namespace { const int CAMERA_DEVICE_API_VERSION_3_3 = 0x303; const int CAMERA_DEVICE_API_VERSION_3_2 = 0x302; const int CAMERA_DEVICE_API_VERSION_1_0 = 0x100; - const char *kHAL3_7 = "3.7"; - const char *kHAL3_6 = "3.6"; - const char *kHAL3_5 = "3.5"; - const char *kHAL3_4 = "3.4"; - const char *kHAL3_3 = "3.3"; - const char *kHAL3_2 = "3.2"; - const char *kHAL1_0 = "1.0"; - - bool matchDeviceName(const hidl_string& deviceName, - const hidl_string &providerType, - std::string* deviceVersion, - std::string* cameraId) { + const char* kHAL3_7 = "3.7"; + const char* kHAL3_6 = "3.6"; + const char* kHAL3_5 = "3.5"; + const char* kHAL3_4 = "3.4"; + const char* kHAL3_3 = "3.3"; + const char* kHAL3_2 = "3.2"; + const char* kHAL1_0 = "1.0"; + + bool matchDeviceName(const hidl_string& deviceName, const hidl_string& providerType, + std::string* deviceVersion, std::string* cameraId) { ::android::String8 pattern; pattern.appendFormat(kDeviceNameRE, providerType.c_str()); std::regex e(pattern.string()); @@ -608,7 +637,8 @@ public: } virtual Return processCaptureResult_3_4( - const hidl_vec& /*results*/) override { + + const hidl_vec& /*results*/) override { ALOGI("processCaptureResult_3_4 callback"); ADD_FAILURE(); // Empty callback should not reach here return Void(); @@ -639,40 +669,40 @@ public: }; struct DeviceCb : public V3_5::ICameraDeviceCallback { - DeviceCb(CameraHidlTest *parent, int deviceVersion, const camera_metadata_t *staticMeta) : - mParent(parent), mDeviceVersion(deviceVersion) { + DeviceCb(CameraHidlTest* parent, int deviceVersion, const camera_metadata_t* staticMeta) + : mParent(parent), mDeviceVersion(deviceVersion) { mStaticMetadata = staticMeta; } - Return processCaptureResult_3_4( - const hidl_vec& results) override; + Return processCaptureResult_3_4(const hidl_vec& results) override; Return processCaptureResult(const hidl_vec& results) override; Return notify(const hidl_vec& msgs) override; - Return requestStreamBuffers( - const hidl_vec& bufReqs, - requestStreamBuffers_cb _hidl_cb) override; + Return requestStreamBuffers(const hidl_vec& bufReqs, + requestStreamBuffers_cb _hidl_cb) override; Return returnStreamBuffers(const hidl_vec& buffers) override; void setCurrentStreamConfig(const hidl_vec& streams, - const hidl_vec& halStreams); + const hidl_vec& halStreams); void waitForBuffersReturned(); - private: + private: bool processCaptureResultLocked(const CaptureResult& results, - hidl_vec physicalCameraMetadata); + hidl_vec physicalCameraMetadata); + Return notifyHelper(const hidl_vec& msgs, + const std::vector>& readoutTimestamps); - CameraHidlTest *mParent; // Parent object + CameraHidlTest* mParent; // Parent object int mDeviceVersion; android::hardware::camera::common::V1_0::helper::CameraMetadata mStaticMetadata; bool hasOutstandingBuffersLocked(); /* members for requestStreamBuffers() and returnStreamBuffers()*/ - std::mutex mLock; // protecting members below - bool mUseHalBufManager = false; - hidl_vec mStreams; + std::mutex mLock; // protecting members below + bool mUseHalBufManager = false; + hidl_vec mStreams; hidl_vec mHalStreams; uint64_t mNextBufferId = 1; using OutstandingBuffers = std::unordered_map; @@ -767,12 +797,12 @@ public: sp* provider2_5 /*out*/, sp* provider2_6 /*out*/, sp* provider2_7 /*out*/); - void castSession(const sp &session, int32_t deviceVersion, - sp *session3_3 /*out*/, - sp *session3_4 /*out*/, - sp *session3_5 /*out*/, - sp *session3_6 /*out*/, - sp *session3_7 /*out*/); + void castSession(const sp& session, int32_t deviceVersion, + sp* session3_3 /*out*/, + sp* session3_4 /*out*/, + sp* session3_5 /*out*/, + sp* session3_6 /*out*/, + sp* session3_7 /*out*/); void castInjectionSession( const sp& session, sp* injectionSession3_7 /*out*/); @@ -853,6 +883,7 @@ public: void verifyCameraCharacteristics(Status status, const CameraMetadata& chars); void verifyExtendedSceneModeCharacteristics(const camera_metadata_t* metadata); void verifyZoomCharacteristics(const camera_metadata_t* metadata); + void verifyStreamUseCaseCharacteristics(const camera_metadata_t* metadata); void verifyRecommendedConfigs(const CameraMetadata& metadata); void verifyMonochromeCharacteristics(const CameraMetadata& chars, int deviceVersion); void verifyMonochromeCameraResult( @@ -898,11 +929,12 @@ public: static Status getMandatoryConcurrentStreams(const camera_metadata_t* staticMeta, std::vector* outputStreams); - + static bool supportsPreviewStabilization(const std::string& name, sp provider); static Status getJpegBufferSize(camera_metadata_t *staticMeta, uint32_t* outBufSize); static Status isConstrainedModeAvailable(camera_metadata_t *staticMeta); static Status isLogicalMultiCamera(const camera_metadata_t *staticMeta); + static bool isTorchStrengthControlSupported(const camera_metadata_t *staticMeta); static Status isOfflineSessionSupported(const camera_metadata_t *staticMeta); static Status getPhysicalCameraIds(const camera_metadata_t *staticMeta, std::unordered_set *physicalIds/*out*/); @@ -944,6 +976,9 @@ public: void processCaptureRequestInternal(uint64_t bufferusage, RequestTemplate reqTemplate, bool useSecureOnlyCameras); + void processPreviewStabilizationCaptureRequestInternal( + bool previewStabilizationOn, + /*inout*/ std::unordered_map& cameraDeviceToTimeLag); // Used by switchToOffline where a new result queue is created for offline reqs void updateInflightResultQueue(std::shared_ptr resultQueue); @@ -955,6 +990,9 @@ protected: // Set by notify() SHUTTER call. nsecs_t shutterTimestamp; + bool shutterReadoutTimestampValid; + nsecs_t shutterReadoutTimestamp; + bool errorCodeValid; ErrorCode errorCode; @@ -994,12 +1032,18 @@ protected: // Buffers are added by process_capture_result when output buffers // return from HAL but framework. - ::android::Vector resultOutputBuffers; + struct StreamBufferAndTimestamp { + StreamBuffer buffer; + nsecs_t timeStamp; + }; + ::android::Vector resultOutputBuffers; std::unordered_set expectedPhysicalResults; InFlightRequest() : shutterTimestamp(0), + shutterReadoutTimestampValid(false), + shutterReadoutTimestamp(0), errorCodeValid(false), errorCode(ErrorCode::ERROR_BUFFER), usePartialResult(false), @@ -1017,6 +1061,8 @@ protected: bool partialResults, uint32_t partialCount, std::shared_ptr queue = nullptr) : shutterTimestamp(0), + shutterReadoutTimestampValid(false), + shutterReadoutTimestamp(0), errorCodeValid(false), errorCode(ErrorCode::ERROR_BUFFER), usePartialResult(partialResults), @@ -1035,6 +1081,8 @@ protected: const std::unordered_set& extraPhysicalResult, std::shared_ptr queue = nullptr) : shutterTimestamp(0), + shutterReadoutTimestampValid(false), + shutterReadoutTimestamp(0), errorCodeValid(false), errorCode(ErrorCode::ERROR_BUFFER), usePartialResult(partialResults), @@ -1078,6 +1126,8 @@ protected: // Camera provider type. std::string mProviderType; + + HandleImporter mHandleImporter; }; Return CameraHidlTest::Camera1DeviceCb::notifyCallback( @@ -1403,8 +1453,25 @@ bool CameraHidlTest::DeviceCb::processCaptureResultLocked(const CaptureResult& r return notify; } - request->resultOutputBuffers.appendArray(results.outputBuffers.data(), - results.outputBuffers.size()); + for (const auto& buffer : results.outputBuffers) { + // wait for the fence timestamp and store it along with the buffer + // TODO: Check if we really need the dup here + sp releaseFence = nullptr; + if (buffer.releaseFence && (buffer.releaseFence->numFds == 1) && + buffer.releaseFence->data[0] >= 0) { + releaseFence = new android::Fence(dup(buffer.releaseFence->data[0])); + } + InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp; + streamBufferAndTimestamp.buffer = buffer; + streamBufferAndTimestamp.timeStamp = systemTime(); + if (releaseFence && releaseFence->isValid()) { + releaseFence->wait(/*ms*/ 300); + nsecs_t releaseTime = releaseFence->getSignalTime(); + if (streamBufferAndTimestamp.timeStamp < releaseTime) + streamBufferAndTimestamp.timeStamp = releaseTime; + } + request->resultOutputBuffers.push_back(streamBufferAndTimestamp); + } // If shutter event is received notify the pending threads. if (request->shutterTimestamp != 0) { notify = true; @@ -1463,6 +1530,18 @@ void CameraHidlTest::DeviceCb::waitForBuffersReturned() { Return CameraHidlTest::DeviceCb::notify( const hidl_vec& messages) { + std::vector> readoutTimestamps; + readoutTimestamps.resize(messages.size()); + for (size_t i = 0; i < messages.size(); i++) { + readoutTimestamps[i] = {false, 0}; + } + + return notifyHelper(messages, readoutTimestamps); +} + +Return CameraHidlTest::DeviceCb::notifyHelper( + const hidl_vec& messages, + const std::vector>& readoutTimestamps) { std::lock_guard l(mParent->mLock); for (size_t i = 0; i < messages.size(); i++) { @@ -1525,6 +1604,8 @@ Return CameraHidlTest::DeviceCb::notify( } InFlightRequest *r = mParent->mInflightMap.editValueAt(idx); r->shutterTimestamp = messages[i].msg.shutter.timestamp; + r->shutterReadoutTimestampValid = readoutTimestamps[i].first; + r->shutterReadoutTimestamp = readoutTimestamps[i].second; } break; default: @@ -3120,9 +3201,9 @@ TEST_P(CameraHidlTest, openClose) { sp sessionV3_5; sp sessionV3_6; sp sessionV3_7; - castSession(session, deviceVersion, &sessionV3_3, - &sessionV3_4, &sessionV3_5, &sessionV3_6, - &sessionV3_7); + castSession(session, deviceVersion, &sessionV3_3, &sessionV3_4, &sessionV3_5, + &sessionV3_6, &sessionV3_7); + if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_7) { ASSERT_TRUE(sessionV3_7.get() != nullptr); } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_6) { @@ -3133,7 +3214,7 @@ TEST_P(CameraHidlTest, openClose) { ASSERT_TRUE(sessionV3_4.get() != nullptr); } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_3) { ASSERT_TRUE(sessionV3_3.get() != nullptr); - } else { //V3_2 + } else { // V3_2 ASSERT_TRUE(sessionV3_3.get() == nullptr); ASSERT_TRUE(sessionV3_4.get() == nullptr); ASSERT_TRUE(sessionV3_5.get() == nullptr); @@ -3295,8 +3376,8 @@ TEST_P(CameraHidlTest, configureStreamsAvailableOutputs) { sp cameraDevice3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7); outputStreams.clear(); @@ -3567,8 +3648,8 @@ TEST_P(CameraHidlTest, configureStreamsInvalidOutputs) { sp cameraDevice3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7); outputStreams.clear(); @@ -3780,8 +3861,8 @@ TEST_P(CameraHidlTest, configureStreamsZSLInputOutputs) { sp cameraDevice3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7); Status rc = isZSLModeAvailable(staticMeta); @@ -3962,8 +4043,8 @@ TEST_P(CameraHidlTest, configureStreamsWithSessionParameters) { sp session3_6; sp session3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMetaBuffer /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) { ASSERT_NE(session3_4, nullptr); } else { @@ -4107,8 +4188,8 @@ TEST_P(CameraHidlTest, configureStreamsPreviewStillOutputs) { sp cameraDevice3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7); // Check if camera support depth only @@ -4241,8 +4322,8 @@ TEST_P(CameraHidlTest, configureStreamsConstrainedOutputs) { sp cameraDevice3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7); Status rc = isConstrainedModeAvailable(staticMeta); @@ -4257,6 +4338,39 @@ TEST_P(CameraHidlTest, configureStreamsConstrainedOutputs) { rc = pickConstrainedModeSize(staticMeta, hfrStream); ASSERT_EQ(Status::OK, rc); + // Check that HAL does not advertise multiple preview rates + // for the same recording rate and size. + camera_metadata_ro_entry entry; + + std::unordered_map fpsRangeMap; + + auto retCode = find_camera_metadata_ro_entry(staticMeta, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, &entry); + ASSERT_EQ(retCode, 0); + ASSERT_GT(entry.count, 0); + + for (size_t i = 0; i < entry.count; i+=5) { + RecordingRateSizePair recordingRateSizePair; + recordingRateSizePair.width = entry.data.i32[i]; + recordingRateSizePair.height = entry.data.i32[i+1]; + + int32_t previewFps = entry.data.i32[i+2]; + int32_t recordingFps = entry.data.i32[i+3]; + recordingRateSizePair.recordingRate = recordingFps; + + if (recordingFps != previewFps) { + auto it = fpsRangeMap.find(recordingRateSizePair); + if (it == fpsRangeMap.end()) { + fpsRangeMap.insert(std::make_pair(recordingRateSizePair,previewFps)); + ALOGV("Added RecordingRateSizePair:%d , %d, %d PreviewRate: %d", + recordingFps, recordingRateSizePair.width, recordingRateSizePair.height, + previewFps); + } else { + ASSERT_EQ(previewFps, it->second); + } + } + } + int32_t streamId = 0; uint32_t streamConfigCounter = 0; V3_2::Stream stream = {streamId, @@ -4488,8 +4602,8 @@ TEST_P(CameraHidlTest, configureStreamsVideoStillOutputs) { sp cameraDevice3_7; openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/); - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7); // Check if camera support depth only @@ -4727,7 +4841,7 @@ void CameraHidlTest::processCaptureRequestInternal(uint64_t bufferUsage, ASSERT_FALSE(inflightReq.errorCodeValid); ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u); - ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].streamId); + ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId); request.frameNumber++; // Empty settings should be supported after the first call @@ -4765,7 +4879,7 @@ void CameraHidlTest::processCaptureRequestInternal(uint64_t bufferUsage, ASSERT_FALSE(inflightReq.errorCodeValid); ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u); - ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].streamId); + ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId); } if (useHalBufManager) { @@ -5234,8 +5348,8 @@ TEST_P(CameraHidlTest, processCaptureRequestBurstISO) { camera_metadata_entry_t hwLevel = staticMeta.find(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL); ASSERT_TRUE(0 < hwLevel.count); if (ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED == hwLevel.data.u8[0] || - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL == hwLevel.data.u8[0]) { - //Limited/External devices can skip this test + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL == hwLevel.data.u8[0]) { + // Limited/External devices can skip this test ret = session->close(); ASSERT_TRUE(ret.isOk()); continue; @@ -5346,7 +5460,7 @@ TEST_P(CameraHidlTest, processCaptureRequestBurstISO) { ASSERT_FALSE(inflightReqs[i].errorCodeValid); ASSERT_NE(inflightReqs[i].resultOutputBuffers.size(), 0u); - ASSERT_EQ(previewStream.id, inflightReqs[i].resultOutputBuffers[0].streamId); + ASSERT_EQ(previewStream.id, inflightReqs[i].resultOutputBuffers[0].buffer.streamId); ASSERT_FALSE(inflightReqs[i].collectedResult.isEmpty()); ASSERT_TRUE(inflightReqs[i].collectedResult.exists(ANDROID_SENSOR_SENSITIVITY)); camera_metadata_entry_t isoResult = inflightReqs[i].collectedResult.find( @@ -5630,7 +5744,7 @@ TEST_P(CameraHidlTest, switchToOffline) { ASSERT_FALSE(inflightReqs[i].errorCodeValid); ASSERT_NE(inflightReqs[i].resultOutputBuffers.size(), 0u); - ASSERT_EQ(stream.id, inflightReqs[i].resultOutputBuffers[0].streamId); + ASSERT_EQ(stream.id, inflightReqs[i].resultOutputBuffers[0].buffer.streamId); ASSERT_FALSE(inflightReqs[i].collectedResult.isEmpty()); } @@ -5826,7 +5940,7 @@ TEST_P(CameraHidlTest, flushPreviewRequest) { if (!inflightReq.errorCodeValid) { ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u); - ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId); + ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId); } else { switch (inflightReq.errorCode) { case ErrorCode::ERROR_REQUEST: @@ -6376,6 +6490,22 @@ Status CameraHidlTest::isLogicalMultiCamera(const camera_metadata_t *staticMeta) return ret; } +bool CameraHidlTest::isTorchStrengthControlSupported(const camera_metadata_t *staticMetadata) { + int32_t maxLevel = 0; + camera_metadata_ro_entry maxEntry; + int rc = find_camera_metadata_ro_entry(staticMetadata, + ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, &maxEntry); + if (rc != 0) { + return false; + } + maxLevel = *maxEntry.data.i32; + if (maxLevel > 1) { + ALOGI("Torch strength control supported."); + return true; + } + return false; +} + // Check if the camera device has logical multi-camera capability. Status CameraHidlTest::isOfflineSessionSupported(const camera_metadata_t *staticMeta) { Status ret = Status::METHOD_NOT_SUPPORTED; @@ -7000,8 +7130,8 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t sp session3_3; sp session3_6; sp session3_7; - castSession(session, deviceVersion, &session3_3, session3_4, session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, session3_4, session3_5, &session3_6, + &session3_7); ASSERT_NE(nullptr, (*session3_4).get()); *useHalBufManager = false; @@ -7295,6 +7425,47 @@ void CameraHidlTest::configurePreviewStream(const std::string &name, int32_t dev previewStream, halStreamConfig, supportsPartialResults, partialResultCount, useHalBufManager, outCb, streamConfigCounter); } + +bool CameraHidlTest::supportsPreviewStabilization(const std::string& name, + sp provider) { + Return ret; + sp device3_x = nullptr; + ret = provider->getCameraDeviceInterface_V3_x(name, [&](auto status, const auto& device) { + ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status); + ASSERT_EQ(Status::OK, status); + ASSERT_NE(device, nullptr); + device3_x = device; + }); + if (!(ret.isOk())) { + ADD_FAILURE() << "Failed to get camera device interface for " << name; + } + + camera_metadata_t* staticMeta = nullptr; + ret = device3_x->getCameraCharacteristics([&](Status s, CameraMetadata metadata) { + ASSERT_EQ(Status::OK, s); + staticMeta = + clone_camera_metadata(reinterpret_cast(metadata.data())); + }); + if (!(ret.isOk())) { + ADD_FAILURE() << "Failed to get camera characteristics for " << name; + } + // Go through the characteristics and see if video stabilization modes have + // preview stabilization + camera_metadata_ro_entry entry; + + int retcode = find_camera_metadata_ro_entry( + staticMeta, ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, &entry); + if ((0 == retcode) && (entry.count > 0)) { + for (auto i = 0; i < entry.count; i++) { + if (entry.data.u8[i] == + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION) { + return true; + } + } + } + return false; +} + // Open a device session and configure a preview stream. void CameraHidlTest::configureSingleStream( const std::string& name, int32_t deviceVersion, sp provider, @@ -7361,8 +7532,8 @@ void CameraHidlTest::configureSingleStream( sp session3_5; sp session3_6; sp session3_7; - castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); *useHalBufManager = false; status = find_camera_metadata_ro_entry(staticMeta, @@ -7541,12 +7712,12 @@ void CameraHidlTest::castProvider(const sp& provider, } //Cast camera device session to corresponding version -void CameraHidlTest::castSession(const sp &session, int32_t deviceVersion, - sp *session3_3 /*out*/, - sp *session3_4 /*out*/, - sp *session3_5 /*out*/, - sp *session3_6 /*out*/, - sp *session3_7 /*out*/) { +void CameraHidlTest::castSession(const sp& session, int32_t deviceVersion, + sp* session3_3 /*out*/, + sp* session3_4 /*out*/, + sp* session3_5 /*out*/, + sp* session3_6 /*out*/, + sp* session3_7 /*out*/) { ASSERT_NE(nullptr, session3_3); ASSERT_NE(nullptr, session3_4); ASSERT_NE(nullptr, session3_5); @@ -8047,6 +8218,7 @@ void CameraHidlTest::verifyCameraCharacteristics(Status status, const CameraMeta verifyExtendedSceneModeCharacteristics(metadata); verifyZoomCharacteristics(metadata); + verifyStreamUseCaseCharacteristics(metadata); } void CameraHidlTest::verifyExtendedSceneModeCharacteristics(const camera_metadata_t* metadata) { @@ -8277,6 +8449,46 @@ void CameraHidlTest::verifyZoomCharacteristics(const camera_metadata_t* metadata } } +void CameraHidlTest::verifyStreamUseCaseCharacteristics(const camera_metadata_t* metadata) { + camera_metadata_ro_entry entry; + // Check capabilities + int retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES, &entry); + bool hasStreamUseCaseCap = false; + if ((0 == retcode) && (entry.count > 0)) { + if (std::find(entry.data.u8, entry.data.u8 + entry.count, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE) != + entry.data.u8 + entry.count) { + hasStreamUseCaseCap = true; + } + } + + bool supportMandatoryUseCases = false; + retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES, &entry); + if ((0 == retcode) && (entry.count > 0)) { + supportMandatoryUseCases = true; + for (size_t i = 0; i < kMandatoryUseCases.size(); i++) { + if (std::find(entry.data.i64, entry.data.i64 + entry.count, kMandatoryUseCases[i]) + == entry.data.i64 + entry.count) { + supportMandatoryUseCases = false; + break; + } + } + bool supportDefaultUseCase = false; + for (size_t i = 0; i < entry.count; i++) { + if (entry.data.i64[i] == ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT) { + supportDefaultUseCase = true; + } + ASSERT_TRUE(entry.data.i64[i] <= ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL || + entry.data.i64[i] >= ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START); + } + ASSERT_TRUE(supportDefaultUseCase); + } + + ASSERT_EQ(hasStreamUseCaseCap, supportMandatoryUseCases); +} + void CameraHidlTest::verifyMonochromeCharacteristics(const CameraMetadata& chars, int deviceVersion) { const camera_metadata_t* metadata = (camera_metadata_t*)chars.data(); @@ -8430,8 +8642,8 @@ void CameraHidlTest::verifyBuffersReturned( sp session3_5; sp session3_6; sp session3_7; - castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, - &session3_6, &session3_7); + castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6, + &session3_7); ASSERT_NE(nullptr, session3_5.get()); hidl_vec streamIds(1); diff --git a/camera/provider/2.7/default/Android.bp b/camera/provider/2.7/default/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..bd5da2dbfaf252aaaca01aac9bea0ca99f6fbf89 --- /dev/null +++ b/camera/provider/2.7/default/Android.bp @@ -0,0 +1,111 @@ +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_library_shared { + name: "android.hardware.camera.provider@2.7-external", + proprietary: true, + srcs: ["ExternalCameraProviderImpl_2_7.cpp"], + shared_libs: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.device@3.6", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.5", + "android.hardware.camera.provider@2.6", + "android.hardware.camera.provider@2.7", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "camera.device@3.3-impl", + "camera.device@3.4-external-impl", + "camera.device@3.4-impl", + "camera.device@3.5-external-impl", + "camera.device@3.5-impl", + "camera.device@3.6-external-impl", + "libcamera_metadata", + "libcutils", + "libhardware", + "libhidlbase", + "liblog", + "libtinyxml2", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], + header_libs: [ + "camera.device@3.4-external-impl_headers", + "camera.device@3.5-external-impl_headers", + "camera.device@3.6-external-impl_headers", + ], + export_include_dirs: ["."], +} + +cc_defaults { + name: "camera_external_service_2_7_defaults", + defaults: ["hidl_defaults"], + proprietary: true, + relative_install_path: "hw", + srcs: ["external-service.cpp"], + compile_multilib: "32", + shared_libs: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.4-external", + "android.hardware.camera.provider@2.5", + "android.hardware.camera.provider@2.5-external", + "android.hardware.camera.provider@2.6", + "android.hardware.camera.provider@2.7", + "android.hardware.camera.provider@2.7-external", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + "libbinder", + "libcamera_metadata", + "libhidlbase", + "liblog", + "libtinyxml2", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], + header_libs: [ + "camera.device@3.4-external-impl_headers", + "camera.device@3.4-impl_headers", + "camera.device@3.5-external-impl_headers", + "camera.device@3.5-impl_headers", + "camera.device@3.6-external-impl_headers", + ], +} + +cc_binary { + name: "android.hardware.camera.provider@2.7-external-service", + defaults: ["camera_external_service_2_7_defaults"], + init_rc: ["android.hardware.camera.provider@2.7-external-service.rc"], +} + +cc_binary { + name: "android.hardware.camera.provider@2.7-external-service-lazy", + overrides: ["android.hardware.camera.provider@2.7-external-service"], + defaults: ["camera_external_service_2_7_defaults"], + init_rc: ["android.hardware.camera.provider@2.7-external-service-lazy.rc"], + cflags: ["-DLAZY_SERVICE"], +} diff --git a/camera/provider/2.7/default/CameraProvider_2_7.h b/camera/provider/2.7/default/CameraProvider_2_7.h new file mode 100644 index 0000000000000000000000000000000000000000..c34905f3f3a9550a6e44b05753bb561bbcb468a1 --- /dev/null +++ b/camera/provider/2.7/default/CameraProvider_2_7.h @@ -0,0 +1,122 @@ +/* + * 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. + */ + +#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_7_CAMERAPROVIDER_H +#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_7_CAMERAPROVIDER_H + +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_7 { +namespace implementation { + +using ::android::sp; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::hardware::camera::common::V1_0::CameraDeviceStatus; +using ::android::hardware::camera::common::V1_0::Status; +using ::android::hardware::camera::common::V1_0::TorchModeStatus; +using ::android::hardware::camera::common::V1_0::VendorTag; +using ::android::hardware::camera::common::V1_0::VendorTagSection; +using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback; +using ::android::hardware::camera::provider::V2_5::DeviceState; +using ::android::hardware::camera::provider::V2_7::CameraIdAndStreamCombination; +using ::android::hardware::camera::provider::V2_7::ICameraProvider; +using ::android::hidl::base::V1_0::IBase; + +// Default recommended RPC thread count for camera provider implementations +const int HWBINDER_THREAD_COUNT = 6; + +template +struct CameraProvider : public ICameraProvider { + CameraProvider() : impl() {} + ~CameraProvider() {} + + // Caller must use this method to check if CameraProvider ctor failed + bool isInitFailed() { return impl.isInitFailed(); } + + // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow. + Return setCallback(const sp& callback) override { + return impl.setCallback(callback); + } + + Return getVendorTags(getVendorTags_cb _hidl_cb) override { + return impl.getVendorTags(_hidl_cb); + } + + Return getCameraIdList(getCameraIdList_cb _hidl_cb) override { + return impl.getCameraIdList(_hidl_cb); + } + + Return isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override { + return impl.isSetTorchModeSupported(_hidl_cb); + } + + Return getCameraDeviceInterface_V1_x(const hidl_string& cameraDeviceName, + getCameraDeviceInterface_V1_x_cb _hidl_cb) override { + return impl.getCameraDeviceInterface_V1_x(cameraDeviceName, _hidl_cb); + } + + Return getCameraDeviceInterface_V3_x(const hidl_string& cameraDeviceName, + getCameraDeviceInterface_V3_x_cb _hidl_cb) override { + return impl.getCameraDeviceInterface_V3_x(cameraDeviceName, _hidl_cb); + } + + // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow. + Return notifyDeviceStateChange(hardware::hidl_bitfield newState) override { + return impl.notifyDeviceStateChange(newState); + } + + // Methods from ::android::hardware::camera::provider::V2_7::ICameraProvider follow. + Return getConcurrentStreamingCameraIds( + getConcurrentStreamingCameraIds_cb _hidl_cb) override { + return impl.getConcurrentStreamingCameraIds(_hidl_cb); + } + + Return isConcurrentStreamCombinationSupported( + const hidl_vec< + ::android::hardware::camera::provider::V2_6::CameraIdAndStreamCombination>& + configs, + isConcurrentStreamCombinationSupported_cb _hidl_cb) override { + return impl.isConcurrentStreamCombinationSupported(configs, _hidl_cb); + } + + Return isConcurrentStreamCombinationSupported_2_7( + const hidl_vec& configs, + isConcurrentStreamCombinationSupported_2_7_cb _hidl_cb) override { + return impl.isConcurrentStreamCombinationSupported_2_7(configs, _hidl_cb); + } + + private: + IMPL impl; +}; + +} // namespace implementation +} // namespace V2_7 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H \ No newline at end of file diff --git a/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.cpp b/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b63e3bb88b6c9da2df61ec0ded32cb31ce2bbada --- /dev/null +++ b/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.cpp @@ -0,0 +1,393 @@ +/* + * 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_TAG "CamPrvdr@2.7-external" +//#define LOG_NDEBUG 0 +#include + +#include +#include +#include +#include +#include +#include "ExternalCameraDevice_3_4.h" +#include "ExternalCameraDevice_3_5.h" +#include "ExternalCameraDevice_3_6.h" +#include "ExternalCameraProviderImpl_2_7.h" + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_7 { +namespace implementation { + +namespace { +// "device@/external/" +const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/external/(.+)"); +const int kMaxDevicePathLen = 256; +const char* kDevicePath = "/dev/"; +constexpr char kPrefix[] = "video"; +constexpr int kPrefixLen = sizeof(kPrefix) - 1; +constexpr int kDevicePrefixLen = sizeof(kDevicePath) + kPrefixLen + 1; + +bool matchDeviceName(int cameraIdOffset, const hidl_string& deviceName, std::string* deviceVersion, + std::string* cameraDevicePath) { + std::string deviceNameStd(deviceName.c_str()); + std::smatch sm; + if (std::regex_match(deviceNameStd, sm, kDeviceNameRE)) { + if (deviceVersion != nullptr) { + *deviceVersion = sm[1]; + } + if (cameraDevicePath != nullptr) { + *cameraDevicePath = "/dev/video" + std::to_string(std::stoi(sm[2]) - cameraIdOffset); + } + return true; + } + return false; +} + +} // anonymous namespace + +ExternalCameraProviderImpl_2_7::ExternalCameraProviderImpl_2_7() + : mCfg(ExternalCameraConfig::loadFromCfg()) { + mHotPlugThread = sp::make(this); + mHotPlugThread->run("ExtCamHotPlug", PRIORITY_BACKGROUND); + + mPreferredHal3MinorVersion = + property_get_int32("ro.vendor.camera.external.hal3TrebleMinorVersion", 4); + ALOGV("Preferred HAL 3 minor version is %d", mPreferredHal3MinorVersion); + switch (mPreferredHal3MinorVersion) { + case 4: + case 5: + case 6: + // OK + break; + default: + ALOGW("Unknown minor camera device HAL version %d in property " + "'camera.external.hal3TrebleMinorVersion', defaulting to 4", + mPreferredHal3MinorVersion); + mPreferredHal3MinorVersion = 4; + } +} + +ExternalCameraProviderImpl_2_7::~ExternalCameraProviderImpl_2_7() { + mHotPlugThread->requestExit(); +} + +Return ExternalCameraProviderImpl_2_7::setCallback( + const sp& callback) { + Mutex::Autolock _l(mLock); + mCallbacks = callback; + if (mCallbacks == nullptr) { + return Status::OK; + } + // Send a callback for all devices to initialize + { + for (const auto& pair : mCameraStatusMap) { + mCallbacks->cameraDeviceStatusChange(pair.first, pair.second); + } + } + + return Status::OK; +} + +Return ExternalCameraProviderImpl_2_7::getVendorTags( + ICameraProvider::getVendorTags_cb _hidl_cb) { + // No vendor tag support for USB camera + hidl_vec zeroSections; + _hidl_cb(Status::OK, zeroSections); + return Void(); +} + +Return ExternalCameraProviderImpl_2_7::getCameraIdList( + ICameraProvider::getCameraIdList_cb _hidl_cb) { + // External camera HAL always report 0 camera, and extra cameras + // are just reported via cameraDeviceStatusChange callbacks + hidl_vec hidlDeviceNameList; + _hidl_cb(Status::OK, hidlDeviceNameList); + return Void(); +} + +void ExternalCameraProviderImpl_2_7::updateAttachedCameras() { + ALOGV("%s start scaning for existing V4L2 devices", __FUNCTION__); + // Find existing /dev/video* devices + DIR* devdir = opendir(kDevicePath); + if (devdir == 0) { + ALOGE("%s: cannot open %s! Exiting threadloop", __FUNCTION__, kDevicePath); + return; + } + + struct dirent* de; + while ((de = readdir(devdir)) != 0) { + // Find external v4l devices that's existing before we start watching and add them + if (!strncmp(kPrefix, de->d_name, kPrefixLen)) { + // TODO: This might reject some valid devices. Ex: internal is 33 and a device named 3 + // is added. + std::string deviceId(de->d_name + kPrefixLen); + if (mCfg.mInternalDevices.count(deviceId) == 0) { + ALOGV("Non-internal v4l device %s found", de->d_name); + char v4l2DevicePath[kMaxDevicePathLen]; + snprintf(v4l2DevicePath, kMaxDevicePathLen, "%s%s", kDevicePath, de->d_name); + deviceAdded(v4l2DevicePath); + } + } + } + closedir(devdir); +} + +Return ExternalCameraProviderImpl_2_7::isSetTorchModeSupported( + ICameraProvider::isSetTorchModeSupported_cb _hidl_cb) { + // setTorchMode API is supported, though right now no external camera device + // has a flash unit. + _hidl_cb(Status::OK, true); + return Void(); +} + +Return ExternalCameraProviderImpl_2_7::getCameraDeviceInterface_V1_x( + const hidl_string&, ICameraProvider::getCameraDeviceInterface_V1_x_cb _hidl_cb) { + // External Camera HAL does not support HAL1 + _hidl_cb(Status::OPERATION_NOT_SUPPORTED, nullptr); + return Void(); +} + +Return ExternalCameraProviderImpl_2_7::getCameraDeviceInterface_V3_x( + const hidl_string& cameraDeviceName, + ICameraProvider::getCameraDeviceInterface_V3_x_cb _hidl_cb) { + std::string cameraDevicePath, deviceVersion; + bool match = matchDeviceName(mCfg.cameraIdOffset, cameraDeviceName, &deviceVersion, + &cameraDevicePath); + if (!match) { + _hidl_cb(Status::ILLEGAL_ARGUMENT, nullptr); + return Void(); + } + + if (mCameraStatusMap.count(cameraDeviceName) == 0 || + mCameraStatusMap[cameraDeviceName] != CameraDeviceStatus::PRESENT) { + _hidl_cb(Status::ILLEGAL_ARGUMENT, nullptr); + return Void(); + } + + sp deviceImpl; + switch (mPreferredHal3MinorVersion) { + case 4: { + ALOGV("Constructing v3.4 external camera device"); + deviceImpl = + new device::V3_4::implementation::ExternalCameraDevice(cameraDevicePath, mCfg); + break; + } + case 5: { + ALOGV("Constructing v3.5 external camera device"); + deviceImpl = + new device::V3_5::implementation::ExternalCameraDevice(cameraDevicePath, mCfg); + break; + } + case 6: { + ALOGV("Constructing v3.6 external camera device"); + deviceImpl = + new device::V3_6::implementation::ExternalCameraDevice(cameraDevicePath, mCfg); + break; + } + default: + ALOGE("%s: Unknown HAL minor version %d!", __FUNCTION__, mPreferredHal3MinorVersion); + _hidl_cb(Status::INTERNAL_ERROR, nullptr); + return Void(); + } + + if (deviceImpl == nullptr || deviceImpl->isInitFailed()) { + ALOGE("%s: camera device %s init failed!", __FUNCTION__, cameraDevicePath.c_str()); + _hidl_cb(Status::INTERNAL_ERROR, nullptr); + return Void(); + } + + IF_ALOGV() { + deviceImpl->getInterface()->interfaceChain( + [](::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) { + ALOGV("Device interface chain:"); + for (auto iface : interfaceChain) { + ALOGV(" %s", iface.c_str()); + } + }); + } + + _hidl_cb(Status::OK, deviceImpl->getInterface()); + + return Void(); +} + +void ExternalCameraProviderImpl_2_7::addExternalCamera(const char* devName) { + ALOGV("ExtCam: adding %s to External Camera HAL!", devName); + Mutex::Autolock _l(mLock); + std::string deviceName; + std::string cameraId = + std::to_string(mCfg.cameraIdOffset + std::atoi(devName + kDevicePrefixLen)); + if (mPreferredHal3MinorVersion == 6) { + deviceName = std::string("device@3.6/external/") + cameraId; + } else if (mPreferredHal3MinorVersion == 5) { + deviceName = std::string("device@3.5/external/") + cameraId; + } else { + deviceName = std::string("device@3.4/external/") + cameraId; + } + mCameraStatusMap[deviceName] = CameraDeviceStatus::PRESENT; + if (mCallbacks != nullptr) { + mCallbacks->cameraDeviceStatusChange(deviceName, CameraDeviceStatus::PRESENT); + } +} + +void ExternalCameraProviderImpl_2_7::deviceAdded(const char* devName) { + { + base::unique_fd fd(::open(devName, O_RDWR)); + if (fd.get() < 0) { + ALOGE("%s open v4l2 device %s failed:%s", __FUNCTION__, devName, strerror(errno)); + return; + } + + struct v4l2_capability capability; + int ret = ioctl(fd.get(), VIDIOC_QUERYCAP, &capability); + if (ret < 0) { + ALOGE("%s v4l2 QUERYCAP %s failed", __FUNCTION__, devName); + return; + } + + if (!(capability.device_caps & V4L2_CAP_VIDEO_CAPTURE)) { + ALOGW("%s device %s does not support VIDEO_CAPTURE", __FUNCTION__, devName); + return; + } + } + // See if we can initialize ExternalCameraDevice correctly + sp deviceImpl = + new device::V3_4::implementation::ExternalCameraDevice(devName, mCfg); + if (deviceImpl == nullptr || deviceImpl->isInitFailed()) { + ALOGW("%s: Attempt to init camera device %s failed!", __FUNCTION__, devName); + return; + } + deviceImpl.clear(); + + addExternalCamera(devName); + return; +} + +void ExternalCameraProviderImpl_2_7::deviceRemoved(const char* devName) { + Mutex::Autolock _l(mLock); + std::string deviceName; + std::string cameraId = + std::to_string(mCfg.cameraIdOffset + std::atoi(devName + kDevicePrefixLen)); + if (mPreferredHal3MinorVersion == 6) { + deviceName = std::string("device@3.6/external/") + cameraId; + } else if (mPreferredHal3MinorVersion == 5) { + deviceName = std::string("device@3.5/external/") + cameraId; + } else { + deviceName = std::string("device@3.4/external/") + cameraId; + } + if (mCameraStatusMap.erase(deviceName) != 0) { + if (mCallbacks != nullptr) { + mCallbacks->cameraDeviceStatusChange(deviceName, CameraDeviceStatus::NOT_PRESENT); + } + } else { + ALOGE("%s: cannot find camera device %s", __FUNCTION__, devName); + } +} + +ExternalCameraProviderImpl_2_7::HotplugThread::HotplugThread(ExternalCameraProviderImpl_2_7* parent) + : Thread(/*canCallJava*/ false), + mParent(parent), + mInternalDevices(parent->mCfg.mInternalDevices) {} + +ExternalCameraProviderImpl_2_7::HotplugThread::~HotplugThread() {} + +bool ExternalCameraProviderImpl_2_7::HotplugThread::threadLoop() { + // Update existing cameras + mParent->updateAttachedCameras(); + + // Watch new video devices + mINotifyFD = inotify_init(); + if (mINotifyFD < 0) { + ALOGE("%s: inotify init failed! Exiting threadloop", __FUNCTION__); + return true; + } + + mWd = inotify_add_watch(mINotifyFD, kDevicePath, IN_CREATE | IN_DELETE); + if (mWd < 0) { + ALOGE("%s: inotify add watch failed! Exiting threadloop", __FUNCTION__); + return true; + } + + bool done = false; + char eventBuf[512]; + while (!done) { + int offset = 0; + int ret = read(mINotifyFD, eventBuf, sizeof(eventBuf)); + if (ret >= (int)sizeof(struct inotify_event)) { + while (offset < ret) { + struct inotify_event* event = (struct inotify_event*)&eventBuf[offset]; + if (event->wd == mWd) { + ALOGV("%s inotify_event %s", __FUNCTION__, event->name); + if (!strncmp(kPrefix, event->name, kPrefixLen)) { + std::string deviceId(event->name + kPrefixLen); + if (mInternalDevices.count(deviceId) == 0) { + char v4l2DevicePath[kMaxDevicePathLen]; + snprintf(v4l2DevicePath, kMaxDevicePathLen, "%s%s", kDevicePath, + event->name); + if (event->mask & IN_CREATE) { + mParent->deviceAdded(v4l2DevicePath); + } + if (event->mask & IN_DELETE) { + mParent->deviceRemoved(v4l2DevicePath); + } + } + } + } + offset += sizeof(struct inotify_event) + event->len; + } + } + } + + return true; +} + +Return ExternalCameraProviderImpl_2_7::notifyDeviceStateChange( + hidl_bitfield /*newState*/) { + return Void(); +} + +Return ExternalCameraProviderImpl_2_7::getConcurrentStreamingCameraIds( + ICameraProvider::getConcurrentStreamingCameraIds_cb _hidl_cb) { + hidl_vec> hidl_camera_id_combinations; + _hidl_cb(Status::OK, hidl_camera_id_combinations); + return Void(); +} + +Return ExternalCameraProviderImpl_2_7::isConcurrentStreamCombinationSupported( + const hidl_vec<::android::hardware::camera::provider::V2_6:: + CameraIdAndStreamCombination>& /* configs */, + ICameraProvider::isConcurrentStreamCombinationSupported_cb _hidl_cb) { + _hidl_cb(Status::OK, false); + return Void(); +} + +Return ExternalCameraProviderImpl_2_7::isConcurrentStreamCombinationSupported_2_7( + const hidl_vec& /* configs */, + ICameraProvider::isConcurrentStreamCombinationSupported_2_7_cb _hidl_cb) { + _hidl_cb(Status::OK, false); + return Void(); +} + +} // namespace implementation +} // namespace V2_7 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.h b/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.h new file mode 100644 index 0000000000000000000000000000000000000000..da9f6b3a9197775b13e6afa8f54b026517773b18 --- /dev/null +++ b/camera/provider/2.7/default/ExternalCameraProviderImpl_2_7.h @@ -0,0 +1,134 @@ +/* + * 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. + */ + +#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_7_EXTCAMERAPROVIDER_H +#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_7_EXTCAMERAPROVIDER_H + +#include +#include +#include +#include +#include +#include +#include +#include "ExternalCameraUtils.h" + +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_7 { +namespace implementation { + +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::hardware::camera::common::V1_0::CameraDeviceStatus; +using ::android::hardware::camera::common::V1_0::Status; +using ::android::hardware::camera::common::V1_0::VendorTagSection; +using ::android::hardware::camera::external::common::ExternalCameraConfig; +using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback; +using ::android::hardware::camera::provider::V2_5::DeviceState; +using ::android::hardware::camera::provider::V2_7::CameraIdAndStreamCombination; +using ::android::hardware::camera::provider::V2_7::ICameraProvider; +using ::android::hidl::base::V1_0::IBase; + +/** + * The implementation of external webcam CameraProvider 2.7, separated + * from the HIDL interface layer to allow for implementation reuse by later + * provider versions. + * + * This camera provider supports standard UVC webcameras via the Linux V4L2 + * UVC driver. + */ +struct ExternalCameraProviderImpl_2_7 { + ExternalCameraProviderImpl_2_7(); + ~ExternalCameraProviderImpl_2_7(); + + // Caller must use this method to check if CameraProvider ctor failed + bool isInitFailed() { return false; } + + // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow. + Return setCallback(const sp& callback); + Return getVendorTags(ICameraProvider::getVendorTags_cb _hidl_cb); + Return getCameraIdList(ICameraProvider::getCameraIdList_cb _hidl_cb); + Return isSetTorchModeSupported(ICameraProvider::isSetTorchModeSupported_cb _hidl_cb); + Return getCameraDeviceInterface_V1_x(const hidl_string&, + ICameraProvider::getCameraDeviceInterface_V1_x_cb); + Return getCameraDeviceInterface_V3_x(const hidl_string&, + ICameraProvider::getCameraDeviceInterface_V3_x_cb); + + // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow. + Return notifyDeviceStateChange(hidl_bitfield newState); + + // Methods from ::android::hardware::camera::provider::V2_7::ICameraProvider follow. + Return getConcurrentStreamingCameraIds( + ICameraProvider::getConcurrentStreamingCameraIds_cb _hidl_cb); + + Return isConcurrentStreamCombinationSupported( + const hidl_vec< + ::android::hardware::camera::provider::V2_6::CameraIdAndStreamCombination>& + configs, + ICameraProvider::isConcurrentStreamCombinationSupported_cb _hidl_cb); + + Return isConcurrentStreamCombinationSupported_2_7( + const hidl_vec& configs, + ICameraProvider::isConcurrentStreamCombinationSupported_2_7_cb _hidl_cb); + + private: + void addExternalCamera(const char* devName); + + void deviceAdded(const char* devName); + + void deviceRemoved(const char* devName); + + void updateAttachedCameras(); + + class HotplugThread : public android::Thread { + public: + HotplugThread(ExternalCameraProviderImpl_2_7* parent); + ~HotplugThread(); + + virtual bool threadLoop() override; + + private: + ExternalCameraProviderImpl_2_7* mParent = nullptr; + const std::unordered_set mInternalDevices; + + int mINotifyFD = -1; + int mWd = -1; + }; + + Mutex mLock; + sp mCallbacks = nullptr; + std::unordered_map mCameraStatusMap; // camera id -> status + const ExternalCameraConfig mCfg; + sp mHotPlugThread; + int mPreferredHal3MinorVersion; +}; + +} // namespace implementation +} // namespace V2_7 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_7_EXTCAMERAPROVIDER_H diff --git a/camera/provider/2.7/default/android.hardware.camera.provider@2.7-external-service-lazy.rc b/camera/provider/2.7/default/android.hardware.camera.provider@2.7-external-service-lazy.rc new file mode 100644 index 0000000000000000000000000000000000000000..9292c4f9595dbcc1daa5c52e162f7dd9de8389b4 --- /dev/null +++ b/camera/provider/2.7/default/android.hardware.camera.provider@2.7-external-service-lazy.rc @@ -0,0 +1,13 @@ +service vendor.camera-provider-2-7-ext /vendor/bin/hw/android.hardware.camera.provider@2.7-external-service-lazy + interface android.hardware.camera.provider@2.4::ICameraProvider external/0 + interface android.hardware.camera.provider@2.5::ICameraProvider external/0 + interface android.hardware.camera.provider@2.6::ICameraProvider external/0 + interface android.hardware.camera.provider@2.7::ICameraProvider external/0 + class hal + oneshot + disabled + user cameraserver + group audio camera input drmrpc usb + ioprio rt 4 + capabilities SYS_NICE + task_profiles CameraServiceCapacity MaxPerformance \ No newline at end of file diff --git a/camera/provider/2.7/default/android.hardware.camera.provider@2.7-external-service.rc b/camera/provider/2.7/default/android.hardware.camera.provider@2.7-external-service.rc new file mode 100644 index 0000000000000000000000000000000000000000..2c9b782c1c780a5faaaac67c6c272bbe28d54f21 --- /dev/null +++ b/camera/provider/2.7/default/android.hardware.camera.provider@2.7-external-service.rc @@ -0,0 +1,11 @@ +service vendor.camera-provider-2-7-ext /vendor/bin/hw/android.hardware.camera.provider@2.7-external-service + interface android.hardware.camera.provider@2.4::ICameraProvider external/0 + interface android.hardware.camera.provider@2.5::ICameraProvider external/0 + interface android.hardware.camera.provider@2.6::ICameraProvider external/0 + interface android.hardware.camera.provider@2.7::ICameraProvider external/0 + class hal + user cameraserver + group audio camera input drmrpc usb + ioprio rt 4 + capabilities SYS_NICE + task_profiles CameraServiceCapacity MaxPerformance diff --git a/camera/provider/2.7/default/external-service.cpp b/camera/provider/2.7/default/external-service.cpp new file mode 100644 index 0000000000000000000000000000000000000000..90b823970f94ce119199d923aa66c0e7d3aa13b0 --- /dev/null +++ b/camera/provider/2.7/default/external-service.cpp @@ -0,0 +1,66 @@ +/* + * Copyright 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. + */ + +#ifdef LAZY_SERVICE +#define LOG_TAG "android.hardware.camera.provider@2.7-external-service-lazy" +#else +#define LOG_TAG "android.hardware.camera.provider@2.7-external-service" +#endif + +#include +#include +#include +#include + +#include "CameraProvider_2_7.h" +#include "ExternalCameraProviderImpl_2_7.h" + +using android::status_t; +using android::hardware::camera::provider::V2_7::ICameraProvider; +using android::hidl::base::V1_0::IBase; + +#ifdef LAZY_SERVICE +const bool kLazyService = true; +#else +const bool kLazyService = false; +#endif + +int main() { + using namespace android::hardware::camera::provider::V2_7::implementation; + + ALOGI("CameraProvider@2.7 external webcam service is starting."); + + ::android::hardware::configureRpcThreadpool(/*threads*/ HWBINDER_THREAD_COUNT, + /*willJoin*/ true); + + ::android::sp> provider = + new CameraProvider(); + + status_t status; + if (kLazyService) { + auto serviceRegistrar = ::android::hardware::LazyServiceRegistrar::getInstance(); + status = serviceRegistrar.registerService(provider, "external/0"); + } else { + status = provider->registerAsService("external/0"); + } + + LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering provider service: %d", + status); + + ::android::hardware::joinRpcThreadpool(); + + return 0; +} \ No newline at end of file diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..87a94b217664d81bfc8a2782cb7a278ace98a9c5 --- /dev/null +++ b/camera/provider/aidl/Android.bp @@ -0,0 +1,39 @@ +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"], +} + +aidl_interface { + name: "android.hardware.camera.provider", + vendor_available: true, + srcs: [ + "android/hardware/camera/provider/*.aidl", + ], + imports: [ + "android.hardware.camera.device", + "android.hardware.camera.common", + ], + stability: "vintf", + backend: { + java: { + enabled: false, + }, + cpp: { + enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.camera.device-V1", + "android.hardware.camera.common-V1", + ], + }, + ], + +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/.hash b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..ccebb8694833840051c547dfdf82a4086413982b --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/.hash @@ -0,0 +1 @@ +5904a53ea55472ca9b45b731cb148c65d1090ba5 diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df77c40a289ba28773b8807e4ded163f99da0742 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +parcelable CameraIdAndStreamCombination { + String cameraId; + android.hardware.camera.device.StreamConfiguration streamConfiguration; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl new file mode 100644 index 0000000000000000000000000000000000000000..334fb2c8270a12eae9d7771f30c541f9e6e9b426 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +parcelable ConcurrentCameraIdCombination { + List combination; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ICameraProvider.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c15bdee62b67fd16728b5662619c3b3bed36c8cd --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ICameraProvider.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +interface ICameraProvider { + void setCallback(android.hardware.camera.provider.ICameraProviderCallback callback); + android.hardware.camera.common.VendorTagSection[] getVendorTags(); + String[] getCameraIdList(); + android.hardware.camera.device.ICameraDevice getCameraDeviceInterface(String cameraDeviceName); + void notifyDeviceStateChange(long deviceState); + android.hardware.camera.provider.ConcurrentCameraIdCombination[] getConcurrentCameraIds(); + boolean isConcurrentStreamCombinationSupported(in android.hardware.camera.provider.CameraIdAndStreamCombination[] configs); + const long DEVICE_STATE_NORMAL = 0; + const long DEVICE_STATE_BACK_COVERED = 1; + const long DEVICE_STATE_FRONT_COVERED = 2; + const long DEVICE_STATE_FOLDED = 4; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ICameraProviderCallback.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ICameraProviderCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d3c53f5bc22934d807de7c9b77ed2414fa6f1f97 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/1/android/hardware/camera/provider/ICameraProviderCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +interface ICameraProviderCallback { + void cameraDeviceStatusChange(String cameraDeviceName, android.hardware.camera.common.CameraDeviceStatus newStatus); + void torchModeStatusChange(String cameraDeviceName, android.hardware.camera.common.TorchModeStatus newStatus); + void physicalCameraDeviceStatusChange(String cameraDeviceName, String physicalCameraDeviceName, android.hardware.camera.common.CameraDeviceStatus newStatus); +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df77c40a289ba28773b8807e4ded163f99da0742 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +parcelable CameraIdAndStreamCombination { + String cameraId; + android.hardware.camera.device.StreamConfiguration streamConfiguration; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl new file mode 100644 index 0000000000000000000000000000000000000000..334fb2c8270a12eae9d7771f30c541f9e6e9b426 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +parcelable ConcurrentCameraIdCombination { + List combination; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c15bdee62b67fd16728b5662619c3b3bed36c8cd --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +interface ICameraProvider { + void setCallback(android.hardware.camera.provider.ICameraProviderCallback callback); + android.hardware.camera.common.VendorTagSection[] getVendorTags(); + String[] getCameraIdList(); + android.hardware.camera.device.ICameraDevice getCameraDeviceInterface(String cameraDeviceName); + void notifyDeviceStateChange(long deviceState); + android.hardware.camera.provider.ConcurrentCameraIdCombination[] getConcurrentCameraIds(); + boolean isConcurrentStreamCombinationSupported(in android.hardware.camera.provider.CameraIdAndStreamCombination[] configs); + const long DEVICE_STATE_NORMAL = 0; + const long DEVICE_STATE_BACK_COVERED = 1; + const long DEVICE_STATE_FRONT_COVERED = 2; + const long DEVICE_STATE_FOLDED = 4; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProviderCallback.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProviderCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d3c53f5bc22934d807de7c9b77ed2414fa6f1f97 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProviderCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.camera.provider; +@VintfStability +interface ICameraProviderCallback { + void cameraDeviceStatusChange(String cameraDeviceName, android.hardware.camera.common.CameraDeviceStatus newStatus); + void torchModeStatusChange(String cameraDeviceName, android.hardware.camera.common.TorchModeStatus newStatus); + void physicalCameraDeviceStatusChange(String cameraDeviceName, String physicalCameraDeviceName, android.hardware.camera.common.CameraDeviceStatus newStatus); +} diff --git a/camera/provider/aidl/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl b/camera/provider/aidl/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl new file mode 100644 index 0000000000000000000000000000000000000000..36b48e1dd8decf1ba4a190391cad8b2c86a0ee6d --- /dev/null +++ b/camera/provider/aidl/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.provider; + +import android.hardware.camera.device.StreamConfiguration; + +@VintfStability +parcelable CameraIdAndStreamCombination { + String cameraId; + + StreamConfiguration streamConfiguration; +} diff --git a/camera/provider/aidl/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl b/camera/provider/aidl/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46917a1caa8f86541c7891a06b19a172f0bf232b --- /dev/null +++ b/camera/provider/aidl/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.provider; + +@VintfStability +parcelable ConcurrentCameraIdCombination { + /** + * Combination of camera ids, that can be opened + * and configured with sessions on, concurrently. + */ + List combination; +} diff --git a/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c4eba8d492d75663cbbfee7ab393603451733c28 --- /dev/null +++ b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl @@ -0,0 +1,307 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.provider; + +import android.hardware.camera.common.VendorTagSection; +import android.hardware.camera.device.ICameraDevice; +import android.hardware.camera.provider.CameraIdAndStreamCombination; +import android.hardware.camera.provider.ConcurrentCameraIdCombination; +import android.hardware.camera.provider.ICameraProviderCallback; + +/** + * Camera provider HAL, which enumerates the available individual camera devices + * known to the provider, and provides updates about changes to device status, + * such as connection, disconnection, or torch mode enable/disable. + * + * The provider is responsible for generating a list of camera device service + * names that can then be opened via the hardware service manager. + * + * Multiple camera provider HALs may be present in a single system. + * For discovery, the service names, and process names, must be of the form + * "android.hardware.camera.provider.ICameraProvider//" + * where + * - is the type of devices this provider knows about, such as + * "internal", "external", "remote" etc. The camera framework + * must not differentiate or chage its behavior based on the specific type. + * - is a non-negative integer starting from 0 to disambiguate + * between multiple HALs of the same type. + * + * The device instance names enumerated by the provider in getCameraIdList() or + * ICameraProviderCallback::cameraDeviceStatusChange() must be of the form + * "device@.//" where + * / is the AIDL version of the interface. Major version is the version baked into the + * name of the device interface. Minor version is the version that would be returned by calling + * getInterfaceVersion on the interface binder returned getCameraDeviceInterface. + * is either a small incrementing integer for "internal" device types, with 0 being the main + * back-facing camera and 1 being the main front-facing camera, if they exist. + * Or, for external devices, a unique serial number (if possible) that can be + * used to identify the device reliably when it is disconnected and reconnected. + * + * Multiple providers must not enumerate the same device ID. + */ + +@VintfStability +interface ICameraProvider { + /** + * Device states to be passed to notifyDeviceStateChange(). + */ + const long DEVICE_STATE_NORMAL = 0; + const long DEVICE_STATE_BACK_COVERED = 1 << 0; + const long DEVICE_STATE_FRONT_COVERED = 1 << 1; + const long DEVICE_STATE_FOLDED = 1 << 2; + + /** + * setCallback: + * + * Provide a callback interface to the HAL provider to inform framework of + * asynchronous camera events. The framework must call this function once + * during camera service startup, before any other calls to the provider + * (note that in case the camera service restarts, this method must be + * invoked again during its startup). + * + * @param callback + * A non-null callback interface to invoke when camera events occur. + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * An unexpected internal error occurred while setting the callbacks + * ILLEGAL_ARGUMENT: + * The callback argument is invalid (for example, null). + * + */ + void setCallback(ICameraProviderCallback callback); + + /** + * getVendorTags: + * + * Retrieve all vendor tags supported by devices discoverable through this + * provider. The tags are grouped into sections. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * An unexpected internal error occurred while setting the callbacks + * @return + * The supported vendor tag sections; empty if there are no supported + * vendor tags. + * + */ + VendorTagSection[] getVendorTags(); + + /** + * getCameraIdList: + * + * Returns the list of internal camera device interfaces known to this + * camera provider. These devices can then be accessed via the service manager. + * + * External camera devices (camera facing EXTERNAL) must be reported through + * the device status change callback, not in this list. Only devices with + * facing BACK or FRONT must be listed here. + * + * A service specific error will be returned on the following conditions + * INTERNAL_ERROR: + * A camera ID list cannot be created. This may be due to + * a failure to initialize the camera subsystem, for example. + * @return The list of internal camera device names known to this provider. + */ + String[] getCameraIdList(); + + /** + * getCameraDeviceInterface: + * + * Return a android.hardware.camera.device/ICameraDevice interface for + * the requested device name. This does not power on the camera device, but + * simply acquires the interface for querying the device static information, + * or to additionally open the device for active use. + * + * Valid device names for this provider can be obtained via either + * getCameraIdList(), or via availability callbacks from + * ICameraProviderCallback::cameraDeviceStatusChange(). + * + * @param cameraDeviceName the name of the device to get an interface to. + * + * A service specific error will be returned on the following conditions + * ILLEGAL_ARGUMENT: + * This device name is unknown, or has been disconnected + * OPERATION_NOT_SUPPORTED: + * The specified device does not support this major version of the + * HAL interface. + * INTERNAL_ERROR: + * A camera interface cannot be returned due to an unexpected + * internal error. + * @return device The interface to this camera device, or null in case of + * error. + */ + ICameraDevice getCameraDeviceInterface(String cameraDeviceName); + + /** + * notifyDeviceStateChange: + * + * Notify the HAL provider that the state of the overall device has + * changed in some way that the HAL may want to know about. + * + * For example, a physical shutter may have been uncovered or covered, + * or a camera may have been covered or uncovered by an add-on keyboard + * or other accessory. + * + * The state is a bitfield of potential states, and some physical configurations + * could plausibly correspond to multiple different combinations of state bits. + * The HAL must ignore any state bits it is not actively using to determine + * the appropriate camera configuration. + * + * For example, on some devices the FOLDED state could mean that + * backward-facing cameras are covered by the fold, so FOLDED by itself implies + * BACK_COVERED. But other devices may support folding but not cover any cameras + * when folded, so for those FOLDED would not imply any of the other flags. + * Since these relationships are very device-specific, it is difficult to specify + * a comprehensive policy. But as a recommendation, it is suggested that if a flag + * necessarily implies other flags are set as well, then those flags should be set. + * So even though FOLDED would be enough to infer BACK_COVERED on some devices, the + * BACK_COVERED flag should also be set for clarity. + * + * This method may be invoked by the HAL client at any time. It must not + * cause any active camera device sessions to be closed, but may dynamically + * change which physical camera a logical multi-camera is using for its + * active and future output. + * + * The method must be invoked by the HAL client at least once before the + * client calls ICameraDevice::open on any camera device interfaces listed + * by this provider, to establish the initial device state. + * + * @param newState + * The new state of the device. + */ + void notifyDeviceStateChange(long deviceState); + + /** + * getConcurrentStreamingCameraIds + * + * Get a vector of combinations of camera device ids that are able to + * configure streams concurrently. Each camera device advertised in a + * combination MUST at the very least support the following streams while + * streaming concurrently with the other camera ids in the combination. + * + * Target 1 Target 2 + * ----------------------------------------------------- + * | Type | Size | Type | Size | + * ----------------------------------------------------- + * | YUV | s1440p | | + * ----------------------------------------------------- + * | JPEG | s1440p | | + * ----------------------------------------------------- + * | PRIV | s1440p | | + * ----------------------------------------------------- + * | YUV / PRIV | s720p | YUV / PRIV | s1440p | + * ----------------------------------------------------- + * | YUV / PRIV | s720p | JPEG | s1440p | + * ----------------------------------------------------- + * + * where: + * s720p - min (max output resolution for the given format, 1280 X 720) + * s1440p - min (max output resolution for the given format, 1920 X 1440) + * + * If a device has MONOCHROME capability (device's capabilities include + * ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME) and therefore supports Y8 + * outputs, stream combinations mentioned above, where YUV is substituted by + * Y8 must be also supported. + * + * Devices whose capabilities do not include + * ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE, must support + * at least a single Y16 stream, Dataspace::DEPTH with sVGA resolution, + * during concurrent operation. + * Where sVGA - min (max output resolution for the given format, 640 X 480) + * + * The camera framework must call this method whenever it gets a + * cameraDeviceStatusChange callback adding a new camera device or removing + * a camera device known to it. This is so that the camera framework can get new combinations + * of camera ids that can stream concurrently, that might have potentially appeared. + * + * For each combination (and their subsets) of camera device ids returned by + * getConcurrentStreamingCameraIds(): If only the mandatory combinations can + * be supported concurrently by each device, then the resource costs must + * sum up to > 100 for the concurrent set, to ensure arbitration between + * camera applications work as expected. Only if resources are sufficient + * to run a set of cameras at full capability (maximally + * resource-consuming framerate and stream size settings available in the + * configuration settings exposed through camera metadata), should the sum + * of resource costs for the combination be <= 100. + * + * For guaranteed concurrent camera operation, the camera framework must call + * ICameraDevice.open() on all devices (intended for concurrent operation), before configuring + * any streams on them. This gives the camera HAL process an opportunity to potentially + * distribute hardware resources better before stream configuration. + * + * Due to potential hardware constraints around internal switching of physical camera devices, + * a device's complete ZOOM_RATIO_RANGE(if supported), may not apply during concurrent + * operation. If ZOOM_RATIO is supported, camera HALs must ensure ZOOM_RATIO_RANGE of + * [1.0, ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM] is supported by that device, during + * concurrent operation. + * + * A service specific error will be returned in the following case : + * + * INTERNAL_ERROR: the hal has encountered an internal error + * + * @return a list of camera id combinations that support + * concurrent stream configurations with the minimum guarantees + * specified. + */ + ConcurrentCameraIdCombination[] getConcurrentCameraIds(); + + /** + * isConcurrentStreamCombinationSupported: + * + * Check for device support of specific camera stream combinations while + * streaming concurrently with other devices. + * + * The per device streamList must contain at least one output-capable stream, and may + * not contain more than one input-capable stream. + * In contrast to regular stream configuration the framework does not create + * or initialize any actual streams. This means that Hal must not use or + * consider the stream "id" value. + * + * ------------------------------------------------------------------------ + * + * Preconditions: + * + * The framework can call this method at any time before, during and + * after active session configuration per device. This means that calls must not + * impact the performance of pending camera requests in any way. In + * particular there must not be any glitches or delays during normal + * camera streaming. + * + * The framework must not call this method with any combination of camera + * ids that is not a subset of the camera ids advertised by getConcurrentStreamingCameraIds of + * the same provider. + * + * Performance requirements: + * This call is expected to be significantly faster than stream + * configuration. In general HW and SW camera settings must not be + * changed and there must not be a user-visible impact on camera performance. + * + * @param configs a vector of camera ids and their corresponding stream + * configurations that need to be queried for support. + * + * On error, the service specific error for the operation will be, one of: + * OPERATION_NOT_SUPPORTED: + * The camera provider does not support stream combination query. + * INTERNAL_ERROR: + * The stream combination query cannot complete due to internal + * error. + * @return true in case the stream combination is supported, false otherwise. + * + * + */ + boolean isConcurrentStreamCombinationSupported(in CameraIdAndStreamCombination[] configs); +} diff --git a/camera/provider/aidl/android/hardware/camera/provider/ICameraProviderCallback.aidl b/camera/provider/aidl/android/hardware/camera/provider/ICameraProviderCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a877637c28b75610ae4a06ffe7ddd8554457e04f --- /dev/null +++ b/camera/provider/aidl/android/hardware/camera/provider/ICameraProviderCallback.aidl @@ -0,0 +1,85 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.camera.provider; + +import android.hardware.camera.common.CameraDeviceStatus; +import android.hardware.camera.common.TorchModeStatus; + +@VintfStability +interface ICameraProviderCallback { + /** + * cameraDeviceStatusChange: + * + * Callback to the camera service to indicate that the state of a specific + * camera device has changed. + * + * On camera service startup, when ICameraProvider::setCallback is invoked, + * the camera service must assume that all internal camera devices are in + * the CAMERA_DEVICE_STATUS_PRESENT state. + * + * The provider must call this method to inform the camera service of any + * initially NOT_PRESENT devices, and of any external camera devices that + * are already present, as soon as the callbacks are available through + * setCallback. + * + * @param cameraDeviceName The name of the camera device that has a new status. + * @param newStatus The new status that device is in. + * + */ + void cameraDeviceStatusChange(String cameraDeviceName, CameraDeviceStatus newStatus); + + /** + * torchModeStatusChange: + * + * Callback to the camera service to indicate that the state of the torch + * mode of the flash unit associated with a specific camera device has + * changed. At provider registration time, the camera service must assume + * the torch modes are in the TORCH_MODE_STATUS_AVAILABLE_OFF state if + * android.flash.info.available is reported as true via the + * ICameraDevice::getCameraCharacteristics call. + * + * @param cameraDeviceName The name of the camera device that has a + * new status. + * @param newStatus The new status that the torch is in. + * + */ + void torchModeStatusChange(String cameraDeviceName, TorchModeStatus newStatus); + + /** + * cameraPhysicalDeviceStatusChange: + * + * Callback to the camera service to indicate that the state of a physical + * camera device of a logical multi-camera has changed. + * + * On camera service startup, when ICameraProvider::setCallback is invoked, + * the camera service must assume that all physical devices backing internal + * multi-camera devices are in the CAMERA_DEVICE_STATUS_PRESENT state. + * + * The provider must call this method to inform the camera service of any + * initially NOT_PRESENT physical devices, as soon as the callbacks are available + * through setCallback. + * + * @param cameraDeviceName The name of the logical multi-camera whose + * physical camera has a new status. + * @param physicalCameraDeviceName The name of the physical camera device + * that has a new status. + * @param newStatus The new status that device is in. + * + */ + void physicalCameraDeviceStatusChange( + String cameraDeviceName, String physicalCameraDeviceName, CameraDeviceStatus newStatus); +} diff --git a/camera/provider/aidl/vts/Android.bp b/camera/provider/aidl/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..727ef03e72909730b3a8c2c8274e92a7202377e3 --- /dev/null +++ b/camera/provider/aidl/vts/Android.bp @@ -0,0 +1,75 @@ +// +// Copyright (C) 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. +// + +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: "VtsAidlHalCameraProvider_TargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "camera_aidl_test.cpp", + "device_cb.cpp", + "empty_device_cb.cpp", + "simple_device_cb.cpp", + "torch_provider_cb.cpp", + "VtsAidlHalCameraProvider_TargetTest.cpp", + ], + + // TODO(b/64437680): Assume these are always available on the device. + shared_libs: [ + "libbinder_ndk", + "libcamera_metadata", + "libcutils", + "libfmq", + "libgui", + "libui", + "libbase", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + ], + + // Statically link to libs not guaranteed to be present on the device. + static_libs: [ + "android.hardware.camera.common@1.0-helper", + "android.hardware.camera.common-V1-ndk", + "android.hardware.camera.device-V1-ndk", + "android.hardware.camera.metadata-V1-ndk", + "android.hardware.camera.provider-V1-ndk", + "android.hardware.graphics.common-V3-ndk", + "android.hidl.allocator@1.0", + "libgrallocusage", + "libhidlmemory", + "libgralloctypes", + "libaidlcommonsupport", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/camera/provider/aidl/vts/AndroidTest.xml b/camera/provider/aidl/vts/AndroidTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..226121da74419ac5595834723354e4b77dfc9e91 --- /dev/null +++ b/camera/provider/aidl/vts/AndroidTest.xml @@ -0,0 +1,33 @@ + + + + \ No newline at end of file diff --git a/camera/provider/aidl/vts/OWNERS b/camera/provider/aidl/vts/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..27d370bcbe71702bfaac4ac22cb4e414af1349c1 --- /dev/null +++ b/camera/provider/aidl/vts/OWNERS @@ -0,0 +1,6 @@ +# Camera team +include platform/frameworks/av:/camera/OWNERS + +# VTS team +yim@google.com +zhuoyao@google.com \ No newline at end of file diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fe03732aff31ca317af3d19c58bee7844965bdb0 --- /dev/null +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -0,0 +1,3063 @@ +/* + * Copyright (C) 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using ::aidl::android::hardware::camera::common::CameraDeviceStatus; +using ::aidl::android::hardware::camera::common::CameraResourceCost; +using ::aidl::android::hardware::camera::common::TorchModeStatus; +using ::aidl::android::hardware::camera::common::VendorTagSection; +using ::aidl::android::hardware::camera::device::ICameraDevice; +using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap; +using ::aidl::android::hardware::camera::metadata::SensorPixelMode; +using ::aidl::android::hardware::camera::provider::CameraIdAndStreamCombination; +using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback; + +using ::ndk::ScopedAStatus; + +namespace { +const int32_t kBurstFrameCount = 10; +const uint32_t kMaxStillWidth = 2048; +const uint32_t kMaxStillHeight = 1536; + +const int64_t kEmptyFlushTimeoutMSec = 200; + +const static std::vector kMandatoryUseCases = { + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL}; +} // namespace + +TEST_P(CameraAidlTest, getCameraIdList) { + std::vector idList; + ScopedAStatus ret = mProvider->getCameraIdList(&idList); + ASSERT_TRUE(ret.isOk()); + + for (size_t i = 0; i < idList.size(); i++) { + ALOGI("Camera Id[%zu] is %s", i, idList[i].c_str()); + } +} + +// Test if ICameraProvider::getVendorTags returns Status::OK +TEST_P(CameraAidlTest, getVendorTags) { + std::vector vendorTags; + ScopedAStatus ret = mProvider->getVendorTags(&vendorTags); + + ASSERT_TRUE(ret.isOk()); + for (size_t i = 0; i < vendorTags.size(); i++) { + ALOGI("Vendor tag section %zu name %s", i, vendorTags[i].sectionName.c_str()); + for (auto& tag : vendorTags[i].tags) { + ALOGI("Vendor tag id %u name %s type %d", tag.tagId, tag.tagName.c_str(), + (int)tag.tagType); + } + } +} + +// Test if ICameraProvider::setCallback returns Status::OK +TEST_P(CameraAidlTest, setCallback) { + struct ProviderCb : public BnCameraProviderCallback { + ScopedAStatus cameraDeviceStatusChange(const std::string& cameraDeviceName, + CameraDeviceStatus newStatus) override { + ALOGI("camera device status callback name %s, status %d", cameraDeviceName.c_str(), + (int)newStatus); + return ScopedAStatus::ok(); + } + ScopedAStatus torchModeStatusChange(const std::string& cameraDeviceName, + TorchModeStatus newStatus) override { + ALOGI("Torch mode status callback name %s, status %d", cameraDeviceName.c_str(), + (int)newStatus); + return ScopedAStatus::ok(); + } + ScopedAStatus physicalCameraDeviceStatusChange(const std::string& cameraDeviceName, + const std::string& physicalCameraDeviceName, + CameraDeviceStatus newStatus) override { + ALOGI("physical camera device status callback name %s, physical camera name %s," + " status %d", + cameraDeviceName.c_str(), physicalCameraDeviceName.c_str(), (int)newStatus); + return ScopedAStatus::ok(); + } + }; + + std::shared_ptr cb = ndk::SharedRefBase::make(); + ScopedAStatus ret = mProvider->setCallback(cb); + ASSERT_TRUE(ret.isOk()); + ret = mProvider->setCallback(nullptr); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError()); +} + +// Test if ICameraProvider::getCameraDeviceInterface returns Status::OK and non-null device +TEST_P(CameraAidlTest, getCameraDeviceInterface) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + std::shared_ptr cameraDevice; + ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &cameraDevice); + ALOGI("getCameraDeviceInterface returns: %d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(cameraDevice, nullptr); + } +} + +// Verify that the device resource cost can be retrieved and the values are +// correct. +TEST_P(CameraAidlTest, getResourceCost) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& deviceName : cameraDeviceNames) { + std::shared_ptr cameraDevice; + ScopedAStatus ret = mProvider->getCameraDeviceInterface(deviceName, &cameraDevice); + ALOGI("getCameraDeviceInterface returns: %d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(cameraDevice, nullptr); + + CameraResourceCost resourceCost; + ret = cameraDevice->getResourceCost(&resourceCost); + ALOGI("getResourceCost returns: %d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + + ALOGI(" Resource cost is %d", resourceCost.resourceCost); + ASSERT_LE(resourceCost.resourceCost, 100u); + + for (const auto& name : resourceCost.conflictingDevices) { + ALOGI(" Conflicting device: %s", name.c_str()); + } + } +} + +TEST_P(CameraAidlTest, systemCameraTest) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::map> hiddenPhysicalIdToLogicalMap; + for (const auto& name : cameraDeviceNames) { + std::shared_ptr device; + ALOGI("systemCameraTest: Testing camera device %s", name.c_str()); + ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + CameraMetadata cameraCharacteristics; + ret = device->getCameraCharacteristics(&cameraCharacteristics); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* staticMeta = + reinterpret_cast(cameraCharacteristics.metadata.data()); + Status rc = isLogicalMultiCamera(staticMeta); + if (rc == Status::OPERATION_NOT_SUPPORTED) { + return; + } + + ASSERT_EQ(rc, Status::OK); + std::unordered_set physicalIds; + ASSERT_EQ(getPhysicalCameraIds(staticMeta, &physicalIds), Status::OK); + SystemCameraKind systemCameraKind = SystemCameraKind::PUBLIC; + Status retStatus = getSystemCameraKind(staticMeta, &systemCameraKind); + ASSERT_EQ(retStatus, Status::OK); + + for (auto physicalId : physicalIds) { + bool isPublicId = false; + for (auto& deviceName : cameraDeviceNames) { + std::string publicVersion, publicId; + ASSERT_TRUE(matchDeviceName(deviceName, mProviderType, &publicVersion, &publicId)); + if (physicalId == publicId) { + isPublicId = true; + break; + } + } + + // For hidden physical cameras, collect their associated logical cameras + // and store the system camera kind. + if (!isPublicId) { + auto it = hiddenPhysicalIdToLogicalMap.find(physicalId); + if (it == hiddenPhysicalIdToLogicalMap.end()) { + hiddenPhysicalIdToLogicalMap.insert(std::make_pair( + physicalId, std::vector({systemCameraKind}))); + } else { + it->second.push_back(systemCameraKind); + } + } + } + } + + // Check that the system camera kind of the logical cameras associated with + // each hidden physical camera is the same. + for (const auto& it : hiddenPhysicalIdToLogicalMap) { + SystemCameraKind neededSystemCameraKind = it.second.front(); + for (auto foundSystemCamera : it.second) { + ASSERT_EQ(neededSystemCameraKind, foundSystemCamera); + } + } +} + +// Verify that the static camera characteristics can be retrieved +// successfully. +TEST_P(CameraAidlTest, getCameraCharacteristics) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + std::shared_ptr device; + ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str()); + ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns: %d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + CameraMetadata chars; + ret = device->getCameraCharacteristics(&chars); + ASSERT_TRUE(ret.isOk()); + verifyCameraCharacteristics(chars); + verifyMonochromeCharacteristics(chars); + verifyRecommendedConfigs(chars); + verifyLogicalOrUltraHighResCameraMetadata(name, device, chars, cameraDeviceNames); + + ASSERT_TRUE(ret.isOk()); + + // getPhysicalCameraCharacteristics will fail for publicly + // advertised camera IDs. + std::string version, cameraId; + ASSERT_TRUE(matchDeviceName(name, mProviderType, &version, &cameraId)); + CameraMetadata devChars; + ret = device->getPhysicalCameraCharacteristics(cameraId, &devChars); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError()); + ASSERT_EQ(0, devChars.metadata.size()); + } +} + +// Verify that the torch strength level can be set and retrieved successfully. +TEST_P(CameraAidlTest, turnOnTorchWithStrengthLevel) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + std::shared_ptr cb = ndk::SharedRefBase::make(this); + ndk::ScopedAStatus ret = mProvider->setCallback(cb); + ASSERT_TRUE(ret.isOk()); + + for (const auto& name : cameraDeviceNames) { + int32_t defaultLevel; + std::shared_ptr device; + ALOGI("%s: Testing camera device %s", __FUNCTION__, name.c_str()); + + ret = mProvider->getCameraDeviceInterface(name, &device); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + CameraMetadata chars; + ret = device->getCameraCharacteristics(&chars); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* staticMeta = + reinterpret_cast(chars.metadata.data()); + bool torchStrengthControlSupported = isTorchStrengthControlSupported(staticMeta); + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, + ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, &entry); + if (torchStrengthControlSupported) { + ASSERT_EQ(rc, 0); + ASSERT_GT(entry.count, 0); + defaultLevel = *entry.data.i32; + ALOGI("Default level is:%d", defaultLevel); + } + + mTorchStatus = TorchModeStatus::NOT_AVAILABLE; + ret = device->turnOnTorchWithStrengthLevel(2); + ALOGI("turnOnTorchWithStrengthLevel returns status: %d", ret.getServiceSpecificError()); + // OPERATION_NOT_SUPPORTED check + if (!torchStrengthControlSupported) { + ALOGI("Torch strength control not supported."); + ASSERT_EQ(static_cast(Status::OPERATION_NOT_SUPPORTED), + ret.getServiceSpecificError()); + } else { + { + ASSERT_TRUE(ret.isOk()); + std::unique_lock l(mTorchLock); + while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kTorchTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout)); + } + ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus); + mTorchStatus = TorchModeStatus::NOT_AVAILABLE; + } + ALOGI("getTorchStrengthLevel: Testing"); + int32_t strengthLevel; + ret = device->getTorchStrengthLevel(&strengthLevel); + ASSERT_TRUE(ret.isOk()); + ALOGI("Torch strength level is : %d", strengthLevel); + ASSERT_EQ(strengthLevel, 2); + + // Turn OFF the torch and verify torch strength level is reset to default level. + ALOGI("Testing torch strength level reset after turning the torch OFF."); + ret = device->setTorchMode(false); + ASSERT_TRUE(ret.isOk()); + { + std::unique_lock l(mTorchLock); + while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kTorchTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout)); + } + ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF, mTorchStatus); + } + + ret = device->getTorchStrengthLevel(&strengthLevel); + ASSERT_TRUE(ret.isOk()); + ALOGI("Torch strength level after turning OFF torch is : %d", strengthLevel); + ASSERT_EQ(strengthLevel, defaultLevel); + } + } +} + +// In case it is supported verify that torch can be enabled. +// Check for corresponding torch callbacks as well. +TEST_P(CameraAidlTest, setTorchMode) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + std::shared_ptr cb = ndk::SharedRefBase::make(this); + ndk::ScopedAStatus ret = mProvider->setCallback(cb); + ALOGI("setCallback returns status: %d", ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(cb, nullptr); + + for (const auto& name : cameraDeviceNames) { + std::shared_ptr device; + ALOGI("setTorchMode: Testing camera device %s", name.c_str()); + ret = mProvider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + CameraMetadata metadata; + ret = device->getCameraCharacteristics(&metadata); + ALOGI("getCameraCharacteristics returns status:%d", ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + camera_metadata_t* staticMeta = + reinterpret_cast(metadata.metadata.data()); + bool torchSupported = isTorchSupported(staticMeta); + + mTorchStatus = TorchModeStatus::NOT_AVAILABLE; + ret = device->setTorchMode(true); + ALOGI("setTorchMode returns status: %d", ret.getServiceSpecificError()); + if (!torchSupported) { + ASSERT_EQ(static_cast(Status::OPERATION_NOT_SUPPORTED), + ret.getServiceSpecificError()); + } else { + ASSERT_TRUE(ret.isOk()); + { + std::unique_lock l(mTorchLock); + while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kTorchTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout)); + } + ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus); + mTorchStatus = TorchModeStatus::NOT_AVAILABLE; + } + + ret = device->setTorchMode(false); + ASSERT_TRUE(ret.isOk()); + { + std::unique_lock l(mTorchLock); + while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kTorchTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout)); + } + ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF, mTorchStatus); + } + } + } +} + +// Check dump functionality. +TEST_P(CameraAidlTest, dump) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + std::shared_ptr device; + ALOGI("dump: Testing camera device %s", name.c_str()); + + ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + int raw_handle = open(kDumpOutput, O_RDWR); + ASSERT_GE(raw_handle, 0); + + auto retStatus = device->dump(raw_handle, nullptr, 0); + ASSERT_EQ(retStatus, ::android::OK); + close(raw_handle); + } +} + +// Open, dump, then close +TEST_P(CameraAidlTest, openClose) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + std::shared_ptr device; + ALOGI("openClose: Testing camera device %s", name.c_str()); + ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + std::shared_ptr cb = ndk::SharedRefBase::make(); + + ret = device->open(cb, &mSession); + ASSERT_TRUE(ret.isOk()); + ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_NE(mSession, nullptr); + int raw_handle = open(kDumpOutput, O_RDWR); + ASSERT_GE(raw_handle, 0); + + auto retStatus = device->dump(raw_handle, nullptr, 0); + ASSERT_EQ(retStatus, ::android::OK); + close(raw_handle); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + // TODO: test all session API calls return INTERNAL_ERROR after close + // TODO: keep a wp copy here and verify session cannot be promoted out of this scope + } +} + +// Check whether all common default request settings can be successfully +// constructed. +TEST_P(CameraAidlTest, constructDefaultRequestSettings) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + std::shared_ptr device; + ALOGI("constructDefaultRequestSettings: Testing camera device %s", name.c_str()); + ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + std::shared_ptr cb = ndk::SharedRefBase::make(); + ret = device->open(cb, &mSession); + ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(mSession, nullptr); + + for (int32_t t = (int32_t)RequestTemplate::PREVIEW; t <= (int32_t)RequestTemplate::MANUAL; + t++) { + RequestTemplate reqTemplate = (RequestTemplate)t; + CameraMetadata rawMetadata; + ret = mSession->constructDefaultRequestSettings(reqTemplate, &rawMetadata); + ALOGI("constructDefaultRequestSettings returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + + if (reqTemplate == RequestTemplate::ZERO_SHUTTER_LAG || + reqTemplate == RequestTemplate::MANUAL) { + // optional templates + ASSERT_TRUE(ret.isOk() || static_cast(Status::ILLEGAL_ARGUMENT) == + ret.getServiceSpecificError()); + } else { + ASSERT_TRUE(ret.isOk()); + } + + if (ret.isOk()) { + const camera_metadata_t* metadata = (camera_metadata_t*)rawMetadata.metadata.data(); + size_t expectedSize = rawMetadata.metadata.size(); + int result = validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED)); + verifyRequestTemplate(metadata, reqTemplate); + } else { + ASSERT_EQ(0u, rawMetadata.metadata.size()); + } + } + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Verify that all supported stream formats and sizes can be configured +// successfully. +TEST_P(CameraAidlTest, configureStreamsAvailableOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputStreams; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr device; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, &device /*out*/); + + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + outputStreams.clear(); + ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams)); + ASSERT_NE(0u, outputStreams.size()); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + int32_t streamConfigCounter = 0; + for (auto& it : outputStreams) { + Stream stream; + Dataspace dataspace = getDataspace(static_cast(it.format)); + stream.id = streamId; + stream.streamType = StreamType::OUTPUT; + stream.width = it.width; + stream.height = it.height; + stream.format = static_cast(it.format); + stream.dataSpace = dataspace; + stream.usage = static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER); + stream.rotation = StreamRotation::ROTATION_0; + stream.dynamicRangeProfile = RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD; + + std::vector streams = {stream}; + StreamConfiguration config; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + + bool expectStreamCombQuery = (isLogicalMultiCamera(staticMeta) == Status::OK); + verifyStreamCombination(device, config, /*expectedStatus*/ true, expectStreamCombQuery); + + config.streamConfigCounter = streamConfigCounter++; + std::vector halConfigs; + ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(halConfigs.size(), 1); + ASSERT_EQ(halConfigs[0].id, streamId); + + streamId++; + } + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Verify that mandatory concurrent streams and outputs are supported. +TEST_P(CameraAidlTest, configureConcurrentStreamsAvailableOutputs) { + struct CameraTestInfo { + CameraMetadata staticMeta; + std::shared_ptr session; + std::shared_ptr cameraDevice; + StreamConfiguration config; + }; + + std::map idToNameMap = getCameraDeviceIdToNameMap(mProvider); + std::vector concurrentDeviceCombinations = + getConcurrentDeviceCombinations(mProvider); + std::vector outputStreams; + for (const auto& cameraDeviceIds : concurrentDeviceCombinations) { + std::vector cameraIdsAndStreamCombinations; + std::vector cameraTestInfos; + size_t i = 0; + for (const auto& id : cameraDeviceIds.combination) { + CameraTestInfo cti; + auto it = idToNameMap.find(id); + ASSERT_TRUE(idToNameMap.end() != it); + std::string name = it->second; + + openEmptyDeviceSession(name, mProvider, &cti.session /*out*/, &cti.staticMeta /*out*/, + &cti.cameraDevice /*out*/); + + outputStreams.clear(); + camera_metadata_t* staticMeta = + reinterpret_cast(cti.staticMeta.metadata.data()); + ASSERT_EQ(Status::OK, getMandatoryConcurrentStreams(staticMeta, &outputStreams)); + ASSERT_NE(0u, outputStreams.size()); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + std::vector streams(outputStreams.size()); + size_t j = 0; + for (const auto& s : outputStreams) { + Stream stream; + Dataspace dataspace = getDataspace(static_cast(s.format)); + stream.id = streamId++; + stream.streamType = StreamType::OUTPUT; + stream.width = s.width; + stream.height = s.height; + stream.format = static_cast(s.format); + stream.usage = static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER); + stream.dataSpace = dataspace; + stream.rotation = StreamRotation::ROTATION_0; + stream.sensorPixelModesUsed = {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}; + stream.dynamicRangeProfile = RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD; + streams[j] = stream; + j++; + } + + // Add the created stream configs to cameraIdsAndStreamCombinations + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &cti.config, + jpegBufferSize); + + cti.config.streamConfigCounter = outputStreams.size(); + CameraIdAndStreamCombination cameraIdAndStreamCombination; + cameraIdAndStreamCombination.cameraId = id; + cameraIdAndStreamCombination.streamConfiguration = cti.config; + cameraIdsAndStreamCombinations.push_back(cameraIdAndStreamCombination); + i++; + cameraTestInfos.push_back(cti); + } + // Now verify that concurrent streams are supported + bool combinationSupported; + ndk::ScopedAStatus ret = mProvider->isConcurrentStreamCombinationSupported( + cameraIdsAndStreamCombinations, &combinationSupported); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(combinationSupported, true); + + // Test the stream can actually be configured + for (auto& cti : cameraTestInfos) { + if (cti.session != nullptr) { + camera_metadata_t* staticMeta = + reinterpret_cast(cti.staticMeta.metadata.data()); + bool expectStreamCombQuery = (isLogicalMultiCamera(staticMeta) == Status::OK); + verifyStreamCombination(cti.cameraDevice, cti.config, /*expectedStatus*/ true, + expectStreamCombQuery); + } + + if (cti.session != nullptr) { + std::vector streamConfigs; + ret = cti.session->configureStreams(cti.config, &streamConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(cti.config.streams.size(), streamConfigs.size()); + } + } + + for (auto& cti : cameraTestInfos) { + ret = cti.session->close(); + ASSERT_TRUE(ret.isOk()); + } + } +} + +// Check for correct handling of invalid/incorrect configuration parameters. +TEST_P(CameraAidlTest, configureStreamsInvalidOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputStreams; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr cameraDevice; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + outputStreams.clear(); + + ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams)); + ASSERT_NE(0u, outputStreams.size()); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + Stream stream = {streamId++, + StreamType::OUTPUT, + static_cast(0), + static_cast(0), + static_cast(outputStreams[0].format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + int32_t streamConfigCounter = 0; + std::vector streams = {stream}; + StreamConfiguration config; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ false, + /*expectStreamCombQuery*/ false); + + config.streamConfigCounter = streamConfigCounter++; + std::vector halConfigs; + ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); + ASSERT_TRUE(static_cast(Status::ILLEGAL_ARGUMENT) == + ret.getServiceSpecificError() || + static_cast(Status::INTERNAL_ERROR) == ret.getServiceSpecificError()); + + stream = {streamId++, + StreamType::OUTPUT, + /*width*/ INT32_MAX, + /*height*/ INT32_MAX, + static_cast(outputStreams[0].format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + + config.streamConfigCounter = streamConfigCounter++; + halConfigs.clear(); + ret = mSession->configureStreams(config, &halConfigs); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError()); + + for (auto& it : outputStreams) { + stream = {streamId++, + StreamType::OUTPUT, + it.width, + it.height, + static_cast(UINT32_MAX), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + config.streamConfigCounter = streamConfigCounter++; + halConfigs.clear(); + ret = mSession->configureStreams(config, &halConfigs); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), + ret.getServiceSpecificError()); + + stream = {streamId++, + StreamType::OUTPUT, + it.width, + it.height, + static_cast(it.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + static_cast(UINT32_MAX), + std::string(), + jpegBufferSize, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + + config.streamConfigCounter = streamConfigCounter++; + halConfigs.clear(); + ret = mSession->configureStreams(config, &halConfigs); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), + ret.getServiceSpecificError()); + } + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Check whether all supported ZSL output stream combinations can be +// configured successfully. +TEST_P(CameraAidlTest, configureStreamsZSLInputOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector inputStreams; + std::vector inputOutputMap; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr cameraDevice; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + + Status rc = isZSLModeAvailable(staticMeta); + if (Status::OPERATION_NOT_SUPPORTED == rc) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + ASSERT_EQ(Status::OK, rc); + + inputStreams.clear(); + ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, inputStreams)); + ASSERT_NE(0u, inputStreams.size()); + + inputOutputMap.clear(); + ASSERT_EQ(Status::OK, getZSLInputOutputMap(staticMeta, inputOutputMap)); + ASSERT_NE(0u, inputOutputMap.size()); + + bool supportMonoY8 = false; + if (Status::OK == isMonochromeCamera(staticMeta)) { + for (auto& it : inputStreams) { + if (it.format == static_cast(PixelFormat::Y8)) { + supportMonoY8 = true; + break; + } + } + } + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + bool hasPrivToY8 = false, hasY8ToY8 = false, hasY8ToBlob = false; + uint32_t streamConfigCounter = 0; + for (auto& inputIter : inputOutputMap) { + AvailableStream input; + ASSERT_EQ(Status::OK, findLargestSize(inputStreams, inputIter.inputFormat, input)); + ASSERT_NE(0u, inputStreams.size()); + + if (inputIter.inputFormat == + static_cast(PixelFormat::IMPLEMENTATION_DEFINED) && + inputIter.outputFormat == static_cast(PixelFormat::Y8)) { + hasPrivToY8 = true; + } else if (inputIter.inputFormat == static_cast(PixelFormat::Y8)) { + if (inputIter.outputFormat == static_cast(PixelFormat::BLOB)) { + hasY8ToBlob = true; + } else if (inputIter.outputFormat == static_cast(PixelFormat::Y8)) { + hasY8ToY8 = true; + } + } + AvailableStream outputThreshold = {INT32_MAX, INT32_MAX, inputIter.outputFormat}; + std::vector outputStreams; + ASSERT_EQ(Status::OK, + getAvailableOutputStreams(staticMeta, outputStreams, &outputThreshold)); + for (auto& outputIter : outputStreams) { + Dataspace outputDataSpace = + getDataspace(static_cast(outputIter.format)); + Stream zslStream = { + streamId++, + StreamType::OUTPUT, + input.width, + input.height, + static_cast(input.format), + static_cast( + GRALLOC_USAGE_HW_CAMERA_ZSL), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + Stream inputStream = { + streamId++, + StreamType::INPUT, + input.width, + input.height, + static_cast(input.format), + static_cast(0), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + Stream outputStream = { + streamId++, + StreamType::OUTPUT, + outputIter.width, + outputIter.height, + static_cast(outputIter.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + outputDataSpace, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + std::vector streams = {inputStream, zslStream, outputStream}; + + StreamConfiguration config; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, + /*expectStreamCombQuery*/ false); + + config.streamConfigCounter = streamConfigCounter++; + std::vector halConfigs; + ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(3u, halConfigs.size()); + } + } + + if (supportMonoY8) { + if (Status::OK == isZSLModeAvailable(staticMeta, PRIV_REPROCESS)) { + ASSERT_TRUE(hasPrivToY8); + } + if (Status::OK == isZSLModeAvailable(staticMeta, YUV_REPROCESS)) { + ASSERT_TRUE(hasY8ToY8); + ASSERT_TRUE(hasY8ToBlob); + } + } + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Check whether session parameters are supported. If Hal support for them +// exist, then try to configure a preview stream using them. +TEST_P(CameraAidlTest, configureStreamsWithSessionParameters) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputPreviewStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + + std::shared_ptr unusedCameraDevice; + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &unusedCameraDevice /*out*/); + camera_metadata_t* staticMetaBuffer = + reinterpret_cast(meta.metadata.data()); + + std::unordered_set availableSessionKeys; + auto rc = getSupportedKeys(staticMetaBuffer, ANDROID_REQUEST_AVAILABLE_SESSION_KEYS, + &availableSessionKeys); + ASSERT_TRUE(Status::OK == rc); + if (availableSessionKeys.empty()) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + android::hardware::camera::common::V1_0::helper::CameraMetadata previewRequestSettings; + android::hardware::camera::common::V1_0::helper::CameraMetadata sessionParams, + modifiedSessionParams; + constructFilteredSettings(mSession, availableSessionKeys, RequestTemplate::PREVIEW, + &previewRequestSettings, &sessionParams); + if (sessionParams.isEmpty()) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + outputPreviewStreams.clear(); + + ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMetaBuffer, outputPreviewStreams, + &previewThreshold)); + ASSERT_NE(0u, outputPreviewStreams.size()); + + Stream previewStream = { + 0, + StreamType::OUTPUT, + outputPreviewStreams[0].width, + outputPreviewStreams[0].height, + static_cast(outputPreviewStreams[0].format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + /*bufferSize*/ 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + std::vector streams = {previewStream}; + StreamConfiguration config; + + config.streams = streams; + config.operationMode = StreamConfigurationMode::NORMAL_MODE; + modifiedSessionParams = sessionParams; + auto sessionParamsBuffer = sessionParams.release(); + std::vector rawSessionParam = + std::vector(reinterpret_cast(sessionParamsBuffer), + reinterpret_cast(sessionParamsBuffer) + + get_camera_metadata_size(sessionParamsBuffer)); + + config.sessionParams.metadata = rawSessionParam; + config.streamConfigCounter = 0; + config.streams = {previewStream}; + config.streamConfigCounter = 0; + config.multiResolutionInputImage = false; + + bool newSessionParamsAvailable = false; + for (const auto& it : availableSessionKeys) { + if (modifiedSessionParams.exists(it)) { + modifiedSessionParams.erase(it); + newSessionParamsAvailable = true; + break; + } + } + if (newSessionParamsAvailable) { + auto modifiedSessionParamsBuffer = modifiedSessionParams.release(); + verifySessionReconfigurationQuery(mSession, sessionParamsBuffer, + modifiedSessionParamsBuffer); + modifiedSessionParams.acquire(modifiedSessionParamsBuffer); + } + + std::vector halConfigs; + ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(1u, halConfigs.size()); + + sessionParams.acquire(sessionParamsBuffer); + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Verify that all supported preview + still capture stream combinations +// can be configured successfully. +TEST_P(CameraAidlTest, configureStreamsPreviewStillOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputBlobStreams; + std::vector outputPreviewStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + AvailableStream blobThreshold = {INT32_MAX, INT32_MAX, static_cast(PixelFormat::BLOB)}; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + + std::shared_ptr cameraDevice; + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + + // Check if camera support depth only + if (isDepthOnly(staticMeta)) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + outputBlobStreams.clear(); + ASSERT_EQ(Status::OK, + getAvailableOutputStreams(staticMeta, outputBlobStreams, &blobThreshold)); + ASSERT_NE(0u, outputBlobStreams.size()); + + outputPreviewStreams.clear(); + ASSERT_EQ(Status::OK, + getAvailableOutputStreams(staticMeta, outputPreviewStreams, &previewThreshold)); + ASSERT_NE(0u, outputPreviewStreams.size()); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + uint32_t streamConfigCounter = 0; + + for (auto& blobIter : outputBlobStreams) { + for (auto& previewIter : outputPreviewStreams) { + Stream previewStream = { + streamId++, + StreamType::OUTPUT, + previewIter.width, + previewIter.height, + static_cast(previewIter.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + /*bufferSize*/ 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + Stream blobStream = { + streamId++, + StreamType::OUTPUT, + blobIter.width, + blobIter.height, + static_cast(blobIter.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_CPU_READ), + Dataspace::JFIF, + StreamRotation::ROTATION_0, + std::string(), + /*bufferSize*/ 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + std::vector streams = {previewStream, blobStream}; + StreamConfiguration config; + + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + config.streamConfigCounter = streamConfigCounter++; + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, + /*expectStreamCombQuery*/ false); + + std::vector halConfigs; + ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(2u, halConfigs.size()); + } + } + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// In case constrained mode is supported, test whether it can be +// configured. Additionally check for common invalid inputs when +// using this mode. +TEST_P(CameraAidlTest, configureStreamsConstrainedOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr cameraDevice; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + + Status rc = isConstrainedModeAvailable(staticMeta); + if (Status::OPERATION_NOT_SUPPORTED == rc) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + ASSERT_EQ(Status::OK, rc); + + AvailableStream hfrStream; + rc = pickConstrainedModeSize(staticMeta, hfrStream); + ASSERT_EQ(Status::OK, rc); + + int32_t streamId = 0; + uint32_t streamConfigCounter = 0; + Stream stream = {streamId, + StreamType::OUTPUT, + hfrStream.width, + hfrStream.height, + static_cast(hfrStream.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + /*bufferSize*/ 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + std::vector streams = {stream}; + StreamConfiguration config; + createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE, + &config); + + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, + /*expectStreamCombQuery*/ false); + + config.streamConfigCounter = streamConfigCounter++; + std::vector halConfigs; + ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(1u, halConfigs.size()); + ASSERT_EQ(halConfigs[0].id, streamId); + + stream = {streamId++, + StreamType::OUTPUT, + static_cast(0), + static_cast(0), + static_cast(hfrStream.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + /*bufferSize*/ 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE, + &config); + + config.streamConfigCounter = streamConfigCounter++; + std::vector halConfig; + ret = mSession->configureStreams(config, &halConfig); + ASSERT_TRUE(static_cast(Status::ILLEGAL_ARGUMENT) == + ret.getServiceSpecificError() || + static_cast(Status::INTERNAL_ERROR) == ret.getServiceSpecificError()); + + stream = {streamId++, + StreamType::OUTPUT, + INT32_MAX, + INT32_MAX, + static_cast(hfrStream.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + /*bufferSize*/ 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE, + &config); + + config.streamConfigCounter = streamConfigCounter++; + halConfigs.clear(); + ret = mSession->configureStreams(config, &halConfigs); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError()); + + stream = {streamId++, + StreamType::OUTPUT, + hfrStream.width, + hfrStream.height, + static_cast(UINT32_MAX), + static_cast( + GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + /*bufferSize*/ 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE, + &config); + + config.streamConfigCounter = streamConfigCounter++; + halConfigs.clear(); + ret = mSession->configureStreams(config, &halConfigs); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError()); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Verify that all supported video + snapshot stream combinations can +// be configured successfully. +TEST_P(CameraAidlTest, configureStreamsVideoStillOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputBlobStreams; + std::vector outputVideoStreams; + AvailableStream videoThreshold = {kMaxVideoWidth, kMaxVideoHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + AvailableStream blobThreshold = {kMaxVideoWidth, kMaxVideoHeight, + static_cast(PixelFormat::BLOB)}; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr cameraDevice; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + + // Check if camera support depth only + if (isDepthOnly(staticMeta)) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + outputBlobStreams.clear(); + ASSERT_EQ(Status::OK, + getAvailableOutputStreams(staticMeta, outputBlobStreams, &blobThreshold)); + ASSERT_NE(0u, outputBlobStreams.size()); + + outputVideoStreams.clear(); + ASSERT_EQ(Status::OK, + getAvailableOutputStreams(staticMeta, outputVideoStreams, &videoThreshold)); + ASSERT_NE(0u, outputVideoStreams.size()); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + uint32_t streamConfigCounter = 0; + for (auto& blobIter : outputBlobStreams) { + for (auto& videoIter : outputVideoStreams) { + Stream videoStream = { + streamId++, + StreamType::OUTPUT, + videoIter.width, + videoIter.height, + static_cast(videoIter.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + Stream blobStream = { + streamId++, + StreamType::OUTPUT, + blobIter.width, + blobIter.height, + static_cast(blobIter.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_CPU_READ), + Dataspace::JFIF, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + std::vector streams = {videoStream, blobStream}; + StreamConfiguration config; + + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + verifyStreamCombination(cameraDevice, config, /*expectedStatus*/ true, + /*expectStreamCombQuery*/ false); + + config.streamConfigCounter = streamConfigCounter++; + std::vector halConfigs; + ndk::ScopedAStatus ret = mSession->configureStreams(config, &halConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(2u, halConfigs.size()); + } + } + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Generate and verify a camera capture request +TEST_P(CameraAidlTest, processCaptureRequestPreview) { + // TODO(b/220897574): Failing with BUFFER_ERROR + processCaptureRequestInternal(GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, RequestTemplate::PREVIEW, + false /*secureOnlyCameras*/); +} + +// Generate and verify a secure camera capture request +TEST_P(CameraAidlTest, processSecureCaptureRequest) { + processCaptureRequestInternal(GRALLOC1_PRODUCER_USAGE_PROTECTED, RequestTemplate::STILL_CAPTURE, + true /*secureOnlyCameras*/); +} + +TEST_P(CameraAidlTest, processCaptureRequestPreviewStabilization) { + std::unordered_map cameraDeviceToTimeLag; + processPreviewStabilizationCaptureRequestInternal(/*previewStabilizationOn*/ false, + cameraDeviceToTimeLag); + processPreviewStabilizationCaptureRequestInternal(/*previewStabilizationOn*/ true, + cameraDeviceToTimeLag); +} + +// Generate and verify a multi-camera capture request +TEST_P(CameraAidlTest, processMultiCaptureRequestPreview) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::YCBCR_420_888)}; + int64_t bufferId = 1; + uint32_t frameNumber = 1; + std::vector settings; + std::vector emptySettings; + std::string invalidPhysicalId = "-1"; + + for (const auto& name : cameraDeviceNames) { + std::string version, deviceId; + ALOGI("processMultiCaptureRequestPreview: Test device %s", name.c_str()); + ASSERT_TRUE(matchDeviceName(name, mProviderType, &version, &deviceId)); + CameraMetadata metadata; + + std::shared_ptr unusedDevice; + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &metadata /*out*/, + &unusedDevice /*out*/); + + camera_metadata_t* staticMeta = + reinterpret_cast(metadata.metadata.data()); + Status rc = isLogicalMultiCamera(staticMeta); + if (Status::OPERATION_NOT_SUPPORTED == rc) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + ASSERT_EQ(Status::OK, rc); + + std::unordered_set physicalIds; + rc = getPhysicalCameraIds(staticMeta, &physicalIds); + ASSERT_TRUE(Status::OK == rc); + ASSERT_TRUE(physicalIds.size() > 1); + + std::unordered_set physicalRequestKeyIDs; + rc = getSupportedKeys(staticMeta, ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS, + &physicalRequestKeyIDs); + ASSERT_TRUE(Status::OK == rc); + if (physicalRequestKeyIDs.empty()) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + // The logical camera doesn't support any individual physical requests. + continue; + } + + android::hardware::camera::common::V1_0::helper::CameraMetadata defaultPreviewSettings; + android::hardware::camera::common::V1_0::helper::CameraMetadata filteredSettings; + constructFilteredSettings(mSession, physicalRequestKeyIDs, RequestTemplate::PREVIEW, + &defaultPreviewSettings, &filteredSettings); + if (filteredSettings.isEmpty()) { + // No physical device settings in default request. + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + const camera_metadata_t* settingsBuffer = defaultPreviewSettings.getAndLock(); + uint8_t* rawSettingsBuffer = (uint8_t*)settingsBuffer; + settings.assign(rawSettingsBuffer, + rawSettingsBuffer + get_camera_metadata_size(settingsBuffer)); + CameraMetadata settingsMetadata = {settings}; + overrideRotateAndCrop(&settingsMetadata); + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + + // Leave only 2 physical devices in the id set. + auto it = physicalIds.begin(); + std::string physicalDeviceId = *it; + it++; + physicalIds.erase(++it, physicalIds.end()); + ASSERT_EQ(physicalIds.size(), 2u); + + std::vector halStreams; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + Stream previewStream; + std::shared_ptr cb; + + configurePreviewStreams( + name, mProvider, &previewThreshold, physicalIds, &mSession, &previewStream, + &halStreams /*out*/, &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/, 0 /*streamConfigCounter*/, true); + if (mSession == nullptr) { + // stream combination not supported by HAL, skip test for device + continue; + } + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + std::shared_ptr resultQueue = + std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + std::shared_ptr inflightReq = std::make_shared( + static_cast(halStreams.size()), false, supportsPartialResults, + partialResultCount, physicalIds, resultQueue); + + std::vector requests(1); + CaptureRequest& request = requests[0]; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settingsMetadata; + + std::vector& outputBuffers = request.outputBuffers; + + std::vector graphicBuffers; + graphicBuffers.reserve(halStreams.size()); + outputBuffers.resize(halStreams.size()); + size_t k = 0; + for (const auto& halStream : halStreams) { + buffer_handle_t buffer_handle; + if (useHalBufManager) { + outputBuffers[k] = {halStream.id, /*bufferId*/ 0, NativeHandle(), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } else { + allocateGraphicBuffer(previewStream.width, previewStream.height, + android_convertGralloc1To0Usage( + static_cast(halStream.producerUsage), + static_cast(halStream.consumerUsage)), + halStream.overrideFormat, &buffer_handle); + graphicBuffers.push_back(buffer_handle); + outputBuffers[k] = { + halStream.id, bufferId, ::android::makeToAidl(buffer_handle), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + bufferId++; + } + k++; + } + + std::vector camSettings(1); + const camera_metadata_t* filteredSettingsBuffer = filteredSettings.getAndLock(); + uint8_t* rawFilteredSettingsBuffer = (uint8_t*)filteredSettingsBuffer; + camSettings[0].settings = {std::vector( + rawFilteredSettingsBuffer, + rawFilteredSettingsBuffer + get_camera_metadata_size(filteredSettingsBuffer))}; + overrideRotateAndCrop(&camSettings[0].settings); + camSettings[0].fmqSettingsSize = 0; + camSettings[0].physicalCameraId = physicalDeviceId; + + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + request.physicalCameraSettings = camSettings; + + { + std::unique_lock l(mLock); + mInflightMap.clear(); + mInflightMap[frameNumber] = inflightReq; + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ndk::ScopedAStatus returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + + request.frameNumber++; + // Empty settings should be supported after the first call + // for repeating requests. + request.settings.metadata.clear(); + request.physicalCameraSettings[0].settings.metadata.clear(); + // The buffer has been registered to HAL by bufferId, so per + // API contract we should send a null handle for this buffer + request.outputBuffers[0].buffer = NativeHandle(); + mInflightMap.clear(); + inflightReq = std::make_shared( + static_cast(physicalIds.size()), false, supportsPartialResults, + partialResultCount, physicalIds, resultQueue); + mInflightMap[request.frameNumber] = inflightReq; + } + + returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + } + + // Invalid physical camera id should fail process requests + frameNumber++; + camSettings[0].physicalCameraId = invalidPhysicalId; + camSettings[0].settings.metadata = settings; + + request.physicalCameraSettings = camSettings; // Invalid camera settings + returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), + returnStatus.getServiceSpecificError()); + + defaultPreviewSettings.unlock(settingsBuffer); + filteredSettings.unlock(filteredSettingsBuffer); + + if (useHalBufManager) { + std::vector streamIds(halStreams.size()); + for (size_t i = 0; i < streamIds.size(); i++) { + streamIds[i] = halStreams[i].id; + } + verifyBuffersReturned(mSession, streamIds, cb); + } + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Generate and verify an ultra high resolution capture request +TEST_P(CameraAidlTest, processUltraHighResolutionRequest) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + int64_t bufferId = 1; + int32_t frameNumber = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + std::string version, deviceId; + ASSERT_TRUE(matchDeviceName(name, mProviderType, &version, &deviceId)); + CameraMetadata meta; + + std::shared_ptr unusedDevice; + openEmptyDeviceSession(name, mProvider, &mSession, &meta, &unusedDevice); + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + if (!isUltraHighResolution(staticMeta)) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + CameraMetadata req; + android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings; + ndk::ScopedAStatus ret = + mSession->constructDefaultRequestSettings(RequestTemplate::STILL_CAPTURE, &req); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* metadata = + reinterpret_cast(req.metadata.data()); + size_t expectedSize = req.metadata.size(); + int result = validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED)); + + size_t entryCount = get_camera_metadata_entry_count(metadata); + ASSERT_GT(entryCount, 0u); + defaultSettings = metadata; + uint8_t sensorPixelMode = + static_cast(ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION); + ASSERT_EQ(::android::OK, + defaultSettings.update(ANDROID_SENSOR_PIXEL_MODE, &sensorPixelMode, 1)); + + const camera_metadata_t* settingsBuffer = defaultSettings.getAndLock(); + uint8_t* rawSettingsBuffer = (uint8_t*)settingsBuffer; + settings.metadata = std::vector( + rawSettingsBuffer, rawSettingsBuffer + get_camera_metadata_size(settingsBuffer)); + overrideRotateAndCrop(&settings); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + + std::vector halStreams; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + Stream previewStream; + std::shared_ptr cb; + + std::list pixelFormats = {PixelFormat::YCBCR_420_888, PixelFormat::RAW16}; + for (PixelFormat format : pixelFormats) { + configureStreams(name, mProvider, format, &mSession, &previewStream, &halStreams, + &supportsPartialResults, &partialResultCount, &useHalBufManager, &cb, + 0, /*maxResolution*/ true); + ASSERT_NE(mSession, nullptr); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + + std::shared_ptr resultQueue = + std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + std::vector graphicBuffers; + graphicBuffers.reserve(halStreams.size()); + std::shared_ptr inflightReq = std::make_shared( + static_cast(halStreams.size()), false, supportsPartialResults, + partialResultCount, std::unordered_set(), resultQueue); + + std::vector requests(1); + CaptureRequest& request = requests[0]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(halStreams.size()); + + size_t k = 0; + for (const auto& halStream : halStreams) { + buffer_handle_t buffer_handle; + if (useHalBufManager) { + outputBuffers[k] = {halStream.id, 0, + NativeHandle(), BufferStatus::OK, + NativeHandle(), NativeHandle()}; + } else { + allocateGraphicBuffer(previewStream.width, previewStream.height, + android_convertGralloc1To0Usage( + static_cast(halStream.producerUsage), + static_cast(halStream.consumerUsage)), + halStream.overrideFormat, &buffer_handle); + graphicBuffers.push_back(buffer_handle); + outputBuffers[k] = { + halStream.id, bufferId, ::android::makeToAidl(buffer_handle), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + bufferId++; + } + k++; + } + + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settings; + request.inputWidth = 0; + request.inputHeight = 0; + + { + std::unique_lock l(mLock); + mInflightMap.clear(); + mInflightMap[frameNumber] = inflightReq; + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ndk::ScopedAStatus returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + } + if (useHalBufManager) { + std::vector streamIds(halStreams.size()); + for (size_t i = 0; i < streamIds.size(); i++) { + streamIds[i] = halStreams[i].id; + } + verifyBuffersReturned(mSession, streamIds, cb); + } + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } + } +} + +// Generate and verify 10-bit dynamic range request +TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + int64_t bufferId = 1; + int32_t frameNumber = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + std::string version, deviceId; + ASSERT_TRUE(matchDeviceName(name, mProviderType, &version, &deviceId)); + CameraMetadata meta; + std::shared_ptr device; + openEmptyDeviceSession(name, mProvider, &mSession, &meta, &device); + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + if (!is10BitDynamicRangeCapable(staticMeta)) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + std::vector profileList; + get10BitDynamicRangeProfiles(staticMeta, &profileList); + ASSERT_FALSE(profileList.empty()); + + CameraMetadata req; + android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings; + ndk::ScopedAStatus ret = + mSession->constructDefaultRequestSettings(RequestTemplate::STILL_CAPTURE, &req); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* metadata = + reinterpret_cast(req.metadata.data()); + size_t expectedSize = req.metadata.size(); + int result = validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED)); + + size_t entryCount = get_camera_metadata_entry_count(metadata); + ASSERT_GT(entryCount, 0u); + defaultSettings = metadata; + + const camera_metadata_t* settingsBuffer = defaultSettings.getAndLock(); + uint8_t* rawSettingsBuffer = (uint8_t*)settingsBuffer; + settings.metadata = std::vector( + rawSettingsBuffer, rawSettingsBuffer + get_camera_metadata_size(settingsBuffer)); + overrideRotateAndCrop(&settings); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + + std::vector halStreams; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + Stream previewStream; + std::shared_ptr cb; + for (const auto& profile : profileList) { + configureStreams(name, mProvider, PixelFormat::IMPLEMENTATION_DEFINED, &mSession, + &previewStream, &halStreams, &supportsPartialResults, + &partialResultCount, &useHalBufManager, &cb, 0, + /*maxResolution*/ false, profile); + ASSERT_NE(mSession, nullptr); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + + std::shared_ptr resultQueue = + std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + std::vector graphicBuffers; + graphicBuffers.reserve(halStreams.size()); + + std::shared_ptr inflightReq = std::make_shared( + static_cast(halStreams.size()), false, supportsPartialResults, + partialResultCount, std::unordered_set(), resultQueue); + + std::vector requests(1); + CaptureRequest& request = requests[0]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(halStreams.size()); + + size_t k = 0; + for (const auto& halStream : halStreams) { + buffer_handle_t buffer_handle; + if (useHalBufManager) { + outputBuffers[k] = {halStream.id, 0, + NativeHandle(), BufferStatus::OK, + NativeHandle(), NativeHandle()}; + } else { + allocateGraphicBuffer(previewStream.width, previewStream.height, + android_convertGralloc1To0Usage( + static_cast(halStream.producerUsage), + static_cast(halStream.consumerUsage)), + halStream.overrideFormat, &buffer_handle); + + graphicBuffers.push_back(buffer_handle); + outputBuffers[k] = { + halStream.id, bufferId, android::makeToAidl(buffer_handle), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + bufferId++; + } + k++; + } + + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settings; + request.inputWidth = 0; + request.inputHeight = 0; + + { + std::unique_lock l(mLock); + mInflightMap.clear(); + mInflightMap[frameNumber] = inflightReq; + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ndk::ScopedAStatus returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + verify10BitMetadata(mHandleImporter, *inflightReq, profile); + } + if (useHalBufManager) { + std::vector streamIds(halStreams.size()); + for (size_t i = 0; i < streamIds.size(); i++) { + streamIds[i] = halStreams[i].id; + } + mSession->signalStreamFlush(streamIds, /*streamConfigCounter*/ 0); + cb->waitForBuffersReturned(); + } + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } + } +} + +// Generate and verify a burst containing alternating sensor sensitivity values +TEST_P(CameraAidlTest, processCaptureRequestBurstISO) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + int64_t bufferId = 1; + int32_t frameNumber = 1; + float isoTol = .03f; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + settings.metadata.clear(); + std::shared_ptr unusedDevice; + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &unusedDevice /*out*/); + camera_metadata_t* staticMetaBuffer = + clone_camera_metadata(reinterpret_cast(meta.metadata.data())); + ::android::hardware::camera::common::V1_0::helper::CameraMetadata staticMeta( + staticMetaBuffer); + + camera_metadata_entry_t hwLevel = staticMeta.find(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL); + ASSERT_TRUE(0 < hwLevel.count); + if (ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED == hwLevel.data.u8[0] || + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL == hwLevel.data.u8[0]) { + // Limited/External devices can skip this test + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + camera_metadata_entry_t isoRange = staticMeta.find(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE); + ASSERT_EQ(isoRange.count, 2u); + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + Stream previewStream; + std::vector halStreams; + std::shared_ptr cb; + configurePreviewStream(name, mProvider, &previewThreshold, &mSession /*out*/, + &previewStream /*out*/, &halStreams /*out*/, + &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + std::shared_ptr resultQueue = + std::make_shared(descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + ret = mSession->constructDefaultRequestSettings(RequestTemplate::PREVIEW, &settings); + ASSERT_TRUE(ret.isOk()); + + ::android::hardware::camera::common::V1_0::helper::CameraMetadata requestMeta; + std::vector requests(kBurstFrameCount); + std::vector buffers(kBurstFrameCount); + std::vector> inflightReqs(kBurstFrameCount); + std::vector isoValues(kBurstFrameCount); + std::vector requestSettings(kBurstFrameCount); + + for (int32_t i = 0; i < kBurstFrameCount; i++) { + std::unique_lock l(mLock); + CaptureRequest& request = requests[i]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(1); + StreamBuffer& outputBuffer = outputBuffers[0]; + + isoValues[i] = ((i % 2) == 0) ? isoRange.data.i32[0] : isoRange.data.i32[1]; + if (useHalBufManager) { + outputBuffer = {halStreams[0].id, 0, + NativeHandle(), BufferStatus::OK, + NativeHandle(), NativeHandle()}; + } else { + allocateGraphicBuffer(previewStream.width, previewStream.height, + android_convertGralloc1To0Usage( + static_cast(halStreams[0].producerUsage), + static_cast(halStreams[0].consumerUsage)), + halStreams[0].overrideFormat, &buffers[i]); + outputBuffer = {halStreams[0].id, bufferId + i, ::android::makeToAidl(buffers[i]), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } + + requestMeta.append(reinterpret_cast(settings.metadata.data())); + + // Disable all 3A routines + uint8_t mode = static_cast(ANDROID_CONTROL_MODE_OFF); + ASSERT_EQ(::android::OK, requestMeta.update(ANDROID_CONTROL_MODE, &mode, 1)); + ASSERT_EQ(::android::OK, + requestMeta.update(ANDROID_SENSOR_SENSITIVITY, &isoValues[i], 1)); + camera_metadata_t* metaBuffer = requestMeta.release(); + uint8_t* rawMetaBuffer = reinterpret_cast(metaBuffer); + requestSettings[i].metadata = std::vector( + rawMetaBuffer, rawMetaBuffer + get_camera_metadata_size(metaBuffer)); + overrideRotateAndCrop(&(requestSettings[i])); + + request.frameNumber = frameNumber + i; + request.fmqSettingsSize = 0; + request.settings = requestSettings[i]; + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + + inflightReqs[i] = std::make_shared(1, false, supportsPartialResults, + partialResultCount, resultQueue); + mInflightMap[frameNumber + i] = inflightReqs[i]; + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + + ndk::ScopedAStatus returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, kBurstFrameCount); + + for (size_t i = 0; i < kBurstFrameCount; i++) { + std::unique_lock l(mLock); + while (!inflightReqs[i]->errorCodeValid && ((0 < inflightReqs[i]->numBuffersLeft) || + (!inflightReqs[i]->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReqs[i]->errorCodeValid); + ASSERT_NE(inflightReqs[i]->resultOutputBuffers.size(), 0u); + ASSERT_EQ(previewStream.id, inflightReqs[i]->resultOutputBuffers[0].buffer.streamId); + ASSERT_FALSE(inflightReqs[i]->collectedResult.isEmpty()); + ASSERT_TRUE(inflightReqs[i]->collectedResult.exists(ANDROID_SENSOR_SENSITIVITY)); + camera_metadata_entry_t isoResult = + inflightReqs[i]->collectedResult.find(ANDROID_SENSOR_SENSITIVITY); + ASSERT_TRUE(std::abs(isoResult.data.i32[0] - isoValues[i]) <= + std::round(isoValues[i] * isoTol)); + } + + if (useHalBufManager) { + verifyBuffersReturned(mSession, previewStream.id, cb); + } + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Test whether an incorrect capture request with missing settings will +// be reported correctly. +TEST_P(CameraAidlTest, processCaptureRequestInvalidSinglePreview) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputPreviewStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + int64_t bufferId = 1; + int32_t frameNumber = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + Stream previewStream; + std::vector halStreams; + std::shared_ptr cb; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + configurePreviewStream(name, mProvider, &previewThreshold, &mSession /*out*/, + &previewStream /*out*/, &halStreams /*out*/, + &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/); + ASSERT_NE(mSession, nullptr); + ASSERT_FALSE(halStreams.empty()); + + buffer_handle_t buffer_handle = nullptr; + + if (useHalBufManager) { + bufferId = 0; + } else { + allocateGraphicBuffer(previewStream.width, previewStream.height, + android_convertGralloc1To0Usage( + static_cast(halStreams[0].producerUsage), + static_cast(halStreams[0].consumerUsage)), + halStreams[0].overrideFormat, &buffer_handle); + } + + std::vector requests(1); + CaptureRequest& request = requests[0]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(1); + StreamBuffer& outputBuffer = outputBuffers[0]; + + outputBuffer = { + halStreams[0].id, + bufferId, + buffer_handle == nullptr ? NativeHandle() : ::android::makeToAidl(buffer_handle), + BufferStatus::OK, + NativeHandle(), + NativeHandle()}; + + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settings; + + // Settings were not correctly initialized, we should fail here + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ndk::ScopedAStatus ret = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError()); + ASSERT_EQ(numRequestProcessed, 0u); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Verify camera offline session behavior +TEST_P(CameraAidlTest, switchToOffline) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + AvailableStream threshold = {kMaxStillWidth, kMaxStillHeight, + static_cast(PixelFormat::BLOB)}; + int64_t bufferId = 1; + int32_t frameNumber = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + { + std::shared_ptr unusedDevice; + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &unusedDevice); + camera_metadata_t* staticMetaBuffer = clone_camera_metadata( + reinterpret_cast(meta.metadata.data())); + ::android::hardware::camera::common::V1_0::helper::CameraMetadata staticMeta( + staticMetaBuffer); + + if (isOfflineSessionSupported(staticMetaBuffer) != Status::OK) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } + + bool supportsPartialResults = false; + int32_t partialResultCount = 0; + Stream stream; + std::vector halStreams; + std::shared_ptr cb; + int32_t jpegBufferSize; + bool useHalBufManager; + configureOfflineStillStream(name, mProvider, &threshold, &mSession /*out*/, &stream /*out*/, + &halStreams /*out*/, &supportsPartialResults /*out*/, + &partialResultCount /*out*/, &cb /*out*/, + &jpegBufferSize /*out*/, &useHalBufManager /*out*/); + + auto ret = mSession->constructDefaultRequestSettings(RequestTemplate::STILL_CAPTURE, + &settings); + ASSERT_TRUE(ret.isOk()); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + + ndk::ScopedAStatus resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + std::shared_ptr resultQueue = + std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + ::android::hardware::camera::common::V1_0::helper::CameraMetadata requestMeta; + + std::vector buffers(kBurstFrameCount); + std::vector> inflightReqs(kBurstFrameCount); + std::vector requestSettings(kBurstFrameCount); + + std::vector requests(kBurstFrameCount); + + HalStream halStream = halStreams[0]; + for (uint32_t i = 0; i < kBurstFrameCount; i++) { + CaptureRequest& request = requests[i]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(1); + StreamBuffer& outputBuffer = outputBuffers[0]; + + std::unique_lock l(mLock); + if (useHalBufManager) { + outputBuffer = {halStream.id, 0, NativeHandle(), BufferStatus::OK, NativeHandle(), + NativeHandle()}; + } else { + // jpeg buffer (w,h) = (blobLen, 1) + allocateGraphicBuffer(jpegBufferSize, /*height*/ 1, + android_convertGralloc1To0Usage( + static_cast(halStream.producerUsage), + static_cast(halStream.consumerUsage)), + halStream.overrideFormat, &buffers[i]); + outputBuffer = {halStream.id, bufferId + i, ::android::makeToAidl(buffers[i]), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } + + requestMeta.clear(); + requestMeta.append(reinterpret_cast(settings.metadata.data())); + + camera_metadata_t* metaBuffer = requestMeta.release(); + uint8_t* rawMetaBuffer = reinterpret_cast(metaBuffer); + requestSettings[i].metadata = std::vector( + rawMetaBuffer, rawMetaBuffer + get_camera_metadata_size(metaBuffer)); + overrideRotateAndCrop(&requestSettings[i]); + + request.frameNumber = frameNumber + i; + request.fmqSettingsSize = 0; + request.settings = requestSettings[i]; + request.inputBuffer = {/*streamId*/ -1, + /*bufferId*/ 0, NativeHandle(), + BufferStatus::ERROR, NativeHandle(), + NativeHandle()}; + + inflightReqs[i] = std::make_shared(1, false, supportsPartialResults, + partialResultCount, resultQueue); + mInflightMap[frameNumber + i] = inflightReqs[i]; + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + + ndk::ScopedAStatus returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, kBurstFrameCount); + + std::vector offlineStreamIds = {halStream.id}; + CameraOfflineSessionInfo offlineSessionInfo; + std::shared_ptr offlineSession; + returnStatus = + mSession->switchToOffline(offlineStreamIds, &offlineSessionInfo, &offlineSession); + + if (!halStreams[0].supportOffline) { + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), + returnStatus.getServiceSpecificError()); + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + ASSERT_TRUE(returnStatus.isOk()); + // Hal might be unable to find any requests qualified for offline mode. + if (offlineSession == nullptr) { + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + ASSERT_EQ(offlineSessionInfo.offlineStreams.size(), 1u); + ASSERT_EQ(offlineSessionInfo.offlineStreams[0].id, halStream.id); + ASSERT_NE(offlineSessionInfo.offlineRequests.size(), 0u); + + // close device session to make sure offline session does not rely on it + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + offlineResultDescriptor; + + auto offlineResultQueueRet = + offlineSession->getCaptureResultMetadataQueue(&offlineResultDescriptor); + std::shared_ptr offlineResultQueue = + std::make_shared(descriptor); + if (!offlineResultQueue->isValid() || offlineResultQueue->availableToWrite() <= 0) { + ALOGE("%s: offline session returns empty result metadata fmq, not use it", __func__); + offlineResultQueue = nullptr; + // Don't use the queue onwards. + } + ASSERT_TRUE(offlineResultQueueRet.isOk()); + + updateInflightResultQueue(offlineResultQueue); + + ret = offlineSession->setCallback(cb); + ASSERT_TRUE(ret.isOk()); + + for (size_t i = 0; i < kBurstFrameCount; i++) { + std::unique_lock l(mLock); + while (!inflightReqs[i]->errorCodeValid && ((0 < inflightReqs[i]->numBuffersLeft) || + (!inflightReqs[i]->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReqs[i]->errorCodeValid); + ASSERT_NE(inflightReqs[i]->resultOutputBuffers.size(), 0u); + ASSERT_EQ(stream.id, inflightReqs[i]->resultOutputBuffers[0].buffer.streamId); + ASSERT_FALSE(inflightReqs[i]->collectedResult.isEmpty()); + } + + ret = offlineSession->close(); + ASSERT_TRUE(ret.isOk()); + } +} + +// Check whether an invalid capture request with missing output buffers +// will be reported correctly. +TEST_P(CameraAidlTest, processCaptureRequestInvalidBuffer) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputBlobStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + int32_t frameNumber = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + Stream previewStream; + std::vector halStreams; + std::shared_ptr cb; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + configurePreviewStream(name, mProvider, &previewThreshold, &mSession /*out*/, + &previewStream /*out*/, &halStreams /*out*/, + &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/); + + RequestTemplate reqTemplate = RequestTemplate::PREVIEW; + ndk::ScopedAStatus ret = mSession->constructDefaultRequestSettings(reqTemplate, &settings); + ASSERT_TRUE(ret.isOk()); + overrideRotateAndCrop(&settings); + + std::vector requests(1); + CaptureRequest& request = requests[0]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(1); + // Empty output buffer + outputBuffers[0] = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settings; + + // Output buffers are missing, we should fail here + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ret = mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError()); + ASSERT_EQ(numRequestProcessed, 0u); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Generate, trigger and flush a preview request +TEST_P(CameraAidlTest, flushPreviewRequest) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputPreviewStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + int64_t bufferId = 1; + int32_t frameNumber = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + Stream previewStream; + std::vector halStreams; + std::shared_ptr cb; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + + configurePreviewStream(name, mProvider, &previewThreshold, &mSession /*out*/, + &previewStream /*out*/, &halStreams /*out*/, + &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/); + + ASSERT_NE(mSession, nullptr); + ASSERT_NE(cb, nullptr); + ASSERT_FALSE(halStreams.empty()); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + + auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + std::shared_ptr resultQueue = + std::make_shared(descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + std::shared_ptr inflightReq = std::make_shared( + 1, false, supportsPartialResults, partialResultCount, resultQueue); + RequestTemplate reqTemplate = RequestTemplate::PREVIEW; + + ndk::ScopedAStatus ret = mSession->constructDefaultRequestSettings(reqTemplate, &settings); + ASSERT_TRUE(ret.isOk()); + overrideRotateAndCrop(&settings); + + buffer_handle_t buffer_handle; + std::vector requests(1); + CaptureRequest& request = requests[0]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(1); + StreamBuffer& outputBuffer = outputBuffers[0]; + if (useHalBufManager) { + bufferId = 0; + outputBuffer = {halStreams[0].id, bufferId, NativeHandle(), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } else { + allocateGraphicBuffer(previewStream.width, previewStream.height, + android_convertGralloc1To0Usage( + static_cast(halStreams[0].producerUsage), + static_cast(halStreams[0].consumerUsage)), + halStreams[0].overrideFormat, &buffer_handle); + outputBuffer = {halStreams[0].id, bufferId, ::android::makeToAidl(buffer_handle), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } + + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settings; + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + + { + std::unique_lock l(mLock); + mInflightMap.clear(); + mInflightMap[frameNumber] = inflightReq; + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ret = mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + // Flush before waiting for request to complete. + ndk::ScopedAStatus returnStatus = mSession->flush(); + ASSERT_TRUE(returnStatus.isOk()); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + if (!inflightReq->errorCodeValid) { + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + ASSERT_EQ(previewStream.id, inflightReq->resultOutputBuffers[0].buffer.streamId); + } else { + switch (inflightReq->errorCode) { + case ErrorCode::ERROR_REQUEST: + case ErrorCode::ERROR_RESULT: + case ErrorCode::ERROR_BUFFER: + // Expected + break; + case ErrorCode::ERROR_DEVICE: + default: + FAIL() << "Unexpected error:" + << static_cast(inflightReq->errorCode); + } + } + } + + if (useHalBufManager) { + verifyBuffersReturned(mSession, previewStream.id, cb); + } + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Verify that camera flushes correctly without any pending requests. +TEST_P(CameraAidlTest, flushEmpty) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputPreviewStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + + for (const auto& name : cameraDeviceNames) { + Stream previewStream; + std::vector halStreams; + std::shared_ptr cb; + bool supportsPartialResults = false; + bool useHalBufManager = false; + + int32_t partialResultCount = 0; + configurePreviewStream(name, mProvider, &previewThreshold, &mSession /*out*/, + &previewStream /*out*/, &halStreams /*out*/, + &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/); + + ndk::ScopedAStatus returnStatus = mSession->flush(); + ASSERT_TRUE(returnStatus.isOk()); + + { + std::unique_lock l(mLock); + auto timeout = std::chrono::system_clock::now() + + std::chrono::milliseconds(kEmptyFlushTimeoutMSec); + ASSERT_EQ(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +// Test camera provider notify method +TEST_P(CameraAidlTest, providerDeviceStateNotification) { + notifyDeviceState(ICameraProvider::DEVICE_STATE_BACK_COVERED); + notifyDeviceState(ICameraProvider::DEVICE_STATE_NORMAL); +} + +// Verify that all supported stream formats and sizes can be configured +// successfully for injection camera. +TEST_P(CameraAidlTest, configureInjectionStreamsAvailableOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputStreams; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata metadata; + + std::shared_ptr injectionSession; + std::shared_ptr unusedDevice; + openEmptyInjectionSession(name, mProvider, &injectionSession /*out*/, &metadata /*out*/, + &unusedDevice /*out*/); + if (injectionSession == nullptr) { + continue; + } + + camera_metadata_t* staticMetaBuffer = + reinterpret_cast(metadata.metadata.data()); + CameraMetadata chars; + chars.metadata = metadata.metadata; + + outputStreams.clear(); + ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMetaBuffer, outputStreams)); + ASSERT_NE(0u, outputStreams.size()); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMetaBuffer, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + int32_t streamConfigCounter = 0; + for (auto& it : outputStreams) { + Dataspace dataspace = getDataspace(static_cast(it.format)); + Stream stream = {streamId, + StreamType::OUTPUT, + it.width, + it.height, + static_cast(it.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + dataspace, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + 0, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + std::vector streams = {stream}; + StreamConfiguration config; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + + config.streamConfigCounter = streamConfigCounter++; + ndk::ScopedAStatus s = injectionSession->configureInjectionStreams(config, chars); + ASSERT_TRUE(s.isOk()); + streamId++; + } + + std::shared_ptr session; + ndk::ScopedAStatus ret = injectionSession->getCameraDeviceSession(&session); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(session, nullptr); + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + } +} + +// Check for correct handling of invalid/incorrect configuration parameters for injection camera. +TEST_P(CameraAidlTest, configureInjectionStreamsInvalidOutputs) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputStreams; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata metadata; + std::shared_ptr injectionSession; + std::shared_ptr unusedDevice; + openEmptyInjectionSession(name, mProvider, &injectionSession /*out*/, &metadata /*out*/, + &unusedDevice); + if (injectionSession == nullptr) { + continue; + } + + camera_metadata_t* staticMetaBuffer = + reinterpret_cast(metadata.metadata.data()); + std::shared_ptr session; + ndk::ScopedAStatus ret = injectionSession->getCameraDeviceSession(&session); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(session, nullptr); + + CameraMetadata chars; + chars.metadata = metadata.metadata; + + outputStreams.clear(); + ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMetaBuffer, outputStreams)); + ASSERT_NE(0u, outputStreams.size()); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMetaBuffer, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + int32_t streamId = 0; + Stream stream = {streamId++, + StreamType::OUTPUT, + 0, + 0, + static_cast(outputStreams[0].format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + 0, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + int32_t streamConfigCounter = 0; + std::vector streams = {stream}; + StreamConfiguration config; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + + config.streamConfigCounter = streamConfigCounter++; + ndk::ScopedAStatus s = injectionSession->configureInjectionStreams(config, chars); + ASSERT_TRUE( + (static_cast(Status::ILLEGAL_ARGUMENT) == s.getServiceSpecificError()) || + (static_cast(Status::INTERNAL_ERROR) == s.getServiceSpecificError())); + + stream = {streamId++, + StreamType::OUTPUT, + INT32_MAX, + INT32_MAX, + static_cast(outputStreams[0].format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + 0, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + config.streamConfigCounter = streamConfigCounter++; + s = injectionSession->configureInjectionStreams(config, chars); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), s.getServiceSpecificError()); + + for (auto& it : outputStreams) { + stream = {streamId++, + StreamType::OUTPUT, + it.width, + it.height, + static_cast(INT32_MAX), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + jpegBufferSize, + 0, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + config.streamConfigCounter = streamConfigCounter++; + s = injectionSession->configureInjectionStreams(config, chars); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), s.getServiceSpecificError()); + + stream = {streamId++, + StreamType::OUTPUT, + it.width, + it.height, + static_cast(it.format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + static_cast(INT32_MAX), + std::string(), + jpegBufferSize, + 0, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + streams[0] = stream; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + config.streamConfigCounter = streamConfigCounter++; + s = injectionSession->configureInjectionStreams(config, chars); + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), s.getServiceSpecificError()); + } + + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + } +} + +// Check whether session parameters are supported for injection camera. If Hal support for them +// exist, then try to configure a preview stream using them. +TEST_P(CameraAidlTest, configureInjectionStreamsWithSessionParameters) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputPreviewStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata metadata; + std::shared_ptr injectionSession; + std::shared_ptr unusedDevice; + openEmptyInjectionSession(name, mProvider, &injectionSession /*out*/, &metadata /*out*/, + &unusedDevice /*out*/); + if (injectionSession == nullptr) { + continue; + } + + std::shared_ptr session; + ndk::ScopedAStatus ret = injectionSession->getCameraDeviceSession(&session); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(session, nullptr); + + camera_metadata_t* staticMetaBuffer = + reinterpret_cast(metadata.metadata.data()); + CameraMetadata chars; + chars.metadata = metadata.metadata; + + std::unordered_set availableSessionKeys; + Status rc = getSupportedKeys(staticMetaBuffer, ANDROID_REQUEST_AVAILABLE_SESSION_KEYS, + &availableSessionKeys); + ASSERT_EQ(Status::OK, rc); + if (availableSessionKeys.empty()) { + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + continue; + } + + android::hardware::camera::common::V1_0::helper::CameraMetadata previewRequestSettings; + android::hardware::camera::common::V1_0::helper::CameraMetadata sessionParams, + modifiedSessionParams; + constructFilteredSettings(session, availableSessionKeys, RequestTemplate::PREVIEW, + &previewRequestSettings, &sessionParams); + if (sessionParams.isEmpty()) { + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + continue; + } + + outputPreviewStreams.clear(); + + ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMetaBuffer, outputPreviewStreams, + &previewThreshold)); + ASSERT_NE(0u, outputPreviewStreams.size()); + + Stream previewStream = { + 0, + StreamType::OUTPUT, + outputPreviewStreams[0].width, + outputPreviewStreams[0].height, + static_cast(outputPreviewStreams[0].format), + static_cast<::aidl::android::hardware::graphics::common::BufferUsage>( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + 0, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + std::vector streams = {previewStream}; + StreamConfiguration config; + config.streams = streams; + config.operationMode = StreamConfigurationMode::NORMAL_MODE; + + modifiedSessionParams = sessionParams; + camera_metadata_t* sessionParamsBuffer = sessionParams.release(); + uint8_t* rawSessionParamsBuffer = reinterpret_cast(sessionParamsBuffer); + config.sessionParams.metadata = + std::vector(rawSessionParamsBuffer, + rawSessionParamsBuffer + get_camera_metadata_size(sessionParamsBuffer)); + + config.streamConfigCounter = 0; + config.streamConfigCounter = 0; + config.multiResolutionInputImage = false; + + ndk::ScopedAStatus s = injectionSession->configureInjectionStreams(config, chars); + ASSERT_TRUE(s.isOk()); + + sessionParams.acquire(sessionParamsBuffer); + free_camera_metadata(staticMetaBuffer); + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + } +} + +// Verify that valid stream use cases can be configured successfully, and invalid use cases +// fail stream configuration. +TEST_P(CameraAidlTest, configureStreamsUseCases) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr cameraDevice; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + // Check if camera support depth only + if (isDepthOnly(staticMeta)) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + std::vector outputPreviewStreams; + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::YCBCR_420_888)}; + ASSERT_EQ(Status::OK, + getAvailableOutputStreams(staticMeta, outputPreviewStreams, &previewThreshold)); + ASSERT_NE(0u, outputPreviewStreams.size()); + + // Combine valid and invalid stream use cases + std::vector useCases(kMandatoryUseCases); + useCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL + 1); + + std::vector supportedUseCases; + camera_metadata_ro_entry entry; + auto retcode = find_camera_metadata_ro_entry( + staticMeta, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES, &entry); + if ((0 == retcode) && (entry.count > 0)) { + supportedUseCases.insert(supportedUseCases.end(), entry.data.i64, + entry.data.i64 + entry.count); + } else { + supportedUseCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT); + } + + std::vector streams(1); + streams[0] = {0, + StreamType::OUTPUT, + outputPreviewStreams[0].width, + outputPreviewStreams[0].height, + static_cast(outputPreviewStreams[0].format), + static_cast<::aidl::android::hardware::graphics::common::BufferUsage>( + GRALLOC1_CONSUMER_USAGE_CPU_READ), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + 0, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + int32_t streamConfigCounter = 0; + CameraMetadata req; + StreamConfiguration config; + RequestTemplate reqTemplate = RequestTemplate::STILL_CAPTURE; + ndk::ScopedAStatus ret = mSession->constructDefaultRequestSettings(reqTemplate, &req); + ASSERT_TRUE(ret.isOk()); + config.sessionParams = req; + + for (int64_t useCase : useCases) { + bool useCaseSupported = std::find(supportedUseCases.begin(), supportedUseCases.end(), + useCase) != supportedUseCases.end(); + + streams[0].useCase = static_cast< + aidl::android::hardware::camera::metadata::ScalerAvailableStreamUseCases>( + useCase); + config.streams = streams; + config.operationMode = StreamConfigurationMode::NORMAL_MODE; + config.streamConfigCounter = streamConfigCounter; + config.multiResolutionInputImage = false; + + bool combSupported; + ret = cameraDevice->isStreamCombinationSupported(config, &combSupported); + if (static_cast(Status::OPERATION_NOT_SUPPORTED) == + ret.getServiceSpecificError()) { + continue; + } + + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(combSupported, useCaseSupported); + + std::vector halStreams; + ret = mSession->configureStreams(config, &halStreams); + ALOGI("configureStreams returns status: %d", ret.getServiceSpecificError()); + if (useCaseSupported) { + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(1u, halStreams.size()); + } else { + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), + ret.getServiceSpecificError()); + } + } + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CameraAidlTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, CameraAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(ICameraProvider::descriptor)), + android::hardware::PrintInstanceNameToString); \ No newline at end of file diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c11fc0cd2bf9c4aa3dcb2039c768db6d27c13236 --- /dev/null +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -0,0 +1,2925 @@ +/* + * Copyright (C) 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. + */ + +#include "camera_aidl_test.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using ::aidl::android::hardware::camera::common::CameraDeviceStatus; +using ::aidl::android::hardware::camera::common::TorchModeStatus; +using ::aidl::android::hardware::camera::device::CameraMetadata; +using ::aidl::android::hardware::camera::device::ICameraDevice; +using ::aidl::android::hardware::camera::metadata::CameraMetadataTag; +using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap; +using ::aidl::android::hardware::camera::metadata::SensorInfoColorFilterArrangement; +using ::aidl::android::hardware::camera::metadata::SensorPixelMode; +using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback; +using ::aidl::android::hardware::camera::provider::ConcurrentCameraIdCombination; +using ::aidl::android::hardware::camera::provider::ICameraProvider; +using ::aidl::android::hardware::common::NativeHandle; +using ::android::hardware::camera::common::V1_0::helper::Size; +using ::ndk::ScopedAStatus; +using ::ndk::SpAIBinder; + +namespace { +bool parseProviderName(const std::string& serviceDescriptor, std::string* type /*out*/, + uint32_t* id /*out*/) { + if (!type || !id) { + ADD_FAILURE(); + return false; + } + + // expected format: // + std::string::size_type slashIdx1 = serviceDescriptor.find('/'); + if (slashIdx1 == std::string::npos || slashIdx1 == serviceDescriptor.size() - 1) { + ADD_FAILURE() << "Provider name does not have / separator between name, type, and id"; + return false; + } + + std::string::size_type slashIdx2 = serviceDescriptor.find('/', slashIdx1 + 1); + if (slashIdx2 == std::string::npos || slashIdx2 == serviceDescriptor.size() - 1) { + ADD_FAILURE() << "Provider name does not have / separator between type and id"; + return false; + } + + std::string typeVal = serviceDescriptor.substr(slashIdx1 + 1, slashIdx2 - slashIdx1 - 1); + + char* endPtr; + errno = 0; + int64_t idVal = strtol(serviceDescriptor.c_str() + slashIdx2 + 1, &endPtr, 10); + if (errno != 0) { + ADD_FAILURE() << "cannot parse provider id as an integer:" << serviceDescriptor.c_str() + << strerror(errno) << errno; + return false; + } + if (endPtr != serviceDescriptor.c_str() + serviceDescriptor.size()) { + ADD_FAILURE() << "provider id has unexpected length " << serviceDescriptor.c_str(); + return false; + } + if (idVal < 0) { + ADD_FAILURE() << "id is negative: " << serviceDescriptor.c_str() << idVal; + return false; + } + + *type = typeVal; + *id = static_cast(idVal); + + return true; +} + +const std::vector kMandatoryUseCases = { + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL}; +} // namespace + +void CameraAidlTest::SetUp() { + std::string serviceDescriptor = GetParam(); + ALOGI("get service with name: %s", serviceDescriptor.c_str()); + + bool success = ABinderProcess_setThreadPoolMaxThreadCount(5); + ALOGI("ABinderProcess_setThreadPoolMaxThreadCount returns %s", success ? "true" : "false"); + ASSERT_TRUE(success); + ABinderProcess_startThreadPool(); + + SpAIBinder cameraProviderBinder = + SpAIBinder(AServiceManager_getService(serviceDescriptor.c_str())); + ASSERT_NE(cameraProviderBinder.get(), nullptr); + + std::shared_ptr cameraProvider = + ICameraProvider::fromBinder(cameraProviderBinder); + ASSERT_NE(cameraProvider.get(), nullptr); + mProvider = cameraProvider; + uint32_t id; + ASSERT_TRUE(parseProviderName(serviceDescriptor, &mProviderType, &id)); + + notifyDeviceState(ICameraProvider::DEVICE_STATE_NORMAL); +} + +void CameraAidlTest::TearDown() { + if (mSession != nullptr) { + ndk::ScopedAStatus ret = mSession->close(); + ASSERT_TRUE(ret.isOk()); + } +} + +std::vector CameraAidlTest::getCameraDeviceNames( + std::shared_ptr& provider, bool addSecureOnly) { + std::vector cameraDeviceNames; + + ScopedAStatus ret = provider->getCameraIdList(&cameraDeviceNames); + if (!ret.isOk()) { + ADD_FAILURE() << "Could not get camera id list"; + } + + // External camera devices are reported through cameraDeviceStatusChange + struct ProviderCb : public BnCameraProviderCallback { + ScopedAStatus cameraDeviceStatusChange(const std::string& devName, + CameraDeviceStatus newStatus) override { + ALOGI("camera device status callback name %s, status %d", devName.c_str(), + (int)newStatus); + if (newStatus == CameraDeviceStatus::PRESENT) { + externalCameraDeviceNames.push_back(devName); + } + return ScopedAStatus::ok(); + } + + ScopedAStatus torchModeStatusChange(const std::string&, TorchModeStatus) override { + return ScopedAStatus::ok(); + } + + ScopedAStatus physicalCameraDeviceStatusChange( + const std::string&, const std::string&, + ::aidl::android::hardware::camera::common::CameraDeviceStatus) override { + return ndk::ScopedAStatus(); + } + + std::vector externalCameraDeviceNames; + }; + std::shared_ptr cb = ndk::SharedRefBase::make(); + auto status = mProvider->setCallback(cb); + + for (const auto& devName : cb->externalCameraDeviceNames) { + if (cameraDeviceNames.end() == + std::find(cameraDeviceNames.begin(), cameraDeviceNames.end(), devName)) { + cameraDeviceNames.push_back(devName); + } + } + + std::vector retList; + for (auto& cameraDeviceName : cameraDeviceNames) { + bool isSecureOnlyCamera = isSecureOnly(mProvider, cameraDeviceName); + if (addSecureOnly) { + if (isSecureOnlyCamera) { + retList.emplace_back(cameraDeviceName); + } + } else if (!isSecureOnlyCamera) { + retList.emplace_back(cameraDeviceName); + } + } + return retList; +} + +bool CameraAidlTest::isSecureOnly(const std::shared_ptr& provider, + const std::string& name) { + std::shared_ptr cameraDevice = nullptr; + ScopedAStatus retInterface = provider->getCameraDeviceInterface(name, &cameraDevice); + if (!retInterface.isOk()) { + ADD_FAILURE() << "Failed to get camera device interface for " << name; + } + + CameraMetadata cameraCharacteristics; + ScopedAStatus retChars = cameraDevice->getCameraCharacteristics(&cameraCharacteristics); + if (!retChars.isOk()) { + ADD_FAILURE() << "Failed to get camera characteristics for device " << name; + } + + camera_metadata_t* chars = + reinterpret_cast(cameraCharacteristics.metadata.data()); + + SystemCameraKind systemCameraKind = SystemCameraKind::PUBLIC; + Status retCameraKind = getSystemCameraKind(chars, &systemCameraKind); + if (retCameraKind != Status::OK) { + ADD_FAILURE() << "Failed to get camera kind for " << name; + } + + return systemCameraKind == SystemCameraKind::HIDDEN_SECURE_CAMERA; +} + +std::map CameraAidlTest::getCameraDeviceIdToNameMap( + std::shared_ptr provider) { + std::vector cameraDeviceNames = getCameraDeviceNames(provider); + + std::map idToNameMap; + for (auto& name : cameraDeviceNames) { + std::string version, cameraId; + if (!matchDeviceName(name, mProviderType, &version, &cameraId)) { + ADD_FAILURE(); + } + idToNameMap.insert(std::make_pair(std::string(cameraId), name)); + } + return idToNameMap; +} + +void CameraAidlTest::verifyMonochromeCameraResult( + const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& metadata) { + camera_metadata_ro_entry entry; + + // Check tags that are not applicable for monochrome camera + ASSERT_FALSE(metadata.exists(ANDROID_SENSOR_GREEN_SPLIT)); + ASSERT_FALSE(metadata.exists(ANDROID_SENSOR_NEUTRAL_COLOR_POINT)); + ASSERT_FALSE(metadata.exists(ANDROID_COLOR_CORRECTION_MODE)); + ASSERT_FALSE(metadata.exists(ANDROID_COLOR_CORRECTION_TRANSFORM)); + ASSERT_FALSE(metadata.exists(ANDROID_COLOR_CORRECTION_GAINS)); + + // Check dynamicBlackLevel + entry = metadata.find(ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL); + if (entry.count > 0) { + ASSERT_EQ(entry.count, 4); + for (size_t i = 1; i < entry.count; i++) { + ASSERT_FLOAT_EQ(entry.data.f[i], entry.data.f[0]); + } + } + + // Check noiseProfile + entry = metadata.find(ANDROID_SENSOR_NOISE_PROFILE); + if (entry.count > 0) { + ASSERT_EQ(entry.count, 2); + } + + // Check lensShadingMap + entry = metadata.find(ANDROID_STATISTICS_LENS_SHADING_MAP); + if (entry.count > 0) { + ASSERT_EQ(entry.count % 4, 0); + for (size_t i = 0; i < entry.count / 4; i++) { + ASSERT_FLOAT_EQ(entry.data.f[i * 4 + 1], entry.data.f[i * 4]); + ASSERT_FLOAT_EQ(entry.data.f[i * 4 + 2], entry.data.f[i * 4]); + ASSERT_FLOAT_EQ(entry.data.f[i * 4 + 3], entry.data.f[i * 4]); + } + } + + // Check tonemapCurve + camera_metadata_ro_entry curveRed = metadata.find(ANDROID_TONEMAP_CURVE_RED); + camera_metadata_ro_entry curveGreen = metadata.find(ANDROID_TONEMAP_CURVE_GREEN); + camera_metadata_ro_entry curveBlue = metadata.find(ANDROID_TONEMAP_CURVE_BLUE); + if (curveRed.count > 0 && curveGreen.count > 0 && curveBlue.count > 0) { + ASSERT_EQ(curveRed.count, curveGreen.count); + ASSERT_EQ(curveRed.count, curveBlue.count); + for (size_t i = 0; i < curveRed.count; i++) { + ASSERT_FLOAT_EQ(curveGreen.data.f[i], curveRed.data.f[i]); + ASSERT_FLOAT_EQ(curveBlue.data.f[i], curveRed.data.f[i]); + } + } +} + +void CameraAidlTest::verifyStreamUseCaseCharacteristics(const camera_metadata_t* metadata) { + camera_metadata_ro_entry entry; + // Check capabilities + int retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, &entry); + bool hasStreamUseCaseCap = false; + if ((0 == retcode) && (entry.count > 0)) { + if (std::find(entry.data.u8, entry.data.u8 + entry.count, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE) != + entry.data.u8 + entry.count) { + hasStreamUseCaseCap = true; + } + } + + bool supportMandatoryUseCases = false; + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES, + &entry); + if ((0 == retcode) && (entry.count > 0)) { + supportMandatoryUseCases = true; + for (size_t i = 0; i < kMandatoryUseCases.size(); i++) { + if (std::find(entry.data.i64, entry.data.i64 + entry.count, kMandatoryUseCases[i]) == + entry.data.i64 + entry.count) { + supportMandatoryUseCases = false; + break; + } + } + bool supportDefaultUseCase = false; + for (size_t i = 0; i < entry.count; i++) { + if (entry.data.i64[i] == ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT) { + supportDefaultUseCase = true; + } + ASSERT_TRUE(entry.data.i64[i] <= ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL || + entry.data.i64[i] >= + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START); + } + ASSERT_TRUE(supportDefaultUseCase); + } + + ASSERT_EQ(hasStreamUseCaseCap, supportMandatoryUseCases); +} + +Status CameraAidlTest::isMonochromeCamera(const camera_metadata_t* staticMeta) { + Status ret = Status::OPERATION_NOT_SUPPORTED; + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &entry); + + if (0 != rc) { + return Status::ILLEGAL_ARGUMENT; + } + + for (size_t i = 0; i < entry.count; i++) { + if (ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME == entry.data.u8[i]) { + ret = Status::OK; + break; + } + } + + return ret; +} + +Status CameraAidlTest::isLogicalMultiCamera(const camera_metadata_t* staticMeta) { + Status ret = Status::OPERATION_NOT_SUPPORTED; + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &entry); + if (0 != rc) { + return Status::ILLEGAL_ARGUMENT; + } + + for (size_t i = 0; i < entry.count; i++) { + if (ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA == entry.data.u8[i]) { + ret = Status::OK; + break; + } + } + + return ret; +} + +void CameraAidlTest::verifyLogicalCameraResult(const camera_metadata_t* staticMetadata, + const std::vector& resultMetadata) { + camera_metadata_t* metadata = (camera_metadata_t*)resultMetadata.data(); + + std::unordered_set physicalIds; + Status rc = getPhysicalCameraIds(staticMetadata, &physicalIds); + ASSERT_TRUE(Status::OK == rc); + ASSERT_TRUE(physicalIds.size() > 1); + + camera_metadata_ro_entry entry; + // Check mainPhysicalId + find_camera_metadata_ro_entry(metadata, ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID, + &entry); + if (entry.count > 0) { + std::string mainPhysicalId(reinterpret_cast(entry.data.u8)); + ASSERT_NE(physicalIds.find(mainPhysicalId), physicalIds.end()); + } else { + ADD_FAILURE() << "Get LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID failed!"; + } +} + +Status CameraAidlTest::getPhysicalCameraIds(const camera_metadata_t* staticMeta, + std::unordered_set* physicalIds) { + if ((nullptr == staticMeta) || (nullptr == physicalIds)) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS, + &entry); + if (0 != rc) { + return Status::ILLEGAL_ARGUMENT; + } + + const uint8_t* ids = entry.data.u8; + size_t start = 0; + for (size_t i = 0; i < entry.count; i++) { + if (ids[i] == '\0') { + if (start != i) { + std::string currentId(reinterpret_cast(ids + start)); + physicalIds->emplace(currentId); + } + start = i + 1; + } + } + + return Status::OK; +} + +Status CameraAidlTest::getSystemCameraKind(const camera_metadata_t* staticMeta, + SystemCameraKind* systemCameraKind) { + if (nullptr == staticMeta || nullptr == systemCameraKind) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry{}; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &entry); + if (0 != rc) { + return Status::ILLEGAL_ARGUMENT; + } + + if (entry.count == 1 && + entry.data.u8[0] == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA) { + *systemCameraKind = SystemCameraKind::HIDDEN_SECURE_CAMERA; + return Status::OK; + } + + // Go through the capabilities and check if it has + // ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA + for (size_t i = 0; i < entry.count; ++i) { + uint8_t capability = entry.data.u8[i]; + if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA) { + *systemCameraKind = SystemCameraKind::SYSTEM_ONLY_CAMERA; + return Status::OK; + } + } + *systemCameraKind = SystemCameraKind::PUBLIC; + return Status::OK; +} + +void CameraAidlTest::notifyDeviceState(int64_t state) { + if (mProvider == nullptr) { + return; + } + mProvider->notifyDeviceStateChange(state); +} + +void CameraAidlTest::allocateGraphicBuffer(uint32_t width, uint32_t height, uint64_t usage, + PixelFormat format, buffer_handle_t* buffer_handle) { + ASSERT_NE(buffer_handle, nullptr); + + uint32_t stride; + + android::status_t err = android::GraphicBufferAllocator::get().allocateRawHandle( + width, height, static_cast(format), 1u /*layerCount*/, usage, buffer_handle, + &stride, "VtsHalCameraProviderV2"); + ASSERT_EQ(err, android::NO_ERROR); +} + +bool CameraAidlTest::matchDeviceName(const std::string& deviceName, const std::string& providerType, + std::string* deviceVersion, std::string* cameraId) { + // expected format: device@.// + std::stringstream pattern; + pattern << "device@([0-9]+\\.[0-9]+)/" << providerType << "/(.+)"; + std::regex e(pattern.str()); + + std::smatch sm; + if (std::regex_match(deviceName, sm, e)) { + if (deviceVersion != nullptr) { + *deviceVersion = sm[1]; + } + if (cameraId != nullptr) { + *cameraId = sm[2]; + } + return true; + } + return false; +} + +void CameraAidlTest::verifyCameraCharacteristics(const CameraMetadata& chars) { + const camera_metadata_t* metadata = + reinterpret_cast(chars.metadata.data()); + + size_t expectedSize = chars.metadata.size(); + int result = validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED)); + size_t entryCount = get_camera_metadata_entry_count(metadata); + // TODO: we can do better than 0 here. Need to check how many required + // characteristics keys we've defined. + ASSERT_GT(entryCount, 0u); + + camera_metadata_ro_entry entry; + int retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL, &entry); + if ((0 == retcode) && (entry.count > 0)) { + uint8_t hardwareLevel = entry.data.u8[0]; + ASSERT_TRUE(hardwareLevel == ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED || + hardwareLevel == ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL || + hardwareLevel == ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3 || + hardwareLevel == ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL); + } else { + ADD_FAILURE() << "Get camera hardware level failed!"; + } + + entry.count = 0; + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION, &entry); + if ((0 == retcode) || (entry.count > 0)) { + ADD_FAILURE() << "ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION " + << " per API contract should never be set by Hal!"; + } + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS, &entry); + if ((0 == retcode) || (entry.count > 0)) { + ADD_FAILURE() << "ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS" + << " per API contract should never be set by Hal!"; + } + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS, &entry); + if ((0 == retcode) || (entry.count > 0)) { + ADD_FAILURE() << "ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS" + << " per API contract should never be set by Hal!"; + } + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS, &entry); + if ((0 == retcode) || (entry.count > 0)) { + ADD_FAILURE() << "ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS" + << " per API contract should never be set by Hal!"; + } + + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS, &entry); + if (0 == retcode || entry.count > 0) { + ADD_FAILURE() << "ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS " + << " per API contract should never be set by Hal!"; + } + + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS, &entry); + if (0 == retcode || entry.count > 0) { + ADD_FAILURE() << "ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS " + << " per API contract should never be set by Hal!"; + } + + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS, + &entry); + if (0 == retcode || entry.count > 0) { + ADD_FAILURE() << "ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS " + << " per API contract should never be set by Hal!"; + } + + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_HEIC_INFO_SUPPORTED, &entry); + if (0 == retcode && entry.count > 0) { + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT, &entry); + if (0 == retcode && entry.count > 0) { + uint8_t maxJpegAppSegmentsCount = entry.data.u8[0]; + ASSERT_TRUE(maxJpegAppSegmentsCount >= 1 && maxJpegAppSegmentsCount <= 16); + } else { + ADD_FAILURE() << "Get Heic maxJpegAppSegmentsCount failed!"; + } + } + + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_LENS_POSE_REFERENCE, &entry); + if (0 == retcode && entry.count > 0) { + uint8_t poseReference = entry.data.u8[0]; + ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_UNDEFINED && + poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA); + } + + retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_INFO_DEVICE_STATE_ORIENTATIONS, &entry); + if (0 == retcode && entry.count > 0) { + ASSERT_TRUE((entry.count % 2) == 0); + uint64_t maxPublicState = ((uint64_t)ICameraProvider::DEVICE_STATE_FOLDED) << 1; + uint64_t vendorStateStart = 1UL << 31; // Reserved for vendor specific states + uint64_t stateMask = (1 << vendorStateStart) - 1; + stateMask &= ~((1 << maxPublicState) - 1); + for (int i = 0; i < entry.count; i += 2) { + ASSERT_TRUE((entry.data.i64[i] & stateMask) == 0); + ASSERT_TRUE((entry.data.i64[i + 1] % 90) == 0); + } + } + + verifyExtendedSceneModeCharacteristics(metadata); + verifyZoomCharacteristics(metadata); + verifyStreamUseCaseCharacteristics(metadata); +} + +void CameraAidlTest::verifyExtendedSceneModeCharacteristics(const camera_metadata_t* metadata) { + camera_metadata_ro_entry entry; + int retcode = 0; + + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_CONTROL_AVAILABLE_MODES, &entry); + if ((0 == retcode) && (entry.count > 0)) { + for (auto i = 0; i < entry.count; i++) { + ASSERT_TRUE(entry.data.u8[i] >= ANDROID_CONTROL_MODE_OFF && + entry.data.u8[i] <= ANDROID_CONTROL_MODE_USE_EXTENDED_SCENE_MODE); + } + } else { + ADD_FAILURE() << "Get camera controlAvailableModes failed!"; + } + + // Check key availability in capabilities, request and result. + + retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, &entry); + bool hasExtendedSceneModeRequestKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasExtendedSceneModeRequestKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_EXTENDED_SCENE_MODE) != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableRequestKeys failed!"; + } + + retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, &entry); + bool hasExtendedSceneModeResultKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasExtendedSceneModeResultKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_EXTENDED_SCENE_MODE) != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableResultKeys failed!"; + } + + retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, &entry); + bool hasExtendedSceneModeMaxSizesKey = false; + bool hasExtendedSceneModeZoomRatioRangesKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasExtendedSceneModeMaxSizesKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES) != + entry.data.i32 + entry.count; + hasExtendedSceneModeZoomRatioRangesKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES) != + entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableCharacteristicsKeys failed!"; + } + + camera_metadata_ro_entry maxSizesEntry; + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES, &maxSizesEntry); + bool hasExtendedSceneModeMaxSizes = (0 == retcode && maxSizesEntry.count > 0); + + camera_metadata_ro_entry zoomRatioRangesEntry; + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES, + &zoomRatioRangesEntry); + bool hasExtendedSceneModeZoomRatioRanges = (0 == retcode && zoomRatioRangesEntry.count > 0); + + // Extended scene mode keys must all be available, or all be unavailable. + bool noExtendedSceneMode = + !hasExtendedSceneModeRequestKey && !hasExtendedSceneModeResultKey && + !hasExtendedSceneModeMaxSizesKey && !hasExtendedSceneModeZoomRatioRangesKey && + !hasExtendedSceneModeMaxSizes && !hasExtendedSceneModeZoomRatioRanges; + if (noExtendedSceneMode) { + return; + } + bool hasExtendedSceneMode = hasExtendedSceneModeRequestKey && hasExtendedSceneModeResultKey && + hasExtendedSceneModeMaxSizesKey && + hasExtendedSceneModeZoomRatioRangesKey && + hasExtendedSceneModeMaxSizes && hasExtendedSceneModeZoomRatioRanges; + ASSERT_TRUE(hasExtendedSceneMode); + + // Must have DISABLED, and must have one of BOKEH_STILL_CAPTURE, BOKEH_CONTINUOUS, or a VENDOR + // mode. + ASSERT_TRUE((maxSizesEntry.count == 6 && zoomRatioRangesEntry.count == 2) || + (maxSizesEntry.count == 9 && zoomRatioRangesEntry.count == 4)); + bool hasDisabledMode = false; + bool hasBokehStillCaptureMode = false; + bool hasBokehContinuousMode = false; + bool hasVendorMode = false; + std::vector outputStreams; + ASSERT_EQ(Status::OK, getAvailableOutputStreams(metadata, outputStreams)); + for (int i = 0, j = 0; i < maxSizesEntry.count && j < zoomRatioRangesEntry.count; i += 3) { + int32_t mode = maxSizesEntry.data.i32[i]; + int32_t maxWidth = maxSizesEntry.data.i32[i + 1]; + int32_t maxHeight = maxSizesEntry.data.i32[i + 2]; + switch (mode) { + case ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED: + hasDisabledMode = true; + ASSERT_TRUE(maxWidth == 0 && maxHeight == 0); + break; + case ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE: + hasBokehStillCaptureMode = true; + j += 2; + break; + case ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS: + hasBokehContinuousMode = true; + j += 2; + break; + default: + if (mode < ANDROID_CONTROL_EXTENDED_SCENE_MODE_VENDOR_START) { + ADD_FAILURE() << "Invalid extended scene mode advertised: " << mode; + } else { + hasVendorMode = true; + j += 2; + } + break; + } + + if (mode != ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED) { + // Make sure size is supported. + bool sizeSupported = false; + for (const auto& stream : outputStreams) { + if ((stream.format == static_cast(PixelFormat::YCBCR_420_888) || + stream.format == static_cast(PixelFormat::IMPLEMENTATION_DEFINED)) && + stream.width == maxWidth && stream.height == maxHeight) { + sizeSupported = true; + break; + } + } + ASSERT_TRUE(sizeSupported); + + // Make sure zoom range is valid + float minZoomRatio = zoomRatioRangesEntry.data.f[0]; + float maxZoomRatio = zoomRatioRangesEntry.data.f[1]; + ASSERT_GT(minZoomRatio, 0.0f); + ASSERT_LE(minZoomRatio, maxZoomRatio); + } + } + ASSERT_TRUE(hasDisabledMode); + ASSERT_TRUE(hasBokehStillCaptureMode || hasBokehContinuousMode || hasVendorMode); +} + +Status CameraAidlTest::getAvailableOutputStreams(const camera_metadata_t* staticMeta, + std::vector& outputStreams, + const AvailableStream* threshold, + bool maxResolution) { + AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::Y16)}; + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + int scalerTag = maxResolution + ? ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION + : ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS; + int depthTag = maxResolution + ? ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION + : ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS; + + camera_metadata_ro_entry scalerEntry; + camera_metadata_ro_entry depthEntry; + int foundScaler = find_camera_metadata_ro_entry(staticMeta, scalerTag, &scalerEntry); + int foundDepth = find_camera_metadata_ro_entry(staticMeta, depthTag, &depthEntry); + if ((0 != foundScaler || (0 != (scalerEntry.count % 4))) && + (0 != foundDepth || (0 != (depthEntry.count % 4)))) { + return Status::ILLEGAL_ARGUMENT; + } + + if (foundScaler == 0 && (0 == (scalerEntry.count % 4))) { + fillOutputStreams(&scalerEntry, outputStreams, threshold, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT); + } + + if (foundDepth == 0 && (0 == (depthEntry.count % 4))) { + fillOutputStreams(&depthEntry, outputStreams, &depthPreviewThreshold, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT); + } + + return Status::OK; +} + +void CameraAidlTest::fillOutputStreams(camera_metadata_ro_entry_t* entry, + std::vector& outputStreams, + const AvailableStream* threshold, + const int32_t availableConfigOutputTag) { + for (size_t i = 0; i < entry->count; i += 4) { + if (availableConfigOutputTag == entry->data.i32[i + 3]) { + if (nullptr == threshold) { + AvailableStream s = {entry->data.i32[i + 1], entry->data.i32[i + 2], + entry->data.i32[i]}; + outputStreams.push_back(s); + } else { + if ((threshold->format == entry->data.i32[i]) && + (threshold->width >= entry->data.i32[i + 1]) && + (threshold->height >= entry->data.i32[i + 2])) { + AvailableStream s = {entry->data.i32[i + 1], entry->data.i32[i + 2], + threshold->format}; + outputStreams.push_back(s); + } + } + } + } +} + +void CameraAidlTest::verifyZoomCharacteristics(const camera_metadata_t* metadata) { + camera_metadata_ro_entry entry; + int retcode = 0; + + // Check key availability in capabilities, request and result. + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, + &entry); + float maxDigitalZoom = 1.0; + if ((0 == retcode) && (entry.count == 1)) { + maxDigitalZoom = entry.data.f[0]; + } else { + ADD_FAILURE() << "Get camera scalerAvailableMaxDigitalZoom failed!"; + } + + retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, &entry); + bool hasZoomRequestKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasZoomRequestKey = std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_ZOOM_RATIO) != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableRequestKeys failed!"; + } + + retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, &entry); + bool hasZoomResultKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasZoomResultKey = std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_ZOOM_RATIO) != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableResultKeys failed!"; + } + + retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, &entry); + bool hasZoomCharacteristicsKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasZoomCharacteristicsKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_ZOOM_RATIO_RANGE) != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableCharacteristicsKeys failed!"; + } + + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_CONTROL_ZOOM_RATIO_RANGE, &entry); + bool hasZoomRatioRange = (0 == retcode && entry.count == 2); + + // Zoom keys must all be available, or all be unavailable. + bool noZoomRatio = !hasZoomRequestKey && !hasZoomResultKey && !hasZoomCharacteristicsKey && + !hasZoomRatioRange; + if (noZoomRatio) { + return; + } + bool hasZoomRatio = + hasZoomRequestKey && hasZoomResultKey && hasZoomCharacteristicsKey && hasZoomRatioRange; + ASSERT_TRUE(hasZoomRatio); + + float minZoomRatio = entry.data.f[0]; + float maxZoomRatio = entry.data.f[1]; + constexpr float FLOATING_POINT_THRESHOLD = 0.00001f; + if (maxDigitalZoom > maxZoomRatio + FLOATING_POINT_THRESHOLD) { + ADD_FAILURE() << "Maximum digital zoom " << maxDigitalZoom + << " is larger than maximum zoom ratio " << maxZoomRatio << " + threshold " + << FLOATING_POINT_THRESHOLD << "!"; + } + if (minZoomRatio > maxZoomRatio) { + ADD_FAILURE() << "Maximum zoom ratio is less than minimum zoom ratio!"; + } + if (minZoomRatio > 1.0f) { + ADD_FAILURE() << "Minimum zoom ratio is more than 1.0!"; + } + if (maxZoomRatio < 1.0f) { + ADD_FAILURE() << "Maximum zoom ratio is less than 1.0!"; + } + + // Make sure CROPPING_TYPE is CENTER_ONLY + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SCALER_CROPPING_TYPE, &entry); + if ((0 == retcode) && (entry.count == 1)) { + int8_t croppingType = entry.data.u8[0]; + ASSERT_EQ(croppingType, ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY); + } else { + ADD_FAILURE() << "Get camera scalerCroppingType failed!"; + } +} + +void CameraAidlTest::verifyMonochromeCharacteristics(const CameraMetadata& chars) { + const camera_metadata_t* metadata = (camera_metadata_t*)chars.metadata.data(); + Status rc = isMonochromeCamera(metadata); + if (Status::OPERATION_NOT_SUPPORTED == rc) { + return; + } + ASSERT_EQ(Status::OK, rc); + + camera_metadata_ro_entry entry; + // Check capabilities + int retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, &entry); + if ((0 == retcode) && (entry.count > 0)) { + ASSERT_EQ(std::find(entry.data.u8, entry.data.u8 + entry.count, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING), + entry.data.u8 + entry.count); + } + + // Check Cfa + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, + &entry); + if ((0 == retcode) && (entry.count == 1)) { + ASSERT_TRUE(entry.data.i32[0] == + static_cast( + SensorInfoColorFilterArrangement:: + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO) || + entry.data.i32[0] == + static_cast( + SensorInfoColorFilterArrangement:: + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR)); + } + + // Check availableRequestKeys + retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, &entry); + if ((0 == retcode) && (entry.count > 0)) { + for (size_t i = 0; i < entry.count; i++) { + ASSERT_NE(entry.data.i32[i], ANDROID_COLOR_CORRECTION_MODE); + ASSERT_NE(entry.data.i32[i], ANDROID_COLOR_CORRECTION_TRANSFORM); + ASSERT_NE(entry.data.i32[i], ANDROID_COLOR_CORRECTION_GAINS); + } + } else { + ADD_FAILURE() << "Get camera availableRequestKeys failed!"; + } + + // Check availableResultKeys + retcode = + find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, &entry); + if ((0 == retcode) && (entry.count > 0)) { + for (size_t i = 0; i < entry.count; i++) { + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_GREEN_SPLIT); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_NEUTRAL_COLOR_POINT); + ASSERT_NE(entry.data.i32[i], ANDROID_COLOR_CORRECTION_MODE); + ASSERT_NE(entry.data.i32[i], ANDROID_COLOR_CORRECTION_TRANSFORM); + ASSERT_NE(entry.data.i32[i], ANDROID_COLOR_CORRECTION_GAINS); + } + } else { + ADD_FAILURE() << "Get camera availableResultKeys failed!"; + } + + // Check availableCharacteristicKeys + retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, &entry); + if ((0 == retcode) && (entry.count > 0)) { + for (size_t i = 0; i < entry.count; i++) { + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_REFERENCE_ILLUMINANT1); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_REFERENCE_ILLUMINANT2); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_CALIBRATION_TRANSFORM1); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_CALIBRATION_TRANSFORM2); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_COLOR_TRANSFORM1); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_COLOR_TRANSFORM2); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_FORWARD_MATRIX1); + ASSERT_NE(entry.data.i32[i], ANDROID_SENSOR_FORWARD_MATRIX2); + } + } else { + ADD_FAILURE() << "Get camera availableResultKeys failed!"; + } + + // Check blackLevelPattern + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SENSOR_BLACK_LEVEL_PATTERN, &entry); + if ((0 == retcode) && (entry.count > 0)) { + ASSERT_EQ(entry.count, 4); + for (size_t i = 1; i < entry.count; i++) { + ASSERT_EQ(entry.data.i32[i], entry.data.i32[0]); + } + } +} + +void CameraAidlTest::verifyRecommendedConfigs(const CameraMetadata& chars) { + size_t CONFIG_ENTRY_SIZE = 5; + size_t CONFIG_ENTRY_TYPE_OFFSET = 3; + size_t CONFIG_ENTRY_BITFIELD_OFFSET = 4; + uint32_t maxPublicUsecase = + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END_3_8; + uint32_t vendorUsecaseStart = + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START; + uint32_t usecaseMask = (1 << vendorUsecaseStart) - 1; + usecaseMask &= ~((1 << maxPublicUsecase) - 1); + + const camera_metadata_t* metadata = + reinterpret_cast(chars.metadata.data()); + + camera_metadata_ro_entry recommendedConfigsEntry, recommendedDepthConfigsEntry, ioMapEntry; + recommendedConfigsEntry.count = recommendedDepthConfigsEntry.count = ioMapEntry.count = 0; + int retCode = find_camera_metadata_ro_entry( + metadata, ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS, + &recommendedConfigsEntry); + int depthRetCode = find_camera_metadata_ro_entry( + metadata, ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS, + &recommendedDepthConfigsEntry); + int ioRetCode = find_camera_metadata_ro_entry( + metadata, ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP, &ioMapEntry); + if ((0 != retCode) && (0 != depthRetCode)) { + // In case both regular and depth recommended configurations are absent, + // I/O should be absent as well. + ASSERT_NE(ioRetCode, 0); + return; + } + + camera_metadata_ro_entry availableKeysEntry; + retCode = find_camera_metadata_ro_entry( + metadata, ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, &availableKeysEntry); + ASSERT_TRUE((0 == retCode) && (availableKeysEntry.count > 0)); + std::vector availableKeys; + availableKeys.reserve(availableKeysEntry.count); + availableKeys.insert(availableKeys.end(), availableKeysEntry.data.i32, + availableKeysEntry.data.i32 + availableKeysEntry.count); + + if (recommendedConfigsEntry.count > 0) { + ASSERT_NE(std::find(availableKeys.begin(), availableKeys.end(), + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS), + availableKeys.end()); + ASSERT_EQ((recommendedConfigsEntry.count % CONFIG_ENTRY_SIZE), 0); + for (size_t i = 0; i < recommendedConfigsEntry.count; i += CONFIG_ENTRY_SIZE) { + int32_t entryType = recommendedConfigsEntry.data.i32[i + CONFIG_ENTRY_TYPE_OFFSET]; + uint32_t bitfield = recommendedConfigsEntry.data.i32[i + CONFIG_ENTRY_BITFIELD_OFFSET]; + ASSERT_TRUE((entryType == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) || + (entryType == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT)); + ASSERT_TRUE((bitfield & usecaseMask) == 0); + } + } + + if (recommendedDepthConfigsEntry.count > 0) { + ASSERT_NE(std::find(availableKeys.begin(), availableKeys.end(), + ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS), + availableKeys.end()); + ASSERT_EQ((recommendedDepthConfigsEntry.count % CONFIG_ENTRY_SIZE), 0); + for (size_t i = 0; i < recommendedDepthConfigsEntry.count; i += CONFIG_ENTRY_SIZE) { + int32_t entryType = recommendedDepthConfigsEntry.data.i32[i + CONFIG_ENTRY_TYPE_OFFSET]; + uint32_t bitfield = + recommendedDepthConfigsEntry.data.i32[i + CONFIG_ENTRY_BITFIELD_OFFSET]; + ASSERT_TRUE((entryType == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) || + (entryType == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT)); + ASSERT_TRUE((bitfield & usecaseMask) == 0); + } + + if (recommendedConfigsEntry.count == 0) { + // In case regular recommended configurations are absent but suggested depth + // configurations are present, I/O should be absent. + ASSERT_NE(ioRetCode, 0); + } + } + + if ((ioRetCode == 0) && (ioMapEntry.count > 0)) { + ASSERT_NE(std::find(availableKeys.begin(), availableKeys.end(), + ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP), + availableKeys.end()); + ASSERT_EQ(isZSLModeAvailable(metadata), Status::OK); + } +} + +// Check whether ZSL is available using the static camera +// characteristics. +Status CameraAidlTest::isZSLModeAvailable(const camera_metadata_t* staticMeta) { + if (Status::OK == isZSLModeAvailable(staticMeta, PRIV_REPROCESS)) { + return Status::OK; + } else { + return isZSLModeAvailable(staticMeta, YUV_REPROCESS); + } +} + +Status CameraAidlTest::isZSLModeAvailable(const camera_metadata_t* staticMeta, + ReprocessType reprocType) { + Status ret = Status::OPERATION_NOT_SUPPORTED; + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &entry); + if (0 != rc) { + return Status::ILLEGAL_ARGUMENT; + } + + for (size_t i = 0; i < entry.count; i++) { + if ((reprocType == PRIV_REPROCESS && + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING == entry.data.u8[i]) || + (reprocType == YUV_REPROCESS && + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING == entry.data.u8[i])) { + ret = Status::OK; + break; + } + } + + return ret; +} + +// Verify logical or ultra high resolution camera static metadata +void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata( + const std::string& cameraName, const std::shared_ptr& device, + const CameraMetadata& chars, const std::vector& deviceNames) { + const camera_metadata_t* metadata = + reinterpret_cast(chars.metadata.data()); + ASSERT_NE(nullptr, metadata); + SystemCameraKind systemCameraKind = SystemCameraKind::PUBLIC; + Status retStatus = getSystemCameraKind(metadata, &systemCameraKind); + ASSERT_EQ(retStatus, Status::OK); + Status rc = isLogicalMultiCamera(metadata); + ASSERT_TRUE(Status::OK == rc || Status::OPERATION_NOT_SUPPORTED == rc); + bool isMultiCamera = (Status::OK == rc); + bool isUltraHighResCamera = isUltraHighResolution(metadata); + if (!isMultiCamera && !isUltraHighResCamera) { + return; + } + + camera_metadata_ro_entry entry; + int retcode = find_camera_metadata_ro_entry(metadata, ANDROID_CONTROL_ZOOM_RATIO_RANGE, &entry); + bool hasZoomRatioRange = (0 == retcode && entry.count == 2); + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); + bool hasHalBufferManager = + (0 == retcode && 1 == entry.count && + entry.data.i32[0] == ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + retcode = find_camera_metadata_ro_entry( + metadata, ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED, &entry); + bool multiResolutionStreamSupported = + (0 == retcode && 1 == entry.count && + entry.data.u8[0] == ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE); + if (multiResolutionStreamSupported) { + ASSERT_TRUE(hasHalBufferManager); + } + + std::string version, cameraId; + ASSERT_TRUE(matchDeviceName(cameraName, mProviderType, &version, &cameraId)); + std::unordered_set physicalIds; + rc = getPhysicalCameraIds(metadata, &physicalIds); + ASSERT_TRUE(isUltraHighResCamera || Status::OK == rc); + for (const auto& physicalId : physicalIds) { + ASSERT_NE(physicalId, cameraId); + } + if (physicalIds.size() == 0) { + ASSERT_TRUE(isUltraHighResCamera && !isMultiCamera); + physicalIds.insert(cameraId); + } + + std::unordered_set physicalRequestKeyIDs; + rc = getSupportedKeys(const_cast(metadata), + ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS, + &physicalRequestKeyIDs); + ASSERT_TRUE(Status::OK == rc); + bool hasTestPatternPhysicalRequestKey = + physicalRequestKeyIDs.find(ANDROID_SENSOR_TEST_PATTERN_MODE) != + physicalRequestKeyIDs.end(); + std::unordered_set privacyTestPatternModes; + getPrivacyTestPatternModes(metadata, &privacyTestPatternModes); + + // Map from image format to number of multi-resolution sizes for that format + std::unordered_map multiResOutputFormatCounterMap; + std::unordered_map multiResInputFormatCounterMap; + for (const auto& physicalId : physicalIds) { + bool isPublicId = false; + std::string fullPublicId; + SystemCameraKind physSystemCameraKind = SystemCameraKind::PUBLIC; + for (auto& deviceName : deviceNames) { + std::string publicVersion, publicId; + ASSERT_TRUE(matchDeviceName(deviceName, mProviderType, &publicVersion, &publicId)); + if (physicalId == publicId) { + isPublicId = true; + fullPublicId = deviceName; + break; + } + } + + camera_metadata_ro_entry physicalMultiResStreamConfigs; + camera_metadata_ro_entry physicalStreamConfigs; + camera_metadata_ro_entry physicalMaxResolutionStreamConfigs; + bool isUltraHighRes = false; + std::unordered_set subCameraPrivacyTestPatterns; + if (isPublicId) { + std::shared_ptr subDevice; + ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(fullPublicId, &subDevice); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(subDevice, nullptr); + + CameraMetadata subDeviceChars; + ret = subDevice->getCameraCharacteristics(&subDeviceChars); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* staticMetadata = + reinterpret_cast(subDeviceChars.metadata.data()); + retStatus = getSystemCameraKind(staticMetadata, &physSystemCameraKind); + ASSERT_EQ(retStatus, Status::OK); + + // Make sure that the system camera kind of a non-hidden + // physical cameras is the same as the logical camera associated + // with it. + ASSERT_EQ(physSystemCameraKind, systemCameraKind); + retcode = find_camera_metadata_ro_entry(staticMetadata, + ANDROID_CONTROL_ZOOM_RATIO_RANGE, &entry); + bool subCameraHasZoomRatioRange = (0 == retcode && entry.count == 2); + ASSERT_EQ(hasZoomRatioRange, subCameraHasZoomRatioRange); + + getMultiResolutionStreamConfigurations( + &physicalMultiResStreamConfigs, &physicalStreamConfigs, + &physicalMaxResolutionStreamConfigs, staticMetadata); + isUltraHighRes = isUltraHighResolution(staticMetadata); + + getPrivacyTestPatternModes(staticMetadata, &subCameraPrivacyTestPatterns); + } else { + // Check camera characteristics for hidden camera id + CameraMetadata physChars; + ndk::ScopedAStatus ret = + device->getPhysicalCameraCharacteristics(physicalId, &physChars); + ASSERT_TRUE(ret.isOk()); + verifyCameraCharacteristics(physChars); + verifyMonochromeCharacteristics(physChars); + + auto staticMetadata = (const camera_metadata_t*)physChars.metadata.data(); + retcode = find_camera_metadata_ro_entry(staticMetadata, + ANDROID_CONTROL_ZOOM_RATIO_RANGE, &entry); + bool subCameraHasZoomRatioRange = (0 == retcode && entry.count == 2); + ASSERT_EQ(hasZoomRatioRange, subCameraHasZoomRatioRange); + + getMultiResolutionStreamConfigurations( + &physicalMultiResStreamConfigs, &physicalStreamConfigs, + &physicalMaxResolutionStreamConfigs, staticMetadata); + isUltraHighRes = isUltraHighResolution(staticMetadata); + getPrivacyTestPatternModes(staticMetadata, &subCameraPrivacyTestPatterns); + + // Check calling getCameraDeviceInterface_V3_x() on hidden camera id returns + // ILLEGAL_ARGUMENT. + std::stringstream s; + s << "device@" << version << "/" << mProviderType << "/" << physicalId; + std::string fullPhysicalId(s.str()); + std::shared_ptr subDevice; + ret = mProvider->getCameraDeviceInterface(fullPhysicalId, &subDevice); + ASSERT_TRUE(static_cast(Status::ILLEGAL_ARGUMENT) == + ret.getServiceSpecificError()); + ASSERT_EQ(subDevice, nullptr); + } + + if (hasTestPatternPhysicalRequestKey) { + ASSERT_TRUE(privacyTestPatternModes == subCameraPrivacyTestPatterns); + } + + if (physicalMultiResStreamConfigs.count > 0) { + ASSERT_EQ(physicalMultiResStreamConfigs.count % 4, 0); + + // Each supported size must be max size for that format, + for (size_t i = 0; i < physicalMultiResStreamConfigs.count / 4; i++) { + int32_t multiResFormat = physicalMultiResStreamConfigs.data.i32[i * 4]; + int32_t multiResWidth = physicalMultiResStreamConfigs.data.i32[i * 4 + 1]; + int32_t multiResHeight = physicalMultiResStreamConfigs.data.i32[i * 4 + 2]; + int32_t multiResInput = physicalMultiResStreamConfigs.data.i32[i * 4 + 3]; + + // Check if the resolution is the max resolution in stream + // configuration map + bool supported = false; + bool isMaxSize = true; + for (size_t j = 0; j < physicalStreamConfigs.count / 4; j++) { + int32_t format = physicalStreamConfigs.data.i32[j * 4]; + int32_t width = physicalStreamConfigs.data.i32[j * 4 + 1]; + int32_t height = physicalStreamConfigs.data.i32[j * 4 + 2]; + int32_t input = physicalStreamConfigs.data.i32[j * 4 + 3]; + if (format == multiResFormat && input == multiResInput) { + if (width == multiResWidth && height == multiResHeight) { + supported = true; + } else if (width * height > multiResWidth * multiResHeight) { + isMaxSize = false; + } + } + } + // Check if the resolution is the max resolution in max + // resolution stream configuration map + bool supportedUltraHighRes = false; + bool isUltraHighResMaxSize = true; + for (size_t j = 0; j < physicalMaxResolutionStreamConfigs.count / 4; j++) { + int32_t format = physicalMaxResolutionStreamConfigs.data.i32[j * 4]; + int32_t width = physicalMaxResolutionStreamConfigs.data.i32[j * 4 + 1]; + int32_t height = physicalMaxResolutionStreamConfigs.data.i32[j * 4 + 2]; + int32_t input = physicalMaxResolutionStreamConfigs.data.i32[j * 4 + 3]; + if (format == multiResFormat && input == multiResInput) { + if (width == multiResWidth && height == multiResHeight) { + supportedUltraHighRes = true; + } else if (width * height > multiResWidth * multiResHeight) { + isUltraHighResMaxSize = false; + } + } + } + + if (isUltraHighRes) { + // For ultra high resolution camera, the configuration must + // be the maximum size in stream configuration map, or max + // resolution stream configuration map + ASSERT_TRUE((supported && isMaxSize) || + (supportedUltraHighRes && isUltraHighResMaxSize)); + } else { + // The configuration must be the maximum size in stream + // configuration map + ASSERT_TRUE(supported && isMaxSize); + ASSERT_FALSE(supportedUltraHighRes); + } + + // Increment the counter for the configuration's format. + auto& formatCounterMap = multiResInput ? multiResInputFormatCounterMap + : multiResOutputFormatCounterMap; + if (formatCounterMap.count(multiResFormat) == 0) { + formatCounterMap[multiResFormat] = 1; + } else { + formatCounterMap[multiResFormat]++; + } + } + + // There must be no duplicates + for (size_t i = 0; i < physicalMultiResStreamConfigs.count / 4 - 1; i++) { + for (size_t j = i + 1; j < physicalMultiResStreamConfigs.count / 4; j++) { + // Input/output doesn't match + if (physicalMultiResStreamConfigs.data.i32[i * 4 + 3] != + physicalMultiResStreamConfigs.data.i32[j * 4 + 3]) { + continue; + } + // Format doesn't match + if (physicalMultiResStreamConfigs.data.i32[i * 4] != + physicalMultiResStreamConfigs.data.i32[j * 4]) { + continue; + } + // Width doesn't match + if (physicalMultiResStreamConfigs.data.i32[i * 4 + 1] != + physicalMultiResStreamConfigs.data.i32[j * 4 + 1]) { + continue; + } + // Height doesn't match + if (physicalMultiResStreamConfigs.data.i32[i * 4 + 2] != + physicalMultiResStreamConfigs.data.i32[j * 4 + 2]) { + continue; + } + // input/output, format, width, and height all match + ADD_FAILURE(); + } + } + } + } + + // If a multi-resolution stream is supported, there must be at least one + // format with more than one resolutions + if (multiResolutionStreamSupported) { + size_t numMultiResFormats = 0; + for (const auto& [format, sizeCount] : multiResOutputFormatCounterMap) { + if (sizeCount >= 2) { + numMultiResFormats++; + } + } + for (const auto& [format, sizeCount] : multiResInputFormatCounterMap) { + if (sizeCount >= 2) { + numMultiResFormats++; + + // If multi-resolution reprocessing is supported, the logical + // camera or ultra-high resolution sensor camera must support + // the corresponding reprocessing capability. + if (format == static_cast(PixelFormat::IMPLEMENTATION_DEFINED)) { + ASSERT_EQ(isZSLModeAvailable(metadata, PRIV_REPROCESS), Status::OK); + } else if (format == static_cast(PixelFormat::YCBCR_420_888)) { + ASSERT_EQ(isZSLModeAvailable(metadata, YUV_REPROCESS), Status::OK); + } + } + } + ASSERT_GT(numMultiResFormats, 0); + } + + // Make sure ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID is available in + // result keys. + if (isMultiCamera) { + retcode = find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, + &entry); + if ((0 == retcode) && (entry.count > 0)) { + ASSERT_NE(std::find(entry.data.i32, entry.data.i32 + entry.count, + static_cast( + CameraMetadataTag:: + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID)), + entry.data.i32 + entry.count); + } else { + ADD_FAILURE() << "Get camera availableResultKeys failed!"; + } + } +} + +bool CameraAidlTest::isUltraHighResolution(const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry scalerEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &scalerEntry); + if (rc == 0) { + for (uint32_t i = 0; i < scalerEntry.count; i++) { + if (scalerEntry.data.u8[i] == + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR) { + return true; + } + } + } + return false; +} + +Status CameraAidlTest::getSupportedKeys(camera_metadata_t* staticMeta, uint32_t tagId, + std::unordered_set* requestIDs) { + if ((nullptr == staticMeta) || (nullptr == requestIDs)) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, tagId, &entry); + if ((0 != rc) || (entry.count == 0)) { + return Status::OK; + } + + requestIDs->insert(entry.data.i32, entry.data.i32 + entry.count); + + return Status::OK; +} + +void CameraAidlTest::getPrivacyTestPatternModes( + const camera_metadata_t* staticMetadata, + std::unordered_set* privacyTestPatternModes) { + ASSERT_NE(staticMetadata, nullptr); + ASSERT_NE(privacyTestPatternModes, nullptr); + + camera_metadata_ro_entry entry; + int retcode = find_camera_metadata_ro_entry( + staticMetadata, ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, &entry); + ASSERT_TRUE(0 == retcode); + + for (auto i = 0; i < entry.count; i++) { + if (entry.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR || + entry.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK) { + privacyTestPatternModes->insert(entry.data.i32[i]); + } + } +} + +void CameraAidlTest::getMultiResolutionStreamConfigurations( + camera_metadata_ro_entry* multiResStreamConfigs, camera_metadata_ro_entry* streamConfigs, + camera_metadata_ro_entry* maxResolutionStreamConfigs, + const camera_metadata_t* staticMetadata) { + ASSERT_NE(multiResStreamConfigs, nullptr); + ASSERT_NE(streamConfigs, nullptr); + ASSERT_NE(maxResolutionStreamConfigs, nullptr); + ASSERT_NE(staticMetadata, nullptr); + + int retcode = find_camera_metadata_ro_entry( + staticMetadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, streamConfigs); + ASSERT_TRUE(0 == retcode); + retcode = find_camera_metadata_ro_entry( + staticMetadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + maxResolutionStreamConfigs); + ASSERT_TRUE(-ENOENT == retcode || 0 == retcode); + retcode = find_camera_metadata_ro_entry( + staticMetadata, ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS, + multiResStreamConfigs); + ASSERT_TRUE(-ENOENT == retcode || 0 == retcode); +} + +bool CameraAidlTest::isTorchSupported(const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry torchEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_FLASH_INFO_AVAILABLE, &torchEntry); + if (rc != 0) { + ALOGI("isTorchSupported: Failed to find entry for ANDROID_FLASH_INFO_AVAILABLE"); + return false; + } + if (torchEntry.count == 1 && !torchEntry.data.u8[0]) { + ALOGI("isTorchSupported: Torch not supported"); + return false; + } + ALOGI("isTorchSupported: Torch supported"); + return true; +} + +bool CameraAidlTest::isTorchStrengthControlSupported(const camera_metadata_t* staticMeta) { + int32_t maxLevel = 0; + camera_metadata_ro_entry maxEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, + &maxEntry); + if (rc != 0) { + ALOGI("isTorchStrengthControlSupported: Failed to find entry for " + "ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL"); + return false; + } + + maxLevel = *maxEntry.data.i32; + if (maxLevel > 1) { + ALOGI("isTorchStrengthControlSupported: Torch strength control supported."); + return true; + } + ALOGI("isTorchStrengthControlSupported: Torch strength control not supported."); + return false; +} + +void CameraAidlTest::verifyRequestTemplate(const camera_metadata_t* metadata, + RequestTemplate requestTemplate) { + ASSERT_NE(nullptr, metadata); + size_t entryCount = get_camera_metadata_entry_count(metadata); + ALOGI("template %u metadata entry count is %zu", (int32_t)requestTemplate, entryCount); + // TODO: we can do better than 0 here. Need to check how many required + // request keys we've defined for each template + ASSERT_GT(entryCount, 0u); + + // Check zoomRatio + camera_metadata_ro_entry zoomRatioEntry; + int foundZoomRatio = + find_camera_metadata_ro_entry(metadata, ANDROID_CONTROL_ZOOM_RATIO, &zoomRatioEntry); + if (foundZoomRatio == 0) { + ASSERT_EQ(zoomRatioEntry.count, 1); + ASSERT_EQ(zoomRatioEntry.data.f[0], 1.0f); + } +} + +void CameraAidlTest::openEmptyDeviceSession(const std::string& name, + const std::shared_ptr& provider, + std::shared_ptr* session, + CameraMetadata* staticMeta, + std::shared_ptr* device) { + ASSERT_NE(nullptr, session); + ASSERT_NE(nullptr, staticMeta); + ASSERT_NE(nullptr, device); + + ALOGI("configureStreams: Testing camera device %s", name.c_str()); + ndk::ScopedAStatus ret = provider->getCameraDeviceInterface(name, device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + std::shared_ptr cb = ndk::SharedRefBase::make(); + ret = (*device)->open(cb, session); + ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(*session, nullptr); + + ret = (*device)->getCameraCharacteristics(staticMeta); + ASSERT_TRUE(ret.isOk()); +} + +void CameraAidlTest::openEmptyInjectionSession(const std::string& name, + const std::shared_ptr& provider, + std::shared_ptr* session, + CameraMetadata* metadata, + std::shared_ptr* device) { + ASSERT_NE(nullptr, session); + ASSERT_NE(nullptr, metadata); + ASSERT_NE(nullptr, device); + + ALOGI("openEmptyInjectionSession: Testing camera device %s", name.c_str()); + ndk::ScopedAStatus ret = provider->getCameraDeviceInterface(name, device); + ALOGI("openEmptyInjectionSession: getCameraDeviceInterface returns status:%d:%d", + ret.getExceptionCode(), ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(*device, nullptr); + + std::shared_ptr cb = ndk::SharedRefBase::make(); + ret = (*device)->openInjectionSession(cb, session); + ALOGI("device::openInjectionSession returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + + if (static_cast(ret.getServiceSpecificError()) == Status::OPERATION_NOT_SUPPORTED && + *session == nullptr) { + return; // Injection Session not supported. Callee will receive nullptr in *session + } + + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(*session, nullptr); + + ret = (*device)->getCameraCharacteristics(metadata); + ASSERT_TRUE(ret.isOk()); +} + +Status CameraAidlTest::getJpegBufferSize(camera_metadata_t* staticMeta, int32_t* outBufSize) { + if (nullptr == staticMeta || nullptr == outBufSize) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_JPEG_MAX_SIZE, &entry); + if ((0 != rc) || (1 != entry.count)) { + return Status::ILLEGAL_ARGUMENT; + } + + *outBufSize = entry.data.i32[0]; + return Status::OK; +} + +Dataspace CameraAidlTest::getDataspace(PixelFormat format) { + switch (format) { + case PixelFormat::BLOB: + return Dataspace::JFIF; + case PixelFormat::Y16: + return Dataspace::DEPTH; + case PixelFormat::RAW16: + case PixelFormat::RAW_OPAQUE: + case PixelFormat::RAW10: + case PixelFormat::RAW12: + return Dataspace::ARBITRARY; + default: + return Dataspace::UNKNOWN; + } +} + +void CameraAidlTest::createStreamConfiguration(std::vector& streams, + StreamConfigurationMode configMode, + StreamConfiguration* config, + int32_t jpegBufferSize) { + ASSERT_NE(nullptr, config); + + for (auto& stream : streams) { + stream.bufferSize = + (stream.format == PixelFormat::BLOB && stream.dataSpace == Dataspace::JFIF) + ? jpegBufferSize + : 0; + } + + // Caller is responsible to fill in non-zero config->streamConfigCounter after this returns + config->streams = streams; + config->operationMode = configMode; + config->multiResolutionInputImage = false; +} + +void CameraAidlTest::verifyStreamCombination(const std::shared_ptr& device, + const StreamConfiguration& config, bool expectedStatus, + bool expectStreamCombQuery) { + if (device != nullptr) { + bool streamCombinationSupported; + ScopedAStatus ret = + device->isStreamCombinationSupported(config, &streamCombinationSupported); + // TODO: Check is unsupported operation is correct. + ASSERT_TRUE(ret.isOk() || + (expectStreamCombQuery && ret.getExceptionCode() == EX_UNSUPPORTED_OPERATION)); + if (ret.isOk()) { + ASSERT_EQ(expectedStatus, streamCombinationSupported); + } + } +} + +std::vector CameraAidlTest::getConcurrentDeviceCombinations( + std::shared_ptr& provider) { + std::vector combinations; + ndk::ScopedAStatus ret = provider->getConcurrentCameraIds(&combinations); + if (!ret.isOk()) { + ADD_FAILURE(); + } + + return combinations; +} + +Status CameraAidlTest::getMandatoryConcurrentStreams(const camera_metadata_t* staticMeta, + std::vector* outputStreams) { + if (nullptr == staticMeta || nullptr == outputStreams) { + return Status::ILLEGAL_ARGUMENT; + } + + if (isDepthOnly(staticMeta)) { + Size y16MaxSize(640, 480); + Size maxAvailableY16Size; + getMaxOutputSizeForFormat(staticMeta, PixelFormat::Y16, &maxAvailableY16Size); + Size y16ChosenSize = getMinSize(y16MaxSize, maxAvailableY16Size); + AvailableStream y16Stream = {.width = y16ChosenSize.width, + .height = y16ChosenSize.height, + .format = static_cast(PixelFormat::Y16)}; + outputStreams->push_back(y16Stream); + return Status::OK; + } + + Size yuvMaxSize(1280, 720); + Size jpegMaxSize(1920, 1440); + Size maxAvailableYuvSize; + Size maxAvailableJpegSize; + getMaxOutputSizeForFormat(staticMeta, PixelFormat::YCBCR_420_888, &maxAvailableYuvSize); + getMaxOutputSizeForFormat(staticMeta, PixelFormat::BLOB, &maxAvailableJpegSize); + Size yuvChosenSize = getMinSize(yuvMaxSize, maxAvailableYuvSize); + Size jpegChosenSize = getMinSize(jpegMaxSize, maxAvailableJpegSize); + + AvailableStream yuvStream = {.width = yuvChosenSize.width, + .height = yuvChosenSize.height, + .format = static_cast(PixelFormat::YCBCR_420_888)}; + + AvailableStream jpegStream = {.width = jpegChosenSize.width, + .height = jpegChosenSize.height, + .format = static_cast(PixelFormat::BLOB)}; + outputStreams->push_back(yuvStream); + outputStreams->push_back(jpegStream); + + return Status::OK; +} + +bool CameraAidlTest::isDepthOnly(const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry scalerEntry; + camera_metadata_ro_entry depthEntry; + + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &scalerEntry); + if (rc == 0) { + for (uint32_t i = 0; i < scalerEntry.count; i++) { + if (scalerEntry.data.u8[i] == + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE) { + return false; + } + } + } + + for (uint32_t i = 0; i < scalerEntry.count; i++) { + if (scalerEntry.data.u8[i] == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT) { + rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, &depthEntry); + size_t idx = 0; + if (rc == 0 && depthEntry.data.i32[idx] == static_cast(PixelFormat::Y16)) { + // only Depth16 format is supported now + return true; + } + break; + } + } + + return false; +} + +Status CameraAidlTest::getMaxOutputSizeForFormat(const camera_metadata_t* staticMeta, + PixelFormat format, Size* size, + bool maxResolution) { + std::vector outputStreams; + if (size == nullptr || + getAvailableOutputStreams(staticMeta, outputStreams, + /*threshold*/ nullptr, maxResolution) != Status::OK) { + return Status::ILLEGAL_ARGUMENT; + } + Size maxSize; + bool found = false; + for (auto& outputStream : outputStreams) { + if (static_cast(format) == outputStream.format && + (outputStream.width * outputStream.height > maxSize.width * maxSize.height)) { + maxSize.width = outputStream.width; + maxSize.height = outputStream.height; + found = true; + } + } + if (!found) { + ALOGE("%s :chosen format %d not found", __FUNCTION__, static_cast(format)); + return Status::ILLEGAL_ARGUMENT; + } + *size = maxSize; + return Status::OK; +} + +Size CameraAidlTest::getMinSize(Size a, Size b) { + if (a.width * a.height < b.width * b.height) { + return a; + } + return b; +} + +Status CameraAidlTest::getZSLInputOutputMap(camera_metadata_t* staticMeta, + std::vector& inputOutputMap) { + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP, &entry); + if ((0 != rc) || (0 >= entry.count)) { + return Status::ILLEGAL_ARGUMENT; + } + + const int32_t* contents = &entry.data.i32[0]; + for (size_t i = 0; i < entry.count;) { + int32_t inputFormat = contents[i++]; + int32_t length = contents[i++]; + for (int32_t j = 0; j < length; j++) { + int32_t outputFormat = contents[i + j]; + AvailableZSLInputOutput zslEntry = {inputFormat, outputFormat}; + inputOutputMap.push_back(zslEntry); + } + i += length; + } + + return Status::OK; +} + +Status CameraAidlTest::findLargestSize(const std::vector& streamSizes, + int32_t format, AvailableStream& result) { + result = {0, 0, 0}; + for (auto& iter : streamSizes) { + if (format == iter.format) { + if ((result.width * result.height) < (iter.width * iter.height)) { + result = iter; + } + } + } + + return (result.format == format) ? Status::OK : Status::ILLEGAL_ARGUMENT; +} + +void CameraAidlTest::constructFilteredSettings( + const std::shared_ptr& session, + const std::unordered_set& availableKeys, RequestTemplate reqTemplate, + android::hardware::camera::common::V1_0::helper::CameraMetadata* defaultSettings, + android::hardware::camera::common::V1_0::helper::CameraMetadata* filteredSettings) { + ASSERT_NE(defaultSettings, nullptr); + ASSERT_NE(filteredSettings, nullptr); + + CameraMetadata req; + auto ret = session->constructDefaultRequestSettings(reqTemplate, &req); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* metadata = + clone_camera_metadata(reinterpret_cast(req.metadata.data())); + size_t expectedSize = req.metadata.size(); + int result = validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED)); + + size_t entryCount = get_camera_metadata_entry_count(metadata); + ASSERT_GT(entryCount, 0u); + *defaultSettings = metadata; + + const android::hardware::camera::common::V1_0::helper::CameraMetadata& constSettings = + *defaultSettings; + for (const auto& keyIt : availableKeys) { + camera_metadata_ro_entry entry = constSettings.find(keyIt); + if (entry.count > 0) { + filteredSettings->update(entry); + } + } +} + +void CameraAidlTest::verifySessionReconfigurationQuery( + const std::shared_ptr& session, camera_metadata* oldSessionParams, + camera_metadata* newSessionParams) { + ASSERT_NE(nullptr, session); + ASSERT_NE(nullptr, oldSessionParams); + ASSERT_NE(nullptr, newSessionParams); + + std::vector oldParams = + std::vector(reinterpret_cast(oldSessionParams), + reinterpret_cast(oldSessionParams) + + get_camera_metadata_size(oldSessionParams)); + CameraMetadata oldMetadata = {oldParams}; + + std::vector newParams = + std::vector(reinterpret_cast(newSessionParams), + reinterpret_cast(newSessionParams) + + get_camera_metadata_size(newSessionParams)); + CameraMetadata newMetadata = {newParams}; + + bool reconfigReq; + ndk::ScopedAStatus ret = + session->isReconfigurationRequired(oldMetadata, newMetadata, &reconfigReq); + ASSERT_TRUE(ret.isOk() || static_cast(ret.getServiceSpecificError()) == + Status::OPERATION_NOT_SUPPORTED); +} + +Status CameraAidlTest::isConstrainedModeAvailable(camera_metadata_t* staticMeta) { + Status ret = Status::OPERATION_NOT_SUPPORTED; + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &entry); + if (0 != rc) { + return Status::ILLEGAL_ARGUMENT; + } + + for (size_t i = 0; i < entry.count; i++) { + if (ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO == + entry.data.u8[i]) { + ret = Status::OK; + break; + } + } + + return ret; +} + +Status CameraAidlTest::pickConstrainedModeSize(camera_metadata_t* staticMeta, + AvailableStream& hfrStream) { + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, &entry); + if (0 != rc) { + return Status::OPERATION_NOT_SUPPORTED; + } else if (0 != (entry.count % 5)) { + return Status::ILLEGAL_ARGUMENT; + } + + hfrStream = {0, 0, static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + for (size_t i = 0; i < entry.count; i += 5) { + int32_t w = entry.data.i32[i]; + int32_t h = entry.data.i32[i + 1]; + if ((hfrStream.width * hfrStream.height) < (w * h)) { + hfrStream.width = w; + hfrStream.height = h; + } + } + + return Status::OK; +} + +void CameraAidlTest::processCaptureRequestInternal(uint64_t bufferUsage, + RequestTemplate reqTemplate, + bool useSecureOnlyCameras) { + std::vector cameraDeviceNames = + getCameraDeviceNames(mProvider, useSecureOnlyCameras); + AvailableStream streamThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + int64_t bufferId = 1; + int32_t frameNumber = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + Stream testStream; + std::vector halStreams; + std::shared_ptr session; + std::shared_ptr cb; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + configureSingleStream(name, mProvider, &streamThreshold, bufferUsage, reqTemplate, + &session /*out*/, &testStream /*out*/, &halStreams /*out*/, + &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/); + + ASSERT_NE(session, nullptr); + ASSERT_NE(cb, nullptr); + ASSERT_FALSE(halStreams.empty()); + + std::shared_ptr resultQueue; + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + ndk::ScopedAStatus ret = session->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(ret.isOk()); + + resultQueue = std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq," + " not use it", + __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + std::shared_ptr inflightReq = std::make_shared( + 1, false, supportsPartialResults, partialResultCount, resultQueue); + + CameraMetadata req; + ret = session->constructDefaultRequestSettings(reqTemplate, &req); + ASSERT_TRUE(ret.isOk()); + settings = req; + + overrideRotateAndCrop(&settings); + + std::vector requests(1); + CaptureRequest& request = requests[0]; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settings; + + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(1); + StreamBuffer& outputBuffer = outputBuffers[0]; + if (useHalBufManager) { + outputBuffer = {halStreams[0].id, + /*bufferId*/ 0, NativeHandle(), BufferStatus::OK, + NativeHandle(), NativeHandle()}; + } else { + buffer_handle_t handle; + allocateGraphicBuffer( + testStream.width, testStream.height, + /* We don't look at halStreamConfig.streams[0].consumerUsage + * since that is 0 for output streams + */ + android_convertGralloc1To0Usage( + static_cast(halStreams[0].producerUsage), bufferUsage), + halStreams[0].overrideFormat, &handle); + + outputBuffer = {halStreams[0].id, bufferId, ::android::makeToAidl(handle), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } + request.inputBuffer = {-1, + 0, + NativeHandle(), + BufferStatus::ERROR, + NativeHandle(), + NativeHandle()}; // Empty Input Buffer + + { + std::unique_lock l(mLock); + mInflightMap.clear(); + mInflightMap.insert(std::make_pair(frameNumber, inflightReq)); + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ret = session->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ALOGI("processCaptureRequestInternal: processCaptureRequest returns status: %d:%d", + ret.getExceptionCode(), ret.getServiceSpecificError()); + + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + ASSERT_EQ(testStream.id, inflightReq->resultOutputBuffers[0].buffer.streamId); + + // shutterReadoutTimestamp must be available, and it must + // be >= shutterTimestamp + exposureTime, + // and < shutterTimestamp + exposureTime + rollingShutterSkew / 2. + ASSERT_TRUE(inflightReq->shutterReadoutTimestampValid); + ASSERT_FALSE(inflightReq->collectedResult.isEmpty()); + + if (inflightReq->collectedResult.exists(ANDROID_SENSOR_EXPOSURE_TIME)) { + camera_metadata_entry_t exposureTimeResult = + inflightReq->collectedResult.find(ANDROID_SENSOR_EXPOSURE_TIME); + nsecs_t exposureToReadout = + inflightReq->shutterReadoutTimestamp - inflightReq->shutterTimestamp; + ASSERT_GE(exposureToReadout, exposureTimeResult.data.i64[0]); + if (inflightReq->collectedResult.exists(ANDROID_SENSOR_ROLLING_SHUTTER_SKEW)) { + camera_metadata_entry_t rollingShutterSkew = + inflightReq->collectedResult.find(ANDROID_SENSOR_ROLLING_SHUTTER_SKEW); + ASSERT_LT(exposureToReadout, + exposureTimeResult.data.i64[0] + rollingShutterSkew.data.i64[0] / 2); + } + } + + request.frameNumber++; + // Empty settings should be supported after the first call + // for repeating requests. + request.settings.metadata.clear(); + // The buffer has been registered to HAL by bufferId, so per + // API contract we should send a null handle for this buffer + request.outputBuffers[0].buffer = NativeHandle(); + mInflightMap.clear(); + inflightReq = std::make_shared(1, false, supportsPartialResults, + partialResultCount, resultQueue); + mInflightMap.insert(std::make_pair(request.frameNumber, inflightReq)); + } + + ret = session->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ALOGI("processCaptureRequestInternal: processCaptureRequest returns status: %d:%d", + ret.getExceptionCode(), ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + ASSERT_EQ(testStream.id, inflightReq->resultOutputBuffers[0].buffer.streamId); + } + + if (useHalBufManager) { + verifyBuffersReturned(session, testStream.id, cb); + } + + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + } +} + +void CameraAidlTest::configureSingleStream( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* previewThreshold, uint64_t bufferUsage, RequestTemplate reqTemplate, + std::shared_ptr* session, Stream* previewStream, + std::vector* halStreams, bool* supportsPartialResults, + int32_t* partialResultCount, bool* useHalBufManager, std::shared_ptr* cb, + uint32_t streamConfigCounter) { + ASSERT_NE(nullptr, session); + ASSERT_NE(nullptr, previewStream); + ASSERT_NE(nullptr, halStreams); + ASSERT_NE(nullptr, supportsPartialResults); + ASSERT_NE(nullptr, partialResultCount); + ASSERT_NE(nullptr, useHalBufManager); + ASSERT_NE(nullptr, cb); + + std::vector outputPreviewStreams; + std::shared_ptr device; + ALOGI("configureStreams: Testing camera device %s", name.c_str()); + + ndk::ScopedAStatus ret = provider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + camera_metadata_t* staticMeta; + CameraMetadata chars; + ret = device->getCameraCharacteristics(&chars); + ASSERT_TRUE(ret.isOk()); + staticMeta = clone_camera_metadata( + reinterpret_cast(chars.metadata.data())); + ASSERT_NE(nullptr, staticMeta); + + size_t expectedSize = chars.metadata.size(); + ALOGE("validate_camera_metadata_structure: %d", + validate_camera_metadata_structure(staticMeta, &expectedSize)); + + camera_metadata_ro_entry entry; + auto status = + find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &entry); + if ((0 == status) && (entry.count > 0)) { + *partialResultCount = entry.data.i32[0]; + *supportsPartialResults = (*partialResultCount > 1); + } + + *cb = ndk::SharedRefBase::make(this, staticMeta); + + device->open(*cb, session); + ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(*session, nullptr); + + *useHalBufManager = false; + status = find_camera_metadata_ro_entry( + staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); + if ((0 == status) && (entry.count == 1)) { + *useHalBufManager = (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + } + + outputPreviewStreams.clear(); + auto rc = getAvailableOutputStreams(staticMeta, outputPreviewStreams, previewThreshold); + + int32_t jpegBufferSize = 0; + ASSERT_EQ(Status::OK, getJpegBufferSize(staticMeta, &jpegBufferSize)); + ASSERT_NE(0u, jpegBufferSize); + + ASSERT_EQ(Status::OK, rc); + ASSERT_FALSE(outputPreviewStreams.empty()); + + Dataspace dataspace = Dataspace::UNKNOWN; + switch (static_cast(outputPreviewStreams[0].format)) { + case PixelFormat::Y16: + dataspace = Dataspace::DEPTH; + break; + default: + dataspace = Dataspace::UNKNOWN; + } + + std::vector streams(1); + streams[0] = {0, + StreamType::OUTPUT, + outputPreviewStreams[0].width, + outputPreviewStreams[0].height, + static_cast(outputPreviewStreams[0].format), + static_cast(bufferUsage), + dataspace, + StreamRotation::ROTATION_0, + "", + 0, + /*groupId*/ -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + StreamConfiguration config; + config.streams = streams; + createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config, + jpegBufferSize); + if (*session != nullptr) { + CameraMetadata sessionParams; + ret = (*session)->constructDefaultRequestSettings(reqTemplate, &sessionParams); + ASSERT_TRUE(ret.isOk()); + config.sessionParams = sessionParams; + config.streamConfigCounter = (int32_t)streamConfigCounter; + + bool supported = false; + ret = device->isStreamCombinationSupported(config, &supported); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(supported, true); + + std::vector halConfigs; + ret = (*session)->configureStreams(config, &halConfigs); + ALOGI("configureStreams returns status: %d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(1u, halConfigs.size()); + halStreams->clear(); + halStreams->push_back(halConfigs[0]); + if (*useHalBufManager) { + std::vector ss(1); + std::vector hs(1); + ss[0] = config.streams[0]; + hs[0] = halConfigs[0]; + (*cb)->setCurrentStreamConfig(ss, hs); + } + } + *previewStream = config.streams[0]; + ASSERT_TRUE(ret.isOk()); +} + +void CameraAidlTest::overrideRotateAndCrop(CameraMetadata* settings) { + if (settings == nullptr) { + return; + } + + ::android::hardware::camera::common::V1_0::helper::CameraMetadata requestMeta = + clone_camera_metadata(reinterpret_cast(settings->metadata.data())); + auto entry = requestMeta.find(ANDROID_SCALER_ROTATE_AND_CROP); + if ((entry.count > 0) && (entry.data.u8[0] == ANDROID_SCALER_ROTATE_AND_CROP_AUTO)) { + uint8_t disableRotateAndCrop = ANDROID_SCALER_ROTATE_AND_CROP_NONE; + requestMeta.update(ANDROID_SCALER_ROTATE_AND_CROP, &disableRotateAndCrop, 1); + settings->metadata.clear(); + camera_metadata_t* metaBuffer = requestMeta.release(); + uint8_t* rawMetaBuffer = reinterpret_cast(metaBuffer); + settings->metadata = + std::vector(rawMetaBuffer, rawMetaBuffer + get_camera_metadata_size(metaBuffer)); + } +} + +void CameraAidlTest::verifyBuffersReturned(const std::shared_ptr& session, + int32_t streamId, const std::shared_ptr& cb, + uint32_t streamConfigCounter) { + ASSERT_NE(nullptr, session); + + std::vector streamIds(1); + streamIds[0] = streamId; + session->signalStreamFlush(streamIds, /*streamConfigCounter*/ streamConfigCounter); + cb->waitForBuffersReturned(); +} + +void CameraAidlTest::processPreviewStabilizationCaptureRequestInternal( + bool previewStabilizationOn, + // Used as output when preview stabilization is off, as output when its on. + std::unordered_map& cameraDeviceToTimeLag) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + AvailableStream streamThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + int64_t bufferId = 1; + int32_t frameNumber = 1; + std::vector settings; + + for (const auto& name : cameraDeviceNames) { + if (!supportsPreviewStabilization(name, mProvider)) { + ALOGI(" %s Camera device %s doesn't support preview stabilization, skipping", __func__, + name.c_str()); + continue; + } + + Stream testStream; + std::vector halStreams; + std::shared_ptr session; + std::shared_ptr cb; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + configureSingleStream(name, mProvider, &streamThreshold, GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, + RequestTemplate::PREVIEW, &session /*out*/, &testStream /*out*/, + &halStreams /*out*/, &supportsPartialResults /*out*/, + &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + ndk::ScopedAStatus resultQueueRet = session->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + + std::shared_ptr resultQueue = + std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq," + " not use it", + __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + std::shared_ptr inflightReq = std::make_shared( + 1, false, supportsPartialResults, partialResultCount, resultQueue); + + CameraMetadata defaultMetadata; + android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings; + ndk::ScopedAStatus ret = session->constructDefaultRequestSettings(RequestTemplate::PREVIEW, + &defaultMetadata); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* metadata = + reinterpret_cast(defaultMetadata.metadata.data()); + defaultSettings = metadata; + android::status_t metadataRet = ::android::OK; + uint8_t videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF; + if (previewStabilizationOn) { + videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION; + metadataRet = defaultSettings.update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + &videoStabilizationMode, 1); + } else { + metadataRet = defaultSettings.update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + &videoStabilizationMode, 1); + } + ASSERT_EQ(metadataRet, ::android::OK); + + camera_metadata_t* releasedMetadata = defaultSettings.release(); + uint8_t* rawMetadata = reinterpret_cast(releasedMetadata); + + buffer_handle_t buffer_handle; + + std::vector requests(1); + CaptureRequest& request = requests[0]; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings.metadata = + std::vector(rawMetadata, rawMetadata + get_camera_metadata_size(releasedMetadata)); + request.outputBuffers = std::vector(1); + StreamBuffer& outputBuffer = request.outputBuffers[0]; + if (useHalBufManager) { + outputBuffer = {halStreams[0].id, + /*bufferId*/ 0, NativeHandle(), BufferStatus::OK, + NativeHandle(), NativeHandle()}; + } else { + allocateGraphicBuffer(testStream.width, testStream.height, + /* We don't look at halStreamConfig.streams[0].consumerUsage + * since that is 0 for output streams + */ + android_convertGralloc1To0Usage( + static_cast(halStreams[0].producerUsage), + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + halStreams[0].overrideFormat, &buffer_handle); + outputBuffer = {halStreams[0].id, bufferId, ::android::makeToAidl(buffer_handle), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + + { + std::unique_lock l(mLock); + mInflightMap.clear(); + mInflightMap.insert(std::make_pair(frameNumber, inflightReq)); + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ret = session->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(numRequestProcessed, 1u); + + { + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + ASSERT_EQ(testStream.id, inflightReq->resultOutputBuffers[0].buffer.streamId); + ASSERT_TRUE(inflightReq->shutterReadoutTimestampValid); + nsecs_t readoutTimestamp = inflightReq->shutterReadoutTimestamp; + + if (previewStabilizationOn) { + // Here we collect the time difference between the buffer ready + // timestamp - notify readout timestamp. + // timeLag = buffer ready timestamp - notify readout timestamp. + // timeLag(previewStabilization) must be <= + // timeLag(stabilization off) + 1 frame duration. + auto it = cameraDeviceToTimeLag.find(name); + camera_metadata_entry e; + e = inflightReq->collectedResult.find(ANDROID_SENSOR_FRAME_DURATION); + ASSERT_TRUE(e.count > 0); + nsecs_t frameDuration = e.data.i64[0]; + ASSERT_TRUE(it != cameraDeviceToTimeLag.end()); + + nsecs_t previewStabOnLagTime = + inflightReq->resultOutputBuffers[0].timeStamp - readoutTimestamp; + ASSERT_TRUE(previewStabOnLagTime <= (it->second + frameDuration)); + } else { + // Fill in the buffer ready timestamp - notify timestamp; + cameraDeviceToTimeLag[std::string(name)] = + inflightReq->resultOutputBuffers[0].timeStamp - readoutTimestamp; + } + } + + if (useHalBufManager) { + verifyBuffersReturned(session, testStream.id, cb); + } + + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + } +} + +bool CameraAidlTest::supportsPreviewStabilization( + const std::string& name, const std::shared_ptr& provider) { + std::shared_ptr device; + ndk::ScopedAStatus ret = provider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + if (!ret.isOk() || device == nullptr) { + ADD_FAILURE() << "Failed to get camera device interface for " << name; + } + + CameraMetadata metadata; + ret = device->getCameraCharacteristics(&metadata); + camera_metadata_t* staticMeta = clone_camera_metadata( + reinterpret_cast(metadata.metadata.data())); + if (!(ret.isOk())) { + ADD_FAILURE() << "Failed to get camera characteristics for " << name; + } + // Go through the characteristics and see if video stabilization modes have + // preview stabilization + camera_metadata_ro_entry entry; + + int retcode = find_camera_metadata_ro_entry( + staticMeta, ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, &entry); + if ((0 == retcode) && (entry.count > 0)) { + for (auto i = 0; i < entry.count; i++) { + if (entry.data.u8[i] == + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION) { + return true; + } + } + } + return false; +} + +void CameraAidlTest::configurePreviewStreams( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* previewThreshold, const std::unordered_set& physicalIds, + std::shared_ptr* session, Stream* previewStream, + std::vector* halStreams, bool* supportsPartialResults, + int32_t* partialResultCount, bool* useHalBufManager, std::shared_ptr* cb, + int32_t streamConfigCounter, bool allowUnsupport) { + ASSERT_NE(nullptr, session); + ASSERT_NE(nullptr, halStreams); + ASSERT_NE(nullptr, previewStream); + ASSERT_NE(nullptr, supportsPartialResults); + ASSERT_NE(nullptr, partialResultCount); + ASSERT_NE(nullptr, useHalBufManager); + ASSERT_NE(nullptr, cb); + + ASSERT_FALSE(physicalIds.empty()); + + std::vector outputPreviewStreams; + std::shared_ptr device; + ALOGI("configureStreams: Testing camera device %s", name.c_str()); + + ndk::ScopedAStatus ret = provider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + CameraMetadata meta; + ret = device->getCameraCharacteristics(&meta); + ASSERT_TRUE(ret.isOk()); + camera_metadata_t* staticMeta = + clone_camera_metadata(reinterpret_cast(meta.metadata.data())); + ASSERT_NE(nullptr, staticMeta); + + camera_metadata_ro_entry entry; + auto status = + find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &entry); + if ((0 == status) && (entry.count > 0)) { + *partialResultCount = entry.data.i32[0]; + *supportsPartialResults = (*partialResultCount > 1); + } + + *cb = ndk::SharedRefBase::make(this, staticMeta); + ret = device->open(*cb, session); + ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(*session, nullptr); + + *useHalBufManager = false; + status = find_camera_metadata_ro_entry( + staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); + if ((0 == status) && (entry.count == 1)) { + *useHalBufManager = (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + } + + outputPreviewStreams.clear(); + Status rc = getAvailableOutputStreams(staticMeta, outputPreviewStreams, previewThreshold); + + ASSERT_EQ(Status::OK, rc); + ASSERT_FALSE(outputPreviewStreams.empty()); + + std::vector streams(physicalIds.size()); + int32_t streamId = 0; + for (auto const& physicalId : physicalIds) { + streams[streamId] = {streamId, + StreamType::OUTPUT, + outputPreviewStreams[0].width, + outputPreviewStreams[0].height, + static_cast(outputPreviewStreams[0].format), + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + physicalId, + 0, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + streamId++; + } + + StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE, CameraMetadata()}; + + RequestTemplate reqTemplate = RequestTemplate::PREVIEW; + ret = (*session)->constructDefaultRequestSettings(reqTemplate, &config.sessionParams); + ASSERT_TRUE(ret.isOk()); + + bool supported = false; + ret = device->isStreamCombinationSupported(config, &supported); + ASSERT_TRUE(ret.isOk()); + if (allowUnsupport && !supported) { + // stream combination not supported. return null session + ret = (*session)->close(); + ASSERT_TRUE(ret.isOk()); + *session = nullptr; + return; + } + ASSERT_TRUE(supported) << "Stream combination must be supported."; + + config.streamConfigCounter = streamConfigCounter; + std::vector halConfigs; + ret = (*session)->configureStreams(config, &halConfigs); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(physicalIds.size(), halConfigs.size()); + *halStreams = halConfigs; + if (*useHalBufManager) { + std::vector ss(physicalIds.size()); + std::vector hs(physicalIds.size()); + for (size_t i = 0; i < physicalIds.size(); i++) { + ss[i] = streams[i]; + hs[i] = halConfigs[i]; + } + (*cb)->setCurrentStreamConfig(ss, hs); + } + *previewStream = streams[0]; + ASSERT_TRUE(ret.isOk()); +} + +void CameraAidlTest::verifyBuffersReturned(const std::shared_ptr& session, + const std::vector& streamIds, + const std::shared_ptr& cb, + uint32_t streamConfigCounter) { + ndk::ScopedAStatus ret = + session->signalStreamFlush(streamIds, /*streamConfigCounter*/ streamConfigCounter); + ASSERT_TRUE(ret.isOk()); + cb->waitForBuffersReturned(); +} + +void CameraAidlTest::configureStreams(const std::string& name, + const std::shared_ptr& provider, + PixelFormat format, + std::shared_ptr* session, + Stream* previewStream, std::vector* halStreams, + bool* supportsPartialResults, int32_t* partialResultCount, + bool* useHalBufManager, std::shared_ptr* outCb, + uint32_t streamConfigCounter, bool maxResolution, + RequestAvailableDynamicRangeProfilesMap prof) { + ASSERT_NE(nullptr, session); + ASSERT_NE(nullptr, halStreams); + ASSERT_NE(nullptr, previewStream); + ASSERT_NE(nullptr, supportsPartialResults); + ASSERT_NE(nullptr, partialResultCount); + ASSERT_NE(nullptr, useHalBufManager); + ASSERT_NE(nullptr, outCb); + + ALOGI("configureStreams: Testing camera device %s", name.c_str()); + + std::vector outputStreams; + std::shared_ptr device; + + ndk::ScopedAStatus ret = provider->getCameraDeviceInterface(name, &device); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(device, nullptr); + + CameraMetadata metadata; + camera_metadata_t* staticMeta; + ret = device->getCameraCharacteristics(&metadata); + ASSERT_TRUE(ret.isOk()); + staticMeta = clone_camera_metadata( + reinterpret_cast(metadata.metadata.data())); + ASSERT_NE(staticMeta, nullptr); + + camera_metadata_ro_entry entry; + auto status = + find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &entry); + if ((0 == status) && (entry.count > 0)) { + *partialResultCount = entry.data.i32[0]; + *supportsPartialResults = (*partialResultCount > 1); + } + + *outCb = ndk::SharedRefBase::make(this, staticMeta); + ret = device->open(*outCb, session); + ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(*session, nullptr); + + *useHalBufManager = false; + status = find_camera_metadata_ro_entry( + staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); + if ((0 == status) && (entry.count == 1)) { + *useHalBufManager = (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + } + + outputStreams.clear(); + Size maxSize; + auto rc = getMaxOutputSizeForFormat(staticMeta, format, &maxSize, maxResolution); + ASSERT_EQ(Status::OK, rc); + + std::vector streams(1); + streams[0] = {0, + StreamType::OUTPUT, + maxSize.width, + maxSize.height, + format, + static_cast<::aidl::android::hardware::graphics::common::BufferUsage>( + GRALLOC1_CONSUMER_USAGE_CPU_READ), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + "", + 0, + -1, + {maxResolution ? SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION + : SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + prof}; + + StreamConfiguration config; + config.streams = streams; + config.operationMode = StreamConfigurationMode::NORMAL_MODE; + config.streamConfigCounter = streamConfigCounter; + config.multiResolutionInputImage = false; + CameraMetadata req; + RequestTemplate reqTemplate = RequestTemplate::STILL_CAPTURE; + ret = (*session)->constructDefaultRequestSettings(reqTemplate, &req); + ASSERT_TRUE(ret.isOk()); + config.sessionParams = req; + + bool supported = false; + ret = device->isStreamCombinationSupported(config, &supported); + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(supported, true); + + ret = (*session)->configureStreams(config, halStreams); + ASSERT_TRUE(ret.isOk()); + + if (*useHalBufManager) { + std::vector ss(1); + std::vector hs(1); + ss[0] = streams[0]; + hs[0] = (*halStreams)[0]; + (*outCb)->setCurrentStreamConfig(ss, hs); + } + + *previewStream = streams[0]; + ASSERT_TRUE(ret.isOk()); +} + +bool CameraAidlTest::is10BitDynamicRangeCapable(const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry scalerEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &scalerEntry); + if (rc == 0) { + for (uint32_t i = 0; i < scalerEntry.count; i++) { + if (scalerEntry.data.u8[i] == + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT) { + return true; + } + } + } + return false; +} + +void CameraAidlTest::get10BitDynamicRangeProfiles( + const camera_metadata_t* staticMeta, + std::vector* profiles) { + ASSERT_NE(nullptr, staticMeta); + ASSERT_NE(nullptr, profiles); + camera_metadata_ro_entry entry; + std::unordered_set entries; + int rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP, &entry); + ASSERT_EQ(rc, 0); + ASSERT_TRUE(entry.count > 0); + ASSERT_EQ(entry.count % 3, 0); + + for (uint32_t i = 0; i < entry.count; i += 3) { + ASSERT_NE(entry.data.i64[i], ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD); + ASSERT_EQ(entries.find(entry.data.i64[i]), entries.end()); + entries.insert(static_cast(entry.data.i64[i])); + profiles->emplace_back( + static_cast(entry.data.i64[i])); + } + + if (!entries.empty()) { + ASSERT_NE(entries.find(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10), + entries.end()); + } +} + +void CameraAidlTest::verify10BitMetadata( + HandleImporter& importer, const InFlightRequest& request, + aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap + profile) { + for (const auto& b : request.resultOutputBuffers) { + bool smpte2086Present = importer.isSmpte2086Present(b.buffer.buffer); + bool smpte2094_10Present = importer.isSmpte2094_10Present(b.buffer.buffer); + bool smpte2094_40Present = importer.isSmpte2094_40Present(b.buffer.buffer); + + switch (static_cast(profile)) { + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10: + ASSERT_FALSE(smpte2086Present); + ASSERT_FALSE(smpte2094_10Present); + ASSERT_FALSE(smpte2094_40Present); + break; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10: + ASSERT_TRUE(smpte2086Present); + ASSERT_FALSE(smpte2094_10Present); + ASSERT_FALSE(smpte2094_40Present); + break; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS: + ASSERT_FALSE(smpte2086Present); + ASSERT_FALSE(smpte2094_10Present); + ASSERT_TRUE(smpte2094_40Present); + break; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF: + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO: + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM: + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO: + 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: + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM: + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO: + ASSERT_FALSE(smpte2086Present); + ASSERT_TRUE(smpte2094_10Present); + ASSERT_FALSE(smpte2094_40Present); + break; + default: + ALOGE("%s: Unexpected 10-bit dynamic range profile: %" PRId64, __FUNCTION__, + profile); + ADD_FAILURE(); + } + } +} + +void CameraAidlTest::configurePreviewStream( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* previewThreshold, std::shared_ptr* session, + Stream* previewStream, std::vector* halStreams, bool* supportsPartialResults, + int32_t* partialResultCount, bool* useHalBufManager, std::shared_ptr* cb, + uint32_t streamConfigCounter) { + configureSingleStream(name, provider, previewThreshold, GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, + RequestTemplate::PREVIEW, session, previewStream, halStreams, + supportsPartialResults, partialResultCount, useHalBufManager, cb, + streamConfigCounter); +} + +Status CameraAidlTest::isOfflineSessionSupported(const camera_metadata_t* staticMeta) { + Status ret = Status::OPERATION_NOT_SUPPORTED; + if (nullptr == staticMeta) { + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &entry); + if (0 != rc) { + return Status::ILLEGAL_ARGUMENT; + } + + for (size_t i = 0; i < entry.count; i++) { + if (ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING == entry.data.u8[i]) { + ret = Status::OK; + break; + } + } + + return ret; +} + +void CameraAidlTest::configureOfflineStillStream( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* threshold, std::shared_ptr* session, + Stream* stream, std::vector* halStreams, bool* supportsPartialResults, + int32_t* partialResultCount, std::shared_ptr* outCb, int32_t* jpegBufferSize, + bool* useHalBufManager) { + ASSERT_NE(nullptr, session); + ASSERT_NE(nullptr, halStreams); + ASSERT_NE(nullptr, stream); + ASSERT_NE(nullptr, supportsPartialResults); + ASSERT_NE(nullptr, partialResultCount); + ASSERT_NE(nullptr, outCb); + ASSERT_NE(nullptr, jpegBufferSize); + ASSERT_NE(nullptr, useHalBufManager); + + std::vector outputStreams; + std::shared_ptr cameraDevice; + ALOGI("configureStreams: Testing camera device %s", name.c_str()); + + ndk::ScopedAStatus ret = provider->getCameraDeviceInterface(name, &cameraDevice); + ASSERT_TRUE(ret.isOk()); + ALOGI("getCameraDeviceInterface returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_NE(cameraDevice, nullptr); + + CameraMetadata metadata; + ret = cameraDevice->getCameraCharacteristics(&metadata); + ASSERT_TRUE(ret.isOk()); + camera_metadata_t* staticMeta = clone_camera_metadata( + reinterpret_cast(metadata.metadata.data())); + ASSERT_NE(nullptr, staticMeta); + + camera_metadata_ro_entry entry; + auto status = + find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &entry); + if ((0 == status) && (entry.count > 0)) { + *partialResultCount = entry.data.i32[0]; + *supportsPartialResults = (*partialResultCount > 1); + } + + *useHalBufManager = false; + status = find_camera_metadata_ro_entry( + staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry); + if ((0 == status) && (entry.count == 1)) { + *useHalBufManager = (entry.data.u8[0] == + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5); + } + + auto st = getJpegBufferSize(staticMeta, jpegBufferSize); + ASSERT_EQ(st, Status::OK); + + *outCb = ndk::SharedRefBase::make(this, staticMeta); + ret = cameraDevice->open(*outCb, session); + ASSERT_TRUE(ret.isOk()); + ALOGI("device::open returns status:%d:%d", ret.getExceptionCode(), + ret.getServiceSpecificError()); + ASSERT_NE(session, nullptr); + + outputStreams.clear(); + auto rc = getAvailableOutputStreams(staticMeta, outputStreams, threshold); + size_t idx = 0; + int currLargest = outputStreams[0].width * outputStreams[0].height; + for (size_t i = 0; i < outputStreams.size(); i++) { + int area = outputStreams[i].width * outputStreams[i].height; + if (area > currLargest) { + idx = i; + currLargest = area; + } + } + + ASSERT_EQ(Status::OK, rc); + ASSERT_FALSE(outputStreams.empty()); + + Dataspace dataspace = getDataspace(static_cast(outputStreams[idx].format)); + + std::vector streams(/*size*/ 1); + streams[0] = {/*id*/ 0, + StreamType::OUTPUT, + outputStreams[idx].width, + outputStreams[idx].height, + static_cast(outputStreams[idx].format), + static_cast<::aidl::android::hardware::graphics::common::BufferUsage>( + GRALLOC1_CONSUMER_USAGE_CPU_READ), + dataspace, + StreamRotation::ROTATION_0, + /*physicalId*/ std::string(), + *jpegBufferSize, + /*groupId*/ 0, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + StreamConfiguration config = {streams, StreamConfigurationMode::NORMAL_MODE, CameraMetadata()}; + + (*session)->configureStreams(config, halStreams); + ASSERT_TRUE(ret.isOk()); + + if (*useHalBufManager) { + (*outCb)->setCurrentStreamConfig(streams, *halStreams); + } + + *stream = streams[0]; +} + +void CameraAidlTest::updateInflightResultQueue( + const std::shared_ptr& resultQueue) { + std::unique_lock l(mLock); + for (auto& it : mInflightMap) { + it.second->resultQueue = resultQueue; + } +} \ No newline at end of file diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ac4b2c9d0e8683a1fa0804e40c78a2a6be2c7cc4 --- /dev/null +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -0,0 +1,531 @@ +/* + * Copyright (C) 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_CAMERA_AIDL_TEST_H_ +#define HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_CAMERA_AIDL_TEST_H_ + +#define LOG_TAG "camera_aidl_hal_test" + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include +#include +#include +#include + +using ::aidl::android::hardware::camera::common::Status; +using ::aidl::android::hardware::camera::common::TorchModeStatus; +using ::aidl::android::hardware::camera::device::BufferRequest; +using ::aidl::android::hardware::camera::device::BufferRequestStatus; +using ::aidl::android::hardware::camera::device::CameraMetadata; +using ::aidl::android::hardware::camera::device::CaptureResult; +using ::aidl::android::hardware::camera::device::ErrorCode; +using ::aidl::android::hardware::camera::device::HalStream; +using ::aidl::android::hardware::camera::device::ICameraDevice; +using ::aidl::android::hardware::camera::device::ICameraDeviceSession; +using ::aidl::android::hardware::camera::device::ICameraInjectionSession; +using ::aidl::android::hardware::camera::device::NotifyMsg; +using ::aidl::android::hardware::camera::device::PhysicalCameraMetadata; +using ::aidl::android::hardware::camera::device::RequestTemplate; +using ::aidl::android::hardware::camera::device::Stream; +using ::aidl::android::hardware::camera::device::StreamBuffer; +using ::aidl::android::hardware::camera::device::StreamBufferRet; +using ::aidl::android::hardware::camera::device::StreamConfiguration; +using ::aidl::android::hardware::camera::device::StreamConfigurationMode; +using ::aidl::android::hardware::camera::provider::ConcurrentCameraIdCombination; +using ::aidl::android::hardware::camera::provider::ICameraProvider; + +using ::aidl::android::hardware::common::NativeHandle; +using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; + +using ::aidl::android::hardware::graphics::common::Dataspace; +using ::aidl::android::hardware::graphics::common::PixelFormat; + +using ::android::hardware::camera::common::V1_0::helper::HandleImporter; +using ::android::hardware::camera::common::V1_0::helper::Size; + +using ResultMetadataQueue = android::AidlMessageQueue; + +using ::ndk::ScopedAStatus; + +class DeviceCb; // Forward declare to break circular header dependency + +class CameraAidlTest : public ::testing::TestWithParam { + public: + enum SystemCameraKind { + /** + * These camera devices are visible to all apps and system components alike + */ + PUBLIC = 0, + + /** + * These camera devices are visible only to processes having the + * android.permission.SYSTEM_CAMERA permission. They are not exposed to 3P + * apps. + */ + SYSTEM_ONLY_CAMERA, + + /** + * These camera devices are visible only to HAL clients (that try to connect + * on a hwbinder thread). + */ + HIDDEN_SECURE_CAMERA + }; + + struct AvailableStream { + int32_t width; + int32_t height; + int32_t format; + }; + + enum ReprocessType { + PRIV_REPROCESS, + YUV_REPROCESS, + }; + + struct AvailableZSLInputOutput { + int32_t inputFormat; + int32_t outputFormat; + }; + + virtual void SetUp() override; + virtual void TearDown() override; + + std::vector getCameraDeviceNames(std::shared_ptr& provider, + bool addSecureOnly = false); + + static bool isSecureOnly(const std::shared_ptr& provider, + const std::string& name); + + std::map getCameraDeviceIdToNameMap( + std::shared_ptr provider); + + static std::vector getConcurrentDeviceCombinations( + std::shared_ptr& provider); + + void notifyDeviceState(int64_t state); + + static void allocateGraphicBuffer(uint32_t width, uint32_t height, uint64_t usage, + PixelFormat format, buffer_handle_t* buffer_handle /*out*/); + + static void openEmptyDeviceSession(const std::string& name, + const std::shared_ptr& provider, + std::shared_ptr* session /*out*/, + CameraMetadata* staticMeta /*out*/, + std::shared_ptr* device /*out*/); + static void openEmptyInjectionSession(const std::string& name, + const std::shared_ptr& provider, + std::shared_ptr* session /*out*/, + CameraMetadata* staticMeta /*out*/, + std::shared_ptr* device /*out*/); + + static void createStreamConfiguration(std::vector& streams, + StreamConfigurationMode configMode, + StreamConfiguration* config, int32_t jpegBufferSize = 0); + + void configureOfflineStillStream( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* threshold, + std::shared_ptr* session /*out*/, Stream* stream /*out*/, + std::vector* halStreams, bool* supportsPartialResults /*out*/, + int32_t* partialResultCount /*out*/, std::shared_ptr* outCb /*out*/, + int32_t* jpegBufferSize /*out*/, bool* useHalBufManager /*out*/); + + void configureStreams( + const std::string& name, const std::shared_ptr& provider, + PixelFormat format, std::shared_ptr* session /*out*/, + Stream* previewStream /*out*/, std::vector* halStreams /*out*/, + bool* supportsPartialResults /*out*/, int32_t* partialResultCount /*out*/, + bool* useHalBufManager /*out*/, std::shared_ptr* outCb /*out*/, + uint32_t streamConfigCounter, bool maxResolution, + aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap + prof = ::aidl::android::hardware::camera::metadata:: + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD); + + void configurePreviewStreams( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* previewThreshold, + const std::unordered_set& physicalIds, + std::shared_ptr* session /*out*/, Stream* previewStream /*out*/, + std::vector* halStreams /*out*/, bool* supportsPartialResults /*out*/, + int32_t* partialResultCount /*out*/, bool* useHalBufManager /*out*/, + std::shared_ptr* cb /*out*/, int32_t streamConfigCounter = 0, + bool allowUnsupport = false); + + void configurePreviewStream( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* previewThreshold, + std::shared_ptr* session /*out*/, Stream* previewStream /*out*/, + std::vector* halStreams /*out*/, bool* supportsPartialResults /*out*/, + int32_t* partialResultCount /*out*/, bool* useHalBufManager /*out*/, + std::shared_ptr* cb /*out*/, uint32_t streamConfigCounter = 0); + + void configureSingleStream( + const std::string& name, const std::shared_ptr& provider, + const AvailableStream* previewThreshold, uint64_t bufferUsage, + RequestTemplate reqTemplate, std::shared_ptr* session /*out*/, + Stream* previewStream /*out*/, std::vector* halStreams /*out*/, + bool* supportsPartialResults /*out*/, int32_t* partialResultCount /*out*/, + bool* useHalBufManager /*out*/, std::shared_ptr* cb /*out*/, + uint32_t streamConfigCounter = 0); + + void verifyLogicalOrUltraHighResCameraMetadata(const std::string& cameraName, + const std::shared_ptr& device, + const CameraMetadata& chars, + const std::vector& deviceNames); + + static void verifyCameraCharacteristics(const CameraMetadata& chars); + + static void verifyExtendedSceneModeCharacteristics(const camera_metadata_t* metadata); + + static void verifyZoomCharacteristics(const camera_metadata_t* metadata); + + static void verifyRecommendedConfigs(const CameraMetadata& chars); + + static void verifyMonochromeCharacteristics(const CameraMetadata& chars); + + static void verifyMonochromeCameraResult( + const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& metadata); + + static void verifyStreamUseCaseCharacteristics(const camera_metadata_t* metadata); + + static void verifyStreamCombination(const std::shared_ptr& device, + const StreamConfiguration& config, bool expectedStatus, + bool expectStreamCombQuery); + + static void verifyLogicalCameraResult(const camera_metadata_t* staticMetadata, + const std::vector& resultMetadata); + + static void verifyBuffersReturned(const std::shared_ptr& session, + int32_t streamId, const std::shared_ptr& cb, + uint32_t streamConfigCounter = 0); + + void verifyBuffersReturned(const std::shared_ptr& session, + const std::vector& streamIds, + const std::shared_ptr& cb, + uint32_t streamConfigCounter = 0); + + static void verifySessionReconfigurationQuery( + const std::shared_ptr& session, camera_metadata* oldSessionParams, + camera_metadata* newSessionParams); + + static void verifyRequestTemplate(const camera_metadata_t* metadata, + RequestTemplate requestTemplate); + + static void overrideRotateAndCrop(CameraMetadata* settings /*in/out*/); + + static bool isDepthOnly(const camera_metadata_t* staticMeta); + + static bool isUltraHighResolution(const camera_metadata_t* staticMeta); + + static Status getAvailableOutputStreams(const camera_metadata_t* staticMeta, + std::vector& outputStreams, + const AvailableStream* threshold = nullptr, + bool maxResolution = false); + + static Status getMaxOutputSizeForFormat(const camera_metadata_t* staticMeta, PixelFormat format, + Size* size, bool maxResolution = false); + + static Status getMandatoryConcurrentStreams(const camera_metadata_t* staticMeta, + std::vector* outputStreams); + + static bool supportsPreviewStabilization(const std::string& name, + const std::shared_ptr& provider); + + static Status getJpegBufferSize(camera_metadata_t* staticMeta, int32_t* outBufSize); + + static Status isConstrainedModeAvailable(camera_metadata_t* staticMeta); + + static Status isLogicalMultiCamera(const camera_metadata_t* staticMeta); + + static bool isTorchSupported(const camera_metadata_t* staticMeta); + + static bool isTorchStrengthControlSupported(const camera_metadata_t* staticMeta); + + static Status isOfflineSessionSupported(const camera_metadata_t* staticMeta); + + static Status getPhysicalCameraIds(const camera_metadata_t* staticMeta, + std::unordered_set* physicalIds /*out*/); + + static Status getSupportedKeys(camera_metadata_t* staticMeta, uint32_t tagId, + std::unordered_set* requestIDs /*out*/); + + static void fillOutputStreams(camera_metadata_ro_entry_t* entry, + std::vector& outputStreams, + const AvailableStream* threshold = nullptr, + const int32_t availableConfigOutputTag = 0u); + + static void constructFilteredSettings( + const std::shared_ptr& session, + const std::unordered_set& availableKeys, RequestTemplate reqTemplate, + android::hardware::camera::common::V1_0::helper::CameraMetadata* + defaultSettings /*out*/, + android::hardware::camera::common::V1_0::helper::CameraMetadata* filteredSettings + /*out*/); + + static Status pickConstrainedModeSize(camera_metadata_t* staticMeta, + AvailableStream& hfrStream); + + static Status isZSLModeAvailable(const camera_metadata_t* staticMeta); + + static Status isZSLModeAvailable(const camera_metadata_t* staticMeta, ReprocessType reprocType); + + static Status getZSLInputOutputMap(camera_metadata_t* staticMeta, + std::vector& inputOutputMap); + + static Status findLargestSize(const std::vector& streamSizes, int32_t format, + AvailableStream& result); + + static Status isMonochromeCamera(const camera_metadata_t* staticMeta); + + static Status getSystemCameraKind(const camera_metadata_t* staticMeta, + SystemCameraKind* systemCameraKind); + + static void getMultiResolutionStreamConfigurations( + camera_metadata_ro_entry* multiResStreamConfigs, + camera_metadata_ro_entry* streamConfigs, + camera_metadata_ro_entry* maxResolutionStreamConfigs, + const camera_metadata_t* staticMetadata); + + static void getPrivacyTestPatternModes( + const camera_metadata_t* staticMetadata, + std::unordered_set* privacyTestPatternModes /*out*/); + + static Dataspace getDataspace(PixelFormat format); + + void processCaptureRequestInternal(uint64_t bufferUsage, RequestTemplate reqTemplate, + bool useSecureOnlyCameras); + + void processPreviewStabilizationCaptureRequestInternal( + bool previewStabilizationOn, + /*inout*/ std::unordered_map& cameraDeviceToTimeLag); + + static bool is10BitDynamicRangeCapable(const camera_metadata_t* staticMeta); + + static void get10BitDynamicRangeProfiles( + const camera_metadata_t* staticMeta, + std::vector* profiles); + + // Used by switchToOffline where a new result queue is created for offline reqs + void updateInflightResultQueue(const std::shared_ptr& resultQueue); + + static Size getMinSize(Size a, Size b); + + protected: + // In-flight queue for tracking completion of capture requests. + struct InFlightRequest { + // Set by notify() SHUTTER call. + nsecs_t shutterTimestamp; + + bool shutterReadoutTimestampValid; + nsecs_t shutterReadoutTimestamp; + + bool errorCodeValid; + ErrorCode errorCode; + + // Is partial result supported + bool usePartialResult; + + // Partial result count expected + int32_t numPartialResults; + + // Message queue + std::shared_ptr resultQueue; + + // Set by process_capture_result call with valid metadata + bool haveResultMetadata; + + // Decremented by calls to process_capture_result with valid output + // and input buffers + ssize_t numBuffersLeft; + + // A 64bit integer to index the frame number associated with this result. + int64_t frameNumber; + + // The partial result count (index) for this capture result. + int32_t partialResultCount; + + // For buffer drop errors, the stream ID for the stream that lost a buffer. + // For physical sub-camera result errors, the Id of the physical stream + // for the physical sub-camera. + // Otherwise -1. + int32_t errorStreamId; + + // If this request has any input buffer + bool hasInputBuffer; + + // Result metadata + ::android::hardware::camera::common::V1_0::helper::CameraMetadata collectedResult; + + // A copy-able StreamBuffer using buffer_handle_t instead of AIDLs NativeHandle + struct NativeStreamBuffer { + int32_t streamId; + int64_t bufferId; + buffer_handle_t buffer; + aidl::android::hardware::camera::device::BufferStatus status; + buffer_handle_t acquireFence; + buffer_handle_t releaseFence; + }; + + // Buffers are added by process_capture_result when output buffers + // return from HAL but framework. + struct StreamBufferAndTimestamp { + NativeStreamBuffer buffer; + nsecs_t timeStamp; + }; + std::vector resultOutputBuffers; + + std::unordered_set expectedPhysicalResults; + + InFlightRequest() + : shutterTimestamp(0), + shutterReadoutTimestampValid(false), + shutterReadoutTimestamp(0), + errorCodeValid(false), + errorCode(ErrorCode::ERROR_BUFFER), + usePartialResult(false), + numPartialResults(0), + resultQueue(nullptr), + haveResultMetadata(false), + numBuffersLeft(0), + frameNumber(0), + partialResultCount(0), + errorStreamId(-1), + hasInputBuffer(false), + collectedResult(1, 10) {} + + InFlightRequest(ssize_t numBuffers, bool hasInput, bool partialResults, + int32_t partialCount, std::shared_ptr queue = nullptr) + : shutterTimestamp(0), + shutterReadoutTimestampValid(false), + shutterReadoutTimestamp(0), + errorCodeValid(false), + errorCode(ErrorCode::ERROR_BUFFER), + usePartialResult(partialResults), + numPartialResults(partialCount), + resultQueue(queue), + haveResultMetadata(false), + numBuffersLeft(numBuffers), + frameNumber(0), + partialResultCount(0), + errorStreamId(-1), + hasInputBuffer(hasInput), + collectedResult(1, 10) {} + + InFlightRequest(ssize_t numBuffers, bool hasInput, bool partialResults, + int32_t partialCount, + const std::unordered_set& extraPhysicalResult, + std::shared_ptr queue = nullptr) + : shutterTimestamp(0), + shutterReadoutTimestampValid(false), + shutterReadoutTimestamp(0), + errorCodeValid(false), + errorCode(ErrorCode::ERROR_BUFFER), + usePartialResult(partialResults), + numPartialResults(partialCount), + resultQueue(queue), + haveResultMetadata(false), + numBuffersLeft(numBuffers), + frameNumber(0), + partialResultCount(0), + errorStreamId(-1), + hasInputBuffer(hasInput), + collectedResult(1, 10), + expectedPhysicalResults(extraPhysicalResult) {} + }; + + static bool matchDeviceName(const std::string& deviceName, const std::string& providerType, + std::string* deviceVersion, std::string* cameraId); + + static void verify10BitMetadata( + HandleImporter& importer, const InFlightRequest& request, + aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap + profile); + + // Map from frame number to the in-flight request state + typedef std::unordered_map> InFlightMap; + + std::mutex mLock; // Synchronize access to member variables + std::condition_variable mResultCondition; // Condition variable for incoming results + InFlightMap mInflightMap; // Map of all inflight requests + + std::vector mNotifyMessages; // Current notification message + + std::mutex mTorchLock; // Synchronize access to torch status + std::condition_variable mTorchCond; // Condition variable for torch status + TorchModeStatus mTorchStatus; // Current torch status + + // Camera provider service + std::shared_ptr mProvider; + + // Camera device session used by the tests + // Tests should take care of closing this session and setting it back to nullptr in successful + // case. Declared as a field to allow TeadDown function to close the session if a test assertion + // fails. + std::shared_ptr mSession; + + // Camera provider type. + std::string mProviderType; + + HandleImporter mHandleImporter; + + friend class DeviceCb; + friend class SimpleDeviceCb; + friend class TorchProviderCb; +}; + +namespace { +// device@.//id +const char* kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/\\s+/(.+)"; +const int32_t kMaxVideoWidth = 4096; +const int32_t kMaxVideoHeight = 2160; + +const int64_t kStreamBufferTimeoutSec = 3; +const int64_t kTorchTimeoutSec = 1; +const char* kDumpOutput = "/dev/null"; +const uint32_t kMaxPreviewWidth = 1920; +const uint32_t kMaxPreviewHeight = 1080; +} // namespace +#endif // HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_CAMERA_AIDL_TEST_H_ diff --git a/camera/provider/aidl/vts/device_cb.cpp b/camera/provider/aidl/vts/device_cb.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e5f2f1eae4e8dc99348c6a272a4e0eace452f912 --- /dev/null +++ b/camera/provider/aidl/vts/device_cb.cpp @@ -0,0 +1,544 @@ +/* + * Copyright (C) 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. + */ + +#include "device_cb.h" + +#include +#include +#include +#include +#include + +using ::aidl::android::hardware::camera::device::BufferStatus; +using ::aidl::android::hardware::camera::device::ErrorMsg; +using ::aidl::android::hardware::camera::device::StreamBufferRequestError; +using ::aidl::android::hardware::camera::device::StreamBuffersVal; +using ::aidl::android::hardware::graphics::common::PixelFormat; + +const int64_t kBufferReturnTimeoutSec = 1; + +DeviceCb::DeviceCb(CameraAidlTest* parent, camera_metadata_t* staticMeta) : mParent(parent) { + mStaticMetadata = staticMeta; +} + +ScopedAStatus DeviceCb::notify(const std::vector& msgs) { + std::vector> readoutTimestamps; + + size_t count = msgs.size(); + readoutTimestamps.resize(count); + + for (size_t i = 0; i < count; i++) { + const NotifyMsg& msg = msgs[i]; + switch (msg.getTag()) { + case NotifyMsg::Tag::error: + readoutTimestamps[i] = {false, 0}; + break; + case NotifyMsg::Tag::shutter: + const auto& shutter = msg.get(); + readoutTimestamps[i] = {true, shutter.readoutTimestamp}; + break; + } + } + + return notifyHelper(msgs, readoutTimestamps); +} + +ScopedAStatus DeviceCb::processCaptureResult(const std::vector& results) { + if (nullptr == mParent) { + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + + bool notify = false; + std::unique_lock l(mParent->mLock); + for (const auto& result : results) { + notify = processCaptureResultLocked(result, result.physicalCameraMetadata); + } + + l.unlock(); + if (notify) { + mParent->mResultCondition.notify_one(); + } + + return ndk::ScopedAStatus::ok(); +} + +ScopedAStatus DeviceCb::requestStreamBuffers(const std::vector& bufReqs, + std::vector* buffers, + BufferRequestStatus* _aidl_return) { + std::vector& bufRets = *buffers; + std::unique_lock l(mLock); + + if (!mUseHalBufManager) { + ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__); + ADD_FAILURE(); + *_aidl_return = BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS; + return ScopedAStatus::ok(); + } + + if (bufReqs.size() > mStreams.size()) { + ALOGE("%s: illegal buffer request: too many requests!", __FUNCTION__); + ADD_FAILURE(); + *_aidl_return = BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS; + return ndk::ScopedAStatus::ok(); + } + + std::vector indexes(bufReqs.size()); + for (size_t i = 0; i < bufReqs.size(); i++) { + bool found = false; + for (size_t idx = 0; idx < mStreams.size(); idx++) { + if (bufReqs[i].streamId == mStreams[idx].id) { + found = true; + indexes[i] = idx; + break; + } + } + if (!found) { + ALOGE("%s: illegal buffer request: unknown streamId %d!", __FUNCTION__, + bufReqs[i].streamId); + ADD_FAILURE(); + *_aidl_return = BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS; + return ScopedAStatus::ok(); + } + } + + bool allStreamOk = true; + bool atLeastOneStreamOk = false; + bufRets.resize(bufReqs.size()); + + for (size_t i = 0; i < bufReqs.size(); i++) { + size_t idx = indexes[i]; + const auto& stream = mStreams[idx]; + const auto& halStream = mHalStreams[idx]; + const BufferRequest& bufReq = bufReqs[i]; + + if (mOutstandingBufferIds[idx].size() + bufReq.numBuffersRequested > halStream.maxBuffers) { + bufRets[i].streamId = stream.id; + bufRets[i].val.set( + StreamBufferRequestError::MAX_BUFFER_EXCEEDED); + allStreamOk = false; + continue; + } + + std::vector tmpRetBuffers(bufReq.numBuffersRequested); + for (size_t j = 0; j < bufReq.numBuffersRequested; j++) { + buffer_handle_t handle; + uint32_t w = stream.width; + uint32_t h = stream.height; + if (stream.format == PixelFormat::BLOB) { + w = stream.bufferSize; + h = 1; + } + + CameraAidlTest::allocateGraphicBuffer( + w, h, + android_convertGralloc1To0Usage(static_cast(halStream.producerUsage), + static_cast(halStream.consumerUsage)), + halStream.overrideFormat, &handle); + + StreamBuffer streamBuffer = StreamBuffer(); + StreamBuffer& sb = tmpRetBuffers[j]; + sb = { + stream.id, mNextBufferId, ::android::dupToAidl(handle), + BufferStatus::OK, NativeHandle(), NativeHandle(), + }; + + mOutstandingBufferIds[idx][mNextBufferId++] = ::android::dupToAidl(handle); + } + atLeastOneStreamOk = true; + bufRets[i].streamId = stream.id; + bufRets[i].val.set(std::move(tmpRetBuffers)); + } + + if (allStreamOk) { + *_aidl_return = BufferRequestStatus::OK; + } else if (atLeastOneStreamOk) { + *_aidl_return = BufferRequestStatus::FAILED_PARTIAL; + } else { + *_aidl_return = BufferRequestStatus::FAILED_UNKNOWN; + } + + if (!hasOutstandingBuffersLocked()) { + l.unlock(); + mFlushedCondition.notify_one(); + } + + return ndk::ScopedAStatus::ok(); +} + +ScopedAStatus DeviceCb::returnStreamBuffers(const std::vector& buffers) { + if (!mUseHalBufManager) { + ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__); + ADD_FAILURE(); + } + + std::unique_lock l(mLock); + for (const auto& buf : buffers) { + if (buf.bufferId == 0) { + // Don't return buffers of bufId 0 (empty buffer) + continue; + } + bool found = false; + for (size_t idx = 0; idx < mOutstandingBufferIds.size(); idx++) { + if (mStreams[idx].id == buf.streamId && + mOutstandingBufferIds[idx].count(buf.bufferId) == 1) { + mOutstandingBufferIds[idx].erase(buf.bufferId); + // TODO: check do we need to close/delete native handle or assume we have enough + // memory to run till the test finish? since we do not capture much requests (and + // most of time one buffer is sufficient) + found = true; + break; + } + } + if (found) { + continue; + } + ALOGE("%s: unknown buffer ID %" PRIu64, __FUNCTION__, buf.bufferId); + ADD_FAILURE(); + } + if (!hasOutstandingBuffersLocked()) { + l.unlock(); + mFlushedCondition.notify_one(); + } + + return ndk::ScopedAStatus::ok(); +} + +void DeviceCb::setCurrentStreamConfig(const std::vector& streams, + const std::vector& halStreams) { + ASSERT_EQ(streams.size(), halStreams.size()); + ASSERT_NE(streams.size(), 0); + for (size_t i = 0; i < streams.size(); i++) { + ASSERT_EQ(streams[i].id, halStreams[i].id); + } + std::lock_guard l(mLock); + mUseHalBufManager = true; + mStreams = streams; + mHalStreams = halStreams; + mOutstandingBufferIds.clear(); + for (size_t i = 0; i < streams.size(); i++) { + mOutstandingBufferIds.emplace_back(); + } +} + +void DeviceCb::waitForBuffersReturned() { + std::unique_lock lk(mLock); + if (hasOutstandingBuffersLocked()) { + auto timeout = std::chrono::seconds(kBufferReturnTimeoutSec); + auto st = mFlushedCondition.wait_for(lk, timeout); + ASSERT_NE(std::cv_status::timeout, st); + } +} + +bool DeviceCb::processCaptureResultLocked( + const CaptureResult& results, std::vector physicalCameraMetadata) { + bool notify = false; + uint32_t frameNumber = results.frameNumber; + + if ((results.result.metadata.empty()) && (results.outputBuffers.empty()) && + (results.inputBuffer.buffer.fds.empty()) && (results.fmqResultSize == 0)) { + ALOGE("%s: No result data provided by HAL for frame %d result count: %d", __func__, + frameNumber, (int)results.fmqResultSize); + ADD_FAILURE(); + return notify; + } + + auto requestEntry = mParent->mInflightMap.find(frameNumber); + if (requestEntry == mParent->mInflightMap.end()) { + ALOGE("%s: Unexpected frame number! received: %u", __func__, frameNumber); + ADD_FAILURE(); + return notify; + } + + bool isPartialResult = false; + bool hasInputBufferInRequest = false; + auto& request = requestEntry->second; + + CameraMetadata resultMetadata; + size_t resultSize = 0; + if (results.fmqResultSize > 0) { + resultMetadata.metadata.resize(results.fmqResultSize); + if (request->resultQueue == nullptr) { + ADD_FAILURE(); + return notify; + } + + if (!request->resultQueue->read(reinterpret_cast(resultMetadata.metadata.data()), + results.fmqResultSize)) { + ALOGE("%s: Frame %d: Cannot read camera metadata from fmq," + "size = %" PRIu64, + __func__, frameNumber, results.fmqResultSize); + ADD_FAILURE(); + return notify; + } + + // Physical device results are only expected in the last/final + // partial result notification. + bool expectPhysicalResults = !(request->usePartialResult && + (results.partialResult < request->numPartialResults)); + if (expectPhysicalResults && + (physicalCameraMetadata.size() != request->expectedPhysicalResults.size())) { + ALOGE("%s: Frame %d: Returned physical metadata count %zu " + "must be equal to expected count %zu", + __func__, frameNumber, physicalCameraMetadata.size(), + request->expectedPhysicalResults.size()); + ADD_FAILURE(); + return notify; + } + std::vector> physResultMetadata; + physResultMetadata.resize(physicalCameraMetadata.size()); + for (size_t i = 0; i < physicalCameraMetadata.size(); i++) { + physResultMetadata[i].resize(physicalCameraMetadata[i].fmqMetadataSize); + if (!request->resultQueue->read(reinterpret_cast(physResultMetadata[i].data()), + physicalCameraMetadata[i].fmqMetadataSize)) { + ALOGE("%s: Frame %d: Cannot read physical camera metadata from fmq," + "size = %" PRIu64, + __func__, frameNumber, physicalCameraMetadata[i].fmqMetadataSize); + ADD_FAILURE(); + return notify; + } + } + resultSize = resultMetadata.metadata.size(); + } else if (!results.result.metadata.empty()) { + resultMetadata = results.result; + resultSize = resultMetadata.metadata.size(); + } + + if (!request->usePartialResult && (resultSize > 0) && (results.partialResult != 1)) { + ALOGE("%s: Result is malformed for frame %d: partial_result %u " + "must be 1 if partial result is not supported", + __func__, frameNumber, results.partialResult); + ADD_FAILURE(); + return notify; + } + + if (results.partialResult != 0) { + request->partialResultCount = results.partialResult; + } + + // Check if this result carries only partial metadata + if (request->usePartialResult && (resultSize > 0)) { + if ((results.partialResult > request->numPartialResults) || (results.partialResult < 1)) { + ALOGE("%s: Result is malformed for frame %d: partial_result %u" + " must be in the range of [1, %d] when metadata is " + "included in the result", + __func__, frameNumber, results.partialResult, request->numPartialResults); + ADD_FAILURE(); + return notify; + } + + // Verify no duplicate tags between partial results + const camera_metadata_t* partialMetadata = + reinterpret_cast(resultMetadata.metadata.data()); + const camera_metadata_t* collectedMetadata = request->collectedResult.getAndLock(); + camera_metadata_ro_entry_t searchEntry, foundEntry; + for (size_t i = 0; i < get_camera_metadata_entry_count(partialMetadata); i++) { + if (0 != get_camera_metadata_ro_entry(partialMetadata, i, &searchEntry)) { + ADD_FAILURE(); + request->collectedResult.unlock(collectedMetadata); + return notify; + } + if (-ENOENT != + find_camera_metadata_ro_entry(collectedMetadata, searchEntry.tag, &foundEntry)) { + ADD_FAILURE(); + request->collectedResult.unlock(collectedMetadata); + return notify; + } + } + request->collectedResult.unlock(collectedMetadata); + request->collectedResult.append(partialMetadata); + + isPartialResult = (results.partialResult < request->numPartialResults); + } else if (resultSize > 0) { + request->collectedResult.append( + reinterpret_cast(resultMetadata.metadata.data())); + isPartialResult = false; + } + + hasInputBufferInRequest = request->hasInputBuffer; + + // Did we get the (final) result metadata for this capture? + if ((resultSize > 0) && !isPartialResult) { + if (request->haveResultMetadata) { + ALOGE("%s: Called multiple times with metadata for frame %d", __func__, frameNumber); + ADD_FAILURE(); + return notify; + } + request->haveResultMetadata = true; + request->collectedResult.sort(); + + // Verify final result metadata + camera_metadata_t* staticMetadataBuffer = mStaticMetadata; + bool isMonochrome = Status::OK == CameraAidlTest::isMonochromeCamera(staticMetadataBuffer); + if (isMonochrome) { + CameraAidlTest::verifyMonochromeCameraResult(request->collectedResult); + } + + // Verify logical camera result metadata + bool isLogicalCamera = + Status::OK == CameraAidlTest::isLogicalMultiCamera(staticMetadataBuffer); + if (isLogicalCamera) { + camera_metadata_t* collectedMetadata = + const_cast(request->collectedResult.getAndLock()); + uint8_t* rawMetadata = reinterpret_cast(collectedMetadata); + std::vector metadata = std::vector( + rawMetadata, rawMetadata + get_camera_metadata_size(collectedMetadata)); + CameraAidlTest::verifyLogicalCameraResult(staticMetadataBuffer, metadata); + request->collectedResult.unlock(collectedMetadata); + } + } + + uint32_t numBuffersReturned = results.outputBuffers.size(); + auto& inputBuffer = results.inputBuffer.buffer; + if (!inputBuffer.fds.empty() && !inputBuffer.ints.empty()) { + if (hasInputBufferInRequest) { + numBuffersReturned += 1; + } else { + ALOGW("%s: Input buffer should be NULL if there is no input" + " buffer sent in the request", + __func__); + } + } + request->numBuffersLeft -= numBuffersReturned; + if (request->numBuffersLeft < 0) { + ALOGE("%s: Too many buffers returned for frame %d", __func__, frameNumber); + ADD_FAILURE(); + return notify; + } + + for (const auto& buffer : results.outputBuffers) { + // wait for the fence timestamp and store it along with the buffer + // TODO: Check if we really need the dup here + android::sp releaseFence = nullptr; + if (buffer.releaseFence.fds.size() == 1 && buffer.releaseFence.fds[0].get() >= 0) { + releaseFence = new android::Fence(dup(buffer.releaseFence.fds[0].get())); + } + + CameraAidlTest::InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp; + streamBufferAndTimestamp.buffer = {buffer.streamId, + buffer.bufferId, + ::android::makeFromAidl(buffer.buffer), + buffer.status, + ::android::makeFromAidl(buffer.acquireFence), + ::android::makeFromAidl(buffer.releaseFence)}; + streamBufferAndTimestamp.timeStamp = systemTime(); + if (releaseFence && releaseFence->isValid()) { + releaseFence->wait(/*ms*/ 300); + nsecs_t releaseTime = releaseFence->getSignalTime(); + if (streamBufferAndTimestamp.timeStamp < releaseTime) + streamBufferAndTimestamp.timeStamp = releaseTime; + } + request->resultOutputBuffers.push_back(streamBufferAndTimestamp); + } + // If shutter event is received notify the pending threads. + if (request->shutterTimestamp != 0) { + notify = true; + } + + if (mUseHalBufManager) { + returnStreamBuffers(results.outputBuffers); + } + return notify; +} + +ScopedAStatus DeviceCb::notifyHelper( + const std::vector& msgs, + const std::vector>& readoutTimestamps) { + std::lock_guard l(mParent->mLock); + + for (size_t i = 0; i < msgs.size(); i++) { + const NotifyMsg& msg = msgs[i]; + NotifyMsg::Tag msgTag = msgs[i].getTag(); + switch (msgTag) { + case NotifyMsg::Tag::error: + if (ErrorCode::ERROR_DEVICE == msg.get().errorCode) { + ALOGE("%s: Camera reported serious device error", __func__); + ADD_FAILURE(); + } else { + auto itr = mParent->mInflightMap.find( + msg.get().frameNumber); + if (itr == mParent->mInflightMap.end()) { + ALOGE("%s: Unexpected error frame number! received: %u", __func__, + msg.get().frameNumber); + ADD_FAILURE(); + break; + } + + auto r = itr->second; + if (ErrorCode::ERROR_RESULT == msg.get().errorCode && + msg.get().errorStreamId != -1) { + if (r->haveResultMetadata) { + ALOGE("%s: Camera must report physical camera result error before " + "the final capture result!", + __func__); + ADD_FAILURE(); + } else { + for (auto& mStream : mStreams) { + if (mStream.id == msg.get().errorStreamId) { + std::string physicalCameraId = mStream.physicalCameraId; + bool idExpected = + r->expectedPhysicalResults.find(physicalCameraId) != + r->expectedPhysicalResults.end(); + if (!idExpected) { + ALOGE("%s: ERROR_RESULT's error stream's physicalCameraId " + "%s must be expected", + __func__, physicalCameraId.c_str()); + ADD_FAILURE(); + } else { + r->expectedPhysicalResults.erase(physicalCameraId); + } + break; + } + } + } + } else { + r->errorCodeValid = true; + r->errorCode = msg.get().errorCode; + r->errorStreamId = msg.get().errorStreamId; + } + } + break; + case NotifyMsg::Tag::shutter: + auto itr = + mParent->mInflightMap.find(msg.get().frameNumber); + if (itr == mParent->mInflightMap.end()) { + ALOGE("%s: Unexpected shutter frame number! received: %u", __func__, + msg.get().frameNumber); + ADD_FAILURE(); + break; + } + auto& r = itr->second; + r->shutterTimestamp = msg.get().timestamp; + r->shutterReadoutTimestampValid = readoutTimestamps[i].first; + r->shutterReadoutTimestamp = readoutTimestamps[i].second; + break; + } + } + + mParent->mResultCondition.notify_one(); + return ScopedAStatus::ok(); +} + +bool DeviceCb::hasOutstandingBuffersLocked() { + if (!mUseHalBufManager) { + return false; + } + for (const auto& outstandingBuffers : mOutstandingBufferIds) { + if (!outstandingBuffers.empty()) { + return true; + } + } + return false; +} diff --git a/camera/provider/aidl/vts/device_cb.h b/camera/provider/aidl/vts/device_cb.h new file mode 100644 index 0000000000000000000000000000000000000000..82ca10ddcbbacfeeab01612606184786a332706d --- /dev/null +++ b/camera/provider/aidl/vts/device_cb.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_DEVICECB_H_ +#define HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_DEVICECB_H_ + +#include + +#include + +#include +#include +#include + +using ::aidl::android::hardware::camera::device::BnCameraDeviceCallback; +using ::aidl::android::hardware::camera::device::BufferRequest; +using ::aidl::android::hardware::camera::device::BufferRequestStatus; +using ::aidl::android::hardware::camera::device::CaptureResult; +using ::aidl::android::hardware::camera::device::HalStream; +using ::aidl::android::hardware::camera::device::NotifyMsg; +using ::aidl::android::hardware::camera::device::PhysicalCameraMetadata; +using ::aidl::android::hardware::camera::device::Stream; +using ::aidl::android::hardware::camera::device::StreamBuffer; +using ::aidl::android::hardware::camera::device::StreamBufferRet; +using ::aidl::android::hardware::common::NativeHandle; + +using ::ndk::ScopedAStatus; + +class CameraAidlTest; + +class DeviceCb : public BnCameraDeviceCallback { + public: + DeviceCb(CameraAidlTest* parent, camera_metadata_t* staticMeta); + ScopedAStatus notify(const std::vector& msgs) override; + ScopedAStatus processCaptureResult(const std::vector& results) override; + ScopedAStatus requestStreamBuffers(const std::vector& bufReqs, + std::vector* buffers, + BufferRequestStatus* _aidl_return) override; + ScopedAStatus returnStreamBuffers(const std::vector& buffers) override; + + void setCurrentStreamConfig(const std::vector& streams, + const std::vector& halStreams); + + void waitForBuffersReturned(); + + private: + bool processCaptureResultLocked(const CaptureResult& results, + std::vector physicalCameraMetadata); + ScopedAStatus notifyHelper(const std::vector& msgs, + const std::vector>& readoutTimestamps); + + CameraAidlTest* mParent; // Parent object + + camera_metadata_t* mStaticMetadata; + bool hasOutstandingBuffersLocked(); + + /* members for requestStreamBuffers() and returnStreamBuffers()*/ + std::mutex mLock; // protecting members below + bool mUseHalBufManager = false; + std::vector mStreams; + std::vector mHalStreams; + int64_t mNextBufferId = 1; + using OutstandingBuffers = std::unordered_map; + // size == mStreams.size(). Tracking each streams outstanding buffers + std::vector mOutstandingBufferIds; + std::condition_variable mFlushedCondition; +}; + +#endif // HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_DEVICECB_H_ diff --git a/camera/provider/aidl/vts/empty_device_cb.cpp b/camera/provider/aidl/vts/empty_device_cb.cpp new file mode 100644 index 0000000000000000000000000000000000000000..38b0d4c21733dc7964c265c650ee9f5bac9d5105 --- /dev/null +++ b/camera/provider/aidl/vts/empty_device_cb.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ + +#include "empty_device_cb.h" +#include + +ScopedAStatus EmptyDeviceCb::notify(const std::vector&) { + ALOGI("notify callback"); + ADD_FAILURE(); // Empty callback should not reach here + return ndk::ScopedAStatus::ok(); +} +ScopedAStatus EmptyDeviceCb::processCaptureResult(const std::vector&) { + ALOGI("processCaptureResult callback"); + ADD_FAILURE(); // Empty callback should not reach here + return ndk::ScopedAStatus::ok(); +} +ScopedAStatus EmptyDeviceCb::requestStreamBuffers(const std::vector&, + std::vector*, + BufferRequestStatus* _aidl_return) { + ALOGI("requestStreamBuffers callback"); + // HAL might want to request buffer after configureStreams, but tests with EmptyDeviceCb + // doesn't actually need to send capture requests, so just return an error. + *_aidl_return = BufferRequestStatus::FAILED_UNKNOWN; + return ndk::ScopedAStatus::ok(); +} +ScopedAStatus EmptyDeviceCb::returnStreamBuffers(const std::vector&) { + ALOGI("returnStreamBuffers"); + ADD_FAILURE(); // Empty callback should not reach here + return ndk::ScopedAStatus::ok(); +} diff --git a/camera/provider/aidl/vts/empty_device_cb.h b/camera/provider/aidl/vts/empty_device_cb.h new file mode 100644 index 0000000000000000000000000000000000000000..e777513068e03ab30a9e1b7caf4aacb5cddbf777 --- /dev/null +++ b/camera/provider/aidl/vts/empty_device_cb.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_EMPTY_DEVICE_CB_H_ +#define HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_EMPTY_DEVICE_CB_H_ + +#include +#include + +using namespace ::aidl::android::hardware::camera::device; + +using ::aidl::android::hardware::camera::device::BnCameraDeviceCallback; +using ::ndk::ScopedAStatus; + +class EmptyDeviceCb : public BnCameraDeviceCallback { + public: + ScopedAStatus notify(const std::vector& msgs) override; + ScopedAStatus processCaptureResult(const std::vector<::CaptureResult>& results) override; + ScopedAStatus requestStreamBuffers(const std::vector& bufReqs, + std::vector* buffers, + BufferRequestStatus* _aidl_return) override; + ScopedAStatus returnStreamBuffers(const std::vector& buffers) override; +}; + +#endif // HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_EMPTY_DEVICE_CB_H_ diff --git a/camera/provider/aidl/vts/simple_device_cb.cpp b/camera/provider/aidl/vts/simple_device_cb.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e9a2c73ad7e3edaa751726ee4de015e330cd6753 --- /dev/null +++ b/camera/provider/aidl/vts/simple_device_cb.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +#include "simple_device_cb.h" + +ScopedAStatus SimpleDeviceCb::notify(const std::vector& msgs) { + std::unique_lock l(mParent->mLock); + mParent->mNotifyMessages = msgs; + mParent->mResultCondition.notify_one(); + + return ndk::ScopedAStatus::ok(); +} +ScopedAStatus SimpleDeviceCb::processCaptureResult(const std::vector&) { + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); +} +ScopedAStatus SimpleDeviceCb::requestStreamBuffers(const std::vector&, + std::vector*, + BufferRequestStatus*) { + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); +} +ScopedAStatus SimpleDeviceCb::returnStreamBuffers(const std::vector&) { + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); +} diff --git a/camera/provider/aidl/vts/simple_device_cb.h b/camera/provider/aidl/vts/simple_device_cb.h new file mode 100644 index 0000000000000000000000000000000000000000..6beffc7966b6229e8b41e2412bc222cf3bbec8f9 --- /dev/null +++ b/camera/provider/aidl/vts/simple_device_cb.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_SIMPLE_DEVICE_CB_H_ +#define HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_SIMPLE_DEVICE_CB_H_ + +#include "camera_aidl_test.h" + +#include + +#include + +using namespace ::aidl::android::hardware::camera::device; + +class SimpleDeviceCb : public BnCameraDeviceCallback { + public: + ScopedAStatus notify(const std::vector& msgs) override; + ScopedAStatus processCaptureResult(const std::vector& results) override; + ScopedAStatus requestStreamBuffers(const std::vector& bufReqs, + std::vector* buffers, + BufferRequestStatus* _aidl_return) override; + virtual ScopedAStatus returnStreamBuffers(const std::vector& buffers) override; + + private: + CameraAidlTest* mParent; +}; + +#endif // HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_SIMPLE_DEVICE_CB_H_ diff --git a/camera/provider/aidl/vts/torch_provider_cb.cpp b/camera/provider/aidl/vts/torch_provider_cb.cpp new file mode 100644 index 0000000000000000000000000000000000000000..52240dfed36f6abf67b739d307c0a6e4955cad45 --- /dev/null +++ b/camera/provider/aidl/vts/torch_provider_cb.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ + +#include "torch_provider_cb.h" + +TorchProviderCb::TorchProviderCb(CameraAidlTest* parent) { + mParent = parent; +} + +ndk::ScopedAStatus TorchProviderCb::torchModeStatusChange(const std::string&, + TorchModeStatus newStatus) { + std::lock_guard l(mParent->mTorchLock); + mParent->mTorchStatus = newStatus; + mParent->mTorchCond.notify_one(); + return ndk::ScopedAStatus::ok(); +} +ScopedAStatus TorchProviderCb::cameraDeviceStatusChange( + const std::string&, ::aidl::android::hardware::camera::common::CameraDeviceStatus) { + // Should not be called + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); +} +ScopedAStatus TorchProviderCb::physicalCameraDeviceStatusChange( + const std::string&, const std::string&, + ::aidl::android::hardware::camera::common::CameraDeviceStatus) { + // Should not be called + return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION); +} diff --git a/camera/provider/aidl/vts/torch_provider_cb.h b/camera/provider/aidl/vts/torch_provider_cb.h new file mode 100644 index 0000000000000000000000000000000000000000..03532541b362ffece6eda0592557984a588a8b30 --- /dev/null +++ b/camera/provider/aidl/vts/torch_provider_cb.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_TORCH_PROVIDER_CB_H_ +#define HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_TORCH_PROVIDER_CB_H_ + +#import +#import + +using ::aidl::android::hardware::camera::common::TorchModeStatus; +using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback; + +class TorchProviderCb : public BnCameraProviderCallback { + public: + TorchProviderCb(CameraAidlTest* parent); + ndk::ScopedAStatus torchModeStatusChange(const std::string& cameraDeviceName, + TorchModeStatus newStatus) override; + + ScopedAStatus cameraDeviceStatusChange( + const std::string& in_cameraDeviceName, + ::aidl::android::hardware::camera::common::CameraDeviceStatus in_newStatus) override; + + ScopedAStatus physicalCameraDeviceStatusChange( + const std::string& in_cameraDeviceName, const std::string& in_physicalCameraDeviceName, + ::aidl::android::hardware::camera::common::CameraDeviceStatus in_newStatus) override; + + private: + CameraAidlTest* mParent; +}; + +#endif // HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_TORCH_PROVIDER_CB_H_ diff --git a/cas/1.0/Android.bp b/cas/1.0/Android.bp index 368156ad7657bb3618a37c6736fa030246b061aa..e27695c89af84eaed2bbd2319641bb3124e58f60 100644 --- a/cas/1.0/Android.bp +++ b/cas/1.0/Android.bp @@ -23,4 +23,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.media", + ], } diff --git a/cas/1.1/Android.bp b/cas/1.1/Android.bp index f5b1cc95644189296086f477b4a9608618a5c761..1bf9c5f030d487003f241de2afc3b0a356b24ce4 100644 --- a/cas/1.1/Android.bp +++ b/cas/1.1/Android.bp @@ -22,4 +22,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.media", + ], } diff --git a/cas/1.2/Android.bp b/cas/1.2/Android.bp index 6c940204649705e22932a214dab14c18f58f1469..5468ed0c65198917a06e485854f84b46a2fcb779 100644 --- a/cas/1.2/Android.bp +++ b/cas/1.2/Android.bp @@ -24,4 +24,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.media", + ], } diff --git a/cas/native/1.0/Android.bp b/cas/native/1.0/Android.bp index 3bb74c107e960e5fdcfe79fa23c91cebda9aa978..ef77ab4f29058e7c0ff0ec1f823e2658007d703d 100644 --- a/cas/native/1.0/Android.bp +++ b/cas/native/1.0/Android.bp @@ -21,4 +21,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media", + ], } diff --git a/common/support/Android.bp b/common/support/Android.bp index 718901ef6a1ac2d588808f15dd8bcd324b0a2c48..12ab1f78a18f964fb3c48c2673dd1088638e8a2d 100644 --- a/common/support/Android.bp +++ b/common/support/Android.bp @@ -25,6 +25,7 @@ cc_library_static { apex_available: [ "//apex_available:platform", "com.android.neuralnetworks", + "com.android.media.swcodec", ], min_sdk_version: "29", } diff --git a/compatibility_matrices/compatibility_matrix.3.xml b/compatibility_matrices/compatibility_matrix.3.xml index 468735d2bad59279c0ee2157b9a0225f550fd6b9..0964c9964c1f3a3594cedbc9287e165e5da7865f 100644 --- a/compatibility_matrices/compatibility_matrix.3.xml +++ b/compatibility_matrices/compatibility_matrix.3.xml @@ -183,7 +183,10 @@ default - + + android.hardware.graphics.allocator 2.0 diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml index 96f291ff838ef37c83e270528cc79bca8282e56f..8ef0b3ad27dfa4d3272378f90f2091682eb4867b 100644 --- a/compatibility_matrices/compatibility_matrix.4.xml +++ b/compatibility_matrices/compatibility_matrix.4.xml @@ -187,7 +187,10 @@ default - + + android.hardware.graphics.allocator 2.0 3.0 diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml index 3642814f7e9de4b581cda8a302a977f6f32e6433..12b85c7724b0b16cbfacec950786ff103d0c5a01 100644 --- a/compatibility_matrices/compatibility_matrix.5.xml +++ b/compatibility_matrices/compatibility_matrix.5.xml @@ -208,7 +208,10 @@ default - + + android.hardware.graphics.allocator 2.0 diff --git a/compatibility_matrices/compatibility_matrix.6.xml b/compatibility_matrices/compatibility_matrix.6.xml index 9c42cb0647256a64c478477d9ae4cfe2712512b5..e19d2dd12edecdb6288eb9bca378a322ee115300 100644 --- a/compatibility_matrices/compatibility_matrix.6.xml +++ b/compatibility_matrices/compatibility_matrix.6.xml @@ -238,7 +238,10 @@ default - + + android.hardware.graphics.allocator 2.0 diff --git a/compatibility_matrices/compatibility_matrix.7.xml b/compatibility_matrices/compatibility_matrix.7.xml index 696767199120a931aecb4ceb309136647c34618e..26b8d63c5cb5233fa37b22640f6247a1e64ec29d 100644 --- a/compatibility_matrices/compatibility_matrix.7.xml +++ b/compatibility_matrices/compatibility_matrix.7.xml @@ -60,6 +60,14 @@ .* + + android.hardware.automotive.evs + + IEvsEnumerator + default + [a-z]+/[0-9]+ + + android.hardware.automotive.evs 1.0-1 @@ -77,12 +85,11 @@ default - - android.hardware.automotive.sv - 1.0 + + android.hardware.automotive.vehicle - ISurroundViewService - default + IVehicle + .* @@ -90,7 +97,7 @@ 2.0 IVehicle - default + .* @@ -103,6 +110,7 @@ android.hardware.biometrics.face + 2 IFace default @@ -118,6 +126,7 @@ android.hardware.biometrics.fingerprint + 2 IFingerprint default @@ -133,6 +142,7 @@ android.hardware.bluetooth.audio + 2 IBluetoothAudioProviderFactory default @@ -170,6 +180,14 @@ [^/]+/[0-9]+ + + android.hardware.camera.provider + 1 + + ICameraProvider + [^/]+/[0-9]+ + + android.hardware.cas 1.1-2 @@ -186,14 +204,21 @@ default - + android.hardware.contexthub - 1.2 - IContexthub + IContextHub default + + android.hardware.drm + 1 + + IDrmFactory + .* + + android.hardware.drm 1.3-4 @@ -231,14 +256,31 @@ android.hardware.gnss + 2 IGnss default - + + android.hardware.gnss.visibility_control + 1 + + IGnssVisibilityControl + default + + + + android.hardware.gnss.measurement_corrections + 1 + + IMeasurementCorrectionsInterface + default + + + android.hardware.graphics.allocator - + 2.0 3.0 4.0 @@ -247,7 +289,18 @@ default - + + android.hardware.graphics.allocator + 1 + + IAllocator + default + + + + android.hardware.graphics.composer 2.1-4 @@ -255,6 +308,14 @@ default + + android.hardware.graphics.composer3 + 1 + + IComposer + default + + android.hardware.graphics.mapper @@ -290,6 +351,13 @@ default + + android.hardware.net.nlinterceptor + + IInterceptor + default + + android.hardware.oemlock 1 @@ -306,11 +374,11 @@ default - - android.hardware.input.classifier - 1.0 + + android.hardware.input.processor + 1 - IInputClassifier + IInputProcessor default @@ -354,11 +422,12 @@ IRemotelyProvisionedComponent default + strongbox android.hardware.light - 1 + 2 ILights default @@ -434,7 +503,7 @@ android.hardware.power - 1-2 + 2-3 IPower default @@ -565,6 +634,13 @@ strongbox + + android.hardware.sensors + + ISensors + default + + android.hardware.sensors 1.0 @@ -582,6 +658,14 @@ default + + android.hardware.soundtrigger3 + 1 + + ISoundTriggerHw + default + + android.hardware.tetheroffload.config 1.0 @@ -630,6 +714,14 @@ default + + android.hardware.tv.tuner + 1 + + ITuner + default + + android.hardware.usb 1.0-3 @@ -638,6 +730,13 @@ default + + android.hardware.usb + + IUsb + default + + android.hardware.usb.gadget 1.0-2 @@ -680,17 +779,17 @@ android.hardware.wifi - 1.3-5 + 1.3-6 IWifi default - - android.hardware.wifi.hostapd - 1.0-3 + + android.hardware.uwb + 1 - IHostapd + IUwb default @@ -702,14 +801,6 @@ default - - android.hardware.wifi.supplicant - 1.2-4 - - ISupplicant - default - - android.hardware.wifi.supplicant diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 64b72bea1b79a1f51b1636ae8fb2c17d15bdcf79..47593d8c570dcd2bd36f6b3224b76eb7c46d14f6 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -60,6 +60,14 @@ .* + + android.hardware.automotive.evs + + IEvsEnumerator + default + [a-z]+/[0-9]+ + + android.hardware.automotive.evs 1.0-1 @@ -77,12 +85,11 @@ default - - android.hardware.automotive.sv - 1.0 + + android.hardware.automotive.vehicle - ISurroundViewService - default + IVehicle + .* @@ -90,11 +97,12 @@ 2.0 IVehicle - default + .* android.hardware.biometrics.face + 2 IFace default @@ -102,6 +110,7 @@ android.hardware.biometrics.fingerprint + 2 IFingerprint default @@ -117,6 +126,7 @@ android.hardware.bluetooth.audio + 2 IBluetoothAudioProviderFactory default @@ -153,6 +163,14 @@ [^/]+/[0-9]+ + + android.hardware.camera.provider + 1 + + ICameraProvider + [^/]+/[0-9]+ + + android.hardware.cas 1.1-2 @@ -169,14 +187,21 @@ default - + android.hardware.contexthub - 1.2 - IContexthub + IContextHub default + + android.hardware.drm + 1 + + IDrmFactory + .* + + android.hardware.drm 1.3-4 @@ -214,14 +239,35 @@ android.hardware.gnss + 2 IGnss default - + + android.hardware.gnss.visibility_control + 1 + + IGnssVisibilityControl + default + + + + android.hardware.gnss.measurement_corrections + 1 + + IMeasurementCorrectionsInterface + default + + + + android.hardware.graphics.allocator - + 2.0 3.0 4.0 @@ -230,7 +276,18 @@ default - + + android.hardware.graphics.allocator + 1 + + IAllocator + default + + + + android.hardware.graphics.composer 2.1-4 @@ -238,6 +295,14 @@ default + + android.hardware.graphics.composer3 + 1 + + IComposer + default + + android.hardware.graphics.mapper @@ -273,6 +338,13 @@ default + + android.hardware.net.nlinterceptor + + IInterceptor + default + + android.hardware.oemlock 1 @@ -289,11 +361,11 @@ default - - android.hardware.input.classifier - 1.0 + + android.hardware.input.processor + 1 - IInputClassifier + IInputProcessor default @@ -342,7 +414,7 @@ android.hardware.light - 1 + 2 ILights default @@ -418,7 +490,7 @@ android.hardware.power - 1-2 + 2-3 IPower default @@ -549,6 +621,13 @@ strongbox + + android.hardware.sensors + + ISensors + default + + android.hardware.sensors 1.0 @@ -566,6 +645,14 @@ default + + android.hardware.soundtrigger3 + 1 + + ISoundTriggerHw + default + + android.hardware.tetheroffload.config 1.0 @@ -614,6 +701,14 @@ default + + android.hardware.tv.tuner + 1 + + ITuner + default + + android.hardware.usb 1.0-3 @@ -679,17 +774,17 @@ android.hardware.wifi - 1.3-5 + 1.3-6 IWifi default - - android.hardware.wifi.hostapd - 1.0-3 + + android.hardware.uwb + 1 - IHostapd + IUwb default @@ -701,14 +796,6 @@ default - - android.hardware.wifi.supplicant - 1.2-4 - - ISupplicant - default - - android.hardware.wifi.supplicant diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index f34009d3296759d2730b78a5f2b69920f622bf5a..6de9d03683a46e5c8828a8c3abd678231a1cbac8 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -53,11 +53,16 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) { // AIDL "android.hardware.audio.common", "android.hardware.biometrics.common", + "android.hardware.camera.metadata", + "android.hardware.camera.device", + "android.hardware.camera.common", "android.hardware.common", "android.hardware.common.fmq", "android.hardware.graphics.common", + "android.hardware.input.common", "android.hardware.keymaster", "android.hardware.radio", + "android.hardware.uwb.fira_android", // Fastboot HAL is only used by recovery. Recovery is owned by OEM. Framework // does not depend on this HAL, hence it is not declared in any manifests or matrices. diff --git a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp index 356ad97327eb0b56c5daa7b83798d3039c834f17..b3173ef2b9a0600332e2919f57f4e4322e48b5df 100644 --- a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp +++ b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp @@ -18,7 +18,8 @@ #include "ContexthubCallbackBase.h" #include "ContexthubHidlTestBase.h" -#include "VtsHalContexthubUtils.h" +#include "VtsHalContexthubUtilsCommon.h" +#include "VtsHalContexthubUtilsHidl.h" #include #include diff --git a/contexthub/1.1/vts/functional/VtsHalContexthubV1_1TargetTest.cpp b/contexthub/1.1/vts/functional/VtsHalContexthubV1_1TargetTest.cpp index acf4be0c4586a15e592d39f276caf30be91ace79..0589fd81509de348a44100ac95cf10172694fb67 100644 --- a/contexthub/1.1/vts/functional/VtsHalContexthubV1_1TargetTest.cpp +++ b/contexthub/1.1/vts/functional/VtsHalContexthubV1_1TargetTest.cpp @@ -18,7 +18,8 @@ #include "ContexthubCallbackBase.h" #include "ContexthubHidlTestBase.h" -#include "VtsHalContexthubUtils.h" +#include "VtsHalContexthubUtilsCommon.h" +#include "VtsHalContexthubUtilsHidl.h" #include #include diff --git a/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp b/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp index 9ee40ede01741ddf2b3b65a0f77d85dc5a7a684d..f1f980795e2e4b236d30e3ec88e1c1a2b3a63f33 100644 --- a/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp +++ b/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp @@ -18,7 +18,8 @@ #include "ContexthubCallbackBase.h" #include "ContexthubHidlTestBase.h" -#include "VtsHalContexthubUtils.h" +#include "VtsHalContexthubUtilsCommon.h" +#include "VtsHalContexthubUtilsHidl.h" #include #include diff --git a/contexthub/aidl/Android.bp b/contexthub/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..a8654455e72d01bba5c41d6ec896e3b5bba08c00 --- /dev/null +++ b/contexthub/aidl/Android.bp @@ -0,0 +1,45 @@ +// Copyright 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"], +} + +aidl_interface { + name: "android.hardware.contexthub", + vendor_available: true, + host_supported: true, + srcs: ["android/hardware/contexthub/*.aidl"], + stability: "vintf", + backend: { + java: { + sdk_version: "module_current", + }, + ndk: { + apps_enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/.hash b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..b01d289b2873475b05b296525d0ef4e15733b236 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/.hash @@ -0,0 +1 @@ +10abe2e5202d9b80ccebf5f6376d711a9a212b27 diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/AsyncEventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8e0ff89c120ef82b4a00c7128ae1b395a96a6845 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/AsyncEventType.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.contexthub; +@Backing(type="int") @VintfStability +enum AsyncEventType { + RESTARTED = 1, +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/ContextHubInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e5735566e7648518bcfbcbb3e065bf8e6036e04e --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/ContextHubInfo.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable ContextHubInfo { + String name; + String vendor; + String toolchain; + int id; + float peakMips; + int maxSupportedMessageLengthBytes; + long chrePlatformId; + byte chreApiMajorVersion; + byte chreApiMinorVersion; + char chrePatchVersion; + String[] supportedPermissions; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/ContextHubMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e38c251928587a17eae3e6a0b341324c6a103591 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/ContextHubMessage.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable ContextHubMessage { + long nanoappId; + char hostEndPoint; + int messageType; + byte[] messageBody; + String[] permissions; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/HostEndpointInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/HostEndpointInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84e8531eb9e9b2def0f7dc55d542a2cb79b4fc82 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/HostEndpointInfo.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable HostEndpointInfo { + char hostEndpointId; + android.hardware.contexthub.HostEndpointInfo.Type type; + @nullable String packageName; + @nullable String attributionTag; + @Backing(type="int") @VintfStability + enum Type { + FRAMEWORK = 1, + APP = 2, + } +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/IContextHub.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f0676bec744bb5645f0cdd1cdf6b141227f33483 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/IContextHub.aidl @@ -0,0 +1,49 @@ +/* + * 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 -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.contexthub; +@VintfStability +interface IContextHub { + List getContextHubs(); + void loadNanoapp(in int contextHubId, in android.hardware.contexthub.NanoappBinary appBinary, in int transactionId); + void unloadNanoapp(in int contextHubId, in long appId, in int transactionId); + void disableNanoapp(in int contextHubId, in long appId, in int transactionId); + void enableNanoapp(in int contextHubId, in long appId, in int transactionId); + void onSettingChanged(in android.hardware.contexthub.Setting setting, in boolean enabled); + void queryNanoapps(in int contextHubId); + void registerCallback(in int contextHubId, in android.hardware.contexthub.IContextHubCallback cb); + void sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message); + void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo); + void onHostEndpointDisconnected(char hostEndpointId); + const int EX_CONTEXT_HUB_UNSPECIFIED = -1; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/IContextHubCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f81f7cfdeeb64e2eb32f5dcb466480c946ec245d --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/IContextHubCallback.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 -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.contexthub; +@VintfStability +interface IContextHubCallback { + void handleNanoappInfo(in android.hardware.contexthub.NanoappInfo[] appInfo); + void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms); + void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt); + void handleTransactionResult(in int transactionId, in boolean success); +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappBinary.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d53b28f943cecf3c60465618f88d0f7274f1946a --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappBinary.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable NanoappBinary { + long nanoappId; + int nanoappVersion; + int flags; + byte targetChreApiMajorVersion; + byte targetChreApiMinorVersion; + byte[] customBinary; + const int FLAG_SIGNED = 1; + const int FLAG_ENCRYPTED = 2; + const int FLAG_TCM_CAPABLE = 4; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7175d7f329d4692c93f35e1be4ec0d3692788b5e --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable NanoappInfo { + long nanoappId; + int nanoappVersion; + boolean enabled; + String[] permissions; + android.hardware.contexthub.NanoappRpcService[] rpcServices; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappRpcService.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappRpcService.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6a164419574870715d97022009958c89c707b41 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/NanoappRpcService.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable NanoappRpcService { + long id; + int version; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/Setting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d998478db699a19b8b62e49c9c5a226146498d34 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/1/android/hardware/contexthub/Setting.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.contexthub; +@Backing(type="byte") @VintfStability +enum Setting { + LOCATION = 1, + WIFI_MAIN = 2, + WIFI_SCANNING = 3, + AIRPLANE_MODE = 4, + MICROPHONE = 5, + BT_MAIN = 6, + BT_SCANNING = 7, +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8e0ff89c120ef82b4a00c7128ae1b395a96a6845 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.contexthub; +@Backing(type="int") @VintfStability +enum AsyncEventType { + RESTARTED = 1, +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e5735566e7648518bcfbcbb3e065bf8e6036e04e --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable ContextHubInfo { + String name; + String vendor; + String toolchain; + int id; + float peakMips; + int maxSupportedMessageLengthBytes; + long chrePlatformId; + byte chreApiMajorVersion; + byte chreApiMinorVersion; + char chrePatchVersion; + String[] supportedPermissions; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e38c251928587a17eae3e6a0b341324c6a103591 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable ContextHubMessage { + long nanoappId; + char hostEndPoint; + int messageType; + byte[] messageBody; + String[] permissions; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/HostEndpointInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/HostEndpointInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84e8531eb9e9b2def0f7dc55d542a2cb79b4fc82 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/HostEndpointInfo.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable HostEndpointInfo { + char hostEndpointId; + android.hardware.contexthub.HostEndpointInfo.Type type; + @nullable String packageName; + @nullable String attributionTag; + @Backing(type="int") @VintfStability + enum Type { + FRAMEWORK = 1, + APP = 2, + } +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f0676bec744bb5645f0cdd1cdf6b141227f33483 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl @@ -0,0 +1,49 @@ +/* + * 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 -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.contexthub; +@VintfStability +interface IContextHub { + List getContextHubs(); + void loadNanoapp(in int contextHubId, in android.hardware.contexthub.NanoappBinary appBinary, in int transactionId); + void unloadNanoapp(in int contextHubId, in long appId, in int transactionId); + void disableNanoapp(in int contextHubId, in long appId, in int transactionId); + void enableNanoapp(in int contextHubId, in long appId, in int transactionId); + void onSettingChanged(in android.hardware.contexthub.Setting setting, in boolean enabled); + void queryNanoapps(in int contextHubId); + void registerCallback(in int contextHubId, in android.hardware.contexthub.IContextHubCallback cb); + void sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message); + void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo); + void onHostEndpointDisconnected(char hostEndpointId); + const int EX_CONTEXT_HUB_UNSPECIFIED = -1; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f81f7cfdeeb64e2eb32f5dcb466480c946ec245d --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.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 -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.contexthub; +@VintfStability +interface IContextHubCallback { + void handleNanoappInfo(in android.hardware.contexthub.NanoappInfo[] appInfo); + void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms); + void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt); + void handleTransactionResult(in int transactionId, in boolean success); +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d53b28f943cecf3c60465618f88d0f7274f1946a --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable NanoappBinary { + long nanoappId; + int nanoappVersion; + int flags; + byte targetChreApiMajorVersion; + byte targetChreApiMinorVersion; + byte[] customBinary; + const int FLAG_SIGNED = 1; + const int FLAG_ENCRYPTED = 2; + const int FLAG_TCM_CAPABLE = 4; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7175d7f329d4692c93f35e1be4ec0d3692788b5e --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable NanoappInfo { + long nanoappId; + int nanoappVersion; + boolean enabled; + String[] permissions; + android.hardware.contexthub.NanoappRpcService[] rpcServices; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappRpcService.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappRpcService.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6a164419574870715d97022009958c89c707b41 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappRpcService.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.contexthub; +@VintfStability +parcelable NanoappRpcService { + long id; + int version; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d998478db699a19b8b62e49c9c5a226146498d34 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.contexthub; +@Backing(type="byte") @VintfStability +enum Setting { + LOCATION = 1, + WIFI_MAIN = 2, + WIFI_SCANNING = 3, + AIRPLANE_MODE = 4, + MICROPHONE = 5, + BT_MAIN = 6, + BT_SCANNING = 7, +} diff --git a/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d884c9c5015b90d28887f311e4045827ee48b12a --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl @@ -0,0 +1,24 @@ +/* + * 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 android.hardware.contexthub; + +@VintfStability +@Backing(type="int") +enum AsyncEventType { + /** An event where the Context Hub has restarted (e.g. due to a crash). */ + RESTARTED = 1, +} diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c0fa702f0bcc868e84cd8ec02f66245946605861 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl @@ -0,0 +1,64 @@ +/* + * 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 android.hardware.contexthub; + +@VintfStability +parcelable ContextHubInfo { + /** Descriptive name of the Context Hub */ + String name; + + /** The vendor e.g. "Google" */ + String vendor; + + /** Toolchain that describes the binary architecture eg: "gcc ARM" */ + String toolchain; + + /** A unique ID for this Context Hub */ + int id; + + /** Peak MIPs this platform can deliver */ + float peakMips; + + /** The maximum length in bytes of the message that can be sent to the Context Hub. */ + int maxSupportedMessageLengthBytes; + + /** + * Machine-readable CHRE platform ID, returned to nanoapps in the CHRE API + * function call chreGetPlatformId(). This field pairs with + * chreApiMajorVersion, chreApiMinorVersion, and chrePatchVersion to fully + * specify the CHRE implementation version. See also the CHRE API header + * file chre/version.h. + */ + long chrePlatformId; + + /** + * The version of the CHRE implementation returned to nanoApps in the CHRE + * API function call chreGetVersion(). The major and minor version specify + * the implemented version of the CHRE API, while the patch version + * describes the implementation version within the scope of the platform + * ID. See also the CHRE API header file chre/version.h. + */ + byte chreApiMajorVersion; + byte chreApiMinorVersion; + char chrePatchVersion; + + /** + * A list of Android permissions this Context Hub support for nanoapps to enforce host endpoints + * are granted in order to communicate with them. + */ + String[] supportedPermissions; +} diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..95d478e6c210a48e722d649aff16ff50906bb709 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl @@ -0,0 +1,53 @@ +/* + * 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 android.hardware.contexthub; + +@VintfStability +parcelable ContextHubMessage { + /** The unique identifier of the nanoapp. */ + long nanoappId; + + /** + * The identifier of the host client that is sending/receiving this message. + * + * There are two reserved values of the host endpoint that has a specific meaning: + * 1) BROADCAST = 0xFFFF: see CHRE_HOST_ENDPOINT_BROADCAST in + * system/chre/chre_api/include/chre_api/chre/event.h for details. + * 2) UNSPECIFIED = 0xFFFE: see CHRE_HOST_ENDPOINT_UNSPECIFIED in + * system/chre/chre_api/include/chre_api/chre/event.h for details. + */ + char hostEndPoint; + + /** + * The type of this message payload, defined by the communication endpoints (i.e. + * either the nanoapp or the host endpoint). This value can be used to distinguish + * the handling of messageBody (e.g. for decoding). + */ + int messageType; + + /** The payload containing the message. */ + byte[] messageBody; + + /** + * The list of Android permissions held by the sending nanoapp at the time + * the message was sent. + * + * The framework MUST drop messages to host apps that don't have a superset + * of the permissions that the sending nanoapp is using. + */ + String[] permissions; +} diff --git a/contexthub/aidl/android/hardware/contexthub/HostEndpointInfo.aidl b/contexthub/aidl/android/hardware/contexthub/HostEndpointInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a9d6657097aa374f0286ef49c7ed23ce36addba7 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/HostEndpointInfo.aidl @@ -0,0 +1,48 @@ +/* + * 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 android.hardware.contexthub; + +/** + * Stores metadata regarding a host endpoint that may communicate with the Context Hub. + */ +@VintfStability +parcelable HostEndpointInfo { + /** The ID of the host endpoint asscociated with this host. */ + char hostEndpointId; + + /** The type of endpoint. */ + Type type; + + /** The (optional) package name of the host. */ + @nullable String packageName; + + /** The (optional) attribution tag associated with this host. */ + @nullable String attributionTag; + + @VintfStability + @Backing(type="int") + enum Type { + /** + * This endpoint is from the Android framework, where packageName and attributionTag may be + * empty. + */ + FRAMEWORK = 1, + + /** This endpoint is an Android app. */ + APP = 2, + } +} diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl new file mode 100644 index 0000000000000000000000000000000000000000..16666efd95a696c3003835002d51019971e2ccef --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -0,0 +1,202 @@ +/* + * 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 android.hardware.contexthub; + +import android.hardware.contexthub.ContextHubInfo; +import android.hardware.contexthub.ContextHubMessage; +import android.hardware.contexthub.HostEndpointInfo; +import android.hardware.contexthub.IContextHubCallback; +import android.hardware.contexthub.NanoappBinary; +import android.hardware.contexthub.Setting; + +@VintfStability +interface IContextHub { + /** + * Enumerates all available Context Hubs. + * + * @return A list of ContextHubInfo describing all Context Hubs. + */ + List getContextHubs(); + + /** + * Loads a nanoapp, and invokes the nanoapp's initialization "start()" entrypoint. + * + * The return value of this method only indicates that the request has been accepted. + * If true is returned, the Context Hub must handle an asynchronous result using the + * the handleTransactionResult() callback. + * + * Depending on the implementation, nanoapp loaded via this API may or may + * not persist across reboots of the hub. If they do persist, the + * implementation must initially place nanoapp in the disabled state upon a + * reboot, and not start them until a call is made to enableNanoapp(). In + * this case, the app must also be unloaded upon a factory reset of the + * device. + * + * Loading a nanoapp must not take more than 30 seconds. + * + * @param contextHubId The identifier of the Context Hub + * @param appBinary The nanoapp binary with header + * @param transactionId The transaction ID associated with this request + * + * @throws EX_ILLEGAL_ARGUMENT if any of the arguments are invalid. + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + * EX_SERVICE_SPECIFIC on error + * - EX_CONTEXT_HUB_UNSPECIFIED if the request failed for other reasons. + */ + void loadNanoapp(in int contextHubId, in NanoappBinary appBinary, in int transactionId); + + /** + * Invokes the nanoapp's deinitialization "end()" entrypoint, and unloads the nanoapp. + * + * The return value of this method only indicates that the request has been accepted. + * If true is returned, the Context Hub must handle an asynchronous result using the + * the handleTransactionResult() callback. + * + * Unloading a nanoapp must not take more than 5 seconds. + * + * @param contextHubId The identifier of the Context Hub + * @param appId The unique ID of the nanoapp + * @param transactionId The transaction ID associated with this request + * + * @throws EX_ILLEGAL_ARGUMENT if any of the arguments are invalid. + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + * EX_SERVICE_SPECIFIC on error + * - EX_CONTEXT_HUB_UNSPECIFIED if the request failed for other reasons. + */ + void unloadNanoapp(in int contextHubId, in long appId, in int transactionId); + + /** + * Disables a nanoapp by invoking the nanoapp's "end()" entrypoint, but does not unload the + * nanoapp. + * + * The return value of this method only indicates that the request has been accepted. + * If true is returned, the Context Hub must handle an asynchronous result using the + * the handleTransactionResult() callback. + * + * Disabling a nanoapp must not take more than 5 seconds. + * + * @param contextHubId The identifier of the Context Hub + * @param appId The unique ID of the nanoapp + * @param transactionId The transaction ID associated with this request + * + * @throws EX_ILLEGAL_ARGUMENT if any of the arguments are invalid. + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + * EX_SERVICE_SPECIFIC on error + * - EX_CONTEXT_HUB_UNSPECIFIED if the request failed for other reasons. + */ + void disableNanoapp(in int contextHubId, in long appId, in int transactionId); + + /** + * Enables a nanoapp by invoking the nanoapp's initialization "start()" entrypoint. + * + * The return value of this method only indicates that the request has been accepted. + * If true is returned, the Context Hub must handle an asynchronous result using the + * the handleTransactionResult() callback. + * + * Enabling a nanoapp must not take more than 5 seconds. + * + * @param contextHubId The identifier of the Context Hub + * @param appId appIdentifier returned by the HAL + * @param message message to be sent + * + * @throws EX_ILLEGAL_ARGUMENT if any of the arguments are invalid. + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + * EX_SERVICE_SPECIFIC on error + * - EX_CONTEXT_HUB_UNSPECIFIED if the request failed for other reasons. + */ + void enableNanoapp(in int contextHubId, in long appId, in int transactionId); + + /** + * Notification sent by the framework to indicate that the user has changed a setting. + * + * @param setting User setting that has been modified + * @param enabled true if the setting has been enabled, false otherwise + */ + void onSettingChanged(in Setting setting, in boolean enabled); + + /** + * Queries for a list of loaded nanoapps on a Context Hub. + * + * If this method succeeds, the result of the query must be delivered through the + * handleNanoappInfo() callback. + * + * @param contextHubId The identifier of the Context Hub + * + * @throws EX_ILLEGAL_ARGUMENT if any of the arguments are invalid. + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + * EX_SERVICE_SPECIFIC on error + * - EX_CONTEXT_HUB_UNSPECIFIED if the request failed for other reasons. + */ + void queryNanoapps(in int contextHubId); + + /** + * Register a callback for the HAL implementation to send asynchronous messages to the service + * from a Context hub. There can only be one callback registered for a single Context Hub ID. + * + * A call to this function when a callback has already been registered must override the + * previous registration. + * + * @param contextHubId The identifier of the Context Hub + * @param callback an implementation of the IContextHubCallbacks + * + * @throws EX_ILLEGAL_ARGUMENT if any of the arguments are invalid. + * EX_SERVICE_SPECIFIC on error + * - EX_CONTEXT_HUB_UNSPECIFIED if the request failed for other reasons. + */ + void registerCallback(in int contextHubId, in IContextHubCallback cb); + + /** + * Sends a message targeted to a nanoapp to the Context Hub. + * + * @param contextHubId The identifier of the Context Hub + * @param message The message to be sent + * + * @throws EX_ILLEGAL_ARGUMENT if any of the arguments are invalid. + * EX_SERVICE_SPECIFIC on error + * - EX_CONTEXT_HUB_UNSPECIFIED if the request failed for other reasons. + */ + void sendMessageToHub(in int contextHubId, in ContextHubMessage message); + + /** + * Invoked when a host endpoint has connected with the ContextHubService. + * + * The host associated with this invocation may initiate a communication channel with + * the Context Hub using sendMessageToHub. + * + * @param hostEndpointInfo Metadata associated with this host endpoint. + */ + void onHostEndpointConnected(in HostEndpointInfo hostEndpointInfo); + + /** + * Invoked when a host endpoint has disconnected from the framework. This could be as a result + * of an explicit connection closure, or unexpected restarts. + * + * Note that hostEndpointId is the same as the value in HostEndpointInfo. When this function is + * called, the HAL is expected to clean up any resources attached to the messaging channel + * associated with this host endpoint ID. + * + * @param hostEndPointId The ID of the host that has disconnected. Any invalid values for this + * parameter should be ignored (no-op). + */ + void onHostEndpointDisconnected(char hostEndpointId); + + /** + * Error codes that are used as service specific errors with the AIDL return + * value EX_SERVICE_SPECIFIC. + */ + const int EX_CONTEXT_HUB_UNSPECIFIED = -1; +} diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e385d48c556acbe4827d05fc5506b56b03f407f3 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl @@ -0,0 +1,77 @@ +/* + * 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 android.hardware.contexthub; + +import android.hardware.contexthub.AsyncEventType; +import android.hardware.contexthub.ContextHubMessage; +import android.hardware.contexthub.NanoappInfo; + +@VintfStability +interface IContextHubCallback { + /** + * This callback is passed by the Contexthub service to the HAL + * implementation to allow the HAL to send information about the + * currently loaded and active nanoapps on the hub. + * + * @param appInfo vector of HubAppinfo structure for each nanoApp + * on the hub that can be enabled, disabled and + * unloaded by the service. Any nanoApps that cannot + * be controlled by the service must not be reported. + * All nanoApps that can be controlled by the service + * must be reported. + */ + void handleNanoappInfo(in NanoappInfo[] appInfo); + + /** + * This callback is passed by the Contexthub service to the HAL + * implementation to allow the HAL to send asynchronous messages back + * to the service and registered clients of the ContextHub service. + * + * @param msg message that should be delivered to host app + * clients + * @param msgContentPerms list of Android permissions that cover the + * contents of the message being sent from the app. + * This is different from the permissions stored + * inside of ContextHubMsg in that these must be a + * subset of those permissions and are meant to + * assist in properly attributing the message + * contents when delivering to a ContextHub service + * client. + */ + void handleContextHubMessage(in ContextHubMessage msg, in String[] msgContentPerms); + + /** + * This callback is passed by the Contexthub service to the HAL + * implementation to allow the HAL to send an asynchronous event + * to the ContextHub service. + * + * @param evt event being sent from the contexthub + * + */ + void handleContextHubAsyncEvent(in AsyncEventType evt); + + /** + * This callback is passed by the Contexthub service to the HAL + * implementation to allow the HAL to send the response for a + * transaction. + * + * @param transactionId The ID of the transaction associated with this callback + * @param success true if the transaction succeeded, false otherwise + * + */ + void handleTransactionResult(in int transactionId, in boolean success); +} diff --git a/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c677ca63e8d5c69d44aa4ed52acdc5bbe493555b --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl @@ -0,0 +1,55 @@ +/* + * 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 android.hardware.contexthub; + +@VintfStability +parcelable NanoappBinary { + /** Indicates that the nanoapp is securely signed (e.g. for production) */ + const int FLAG_SIGNED = 1 << 0; + const int FLAG_ENCRYPTED = 1 << 1; + /** Indicates that the nanoapp can run on a Context Hub's TCM memory region */ + const int FLAG_TCM_CAPABLE = 1 << 2; + + /** + * The unique identifier of the nanoapp for the entire system. See chreNanoappInfo in + * system/chre/chre_api/include/chre_api/chre/event.h for the convention for choosing + * this ID. + */ + long nanoappId; + + /** The version of the nanoapp. */ + int nanoappVersion; + + /** The nanoapp flags, comprised of the bitmasks defined in FLAG_* constants above. */ + int flags; + + /** + * The version of the CHRE API that this nanoapp was compiled against. See + * the CHRE API header file chre/version.h for more information. The hub + * implementation must use this to confirm compatibility before loading + * this nanoapp. + */ + byte targetChreApiMajorVersion; + byte targetChreApiMinorVersion; + + /** + * Implementation-specific binary nanoapp data. This does not include the + * common nanoapp header that contains the app ID, etc., as this data is + * explicitly passed through the other fields in this struct. + */ + byte[] customBinary; +} diff --git a/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..77ac0262b4324d0f3b03237047a5051ddde8f690 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl @@ -0,0 +1,49 @@ +/* + * 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 android.hardware.contexthub; + +import android.hardware.contexthub.NanoappRpcService; + +@VintfStability +parcelable NanoappInfo { + /** The unique identifier of the nanoapp. */ + long nanoappId; + + /** The version of the nanoapp */ + int nanoappVersion; + + /** True if this nanoapp is in a running state, false otherwise */ + boolean enabled; + + /** + * The list of Android permissions used by this nanoapp. This list MUST + * correspond to the permissions required for an equivalent Android app to + * sample similar signals through the Android framework. + * + * For example, if a nanoapp used location-based signals, the permissions + * list MUST contains android.permission.ACCESS_FINE_LOCATION and + * android.permission.ACCESS_BACKGROUND_LOCATION. If it were to also use + * audio data, it would require adding android.permission.RECORD_AUDIO to + * this list. + */ + String[] permissions; + + /** + * The list of RPC services supported by this nanoapp. + */ + NanoappRpcService[] rpcServices; +} diff --git a/contexthub/aidl/android/hardware/contexthub/NanoappRpcService.aidl b/contexthub/aidl/android/hardware/contexthub/NanoappRpcService.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6dc5e955e7d5406b105420c23106b1711b5d62a0 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/NanoappRpcService.aidl @@ -0,0 +1,42 @@ +/* + * 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 android.hardware.contexthub; + +/** + * An RPC service exposed by a nanoapp. + * + * The implementation of the RPC interface is not defined by the HAL, and is written + * at the messaging endpoint layers (Android app and/or CHRE nanoapp). NanoappRpcService + * contains the informational metadata to be consumed by the RPC interface layer. + */ +@VintfStability +parcelable NanoappRpcService { + /** + * The unique 64-bit ID of an RPC service exposed by a nanoapp. Note that + * the uniqueness is only required within the nanoapp's domain (i.e. the + * combination of the nanoapp ID and service id must be unique). + */ + long id; + + /** + * The software version of this service, which follows the semantic + * versioning scheme (see semver.org). It follows the format + * major.minor.patch, where major and minor versions take up one byte + * each, and the patch version takes up the final 2 bytes. + */ + int version; +} diff --git a/contexthub/aidl/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/android/hardware/contexthub/Setting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91d4c3f0be1b691c089c4fabea14cec608ce4f88 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/Setting.aidl @@ -0,0 +1,50 @@ +/* + * 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 android.hardware.contexthub; + +/** + * Used to indicate the type of user setting that has changed. + */ +@VintfStability +@Backing(type="byte") +enum Setting { + LOCATION = 1, + /** + * The main WiFi toggle in the Android settings for WiFi connectivity. + */ + WIFI_MAIN, + /** + * The "Wi-Fi scanning" setting for location scans. + */ + WIFI_SCANNING, + AIRPLANE_MODE, + /** + * Indicates if the microphone access is available for CHRE. Microphone + * access is disabled if the user has turned off the microphone as a + * privacy setting, in which case audio data cannot be used and propagated + * by CHRE. + */ + MICROPHONE, + /** + * The main BT toggle in the Android settings for BT connectivity. + */ + BT_MAIN, + /** + * The "BT scanning" setting for location scans. + */ + BT_SCANNING, +} diff --git a/contexthub/aidl/default/Android.bp b/contexthub/aidl/default/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..269057a2a2f85d42072f795578f4d28b4309be15 --- /dev/null +++ b/contexthub/aidl/default/Android.bp @@ -0,0 +1,59 @@ +/* + * 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_library_static { + name: "libcontexthubexampleimpl", + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.contexthub-V1-ndk", + ], + export_include_dirs: ["include"], + srcs: [ + "ContextHub.cpp", + ], + visibility: [ + ":__subpackages__", + "//hardware/interfaces/tests/extension/contexthub:__subpackages__", + ], +} + +cc_binary { + name: "android.hardware.contexthub-service.example", + relative_install_path: "hw", + init_rc: ["contexthub-default.rc"], + vintf_fragments: ["contexthub-default.xml"], + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.contexthub-V1-ndk", + ], + static_libs: [ + "libcontexthubexampleimpl", + ], + srcs: ["main.cpp"], +} diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4c23cbc8bf6b12dbcfbc8d2c8d44fc0bb5369def --- /dev/null +++ b/contexthub/aidl/default/ContextHub.cpp @@ -0,0 +1,119 @@ +/* + * 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. + */ + +#include "contexthub-impl/ContextHub.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace contexthub { + +using ::ndk::ScopedAStatus; + +ScopedAStatus ContextHub::getContextHubs(std::vector* out_contextHubInfos) { + ContextHubInfo hub = {}; + hub.name = "Mock Context Hub"; + hub.vendor = "AOSP"; + hub.toolchain = "n/a"; + hub.id = kMockHubId; + hub.peakMips = 1; + hub.maxSupportedMessageLengthBytes = 4096; + hub.chrePlatformId = UINT64_C(0x476f6f6754000000); + hub.chreApiMajorVersion = 1; + hub.chreApiMinorVersion = 6; + + out_contextHubInfos->push_back(hub); + + return ndk::ScopedAStatus::ok(); +} + +// We don't expose any nanoapps for the default impl, therefore all nanoapp-related APIs fail. +ScopedAStatus ContextHub::loadNanoapp(int32_t /* in_contextHubId */, + const NanoappBinary& /* in_appBinary */, + int32_t /* in_transactionId */) { + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +ScopedAStatus ContextHub::unloadNanoapp(int32_t /* in_contextHubId */, int64_t /* in_appId */, + int32_t /* in_transactionId */) { + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +ScopedAStatus ContextHub::disableNanoapp(int32_t /* in_contextHubId */, int64_t /* in_appId */, + int32_t /* in_transactionId */) { + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +ScopedAStatus ContextHub::enableNanoapp(int32_t /* in_contextHubId */, int64_t /* in_appId */, + int32_t /* in_transactionId */) { + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +ScopedAStatus ContextHub::onSettingChanged(Setting /* in_setting */, bool /*in_enabled */) { + return ndk::ScopedAStatus::ok(); +} + +ScopedAStatus ContextHub::queryNanoapps(int32_t in_contextHubId) { + if (in_contextHubId == kMockHubId && mCallback != nullptr) { + std::vector nanoapps; + mCallback->handleNanoappInfo(nanoapps); + return ndk::ScopedAStatus::ok(); + } else { + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } +} + +ScopedAStatus ContextHub::registerCallback(int32_t in_contextHubId, + const std::shared_ptr& in_cb) { + if (in_contextHubId == kMockHubId) { + mCallback = in_cb; + return ndk::ScopedAStatus::ok(); + } else { + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } +} + +ScopedAStatus ContextHub::sendMessageToHub(int32_t in_contextHubId, + const ContextHubMessage& /* in_message */) { + if (in_contextHubId == kMockHubId) { + // Return true here to indicate that the HAL has accepted the message. + // Successful delivery of the message to a nanoapp should be handled at + // a higher level protocol. + return ndk::ScopedAStatus::ok(); + } else { + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } +} + +ScopedAStatus ContextHub::onHostEndpointConnected(const HostEndpointInfo& in_info) { + mConnectedHostEndpoints.insert(in_info.hostEndpointId); + + return ndk::ScopedAStatus::ok(); +} + +ScopedAStatus ContextHub::onHostEndpointDisconnected(char16_t in_hostEndpointId) { + if (mConnectedHostEndpoints.count(in_hostEndpointId) > 0) { + mConnectedHostEndpoints.erase(in_hostEndpointId); + return ndk::ScopedAStatus::ok(); + } else { + return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT)); + } +} + +} // namespace contexthub +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/contexthub/aidl/default/contexthub-default.rc b/contexthub/aidl/default/contexthub-default.rc new file mode 100644 index 0000000000000000000000000000000000000000..a6a6d2a19f7a2fa97d430f3e651025094059a019 --- /dev/null +++ b/contexthub/aidl/default/contexthub-default.rc @@ -0,0 +1,4 @@ +service vendor.contexthub-default /vendor/bin/hw/android.hardware.contexthub-service.example + class hal + user context_hub + group context_hub diff --git a/contexthub/aidl/default/contexthub-default.xml b/contexthub/aidl/default/contexthub-default.xml new file mode 100644 index 0000000000000000000000000000000000000000..e383c50ca05810df6a8ee508a8a69aef8022a142 --- /dev/null +++ b/contexthub/aidl/default/contexthub-default.xml @@ -0,0 +1,7 @@ + + + android.hardware.contexthub + 1 + IContextHub/default + + diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h new file mode 100644 index 0000000000000000000000000000000000000000..03d84321347ed495d12b717c083c52bad55494f5 --- /dev/null +++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace contexthub { + +class ContextHub : public BnContextHub { + ::ndk::ScopedAStatus getContextHubs(std::vector* out_contextHubInfos) override; + ::ndk::ScopedAStatus loadNanoapp(int32_t in_contextHubId, const NanoappBinary& in_appBinary, + int32_t in_transactionId) override; + ::ndk::ScopedAStatus unloadNanoapp(int32_t in_contextHubId, int64_t in_appId, + int32_t in_transactionId) override; + ::ndk::ScopedAStatus disableNanoapp(int32_t in_contextHubId, int64_t in_appId, + int32_t in_transactionId) override; + ::ndk::ScopedAStatus enableNanoapp(int32_t in_contextHubId, int64_t in_appId, + int32_t in_transactionId) override; + ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override; + ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId) override; + ::ndk::ScopedAStatus registerCallback( + int32_t in_contextHubId, const std::shared_ptr& in_cb) override; + ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId, + const ContextHubMessage& in_message) override; + ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override; + + ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override; + + private: + static constexpr uint32_t kMockHubId = 0; + std::shared_ptr mCallback; + + std::unordered_set mConnectedHostEndpoints; +}; + +} // namespace contexthub +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/contexthub/aidl/default/main.cpp b/contexthub/aidl/default/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dc9035f084087b2b0fe9974b558bee6112419d9d --- /dev/null +++ b/contexthub/aidl/default/main.cpp @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#include "contexthub-impl/ContextHub.h" + +#include +#include +#include + +using aidl::android::hardware::contexthub::ContextHub; + +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(0); + + // Make a default contexthub service + auto vib = ndk::SharedRefBase::make(); + const std::string vibName = std::string() + ContextHub::descriptor + "/default"; + binder_status_t status = AServiceManager_addService(vib->asBinder().get(), vibName.c_str()); + CHECK(status == STATUS_OK); + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} diff --git a/contexthub/aidl/vts/Android.bp b/contexthub/aidl/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..673eac0b93c84311be0c4dc9681490617c718619 --- /dev/null +++ b/contexthub/aidl/vts/Android.bp @@ -0,0 +1,42 @@ +// Copyright 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: "VtsAidlHalContextHubTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: ["VtsAidlHalContextHubTargetTest.cpp"], + shared_libs: [ + "libbinder", + ], + static_libs: [ + "android.hardware.contexthub-V1-cpp", + "VtsHalContexthubUtils", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/contexthub/aidl/vts/OWNERS b/contexthub/aidl/vts/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..150818d5bb3db7a959eab9dbcce78a6d46fe73a7 --- /dev/null +++ b/contexthub/aidl/vts/OWNERS @@ -0,0 +1 @@ +file:/contexthub/common/vts/OWNERS diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3c01c6bac29a6ff22fecabb153b06ed5f15e6e12 --- /dev/null +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -0,0 +1,361 @@ +/* + * 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. + */ +#include +#include + +#include "VtsHalContexthubUtilsCommon.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using ::android::ProcessState; +using ::android::sp; +using ::android::String16; +using ::android::binder::Status; +using ::android::hardware::contexthub::AsyncEventType; +using ::android::hardware::contexthub::ContextHubInfo; +using ::android::hardware::contexthub::ContextHubMessage; +using ::android::hardware::contexthub::HostEndpointInfo; +using ::android::hardware::contexthub::IContextHub; +using ::android::hardware::contexthub::IContextHubCallbackDefault; +using ::android::hardware::contexthub::NanoappBinary; +using ::android::hardware::contexthub::NanoappInfo; +using ::android::hardware::contexthub::NanoappRpcService; +using ::android::hardware::contexthub::Setting; +using ::android::hardware::contexthub::vts_utils::kNonExistentAppId; +using ::android::hardware::contexthub::vts_utils::waitForCallback; + +class ContextHubAidl : public testing::TestWithParam> { + public: + virtual void SetUp() override { + contextHub = android::waitForDeclaredService( + String16(std::get<0>(GetParam()).c_str())); + ASSERT_NE(contextHub, nullptr); + } + + uint32_t getHubId() { return std::get<1>(GetParam()); } + + void testSettingChanged(Setting setting); + + sp contextHub; +}; + +TEST_P(ContextHubAidl, TestGetHubs) { + std::vector hubs; + ASSERT_TRUE(contextHub->getContextHubs(&hubs).isOk()); + + ALOGD("System reports %zu hubs", hubs.size()); + + for (const ContextHubInfo& hub : hubs) { + ALOGD("Checking hub ID %" PRIu32, hub.id); + + EXPECT_GT(hub.name.size(), 0); + EXPECT_GT(hub.vendor.size(), 0); + EXPECT_GT(hub.toolchain.size(), 0); + EXPECT_GT(hub.peakMips, 0); + EXPECT_GT(hub.chrePlatformId, 0); + EXPECT_GT(hub.chreApiMajorVersion, 0); + EXPECT_GE(hub.chreApiMinorVersion, 0); + EXPECT_GE(hub.chrePatchVersion, 0); + + // Minimum 128 byte MTU as required by CHRE API v1.0 + EXPECT_GE(hub.maxSupportedMessageLengthBytes, UINT32_C(128)); + } +} + +class EmptyContextHubCallback : public android::hardware::contexthub::BnContextHubCallback { + public: + Status handleNanoappInfo(const std::vector& /* appInfo */) override { + return Status::ok(); + } + + Status handleContextHubMessage(const ContextHubMessage& /* msg */, + const std::vector& /* msgContentPerms */) override { + return Status::ok(); + } + + Status handleContextHubAsyncEvent(AsyncEventType /* evt */) override { return Status::ok(); } + + Status handleTransactionResult(int32_t /* transactionId */, bool /* success */) override { + return Status::ok(); + } +}; + +TEST_P(ContextHubAidl, TestRegisterCallback) { + sp cb = sp::make(); + ASSERT_TRUE(contextHub->registerCallback(getHubId(), cb).isOk()); +} + +TEST_P(ContextHubAidl, TestRegisterNullCallback) { + ASSERT_TRUE(contextHub->registerCallback(getHubId(), nullptr).isOk()); +} + +// Helper callback that puts the async appInfo callback data into a promise +class QueryAppsCallback : public android::hardware::contexthub::BnContextHubCallback { + public: + Status handleNanoappInfo(const std::vector& appInfo) override { + ALOGD("Got app info callback with %zu apps", appInfo.size()); + promise.set_value(appInfo); + return Status::ok(); + } + + Status handleContextHubMessage(const ContextHubMessage& /* msg */, + const std::vector& /* msgContentPerms */) override { + return Status::ok(); + } + + Status handleContextHubAsyncEvent(AsyncEventType /* evt */) override { return Status::ok(); } + + Status handleTransactionResult(int32_t /* transactionId */, bool /* success */) override { + return Status::ok(); + } + + std::promise> promise; +}; + +// Calls queryApps() and checks the returned metadata +TEST_P(ContextHubAidl, TestQueryApps) { + sp cb = sp::make(); + ASSERT_TRUE(contextHub->registerCallback(getHubId(), cb).isOk()); + ASSERT_TRUE(contextHub->queryNanoapps(getHubId()).isOk()); + + std::vector appInfoList; + ASSERT_TRUE(waitForCallback(cb->promise.get_future(), &appInfoList)); + for (const NanoappInfo& appInfo : appInfoList) { + EXPECT_NE(appInfo.nanoappId, UINT64_C(0)); + EXPECT_NE(appInfo.nanoappId, kNonExistentAppId); + + // Verify services are unique. + std::set existingServiceIds; + for (const NanoappRpcService& rpcService : appInfo.rpcServices) { + EXPECT_NE(rpcService.id, UINT64_C(0)); + EXPECT_EQ(existingServiceIds.count(rpcService.id), 0); + existingServiceIds.insert(rpcService.id); + } + } +} + +// Helper callback that puts the TransactionResult for the expectedTransactionId into a +// promise +class TransactionResultCallback : public android::hardware::contexthub::BnContextHubCallback { + public: + Status handleNanoappInfo(const std::vector& /* appInfo */) override { + return Status::ok(); + } + + Status handleContextHubMessage(const ContextHubMessage& /* msg */, + const std::vector& /* msgContentPerms */) override { + return Status::ok(); + } + + Status handleContextHubAsyncEvent(AsyncEventType /* evt */) override { return Status::ok(); } + + Status handleTransactionResult(int32_t transactionId, bool success) override { + ALOGD("Got transaction result callback for transactionId %" PRIu32 " (expecting %" PRIu32 + ") with success %d", + transactionId, expectedTransactionId, success); + if (transactionId == expectedTransactionId) { + promise.set_value(success); + } + return Status::ok(); + } + + uint32_t expectedTransactionId = 0; + std::promise promise; +}; + +// Parameterized fixture that sets the callback to TransactionResultCallback +class ContextHubTransactionTest : public ContextHubAidl { + public: + virtual void SetUp() override { + ContextHubAidl::SetUp(); + ASSERT_TRUE(contextHub->registerCallback(getHubId(), cb).isOk()); + } + + sp cb = sp::make(); +}; + +TEST_P(ContextHubTransactionTest, TestSendMessageToNonExistentNanoapp) { + ContextHubMessage message; + message.nanoappId = kNonExistentAppId; + message.messageType = 1; + message.messageBody.resize(4); + std::fill(message.messageBody.begin(), message.messageBody.end(), 0); + + ALOGD("Sending message to non-existent nanoapp"); + ASSERT_TRUE(contextHub->sendMessageToHub(getHubId(), message).isOk()); +} + +TEST_P(ContextHubTransactionTest, TestLoadEmptyNanoapp) { + cb->expectedTransactionId = 0123; + NanoappBinary emptyApp; + + emptyApp.nanoappId = kNonExistentAppId; + emptyApp.nanoappVersion = 1; + emptyApp.flags = 0; + emptyApp.targetChreApiMajorVersion = 1; + emptyApp.targetChreApiMinorVersion = 0; + + ALOGD("Loading empty nanoapp"); + bool success = contextHub->loadNanoapp(getHubId(), emptyApp, cb->expectedTransactionId).isOk(); + if (success) { + bool transactionSuccess; + ASSERT_TRUE(waitForCallback(cb->promise.get_future(), &transactionSuccess)); + ASSERT_FALSE(transactionSuccess); + } +} + +TEST_P(ContextHubTransactionTest, TestUnloadNonexistentNanoapp) { + cb->expectedTransactionId = 1234; + + ALOGD("Unloading nonexistent nanoapp"); + bool success = + contextHub->unloadNanoapp(getHubId(), kNonExistentAppId, cb->expectedTransactionId) + .isOk(); + if (success) { + bool transactionSuccess; + ASSERT_TRUE(waitForCallback(cb->promise.get_future(), &transactionSuccess)); + ASSERT_FALSE(transactionSuccess); + } +} + +TEST_P(ContextHubTransactionTest, TestEnableNonexistentNanoapp) { + cb->expectedTransactionId = 2345; + + ALOGD("Enabling nonexistent nanoapp"); + bool success = + contextHub->enableNanoapp(getHubId(), kNonExistentAppId, cb->expectedTransactionId) + .isOk(); + if (success) { + bool transactionSuccess; + ASSERT_TRUE(waitForCallback(cb->promise.get_future(), &transactionSuccess)); + ASSERT_FALSE(transactionSuccess); + } +} + +TEST_P(ContextHubTransactionTest, TestDisableNonexistentNanoapp) { + cb->expectedTransactionId = 3456; + + ALOGD("Disabling nonexistent nanoapp"); + bool success = + contextHub->disableNanoapp(getHubId(), kNonExistentAppId, cb->expectedTransactionId) + .isOk(); + if (success) { + bool transactionSuccess; + ASSERT_TRUE(waitForCallback(cb->promise.get_future(), &transactionSuccess)); + ASSERT_FALSE(transactionSuccess); + } +} + +void ContextHubAidl::testSettingChanged(Setting setting) { + // In VTS, we only test that sending the values doesn't cause things to blow up - GTS tests + // verify the expected E2E behavior in CHRE + sp cb = sp::make(); + ASSERT_TRUE(contextHub->registerCallback(getHubId(), cb).isOk()); + + ASSERT_TRUE(contextHub->onSettingChanged(setting, true /* enabled */).isOk()); + ASSERT_TRUE(contextHub->onSettingChanged(setting, false /* enabled */).isOk()); + + ASSERT_TRUE(contextHub->registerCallback(getHubId(), nullptr).isOk()); +} + +TEST_P(ContextHubAidl, TestOnLocationSettingChanged) { + testSettingChanged(Setting::LOCATION); +} + +TEST_P(ContextHubAidl, TestOnWifiMainSettingChanged) { + testSettingChanged(Setting::WIFI_MAIN); +} + +TEST_P(ContextHubAidl, TestOnWifiScanningSettingChanged) { + testSettingChanged(Setting::WIFI_SCANNING); +} + +TEST_P(ContextHubAidl, TestOnAirplaneModeSettingChanged) { + testSettingChanged(Setting::AIRPLANE_MODE); +} + +TEST_P(ContextHubAidl, TestOnMicrophoneSettingChanged) { + testSettingChanged(Setting::MICROPHONE); +} + +TEST_P(ContextHubAidl, TestOnBtMainSettingChanged) { + testSettingChanged(Setting::BT_MAIN); +} + +TEST_P(ContextHubAidl, TestOnBtScanningSettingChanged) { + testSettingChanged(Setting::BT_SCANNING); +} + +std::vector> generateContextHubMapping() { + std::vector> tuples; + auto contextHubAidlNames = android::getAidlHalInstanceNames(IContextHub::descriptor); + std::vector contextHubInfos; + + for (int i = 0; i < contextHubAidlNames.size(); i++) { + auto contextHubName = contextHubAidlNames[i].c_str(); + auto contextHub = android::waitForDeclaredService(String16(contextHubName)); + if (contextHub->getContextHubs(&contextHubInfos).isOk()) { + for (auto& info : contextHubInfos) { + tuples.push_back(std::make_tuple(contextHubName, info.id)); + } + } + } + + return tuples; +} + +TEST_P(ContextHubAidl, TestHostConnection) { + constexpr char16_t kHostEndpointId = 1; + HostEndpointInfo hostEndpointInfo; + hostEndpointInfo.hostEndpointId = kHostEndpointId; + + ASSERT_TRUE(contextHub->onHostEndpointConnected(hostEndpointInfo).isOk()); + ASSERT_TRUE(contextHub->onHostEndpointDisconnected(kHostEndpointId).isOk()); +} + +TEST_P(ContextHubAidl, TestInvalidHostConnection) { + constexpr char16_t kHostEndpointId = 1; + + ASSERT_TRUE(contextHub->onHostEndpointDisconnected(kHostEndpointId).isOk()); +} + +std::string PrintGeneratedTest(const testing::TestParamInfo& info) { + return std::string("CONTEXT_HUB_ID_") + std::to_string(std::get<1>(info.param)); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ContextHubAidl); +INSTANTIATE_TEST_SUITE_P(ContextHub, ContextHubAidl, testing::ValuesIn(generateContextHubMapping()), + PrintGeneratedTest); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ContextHubTransactionTest); +INSTANTIATE_TEST_SUITE_P(ContextHub, ContextHubTransactionTest, + testing::ValuesIn(generateContextHubMapping()), PrintGeneratedTest); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ProcessState::self()->setThreadPoolMaxThreadCount(1); + ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/contexthub/common/vts/VtsHalContexthubUtils.cpp b/contexthub/common/vts/VtsHalContexthubUtils.cpp index 5033b416c945399cdcf13b59cfa408a9d4e35bdb..d98232583b0c0547289c6b6b473d911bc947cfa7 100644 --- a/contexthub/common/vts/VtsHalContexthubUtils.cpp +++ b/contexthub/common/vts/VtsHalContexthubUtils.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "VtsHalContexthubUtils.h" +#include "VtsHalContexthubUtilsHidl.h" #include #include diff --git a/contexthub/common/vts/VtsHalContexthubUtilsCommon.h b/contexthub/common/vts/VtsHalContexthubUtilsCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..8b04e3f04fa614667142c33e854a88167e6dee69 --- /dev/null +++ b/contexthub/common/vts/VtsHalContexthubUtilsCommon.h @@ -0,0 +1,68 @@ +/* + * 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. + */ + +/** + * Utils file for any Context Hub VTS code (i.e. not specific to e.g. HIDL). + */ + +#pragma once + +#include +#include + +namespace android { +namespace hardware { +namespace contexthub { +namespace vts_utils { + +// App ID with vendor "GoogT" (Google Testing), app identifier 0x555555. This +// app ID is reserved and must never appear in the list of loaded apps. +constexpr uint64_t kNonExistentAppId = 0x476f6f6754555555; + +// Helper that does explicit conversion of an enum class to its underlying/base +// type. Useful for stream output of enum values. +template +inline constexpr typename std::underlying_type::type asBaseType(EnumType value) { + return static_cast::type>(value); +} + +// Wait for a callback to occur (signaled by the given future) up to the +// provided timeout. If the future is invalid or the callback does not come +// within the given time, returns false. +template +bool waitForCallback(std::future future, ReturnType* result, + std::chrono::milliseconds timeout = std::chrono::seconds(5)) { + auto expiration = std::chrono::system_clock::now() + timeout; + + EXPECT_NE(result, nullptr); + EXPECT_TRUE(future.valid()); + if (result != nullptr && future.valid()) { + std::future_status status = future.wait_until(expiration); + EXPECT_NE(status, std::future_status::timeout) << "Timed out waiting for callback"; + + if (status == std::future_status::ready) { + *result = future.get(); + return true; + } + } + + return false; +} + +} // namespace vts_utils +} // namespace contexthub +} // namespace hardware +} // namespace android diff --git a/contexthub/common/vts/VtsHalContexthubUtils.h b/contexthub/common/vts/VtsHalContexthubUtilsHidl.h similarity index 61% rename from contexthub/common/vts/VtsHalContexthubUtils.h rename to contexthub/common/vts/VtsHalContexthubUtilsHidl.h index dff1865f4ca93579142fbb5302e006655b2db2a8..c79afc85cfe22b1c6c4cc4e1651336796c3c9195 100644 --- a/contexthub/common/vts/VtsHalContexthubUtils.h +++ b/contexthub/common/vts/VtsHalContexthubUtilsHidl.h @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/** + * Utils file for HIDL related VTS code. + */ #pragma once #include @@ -21,8 +25,6 @@ #include #include -#include -#include #include namespace android { @@ -30,20 +32,9 @@ namespace hardware { namespace contexthub { namespace vts_utils { -// App ID with vendor "GoogT" (Google Testing), app identifier 0x555555. This -// app ID is reserved and must never appear in the list of loaded apps. -constexpr uint64_t kNonExistentAppId = 0x476f6f6754555555; - #define ASSERT_OK(result) ASSERT_EQ(result, ::android::hardware::contexthub::V1_0::Result::OK) #define EXPECT_OK(result) EXPECT_EQ(result, ::android::hardware::contexthub::V1_0::Result::OK) -// Helper that does explicit conversion of an enum class to its underlying/base -// type. Useful for stream output of enum values. -template -inline constexpr typename std::underlying_type::type asBaseType(EnumType value) { - return static_cast::type>(value); -} - // Synchronously queries IContexthub::getHubs() and returns the result hidl_vec getHubsSync(V1_0::IContexthub* hubApi); @@ -68,29 +59,6 @@ static std::vector> getHalAndHubIdList() { return parameters; } -// Wait for a callback to occur (signaled by the given future) up to the -// provided timeout. If the future is invalid or the callback does not come -// within the given time, returns false. -template -bool waitForCallback(std::future future, ReturnType* result, - std::chrono::milliseconds timeout = std::chrono::seconds(5)) { - auto expiration = std::chrono::system_clock::now() + timeout; - - EXPECT_NE(result, nullptr); - EXPECT_TRUE(future.valid()); - if (result != nullptr && future.valid()) { - std::future_status status = future.wait_until(expiration); - EXPECT_NE(status, std::future_status::timeout) << "Timed out waiting for callback"; - - if (status == std::future_status::ready) { - *result = future.get(); - return true; - } - } - - return false; -} - } // namespace vts_utils } // namespace contexthub } // namespace hardware diff --git a/current.txt b/current.txt index 6a77e19f7b4877568eea292b4039c3d36ac4d462..afde7b17fa727c4f8ab4d43fb3946646d445f92a 100644 --- a/current.txt +++ b/current.txt @@ -5,6 +5,7 @@ 717c17cd380bb48710dff601d1a03351d4ebc28028353d5d60489248f506523c android.hardware.tests.lazy@1.0::ILazy 67222a2ed4071b6c232e671ce0f4be4f85c1c6fb017ec2355396adaae1fe26be android.hardware.tests.lazy@1.1::ILazy +c1c5fbd3a81c0d190c89348eed39539c77e97fe1d8d1b9874eba56393e70c6f0 android.hardware.tests.lazy_cb@1.0::ILazyCb # HALs released in Android O @@ -906,8 +907,26 @@ c8a57364f6ad20842be14f4db284df5304f7521ca8eac6bcc1fa6c5b466fb8a6 android.hardwar # ABI preserving changes to HALs during Android T 62ace52d9c3ff1f60f94118557a2aaf0b953513e59dcd34d5f94ae28d4c7e780 android.hardware.fastboot@1.0::IFastboot +f767a132ef28275294db15353f14f3876a4048770751931a77d038d4228f2cb7 android.hardware.graphics.composer@2.4::IComposerClient d0fb32f3ddeb9af7115ab32905225ea69b930d2472be8e9610f0cf136c15aefb android.hardware.keymaster@4.0::IKeymasterDevice # b/210424594 ca62a2a95d173ed323309e5e00f653ad3cceec82a6e5e4976a249cb5aafe2515 android.hardware.neuralnetworks@1.2::types fa76bced6b1b71c40fc706c508a9011284c57f57831cd0cf5f45653ed4ea463e android.hardware.neuralnetworks@1.3::types +700d9de9b47984898789f5706e59285ea6fe83aa5744dccf8491c4b881033ae7 android.hardware.camera.device@3.7::ICameraInjectionSession -# There should be no more HIDL HALs - please use AIDL instead. +# HALs released in Android T +75d10baa98d661fb455622a1b0c76b53f0b19a906c6fb058daadfed5db77ed3f android.hardware.audio@7.1::IDevice +3a69d224c3351bdc5651c77cd588d5a36bb65a34abd423901a9cf63ac5916f20 android.hardware.audio@7.1::IDevicesFactory +4569e703efb9ab0f4fc02bcca866a77d4352e292fbf715927cba31e6eba51ad6 android.hardware.audio@7.1::IPrimaryDevice +ec11690878547a55eb1d6a286f83e227d8328c2cf1d069316b55b4e4084fd9a2 android.hardware.audio@7.1::IStreamOut +786b8619580d7cfae70f02136307e141481714fcc76c6b700e655568f1bf0733 android.hardware.audio@7.1::IStreamOutLatencyModeCallback +bfbf383768881eb06f99db76ce79135e37b2b105a90d67bf7468f8df05180bf4 android.hardware.audio@7.1::types +1de444305084b815a1cf45b41d8bd7fa8dc960da89c2d548f38feaa662d8f310 android.hardware.wifi@1.6::IWifi +e8cf2570d2f3d8cf7a7251e85a87cbf633d0bff3c28e1c9bbf339dea04b254fa android.hardware.wifi@1.6::IWifiChip +e05c047de0a7f2cc8f166a1c808b78e8565ff866fb69991fc3bbfa9141871d5b android.hardware.wifi@1.6::IWifiNanIface +b7ce2d87841585551b082fca6d099622e63b7099e0d8013f687ea1a1dc35c4dc android.hardware.wifi@1.6::IWifiNanIfaceEventCallback +8c51742b2540b005edb16d2003b87f8e8220e113b234ddbb133f95e86837e9aa android.hardware.wifi@1.6::IWifiRttController +537f0bcfaf9d91b3136984f5e85d6ea559771726d6624a1d17c151b9c9f4b2f9 android.hardware.wifi@1.6::IWifiRttControllerEventCallback +1bac6a7c8136dfb0414fe5639eec115aa2d12927e64a0642a43fb53225f099b2 android.hardware.wifi@1.6::IWifiStaIface +0a800e010e8eb6eecdfdc96f04fd2ae2f417a79a74a7c0eec3a9f539199bccd4 android.hardware.wifi@1.6::types + +# There will be no more HIDL HALs. Use AIDL instead. diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp index 8ca6a656ca0495d2308cb8fe0c651bfc200147e8..d6c37c5939d10b3579eb7c5109603b7495594285 100644 --- a/drm/1.0/vts/functional/Android.bp +++ b/drm/1.0/vts/functional/Android.bp @@ -23,6 +23,14 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } +cc_library_headers { + name: "drm_hal_vendor_module_headers", + vendor_available: true, + export_include_dirs: [ + "include", + ], +} + cc_library_static { name: "libdrmvtshelper", defaults: ["VtsHalTargetTestDefaults"], @@ -36,6 +44,7 @@ cc_library_static { "android.hardware.drm@1.0-helper", ], export_include_dirs: ["include"], + export_static_lib_headers: ["android.hardware.drm@1.0-helper"], } cc_library_static { diff --git a/drm/1.2/vts/functional/Android.bp b/drm/1.2/vts/functional/Android.bp index dd22ebe10b83c4cb84cbf72f552a646b6f55791a..9a450514ffb775c4b55c6b1d36c917c8c289dc38 100644 --- a/drm/1.2/vts/functional/Android.bp +++ b/drm/1.2/vts/functional/Android.bp @@ -23,6 +23,19 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } +cc_library_static { + name: "libvtsclearkey", + srcs: [ + "drm_hal_clearkey_module.cpp", + ], + static_libs: [ + "libgtest", + ], + header_libs: ["drm_hal_vendor_module_headers"], + export_header_lib_headers: ["drm_hal_vendor_module_headers"], + export_include_dirs: ["."], +} + cc_library_static { name: "android.hardware.drm@1.2-vts", defaults: ["VtsHalTargetTestDefaults"], diff --git a/drm/aidl/Android.bp b/drm/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..6273a38a26eddfa2c9fc8f486bd41567645e7a43 --- /dev/null +++ b/drm/aidl/Android.bp @@ -0,0 +1,37 @@ +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"], +} + +aidl_interface { + name: "android.hardware.drm", + vendor_available: true, + srcs: ["android/hardware/drm/*.aidl"], + stability: "vintf", + imports: [ + "android.hardware.common-V2", + ], + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + ndk: { + min_sdk_version: "current", + }, + }, + double_loadable: true, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.common-V2"], + }, + ], + +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/.hash b/drm/aidl/aidl_api/android.hardware.drm/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..886e28c0cba05362572a70e3668b4043283f9761 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/.hash @@ -0,0 +1 @@ +7b4b0a0f36a7a6bb22d2016375e4a9d4a033592f diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/CryptoSchemes.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/CryptoSchemes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1d3c293eca267f3de26581632e8d22996854730c --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/CryptoSchemes.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.drm; +@VintfStability +parcelable CryptoSchemes { + List uuids; + List mimeTypes; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DecryptArgs.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DecryptArgs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9c574a48ef8287f6a82a21b5547dfb69ccb71612 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DecryptArgs.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.drm; +@VintfStability +parcelable DecryptArgs { + boolean secure; + byte[] keyId; + byte[] iv; + android.hardware.drm.Mode mode; + android.hardware.drm.Pattern pattern; + android.hardware.drm.SubSample[] subSamples; + android.hardware.drm.SharedBuffer source; + long offset; + android.hardware.drm.DestinationBuffer destination; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DestinationBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DestinationBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8c3ba7d0b76b0f41f2f83bc6e01f6ee491f3a2bd --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DestinationBuffer.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +union DestinationBuffer { + android.hardware.drm.SharedBuffer nonsecureMemory; + android.hardware.common.NativeHandle secureMemory; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetric.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetric.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c78dff0b166ca0fb85ac4a44cd6869c9f6bcef04 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetric.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable DrmMetric { + String name; + List attributes; + List values; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricGroup.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricGroup.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4128eaa54db79686b6f2271dc4c5ec3ccdecca4c --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricGroup.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable DrmMetricGroup { + List metrics; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricNamedValue.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricNamedValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..76ec35c0cf4d18412d84c58c2c2ae7b53a2d73fd --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricNamedValue.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable DrmMetricNamedValue { + String name; + android.hardware.drm.DrmMetricValue value; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricValue.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..806491357c02556835e78b887db8fa00be4ba833 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/DrmMetricValue.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +union DrmMetricValue { + long int64Value; + double doubleValue; + String stringValue; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/EventType.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/EventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..80ebb285ae3fb3fc5781afaacab9188b1b705a22 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/EventType.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum EventType { + PROVISION_REQUIRED = 0, + KEY_NEEDED = 1, + KEY_EXPIRED = 2, + VENDOR_DEFINED = 3, + SESSION_RECLAIMED = 4, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevel.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5704fb0726c18e668f26f3f569149c254a71f1e7 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevel.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum HdcpLevel { + HDCP_UNKNOWN = 0, + HDCP_NONE = 1, + HDCP_V1 = 2, + HDCP_V2 = 3, + HDCP_V2_1 = 4, + HDCP_V2_2 = 5, + HDCP_NO_OUTPUT = 6, + HDCP_V2_3 = 7, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevels.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevels.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6f86ace67b47f83ac2a32456be9a93ed6990521 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevels.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable HdcpLevels { + android.hardware.drm.HdcpLevel connectedLevel; + android.hardware.drm.HdcpLevel maxLevel; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ICryptoPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ICryptoPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..31c45e0e1fcea03093848645c2c9d86278025316 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ICryptoPlugin.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.drm; +@VintfStability +interface ICryptoPlugin { + int decrypt(in android.hardware.drm.DecryptArgs args); + List getLogMessages(); + void notifyResolution(in int width, in int height); + boolean requiresSecureDecoderComponent(in String mime); + void setMediaDrmSession(in byte[] sessionId); + void setSharedBufferBase(in android.hardware.drm.SharedBuffer base); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmFactory.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmFactory.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82efbb7ea0266daa30e410b2412199a7695d9ede --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmFactory.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +interface IDrmFactory { + @nullable android.hardware.drm.IDrmPlugin createDrmPlugin(in android.hardware.drm.Uuid uuid, in String appPackageName); + @nullable android.hardware.drm.ICryptoPlugin createCryptoPlugin(in android.hardware.drm.Uuid uuid, in byte[] initData); + android.hardware.drm.CryptoSchemes getSupportedCryptoSchemes(); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae10062c81b90e23e5de7b755364c02801a34387 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmPlugin.aidl @@ -0,0 +1,76 @@ +/* + * 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 -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.drm; +@VintfStability +interface IDrmPlugin { + void closeSession(in byte[] sessionId); + byte[] decrypt(in byte[] sessionId, in byte[] keyId, in byte[] input, in byte[] iv); + byte[] encrypt(in byte[] sessionId, in byte[] keyId, in byte[] input, in byte[] iv); + android.hardware.drm.HdcpLevels getHdcpLevels(); + android.hardware.drm.KeyRequest getKeyRequest(in byte[] scope, in byte[] initData, in String mimeType, in android.hardware.drm.KeyType keyType, in android.hardware.drm.KeyValue[] optionalParameters); + List getLogMessages(); + List getMetrics(); + android.hardware.drm.NumberOfSessions getNumberOfSessions(); + List getOfflineLicenseKeySetIds(); + android.hardware.drm.OfflineLicenseState getOfflineLicenseState(in android.hardware.drm.KeySetId keySetId); + byte[] getPropertyByteArray(in String propertyName); + String getPropertyString(in String propertyName); + android.hardware.drm.ProvisionRequest getProvisionRequest(in String certificateType, in String certificateAuthority); + android.hardware.drm.SecureStop getSecureStop(in android.hardware.drm.SecureStopId secureStopId); + List getSecureStopIds(); + List getSecureStops(); + android.hardware.drm.SecurityLevel getSecurityLevel(in byte[] sessionId); + byte[] openSession(in android.hardware.drm.SecurityLevel securityLevel); + android.hardware.drm.KeySetId provideKeyResponse(in byte[] scope, in byte[] response); + android.hardware.drm.ProvideProvisionResponseResult provideProvisionResponse(in byte[] response); + List queryKeyStatus(in byte[] sessionId); + void releaseAllSecureStops(); + void releaseSecureStop(in android.hardware.drm.SecureStopId secureStopId); + void releaseSecureStops(in android.hardware.drm.OpaqueData ssRelease); + void removeAllSecureStops(); + void removeKeys(in byte[] sessionId); + void removeOfflineLicense(in android.hardware.drm.KeySetId keySetId); + void removeSecureStop(in android.hardware.drm.SecureStopId secureStopId); + boolean requiresSecureDecoder(in String mime, in android.hardware.drm.SecurityLevel level); + void restoreKeys(in byte[] sessionId, in android.hardware.drm.KeySetId keySetId); + void setCipherAlgorithm(in byte[] sessionId, in String algorithm); + void setListener(in android.hardware.drm.IDrmPluginListener listener); + void setMacAlgorithm(in byte[] sessionId, in String algorithm); + void setPlaybackId(in byte[] sessionId, in String playbackId); + void setPropertyByteArray(in String propertyName, in byte[] value); + void setPropertyString(in String propertyName, in String value); + byte[] sign(in byte[] sessionId, in byte[] keyId, in byte[] message); + byte[] signRSA(in byte[] sessionId, in String algorithm, in byte[] message, in byte[] wrappedkey); + boolean verify(in byte[] sessionId, in byte[] keyId, in byte[] message, in byte[] signature); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmPluginListener.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmPluginListener.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0a4b4b70bc8211b879f0b199f11e7fcbd3d02a7e --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/IDrmPluginListener.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 -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.drm; +@VintfStability +interface IDrmPluginListener { + oneway void onEvent(in android.hardware.drm.EventType eventType, in byte[] sessionId, in byte[] data); + oneway void onExpirationUpdate(in byte[] sessionId, in long expiryTimeInMS); + oneway void onKeysChange(in byte[] sessionId, in android.hardware.drm.KeyStatus[] keyStatusList, in boolean hasNewUsableKey); + oneway void onSessionLostState(in byte[] sessionId); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyRequest.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..267f53275583a2ede2fb41ed49eda71b92f7d9f7 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeyRequest { + byte[] request; + android.hardware.drm.KeyRequestType requestType; + String defaultUrl; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyRequestType.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyRequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..34b9615c55e1dcad4dd3c6ecc187e86cdbd20345 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyRequestType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum KeyRequestType { + INITIAL = 0, + RENEWAL = 1, + RELEASE = 2, + UNKNOWN = 3, + NONE = 4, + UPDATE = 5, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeySetId.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeySetId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..58dfe1a4129f05c483ce25e02aac698a769e480d --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeySetId.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeySetId { + byte[] keySetId; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyStatus.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..53ab70f0fb68bad10be674a0e10bb96c70923ab4 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeyStatus { + byte[] keyId; + android.hardware.drm.KeyStatusType type; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyStatusType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..261516f8efed0c6ea3a535cb5e6d1f0d7b2e68ac --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyStatusType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum KeyStatusType { + USABLE = 0, + EXPIRED = 1, + OUTPUT_NOT_ALLOWED = 2, + STATUS_PENDING = 3, + INTERNAL_ERROR = 4, + USABLE_IN_FUTURE = 5, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyType.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7a9d6335788a883bb30971d72612b12bc5d2b413 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum KeyType { + OFFLINE = 0, + STREAMING = 1, + RELEASE = 2, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyValue.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35d7b77bc9af10da44bf97149899757521332925 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/KeyValue.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeyValue { + String key; + String value; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/LogMessage.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/LogMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..93f76e1c41ede4c9b05e58c73264b4181877ffbc --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/LogMessage.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable LogMessage { + long timeMs; + android.hardware.drm.LogPriority priority; + String message; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/LogPriority.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/LogPriority.aidl new file mode 100644 index 0000000000000000000000000000000000000000..83362c359fe91425e6f2a145e55ce985d77b9cea --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/LogPriority.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum LogPriority { + UNKNOWN = 0, + DEFAULT = 1, + VERBOSE = 2, + DEBUG = 3, + INFO = 4, + WARN = 5, + ERROR = 6, + FATAL = 7, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Mode.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Mode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..73797740931c017ffd4512328ebd5bd1084af63f --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Mode.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 -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.drm; +@Backing(type="int") @VintfStability +enum Mode { + UNENCRYPTED = 0, + AES_CTR = 1, + AES_CBC_CTS = 2, + AES_CBC = 3, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/NumberOfSessions.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/NumberOfSessions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a421125fc3faa19324839b805bf480ad2703afa8 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/NumberOfSessions.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable NumberOfSessions { + int currentSessions; + int maxSessions; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/OfflineLicenseState.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/OfflineLicenseState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..629564d706e87f09d483623f04e1b6497aaf34c3 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/OfflineLicenseState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum OfflineLicenseState { + UNKNOWN = 0, + USABLE = 1, + INACTIVE = 2, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/OpaqueData.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/OpaqueData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3085889faf0b227688faced0ed1ce1720e44966e --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/OpaqueData.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable OpaqueData { + byte[] opaqueData; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Pattern.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Pattern.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b01562e67e7af937fad5cbfa34a0b3e1a738b607 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Pattern.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable Pattern { + int encryptBlocks; + int skipBlocks; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ProvideProvisionResponseResult.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ProvideProvisionResponseResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..827de59093eaa54f1dc01769e91600e828cc18fa --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ProvideProvisionResponseResult.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable ProvideProvisionResponseResult { + byte[] certificate; + byte[] wrappedKey; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ProvisionRequest.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ProvisionRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84c56621f2e8fe328adae76f07121840c881458b --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/ProvisionRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable ProvisionRequest { + byte[] request; + String defaultUrl; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecureStop.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecureStop.aidl new file mode 100644 index 0000000000000000000000000000000000000000..81d2dfe75ce0622ced5ae3aa286e16dfc4b98cf2 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecureStop.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable SecureStop { + byte[] opaqueData; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecureStopId.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecureStopId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b904c862959e45fc56560af5c0783ae7d77e470 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecureStopId.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable SecureStopId { + byte[] secureStopId; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecurityLevel.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecurityLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..65b2b9d2ae290471cbc523ba63f0b1848040bb44 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SecurityLevel.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum SecurityLevel { + UNKNOWN = 0, + SW_SECURE_CRYPTO = 1, + SW_SECURE_DECODE = 2, + HW_SECURE_CRYPTO = 3, + HW_SECURE_DECODE = 4, + HW_SECURE_ALL = 5, + DEFAULT = 6, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SharedBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SharedBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..314fe7cf00f2646671ed55b6394cdf874c9a0254 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SharedBuffer.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 -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.drm; +@VintfStability +parcelable SharedBuffer { + int bufferId; + long offset; + long size; + android.hardware.common.NativeHandle handle; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Status.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Status.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c64068958f8ce138ba087722976040ae7fa689b1 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Status.aidl @@ -0,0 +1,77 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum Status { + OK = 0, + ERROR_DRM_NO_LICENSE = 1, + ERROR_DRM_LICENSE_EXPIRED = 2, + ERROR_DRM_SESSION_NOT_OPENED = 3, + ERROR_DRM_CANNOT_HANDLE = 4, + ERROR_DRM_INVALID_STATE = 5, + BAD_VALUE = 6, + ERROR_DRM_NOT_PROVISIONED = 7, + ERROR_DRM_RESOURCE_BUSY = 8, + ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION = 9, + ERROR_DRM_DEVICE_REVOKED = 10, + ERROR_DRM_DECRYPT = 11, + ERROR_DRM_UNKNOWN = 12, + ERROR_DRM_INSUFFICIENT_SECURITY = 13, + ERROR_DRM_FRAME_TOO_LARGE = 14, + ERROR_DRM_SESSION_LOST_STATE = 15, + ERROR_DRM_RESOURCE_CONTENTION = 16, + CANNOT_DECRYPT_ZERO_SUBSAMPLES = 17, + CRYPTO_LIBRARY_ERROR = 18, + GENERAL_OEM_ERROR = 19, + GENERAL_PLUGIN_ERROR = 20, + INIT_DATA_INVALID = 21, + KEY_NOT_LOADED = 22, + LICENSE_PARSE_ERROR = 23, + LICENSE_POLICY_ERROR = 24, + LICENSE_RELEASE_ERROR = 25, + LICENSE_REQUEST_REJECTED = 26, + LICENSE_RESTORE_ERROR = 27, + LICENSE_STATE_ERROR = 28, + MALFORMED_CERTIFICATE = 29, + MEDIA_FRAMEWORK_ERROR = 30, + MISSING_CERTIFICATE = 31, + PROVISIONING_CERTIFICATE_ERROR = 32, + PROVISIONING_CONFIGURATION_ERROR = 33, + PROVISIONING_PARSE_ERROR = 34, + PROVISIONING_REQUEST_REJECTED = 35, + RETRYABLE_PROVISIONING_ERROR = 36, + SECURE_STOP_RELEASE_ERROR = 37, + STORAGE_READ_FAILURE = 38, + STORAGE_WRITE_FAILURE = 39, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SubSample.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SubSample.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57d815eeb25d03200b527ac1a2461ad2d28e4bf4 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SubSample.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable SubSample { + int numBytesOfClearData; + int numBytesOfEncryptedData; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SupportedContentType.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SupportedContentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6ef5db860a5d1c9e73bdb9cf33b6499ddd69624e --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/SupportedContentType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.drm; +@VintfStability +parcelable SupportedContentType { + String mime; + android.hardware.drm.SecurityLevel minLevel; + android.hardware.drm.SecurityLevel maxLevel; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Uuid.aidl b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Uuid.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3c2cfa2037200a0cc52a8ea2f9e26ed465466320 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/Uuid.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable Uuid { + byte[16] uuid; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1d3c293eca267f3de26581632e8d22996854730c --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.drm; +@VintfStability +parcelable CryptoSchemes { + List uuids; + List mimeTypes; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9c574a48ef8287f6a82a21b5547dfb69ccb71612 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DecryptArgs.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.drm; +@VintfStability +parcelable DecryptArgs { + boolean secure; + byte[] keyId; + byte[] iv; + android.hardware.drm.Mode mode; + android.hardware.drm.Pattern pattern; + android.hardware.drm.SubSample[] subSamples; + android.hardware.drm.SharedBuffer source; + long offset; + android.hardware.drm.DestinationBuffer destination; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8c3ba7d0b76b0f41f2f83bc6e01f6ee491f3a2bd --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DestinationBuffer.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +union DestinationBuffer { + android.hardware.drm.SharedBuffer nonsecureMemory; + android.hardware.common.NativeHandle secureMemory; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetric.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetric.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c78dff0b166ca0fb85ac4a44cd6869c9f6bcef04 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetric.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable DrmMetric { + String name; + List attributes; + List values; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricGroup.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricGroup.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4128eaa54db79686b6f2271dc4c5ec3ccdecca4c --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricGroup.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable DrmMetricGroup { + List metrics; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricNamedValue.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricNamedValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..76ec35c0cf4d18412d84c58c2c2ae7b53a2d73fd --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricNamedValue.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable DrmMetricNamedValue { + String name; + android.hardware.drm.DrmMetricValue value; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricValue.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..806491357c02556835e78b887db8fa00be4ba833 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/DrmMetricValue.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +union DrmMetricValue { + long int64Value; + double doubleValue; + String stringValue; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/EventType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/EventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..80ebb285ae3fb3fc5781afaacab9188b1b705a22 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/EventType.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum EventType { + PROVISION_REQUIRED = 0, + KEY_NEEDED = 1, + KEY_EXPIRED = 2, + VENDOR_DEFINED = 3, + SESSION_RECLAIMED = 4, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevel.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5704fb0726c18e668f26f3f569149c254a71f1e7 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevel.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum HdcpLevel { + HDCP_UNKNOWN = 0, + HDCP_NONE = 1, + HDCP_V1 = 2, + HDCP_V2 = 3, + HDCP_V2_1 = 4, + HDCP_V2_2 = 5, + HDCP_NO_OUTPUT = 6, + HDCP_V2_3 = 7, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevels.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevels.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6f86ace67b47f83ac2a32456be9a93ed6990521 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevels.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable HdcpLevels { + android.hardware.drm.HdcpLevel connectedLevel; + android.hardware.drm.HdcpLevel maxLevel; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..31c45e0e1fcea03093848645c2c9d86278025316 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ICryptoPlugin.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.drm; +@VintfStability +interface ICryptoPlugin { + int decrypt(in android.hardware.drm.DecryptArgs args); + List getLogMessages(); + void notifyResolution(in int width, in int height); + boolean requiresSecureDecoderComponent(in String mime); + void setMediaDrmSession(in byte[] sessionId); + void setSharedBufferBase(in android.hardware.drm.SharedBuffer base); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82efbb7ea0266daa30e410b2412199a7695d9ede --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmFactory.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +interface IDrmFactory { + @nullable android.hardware.drm.IDrmPlugin createDrmPlugin(in android.hardware.drm.Uuid uuid, in String appPackageName); + @nullable android.hardware.drm.ICryptoPlugin createCryptoPlugin(in android.hardware.drm.Uuid uuid, in byte[] initData); + android.hardware.drm.CryptoSchemes getSupportedCryptoSchemes(); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae10062c81b90e23e5de7b755364c02801a34387 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPlugin.aidl @@ -0,0 +1,76 @@ +/* + * 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 -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.drm; +@VintfStability +interface IDrmPlugin { + void closeSession(in byte[] sessionId); + byte[] decrypt(in byte[] sessionId, in byte[] keyId, in byte[] input, in byte[] iv); + byte[] encrypt(in byte[] sessionId, in byte[] keyId, in byte[] input, in byte[] iv); + android.hardware.drm.HdcpLevels getHdcpLevels(); + android.hardware.drm.KeyRequest getKeyRequest(in byte[] scope, in byte[] initData, in String mimeType, in android.hardware.drm.KeyType keyType, in android.hardware.drm.KeyValue[] optionalParameters); + List getLogMessages(); + List getMetrics(); + android.hardware.drm.NumberOfSessions getNumberOfSessions(); + List getOfflineLicenseKeySetIds(); + android.hardware.drm.OfflineLicenseState getOfflineLicenseState(in android.hardware.drm.KeySetId keySetId); + byte[] getPropertyByteArray(in String propertyName); + String getPropertyString(in String propertyName); + android.hardware.drm.ProvisionRequest getProvisionRequest(in String certificateType, in String certificateAuthority); + android.hardware.drm.SecureStop getSecureStop(in android.hardware.drm.SecureStopId secureStopId); + List getSecureStopIds(); + List getSecureStops(); + android.hardware.drm.SecurityLevel getSecurityLevel(in byte[] sessionId); + byte[] openSession(in android.hardware.drm.SecurityLevel securityLevel); + android.hardware.drm.KeySetId provideKeyResponse(in byte[] scope, in byte[] response); + android.hardware.drm.ProvideProvisionResponseResult provideProvisionResponse(in byte[] response); + List queryKeyStatus(in byte[] sessionId); + void releaseAllSecureStops(); + void releaseSecureStop(in android.hardware.drm.SecureStopId secureStopId); + void releaseSecureStops(in android.hardware.drm.OpaqueData ssRelease); + void removeAllSecureStops(); + void removeKeys(in byte[] sessionId); + void removeOfflineLicense(in android.hardware.drm.KeySetId keySetId); + void removeSecureStop(in android.hardware.drm.SecureStopId secureStopId); + boolean requiresSecureDecoder(in String mime, in android.hardware.drm.SecurityLevel level); + void restoreKeys(in byte[] sessionId, in android.hardware.drm.KeySetId keySetId); + void setCipherAlgorithm(in byte[] sessionId, in String algorithm); + void setListener(in android.hardware.drm.IDrmPluginListener listener); + void setMacAlgorithm(in byte[] sessionId, in String algorithm); + void setPlaybackId(in byte[] sessionId, in String playbackId); + void setPropertyByteArray(in String propertyName, in byte[] value); + void setPropertyString(in String propertyName, in String value); + byte[] sign(in byte[] sessionId, in byte[] keyId, in byte[] message); + byte[] signRSA(in byte[] sessionId, in String algorithm, in byte[] message, in byte[] wrappedkey); + boolean verify(in byte[] sessionId, in byte[] keyId, in byte[] message, in byte[] signature); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPluginListener.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPluginListener.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0a4b4b70bc8211b879f0b199f11e7fcbd3d02a7e --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/IDrmPluginListener.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 -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.drm; +@VintfStability +interface IDrmPluginListener { + oneway void onEvent(in android.hardware.drm.EventType eventType, in byte[] sessionId, in byte[] data); + oneway void onExpirationUpdate(in byte[] sessionId, in long expiryTimeInMS); + oneway void onKeysChange(in byte[] sessionId, in android.hardware.drm.KeyStatus[] keyStatusList, in boolean hasNewUsableKey); + oneway void onSessionLostState(in byte[] sessionId); +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequest.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..267f53275583a2ede2fb41ed49eda71b92f7d9f7 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeyRequest { + byte[] request; + android.hardware.drm.KeyRequestType requestType; + String defaultUrl; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequestType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..34b9615c55e1dcad4dd3c6ecc187e86cdbd20345 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequestType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum KeyRequestType { + INITIAL = 0, + RENEWAL = 1, + RELEASE = 2, + UNKNOWN = 3, + NONE = 4, + UPDATE = 5, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeySetId.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeySetId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..58dfe1a4129f05c483ce25e02aac698a769e480d --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeySetId.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeySetId { + byte[] keySetId; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatus.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..53ab70f0fb68bad10be674a0e10bb96c70923ab4 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeyStatus { + byte[] keyId; + android.hardware.drm.KeyStatusType type; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..261516f8efed0c6ea3a535cb5e6d1f0d7b2e68ac --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum KeyStatusType { + USABLE = 0, + EXPIRED = 1, + OUTPUT_NOT_ALLOWED = 2, + STATUS_PENDING = 3, + INTERNAL_ERROR = 4, + USABLE_IN_FUTURE = 5, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7a9d6335788a883bb30971d72612b12bc5d2b413 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum KeyType { + OFFLINE = 0, + STREAMING = 1, + RELEASE = 2, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyValue.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35d7b77bc9af10da44bf97149899757521332925 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyValue.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable KeyValue { + String key; + String value; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogMessage.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..93f76e1c41ede4c9b05e58c73264b4181877ffbc --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogMessage.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable LogMessage { + long timeMs; + android.hardware.drm.LogPriority priority; + String message; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogPriority.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogPriority.aidl new file mode 100644 index 0000000000000000000000000000000000000000..83362c359fe91425e6f2a145e55ce985d77b9cea --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogPriority.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum LogPriority { + UNKNOWN = 0, + DEFAULT = 1, + VERBOSE = 2, + DEBUG = 3, + INFO = 4, + WARN = 5, + ERROR = 6, + FATAL = 7, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Mode.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Mode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..73797740931c017ffd4512328ebd5bd1084af63f --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Mode.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 -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.drm; +@Backing(type="int") @VintfStability +enum Mode { + UNENCRYPTED = 0, + AES_CTR = 1, + AES_CBC_CTS = 2, + AES_CBC = 3, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/NumberOfSessions.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/NumberOfSessions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a421125fc3faa19324839b805bf480ad2703afa8 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/NumberOfSessions.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable NumberOfSessions { + int currentSessions; + int maxSessions; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OfflineLicenseState.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OfflineLicenseState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..629564d706e87f09d483623f04e1b6497aaf34c3 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OfflineLicenseState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum OfflineLicenseState { + UNKNOWN = 0, + USABLE = 1, + INACTIVE = 2, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OpaqueData.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OpaqueData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3085889faf0b227688faced0ed1ce1720e44966e --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OpaqueData.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable OpaqueData { + byte[] opaqueData; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Pattern.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Pattern.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b01562e67e7af937fad5cbfa34a0b3e1a738b607 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Pattern.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable Pattern { + int encryptBlocks; + int skipBlocks; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ProvideProvisionResponseResult.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ProvideProvisionResponseResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..827de59093eaa54f1dc01769e91600e828cc18fa --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ProvideProvisionResponseResult.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable ProvideProvisionResponseResult { + byte[] certificate; + byte[] wrappedKey; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ProvisionRequest.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ProvisionRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84c56621f2e8fe328adae76f07121840c881458b --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/ProvisionRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable ProvisionRequest { + byte[] request; + String defaultUrl; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecureStop.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecureStop.aidl new file mode 100644 index 0000000000000000000000000000000000000000..81d2dfe75ce0622ced5ae3aa286e16dfc4b98cf2 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecureStop.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable SecureStop { + byte[] opaqueData; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecureStopId.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecureStopId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b904c862959e45fc56560af5c0783ae7d77e470 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecureStopId.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable SecureStopId { + byte[] secureStopId; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecurityLevel.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecurityLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..65b2b9d2ae290471cbc523ba63f0b1848040bb44 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecurityLevel.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum SecurityLevel { + UNKNOWN = 0, + SW_SECURE_CRYPTO = 1, + SW_SECURE_DECODE = 2, + HW_SECURE_CRYPTO = 3, + HW_SECURE_DECODE = 4, + HW_SECURE_ALL = 5, + DEFAULT = 6, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..314fe7cf00f2646671ed55b6394cdf874c9a0254 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SharedBuffer.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 -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.drm; +@VintfStability +parcelable SharedBuffer { + int bufferId; + long offset; + long size; + android.hardware.common.NativeHandle handle; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Status.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Status.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c64068958f8ce138ba087722976040ae7fa689b1 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Status.aidl @@ -0,0 +1,77 @@ +/* + * 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 -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.drm; +@Backing(type="int") @VintfStability +enum Status { + OK = 0, + ERROR_DRM_NO_LICENSE = 1, + ERROR_DRM_LICENSE_EXPIRED = 2, + ERROR_DRM_SESSION_NOT_OPENED = 3, + ERROR_DRM_CANNOT_HANDLE = 4, + ERROR_DRM_INVALID_STATE = 5, + BAD_VALUE = 6, + ERROR_DRM_NOT_PROVISIONED = 7, + ERROR_DRM_RESOURCE_BUSY = 8, + ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION = 9, + ERROR_DRM_DEVICE_REVOKED = 10, + ERROR_DRM_DECRYPT = 11, + ERROR_DRM_UNKNOWN = 12, + ERROR_DRM_INSUFFICIENT_SECURITY = 13, + ERROR_DRM_FRAME_TOO_LARGE = 14, + ERROR_DRM_SESSION_LOST_STATE = 15, + ERROR_DRM_RESOURCE_CONTENTION = 16, + CANNOT_DECRYPT_ZERO_SUBSAMPLES = 17, + CRYPTO_LIBRARY_ERROR = 18, + GENERAL_OEM_ERROR = 19, + GENERAL_PLUGIN_ERROR = 20, + INIT_DATA_INVALID = 21, + KEY_NOT_LOADED = 22, + LICENSE_PARSE_ERROR = 23, + LICENSE_POLICY_ERROR = 24, + LICENSE_RELEASE_ERROR = 25, + LICENSE_REQUEST_REJECTED = 26, + LICENSE_RESTORE_ERROR = 27, + LICENSE_STATE_ERROR = 28, + MALFORMED_CERTIFICATE = 29, + MEDIA_FRAMEWORK_ERROR = 30, + MISSING_CERTIFICATE = 31, + PROVISIONING_CERTIFICATE_ERROR = 32, + PROVISIONING_CONFIGURATION_ERROR = 33, + PROVISIONING_PARSE_ERROR = 34, + PROVISIONING_REQUEST_REJECTED = 35, + RETRYABLE_PROVISIONING_ERROR = 36, + SECURE_STOP_RELEASE_ERROR = 37, + STORAGE_READ_FAILURE = 38, + STORAGE_WRITE_FAILURE = 39, +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SubSample.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SubSample.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57d815eeb25d03200b527ac1a2461ad2d28e4bf4 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SubSample.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable SubSample { + int numBytesOfClearData; + int numBytesOfEncryptedData; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SupportedContentType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SupportedContentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6ef5db860a5d1c9e73bdb9cf33b6499ddd69624e --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SupportedContentType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.drm; +@VintfStability +parcelable SupportedContentType { + String mime; + android.hardware.drm.SecurityLevel minLevel; + android.hardware.drm.SecurityLevel maxLevel; +} diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3c2cfa2037200a0cc52a8ea2f9e26ed465466320 --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Uuid.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.drm; +@VintfStability +parcelable Uuid { + byte[16] uuid; +} diff --git a/drm/aidl/android/hardware/drm/CryptoSchemes.aidl b/drm/aidl/android/hardware/drm/CryptoSchemes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1f251d8a751f5ec24199759c7a07e20b443c553d --- /dev/null +++ b/drm/aidl/android/hardware/drm/CryptoSchemes.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.drm; + +import android.hardware.drm.SupportedContentType; +import android.hardware.drm.Uuid; + +@VintfStability +parcelable CryptoSchemes { + + /** + * Supported crypto schemes + */ + List uuids; + + /** + * Supported mime types, and supported SecurityLevels for each mime + */ + List mimeTypes; + +} diff --git a/drm/aidl/android/hardware/drm/DecryptArgs.aidl b/drm/aidl/android/hardware/drm/DecryptArgs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5ec1b7154ed18651d5b4367d31dfbe6181c2490c --- /dev/null +++ b/drm/aidl/android/hardware/drm/DecryptArgs.aidl @@ -0,0 +1,87 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.drm; + +import android.hardware.drm.DestinationBuffer; +import android.hardware.drm.KeyStatusType; +import android.hardware.drm.Mode; +import android.hardware.drm.Pattern; +import android.hardware.drm.SharedBuffer; +import android.hardware.drm.SubSample; + +/** + * Arguments to ICryptoPlugin decrypt + */ +@VintfStability +parcelable DecryptArgs { + + /** + * A flag to indicate if a secure decoder is being used. + * + * This enables the plugin to configure buffer modes to work consistently + * with a secure decoder. + */ + boolean secure; + + /** + * The keyId for the key that is used to do the decryption. + * + * The keyId refers to a key in the associated MediaDrm instance. + */ + byte[] keyId; + + /** + * The initialization vector + */ + byte[] iv; + + /** + * Crypto mode + */ + Mode mode; + + /** + * Crypto pattern + */ + Pattern pattern; + + /** + * A vector of subsamples indicating the number of clear and encrypted + * bytes to process. + * + * This allows the decrypt call to operate on a range of subsamples in a + * single call + */ + SubSample[] subSamples; + + /** + * Input buffer for the decryption + */ + SharedBuffer source; + + /** + * The offset of the first byte of encrypted data from the base of the + * source buffer + */ + long offset; + + /** + * Output buffer for the decryption + */ + DestinationBuffer destination; + +} diff --git a/drm/aidl/android/hardware/drm/DestinationBuffer.aidl b/drm/aidl/android/hardware/drm/DestinationBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7fc61e1676207a5854a88409d5740decac413293 --- /dev/null +++ b/drm/aidl/android/hardware/drm/DestinationBuffer.aidl @@ -0,0 +1,40 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.common.NativeHandle; +import android.hardware.drm.SharedBuffer; + +/** + * A decrypt destination buffer can be either normal user-space shared + * memory for the non-secure decrypt case, or it can be a secure buffer + * which is referenced by a native-handle. + * + * The native handle is allocated by the vendor's buffer allocator. + */ +@VintfStability +union DestinationBuffer { + /** + * decrypted data written to user-space non-secure shared memory. + */ + SharedBuffer nonsecureMemory; + /** + * decrypted data written to secure memory referenced by the vendor's + * buffer allocator. + */ + NativeHandle secureMemory; +} diff --git a/drm/aidl/android/hardware/drm/DrmMetric.aidl b/drm/aidl/android/hardware/drm/DrmMetric.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6199af6d4d47b58882dfaf13c9b35443c8700cb2 --- /dev/null +++ b/drm/aidl/android/hardware/drm/DrmMetric.aidl @@ -0,0 +1,46 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.DrmMetricNamedValue; + +/** + * The metric being captured. + * + * A metric must have a name and at least one value. A metric may have 0 or + * more attributes. The fields of a Metric are opaque to the framework. + */ +@VintfStability +parcelable DrmMetric { + String name; + + /** + * Detail(s) about the metric being captured. + * + * The fields of an Attribute are opaque to the framework. + */ + List attributes; + + /** + * Value(s) of the metric. + * + * A metric may have multiple values. The component name may be left empty + * if there is only supposed to be one value for the given metric. The + * fields of the Value are opaque to the framework. + */ + List values; +} diff --git a/drm/aidl/android/hardware/drm/DrmMetricGroup.aidl b/drm/aidl/android/hardware/drm/DrmMetricGroup.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3b1f3c9b0e94c396bc1677f08007684c27f13d9c --- /dev/null +++ b/drm/aidl/android/hardware/drm/DrmMetricGroup.aidl @@ -0,0 +1,61 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.DrmMetric; + +/** + * This message contains plugin-specific metrics made available to the client. + * The message is used for making vendor-specific metrics available to an + * application. The framework is not consuming any of the information. + * + * Metrics are grouped in instances of DrmMetricGroup. Each group contains + * multiple instances of Metric. + * + * Example: + * + * Capture the timing information of a buffer copy event, "buf_copy", broken + * out by the "size" of the buffer. + * + * DrmMetricGroup { + * metrics[0] { + * name: "buf_copy" + * attributes[0] { + * name: "size" + * type: INT64_TYPE + * int64Value: 1024 + * } + * values[0] { + * componentName: "operation_count" + * type: INT64_TYPE + * int64Value: 75 + * } + * values[1] { + * component_name: "average_time_seconds" + * type: DOUBLE_TYPE + * doubleValue: 0.00000042 + * } + * } + * } + */ +@VintfStability +parcelable DrmMetricGroup { + /** + * The list of metrics to be captured. + */ + List metrics; +} diff --git a/drm/aidl/android/hardware/drm/DrmMetricNamedValue.aidl b/drm/aidl/android/hardware/drm/DrmMetricNamedValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5bb17a6036abcece120dad4f65853bc7430de6e8 --- /dev/null +++ b/drm/aidl/android/hardware/drm/DrmMetricNamedValue.aidl @@ -0,0 +1,28 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.DrmMetricValue; + +/** + * A name-value pair used in drm metrics. + */ +@VintfStability +parcelable DrmMetricNamedValue { + String name; + DrmMetricValue value; +} diff --git a/drm/aidl/android/hardware/drm/DrmMetricValue.aidl b/drm/aidl/android/hardware/drm/DrmMetricValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0203f3f8014f6b766c58ca0fae2dfc80055c1bfa --- /dev/null +++ b/drm/aidl/android/hardware/drm/DrmMetricValue.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.drm; + +/** + * The value of a metric or a metric's attribute. + */ +@VintfStability +union DrmMetricValue { + long int64Value; + double doubleValue; + String stringValue; +} diff --git a/drm/aidl/android/hardware/drm/EventType.aidl b/drm/aidl/android/hardware/drm/EventType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7a06eb0505478c8376a71345c3001f4c16c96e77 --- /dev/null +++ b/drm/aidl/android/hardware/drm/EventType.aidl @@ -0,0 +1,51 @@ +/* + * 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 android.hardware.drm; + +/** + * EventType enumerates the events that can be delivered by sendEvent + */ +@VintfStability +@Backing(type="int") +enum EventType { + /** + * This event type indicates that the app needs to request a certificate + * from the provisioning server. The request message data is obtained using + * getProvisionRequest(). + */ + PROVISION_REQUIRED, + /** + * This event type indicates that the app needs to request keys from a + * license server. The request message data is obtained using getKeyRequest. + */ + KEY_NEEDED, + /** + * This event type indicates that the licensed usage duration for keys in a + * session has expired. The keys are no longer valid. + */ + KEY_EXPIRED, + /** + * This event may indicate some specific vendor-defined condition, see your + * DRM provider documentation for details. + */ + VENDOR_DEFINED, + /** + * This event indicates that a session opened by the app has been reclaimed + * by the resource manager. + */ + SESSION_RECLAIMED, +} diff --git a/drm/aidl/android/hardware/drm/HdcpLevel.aidl b/drm/aidl/android/hardware/drm/HdcpLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3497b784313f45c41100153a147fc31fe671162b --- /dev/null +++ b/drm/aidl/android/hardware/drm/HdcpLevel.aidl @@ -0,0 +1,59 @@ +/* + * 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 android.hardware.drm; + +/** + * HDCP specifications are defined by Digital Content Protection LLC (DCP). + * "HDCP Specification Rev. 2.3 Interface Independent Adaptation" + * "HDCP 2.3 on HDMI Specification" + */ +@VintfStability +@Backing(type="int") +enum HdcpLevel { + /** + * Unable to determine the HDCP level + */ + HDCP_UNKNOWN, + /** + * No HDCP, output is unprotected + */ + HDCP_NONE, + /** + * HDCP version 1.0 + */ + HDCP_V1, + /** + * HDCP version 2.0 Type 1. + */ + HDCP_V2, + /** + * HDCP version 2.1 Type 1. + */ + HDCP_V2_1, + /** + * HDCP version 2.2 Type 1. + */ + HDCP_V2_2, + /** + * No digital output, implicitly secure + */ + HDCP_NO_OUTPUT, + /** + * HDCP version 2.3 Type 1. + */ + HDCP_V2_3, +} diff --git a/drm/aidl/android/hardware/drm/HdcpLevels.aidl b/drm/aidl/android/hardware/drm/HdcpLevels.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd4642ba42cf0d06351f10af906b40fe5574b97e --- /dev/null +++ b/drm/aidl/android/hardware/drm/HdcpLevels.aidl @@ -0,0 +1,28 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.HdcpLevel; + +@VintfStability +parcelable HdcpLevels { + /** The lowest HDCP level for any connected displays. */ + HdcpLevel connectedLevel; + + /** The highest HDCP level that can be supported by the device. */ + HdcpLevel maxLevel; +} diff --git a/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl b/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d344b62a7a8f3c7b712fa213d939ab7b18706db4 --- /dev/null +++ b/drm/aidl/android/hardware/drm/ICryptoPlugin.aidl @@ -0,0 +1,118 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.common.Ashmem; +import android.hardware.drm.DecryptArgs; +import android.hardware.drm.DestinationBuffer; +import android.hardware.drm.LogMessage; +import android.hardware.drm.Mode; +import android.hardware.drm.Pattern; +import android.hardware.drm.SharedBuffer; +import android.hardware.drm.Status; +import android.hardware.drm.SubSample; + +/** + * ICryptoPlugin is the HAL for vendor-provided crypto plugins. + * + * It allows crypto sessions to be opened and operated on, to + * load crypto keys for a codec to decrypt protected video content. + */ +@VintfStability +interface ICryptoPlugin { + /** + * Decrypt an array of subsamples from the source memory buffer to the + * destination memory buffer. + * + * @return number of decrypted bytes + * Implicit error codes: + * + ERROR_DRM_CANNOT_HANDLE in other failure cases + * + ERROR_DRM_DECRYPT if the decrypt operation fails + * + ERROR_DRM_FRAME_TOO_LARGE if the frame being decrypted into + * the secure output buffer exceeds the size of the buffer + * + ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION if required output + * protections are not active + * + ERROR_DRM_INSUFFICIENT_SECURITY if the security level of the + * device is not sufficient to meet the requirements in + * the license policy + * + ERROR_DRM_INVALID_STATE if the device is in a state where it + * is not able to perform decryption + * + ERROR_DRM_LICENSE_EXPIRED if the license keys have expired + * + ERROR_DRM_NO_LICENSE if no license keys have been loaded + * + ERROR_DRM_RESOURCE_BUSY if the resources required to perform + * the decryption are not available + * + ERROR_DRM_SESSION_NOT_OPENED if the decrypt session is not + * opened + */ + int decrypt(in DecryptArgs args); + + /** + * Get OEMCrypto or plugin error messages. + * + * @return LogMessages + * Implicit error codes: + * + GENERAL_OEM_ERROR on OEM-provided, low-level component failures; + * + GENERAL_PLUGIN_ERROR on unexpected plugin-level errors. + */ + List getLogMessages(); + + /** + * Notify a plugin of the currently configured resolution. + * + * @param width - the display resolutions's width + * @param height - the display resolution's height + */ + void notifyResolution(in int width, in int height); + + /** + * Check if the specified mime-type requires a secure decoder + * component. + * + * @param mime The content mime-type + * @return must be true only if a secure decoder is required + * for the specified mime-type + */ + boolean requiresSecureDecoderComponent(in String mime); + + /** + * Associate a mediadrm session with this crypto session. + * + * @param sessionId the MediaDrm session ID to associate with + * this crypto session + * @return (implicit) the status of the call, status can be: + * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened, or + * ERROR_DRM_CANNOT_HANDLE if the operation is not supported by + * the drm scheme + */ + void setMediaDrmSession(in byte[] sessionId); + + /** + * Set a shared memory base for subsequent decrypt operations. + * The buffer base is mmaped from a ParcelFileDesciptor in Ashmem + * which maps shared memory in the HAL module. + * After the shared buffer base is established, the decrypt() method + * receives SharedBuffer instances which specify the buffer address range + * for decrypt source and destination addresses. + * + * There can be multiple shared buffers per crypto plugin. The buffers + * are distinguished by the bufferId. + * + * @param base the base of the memory buffer abstracted by + * SharedBuffer parcelable (bufferId, size, handle) + */ + void setSharedBufferBase(in SharedBuffer base); +} diff --git a/drm/aidl/android/hardware/drm/IDrmFactory.aidl b/drm/aidl/android/hardware/drm/IDrmFactory.aidl new file mode 100644 index 0000000000000000000000000000000000000000..86c3f21a10df70ed6e193fbd35793bc2c182fecc --- /dev/null +++ b/drm/aidl/android/hardware/drm/IDrmFactory.aidl @@ -0,0 +1,70 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.CryptoSchemes; +import android.hardware.drm.SecurityLevel; +import android.hardware.drm.Uuid; + +/** + * IDrmFactory is the main entry point for interacting with a vendor's + * drm HAL to create drm plugin instances. A drm plugin instance + * creates drm sessions which are used to obtain keys for a crypto + * session so it can decrypt protected video content. + */ +@VintfStability +interface IDrmFactory { + /** + * Create a drm plugin instance for the specified uuid and + * scheme-specific initialization data. + * + * @param uuid uniquely identifies the drm scheme. See + * http://dashif.org/identifiers/protection for uuid assignments + * @param appPackageName identifies the package name of the calling + * application. + * + * @return A DRM plugin instance if successful, or null if not created. + * Implicit error codes: + * + ERROR_DRM_CANNOT_HANDLE if the plugin cannot be created. + */ + @nullable android.hardware.drm.IDrmPlugin createDrmPlugin( + in Uuid uuid, in String appPackageName); + + /** + * Create a crypto plugin for the specified uuid and scheme-specific + * initialization data. + * + * @param uuid uniquely identifies the drm scheme. See + * http://dashif.org/identifiers/protection for uuid assignments + * + * @param initData scheme-specific init data. + * + * @return A crypto plugin instance if successful, or null if not created. + */ + @nullable android.hardware.drm.ICryptoPlugin createCryptoPlugin( + in Uuid uuid, in byte[] initData); + + /** + * Return vector of uuids identifying crypto schemes supported by + * this HAL. + * + * @return List of uuids for which isCryptoSchemeSupported is true; + * each uuid can be used as input to createPlugin. + */ + CryptoSchemes getSupportedCryptoSchemes(); + +} diff --git a/drm/aidl/android/hardware/drm/IDrmPlugin.aidl b/drm/aidl/android/hardware/drm/IDrmPlugin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..11ca8b64913e382fd03825f8575db32101257258 --- /dev/null +++ b/drm/aidl/android/hardware/drm/IDrmPlugin.aidl @@ -0,0 +1,744 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.DrmMetricGroup; +import android.hardware.drm.HdcpLevels; +import android.hardware.drm.IDrmPluginListener; +import android.hardware.drm.KeySetId; +import android.hardware.drm.KeyRequest; +import android.hardware.drm.KeyStatus; +import android.hardware.drm.KeyType; +import android.hardware.drm.KeyValue; +import android.hardware.drm.LogMessage; +import android.hardware.drm.NumberOfSessions; +import android.hardware.drm.OfflineLicenseState; +import android.hardware.drm.OpaqueData; +import android.hardware.drm.ProvideProvisionResponseResult; +import android.hardware.drm.ProvisionRequest; +import android.hardware.drm.SecureStop; +import android.hardware.drm.SecureStopId; +import android.hardware.drm.SecurityLevel; + +/** + * IDrmPlugin is used to interact with a specific drm plugin that was + * created by IDrmFactory::createPlugin. + * + * A drm plugin provides methods for obtaining drm keys to be used by a codec + * to decrypt protected video content. + */ +@VintfStability +interface IDrmPlugin { + /** + * Close a session on the DrmPlugin object + * + * @param sessionId the session id the call applies to + * + * @return (implicit) the status of the call: + * BAD_VALUE if the sessionId is invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the session cannot be closed. + * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + void closeSession(in byte[] sessionId); + + /** + * Decrypt the provided input buffer with the cipher algorithm + * specified by setCipherAlgorithm and the key selected by keyId, + * and return the decrypted data. + * + * @param sessionId the session id the call applies to + * @param keyId the ID of the key to use for decryption + * @param input the input data to decrypt + * @param iv the initialization vector to use for decryption + * + * @return decrypted output buffer + * Implicit error codes: + * + BAD_VALUE if the sessionId is invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the decrypt operation cannot be performed. + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + byte[] decrypt(in byte[] sessionId, in byte[] keyId, in byte[] input, in byte[] iv); + + /** + * Encrypt the provided input buffer with the cipher algorithm specified by + * setCipherAlgorithm and the key selected by keyId, and return the + * encrypted data. + * + * @param sessionId the session id the call applies to + * @param keyId the ID of the key to use for encryption + * @param input the input data to encrypt + * @param iv the initialization vector to use for encryption + * + * @return encrypted output buffer + * Implicit error codes: + * + BAD_VALUE if the sessionId is invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the encrypt operation cannot be performed. + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + byte[] encrypt(in byte[] sessionId, in byte[] keyId, in byte[] input, in byte[] iv); + + /** + * Return the currently negotiated and max supported HDCP levels. + * + * The current level is based on the display(s) the device is connected to. + * If multiple HDCP-capable displays are simultaneously connected to + * separate interfaces, this method returns the lowest negotiated HDCP level + * of all interfaces. + * + * The maximum HDCP level is the highest level that can potentially be + * negotiated. It is a constant for any device, i.e. it does not depend on + * downstream receiving devices that could be connected. For example, if + * the device has HDCP 1.x keys and is capable of negotiating HDCP 1.x, but + * does not have HDCP 2.x keys, then the maximum HDCP capability would be + * reported as 1.x. If multiple HDCP-capable interfaces are present, it + * indicates the highest of the maximum HDCP levels of all interfaces. + * + * This method should only be used for informational purposes, not for + * enforcing compliance with HDCP requirements. Trusted enforcement of HDCP + * policies must be handled by the DRM system. + * + * @return HdcpLevels parcelable + * Implicit error codes: + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the HDCP level cannot be queried + */ + HdcpLevels getHdcpLevels(); + + /** + * A key request/response exchange occurs between the app and a License + * Server to obtain the keys required to decrypt the content. + * getKeyRequest() is used to obtain an opaque key request blob that is + * delivered to the license server. + * + * @param scope either a sessionId or a keySetId, depending on the + * specified keyType. When the keyType is OFFLINE or STREAMING, scope + * must be set to the sessionId the keys will be provided to. When the + * keyType is RELEASE, scope must be set to the keySetId of the keys + * being released. + * @param initData container-specific data, its meaning is interpreted + * based on the mime type provided in the mimeType parameter. It could + * contain, for example, the content ID, key ID or other data obtained + * from the content metadata that is required to generate the key + * request. initData must be empty when keyType is RELEASE. + * @param mimeType identifies the mime type of the content + * @param keyType specifies if the keys are to be used for streaming, + * offline or a release + * @param optionalParameters included in the key request message to + * allow a client application to provide additional message parameters + * to the server. + * + * @return KeyRequest parcelable + * Implicit error codes: + * + BAD_VALUE if any parameters are invalid + * + ERROR_DRM_CANNOT_HANDLE if getKeyRequest is not supported at + * the time of the call + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * a key request cannot be generated + * + ERROR_DRM_NOT_PROVISIONED if the device requires provisioning + * before it is able to generate a key request + * + ERROR_DRM_RESOURCE_CONTENTION if client applications using the + * hal are temporarily exceeding the available crypto resources + * such that a retry of the operation is likely to succeed + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + KeyRequest getKeyRequest(in byte[] scope, in byte[] initData, in String mimeType, + in KeyType keyType, in KeyValue[] optionalParameters); + + /** + * Get Plugin error messages. + * + * @return LogMessages + * Implicit error codes: + * + GENERAL_OEM_ERROR on OEM-provided, low-level component failures; + * + GENERAL_PLUGIN_ERROR on unexpected plugin-level errors. + */ + List getLogMessages(); + + /** + * Returns the plugin-specific metrics. Multiple metric groups may be + * returned in one call to getMetrics(). The scope and definition of the + * metrics is defined by the plugin. + * + * @return collection of metric groups provided by the plugin + * Implicit error codes: + * + ERROR_DRM_INVALID_STATE if the metrics are not available to be + * returned. + */ + List getMetrics(); + + /** + * Return the current number of open sessions and the maximum number of + * sessions that may be opened simultaneously among all DRM instances + * for the active DRM scheme. + * + * @return NumberOfSessions parcelable + * Implicit error codes: + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * number of sessions cannot be queried + */ + NumberOfSessions getNumberOfSessions(); + + /** + * The keys in an offline license allow protected content to be + * played even if the device is not connected to a network. + * Offline licenses are stored on the device after a key + * request/response exchange when the key request KeyType is + * OFFLINE. Normally each app is responsible for keeping track of + * the KeySetIds it has created. In some situations however, it + * will be necessary to request the list of stored offline license + * KeySetIds. If an app loses the KeySetId for any stored licenses + * that it created, for example, it must be able to recover the + * stored KeySetIds so those licenses will be removed when they + * expire or when the app is uninstalled. + * + * This method returns a list of the KeySetIds for all offline + * licenses. The offline license KeySetId allows an app to query + * the status of an offline license or remove it. + * + * @return list of keySetIds + * Implicit error codes: + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * KeySetIds can't be returned + */ + List getOfflineLicenseKeySetIds(); + + /** + * Request the state of an offline license. An offline license must + * be usable or inactive. The keys in a usable offline license are + * available for decryption. When the offline license state is + * inactive, the keys have been marked for release using + * getKeyRequest with KeyType RELEASE but the key response has not + * been received. The keys in an inactive offline license are not + * usable for decryption. + * + * @param keySetId the id of the offline license + * + * @return The offline license state, UNKNOWN, USABLE or INACTIVE. + * Implicit error codes: + * + BAD_VALUE if the license is not found + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * offline license state can't be queried + */ + OfflineLicenseState getOfflineLicenseState(in KeySetId keySetId); + + /** + * Read a byte array property value given the property name. + * See getPropertyString. + * + * @param propertyName the name of the property + * + * @return property value bye array + * Implicit error codes: + * + BAD_VALUE if the property name is invalid + * + ERROR_DRM_CANNOT_HANDLE if the property is not supported + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * property cannot be obtained + */ + byte[] getPropertyByteArray(in String propertyName); + + /** + * A drm scheme can have properties that are settable and readable + * by an app. There are a few forms of property access methods, + * depending on the data type of the property. + * + * Property values defined by the public API are: + * "vendor" [string] identifies the maker of the drm scheme + * "version" [string] identifies the version of the drm scheme + * "description" [string] describes the drm scheme + * 'deviceUniqueId' [byte array] The device unique identifier is + * established during device provisioning and provides a means of + * uniquely identifying each device. + * + * Since drm scheme properties may vary, additional field names may be + * defined by each DRM vendor. Refer to your DRM provider documentation + * for definitions of its additional field names. + * + * Read a string property value given the property name. + * + * @param propertyName the name of the property + * + * @return the property value string. + * Implicit error codes: + * + BAD_VALUE if the property name is invalid + * + ERROR_DRM_CANNOT_HANDLE if the property is not supported + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * property cannot be obtained + */ + String getPropertyString(in String propertyName); + + /** + * A provision request/response exchange occurs between the app + * and a provisioning server to retrieve a device certificate. + * getProvisionRequest is used to obtain an opaque provisioning + * request blob that is delivered to the provisioning server. + * + * @param certificateType the type of certificate requested, e.g. "X.509" + * @param certificateAuthority identifies the certificate authority. + * A certificate authority (CA) is an entity which issues digital + * certificates for use by other parties. It is an example of a + * trusted third party. + * + * @return ProvisionRequest parcelable + * Implicit error codes: + * + ERROR_DRM_CANNOT_HANDLE if the drm scheme does not require + * provisioning + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the provision request cannot be generated + * + ERROR_DRM_RESOURCE_CONTENTION if client applications using + * the hal are temporarily exceeding the available crypto + * resources such that a retry of the operation is likely + * to succeed + */ + ProvisionRequest getProvisionRequest( + in String certificateType, in String certificateAuthority); + + /** + * Get all secure stops by secure stop ID + * + * @param secureStopId the ID of the secure stop to return. + * The secure stop ID is delivered by the key server + * as part of the key response and must also be known by the app. + * + * @return secure stop opaque object. + * Implicit error codes: + * + BAD_VALUE if the secureStopId is invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the secure stop cannot be returned + */ + SecureStop getSecureStop(in SecureStopId secureStopId); + + /** + * Get the IDs of all secure stops on the device + * + * @return list of secure stops IDs. + * Implicit error codes: + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the secure stop IDs list cannot be returned + */ + List getSecureStopIds(); + + /** + * SecureStop is a way of enforcing the concurrent stream limit per + * subscriber. + * + * It can securely monitor the lifetime of sessions across device reboots + * by periodically persisting the session lifetime status in secure + * storage. + * + * A signed version of the sessionID is written to persistent storage on the + * device when each MediaCrypto object is created and periodically during + * playback. The sessionID is signed by the device private key to prevent + * tampering. + * + * When playback is completed the session is destroyed, and the secure + * stops are queried by the app. The app then delivers the secure stop + * message to a server which verifies the signature to confirm that the + * session and its keys have been removed from the device. The persisted + * record on the device is removed after receiving and verifying the + * signed response from the server. + * + * Get all secure stops on the device + * + * @return list of the opaque secure stop objects. + * Implicit error codes: + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the secure stops cannot be returned + */ + List getSecureStops(); + + /** + * Return the current security level of a session. A session has an initial + * security level determined by the robustness of the DRM system's + * implementation on the device. + * + * @param sessionId the session id the call applies to + * + * @return the current security level for the session. + * Implicit error codes: + * + BAD_VALUE if the sessionId is invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the security level cannot be queried + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + SecurityLevel getSecurityLevel(in byte[] sessionId); + + /** + * Open a new session at a requested security level. The security level + * represents the robustness of the device's DRM implementation. By default, + * sessions are opened at the native security level of the device which is + * the maximum level that can be supported. Overriding the security level is + * necessary when the decrypted frames need to be manipulated, such as for + * image compositing. The security level parameter must be equal to or lower + * than the native level. If the requested level is not supported, the next + * lower supported security level must be set. The level can be queried + * using {@link #getSecurityLevel}. A session ID is returned. + * + * @param level the requested security level + * + * @return sessionId + */ + byte[] openSession(in SecurityLevel securityLevel); + + /** + * After a key response is received by the app, it is provided to the + * Drm plugin using provideKeyResponse. + * + * @param scope may be a sessionId or a keySetId depending on the + * type of the response. Scope should be set to the sessionId + * when the response is for either streaming or offline key requests. + * Scope should be set to the keySetId when the response is for + * a release request. + * @param response the response from the key server that is being + * provided to the drm HAL. + * + * @return a keySetId that can be used to later restore the keys to a new + * session with the method restoreKeys when the response is for an + * offline key request. + * Implicit error codes: + * + BAD_VALUE if any parameters are invalid + * + ERROR_DRM_CANNOT_HANDLE if provideKeyResponse is not supported + * at the time of the call + * + ERROR_DRM_DEVICE_REVOKED if the device has been disabled by + * the license policy + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where + * a key response cannot be handled. + * + ERROR_DRM_NOT_PROVISIONED if the device requires provisioning + * before it can handle the key response + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + KeySetId provideKeyResponse(in byte[] scope, in byte[] response); + + /** + * After a provision response is received by the app from a provisioning + * server, it is provided to the Drm HAL using provideProvisionResponse. + * The HAL implementation must receive the provision request and + * store the provisioned credentials. + * + * @param response the opaque provisioning response received by the + * app from a provisioning server. + * + * @return ProvideProvisionResponseResult parcelable, which contains + * the public certificate and encrypted private key that can be + * used by signRSA to compute an RSA signature on a message. + * Implicit error codes: + * + BAD_VALUE if any parameters are invalid + * + ERROR_DRM_DEVICE_REVOKED if the device has been disabled by + * the license policy + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * provision response cannot be handled + */ + ProvideProvisionResponseResult provideProvisionResponse(in byte[] response); + + /** + * Request an informative description of the license for the session. + * The status is in the form of {name, value} pairs. Since DRM license + * policies vary by vendor, the specific status field names are + * determined by each DRM vendor. Refer to your DRM provider + * documentation for definitions of the field names for a particular + * drm scheme. + * + * @param sessionId the session id the call applies to + * + * @return a list of name value pairs describing the license. + * Implicit error codes: + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + * + BAD_VALUE if any parameters are invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * key status cannot be queried. + */ + List queryKeyStatus(in byte[] sessionId); + + /** + * Release all secure stops on the device + * + * @return (implicit) the status of the call: + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the secure stops cannot be released. + */ + void releaseAllSecureStops(); + + /** + * Release a secure stop by secure stop ID + * + * @param secureStopId the ID of the secure stop to release. + * The secure stop ID is delivered by the key server as + * part of the key response and must also be known by the app. + * + * @return (implicit) the status of the call: + * BAD_VALUE if the secureStopId is invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the secure stop cannot be released. + */ + void releaseSecureStop(in SecureStopId secureStopId); + + /** + * Release secure stops given a release message from the key server + * + * @param ssRelease the secure stop release message identifying + * one or more secure stops to release. ssRelease is opaque, + * it is passed directly from a DRM license server through + * the app and media framework to the vendor HAL module. + * The format and content of ssRelease must be defined by the + * DRM scheme being implemented according to this HAL. + * The DRM scheme can be identified by its UUID which + * can be queried using IDrmFactory::isCryptoSchemeSupported. + * + * @return (implicit) the status of the call: + * BAD_VALUE if ssRelease is invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state wherei + * the secure stop cannot be released. + */ + void releaseSecureStops(in OpaqueData ssRelease); + + /** + * Remove all secure stops on the device without requiring a secure + * stop release response message from the key server. + * + * @return (implicit) the status of the call: + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the secure stops cannot be removed. + */ + void removeAllSecureStops(); + + /** + * Remove the current keys from a session + * + * @param sessionId the session id the call applies to + * + * @return (implicit) the status of the call: + * BAD_VALUE if the sessionId is invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the keys cannot be removed. + * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + void removeKeys(in byte[] sessionId); + + /** + * Normally offline licenses are released using a key + * request/response exchange using getKeyRequest where the KeyType + * is RELEASE, followed by provideKeyResponse. This allows the + * server to cryptographically confirm that the license has been + * removed and then adjust the count of offline licenses allocated + * to the device. + *

+ * In some exceptional situations it will be necessary to directly + * remove offline licenses without notifying the server, which is + * performed by this method. + * + * @param keySetId the id of the offline license to remove + * + * @return (implicit) the status of the call: + * BAD_VALUE if the license is not found + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the KeySetIds can't be removed. + */ + void removeOfflineLicense(in KeySetId keySetId); + + /** + * Remove a secure stop given its secure stop ID, without requiring + * a secure stop release response message from the key server. + * + * @param secureStopId the ID of the secure stop to release. + * + * @return the status of the call: + * BAD_VALUE if the secureStopId is invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the secure stop cannot be removed. + */ + void removeSecureStop(in SecureStopId secureStopId); + + /** + * Check if the specified mime-type & security level require a secure decoder + * component. + * + * @param mime The content mime-type + * @param level the requested security level + * + * @return must be true if and only if a secure decoder is + * required for the specified mime-type & security level + */ + boolean requiresSecureDecoder(in String mime, in SecurityLevel level); + + /** + * Restore persisted offline keys into a new session + * + * @param sessionId the session id the call applies to + * @param keySetId identifies the keys to load, obtained from + * a prior call to provideKeyResponse(). + * + * @return (implicit) the status of the call: + * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + * BAD_VALUE if any parameters are invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * keys cannot be restored. + */ + void restoreKeys(in byte[] sessionId, in KeySetId keySetId); + + /** + * The following methods implement operations on a CryptoSession to support + * encrypt, decrypt, sign verify operations on operator-provided + * session keys. + * + * + * Set the cipher algorithm to be used for the specified session. + * + * @param sessionId the session id the call applies to + * @param algorithm the algorithm to use. The string conforms to JCA + * Standard Names for Cipher Transforms and is case insensitive. An + * example algorithm is "AES/CBC/PKCS5Padding". + * + * @return (implicit) the status of the call: + * BAD_VALUE if any parameters are invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the algorithm cannot be set. + * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened` + */ + void setCipherAlgorithm(in byte[] sessionId, in String algorithm); + + /** + * Plugins call the following methods to deliver events to the + * java app. + * + * + * Set a listener for a drm session. This allows the drm HAL to + * make asynchronous calls back to the client of IDrm. + * + * @param listener instance of IDrmPluginListener to receive the events + */ + void setListener(in IDrmPluginListener listener); + + /** + * Set the MAC algorithm to be used for computing hashes in a session. + * + * @param sessionId the session id the call applies to + * @param algorithm the algorithm to use. The string conforms to JCA + * Standard Names for Mac Algorithms and is case insensitive. An example MAC + * algorithm string is "HmacSHA256". + * + * @return (implicit) the status of the call: + * BAD_VALUE if any parameters are invalid + * ERROR_DRM_INVALID_STATE if the HAL is in a state where + * the algorithm cannot be set. + * ERROR_DRM_SESSION_NOT_OPENED if the session is not opened` + */ + void setMacAlgorithm(in byte[] sessionId, in String algorithm); + + /** + * Set playback id of a drm session. The playback id can be used to join drm session metrics + * with metrics from other low level media components, e.g. codecs, or metrics from the high + * level player. + * + * @param sessionId drm session id + * @param playbackId high level playback id + * + * @return (implicit) the status of the call: + * ERROR_DRM_SESSION_NOT_OPENED if the drm session cannot be found + */ + void setPlaybackId(in byte[] sessionId, in String playbackId); + + /** + * Write a property byte array value given the property name + * + * @param propertyName the name of the property + * @param value the value to write + * + * @return (implicit) the status of the call: + * BAD_VALUE if the property name is invalid + * ERROR_DRM_CANNOT_HANDLE if the property is not supported + * ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * property cannot be set + */ + void setPropertyByteArray(in String propertyName, in byte[] value); + + /** + * Write a property string value given the property name + * + * @param propertyName the name of the property + * @param value the value to write + * + * @return (implicit) status of the call: + * BAD_VALUE if the property name is invalid + * ERROR_DRM_CANNOT_HANDLE if the property is not supported + * ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * property cannot be set + */ + void setPropertyString(in String propertyName, in String value); + + /** + * Compute a signature over the provided message using the mac algorithm + * specified by setMacAlgorithm and the key selected by keyId and return + * the signature. + * + * @param sessionId the session id the call applies to + * @param keyId the ID of the key to use for decryption + * @param message the message to compute a signature over + * + * @return signature computed over the message + * Implicit error codes: + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + * + BAD_VALUE if any parameters are invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * sign operation cannot be performed. + */ + byte[] sign(in byte[] sessionId, in byte[] keyId, in byte[] message); + + /** + * Compute an RSA signature on the provided message using the specified + * algorithm. + * + * @param sessionId the session id the call applies to + * @param algorithm the signing algorithm, such as "RSASSA-PSS-SHA1" + * or "PKCS1-BlockType1" + * @param message the message to compute the signature on + * @param wrappedKey the private key returned during provisioning as + * returned by provideProvisionResponse. + * + * @return signature computed over the message + * Implicit error codes: + * + BAD_VALUE if any parameters are invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * signRSA operation operation cannot be performed + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + */ + byte[] signRSA( + in byte[] sessionId, in String algorithm, in byte[] message, + in byte[] wrappedkey); + + /** + * Compute a hash of the provided message using the mac algorithm specified + * by setMacAlgorithm and the key selected by keyId, and compare with the + * expected result. + * + * @param sessionId the session id the call applies to + * @param keyId the ID of the key to use for decryption + * @param message the message to compute a hash of + * @param signature the signature to verify + * + * @return true if the signature is verified positively, false otherwise. + * Implicit error codes: + * + ERROR_DRM_SESSION_NOT_OPENED if the session is not opened + * + BAD_VALUE if any parameters are invalid + * + ERROR_DRM_INVALID_STATE if the HAL is in a state where the + * verify operation cannot be performed. + */ + boolean verify( + in byte[] sessionId, in byte[] keyId, in byte[] message, + in byte[] signature); +} diff --git a/drm/aidl/android/hardware/drm/IDrmPluginListener.aidl b/drm/aidl/android/hardware/drm/IDrmPluginListener.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d52da667426d3c8f888c15126543db42e6b97213 --- /dev/null +++ b/drm/aidl/android/hardware/drm/IDrmPluginListener.aidl @@ -0,0 +1,76 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.EventType; +import android.hardware.drm.KeyStatus; + +/** + * IDrmPluginListener is a listener interface for Drm events sent from an + * IDrmPlugin instance. + */ +@VintfStability +interface IDrmPluginListener { + /** + * Legacy event sending method, it sends events of various types using a + * single overloaded set of parameters. This form is deprecated. + * + * @param eventType the type of the event + * @param sessionId identifies the session the event originated from + * @param data event-specific data blob + */ + oneway void onEvent(in EventType eventType, in byte[] sessionId, in byte[] data); + + /** + * Send a license expiration update to the listener. The expiration + * update indicates how long the current keys are valid before they + * need to be renewed. + * + * @param sessionId identifies the session the event originated from + * @param expiryTimeInMS the time when the keys need to be renewed. + * The time is in milliseconds, relative to the Unix epoch. A time + * of 0 indicates that the keys never expire. + */ + oneway void onExpirationUpdate(in byte[] sessionId, in long expiryTimeInMS); + + /** + * Send a keys change event to the listener. The keys change event + * indicates the status of each key in the session. Keys can be + * indicated as being usable, expired, outputnotallowed or statuspending. + * + * @param sessionId identifies the session the event originated from + * @param keyStatusList indicates the status for each key ID in the + * session. + * @param hasNewUsableKey indicates if the event includes at least one + * key that has become usable. + */ + oneway void onKeysChange( + in byte[] sessionId, in KeyStatus[] keyStatusList, in boolean hasNewUsableKey); + + /** + * Some device crypto hardware is incapable of retaining crypto + * session state across suspend and resume cycles. A + * SessionLostState event must be signaled when a session has + * become invalid for this reason. This event must not be used to + * indicate a failure in the crypto system. Closing the session + * and opening a new one must allow the application to resume + * normal use of the drm hal module. + * + * @param sessionId identifies the session that has been invalidated + */ + oneway void onSessionLostState(in byte[] sessionId); +} diff --git a/drm/aidl/android/hardware/drm/KeyRequest.aidl b/drm/aidl/android/hardware/drm/KeyRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c732055f2314534339c4d6339423121c76db409 --- /dev/null +++ b/drm/aidl/android/hardware/drm/KeyRequest.aidl @@ -0,0 +1,46 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.KeyRequestType; + +@VintfStability +parcelable KeyRequest { + /** The opaque key request blob. */ + byte[] request; + + /** + * Enumerated type: + * INITIAL - the first key request for a license + * NONE - indicates that no request is needed because the keys + * are already loaded + * RENEWAL - is a subsequent key request used to refresh the + * keys in a license + * RELEASE - indicates keys are being released + * UPDATE - indicates that the keys need to be refetched after + * the initial license request + */ + KeyRequestType requestType; + + /** + * The URL that the request may be sent to, + * if provided by the drm HAL. The app can choose to + * override this URL. If the HAL implementation does not provide + * a defaultUrl, the returned string must be empty. + */ + String defaultUrl; +} diff --git a/drm/aidl/android/hardware/drm/KeyRequestType.aidl b/drm/aidl/android/hardware/drm/KeyRequestType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3a603ff6c8a84692f8e936e7ffc0789b8ce5faec --- /dev/null +++ b/drm/aidl/android/hardware/drm/KeyRequestType.aidl @@ -0,0 +1,52 @@ +/* + * 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 android.hardware.drm; + +/** + * An app determines the type of a key request returned from getKeyRequest. + */ +@VintfStability +@Backing(type="int") +enum KeyRequestType { + /** + * Key request type is for an initial license request + */ + INITIAL, + /** + * Key request type is for license renewal. Renewal requests are used + * to extend the validity period for streaming keys. + */ + RENEWAL, + /** + * Key request type is a release. A key release causes offline keys + * to become available for streaming. + */ + RELEASE, + /** + * Key request type is unknown due to some error condition. + */ + UNKNOWN, + /** + * Keys are already loaded. No key request is needed. + */ + NONE, + /** + * Keys have previously been loaded. An additional (non-renewal) license + * request is needed. + */ + UPDATE, +} diff --git a/drm/aidl/android/hardware/drm/KeySetId.aidl b/drm/aidl/android/hardware/drm/KeySetId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..be0ce0efa863495e47be88748498d2f4cc1b1c5b --- /dev/null +++ b/drm/aidl/android/hardware/drm/KeySetId.aidl @@ -0,0 +1,22 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable KeySetId { + byte[] keySetId; +} diff --git a/drm/aidl/android/hardware/drm/KeyStatus.aidl b/drm/aidl/android/hardware/drm/KeyStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..16e042a147cef0de1643230240a855c5e6661d8d --- /dev/null +++ b/drm/aidl/android/hardware/drm/KeyStatus.aidl @@ -0,0 +1,29 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.KeyStatusType; + +/** + * Used by sendKeysChange to report the usability status of each key + * to the app. + */ +@VintfStability +parcelable KeyStatus { + byte[] keyId; + KeyStatusType type; +} diff --git a/drm/aidl/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/android/hardware/drm/KeyStatusType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6c3c6a2363f5ae9eeff11b1ccc9e7aac461cbce9 --- /dev/null +++ b/drm/aidl/android/hardware/drm/KeyStatusType.aidl @@ -0,0 +1,51 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +@Backing(type="int") +enum KeyStatusType { + /** + * The key is currently usable to decrypt media data. + */ + USABLE, + /** + * The key is no longer usable to decrypt media data because its expiration + * time has passed. + */ + EXPIRED, + /** + * The key is not currently usable to decrypt media data because its output + * requirements cannot currently be met. + */ + OUTPUT_NOT_ALLOWED, + /** + * The status of the key is not yet known and is being determined. + */ + STATUS_PENDING, + /** + * The key is not currently usable to decrypt media data because of an + * internal error in processing unrelated to input parameters. + */ + INTERNAL_ERROR, + /** + * The key is not yet usable to decrypt media because the start + * time is in the future. The key must become usable when + * its start time is reached. + */ + USABLE_IN_FUTURE, +} diff --git a/drm/aidl/android/hardware/drm/KeyType.aidl b/drm/aidl/android/hardware/drm/KeyType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..78b4d8369c9caeb1dc10d3c3f493d260644408df --- /dev/null +++ b/drm/aidl/android/hardware/drm/KeyType.aidl @@ -0,0 +1,38 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +@Backing(type="int") +enum KeyType { + /** + * Drm keys can be for offline content or for online streaming. + * Offline keys are persisted on the device and may be used when the device + * is disconnected from the network. + */ + OFFLINE, + /** + * Keys for streaming are not persisted and require the device to be + * connected to the network for periodic renewal. + */ + STREAMING, + /** + * The Release type is used to request that offline keys be no longer + * restricted to offline use. + */ + RELEASE, +} diff --git a/drm/aidl/android/hardware/drm/KeyValue.aidl b/drm/aidl/android/hardware/drm/KeyValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e26781b58b47f457bb2fab8b94de0d644dca7da4 --- /dev/null +++ b/drm/aidl/android/hardware/drm/KeyValue.aidl @@ -0,0 +1,23 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable KeyValue { + String key; + String value; +} diff --git a/drm/aidl/android/hardware/drm/LogMessage.aidl b/drm/aidl/android/hardware/drm/LogMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8ac1ced5858d797524763cd638302d26da29367e --- /dev/null +++ b/drm/aidl/android/hardware/drm/LogMessage.aidl @@ -0,0 +1,38 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.drm.LogPriority; + +/** + * Returned by getLogMessages to report error diagnostics to the + * app. + * + * The |message| field is for informational purposes only, and + * NOT meant to be parsed programmatically when handling errors. + * For programmatic error handling, please check the return |Status| + * of APIs instead. + */ +@VintfStability +parcelable LogMessage { + /** + * Epoch time in milliseconds. + */ + long timeMs; + LogPriority priority; + String message; +} diff --git a/drm/aidl/android/hardware/drm/LogPriority.aidl b/drm/aidl/android/hardware/drm/LogPriority.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4db3b409825fdc29a9dc21c599f9e30aff5ee540 --- /dev/null +++ b/drm/aidl/android/hardware/drm/LogPriority.aidl @@ -0,0 +1,30 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +@Backing(type="int") +enum LogPriority { + UNKNOWN, + DEFAULT, + VERBOSE, + DEBUG, + INFO, + WARN, + ERROR, + FATAL, +} diff --git a/drm/aidl/android/hardware/drm/Mode.aidl b/drm/aidl/android/hardware/drm/Mode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6fc00651a89b6177039a177902f6c35f5b87d0e7 --- /dev/null +++ b/drm/aidl/android/hardware/drm/Mode.aidl @@ -0,0 +1,29 @@ +/* + * 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 android.hardware.drm; + +/** + * Enumerate the supported crypto modes + */ +@VintfStability +@Backing(type="int") +enum Mode { + UNENCRYPTED = 0, + AES_CTR = 1, + AES_CBC_CTS = 2, + AES_CBC = 3, +} diff --git a/drm/aidl/android/hardware/drm/NumberOfSessions.aidl b/drm/aidl/android/hardware/drm/NumberOfSessions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..75b7c2ece825220bdd8baa7f8c4b767d282c3376 --- /dev/null +++ b/drm/aidl/android/hardware/drm/NumberOfSessions.aidl @@ -0,0 +1,26 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable NumberOfSessions { + /** The number of currently opened sessions. */ + int currentSessions; + + /** The maximum number of sessions that the device can support. */ + int maxSessions; +} diff --git a/drm/aidl/android/hardware/drm/OfflineLicenseState.aidl b/drm/aidl/android/hardware/drm/OfflineLicenseState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0f447db2fa86222b811727c8cdaf38e4fea8ff7f --- /dev/null +++ b/drm/aidl/android/hardware/drm/OfflineLicenseState.aidl @@ -0,0 +1,36 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +@Backing(type="int") +enum OfflineLicenseState { + /** + * Offline license state is unknown + */ + UNKNOWN, + /** + * Offline license state is usable, the keys are usable for decryption. + */ + USABLE, + /** + * Offline license state is inactive, the keys have been marked for + * release using {@link #getKeyRequest} with KEY_TYPE_RELEASE but the + * key response has not been received. + */ + INACTIVE, +} diff --git a/drm/aidl/android/hardware/drm/OpaqueData.aidl b/drm/aidl/android/hardware/drm/OpaqueData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6b2a2e79c00cac095b4650d86a260b973c05d023 --- /dev/null +++ b/drm/aidl/android/hardware/drm/OpaqueData.aidl @@ -0,0 +1,22 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable OpaqueData { + byte[] opaqueData; +} diff --git a/drm/aidl/android/hardware/drm/Pattern.aidl b/drm/aidl/android/hardware/drm/Pattern.aidl new file mode 100644 index 0000000000000000000000000000000000000000..88d22cf221106f2b15c77a276db9032f83486f99 --- /dev/null +++ b/drm/aidl/android/hardware/drm/Pattern.aidl @@ -0,0 +1,39 @@ +/* + * 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 android.hardware.drm; + +/** + * A crypto Pattern is a repeating sequence of encrypted and clear blocks + * occurring within the bytes indicated by mNumBytesOfEncryptedDatad bytes + * of a subsample. Patterns are used to reduce the CPU overhead of + * decrypting samples. As an example, HLS uses 1:9 patterns where every + * 10th block is encrypted. + */ +@VintfStability +parcelable Pattern { + /** + * The number of blocks to be encrypted in the pattern. If zero, + * pattern encryption is inoperative. + */ + int encryptBlocks; + + /** + * The number of blocks to be skipped (left clear) in the pattern. If + * zero, pattern encryption is inoperative. + */ + int skipBlocks; +} diff --git a/drm/aidl/android/hardware/drm/ProvideProvisionResponseResult.aidl b/drm/aidl/android/hardware/drm/ProvideProvisionResponseResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e9f1e2b9569baa598e5d42630676f2a086458834 --- /dev/null +++ b/drm/aidl/android/hardware/drm/ProvideProvisionResponseResult.aidl @@ -0,0 +1,34 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable ProvideProvisionResponseResult { + /** + * The public certificate resulting from the provisioning + * operation, if any. An empty vector indicates that no + * certificate was returned. + */ + byte[] certificate; + + /** + * An opaque object containing encrypted private key material + * to be used by signRSA when computing an RSA signature on a + * message, see the signRSA method. + */ + byte[] wrappedKey; +} diff --git a/drm/aidl/android/hardware/drm/ProvisionRequest.aidl b/drm/aidl/android/hardware/drm/ProvisionRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..eb42d32c871a19578e6bba8a7f52db617ce76693 --- /dev/null +++ b/drm/aidl/android/hardware/drm/ProvisionRequest.aidl @@ -0,0 +1,31 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable ProvisionRequest { + /** The opaque certificate request blob. */ + byte[] request; + + /** + * The URL that the provisioning request may be sent to, + * if known by the HAL implementation. An app can choose to + * override this URL. If the HAL implementation does not provide + * a defaultUrl, the returned string must be empty. + */ + String defaultUrl; +} diff --git a/drm/aidl/android/hardware/drm/SecureStop.aidl b/drm/aidl/android/hardware/drm/SecureStop.aidl new file mode 100644 index 0000000000000000000000000000000000000000..37cfbd39ab8a2e8f0bec57b18cd0a12040cc467e --- /dev/null +++ b/drm/aidl/android/hardware/drm/SecureStop.aidl @@ -0,0 +1,25 @@ +/* + * 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 android.hardware.drm; + +/** + * Encapsulates a secure stop opaque object. + */ +@VintfStability +parcelable SecureStop { + byte[] opaqueData; +} diff --git a/drm/aidl/android/hardware/drm/SecureStopId.aidl b/drm/aidl/android/hardware/drm/SecureStopId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..775e60b3915ebdddfe9ba983e347ac2ab93adcbe --- /dev/null +++ b/drm/aidl/android/hardware/drm/SecureStopId.aidl @@ -0,0 +1,22 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable SecureStopId { + byte[] secureStopId; +} diff --git a/drm/aidl/android/hardware/drm/SecurityLevel.aidl b/drm/aidl/android/hardware/drm/SecurityLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aac1b686f37aabf481e57d1e10176ed934b84c67 --- /dev/null +++ b/drm/aidl/android/hardware/drm/SecurityLevel.aidl @@ -0,0 +1,55 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +@Backing(type="int") +enum SecurityLevel { + /** + * Unable to determine the security level + */ + UNKNOWN, + /** + * Software-based whitebox crypto + */ + SW_SECURE_CRYPTO, + /** + * Software-based whitebox crypto and an obfuscated decoder + */ + SW_SECURE_DECODE, + /** + * DRM key management and crypto operations are performed within a + * hardware backed trusted execution environment + */ + HW_SECURE_CRYPTO, + /** + * DRM key management, crypto operations and decoding of content + * are performed within a hardware backed trusted execution environment + */ + HW_SECURE_DECODE, + /** + * DRM key management, crypto operations, decoding of content and all + * handling of the media (compressed and uncompressed) is handled within + * a hardware backed trusted execution environment. + */ + HW_SECURE_ALL, + /** + * The default security level is defined as the highest security level + * supported on the device. + */ + DEFAULT, +} diff --git a/drm/aidl/android/hardware/drm/SharedBuffer.aidl b/drm/aidl/android/hardware/drm/SharedBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b2610f4bcb7b2ff7365f7dd66e0952acd967bae --- /dev/null +++ b/drm/aidl/android/hardware/drm/SharedBuffer.aidl @@ -0,0 +1,45 @@ +/* + * 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 android.hardware.drm; + +import android.hardware.common.NativeHandle; + +/** + * SharedBuffer describes a decrypt buffer which is defined by a bufferId, an + * offset and a size. The offset is relative to the shared memory base for the + * memory region identified by bufferId, which is established by + * setSharedMemoryBase(). + */ +@VintfStability +parcelable SharedBuffer { + /** + * The unique buffer identifier + */ + int bufferId; + /** + * The offset from the shared memory base + */ + long offset; + /** + * The size of the shared buffer in bytes + */ + long size; + /** + * Handle to shared memory + */ + NativeHandle handle; +} diff --git a/drm/aidl/android/hardware/drm/Status.aidl b/drm/aidl/android/hardware/drm/Status.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ee57d646088cab892c35c12175e2f099741aadf9 --- /dev/null +++ b/drm/aidl/android/hardware/drm/Status.aidl @@ -0,0 +1,221 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +@Backing(type="int") +enum Status { + /** + * The DRM plugin must return OK when an operation completes without any + * errors. + */ + OK, + /** + * The DRM plugin must return ERROR_DRM_NO_LICENSE, when decryption is + * attempted and no license keys have been provided. + */ + ERROR_DRM_NO_LICENSE, + /** + * ERROR_DRM_LICENSE_EXPIRED must be returned when an attempt is made + * to use a license and the keys in that license have expired. + */ + ERROR_DRM_LICENSE_EXPIRED, + /** + * The DRM plugin must return ERROR_DRM_SESSION_NOT_OPENED when an + * attempt is made to use a session that has not been opened. + */ + ERROR_DRM_SESSION_NOT_OPENED, + /** + * The DRM plugin must return ERROR_DRM_CANNOT_HANDLE when an unsupported + * data format or operation is attempted. + */ + ERROR_DRM_CANNOT_HANDLE, + /** + * ERROR_DRM_INVALID_STATE must be returned when the device is in a state + * where it is not able to perform decryption. + */ + ERROR_DRM_INVALID_STATE, + /** + * The DRM plugin must return BAD_VALUE whenever an illegal parameter is + * passed to one of the interface functions. + */ + BAD_VALUE, + /** + * The DRM plugin must return ERROR_DRM_NOT_PROVISIONED from getKeyRequest, + * openSession or provideKeyResponse when the device has not yet been + * provisioned. + */ + ERROR_DRM_NOT_PROVISIONED, + /** + * ERROR_DRM_RESOURCE_BUSY must be returned when resources, such as drm + * sessions or secure buffers are not available to perform a requested + * operation because they are already in use. + */ + ERROR_DRM_RESOURCE_BUSY, + /** + * The DRM Plugin must return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION + * when the output protection level enabled on the device is not + * sufficient to meet the requirements in the license policy. HDCP is an + * example of a form of output protection. + */ + ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION, + /** + * The DRM Plugin must return ERROR_DRM_DEVICE_REVOKED from + * provideProvisionResponse and provideKeyResponse if the response indicates + * that the device has been revoked. Device revocation means that the device + * is no longer permitted to play content. + */ + ERROR_DRM_DEVICE_REVOKED, + /** + * The DRM Plugin must return ERROR_DRM_DECRYPT if the CryptoPlugin + * decrypt operation fails. + */ + ERROR_DRM_DECRYPT, + /** + * ERROR_DRM_UNKNOWN must be returned when a fatal failure occurs and no + * other defined error is appropriate. + */ + ERROR_DRM_UNKNOWN, + /** + * The drm HAL module must return ERROR_DRM_INSUFFICIENT_SECURITY + * from the crypto plugin decrypt method when the security level + * of the device is not sufficient to meet the requirements in the + * license policy. + */ + ERROR_DRM_INSUFFICIENT_SECURITY, + /** + * The drm HAL module must return ERROR_FRAME_TOO_LARGE from the + * decrypt method when the frame being decrypted into the secure + * output buffer exceeds the size of the buffer. + */ + ERROR_DRM_FRAME_TOO_LARGE, + /** + * This error must be returned from any session method when an + * attempt is made to use the session after the crypto hardware + * state has been invalidated. Some devices are not able to + * retain crypto session state across device suspend/resume which + * results in invalid session state. + */ + ERROR_DRM_SESSION_LOST_STATE, + /** + * The drm HAL module must return this error if client + * applications using the hal are temporarily exceeding the + * capacity of available crypto resources such that a retry of + * the operation is likely to succeed. + */ + ERROR_DRM_RESOURCE_CONTENTION, + /** + * queueSecureInput buffer called with 0 subsamples. + */ + CANNOT_DECRYPT_ZERO_SUBSAMPLES, + /** + * An error happened within the crypto library used by the drm plugin. + */ + CRYPTO_LIBRARY_ERROR, + /** + * Non-specific error reported by the device OEM subsystem. + */ + GENERAL_OEM_ERROR, + /** + * Unexpected internal failure in the drm/crypto plugin. + */ + GENERAL_PLUGIN_ERROR, + /** + * The init data parameter passed to getKeyRequest is empty or invalid. + */ + INIT_DATA_INVALID, + /** + * Either the key was not loaded from the license before attempting the + * operation, or the key ID parameter provided by the app is incorrect. + */ + KEY_NOT_LOADED, + /** + * The license response was empty, fields are missing or otherwise unable + * to be parsed. + */ + LICENSE_PARSE_ERROR, + /** + * The operation (e.g. to renew or persist a license) is prohibited by the + * license policy. + */ + LICENSE_POLICY_ERROR, + /** + * Failed to generate a release request because a field in the stored + * license is empty or malformed. + */ + LICENSE_RELEASE_ERROR, + /** + * The license server detected an error in the license request. + */ + LICENSE_REQUEST_REJECTED, + /** + * Failed to restore an offline license because a field is empty or + * malformed. + */ + LICENSE_RESTORE_ERROR, + /** + * License is in an invalid state for the attempted operation. + */ + LICENSE_STATE_ERROR, + /** + * Certificate is malformed or is of the wrong type. + */ + MALFORMED_CERTIFICATE, + /** + * Failure in the media framework. + */ + MEDIA_FRAMEWORK_ERROR, + /** + * Certificate has not been set. + */ + MISSING_CERTIFICATE, + /** + * There was an error loading the provisioned certificate. + */ + PROVISIONING_CERTIFICATE_ERROR, + /** + * Required steps where not performed before provisioning was attempted. + */ + PROVISIONING_CONFIGURATION_ERROR, + /** + * The provisioning response was empty, fields are missing or otherwise + * unable to be parsed. + */ + PROVISIONING_PARSE_ERROR, + /** + * The provisioning server detected an error in the provisioning request. + */ + PROVISIONING_REQUEST_REJECTED, + /** + * Provisioning failed in a way that is likely to succeed on a subsequent + * attempt. + */ + RETRYABLE_PROVISIONING_ERROR, + /** + * Failed to generate a secure stop request because a field in the stored + * license is empty or malformed. + */ + SECURE_STOP_RELEASE_ERROR, + /** + * The plugin was unable to read data from the filesystem. + */ + STORAGE_READ_FAILURE, + /** + * The plugin was unable to write data to the filesystem. + */ + STORAGE_WRITE_FAILURE, +} diff --git a/drm/aidl/android/hardware/drm/SubSample.aidl b/drm/aidl/android/hardware/drm/SubSample.aidl new file mode 100644 index 0000000000000000000000000000000000000000..68a8fb11237edb5d77a402a471003879675101e1 --- /dev/null +++ b/drm/aidl/android/hardware/drm/SubSample.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.drm; + +/** + * A subsample consists of some number of bytes of clear (unencrypted) + * data followed by a number of bytes of encrypted data. + */ +@VintfStability +parcelable SubSample { + int numBytesOfClearData; + int numBytesOfEncryptedData; +} diff --git a/drm/aidl/android/hardware/drm/SupportedContentType.aidl b/drm/aidl/android/hardware/drm/SupportedContentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f4fabad5545e72ac1c44c544610a546936deaeff --- /dev/null +++ b/drm/aidl/android/hardware/drm/SupportedContentType.aidl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.drm; + +import android.hardware.drm.SecurityLevel; + +@VintfStability +parcelable SupportedContentType { + /** Supported mime type. E.g. cenc, video/mp4, etc */ + String mime; + + /** Minimum supported security level (inclusive) */ + SecurityLevel minLevel; + + /** Maximum supported security level (inclusive) */ + SecurityLevel maxLevel; +} diff --git a/drm/aidl/android/hardware/drm/Uuid.aidl b/drm/aidl/android/hardware/drm/Uuid.aidl new file mode 100644 index 0000000000000000000000000000000000000000..db5a70d3491b0e3c6744a8b6b573448d6ffdf4ce --- /dev/null +++ b/drm/aidl/android/hardware/drm/Uuid.aidl @@ -0,0 +1,22 @@ +/* + * 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 android.hardware.drm; + +@VintfStability +parcelable Uuid { + byte[16] uuid; +} diff --git a/drm/aidl/vts/Android.bp b/drm/aidl/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..190f60d29be1b5eee9fcb693a70386b00fcfa9f8 --- /dev/null +++ b/drm/aidl/vts/Android.bp @@ -0,0 +1,75 @@ +// +// 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: "VtsAidlHalDrmTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "drm_hal_common.cpp", + "drm_hal_test.cpp", + "drm_hal_test_main.cpp", + ], + local_include_dirs: [ + "include", + ], + header_libs: [ + "drm_hal_vendor_module_headers", + ], + shared_libs: [ + "libandroid", + "libbinder_ndk", + "libcrypto", + "libnativehelper", + ], + static_libs: [ + "android.hardware.drm@1.0-helper", + "android.hardware.drm-V1-ndk", + "android.hardware.common-V2-ndk", + "libaidlcommonsupport", + "libgmock_ndk", + "libdrmvtshelper", + "libvtsclearkey", + ], + arch: { + arm: { + data: [":libvtswidevine-arm-prebuilts"], + }, + arm64: { + data: [":libvtswidevine-arm64-prebuilts"], + }, + x86: { + data: [":libvtswidevine-x86-prebuilts"], + }, + x86_64: { + data: [":libvtswidevine-x86_64-prebuilts"], + }, + }, + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/drm/aidl/vts/AndroidTest.xml b/drm/aidl/vts/AndroidTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..9e5b41a048958ab0fbb4ec0bada47eafa8980e52 --- /dev/null +++ b/drm/aidl/vts/AndroidTest.xml @@ -0,0 +1,38 @@ + + + + diff --git a/drm/aidl/vts/OWNERS b/drm/aidl/vts/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..e44b93eef9410dbaf54aafef4da1aaebef3f4312 --- /dev/null +++ b/drm/aidl/vts/OWNERS @@ -0,0 +1,4 @@ +edwinwong@google.com +jtinker@google.com +kelzhan@google.com +robertshih@google.com diff --git a/drm/aidl/vts/drm_hal_common.cpp b/drm/aidl/vts/drm_hal_common.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7de81670abd0a9bacc408298f06d28dadf1f8d8a --- /dev/null +++ b/drm/aidl/vts/drm_hal_common.cpp @@ -0,0 +1,643 @@ +/* + * 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_TAG "drm_hal_common" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "drm_hal_clearkey_module.h" +#include "drm_hal_common.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace drm { +namespace vts { + +namespace clearkeydrm = ::android::hardware::drm::V1_2::vts; + +using std::vector; +using ::aidl::android::hardware::common::Ashmem; +using ::aidl::android::hardware::drm::DecryptArgs; +using ::aidl::android::hardware::drm::DestinationBuffer; +using ::aidl::android::hardware::drm::EventType; +using ::aidl::android::hardware::drm::ICryptoPlugin; +using ::aidl::android::hardware::drm::IDrmPlugin; +using ::aidl::android::hardware::drm::KeyRequest; +using ::aidl::android::hardware::drm::KeyRequestType; +using ::aidl::android::hardware::drm::KeySetId; +using ::aidl::android::hardware::drm::KeyType; +using ::aidl::android::hardware::drm::KeyValue; +using ::aidl::android::hardware::drm::Mode; +using ::aidl::android::hardware::drm::Pattern; +using ::aidl::android::hardware::drm::ProvisionRequest; +using ::aidl::android::hardware::drm::ProvideProvisionResponseResult; +using ::aidl::android::hardware::drm::SecurityLevel; +using ::aidl::android::hardware::drm::Status; +using ::aidl::android::hardware::drm::SubSample; +using ::aidl::android::hardware::drm::Uuid; + +Status DrmErr(const ::ndk::ScopedAStatus& ret) { + return static_cast(ret.getServiceSpecificError()); +} + +std::string HalBaseName(const std::string& fullname) { + auto idx = fullname.find('/'); + if (idx == std::string::npos) { + return fullname; + } + return fullname.substr(idx + 1); +} + +const char* kDrmIface = "android.hardware.drm.IDrmFactory"; +const int MAX_OPEN_SESSION_ATTEMPTS = 3; + +std::string HalFullName(const std::string& iface, const std::string& basename) { + return iface + '/' + basename; +} + +testing::AssertionResult IsOk(const ::ndk::ScopedAStatus& ret) { + if (ret.isOk()) { + return testing::AssertionSuccess(); + } + return testing::AssertionFailure() << "ex: " << ret.getExceptionCode() + << "; svc err: " << ret.getServiceSpecificError() + << "; desc: " << ret.getDescription(); +} + +const char* kCallbackLostState = "LostState"; +const char* kCallbackKeysChange = "KeysChange"; + +drm_vts::VendorModules* DrmHalTest::gVendorModules = nullptr; + +/** + * DrmHalPluginListener + */ +::ndk::ScopedAStatus DrmHalPluginListener::onEvent( + EventType eventType, + const vector& sessionId, + const vector& data) { + ListenerArgs args{}; + args.eventType = eventType; + args.sessionId = sessionId; + args.data = data; + eventPromise.set_value(args); + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus DrmHalPluginListener::onExpirationUpdate( + const vector& sessionId, + int64_t expiryTimeInMS) { + ListenerArgs args{}; + args.sessionId = sessionId; + args.expiryTimeInMS = expiryTimeInMS; + expirationUpdatePromise.set_value(args); + return ::ndk::ScopedAStatus::ok(); + +} + +::ndk::ScopedAStatus DrmHalPluginListener::onSessionLostState(const vector& sessionId) { + ListenerArgs args{}; + args.sessionId = sessionId; + sessionLostStatePromise.set_value(args); + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus DrmHalPluginListener::onKeysChange( + const std::vector& sessionId, + const std::vector<::aidl::android::hardware::drm::KeyStatus>& keyStatusList, + bool hasNewUsableKey) { + ListenerArgs args{}; + args.sessionId = sessionId; + args.keyStatusList = keyStatusList; + args.hasNewUsableKey = hasNewUsableKey; + keysChangePromise.set_value(args); + return ::ndk::ScopedAStatus::ok(); +} + +ListenerArgs DrmHalPluginListener::getListenerArgs(std::promise& promise) { + auto future = promise.get_future(); + auto timeout = std::chrono::milliseconds(500); + EXPECT_EQ(future.wait_for(timeout), std::future_status::ready); + return future.get(); +} + +ListenerArgs DrmHalPluginListener::getEventArgs() { + return getListenerArgs(eventPromise); +} + +ListenerArgs DrmHalPluginListener::getExpirationUpdateArgs() { + return getListenerArgs(expirationUpdatePromise); +} + +ListenerArgs DrmHalPluginListener::getSessionLostStateArgs() { + return getListenerArgs(sessionLostStatePromise); +} + +ListenerArgs DrmHalPluginListener::getKeysChangeArgs() { + return getListenerArgs(keysChangePromise); +} + +static DrmHalVTSVendorModule_V1* getModuleForInstance(const std::string& instance) { + if (instance.find("clearkey") != std::string::npos || + instance.find("default") != std::string::npos) { + return new clearkeydrm::DrmHalVTSClearkeyModule(); + } + + return static_cast( + DrmHalTest::gVendorModules->getModuleByName(instance)); +} + +/** + * DrmHalTest + */ + +DrmHalTest::DrmHalTest() : vendorModule(getModuleForInstance(GetParamService())) {} + +void DrmHalTest::SetUp() { + const ::testing::TestInfo* const test_info = + ::testing::UnitTest::GetInstance()->current_test_info(); + + ALOGD("Running test %s.%s from (vendor) module %s", test_info->test_case_name(), + test_info->name(), GetParamService().c_str()); + + auto svc = GetParamService(); + const string drmInstance = HalFullName(kDrmIface, svc); + + if (drmInstance.find("IDrmFactory") != std::string::npos) { + drmFactory = IDrmFactory::fromBinder( + ::ndk::SpAIBinder(AServiceManager_waitForService(drmInstance.c_str()))); + ASSERT_NE(drmFactory, nullptr); + drmPlugin = createDrmPlugin(); + cryptoPlugin = createCryptoPlugin(); + } + + if (!vendorModule) { + ASSERT_NE(drmInstance, "widevine") << "Widevine requires vendor module."; + ASSERT_NE(drmInstance, "clearkey") << "Clearkey requires vendor module."; + GTEST_SKIP() << "No vendor module installed"; + } + + ASSERT_EQ(HalBaseName(drmInstance), vendorModule->getServiceName()); + contentConfigurations = vendorModule->getContentConfigurations(); + + // If drm scheme not installed skip subsequent tests + bool result = isCryptoSchemeSupported(getAidlUUID(), SecurityLevel::SW_SECURE_CRYPTO, "cenc"); + if (!result) { + if (GetParamUUID() == std::array()) { + GTEST_SKIP() << "vendor module drm scheme not supported"; + } else { + FAIL() << "param scheme must be supported"; + } + } + + ASSERT_NE(nullptr, drmPlugin.get()) + << "Can't find " << vendorModule->getServiceName() << " drm aidl plugin"; + ASSERT_NE(nullptr, cryptoPlugin.get()) + << "Can't find " << vendorModule->getServiceName() << " crypto aidl plugin"; +} + +std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> DrmHalTest::createDrmPlugin() { + if (drmFactory == nullptr) { + return nullptr; + } + std::string packageName("aidl.android.hardware.drm.test"); + std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> result; + auto ret = drmFactory->createDrmPlugin(getAidlUUID(), packageName, &result); + EXPECT_OK(ret) << "createDrmPlugin remote call failed"; + return result; +} + +std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> DrmHalTest::createCryptoPlugin() { + if (drmFactory == nullptr) { + return nullptr; + } + vector initVec; + std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> result; + auto ret = drmFactory->createCryptoPlugin(getAidlUUID(), initVec, &result); + EXPECT_OK(ret) << "createCryptoPlugin remote call failed"; + return result; +} + +::aidl::android::hardware::drm::Uuid DrmHalTest::getAidlUUID() { + return toAidlUuid(getUUID()); +} + +std::vector DrmHalTest::getUUID() { + auto paramUUID = GetParamUUID(); + if (paramUUID == std::array()) { + return getVendorUUID(); + } + return std::vector(paramUUID.begin(), paramUUID.end()); +} + +std::vector DrmHalTest::getVendorUUID() { + if (vendorModule == nullptr) { + ALOGW("vendor module for %s not found", GetParamService().c_str()); + return std::vector(16); + } + return vendorModule->getUUID(); +} + +bool DrmHalTest::isCryptoSchemeSupported(Uuid uuid, SecurityLevel level, std::string mime) { + CryptoSchemes schemes{}; + auto ret = drmFactory->getSupportedCryptoSchemes(&schemes); + EXPECT_OK(ret); + if (!ret.isOk() || !std::count(schemes.uuids.begin(), schemes.uuids.end(), uuid)) { + return false; + } + if (mime.empty()) { + EXPECT_THAT(level, AnyOf(Eq(SecurityLevel::DEFAULT), Eq(SecurityLevel::UNKNOWN))); + return true; + } + for (auto ct : schemes.mimeTypes) { + if (ct.mime != mime) { + continue; + } + if (level == SecurityLevel::DEFAULT || level == SecurityLevel::UNKNOWN) { + return true; + } + if (level <= ct.maxLevel && level >= ct.minLevel) { + return true; + } + } + return false; +} + +void DrmHalTest::provision() { + std::string certificateType; + std::string certificateAuthority; + vector provisionRequest; + std::string defaultUrl; + ProvisionRequest result; + auto ret = drmPlugin->getProvisionRequest(certificateType, certificateAuthority, &result); + + EXPECT_TXN(ret); + if (ret.isOk()) { + EXPECT_NE(result.request.size(), 0u); + provisionRequest = result.request; + defaultUrl = result.defaultUrl; + } else if (DrmErr(ret) == Status::ERROR_DRM_CANNOT_HANDLE) { + EXPECT_EQ(0u, result.request.size()); + } + + if (provisionRequest.size() > 0) { + vector response = + vendorModule->handleProvisioningRequest(provisionRequest, defaultUrl); + ASSERT_NE(0u, response.size()); + + ProvideProvisionResponseResult result; + auto ret = drmPlugin->provideProvisionResponse(response, &result); + EXPECT_TXN(ret); + } +} + +SessionId DrmHalTest::openSession(SecurityLevel level, Status* err) { + SessionId sessionId; + auto ret = drmPlugin->openSession(level, &sessionId); + EXPECT_TXN(ret); + *err = DrmErr(ret); + return sessionId; +} + +/** + * Helper method to open a session and verify that a non-empty + * session ID is returned + */ +SessionId DrmHalTest::openSession() { + SessionId sessionId; + + int attmpt = 0; + while (attmpt++ < MAX_OPEN_SESSION_ATTEMPTS) { + auto ret = drmPlugin->openSession(SecurityLevel::DEFAULT, &sessionId); + if(DrmErr(ret) == Status::ERROR_DRM_NOT_PROVISIONED) { + provision(); + } else { + EXPECT_OK(ret); + EXPECT_NE(0u, sessionId.size()); + break; + } + } + + return sessionId; +} + +/** + * Helper method to close a session + */ +void DrmHalTest::closeSession(const SessionId& sessionId) { + auto ret = drmPlugin->closeSession(sessionId); + EXPECT_OK(ret); +} + +vector DrmHalTest::getKeyRequest( + const SessionId& sessionId, + const DrmHalVTSVendorModule_V1::ContentConfiguration& configuration, + const KeyType& type = KeyType::STREAMING) { + KeyRequest result; + auto ret = drmPlugin->getKeyRequest(sessionId, configuration.initData, configuration.mimeType, + type, toAidlKeyedVector(configuration.optionalParameters), + &result); + EXPECT_OK(ret) << "Failed to get key request for configuration " + << configuration.name << " for key type " + << static_cast(type); + if (type == KeyType::RELEASE) { + EXPECT_EQ(KeyRequestType::RELEASE, result.requestType); + } else { + EXPECT_EQ(KeyRequestType::INITIAL, result.requestType); + } + EXPECT_NE(result.request.size(), 0u) << "Expected key request size" + " to have length > 0 bytes"; + return result.request; +} + +DrmHalVTSVendorModule_V1::ContentConfiguration DrmHalTest::getContent(const KeyType& type) const { + for (const auto& config : contentConfigurations) { + if (type != KeyType::OFFLINE || config.policy.allowOffline) { + return config; + } + } + ADD_FAILURE() << "no content configurations found"; + return {}; +} + +vector DrmHalTest::provideKeyResponse(const SessionId& sessionId, + const vector& keyResponse) { + KeySetId result; + auto ret = drmPlugin->provideKeyResponse(sessionId, keyResponse, &result); + EXPECT_OK(ret) << "Failure providing key response for configuration "; + return result.keySetId; +} + +/** + * Helper method to load keys for subsequent decrypt tests. + * These tests use predetermined key request/response to + * avoid requiring a round trip to a license server. + */ +vector DrmHalTest::loadKeys( + const SessionId& sessionId, + const DrmHalVTSVendorModule_V1::ContentConfiguration& configuration, const KeyType& type) { + vector keyRequest = getKeyRequest(sessionId, configuration, type); + + /** + * Get key response from vendor module + */ + vector keyResponse = + vendorModule->handleKeyRequest(keyRequest, configuration.serverUrl); + EXPECT_NE(keyResponse.size(), 0u) << "Expected key response size " + "to have length > 0 bytes"; + + return provideKeyResponse(sessionId, keyResponse); +} + +vector DrmHalTest::loadKeys(const SessionId& sessionId, const KeyType& type) { + return loadKeys(sessionId, getContent(type), type); +} + +std::array DrmHalTest::toStdArray(const vector& vec) { + EXPECT_EQ(16u, vec.size()); + std::array arr; + std::copy_n(vec.begin(), vec.size(), arr.begin()); + return arr; +} + +KeyedVector DrmHalTest::toAidlKeyedVector(const map& params) { + std::vector stdKeyedVector; + for (auto it = params.begin(); it != params.end(); ++it) { + KeyValue keyValue; + keyValue.key = it->first; + keyValue.value = it->second; + stdKeyedVector.push_back(keyValue); + } + return KeyedVector(stdKeyedVector); +} + +/** + * getDecryptMemory allocates memory for decryption, then sets it + * as a shared buffer base in the crypto hal. An output SharedBuffer + * is updated via reference. + * + * @param size the size of the memory segment to allocate + * @param the index of the memory segment which will be used + * to refer to it for decryption. + */ +void DrmHalTest::getDecryptMemory(size_t size, size_t index, SharedBuffer& out) { + out.bufferId = static_cast(index); + out.offset = 0; + out.size = static_cast(size); + + int fd = ASharedMemory_create("drmVtsSharedMemory", size); + EXPECT_GE(fd, 0); + EXPECT_EQ(size, ASharedMemory_getSize(fd)); + auto handle = native_handle_create(1, 0); + handle->data[0] = fd; + out.handle = ::android::makeToAidl(handle); + + EXPECT_OK(cryptoPlugin->setSharedBufferBase(out)); + native_handle_delete(handle); +} + +uint8_t* DrmHalTest::fillRandom(const ::aidl::android::hardware::drm::SharedBuffer& buf) { + std::random_device rd; + std::mt19937 rand(rd()); + + auto fd = buf.handle.fds[0].get(); + size_t size = buf.size; + uint8_t* base = static_cast( + mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)); + EXPECT_NE(MAP_FAILED, base); + for (size_t i = 0; i < size / sizeof(uint32_t); i++) { + auto p = static_cast(static_cast(base)); + p[i] = rand(); + } + return base; +} + +uint32_t DrmHalTest::decrypt(Mode mode, bool isSecure, const std::array& keyId, + uint8_t* iv, const vector& subSamples, + const Pattern& pattern, const vector& key, + Status expectedStatus) { + const size_t kSegmentIndex = 0; + + uint8_t localIv[AES_BLOCK_SIZE]; + memcpy(localIv, iv, AES_BLOCK_SIZE); + vector ivVec(localIv, localIv + AES_BLOCK_SIZE); + vector keyIdVec(keyId.begin(), keyId.end()); + + int64_t totalSize = 0; + for (size_t i = 0; i < subSamples.size(); i++) { + totalSize += subSamples[i].numBytesOfClearData; + totalSize += subSamples[i].numBytesOfEncryptedData; + } + + // The first totalSize bytes of shared memory is the encrypted + // input, the second totalSize bytes (if exists) is the decrypted output. + size_t factor = expectedStatus == Status::ERROR_DRM_FRAME_TOO_LARGE ? 1 : 2; + SharedBuffer sourceBuffer; + getDecryptMemory(totalSize * factor, kSegmentIndex, sourceBuffer); + auto base = fillRandom(sourceBuffer); + + SharedBuffer sourceRange; + sourceRange.bufferId = kSegmentIndex; + sourceRange.offset = 0; + sourceRange.size = totalSize; + + SharedBuffer destRange; + destRange.bufferId = kSegmentIndex; + destRange.offset = totalSize; + destRange.size = totalSize; + + DecryptArgs args; + args.secure = isSecure; + args.keyId = keyIdVec; + args.iv = ivVec; + args.mode = mode; + args.pattern = pattern; + args.subSamples = subSamples; + args.source = std::move(sourceRange); + args.offset = 0; + args.destination = std::move(destRange); + + int32_t bytesWritten = 0; + auto ret = cryptoPlugin->decrypt(args, &bytesWritten); + EXPECT_TXN(ret); + EXPECT_EQ(expectedStatus, DrmErr(ret)) << "Unexpected decrypt status " << ret.getMessage(); + + if (bytesWritten != totalSize) { + return bytesWritten; + } + + // generate reference vector + vector reference(totalSize); + + memcpy(localIv, iv, AES_BLOCK_SIZE); + switch (mode) { + case Mode::UNENCRYPTED: + memcpy(&reference[0], base, totalSize); + break; + case Mode::AES_CTR: + aes_ctr_decrypt(&reference[0], base, localIv, subSamples, key); + break; + case Mode::AES_CBC: + aes_cbc_decrypt(&reference[0], base, localIv, subSamples, key); + break; + case Mode::AES_CBC_CTS: + ADD_FAILURE() << "AES_CBC_CTS mode not supported"; + break; + } + + // compare reference to decrypted data which is at base + total size + EXPECT_EQ(0, memcmp(static_cast(&reference[0]), static_cast(base + totalSize), + totalSize)) + << "decrypt data mismatch"; + munmap(base, totalSize * factor); + return totalSize; +} + +/** + * Decrypt a list of clear+encrypted subsamples using the specified key + * in AES-CTR mode + */ +void DrmHalTest::aes_ctr_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv, + const vector& subSamples, const vector& key) { + AES_KEY decryptionKey; + AES_set_encrypt_key(&key[0], 128, &decryptionKey); + + size_t offset = 0; + unsigned int blockOffset = 0; + uint8_t previousEncryptedCounter[AES_BLOCK_SIZE]; + memset(previousEncryptedCounter, 0, AES_BLOCK_SIZE); + + for (size_t i = 0; i < subSamples.size(); i++) { + const SubSample& subSample = subSamples[i]; + + if (subSample.numBytesOfClearData > 0) { + memcpy(dest + offset, src + offset, subSample.numBytesOfClearData); + offset += subSample.numBytesOfClearData; + } + + if (subSample.numBytesOfEncryptedData > 0) { + AES_ctr128_encrypt(src + offset, dest + offset, subSample.numBytesOfEncryptedData, + &decryptionKey, iv, previousEncryptedCounter, &blockOffset); + offset += subSample.numBytesOfEncryptedData; + } + } +} + +/** + * Decrypt a list of clear+encrypted subsamples using the specified key + * in AES-CBC mode + */ +void DrmHalTest::aes_cbc_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv, + const vector& subSamples, const vector& key) { + AES_KEY decryptionKey; + AES_set_encrypt_key(&key[0], 128, &decryptionKey); + + size_t offset = 0; + for (size_t i = 0; i < subSamples.size(); i++) { + memcpy(dest + offset, src + offset, subSamples[i].numBytesOfClearData); + offset += subSamples[i].numBytesOfClearData; + + AES_cbc_encrypt(src + offset, dest + offset, subSamples[i].numBytesOfEncryptedData, + &decryptionKey, iv, 0 /* decrypt */); + offset += subSamples[i].numBytesOfEncryptedData; + } +} + +/** + * Helper method to test decryption with invalid keys is returned + */ +void DrmHalClearkeyTest::decryptWithInvalidKeys(vector& invalidResponse, + vector& iv, const Pattern& noPattern, + const vector& subSamples) { + DrmHalVTSVendorModule_V1::ContentConfiguration content = getContent(); + if (content.keys.empty()) { + FAIL() << "no keys"; + } + + const auto& key = content.keys[0]; + auto sessionId = openSession(); + KeySetId result; + auto ret = drmPlugin->provideKeyResponse(sessionId, invalidResponse, &result); + + EXPECT_OK(ret); + EXPECT_EQ(0u, result.keySetId.size()); + + EXPECT_OK(cryptoPlugin->setMediaDrmSession(sessionId)); + + uint32_t byteCount = + decrypt(Mode::AES_CTR, key.isSecure, toStdArray(key.keyId), &iv[0], subSamples, + noPattern, key.clearContentKey, Status::ERROR_DRM_NO_LICENSE); + EXPECT_EQ(0u, byteCount); + + closeSession(sessionId); +} + +} // namespace vts +} // namespace drm +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/drm/aidl/vts/drm_hal_test.cpp b/drm/aidl/vts/drm_hal_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..14b3acfc7f117868215babefd636a4a92f2c6965 --- /dev/null +++ b/drm/aidl/vts/drm_hal_test.cpp @@ -0,0 +1,550 @@ +/* + * 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_TAG "drm_hal_test" + +#include +#include +#include + +#include +#include + +#include "drm_hal_common.h" + +using ::aidl::android::hardware::drm::EventType; +using ::aidl::android::hardware::drm::HdcpLevels; +using ::aidl::android::hardware::drm::KeyRequest; +using ::aidl::android::hardware::drm::HdcpLevel; +using ::aidl::android::hardware::drm::IDrmPluginListener; +using ::aidl::android::hardware::drm::KeyRequestType; +using ::aidl::android::hardware::drm::KeySetId; +using ::aidl::android::hardware::drm::KeyStatus; +using ::aidl::android::hardware::drm::KeyStatusType; +using ::aidl::android::hardware::drm::KeyType; +using ::aidl::android::hardware::drm::Mode; +using ::aidl::android::hardware::drm::OfflineLicenseState; +using ::aidl::android::hardware::drm::Pattern; +using ::aidl::android::hardware::drm::SecurityLevel; +using ::aidl::android::hardware::drm::Status; +using ::aidl::android::hardware::drm::SubSample; +using ::aidl::android::hardware::drm::Uuid; + +using ::aidl::android::hardware::drm::vts::DrmErr; +using ::aidl::android::hardware::drm::vts::DrmHalClearkeyTest; +using ::aidl::android::hardware::drm::vts::DrmHalPluginListener; +using ::aidl::android::hardware::drm::vts::DrmHalTest; +using ::aidl::android::hardware::drm::vts::ListenerArgs; +using ::aidl::android::hardware::drm::vts::kCallbackKeysChange; +using ::aidl::android::hardware::drm::vts::kCallbackLostState; + +using std::string; +using std::vector; + +static const char* const kVideoMp4 = "video/mp4"; +static const char* const kBadMime = "video/unknown"; +static const char* const kDrmErrorTestKey = "drmErrorTest"; +static const char* const kDrmErrorInvalidState = "invalidState"; +static const char* const kDrmErrorResourceContention = "resourceContention"; +static constexpr SecurityLevel kSwSecureCrypto = SecurityLevel::SW_SECURE_CRYPTO; +static constexpr SecurityLevel kHwSecureAll = SecurityLevel::HW_SECURE_ALL; + +/** + * Ensure drm factory supports module UUID Scheme + */ +TEST_P(DrmHalTest, VendorUuidSupported) { + bool result = isCryptoSchemeSupported(getAidlUUID(), kSwSecureCrypto, kVideoMp4); + ALOGI("kVideoMp4 = %s res %d", kVideoMp4, result); + EXPECT_TRUE(result); +} + +/** + * Ensure drm factory doesn't support an invalid scheme UUID + */ +TEST_P(DrmHalTest, InvalidPluginNotSupported) { + const vector kInvalidUUID = {0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, + 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80}; + auto result = isCryptoSchemeSupported(toAidlUuid(kInvalidUUID), kSwSecureCrypto, kVideoMp4); + EXPECT_FALSE(result); +} + +/** + * Ensure drm factory doesn't support an empty UUID + */ +TEST_P(DrmHalTest, EmptyPluginUUIDNotSupported) { + vector emptyUUID(16); + memset(emptyUUID.data(), 0, 16); + auto result = isCryptoSchemeSupported(toAidlUuid(emptyUUID), kSwSecureCrypto, kVideoMp4); + EXPECT_FALSE(result); +} + +/** + * Ensure drm factory doesn't support an invalid mime type + */ +TEST_P(DrmHalTest, BadMimeNotSupported) { + auto result = isCryptoSchemeSupported(getAidlUUID(), kSwSecureCrypto, kBadMime); + EXPECT_FALSE(result); +} + +/** + * getSupportedCryptoSchemes confidence check + */ +TEST_P(DrmHalTest, SupportedCryptoSchemes) { + aidl::android::hardware::drm::CryptoSchemes schemes{}; + auto result = drmFactory->getSupportedCryptoSchemes(&schemes); + EXPECT_FALSE(schemes.uuids.empty()); + for(auto ct : schemes.mimeTypes) { + EXPECT_LE(ct.minLevel, ct.maxLevel); + } + EXPECT_OK(result); +} + +/** + * DrmPlugin tests + */ + +/** + * Test that a DRM plugin can handle provisioning. While + * it is not required that a DRM scheme require provisioning, + * it should at least return appropriate status values. If + * a provisioning request is returned, it is passed to the + * vendor module which should provide a provisioning response + * that is delivered back to the HAL. + */ +TEST_P(DrmHalTest, DoProvisioning) { + for (auto level : {kHwSecureAll, kSwSecureCrypto}) { + Status err = Status::OK; + auto sid = openSession(level, &err); + if (err == Status::OK) { + closeSession(sid); + } else if (err == Status::ERROR_DRM_CANNOT_HANDLE) { + continue; + } else { + EXPECT_EQ(Status::ERROR_DRM_NOT_PROVISIONED, err); + provision(); + } + } +} + +/** + * A get key request should fail if no sessionId is provided + */ +TEST_P(DrmHalTest, GetKeyRequestNoSession) { + SessionId invalidSessionId; + vector initData; + KeyedVector optionalParameters; + KeyRequest result; + auto ret = drmPlugin->getKeyRequest(invalidSessionId, initData, kVideoMp4, KeyType::STREAMING, + optionalParameters, &result); + EXPECT_TXN(ret); + EXPECT_EQ(Status::BAD_VALUE, DrmErr(ret)); +} + +/** + * Test that the plugin returns the documented error for the + * case of attempting to generate a key request using an + * invalid mime type + */ +TEST_P(DrmHalTest, GetKeyRequestBadMime) { + auto sessionId = openSession(); + vector initData; + KeyedVector optionalParameters; + KeyRequest result; + auto ret = drmPlugin->getKeyRequest(sessionId, initData, kBadMime, KeyType::STREAMING, + optionalParameters, &result); + EXPECT_EQ(EX_SERVICE_SPECIFIC, ret.getExceptionCode()); + closeSession(sessionId); +} + +/** + * Test drm plugin offline key support + */ +TEST_P(DrmHalTest, OfflineLicenseTest) { + auto sessionId = openSession(); + vector keySetId = loadKeys(sessionId, KeyType::OFFLINE); + closeSession(sessionId); + + vector result; + auto ret = drmPlugin->getOfflineLicenseKeySetIds(&result); + EXPECT_OK(ret); + bool found = false; + for (KeySetId keySetId2 : result) { + if (keySetId == keySetId2.keySetId) { + found = true; + break; + } + } + EXPECT_TRUE(found) << "keySetId not found"; + + ret = drmPlugin->removeOfflineLicense({keySetId}); + EXPECT_OK(ret); + + ret = drmPlugin->getOfflineLicenseKeySetIds(&result); + EXPECT_OK(ret); + for (KeySetId keySetId2 : result) { + EXPECT_NE(keySetId, keySetId2.keySetId); + } + + ret = drmPlugin->removeOfflineLicense({keySetId}); + EXPECT_TXN(ret); + EXPECT_EQ(Status::BAD_VALUE, DrmErr(ret)); +} + +/** + * Test drm plugin offline key state + */ +TEST_P(DrmHalTest, OfflineLicenseStateTest) { + auto sessionId = openSession(); + DrmHalVTSVendorModule_V1::ContentConfiguration content = getContent(KeyType::OFFLINE); + vector keySetId = loadKeys(sessionId, content, KeyType::OFFLINE); + closeSession(sessionId); + + OfflineLicenseState result{}; + auto ret = drmPlugin->getOfflineLicenseState({keySetId}, &result); + EXPECT_OK(ret); + EXPECT_EQ(OfflineLicenseState::USABLE, result); + + vector keyRequest = getKeyRequest(keySetId, content, KeyType::RELEASE); + ret = drmPlugin->getOfflineLicenseState({keySetId}, &result); + EXPECT_OK(ret); + EXPECT_EQ(OfflineLicenseState::INACTIVE, result); + + /** + * Get key response from vendor module + */ + vector keyResponse = vendorModule->handleKeyRequest(keyRequest, content.serverUrl); + EXPECT_GT(keyResponse.size(), 0u); + + result = OfflineLicenseState::UNKNOWN; + provideKeyResponse(keySetId, keyResponse); + ret = drmPlugin->getOfflineLicenseState({keySetId}, &result); + EXPECT_TXN(ret); + EXPECT_EQ(Status::BAD_VALUE, DrmErr(ret)); + EXPECT_EQ(OfflineLicenseState::UNKNOWN, result); +} + +/** + * Negative offline license test. Remove empty keySetId + */ +TEST_P(DrmHalTest, RemoveEmptyKeySetId) { + KeySetId emptyKeySetId; + auto ret = drmPlugin->removeOfflineLicense(emptyKeySetId); + EXPECT_TXN(ret); + EXPECT_EQ(Status::BAD_VALUE, DrmErr(ret)); +} + +/** + * Negative offline license test. Get empty keySetId state + */ +TEST_P(DrmHalTest, GetEmptyKeySetIdState) { + KeySetId emptyKeySetId; + OfflineLicenseState result; + auto ret = drmPlugin->getOfflineLicenseState(emptyKeySetId, &result); + EXPECT_TXN(ret); + EXPECT_EQ(Status::BAD_VALUE, DrmErr(ret)); + EXPECT_EQ(OfflineLicenseState::UNKNOWN, result); +} + +/** + * Test that the plugin returns valid connected and max HDCP levels + */ +TEST_P(DrmHalTest, GetHdcpLevels) { + HdcpLevels result; + auto ret = drmPlugin->getHdcpLevels(&result); + EXPECT_OK(ret); + EXPECT_GE(result.connectedLevel, HdcpLevel::HDCP_NONE); + EXPECT_LE(result.maxLevel, HdcpLevel::HDCP_V2_3); +} + +/** + * CryptoPlugin Decrypt tests + */ + +/** + * Positive decrypt test. "Decrypt" a single clear segment + */ +TEST_P(DrmHalTest, ClearSegmentTest) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { + const size_t kSegmentSize = 1024; + vector iv(AES_BLOCK_SIZE, 0); + const Pattern noPattern = {0, 0}; + const vector subSamples = { + {.numBytesOfClearData = kSegmentSize, .numBytesOfEncryptedData = 0}}; + auto sessionId = openSession(); + loadKeys(sessionId, config); + + auto ret = cryptoPlugin->setMediaDrmSession(sessionId); + EXPECT_OK(ret); + + uint32_t byteCount = + decrypt(Mode::UNENCRYPTED, key.isSecure, toStdArray(key.keyId), &iv[0], + subSamples, noPattern, key.clearContentKey, Status::OK); + EXPECT_EQ(kSegmentSize, byteCount); + + closeSession(sessionId); + } + } +} + +/** + * Positive decrypt test. Decrypt a single segment using aes_ctr. + * Verify data matches. + */ +TEST_P(DrmHalTest, EncryptedAesCtrSegmentTest) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { + const size_t kSegmentSize = 1024; + vector iv(AES_BLOCK_SIZE, 0); + const Pattern noPattern = {0, 0}; + const vector subSamples = { + {.numBytesOfClearData = kSegmentSize, .numBytesOfEncryptedData = 0}}; + auto sessionId = openSession(); + loadKeys(sessionId, config); + + auto ret = cryptoPlugin->setMediaDrmSession(sessionId); + EXPECT_OK(ret); + + uint32_t byteCount = decrypt(Mode::AES_CTR, key.isSecure, toStdArray(key.keyId), &iv[0], + subSamples, noPattern, key.clearContentKey, Status::OK); + EXPECT_EQ(kSegmentSize, byteCount); + + closeSession(sessionId); + } + } +} + +/** + * Negative decrypt test. Decrypted frame too large to fit in output buffer + */ +TEST_P(DrmHalTest, ErrorFrameTooLarge) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { + const size_t kSegmentSize = 1024; + vector iv(AES_BLOCK_SIZE, 0); + const Pattern noPattern = {0, 0}; + const vector subSamples = { + {.numBytesOfClearData = kSegmentSize, .numBytesOfEncryptedData = 0}}; + auto sessionId = openSession(); + loadKeys(sessionId, config); + + auto ret = cryptoPlugin->setMediaDrmSession(sessionId); + EXPECT_OK(ret); + + decrypt(Mode::UNENCRYPTED, key.isSecure, toStdArray(key.keyId), &iv[0], subSamples, + noPattern, key.clearContentKey, Status::ERROR_DRM_FRAME_TOO_LARGE); + + closeSession(sessionId); + } + } +} + +/** + * Negative decrypt test. Decrypt without loading keys. + */ +TEST_P(DrmHalTest, EncryptedAesCtrSegmentTestNoKeys) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { + vector iv(AES_BLOCK_SIZE, 0); + const Pattern noPattern = {0, 0}; + const vector subSamples = { + {.numBytesOfClearData = 256, .numBytesOfEncryptedData = 256}}; + auto sessionId = openSession(); + + auto ret = cryptoPlugin->setMediaDrmSession(sessionId); + EXPECT_OK(ret); + + uint32_t byteCount = + decrypt(Mode::AES_CTR, key.isSecure, toStdArray(key.keyId), &iv[0], subSamples, + noPattern, key.clearContentKey, Status::ERROR_DRM_NO_LICENSE); + EXPECT_EQ(0u, byteCount); + + closeSession(sessionId); + } + } +} + +/** + * Ensure clearkey drm factory doesn't support security level higher than supported + */ +TEST_P(DrmHalClearkeyTest, BadLevelNotSupported) { + auto result = isCryptoSchemeSupported(getAidlUUID(), kHwSecureAll, kVideoMp4); + EXPECT_FALSE(result); +} + +/** + * Test resource contention during attempt to generate key request + */ +TEST_P(DrmHalClearkeyTest, GetKeyRequestResourceContention) { + auto ret = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorResourceContention); + EXPECT_OK(ret); + + auto sessionId = openSession(); + vector initData; + KeyedVector optionalParameters; + KeyRequest result; + ret = drmPlugin->getKeyRequest(sessionId, initData, kVideoMp4, KeyType::STREAMING, + optionalParameters, &result); + EXPECT_TXN(ret); + EXPECT_EQ(Status::ERROR_DRM_RESOURCE_CONTENTION, DrmErr(ret)); + + ret = drmPlugin->closeSession(sessionId); + EXPECT_TXN(ret); + EXPECT_NE(Status::OK, DrmErr(ret)); +} + +/** + * Test clearkey plugin offline key with mock error + */ +TEST_P(DrmHalClearkeyTest, OfflineLicenseInvalidState) { + auto sessionId = openSession(); + vector keySetId = loadKeys(sessionId, KeyType::OFFLINE); + auto ret = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorInvalidState); + EXPECT_OK(ret); + + // everything should start failing + const Status kInvalidState = Status::ERROR_DRM_INVALID_STATE; + vector result; + ret = drmPlugin->getOfflineLicenseKeySetIds(&result); + EXPECT_TXN(ret); + EXPECT_EQ(kInvalidState, DrmErr(ret)); + EXPECT_EQ(0u, result.size()); + + OfflineLicenseState state = OfflineLicenseState::UNKNOWN; + ret = drmPlugin->getOfflineLicenseState({keySetId}, &state); + EXPECT_TXN(ret); + EXPECT_EQ(kInvalidState, DrmErr(ret)); + EXPECT_EQ(OfflineLicenseState::UNKNOWN, state); + + ret = drmPlugin->removeOfflineLicense({keySetId}); + EXPECT_TXN(ret); + EXPECT_EQ(kInvalidState, DrmErr(ret)); + closeSession(sessionId); +} + +/** + * Test listener is triggered on key response + */ +TEST_P(DrmHalClearkeyTest, ListenerCallbacks) { + auto listener = ndk::SharedRefBase::make(); + auto res = drmPlugin->setListener(listener); + EXPECT_OK(res); + + auto sessionId = openSession(); + loadKeys(sessionId, KeyType::STREAMING); + closeSession(sessionId); + + auto args = listener->getEventArgs(); + EXPECT_EQ(EventType::VENDOR_DEFINED, args.eventType); + EXPECT_EQ(sessionId, args.data); + EXPECT_EQ(sessionId, args.sessionId); + + args = listener->getExpirationUpdateArgs(); + EXPECT_EQ(sessionId, args.sessionId); + EXPECT_EQ(100, args.expiryTimeInMS); + + args = listener->getKeysChangeArgs(); + const vector keyStatusList = { + {{0xa, 0xb, 0xc}, KeyStatusType::USABLE}, + {{0xd, 0xe, 0xf}, KeyStatusType::EXPIRED}, + {{0x0, 0x1, 0x2}, KeyStatusType::USABLE_IN_FUTURE}, + }; + EXPECT_EQ(sessionId, args.sessionId); + EXPECT_EQ(keyStatusList, args.keyStatusList); + EXPECT_TRUE(args.hasNewUsableKey); +} + +/** + * Test SessionLostState is triggered on error + */ +TEST_P(DrmHalClearkeyTest, SessionLostState) { + auto listener = ndk::SharedRefBase::make(); + auto res = drmPlugin->setListener(listener); + EXPECT_OK(res); + + res = drmPlugin->setPropertyString(kDrmErrorTestKey, kDrmErrorInvalidState); + EXPECT_OK(res); + + auto sessionId = openSession(); + auto ret = drmPlugin->closeSession(sessionId); + + auto args = listener->getSessionLostStateArgs(); + EXPECT_EQ(sessionId, args.sessionId); +} + +/** + * Negative decrypt test. Decrypt with invalid key. + */ +TEST_P(DrmHalClearkeyTest, DecryptWithEmptyKey) { + vector iv(AES_BLOCK_SIZE, 0); + const Pattern noPattern = {0, 0}; + const uint32_t kClearBytes = 512; + const uint32_t kEncryptedBytes = 512; + const vector subSamples = { + {.numBytesOfClearData = kClearBytes, .numBytesOfEncryptedData = kEncryptedBytes}}; + + // base 64 encoded JSON response string, must not contain padding character '=' + const string emptyKeyResponse = + "{\"keys\":[" + "{" + "\"kty\":\"oct\"" + "\"alg\":\"A128KW2\"" + "\"k\":\"SGVsbG8gRnJpZW5kIQ\"" + "\"kid\":\"Y2xlYXJrZXlrZXlpZDAyAy\"" + "}" + "{" + "\"kty\":\"oct\"," + "\"alg\":\"A128KW2\"" + "\"kid\":\"Y2xlYXJrZXlrZXlpZDAzAy\"," // empty key follows + "\"k\":\"R\"" + "}]" + "}"; + const size_t kEmptyKeyResponseSize = emptyKeyResponse.size(); + + vector invalidResponse; + invalidResponse.resize(kEmptyKeyResponseSize); + memcpy(invalidResponse.data(), emptyKeyResponse.c_str(), kEmptyKeyResponseSize); + decryptWithInvalidKeys(invalidResponse, iv, noPattern, subSamples); +} + +/** + * Negative decrypt test. Decrypt with a key exceeds AES_BLOCK_SIZE. + */ +TEST_P(DrmHalClearkeyTest, DecryptWithKeyTooLong) { + vector iv(AES_BLOCK_SIZE, 0); + const Pattern noPattern = {0, 0}; + const uint32_t kClearBytes = 512; + const uint32_t kEncryptedBytes = 512; + const vector subSamples = { + {.numBytesOfClearData = kClearBytes, .numBytesOfEncryptedData = kEncryptedBytes}}; + + // base 64 encoded JSON response string, must not contain padding character '=' + const string keyTooLongResponse = + "{\"keys\":[" + "{" + "\"kty\":\"oct\"," + "\"alg\":\"A128KW2\"" + "\"kid\":\"Y2xlYXJrZXlrZXlpZDAzAy\"," // key too long + "\"k\":\"V2lubmllIHRoZSBwb29oIVdpbm5pZSB0aGUgcG9vaCE=\"" + "}]" + "}"; + const size_t kKeyTooLongResponseSize = keyTooLongResponse.size(); + + vector invalidResponse; + invalidResponse.resize(kKeyTooLongResponseSize); + memcpy(invalidResponse.data(), keyTooLongResponse.c_str(), kKeyTooLongResponseSize); + decryptWithInvalidKeys(invalidResponse, iv, noPattern, subSamples); +} diff --git a/drm/aidl/vts/drm_hal_test_main.cpp b/drm/aidl/vts/drm_hal_test_main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..833a51aeed5a63bb110cdcc9fef7c362b97c51d0 --- /dev/null +++ b/drm/aidl/vts/drm_hal_test_main.cpp @@ -0,0 +1,86 @@ +/* + * 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. + */ + +/** + * Instantiate the set of test cases for each vendor module + */ + +#define LOG_TAG "drm_hal_test_main" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "drm_hal_common.h" + +using ::aidl::android::hardware::drm::vts::DrmHalClearkeyTest; +using ::aidl::android::hardware::drm::vts::DrmHalTest; +using ::aidl::android::hardware::drm::vts::HalBaseName; +using drm_vts::DrmHalTestParam; +using drm_vts::PrintParamInstanceToString; + +static const std::vector getAllInstances() { + using ::aidl::android::hardware::drm::IDrmFactory; + + std::vector drmInstances = + android::getAidlHalInstanceNames(IDrmFactory::descriptor); + + std::set allInstances; + for (auto svc : drmInstances) { + allInstances.insert(HalBaseName(svc)); + } + + std::vector allInstanceUuidCombos; + auto noUUID = [](std::string s) { return DrmHalTestParam(s); }; + std::transform(allInstances.begin(), allInstances.end(), + std::back_inserter(allInstanceUuidCombos), noUUID); + return allInstanceUuidCombos; +}; + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalTest); +INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalTest, testing::ValuesIn(getAllInstances()), + PrintParamInstanceToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DrmHalClearkeyTest); +INSTANTIATE_TEST_SUITE_P(PerInstance, DrmHalClearkeyTest, testing::ValuesIn(getAllInstances()), + PrintParamInstanceToString); + +int main(int argc, char** argv) { +#if defined(__LP64__) + const char* kModulePath = "/data/local/tmp/64/lib"; +#else + const char* kModulePath = "/data/local/tmp/32/lib"; +#endif + DrmHalTest::gVendorModules = new drm_vts::VendorModules(kModulePath); + if (DrmHalTest::gVendorModules->getPathList().size() == 0) { + std::cerr << "WARNING: No vendor modules found in " << kModulePath + << ", all vendor tests will be skipped" << std::endl; + } + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + ::testing::InitGoogleTest(&argc, argv); + int status = RUN_ALL_TESTS(); + ALOGI("Test result = %d", status); + return status; +} diff --git a/drm/aidl/vts/include/drm_hal_common.h b/drm/aidl/vts/include/drm_hal_common.h new file mode 100644 index 0000000000000000000000000000000000000000..d493bed05a7cb82bee7f58edddeeb662f95bdc25 --- /dev/null +++ b/drm/aidl/vts/include/drm_hal_common.h @@ -0,0 +1,217 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "VtsHalHidlTargetCallbackBase.h" +#include "drm_hal_vendor_module_api.h" +#include "drm_vts_helper.h" +#include "vendor_modules.h" + +using drm_vts::DrmHalTestParam; + +namespace { +typedef vector<::aidl::android::hardware::drm::KeyValue> KeyedVector; +typedef std::vector SessionId; +} // namespace + +#define EXPECT_OK(ret) EXPECT_TRUE(::aidl::android::hardware::drm::vts::IsOk(ret)) +#define EXPECT_TXN(ret) EXPECT_TRUE(ret.isOk() || ret.getExceptionCode() == EX_SERVICE_SPECIFIC) + +namespace aidl { +namespace android { +namespace hardware { +namespace drm { +namespace vts { + +using ::testing::AnyOf; +using ::testing::Eq; + +::aidl::android::hardware::drm::Status DrmErr(const ::ndk::ScopedAStatus& ret); +std::string HalBaseName(const std::string& fullname); +std::string HalFullName(const std::string& iface, const std::string& basename); +testing::AssertionResult IsOk(const ::ndk::ScopedAStatus& ret); + +extern const char* kDrmIface; +extern const char* kCryptoIface; + +class DrmHalTest : public ::testing::TestWithParam { + public: + static drm_vts::VendorModules* gVendorModules; + DrmHalTest(); + virtual void SetUp() override; + virtual void TearDown() override {} + + protected: + ::aidl::android::hardware::drm::Uuid getAidlUUID(); + std::vector getUUID(); + std::vector getVendorUUID(); + std::array GetParamUUID() { return GetParam().scheme_; } + std::string GetParamService() { return GetParam().instance_; } + ::aidl::android::hardware::drm::Uuid toAidlUuid(const std::vector& in_uuid) { + std::array a; + std::copy_n(in_uuid.begin(), a.size(), a.begin()); + return {a}; + } + + bool isCryptoSchemeSupported(::aidl::android::hardware::drm::Uuid uuid, + ::aidl::android::hardware::drm::SecurityLevel level, + std::string mime); + void provision(); + SessionId openSession(::aidl::android::hardware::drm::SecurityLevel level, + ::aidl::android::hardware::drm::Status* err); + SessionId openSession(); + void closeSession(const SessionId& sessionId); + std::vector loadKeys( + const SessionId& sessionId, + const ::aidl::android::hardware::drm::KeyType& type = KeyType::STREAMING); + std::vector loadKeys( + const SessionId& sessionId, const DrmHalVTSVendorModule_V1::ContentConfiguration&, + const ::aidl::android::hardware::drm::KeyType& type = KeyType::STREAMING); + std::vector getKeyRequest(const SessionId& sessionId, + const DrmHalVTSVendorModule_V1::ContentConfiguration&, + const ::aidl::android::hardware::drm::KeyType& type); + std::vector provideKeyResponse(const SessionId& sessionId, + const std::vector& keyResponse); + DrmHalVTSVendorModule_V1::ContentConfiguration getContent( + const ::aidl::android::hardware::drm::KeyType& type = KeyType::STREAMING) const; + + KeyedVector toAidlKeyedVector(const std::map& params); + std::array toStdArray(const std::vector& vec); + uint8_t* fillRandom(const ::aidl::android::hardware::drm::SharedBuffer& buf); + void getDecryptMemory(size_t size, size_t index, SharedBuffer& buf); + + uint32_t decrypt(::aidl::android::hardware::drm::Mode mode, bool isSecure, + const std::array& keyId, uint8_t* iv, + const std::vector<::aidl::android::hardware::drm::SubSample>& subSamples, + const ::aidl::android::hardware::drm::Pattern& pattern, + const std::vector& key, + ::aidl::android::hardware::drm::Status expectedStatus); + void aes_ctr_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv, + const std::vector<::aidl::android::hardware::drm::SubSample>& subSamples, + const std::vector& key); + void aes_cbc_decrypt(uint8_t* dest, uint8_t* src, uint8_t* iv, + const std::vector<::aidl::android::hardware::drm::SubSample>& subSamples, + const std::vector& key); + + std::shared_ptr<::aidl::android::hardware::drm::IDrmFactory> drmFactory; + std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> drmPlugin; + std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> cryptoPlugin; + + unique_ptr vendorModule; + std::vector contentConfigurations; + + private: + std::shared_ptr<::aidl::android::hardware::drm::IDrmPlugin> createDrmPlugin(); + std::shared_ptr<::aidl::android::hardware::drm::ICryptoPlugin> createCryptoPlugin(); +}; + +class DrmHalClearkeyTest : public DrmHalTest { + public: + virtual void SetUp() override { + DrmHalTest::SetUp(); + auto kClearKeyUUID = toAidlUuid({0xE2, 0x71, 0x9D, 0x58, 0xA9, 0x85, 0xB3, 0xC9, + 0x78, 0x1A, 0xB0, 0x30, 0xAF, 0x78, 0xD3, 0x0E}); + static const std::string kMimeType = "video/mp4"; + static constexpr ::aidl::android::hardware::drm::SecurityLevel kSecurityLevel = + ::aidl::android::hardware::drm::SecurityLevel::SW_SECURE_CRYPTO; + + if (!isCryptoSchemeSupported(kClearKeyUUID, kSecurityLevel, kMimeType)) { + GTEST_SKIP() << "ClearKey not supported by " << GetParamService(); + } + } + virtual void TearDown() override {} + void decryptWithInvalidKeys( + std::vector& invalidResponse, std::vector& iv, + const ::aidl::android::hardware::drm::Pattern& noPattern, + const std::vector<::aidl::android::hardware::drm::SubSample>& subSamples); +}; + +/** + * Event Handling tests + */ +extern const char* kCallbackLostState; +extern const char* kCallbackKeysChange; + +struct ListenerArgs { + EventType eventType; + SessionId sessionId; + int64_t expiryTimeInMS; + std::vector data; + std::vector keyStatusList; + bool hasNewUsableKey; +}; + +class DrmHalPluginListener : public BnDrmPluginListener { + public: + DrmHalPluginListener() {} + virtual ~DrmHalPluginListener() {} + + virtual ::ndk::ScopedAStatus onEvent( + ::aidl::android::hardware::drm::EventType in_eventType, + const std::vector& in_sessionId, + const std::vector& in_data) override; + + virtual ::ndk::ScopedAStatus onExpirationUpdate( + const std::vector& in_sessionId, + int64_t in_expiryTimeInMS) override; + + virtual ::ndk::ScopedAStatus onSessionLostState( + const std::vector& in_sessionId) override; + + virtual ::ndk::ScopedAStatus onKeysChange( + const std::vector& in_sessionId, + const std::vector<::aidl::android::hardware::drm::KeyStatus>& in_keyStatusList, + bool in_hasNewUsableKey) override; + + ListenerArgs getEventArgs(); + ListenerArgs getExpirationUpdateArgs(); + ListenerArgs getSessionLostStateArgs(); + ListenerArgs getKeysChangeArgs(); + + private: + ListenerArgs getListenerArgs(std::promise& promise); + std::promise eventPromise, expirationUpdatePromise, + sessionLostStatePromise, keysChangePromise; +}; + +} // namespace vts +} // namespace drm +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/dumpstate/aidl/Android.bp b/dumpstate/aidl/Android.bp index 4de5da390a80c6ecd47c9676c09c360be57b1077..63670bb0aba21d2e47e8227c2392c0fdcabf8597 100644 --- a/dumpstate/aidl/Android.bp +++ b/dumpstate/aidl/Android.bp @@ -34,4 +34,11 @@ aidl_interface { enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + } diff --git a/dumpstate/aidl/aidl_api/android.hardware.dumpstate/1/.hash b/dumpstate/aidl/aidl_api/android.hardware.dumpstate/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..d5c42266e9d788659cb718ff2b7d9fc660da0605 --- /dev/null +++ b/dumpstate/aidl/aidl_api/android.hardware.dumpstate/1/.hash @@ -0,0 +1 @@ +d7c8d1b9054ec2fb0510edb68b95ca69fd038719 diff --git a/dumpstate/aidl/aidl_api/android.hardware.dumpstate/1/android/hardware/dumpstate/IDumpstateDevice.aidl b/dumpstate/aidl/aidl_api/android.hardware.dumpstate/1/android/hardware/dumpstate/IDumpstateDevice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4d78a4c09ccc36b2adb321017f5c2909eeb762c9 --- /dev/null +++ b/dumpstate/aidl/aidl_api/android.hardware.dumpstate/1/android/hardware/dumpstate/IDumpstateDevice.aidl @@ -0,0 +1,53 @@ +/* + * 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 -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.dumpstate; +@VintfStability +interface IDumpstateDevice { + void dumpstateBoard(in ParcelFileDescriptor[] fd, in android.hardware.dumpstate.IDumpstateDevice.DumpstateMode mode, in long timeoutMillis); + boolean getVerboseLoggingEnabled(); + void setVerboseLoggingEnabled(in boolean enable); + const int ERROR_UNSUPPORTED_MODE = 1; + const int ERROR_DEVICE_LOGGING_NOT_ENABLED = 2; + @Backing(type="int") @VintfStability + enum DumpstateMode { + FULL = 0, + INTERACTIVE = 1, + REMOTE = 2, + WEAR = 3, + CONNECTIVITY = 4, + WIFI = 5, + DEFAULT = 6, + PROTO = 7, + } +} diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp index 3c9c29a7d629cfd6a448012421ef110b0ca1c1df..a73182edb60e1215c2a1d7bae9527b6fdaf80628 100644 --- a/gnss/1.1/default/Android.bp +++ b/gnss/1.1/default/Android.bp @@ -27,7 +27,7 @@ cc_binary { "android.hardware.gnss@2.0", "android.hardware.gnss@1.1", "android.hardware.gnss@1.0", - "android.hardware.gnss-V1-ndk", + "android.hardware.gnss-V2-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp index c59d5e7a64e59a84966912e2258b88d9549c23a3..f8fad94a34b404fd2ac195f2dd7cda80e1cfe7fb 100644 --- a/gnss/1.1/vts/functional/Android.bp +++ b/gnss/1.1/vts/functional/Android.bp @@ -36,6 +36,7 @@ cc_test { "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", "android.hardware.gnss@common-vts-lib", + "android.hardware.gnss-V2-cpp", ], shared_libs: [ "android.hardware.gnss.measurement_corrections@1.0", diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp index 695246ad530dc6ff5e6dfb1cccfe90d628d0c11b..769e8ae167ad500435ec8ba59954cc306bf48810 100644 --- a/gnss/2.0/default/Android.bp +++ b/gnss/2.0/default/Android.bp @@ -50,7 +50,7 @@ cc_binary { "android.hardware.gnss@2.0", "android.hardware.gnss@1.1", "android.hardware.gnss@1.0", - "android.hardware.gnss-V1-ndk", + "android.hardware.gnss-V2-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp index 3bbd572841b7543d1e79f33414eb0724fe374764..2042dd9f17a30b7b94e73fa96f729e3cf0480003 100644 --- a/gnss/2.0/vts/functional/Android.bp +++ b/gnss/2.0/vts/functional/Android.bp @@ -39,6 +39,10 @@ cc_test { "android.hardware.gnss@2.0", "android.hardware.gnss@2.1", "android.hardware.gnss@common-vts-lib", + "android.hardware.gnss-V2-cpp", + ], + test_suites: [ + "general-tests", + "vts", ], - test_suites: ["general-tests", "vts"], } diff --git a/gnss/2.1/default/Android.bp b/gnss/2.1/default/Android.bp index c46c73545c89759128b1948826ac8a97283ffc2b..2979f5c9b7279a55098f5b3097249d989549045f 100644 --- a/gnss/2.1/default/Android.bp +++ b/gnss/2.1/default/Android.bp @@ -44,7 +44,7 @@ cc_binary { "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", - "android.hardware.gnss-V1-ndk", + "android.hardware.gnss-V2-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/2.1/vts/functional/Android.bp b/gnss/2.1/vts/functional/Android.bp index aaddd96f8caca24ad3c7b29f72fa66bede6c589e..d7b6eebbe946f0e91fce22c22df2ed5ac4509e1f 100644 --- a/gnss/2.1/vts/functional/Android.bp +++ b/gnss/2.1/vts/functional/Android.bp @@ -40,6 +40,7 @@ cc_test { "android.hardware.gnss@2.0", "android.hardware.gnss@2.1", "android.hardware.gnss@common-vts-lib", + "android.hardware.gnss-V2-cpp", ], shared_libs: [ "libvintf", diff --git a/gnss/aidl/Android.bp b/gnss/aidl/Android.bp index 3797c69daa21f3434e2b4820d30baac946714bab..f45fe5d54b2da7d8b49044e061bc38a61a4e7a1b 100644 --- a/gnss/aidl/Android.bp +++ b/gnss/aidl/Android.bp @@ -26,12 +26,27 @@ package { aidl_interface { name: "android.hardware.gnss", vendor_available: true, - srcs: ["android/hardware/gnss/*.aidl"], + srcs: [ + "android/hardware/gnss/*.aidl", + "android/hardware/gnss/measurement_corrections/*.aidl", + "android/hardware/gnss/visibility_control/*.aidl", + ], stability: "vintf", backend: { java: { platform_apis: true, }, }, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: [], + }, + { + version: "2", + imports: [], + }, + + ], + } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/.hash b/gnss/aidl/aidl_api/android.hardware.gnss/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..0e529bbd67ca725c524f5ba4bda7746712f891a8 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/.hash @@ -0,0 +1 @@ +fc957f1d3d261d065ff5e5415f2d21caa79c310f diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/BlocklistedSource.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ccb2b281db62be6a7602dc495d34ac850cc21a41 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/BlocklistedSource.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable BlocklistedSource { + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; + int svid; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/CorrelationVector.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/CorrelationVector.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b9590036db999b62f8c9823f2b43d11f51da68dd --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/CorrelationVector.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable CorrelationVector { + double frequencyOffsetMps; + double samplingWidthM; + double samplingStartM; + int[] magnitude; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/ElapsedRealtime.aidl new file mode 100644 index 0000000000000000000000000000000000000000..559ed2915f59410924a1d59d81dba4406b9a90a1 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/ElapsedRealtime.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable ElapsedRealtime { + int flags; + long timestampNs; + double timeUncertaintyNs; + const int HAS_TIMESTAMP_NS = 1; + const int HAS_TIME_UNCERTAINTY_NS = 2; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssClock.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a8454ddfc04a3f16a3c00e86fe57ddb936e6280e --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssClock.aidl @@ -0,0 +1,56 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable GnssClock { + int gnssClockFlags; + int leapSecond; + long timeNs; + double timeUncertaintyNs; + long fullBiasNs; + double biasNs; + double biasUncertaintyNs; + double driftNsps; + double driftUncertaintyNsps; + int hwClockDiscontinuityCount; + android.hardware.gnss.GnssSignalType referenceSignalTypeForIsb; + const int HAS_LEAP_SECOND = 1; + const int HAS_TIME_UNCERTAINTY = 2; + const int HAS_FULL_BIAS = 4; + const int HAS_BIAS = 8; + const int HAS_BIAS_UNCERTAINTY = 16; + const int HAS_DRIFT = 32; + const int HAS_DRIFT_UNCERTAINTY = 64; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssConstellationType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssConstellationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fee2ef67c3650411860c25e58af7b6ec4ff1863a --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssConstellationType.aidl @@ -0,0 +1,46 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@Backing(type="int") @VintfStability +enum GnssConstellationType { + UNKNOWN = 0, + GPS = 1, + SBAS = 2, + GLONASS = 3, + QZSS = 4, + BEIDOU = 5, + GALILEO = 6, + IRNSS = 7, +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssData.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..31426f050716a4fd10ee0c701e6b7250a03a76c3 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssData.aidl @@ -0,0 +1,48 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable GnssData { + android.hardware.gnss.GnssMeasurement[] measurements; + android.hardware.gnss.GnssClock clock; + android.hardware.gnss.ElapsedRealtime elapsedRealtime; + android.hardware.gnss.GnssData.GnssAgc[] gnssAgcs = {}; + @VintfStability + parcelable GnssAgc { + double agcLevelDb; + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; + long carrierFrequencyHz; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssLocation.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ed9dcfa96781d877c2b41fdfbe9a41c840a50067 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssLocation.aidl @@ -0,0 +1,58 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable GnssLocation { + int gnssLocationFlags; + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double speedMetersPerSec; + double bearingDegrees; + double horizontalAccuracyMeters; + double verticalAccuracyMeters; + double speedAccuracyMetersPerSecond; + double bearingAccuracyDegrees; + long timestampMillis; + android.hardware.gnss.ElapsedRealtime elapsedRealtime; + const int HAS_LAT_LONG = 1; + const int HAS_ALTITUDE = 2; + const int HAS_SPEED = 4; + const int HAS_BEARING = 8; + const int HAS_HORIZONTAL_ACCURACY = 16; + const int HAS_VERTICAL_ACCURACY = 32; + const int HAS_SPEED_ACCURACY = 64; + const int HAS_BEARING_ACCURACY = 128; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssMeasurement.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8a448874196a9a9b32d59e68a9dbc1a42c900ba0 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssMeasurement.aidl @@ -0,0 +1,99 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable GnssMeasurement { + int flags; + int svid; + android.hardware.gnss.GnssSignalType signalType; + double timeOffsetNs; + int state; + long receivedSvTimeInNs; + long receivedSvTimeUncertaintyInNs; + double antennaCN0DbHz; + double basebandCN0DbHz; + double pseudorangeRateMps; + double pseudorangeRateUncertaintyMps; + int accumulatedDeltaRangeState; + double accumulatedDeltaRangeM; + double accumulatedDeltaRangeUncertaintyM; + long carrierCycles; + double carrierPhase; + double carrierPhaseUncertainty; + android.hardware.gnss.GnssMultipathIndicator multipathIndicator = android.hardware.gnss.GnssMultipathIndicator.UNKNOWN; + double snrDb; + double agcLevelDb; + double fullInterSignalBiasNs; + double fullInterSignalBiasUncertaintyNs; + double satelliteInterSignalBiasNs; + double satelliteInterSignalBiasUncertaintyNs; + android.hardware.gnss.SatellitePvt satellitePvt; + android.hardware.gnss.CorrelationVector[] correlationVectors; + const int HAS_SNR = 1; + const int HAS_CARRIER_FREQUENCY = 512; + const int HAS_CARRIER_CYCLES = 1024; + const int HAS_CARRIER_PHASE = 2048; + const int HAS_CARRIER_PHASE_UNCERTAINTY = 4096; + const int HAS_AUTOMATIC_GAIN_CONTROL = 8192; + const int HAS_FULL_ISB = 65536; + const int HAS_FULL_ISB_UNCERTAINTY = 131072; + const int HAS_SATELLITE_ISB = 262144; + const int HAS_SATELLITE_ISB_UNCERTAINTY = 524288; + const int HAS_SATELLITE_PVT = 1048576; + const int HAS_CORRELATION_VECTOR = 2097152; + const int STATE_UNKNOWN = 0; + const int STATE_CODE_LOCK = 1; + const int STATE_BIT_SYNC = 2; + const int STATE_SUBFRAME_SYNC = 4; + const int STATE_TOW_DECODED = 8; + const int STATE_MSEC_AMBIGUOUS = 16; + const int STATE_SYMBOL_SYNC = 32; + const int STATE_GLO_STRING_SYNC = 64; + const int STATE_GLO_TOD_DECODED = 128; + const int STATE_BDS_D2_BIT_SYNC = 256; + const int STATE_BDS_D2_SUBFRAME_SYNC = 512; + const int STATE_GAL_E1BC_CODE_LOCK = 1024; + const int STATE_GAL_E1C_2ND_CODE_LOCK = 2048; + const int STATE_GAL_E1B_PAGE_SYNC = 4096; + const int STATE_SBAS_SYNC = 8192; + const int STATE_TOW_KNOWN = 16384; + const int STATE_GLO_TOD_KNOWN = 32768; + const int STATE_2ND_CODE_LOCK = 65536; + const int ADR_STATE_UNKNOWN = 0; + const int ADR_STATE_VALID = 1; + const int ADR_STATE_RESET = 2; + const int ADR_STATE_CYCLE_SLIP = 4; + const int ADR_STATE_HALF_CYCLE_RESOLVED = 8; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssMultipathIndicator.aidl new file mode 100644 index 0000000000000000000000000000000000000000..62ade9c3e8f2ee48abda16c86a61f8a1235634de --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssMultipathIndicator.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@Backing(type="int") @VintfStability +enum GnssMultipathIndicator { + UNKNOWN = 0, + PRESENT = 1, + NOT_PRESENT = 2, +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssPowerStats.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssPowerStats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c4a9e6179e75aba3957807dea0d0ee841fc16deb --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssPowerStats.aidl @@ -0,0 +1,45 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable GnssPowerStats { + android.hardware.gnss.ElapsedRealtime elapsedRealtime; + double totalEnergyMilliJoule; + double singlebandTrackingModeEnergyMilliJoule; + double multibandTrackingModeEnergyMilliJoule; + double singlebandAcquisitionModeEnergyMilliJoule; + double multibandAcquisitionModeEnergyMilliJoule; + double[] otherModesEnergyMilliJoule; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssSignalType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4a49547b496b187c43f13fac452a05357bbdfbbe --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/GnssSignalType.aidl @@ -0,0 +1,57 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable GnssSignalType { + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; + double carrierFrequencyHz; + @utf8InCpp String codeType; + const @utf8InCpp String CODE_TYPE_A = "A"; + const @utf8InCpp String CODE_TYPE_B = "B"; + const @utf8InCpp String CODE_TYPE_C = "C"; + const @utf8InCpp String CODE_TYPE_D = "D"; + const @utf8InCpp String CODE_TYPE_I = "I"; + const @utf8InCpp String CODE_TYPE_L = "L"; + const @utf8InCpp String CODE_TYPE_M = "M"; + const @utf8InCpp String CODE_TYPE_N = "N"; + const @utf8InCpp String CODE_TYPE_P = "P"; + const @utf8InCpp String CODE_TYPE_Q = "Q"; + const @utf8InCpp String CODE_TYPE_S = "S"; + const @utf8InCpp String CODE_TYPE_W = "W"; + const @utf8InCpp String CODE_TYPE_X = "X"; + const @utf8InCpp String CODE_TYPE_Y = "Y"; + const @utf8InCpp String CODE_TYPE_Z = "Z"; + const @utf8InCpp String CODE_TYPE_UNKNOWN = "UNKNOWN"; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnss.aidl new file mode 100644 index 0000000000000000000000000000000000000000..639539ad655c41f4e739ff17ce045a2dd72066b1 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnss.aidl @@ -0,0 +1,50 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnss { + void setCallback(in android.hardware.gnss.IAGnssCallback callback); + void dataConnClosed(); + void dataConnFailed(); + void setServer(in android.hardware.gnss.IAGnssCallback.AGnssType type, in @utf8InCpp String hostname, in int port); + void dataConnOpen(in long networkHandle, in @utf8InCpp String apn, in android.hardware.gnss.IAGnss.ApnIpType apnIpType); + @Backing(type="int") @VintfStability + enum ApnIpType { + INVALID = 0, + IPV4 = 1, + IPV6 = 2, + IPV4V6 = 3, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b2da8d9583f845ba916d85c5eda597f2f9b42030 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssCallback.aidl @@ -0,0 +1,54 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnssCallback { + void agnssStatusCb(in android.hardware.gnss.IAGnssCallback.AGnssType type, in android.hardware.gnss.IAGnssCallback.AGnssStatusValue status); + @Backing(type="int") @VintfStability + enum AGnssType { + SUPL = 1, + C2K = 2, + SUPL_EIMS = 3, + SUPL_IMS = 4, + } + @Backing(type="int") @VintfStability + enum AGnssStatusValue { + REQUEST_AGNSS_DATA_CONN = 1, + RELEASE_AGNSS_DATA_CONN = 2, + AGNSS_DATA_CONNECTED = 3, + AGNSS_DATA_CONN_DONE = 4, + AGNSS_DATA_CONN_FAILED = 5, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssRil.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8930752f7fa82a1f9942aedcec11150fa09c25ee --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssRil.aidl @@ -0,0 +1,80 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnssRil { + void setCallback(in android.hardware.gnss.IAGnssRilCallback callback); + void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation); + void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid); + void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes); + const int NETWORK_CAPABILITY_NOT_METERED = 1; + const int NETWORK_CAPABILITY_NOT_ROAMING = 2; + @Backing(type="int") @VintfStability + enum AGnssRefLocationType { + GSM_CELLID = 1, + UMTS_CELLID = 2, + LTE_CELLID = 4, + NR_CELLID = 8, + } + @Backing(type="int") @VintfStability + enum SetIdType { + NONE = 0, + IMSI = 1, + MSISDM = 2, + } + @VintfStability + parcelable AGnssRefLocationCellID { + android.hardware.gnss.IAGnssRil.AGnssRefLocationType type; + int mcc; + int mnc; + int lac; + long cid; + int tac; + int pcid; + int arfcn; + } + @VintfStability + parcelable AGnssRefLocation { + android.hardware.gnss.IAGnssRil.AGnssRefLocationType type; + android.hardware.gnss.IAGnssRil.AGnssRefLocationCellID cellID; + } + @VintfStability + parcelable NetworkAttributes { + long networkHandle; + boolean isConnected; + int capabilities; + @utf8InCpp String apn; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssRilCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssRilCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3717026622856c171e235ba1e52c90068003e212 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IAGnssRilCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnssRilCallback { + void requestSetIdCb(in int setIdflag); + void requestRefLocCb(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnss.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0e6405ea7ccbe32843a2aa16e6d3704c8e492f20 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnss.aidl @@ -0,0 +1,103 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnss { + void setCallback(in android.hardware.gnss.IGnssCallback callback); + void close(); + @nullable android.hardware.gnss.IGnssPsds getExtensionPsds(); + android.hardware.gnss.IGnssConfiguration getExtensionGnssConfiguration(); + android.hardware.gnss.IGnssMeasurementInterface getExtensionGnssMeasurement(); + android.hardware.gnss.IGnssPowerIndication getExtensionGnssPowerIndication(); + @nullable android.hardware.gnss.IGnssBatching getExtensionGnssBatching(); + @nullable android.hardware.gnss.IGnssGeofence getExtensionGnssGeofence(); + @nullable android.hardware.gnss.IGnssNavigationMessageInterface getExtensionGnssNavigationMessage(); + android.hardware.gnss.IAGnss getExtensionAGnss(); + android.hardware.gnss.IAGnssRil getExtensionAGnssRil(); + android.hardware.gnss.IGnssDebug getExtensionGnssDebug(); + android.hardware.gnss.visibility_control.IGnssVisibilityControl getExtensionGnssVisibilityControl(); + void start(); + void stop(); + void injectTime(in long timeMs, in long timeReferenceMs, in int uncertaintyMs); + void injectLocation(in android.hardware.gnss.GnssLocation location); + void injectBestLocation(in android.hardware.gnss.GnssLocation location); + void deleteAidingData(in android.hardware.gnss.IGnss.GnssAidingData aidingDataFlags); + void setPositionMode(in android.hardware.gnss.IGnss.PositionModeOptions options); + android.hardware.gnss.IGnssAntennaInfo getExtensionGnssAntennaInfo(); + @nullable android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsInterface getExtensionMeasurementCorrections(); + void startSvStatus(); + void stopSvStatus(); + void startNmea(); + void stopNmea(); + const int ERROR_INVALID_ARGUMENT = 1; + const int ERROR_ALREADY_INIT = 2; + const int ERROR_GENERIC = 3; + @Backing(type="int") @VintfStability + enum GnssPositionMode { + STANDALONE = 0, + MS_BASED = 1, + MS_ASSISTED = 2, + } + @Backing(type="int") @VintfStability + enum GnssPositionRecurrence { + RECURRENCE_PERIODIC = 0, + RECURRENCE_SINGLE = 1, + } + @Backing(type="int") @VintfStability + enum GnssAidingData { + EPHEMERIS = 1, + ALMANAC = 2, + POSITION = 4, + TIME = 8, + IONO = 16, + UTC = 32, + HEALTH = 64, + SVDIR = 128, + SVSTEER = 256, + SADATA = 512, + RTI = 1024, + CELLDB_INFO = 32768, + ALL = 65535, + } + @VintfStability + parcelable PositionModeOptions { + android.hardware.gnss.IGnss.GnssPositionMode mode; + android.hardware.gnss.IGnss.GnssPositionRecurrence recurrence; + int minIntervalMs; + int preferredAccuracyMeters; + int preferredTimeMs; + boolean lowPowerMode; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssAntennaInfo.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssAntennaInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..43ad328e5c9552f51054818277e299d948aa0309 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssAntennaInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssAntennaInfo { + void setCallback(in android.hardware.gnss.IGnssAntennaInfoCallback callback); + void close(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssAntennaInfoCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssAntennaInfoCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..eb6abe55f8d2117d123bc5c44ca637fc66b55a98 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssAntennaInfoCallback.aidl @@ -0,0 +1,61 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssAntennaInfoCallback { + void gnssAntennaInfoCb(in android.hardware.gnss.IGnssAntennaInfoCallback.GnssAntennaInfo[] gnssAntennaInfos); + @VintfStability + parcelable Row { + double[] row; + } + @VintfStability + parcelable Coord { + double x; + double xUncertainty; + double y; + double yUncertainty; + double z; + double zUncertainty; + } + @VintfStability + parcelable GnssAntennaInfo { + long carrierFrequencyHz; + android.hardware.gnss.IGnssAntennaInfoCallback.Coord phaseCenterOffsetCoordinateMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] phaseCenterVariationCorrectionMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] phaseCenterVariationCorrectionUncertaintyMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] signalGainCorrectionDbi; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] signalGainCorrectionUncertaintyDbi; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssBatching.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssBatching.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d82aa1fe07db58048ab8598ae15aa397a87415d5 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssBatching.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssBatching { + void init(in android.hardware.gnss.IGnssBatchingCallback callback); + int getBatchSize(); + void start(in android.hardware.gnss.IGnssBatching.Options options); + void flush(); + void stop(); + void cleanup(); + const int WAKEUP_ON_FIFO_FULL = 1; + @VintfStability + parcelable Options { + long periodNanos; + float minDistanceMeters; + int flags; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssBatchingCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssBatchingCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b12a8bd51946bbd022b44588b57b9a5be87445e0 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssBatchingCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssBatchingCallback { + void gnssLocationBatchCb(in android.hardware.gnss.GnssLocation[] locations); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..48c88f5ffe3217dd19afa116a67db715d80c11dd --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssCallback.aidl @@ -0,0 +1,95 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssCallback { + void gnssSetCapabilitiesCb(in int capabilities); + void gnssStatusCb(in android.hardware.gnss.IGnssCallback.GnssStatusValue status); + void gnssSvStatusCb(in android.hardware.gnss.IGnssCallback.GnssSvInfo[] svInfoList); + void gnssLocationCb(in android.hardware.gnss.GnssLocation location); + void gnssNmeaCb(in long timestamp, in @utf8InCpp String nmea); + void gnssAcquireWakelockCb(); + void gnssReleaseWakelockCb(); + void gnssSetSystemInfoCb(in android.hardware.gnss.IGnssCallback.GnssSystemInfo info); + void gnssRequestTimeCb(); + void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency); + const int CAPABILITY_SCHEDULING = 1; + const int CAPABILITY_MSB = 2; + const int CAPABILITY_MSA = 4; + const int CAPABILITY_SINGLE_SHOT = 8; + const int CAPABILITY_ON_DEMAND_TIME = 16; + const int CAPABILITY_GEOFENCING = 32; + const int CAPABILITY_MEASUREMENTS = 64; + const int CAPABILITY_NAV_MESSAGES = 128; + const int CAPABILITY_LOW_POWER_MODE = 256; + const int CAPABILITY_SATELLITE_BLOCKLIST = 512; + const int CAPABILITY_MEASUREMENT_CORRECTIONS = 1024; + const int CAPABILITY_ANTENNA_INFO = 2048; + const int CAPABILITY_CORRELATION_VECTOR = 4096; + const int CAPABILITY_SATELLITE_PVT = 8192; + const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = 16384; + @Backing(type="int") @VintfStability + enum GnssStatusValue { + NONE = 0, + SESSION_BEGIN = 1, + SESSION_END = 2, + ENGINE_ON = 3, + ENGINE_OFF = 4, + } + @Backing(type="int") @VintfStability + enum GnssSvFlags { + NONE = 0, + HAS_EPHEMERIS_DATA = 1, + HAS_ALMANAC_DATA = 2, + USED_IN_FIX = 4, + HAS_CARRIER_FREQUENCY = 8, + } + @VintfStability + parcelable GnssSvInfo { + int svid; + android.hardware.gnss.GnssConstellationType constellation; + float cN0Dbhz; + float basebandCN0DbHz; + float elevationDegrees; + float azimuthDegrees; + long carrierFrequencyHz; + int svFlag; + } + @VintfStability + parcelable GnssSystemInfo { + int yearOfHw; + @utf8InCpp String name; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssConfiguration.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssConfiguration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1d6399e52ba172965a9b84fd3194b1e0a740bd4f --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssConfiguration.aidl @@ -0,0 +1,52 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssConfiguration { + void setSuplVersion(in int version); + void setSuplMode(in int mode); + void setLppProfile(in int lppProfile); + void setGlonassPositioningProtocol(in int protocol); + void setEmergencySuplPdn(in boolean enable); + void setEsExtensionSec(in int emergencyExtensionSeconds); + void setBlocklist(in android.hardware.gnss.BlocklistedSource[] blocklist); + const int SUPL_MODE_MSB = 1; + const int SUPL_MODE_MSA = 2; + const int LPP_PROFILE_USER_PLANE = 1; + const int LPP_PROFILE_CONTROL_PLANE = 2; + const int GLONASS_POS_PROTOCOL_RRC_CPLANE = 1; + const int GLONASS_POS_PROTOCOL_RRLP_UPLANE = 2; + const int GLONASS_POS_PROTOCOL_LPP_UPLANE = 4; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssDebug.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssDebug.aidl new file mode 100644 index 0000000000000000000000000000000000000000..591b53301fce636b29267cacfeaae0d2d1d3b54e --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssDebug.aidl @@ -0,0 +1,88 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssDebug { + android.hardware.gnss.IGnssDebug.DebugData getDebugData(); + @Backing(type="int") @VintfStability + enum SatelliteEphemerisType { + EPHEMERIS = 0, + ALMANAC_ONLY = 1, + NOT_AVAILABLE = 2, + } + @Backing(type="int") @VintfStability + enum SatelliteEphemerisHealth { + GOOD = 0, + BAD = 1, + UNKNOWN = 2, + } + @VintfStability + parcelable TimeDebug { + long timeEstimateMs; + float timeUncertaintyNs; + float frequencyUncertaintyNsPerSec; + } + @VintfStability + parcelable PositionDebug { + boolean valid; + double latitudeDegrees; + double longitudeDegrees; + float altitudeMeters; + float speedMetersPerSec; + float bearingDegrees; + double horizontalAccuracyMeters; + double verticalAccuracyMeters; + double speedAccuracyMetersPerSecond; + double bearingAccuracyDegrees; + float ageSeconds; + } + @VintfStability + parcelable SatelliteData { + int svid; + android.hardware.gnss.GnssConstellationType constellation; + android.hardware.gnss.IGnssDebug.SatelliteEphemerisType ephemerisType; + android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource; + android.hardware.gnss.IGnssDebug.SatelliteEphemerisHealth ephemerisHealth; + float ephemerisAgeSeconds; + boolean serverPredictionIsAvailable; + float serverPredictionAgeSeconds; + } + @VintfStability + parcelable DebugData { + android.hardware.gnss.IGnssDebug.PositionDebug position; + android.hardware.gnss.IGnssDebug.TimeDebug time; + List satelliteDataArray; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssGeofence.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssGeofence.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5065ad49c8a600aaa322b91122432e43b9a55abf --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssGeofence.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssGeofence { + void setCallback(in android.hardware.gnss.IGnssGeofenceCallback callback); + void addGeofence(in int geofenceId, in double latitudeDegrees, in double longitudeDegrees, in double radiusMeters, in int lastTransition, in int monitorTransitions, in int notificationResponsivenessMs, in int unknownTimerMs); + void pauseGeofence(in int geofenceId); + void resumeGeofence(in int geofenceId, in int monitorTransitions); + void removeGeofence(in int geofenceId); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssGeofenceCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssGeofenceCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df5dc2d9194b7f095f8dbb1ce6843e49952e31e4 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssGeofenceCallback.aidl @@ -0,0 +1,55 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssGeofenceCallback { + void gnssGeofenceTransitionCb(in int geofenceId, in android.hardware.gnss.GnssLocation location, in int transition, in long timestampMillis); + void gnssGeofenceStatusCb(in int availability, in android.hardware.gnss.GnssLocation lastLocation); + void gnssGeofenceAddCb(in int geofenceId, in int status); + void gnssGeofenceRemoveCb(in int geofenceId, in int status); + void gnssGeofencePauseCb(in int geofenceId, in int status); + void gnssGeofenceResumeCb(in int geofenceId, in int status); + const int ENTERED = 1; + const int EXITED = 2; + const int UNCERTAIN = 4; + const int UNAVAILABLE = 1; + const int AVAILABLE = 2; + const int OPERATION_SUCCESS = 0; + const int ERROR_TOO_MANY_GEOFENCES = -100; + const int ERROR_ID_EXISTS = -101; + const int ERROR_ID_UNKNOWN = -102; + const int ERROR_INVALID_TRANSITION = -103; + const int ERROR_GENERIC = -149; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssMeasurementCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..624a7ae84d99bf935f2a0955474517c5b9c4f27f --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssMeasurementCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssMeasurementCallback { + void gnssMeasurementCb(in android.hardware.gnss.GnssData data); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssMeasurementInterface.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6fe6a6c6fd0b67c135c3279dc8154636b0ecdff3 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssMeasurementInterface.aidl @@ -0,0 +1,47 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssMeasurementInterface { + void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking, in boolean enableCorrVecOutputs); + void close(); + void setCallbackWithOptions(in android.hardware.gnss.IGnssMeasurementCallback callback, in android.hardware.gnss.IGnssMeasurementInterface.Options options); + @VintfStability + parcelable Options { + boolean enableFullTracking; + boolean enableCorrVecOutputs; + int intervalMs; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssNavigationMessageCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssNavigationMessageCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c65cff21be6073230f04560f9743920037072e7f --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssNavigationMessageCallback.aidl @@ -0,0 +1,69 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssNavigationMessageCallback { + void gnssNavigationMessageCb(in android.hardware.gnss.IGnssNavigationMessageCallback.GnssNavigationMessage message); + @VintfStability + parcelable GnssNavigationMessage { + int svid; + android.hardware.gnss.IGnssNavigationMessageCallback.GnssNavigationMessage.GnssNavigationMessageType type; + int status; + int messageId; + int submessageId; + byte[] data; + const int STATUS_PARITY_PASSED = 1; + const int STATUS_PARITY_REBUILT = 2; + const int STATUS_UNKNOWN = 0; + @Backing(type="int") @VintfStability + enum GnssNavigationMessageType { + UNKNOWN = 0, + GPS_L1CA = 257, + GPS_L2CNAV = 258, + GPS_L5CNAV = 259, + SBS = 513, + GPS_CNAV2 = 260, + GLO_L1CA = 769, + QZS_L1CA = 1025, + BDS_D1 = 1281, + BDS_D2 = 1282, + BDS_CNAV1 = 1283, + BDS_CNAV2 = 1284, + GAL_I = 1537, + GAL_F = 1538, + IRN_L5CA = 1793, + } + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssNavigationMessageInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssNavigationMessageInterface.aidl new file mode 100644 index 0000000000000000000000000000000000000000..187773dd815da321f44bea57ee7ef4ba62d3f471 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssNavigationMessageInterface.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssNavigationMessageInterface { + void setCallback(in android.hardware.gnss.IGnssNavigationMessageCallback callback); + void close(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPowerIndication.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPowerIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f77dbfff86ddf065fa3e68dd15473e394c66a7a7 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPowerIndication.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssPowerIndication { + void setCallback(in android.hardware.gnss.IGnssPowerIndicationCallback callback); + oneway void requestGnssPowerStats(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPowerIndicationCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPowerIndicationCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d35c77fdf19ebb224cddb12c686096a65f951656 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPowerIndicationCallback.aidl @@ -0,0 +1,46 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssPowerIndicationCallback { + void setCapabilitiesCb(in int capabilities); + oneway void gnssPowerStatsCb(in android.hardware.gnss.GnssPowerStats gnssPowerStats); + const int CAPABILITY_TOTAL = 1; + const int CAPABILITY_SINGLEBAND_TRACKING = 2; + const int CAPABILITY_MULTIBAND_TRACKING = 4; + const int CAPABILITY_SINGLEBAND_ACQUISITION = 8; + const int CAPABILITY_MULTIBAND_ACQUISITION = 16; + const int CAPABILITY_OTHER_MODES = 32; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPsds.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPsds.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3aee798b3345b6cfa6d79ee7264a88de88de4f45 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPsds.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssPsds { + void injectPsdsData(in android.hardware.gnss.PsdsType psdsType, in byte[] psdsData); + void setCallback(in android.hardware.gnss.IGnssPsdsCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPsdsCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPsdsCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dadc9fb092900626dee750a1c704520f57276e23 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/IGnssPsdsCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssPsdsCallback { + void downloadRequestCb(in android.hardware.gnss.PsdsType psdsType); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/PsdsType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/PsdsType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..60b15d63eb4fd39249c311cf4ccca603f8bb8664 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/PsdsType.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@Backing(type="int") @VintfStability +enum PsdsType { + LONG_TERM = 1, + NORMAL = 2, + REALTIME = 3, +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatelliteClockInfo.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatelliteClockInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..05f773328083d81e77f517e7b7f9815a07193b5f --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatelliteClockInfo.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable SatelliteClockInfo { + double satHardwareCodeBiasMeters; + double satTimeCorrectionMeters; + double satClkDriftMps; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatellitePositionEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatellitePositionEcef.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3d4f7ff6e21677e1745952b2b62dad3d30e77c61 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatellitePositionEcef.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable SatellitePositionEcef { + double posXMeters; + double posYMeters; + double posZMeters; + double ureMeters; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatellitePvt.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5fd411fa843fdbc50601375bff1178ffe63fe830 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatellitePvt.aidl @@ -0,0 +1,59 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable SatellitePvt { + int flags; + android.hardware.gnss.SatellitePositionEcef satPosEcef; + android.hardware.gnss.SatelliteVelocityEcef satVelEcef; + android.hardware.gnss.SatelliteClockInfo satClockInfo; + double ionoDelayMeters; + double tropoDelayMeters; + long timeOfClockSeconds; + int issueOfDataClock; + long timeOfEphemerisSeconds; + int issueOfDataEphemeris; + android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource = android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource.OTHER; + const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1; + const int HAS_IONO = 2; + const int HAS_TROPO = 4; + @Backing(type="int") @VintfStability + enum SatelliteEphemerisSource { + DEMODULATED = 0, + SERVER_NORMAL = 1, + SERVER_LONG_TERM = 2, + OTHER = 3, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatelliteVelocityEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatelliteVelocityEcef.aidl new file mode 100644 index 0000000000000000000000000000000000000000..94d0b344b7cbf3e05a189de5be2477e18d7079d7 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/SatelliteVelocityEcef.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable SatelliteVelocityEcef { + double velXMps; + double velYMps; + double velZMps; + double ureRateMps; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4126702a2de934d4f31f923fb81b9a023c772245 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +interface IMeasurementCorrectionsCallback { + void setCapabilitiesCb(in int capabilities); + const int CAPABILITY_LOS_SATS = 1; + const int CAPABILITY_EXCESS_PATH_LENGTH = 2; + const int CAPABILITY_REFLECTING_PLANE = 4; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bd305345f656907593424fa667de11879f5064b1 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +interface IMeasurementCorrectionsInterface { + void setCorrections(in android.hardware.gnss.measurement_corrections.MeasurementCorrections corrections); + void setCallback(in android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35fd79e57e7252862323642f42c5eb64af1463f7 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable MeasurementCorrections { + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double horizontalPositionUncertaintyMeters; + double verticalPositionUncertaintyMeters; + long toaGpsNanosecondsOfWeek; + android.hardware.gnss.measurement_corrections.SingleSatCorrection[] satCorrections; + boolean hasEnvironmentBearing; + float environmentBearingDegrees; + float environmentBearingUncertaintyDegrees; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl new file mode 100644 index 0000000000000000000000000000000000000000..90c9e033360abc13dd39382f9f7b712ba4a5b98d --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable ReflectingPlane { + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double reflectingPlaneAzimuthDegrees; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ebbe6846e95fd1bdb12c5cb456c3c1d80d021775 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl @@ -0,0 +1,63 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable SingleSatCorrection { + int singleSatCorrectionFlags; + android.hardware.gnss.GnssConstellationType constellation; + int svid; + long carrierFrequencyHz; + float probSatIsLos; + float combinedExcessPathLengthMeters; + float combinedExcessPathLengthUncertaintyMeters; + float combinedAttenuationDb; + android.hardware.gnss.measurement_corrections.SingleSatCorrection.ExcessPathInfo[] excessPathInfos; + const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 1; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH = 2; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC = 4; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION = 16; + @VintfStability + parcelable ExcessPathInfo { + int excessPathInfoFlags; + float excessPathLengthMeters; + float excessPathLengthUncertaintyMeters; + android.hardware.gnss.measurement_corrections.ReflectingPlane reflectingPlane; + float attenuationDb; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH = 1; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC = 2; + const int EXCESS_PATH_INFO_HAS_REFLECTING_PLANE = 4; + const int EXCESS_PATH_INFO_HAS_ATTENUATION = 8; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d7a7a9651f700264bdb0e0898071cae6442a4435 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss.visibility_control; +/* @hide */ +@VintfStability +interface IGnssVisibilityControl { + void enableNfwLocationAccess(in @utf8InCpp String[] proxyApps); + void setCallback(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c9b96f50bb383ea28739bb486db0a97e7c1c8094 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/2/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl @@ -0,0 +1,75 @@ +/* + * 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 -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.gnss.visibility_control; +/* @hide */ +@VintfStability +interface IGnssVisibilityControlCallback { + void nfwNotifyCb(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwNotification notification); + boolean isInEmergencySession(); + @Backing(type="int") @VintfStability + enum NfwProtocolStack { + CTRL_PLANE = 0, + SUPL = 1, + IMS = 10, + SIM = 11, + OTHER_PROTOCOL_STACK = 100, + } + @Backing(type="int") @VintfStability + enum NfwRequestor { + CARRIER = 0, + OEM = 10, + MODEM_CHIPSET_VENDOR = 11, + GNSS_CHIPSET_VENDOR = 12, + OTHER_CHIPSET_VENDOR = 13, + AUTOMOBILE_CLIENT = 20, + OTHER_REQUESTOR = 100, + } + @Backing(type="int") @VintfStability + enum NfwResponseType { + REJECTED = 0, + ACCEPTED_NO_LOCATION_PROVIDED = 1, + ACCEPTED_LOCATION_PROVIDED = 2, + } + @VintfStability + parcelable NfwNotification { + String proxyAppPackageName; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwProtocolStack protocolStack; + String otherProtocolStackName; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwRequestor requestor; + String requestorId; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwResponseType responseType; + boolean inEmergencyMode; + boolean isCachedLocation; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl index a4f00971c5ceb9005c08f6d9931f4af9deb22475..ccb2b281db62be6a7602dc495d34ac850cc21a41 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable BlocklistedSource { android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl index b0848bb9c4ba76badd49a551d8d7d20280bdff95..b9590036db999b62f8c9823f2b43d11f51da68dd 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/CorrelationVector.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable CorrelationVector { double frequencyOffsetMps; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl index 7d3baa41f2ceef0ca4b762eb39574ca2ea026f09..559ed2915f59410924a1d59d81dba4406b9a90a1 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/ElapsedRealtime.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable ElapsedRealtime { int flags; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl index c54cc2c50097f3c92c9686f5fa9b3800f3ed9f99..a8454ddfc04a3f16a3c00e86fe57ddb936e6280e 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssClock.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable GnssClock { int gnssClockFlags; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssConstellationType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssConstellationType.aidl index c1fcfcc741547e41994136319a50f42d11c52d29..fee2ef67c3650411860c25e58af7b6ec4ff1863a 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssConstellationType.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssConstellationType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @Backing(type="int") @VintfStability enum GnssConstellationType { UNKNOWN = 0, diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl index ebb5d0bdff51955797d74a026b7539de3d5d2c94..31426f050716a4fd10ee0c701e6b7250a03a76c3 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl @@ -32,9 +32,17 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable GnssData { android.hardware.gnss.GnssMeasurement[] measurements; android.hardware.gnss.GnssClock clock; android.hardware.gnss.ElapsedRealtime elapsedRealtime; + android.hardware.gnss.GnssData.GnssAgc[] gnssAgcs = {}; + @VintfStability + parcelable GnssAgc { + double agcLevelDb; + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; + long carrierFrequencyHz; + } } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssLocation.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ed9dcfa96781d877c2b41fdfbe9a41c840a50067 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssLocation.aidl @@ -0,0 +1,58 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +parcelable GnssLocation { + int gnssLocationFlags; + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double speedMetersPerSec; + double bearingDegrees; + double horizontalAccuracyMeters; + double verticalAccuracyMeters; + double speedAccuracyMetersPerSecond; + double bearingAccuracyDegrees; + long timestampMillis; + android.hardware.gnss.ElapsedRealtime elapsedRealtime; + const int HAS_LAT_LONG = 1; + const int HAS_ALTITUDE = 2; + const int HAS_SPEED = 4; + const int HAS_BEARING = 8; + const int HAS_HORIZONTAL_ACCURACY = 16; + const int HAS_VERTICAL_ACCURACY = 32; + const int HAS_SPEED_ACCURACY = 64; + const int HAS_BEARING_ACCURACY = 128; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl index 948c540fc319f40ceb255643cc6a5e5316c2da4d..8a448874196a9a9b32d59e68a9dbc1a42c900ba0 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable GnssMeasurement { int flags; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl index 24f45c42fa32cdcd1a945bc6181556012db94738..62ade9c3e8f2ee48abda16c86a61f8a1235634de 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMultipathIndicator.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @Backing(type="int") @VintfStability enum GnssMultipathIndicator { UNKNOWN = 0, diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssPowerStats.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssPowerStats.aidl index 670244fd1f68edaa51ce3c88a3dce26c7314fe7d..c4a9e6179e75aba3957807dea0d0ee841fc16deb 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssPowerStats.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssPowerStats.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable GnssPowerStats { android.hardware.gnss.ElapsedRealtime elapsedRealtime; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl index c2a5b51e15f02b9625f8b1be1d59bbd5e2c75c78..4a49547b496b187c43f13fac452a05357bbdfbbe 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable GnssSignalType { android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnss.aidl new file mode 100644 index 0000000000000000000000000000000000000000..639539ad655c41f4e739ff17ce045a2dd72066b1 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnss.aidl @@ -0,0 +1,50 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnss { + void setCallback(in android.hardware.gnss.IAGnssCallback callback); + void dataConnClosed(); + void dataConnFailed(); + void setServer(in android.hardware.gnss.IAGnssCallback.AGnssType type, in @utf8InCpp String hostname, in int port); + void dataConnOpen(in long networkHandle, in @utf8InCpp String apn, in android.hardware.gnss.IAGnss.ApnIpType apnIpType); + @Backing(type="int") @VintfStability + enum ApnIpType { + INVALID = 0, + IPV4 = 1, + IPV6 = 2, + IPV4V6 = 3, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b2da8d9583f845ba916d85c5eda597f2f9b42030 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssCallback.aidl @@ -0,0 +1,54 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnssCallback { + void agnssStatusCb(in android.hardware.gnss.IAGnssCallback.AGnssType type, in android.hardware.gnss.IAGnssCallback.AGnssStatusValue status); + @Backing(type="int") @VintfStability + enum AGnssType { + SUPL = 1, + C2K = 2, + SUPL_EIMS = 3, + SUPL_IMS = 4, + } + @Backing(type="int") @VintfStability + enum AGnssStatusValue { + REQUEST_AGNSS_DATA_CONN = 1, + RELEASE_AGNSS_DATA_CONN = 2, + AGNSS_DATA_CONNECTED = 3, + AGNSS_DATA_CONN_DONE = 4, + AGNSS_DATA_CONN_FAILED = 5, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8930752f7fa82a1f9942aedcec11150fa09c25ee --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl @@ -0,0 +1,80 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnssRil { + void setCallback(in android.hardware.gnss.IAGnssRilCallback callback); + void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation); + void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid); + void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes); + const int NETWORK_CAPABILITY_NOT_METERED = 1; + const int NETWORK_CAPABILITY_NOT_ROAMING = 2; + @Backing(type="int") @VintfStability + enum AGnssRefLocationType { + GSM_CELLID = 1, + UMTS_CELLID = 2, + LTE_CELLID = 4, + NR_CELLID = 8, + } + @Backing(type="int") @VintfStability + enum SetIdType { + NONE = 0, + IMSI = 1, + MSISDM = 2, + } + @VintfStability + parcelable AGnssRefLocationCellID { + android.hardware.gnss.IAGnssRil.AGnssRefLocationType type; + int mcc; + int mnc; + int lac; + long cid; + int tac; + int pcid; + int arfcn; + } + @VintfStability + parcelable AGnssRefLocation { + android.hardware.gnss.IAGnssRil.AGnssRefLocationType type; + android.hardware.gnss.IAGnssRil.AGnssRefLocationCellID cellID; + } + @VintfStability + parcelable NetworkAttributes { + long networkHandle; + boolean isConnected; + int capabilities; + @utf8InCpp String apn; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRilCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRilCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3717026622856c171e235ba1e52c90068003e212 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRilCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.gnss; +/* @hide */ +@VintfStability +interface IAGnssRilCallback { + void requestSetIdCb(in int setIdflag); + void requestRefLocCb(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl index f93b496cddb941d159fc80e75955d6e8d958120b..0e6405ea7ccbe32843a2aa16e6d3704c8e492f20 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnss.aidl @@ -32,15 +32,72 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnss { void setCallback(in android.hardware.gnss.IGnssCallback callback); void close(); - android.hardware.gnss.IGnssPsds getExtensionPsds(); + @nullable android.hardware.gnss.IGnssPsds getExtensionPsds(); android.hardware.gnss.IGnssConfiguration getExtensionGnssConfiguration(); android.hardware.gnss.IGnssMeasurementInterface getExtensionGnssMeasurement(); android.hardware.gnss.IGnssPowerIndication getExtensionGnssPowerIndication(); + @nullable android.hardware.gnss.IGnssBatching getExtensionGnssBatching(); + @nullable android.hardware.gnss.IGnssGeofence getExtensionGnssGeofence(); + @nullable android.hardware.gnss.IGnssNavigationMessageInterface getExtensionGnssNavigationMessage(); + android.hardware.gnss.IAGnss getExtensionAGnss(); + android.hardware.gnss.IAGnssRil getExtensionAGnssRil(); + android.hardware.gnss.IGnssDebug getExtensionGnssDebug(); + android.hardware.gnss.visibility_control.IGnssVisibilityControl getExtensionGnssVisibilityControl(); + void start(); + void stop(); + void injectTime(in long timeMs, in long timeReferenceMs, in int uncertaintyMs); + void injectLocation(in android.hardware.gnss.GnssLocation location); + void injectBestLocation(in android.hardware.gnss.GnssLocation location); + void deleteAidingData(in android.hardware.gnss.IGnss.GnssAidingData aidingDataFlags); + void setPositionMode(in android.hardware.gnss.IGnss.PositionModeOptions options); + android.hardware.gnss.IGnssAntennaInfo getExtensionGnssAntennaInfo(); + @nullable android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsInterface getExtensionMeasurementCorrections(); + void startSvStatus(); + void stopSvStatus(); + void startNmea(); + void stopNmea(); const int ERROR_INVALID_ARGUMENT = 1; const int ERROR_ALREADY_INIT = 2; const int ERROR_GENERIC = 3; + @Backing(type="int") @VintfStability + enum GnssPositionMode { + STANDALONE = 0, + MS_BASED = 1, + MS_ASSISTED = 2, + } + @Backing(type="int") @VintfStability + enum GnssPositionRecurrence { + RECURRENCE_PERIODIC = 0, + RECURRENCE_SINGLE = 1, + } + @Backing(type="int") @VintfStability + enum GnssAidingData { + EPHEMERIS = 1, + ALMANAC = 2, + POSITION = 4, + TIME = 8, + IONO = 16, + UTC = 32, + HEALTH = 64, + SVDIR = 128, + SVSTEER = 256, + SADATA = 512, + RTI = 1024, + CELLDB_INFO = 32768, + ALL = 65535, + } + @VintfStability + parcelable PositionModeOptions { + android.hardware.gnss.IGnss.GnssPositionMode mode; + android.hardware.gnss.IGnss.GnssPositionRecurrence recurrence; + int minIntervalMs; + int preferredAccuracyMeters; + int preferredTimeMs; + boolean lowPowerMode; + } } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssAntennaInfo.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssAntennaInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..43ad328e5c9552f51054818277e299d948aa0309 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssAntennaInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssAntennaInfo { + void setCallback(in android.hardware.gnss.IGnssAntennaInfoCallback callback); + void close(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssAntennaInfoCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssAntennaInfoCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..eb6abe55f8d2117d123bc5c44ca637fc66b55a98 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssAntennaInfoCallback.aidl @@ -0,0 +1,61 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssAntennaInfoCallback { + void gnssAntennaInfoCb(in android.hardware.gnss.IGnssAntennaInfoCallback.GnssAntennaInfo[] gnssAntennaInfos); + @VintfStability + parcelable Row { + double[] row; + } + @VintfStability + parcelable Coord { + double x; + double xUncertainty; + double y; + double yUncertainty; + double z; + double zUncertainty; + } + @VintfStability + parcelable GnssAntennaInfo { + long carrierFrequencyHz; + android.hardware.gnss.IGnssAntennaInfoCallback.Coord phaseCenterOffsetCoordinateMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] phaseCenterVariationCorrectionMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] phaseCenterVariationCorrectionUncertaintyMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] signalGainCorrectionDbi; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] signalGainCorrectionUncertaintyDbi; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d82aa1fe07db58048ab8598ae15aa397a87415d5 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatching.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssBatching { + void init(in android.hardware.gnss.IGnssBatchingCallback callback); + int getBatchSize(); + void start(in android.hardware.gnss.IGnssBatching.Options options); + void flush(); + void stop(); + void cleanup(); + const int WAKEUP_ON_FIFO_FULL = 1; + @VintfStability + parcelable Options { + long periodNanos; + float minDistanceMeters; + int flags; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatchingCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatchingCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b12a8bd51946bbd022b44588b57b9a5be87445e0 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssBatchingCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssBatchingCallback { + void gnssLocationBatchCb(in android.hardware.gnss.GnssLocation[] locations); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl index fb0931c59adc66f0b85de99a4896104a69fa8c5f..48c88f5ffe3217dd19afa116a67db715d80c11dd 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl @@ -32,11 +32,64 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssCallback { void gnssSetCapabilitiesCb(in int capabilities); + void gnssStatusCb(in android.hardware.gnss.IGnssCallback.GnssStatusValue status); + void gnssSvStatusCb(in android.hardware.gnss.IGnssCallback.GnssSvInfo[] svInfoList); + void gnssLocationCb(in android.hardware.gnss.GnssLocation location); + void gnssNmeaCb(in long timestamp, in @utf8InCpp String nmea); + void gnssAcquireWakelockCb(); + void gnssReleaseWakelockCb(); + void gnssSetSystemInfoCb(in android.hardware.gnss.IGnssCallback.GnssSystemInfo info); + void gnssRequestTimeCb(); + void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency); + const int CAPABILITY_SCHEDULING = 1; + const int CAPABILITY_MSB = 2; + const int CAPABILITY_MSA = 4; + const int CAPABILITY_SINGLE_SHOT = 8; + const int CAPABILITY_ON_DEMAND_TIME = 16; + const int CAPABILITY_GEOFENCING = 32; + const int CAPABILITY_MEASUREMENTS = 64; + const int CAPABILITY_NAV_MESSAGES = 128; + const int CAPABILITY_LOW_POWER_MODE = 256; const int CAPABILITY_SATELLITE_BLOCKLIST = 512; + const int CAPABILITY_MEASUREMENT_CORRECTIONS = 1024; + const int CAPABILITY_ANTENNA_INFO = 2048; const int CAPABILITY_CORRELATION_VECTOR = 4096; const int CAPABILITY_SATELLITE_PVT = 8192; const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = 16384; + @Backing(type="int") @VintfStability + enum GnssStatusValue { + NONE = 0, + SESSION_BEGIN = 1, + SESSION_END = 2, + ENGINE_ON = 3, + ENGINE_OFF = 4, + } + @Backing(type="int") @VintfStability + enum GnssSvFlags { + NONE = 0, + HAS_EPHEMERIS_DATA = 1, + HAS_ALMANAC_DATA = 2, + USED_IN_FIX = 4, + HAS_CARRIER_FREQUENCY = 8, + } + @VintfStability + parcelable GnssSvInfo { + int svid; + android.hardware.gnss.GnssConstellationType constellation; + float cN0Dbhz; + float basebandCN0DbHz; + float elevationDegrees; + float azimuthDegrees; + long carrierFrequencyHz; + int svFlag; + } + @VintfStability + parcelable GnssSystemInfo { + int yearOfHw; + @utf8InCpp String name; + } } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl index 54cd022f66b14e5de4d06ca785a460586a215c5b..1d6399e52ba172965a9b84fd3194b1e0a740bd4f 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssConfiguration.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssConfiguration { void setSuplVersion(in int version); diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssDebug.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssDebug.aidl new file mode 100644 index 0000000000000000000000000000000000000000..591b53301fce636b29267cacfeaae0d2d1d3b54e --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssDebug.aidl @@ -0,0 +1,88 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssDebug { + android.hardware.gnss.IGnssDebug.DebugData getDebugData(); + @Backing(type="int") @VintfStability + enum SatelliteEphemerisType { + EPHEMERIS = 0, + ALMANAC_ONLY = 1, + NOT_AVAILABLE = 2, + } + @Backing(type="int") @VintfStability + enum SatelliteEphemerisHealth { + GOOD = 0, + BAD = 1, + UNKNOWN = 2, + } + @VintfStability + parcelable TimeDebug { + long timeEstimateMs; + float timeUncertaintyNs; + float frequencyUncertaintyNsPerSec; + } + @VintfStability + parcelable PositionDebug { + boolean valid; + double latitudeDegrees; + double longitudeDegrees; + float altitudeMeters; + float speedMetersPerSec; + float bearingDegrees; + double horizontalAccuracyMeters; + double verticalAccuracyMeters; + double speedAccuracyMetersPerSecond; + double bearingAccuracyDegrees; + float ageSeconds; + } + @VintfStability + parcelable SatelliteData { + int svid; + android.hardware.gnss.GnssConstellationType constellation; + android.hardware.gnss.IGnssDebug.SatelliteEphemerisType ephemerisType; + android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource; + android.hardware.gnss.IGnssDebug.SatelliteEphemerisHealth ephemerisHealth; + float ephemerisAgeSeconds; + boolean serverPredictionIsAvailable; + float serverPredictionAgeSeconds; + } + @VintfStability + parcelable DebugData { + android.hardware.gnss.IGnssDebug.PositionDebug position; + android.hardware.gnss.IGnssDebug.TimeDebug time; + List satelliteDataArray; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofence.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofence.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5065ad49c8a600aaa322b91122432e43b9a55abf --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofence.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssGeofence { + void setCallback(in android.hardware.gnss.IGnssGeofenceCallback callback); + void addGeofence(in int geofenceId, in double latitudeDegrees, in double longitudeDegrees, in double radiusMeters, in int lastTransition, in int monitorTransitions, in int notificationResponsivenessMs, in int unknownTimerMs); + void pauseGeofence(in int geofenceId); + void resumeGeofence(in int geofenceId, in int monitorTransitions); + void removeGeofence(in int geofenceId); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofenceCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofenceCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df5dc2d9194b7f095f8dbb1ce6843e49952e31e4 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssGeofenceCallback.aidl @@ -0,0 +1,55 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssGeofenceCallback { + void gnssGeofenceTransitionCb(in int geofenceId, in android.hardware.gnss.GnssLocation location, in int transition, in long timestampMillis); + void gnssGeofenceStatusCb(in int availability, in android.hardware.gnss.GnssLocation lastLocation); + void gnssGeofenceAddCb(in int geofenceId, in int status); + void gnssGeofenceRemoveCb(in int geofenceId, in int status); + void gnssGeofencePauseCb(in int geofenceId, in int status); + void gnssGeofenceResumeCb(in int geofenceId, in int status); + const int ENTERED = 1; + const int EXITED = 2; + const int UNCERTAIN = 4; + const int UNAVAILABLE = 1; + const int AVAILABLE = 2; + const int OPERATION_SUCCESS = 0; + const int ERROR_TOO_MANY_GEOFENCES = -100; + const int ERROR_ID_EXISTS = -101; + const int ERROR_ID_UNKNOWN = -102; + const int ERROR_INVALID_TRANSITION = -103; + const int ERROR_GENERIC = -149; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl index 6e626172b9d2f799c77b67f2354d9e05a0268649..624a7ae84d99bf935f2a0955474517c5b9c4f27f 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementCallback.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssMeasurementCallback { void gnssMeasurementCb(in android.hardware.gnss.GnssData data); diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl index 24d6f9c4cf6a6bcdd685d9189d7d9f1a156c9914..6fe6a6c6fd0b67c135c3279dc8154636b0ecdff3 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssMeasurementInterface.aidl @@ -32,8 +32,16 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssMeasurementInterface { void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking, in boolean enableCorrVecOutputs); void close(); + void setCallbackWithOptions(in android.hardware.gnss.IGnssMeasurementCallback callback, in android.hardware.gnss.IGnssMeasurementInterface.Options options); + @VintfStability + parcelable Options { + boolean enableFullTracking; + boolean enableCorrVecOutputs; + int intervalMs; + } } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c65cff21be6073230f04560f9743920037072e7f --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageCallback.aidl @@ -0,0 +1,69 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssNavigationMessageCallback { + void gnssNavigationMessageCb(in android.hardware.gnss.IGnssNavigationMessageCallback.GnssNavigationMessage message); + @VintfStability + parcelable GnssNavigationMessage { + int svid; + android.hardware.gnss.IGnssNavigationMessageCallback.GnssNavigationMessage.GnssNavigationMessageType type; + int status; + int messageId; + int submessageId; + byte[] data; + const int STATUS_PARITY_PASSED = 1; + const int STATUS_PARITY_REBUILT = 2; + const int STATUS_UNKNOWN = 0; + @Backing(type="int") @VintfStability + enum GnssNavigationMessageType { + UNKNOWN = 0, + GPS_L1CA = 257, + GPS_L2CNAV = 258, + GPS_L5CNAV = 259, + SBS = 513, + GPS_CNAV2 = 260, + GLO_L1CA = 769, + QZS_L1CA = 1025, + BDS_D1 = 1281, + BDS_D2 = 1282, + BDS_CNAV1 = 1283, + BDS_CNAV2 = 1284, + GAL_I = 1537, + GAL_F = 1538, + IRN_L5CA = 1793, + } + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageInterface.aidl new file mode 100644 index 0000000000000000000000000000000000000000..187773dd815da321f44bea57ee7ef4ba62d3f471 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssNavigationMessageInterface.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss; +/* @hide */ +@VintfStability +interface IGnssNavigationMessageInterface { + void setCallback(in android.hardware.gnss.IGnssNavigationMessageCallback callback); + void close(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndication.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndication.aidl index fbf1f6ffb600be07edb1ad1105b859fa590df146..f77dbfff86ddf065fa3e68dd15473e394c66a7a7 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndication.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndication.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssPowerIndication { void setCallback(in android.hardware.gnss.IGnssPowerIndicationCallback callback); diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl index bfa787e3e2579df756fba0e7750e2dd4ed6053d1..d35c77fdf19ebb224cddb12c686096a65f951656 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPowerIndicationCallback.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssPowerIndicationCallback { void setCapabilitiesCb(in int capabilities); diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl index 526ecc8fcdfb92171a345aa5501c8a3de6c7c049..3aee798b3345b6cfa6d79ee7264a88de88de4f45 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsds.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssPsds { void injectPsdsData(in android.hardware.gnss.PsdsType psdsType, in byte[] psdsData); diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsdsCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsdsCallback.aidl index 2205bc46dd91868a70f6df572d280221fda72ac0..dadc9fb092900626dee750a1c704520f57276e23 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsdsCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssPsdsCallback.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability interface IGnssPsdsCallback { void downloadRequestCb(in android.hardware.gnss.PsdsType psdsType); diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/PsdsType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/PsdsType.aidl index 727bb6912b9c74468d5778a2f50d36f72f9654be..60b15d63eb4fd39249c311cf4ccca603f8bb8664 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/PsdsType.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/PsdsType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @Backing(type="int") @VintfStability enum PsdsType { LONG_TERM = 1, diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteClockInfo.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteClockInfo.aidl index ed23e639a8a76fc830f456cd167adc934b48bef3..05f773328083d81e77f517e7b7f9815a07193b5f 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteClockInfo.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteClockInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable SatelliteClockInfo { double satHardwareCodeBiasMeters; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePositionEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePositionEcef.aidl index e1a20c378ec5e809859bc3acf847bed492215870..3d4f7ff6e21677e1745952b2b62dad3d30e77c61 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePositionEcef.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePositionEcef.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable SatellitePositionEcef { double posXMeters; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl index 8c1784174d2d75bf8cf3b3dbb0d8a80d4e567c07..5fd411fa843fdbc50601375bff1178ffe63fe830 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable SatellitePvt { int flags; @@ -40,7 +41,19 @@ parcelable SatellitePvt { android.hardware.gnss.SatelliteClockInfo satClockInfo; double ionoDelayMeters; double tropoDelayMeters; + long timeOfClockSeconds; + int issueOfDataClock; + long timeOfEphemerisSeconds; + int issueOfDataEphemeris; + android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource = android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource.OTHER; const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1; const int HAS_IONO = 2; const int HAS_TROPO = 4; + @Backing(type="int") @VintfStability + enum SatelliteEphemerisSource { + DEMODULATED = 0, + SERVER_NORMAL = 1, + SERVER_LONG_TERM = 2, + OTHER = 3, + } } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteVelocityEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteVelocityEcef.aidl index a571048c205fe49375ebe9b0cb3c6a341cd9a87a..94d0b344b7cbf3e05a189de5be2477e18d7079d7 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteVelocityEcef.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatelliteVelocityEcef.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.gnss; +/* @hide */ @VintfStability parcelable SatelliteVelocityEcef { double velXMps; diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4126702a2de934d4f31f923fb81b9a023c772245 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +interface IMeasurementCorrectionsCallback { + void setCapabilitiesCb(in int capabilities); + const int CAPABILITY_LOS_SATS = 1; + const int CAPABILITY_EXCESS_PATH_LENGTH = 2; + const int CAPABILITY_REFLECTING_PLANE = 4; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bd305345f656907593424fa667de11879f5064b1 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +interface IMeasurementCorrectionsInterface { + void setCorrections(in android.hardware.gnss.measurement_corrections.MeasurementCorrections corrections); + void setCallback(in android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl new file mode 100644 index 0000000000000000000000000000000000000000..35fd79e57e7252862323642f42c5eb64af1463f7 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable MeasurementCorrections { + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double horizontalPositionUncertaintyMeters; + double verticalPositionUncertaintyMeters; + long toaGpsNanosecondsOfWeek; + android.hardware.gnss.measurement_corrections.SingleSatCorrection[] satCorrections; + boolean hasEnvironmentBearing; + float environmentBearingDegrees; + float environmentBearingUncertaintyDegrees; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl new file mode 100644 index 0000000000000000000000000000000000000000..90c9e033360abc13dd39382f9f7b712ba4a5b98d --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable ReflectingPlane { + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double reflectingPlaneAzimuthDegrees; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ebbe6846e95fd1bdb12c5cb456c3c1d80d021775 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl @@ -0,0 +1,63 @@ +/* + * 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 -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.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable SingleSatCorrection { + int singleSatCorrectionFlags; + android.hardware.gnss.GnssConstellationType constellation; + int svid; + long carrierFrequencyHz; + float probSatIsLos; + float combinedExcessPathLengthMeters; + float combinedExcessPathLengthUncertaintyMeters; + float combinedAttenuationDb; + android.hardware.gnss.measurement_corrections.SingleSatCorrection.ExcessPathInfo[] excessPathInfos; + const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 1; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH = 2; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC = 4; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION = 16; + @VintfStability + parcelable ExcessPathInfo { + int excessPathInfoFlags; + float excessPathLengthMeters; + float excessPathLengthUncertaintyMeters; + android.hardware.gnss.measurement_corrections.ReflectingPlane reflectingPlane; + float attenuationDb; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH = 1; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC = 2; + const int EXCESS_PATH_INFO_HAS_REFLECTING_PLANE = 4; + const int EXCESS_PATH_INFO_HAS_ATTENUATION = 8; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d7a7a9651f700264bdb0e0898071cae6442a4435 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.gnss.visibility_control; +/* @hide */ +@VintfStability +interface IGnssVisibilityControl { + void enableNfwLocationAccess(in @utf8InCpp String[] proxyApps); + void setCallback(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c9b96f50bb383ea28739bb486db0a97e7c1c8094 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl @@ -0,0 +1,75 @@ +/* + * 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 -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.gnss.visibility_control; +/* @hide */ +@VintfStability +interface IGnssVisibilityControlCallback { + void nfwNotifyCb(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwNotification notification); + boolean isInEmergencySession(); + @Backing(type="int") @VintfStability + enum NfwProtocolStack { + CTRL_PLANE = 0, + SUPL = 1, + IMS = 10, + SIM = 11, + OTHER_PROTOCOL_STACK = 100, + } + @Backing(type="int") @VintfStability + enum NfwRequestor { + CARRIER = 0, + OEM = 10, + MODEM_CHIPSET_VENDOR = 11, + GNSS_CHIPSET_VENDOR = 12, + OTHER_CHIPSET_VENDOR = 13, + AUTOMOBILE_CLIENT = 20, + OTHER_REQUESTOR = 100, + } + @Backing(type="int") @VintfStability + enum NfwResponseType { + REJECTED = 0, + ACCEPTED_NO_LOCATION_PROVIDED = 1, + ACCEPTED_LOCATION_PROVIDED = 2, + } + @VintfStability + parcelable NfwNotification { + String proxyAppPackageName; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwProtocolStack protocolStack; + String otherProtocolStackName; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwRequestor requestor; + String requestorId; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwResponseType responseType; + boolean inEmergencyMode; + boolean isCachedLocation; + } +} diff --git a/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl index 8b730921ffddbb518c06db3832e15b31afb09e25..0c40a49f9b56eb10a274b92fbaebc452ecfff2ac 100644 --- a/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl +++ b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.GnssConstellationType; /** * Represents a blocklisted source. + * + * @hide */ @VintfStability parcelable BlocklistedSource { @@ -33,4 +35,4 @@ parcelable BlocklistedSource { * svid's for the specified constellation. */ int svid; -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl b/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl index 6fbabbc1406dd156ae0b8e48520c8f62bf90bf47..a933c67adde7c5a58561fa348cfe3cf6fe96c15f 100644 --- a/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl +++ b/gnss/aidl/android/hardware/gnss/CorrelationVector.aidl @@ -19,6 +19,8 @@ package android.hardware.gnss; /** * Contains info about the correlation output of incoming GNSS signal and a local copy of * its corresponding spreading code at a given frequency offset. + * + * @hide */ @VintfStability parcelable CorrelationVector { diff --git a/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl index 67d090eb24252facab17369decf4b8b0796a9957..67ecbcb580bcac3accfd56d84fb6aec31c4ed168 100644 --- a/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl +++ b/gnss/aidl/android/hardware/gnss/ElapsedRealtime.aidl @@ -18,6 +18,8 @@ package android.hardware.gnss; /** * Cumulative GNSS power statistics since boot. + * + * @hide */ @VintfStability parcelable ElapsedRealtime { @@ -50,4 +52,4 @@ parcelable ElapsedRealtime { * reported measurements in nanoseconds (68% confidence). */ double timeUncertaintyNs; -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/android/hardware/gnss/GnssClock.aidl index f416e08e5f54b57e95573bbfa93186869ce3f6b0..f5c090bd05e92b9793dbb1a22dc3e5ebe649ac60 100644 --- a/gnss/aidl/android/hardware/gnss/GnssClock.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssClock.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.GnssSignalType; /** * Represents an estimate of the GNSS clock time. + * + * @hide */ @VintfStability parcelable GnssClock { @@ -200,4 +202,4 @@ parcelable GnssClock { * Reference GNSS signal type for inter-signal bias. */ GnssSignalType referenceSignalTypeForIsb; -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/GnssConstellationType.aidl b/gnss/aidl/android/hardware/gnss/GnssConstellationType.aidl index af3e089c5efed8acc41c7164d8bddd69acdb5bcf..2efd1d9fde432f150190a967984d732e7c084a33 100644 --- a/gnss/aidl/android/hardware/gnss/GnssConstellationType.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssConstellationType.aidl @@ -21,6 +21,8 @@ package android.hardware.gnss; * * This is to specify the navigation satellite system, for example, as listed in Section 3.5 in * RINEX Version 3.04. + * + * @hide */ @VintfStability @Backing(type="int") @@ -40,4 +42,4 @@ enum GnssConstellationType { GALILEO = 6, /** Indian Regional Navigation Satellite System. */ IRNSS = 7, -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/GnssData.aidl b/gnss/aidl/android/hardware/gnss/GnssData.aidl index ed30c989f806fc712d28d18d796fa535c746c41e..075a0391e28260afcc52e4136aac0b72fa86512a 100644 --- a/gnss/aidl/android/hardware/gnss/GnssData.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssData.aidl @@ -18,6 +18,7 @@ package android.hardware.gnss; import android.hardware.gnss.ElapsedRealtime; import android.hardware.gnss.GnssClock; +import android.hardware.gnss.GnssConstellationType; import android.hardware.gnss.GnssMeasurement; /** @@ -27,6 +28,8 @@ import android.hardware.gnss.GnssMeasurement; * * - Reporting of GNSS constellation measurements is mandatory. * - Reporting of all tracked constellations are encouraged. + * + * @hide */ @VintfStability parcelable GnssData { @@ -41,4 +44,59 @@ parcelable GnssData { * clock. */ ElapsedRealtime elapsedRealtime; -} \ No newline at end of file + + /** + * Represents a reading of GNSS AGC value of a constellation type and a frequency band. + */ + @VintfStability + parcelable GnssAgc { + /** + * Automatic gain control (AGC) level. AGC acts as a variable gain amplifier adjusting the + * power of the incoming signal. The AGC level may be used to indicate potential + * interference. Higher gain (and/or lower input power) must be output as a positive number. + * Hence in cases of strong jamming, in the band of this signal, this value must go more + * negative. This value must be consistent given the same level of the incoming signal + * power. + * + * Note: Different hardware designs (e.g. antenna, pre-amplification, or other RF HW + * components) may also affect the typical output of this value on any given hardware design + * in an open sky test - the important aspect of this output is that changes in this value + * are indicative of changes on input signal power in the frequency band for this + * measurement. + */ + double agcLevelDb; + + /** + * Constellation type of the SV that transmits the signal. + */ + GnssConstellationType constellation = GnssConstellationType.UNKNOWN; + + /** + * Carrier frequency of the signal tracked, for example it can be the + * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 = + * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it + * is the primary common use central frequency, e.g. L1 = 1575.45 MHz + * for GPS. + * + * If all the GLO frequencies have a common AGC, the FC0 (frequency + * channel number 0) of the individual GLO bands is used to represent + * all the GLO frequencies. + * + * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same + * time, two raw measurement structs must be reported for this same + * satellite, in one of the measurement structs, all the values related + * to L1 must be filled, and in the other all of the values related to + * L5 must be filled. + */ + long carrierFrequencyHz; + } + + /** + * The array of GNSS AGC values. + * + * This field must be reported when the GNSS measurement engine is running, even when the + * GnssMeasurement or GnssClock fields are not reported yet. E.g., when a GNSS signal is too + * weak to be acquired, the AGC value must still be reported. + */ + GnssAgc[] gnssAgcs = {}; +} diff --git a/gnss/aidl/android/hardware/gnss/GnssLocation.aidl b/gnss/aidl/android/hardware/gnss/GnssLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..994685137acc7501306f252c70e23c7bfcf9834f --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/GnssLocation.aidl @@ -0,0 +1,91 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.ElapsedRealtime; + +/** Represents a location. @hide */ +@VintfStability +parcelable GnssLocation { + /** Bit mask to indicate GnssLocation has valid latitude and longitude. */ + const int HAS_LAT_LONG = 0x0001; + /** Bit mask to indicate GnssLocation has valid altitude. */ + const int HAS_ALTITUDE = 0x0002; + /** Bit mask to indicate GnssLocation has valid speed. */ + const int HAS_SPEED = 0x0004; + /** Bit mask to indicate GnssLocation has valid bearing. */ + const int HAS_BEARING = 0x0008; + /** Bit mask to indicate GnssLocation has valid horizontal accuracy. */ + const int HAS_HORIZONTAL_ACCURACY = 0x0010; + /** Bit mask to indicate GnssLocation has valid vertical accuracy. */ + const int HAS_VERTICAL_ACCURACY = 0x0020; + /** Bit mask to indicate GnssLocation has valid speed accuracy. */ + const int HAS_SPEED_ACCURACY = 0x0040; + /** Bit mask to indicate GnssLocation has valid bearing accuracy. */ + const int HAS_BEARING_ACCURACY = 0x0080; + + /** A bit field of flags indicating the validity of the fields in this GnssLocation. */ + int gnssLocationFlags; + + /** Represents latitude in degrees. */ + double latitudeDegrees; + + /** Represents longitude in degrees. */ + double longitudeDegrees; + + /** Represents altitude in meters above the WGS 84 reference ellipsoid. */ + double altitudeMeters; + + /** Represents speed in meters per second. */ + double speedMetersPerSec; + + /** Represents heading in degrees. */ + double bearingDegrees; + + /** + * Represents expected horizontal position accuracy, radial, in meters (68% confidence). + */ + double horizontalAccuracyMeters; + + /** + * Represents expected vertical position accuracy in meters (68% confidence). + */ + double verticalAccuracyMeters; + + /** + * Represents expected speed accuracy in meter per seconds (68% confidence). + */ + double speedAccuracyMetersPerSecond; + + /** + * Represents expected bearing accuracy in degrees (68% confidence). + */ + double bearingAccuracyDegrees; + + /** Timestamp for the location fix in milliseconds since January 1, 1970. */ + long timestampMillis; + + /** + * Timing information of the GNSS location synchronized with SystemClock.elapsedRealtimeNanos() + * clock. + * + * This clock information can be obtained from SystemClock.elapsedRealtimeNanos(), when the GNSS + * is attached straight to the AP/SOC. When it is attached to a separate module the timestamp + * needs to be estimated by syncing the notion of time via PTP or some other mechanism. + */ + ElapsedRealtime elapsedRealtime; +} diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl index efecddd41e3e8ce828cbbf5f0d2c1befc3a83cd8..db724a49c830cb28b938959339a2c7f8e249ea2b 100644 --- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl @@ -28,6 +28,8 @@ import android.hardware.gnss.SatellitePvt; * this struct must be based on GNSS signal measurements only. You must not synthesize measurements * by calculating or reporting expected measurements based on known or estimated position, velocity, * or time. + * + * @hide */ @VintfStability parcelable GnssMeasurement { diff --git a/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl index ec1ce6270501b2c6ea2e7e547f4b072757d530c4..98ffe284f179cc7840de7820163c8e2d2938e8e8 100644 --- a/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssMultipathIndicator.aidl @@ -19,6 +19,8 @@ package android.hardware.gnss; /** * Enumeration of available values for the GNSS Measurement's multipath * indicator. + * + * @hide */ @VintfStability @Backing(type="int") @@ -29,4 +31,4 @@ enum GnssMultipathIndicator { PRESENT = 1, /** The measurement is indicated to be not affected by multipath. */ NOT_PRESENT = 2, -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/GnssPowerStats.aidl b/gnss/aidl/android/hardware/gnss/GnssPowerStats.aidl index 2bea44dbb995e0cd019a4f1e9437d91170e0869f..3f33dd638974d2d9dfe0cf96a24a6e9b87f140a9 100644 --- a/gnss/aidl/android/hardware/gnss/GnssPowerStats.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssPowerStats.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.ElapsedRealtime; /** * Cumulative GNSS power statistics since boot. + * + * @hide */ @VintfStability parcelable GnssPowerStats { @@ -63,4 +65,4 @@ parcelable GnssPowerStats { * operating in each of the vendor-specific power modes. */ double[] otherModesEnergyMilliJoule; -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl index a16b170da4e9c7e80ae00735a39e71d9bb6f4826..241971fe9316e426725a9747e9f90811fac4c101 100644 --- a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.GnssConstellationType; /** * Represents a GNSS signal type. + * + * @hide */ @VintfStability parcelable GnssSignalType { diff --git a/gnss/aidl/android/hardware/gnss/IAGnss.aidl b/gnss/aidl/android/hardware/gnss/IAGnss.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ca67e01ecf29385b98d5b4fea24c0311516af654 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IAGnss.aidl @@ -0,0 +1,84 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.IAGnssCallback; +import android.hardware.gnss.IAGnssCallback.AGnssType; + +/** + * Extended interface for Assisted GNSS support. + * + * @hide + */ +@VintfStability +interface IAGnss { + /** Access point name IP type */ + @VintfStability + @Backing(type="int") + enum ApnIpType { + INVALID = 0, + IPV4 = 1, + IPV6 = 2, + IPV4V6 = 3, + } + + /** + * Opens the AGNSS interface and provides the callback routines to the + * implementation of this interface. + * + * If setCallback is not called, this interface will not respond to any + * other method calls. + * + * @param callback Handle to the AGNSS status callback interface. + */ + void setCallback(in IAGnssCallback callback); + + /** + * Notifies that the AGNSS data connection has been closed. + */ + void dataConnClosed(); + + /** + * Notifies that a data connection is not available for AGNSS. + */ + void dataConnFailed(); + + /** + * Sets the hostname and port for the AGNSS server. + * + * @param type Specifies if SUPL or C2K. + * @param hostname Hostname of the AGNSS server. + * @param port Port number associated with the server. + */ + void setServer(in AGnssType type, in @utf8InCpp String hostname, in int port); + + /** + * Notifies GNSS that a data connection is available and sets the network handle, + * name of the APN, and its IP type to be used for SUPL connections. + * + * The HAL implementation must use the network handle to set the network for the + * SUPL connection sockets using the android_setsocknetwork function. This will ensure + * that there is a network path to the SUPL server. The network handle can also be used + * to get the IP address of SUPL FQDN using the android_getaddrinfofornetwork() function. + * + * @param networkHandle Handle representing the network for use with the NDK API. + * @param apn Access Point Name (follows regular APN naming convention). + * @param apnIpType Specifies IP type of APN. + */ + void dataConnOpen( + in long networkHandle, in @utf8InCpp String apn, in ApnIpType apnIpType); +} diff --git a/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e3a16493f384b22a1a5954c4049bb1e7abf5d804 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IAGnssCallback.aidl @@ -0,0 +1,71 @@ +/* + * 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 android.hardware.gnss; + +/** + * Callback structure for the AGNSS interface. + * + * @hide + */ +@VintfStability +interface IAGnssCallback { + /** AGNSS service type */ + @VintfStability + @Backing(type="int") + enum AGnssType { + // Secure User Plane Location + SUPL = 1, + // CDMA2000 + C2K = 2, + // SUPL, Emergency call over IP Multimedia Subsystem + SUPL_EIMS = 3, + // SUPL, IP Multimedia Subsystem + SUPL_IMS = 4, + } + + /** AGNSS status value */ + @VintfStability + @Backing(type="int") + enum AGnssStatusValue { + /** GNSS requests data connection for AGNSS. */ + REQUEST_AGNSS_DATA_CONN = 1, + + /** GNSS releases the AGNSS data connection. */ + RELEASE_AGNSS_DATA_CONN = 2, + + /** AGNSS data connection initiated */ + AGNSS_DATA_CONNECTED = 3, + + /** AGNSS data connection completed */ + AGNSS_DATA_CONN_DONE = 4, + + /** AGNSS data connection failed */ + AGNSS_DATA_CONN_FAILED = 5, + } + + /** + * Callback with AGNSS status information. + * + * The GNSS HAL implementation must use this method to request the framework to setup + * network connection for the specified AGNSS service and to update the connection + * status so that the framework can release the resources. + * + * @param type Type of AGNSS service. + * @parama status Status of the data connection. + */ + void agnssStatusCb(in AGnssType type, in AGnssStatusValue status); +} diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl new file mode 100644 index 0000000000000000000000000000000000000000..44847f0ab163d05a800648e518fdb25c913a1a9e --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl @@ -0,0 +1,167 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.gnss; + +import android.hardware.gnss.IAGnssRilCallback; + +/** + * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface + * Layer interface allows the GNSS chipset to request radio interface layer + * information from Android platform. Examples of such information are reference + * location, unique subscriber ID, phone number string and network availability changes. + * + * @hide + */ +@VintfStability +interface IAGnssRil { + /** Network capability mode bitmask for not metered. */ + const int NETWORK_CAPABILITY_NOT_METERED = 0x01; + + /** Network capability mode bitmask for not roaming. */ + const int NETWORK_CAPABILITY_NOT_ROAMING = 0x02; + + /** AGNSS reference location type */ + @VintfStability + @Backing(type="int") + enum AGnssRefLocationType { + GSM_CELLID = 1, + UMTS_CELLID = 2, + LTE_CELLID = 4, + NR_CELLID = 8, + } + + /** SET ID type*/ + @VintfStability + @Backing(type="int") + enum SetIdType { + NONE = 0, + IMSI = 1, + MSISDM = 2, + } + + /** + * CellID for 2G, 3G ,LTE and NR used in AGNSS. This is defined in + * UserPlane Location Protocol (Version 2.0.4). + */ + @VintfStability + parcelable AGnssRefLocationCellID { + AGnssRefLocationType type; + + /** Mobile Country Code. */ + int mcc; + + /** Mobile Network Code .*/ + int mnc; + + /** + * Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE, + * lac is populated with tac, to ensure that we don't break old clients that + * might rely on the old (wrong) behavior. + */ + int lac; + + /** + * Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. + * Cell Global Id NR in 5G. + */ + long cid; + + /** Tracking Area Code in LTE and NR. */ + int tac; + + /** Physical Cell id in LTE and NR (not used in 2G and 3G) */ + int pcid; + + /** Absolute Radio Frequency Channel Number in NR. */ + int arfcn; + } + + /** Represents ref locations */ + @VintfStability + parcelable AGnssRefLocation { + AGnssRefLocationType type; + + AGnssRefLocationCellID cellID; + } + + /** Represents network connection status and capabilities. */ + @VintfStability + parcelable NetworkAttributes { + /** A handle representing this Network. */ + long networkHandle; + + /** + * True indicates that network connectivity exists and it is possible to + * establish connections and pass data. If false, only the networkHandle field + * is populated to indicate that this network has just disconnected. + */ + boolean isConnected; + + /** + * A bitfield of flags indicating the capabilities of this network. The bit masks are + * defined in NETWORK_CAPABILITY_*. + */ + int capabilities; + + /** + * Telephony preferred Access Point Name to use for carrier data connection when + * connected to a cellular network. Empty string, otherwise. + */ + @utf8InCpp String apn; + } + + /** + * Opens the AGNSS interface and provides the callback routines + * to the implementation of this interface. + * + * @param callback Interface for AGnssRil callbacks. + * + */ + void setCallback(in IAGnssRilCallback callback); + + /** + * Sets the reference location. + * + * @param agnssReflocation AGNSS reference location CellID. + * + */ + void setRefLocation(in AGnssRefLocation agnssReflocation); + + /** + * Sets the SET ID. + * + * @param type Must be populated with either IMSI or MSISDN or NONE. + * @param setid If type is IMSI then setid is populated with + * a string representing the unique Subscriber ID, for example, the IMSI for + * a GMS phone. If type is MSISDN, then setid must contain + * the phone number string for line 1. For example, the MSISDN for a GSM phone. + * If the type is NONE, then the string must be empty. + * + */ + void setSetId(in SetIdType type, in @utf8InCpp String setid); + + /** + * Notifies GNSS of network status changes. + * + * The framework calls this method to update the GNSS HAL implementation of network + * state changes. + * + * @param attributes Updated network attributes. + * + */ + void updateNetworkState(in NetworkAttributes attributes); +} diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..99fe2b74a2edf69860dccef498efa4a5a8935e40 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IAGnssRilCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.gnss; + +/** + * Callback for IAGnssRil interface. Used to request SET ID and + * Reference Location. + * + * @hide + */ +@VintfStability +interface IAGnssRilCallback { + /** + * The Hal uses this API to request a SET ID. + * + * @param setIdflag A bitfield of IAGnssRil.SetIdType that is required by + * the HAL. The framework will inject an empty SET ID if the flag is NONE. + * + */ + void requestSetIdCb(in int setIdflag); + + /** + * The Hal uses this API to request a reference location. + */ + void requestRefLocCb(); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl index f99b512c5f54be79b810f6b69de81859749c921c..f0b583d1649957a6b6a6f3d6fb777db23ee114a6 100644 --- a/gnss/aidl/android/hardware/gnss/IGnss.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl @@ -16,20 +16,31 @@ package android.hardware.gnss; +import android.hardware.gnss.GnssLocation; +import android.hardware.gnss.IAGnss; +import android.hardware.gnss.IAGnssRil; +import android.hardware.gnss.IGnssAntennaInfo; +import android.hardware.gnss.IGnssBatching; import android.hardware.gnss.IGnssCallback; import android.hardware.gnss.IGnssConfiguration; +import android.hardware.gnss.IGnssDebug; +import android.hardware.gnss.IGnssGeofence; import android.hardware.gnss.IGnssMeasurementInterface; +import android.hardware.gnss.IGnssNavigationMessageInterface; import android.hardware.gnss.IGnssPowerIndication; import android.hardware.gnss.IGnssPsds; +import android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsInterface; +import android.hardware.gnss.visibility_control.IGnssVisibilityControl; /** * Represents the standard GNSS (Global Navigation Satellite System) interface. + * + * @hide */ @VintfStability interface IGnss { - /** - * All GNSS Binder calls may return a ServiceSpecificException with the following error + * All GNSS binder calls may return a ServiceSpecificException with the following error * codes. */ const int ERROR_INVALID_ARGUMENT = 1; @@ -40,6 +51,53 @@ interface IGnss { /** Any other error. */ const int ERROR_GENERIC = 3; + /** Requested operational mode for GNSS operation. */ + @VintfStability + @Backing(type="int") + enum GnssPositionMode { + /** Mode for running GNSS standalone (no assistance). */ + STANDALONE = 0, + /** AGNSS MS-Based mode. */ + MS_BASED = 1, + /** + * AGNSS MS-Assisted mode. This mode is not maintained by the platform anymore. + * It is strongly recommended to use MS_BASED instead. + */ + MS_ASSISTED = 2, + } + + /** Requested recurrence mode for GNSS operation. */ + @VintfStability + @Backing(type="int") + enum GnssPositionRecurrence { + /** Receive GNSS fixes on a recurring basis at a specified period. */ + RECURRENCE_PERIODIC = 0, + /** Request a single shot GNSS fix. */ + RECURRENCE_SINGLE = 1, + } + + /** + * Flags used to specify which aiding data to delete when calling + * deleteAidingData(). + */ + @VintfStability + @Backing(type="int") + enum GnssAidingData { + EPHEMERIS = 0x0001, + ALMANAC = 0x0002, + POSITION = 0x0004, + TIME = 0x0008, + IONO = 0x0010, + UTC = 0x0020, + HEALTH = 0x0040, + SVDIR = 0x0080, + SVSTEER = 0x0100, + SADATA = 0x0200, + RTI = 0x0400, + CELLDB_INFO = 0x8000, + ALL = 0xFFFF + } + /** * Opens the interface and provides the callback routines to the implementation of this * interface. @@ -73,27 +131,25 @@ interface IGnss { /** * This method returns the IGnssPsds interface. * - * This method must return non-null. - * - * @return Handle to the IGnssPsds interface. + * @return The IGnssPsds interface. */ - IGnssPsds getExtensionPsds(); + @nullable IGnssPsds getExtensionPsds(); /** * This method returns the IGnssConfiguration interface. * * This method must return non-null. * - * @return Handle to the IGnssConfiguration interface. + * @return The IGnssConfiguration interface. */ IGnssConfiguration getExtensionGnssConfiguration(); /** - * This methods returns the IGnssMeasurementInterface interface. + * This method returns the IGnssMeasurementInterface interface. * * This method must return non-null. * - * @return Handle to the IGnssMeasurementInterface interface. + * @return The IGnssMeasurementInterface interface. */ IGnssMeasurementInterface getExtensionGnssMeasurement(); @@ -102,7 +158,189 @@ interface IGnss { * * This method must return non-null. * - * @return Handle to the IGnssPowerIndication interface. + * @return The IGnssPowerIndication interface. */ IGnssPowerIndication getExtensionGnssPowerIndication(); + + /** + * This method returns the IGnssBatching interface. + * + * @return The IGnssBatching interface. + */ + @nullable IGnssBatching getExtensionGnssBatching(); + + /** + * This method returns the IGnssGeofence interface. + * + * @return The IGnssGeofence interface. + */ + @nullable IGnssGeofence getExtensionGnssGeofence(); + + /** + * This method returns the IGnssNavigationMessageInterface. + * + * @return The IGnssNavigationMessageInterface. + */ + @nullable IGnssNavigationMessageInterface getExtensionGnssNavigationMessage(); + + /** + * This method returns the IAGnss interface. + * + * @return The IAGnss interface. + */ + IAGnss getExtensionAGnss(); + + /** + * This method returns the IAGnssRil interface. + * + * @return The IAGnssRil interface. + */ + IAGnssRil getExtensionAGnssRil(); + + /** + * This method returns the IGnssDebug interface. + * + * This method must return non-null. + * + * @return Handle to the IGnssDebug interface. + */ + IGnssDebug getExtensionGnssDebug(); + + /** + * This method returns the IGnssVisibilityControl. + * + * @return Handle to the IGnssVisibilityControl. + */ + IGnssVisibilityControl getExtensionGnssVisibilityControl(); + + /** + * Starts a location output stream using the IGnssCallback gnssLocationCb(), following the + * settings from the most recent call to setPositionMode(). + * + * This output must operate independently of any GNSS location batching operations, + * see the IGnssBatching for details. + */ + void start(); + + /** + * Stops the location output stream. + */ + void stop(); + + /** + * Injects the current time. + * + * @param timeMs This is the UTC time received from the NTP server, its value is given in + * milliseconds since January 1, 1970. + * @param timeReferenceMs The corresponding value of SystemClock.elapsedRealtime() from the + * device when the NTP response was received in milliseconds. + * @param uncertaintyMs Uncertainty associated with the value represented by time. Represented + * in milliseconds. + */ + void injectTime(in long timeMs, in long timeReferenceMs, in int uncertaintyMs); + + /** + * Injects current location from another (typically network) location provider. + * + * @param location Current location from the location provider + */ + void injectLocation(in GnssLocation location); + + /** + * Injects current location from the best available location provider. + * + * Unlike injectLocation, this method may inject a recent GNSS location from the HAL + * implementation, if that is the best available location known to the framework. + * + * @param location Location information from the best available location provider. + */ + void injectBestLocation(in GnssLocation location); + + /** + * Specifies that the next call to start will not use the information defined in the flags. + * GnssAidingData value of GnssAidingData::ALL is passed for a cold start. + * + * @param aidingDataFlags Flags specifying the aiding data to be deleted. + */ + void deleteAidingData(in GnssAidingData aidingDataFlags); + + /** + * Options used in the setPositionMode() call for specifying the GNSS engine behavior. + */ + @VintfStability + parcelable PositionModeOptions { + /** + * Must be one of MS_BASED or STANDALONE. It is allowed by the platform (and it is + * recommended) to fallback to MS_BASED if MS_ASSISTED is passed in, and MS_BASED is + * supported. + */ + GnssPositionMode mode; + + /* Recurrence GNSS position recurrence value, either periodic or single. */ + GnssPositionRecurrence recurrence; + + /* Represents the time between fixes in milliseconds. */ + int minIntervalMs; + + /* Represents the requested fix accuracy in meters. */ + int preferredAccuracyMeters; + + /* Represents the requested time to first fix in milliseconds. */ + int preferredTimeMs; + + /** + * When true, and IGnss is the only client to the GNSS hardware, the GNSS hardware must make + * strong tradeoffs to substantially restrict power use. Specifically, in the case of a + * several second long minIntervalMs, the GNSS hardware must not, on average, run power + * hungry operations like RF and signal searches for more than one second per interval, and + * must make exactly one call to gnssSvStatusCb(), and either zero or one call to + * GnssLocationCb() at each interval. When false, HAL must operate in the nominal mode and + * is expected to make power and performance tradoffs such as duty-cycling when signal + * conditions are good and more active searches to reacquire GNSS signals when no signals + * are present. When there are additional clients using the GNSS hardware other than IGnss, + * the GNSS hardware may operate in a higher power mode, on behalf of those clients. + */ + boolean lowPowerMode; + } + + /** + * Sets the GnssPositionMode parameter, its associated recurrence value, the time between fixes, + * requested fix accuracy, time to first fix. + */ + void setPositionMode(in PositionModeOptions options); + + /* + * This method returns the IGnssAntennaInfo. + * + * @return Handle to the IGnssAntennaInfo. + */ + IGnssAntennaInfo getExtensionGnssAntennaInfo(); + + /** + * This method returns the IMeasurementCorrectionsInterface. + * + * @return Handle to the IMeasurementCorrectionsInterface. + */ + @nullable IMeasurementCorrectionsInterface getExtensionMeasurementCorrections(); + + /** + * Starts a SvStatus output stream using the IGnssCallback gnssSvStatusCb(). + */ + void startSvStatus(); + + /** + * Stops the SvStatus output stream. + */ + void stopSvStatus(); + + /** + * Starts an NMEA (National Marine Electronics Association) output stream using the + * IGnssCallback gnssNmeaCb(). + */ + void startNmea(); + + /** + * Stops the NMEA output stream. + */ + void stopNmea(); } diff --git a/gnss/aidl/android/hardware/gnss/IGnssAntennaInfo.aidl b/gnss/aidl/android/hardware/gnss/IGnssAntennaInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3b173f995ac6fefae80e4d0c982bc594be758516 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssAntennaInfo.aidl @@ -0,0 +1,43 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.IGnssAntennaInfoCallback; + +/** + * Extended interface for GNSS antenna information support. + * + * @hide + */ +@VintfStability +interface IGnssAntennaInfo { + /** + * Registers the callback routines with the HAL. + * + * @param callback Handle to the GnssAntennaInfo callback interface. + */ + void setCallback(in IGnssAntennaInfoCallback callback); + + /** + * Stops updates from the HAL, and unregisters the callback routines. + * After a call to close(), the previously registered callbacks must be + * considered invalid by the HAL. + * If close() is invoked without a previous setCallback, this function must perform + * no work. + */ + void close(); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssAntennaInfoCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssAntennaInfoCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..48565518cacb8a6426dd0a845920f3f403609752 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssAntennaInfoCallback.aidl @@ -0,0 +1,142 @@ +/* + * 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 android.hardware.gnss; + +/** + * The callback interface to report GNSS antenna information from the HAL. + * + * @hide + */ +@VintfStability +interface IGnssAntennaInfoCallback { + /** + * A row of doubles. This is used to represent a row in a 2D array, which are used to + * characterize the phase center variation corrections and signal gain corrections. + */ + @VintfStability + parcelable Row { + double[] row; + } + + /** + * A point in 3D space, with associated uncertainty. + */ + @VintfStability + parcelable Coord { + double x; + + double xUncertainty; + + double y; + + double yUncertainty; + + double z; + + double zUncertainty; + } + + @VintfStability + parcelable GnssAntennaInfo { + /** + * The carrier frequency in Hz. + */ + long carrierFrequencyHz; + + /** + * Phase center offset (PCO) with associated 1-sigma uncertainty. PCO is defined with + * respect to the origin of the Android sensor coordinate system, e.g., center of primary + * screen for mobiles - see sensor or form factor documents for details. + */ + Coord phaseCenterOffsetCoordinateMillimeters; + + /** + * 2D vectors representing the phase center variation (PCV) corrections, in + * millimeters, at regularly spaced azimuthal angle (theta) and zenith angle + * (phi). The PCV correction is added to the phase measurement to obtain the + * corrected value. + * + * The azimuthal angle, theta, is defined with respect to the X axis of the + * Android sensor coordinate system, increasing toward the Y axis. The zenith + * angle, phi, is defined with respect to the Z axis of the Android Sensor + * coordinate system, increasing toward the X-Y plane. + * + * Each row vector (outer vectors) represents a fixed theta. The first row + * corresponds to a theta angle of 0 degrees. The last row corresponds to a + * theta angle of (360 - deltaTheta) degrees, where deltaTheta is the regular + * spacing between azimuthal angles, i.e., deltaTheta = 360 / (number of rows). + * + * The columns (inner vectors) represent fixed zenith angles, beginning at 0 + * degrees and ending at 180 degrees. They are separated by deltaPhi, the regular + * spacing between zenith angles, i.e., deltaPhi = 180 / (number of columns - 1). + * + * This field is optional, i.e., an empty vector. + */ + Row[] phaseCenterVariationCorrectionMillimeters; + + /** + * 2D vectors of 1-sigma uncertainty in millimeters associated with the PCV + * correction values. + * + * This field is optional, i.e., an empty vector. + */ + Row[] phaseCenterVariationCorrectionUncertaintyMillimeters; + + /** + * 2D vectors representing the signal gain corrections at regularly spaced + * azimuthal angle (theta) and zenith angle (phi). The values are calculated or + * measured at the antenna feed point without considering the radio and receiver + * noise figure and path loss contribution, in dBi, i.e., decibel over isotropic + * antenna with the same total power. The signal gain correction is added the + * signal gain measurement to obtain the corrected value. + * + * The azimuthal angle, theta, is defined with respect to the X axis of the + * Android sensor coordinate system, increasing toward the Y axis. The zenith + * angle, phi, is defined with respect to the Z axis of the Android Sensor + * coordinate system, increasing toward the X-Y plane. + * + * Each row vector (outer vectors) represents a fixed theta. The first row + * corresponds to a theta angle of 0 degrees. The last row corresponds to a + * theta angle of (360 - deltaTheta) degrees, where deltaTheta is the regular + * spacing between azimuthal angles, i.e., deltaTheta = 360 / (number of rows). + * + * The columns (inner vectors) represent fixed zenith angles, beginning at 0 + * degrees and ending at 180 degrees. They are separated by deltaPhi, the regular + * spacing between zenith angles, i.e., deltaPhi = 180 / (number of columns - 1). + * + * This field is optional, i.e., an empty vector. + */ + Row[] signalGainCorrectionDbi; + + /** + * 2D vectors of 1-sigma uncertainty in dBi associated with the signal + * gain correction values. + * + * This field is optional, i.e., an empty vector. + */ + Row[] signalGainCorrectionUncertaintyDbi; + } + + /** + * Called when on connection, and on known-change to these values, such as upon a known + * GNSS RF antenna tuning change, or a foldable device state change. + * + * This is optional. It can never be called if the GNSS antenna information is not + * available. + */ + void gnssAntennaInfoCb(in GnssAntennaInfo[] gnssAntennaInfos); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssBatching.aidl b/gnss/aidl/android/hardware/gnss/IGnssBatching.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2880df6bb90fc4923b64e9a5467613b3941a6d04 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssBatching.aidl @@ -0,0 +1,136 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.IGnssBatchingCallback; + +/** + * Extended interface for GNSS Batching support. + * + * If this interface is supported, this batching request must be able to run in parallel with, or + * without, non-batched location requested by the IGnss start() & stop() - i.e. both requests must + * be handled independently, and not interfere with each other. + * + * For example, if a 1Hz continuous output is underway on the IGnssCallback, due to an IGnss start() + * operation, and then a IGnssBatching start() is called for a location every 10 seconds, the newly + * added batching request must not disrupt the 1Hz continuous location output on the IGnssCallback. + * + * As with GNSS Location outputs, source of location must be GNSS satellite measurements, optionally + * using interial and baro sensors to improve relative motion filtering. No additional absolute + * positioning information, such as WiFi derived location, may be mixed with the GNSS information. + * + * @hide + */ +@VintfStability +interface IGnssBatching { + /** + * Bit mask indicating batching supports wake up and flush when FIFO is full. + * + * If this flag is set, the hardware implementation must wake up the application processor when + * the FIFO is full, and call IGnssBatchingCallback to return the locations. + * + * If the flag is not set, the hardware implementation must drop the oldest data when the FIFO + * is full. + */ + const int WAKEUP_ON_FIFO_FULL = 0x01; + + /** Options specifying the batching request. */ + @VintfStability + parcelable Options { + /** Time interval between samples in the location batch, in nanoseconds. */ + long periodNanos; + + /** + * The minimum distance in meters that the batching engine should + * accumulate before trying another GPS fix when in a challenging GPS environment. + * + * This is an optional field. If it is set as 0, the chipset can operate in an automatic + * mode. + */ + float minDistanceMeters; + + /** A bit field of Flags (WAKEUP_ON_FIFO_FULL) indicating the batching behavior. */ + int flags; + } + + /** + * Open the interface and provides the callback routines to the implementation of this + * interface. + * + * @param callback Callback interface for IGnssBatching. + */ + void init(in IGnssBatchingCallback callback); + + /** + * Return the batch size (in number of GnssLocation objects) available in this hardware + * implementation. + * + * If the available size is variable, for example, based on other operations consuming memory, + * this is the minimum size guaranteed to be available for batching operations. + * + * This may, for example, be used by the client, to decide on the batching interval and whether + * the AP should be woken up or not. + * + * @return the number of location objects supported per batch + */ + int getBatchSize(); + + /** + * Start batching locations. This API is primarily used when the AP is asleep and the device can + * batch locations in the hardware. + * + * The implementation must invoke IGnssBatchingCallback, provided in init(), to return the + * location. + * + * When the buffer is full and WAKEUP_ON_FIFO_FULL is used, IGnssBatchingCallback must be called + * to return the locations. + * + * When the buffer is full and WAKEUP_ON_FIFO_FULL is not set, the oldest location object is + * dropped. In this case the AP must not be woken up. The AP would then generally be responsible + * for using flushBatchedLocation to explicitly ask for the location as needed, to avoid it + * being dropped. + * + * @param options Options specifying the batching request. + */ + void start(in Options options); + + /** + * Retrieve all batched locations currently stored. + * + * The implementation must invoke IGnssBatchingCallback, provided in init(), to return the + * location. + * + * IGnssBatchingCallback must be called in response, even if there are no locations to flush + * (in which case the Location vector must be empty). + * + * Subsequent calls to flush must not return any of the locations returned in this call. + */ + void flush(); + + /** + * Stop batching. + */ + void stop(); + + /** + * Closes the interface. If any batch operations are in progress, they must be stopped. If any + * locations are in the hardware batch, they must be deleted (and not sent via callback.) + * + * init() may be called again, after this, if the interface is to be restored + */ + void cleanup(); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssBatchingCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssBatchingCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..36e8307f7a6d1dc5823a5e037c870b8b4d4584b4 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssBatchingCallback.aidl @@ -0,0 +1,40 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.GnssLocation; + +/** + * The callback interface to report batched GNSS locations from the HAL. + * + * @hide + */ +@VintfStability +interface IGnssBatchingCallback { + /** + * Called when a batch of locations is output, by various means, including + * a flush request, as well as the buffer becoming full (if appropriate option + * is set.) + * + * All locations returned by this callback must be cleared from the hardware + * buffer, such the sequential calls of this callback do not return any + * redundant locations. (Same lat/lon, at a new time, is acceptable.) + * + * @param locations A list of GNSS Locations + */ + void gnssLocationBatchCb(in GnssLocation[] locations); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl index aad09ef98b86755e2493d18f42160bd0d1fc8c10..8633bea070ec0c71cd4b6f6eee5580fd1a83fc6b 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl @@ -16,6 +16,8 @@ package android.hardware.gnss; +import android.hardware.gnss.GnssConstellationType; +import android.hardware.gnss.GnssLocation; import android.hardware.gnss.IGnssConfiguration; import android.hardware.gnss.IGnssPsds; @@ -23,12 +25,53 @@ import android.hardware.gnss.IGnssPsds; * This interface is required for the HAL to communicate certain information * like status and location info back to the framework, the framework implements * the interfaces and passes a handle to the HAL. + * + * @hide */ @VintfStability interface IGnssCallback { + /** + * Capability bit mask indicating that GNSS supports scheduling fixes for RECURRENCE_PERIODIC + * mode. + * + * If this is not set, then the framework will use 1000ms for minInterval and will call start() + * and stop() to schedule the GNSS. + */ + const int CAPABILITY_SCHEDULING = 1 << 0; + + /** Capability bit mask indicating that GNSS supports MS-Based AGNSS mode */ + const int CAPABILITY_MSB = 1 << 1; + + /** Capability bit mask indicating that GNSS supports MS-Assisted AGNSS mode */ + const int CAPABILITY_MSA = 1 << 2; + + /** Capability bit mask indicating that GNSS supports single-shot fixes */ + const int CAPABILITY_SINGLE_SHOT = 1 << 3; + + /** Capability bit mask indicating that GNSS supports on demand time injection */ + const int CAPABILITY_ON_DEMAND_TIME = 1 << 4; + + /** Capability bit mask indicating that GNSS supports Geofencing */ + const int CAPABILITY_GEOFENCING = 1 << 5; + + /** Capability bit mask indicating that GNSS supports Measurements. */ + const int CAPABILITY_MEASUREMENTS = 1 << 6; + + /** Capability bit mask indicating that GNSS supports Navigation Messages */ + const int CAPABILITY_NAV_MESSAGES = 1 << 7; + + /** Capability bit mask indicating that GNSS supports low power mode */ + const int CAPABILITY_LOW_POWER_MODE = 1 << 8; + /** Capability bit mask indicating that GNSS supports blocklisting satellites */ const int CAPABILITY_SATELLITE_BLOCKLIST = 1 << 9; + /** Capability bit mask indicating that GNSS supports measurement corrections */ + const int CAPABILITY_MEASUREMENT_CORRECTIONS = 1 << 10; + + /** Capability bit mask indicating that GNSS supports antenna info */ + const int CAPABILITY_ANTENNA_INFO = 1 << 11; + /** Capability bit mask indicating that GNSS supports correlation vector */ const int CAPABILITY_CORRELATION_VECTOR = 1 << 12; @@ -44,4 +87,225 @@ interface IGnssCallback { * @param capabilities Capability parameter is a bit field of the Capability bit masks. */ void gnssSetCapabilitiesCb(in int capabilities); + + /** GNSS status event values. */ + @VintfStability + @Backing(type="int") + enum GnssStatusValue { + /** GNSS status unknown. */ + NONE = 0, + /** GNSS has begun navigating. */ + SESSION_BEGIN = 1, + /** GNSS has stopped navigating. */ + SESSION_END = 2, + /** GNSS has powered on but is not navigating. */ + ENGINE_ON = 3, + /** GNSS is powered off. */ + ENGINE_OFF = 4 + } + + /** + * Flags that indicate information about the satellite + */ + @VintfStability + @Backing(type="int") + enum GnssSvFlags { + NONE = 0, + HAS_EPHEMERIS_DATA = 1 << 0, + HAS_ALMANAC_DATA = 1 << 1, + USED_IN_FIX = 1 << 2, + HAS_CARRIER_FREQUENCY = 1 << 3, + } + + @VintfStability + parcelable GnssSvInfo { + /** + * Pseudo-random or satellite ID number for the satellite, a.k.a. Space Vehicle (SV), or + * FCN/OSN number for Glonass. The distinction is made by looking at constellation field. + * Values must be in the range of: + * + * - GNSS: 1-32 + * - SBAS: 120-151, 183-192 + * - GLONASS: 1-24, the orbital slot number (OSN), if known. Or, if not: + * 93-106, the frequency channel number (FCN) (-7 to +6) offset by + * + 100 + * i.e. report an FCN of -7 as 93, FCN of 0 as 100, and FCN of +6 + * as 106. + * - QZSS: 193-200 + * - Galileo: 1-36 + * - Beidou: 1-37 + * - IRNSS: 1-14 + */ + int svid; + + /** + * Defines the constellation of the given SV. + */ + GnssConstellationType constellation; + + /** + * Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. + * It contains the measured C/N0 value for the signal at the antenna port. + * + * This is a mandatory field. + */ + float cN0Dbhz; + + /** + * Baseband Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. It contains + * the measured C/N0 value for the signal measured at the baseband. + * + * This is typically a few dB weaker than the value estimated for C/N0 at the antenna port, + * which is reported in cN0DbHz. + * + * If a signal has separate components (e.g. Pilot and Data channels) and the receiver only + * processes one of the components, then the reported basebandCN0DbHz reflects only the + * component that is processed. + * + * This field is mandatory. Like cN0DbHz, it may be reported as 0 for satellites being + * reported that may be searched for, but not yet tracked. + */ + float basebandCN0DbHz; + + /** Elevation of SV in degrees. */ + float elevationDegrees; + + /** Azimuth of SV in degrees. */ + float azimuthDegrees; + + /** + * Carrier frequency of the signal tracked, for example it can be the + * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 = + * 1176.45 MHz, varying GLO channels, etc. If the field is zero, it is + * the primary common use central frequency, e.g. L1 = 1575.45 MHz for + * GPS. + * + * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same + * time, two GnssSvInfo structs must be reported for this same + * satellite, in one of the structs, all the values related + * to L1 must be filled, and in the other all of the values related to + * L5 must be filled. + * + * If the data is available, svFlag must contain HAS_CARRIER_FREQUENCY. + */ + long carrierFrequencyHz; + + /** A bit field of the GnssSvFlags. */ + int svFlag; + } + + /** + * Called to communicate the status of the GNSS engine. + * + * @param status Status information from HAL. + */ + void gnssStatusCb(in GnssStatusValue status); + + /** + * Callback for the HAL to pass a vector of GnssSvInfo back to the client. + * + * If GnssMeasurement is registered, the SvStatus report interval is the same as the measurement + * interval, i.e., the interval the measurement engine runs at. If GnssMeasurement is not + * registered, the SvStatus interval is the same as the location interval. + * + * @param svInfo SV status information from HAL. + */ + void gnssSvStatusCb(in GnssSvInfo[] svInfoList); + + /** + * Called when a GNSS location is available. + * + * @param location Location information from HAL. + */ + void gnssLocationCb(in GnssLocation location); + + /** + * Callback for reporting NMEA sentences. Called when NMEA data is available. + * + * @param timestamp Marks the instance of reporting. + * @param nmea Follows standard NMEA 0183. Each sentence begins with a '$' + * and ends with a carriage return/line feed sequence and can be no longer + * than 80 characters of visible text (plus the line terminators). The data + * is contained within this single line with data items separated by commas. + * The data itself is just ascii text and may extend over multiple sentences + * in certain specialized instances but is normally fully contained in one + * variable length sentence. The data may vary in the amount of precision + * contained in the message. For example time might be indicated to decimal + * parts of a second or location may be shown with 3 or even 4 digits after + * the decimal point. Programs that read the data must only use the commas + * to determine the field boundaries and not depend on column positions. + * There is a provision for a checksum at the end of each sentence which may + * or may not be checked by the unit that reads the data. The checksum field + * consists of a '*' and two hex digits representing an 8 bit exclusive OR + * of all characters between, but not including, the '$' and '*'. + */ + void gnssNmeaCb(in long timestamp, in @utf8InCpp String nmea); + + /** + * Callback utility for acquiring the GNSS wakelock. This can be used to prevent + * the CPU from suspending while handling GNSS events. + */ + void gnssAcquireWakelockCb(); + + /** Callback utility for releasing the GNSS wakelock. */ + void gnssReleaseWakelockCb(); + + /** + * Provides information about how new the underlying GPS/GNSS hardware and software is. + */ + @VintfStability + parcelable GnssSystemInfo { + /** + * The year in which the last update was made to the underlying hardware/firmware used to + * capture GNSS signals, e.g. 2016. + */ + int yearOfHw; + + /** + * The name of the GNSS HAL implementation model and version name. + * + * This is a user-visible string that identifies the model and version of the GNSS HAL. + * For example "ABC Co., Baseband Part 1234, RF Part 567, Software version 3.14.159" + * + * For privacy reasons, this string must not contain any device-specific serial number or + * other identifier that uniquely identifies an individual device. + */ + @utf8InCpp String name; + } + + /** + * Callback to inform the framework of the GNSS system information. + * + * This must be called in response to IGnss::setCallback + * + * @param info GnssSystemInfo about the GPS/GNSS hardware. + */ + void gnssSetSystemInfoCb(in GnssSystemInfo info); + + /** Callback for requesting NTP time */ + void gnssRequestTimeCb(); + + /** + * Callback for requesting Location. + * + * HAL implementation must call this when it wants the framework to provide locations to assist + * with GNSS HAL operation, for example, to assist with time to first fix, error recovery, or to + * supplement GNSS location for other clients of the GNSS HAL. + * + * If a request is made with independentFromGnss set to true, the framework must avoid + * providing locations derived from GNSS locations (such as "fused" location), to help improve + * information independence for situations such as error recovery. + * + * In response to this method call, GNSS HAL can expect zero, one, or more calls to + * IGnss::injectLocation or IGnss::injectBestLocation, dependent on availability of location + * from other sources, which may happen at some arbitrary delay. Generally speaking, HAL + * implementations must be able to handle calls to IGnss::injectLocation or + * IGnss::injectBestLocation at any time. + * + * @param independentFromGnss True if requesting a location that is independent from GNSS. + * @param isUserEmergency True if the location request is for delivery of this location to an + * emergency services endpoint, during a user-initiated emergency session (e.g. + * during-call to E911, or up to 5 minutes after end-of-call or text to E911). + */ + void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency); } diff --git a/gnss/aidl/android/hardware/gnss/IGnssConfiguration.aidl b/gnss/aidl/android/hardware/gnss/IGnssConfiguration.aidl index e0ad3575f02feb8ccc660fa7ec779daabb0525c0..313ae22cc28349f3f6535017a700dd6c68578d2c 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssConfiguration.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssConfiguration.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.BlocklistedSource; /** * Extended interface for GNSS Configuration support. + * + * @hide */ @VintfStability interface IGnssConfiguration { @@ -119,4 +121,4 @@ interface IGnssConfiguration { * @param blocklist The BlocklistedSource(s) of satellites the HAL must not use. */ void setBlocklist(in BlocklistedSource[] blocklist); -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssDebug.aidl b/gnss/aidl/android/hardware/gnss/IGnssDebug.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9e1b5edc87680b725b014cf2965d005e27ae8474 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssDebug.aidl @@ -0,0 +1,201 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.GnssConstellationType; +import android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource; + +/** + * Extended interface for GNSS Debug support + * + * This information is used for debugging purpose, e.g., shown in a bugreport to + * describe the chipset states including time, position, and satellite data. + * + * @hide + */ +@VintfStability +interface IGnssDebug { + /** Satellite's ephemeris type */ + @VintfStability + @Backing(type="int") + enum SatelliteEphemerisType { + EPHEMERIS = 0, + ALMANAC_ONLY = 1, + NOT_AVAILABLE = 2, + } + + /** Satellite's ephemeris health */ + @VintfStability + @Backing(type="int") + enum SatelliteEphemerisHealth { + GOOD = 0, + BAD = 1, + UNKNOWN = 2, + } + + /** + * Provides the current best known UTC time estimate. + * If no fresh information is available, e.g. after a delete all, + * then whatever the effective defaults are on the device must be + * provided (e.g. Jan. 1, 2017, with an uncertainty of 5 years) expressed + * in the specified units. + */ + @VintfStability + parcelable TimeDebug { + /** UTC time estimate in milliseconds. */ + long timeEstimateMs; + + /** 68% time error estimate in nanoseconds. */ + float timeUncertaintyNs; + + /** + * 68% error estimate in local clock drift, + * in nanoseconds per second (also known as parts per billion - ppb.) + */ + float frequencyUncertaintyNsPerSec; + } + + @VintfStability + parcelable PositionDebug { + /** + * Validity of the data in this struct. False only if no + * latitude/longitude information is known. + */ + boolean valid; + + /** Latitude expressed in degrees */ + double latitudeDegrees; + + /** Longitude expressed in degrees */ + double longitudeDegrees; + + /** Altitude above ellipsoid expressed in meters */ + float altitudeMeters; + + /** Represents horizontal speed in meters per second. */ + float speedMetersPerSec; + + /** Represents heading in degrees. */ + float bearingDegrees; + + /** + * Estimated horizontal accuracy of position expressed in meters, + * radial, 68% confidence. + */ + double horizontalAccuracyMeters; + + /** + * Estimated vertical accuracy of position expressed in meters, with + * 68% confidence. + */ + double verticalAccuracyMeters; + + /** + * Estimated speed accuracy in meters per second with 68% confidence. + */ + double speedAccuracyMetersPerSecond; + + /** + * Estimated bearing accuracy degrees with 68% confidence. + */ + double bearingAccuracyDegrees; + + /** + * Time duration before this report that this position information was + * valid. This can, for example, be a previous injected location with + * an age potentially thousands of seconds old, or + * extrapolated to the current time (with appropriately increased + * accuracy estimates), with a (near) zero age. + */ + float ageSeconds; + } + + @VintfStability + parcelable SatelliteData { + /** Satellite vehicle ID number */ + int svid; + + /** Defines the constellation type of the given SV. */ + GnssConstellationType constellation; + + /** + * Defines the standard broadcast ephemeris or almanac availability for + * the satellite. To report status of predicted orbit and clock + * information, see the serverPrediction fields below. + */ + SatelliteEphemerisType ephemerisType; + + /** Defines the ephemeris source of the satellite. */ + SatelliteEphemerisSource ephemerisSource; + + /** + * Defines whether the satellite is known healthy + * (safe for use in location calculation.) + */ + SatelliteEphemerisHealth ephemerisHealth; + + /** + * Time duration from this report (current time), minus the + * effective time of the ephemeris source (e.g. TOE, TOA.) + * Set to 0 when ephemerisType is NOT_AVAILABLE. + */ + float ephemerisAgeSeconds; + + /** + * True if a server has provided a predicted orbit and clock model for + * this satellite. + */ + boolean serverPredictionIsAvailable; + + /** + * Time duration from this report (current time) minus the time of the + * start of the server predicted information. For example, a 1 day + * old prediction would be reported as 86400 seconds here. + */ + float serverPredictionAgeSeconds; + } + + /** + * Provides a set of debug information that is filled by the GNSS chipset + * when the method getDebugData() is invoked. + */ + @VintfStability + parcelable DebugData { + /** Current best known position. */ + PositionDebug position; + + /** Current best know time estimate */ + TimeDebug time; + + /** + * Provides a list of the available satellite data, for all + * satellites and constellations the device can track, + * including GnssConstellationType UNKNOWN. + */ + List satelliteDataArray; + } + + /** + * This methods requests position, time and satellite ephemeris debug information + * from the HAL. + * + * @return ret debugData information from GNSS Hal that contains the current best + * known position, best known time estimate and a complete list of + * constellations that the device can track. + */ + DebugData getDebugData(); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssGeofence.aidl b/gnss/aidl/android/hardware/gnss/IGnssGeofence.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2a540a26615fe61a6bc5e3c0cc8aaed1a2030f8d --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssGeofence.aidl @@ -0,0 +1,86 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.IGnssGeofenceCallback; + +/** + * Extended interface for GNSS Geofence support. + * + * @hide + */ +@VintfStability +interface IGnssGeofence { + /** + * Opens the geofence interface and provides the callback routines to the HAL. + * + * @param callback Handle to the IGnssGeofenceCallback interface. + */ + void setCallback(in IGnssGeofenceCallback callback); + + /** + * Add a geofence area. This api currently supports circular geofences. + * + * @param geofenceId The id for the geofence. If a geofence with this id already exists, an + * error value (ERROR_ID_EXISTS) must be returned. + * @param latitudeDegrees The latitude(in degrees) for the geofence lastTransition. + * @param longitudeDegrees The longitude(in degrees) for the geofence lastTransition. + * @param radiusMeters The radius(in meters) for the geofence lastTransition. + * @param lastTransition The current state of the geofence. It can be one of the transition + * states (ENTERED, EXITED, UNCERTAIN) as defined in IGnssGeofenceCallback. For example, if + * the system already knows that the user is inside the geofence, this will be set to ENTERED. + * In most cases, it will be UNCERTAIN. + * @param monitorTransitions A bitfield of ENTERED, EXITED and UNCERTAIN. It represents which + * transitions to monitor. + * @param notificationResponsivenessMs - Defines the best-effort description of how soon must + * the callback be called when the transition associated with the Geofence is triggered. For + * instance, if set to 1000 milliseconds with ENTERED, the callback must be called 1000 + * milliseconds within entering the geofence. This parameter is defined in milliseconds. + * NOTE: This is not to be confused with the rate that the GNSS is polled at. It is acceptable + * to dynamically vary the rate of sampling the GNSS for power-saving reasons; thus the rate of + * sampling may be faster or slower than this. + * @param unknownTimerMs - The time limit in millisecondsafter which the UNCERTAIN transition + * must be triggered. + */ + void addGeofence(in int geofenceId, in double latitudeDegrees, in double longitudeDegrees, + in double radiusMeters, in int lastTransition, in int monitorTransitions, + in int notificationResponsivenessMs, in int unknownTimerMs); + + /** + * Pause monitoring a particular geofence. + * + * @param geofenceId The id for the geofence. + */ + void pauseGeofence(in int geofenceId); + + /** + * Resume monitoring a particular geofence. + * + * @param geofenceId - The id for the geofence. + * @param monitorTransitions Specifies which transitions to monitor. It can be a bitwise OR of + * ENTERED, EXITED and UNCERTAIN. This supersedes the value associated provided in the + * addGeofence call. + */ + void resumeGeofence(in int geofenceId, in int monitorTransitions); + + /** + * Remove a geofence area. After the function returns, no notifications must be sent. + * + * @param geofenceId The id of the geofence. + */ + void removeGeofence(in int geofenceId); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssGeofenceCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssGeofenceCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5cb8d9c934e7860c401097bd2162eba3b0392270 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssGeofenceCallback.aidl @@ -0,0 +1,186 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.GnssLocation; + +/** + * The callback interface to report GNSS geofence events from the HAL. + * + * There are 3 states associated with a Geofence: Inside, Outside, Unknown. + * There are 3 transitions: ENTERED, EXITED, UNCERTAIN. + * + * An example state diagram with confidence level: 95% and Unknown time limit + * set as 30 secs is shown below. (confidence level and Unknown time limit are + * explained latter). + * ____________________________ + * | Unknown (30 secs) | + * """""""""""""""""""""""""""" + * ^ | | ^ + * UNCERTAIN| |ENTERED EXITED| |UNCERTAIN + * | v v | + * ________ EXITED _________ + * | Inside | -----------> | Outside | + * | | <----------- | | + * """""""" ENTERED """"""""" + * + * Inside state: We are 95% confident that the user is inside the geofence. + * Outside state: We are 95% confident that the user is outside the geofence + * Unknown state: Rest of the time. + * + * The Unknown state is better explained with an example: + * + * __________ + * | c| + * | ___ | _______ + * | |a| | | b | + * | """ | """"""" + * | | + * """""""""" + * In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy + * circle reported by the GNSS subsystem. Now with regard to "b", the system is + * confident that the user is outside. But with regard to "a" is not confident + * whether it is inside or outside the geofence. If the accuracy remains the + * same for a sufficient period of time, the UNCERTAIN transition must be + * triggered with the state set to Unknown. If the accuracy improves later, an + * appropriate transition must be triggered. This "sufficient period of time" + * is defined by the parameter in the addGeofenceArea API. + * In other words, Unknown state can be interpreted as a state in which the + * GNSS subsystem isn't confident enough that the user is either inside or + * outside the Geofence. It moves to Unknown state only after the expiry of the + * timeout. + * + * The geofence callback needs to be triggered for the ENTERED and EXITED + * transitions, when the GNSS system is confident that the user has entered + * (Inside state) or exited (Outside state) the Geofence. An implementation + * which uses a value of 95% as the confidence is recommended. The callback + * must be triggered only for the transitions requested by the + * addGeofenceArea method. + * + * Even though the diagram and explanation talks about states and transitions, + * the callee is only interested in the transitions. The states are mentioned + * here for illustrative purposes. + * + * Startup Scenario: When the device boots up, if an application adds geofences, + * and then we get an accurate GNSS location fix, it needs to trigger the + * appropriate (ENTERED or EXITED) transition for every Geofence it knows about. + * By default, all the Geofences will be in the Unknown state. + * + * When the GNSS system is unavailable, gnssGeofenceStatusCb must be + * called to inform the upper layers of the same. Similarly, when it becomes + * available the callback must be called. This is a global state while the + * UNKNOWN transition described above is per geofence. + * + * An important aspect to note is that users of this API (framework), will use + * other subsystems like wifi, sensors, cell to handle Unknown case and + * hopefully provide a definitive state transition to the third party + * application. GNSS Geofence will just be a signal indicating what the GNSS + * subsystem knows about the Geofence. + * + * @hide + */ +@VintfStability +interface IGnssGeofenceCallback { + // Geofence transition status + const int ENTERED = 1 << 0; + const int EXITED = 1 << 1; + const int UNCERTAIN = 1 << 2; + + // Geofence availability status + const int UNAVAILABLE = 1 << 0; + const int AVAILABLE = 1 << 1; + + // Geofence operation status + const int OPERATION_SUCCESS = 0; + const int ERROR_TOO_MANY_GEOFENCES = -100; + const int ERROR_ID_EXISTS = -101; + const int ERROR_ID_UNKNOWN = -102; + const int ERROR_INVALID_TRANSITION = -103; + const int ERROR_GENERIC = -149; + + /** + * The callback associated with the geofence transition. + * + * The callback must only be called when the caller is interested in that particular transition. + * For instance, if the caller is interested only in ENTERED transition, then the callback must + * not be called with the EXITED transition. + * + * IMPORTANT: If a transition is triggered resulting in this callback, the GNSS subsystem will + * wake up the application processor, if it is in suspend state. + * + * @param geofenceId The id associated with the addGeofenceArea. + * @param location The current GNSS location. + * @param transition Can be one of ENTERED, EXITED or UNCERTAIN. + * @param timestamp Timestamp (in UTC milliseconds) when the transition was detected. + */ + void gnssGeofenceTransitionCb(in int geofenceId, in GnssLocation location, in int transition, + in long timestampMillis); + + /** + * The callback associated with the availability of the GNSS system for geofencing monitoring. + * If the GNSS system determines that it cannot monitor geofences because of lack of reliability + * or unavailability of the GNSS signals, it will call this callback with UNAVAILABLE parameter. + * + * @param status - UNAVAILABLE or AVAILABLE. + * @param lastLocation - Last known location. + */ + void gnssGeofenceStatusCb(in int availability, in GnssLocation lastLocation); + + /** + * The callback associated with the addGeofence call. + * + * @param geofenceId Id of the geofence. + * @param status Returns OPERATION_SUCCESS if the geofence add was successful, + * returns ERROR_TOO_MANY_GEOFENCES if the geofence limit has been reached, + * returns ERROR_ID_EXISTS if geofence with id already exists, + * returns ERROR_INVALID_TRANSITION if the monitorTransition contains an invalid + * transition, and + * returns ERROR_GENERIC for other errors. + */ + void gnssGeofenceAddCb(in int geofenceId, in int status); + + /** + * The callback associated with the removeGeofence call. + * + * @param geofenceId Id of the geofence. + * @param status Returns OPERATION_SUCCESS if successful, + * returns ERROR_ID_UNKNOWN for invalid id and + * returns ERROR_GENERIC for others. + */ + void gnssGeofenceRemoveCb(in int geofenceId, in int status); + + /** + * The callback associated with the pauseGeofence call. + * + * @param geofenceId Id of the geofence. + * @param status Returns OPERATION_SUCCESS if success, + * returns ERROR_ID_UNKNOWN for invalid id, + * returns ERROR_INVALID_TRANSITION when monitorTransitions is invalid, and + * returns ERROR_GENERIC for other err errors. + */ + void gnssGeofencePauseCb(in int geofenceId, in int status); + + /** + * The callback associated with the resumeGeofence call. + * + * @param geofenceId - Id of the geofence. + * @param status Returns OPERATION_SUCCESS if successful, + * returns ERROR_ID_UNKNOWN for invalid id, and + * returns ERROR_GENERIC for others. + */ + void gnssGeofenceResumeCb(in int geofenceId, in int status); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl index 328cf2abadd02c76d269c295618dc7899206e20c..a8bd8a32192aa1018e430a126485a0bafa9643c6 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementCallback.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.GnssData; /** * The callback interface to report GNSS Measurement from the HAL. + * + * @hide */ @VintfStability interface IGnssMeasurementCallback { @@ -29,4 +31,4 @@ interface IGnssMeasurementCallback { * @param data Contains a reading of GNSS measurements. */ void gnssMeasurementCb(in GnssData data); -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl index 08c83a42e7983ae17285d7d8ef464b5bd3bcba8e..8733754e968ffe426e4cc85fcd4098f6443420ea 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl @@ -20,9 +20,58 @@ import android.hardware.gnss.IGnssMeasurementCallback; /** * Extended interface for GNSS Measurement support. + * + * @hide */ @VintfStability interface IGnssMeasurementInterface { + /** + * Options specifying the GnssMeasurement request. + */ + @VintfStability + parcelable Options { + /** + * Enable full tracking mode. + * + * If true, GNSS chipset must switch off duty cycling. In such mode no clock discontinuities + * are expected and, when supported, carrier phase should be continuous in good signal + * conditions. All non-blocklisted, healthy constellations, satellites and frequency bands + * that the chipset supports must be reported in this mode. The GNSS chipset is allowed to + * consume more power in this mode. If false, API must optimize power via duty cycling, + * constellations and frequency limits, etc. + */ + boolean enableFullTracking; + + /** + * Enable Correlation Vector outputs. + * + * If true, enable correlation vectors as part of the raw GNSS measurements outputs. If + * false, disable correlation vectors. + */ + boolean enableCorrVecOutputs; + + /** + * Time interval between the reported measurements in milliseconds. + * + * When there is no concurrent location and measurement requests, the GNSS chipset must + * report measurements at as close as possible to the requested rate, as is supported by the + * implementation. + * + * When there are concurrent location and measurement requests, the GNSS chipset must report + * measurements at the same or a faster rate than the requested. In the concurrency cases, + * all the available measurements must be reported to the framework. + * + * For cases where concurrently serving the location and the measurement requests would not + * consume more power than only the measurement request, the faster rate of the 2 requests + * must be chosen. Otherwise, it is recommended that the GNSS chipset minimizes the power + * consumption with appropriate location and measurement intervals to satisfy both requests. + * For example, for 2-sec measurement interval request and 7-sec location interval request, + * the GNSS chipset is recommended to run the measurement engine with 2-sec interval and the + * location engine with 6-sec interval. + */ + int intervalMs; + } + /** * Initializes the interface and registers the callback routines with the HAL. After a * successful call to 'setCallback' the HAL must begin to provide updates at an average @@ -39,13 +88,9 @@ interface IGnssMeasurementInterface { * * @param enableCorrVecOutputs If true, enable correlation vectors as part of the raw GNSS * measurements outputs. If false, disable correlation vectors. - * - * Returns ok() if successful. Returns ERROR_ALREADY_INIT if a callback has already been - * registered without a corresponding call to 'close'. Returns ERROR_GENERIC for any other - * error. The HAL must not generate any other updates upon returning this error code. */ void setCallback(in IGnssMeasurementCallback callback, in boolean enableFullTracking, - in boolean enableCorrVecOutputs); + in boolean enableCorrVecOutputs); /** * Stops updates from the HAL, and unregisters the callback routines. After a call to close(), @@ -55,4 +100,11 @@ interface IGnssMeasurementInterface { * no work. */ void close(); -} \ No newline at end of file + + /** + * Initializes the interface and registers the callback routines with the HAL. + * + * @param options See Options definition. + */ + void setCallbackWithOptions(in IGnssMeasurementCallback callback, in Options options); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6990e19ff65045bb074568fc474882aa22ddd828 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageCallback.aidl @@ -0,0 +1,244 @@ +/* + * 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 android.hardware.gnss; + +/** + * Represents a GNSS navigation message (or a fragment of it). + * + * @hide + */ +@VintfStability +interface IGnssNavigationMessageCallback { + /** + * Represents a reading of GNSS measurements. For devices launched in Android Q or newer, it is + * mandatory that these be provided, on request, when the GNSS receiver is searching/tracking + * signals. + * + * - Reporting of GNSS constellation measurements is mandatory. + * - Reporting of all tracked constellations are encouraged. + */ + @VintfStability + parcelable GnssNavigationMessage { + /** + * Status of Navigation Message + * + * When a message is received properly without any parity error in its + * navigation words, the status must be set to PARITY_PASSED. + * + * If a message is received with words that failed a parity check, but the GNSS + * receiver has corrected those words, the status must be set to PARITY_REBUILT. + * + * Do not send any navigation message that contains words with parity errors + * that cannot be corrected. + */ + const int STATUS_PARITY_PASSED = (1 << 0); + const int STATUS_PARITY_REBUILT = (1 << 1); + const int STATUS_UNKNOWN = 0; + + /** + * Enumeration of available values to indicate the GNSS Navigation message + * types. + * + * For convenience, first byte is the GnssConstellationType on which that signal + * is typically transmitted. + */ + @VintfStability + @Backing(type="int") + enum GnssNavigationMessageType { + UNKNOWN = 0, + + /** GPS L1 C/A message contained in the structure. */ + GPS_L1CA = 0x0101, + + /** GPS L2-CNAV message contained in the structure. */ + GPS_L2CNAV = 0x0102, + + /** GPS L5-CNAV message contained in the structure. */ + GPS_L5CNAV = 0x0103, + + /* SBAS message contained in the structure. */ + SBS = 0x0201, + + /** GPS CNAV-2 message contained in the structure. */ + GPS_CNAV2 = 0x0104, + + /** Glonass L1 CA message contained in the structure. */ + GLO_L1CA = 0x0301, + + /** QZSS L1 C/A message contained in the structure. */ + QZS_L1CA = 0x0401, + + /** Beidou D1 message contained in the structure. */ + BDS_D1 = 0x0501, + + /** Beidou D2 message contained in the structure. */ + BDS_D2 = 0x0502, + + /** Beidou CNAV1 message contained in the structure. */ + BDS_CNAV1 = 0x0503, + + /** Beidou CNAV2 message contained in the structure. */ + BDS_CNAV2 = 0x0504, + + /** Galileo I/NAV message contained in the structure. */ + GAL_I = 0x0601, + + /** Galileo F/NAV message contained in the structure. */ + GAL_F = 0x0602, + + /** IRNSS L5 C/A message contained in the structure. */ + IRN_L5CA = 0x0701, + } + + /** + * Satellite vehicle ID number, as defined in GnssSvInfo::svid + * + * This is a mandatory value. + */ + int svid; + + /** + * The type of message contained in the structure. + * + * This is a mandatory value. + */ + GnssNavigationMessageType type; + + /** + * The status of the received navigation message. + * + * It is a bitfield of constants with prefix "STATUS_" defined in this structure. + * + * No need to send any navigation message that contains words with parity + * errors that cannot be corrected. + */ + int status; + + /** + * Message identifier. It provides an index so the complete Navigation + * Message can be assembled. + * + * - For GNSS L1 C/A subframe 4 and 5, this value corresponds to the 'frame + * id' of the navigation message, in the range of 1-25 (Subframe 1, 2, 3 + * does not contain a 'frame id' and this value can be set to -1.) + * + * - For Glonass L1 C/A, this refers to the frame ID, in the range of 1-5. + * + * - For BeiDou D1, this refers to the frame number in the range of 1-24 + * + * - For Beidou D2, this refers to the frame number, in the range of 1-120 + * + * - For Galileo F/NAV nominal frame structure, this refers to the subframe + * number, in the range of 1-12 + * + * - For Galileo I/NAV nominal frame structure, this refers to the subframe + * number in the range of 1-24 + * + * - For SBAS and Beidou CNAV2, this is unused and can be set to -1. + * + * - For QZSS L1 C/A subframe 4 and 5, this value corresponds to the 'frame id' of the + * navigation message, in the range of 1-25. (Subframe 1, 2, 3 does not contain a 'frame + * id' and this value can be set to -1.) + * + * - For Beidou CNAV1 this refers to the page type number in the range of 1-63. + * + * - For IRNSS L5 C/A subframe 3 and 4, this value corresponds to the Message Id of the + * navigation message, in the range of 1-63. (Subframe 1 and 2 does not contain a message + * type id and this value can be set to -1.) + */ + int messageId; + + /** + * Sub-message identifier. If required by the message 'type', this value contains a + * sub-index within the current message (or frame) that is being transmitted. + * + * - For GNSS L1 C/A, BeiDou D1 & BeiDou D2, the submessage id corresponds to the subframe + * number of the navigation message, in the range of 1-5. + * + * - For Glonass L1 C/A, this refers to the String number, in the range from 1-15. + * + * - For Galileo F/NAV, this refers to the page type in the range 1-6. + * + * - For Galileo I/NAV, this refers to the word type in the range 0-10+. A value of 0 is + * only allowed if the Satellite is transmiting a Spare Word. + * + * - For Galileo in particular, the type information embedded within the data bits may be + * even more useful in interpretation, than the nominal page and word types provided in + * this field. + * + * - For SBAS, the submessage id corresponds to the message type, in the range 1-63. + * + * - For Beidou CNAV1, the submessage id corresponds to the subframe number of the + * navigation message, in the range of 1-3. + * + * - For Beidou CNAV2, the submessage id corresponds to the message type, in the range 1-63. + * + * - For IRNSS L5 C/A, the submessage id corresponds to the subframe number of the + * navigation message, in the range of 1-4. + */ + int submessageId; + + /** + * The data of the reported GNSS message. The bytes (or words) are specified + * using big endian format (MSB first). + * + * - For GNSS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit + * words. Each word (30 bits) must fit into the last 30 bits in a + * 4-byte word (skip B31 and B32), with MSB first, for a total of 40 + * bytes, covering a time period of 6, 6, and 0.6 seconds, respectively. + * The standard followed is 1995 SPS Signal specification. + * + * - For Glonass L1 C/A, each string contains 85 data bits, including the + * checksum. These bits must fit into 11 bytes, with MSB first (skip + * B86-B88), covering a time period of 2 seconds. + * The standard followed is Glonass Interface Control Document Edition 5.1. + * + * - For Galileo F/NAV, each word consists of 238-bit (sync & tail symbols + * excluded). Each word must fit into 30-bytes, with MSB first (skip + * B239, B240), covering a time period of 10 seconds. The standard + * followed is European GNSS(Galileo) Signal in Space Interface + * Control Document Issue 1.2. + * + * - For Galileo I/NAV, each page contains 2 page parts, even and odd, with + * a total of 2x114 = 228 bits, (sync & tail excluded) that must fit + * into 29 bytes, with MSB first (skip B229-B232). The standard followed + * is same as above. + * + * - For SBAS, each block consists of 250 data bits, that should be fit into 32 bytes. MSB + * first (skip B251-B256). + * + * - For Beidou CNAV1, subframe #1 consists of 14 data bits, that should be fit into 2 + * bytes. MSB first (skip B15-B16). subframe #2 consists of 600 bits that should be fit + * into 75 bytes. subframe #3 consists of 264 data bits that should be fit into 33 bytes. + * + * - For Beidou CNAV2, each subframe consists of 288 data bits, that should be fit into 36 + * bytes. + * + * The data reported here must be the raw data as demodulated by the GNSS receiver, not data + * received from an external source (i.e. not from a server download.) + */ + byte[] data; + } + + /** + * The callback to report an available fragment of a GNSS navigation messages + * from the HAL. + * + * @param message - The GNSS navigation submessage/subframe representation. + */ + void gnssNavigationMessageCb(in GnssNavigationMessage message); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageInterface.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6c0f83a7822f1c6e9f25d65b9b7c4044e9262b9e --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/IGnssNavigationMessageInterface.aidl @@ -0,0 +1,48 @@ +/* + * 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 android.hardware.gnss; + +import android.hardware.gnss.IGnssNavigationMessageCallback; + +/** + * Extended interface for GNSS navigation message reporting support. + * + * @hide + */ +@VintfStability +interface IGnssNavigationMessageInterface { + /** + * Initializes the interface and registers the callback routines with the HAL. + * + * After a successful call to 'setCallback' the HAL must begin to provide updates as + * they become available. + * + * @param callback handle to IGnssNavigationMessageCallack interface. + */ + void setCallback(in IGnssNavigationMessageCallback callback); + + /** + * Stops updates from the HAL, and unregisters the callback routines. + * + * After a call to close(), the previously registered callbacks must be + * considered invalid by the HAL. + * + * If close() is invoked without a previous setCallback, this function must perform + * no work. + */ + void close(); +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssPowerIndication.aidl b/gnss/aidl/android/hardware/gnss/IGnssPowerIndication.aidl index 93fdadc886c81ae13d1155dad286d3cfe6061bab..1486095b4e8c98abcd3020fc9e6ac60e87ced373 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssPowerIndication.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssPowerIndication.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.IGnssPowerIndicationCallback; /** * Extended interface for GNSS Power Indication support. + * + * @hide */ @VintfStability interface IGnssPowerIndication { @@ -36,4 +38,4 @@ interface IGnssPowerIndication { * from IGnssPowerIndicationCallback.gnssPowerStatsCb(). */ oneway void requestGnssPowerStats(); -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssPowerIndicationCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssPowerIndicationCallback.aidl index 4474c0c69c4e41a10753bbae89e894e0ec33ed9c..8e6a6e45d5fb50a29cb5a672a7f95d8c234e67db 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssPowerIndicationCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssPowerIndicationCallback.aidl @@ -20,6 +20,8 @@ import android.hardware.gnss.GnssPowerStats; /** * The callback interface to report GNSS Power Indication from the HAL. + * + * @hide */ @VintfStability interface IGnssPowerIndicationCallback { @@ -60,4 +62,4 @@ interface IGnssPowerIndicationCallback { * @param gnssPowerStats GNSS power statistics since boot. */ oneway void gnssPowerStatsCb(in GnssPowerStats gnssPowerStats); -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl b/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl index 7c4609653fc8eabe25a408bbd630c97c9c5e2f2f..8de2dcfca8a2b2045f75f43f8f3605b82632d0e1 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssPsds.aidl @@ -22,6 +22,8 @@ import android.hardware.gnss.PsdsType; /** * This interface is used by the GNSS HAL to request the framework to download Predicted Satellite * Data Service data. + * + * @hide */ @VintfStability interface IGnssPsds { @@ -42,4 +44,4 @@ interface IGnssPsds { * @param callback Handle to the IGnssPsdsCallback interface. */ void setCallback(in IGnssPsdsCallback callback); -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/IGnssPsdsCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssPsdsCallback.aidl index 72b693b4a32838d15637c3a483bab310035e1491..bc31000217aa1928aaac1fbc8e4cac68e1f6dbdf 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssPsdsCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssPsdsCallback.aidl @@ -21,6 +21,8 @@ import android.hardware.gnss.PsdsType; /** * This interface is used by the GNSS HAL to request download data from Predicted Satellite Data * Service (PSDS). + * + * @hide */ @VintfStability interface IGnssPsdsCallback { @@ -34,4 +36,4 @@ interface IGnssPsdsCallback { * @param psdsType Type of PSDS data. */ void downloadRequestCb(in PsdsType psdsType); -} \ No newline at end of file +} diff --git a/gnss/aidl/android/hardware/gnss/PsdsType.aidl b/gnss/aidl/android/hardware/gnss/PsdsType.aidl index d4fec77adee9ef0b020783810851d008f96f8b4e..67a74c7e676de157d8a1435b0333a45b3ccf6813 100644 --- a/gnss/aidl/android/hardware/gnss/PsdsType.aidl +++ b/gnss/aidl/android/hardware/gnss/PsdsType.aidl @@ -16,7 +16,11 @@ package android.hardware.gnss; -/** The type of PSDS data. */ +/** + * The type of PSDS data. + * + * @hide + */ @VintfStability @Backing(type="int") enum PsdsType { diff --git a/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl b/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl index 4b7d5d68cb18480a496d24196270e3dee737f88c..84f35ffc88926339beaa81d9fc3b1a0a51f7b3d2 100644 --- a/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl +++ b/gnss/aidl/android/hardware/gnss/SatelliteClockInfo.aidl @@ -18,6 +18,8 @@ package android.hardware.gnss; /** * Contains estimates of the satellite clock info. + * + * @hide */ @VintfStability parcelable SatelliteClockInfo { diff --git a/gnss/aidl/android/hardware/gnss/SatellitePositionEcef.aidl b/gnss/aidl/android/hardware/gnss/SatellitePositionEcef.aidl index febe62333f6066a017efce2c2c1ac01d9c749149..105cb85c4a3ba89f801e3c0827f6d4f610285fbc 100644 --- a/gnss/aidl/android/hardware/gnss/SatellitePositionEcef.aidl +++ b/gnss/aidl/android/hardware/gnss/SatellitePositionEcef.aidl @@ -21,6 +21,8 @@ package android.hardware.gnss; * * The satellite position must be defined at the time of transmission of the * signal receivedSvTimeNs. + * + * @hide */ @VintfStability parcelable SatellitePositionEcef { diff --git a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl index a238e3fc26c183f5d3cb1eaf3850e108b5ff1221..2d52415e56ff3f422475c3c7bdd461d576473f24 100644 --- a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl @@ -23,6 +23,8 @@ import android.hardware.gnss.SatelliteVelocityEcef; /** * Contains estimates of the satellite position, velocity and time in the * ECEF coordinate frame. + * + * @hide */ @VintfStability parcelable SatellitePvt { @@ -74,4 +76,64 @@ parcelable SatellitePvt { /** Tropospheric delay in meters. */ double tropoDelayMeters; + + /** + * Time of Clock in seconds. + * + * This value is defined in seconds since GPS epoch, regardless of the constellation. + * + * The value must not be encoded as in GPS ICD200 documentation. + */ + long timeOfClockSeconds; + + /** + * Issue of Data, Clock. + * + * This is defined in GPS ICD200 documentation + * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf). + * + * The field must be set to 0 if it is not supported. + */ + int issueOfDataClock; + + /** + * Time of Ephemeris in seconds. + * + * This value is defined in seconds since GPS epoch, regardless of the constellation. + * + * The value must not be encoded as in GPS ICD200 documentation. + */ + long timeOfEphemerisSeconds; + + /** + * Issue of Data, Ephemeris. + * + * This is defined in GPS ICD200 documentation + * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf). + * + * The field must be set to 0 if it is not supported. + */ + int issueOfDataEphemeris; + + /** Satellite's ephemeris source */ + @VintfStability + @Backing(type="int") + enum SatelliteEphemerisSource { + // Demodulated from broadcast signals + DEMODULATED = 0, + // Server provided Normal type ephemeris data, which is similar to broadcast ephemeris in + // longevity (e.g. SUPL) - lasting for few hours and providing satellite orbit and clock + // with accuracy of 1 - 2 meters. + SERVER_NORMAL = 1, + // Server provided Long-Term type ephemeris data, which lasts for many hours to several days + // and often provides satellite orbit and clock accuracy of 2 - 20 meters. + SERVER_LONG_TERM = 2, + // Other source + OTHER = 3, + } + + /** + * Source of the ephemeris. + */ + SatelliteEphemerisSource ephemerisSource = SatelliteEphemerisSource.OTHER; } diff --git a/gnss/aidl/android/hardware/gnss/SatelliteVelocityEcef.aidl b/gnss/aidl/android/hardware/gnss/SatelliteVelocityEcef.aidl index f2d7ab6030914858bf34d834a20e5a2d3234e402..3d3ea1add3e080eb7bb43cdf24766ea779eb1bf4 100644 --- a/gnss/aidl/android/hardware/gnss/SatelliteVelocityEcef.aidl +++ b/gnss/aidl/android/hardware/gnss/SatelliteVelocityEcef.aidl @@ -21,6 +21,8 @@ package android.hardware.gnss; * * The satellite velocity must be defined at the time of transmission of the * signal receivedSvTimeNs. + * + * @hide */ @VintfStability parcelable SatelliteVelocityEcef { diff --git a/gnss/aidl/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl b/gnss/aidl/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4732ffc813b5ab7ca413eb23fb7a09a56503e111 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl @@ -0,0 +1,59 @@ +/* + * 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 android.hardware.gnss.measurement_corrections; + +/** + * GNSS measurement corrections callback interface. + * + * @hide + */ +@VintfStability +interface IMeasurementCorrectionsCallback { + /** + * Flags to indicate supported measurement corrections capabilities + * + * Either the LOS_SATS or the EXCESS_PATH_LENGTH capability must be supported. + */ + /** + * Capability bit flag indicating that GNSS supports line-of-sight satellite identification + * measurement corrections + */ + const int CAPABILITY_LOS_SATS = 1 << 0; + /** + * Capability bit flag indicating that GNSS supports per satellite excess-path-length + * measurement corrections + */ + const int CAPABILITY_EXCESS_PATH_LENGTH = 1 << 1; + /** + * Capability bit flag indicating that GNSS supports reflecting planes measurement + * corrections + */ + const int CAPABILITY_REFLECTING_PLANE = 1 << 2; + + /** + * Callback to inform framework the measurement correction specific capabilities of the GNSS + * HAL implementation. + * + * The GNSS HAL must call this method immediately after the framework opens the measurement + * corrections interface. + * + * @param capabilities A bit field of flags indicating the capabilities of measurement + * corrections. + * It is mandatory to support either LOS_STATS or EXCESS_PATH_LENGTH capability. + */ + void setCapabilitiesCb(in int capabilities); +} diff --git a/gnss/aidl/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl b/gnss/aidl/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl new file mode 100644 index 0000000000000000000000000000000000000000..841fed31540adca2d0c4849cfdb3f1454b085d78 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl @@ -0,0 +1,50 @@ +/* + * 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 android.hardware.gnss.measurement_corrections; + +import android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsCallback; +import android.hardware.gnss.measurement_corrections.MeasurementCorrections; + +/** + * Interface for measurement corrections support. + * + * @hide + */ +@VintfStability +interface IMeasurementCorrectionsInterface { + /** + * Injects measurement corrections to be used by the HAL to improve the GNSS location output. + * + * These are NOT to be used to adjust the IGnssMeasurementCallback output values - + * those remain raw, uncorrected measurements. + * + * In general, these are injected when conditions defined by the platform are met, such as when + * GNSS Location is being requested at a sufficiently high accuracy, based on the capabilities + * of the GNSS chipset as reported in the IGnssCallback. + * + * @param corrections The computed corrections to be used by the HAL. + */ + void setCorrections(in MeasurementCorrections corrections); + + /** + * Opens the interface and provides the callback routines to the implementation of this + * interface. + * + * @param callback Callback interface for IMeasurementCorrections. + */ + void setCallback(in IMeasurementCorrectionsCallback callback); +} diff --git a/gnss/aidl/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl b/gnss/aidl/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d6224b4fcc6d9ac2965173a4e2e0186498162b65 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl @@ -0,0 +1,104 @@ +/* + * 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 android.hardware.gnss.measurement_corrections; + +import android.hardware.gnss.measurement_corrections.SingleSatCorrection; + +/** + * A struct containing a set of measurement corrections for all used GNSS satellites at the location + * specified by latitudeDegrees, longitudeDegrees, altitudeMeters and at the time of week specified + * toaGpsNanosecondsOfWeek + * + * @hide + */ +@VintfStability +parcelable MeasurementCorrections { + /** Represents latitude in degrees at which the corrections are computed.. */ + double latitudeDegrees; + + /** Represents longitude in degrees at which the corrections are computed.. */ + double longitudeDegrees; + + /** + * Represents altitude in meters above the WGS 84 reference ellipsoid at which the corrections + * are computed. + */ + double altitudeMeters; + + /** + * Represents the horizontal uncertainty (63% to 68% confidence) in meters on the device + * position at which the corrections are provided. + * + * This value is useful for example to judge how accurate the provided corrections are. + */ + double horizontalPositionUncertaintyMeters; + + /** + * Represents the vertical uncertainty (63% to 68% confidence) in meters on the device position + * at which the corrections are provided. + * + * This value is useful for example to judge how accurate the provided corrections are. + */ + double verticalPositionUncertaintyMeters; + + /** Time Of Applicability, GPS time of week in nanoseconds. */ + long toaGpsNanosecondsOfWeek; + + /** + * A set of SingleSatCorrection each containing measurement corrections for a satellite in view + */ + SingleSatCorrection[] satCorrections; + + /** + * Boolean indicating if environment bearing is available. + */ + boolean hasEnvironmentBearing; + + /** + * Environment bearing in degrees clockwise from true North (0.0 to 360.0], in direction of + * user motion. Environment bearing is provided when it is known with high probability that + * velocity is aligned with an environment feature, such as a building or road. + * + * If user speed is zero, environmentBearingDegrees represents bearing of most recent speed + * that was > 0. + * + * As position approaches another road, environmentBearingUncertaintyDegrees will grow, and at + * some stage hasEnvironmentBearing = false. + * + * As position moves towards an open area, environmentBearingUncertaintyDegrees will grow, and + * at some stage hasEnvironmentBearing = false. + * + * If the road is curved in the vicinity of the user location, then + * environmentBearingUncertaintyDegrees will include the amount by which the road direction + * changes in the area of position uncertainty. + * + * hasEnvironmentBearing should be checked to verify the environment bearing is available + * before calling this method. The value is undefined if hasEnvironmentBearing is false. + */ + float environmentBearingDegrees; + + /** + * Environment bearing uncertainty [0 to 180]. It represents the standard deviation of the + * physical structure in the circle of position uncertainty. hasEnvironmentBearing becomes false + * as the uncertainty value passes a predefined threshold depending on the physical structure + * around the user. + * + * hasEnvironmentBearing should be checked to verify the environment bearing is available + * before calling this method. The value is undefined if hasEnvironmentBearing is false. + */ + float environmentBearingUncertaintyDegrees; +} diff --git a/gnss/aidl/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl b/gnss/aidl/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl new file mode 100644 index 0000000000000000000000000000000000000000..810437271ce7386f9f1739e9fc98f19b46abd9cd --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl @@ -0,0 +1,45 @@ +/* + * 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 android.hardware.gnss.measurement_corrections; + +/** + * A struct containing the characteristics of the reflecting plane that the satellite signal has + * bounced from. + * + * The value is only valid if HAS_REFLECTING_PLANE flag is set. An invalid reflecting plane + * means either reflection planes serving is not supported or the satellite signal has gone + * through multiple reflections. + * + * @hide + */ +@VintfStability +parcelable ReflectingPlane { + /** Represents latitude of the reflecting plane in degrees. */ + double latitudeDegrees; + + /** Represents longitude of the reflecting plane in degrees. */ + double longitudeDegrees; + + /** + * Represents altitude of the reflecting point in the plane in meters above the WGS 84 reference + * ellipsoid. + */ + double altitudeMeters; + + /** Represents azimuth clockwise from north of the reflecting plane in degrees. */ + double reflectingPlaneAzimuthDegrees; +} diff --git a/gnss/aidl/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl b/gnss/aidl/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl new file mode 100644 index 0000000000000000000000000000000000000000..56c691c3a4d2614f334e4713366f62d4e7454f3a --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl @@ -0,0 +1,140 @@ +/* + * 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 android.hardware.gnss.measurement_corrections; + +import android.hardware.gnss.GnssConstellationType; +import android.hardware.gnss.measurement_corrections.ReflectingPlane; + +/** + * A struct with measurement corrections for a single visible satellites + * + * The bit mask singleSatCorrectionFlags indicates which correction values are valid in the struct + * + * @hide + */ +@VintfStability +parcelable SingleSatCorrection { + /** Bit mask to indicate which values are valid in a SingleSatCorrection object. */ + /** GnssSingleSatCorrectionFlags has valid probSatIsLos field. */ + const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 0x0001; + /** GnssSingleSatCorrectionFlags has valid combinedExcessPathLengthMeters field. */ + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH = 0x0002; + /** GnssSingleSatCorrectionFlags has valid combinedExcessPathLengthUncertaintyMeters field. */ + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC = 0x0004; + /** GnssSingleSatCorrectionFlags has valid combinedAttenuationDb field. */ + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION = 0x0010; + + /** Contains GnssSingleSatCorrectionFlags bits. */ + int singleSatCorrectionFlags; + + /** + * Defines the constellation of the given satellite. + */ + GnssConstellationType constellation; + + /** + * Satellite vehicle ID number, as defined in GnssSvInfo::svid + */ + int svid; + + /** + * Carrier frequency of the signal to be corrected, for example it can be the + * GPS center frequency for L1 = 1,575,420,000 Hz, varying GLO channels, etc. + * + * For a receiver with capabilities to track multiple frequencies for the same satellite, + * multiple corrections for the same satellite may be provided. + */ + long carrierFrequencyHz; + + /** + * The probability that the satellite is estimated to be in Line-of-Sight condition at the given + * location. + */ + float probSatIsLos; + + /** + * Combined excess path length to be subtracted from pseudorange before using it in + * calculating location. + * + * The value is computed by correlating the individual paths and picking the delay at the + * highest peak. + * + * Note this value is NOT to be used to adjust the GnssMeasurementCallback outputs. + */ + float combinedExcessPathLengthMeters; + + /** + * Error estimate (1-sigma) for the Excess path length estimate. + * + * The value is computed by combining the individual excessPathLengthUncertaintyMeters values + * into a single value for this satellite. + */ + float combinedExcessPathLengthUncertaintyMeters; + + /** + * Combined expected reduction of signal strength for this satellite in non-negative dB. + */ + float combinedAttenuationDb; + + /** + * A struct for the info of an excess path caused by reflection. + */ + @VintfStability + parcelable ExcessPathInfo { + /** ExcessPathInfo has valid Excess Path Length field. */ + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH = 0x0001; + /** ExcessPathInfo has valid Excess Path Length Uncertainty field. */ + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC = 0x0002; + /** ExcessPathInfo has valid Reflecting Plane field. */ + const int EXCESS_PATH_INFO_HAS_REFLECTING_PLANE = 0x0004; + /** ExcessPathInfo has valid Attenuation field. */ + const int EXCESS_PATH_INFO_HAS_ATTENUATION = 0x0008; + + /** Contains flag bits to indicate which fields exist in the ExcessPathInfo object. */ + int excessPathInfoFlags; + + /** + * Excess path length to be subtracted from pseudorange before using it in calculating + * location. + * + * Note this value is NOT to be used to adjust the GnssMeasurementCallback outputs. + */ + float excessPathLengthMeters; + + /** Error estimate (1-sigma) for the Excess path length estimate. */ + float excessPathLengthUncertaintyMeters; + + /** + * Defines the reflecting plane characteristics such as location and azimuth. + * + * The value is only valid if HAS_REFLECTING_PLANE flag is set. An invalid reflecting plane + * means either reflection planes serving is not supported or the satellite signal has gone + * through multiple reflections. + */ + ReflectingPlane reflectingPlane; + + /** + * The expected reduction of signal strength of this path in non-negative dB. + */ + float attenuationDb; + } + + /** + * A list of excess path info. + */ + ExcessPathInfo[] excessPathInfos; +} diff --git a/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2fdf0bec0709c0ea20c1ae41b8e5a917f2b1f8ee --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl @@ -0,0 +1,84 @@ +/* + * 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 android.hardware.gnss.visibility_control; + +import android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback; + +/** + * Represents the GNSS location reporting permissions and notification interface. + * + * This interface is used to tell the GNSS HAL implementation whether the framework user has + * granted permission to the GNSS HAL implementation to provide GNSS location information for + * non-framework (NFW), non-user initiated emergency use cases, and to notify the framework user + * of these GNSS location information deliveries. + * + * For user initiated emergency cases (and for the configured extended emergency session duration), + * the GNSS HAL implementation must serve the emergency location supporting network initiated + * location requests immediately irrespective of this permission settings. + * + * There is no separate need for the GNSS HAL implementation to monitor the global device location + * on/off setting. Permission to use GNSS for non-framework use cases is expressly controlled + * by the method enableNfwLocationAccess(). The framework monitors the location permission settings + * of the configured proxy applications(s), and device location settings, and calls the method + * enableNfwLocationAccess() whenever the user control proxy applications have, or do not have, + * location permission. The proxy applications are used to provide user visibility and control of + * location access by the non-framework on/off device entities they are representing. + * + * For device user visibility, the GNSS HAL implementation must call the method + * IGnssVisibilityControlCallback.nfwNotifyCb() whenever location request is rejected or + * location information is provided to non-framework entities (on or off device). This includes + * the network initiated location requests for user-initiated emergency use cases as well. + * + * The HAL implementations that support this interface must not report GNSS location, measurement, + * status, or other information that can be used to derive user location to any entity when not + * expressly authorized by this HAL. This includes all endpoints for location information + * off the device, including carriers, vendors, OEM and others directly or indirectly. + * + * @hide + */ +@VintfStability +interface IGnssVisibilityControl { + /** + * Enables/disables non-framework entity location access permission in the GNSS HAL. + * + * The framework will call this method to update GNSS HAL implementation every time the + * framework user, through the given proxy application(s) and/or device location settings, + * explicitly grants/revokes the location access permission for non-framework, non-user + * initiated emergency use cases. + * + * Whenever the user location information is delivered to non-framework entities, the HAL + * implementation must call the method IGnssVisibilityControlCallback.nfwNotifyCb() to notify + * the framework for user visibility. + * + * @param proxyApps Full list of package names of proxy Android applications representing + * the non-framework location access entities (on/off the device) for which the framework + * user has granted non-framework location access permission. The GNSS HAL implementation + * must provide location information only to non-framework entities represented by these + * proxy applications. + * + * The package name of the proxy Android application follows the standard Java language + * package naming format. For example, com.example.myapp. + */ + void enableNfwLocationAccess(in @utf8InCpp String[] proxyApps); + + /** + * Registers the callback for HAL implementation to use. + * + * @param callback Handle to IGnssVisibilityControlCallback interface. + */ + void setCallback(in IGnssVisibilityControlCallback callback); +} diff --git a/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8b08098f70c0ad70b0fd98276f1b632a11eda710 --- /dev/null +++ b/gnss/aidl/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl @@ -0,0 +1,178 @@ +/* + * 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 android.hardware.gnss.visibility_control; + +/** + * GNSS location reporting permissions and notification callback interface. + * + * @hide + */ +@VintfStability +interface IGnssVisibilityControlCallback { + /** + * Protocol stack that is requesting the non-framework location information. + */ + @VintfStability + @Backing(type="int") + enum NfwProtocolStack { + /** Cellular control plane requests */ + CTRL_PLANE = 0, + + /** All types of SUPL requests */ + SUPL = 1, + + /** All types of requests from IMS */ + IMS = 10, + + /** All types of requests from SIM */ + SIM = 11, + + /** Requests from other protocol stacks */ + OTHER_PROTOCOL_STACK = 100 + } + + /** + * Entity that is requesting/receiving the location information. + */ + @VintfStability + @Backing(type="int") + enum NfwRequestor { + /** Wireless service provider */ + CARRIER = 0, + + /** Device manufacturer */ + OEM = 10, + + /** Modem chipset vendor */ + MODEM_CHIPSET_VENDOR = 11, + + /** GNSS chipset vendor */ + GNSS_CHIPSET_VENDOR = 12, + + /** Other chipset vendor */ + OTHER_CHIPSET_VENDOR = 13, + + /** Automobile client */ + AUTOMOBILE_CLIENT = 20, + + /** Other sources */ + OTHER_REQUESTOR = 100 + } + + /** + * GNSS response type for non-framework location requests. + */ + @VintfStability + @Backing(type="int") + enum NfwResponseType { + /** Request rejected because framework has not given permission for this use case */ + REJECTED = 0, + + /** Request accepted but could not provide location because of a failure */ + ACCEPTED_NO_LOCATION_PROVIDED = 1, + + /** Request accepted and location provided */ + ACCEPTED_LOCATION_PROVIDED = 2, + } + + /** + * Represents a non-framework location information request/response notification. + */ + @VintfStability + parcelable NfwNotification { + /** + * Package name of the Android proxy application representing the non-framework + * entity that requested location. Set to empty string if unknown. + * + * For user-initiated emergency use cases, this field must be set to empty string + * and the inEmergencyMode field must be set to true. + */ + String proxyAppPackageName; + + /** Protocol stack that initiated the non-framework location request. */ + NfwProtocolStack protocolStack; + + /** + * Name of the protocol stack if protocolStack field is set to OTHER_PROTOCOL_STACK. + * Otherwise, set to empty string. + * + * This field is opaque to the framework and used for logging purposes. + */ + String otherProtocolStackName; + + /** Source initiating/receiving the location information. */ + NfwRequestor requestor; + + /** + * Identity of the endpoint receiving the location information. For example, carrier + * name, OEM name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. + * + * This field is opaque to the framework and used for logging purposes. + */ + String requestorId; + + /** Indicates whether location information was provided for this request. */ + NfwResponseType responseType; + + /** Is the device in user initiated emergency session. */ + boolean inEmergencyMode; + + /** Is cached location provided */ + boolean isCachedLocation; + } + + /** + * Callback to report a non-framework delivered location. + * + * The GNSS HAL implementation must call this method to notify the framework whenever + * a non-framework location request is made to the GNSS HAL. + * + * Non-framework entities like low power sensor hubs that request location from GNSS and + * only pass location information through Android framework controls are exempt from this + * power-spending reporting. However, low power sensor hubs or other chipsets which may send + * the location information to anywhere other than Android framework (which provides user + * visibility and control), must report location information use through this API whenever + * location information (or events driven by that location such as "home" location detection) + * leaves the domain of that low power chipset. + * + * To avoid overly spamming the framework, high speed location reporting of the exact same + * type may be throttled to report location at a lower rate than the actual report rate, as + * long as the location is reported with a latency of no more than the larger of 5 seconds, + * or the next the Android processor awake time. For example, if an Automotive client is + * getting location information from the GNSS location system at 20Hz, this method may be + * called at 1Hz. As another example, if a low power processor is getting location from the + * GNSS chipset, and the Android processor is asleep, the notification to the Android HAL may + * be delayed until the next wake of the Android processor. + * + * @param notification Non-framework delivered location request/response description. + */ + void nfwNotifyCb(in NfwNotification notification); + + /** + * Tells if the device is currently in an emergency session. + * + * Emergency session is defined as the device being actively in a user initiated emergency + * call or in post emergency call extension time period. + * + * If the GNSS HAL implementation cannot determine if the device is in emergency session + * mode, it must call this method to confirm that the device is in emergency session before + * serving network initiated emergency SUPL and Control Plane location requests. + * + * @return success True if the framework determines that the device is in emergency session. + */ + boolean isInEmergencySession(); +} diff --git a/gnss/aidl/default/AGnss.cpp b/gnss/aidl/default/AGnss.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e8d5ef7e1e4372067f7d945114df5fcd20b1dccf --- /dev/null +++ b/gnss/aidl/default/AGnss.cpp @@ -0,0 +1,47 @@ +/* + * 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_TAG "AGnssAidl" + +#include "AGnss.h" +#include +#include + +namespace aidl::android::hardware::gnss { + +std::shared_ptr AGnss::sCallback = nullptr; + +ndk::ScopedAStatus AGnss::setCallback(const std::shared_ptr& callback) { + ALOGD("AGnss::setCallback"); + std::unique_lock lock(mMutex); + sCallback = callback; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AGnss::setServer(AGnssType type, const std::string& hostname, int port) { + ALOGD("AGnss::setServer: type: %s, hostname: %s, port: %d", toString(type).c_str(), + hostname.c_str(), port); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AGnss::dataConnOpen(int64_t networkHandle, const std::string& apn, + ApnIpType apnIpType) { + ALOGD("AGnss::dataConnOpen: networkHandle:%" PRId64 ", apn: %s, apnIpType %s", networkHandle, + apn.c_str(), toString(apnIpType).c_str()); + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/AGnss.h b/gnss/aidl/default/AGnss.h new file mode 100644 index 0000000000000000000000000000000000000000..cd973e11b667626c66d02b9b0de300399c7a1cdf --- /dev/null +++ b/gnss/aidl/default/AGnss.h @@ -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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::gnss { + +using AGnssType = IAGnssCallback::AGnssType; + +struct AGnss : public BnAGnss { + public: + ndk::ScopedAStatus setCallback(const std::shared_ptr& callback) override; + ndk::ScopedAStatus dataConnClosed() override { return ndk::ScopedAStatus::ok(); } + ndk::ScopedAStatus dataConnFailed() override { return ndk::ScopedAStatus::ok(); } + ndk::ScopedAStatus setServer(AGnssType type, const std::string& hostname, int port) override; + ndk::ScopedAStatus dataConnOpen(int64_t networkHandle, const std::string& apn, + ApnIpType apnIpType) override; + + private: + // Synchronization lock for sCallback + mutable std::mutex mMutex; + // Guarded by mMutex + static std::shared_ptr sCallback; +}; + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/AGnssRil.cpp b/gnss/aidl/default/AGnssRil.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2aa1abcb988531eb75408bb1603283ee8bad9c90 --- /dev/null +++ b/gnss/aidl/default/AGnssRil.cpp @@ -0,0 +1,58 @@ +/* + * 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_TAG "AGnssRilAidl" + +#include "AGnssRil.h" +#include +#include + +namespace aidl::android::hardware::gnss { + +std::shared_ptr AGnssRil::sCallback = nullptr; + +ndk::ScopedAStatus AGnssRil::setCallback(const std::shared_ptr& callback) { + ALOGD("AGnssRil::setCallback"); + std::unique_lock lock(mMutex); + sCallback = callback; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AGnssRil::setRefLocation(const AGnssRefLocation& agnssReflocation) { + const AGnssRefLocationCellID& cellInfo = agnssReflocation.cellID; + ALOGD("AGnssRil::setRefLocation: type: %s, mcc: %d, mnc: %d, lac: %d, cid: %" PRId64 + ", tac: %d, pcid: " + "%d, arfcn: %d", + toString(agnssReflocation.type).c_str(), cellInfo.mcc, cellInfo.mnc, cellInfo.lac, + cellInfo.cid, cellInfo.tac, cellInfo.pcid, cellInfo.arfcn); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AGnssRil::setSetId(SetIdType type, const std::string& setid) { + ALOGD("AGnssRil::setSetId: type:%s, setid: %s", toString(type).c_str(), setid.c_str()); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AGnssRil::updateNetworkState(const NetworkAttributes& attributes) { + ALOGD("AGnssRil::updateNetworkState: networkHandle:%" PRId64 + ", isConnected: %d, capabilities: %d, " + "apn: %s", + attributes.networkHandle, attributes.isConnected, attributes.capabilities, + attributes.apn.c_str()); + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/AGnssRil.h b/gnss/aidl/default/AGnssRil.h new file mode 100644 index 0000000000000000000000000000000000000000..e205b69763b553fe6bdd2d5407e07265fc4d6615 --- /dev/null +++ b/gnss/aidl/default/AGnssRil.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::gnss { + +struct AGnssRil : public BnAGnssRil { + public: + ndk::ScopedAStatus setCallback(const std::shared_ptr& callback) override; + ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override; + ndk::ScopedAStatus setSetId(SetIdType type, const std::string& setid) override; + ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override; + + private: + // Synchronization lock for sCallback + mutable std::mutex mMutex; + // Guarded by mMutex + static std::shared_ptr sCallback; +}; + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp index c028dd764e6d8d5160080abf65001754d853a2c5..c8ae6b263d841864cf4cffb6b570d835154e05ca 100644 --- a/gnss/aidl/default/Android.bp +++ b/gnss/aidl/default/Android.bp @@ -31,7 +31,6 @@ cc_binary { ], vintf_fragments: [ "gnss-default.xml", - "gnss@2.1-service.xml", ], vendor: true, cflags: [ @@ -47,20 +46,27 @@ cc_binary { "liblog", "android.hardware.gnss@2.1", "android.hardware.gnss@2.0", - "android.hardware.gnss@1.1", "android.hardware.gnss@1.0", "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss.visibility_control@1.0", - "android.hardware.gnss-V1-ndk", + "android.hardware.gnss-V2-ndk", ], srcs: [ + "AGnssRil.cpp", + "AGnss.cpp", "Gnss.cpp", - "GnssHidlHal.cpp", + "GnssAntennaInfo.cpp", + "GnssBatching.cpp", + "GnssDebug.cpp", + "GnssGeofence.cpp", + "GnssNavigationMessageInterface.cpp", "GnssPowerIndication.cpp", "GnssPsds.cpp", "GnssConfiguration.cpp", "GnssMeasurementInterface.cpp", + "GnssVisibilityControl.cpp", + "MeasurementCorrectionsInterface.cpp", "service.cpp", ], static_libs: [ diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp index 6061eec817bfe61ae5bfebb8ba0fd645449c29a6..cf2c90d3591a1c2d3d003663a6c367138b6ac188 100644 --- a/gnss/aidl/default/Gnss.cpp +++ b/gnss/aidl/default/Gnss.cpp @@ -17,74 +17,356 @@ #define LOG_TAG "GnssAidl" #include "Gnss.h" +#include #include +#include +#include "AGnss.h" +#include "AGnssRil.h" +#include "DeviceFileReader.h" +#include "FixLocationParser.h" +#include "GnssAntennaInfo.h" +#include "GnssBatching.h" #include "GnssConfiguration.h" -#include "GnssMeasurementInterface.h" +#include "GnssDebug.h" +#include "GnssGeofence.h" +#include "GnssNavigationMessageInterface.h" #include "GnssPsds.h" +#include "GnssVisibilityControl.h" +#include "MeasurementCorrectionsInterface.h" +#include "Utils.h" namespace aidl::android::hardware::gnss { +using ::android::hardware::gnss::common::Utils; + +using ndk::ScopedAStatus; +using GnssSvInfo = IGnssCallback::GnssSvInfo; + +constexpr int TTFF_MILLIS = 2200; std::shared_ptr Gnss::sGnssCallback = nullptr; -ndk::ScopedAStatus Gnss::setCallback(const std::shared_ptr& callback) { - ALOGD("Gnss::setCallback"); +Gnss::Gnss() : mMinIntervalMs(1000), mFirstFixReceived(false) {} + +ScopedAStatus Gnss::setCallback(const std::shared_ptr& callback) { + ALOGD("setCallback"); if (callback == nullptr) { ALOGE("%s: Null callback ignored", __func__); - return ndk::ScopedAStatus::fromExceptionCode(STATUS_INVALID_OPERATION); + return ScopedAStatus::fromExceptionCode(STATUS_INVALID_OPERATION); } - sGnssCallback = callback; - int capabilities = (int)(IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST | - IGnssCallback::CAPABILITY_SATELLITE_PVT | - IGnssCallback::CAPABILITY_CORRELATION_VECTOR); - + int capabilities = + (int)(IGnssCallback::CAPABILITY_MEASUREMENTS | IGnssCallback::CAPABILITY_SCHEDULING | + IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST | + IGnssCallback::CAPABILITY_SATELLITE_PVT | + IGnssCallback::CAPABILITY_CORRELATION_VECTOR | + IGnssCallback::CAPABILITY_ANTENNA_INFO); auto status = sGnssCallback->gnssSetCapabilitiesCb(capabilities); if (!status.isOk()) { - ALOGE("%s: Unable to invoke callback.gnssSetCapabilities", __func__); + ALOGE("%s: Unable to invoke callback.gnssSetCapabilitiesCb", __func__); } - return ndk::ScopedAStatus::ok(); + IGnssCallback::GnssSystemInfo systemInfo = { + .yearOfHw = 2022, + .name = "Google Mock GNSS Implementation AIDL v2", + }; + status = sGnssCallback->gnssSetSystemInfoCb(systemInfo); + if (!status.isOk()) { + ALOGE("%s: Unable to invoke callback.gnssSetSystemInfoCb", __func__); + } + + return ScopedAStatus::ok(); +} + +std::unique_ptr Gnss::getLocationFromHW() { + if (!::android::hardware::gnss::common::ReplayUtils::hasFixedLocationDeviceFile()) { + return nullptr; + } + std::string inputStr = + ::android::hardware::gnss::common::DeviceFileReader::Instance().getLocationData(); + return ::android::hardware::gnss::common::FixLocationParser::getLocationFromInputStr(inputStr); } -ndk::ScopedAStatus Gnss::close() { - ALOGD("Gnss::close"); +ScopedAStatus Gnss::start() { + ALOGD("start()"); + if (mIsActive) { + ALOGW("Gnss has started. Restarting..."); + stop(); + } + + mIsActive = true; + mThreadBlocker.reset(); + // notify measurement engine to update measurement interval + mGnssMeasurementInterface->setLocationEnabled(true); + this->reportGnssStatusValue(IGnssCallback::GnssStatusValue::SESSION_BEGIN); + mThread = std::thread([this]() { + this->reportSvStatus(); + if (!mFirstFixReceived) { + std::this_thread::sleep_for(std::chrono::milliseconds(TTFF_MILLIS)); + mFirstFixReceived = true; + } + do { + if (!mIsActive) { + break; + } + this->reportSvStatus(); + this->reportNmea(); + + auto currentLocation = getLocationFromHW(); + mGnssPowerIndication->notePowerConsumption(); + if (currentLocation != nullptr) { + this->reportLocation(*currentLocation); + } else { + const auto location = Utils::getMockLocation(); + this->reportLocation(location); + } + } while (mIsActive && mThreadBlocker.wait_for(std::chrono::milliseconds(mMinIntervalMs))); + }); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::stop() { + ALOGD("stop"); + mIsActive = false; + mGnssMeasurementInterface->setLocationEnabled(false); + this->reportGnssStatusValue(IGnssCallback::GnssStatusValue::SESSION_END); + mThreadBlocker.notify(); + if (mThread.joinable()) { + mThread.join(); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::close() { + ALOGD("close"); sGnssCallback = nullptr; + return ScopedAStatus::ok(); +} + +void Gnss::reportLocation(const GnssLocation& location) const { + std::unique_lock lock(mMutex); + if (sGnssCallback == nullptr) { + ALOGE("%s: GnssCallback is null.", __func__); + return; + } + auto status = sGnssCallback->gnssLocationCb(location); + if (!status.isOk()) { + ALOGE("%s: Unable to invoke gnssLocationCb", __func__); + } + return; +} + +void Gnss::reportSvStatus() const { + if (mIsSvStatusActive) { + auto svStatus = filterBlocklistedSatellites(Utils::getMockSvInfoList()); + reportSvStatus(svStatus); + } +} + +void Gnss::reportSvStatus(const std::vector& svInfoList) const { + std::unique_lock lock(mMutex); + if (sGnssCallback == nullptr) { + ALOGE("%s: sGnssCallback is null.", __func__); + return; + } + auto status = sGnssCallback->gnssSvStatusCb(svInfoList); + if (!status.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } +} + +std::vector Gnss::filterBlocklistedSatellites( + std::vector gnssSvInfoList) const { + for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) { + if (mGnssConfiguration->isBlocklisted(gnssSvInfoList[i])) { + gnssSvInfoList[i].svFlag &= ~(uint32_t)IGnssCallback::GnssSvFlags::USED_IN_FIX; + } + } + return gnssSvInfoList; +} + +void Gnss::reportGnssStatusValue(const IGnssCallback::GnssStatusValue gnssStatusValue) const { + std::unique_lock lock(mMutex); + if (sGnssCallback == nullptr) { + ALOGE("%s: sGnssCallback is null.", __func__); + return; + } + auto status = sGnssCallback->gnssStatusCb(gnssStatusValue); + if (!status.isOk()) { + ALOGE("%s: Unable to invoke gnssStatusCb", __func__); + } +} + +void Gnss::reportNmea() const { + if (mIsNmeaActive) { + std::unique_lock lock(mMutex); + if (sGnssCallback == nullptr) { + ALOGE("%s: sGnssCallback is null.", __func__); + return; + } + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + auto status = sGnssCallback->gnssNmeaCb(now, "$TEST,0,1,2,3,4,5"); + if (!status.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + } +} + +ScopedAStatus Gnss::startSvStatus() { + ALOGD("startSvStatus"); + mIsSvStatusActive = true; + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::stopSvStatus() { + ALOGD("stopSvStatus"); + mIsSvStatusActive = false; + return ScopedAStatus::ok(); +} +ScopedAStatus Gnss::startNmea() { + ALOGD("startNmea"); + mIsNmeaActive = true; + return ScopedAStatus::ok(); +} +ScopedAStatus Gnss::stopNmea() { + ALOGD("stopNmea"); + mIsNmeaActive = false; + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::getExtensionAGnss(std::shared_ptr* iAGnss) { + ALOGD("Gnss::getExtensionAGnss"); + *iAGnss = SharedRefBase::make(); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Gnss::getExtensionPsds(std::shared_ptr* iGnssPsds) { - ALOGD("Gnss::getExtensionPsds"); - *iGnssPsds = SharedRefBase::make(); +ScopedAStatus Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs, int uncertaintyMs) { + ALOGD("injectTime. timeMs:%" PRId64 ", timeReferenceMs:%" PRId64 ", uncertaintyMs:%d", timeMs, + timeReferenceMs, uncertaintyMs); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::getExtensionAGnssRil(std::shared_ptr* iAGnssRil) { + ALOGD("Gnss::getExtensionAGnssRil"); + *iAGnssRil = SharedRefBase::make(); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Gnss::getExtensionGnssConfiguration( +ScopedAStatus Gnss::injectLocation(const GnssLocation& location) { + ALOGD("injectLocation. lat:%lf, lng:%lf, acc:%f", location.latitudeDegrees, + location.longitudeDegrees, location.horizontalAccuracyMeters); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::injectBestLocation(const GnssLocation& location) { + ALOGD("injectBestLocation. lat:%lf, lng:%lf, acc:%f", location.latitudeDegrees, + location.longitudeDegrees, location.horizontalAccuracyMeters); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::deleteAidingData(GnssAidingData aidingDataFlags) { + ALOGD("deleteAidingData. flags:%d", (int)aidingDataFlags); + mFirstFixReceived = false; + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::setPositionMode(const PositionModeOptions& options) { + ALOGD("setPositionMode. minIntervalMs:%d, lowPowerMode:%d", options.minIntervalMs, + (int)options.lowPowerMode); + mMinIntervalMs = std::max(1000, options.minIntervalMs); + mGnssMeasurementInterface->setLocationInterval(mMinIntervalMs); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::getExtensionPsds(std::shared_ptr* iGnssPsds) { + ALOGD("getExtensionPsds"); + *iGnssPsds = SharedRefBase::make(); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::getExtensionGnssConfiguration( std::shared_ptr* iGnssConfiguration) { - ALOGD("Gnss::getExtensionGnssConfiguration"); + ALOGD("getExtensionGnssConfiguration"); if (mGnssConfiguration == nullptr) { mGnssConfiguration = SharedRefBase::make(); } *iGnssConfiguration = mGnssConfiguration; - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } -ndk::ScopedAStatus Gnss::getExtensionGnssPowerIndication( +ScopedAStatus Gnss::getExtensionGnssPowerIndication( std::shared_ptr* iGnssPowerIndication) { - ALOGD("Gnss::getExtensionGnssPowerIndication"); + ALOGD("getExtensionGnssPowerIndication"); if (mGnssPowerIndication == nullptr) { mGnssPowerIndication = SharedRefBase::make(); } *iGnssPowerIndication = mGnssPowerIndication; - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } -ndk::ScopedAStatus Gnss::getExtensionGnssMeasurement( +ScopedAStatus Gnss::getExtensionGnssMeasurement( std::shared_ptr* iGnssMeasurement) { - ALOGD("Gnss::getExtensionGnssMeasurement"); + ALOGD("getExtensionGnssMeasurement"); + if (mGnssMeasurementInterface == nullptr) { + mGnssMeasurementInterface = SharedRefBase::make(); + } + *iGnssMeasurement = mGnssMeasurementInterface; + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::getExtensionGnssBatching(std::shared_ptr* iGnssBatching) { + ALOGD("getExtensionGnssBatching"); + + *iGnssBatching = SharedRefBase::make(); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::getExtensionGnssGeofence(std::shared_ptr* iGnssGeofence) { + ALOGD("getExtensionGnssGeofence"); + + *iGnssGeofence = SharedRefBase::make(); + return ScopedAStatus::ok(); +} + +ScopedAStatus Gnss::getExtensionGnssNavigationMessage( + std::shared_ptr* iGnssNavigationMessage) { + ALOGD("getExtensionGnssNavigationMessage"); + + *iGnssNavigationMessage = SharedRefBase::make(); + return ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Gnss::getExtensionGnssDebug(std::shared_ptr* iGnssDebug) { + ALOGD("Gnss::getExtensionGnssDebug"); + + *iGnssDebug = SharedRefBase::make(); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Gnss::getExtensionGnssVisibilityControl( + std::shared_ptr* iGnssVisibilityControl) { + ALOGD("Gnss::getExtensionGnssVisibilityControl"); + + *iGnssVisibilityControl = SharedRefBase::make(); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Gnss::getExtensionGnssAntennaInfo( + std::shared_ptr* iGnssAntennaInfo) { + ALOGD("Gnss::getExtensionGnssAntennaInfo"); + + *iGnssAntennaInfo = SharedRefBase::make(); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Gnss::getExtensionMeasurementCorrections( + std::shared_ptr* + iMeasurementCorrections) { + ALOGD("Gnss::getExtensionMeasurementCorrections"); - *iGnssMeasurement = SharedRefBase::make(); + *iMeasurementCorrections = + SharedRefBase::make(); return ndk::ScopedAStatus::ok(); } diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h index 76ebe4d126baf3cd8884379f80cdde3d06be7779..df10fc856bab282e571401cc38695206cb0efb81 100644 --- a/gnss/aidl/default/Gnss.h +++ b/gnss/aidl/default/Gnss.h @@ -16,20 +16,48 @@ #pragma once +#include +#include #include +#include +#include #include +#include #include #include #include +#include +#include +#include +#include +#include #include "GnssConfiguration.h" +#include "GnssMeasurementInterface.h" #include "GnssPowerIndication.h" +#include "Utils.h" namespace aidl::android::hardware::gnss { class Gnss : public BnGnss { public: + Gnss(); + ~Gnss() { stop(); }; ndk::ScopedAStatus setCallback(const std::shared_ptr& callback) override; + ndk::ScopedAStatus start() override; + ndk::ScopedAStatus stop() override; ndk::ScopedAStatus close() override; + + ndk::ScopedAStatus injectTime(int64_t timeMs, int64_t timeReferenceMs, + int uncertaintyMs) override; + ndk::ScopedAStatus injectLocation(const GnssLocation& location) override; + ndk::ScopedAStatus injectBestLocation(const GnssLocation& location) override; + ndk::ScopedAStatus deleteAidingData(GnssAidingData aidingDataFlags) override; + ndk::ScopedAStatus setPositionMode(const PositionModeOptions& options) override; + ndk::ScopedAStatus startSvStatus() override; + ndk::ScopedAStatus stopSvStatus() override; + ndk::ScopedAStatus startNmea() override; + ndk::ScopedAStatus stopNmea() override; + ndk::ScopedAStatus getExtensionPsds(std::shared_ptr* iGnssPsds) override; ndk::ScopedAStatus getExtensionGnssConfiguration( std::shared_ptr* iGnssConfiguration) override; @@ -37,12 +65,50 @@ class Gnss : public BnGnss { std::shared_ptr* iGnssPowerIndication) override; ndk::ScopedAStatus getExtensionGnssMeasurement( std::shared_ptr* iGnssMeasurement) override; + ndk::ScopedAStatus getExtensionGnssBatching( + std::shared_ptr* iGnssBatching) override; + ndk::ScopedAStatus getExtensionGnssGeofence( + std::shared_ptr* iGnssGeofence) override; + ndk::ScopedAStatus getExtensionGnssNavigationMessage( + std::shared_ptr* iGnssNavigationMessage) override; + ndk::ScopedAStatus getExtensionAGnss(std::shared_ptr* iAGnss) override; + ndk::ScopedAStatus getExtensionAGnssRil(std::shared_ptr* iAGnssRil) override; + ndk::ScopedAStatus getExtensionGnssDebug(std::shared_ptr* iGnssDebug) override; + ndk::ScopedAStatus getExtensionGnssVisibilityControl( + std::shared_ptr* + iGnssVisibilityControl) override; + ndk::ScopedAStatus getExtensionGnssAntennaInfo( + std::shared_ptr* iGnssAntennaInfo) override; + ndk::ScopedAStatus getExtensionMeasurementCorrections( + std::shared_ptr* iMeasurementCorrections) + override; std::shared_ptr mGnssConfiguration; std::shared_ptr mGnssPowerIndication; + std::shared_ptr mGnssMeasurementInterface; private: + void reportLocation(const GnssLocation&) const; + void reportSvStatus() const; + void reportSvStatus(const std::vector& svInfoList) const; + std::vector filterBlocklistedSatellites( + std::vector gnssSvInfoList) const; + void reportGnssStatusValue(const IGnssCallback::GnssStatusValue gnssStatusValue) const; + std::unique_ptr getLocationFromHW(); + void reportNmea() const; + static std::shared_ptr sGnssCallback; + + std::atomic mMinIntervalMs; + std::atomic mIsActive; + std::atomic mIsSvStatusActive; + std::atomic mIsNmeaActive; + std::atomic mFirstFixReceived; + std::thread mThread; + ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker; + + mutable std::mutex mMutex; }; } // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssAntennaInfo.cpp b/gnss/aidl/default/GnssAntennaInfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..72def716dedc599b41825c683cd71fb987e3aa8b --- /dev/null +++ b/gnss/aidl/default/GnssAntennaInfo.cpp @@ -0,0 +1,149 @@ +/* + * 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_TAG "GnssAntennaInfoAidl" + +#include "GnssAntennaInfo.h" +#include +#include +#include "Utils.h" + +namespace aidl::android::hardware::gnss { + +using namespace ::android::hardware::gnss; +using Row = IGnssAntennaInfoCallback::Row; +using Coord = IGnssAntennaInfoCallback::Coord; + +std::shared_ptr GnssAntennaInfo::sCallback = nullptr; + +GnssAntennaInfo::GnssAntennaInfo() : mMinIntervalMs(1000) {} + +GnssAntennaInfo::~GnssAntennaInfo() { + stop(); +} + +// Methods from ::android::hardware::gnss::V2_1::IGnssAntennaInfo follow. +ndk::ScopedAStatus GnssAntennaInfo::setCallback( + const std::shared_ptr& callback) { + ALOGD("setCallback"); + std::unique_lock lock(mMutex); + sCallback = callback; + + if (mIsActive) { + ALOGW("GnssAntennaInfo callback already set. Resetting the callback..."); + stop(); + } + start(); + + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssAntennaInfo::close() { + ALOGD("close"); + stop(); + std::unique_lock lock(mMutex); + sCallback = nullptr; + return ndk::ScopedAStatus::ok(); +} + +void GnssAntennaInfo::start() { + ALOGD("start"); + mIsActive = true; + mThread = std::thread([this]() { + while (mIsActive == true) { + if (sCallback != nullptr) { + IGnssAntennaInfoCallback::GnssAntennaInfo mockAntennaInfo_1 = { + .carrierFrequencyHz = 1575420000, + .phaseCenterOffsetCoordinateMillimeters = Coord{.x = 1, + .xUncertainty = 0.1, + .y = 2, + .yUncertainty = 0.1, + .z = 3, + .zUncertainty = 0.1}, + .phaseCenterVariationCorrectionMillimeters = + { + Row{std::vector{1, -1, 5, -2, 3, -1}}, + Row{std::vector{-2, 3, 2, 0, 1, 2}}, + Row{std::vector{1, 3, 2, -1, -3, 5}}, + }, + .phaseCenterVariationCorrectionUncertaintyMillimeters = + { + Row{std::vector{0.1, 0.2, 0.4, 0.1, 0.2, 0.3}}, + Row{std::vector{0.3, 0.2, 0.3, 0.6, 0.1, 0.1}}, + Row{std::vector{0.1, 0.1, 0.4, 0.2, 0.5, 0.3}}, + }, + .signalGainCorrectionDbi = + { + Row{std::vector{2, -3, 1, -3, 0, -4}}, + Row{std::vector{1, 0, -4, 1, 3, -2}}, + Row{std::vector{3, -2, 0, -2, 3, 0}}, + }, + .signalGainCorrectionUncertaintyDbi = + { + Row{std::vector{0.3, 0.1, 0.2, 0.6, 0.1, 0.3}}, + Row{std::vector{0.1, 0.1, 0.5, 0.2, 0.3, 0.1}}, + Row{std::vector{0.2, 0.4, 0.2, 0.1, 0.1, 0.2}}, + }, + }; + + IGnssAntennaInfoCallback::GnssAntennaInfo mockAntennaInfo_2 = { + .carrierFrequencyHz = 1176450000, + .phaseCenterOffsetCoordinateMillimeters = Coord{.x = 5, + .xUncertainty = 0.1, + .y = 6, + .yUncertainty = 0.1, + .z = 7, + .zUncertainty = 0.1}, + }; + + std::vector mockAntennaInfos = { + mockAntennaInfo_1, + mockAntennaInfo_2, + }; + this->reportAntennaInfo(mockAntennaInfos); + } + + /** For mock implementation this is good. On real device, we should only report + antennaInfo at start and when there is a configuration change. **/ + std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs)); + } + }); +} + +void GnssAntennaInfo::stop() { + ALOGD("stop"); + mIsActive = false; + if (mThread.joinable()) { + mThread.join(); + } +} + +void GnssAntennaInfo::reportAntennaInfo( + const std::vector& antennaInfo) const { + std::unique_lock lock(mMutex); + + if (sCallback == nullptr) { + ALOGE("%s: No non-null callback", __func__); + return; + } + + auto ret = sCallback->gnssAntennaInfoCb(antennaInfo); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } +} + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssAntennaInfo.h b/gnss/aidl/default/GnssAntennaInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..2cf7b1366bb0ccecb16b7a9a062707f804512991 --- /dev/null +++ b/gnss/aidl/default/GnssAntennaInfo.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +namespace aidl::android::hardware::gnss { + +struct GnssAntennaInfo : public BnGnssAntennaInfo { + public: + GnssAntennaInfo(); + ~GnssAntennaInfo(); + ndk::ScopedAStatus setCallback( + const std::shared_ptr& callback) override; + ndk::ScopedAStatus close() override; + + private: + void start(); + void stop(); + void reportAntennaInfo( + const std::vector& antennaInfo) const; + + // Guarded by mMutex + static std::shared_ptr sCallback; + + std::atomic mIsActive; + std::atomic mMinIntervalMs; + std::thread mThread; + + // Synchronization lock for sCallback + mutable std::mutex mMutex; +}; + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssBatching.cpp b/gnss/aidl/default/GnssBatching.cpp new file mode 100644 index 0000000000000000000000000000000000000000..33e1fd500e66b617d58ce073f5e3113bc6277d8b --- /dev/null +++ b/gnss/aidl/default/GnssBatching.cpp @@ -0,0 +1,128 @@ +/* + * 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_TAG "GnssBatchingAidl" + +#include "GnssBatching.h" +#include +#include +#include +#include +#include "Utils.h" + +namespace aidl::android::hardware::gnss { + +using namespace ::android::hardware::gnss; + +constexpr int BATCH_SIZE = 10; + +std::shared_ptr GnssBatching::sCallback = nullptr; + +GnssBatching::GnssBatching() + : mMinIntervalMs(1000), + mWakeUpOnFifoFull(false), + mBatchedLocations(std::vector()) {} +GnssBatching::~GnssBatching() { + cleanup(); +} + +ndk::ScopedAStatus GnssBatching::init(const std::shared_ptr& callback) { + ALOGD("init"); + std::unique_lock lock(mMutex); + sCallback = callback; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssBatching::getBatchSize(int* size) { + ALOGD("getBatchingSize"); + *size = BATCH_SIZE; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssBatching::start(const Options& options) { + ALOGD("start: periodNanos=%" PRId64 ", minDistanceMeters=%f, flags=%d", options.periodNanos, + options.minDistanceMeters, options.flags); + if (mIsActive) { + ALOGW("Gnss has started. Restarting..."); + stop(); + } + + // mMinIntervalMs is not smaller than 1 sec + long periodNanos = (options.periodNanos < 1e9) ? 1e9 : options.periodNanos; + mMinIntervalMs = periodNanos / 1e6; + mWakeUpOnFifoFull = (options.flags & IGnssBatching::WAKEUP_ON_FIFO_FULL) ? true : false; + mMinDistanceMeters = options.minDistanceMeters; + + mIsActive = true; + mThread = std::thread([this]() { + while (mIsActive == true) { + const auto location = common::Utils::getMockLocation(); + this->batchLocation(location); + std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs)); + } + }); + + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssBatching::flush() { + ALOGD("flush"); + std::vector copy = std::vector(mBatchedLocations); + ndk::ScopedAStatus status; + if (sCallback != nullptr) { + sCallback->gnssLocationBatchCb(copy); + status = ndk::ScopedAStatus::ok(); + } else { + ALOGE("GnssBatchingCallback is null. flush() failed."); + status = ndk::ScopedAStatus::fromServiceSpecificError(IGnss::ERROR_GENERIC); + } + mBatchedLocations.clear(); + return status; +} + +ndk::ScopedAStatus GnssBatching::stop() { + ALOGD("stop"); + // Do not call flush() at stop() + mIsActive = false; + if (mThread.joinable()) { + mThread.join(); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssBatching::cleanup() { + ALOGD("cleanup"); + std::unique_lock lock(mMutex); + if (mIsActive) { + stop(); + } + flush(); + + sCallback = nullptr; + return ndk::ScopedAStatus::ok(); +} + +void GnssBatching::batchLocation(const GnssLocation& location) { + if (mBatchedLocations.size() > BATCH_SIZE) { + mBatchedLocations.erase(mBatchedLocations.begin()); + } + mBatchedLocations.push_back(location); + if (mWakeUpOnFifoFull && mBatchedLocations.size() == BATCH_SIZE) { + flush(); + } +} + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssBatching.h b/gnss/aidl/default/GnssBatching.h new file mode 100644 index 0000000000000000000000000000000000000000..6d1d80923022ced8883b4f6e26247fe86f8f9ed2 --- /dev/null +++ b/gnss/aidl/default/GnssBatching.h @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace aidl::android::hardware::gnss { + +struct GnssBatching : public BnGnssBatching { + public: + GnssBatching(); + ~GnssBatching(); + ndk::ScopedAStatus init(const std::shared_ptr& callback) override; + ndk::ScopedAStatus getBatchSize(int* size) override; + ndk::ScopedAStatus start(const Options& options) override; + ndk::ScopedAStatus flush() override; + ndk::ScopedAStatus stop() override; + ndk::ScopedAStatus cleanup() override; + + private: + void batchLocation(const GnssLocation&); + + // Guarded by mMutex + static std::shared_ptr sCallback; + + std::thread mThread; + std::atomic mIsActive; + std::atomic mMinIntervalMs; + std::atomic mMinDistanceMeters; + std::atomic mWakeUpOnFifoFull; + + // Synchronization lock for sCallback + mutable std::mutex mMutex; + + std::vector mBatchedLocations; +}; + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssConfiguration.cpp b/gnss/aidl/default/GnssConfiguration.cpp index 30e0d8c8b9942965ef092a465887b45b04488a27..96a1aa2a3ffca8e3ca5b81fb914e89c5cf5ce1a2 100644 --- a/gnss/aidl/default/GnssConfiguration.cpp +++ b/gnss/aidl/default/GnssConfiguration.cpp @@ -49,4 +49,14 @@ bool GnssConfiguration::isBlocklistedV2_1(const GnssSvInfoV2_1& gnssSvInfo) cons return (mBlocklistedSourceSet.find(source) != mBlocklistedSourceSet.end()); } +bool GnssConfiguration::isBlocklisted(const IGnssCallback::GnssSvInfo& gnssSvInfo) const { + std::unique_lock lock(mMutex); + if (mBlocklistedConstellationSet.find(gnssSvInfo.constellation) != + mBlocklistedConstellationSet.end()) { + return true; + } + BlocklistedSource source = {.constellation = gnssSvInfo.constellation, .svid = gnssSvInfo.svid}; + return (mBlocklistedSourceSet.find(source) != mBlocklistedSourceSet.end()); +} + } // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssConfiguration.h b/gnss/aidl/default/GnssConfiguration.h index 491733c9cad7d35a61ac504aa39c968fdfa34b38..3c77f32d1fdebcf597c0353c4bda3a438e974371 100644 --- a/gnss/aidl/default/GnssConfiguration.h +++ b/gnss/aidl/default/GnssConfiguration.h @@ -16,6 +16,7 @@ #pragma once +#include #include #include #include @@ -62,6 +63,7 @@ struct GnssConfiguration : public BnGnssConfiguration { ndk::ScopedAStatus setBlocklist(const vector& blocklist) override; bool isBlocklistedV2_1(const GnssSvInfoV2_1& gnssSvInfo) const; + bool isBlocklisted(const IGnssCallback::GnssSvInfo& gnssSvInfo) const; private: BlocklistedSourceSet mBlocklistedSourceSet; diff --git a/gnss/aidl/default/GnssDebug.cpp b/gnss/aidl/default/GnssDebug.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f40c0bcef00f6be7d8bddc8466138375b049ea5e --- /dev/null +++ b/gnss/aidl/default/GnssDebug.cpp @@ -0,0 +1,50 @@ +/* + * 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_TAG "GnssDebugAidl" + +#include "GnssDebug.h" +#include +#include "MockLocation.h" + +namespace aidl::android::hardware::gnss { + +ndk::ScopedAStatus GnssDebug::getDebugData(DebugData* debugData) { + ALOGD("GnssDebug::getDebugData"); + + PositionDebug positionDebug = {.valid = true, + .latitudeDegrees = 37.4219999, + .longitudeDegrees = -122.0840575, + .altitudeMeters = 1.60062531, + .speedMetersPerSec = 0, + .bearingDegrees = 0, + .horizontalAccuracyMeters = 5, + .verticalAccuracyMeters = 5, + .speedAccuracyMetersPerSecond = 1, + .bearingAccuracyDegrees = 90, + .ageSeconds = 0.99}; + TimeDebug timeDebug = {.timeEstimateMs = 1519930775453L, + .timeUncertaintyNs = 1000, + .frequencyUncertaintyNsPerSec = 5.0e4}; + std::vector satelliteDataArrayDebug = {}; + debugData->position = positionDebug; + debugData->time = timeDebug; + debugData->satelliteDataArray = satelliteDataArrayDebug; + + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssDebug.h b/gnss/aidl/default/GnssDebug.h new file mode 100644 index 0000000000000000000000000000000000000000..001d47cf5c8ef6cbd757426e7c453d7ffe317d34 --- /dev/null +++ b/gnss/aidl/default/GnssDebug.h @@ -0,0 +1,28 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::gnss { + +struct GnssDebug : public BnGnssDebug { + public: + ndk::ScopedAStatus getDebugData(DebugData* debugData) override; +}; + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssGeofence.cpp b/gnss/aidl/default/GnssGeofence.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eda33cc1b62b642530bec4c7f88cfc65b43e1c50 --- /dev/null +++ b/gnss/aidl/default/GnssGeofence.cpp @@ -0,0 +1,61 @@ +/* + * 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_TAG "GnssGeofenceAidl" + +#include "GnssGeofence.h" +#include +#include + +namespace aidl::android::hardware::gnss { + +std::shared_ptr GnssGeofence::sCallback = nullptr; + +ndk::ScopedAStatus GnssGeofence::setCallback( + const std::shared_ptr& callback) { + ALOGD("setCallback"); + std::unique_lock lock(mMutex); + sCallback = callback; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssGeofence::addGeofence(int geofenceId, double latitudeDegrees, + double longitudeDegrees, double radiusMeters, + int lastTransition, int monitorTransitions, + int notificationResponsivenessMs, int unknownTimerMs) { + ALOGD("addGeofence. geofenceId=%d, lat=%lf, lng=%lf, rad=%lf, lastTransition=%d, " + "monitorTransitions=%d, notificationResponsivenessMs=%d, unknownTimerMs=%d", + geofenceId, latitudeDegrees, longitudeDegrees, radiusMeters, lastTransition, + monitorTransitions, notificationResponsivenessMs, unknownTimerMs); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssGeofence::pauseGeofence(int geofenceId) { + ALOGD("pauseGeofence. id=%d", geofenceId); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssGeofence::resumeGeofence(int geofenceId, int monitorTransitions) { + ALOGD("resumeGeofence. id=%d, monitorTransitions=%d", geofenceId, monitorTransitions); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssGeofence::removeGeofence(int geofenceId) { + ALOGD("removeGeofence. id=%d", geofenceId); + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssGeofence.h b/gnss/aidl/default/GnssGeofence.h new file mode 100644 index 0000000000000000000000000000000000000000..313e8322651098f71f563eca9bc0d82b042d2215 --- /dev/null +++ b/gnss/aidl/default/GnssGeofence.h @@ -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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::gnss { + +struct GnssGeofence : public BnGnssGeofence { + public: + ndk::ScopedAStatus setCallback(const std::shared_ptr& callback) override; + ndk::ScopedAStatus addGeofence(int geofenceId, double latitudeDegrees, double longitudeDegrees, + double radiusMeters, int lastTransition, int monitorTransitions, + int notificationResponsivenessMs, int unknownTimerMs) override; + ndk::ScopedAStatus pauseGeofence(int geofenceId) override; + ndk::ScopedAStatus resumeGeofence(int geofenceId, int monitorTransitions) override; + ndk::ScopedAStatus removeGeofence(int geofenceId) override; + + private: + // Guarded by mMutex + static std::shared_ptr sCallback; + + // Synchronization lock for sCallback + mutable std::mutex mMutex; +}; + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssHidlHal.cpp b/gnss/aidl/default/GnssHidlHal.cpp deleted file mode 100644 index 10b0106f327fecf5ddc20a6fa9db6b1bf43e2a29..0000000000000000000000000000000000000000 --- a/gnss/aidl/default/GnssHidlHal.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "GnssHidlHal" - -#include "GnssHidlHal.h" - -namespace aidl::android::hardware::gnss { - -using GnssSvInfo = ::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo; - -GnssHidlHal::GnssHidlHal(const std::shared_ptr& gnssAidl) : mGnssAidl(gnssAidl) { - Gnss* iGnss = mGnssAidl.get(); - std::shared_ptr iGnssConfiguration; - auto status = iGnss->getExtensionGnssConfiguration(&iGnssConfiguration); - if (!status.isOk()) { - ALOGE("Failed to getExtensionGnssConfiguration."); - } else { - mGnssConfigurationAidl = iGnss->mGnssConfiguration; - } - - std::shared_ptr iGnssPowerIndication; - status = iGnss->getExtensionGnssPowerIndication(&iGnssPowerIndication); - if (!status.isOk()) { - ALOGE("Failed to getExtensionGnssPowerIndication."); - } else { - mGnssPowerIndicationAidl = iGnss->mGnssPowerIndication; - } -}; - -hidl_vec GnssHidlHal::filterBlocklistedSatellitesV2_1( - hidl_vec gnssSvInfoList) { - if (mGnssConfigurationAidl == nullptr) { - ALOGE("Handle to AIDL GnssConfiguration is not available."); - return gnssSvInfoList; - } - for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) { - if (mGnssConfigurationAidl->isBlocklistedV2_1(gnssSvInfoList[i])) { - ALOGD("Blocklisted constellation: %d, svid: %d", - (int)gnssSvInfoList[i].v2_0.constellation, gnssSvInfoList[i].v2_0.v1_0.svid); - gnssSvInfoList[i].v2_0.v1_0.svFlag &= ~static_cast( - ::android::hardware::gnss::V1_0::IGnssCallback::GnssSvFlags::USED_IN_FIX); - } - } - return gnssSvInfoList; -} - -void GnssHidlHal::notePowerConsumption() { - mGnssPowerIndicationAidl->notePowerConsumption(); -} - -} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssHidlHal.h b/gnss/aidl/default/GnssHidlHal.h deleted file mode 100644 index 5fb4f972deaef4970275180e073e29d857622814..0000000000000000000000000000000000000000 --- a/gnss/aidl/default/GnssHidlHal.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "Gnss.h" -#include "GnssConfiguration.h" -#include "v2_1/GnssTemplate.h" - -namespace aidl::android::hardware::gnss { - -class GnssHidlHal : public ::android::hardware::gnss::common::implementation::GnssTemplate< - ::android::hardware::gnss::V2_1::IGnss> { - public: - GnssHidlHal(const std::shared_ptr& gnssAidl); - - private: - hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo> - filterBlocklistedSatellitesV2_1( - hidl_vec<::android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo> gnssSvInfoList) - override; - void notePowerConsumption() override; - - std::shared_ptr mGnssAidl; - std::shared_ptr mGnssConfigurationAidl; - std::shared_ptr mGnssPowerIndicationAidl; -}; - -} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp index 9e4f7c7f2520ce8a60303dacfcdc52e812543c57..606de073672be018429693102b1614eeb8ae9068 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.cpp +++ b/gnss/aidl/default/GnssMeasurementInterface.cpp @@ -33,10 +33,11 @@ using DeviceFileReader = ::android::hardware::gnss::common::DeviceFileReader; std::shared_ptr GnssMeasurementInterface::sCallback = nullptr; -GnssMeasurementInterface::GnssMeasurementInterface() : mMinIntervalMillis(1000) {} +GnssMeasurementInterface::GnssMeasurementInterface() + : mIntervalMs(1000), mLocationIntervalMs(1000), mFutures(std::vector>()) {} GnssMeasurementInterface::~GnssMeasurementInterface() { - stop(); + waitForStoppingThreads(); } ndk::ScopedAStatus GnssMeasurementInterface::setCallback( @@ -44,8 +45,10 @@ ndk::ScopedAStatus GnssMeasurementInterface::setCallback( const bool enableCorrVecOutputs) { ALOGD("setCallback: enableFullTracking: %d enableCorrVecOutputs: %d", (int)enableFullTracking, (int)enableCorrVecOutputs); - std::unique_lock lock(mMutex); - sCallback = callback; + { + std::unique_lock lock(mMutex); + sCallback = callback; + } if (mIsActive) { ALOGW("GnssMeasurement callback already set. Resetting the callback..."); @@ -56,19 +59,56 @@ ndk::ScopedAStatus GnssMeasurementInterface::setCallback( return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus GnssMeasurementInterface::setCallbackWithOptions( + const std::shared_ptr& callback, const Options& options) { + ALOGD("setCallbackWithOptions: fullTracking:%d, corrVec:%d, intervalMs:%d", + (int)options.enableFullTracking, (int)options.enableCorrVecOutputs, options.intervalMs); + { + std::unique_lock lock(mMutex); + sCallback = callback; + } + + if (mIsActive) { + ALOGW("GnssMeasurement callback already set. Resetting the callback..."); + stop(); + } + mIntervalMs = std::max(options.intervalMs, 1000); + start(options.enableCorrVecOutputs); + + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus GnssMeasurementInterface::close() { ALOGD("close"); - stop(); - std::unique_lock lock(mMutex); - sCallback = nullptr; + if (mIsActive) { + stop(); + } + { + std::unique_lock lock(mMutex); + sCallback = nullptr; + } + mIntervalMs = 1000; return ndk::ScopedAStatus::ok(); } void GnssMeasurementInterface::start(const bool enableCorrVecOutputs) { ALOGD("start"); + + if (mIsActive) { + ALOGD("restarting since measurement has started"); + stop(); + } + // Wait for stopping previous thread. + waitForStoppingThreads(); + mIsActive = true; + mThreadBlocker.reset(); mThread = std::thread([this, enableCorrVecOutputs]() { - while (mIsActive == true) { + int intervalMs; + do { + if (!mIsActive) { + break; + } std::string rawMeasurementStr = ""; if (ReplayUtils::hasGnssDeviceFile() && ReplayUtils::isGnssRawMeasurement( @@ -85,15 +125,19 @@ void GnssMeasurementInterface::start(const bool enableCorrVecOutputs) { auto measurement = Utils::getMockMeasurement(enableCorrVecOutputs); this->reportMeasurement(measurement); } - std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMillis)); - } + intervalMs = + (mLocationEnabled) ? std::min(mLocationIntervalMs, mIntervalMs) : mIntervalMs; + } while (mIsActive && mThreadBlocker.wait_for(std::chrono::milliseconds(intervalMs))); }); - mThread.detach(); } void GnssMeasurementInterface::stop() { ALOGD("stop"); mIsActive = false; + mThreadBlocker.notify(); + if (mThread.joinable()) { + mFutures.push_back(std::async(std::launch::async, [this] { mThread.join(); })); + } } void GnssMeasurementInterface::reportMeasurement(const GnssData& data) { @@ -110,4 +154,21 @@ void GnssMeasurementInterface::reportMeasurement(const GnssData& data) { callbackCopy->gnssMeasurementCb(data); } +void GnssMeasurementInterface::setLocationInterval(const int intervalMs) { + mLocationIntervalMs = intervalMs; +} + +void GnssMeasurementInterface::setLocationEnabled(const bool enabled) { + mLocationEnabled = enabled; +} + +void GnssMeasurementInterface::waitForStoppingThreads() { + for (auto& future : mFutures) { + ALOGD("Stopping previous thread."); + future.wait(); + ALOGD("Done stopping thread."); + } + mFutures.clear(); +} + } // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h index db6351555db3b3e70d250cbe9aeb5537b0c8f413..bb080275687409285a6be74ee51a8f1f66c7fa61 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.h +++ b/gnss/aidl/default/GnssMeasurementInterface.h @@ -19,8 +19,10 @@ #include #include #include +#include #include #include +#include "Utils.h" namespace aidl::android::hardware::gnss { @@ -32,15 +34,25 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface { const bool enableFullTracking, const bool enableCorrVecOutputs) override; ndk::ScopedAStatus close() override; + ndk::ScopedAStatus setCallbackWithOptions( + const std::shared_ptr& callback, + const Options& options) override; + void setLocationInterval(const int intervalMs); + void setLocationEnabled(const bool enabled); private: void start(const bool enableCorrVecOutputs); void stop(); void reportMeasurement(const GnssData&); + void waitForStoppingThreads(); - std::atomic mMinIntervalMillis; + std::atomic mIntervalMs; + std::atomic mLocationIntervalMs; std::atomic mIsActive; + std::atomic mLocationEnabled; std::thread mThread; + std::vector> mFutures; + ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker; // Guarded by mMutex static std::shared_ptr sCallback; diff --git a/gnss/aidl/default/GnssNavigationMessageInterface.cpp b/gnss/aidl/default/GnssNavigationMessageInterface.cpp new file mode 100644 index 0000000000000000000000000000000000000000..75b962452a635feb7481dc0967ad6ce9c32ffcb8 --- /dev/null +++ b/gnss/aidl/default/GnssNavigationMessageInterface.cpp @@ -0,0 +1,119 @@ +/* + * 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_TAG "GnssNavigationMessageAidl" + +#include "GnssNavigationMessageInterface.h" +#include +#include +#include "Utils.h" + +namespace aidl::android::hardware::gnss { + +using namespace ::android::hardware::gnss; +using GnssNavigationMessage = IGnssNavigationMessageCallback::GnssNavigationMessage; +using GnssNavigationMessageType = GnssNavigationMessage::GnssNavigationMessageType; + +std::shared_ptr GnssNavigationMessageInterface::sCallback = nullptr; + +GnssNavigationMessageInterface::GnssNavigationMessageInterface() : mMinIntervalMillis(1000) {} + +GnssNavigationMessageInterface::~GnssNavigationMessageInterface() { + waitForStoppingThreads(); +} + +ndk::ScopedAStatus GnssNavigationMessageInterface::setCallback( + const std::shared_ptr& callback) { + ALOGD("setCallback"); + std::unique_lock lock(mMutex); + sCallback = callback; + start(); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssNavigationMessageInterface::close() { + ALOGD("close"); + if (mIsActive) { + stop(); + } + std::unique_lock lock(mMutex); + sCallback = nullptr; + return ndk::ScopedAStatus::ok(); +} + +void GnssNavigationMessageInterface::start() { + ALOGD("start"); + + if (mIsActive) { + ALOGD("restarting since nav msg has started"); + stop(); + } + // Wait for stopping previous thread. + waitForStoppingThreads(); + + mIsActive = true; + mThread = std::thread([this]() { + do { + if (!mIsActive) { + break; + } + GnssNavigationMessage message = { + .svid = 19, + .type = GnssNavigationMessageType::GPS_L1CA, + .status = GnssNavigationMessage::STATUS_PARITY_PASSED, + .messageId = 2, + .submessageId = 3, + .data = std::vector(40, 0xF9), + }; + this->reportMessage(message); + } while (mIsActive && + mThreadBlocker.wait_for(std::chrono::milliseconds(mMinIntervalMillis))); + }); +} + +void GnssNavigationMessageInterface::stop() { + ALOGD("stop"); + mIsActive = false; + mThreadBlocker.notify(); + if (mThread.joinable()) { + mFutures.push_back(std::async(std::launch::async, [this] { mThread.join(); })); + } +} + +void GnssNavigationMessageInterface::reportMessage(const GnssNavigationMessage& message) { + ALOGD("reportMessage()"); + std::shared_ptr callbackCopy; + { + std::unique_lock lock(mMutex); + if (sCallback == nullptr) { + ALOGE("%s: GnssNavigationMessageInterface::sCallback is null.", __func__); + return; + } + callbackCopy = sCallback; + } + callbackCopy->gnssNavigationMessageCb(message); +} + +void GnssNavigationMessageInterface::waitForStoppingThreads() { + for (auto& future : mFutures) { + ALOGD("Stopping previous thread."); + future.wait(); + ALOGD("Done stopping thread."); + } + mFutures.clear(); +} + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssNavigationMessageInterface.h b/gnss/aidl/default/GnssNavigationMessageInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..b3353480f4c00fbb028673c3e48550d1560e4b42 --- /dev/null +++ b/gnss/aidl/default/GnssNavigationMessageInterface.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include "Utils.h" + +namespace aidl::android::hardware::gnss { + +struct GnssNavigationMessageInterface : public BnGnssNavigationMessageInterface { + public: + GnssNavigationMessageInterface(); + ~GnssNavigationMessageInterface(); + ndk::ScopedAStatus setCallback( + const std::shared_ptr& callback) override; + ndk::ScopedAStatus close() override; + + private: + void start(); + void stop(); + void reportMessage(const IGnssNavigationMessageCallback::GnssNavigationMessage& message); + void waitForStoppingThreads(); + + std::atomic mMinIntervalMillis; + std::atomic mIsActive; + std::thread mThread; + std::vector> mFutures; + ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker; + + // Guarded by mMutex + static std::shared_ptr sCallback; + // Synchronization lock for sCallback + mutable std::mutex mMutex; +}; + +} // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/GnssVisibilityControl.cpp b/gnss/aidl/default/GnssVisibilityControl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..208d73ca205f3bcc92e7a163d3c4308c719b971a --- /dev/null +++ b/gnss/aidl/default/GnssVisibilityControl.cpp @@ -0,0 +1,51 @@ +/* + * 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_TAG "GnssVisibilityControl" + +#include "GnssVisibilityControl.h" +#include + +namespace aidl::android::hardware::gnss::visibility_control { + +std::shared_ptr GnssVisibilityControl::sCallback = nullptr; + +ndk::ScopedAStatus GnssVisibilityControl::enableNfwLocationAccess( + const std::vector& proxyApps) { + std::string os; + bool first = true; + for (const auto& proxyApp : proxyApps) { + if (first) { + first = false; + } else { + os += " "; + } + os += proxyApp; + } + + ALOGD("GnssVisibilityControl::enableNfwLocationAccess proxyApps: %s", os.c_str()); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus GnssVisibilityControl::setCallback( + const std::shared_ptr& callback) { + ALOGD("GnssVisibilityControl::setCallback"); + std::unique_lock lock(mMutex); + sCallback = callback; + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::gnss::visibility_control diff --git a/gnss/aidl/default/GnssVisibilityControl.h b/gnss/aidl/default/GnssVisibilityControl.h new file mode 100644 index 0000000000000000000000000000000000000000..5b36442374a56575c0049b390a562fd340205bde --- /dev/null +++ b/gnss/aidl/default/GnssVisibilityControl.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::gnss::visibility_control { + +struct GnssVisibilityControl : public BnGnssVisibilityControl { + public: + ndk::ScopedAStatus enableNfwLocationAccess(const std::vector& hostname) override; + ndk::ScopedAStatus setCallback( + const std::shared_ptr& callback) override; + + private: + // Synchronization lock for sCallback + mutable std::mutex mMutex; + // Guarded by mMutex + static std::shared_ptr sCallback; +}; + +} // namespace aidl::android::hardware::gnss::visibility_control diff --git a/gnss/aidl/default/MeasurementCorrectionsInterface.cpp b/gnss/aidl/default/MeasurementCorrectionsInterface.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66270c89daa9f047d6fac9070c149bf8c0562017 --- /dev/null +++ b/gnss/aidl/default/MeasurementCorrectionsInterface.cpp @@ -0,0 +1,78 @@ +/* + * 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_TAG "MeasurementCorrectionsInterface" + +#include "MeasurementCorrectionsInterface.h" +#include +#include + +namespace aidl::android::hardware::gnss::measurement_corrections { + +std::shared_ptr MeasurementCorrectionsInterface::sCallback = + nullptr; + +ndk::ScopedAStatus MeasurementCorrectionsInterface::setCorrections( + const MeasurementCorrections& corrections) { + ALOGD("setCorrections"); + ALOGD("corrections = lat: %f, lng: %f, alt: %f, hUnc: %f, vUnc: %f, toa: %llu, " + "satCorrections.size: %d", + corrections.latitudeDegrees, corrections.longitudeDegrees, corrections.altitudeMeters, + corrections.horizontalPositionUncertaintyMeters, + corrections.verticalPositionUncertaintyMeters, + static_cast(corrections.toaGpsNanosecondsOfWeek), + static_cast(corrections.satCorrections.size())); + for (auto singleSatCorrection : corrections.satCorrections) { + ALOGD("singleSatCorrection = flags: %d, constellation: %d, svid: %d" + ", cfHz: %" PRId64 + ", probLos: %f, combinedEpl: %f, combinedEplUnc: %f, combinedAttenuation: %f" + ", excessPathInfos.size: %d", + singleSatCorrection.singleSatCorrectionFlags, singleSatCorrection.constellation, + singleSatCorrection.svid, singleSatCorrection.carrierFrequencyHz, + singleSatCorrection.probSatIsLos, singleSatCorrection.combinedExcessPathLengthMeters, + singleSatCorrection.combinedExcessPathLengthUncertaintyMeters, + singleSatCorrection.combinedAttenuationDb, + static_cast(singleSatCorrection.excessPathInfos.size())); + + for (auto excessPathInfo : singleSatCorrection.excessPathInfos) { + ALOGD("excessPathInfo = epl: %f, eplUnc: %f, attenuation: %f", + excessPathInfo.excessPathLengthMeters, + excessPathInfo.excessPathLengthUncertaintyMeters, excessPathInfo.attenuationDb); + ALOGD("reflecting plane = lat: %f, lng: %f, alt: %f, azm: %f", + excessPathInfo.reflectingPlane.latitudeDegrees, + excessPathInfo.reflectingPlane.longitudeDegrees, + excessPathInfo.reflectingPlane.altitudeMeters, + excessPathInfo.reflectingPlane.reflectingPlaneAzimuthDegrees); + } + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus MeasurementCorrectionsInterface::setCallback( + const std::shared_ptr& callback) { + ALOGD("MeasurementCorrections::setCallback"); + std::unique_lock lock(mMutex); + sCallback = callback; + auto ret = sCallback->setCapabilitiesCb( + IMeasurementCorrectionsCallback::CAPABILITY_LOS_SATS | + IMeasurementCorrectionsCallback::CAPABILITY_EXCESS_PATH_LENGTH | + IMeasurementCorrectionsCallback::CAPABILITY_REFLECTING_PLANE); + if (!ret.isOk()) { + ALOGE("%s: Unable to invoke callback", __func__); + } + return ndk::ScopedAStatus::ok(); +} +} // namespace aidl::android::hardware::gnss::measurement_corrections diff --git a/gnss/aidl/default/MeasurementCorrectionsInterface.h b/gnss/aidl/default/MeasurementCorrectionsInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..af58725050303bfed000447a848c2ed1fd1efd9e --- /dev/null +++ b/gnss/aidl/default/MeasurementCorrectionsInterface.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::gnss::measurement_corrections { + +struct MeasurementCorrectionsInterface : public BnMeasurementCorrectionsInterface { + public: + ndk::ScopedAStatus setCorrections(const MeasurementCorrections& corrections) override; + ndk::ScopedAStatus setCallback( + const std::shared_ptr& callback) override; + + private: + // Synchronization lock for sCallback + mutable std::mutex mMutex; + // Guarded by mMutex + static std::shared_ptr sCallback; +}; + +} // namespace aidl::android::hardware::gnss::measurement_corrections diff --git a/gnss/aidl/default/gnss-default.xml b/gnss/aidl/default/gnss-default.xml index 2b06cd28de3ba111856671dfa1f7c235995d3af6..7449310933f70a0bb87137618f908adc61f25472 100644 --- a/gnss/aidl/default/gnss-default.xml +++ b/gnss/aidl/default/gnss-default.xml @@ -1,6 +1,7 @@ android.hardware.gnss + 2 IGnss default diff --git a/gnss/aidl/default/gnss@2.1-service.xml b/gnss/aidl/default/gnss@2.1-service.xml deleted file mode 100644 index 12a1fdfa089fcb4cc4c02ab3cfdc806e385aa793..0000000000000000000000000000000000000000 --- a/gnss/aidl/default/gnss@2.1-service.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - android.hardware.gnss - hwbinder - 2.1 - 1.1 - - IGnss - default - - - diff --git a/gnss/aidl/default/service.cpp b/gnss/aidl/default/service.cpp index bbe34f1a284cabb826279218a35400bfb754ddc5..162532be793651a98a458d35b7be329381547529 100644 --- a/gnss/aidl/default/service.cpp +++ b/gnss/aidl/default/service.cpp @@ -24,15 +24,12 @@ #include #include #include "Gnss.h" -#include "GnssHidlHal.h" using aidl::android::hardware::gnss::Gnss; -using aidl::android::hardware::gnss::GnssHidlHal; using ::android::OK; using ::android::sp; using ::android::hardware::configureRpcThreadpool; using ::android::hardware::joinRpcThreadpool; -using ::android::hardware::gnss::V2_1::IGnss; int main() { ABinderProcess_setThreadPoolMaxThreadCount(1); @@ -44,14 +41,6 @@ int main() { AServiceManager_addService(gnssAidl->asBinder().get(), instance.c_str()); CHECK_EQ(status, STATUS_OK); - sp gnss = new GnssHidlHal(gnssAidl); - configureRpcThreadpool(1, true /* will join */); - if (gnss->registerAsService() != OK) { - ALOGE("Could not register gnss 2.1 service."); - return 0; - } - - joinRpcThreadpool(); ABinderProcess_joinThreadPool(); return EXIT_FAILURE; // should not reach diff --git a/gnss/aidl/vts/AGnssCallbackAidl.cpp b/gnss/aidl/vts/AGnssCallbackAidl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..332783500167f7860a93e2a9b8ed73447e828bdf --- /dev/null +++ b/gnss/aidl/vts/AGnssCallbackAidl.cpp @@ -0,0 +1,24 @@ +/* + * 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. + */ + +#include "AGnssCallbackAidl.h" +#include + +android::binder::Status AGnssCallbackAidl::agnssStatusCb(const AGnssType type, + const AGnssStatusValue status) { + ALOGI("agnssStatusCb type %d status %d", type, status); + return android::binder::Status::ok(); +} diff --git a/gnss/aidl/vts/AGnssCallbackAidl.h b/gnss/aidl/vts/AGnssCallbackAidl.h new file mode 100644 index 0000000000000000000000000000000000000000..6173e857980ddf97ccaccacbb1565b766c2d3721 --- /dev/null +++ b/gnss/aidl/vts/AGnssCallbackAidl.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma once + +#include + +using AGnssType = android::hardware::gnss::IAGnssCallback::AGnssType; +using AGnssStatusValue = android::hardware::gnss::IAGnssCallback::AGnssStatusValue; + +/** Implementation for IAGnssCallback. */ +class AGnssCallbackAidl : public android::hardware::gnss::BnAGnssCallback { + public: + AGnssCallbackAidl(){}; + ~AGnssCallbackAidl(){}; + android::binder::Status agnssStatusCb(const AGnssType type, + const AGnssStatusValue status) override; +}; diff --git a/gnss/aidl/vts/AGnssRilCallbackAidl.cpp b/gnss/aidl/vts/AGnssRilCallbackAidl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4e4166d61d2d8b9b9bfb2b5864e109759fdfe78f --- /dev/null +++ b/gnss/aidl/vts/AGnssRilCallbackAidl.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (C) 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. + */ + +#include "AGnssRilCallbackAidl.h" +#include + +android::binder::Status AGnssRilCallbackAidl::requestSetIdCb(int setIdflag) { + ALOGI("requestSetIdCb setIdflag %d", setIdflag); + return android::binder::Status::ok(); +} + +android::binder::Status AGnssRilCallbackAidl::requestRefLocCb() { + ALOGI("requestRefLocCb"); + return android::binder::Status::ok(); +} diff --git a/gnss/aidl/vts/AGnssRilCallbackAidl.h b/gnss/aidl/vts/AGnssRilCallbackAidl.h new file mode 100644 index 0000000000000000000000000000000000000000..74b34eee94228b70e3d04a61eb5c0044494be31c --- /dev/null +++ b/gnss/aidl/vts/AGnssRilCallbackAidl.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 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. + */ + +#pragma once + +#include + +/** Implementation for IAGnssRilCallback. */ +class AGnssRilCallbackAidl : public android::hardware::gnss::BnAGnssRilCallback { + public: + AGnssRilCallbackAidl(){}; + ~AGnssRilCallbackAidl(){}; + android::binder::Status requestSetIdCb(int setIdflag) override; + android::binder::Status requestRefLocCb() override; +}; diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp index 838849d535098e62b6338458224b802af9ce7b5e..f02a41e2480f26d1bf8a290ce398d91d1c9a9336 100644 --- a/gnss/aidl/vts/Android.bp +++ b/gnss/aidl/vts/Android.bp @@ -30,9 +30,17 @@ cc_test { srcs: [ "gnss_hal_test.cpp", "gnss_hal_test_cases.cpp", + "AGnssCallbackAidl.cpp", + "AGnssRilCallbackAidl.cpp", + "GnssAntennaInfoCallbackAidl.cpp", + "GnssBatchingCallback.cpp", "GnssCallbackAidl.cpp", + "GnssGeofenceCallback.cpp", "GnssMeasurementCallbackAidl.cpp", + "GnssNavigationMessageCallback.cpp", "GnssPowerIndicationCallback.cpp", + "GnssVisibilityControlCallback.cpp", + "MeasurementCorrectionsCallback.cpp", "VtsHalGnssTargetTest.cpp", ], shared_libs: [ @@ -43,7 +51,7 @@ cc_test { "libbinder", ], static_libs: [ - "android.hardware.gnss-V1-cpp", + "android.hardware.gnss-V2-cpp", "android.hardware.gnss@common-vts-lib", ], test_suites: [ diff --git a/gnss/aidl/vts/GnssAntennaInfoCallbackAidl.cpp b/gnss/aidl/vts/GnssAntennaInfoCallbackAidl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..11001cde89cdcb9a784ec73c8db04b0177ec3ed6 --- /dev/null +++ b/gnss/aidl/vts/GnssAntennaInfoCallbackAidl.cpp @@ -0,0 +1,26 @@ +/* + * 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. + */ + +#include "GnssAntennaInfoCallbackAidl.h" +#include +#include + +android::binder::Status GnssAntennaInfoCallbackAidl::gnssAntennaInfoCb( + const std::vector& gnssAntennaInfos) { + ALOGD("GnssAntennaInfo received. Size = %d", (int)gnssAntennaInfos.size()); + antenna_info_cbq_.store(gnssAntennaInfos); + return android::binder::Status::ok(); +} diff --git a/gnss/aidl/vts/GnssAntennaInfoCallbackAidl.h b/gnss/aidl/vts/GnssAntennaInfoCallbackAidl.h new file mode 100644 index 0000000000000000000000000000000000000000..77e105797a4659b194f17f1fdd4523e0bf6438fd --- /dev/null +++ b/gnss/aidl/vts/GnssAntennaInfoCallbackAidl.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include "GnssCallbackEventQueue.h" + +/** Implementation for IGnssAntennaInfoCallback. */ +class GnssAntennaInfoCallbackAidl : public android::hardware::gnss::BnGnssAntennaInfoCallback { + public: + GnssAntennaInfoCallbackAidl() : antenna_info_cbq_("info"){}; + ~GnssAntennaInfoCallbackAidl(){}; + + android::binder::Status gnssAntennaInfoCb( + const std::vector& gnssAntennaInfos) + override; + + android::hardware::gnss::common::GnssCallbackEventQueue< + std::vector> + antenna_info_cbq_; +}; diff --git a/gnss/aidl/vts/GnssBatchingCallback.cpp b/gnss/aidl/vts/GnssBatchingCallback.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d4eb0a58b6ce2ab16c75a467e5388aff621a6b28 --- /dev/null +++ b/gnss/aidl/vts/GnssBatchingCallback.cpp @@ -0,0 +1,33 @@ +/* + * 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_TAG "GnssBatchingCallbackAidl" + +#include "GnssBatchingCallback.h" +#include +#include + +android::binder::Status GnssBatchingCallback::gnssLocationBatchCb( + const std::vector& locations) { + ALOGI("Batched locations received with size=%d", (int)locations.size()); + for (const auto& location : locations) { + ALOGI("elapsedRealtime: flags = %d, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf", + location.elapsedRealtime.flags, location.elapsedRealtime.timestampNs, + location.elapsedRealtime.timeUncertaintyNs); + } + batched_locations_cbq_.store(locations); + return android::binder::Status::ok(); +} diff --git a/gnss/aidl/vts/GnssBatchingCallback.h b/gnss/aidl/vts/GnssBatchingCallback.h new file mode 100644 index 0000000000000000000000000000000000000000..310a134a3ff33f7f58a79f1360e5355a7a52bad7 --- /dev/null +++ b/gnss/aidl/vts/GnssBatchingCallback.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include "GnssCallbackEventQueue.h" + +/** Implementation for IGnssBatchingCallback. */ +class GnssBatchingCallback : public android::hardware::gnss::BnGnssBatchingCallback { + public: + GnssBatchingCallback() : batched_locations_cbq_("batched_locations") {} + ~GnssBatchingCallback() {} + + android::binder::Status gnssLocationBatchCb( + const std::vector& locations) override; + + android::hardware::gnss::common::GnssCallbackEventQueue< + std::vector> + batched_locations_cbq_; + std::vector last_batched_locations_; +}; diff --git a/gnss/aidl/vts/GnssCallbackAidl.cpp b/gnss/aidl/vts/GnssCallbackAidl.cpp index f5c745b75c3e434908037b7c4df13a8fd60c9946..2f6128b6d273220a82cbc84138ec70b3bd6cd685 100644 --- a/gnss/aidl/vts/GnssCallbackAidl.cpp +++ b/gnss/aidl/vts/GnssCallbackAidl.cpp @@ -14,11 +14,63 @@ * limitations under the License. */ +#define LOG_TAG "GnssCallbackAidl" + #include "GnssCallbackAidl.h" #include -android::binder::Status GnssCallbackAidl::gnssSetCapabilitiesCb(const int capabilities) { - ALOGI("Capabilities received %d", capabilities); +using android::binder::Status; +using android::hardware::gnss::GnssLocation; +using GnssSvInfo = android::hardware::gnss::IGnssCallback::GnssSvInfo; +using GnssSystemInfo = android::hardware::gnss::IGnssCallback::GnssSystemInfo; + +Status GnssCallbackAidl::gnssSetCapabilitiesCb(const int capabilities) { + ALOGI("Capabilities received %#08x", capabilities); capabilities_cbq_.store(capabilities); - return android::binder::Status::ok(); + return Status::ok(); +} + +Status GnssCallbackAidl::gnssStatusCb(const GnssStatusValue /* status */) { + ALOGI("gnssStatusCb"); + return Status::ok(); +} + +Status GnssCallbackAidl::gnssSvStatusCb(const std::vector& svInfoList) { + ALOGI("gnssSvStatusCb. Size = %d", (int)svInfoList.size()); + sv_info_list_cbq_.store(svInfoList); + return Status::ok(); +} + +Status GnssCallbackAidl::gnssLocationCb(const GnssLocation& location) { + ALOGI("Location received"); + location_cbq_.store(location); + return Status::ok(); +} + +Status GnssCallbackAidl::gnssNmeaCb(const int64_t timestamp, const std::string& nmea) { + nmea_cbq_.store(std::make_pair(timestamp, nmea)); + return Status::ok(); +} + +Status GnssCallbackAidl::gnssAcquireWakelockCb() { + return Status::ok(); +} + +Status GnssCallbackAidl::gnssReleaseWakelockCb() { + return Status::ok(); +} + +Status GnssCallbackAidl::gnssSetSystemInfoCb(const GnssSystemInfo& info) { + ALOGI("gnssSetSystemInfoCb, year=%d, name=%s", info.yearOfHw, info.name.c_str()); + info_cbq_.store(info); + return Status::ok(); +} + +Status GnssCallbackAidl::gnssRequestTimeCb() { + return Status::ok(); +} + +Status GnssCallbackAidl::gnssRequestLocationCb(const bool /* independentFromGnss */, + const bool /* isUserEmergency */) { + return Status::ok(); } diff --git a/gnss/aidl/vts/GnssCallbackAidl.h b/gnss/aidl/vts/GnssCallbackAidl.h index 7f802ea02ed2958ca0793d5315e50df906bb3791..a9495ba3c2261df95da9f614c5ef0fbb3eeaff0e 100644 --- a/gnss/aidl/vts/GnssCallbackAidl.h +++ b/gnss/aidl/vts/GnssCallbackAidl.h @@ -17,16 +17,46 @@ #pragma once #include +#include #include "GnssCallbackEventQueue.h" /* Callback class for data & Event. */ class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback { public: - GnssCallbackAidl() : capabilities_cbq_("capabilities"){}; + GnssCallbackAidl() + : capabilities_cbq_("capabilities"), + info_cbq_("system_info"), + location_cbq_("location"), + sv_info_list_cbq_("sv_info"), + nmea_cbq_("nmea"){}; ~GnssCallbackAidl(){}; android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override; + android::binder::Status gnssStatusCb(const GnssStatusValue status) override; + android::binder::Status gnssSvStatusCb(const std::vector& svInfoList) override; + android::binder::Status gnssLocationCb( + const android::hardware::gnss::GnssLocation& location) override; + android::binder::Status gnssNmeaCb(const int64_t timestamp, const std::string& nmea) override; + android::binder::Status gnssAcquireWakelockCb() override; + android::binder::Status gnssReleaseWakelockCb() override; + android::binder::Status gnssSetSystemInfoCb(const GnssSystemInfo& info) override; + android::binder::Status gnssRequestTimeCb() override; + android::binder::Status gnssRequestLocationCb(const bool independentFromGnss, + const bool isUserEmergency) override; int last_capabilities_; + android::hardware::gnss::IGnssCallback::GnssSystemInfo last_info_; + android::hardware::gnss::GnssLocation last_location_; + android::hardware::gnss::common::GnssCallbackEventQueue capabilities_cbq_; + android::hardware::gnss::common::GnssCallbackEventQueue< + android::hardware::gnss::IGnssCallback::GnssSystemInfo> + info_cbq_; + android::hardware::gnss::common::GnssCallbackEventQueue + location_cbq_; + android::hardware::gnss::common::GnssCallbackEventQueue< + std::vector> + sv_info_list_cbq_; + android::hardware::gnss::common::GnssCallbackEventQueue> + nmea_cbq_; }; \ No newline at end of file diff --git a/gnss/aidl/vts/GnssGeofenceCallback.cpp b/gnss/aidl/vts/GnssGeofenceCallback.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b841cb96c77426563607d23608e6052ef78ad4b9 --- /dev/null +++ b/gnss/aidl/vts/GnssGeofenceCallback.cpp @@ -0,0 +1,46 @@ +/* + * 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. + */ + +#include "GnssGeofenceCallback.h" +#include + +using android::binder::Status; +using android::hardware::gnss::GnssLocation; + +Status GnssGeofenceCallback::gnssGeofenceTransitionCb(int, const GnssLocation&, int, int64_t) { + // To implement + return Status::ok(); +} +Status GnssGeofenceCallback::gnssGeofenceStatusCb(int, const GnssLocation&) { + // To implement + return Status::ok(); +} +Status GnssGeofenceCallback::gnssGeofenceAddCb(int, int) { + // To implement + return Status::ok(); +} +Status GnssGeofenceCallback::gnssGeofenceRemoveCb(int, int) { + // To implement + return Status::ok(); +} +Status GnssGeofenceCallback::gnssGeofencePauseCb(int, int) { + // To implement + return Status::ok(); +} +Status GnssGeofenceCallback::gnssGeofenceResumeCb(int, int) { + // To implement + return Status::ok(); +} diff --git a/gnss/aidl/vts/GnssGeofenceCallback.h b/gnss/aidl/vts/GnssGeofenceCallback.h new file mode 100644 index 0000000000000000000000000000000000000000..b10551871a28ca5a3f18a1a479acd1aa7568dade --- /dev/null +++ b/gnss/aidl/vts/GnssGeofenceCallback.h @@ -0,0 +1,38 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include "GnssCallbackEventQueue.h" + +/** Implementation for IGnssGeofenceCallback. */ +class GnssGeofenceCallback : public android::hardware::gnss::BnGnssGeofenceCallback { + public: + GnssGeofenceCallback() {} + ~GnssGeofenceCallback() {} + + android::binder::Status gnssGeofenceTransitionCb( + int geofenceId, const android::hardware::gnss::GnssLocation& location, int transition, + int64_t timestampMillis) override; + android::binder::Status gnssGeofenceStatusCb( + int availability, const android::hardware::gnss::GnssLocation& lastLocation) override; + android::binder::Status gnssGeofenceAddCb(int geofenceId, int status) override; + android::binder::Status gnssGeofenceRemoveCb(int geofenceId, int status) override; + android::binder::Status gnssGeofencePauseCb(int geofenceId, int status) override; + android::binder::Status gnssGeofenceResumeCb(int geofenceId, int status) override; +}; diff --git a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp index c4fad7fb35feac2b546b8956a478d826b62a42f7..a553954a972f871d58d85b8117d3cbaa5bd4e1b4 100644 --- a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp +++ b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp @@ -24,12 +24,10 @@ using android::hardware::gnss::GnssData; android::binder::Status GnssMeasurementCallbackAidl::gnssMeasurementCb(const GnssData& gnssData) { ALOGI("gnssMeasurementCb"); - ALOGI("elapsedRealtime: flags = %d, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf", + ALOGV("elapsedRealtime: flags = 0x%X, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf", gnssData.elapsedRealtime.flags, gnssData.elapsedRealtime.timestampNs, gnssData.elapsedRealtime.timeUncertaintyNs); - for (const auto& measurement : gnssData.measurements) { - ALOGI("measurement.receivedSvTimeInNs=%" PRId64, measurement.receivedSvTimeInNs); - } + gnss_data_cbq_.store(gnssData); return android::binder::Status::ok(); } diff --git a/gnss/aidl/vts/GnssNavigationMessageCallback.cpp b/gnss/aidl/vts/GnssNavigationMessageCallback.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cf4a6ebef8b5be93d09129b8a32b41aafc3c35dd --- /dev/null +++ b/gnss/aidl/vts/GnssNavigationMessageCallback.cpp @@ -0,0 +1,28 @@ +/* + * 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_TAG "GnssNavMsgCallback" + +#include "GnssNavigationMessageCallback.h" +#include + +android::binder::Status GnssNavigationMessageCallback::gnssNavigationMessageCb( + const android::hardware::gnss::IGnssNavigationMessageCallback::GnssNavigationMessage& msg) { + ALOGD("gnssNavigationMessageCb. svid=%d, type=%d, status=%d, msgId=%d, subMsgId=%d, " + "data.size=%d", + msg.svid, (int)msg.type, (int)msg.status, msg.messageId, msg.submessageId, + (int)msg.data.size()); + return android::binder::Status::ok(); +} diff --git a/gnss/aidl/vts/GnssNavigationMessageCallback.h b/gnss/aidl/vts/GnssNavigationMessageCallback.h new file mode 100644 index 0000000000000000000000000000000000000000..55114ca8d114b4688a51558886c5f25a8580cad2 --- /dev/null +++ b/gnss/aidl/vts/GnssNavigationMessageCallback.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma once + +#include + +/** Implementation for IGnssNavigationMessageCallback. */ +class GnssNavigationMessageCallback + : public android::hardware::gnss::BnGnssNavigationMessageCallback { + public: + GnssNavigationMessageCallback() {} + ~GnssNavigationMessageCallback() {} + + android::binder::Status gnssNavigationMessageCb( + const android::hardware::gnss::IGnssNavigationMessageCallback::GnssNavigationMessage& + message) override; +}; diff --git a/gnss/aidl/vts/GnssVisibilityControlCallback.cpp b/gnss/aidl/vts/GnssVisibilityControlCallback.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa27af169b3c637dc14e62c16709466f7498705a --- /dev/null +++ b/gnss/aidl/vts/GnssVisibilityControlCallback.cpp @@ -0,0 +1,28 @@ +/* + * 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. + */ + +#include "GnssVisibilityControlCallback.h" +#include + +android::binder::Status GnssVisibilityControlCallback::nfwNotifyCb(const NfwNotification&) { + // To implement + return android::binder::Status::ok(); +} + +android::binder::Status GnssVisibilityControlCallback::isInEmergencySession(bool*) { + // To implement + return android::binder::Status::ok(); +} diff --git a/gnss/aidl/vts/GnssVisibilityControlCallback.h b/gnss/aidl/vts/GnssVisibilityControlCallback.h new file mode 100644 index 0000000000000000000000000000000000000000..fbacde766d8c1859def3a901cf861384977d9895 --- /dev/null +++ b/gnss/aidl/vts/GnssVisibilityControlCallback.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +#pragma once + +#include + +class GnssVisibilityControlCallback + : public android::hardware::gnss::visibility_control::BnGnssVisibilityControlCallback { + public: + GnssVisibilityControlCallback(){}; + ~GnssVisibilityControlCallback(){}; + android::binder::Status nfwNotifyCb( + const android::hardware::gnss::visibility_control::IGnssVisibilityControlCallback:: + NfwNotification& notification) override; + android::binder::Status isInEmergencySession(bool* _aidl_return) override; +}; diff --git a/gnss/aidl/vts/MeasurementCorrectionsCallback.cpp b/gnss/aidl/vts/MeasurementCorrectionsCallback.cpp new file mode 100644 index 0000000000000000000000000000000000000000..db1f7a689384f41a103b40a40441f47a9d3f28e6 --- /dev/null +++ b/gnss/aidl/vts/MeasurementCorrectionsCallback.cpp @@ -0,0 +1,26 @@ +/* + * 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_TAG "MeasurementCorrectionsCallback" + +#include "MeasurementCorrectionsCallback.h" +#include + +android::binder::Status MeasurementCorrectionsCallback::setCapabilitiesCb(const int capabilities) { + ALOGI("Capabilities received %d", capabilities); + capabilities_cbq_.store(capabilities); + return android::binder::Status::ok(); +} diff --git a/gnss/aidl/vts/MeasurementCorrectionsCallback.h b/gnss/aidl/vts/MeasurementCorrectionsCallback.h new file mode 100644 index 0000000000000000000000000000000000000000..27e5b3cde2282136aa5094779422aab62b7775cb --- /dev/null +++ b/gnss/aidl/vts/MeasurementCorrectionsCallback.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma once + +#include +#include "GnssCallbackEventQueue.h" + +class MeasurementCorrectionsCallback + : public android::hardware::gnss::measurement_corrections::BnMeasurementCorrectionsCallback { + public: + MeasurementCorrectionsCallback() : capabilities_cbq_("capabilities"){}; + ~MeasurementCorrectionsCallback(){}; + android::binder::Status setCapabilitiesCb(const int capabilities) override; + + android::hardware::gnss::common::GnssCallbackEventQueue capabilities_cbq_; + int last_capabilities_; +}; diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp index 2447bf8c84bb8bf4b306a0687229daa169f42751..0e1218e40c4f905779c0f9cfeb62eee52cd5d041 100644 --- a/gnss/aidl/vts/gnss_hal_test.cpp +++ b/gnss/aidl/vts/gnss_hal_test.cpp @@ -14,20 +14,66 @@ * limitations under the License. */ +#define LOG_TAG "GnssHalTest" + #include "gnss_hal_test.h" #include +#include +#include +#include "Utils.h" + +using android::hardware::gnss::GnssClock; +using android::hardware::gnss::GnssConstellationType; +using android::hardware::gnss::GnssData; +using android::hardware::gnss::GnssLocation; +using android::hardware::gnss::GnssMeasurement; +using android::hardware::gnss::IGnss; +using android::hardware::gnss::IGnssCallback; +using android::hardware::gnss::IGnssMeasurementInterface; +using android::hardware::gnss::common::Utils; +using GnssConstellationTypeV2_0 = android::hardware::gnss::V2_0::GnssConstellationType; -using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType; +namespace { +// The difference between the mean of the received intervals and the requested interval should not +// be larger mInterval * ALLOWED_MEAN_ERROR_RATIO +constexpr double ALLOWED_MEAN_ERROR_RATIO = 0.25; + +// The standard deviation computed for the deltas should not be bigger +// than mInterval * ALLOWED_STDEV_ERROR_RATIO or MIN_STDEV_MS, whichever is higher. +constexpr double ALLOWED_STDEV_ERROR_RATIO = 0.50; +constexpr double MIN_STDEV_MS = 1000; + +double computeMean(std::vector& deltas) { + long accumulator = 0; + for (auto& d : deltas) { + accumulator += d; + } + return accumulator / deltas.size(); +} + +double computeStdev(double mean, std::vector& deltas) { + double accumulator = 0; + for (auto& d : deltas) { + double diff = d - mean; + accumulator += diff * diff; + } + return std::sqrt(accumulator / (deltas.size() - 1)); +} + +} // anonymous namespace void GnssHalTest::SetUp() { // Get AIDL handle aidl_gnss_hal_ = android::waitForDeclaredService(String16(GetParam().c_str())); ASSERT_NE(aidl_gnss_hal_, nullptr); + ALOGD("AIDL Interface Version = %d", aidl_gnss_hal_->getInterfaceVersion()); - const auto& hidlInstanceNames = android::hardware::getAllHalInstanceNames( - android::hardware::gnss::V2_1::IGnss::descriptor); - gnss_hal_ = IGnss_V2_1::getService(hidlInstanceNames[0]); - ASSERT_NE(gnss_hal_, nullptr); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + const auto& hidlInstanceNames = android::hardware::getAllHalInstanceNames( + android::hardware::gnss::V2_1::IGnss::descriptor); + gnss_hal_ = IGnss_V2_1::getService(hidlInstanceNames[0]); + ASSERT_NE(gnss_hal_, nullptr); + } SetUpGnssCallback(); } @@ -40,7 +86,6 @@ void GnssHalTest::SetUpGnssCallback() { if (!status.isOk()) { ALOGE("Failed to setCallback"); } - ASSERT_TRUE(status.isOk()); /* @@ -48,9 +93,384 @@ void GnssHalTest::SetUpGnssCallback() { */ EXPECT_TRUE(aidl_gnss_cb_->capabilities_cbq_.retrieve(aidl_gnss_cb_->last_capabilities_, TIMEOUT_SEC)); - EXPECT_EQ(aidl_gnss_cb_->capabilities_cbq_.calledCount(), 1); - // Invoke the super method. - GnssHalTestTemplate::SetUpGnssCallback(); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + // Invoke the super method. + GnssHalTestTemplate::SetUpGnssCallback(); + } else { + /* + * SystemInfo callback should trigger + */ + EXPECT_TRUE(aidl_gnss_cb_->info_cbq_.retrieve(aidl_gnss_cb_->last_info_, TIMEOUT_SEC)); + EXPECT_EQ(aidl_gnss_cb_->info_cbq_.calledCount(), 1); + } +} + +void GnssHalTest::CheckLocation(const GnssLocation& location, bool check_speed) { + Utils::checkLocation(location, check_speed, /* check_more_accuracies= */ true); +} + +void GnssHalTest::SetPositionMode(const int min_interval_msec, const bool low_power_mode) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + // Invoke the super method. + return GnssHalTestTemplate::SetPositionMode(min_interval_msec, low_power_mode); + } + + const int kPreferredAccuracy = 0; // Ideally perfect (matches GnssLocationProvider) + const int kPreferredTimeMsec = 0; // Ideally immediate + + IGnss::PositionModeOptions options; + options.mode = IGnss::GnssPositionMode::MS_BASED; + options.recurrence = IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC; + options.minIntervalMs = min_interval_msec; + options.preferredAccuracyMeters = kPreferredAccuracy; + options.preferredTimeMs = kPreferredTimeMsec; + options.lowPowerMode = low_power_mode; + auto status = aidl_gnss_hal_->setPositionMode(options); + + ASSERT_TRUE(status.isOk()); +} + +bool GnssHalTest::StartAndCheckFirstLocation(const int min_interval_msec, const bool low_power_mode, + const bool start_sv_status, const bool start_nmea) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + // Invoke the super method. + return GnssHalTestTemplate::StartAndCheckFirstLocation(min_interval_msec, + low_power_mode); + } + SetPositionMode(min_interval_msec, low_power_mode); + + if (start_sv_status) { + auto status = aidl_gnss_hal_->startSvStatus(); + EXPECT_TRUE(status.isOk()); + } + if (start_nmea) { + auto status = aidl_gnss_hal_->startNmea(); + EXPECT_TRUE(status.isOk()); + } + + auto status = aidl_gnss_hal_->start(); + EXPECT_TRUE(status.isOk()); + + /* + * GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS, + * so allow time to demodulate ephemeris over the air. + */ + const int kFirstGnssLocationTimeoutSeconds = 75; + + EXPECT_TRUE(aidl_gnss_cb_->location_cbq_.retrieve(aidl_gnss_cb_->last_location_, + kFirstGnssLocationTimeoutSeconds)); + int locationCalledCount = aidl_gnss_cb_->location_cbq_.calledCount(); + EXPECT_EQ(locationCalledCount, 1); + + if (locationCalledCount > 0) { + // don't require speed on first fix + CheckLocation(aidl_gnss_cb_->last_location_, false); + return true; + } + return false; +} + +bool GnssHalTest::StartAndCheckFirstLocation(const int min_interval_msec, + const bool low_power_mode) { + return StartAndCheckFirstLocation(min_interval_msec, low_power_mode, + /* start_sv_status= */ true, /* start_nmea= */ true); +} + +void GnssHalTest::StopAndClearLocations() { + ALOGD("StopAndClearLocations"); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + // Invoke the super method. + return GnssHalTestTemplate::StopAndClearLocations(); + } + auto status = aidl_gnss_hal_->stopSvStatus(); + EXPECT_TRUE(status.isOk()); + status = aidl_gnss_hal_->stopNmea(); + EXPECT_TRUE(status.isOk()); + + status = aidl_gnss_hal_->stop(); + EXPECT_TRUE(status.isOk()); + + /* + * Clear notify/waiting counter, allowing up till the timeout after + * the last reply for final startup messages to arrive (esp. system + * info.) + */ + while (aidl_gnss_cb_->location_cbq_.retrieve(aidl_gnss_cb_->last_location_, TIMEOUT_SEC)) { + } + aidl_gnss_cb_->location_cbq_.reset(); +} + +void GnssHalTest::StartAndCheckLocations(const int count, const bool start_sv_status, + const bool start_nmea) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + // Invoke the super method. + return GnssHalTestTemplate::StartAndCheckLocations(count); + } + const int kMinIntervalMsec = 500; + const int kLocationTimeoutSubsequentSec = 2; + const bool kLowPowerMode = false; + + EXPECT_TRUE(StartAndCheckFirstLocation(kMinIntervalMsec, kLowPowerMode, start_sv_status, + start_nmea)); + + for (int i = 1; i < count; i++) { + EXPECT_TRUE(aidl_gnss_cb_->location_cbq_.retrieve(aidl_gnss_cb_->last_location_, + kLocationTimeoutSubsequentSec)); + int locationCalledCount = aidl_gnss_cb_->location_cbq_.calledCount(); + EXPECT_EQ(locationCalledCount, i + 1); + // Don't cause confusion by checking details if no location yet + if (locationCalledCount > 0) { + // Should be more than 1 location by now, but if not, still don't check first fix speed + CheckLocation(aidl_gnss_cb_->last_location_, locationCalledCount > 1); + } + } +} + +void GnssHalTest::StartAndCheckLocations(const int count) { + StartAndCheckLocations(count, /* start_sv_status= */ true, /* start_nmea= */ true); +} + +std::list> GnssHalTest::convertToAidl( + const std::list>& sv_info_list) { + std::list> aidl_sv_info_list; + for (const auto& sv_info_vec : sv_info_list) { + std::vector aidl_sv_info_vec; + for (const auto& sv_info : sv_info_vec) { + IGnssCallback::GnssSvInfo aidl_sv_info; + aidl_sv_info.svid = sv_info.v2_0.v1_0.svid; + aidl_sv_info.constellation = + static_cast(sv_info.v2_0.constellation); + aidl_sv_info.cN0Dbhz = sv_info.v2_0.v1_0.cN0Dbhz; + aidl_sv_info.basebandCN0DbHz = sv_info.basebandCN0DbHz; + aidl_sv_info.elevationDegrees = sv_info.v2_0.v1_0.elevationDegrees; + aidl_sv_info.azimuthDegrees = sv_info.v2_0.v1_0.azimuthDegrees; + aidl_sv_info.carrierFrequencyHz = (int64_t)sv_info.v2_0.v1_0.carrierFrequencyHz; + aidl_sv_info.svFlag = (int)sv_info.v2_0.v1_0.svFlag; + aidl_sv_info_vec.push_back(aidl_sv_info); + } + aidl_sv_info_list.push_back(aidl_sv_info_vec); + } + return aidl_sv_info_list; +} + +/* + * FindStrongFrequentNonGpsSource: + * + * Search through a GnssSvStatus list for the strongest non-GPS satellite observed enough times + * + * returns the strongest source, + * or a source with constellation == UNKNOWN if none are found sufficient times + */ +BlocklistedSource GnssHalTest::FindStrongFrequentNonGpsSource( + const std::list> sv_info_list, + const int min_observations) { + return FindStrongFrequentNonGpsSource(convertToAidl(sv_info_list), min_observations); +} + +BlocklistedSource GnssHalTest::FindStrongFrequentNonGpsSource( + const std::list> sv_info_list, + const int min_observations) { + std::map mapSignals; + + for (const auto& sv_info_vec : sv_info_list) { + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + const auto& gnss_sv = sv_info_vec[iSv]; + if ((gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX) && + (gnss_sv.constellation != GnssConstellationType::GPS)) { + ComparableBlocklistedSource source; + source.id.svid = gnss_sv.svid; + source.id.constellation = gnss_sv.constellation; + + const auto& itSignal = mapSignals.find(source); + if (itSignal == mapSignals.end()) { + SignalCounts counts; + counts.observations = 1; + counts.max_cn0_dbhz = gnss_sv.cN0Dbhz; + mapSignals.insert( + std::pair(source, counts)); + } else { + itSignal->second.observations++; + if (itSignal->second.max_cn0_dbhz < gnss_sv.cN0Dbhz) { + itSignal->second.max_cn0_dbhz = gnss_sv.cN0Dbhz; + } + } + } + } + } + + float max_cn0_dbhz_with_sufficient_count = 0.; + int total_observation_count = 0; + int blocklisted_source_count_observation = 0; + + ComparableBlocklistedSource source_to_blocklist; // initializes to zero = UNKNOWN constellation + for (auto const& pairSignal : mapSignals) { + total_observation_count += pairSignal.second.observations; + if ((pairSignal.second.observations >= min_observations) && + (pairSignal.second.max_cn0_dbhz > max_cn0_dbhz_with_sufficient_count)) { + source_to_blocklist = pairSignal.first; + blocklisted_source_count_observation = pairSignal.second.observations; + max_cn0_dbhz_with_sufficient_count = pairSignal.second.max_cn0_dbhz; + } + } + ALOGD("Among %d observations, chose svid %d, constellation %d, " + "with %d observations at %.1f max CNo", + total_observation_count, source_to_blocklist.id.svid, + (int)source_to_blocklist.id.constellation, blocklisted_source_count_observation, + max_cn0_dbhz_with_sufficient_count); + + return source_to_blocklist.id; +} + +GnssConstellationType GnssHalTest::startLocationAndGetNonGpsConstellation( + const int locations_to_await, const int gnss_sv_info_list_timeout) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return static_cast( + GnssHalTestTemplate::startLocationAndGetNonGpsConstellation( + locations_to_await, gnss_sv_info_list_timeout)); + } + aidl_gnss_cb_->location_cbq_.reset(); + StartAndCheckLocations(locations_to_await); + const int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount(); + + // Tolerate 1 less sv status to handle edge cases in reporting. + int sv_info_list_cbq_size = aidl_gnss_cb_->sv_info_list_cbq_.size(); + EXPECT_GE(sv_info_list_cbq_size + 1, locations_to_await); + ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)", + sv_info_list_cbq_size, locations_to_await, location_called_count); + + // Find first non-GPS constellation to blocklist + GnssConstellationType constellation_to_blocklist = GnssConstellationType::UNKNOWN; + for (int i = 0; i < sv_info_list_cbq_size; ++i) { + std::vector sv_info_vec; + aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, gnss_sv_info_list_timeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + auto& gnss_sv = sv_info_vec[iSv]; + if ((gnss_sv.svFlag & (uint32_t)IGnssCallback::GnssSvFlags::USED_IN_FIX) && + (gnss_sv.constellation != GnssConstellationType::UNKNOWN) && + (gnss_sv.constellation != GnssConstellationType::GPS)) { + // found a non-GPS constellation + constellation_to_blocklist = gnss_sv.constellation; + break; + } + } + if (constellation_to_blocklist != GnssConstellationType::UNKNOWN) { + break; + } + } + + if (constellation_to_blocklist == GnssConstellationType::UNKNOWN) { + ALOGI("No non-GPS constellations found, constellation blocklist test less effective."); + // Proceed functionally to blocklist something. + constellation_to_blocklist = GnssConstellationType::GLONASS; + } + + return constellation_to_blocklist; +} + +void GnssHalTest::checkGnssMeasurementClockFields(const GnssData& measurement) { + Utils::checkElapsedRealtime(measurement.elapsedRealtime); + ASSERT_TRUE(measurement.clock.gnssClockFlags >= 0 && + measurement.clock.gnssClockFlags <= + (GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY | + GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS | + GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT | + GnssClock::HAS_DRIFT_UNCERTAINTY)); +} + +void GnssHalTest::checkGnssMeasurementFlags(const GnssMeasurement& measurement) { + ASSERT_TRUE(measurement.flags >= 0 && + measurement.flags <= + (GnssMeasurement::HAS_SNR | GnssMeasurement::HAS_CARRIER_FREQUENCY | + GnssMeasurement::HAS_CARRIER_CYCLES | GnssMeasurement::HAS_CARRIER_PHASE | + GnssMeasurement::HAS_CARRIER_PHASE_UNCERTAINTY | + GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL | + GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY | + GnssMeasurement::HAS_SATELLITE_ISB | + GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY | + GnssMeasurement::HAS_SATELLITE_PVT | + GnssMeasurement::HAS_CORRELATION_VECTOR)); +} + +void GnssHalTest::checkGnssMeasurementFields(const GnssMeasurement& measurement, + const GnssData& data) { + checkGnssMeasurementFlags(measurement); + // Verify CodeType is valid. + ASSERT_NE(measurement.signalType.codeType, ""); + // Verify basebandCn0DbHz is valid. + ASSERT_TRUE(measurement.basebandCN0DbHz > 0.0 && measurement.basebandCN0DbHz <= 65.0); + + if (((measurement.flags & GnssMeasurement::HAS_FULL_ISB) > 0) && + ((measurement.flags & GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY) > 0) && + ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB) > 0) && + ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY) > 0)) { + GnssConstellationType referenceConstellation = + data.clock.referenceSignalTypeForIsb.constellation; + double carrierFrequencyHz = data.clock.referenceSignalTypeForIsb.carrierFrequencyHz; + std::string codeType = data.clock.referenceSignalTypeForIsb.codeType; + + ASSERT_TRUE(referenceConstellation >= GnssConstellationType::UNKNOWN && + referenceConstellation <= GnssConstellationType::IRNSS); + ASSERT_TRUE(carrierFrequencyHz > 0); + ASSERT_NE(codeType, ""); + + ASSERT_TRUE(std::abs(measurement.fullInterSignalBiasNs) < 1.0e6); + ASSERT_TRUE(measurement.fullInterSignalBiasUncertaintyNs >= 0); + ASSERT_TRUE(std::abs(measurement.satelliteInterSignalBiasNs) < 1.0e6); + ASSERT_TRUE(measurement.satelliteInterSignalBiasUncertaintyNs >= 0); + } +} + +void GnssHalTest::startMeasurementWithInterval( + int intervalMs, const sp& iGnssMeasurement, + sp& callback) { + ALOGD("Start requesting measurement at interval of %d millis.", intervalMs); + IGnssMeasurementInterface::Options options; + options.intervalMs = intervalMs; + auto status = iGnssMeasurement->setCallbackWithOptions(callback, options); + ASSERT_TRUE(status.isOk()); +} + +void GnssHalTest::collectMeasurementIntervals(const sp& callback, + const int numMeasurementEvents, + const int timeoutSeconds, + std::vector& deltasMs) { + int64_t lastElapsedRealtimeMillis = 0; + for (int i = 0; i < numMeasurementEvents; i++) { + GnssData lastGnssData; + ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastGnssData, timeoutSeconds)); + EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1); + ASSERT_TRUE(lastGnssData.measurements.size() > 0); + + // Validity check GnssData fields + checkGnssMeasurementClockFields(lastGnssData); + for (const auto& measurement : lastGnssData.measurements) { + checkGnssMeasurementFields(measurement, lastGnssData); + } + + long currentElapsedRealtimeMillis = lastGnssData.elapsedRealtime.timestampNs * 1e-6; + if (lastElapsedRealtimeMillis != 0) { + deltasMs.push_back(currentElapsedRealtimeMillis - lastElapsedRealtimeMillis); + } + lastElapsedRealtimeMillis = currentElapsedRealtimeMillis; + } +} + +void GnssHalTest::assertMeanAndStdev(int intervalMs, std::vector& deltasMs) { + double mean = computeMean(deltasMs); + double stdev = computeStdev(mean, deltasMs); + EXPECT_TRUE(std::abs(mean - intervalMs) <= intervalMs * ALLOWED_MEAN_ERROR_RATIO) + << "Test failed, because the mean of intervals is " << mean + << " millis. The test requires that abs(" << mean << " - " << intervalMs + << ") <= " << intervalMs * ALLOWED_MEAN_ERROR_RATIO + << " millis, when the requested interval is " << intervalMs << " millis."; + + double maxStdev = std::max(MIN_STDEV_MS, intervalMs * ALLOWED_STDEV_ERROR_RATIO); + EXPECT_TRUE(stdev <= maxStdev) + << "Test failed, because the stdev of intervals is " << stdev + << " millis, which must be <= " << maxStdev + << " millis, when the requested interval is " << intervalMs << " millis."; + ALOGD("Mean of interval deltas in millis: %.1lf", mean); + ALOGD("Stdev of interval deltas in millis: %.1lf", stdev); } diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h index f72f7fe4e897e1bbccb5b4d5a68bb546982432e9..645fc824e0157b37fd77a552ef5ea62cb2ce6190 100644 --- a/gnss/aidl/vts/gnss_hal_test.h +++ b/gnss/aidl/vts/gnss_hal_test.h @@ -23,7 +23,9 @@ #include #include +#include "GnssBatchingCallback.h" #include "GnssCallbackAidl.h" +#include "GnssMeasurementCallbackAidl.h" #include "v2_1/gnss_hal_test_template.h" using IGnss_V2_1 = android::hardware::gnss::V2_1::IGnss; @@ -40,9 +42,66 @@ class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate< public: GnssHalTest(){}; ~GnssHalTest(){}; + + struct ComparableBlocklistedSource { + android::hardware::gnss::BlocklistedSource id; + + ComparableBlocklistedSource() { + id.constellation = android::hardware::gnss::GnssConstellationType::UNKNOWN; + id.svid = 0; + } + + bool operator<(const ComparableBlocklistedSource& compare) const { + return ((id.svid < compare.id.svid) || ((id.svid == compare.id.svid) && + (id.constellation < compare.id.constellation))); + } + }; + + struct SignalCounts { + int observations; + float max_cn0_dbhz; + }; + virtual void SetUp() override; virtual void SetUpGnssCallback() override; + void CheckLocation(const android::hardware::gnss::GnssLocation& location, + const bool check_speed); + void SetPositionMode(const int min_interval_msec, const bool low_power_mode); + bool StartAndCheckFirstLocation(const int min_interval_msec, const bool low_power_mode); + bool StartAndCheckFirstLocation(const int min_interval_msec, const bool low_power_mode, + const bool start_sv_status, const bool start_nmea); + void StopAndClearLocations(); + void StartAndCheckLocations(const int count); + void StartAndCheckLocations(const int count, const bool start_sv_status, const bool start_nmea); + + android::hardware::gnss::GnssConstellationType startLocationAndGetNonGpsConstellation( + const int locations_to_await, const int gnss_sv_info_list_timeout); + std::list> convertToAidl( + const std::list>& + sv_info_list); + android::hardware::gnss::BlocklistedSource FindStrongFrequentNonGpsSource( + const std::list> + sv_info_list, + const int min_observations); + android::hardware::gnss::BlocklistedSource FindStrongFrequentNonGpsSource( + const std::list> + sv_info_list, + const int min_observations); + + void checkGnssMeasurementClockFields(const android::hardware::gnss::GnssData& measurement); + void checkGnssMeasurementFlags(const android::hardware::gnss::GnssMeasurement& measurement); + void checkGnssMeasurementFields(const android::hardware::gnss::GnssMeasurement& measurement, + const android::hardware::gnss::GnssData& data); + void startMeasurementWithInterval( + int intervalMillis, + const sp& iMeasurement, + sp& callback); + void collectMeasurementIntervals(const sp& callback, + const int numMeasurementEvents, const int timeoutSeconds, + std::vector& deltaMs); + void assertMeanAndStdev(int intervalMillis, std::vector& deltasMillis); + sp aidl_gnss_hal_; sp aidl_gnss_cb_; // Primary callback interface }; diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 0cd782ebc1416d37bf123f0baecbc5569b9117bc..3696233d3b874931c2b7c760c3de9f75388fa617 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -16,32 +16,73 @@ #define LOG_TAG "GnssHalTestCases" +#include #include +#include +#include +#include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include "AGnssCallbackAidl.h" +#include "AGnssRilCallbackAidl.h" +#include "GnssAntennaInfoCallbackAidl.h" +#include "GnssBatchingCallback.h" +#include "GnssGeofenceCallback.h" #include "GnssMeasurementCallbackAidl.h" +#include "GnssNavigationMessageCallback.h" #include "GnssPowerIndicationCallback.h" +#include "GnssVisibilityControlCallback.h" +#include "MeasurementCorrectionsCallback.h" +#include "Utils.h" #include "gnss_hal_test.h" using android::sp; using android::hardware::gnss::BlocklistedSource; using android::hardware::gnss::ElapsedRealtime; using android::hardware::gnss::GnssClock; +using android::hardware::gnss::GnssConstellationType; using android::hardware::gnss::GnssData; +using android::hardware::gnss::GnssLocation; using android::hardware::gnss::GnssMeasurement; using android::hardware::gnss::GnssPowerStats; +using android::hardware::gnss::IAGnss; +using android::hardware::gnss::IAGnssRil; using android::hardware::gnss::IGnss; +using android::hardware::gnss::IGnssAntennaInfo; +using android::hardware::gnss::IGnssAntennaInfoCallback; +using android::hardware::gnss::IGnssBatching; +using android::hardware::gnss::IGnssBatchingCallback; +using android::hardware::gnss::IGnssCallback; using android::hardware::gnss::IGnssConfiguration; +using android::hardware::gnss::IGnssDebug; +using android::hardware::gnss::IGnssGeofence; +using android::hardware::gnss::IGnssGeofenceCallback; using android::hardware::gnss::IGnssMeasurementCallback; using android::hardware::gnss::IGnssMeasurementInterface; +using android::hardware::gnss::IGnssNavigationMessageInterface; using android::hardware::gnss::IGnssPowerIndication; using android::hardware::gnss::IGnssPsds; using android::hardware::gnss::PsdsType; using android::hardware::gnss::SatellitePvt; +using android::hardware::gnss::common::Utils; +using android::hardware::gnss::measurement_corrections::IMeasurementCorrectionsInterface; +using android::hardware::gnss::visibility_control::IGnssVisibilityControl; -using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType; +using GnssConstellationTypeV2_0 = android::hardware::gnss::V2_0::GnssConstellationType; + +static bool IsAutomotiveDevice() { + char buffer[PROPERTY_VALUE_MAX] = {0}; + property_get("ro.hardware.type", buffer, ""); + return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; +} /* * SetupTeardownCreateCleanup: @@ -51,6 +92,224 @@ using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType */ TEST_P(GnssHalTest, SetupTeardownCreateCleanup) {} +/* + * GetLocation: + * Turns on location, waits 75 second for at least 5 locations, + * and checks them for reasonable validity. + */ +TEST_P(GnssHalTest, GetLocations) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + const int kMinIntervalMsec = 500; + const int kLocationsToCheck = 5; + + SetPositionMode(kMinIntervalMsec, /* low_power_mode= */ false); + StartAndCheckLocations(kLocationsToCheck); + StopAndClearLocations(); +} + +/* + * InjectDelete: + * Ensures that calls to inject and/or delete information state are handled. + */ +TEST_P(GnssHalTest, InjectDelete) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + // Confidently, well north of Alaska + auto status = aidl_gnss_hal_->injectLocation(Utils::getMockLocation(80.0, -170.0, 150.0)); + ASSERT_TRUE(status.isOk()); + + // Fake time, but generally reasonable values (time in Aug. 2018) + status = + aidl_gnss_hal_->injectTime(/* timeMs= */ 1534567890123L, + /* timeReferenceMs= */ 123456L, /* uncertaintyMs= */ 10000L); + ASSERT_TRUE(status.isOk()); + + status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION); + ASSERT_TRUE(status.isOk()); + + status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::TIME); + ASSERT_TRUE(status.isOk()); + + // Ensure we can get a good location after a bad injection has been deleted + StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false); + StopAndClearLocations(); +} + +/* + * InjectSeedLocation: + * Injects a seed location and ensures the injected seed location is not fused in the resulting + * GNSS location. + */ +TEST_P(GnssHalTest, InjectSeedLocation) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + // An arbitrary position in North Pacific Ocean (where no VTS labs will ever likely be located). + const double seedLatDegrees = 32.312894; + const double seedLngDegrees = -172.954117; + const float seedAccuracyMeters = 150.0; + + auto status = aidl_gnss_hal_->injectLocation( + Utils::getMockLocation(seedLatDegrees, seedLngDegrees, seedAccuracyMeters)); + ASSERT_TRUE(status.isOk()); + + StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false); + + // Ensure we don't get a location anywhere within 111km (1 degree of lat or lng) of the seed + // location. + EXPECT_TRUE(std::abs(aidl_gnss_cb_->last_location_.latitudeDegrees - seedLatDegrees) > 1.0 || + std::abs(aidl_gnss_cb_->last_location_.longitudeDegrees - seedLngDegrees) > 1.0); + + StopAndClearLocations(); + + status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION); + ASSERT_TRUE(status.isOk()); +} + +/* + * GnssCapabilities: + * 1. Verifies that GNSS hardware supports measurement capabilities. + * 2. Verifies that GNSS hardware supports Scheduling capabilities. + */ +TEST_P(GnssHalTest, GnssCapabilites) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + if (!IsAutomotiveDevice()) { + EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_MEASUREMENTS); + } + EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_SCHEDULING); +} + +/* + * GetLocationLowPower: + * Turns on location, waits for at least 5 locations allowing max of LOCATION_TIMEOUT_SUBSEQUENT_SEC + * between one location and the next. Also ensure that MIN_INTERVAL_MSEC is respected by waiting + * NO_LOCATION_PERIOD_SEC and verfiy that no location is received. Also perform validity checks on + * each received location. + */ +TEST_P(GnssHalTest, GetLocationLowPower) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + + const int kMinIntervalMsec = 5000; + const int kLocationTimeoutSubsequentSec = (kMinIntervalMsec / 1000) * 2; + const int kNoLocationPeriodSec = (kMinIntervalMsec / 1000) / 2; + const int kLocationsToCheck = 5; + const bool kLowPowerMode = true; + + // Warmup period - VTS doesn't have AGPS access via GnssLocationProvider + aidl_gnss_cb_->location_cbq_.reset(); + StartAndCheckLocations(kLocationsToCheck); + StopAndClearLocations(); + aidl_gnss_cb_->location_cbq_.reset(); + + // Start of Low Power Mode test + // Don't expect true - as without AGPS access + if (!StartAndCheckFirstLocation(kMinIntervalMsec, kLowPowerMode)) { + ALOGW("GetLocationLowPower test - no first low power location received."); + } + + for (int i = 1; i < kLocationsToCheck; i++) { + // Verify that kMinIntervalMsec is respected by waiting kNoLocationPeriodSec and + // ensure that no location is received yet + + aidl_gnss_cb_->location_cbq_.retrieve(aidl_gnss_cb_->last_location_, kNoLocationPeriodSec); + const int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount(); + // Tolerate (ignore) one extra location right after the first one + // to handle startup edge case scheduling limitations in some implementations + if ((i == 1) && (location_called_count == 2)) { + CheckLocation(aidl_gnss_cb_->last_location_, true); + continue; // restart the quiet wait period after this too-fast location + } + EXPECT_LE(location_called_count, i); + if (location_called_count != i) { + ALOGW("GetLocationLowPower test - not enough locations received. %d vs. %d expected ", + location_called_count, i); + } + + if (!aidl_gnss_cb_->location_cbq_.retrieve( + aidl_gnss_cb_->last_location_, + kLocationTimeoutSubsequentSec - kNoLocationPeriodSec)) { + ALOGW("GetLocationLowPower test - timeout awaiting location %d", i); + } else { + CheckLocation(aidl_gnss_cb_->last_location_, true); + } + } + + StopAndClearLocations(); +} + +/* + * InjectBestLocation + * + * Ensure successfully injecting a location. + */ +TEST_P(GnssHalTest, InjectBestLocation) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + StartAndCheckLocations(1); + GnssLocation gnssLocation = aidl_gnss_cb_->last_location_; + CheckLocation(gnssLocation, true); + + auto status = aidl_gnss_hal_->injectBestLocation(gnssLocation); + + ASSERT_TRUE(status.isOk()); + + status = aidl_gnss_hal_->deleteAidingData(IGnss::GnssAidingData::POSITION); + + ASSERT_TRUE(status.isOk()); +} + +/* + * TestGnssSvInfoFields: + * Gets 1 location and a (non-empty) GnssSvInfo, and verifies basebandCN0DbHz is valid. + */ +TEST_P(GnssHalTest, TestGnssSvInfoFields) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + aidl_gnss_cb_->location_cbq_.reset(); + aidl_gnss_cb_->sv_info_list_cbq_.reset(); + StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false); + int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount(); + ALOGD("Observed %d GnssSvStatus, while awaiting one location (%d received)", + aidl_gnss_cb_->sv_info_list_cbq_.size(), location_called_count); + + // Wait for up to kNumSvInfoLists events for kTimeoutSeconds for each event. + int kTimeoutSeconds = 2; + int kNumSvInfoLists = 4; + std::list> sv_info_lists; + std::vector last_sv_info_list; + + do { + EXPECT_GT(aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_lists, kNumSvInfoLists, + kTimeoutSeconds), + 0); + if (!sv_info_lists.empty()) { + last_sv_info_list = sv_info_lists.back(); + ALOGD("last_sv_info size = %d", (int)last_sv_info_list.size()); + } + } while (!sv_info_lists.empty() && last_sv_info_list.size() == 0); + + bool nonZeroCn0Found = false; + for (auto sv_info : last_sv_info_list) { + EXPECT_TRUE(sv_info.basebandCN0DbHz >= 0.0 && sv_info.basebandCN0DbHz <= 65.0); + if (sv_info.basebandCN0DbHz > 0.0) { + nonZeroCn0Found = true; + } + } + // Assert at least one value is non-zero. Zero is ok in status as it's possibly + // reporting a searched but not found satellite. + EXPECT_TRUE(nonZeroCn0Found); + StopAndClearLocations(); +} + /* * TestPsdsExtension: * 1. Gets the PsdsExtension @@ -65,7 +324,7 @@ TEST_P(GnssHalTest, TestPsdsExtension) { } } -void CheckSatellitePvt(const SatellitePvt& satellitePvt) { +void CheckSatellitePvt(const SatellitePvt& satellitePvt, const int interfaceVersion) { const double kMaxOrbitRadiusMeters = 43000000.0; const double kMaxVelocityMps = 4000.0; // The below values are determined using GPS ICD Table 20-1 @@ -110,38 +369,15 @@ void CheckSatellitePvt(const SatellitePvt& satellitePvt) { ALOGD("Found HAS_TROPO"); ASSERT_TRUE(satellitePvt.tropoDelayMeters > 0 && satellitePvt.tropoDelayMeters < 100); } -} - -void CheckGnssMeasurementClockFields(const GnssData& measurement) { - ASSERT_TRUE(measurement.elapsedRealtime.flags >= 0 && - measurement.elapsedRealtime.flags <= (ElapsedRealtime::HAS_TIMESTAMP_NS | - ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS)); - if (measurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) { - ASSERT_TRUE(measurement.elapsedRealtime.timestampNs > 0); - } - if (measurement.elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) { - ASSERT_TRUE(measurement.elapsedRealtime.timeUncertaintyNs > 0); - } - ASSERT_TRUE(measurement.clock.gnssClockFlags >= 0 && - measurement.clock.gnssClockFlags <= - (GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY | - GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS | - GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT | - GnssClock::HAS_DRIFT_UNCERTAINTY)); -} - -void CheckGnssMeasurementFlags(const GnssMeasurement& measurement) { - ASSERT_TRUE(measurement.flags >= 0 && - measurement.flags <= - (GnssMeasurement::HAS_SNR | GnssMeasurement::HAS_CARRIER_FREQUENCY | - GnssMeasurement::HAS_CARRIER_CYCLES | GnssMeasurement::HAS_CARRIER_PHASE | - GnssMeasurement::HAS_CARRIER_PHASE_UNCERTAINTY | - GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL | - GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY | - GnssMeasurement::HAS_SATELLITE_ISB | - GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY | - GnssMeasurement::HAS_SATELLITE_PVT | - GnssMeasurement::HAS_CORRELATION_VECTOR)); + if (interfaceVersion >= 2) { + ASSERT_TRUE(satellitePvt.timeOfClockSeconds >= 0); + ASSERT_TRUE(satellitePvt.timeOfEphemerisSeconds >= 0); + // IODC has 10 bits + ASSERT_TRUE(satellitePvt.issueOfDataClock >= 0 && satellitePvt.issueOfDataClock <= 1023); + // IODE has 8 bits + ASSERT_TRUE(satellitePvt.issueOfDataEphemeris >= 0 && + satellitePvt.issueOfDataEphemeris <= 255); + } } /* @@ -181,15 +417,15 @@ TEST_P(GnssHalTest, TestGnssMeasurementExtensionAndSatellitePvt) { ASSERT_TRUE(lastMeasurement.measurements.size() > 0); // Validity check GnssData fields - CheckGnssMeasurementClockFields(lastMeasurement); + checkGnssMeasurementClockFields(lastMeasurement); for (const auto& measurement : lastMeasurement.measurements) { - CheckGnssMeasurementFlags(measurement); + checkGnssMeasurementFields(measurement, lastMeasurement); if (measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT && kIsSatellitePvtSupported == true) { ALOGD("Found a measurement with SatellitePvt"); satellitePvtFound = true; - CheckSatellitePvt(measurement.satellitePvt); + CheckSatellitePvt(measurement.satellitePvt, aidl_gnss_hal_->getInterfaceVersion()); } } } @@ -241,10 +477,10 @@ TEST_P(GnssHalTest, TestCorrelationVector) { ASSERT_TRUE(lastMeasurement.measurements.size() > 0); // Validity check GnssData fields - CheckGnssMeasurementClockFields(lastMeasurement); + checkGnssMeasurementClockFields(lastMeasurement); for (const auto& measurement : lastMeasurement.measurements) { - CheckGnssMeasurementFlags(measurement); + checkGnssMeasurementFields(measurement, lastMeasurement); if (measurement.flags & GnssMeasurement::HAS_CORRELATION_VECTOR) { correlationVectorFound = true; ASSERT_TRUE(measurement.correlationVectors.size() > 0); @@ -300,7 +536,11 @@ TEST_P(GnssHalTest, TestGnssPowerIndication) { auto powerStats1 = gnssPowerIndicationCallback->last_gnss_power_stats_; // Get a location and request another GnssPowerStats - gnss_cb_->location_cbq_.reset(); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + gnss_cb_->location_cbq_.reset(); + } else { + aidl_gnss_cb_->location_cbq_.reset(); + } StartAndCheckFirstLocation(/* min_interval_msec= */ 1000, /* low_power_mode= */ false); // Request and verify the 2nd GnssPowerStats has larger values than the 1st one @@ -350,88 +590,6 @@ TEST_P(GnssHalTest, TestGnssPowerIndication) { StopAndClearLocations(); } -/* - * FindStrongFrequentNonGpsSource: - * - * Search through a GnssSvStatus list for the strongest non-GPS satellite observed enough times - * - * returns the strongest source, - * or a source with constellation == UNKNOWN if none are found sufficient times - */ -BlocklistedSource FindStrongFrequentNonGpsSource( - const std::list> sv_info_list, - const int min_observations) { - struct ComparableBlocklistedSource { - BlocklistedSource id; - - ComparableBlocklistedSource() { - id.constellation = GnssConstellationTypeAidl::UNKNOWN; - id.svid = 0; - } - - bool operator<(const ComparableBlocklistedSource& compare) const { - return ((id.svid < compare.id.svid) || ((id.svid == compare.id.svid) && - (id.constellation < compare.id.constellation))); - } - }; - - struct SignalCounts { - int observations; - float max_cn0_dbhz; - }; - - std::map mapSignals; - - for (const auto& sv_info_vec : sv_info_list) { - for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { - const auto& gnss_sv = sv_info_vec[iSv]; - if ((gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX) && - (gnss_sv.v2_0.constellation != GnssConstellationType::GPS)) { - ComparableBlocklistedSource source; - source.id.svid = gnss_sv.v2_0.v1_0.svid; - source.id.constellation = - static_cast(gnss_sv.v2_0.constellation); - - const auto& itSignal = mapSignals.find(source); - if (itSignal == mapSignals.end()) { - SignalCounts counts; - counts.observations = 1; - counts.max_cn0_dbhz = gnss_sv.v2_0.v1_0.cN0Dbhz; - mapSignals.insert( - std::pair(source, counts)); - } else { - itSignal->second.observations++; - if (itSignal->second.max_cn0_dbhz < gnss_sv.v2_0.v1_0.cN0Dbhz) { - itSignal->second.max_cn0_dbhz = gnss_sv.v2_0.v1_0.cN0Dbhz; - } - } - } - } - } - - float max_cn0_dbhz_with_sufficient_count = 0.; - int total_observation_count = 0; - int blocklisted_source_count_observation = 0; - - ComparableBlocklistedSource source_to_blocklist; // initializes to zero = UNKNOWN constellation - for (auto const& pairSignal : mapSignals) { - total_observation_count += pairSignal.second.observations; - if ((pairSignal.second.observations >= min_observations) && - (pairSignal.second.max_cn0_dbhz > max_cn0_dbhz_with_sufficient_count)) { - source_to_blocklist = pairSignal.first; - blocklisted_source_count_observation = pairSignal.second.observations; - max_cn0_dbhz_with_sufficient_count = pairSignal.second.max_cn0_dbhz; - } - } - ALOGD("Among %d observations, chose svid %d, constellation %d, " - "with %d observations at %.1f max CNo", - total_observation_count, source_to_blocklist.id.svid, - (int)source_to_blocklist.id.constellation, blocklisted_source_count_observation, - max_cn0_dbhz_with_sufficient_count); - - return source_to_blocklist.id; -} - /* * BlocklistIndividualSatellites: * @@ -457,12 +615,20 @@ TEST_P(GnssHalTest, BlocklistIndividualSatellites) { const int kLocationsToAwait = 3; const int kRetriesToUnBlocklist = 10; - gnss_cb_->location_cbq_.reset(); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + gnss_cb_->location_cbq_.reset(); + } else { + aidl_gnss_cb_->location_cbq_.reset(); + } StartAndCheckLocations(kLocationsToAwait); - int location_called_count = gnss_cb_->location_cbq_.calledCount(); + int location_called_count = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->location_cbq_.calledCount() + : aidl_gnss_cb_->location_cbq_.calledCount(); // Tolerate 1 less sv status to handle edge cases in reporting. - int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size(); + int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->sv_info_list_cbq_.size() + : aidl_gnss_cb_->sv_info_list_cbq_.size(); EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)", sv_info_list_cbq_size, kLocationsToAwait, location_called_count); @@ -474,16 +640,24 @@ TEST_P(GnssHalTest, BlocklistIndividualSatellites) { */ const int kGnssSvInfoListTimeout = 2; - std::list> sv_info_vec_list; - int count = gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec_list, sv_info_list_cbq_size, - kGnssSvInfoListTimeout); - - ASSERT_EQ(count, sv_info_list_cbq_size); - - BlocklistedSource source_to_blocklist = - FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1); + BlocklistedSource source_to_blocklist; + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + std::list> sv_info_vec_list; + int count = gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec_list, sv_info_list_cbq_size, + kGnssSvInfoListTimeout); + ASSERT_EQ(count, sv_info_list_cbq_size); + source_to_blocklist = + FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1); + } else { + std::list> sv_info_vec_list; + int count = aidl_gnss_cb_->sv_info_list_cbq_.retrieve( + sv_info_vec_list, sv_info_list_cbq_size, kGnssSvInfoListTimeout); + ASSERT_EQ(count, sv_info_list_cbq_size); + source_to_blocklist = + FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1); + } - if (source_to_blocklist.constellation == GnssConstellationTypeAidl::UNKNOWN) { + if (source_to_blocklist.constellation == GnssConstellationType::UNKNOWN) { // Cannot find a non-GPS satellite. Let the test pass. ALOGD("Cannot find a non-GPS satellite. Letting the test pass."); return; @@ -505,32 +679,53 @@ TEST_P(GnssHalTest, BlocklistIndividualSatellites) { ASSERT_TRUE(status.isOk()); // retry and ensure satellite not used - gnss_cb_->sv_info_list_cbq_.reset(); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + gnss_cb_->sv_info_list_cbq_.reset(); + gnss_cb_->location_cbq_.reset(); + } else { + aidl_gnss_cb_->sv_info_list_cbq_.reset(); + aidl_gnss_cb_->location_cbq_.reset(); + } - gnss_cb_->location_cbq_.reset(); StartAndCheckLocations(kLocationsToAwait); // early exit if test is being run with insufficient signal - location_called_count = gnss_cb_->location_cbq_.calledCount(); + location_called_count = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->location_cbq_.calledCount() + : aidl_gnss_cb_->location_cbq_.calledCount(); if (location_called_count == 0) { ALOGE("0 Gnss locations received - ensure sufficient signal and retry"); } ASSERT_TRUE(location_called_count > 0); // Tolerate 1 less sv status to handle edge cases in reporting. - sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size(); + sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->sv_info_list_cbq_.size() + : aidl_gnss_cb_->sv_info_list_cbq_.size(); EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)", sv_info_list_cbq_size, kLocationsToAwait, location_called_count); for (int i = 0; i < sv_info_list_cbq_size; ++i) { - hidl_vec sv_info_vec; - gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); - for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { - const auto& gnss_sv = sv_info_vec[iSv]; - EXPECT_FALSE((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) && - (static_cast(gnss_sv.v2_0.constellation) == - source_to_blocklist.constellation) && - (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + hidl_vec sv_info_vec; + gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + auto& gnss_sv = sv_info_vec[iSv]; + EXPECT_FALSE( + (gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) && + (static_cast(gnss_sv.v2_0.constellation) == + source_to_blocklist.constellation) && + (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + } + } else { + std::vector sv_info_vec; + aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + auto& gnss_sv = sv_info_vec[iSv]; + EXPECT_FALSE((gnss_sv.svid == source_to_blocklist.svid) && + (gnss_sv.constellation == source_to_blocklist.constellation) && + (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)); + } } } @@ -545,36 +740,59 @@ TEST_P(GnssHalTest, BlocklistIndividualSatellites) { int unblocklist_loops_remaining = kRetriesToUnBlocklist; while (!strongest_sv_is_reobserved && (unblocklist_loops_remaining-- > 0)) { StopAndClearLocations(); - gnss_cb_->sv_info_list_cbq_.reset(); - gnss_cb_->location_cbq_.reset(); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + gnss_cb_->sv_info_list_cbq_.reset(); + gnss_cb_->location_cbq_.reset(); + } else { + aidl_gnss_cb_->sv_info_list_cbq_.reset(); + aidl_gnss_cb_->location_cbq_.reset(); + } StartAndCheckLocations(kLocationsToAwait); // early exit loop if test is being run with insufficient signal - location_called_count = gnss_cb_->location_cbq_.calledCount(); + location_called_count = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->location_cbq_.calledCount() + : aidl_gnss_cb_->location_cbq_.calledCount(); if (location_called_count == 0) { ALOGE("0 Gnss locations received - ensure sufficient signal and retry"); } ASSERT_TRUE(location_called_count > 0); // Tolerate 1 less sv status to handle edge cases in reporting. - sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size(); + sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->sv_info_list_cbq_.size() + : aidl_gnss_cb_->sv_info_list_cbq_.size(); EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait); ALOGD("Clear blocklist, observed %d GnssSvInfo, while awaiting %d Locations" ", tries remaining %d", sv_info_list_cbq_size, kLocationsToAwait, unblocklist_loops_remaining); for (int i = 0; i < sv_info_list_cbq_size; ++i) { - hidl_vec sv_info_vec; - gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); - for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { - const auto& gnss_sv = sv_info_vec[iSv]; - if ((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) && - (static_cast(gnss_sv.v2_0.constellation) == - source_to_blocklist.constellation) && - (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) { - strongest_sv_is_reobserved = true; - break; + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + hidl_vec sv_info_vec; + gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + auto& gnss_sv = sv_info_vec[iSv]; + if ((gnss_sv.v2_0.v1_0.svid == source_to_blocklist.svid) && + (static_cast(gnss_sv.v2_0.constellation) == + source_to_blocklist.constellation) && + (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)) { + strongest_sv_is_reobserved = true; + break; + } + } + } else { + std::vector sv_info_vec; + aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + auto& gnss_sv = sv_info_vec[iSv]; + if ((gnss_sv.svid == source_to_blocklist.svid) && + (gnss_sv.constellation == source_to_blocklist.constellation) && + (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)) { + strongest_sv_is_reobserved = true; + break; + } } } if (strongest_sv_is_reobserved) break; @@ -606,7 +824,7 @@ TEST_P(GnssHalTest, BlocklistConstellationLocationOff) { const int kGnssSvInfoListTimeout = 2; // Find first non-GPS constellation to blocklist - GnssConstellationTypeAidl constellation_to_blocklist = static_cast( + GnssConstellationType constellation_to_blocklist = static_cast( startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout)); // Turns off location @@ -619,7 +837,7 @@ TEST_P(GnssHalTest, BlocklistConstellationLocationOff) { // IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is // supported. BlocklistedSource source_to_blocklist_2; - source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS; + source_to_blocklist_2.constellation = GnssConstellationType::IRNSS; source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation sp gnss_configuration_hal; @@ -636,27 +854,47 @@ TEST_P(GnssHalTest, BlocklistConstellationLocationOff) { ASSERT_TRUE(status.isOk()); // retry and ensure constellation not used - gnss_cb_->sv_info_list_cbq_.reset(); - - gnss_cb_->location_cbq_.reset(); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + gnss_cb_->sv_info_list_cbq_.reset(); + gnss_cb_->location_cbq_.reset(); + } else { + aidl_gnss_cb_->sv_info_list_cbq_.reset(); + aidl_gnss_cb_->location_cbq_.reset(); + } StartAndCheckLocations(kLocationsToAwait); // Tolerate 1 less sv status to handle edge cases in reporting. - int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size(); + int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->sv_info_list_cbq_.size() + : aidl_gnss_cb_->sv_info_list_cbq_.size(); EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations", sv_info_list_cbq_size, kLocationsToAwait); for (int i = 0; i < sv_info_list_cbq_size; ++i) { - hidl_vec sv_info_vec; - gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); - for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { - const auto& gnss_sv = sv_info_vec[iSv]; - EXPECT_FALSE((static_cast(gnss_sv.v2_0.constellation) == - source_to_blocklist_1.constellation) && - (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); - EXPECT_FALSE((static_cast(gnss_sv.v2_0.constellation) == - source_to_blocklist_2.constellation) && - (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + hidl_vec sv_info_vec; + gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + const auto& gnss_sv = sv_info_vec[iSv]; + EXPECT_FALSE( + (static_cast(gnss_sv.v2_0.constellation) == + source_to_blocklist_1.constellation) && + (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + EXPECT_FALSE( + (static_cast(gnss_sv.v2_0.constellation) == + source_to_blocklist_2.constellation) && + (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + } + } else { + std::vector sv_info_vec; + aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + const auto& gnss_sv = sv_info_vec[iSv]; + EXPECT_FALSE((gnss_sv.constellation == source_to_blocklist_1.constellation) && + (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)); + EXPECT_FALSE((gnss_sv.constellation == source_to_blocklist_2.constellation) && + (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)); + } } } @@ -689,7 +927,7 @@ TEST_P(GnssHalTest, BlocklistConstellationLocationOn) { const int kGnssSvInfoListTimeout = 2; // Find first non-GPS constellation to blocklist - GnssConstellationTypeAidl constellation_to_blocklist = static_cast( + GnssConstellationType constellation_to_blocklist = static_cast( startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout)); BlocklistedSource source_to_blocklist_1; @@ -699,7 +937,7 @@ TEST_P(GnssHalTest, BlocklistConstellationLocationOn) { // IRNSS was added in 2.0. Always attempt to blocklist IRNSS to verify that the new enum is // supported. BlocklistedSource source_to_blocklist_2; - source_to_blocklist_2.constellation = GnssConstellationTypeAidl::IRNSS; + source_to_blocklist_2.constellation = GnssConstellationType::IRNSS; source_to_blocklist_2.svid = 0; // documented wildcard for all satellites in this constellation sp gnss_configuration_hal; @@ -719,27 +957,47 @@ TEST_P(GnssHalTest, BlocklistConstellationLocationOn) { StopAndClearLocations(); // retry and ensure constellation not used - gnss_cb_->sv_info_list_cbq_.reset(); - - gnss_cb_->location_cbq_.reset(); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + gnss_cb_->sv_info_list_cbq_.reset(); + gnss_cb_->location_cbq_.reset(); + } else { + aidl_gnss_cb_->sv_info_list_cbq_.reset(); + aidl_gnss_cb_->location_cbq_.reset(); + } StartAndCheckLocations(kLocationsToAwait); // Tolerate 1 less sv status to handle edge cases in reporting. - int sv_info_list_cbq_size = gnss_cb_->sv_info_list_cbq_.size(); + int sv_info_list_cbq_size = (aidl_gnss_hal_->getInterfaceVersion() <= 1) + ? gnss_cb_->sv_info_list_cbq_.size() + : aidl_gnss_cb_->sv_info_list_cbq_.size(); EXPECT_GE(sv_info_list_cbq_size + 1, kLocationsToAwait); ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations", sv_info_list_cbq_size, kLocationsToAwait); for (int i = 0; i < sv_info_list_cbq_size; ++i) { - hidl_vec sv_info_vec; - gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); - for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { - const auto& gnss_sv = sv_info_vec[iSv]; - EXPECT_FALSE((static_cast(gnss_sv.v2_0.constellation) == - source_to_blocklist_1.constellation) && - (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); - EXPECT_FALSE((static_cast(gnss_sv.v2_0.constellation) == - source_to_blocklist_2.constellation) && - (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + hidl_vec sv_info_vec; + gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + const auto& gnss_sv = sv_info_vec[iSv]; + EXPECT_FALSE( + (static_cast(gnss_sv.v2_0.constellation) == + source_to_blocklist_1.constellation) && + (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + EXPECT_FALSE( + (static_cast(gnss_sv.v2_0.constellation) == + source_to_blocklist_2.constellation) && + (gnss_sv.v2_0.v1_0.svFlag & IGnssCallback_1_0::GnssSvFlags::USED_IN_FIX)); + } + } else { + std::vector sv_info_vec; + aidl_gnss_cb_->sv_info_list_cbq_.retrieve(sv_info_vec, kGnssSvInfoListTimeout); + for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) { + const auto& gnss_sv = sv_info_vec[iSv]; + EXPECT_FALSE((gnss_sv.constellation == source_to_blocklist_1.constellation) && + (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)); + EXPECT_FALSE((gnss_sv.constellation == source_to_blocklist_2.constellation) && + (gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX)); + } } } @@ -749,3 +1007,490 @@ TEST_P(GnssHalTest, BlocklistConstellationLocationOn) { status = gnss_configuration_hal->setBlocklist(sources); ASSERT_TRUE(status.isOk()); } + +/* + * TestAllExtensions. + */ +TEST_P(GnssHalTest, TestAllExtensions) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + + sp iGnssBatching; + auto status = aidl_gnss_hal_->getExtensionGnssBatching(&iGnssBatching); + if (status.isOk() && iGnssBatching != nullptr) { + auto gnssBatchingCallback = sp::make(); + status = iGnssBatching->init(gnssBatchingCallback); + ASSERT_TRUE(status.isOk()); + + status = iGnssBatching->cleanup(); + ASSERT_TRUE(status.isOk()); + } + + sp iGnssGeofence; + status = aidl_gnss_hal_->getExtensionGnssGeofence(&iGnssGeofence); + if (status.isOk() && iGnssGeofence != nullptr) { + auto gnssGeofenceCallback = sp::make(); + status = iGnssGeofence->setCallback(gnssGeofenceCallback); + ASSERT_TRUE(status.isOk()); + } + + sp iGnssNavMsgIface; + status = aidl_gnss_hal_->getExtensionGnssNavigationMessage(&iGnssNavMsgIface); + if (status.isOk() && iGnssNavMsgIface != nullptr) { + auto gnssNavMsgCallback = sp::make(); + status = iGnssNavMsgIface->setCallback(gnssNavMsgCallback); + ASSERT_TRUE(status.isOk()); + + status = iGnssNavMsgIface->close(); + ASSERT_TRUE(status.isOk()); + } +} + +/* + * TestAGnssExtension: + * 1. Gets the IAGnss extension. + * 2. Sets AGnssCallback. + * 3. Sets SUPL server host/port. + */ +TEST_P(GnssHalTest, TestAGnssExtension) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + sp iAGnss; + auto status = aidl_gnss_hal_->getExtensionAGnss(&iAGnss); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iAGnss != nullptr); + + auto agnssCallback = sp::make(); + status = iAGnss->setCallback(agnssCallback); + ASSERT_TRUE(status.isOk()); + + // Set SUPL server host/port + status = iAGnss->setServer(AGnssType::SUPL, std::string("supl.google.com"), 7275); + ASSERT_TRUE(status.isOk()); +} + +/* + * TestAGnssRilExtension: + * 1. Gets the IAGnssRil extension. + * 2. Sets AGnssRilCallback. + * 3. Update network state to connected and then disconnected. + * 4. Sets reference location. + */ +TEST_P(GnssHalTest, TestAGnssRilExtension) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + sp iAGnssRil; + auto status = aidl_gnss_hal_->getExtensionAGnssRil(&iAGnssRil); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iAGnssRil != nullptr); + + auto agnssRilCallback = sp::make(); + status = iAGnssRil->setCallback(agnssRilCallback); + ASSERT_TRUE(status.isOk()); + + // Update GNSS HAL that a network has connected. + IAGnssRil::NetworkAttributes networkAttributes; + networkAttributes.networkHandle = 7700664333L; + networkAttributes.isConnected = true; + networkAttributes.capabilities = IAGnssRil::NETWORK_CAPABILITY_NOT_ROAMING; + networkAttributes.apn = "placeholder-apn"; + status = iAGnssRil->updateNetworkState(networkAttributes); + ASSERT_TRUE(status.isOk()); + + // Update GNSS HAL that network has disconnected. + networkAttributes.isConnected = false; + status = iAGnssRil->updateNetworkState(networkAttributes); + ASSERT_TRUE(status.isOk()); + + // Set RefLocation + IAGnssRil::AGnssRefLocationCellID agnssReflocationCellId; + agnssReflocationCellId.type = IAGnssRil::AGnssRefLocationType::LTE_CELLID; + agnssReflocationCellId.mcc = 466; + agnssReflocationCellId.mnc = 97; + agnssReflocationCellId.lac = 46697; + agnssReflocationCellId.cid = 59168142; + agnssReflocationCellId.pcid = 420; + agnssReflocationCellId.tac = 11460; + IAGnssRil::AGnssRefLocation agnssReflocation; + agnssReflocation.type = IAGnssRil::AGnssRefLocationType::LTE_CELLID; + agnssReflocation.cellID = agnssReflocationCellId; + + status = iAGnssRil->setRefLocation(agnssReflocation); + ASSERT_TRUE(status.isOk()); +} + +/* + * GnssDebugValuesSanityTest: + * Ensures that GnssDebug values make sense. + */ +TEST_P(GnssHalTest, GnssDebugValuesSanityTest) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + sp iGnssDebug; + auto status = aidl_gnss_hal_->getExtensionGnssDebug(&iGnssDebug); + ASSERT_TRUE(status.isOk()); + + if (!IsAutomotiveDevice()) { + ASSERT_TRUE(iGnssDebug != nullptr); + + IGnssDebug::DebugData data; + auto status = iGnssDebug->getDebugData(&data); + ASSERT_TRUE(status.isOk()); + + if (data.position.valid) { + ASSERT_TRUE(data.position.latitudeDegrees >= -90 && + data.position.latitudeDegrees <= 90); + ASSERT_TRUE(data.position.longitudeDegrees >= -180 && + data.position.longitudeDegrees <= 180); + ASSERT_TRUE(data.position.altitudeMeters >= -1000 && // Dead Sea: -414m + data.position.altitudeMeters <= 20000); // Mount Everest: 8850m + ASSERT_TRUE(data.position.speedMetersPerSec >= 0 && + data.position.speedMetersPerSec <= 600); + ASSERT_TRUE(data.position.bearingDegrees >= -360 && + data.position.bearingDegrees <= 360); + ASSERT_TRUE(data.position.horizontalAccuracyMeters > 0 && + data.position.horizontalAccuracyMeters <= 20000000); + ASSERT_TRUE(data.position.verticalAccuracyMeters > 0 && + data.position.verticalAccuracyMeters <= 20000); + ASSERT_TRUE(data.position.speedAccuracyMetersPerSecond > 0 && + data.position.speedAccuracyMetersPerSecond <= 500); + ASSERT_TRUE(data.position.bearingAccuracyDegrees > 0 && + data.position.bearingAccuracyDegrees <= 180); + ASSERT_TRUE(data.position.ageSeconds >= 0); + } + ASSERT_TRUE(data.time.timeEstimateMs >= 1483228800000); // Jan 01 2017 00:00:00 GMT. + ASSERT_TRUE(data.time.timeUncertaintyNs > 0); + ASSERT_TRUE(data.time.frequencyUncertaintyNsPerSec > 0 && + data.time.frequencyUncertaintyNsPerSec <= 2.0e5); // 200 ppm + } +} + +/* + * TestGnssVisibilityControlExtension: + * 1. Gets the IGnssVisibilityControl extension. + * 2. Sets GnssVisibilityControlCallback + * 3. Sets proxy apps + */ +TEST_P(GnssHalTest, TestGnssVisibilityControlExtension) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + sp iGnssVisibilityControl; + auto status = aidl_gnss_hal_->getExtensionGnssVisibilityControl(&iGnssVisibilityControl); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssVisibilityControl != nullptr); + auto gnssVisibilityControlCallback = sp::make(); + status = iGnssVisibilityControl->setCallback(gnssVisibilityControlCallback); + ASSERT_TRUE(status.isOk()); + + std::vector proxyApps{std::string("com.example.ims"), + std::string("com.example.mdt")}; + status = iGnssVisibilityControl->enableNfwLocationAccess(proxyApps); + ASSERT_TRUE(status.isOk()); +} + +/* + * TestGnssAgcInGnssMeasurement: + * 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension. + * 2. Sets a GnssMeasurementCallback, waits for a measurement. + */ +TEST_P(GnssHalTest, TestGnssAgcInGnssMeasurement) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + const int kFirstGnssMeasurementTimeoutSeconds = 10; + const int kNumMeasurementEvents = 5; + + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + auto callback = sp::make(); + status = iGnssMeasurement->setCallback(callback, /* enableFullTracking= */ false, + /* enableCorrVecOutputs */ false); + ASSERT_TRUE(status.isOk()); + + for (int i = 0; i < kNumMeasurementEvents; i++) { + GnssData lastMeasurement; + ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement, + kFirstGnssMeasurementTimeoutSeconds)); + EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1); + ASSERT_TRUE(lastMeasurement.measurements.size() > 0); + + // Validity check GnssData fields + checkGnssMeasurementClockFields(lastMeasurement); + + ASSERT_TRUE(lastMeasurement.gnssAgcs.size() > 0); + for (const auto& gnssAgc : lastMeasurement.gnssAgcs) { + ASSERT_TRUE(gnssAgc.carrierFrequencyHz >= 0); + } + } + + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); +} + +/* + * TestGnssAntennaInfo: + * Sets a GnssAntennaInfoCallback, waits for report, and verifies + * 1. phaseCenterOffsetCoordinateMillimeters is valid + * 2. phaseCenterOffsetCoordinateUncertaintyMillimeters is valid. + * PhaseCenterVariationCorrections and SignalGainCorrections are optional. + */ +TEST_P(GnssHalTest, TestGnssAntennaInfo) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + + const int kAntennaInfoTimeoutSeconds = 2; + sp iGnssAntennaInfo; + auto status = aidl_gnss_hal_->getExtensionGnssAntennaInfo(&iGnssAntennaInfo); + ASSERT_TRUE(status.isOk()); + + if (!(aidl_gnss_cb_->last_capabilities_ & (int)GnssCallbackAidl::CAPABILITY_ANTENNA_INFO) || + iGnssAntennaInfo == nullptr) { + ALOGD("GnssAntennaInfo AIDL is not supported."); + return; + } + + auto callback = sp::make(); + status = iGnssAntennaInfo->setCallback(callback); + ASSERT_TRUE(status.isOk()); + + std::vector antennaInfos; + ASSERT_TRUE(callback->antenna_info_cbq_.retrieve(antennaInfos, kAntennaInfoTimeoutSeconds)); + EXPECT_EQ(callback->antenna_info_cbq_.calledCount(), 1); + ASSERT_TRUE(antennaInfos.size() > 0); + + for (auto antennaInfo : antennaInfos) { + // Remaining fields are optional + if (!antennaInfo.phaseCenterVariationCorrectionMillimeters.empty()) { + int numRows = antennaInfo.phaseCenterVariationCorrectionMillimeters.size(); + int numColumns = antennaInfo.phaseCenterVariationCorrectionMillimeters[0].row.size(); + // Must have at least 1 row and 2 columns + ASSERT_TRUE(numRows >= 1 && numColumns >= 2); + + // Corrections and uncertainties must have same dimensions + ASSERT_TRUE(antennaInfo.phaseCenterVariationCorrectionMillimeters.size() == + antennaInfo.phaseCenterVariationCorrectionUncertaintyMillimeters.size()); + ASSERT_TRUE( + antennaInfo.phaseCenterVariationCorrectionMillimeters[0].row.size() == + antennaInfo.phaseCenterVariationCorrectionUncertaintyMillimeters[0].row.size()); + + // Must be rectangular + for (auto row : antennaInfo.phaseCenterVariationCorrectionMillimeters) { + ASSERT_TRUE(row.row.size() == numColumns); + } + for (auto row : antennaInfo.phaseCenterVariationCorrectionUncertaintyMillimeters) { + ASSERT_TRUE(row.row.size() == numColumns); + } + } + if (!antennaInfo.signalGainCorrectionDbi.empty()) { + int numRows = antennaInfo.signalGainCorrectionDbi.size(); + int numColumns = antennaInfo.signalGainCorrectionUncertaintyDbi[0].row.size(); + // Must have at least 1 row and 2 columns + ASSERT_TRUE(numRows >= 1 && numColumns >= 2); + + // Corrections and uncertainties must have same dimensions + ASSERT_TRUE(antennaInfo.signalGainCorrectionDbi.size() == + antennaInfo.signalGainCorrectionUncertaintyDbi.size()); + ASSERT_TRUE(antennaInfo.signalGainCorrectionDbi[0].row.size() == + antennaInfo.signalGainCorrectionUncertaintyDbi[0].row.size()); + + // Must be rectangular + for (auto row : antennaInfo.signalGainCorrectionDbi) { + ASSERT_TRUE(row.row.size() == numColumns); + } + for (auto row : antennaInfo.signalGainCorrectionUncertaintyDbi) { + ASSERT_TRUE(row.row.size() == numColumns); + } + } + } + + iGnssAntennaInfo->close(); +} + +/* + * TestGnssMeasurementCorrections: + * If measurement corrections capability is supported, verifies that the measurement corrections + * capabilities are reported and the mandatory LOS_SATS or the EXCESS_PATH_LENGTH + * capability flag is set. + */ +TEST_P(GnssHalTest, TestGnssMeasurementCorrections) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + if (!(aidl_gnss_cb_->last_capabilities_ & + (int)GnssCallbackAidl::CAPABILITY_MEASUREMENT_CORRECTIONS)) { + return; + } + + sp iMeasurementCorrectionsAidl; + auto status = aidl_gnss_hal_->getExtensionMeasurementCorrections(&iMeasurementCorrectionsAidl); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iMeasurementCorrectionsAidl != nullptr); + + // Setup measurement corrections callback. + auto gnssMeasurementCorrectionsCallback = sp::make(); + status = iMeasurementCorrectionsAidl->setCallback(gnssMeasurementCorrectionsCallback); + ASSERT_TRUE(status.isOk()); + + const int kTimeoutSec = 5; + EXPECT_TRUE(gnssMeasurementCorrectionsCallback->capabilities_cbq_.retrieve( + gnssMeasurementCorrectionsCallback->last_capabilities_, kTimeoutSec)); + ASSERT_TRUE(gnssMeasurementCorrectionsCallback->capabilities_cbq_.calledCount() > 0); + + ASSERT_TRUE((gnssMeasurementCorrectionsCallback->last_capabilities_ & + (MeasurementCorrectionsCallback::CAPABILITY_LOS_SATS | + MeasurementCorrectionsCallback::CAPABILITY_EXCESS_PATH_LENGTH)) != 0); + + // Set a mock MeasurementCorrections. + status = iMeasurementCorrectionsAidl->setCorrections( + Utils::getMockMeasurementCorrections_aidl()); + ASSERT_TRUE(status.isOk()); +} + +/* + * TestStopSvStatusAndNmea: + * 1. Call stopSvStatus and stopNmea. + * 2. Start location and verify that + * - no SvStatus is received. + * - no Nmea is received. + */ +TEST_P(GnssHalTest, TestStopSvStatusAndNmea) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + auto status = aidl_gnss_hal_->stopSvStatus(); + EXPECT_TRUE(status.isOk()); + status = aidl_gnss_hal_->stopNmea(); + EXPECT_TRUE(status.isOk()); + + int kLocationsToAwait = 5; + aidl_gnss_cb_->location_cbq_.reset(); + aidl_gnss_cb_->sv_info_list_cbq_.reset(); + aidl_gnss_cb_->nmea_cbq_.reset(); + StartAndCheckLocations(/* count= */ kLocationsToAwait, + /* start_sv_status= */ false, /* start_nmea= */ false); + int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount(); + ALOGD("Observed %d GnssSvStatus, and %d Nmea while awaiting %d locations (%d received)", + aidl_gnss_cb_->sv_info_list_cbq_.size(), aidl_gnss_cb_->nmea_cbq_.size(), + kLocationsToAwait, location_called_count); + + // Ensure that no SvStatus & no Nmea is received. + EXPECT_EQ(aidl_gnss_cb_->sv_info_list_cbq_.size(), 0); + EXPECT_EQ(aidl_gnss_cb_->nmea_cbq_.size(), 0); + + StopAndClearLocations(); +} + +/* + * TestGnssMeasurementIntervals_WithoutLocation: + * 1. start measurement with interval + * 2. verify that the received measurement intervals have expected mean and stdev + */ +TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + + std::vector intervals({2000, 4000}); + std::vector numEvents({10, 5}); + + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + ALOGD("TestGnssMeasurementIntervals_WithoutLocation"); + for (int i = 0; i < intervals.size(); i++) { + auto callback = sp::make(); + startMeasurementWithInterval(intervals[i], iGnssMeasurement, callback); + + std::vector deltas; + collectMeasurementIntervals(callback, numEvents[i], /* timeoutSeconds= */ 10, deltas); + + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); + + assertMeanAndStdev(intervals[i], deltas); + } +} + +/* + * TestGnssMeasurementIntervals_LocationOnBeforeMeasurement: + * 1. start measurement with interval + * 2. verify that the received measurement intervals have expected mean and stdev + */ +TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnBeforeMeasurement) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + + std::vector intervals({2000}); + + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + int locationIntervalMs = 1000; + + // Start location first and then start measurement + ALOGD("TestGnssMeasurementIntervals_LocationOnBeforeMeasurement"); + StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false); + for (auto& intervalMs : intervals) { + auto callback = sp::make(); + startMeasurementWithInterval(intervalMs, iGnssMeasurement, callback); + + std::vector deltas; + collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, deltas); + + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); + + assertMeanAndStdev(locationIntervalMs, deltas); + } + StopAndClearLocations(); +} + +/* + * TestGnssMeasurementIntervals: + * 1. start measurement with interval + * 2. verify that the received measurement intervals have expected mean and stdev + */ +TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { + return; + } + + std::vector intervals({2000}); + + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + int locationIntervalMs = 1000; + // Start location first and then start measurement + ALOGD("TestGnssMeasurementIntervals_LocationOnAfterMeasurement"); + for (auto& intervalMs : intervals) { + auto callback = sp::make(); + startMeasurementWithInterval(intervalMs, iGnssMeasurement, callback); + + StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false); + std::vector deltas; + collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, deltas); + + StopAndClearLocations(); + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); + + assertMeanAndStdev(locationIntervalMs, deltas); + } +} diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp index dda8a441e3e8d6f1db91d36f6e9aeccf8e754b30..b896f04ddf920b936160416dc1114ca94c6b3c3d 100644 --- a/gnss/common/utils/default/Android.bp +++ b/gnss/common/utils/default/Android.bp @@ -57,6 +57,6 @@ cc_library_static { "android.hardware.gnss@2.1", "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.measurement_corrections@1.0", - "android.hardware.gnss-V1-ndk", + "android.hardware.gnss-V2-ndk", ], } diff --git a/gnss/common/utils/default/FixLocationParser.cpp b/gnss/common/utils/default/FixLocationParser.cpp index f0177b49c5c4e571cb2a082ac1ee5b2fb8ffe232..f391d96616091a62b552a1dac15b723f13eab9f8 100644 --- a/gnss/common/utils/default/FixLocationParser.cpp +++ b/gnss/common/utils/default/FixLocationParser.cpp @@ -16,14 +16,15 @@ #include "FixLocationParser.h" -#include - namespace android { namespace hardware { namespace gnss { namespace common { -std::unique_ptr FixLocationParser::getLocationFromInputStr( +using aidl::android::hardware::gnss::ElapsedRealtime; +using aidl::android::hardware::gnss::GnssLocation; + +std::unique_ptr FixLocationParser::getLocationFromInputStr( const std::string& locationStr) { /* * Fix,Provider,LatitudeDegrees,LongitudeDegrees,AltitudeMeters,SpeedMps, @@ -44,33 +45,31 @@ std::unique_ptr FixLocationParser::getLocationFromInputStr( if (locationValues.size() < 12) { return nullptr; } - V2_0::ElapsedRealtime elapsedRealtime = { - .flags = V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS | - V2_0::ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS, - .timestampNs = static_cast(::android::elapsedRealtimeNano()), + ElapsedRealtime elapsedRealtime = { + .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS, + .timestampNs = ::android::elapsedRealtimeNano(), // This is an hardcoded value indicating a 1ms of uncertainty between the two clocks. // In an actual implementation provide an estimate of the synchronization uncertainty // or don't set the field. .timeUncertaintyNs = 1020400}; - V1_0::GnssLocation locationV1 = { + GnssLocation location = { .gnssLocationFlags = 0xFF, .latitudeDegrees = ParseUtils::tryParseDouble(locationValues[2], 0), .longitudeDegrees = ParseUtils::tryParseDouble(locationValues[3], 0), .altitudeMeters = ParseUtils::tryParseDouble(locationValues[4], 0), - .speedMetersPerSec = ParseUtils::tryParsefloat(locationValues[5], 0), - .bearingDegrees = ParseUtils::tryParsefloat(locationValues[7], 0), - .horizontalAccuracyMeters = ParseUtils::tryParsefloat(locationValues[6], 0), - .verticalAccuracyMeters = ParseUtils::tryParsefloat(locationValues[6], 0), - .speedAccuracyMetersPerSecond = ParseUtils::tryParsefloat(locationValues[9], 0), - .bearingAccuracyDegrees = ParseUtils::tryParsefloat(locationValues[10], 0), - .timestamp = ParseUtils::tryParseLongLong(locationValues[8], 0)}; - - V2_0::GnssLocation locationV2 = {.v1_0 = locationV1, .elapsedRealtime = elapsedRealtime}; - return std::make_unique(locationV2); + .speedMetersPerSec = ParseUtils::tryParseDouble(locationValues[5], 0), + .bearingDegrees = ParseUtils::tryParseDouble(locationValues[7], 0), + .horizontalAccuracyMeters = ParseUtils::tryParseDouble(locationValues[6], 0), + .verticalAccuracyMeters = ParseUtils::tryParseDouble(locationValues[6], 0), + .speedAccuracyMetersPerSecond = ParseUtils::tryParseDouble(locationValues[9], 0), + .bearingAccuracyDegrees = ParseUtils::tryParseDouble(locationValues[10], 0), + .timestampMillis = ParseUtils::tryParseLongLong(locationValues[8], 0), + .elapsedRealtime = elapsedRealtime}; + return std::make_unique(location); } } // namespace common } // namespace gnss } // namespace hardware -} // namespace android +} // namespace android \ No newline at end of file diff --git a/gnss/common/utils/default/GnssReplayUtils.cpp b/gnss/common/utils/default/GnssReplayUtils.cpp index d6769bdacc9b1a5131fdb6e2af59ff3fcfb5d663..6caf313a040abbdd65e2f39c8bfdbcafd83ca992 100644 --- a/gnss/common/utils/default/GnssReplayUtils.cpp +++ b/gnss/common/utils/default/GnssReplayUtils.cpp @@ -72,7 +72,7 @@ bool ReplayUtils::isGnssRawMeasurement(const std::string& inputStr) { bool ReplayUtils::isNMEA(const std::string& inputStr) { return !inputStr.empty() && (inputStr.find("$GPRMC,", 0) != std::string::npos || - inputStr.find("$GPRMA,", 0) != std::string::npos); + inputStr.find("$GPGGA,", 0) != std::string::npos); } } // namespace common diff --git a/gnss/common/utils/default/NmeaFixInfo.cpp b/gnss/common/utils/default/NmeaFixInfo.cpp index c7ee13488b3af7938922ccba4e3c9c65444f35a0..22aef90204a6da63c6cfa409a9beff4e11472df5 100644 --- a/gnss/common/utils/default/NmeaFixInfo.cpp +++ b/gnss/common/utils/default/NmeaFixInfo.cpp @@ -34,6 +34,9 @@ namespace hardware { namespace gnss { namespace common { +using aidl::android::hardware::gnss::ElapsedRealtime; +using aidl::android::hardware::gnss::GnssLocation; + NmeaFixInfo::NmeaFixInfo() : hasGMCRecord(false), hasGGARecord(false) {} float NmeaFixInfo::getAltitudeMeters() const { @@ -236,6 +239,40 @@ std::unique_ptr NmeaFixInfo::getLocationFromInputStr( return nmeaFixInfo.toGnssLocation(); } +/** + * Convert V2_0::GnssLocation to aidl::GnssLocation. + */ +std::unique_ptr NmeaFixInfo::getAidlLocationFromInputStr( + const std::string& inputStr) { + std::unique_ptr locationV2 = getLocationFromInputStr(inputStr); + if (locationV2 == nullptr) { + return nullptr; + } + + ElapsedRealtime elapsedRealtime = { + .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS, + .timestampNs = ::android::elapsedRealtimeNano(), + // This is an hardcoded value indicating a 1ms of uncertainty between the two clocks. + // In an actual implementation provide an estimate of the synchronization uncertainty + // or don't set the field. + .timeUncertaintyNs = 1020400}; + + GnssLocation location = { + .gnssLocationFlags = locationV2->v1_0.gnssLocationFlags, + .latitudeDegrees = locationV2->v1_0.latitudeDegrees, + .longitudeDegrees = locationV2->v1_0.longitudeDegrees, + .altitudeMeters = locationV2->v1_0.altitudeMeters, + .speedMetersPerSec = locationV2->v1_0.speedMetersPerSec, + .bearingDegrees = locationV2->v1_0.bearingDegrees, + .horizontalAccuracyMeters = locationV2->v1_0.horizontalAccuracyMeters, + .verticalAccuracyMeters = locationV2->v1_0.verticalAccuracyMeters, + .speedAccuracyMetersPerSecond = locationV2->v1_0.speedAccuracyMetersPerSecond, + .bearingAccuracyDegrees = locationV2->v1_0.bearingAccuracyDegrees, + .timestampMillis = locationV2->v1_0.timestamp, + .elapsedRealtime = elapsedRealtime}; + return std::make_unique(location); +} + /** * Parses the input string in NMEA format and convert to GnssLocation. */ diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp index 23e39b26ec59884c5c5f00cdfb9998d45047079e..4de49f376c4791a7e8b3daca158d225d07df4b61 100644 --- a/gnss/common/utils/default/Utils.cpp +++ b/gnss/common/utils/default/Utils.cpp @@ -27,13 +27,19 @@ namespace common { using aidl::android::hardware::gnss::ElapsedRealtime; using aidl::android::hardware::gnss::GnssClock; +using aidl::android::hardware::gnss::GnssConstellationType; using aidl::android::hardware::gnss::GnssData; +using aidl::android::hardware::gnss::GnssLocation; using aidl::android::hardware::gnss::GnssMeasurement; using aidl::android::hardware::gnss::IGnss; +using aidl::android::hardware::gnss::IGnssDebug; using aidl::android::hardware::gnss::IGnssMeasurementCallback; using aidl::android::hardware::gnss::SatellitePvt; +using GnssSvInfo = aidl::android::hardware::gnss::IGnssCallback::GnssSvInfo; +using GnssSvFlags = aidl::android::hardware::gnss::IGnssCallback::GnssSvFlags; -using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags; +using GnssSvFlagsV1_0 = V1_0::IGnssCallback::GnssSvFlags; +using GnssAgc = aidl::android::hardware::gnss::GnssData::GnssAgc; using GnssMeasurementFlagsV1_0 = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags; using GnssMeasurementFlagsV2_1 = V2_1::IGnssMeasurementCallback::GnssMeasurementFlags; using GnssMeasurementStateV2_0 = V2_0::IGnssMeasurementCallback::GnssMeasurementState; @@ -143,7 +149,7 @@ GnssDataV2_0 Utils::getMockMeasurementV2_0() { GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { aidl::android::hardware::gnss::GnssSignalType signalType = { - .constellation = aidl::android::hardware::gnss::GnssConstellationType::GLONASS, + .constellation = GnssConstellationType::GLONASS, .carrierFrequencyHz = 1.59975e+09, .codeType = aidl::android::hardware::gnss::GnssSignalType::CODE_TYPE_C, }; @@ -176,33 +182,43 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { .fullInterSignalBiasUncertaintyNs = 792.0, .satelliteInterSignalBiasNs = 233.9, .satelliteInterSignalBiasUncertaintyNs = 921.2, - .satellitePvt = {.flags = SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO | - SatellitePvt::HAS_IONO | SatellitePvt::HAS_TROPO, - .satPosEcef = {.posXMeters = 10442993.1153328, - .posYMeters = -19926932.8051666, - .posZMeters = -12034295.0216203, - .ureMeters = 1000.2345678}, - .satVelEcef = {.velXMps = -478.667183715732, - .velYMps = 1580.68371984114, - .velZMps = -3030.52994449997, - .ureRateMps = 10.2345678}, - .satClockInfo = {.satHardwareCodeBiasMeters = 1.396983861923e-09, - .satTimeCorrectionMeters = -7113.08964331, - .satClkDriftMps = 0}, - .ionoDelayMeters = 3.069949602639317e-08, - .tropoDelayMeters = 3.882265204404031}, + .satellitePvt = + { + .flags = SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO | + SatellitePvt::HAS_IONO | SatellitePvt::HAS_TROPO, + .satPosEcef = {.posXMeters = 10442993.1153328, + .posYMeters = -19926932.8051666, + .posZMeters = -12034295.0216203, + .ureMeters = 1000.2345678}, + .satVelEcef = {.velXMps = -478.667183715732, + .velYMps = 1580.68371984114, + .velZMps = -3030.52994449997, + .ureRateMps = 10.2345678}, + .satClockInfo = {.satHardwareCodeBiasMeters = 1.396983861923e-09, + .satTimeCorrectionMeters = -7113.08964331, + .satClkDriftMps = 0}, + .ionoDelayMeters = 3.069949602639317e-08, + .tropoDelayMeters = 3.882265204404031, + .ephemerisSource = + SatellitePvt::SatelliteEphemerisSource::SERVER_LONG_TERM, + .timeOfClockSeconds = 12345, + .issueOfDataClock = 143, + .timeOfEphemerisSeconds = 9876, + .issueOfDataEphemeris = 48, + }, .correlationVectors = {}}; GnssClock clock = {.gnssClockFlags = GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS | GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT | GnssClock::HAS_DRIFT_UNCERTAINTY, - .timeNs = 35854545000000, - .fullBiasNs = -234621900521857520, - .biasNs = 0.2352389998626708984, - .biasUncertaintyNs = 274.989972114563, - .driftNsps = -124.3742360, - .driftUncertaintyNsps = 239.6234285828, - .hwClockDiscontinuityCount = 999}; + .timeNs = 2713545000000, + .fullBiasNs = -1226701900521857520, + .biasNs = 0.59689998626708984, + .biasUncertaintyNs = 47514.989972114563, + .driftNsps = -51.757811607455452, + .driftUncertaintyNsps = 310.64968328491528, + .hwClockDiscontinuityCount = 1, + .referenceSignalTypeForIsb = signalType}; ElapsedRealtime timestamp = { .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS, @@ -227,11 +243,49 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { measurement.flags |= GnssMeasurement::HAS_CORRELATION_VECTOR; } - GnssData gnssData = { - .measurements = {measurement}, .clock = clock, .elapsedRealtime = timestamp}; + GnssAgc gnssAgc1 = { + .agcLevelDb = 3.5, + .constellation = GnssConstellationType::GLONASS, + .carrierFrequencyHz = (int64_t)kGloG1FreqHz, + }; + + GnssAgc gnssAgc2 = { + .agcLevelDb = -5.1, + .constellation = GnssConstellationType::GPS, + .carrierFrequencyHz = (int64_t)kGpsL1FreqHz, + }; + + GnssData gnssData = {.measurements = {measurement}, + .clock = clock, + .elapsedRealtime = timestamp, + .gnssAgcs = std::vector({gnssAgc1, gnssAgc2})}; return gnssData; } +GnssLocation Utils::getMockLocation() { + ElapsedRealtime elapsedRealtime = { + .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS, + .timestampNs = ::android::elapsedRealtimeNano(), + // This is an hardcoded value indicating a 1ms of uncertainty between the two clocks. + // In an actual implementation provide an estimate of the synchronization uncertainty + // or don't set the field. + .timeUncertaintyNs = 1020400}; + GnssLocation location = {.gnssLocationFlags = 0xFF, + .latitudeDegrees = gMockLatitudeDegrees, + .longitudeDegrees = gMockLongitudeDegrees, + .altitudeMeters = gMockAltitudeMeters, + .speedMetersPerSec = gMockSpeedMetersPerSec, + .bearingDegrees = gMockBearingDegrees, + .horizontalAccuracyMeters = kMockHorizontalAccuracyMeters, + .verticalAccuracyMeters = kMockVerticalAccuracyMeters, + .speedAccuracyMetersPerSecond = kMockSpeedAccuracyMetersPerSecond, + .bearingAccuracyDegrees = kMockBearingAccuracyDegrees, + .timestampMillis = static_cast( + kMockTimestamp + ::android::elapsedRealtimeNano() / 1e6), + .elapsedRealtime = elapsedRealtime}; + return location; +} + V2_0::GnssLocation Utils::getMockLocationV2_0() { const V2_0::ElapsedRealtime timestamp = { .flags = V2_0::ElapsedRealtimeFlags::HAS_TIMESTAMP_NS | @@ -264,6 +318,40 @@ V1_0::GnssLocation Utils::getMockLocationV1_0() { return location; } +namespace { +GnssSvInfo getMockSvInfo(int svid, GnssConstellationType type, float cN0DbHz, float basebandCN0DbHz, + float elevationDegrees, float azimuthDegrees, long carrierFrequencyHz) { + GnssSvInfo svInfo = { + .svid = svid, + .constellation = type, + .cN0Dbhz = cN0DbHz, + .basebandCN0DbHz = basebandCN0DbHz, + .elevationDegrees = elevationDegrees, + .azimuthDegrees = azimuthDegrees, + .carrierFrequencyHz = carrierFrequencyHz, + .svFlag = (int)GnssSvFlags::USED_IN_FIX | (int)GnssSvFlags::HAS_EPHEMERIS_DATA | + (int)GnssSvFlags::HAS_ALMANAC_DATA | (int)GnssSvFlags::HAS_CARRIER_FREQUENCY}; + return svInfo; +} +} // anonymous namespace + +std::vector Utils::getMockSvInfoList() { + std::vector gnssSvInfoList = { + getMockSvInfo(3, GnssConstellationType::GPS, 32.5, 27.5, 59.1, 166.5, kGpsL1FreqHz), + getMockSvInfo(5, GnssConstellationType::GPS, 27.0, 22.0, 29.0, 56.5, kGpsL1FreqHz), + getMockSvInfo(17, GnssConstellationType::GPS, 30.5, 25.5, 71.0, 77.0, kGpsL5FreqHz), + getMockSvInfo(26, GnssConstellationType::GPS, 24.1, 19.1, 28.0, 253.0, kGpsL5FreqHz), + getMockSvInfo(5, GnssConstellationType::GLONASS, 20.5, 15.5, 11.5, 116.0, kGloG1FreqHz), + getMockSvInfo(17, GnssConstellationType::GLONASS, 21.5, 16.5, 28.5, 186.0, + kGloG1FreqHz), + getMockSvInfo(18, GnssConstellationType::GLONASS, 28.3, 25.3, 38.8, 69.0, kGloG1FreqHz), + getMockSvInfo(10, GnssConstellationType::GLONASS, 25.0, 20.0, 66.0, 247.0, + kGloG1FreqHz), + getMockSvInfo(3, GnssConstellationType::IRNSS, 22.0, 19.7, 35.0, 112.0, kIrnssL5FreqHz), + }; + return gnssSvInfoList; +} + hidl_vec Utils::getMockSvInfoListV2_1() { GnssSvInfoV1_0 gnssSvInfoV1_0 = Utils::getMockSvInfoV1_0(3, V1_0::GnssConstellationType::GPS, 32.5, 59.1, 166.5, kGpsL1FreqHz); @@ -335,15 +423,15 @@ GnssSvInfoV2_0 Utils::getMockSvInfoV2_0(GnssSvInfoV1_0 gnssSvInfoV1_0, GnssSvInfoV1_0 Utils::getMockSvInfoV1_0(int16_t svid, V1_0::GnssConstellationType type, float cN0DbHz, float elevationDegrees, float azimuthDegrees, float carrierFrequencyHz) { - GnssSvInfoV1_0 svInfo = {.svid = svid, - .constellation = type, - .cN0Dbhz = cN0DbHz, - .elevationDegrees = elevationDegrees, - .azimuthDegrees = azimuthDegrees, - .carrierFrequencyHz = carrierFrequencyHz, - .svFlag = GnssSvFlags::USED_IN_FIX | GnssSvFlags::HAS_EPHEMERIS_DATA | - GnssSvFlags::HAS_ALMANAC_DATA | - GnssSvFlags::HAS_CARRIER_FREQUENCY}; + GnssSvInfoV1_0 svInfo = { + .svid = svid, + .constellation = type, + .cN0Dbhz = cN0DbHz, + .elevationDegrees = elevationDegrees, + .azimuthDegrees = azimuthDegrees, + .carrierFrequencyHz = carrierFrequencyHz, + .svFlag = GnssSvFlagsV1_0::USED_IN_FIX | GnssSvFlagsV1_0::HAS_EPHEMERIS_DATA | + GnssSvFlagsV1_0::HAS_ALMANAC_DATA | GnssSvFlagsV1_0::HAS_CARRIER_FREQUENCY}; return svInfo; } diff --git a/gnss/common/utils/default/include/FixLocationParser.h b/gnss/common/utils/default/include/FixLocationParser.h index 19748a9dd1bda7e02f652872691459cff8efe41b..a73891452ae63dab603572f83029a3c9bdfce3d0 100644 --- a/gnss/common/utils/default/include/FixLocationParser.h +++ b/gnss/common/utils/default/include/FixLocationParser.h @@ -17,7 +17,7 @@ #ifndef android_hardware_gnss_common_default_FixLocationParser_H_ #define android_hardware_gnss_common_default_FixLocationParser_H_ -#include +#include #include #include @@ -36,7 +36,8 @@ namespace common { struct FixLocationParser { public: - static std::unique_ptr getLocationFromInputStr(const std::string& inputStr); + static std::unique_ptr getLocationFromInputStr( + const std::string& inputStr); }; } // namespace common @@ -44,4 +45,4 @@ struct FixLocationParser { } // namespace hardware } // namespace android -#endif // android_hardware_gnss_common_default_FixLocationParser_H_ +#endif // android_hardware_gnss_common_default_FixLocationParser_H_ \ No newline at end of file diff --git a/gnss/common/utils/default/include/NmeaFixInfo.h b/gnss/common/utils/default/include/NmeaFixInfo.h index 5c27045316958902feb7f47fa611a5f3a714a0ea..407336121d3b621bf52e531db52c89f5a608d025 100644 --- a/gnss/common/utils/default/include/NmeaFixInfo.h +++ b/gnss/common/utils/default/include/NmeaFixInfo.h @@ -22,6 +22,7 @@ #include #include #include +#include "aidl/android/hardware/gnss/IGnss.h" namespace android { namespace hardware { namespace gnss { @@ -45,6 +46,8 @@ class NmeaFixInfo { public: static std::unique_ptr getLocationFromInputStr(const std::string& inputStr); + static std::unique_ptr getAidlLocationFromInputStr( + const std::string& inputStr); private: static void splitStr(const std::string& line, const char& delimiter, diff --git a/gnss/common/utils/default/include/Utils.h b/gnss/common/utils/default/include/Utils.h index 43772ce11abc35fea7147756d4ab05e888e3f7e4..ad8f539248e035583a00bd3f0af82872c4a1bbed 100644 --- a/gnss/common/utils/default/include/Utils.h +++ b/gnss/common/utils/default/include/Utils.h @@ -17,6 +17,7 @@ #ifndef android_hardware_gnss_common_default_Utils_H_ #define android_hardware_gnss_common_default_Utils_H_ +#include #include #include #include @@ -34,8 +35,13 @@ struct Utils { const bool enableCorrVecOutputs); static V2_0::IGnssMeasurementCallback::GnssData getMockMeasurementV2_0(); static V2_1::IGnssMeasurementCallback::GnssData getMockMeasurementV2_1(); + + static aidl::android::hardware::gnss::GnssLocation getMockLocation(); static V2_0::GnssLocation getMockLocationV2_0(); static V1_0::GnssLocation getMockLocationV1_0(); + + static std::vector + getMockSvInfoList(); static hidl_vec getMockSvInfoListV2_1(); static V2_1::IGnssCallback::GnssSvInfo getMockSvInfoV2_1( V2_0::IGnssCallback::GnssSvInfo gnssSvInfoV2_0, float basebandCN0DbHz); @@ -46,9 +52,35 @@ struct Utils { float cN0DbHz, float elevationDegrees, float azimuthDegrees, float carrierFrequencyHz); + static hidl_vec getMockAntennaInfos(); }; +struct ThreadBlocker { + // returns false if unblocked: + template + bool wait_for(std::chrono::duration const& time) { + std::unique_lock lock(m); + return !cv.wait_for(lock, time, [&] { return terminate; }); + } + + void notify() { + std::unique_lock lock(m); + terminate = true; + cv.notify_all(); + } + + void reset() { + std::unique_lock lock(m); + terminate = false; + } + + private: + std::condition_variable cv; + std::mutex m; + bool terminate = false; +}; + } // namespace common } // namespace gnss } // namespace hardware diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h index 473e587762019480a5ec77831e6c00fe4de9c90a..c5a186b7ab4bffafb1d27c78e97daafa836a22e7 100644 --- a/gnss/common/utils/default/include/v2_1/GnssTemplate.h +++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h @@ -31,7 +31,6 @@ #include #include "DeviceFileReader.h" -#include "FixLocationParser.h" #include "GnssAntennaInfo.h" #include "GnssConfiguration.h" #include "GnssDebug.h" @@ -39,6 +38,7 @@ #include "GnssMeasurementCorrections.h" #include "GnssReplayUtils.h" #include "MockLocation.h" +#include "NmeaFixInfo.h" #include "Utils.h" namespace android::hardware::gnss::common::implementation { @@ -46,6 +46,7 @@ namespace android::hardware::gnss::common::implementation { constexpr int INPUT_BUFFER_SIZE = 128; constexpr char CMD_GET_LOCATION[] = "CMD_GET_LOCATION"; constexpr char GNSS_PATH[] = "/dev/gnss0"; +constexpr int TTFF_MILLIS = 2200; template struct GnssTemplate : public T_IGnss { @@ -131,6 +132,7 @@ struct GnssTemplate : public T_IGnss { std::atomic mHardwareModeChecked; std::atomic mGnssFd; std::thread mThread; + std::atomic mFirstFixReceived; mutable std::mutex mMutex; virtual hidl_vec filterBlocklistedSatellitesV2_1( @@ -152,7 +154,8 @@ GnssTemplate::GnssTemplate() : mMinIntervalMs(1000), mGnssConfiguration{new V2_1::implementation::GnssConfiguration()}, mHardwareModeChecked(false), - mGnssFd(-1) {} + mGnssFd(-1), + mFirstFixReceived(false) {} template GnssTemplate::~GnssTemplate() { @@ -162,12 +165,9 @@ GnssTemplate::~GnssTemplate() { template std::unique_ptr GnssTemplate::getLocationFromHW() { mHardwareModeChecked = true; - if (!ReplayUtils::hasFixedLocationDeviceFile()) { - return nullptr; - } std::string inputStr = ::android::hardware::gnss::common::DeviceFileReader::Instance().getLocationData(); - return FixLocationParser::getLocationFromInputStr(inputStr); + return NmeaFixInfo::getLocationFromInputStr(inputStr); } template @@ -180,6 +180,12 @@ Return GnssTemplate::start() { mIsActive = true; this->reportGnssStatusValue(V1_0::IGnssCallback::GnssStatusValue::SESSION_BEGIN); mThread = std::thread([this]() { + auto svStatus = filterBlocklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1()); + this->reportSvStatus(svStatus); + if (!mFirstFixReceived) { + std::this_thread::sleep_for(std::chrono::milliseconds(TTFF_MILLIS)); + mFirstFixReceived = true; + } while (mIsActive == true) { auto svStatus = filterBlocklistedSatellitesV2_1(Utils::getMockSvInfoListV2_1()); this->reportSvStatus(svStatus); @@ -282,7 +288,7 @@ Return GnssTemplate::injectLocation(double, double, float) { template Return GnssTemplate::deleteAidingData(V1_0::IGnss::GnssAidingData) { - // TODO implement + mFirstFixReceived = false; return Void(); } @@ -517,7 +523,7 @@ Return GnssTemplate::setCallback_2_1(const spgnssSetCapabilitiesCb_2_1(capabilities); if (!ret.isOk()) { ALOGE("%s: Unable to invoke callback", __func__); diff --git a/gnss/common/utils/vts/Android.bp b/gnss/common/utils/vts/Android.bp index 47eff2ec9c692dc3c6872ad4634afb694ce2dd51..f92e609f3cc24ba7807f098e9b1817ba708ffd82 100644 --- a/gnss/common/utils/vts/Android.bp +++ b/gnss/common/utils/vts/Android.bp @@ -44,6 +44,7 @@ cc_library_static { "android.hardware.gnss@2.1", "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss.measurement_corrections@1.1", + "android.hardware.gnss-V2-cpp", ], static_libs: [ "libgtest", diff --git a/gnss/common/utils/vts/Utils.cpp b/gnss/common/utils/vts/Utils.cpp index 9c84e806f8ddba76f4c2b843dd3239436eafc7dc..69e2b346b0d0e2aa17792050e9ca72d95af4ea78 100644 --- a/gnss/common/utils/vts/Utils.cpp +++ b/gnss/common/utils/vts/Utils.cpp @@ -15,88 +15,86 @@ */ #include +#include +#include #include "gtest/gtest.h" #include +#include namespace android { namespace hardware { namespace gnss { namespace common { -using GnssConstellationType_V1_0 = V1_0::GnssConstellationType; -using GnssConstellationType_V2_0 = V2_0::GnssConstellationType; +using android::hardware::gnss::ElapsedRealtime; +using android::hardware::gnss::GnssLocation; +using namespace measurement_corrections::V1_0; using V1_0::GnssLocationFlags; -void Utils::checkLocation(const GnssLocation& location, bool check_speed, - bool check_more_accuracies) { - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG); - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE); - if (check_speed) { - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED); - } - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY); - // New uncertainties available in O must be provided, - // at least when paired with modern hardware (2017+) - if (check_more_accuracies) { - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY); - if (check_speed) { - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY); - if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) { - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY); - } - } - } - EXPECT_GE(location.latitudeDegrees, -90.0); - EXPECT_LE(location.latitudeDegrees, 90.0); - EXPECT_GE(location.longitudeDegrees, -180.0); - EXPECT_LE(location.longitudeDegrees, 180.0); - EXPECT_GE(location.altitudeMeters, -1000.0); - EXPECT_LE(location.altitudeMeters, 30000.0); - if (check_speed) { - EXPECT_GE(location.speedMetersPerSec, 0.0); - EXPECT_LE(location.speedMetersPerSec, 5.0); // VTS tests are stationary. - - // Non-zero speeds must be reported with an associated bearing - if (location.speedMetersPerSec > 0.0) { - EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING); - } - } +using MeasurementCorrectionsAidl = + android::hardware::gnss::measurement_corrections::MeasurementCorrections; +using ReflectingPlaneAidl = android::hardware::gnss::measurement_corrections::ReflectingPlane; +using SingleSatCorrectionAidl = + android::hardware::gnss::measurement_corrections::SingleSatCorrection; +using ExcessPathInfo = SingleSatCorrectionAidl::ExcessPathInfo; - /* - * Tolerating some especially high values for accuracy estimate, in case of - * first fix with especially poor geometry (happens occasionally) - */ - EXPECT_GT(location.horizontalAccuracyMeters, 0.0); - EXPECT_LE(location.horizontalAccuracyMeters, 250.0); - - /* - * Some devices may define bearing as -180 to +180, others as 0 to 360. - * Both are okay & understandable. - */ - if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) { - EXPECT_GE(location.bearingDegrees, -180.0); - EXPECT_LE(location.bearingDegrees, 360.0); - } - if (location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) { - EXPECT_GT(location.verticalAccuracyMeters, 0.0); - EXPECT_LE(location.verticalAccuracyMeters, 500.0); - } - if (location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) { - EXPECT_GT(location.speedAccuracyMetersPerSecond, 0.0); - EXPECT_LE(location.speedAccuracyMetersPerSecond, 50.0); +template <> +int64_t Utils::getLocationTimestampMillis(const android::hardware::gnss::GnssLocation& location) { + return location.timestampMillis; +} + +template <> +int64_t Utils::getLocationTimestampMillis(const V1_0::GnssLocation& location) { + return location.timestamp; +} + +template <> +void Utils::checkLocationElapsedRealtime(const V1_0::GnssLocation&) {} + +template <> +void Utils::checkLocationElapsedRealtime(const android::hardware::gnss::GnssLocation& location) { + checkElapsedRealtime(location.elapsedRealtime); +} + +void Utils::checkElapsedRealtime(const ElapsedRealtime& elapsedRealtime) { + ASSERT_TRUE(elapsedRealtime.flags >= 0 && + elapsedRealtime.flags <= (ElapsedRealtime::HAS_TIMESTAMP_NS | + ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS)); + if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIMESTAMP_NS) { + ASSERT_TRUE(elapsedRealtime.timestampNs > 0); } - if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) { - EXPECT_GT(location.bearingAccuracyDegrees, 0.0); - EXPECT_LE(location.bearingAccuracyDegrees, 360.0); + if (elapsedRealtime.flags & ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS) { + ASSERT_TRUE(elapsedRealtime.timeUncertaintyNs > 0); } +} - // Check timestamp > 1.48e12 (47 years in msec - 1970->2017+) - EXPECT_GT(location.timestamp, 1.48e12); +const GnssLocation Utils::getMockLocation(double latitudeDegrees, double longitudeDegrees, + double horizontalAccuracyMeters) { + ElapsedRealtime elapsedRealtime; + elapsedRealtime.flags = + ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS; + elapsedRealtime.timestampNs = ::android::elapsedRealtimeNano(); + elapsedRealtime.timeUncertaintyNs = 1000; + GnssLocation location; + location.gnssLocationFlags = 0xFF; + location.latitudeDegrees = latitudeDegrees; + location.longitudeDegrees = longitudeDegrees; + location.altitudeMeters = 500.0; + location.speedMetersPerSec = 0.0; + location.bearingDegrees = 0.0; + location.horizontalAccuracyMeters = horizontalAccuracyMeters; + location.verticalAccuracyMeters = 1000.0; + location.speedAccuracyMetersPerSecond = 1000.0; + location.bearingAccuracyDegrees = 90.0; + location.timestampMillis = + static_cast(kMockTimestamp + ::android::elapsedRealtimeNano() * 1e-6); + location.elapsedRealtime = elapsedRealtime; + return location; } -const MeasurementCorrections_1_0 Utils::getMockMeasurementCorrections() { +const MeasurementCorrections Utils::getMockMeasurementCorrections() { ReflectingPlane reflectingPlane = { .latitudeDegrees = 37.4220039, .longitudeDegrees = -122.0840991, @@ -104,12 +102,12 @@ const MeasurementCorrections_1_0 Utils::getMockMeasurementCorrections() { .azimuthDegrees = 203.0, }; - SingleSatCorrection_V1_0 singleSatCorrection1 = { + SingleSatCorrection singleSatCorrection1 = { .singleSatCorrectionFlags = GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC | GnssSingleSatCorrectionFlags::HAS_REFLECTING_PLANE, - .constellation = GnssConstellationType_V1_0::GPS, + .constellation = V1_0::GnssConstellationType::GPS, .svid = 12, .carrierFrequencyHz = 1.59975e+09, .probSatIsLos = 0.50001, @@ -117,11 +115,12 @@ const MeasurementCorrections_1_0 Utils::getMockMeasurementCorrections() { .excessPathLengthUncertaintyMeters = 25.5, .reflectingPlane = reflectingPlane, }; - SingleSatCorrection_V1_0 singleSatCorrection2 = { + SingleSatCorrection singleSatCorrection2 = { .singleSatCorrectionFlags = GnssSingleSatCorrectionFlags::HAS_SAT_IS_LOS_PROBABILITY | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH | GnssSingleSatCorrectionFlags::HAS_EXCESS_PATH_LENGTH_UNC, - .constellation = GnssConstellationType_V1_0::GPS, + + .constellation = V1_0::GnssConstellationType::GPS, .svid = 9, .carrierFrequencyHz = 1.59975e+09, .probSatIsLos = 0.873, @@ -129,9 +128,9 @@ const MeasurementCorrections_1_0 Utils::getMockMeasurementCorrections() { .excessPathLengthUncertaintyMeters = 10.0, }; - hidl_vec singleSatCorrections = {singleSatCorrection1, - singleSatCorrection2}; - MeasurementCorrections_1_0 mockCorrections = { + hidl_vec singleSatCorrections = {singleSatCorrection1, + singleSatCorrection2}; + MeasurementCorrections mockCorrections = { .latitudeDegrees = 37.4219999, .longitudeDegrees = -122.0840575, .altitudeMeters = 30.60062531, @@ -143,25 +142,26 @@ const MeasurementCorrections_1_0 Utils::getMockMeasurementCorrections() { return mockCorrections; } -const MeasurementCorrections_1_1 Utils::getMockMeasurementCorrections_1_1() { - MeasurementCorrections_1_0 mockCorrections_1_0 = getMockMeasurementCorrections(); +const measurement_corrections::V1_1::MeasurementCorrections +Utils::getMockMeasurementCorrections_1_1() { + MeasurementCorrections mockCorrections_1_0 = getMockMeasurementCorrections(); - SingleSatCorrection_V1_1 singleSatCorrection1 = { + measurement_corrections::V1_1::SingleSatCorrection singleSatCorrection1 = { .v1_0 = mockCorrections_1_0.satCorrections[0], - .constellation = GnssConstellationType_V2_0::IRNSS, + .constellation = V2_0::GnssConstellationType::IRNSS, }; - SingleSatCorrection_V1_1 singleSatCorrection2 = { + measurement_corrections::V1_1::SingleSatCorrection singleSatCorrection2 = { .v1_0 = mockCorrections_1_0.satCorrections[1], - .constellation = GnssConstellationType_V2_0::IRNSS, + .constellation = V2_0::GnssConstellationType::IRNSS, }; - mockCorrections_1_0.satCorrections[0].constellation = GnssConstellationType_V1_0::UNKNOWN; - mockCorrections_1_0.satCorrections[1].constellation = GnssConstellationType_V1_0::UNKNOWN; + mockCorrections_1_0.satCorrections[0].constellation = V1_0::GnssConstellationType::UNKNOWN; + mockCorrections_1_0.satCorrections[1].constellation = V1_0::GnssConstellationType::UNKNOWN; - hidl_vec singleSatCorrections = {singleSatCorrection1, - singleSatCorrection2}; + hidl_vec singleSatCorrections = { + singleSatCorrection1, singleSatCorrection2}; - MeasurementCorrections_1_1 mockCorrections_1_1 = { + measurement_corrections::V1_1::MeasurementCorrections mockCorrections_1_1 = { .v1_0 = mockCorrections_1_0, .hasEnvironmentBearing = true, .environmentBearingDegrees = 45.0, @@ -171,28 +171,108 @@ const MeasurementCorrections_1_1 Utils::getMockMeasurementCorrections_1_1() { return mockCorrections_1_1; } +namespace { +const ExcessPathInfo createExcessPathInfo(float excessPathLengthMeters, + float excessPathLengthUncertaintyMeters, + const ReflectingPlaneAidl* reflectingPlane, + float attenuationDb) { + ExcessPathInfo excessPathInfo; + excessPathInfo.excessPathInfoFlags = + ExcessPathInfo::EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH | + ExcessPathInfo::EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC | + ExcessPathInfo::EXCESS_PATH_INFO_HAS_ATTENUATION | + (reflectingPlane == nullptr ? 0 + : ExcessPathInfo::EXCESS_PATH_INFO_HAS_REFLECTING_PLANE); + excessPathInfo.excessPathLengthMeters = excessPathLengthMeters; + excessPathInfo.excessPathLengthUncertaintyMeters = excessPathLengthUncertaintyMeters; + if (reflectingPlane != nullptr) { + excessPathInfo.reflectingPlane = *reflectingPlane; + } + excessPathInfo.attenuationDb = attenuationDb; + return excessPathInfo; +} +} // anonymous namespace + +const MeasurementCorrectionsAidl Utils::getMockMeasurementCorrections_aidl() { + ReflectingPlaneAidl reflectingPlane; + reflectingPlane.latitudeDegrees = 37.4220039; + reflectingPlane.longitudeDegrees = -122.0840991; + reflectingPlane.altitudeMeters = 250.35; + reflectingPlane.reflectingPlaneAzimuthDegrees = 203.0; + + SingleSatCorrectionAidl singleSatCorrection1; + singleSatCorrection1.singleSatCorrectionFlags = + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY | + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH | + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC | + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION; + singleSatCorrection1.constellation = android::hardware::gnss::GnssConstellationType::GPS; + singleSatCorrection1.svid = 12; + singleSatCorrection1.carrierFrequencyHz = 1.59975e+09; + singleSatCorrection1.probSatIsLos = 0.50001; + singleSatCorrection1.combinedExcessPathLengthMeters = 203.5; + singleSatCorrection1.combinedExcessPathLengthUncertaintyMeters = 59.1; + singleSatCorrection1.combinedAttenuationDb = -4.3; + singleSatCorrection1.excessPathInfos.push_back( + createExcessPathInfo(137.4, 25.5, &reflectingPlane, -3.5)); + singleSatCorrection1.excessPathInfos.push_back( + createExcessPathInfo(296.3, 87.2, &reflectingPlane, -5.1)); + + SingleSatCorrectionAidl singleSatCorrection2; + singleSatCorrection2.singleSatCorrectionFlags = + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY | + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH | + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC | + SingleSatCorrectionAidl::SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION; + singleSatCorrection2.constellation = GnssConstellationType::GPS; + singleSatCorrection2.svid = 9; + singleSatCorrection2.carrierFrequencyHz = 1.59975e+09; + singleSatCorrection2.probSatIsLos = 0.873; + singleSatCorrection2.combinedExcessPathLengthMeters = 26.294; + singleSatCorrection2.combinedExcessPathLengthUncertaintyMeters = 10.0; + singleSatCorrection2.combinedAttenuationDb = -0.5; + singleSatCorrection2.excessPathInfos.push_back( + createExcessPathInfo(26.294, 10.0, nullptr, -0.5)); + + std::vector singleSatCorrections = {singleSatCorrection1, + singleSatCorrection2}; + MeasurementCorrectionsAidl mockCorrections; + mockCorrections.latitudeDegrees = 37.4219999; + mockCorrections.longitudeDegrees = -122.0840575; + mockCorrections.altitudeMeters = 30.60062531; + mockCorrections.horizontalPositionUncertaintyMeters = 9.23542; + mockCorrections.verticalPositionUncertaintyMeters = 15.02341; + mockCorrections.toaGpsNanosecondsOfWeek = 2935633453L; + mockCorrections.hasEnvironmentBearing = true; + mockCorrections.environmentBearingDegrees = 45.0; + mockCorrections.environmentBearingUncertaintyDegrees = 4.0; + mockCorrections.satCorrections = singleSatCorrections; + + return mockCorrections; +} + /* * MapConstellationType: * Given a GnssConstellationType_2_0 type constellation, maps to its equivalent * GnssConstellationType_1_0 type constellation. For constellations that do not have * an equivalent value, maps to GnssConstellationType_1_0::UNKNOWN */ -GnssConstellationType_1_0 Utils::mapConstellationType(GnssConstellationType_2_0 constellation) { +V1_0::GnssConstellationType Utils::mapConstellationType(V2_0::GnssConstellationType constellation) { switch (constellation) { - case GnssConstellationType_2_0::GPS: - return GnssConstellationType_1_0::GPS; - case GnssConstellationType_2_0::SBAS: - return GnssConstellationType_1_0::SBAS; - case GnssConstellationType_2_0::GLONASS: - return GnssConstellationType_1_0::GLONASS; - case GnssConstellationType_2_0::QZSS: - return GnssConstellationType_1_0::QZSS; - case GnssConstellationType_2_0::BEIDOU: - return GnssConstellationType_1_0::BEIDOU; - case GnssConstellationType_2_0::GALILEO: - return GnssConstellationType_1_0::GALILEO; + case V2_0::GnssConstellationType::GPS: + return V1_0::GnssConstellationType::GPS; + case V2_0::GnssConstellationType::SBAS: + return V1_0::GnssConstellationType::SBAS; + case V2_0::GnssConstellationType::GLONASS: + return V1_0::GnssConstellationType::GLONASS; + case V2_0::GnssConstellationType::QZSS: + return V1_0::GnssConstellationType::QZSS; + case V2_0::GnssConstellationType::BEIDOU: + return V1_0::GnssConstellationType::BEIDOU; + case V2_0::GnssConstellationType::GALILEO: + return V1_0::GnssConstellationType::GALILEO; default: - return GnssConstellationType_1_0::UNKNOWN; + return V1_0::GnssConstellationType::UNKNOWN; } } diff --git a/gnss/common/utils/vts/include/Utils.h b/gnss/common/utils/vts/include/Utils.h index a4aad80f693dae10e69c0c82b47fce8218d6c2f9..7b890781dbf63563622d810774a49d91346e1fc0 100644 --- a/gnss/common/utils/vts/include/Utils.h +++ b/gnss/common/utils/vts/include/Utils.h @@ -19,23 +19,13 @@ #include #include +#include #include #include +#include -using GnssConstellationType_1_0 = android::hardware::gnss::V1_0::GnssConstellationType; -using GnssConstellationType_2_0 = android::hardware::gnss::V2_0::GnssConstellationType; -using GnssLocation = ::android::hardware::gnss::V1_0::GnssLocation; -using namespace android::hardware::gnss::measurement_corrections::V1_0; - -using MeasurementCorrections_1_0 = - android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections; -using MeasurementCorrections_1_1 = - android::hardware::gnss::measurement_corrections::V1_1::MeasurementCorrections; - -using SingleSatCorrection_V1_0 = - android::hardware::gnss::measurement_corrections::V1_0::SingleSatCorrection; -using SingleSatCorrection_V1_1 = - android::hardware::gnss::measurement_corrections::V1_1::SingleSatCorrection; +#include +#include namespace android { namespace hardware { @@ -43,16 +33,106 @@ namespace gnss { namespace common { struct Utils { - static void checkLocation(const GnssLocation& location, bool check_speed, - bool check_more_accuracies); - static const MeasurementCorrections_1_0 getMockMeasurementCorrections(); - static const MeasurementCorrections_1_1 getMockMeasurementCorrections_1_1(); + public: + static const int64_t kMockTimestamp = 1519930775453L; + + template + static void checkLocation(const T& location, bool check_speed, bool check_more_accuracies); + template + static void checkLocationElapsedRealtime(const T& location); - static GnssConstellationType_1_0 mapConstellationType(GnssConstellationType_2_0 constellation); + static void checkElapsedRealtime( + const android::hardware::gnss::ElapsedRealtime& elapsedRealtime); + + static const android::hardware::gnss::GnssLocation getMockLocation( + double latitudeDegrees, double longitudeDegrees, double horizontalAccuracyMeters); + static const measurement_corrections::V1_0::MeasurementCorrections + getMockMeasurementCorrections(); + static const measurement_corrections::V1_1::MeasurementCorrections + getMockMeasurementCorrections_1_1(); + static const android::hardware::gnss::measurement_corrections::MeasurementCorrections + getMockMeasurementCorrections_aidl(); + + static V1_0::GnssConstellationType mapConstellationType( + V2_0::GnssConstellationType constellation); static bool isAutomotiveDevice(); + + private: + template + static int64_t getLocationTimestampMillis(const T&); }; +template +void Utils::checkLocation(const T& location, bool check_speed, bool check_more_accuracies) { + EXPECT_TRUE(location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_LAT_LONG); + EXPECT_TRUE(location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_ALTITUDE); + if (check_speed) { + EXPECT_TRUE(location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_SPEED); + } + EXPECT_TRUE(location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_HORIZONTAL_ACCURACY); + // New uncertainties available in O must be provided, + // at least when paired with modern hardware (2017+) + if (check_more_accuracies) { + EXPECT_TRUE(location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_VERTICAL_ACCURACY); + if (check_speed) { + EXPECT_TRUE(location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_SPEED_ACCURACY); + if (location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_BEARING) { + EXPECT_TRUE(location.gnssLocationFlags & + V1_0::GnssLocationFlags::HAS_BEARING_ACCURACY); + } + } + } + EXPECT_GE(location.latitudeDegrees, -90.0); + EXPECT_LE(location.latitudeDegrees, 90.0); + EXPECT_GE(location.longitudeDegrees, -180.0); + EXPECT_LE(location.longitudeDegrees, 180.0); + EXPECT_GE(location.altitudeMeters, -1000.0); + EXPECT_LE(location.altitudeMeters, 30000.0); + if (check_speed) { + EXPECT_GE(location.speedMetersPerSec, 0.0); + EXPECT_LE(location.speedMetersPerSec, 5.0); // VTS tests are stationary. + + // Non-zero speeds must be reported with an associated bearing + if (location.speedMetersPerSec > 0.0) { + EXPECT_TRUE(location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_BEARING); + } + } + + /* + * Tolerating some especially high values for accuracy estimate, in case of + * first fix with especially poor geometry (happens occasionally) + */ + EXPECT_GT(location.horizontalAccuracyMeters, 0.0); + EXPECT_LE(location.horizontalAccuracyMeters, 250.0); + + /* + * Some devices may define bearing as -180 to +180, others as 0 to 360. + * Both are okay & understandable. + */ + if (location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_BEARING) { + EXPECT_GE(location.bearingDegrees, -180.0); + EXPECT_LE(location.bearingDegrees, 360.0); + } + if (location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_VERTICAL_ACCURACY) { + EXPECT_GT(location.verticalAccuracyMeters, 0.0); + EXPECT_LE(location.verticalAccuracyMeters, 500.0); + } + if (location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_SPEED_ACCURACY) { + EXPECT_GT(location.speedAccuracyMetersPerSecond, 0.0); + EXPECT_LE(location.speedAccuracyMetersPerSecond, 50.0); + } + if (location.gnssLocationFlags & V1_0::GnssLocationFlags::HAS_BEARING_ACCURACY) { + EXPECT_GT(location.bearingAccuracyDegrees, 0.0); + EXPECT_LE(location.bearingAccuracyDegrees, 360.0); + } + + // Check timestamp > 1.48e12 (47 years in msec - 1970->2017+) + EXPECT_GT(getLocationTimestampMillis(location), 1.48e12); + + checkLocationElapsedRealtime(location); +} + } // namespace common } // namespace gnss } // namespace hardware diff --git a/gnss/common/utils/vts/include/v2_1/GnssCallback.h b/gnss/common/utils/vts/include/v2_1/GnssCallback.h index ab1375d3a5993c7c48104012eec661b8954e1be2..09a67de71736a89aca013ce0e0de8eda215dacf9 100644 --- a/gnss/common/utils/vts/include/v2_1/GnssCallback.h +++ b/gnss/common/utils/vts/include/v2_1/GnssCallback.h @@ -28,7 +28,6 @@ using android::hardware::Void; using android::hardware::gnss::common::GnssCallbackEventQueue; using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback; using android::hardware::gnss::V1_0::GnssLocationFlags; -using android::hardware::gnss::V2_0::GnssConstellationType; using GnssLocation_1_0 = android::hardware::gnss::V1_0::GnssLocation; using GnssLocation_2_0 = android::hardware::gnss::V2_0::GnssLocation; diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp index 6ec4e645c1f3357e7a20b5c53aa3b3db63c9868c..40db81d3e489aa6738eb30d8b8ca96871a8477bc 100644 --- a/graphics/allocator/2.0/Android.bp +++ b/graphics/allocator/2.0/Android.bp @@ -24,4 +24,9 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/allocator/3.0/Android.bp b/graphics/allocator/3.0/Android.bp index 768baba9878cfd6817474e9824fa7cceb10c7d10..800632c59da277c48eaf3494d4a111659eab9eb8 100644 --- a/graphics/allocator/3.0/Android.bp +++ b/graphics/allocator/3.0/Android.bp @@ -26,4 +26,9 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/allocator/4.0/Android.bp b/graphics/allocator/4.0/Android.bp index 0df9b390f512a731794726fa224b037f86c7a2b9..5c5fb37c4813e852a311d2eec28239136eb8750a 100644 --- a/graphics/allocator/4.0/Android.bp +++ b/graphics/allocator/4.0/Android.bp @@ -26,4 +26,9 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..272ab4880948f6cfdb13fd9852596798f3bcfc15 --- /dev/null +++ b/graphics/allocator/aidl/Android.bp @@ -0,0 +1,47 @@ +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"], +} + +aidl_interface { + name: "android.hardware.graphics.allocator", + vendor_available: true, + vndk: { + enabled: true, + support_system_process: true, + }, + srcs: ["android/hardware/graphics/allocator/*.aidl"], + imports: [ + "android.hardware.common-V2", + ], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + ndk: { + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], + vndk: { + enabled: true, + }, + min_sdk_version: "29", + }, + }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.common-V2"], + }, + ], + +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/.hash b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..783f3d79027455c2c0d6ee8cd4faec17ba5da1f9 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/.hash @@ -0,0 +1 @@ +0dab5f7fc46756d126ac127cd6033fc242eff0aa diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/AllocationError.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/AllocationError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e7b739ed55b81f7e191c902a2998b32f7969bec --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/AllocationError.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.allocator; +@Backing(type="int") @VintfStability +enum AllocationError { + BAD_DESCRIPTOR = 0, + NO_RESOURCES = 1, + UNSUPPORTED = 2, +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/AllocationResult.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/AllocationResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..73cfeb542204999c08700aadb3b5a46c0457b733 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/AllocationResult.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.allocator; +@VintfStability +parcelable AllocationResult { + int stride; + android.hardware.common.NativeHandle[] buffers; +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/IAllocator.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/IAllocator.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fe0b0a214b1140787243637563f9fee124231469 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/1/android/hardware/graphics/allocator/IAllocator.aidl @@ -0,0 +1,38 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.allocator; +@VintfStability +interface IAllocator { + android.hardware.graphics.allocator.AllocationResult allocate(in byte[] descriptor, in int count); +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/AllocationError.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/AllocationError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6e7b739ed55b81f7e191c902a2998b32f7969bec --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/AllocationError.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.allocator; +@Backing(type="int") @VintfStability +enum AllocationError { + BAD_DESCRIPTOR = 0, + NO_RESOURCES = 1, + UNSUPPORTED = 2, +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/AllocationResult.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/AllocationResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..73cfeb542204999c08700aadb3b5a46c0457b733 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/AllocationResult.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.allocator; +@VintfStability +parcelable AllocationResult { + int stride; + android.hardware.common.NativeHandle[] buffers; +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/IAllocator.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/IAllocator.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fe0b0a214b1140787243637563f9fee124231469 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/IAllocator.aidl @@ -0,0 +1,38 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.allocator; +@VintfStability +interface IAllocator { + android.hardware.graphics.allocator.AllocationResult allocate(in byte[] descriptor, in int count); +} diff --git a/graphics/allocator/aidl/android/hardware/graphics/allocator/AllocationError.aidl b/graphics/allocator/aidl/android/hardware/graphics/allocator/AllocationError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c6b77b9f7f9a3a160609f52e9eec8ddfd4f0854e --- /dev/null +++ b/graphics/allocator/aidl/android/hardware/graphics/allocator/AllocationError.aidl @@ -0,0 +1,36 @@ +/* + * 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. + */ + +package android.hardware.graphics.allocator; + +@VintfStability +@Backing(type="int") +enum AllocationError { + /** + * Invalid BufferDescriptor. + */ + BAD_DESCRIPTOR, + + /** + * Resource unavailable. + */ + NO_RESOURCES, + + /** + * Permanent failure. + */ + UNSUPPORTED +} \ No newline at end of file diff --git a/graphics/allocator/aidl/android/hardware/graphics/allocator/AllocationResult.aidl b/graphics/allocator/aidl/android/hardware/graphics/allocator/AllocationResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0774e2554cb391039b871d0fab35eb849137e397 --- /dev/null +++ b/graphics/allocator/aidl/android/hardware/graphics/allocator/AllocationResult.aidl @@ -0,0 +1,30 @@ +/* + * 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. + */ + +package android.hardware.graphics.allocator; + +import android.hardware.common.NativeHandle; + + /** + * Result of an IAllocator::allocate call. + * + * @sa +ndk libnativewindow#AHardwareBuffer_Desc + */ +@VintfStability +parcelable AllocationResult { + int stride; + NativeHandle[] buffers; +} \ No newline at end of file diff --git a/graphics/allocator/aidl/android/hardware/graphics/allocator/IAllocator.aidl b/graphics/allocator/aidl/android/hardware/graphics/allocator/IAllocator.aidl new file mode 100644 index 0000000000000000000000000000000000000000..92dfd4f8abc1376a8492e1c2cba6c707ce9fddaf --- /dev/null +++ b/graphics/allocator/aidl/android/hardware/graphics/allocator/IAllocator.aidl @@ -0,0 +1,36 @@ +/* + * 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. + */ + +package android.hardware.graphics.allocator; + +import android.hardware.graphics.allocator.AllocationResult; + +@VintfStability +interface IAllocator { + /** + * Allocates buffers with the properties specified by the descriptor. + * + * Allocations should be optimized for usage bits provided in the + * descriptor. + * + * @param descriptor Properties of the buffers to allocate. This must be + * obtained from IMapper::createDescriptor(). + * @param count The number of buffers to allocate. + * @return An AllocationResult containing the result of the allocation + * @throws AllocationError on failure + */ + AllocationResult allocate(in byte[] descriptor, in int count); +} diff --git a/graphics/allocator/aidl/vts/Android.bp b/graphics/allocator/aidl/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..99ffb24079237b4e4b19b058c8358c3a30c4683a --- /dev/null +++ b/graphics/allocator/aidl/vts/Android.bp @@ -0,0 +1,68 @@ +/** + * 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", + "hwui_defaults", + ], + 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", + "libnativewindow", + ], + static_libs: [ + "libaidlcommonsupport", + "libgtest", + "libhwui", + ], + header_libs: [ + "libhwui_internal_headers", + ], + 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 0000000000000000000000000000000000000000..59af5cf3753c2157d1be085d4c162107e2539f0a --- /dev/null +++ b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp @@ -0,0 +1,379 @@ +/* + * 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. + */ + +#undef LOG_TAG +#define LOG_TAG "VtsHalGraphicsAllocatorAidl_TargetTest" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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; +using android::uirenderer::AutoEglImage; +using android::uirenderer::AutoGLFramebuffer; +using android::uirenderer::AutoSkiaGlTexture; +using android::uirenderer::renderthread::EglManager; + +static constexpr uint64_t pack(const std::initializer_list& usages) { + uint64_t ret = 0; + for (const auto u : usages) { + ret |= static_cast(u); + } + return ret; +} + +static constexpr hardware::graphics::common::V1_2::PixelFormat cast(PixelFormat format) { + return static_cast(format); +} + +class BufferHandle { + sp mMapper; + native_handle_t* mRawHandle; + bool mImported = false; + uint32_t mStride; + const IMapper::BufferDescriptorInfo mInfo; + + BufferHandle(const BufferHandle&) = delete; + void operator=(const BufferHandle&) = delete; + + public: + BufferHandle(const sp mapper, native_handle_t* handle, bool imported, uint32_t stride, + const IMapper::BufferDescriptorInfo& info) + : mMapper(mapper), mRawHandle(handle), mImported(imported), mStride(stride), mInfo(info) {} + + ~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; } + + AHardwareBuffer_Desc describe() const { + return { + .width = mInfo.width, + .height = mInfo.height, + .layers = mInfo.layerCount, + .format = static_cast(mInfo.format), + .usage = mInfo.usage, + .stride = stride(), + .rfu0 = 0, + .rfu1 = 0, + }; + } + + AHardwareBuffer* createAHardwareBuffer() const { + auto desc = describe(); + AHardwareBuffer* buffer = nullptr; + int err = AHardwareBuffer_createFromHandle( + &desc, mRawHandle, AHARDWAREBUFFER_CREATE_FROM_HANDLE_METHOD_CLONE, &buffer); + EXPECT_EQ(0, err) << "Failed to AHardwareBuffer_createFromHandle"; + return err ? nullptr : buffer; + } +}; + +class GraphicsTestsBase { + private: + std::shared_ptr mAllocator; + sp mMapper; + + protected: + void Initialize(std::string allocatorService, std::string mapperService) { + mAllocator = IAllocator::fromBinder( + ndk::SpAIBinder(AServiceManager_checkService(allocatorService.c_str()))); + mMapper = IMapper::getService(mapperService); + + 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"; + } + + public: + 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; + } + + std::unique_ptr allocate(const IMapper::BufferDescriptorInfo& descriptorInfo) { + 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"; + } else { + EXPECT_EQ(OK, error) << "Allocation transport failure"; + } + return nullptr; + } else { + return std::make_unique(mMapper, dupFromAidl(result.buffers[0]), false, + result.stride, descriptorInfo); + } + } + + bool isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo) { + bool ret = false; + EXPECT_TRUE(mMapper->isSupported(descriptorInfo, + [&](auto error, bool supported) { + ASSERT_EQ(Error::NONE, error); + ret = supported; + }) + .isOk()); + return ret; + } +}; + +class GraphicsAllocatorAidlTests + : public GraphicsTestsBase, + public ::testing::TestWithParam> { + public: + void SetUp() override { Initialize(std::get<0>(GetParam()), std::get<1>(GetParam())); } + + void TearDown() override {} +}; + +struct FlushMethod { + std::string name; + std::function func; +}; + +class GraphicsFrontBufferTests + : public GraphicsTestsBase, + public ::testing::TestWithParam> { + private: + EglManager eglManager; + std::function flush; + + public: + void SetUp() override { + Initialize(std::get<0>(GetParam()), std::get<1>(GetParam())); + flush = std::get<2>(GetParam()).func; + eglManager.initialize(); + } + + void TearDown() override { eglManager.destroy(); } + + void fillWithGpu(AHardwareBuffer* buffer, float red, float green, float blue, float alpha) { + const EGLClientBuffer clientBuffer = eglGetNativeClientBufferANDROID(buffer); + AutoEglImage eglImage(eglManager.eglDisplay(), clientBuffer); + AutoSkiaGlTexture glTexture; + AutoGLFramebuffer glFbo; + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage.image); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + glTexture.mTexture, 0); + + AHardwareBuffer_Desc desc; + AHardwareBuffer_describe(buffer, &desc); + glViewport(0, 0, desc.width, desc.height); + glDisable(GL_STENCIL_TEST); + glDisable(GL_SCISSOR_TEST); + glClearColor(red, green, blue, alpha); + glClear(GL_COLOR_BUFFER_BIT); + flush(eglManager); + } + + void fillWithGpu(AHardwareBuffer* buffer, /*RGBA*/ uint32_t color) { + // Keep it simple for now + static_assert(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__); + float a = float((color >> 24) & 0xff) / 255.0f; + float b = float((color >> 16) & 0xff) / 255.0f; + float g = float((color >> 8) & 0xff) / 255.0f; + float r = float((color)&0xff) / 255.0f; + fillWithGpu(buffer, r, g, b, a); + } +}; + +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); +} + +TEST_P(GraphicsFrontBufferTests, FrontBufferGpuToCpu) { + IMapper::BufferDescriptorInfo info{ + .name = "CPU_8888", + .width = 64, + .height = 64, + .layerCount = 1, + .format = cast(PixelFormat::RGBA_8888), + .usage = pack({BufferUsage::GPU_RENDER_TARGET, BufferUsage::CPU_READ_OFTEN, + BufferUsage::FRONT_BUFFER}), + .reservedSize = 0, + }; + const bool supported = isSupported(info); + auto buffer = allocate(info); + if (!supported) { + ASSERT_EQ(nullptr, buffer.get()) + << "Allocation succeeded, but IMapper::isSupported was false"; + GTEST_SKIP(); + } else { + ASSERT_NE(nullptr, buffer.get()) << "Allocation failed, but IMapper::isSupported was true"; + } + + AHardwareBuffer* ahb = buffer->createAHardwareBuffer(); + ASSERT_NE(nullptr, ahb); + + // We draw 3 times with 3 different colors to ensure the flush is consistently flushing. + // Particularly for glFlush() there's occasions where it seems something triggers a flush + // to happen even though glFlush itself isn't consistently doing so, but for FRONT_BUFFER + // bound buffers it is supposed to consistently flush. + for (uint32_t color : {0xFF0000FFu, 0x00FF00FFu, 0x0000FFFFu}) { + fillWithGpu(ahb, color); + uint32_t* addr; + ASSERT_EQ(0, AHardwareBuffer_lock(ahb, AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN, -1, nullptr, + (void**)&addr)); + // Spot check a few pixels + EXPECT_EQ(color, addr[0]); + EXPECT_EQ(color, addr[32 + (32 * buffer->stride())]); + AHardwareBuffer_unlock(ahb, nullptr); + } + + AHardwareBuffer_release(ahb); +} + +TEST_P(GraphicsFrontBufferTests, FrontBufferGpuToGpu) { + IMapper::BufferDescriptorInfo info{ + .name = "CPU_8888", + .width = 64, + .height = 64, + .layerCount = 1, + .format = cast(PixelFormat::RGBA_8888), + .usage = pack({BufferUsage::GPU_RENDER_TARGET, BufferUsage::GPU_TEXTURE, + BufferUsage::FRONT_BUFFER}), + .reservedSize = 0, + }; + const bool supported = isSupported(info); + auto buffer = allocate(info); + if (!supported) { + ASSERT_EQ(nullptr, buffer.get()) + << "Allocation succeeded, but IMapper::isSupported was false"; + GTEST_SKIP(); + } else { + ASSERT_NE(nullptr, buffer.get()) << "Allocation failed, but IMapper::isSupported was true"; + } + + AHardwareBuffer* ahb = buffer->createAHardwareBuffer(); + ASSERT_NE(nullptr, ahb); + + // We draw 3 times with 3 different colors to ensure the flush is consistently flushing. + // Particularly for glFlush() there's occasions where it seems something triggers a flush + // to happen even though glFlush itself isn't consistently doing so, but for FRONT_BUFFER + // bound buffers it is supposed to consistently flush. + for (uint32_t color : {0xFF0000FFu, 0x00FF00FFu, 0x0000FFFFu}) { + fillWithGpu(ahb, color); + sk_sp hwBitmap = Bitmap::createFrom(ahb, SkColorSpace::MakeSRGB()); + SkBitmap cpuBitmap = hwBitmap->getSkBitmap(); + // Spot check a few pixels + EXPECT_EQ(color, *cpuBitmap.getAddr32(0, 0)); + EXPECT_EQ(color, *cpuBitmap.getAddr32(16, 30)); + } + + AHardwareBuffer_release(ahb); +} + +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<>); + +const auto FlushMethodsValues = testing::Values( + FlushMethod{"glFinish", [](EglManager&) { glFinish(); }}, + FlushMethod{"glFlush", + [](EglManager&) { + glFlush(); + // Since the goal is to verify that glFlush() actually flushes, we can't + // wait on any sort of fence since that will change behavior So instead we + // just sleep & hope + sleep(1); + }}, + FlushMethod{"eglClientWaitSync", [](EglManager& eglManager) { + EGLDisplay display = eglManager.eglDisplay(); + EGLSyncKHR fence = eglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, NULL); + eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, + EGL_FOREVER_KHR); + eglDestroySyncKHR(display, fence); + }}); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsFrontBufferTests); +INSTANTIATE_TEST_CASE_P( + PerInstance, GraphicsFrontBufferTests, + testing::Combine(testing::ValuesIn(getAidlHalInstanceNames(IAllocator::descriptor)), + testing::ValuesIn(getAllHalInstanceNames(IMapper::descriptor)), + FlushMethodsValues), + [](auto info) -> std::string { + std::string name = std::to_string(info.index) + "/" + std::get<2>(info.param).name; + return Sanitize(name); + }); diff --git a/graphics/bufferqueue/1.0/Android.bp b/graphics/bufferqueue/1.0/Android.bp index eda80d7a0dd4b535b320add5e7dd210eed43a9c1..11559b2637fc749fb06326e60254e48ec27f1b20 100644 --- a/graphics/bufferqueue/1.0/Android.bp +++ b/graphics/bufferqueue/1.0/Android.bp @@ -25,4 +25,10 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + "com.android.media", + "com.android.media.swcodec", + ], } diff --git a/graphics/bufferqueue/2.0/Android.bp b/graphics/bufferqueue/2.0/Android.bp index 13feeb154818dc4528d9e515124c6ccfdefb8810..552dafff8b5f9f201c6e74d5a43fe38d4c2d02a2 100644 --- a/graphics/bufferqueue/2.0/Android.bp +++ b/graphics/bufferqueue/2.0/Android.bp @@ -27,4 +27,10 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + "com.android.media", + "com.android.media.swcodec", + ], } diff --git a/graphics/common/1.0/Android.bp b/graphics/common/1.0/Android.bp index 74a0d9b9ea9b5c495c1710790051ae68d91f7f1f..19c51cd8e9b10281f3df713ea1043e3037876fba 100644 --- a/graphics/common/1.0/Android.bp +++ b/graphics/common/1.0/Android.bp @@ -21,4 +21,10 @@ hidl_interface { ], gen_java: true, gen_java_constants: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/common/1.1/Android.bp b/graphics/common/1.1/Android.bp index a120278a86acd8b736bbeb0f5718cf1f63b4fc03..0f1b5bf17a58fabc4b5409564d32ce2658039103 100644 --- a/graphics/common/1.1/Android.bp +++ b/graphics/common/1.1/Android.bp @@ -24,4 +24,10 @@ hidl_interface { ], gen_java: true, gen_java_constants: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/common/1.2/Android.bp b/graphics/common/1.2/Android.bp index fe149e4225c48387fab557cee060f19b64790b9b..ce3350d648e28d3cdaf61ef290994852aa371099 100644 --- a/graphics/common/1.2/Android.bp +++ b/graphics/common/1.2/Android.bp @@ -25,4 +25,10 @@ hidl_interface { ], gen_java: true, gen_java_constants: true, + apex_available: [ + "//apex_available:platform", + "com.android.bluetooth", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index b23d4a7caf223e484104b25c08b26a373d6374d8..40a575d555be0143e2d18621fc35690afc98d2c0 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { enabled: true, support_system_process: true, }, - vndk_use_version: "2", + vndk_use_version: "3", srcs: [ "android/hardware/graphics/common/*.aidl", ], @@ -25,7 +25,8 @@ aidl_interface { ], backend: { java: { - enabled: false, + enabled: true, + platform_apis: true, }, cpp: { enabled: false, @@ -39,8 +40,24 @@ aidl_interface { min_sdk_version: "29", }, }, - versions: [ - "1", - "2", + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + ], + }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + ], + }, + { + version: "3", + imports: [ + "android.hardware.common-V2", + ], + }, ], } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/.hash b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/.hash new file mode 100644 index 0000000000000000000000000000000000000000..dfda68f42d042e9a20aa3dcb4364f949a4fd22dc --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/.hash @@ -0,0 +1 @@ +e7e8b0bd7cd27ab4f1998700ef19ebc82e022d87 diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/AlphaInterpretation.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/AlphaInterpretation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ea60283fe17f87c24216104da272171c629e6507 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/AlphaInterpretation.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum AlphaInterpretation { + COVERAGE = 0, + MASK = 1, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/BlendMode.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/BlendMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d1f61beee8d4e85ac546f4a3a50d3a464b906704 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/BlendMode.aidl @@ -0,0 +1,42 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum BlendMode { + INVALID = 0, + NONE = 1, + PREMULTIPLIED = 2, + COVERAGE = 3, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/BufferUsage.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/BufferUsage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d3ab44f2ce2e07ddde44f566510256e8a100d8d9 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/BufferUsage.aidl @@ -0,0 +1,65 @@ +/* + * Copyright 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum BufferUsage { + CPU_READ_MASK = 15, + CPU_READ_NEVER = 0, + CPU_READ_RARELY = 2, + CPU_READ_OFTEN = 3, + CPU_WRITE_MASK = 240, + CPU_WRITE_NEVER = 0, + CPU_WRITE_RARELY = 32, + CPU_WRITE_OFTEN = 48, + GPU_TEXTURE = 256, + GPU_RENDER_TARGET = 512, + COMPOSER_OVERLAY = 2048, + COMPOSER_CLIENT_TARGET = 4096, + PROTECTED = 16384, + COMPOSER_CURSOR = 32768, + VIDEO_ENCODER = 65536, + CAMERA_OUTPUT = 131072, + CAMERA_INPUT = 262144, + RENDERSCRIPT = 1048576, + VIDEO_DECODER = 4194304, + SENSOR_DIRECT_DATA = 8388608, + GPU_DATA_BUFFER = 16777216, + GPU_CUBE_MAP = 33554432, + GPU_MIPMAP_COMPLETE = 67108864, + HW_IMAGE_ENCODER = 134217728, + FRONT_BUFFER = 4294967296, + VENDOR_MASK = -268435456, + VENDOR_MASK_HI = -281474976710656, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ChromaSiting.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ChromaSiting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b8af6446042719ea282d46f390700afff6c4a528 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ChromaSiting.aidl @@ -0,0 +1,42 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum ChromaSiting { + NONE = 0, + UNKNOWN = 1, + SITED_INTERSTITIAL = 2, + COSITED_HORIZONTAL = 3, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ColorTransform.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ColorTransform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f74859b7880c635b0155088b19d42881b02e6eb8 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ColorTransform.aidl @@ -0,0 +1,45 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum ColorTransform { + IDENTITY = 0, + ARBITRARY_MATRIX = 1, + VALUE_INVERSE = 2, + GRAYSCALE = 3, + CORRECT_PROTANOPIA = 4, + CORRECT_DEUTERANOPIA = 5, + CORRECT_TRITANOPIA = 6, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Compression.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Compression.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f155e19a940a567d1d09e67d5d8e59d8c6d7a4b --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Compression.aidl @@ -0,0 +1,40 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum Compression { + NONE = 0, + DISPLAY_STREAM_COMPRESSION = 1, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Cta861_3.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Cta861_3.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ec90c9c64f63a18e228ecaff93fb705136cfda30 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Cta861_3.aidl @@ -0,0 +1,40 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable Cta861_3 { + float maxContentLightLevel; + float maxFrameAverageLightLevel; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Dataspace.aidl new file mode 100644 index 0000000000000000000000000000000000000000..668b033174f79daa49607ee18ffb68f1d480e34f --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Dataspace.aidl @@ -0,0 +1,98 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Dataspace { + UNKNOWN = 0, + ARBITRARY = 1, + STANDARD_SHIFT = 16, + STANDARD_MASK = 4128768, + STANDARD_UNSPECIFIED = 0, + STANDARD_BT709 = 65536, + STANDARD_BT601_625 = 131072, + STANDARD_BT601_625_UNADJUSTED = 196608, + STANDARD_BT601_525 = 262144, + STANDARD_BT601_525_UNADJUSTED = 327680, + STANDARD_BT2020 = 393216, + STANDARD_BT2020_CONSTANT_LUMINANCE = 458752, + STANDARD_BT470M = 524288, + STANDARD_FILM = 589824, + STANDARD_DCI_P3 = 655360, + STANDARD_ADOBE_RGB = 720896, + TRANSFER_SHIFT = 22, + TRANSFER_MASK = 130023424, + TRANSFER_UNSPECIFIED = 0, + TRANSFER_LINEAR = 4194304, + TRANSFER_SRGB = 8388608, + TRANSFER_SMPTE_170M = 12582912, + TRANSFER_GAMMA2_2 = 16777216, + TRANSFER_GAMMA2_6 = 20971520, + TRANSFER_GAMMA2_8 = 25165824, + TRANSFER_ST2084 = 29360128, + TRANSFER_HLG = 33554432, + RANGE_SHIFT = 27, + RANGE_MASK = 939524096, + RANGE_UNSPECIFIED = 0, + RANGE_FULL = 134217728, + RANGE_LIMITED = 268435456, + RANGE_EXTENDED = 402653184, + SRGB_LINEAR = 138477568, + SCRGB_LINEAR = 406913024, + SRGB = 142671872, + SCRGB = 411107328, + JFIF = 146931712, + BT601_625 = 281149440, + BT601_525 = 281280512, + BT709 = 281083904, + DCI_P3_LINEAR = 139067392, + DCI_P3 = 155844608, + DISPLAY_P3_LINEAR = 139067392, + DISPLAY_P3 = 143261696, + ADOBE_RGB = 151715840, + BT2020_LINEAR = 138805248, + BT2020 = 147193856, + BT2020_PQ = 163971072, + DEPTH = 4096, + SENSOR = 4097, + BT2020_ITU = 281411584, + BT2020_ITU_PQ = 298188800, + BT2020_ITU_HLG = 302383104, + BT2020_HLG = 168165376, + DISPLAY_BT2020 = 142999552, + DYNAMIC_DEPTH = 4098, + JPEG_APP_SEGMENTS = 4099, + HEIF = 4100, + BT709_FULL_RANGE = 146866176, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/DisplayDecorationSupport.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/DisplayDecorationSupport.aidl new file mode 100644 index 0000000000000000000000000000000000000000..27eff764325448e1f65d19b02a55659e9ae05648 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/DisplayDecorationSupport.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable DisplayDecorationSupport { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.AlphaInterpretation alphaInterpretation; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ExtendableType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ExtendableType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5ff17752f7c0ab4e12a2711dadc04642e1734a5d --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/ExtendableType.aidl @@ -0,0 +1,40 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable ExtendableType { + @utf8InCpp String name; + long value = 0; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/FRect.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/FRect.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7972e111e259526f056fd1f2e1049ac5cd871e26 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/FRect.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable FRect { + float left; + float top; + float right; + float bottom; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/HardwareBuffer.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/HardwareBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1817769af21c404a21a058cad36fe36048aae382 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/HardwareBuffer.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable HardwareBuffer { + android.hardware.graphics.common.HardwareBufferDescription description; + android.hardware.common.NativeHandle handle; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/HardwareBufferDescription.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/HardwareBufferDescription.aidl new file mode 100644 index 0000000000000000000000000000000000000000..70f46a1e6c473a0e861d07c9883b06b81b7b4163 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/HardwareBufferDescription.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable HardwareBufferDescription { + int width; + int height; + int layers; + android.hardware.graphics.common.PixelFormat format = android.hardware.graphics.common.PixelFormat.UNSPECIFIED; + android.hardware.graphics.common.BufferUsage usage = android.hardware.graphics.common.BufferUsage.CPU_READ_NEVER; + int stride; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Hdr.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7bae45e94975f4f2aa3a707c8030460f94937104 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Hdr.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Hdr { + DOLBY_VISION = 1, + HDR10 = 2, + HLG = 3, + HDR10_PLUS = 4, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Interlaced.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Interlaced.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e04d2ab2bde3a1ac69a9c5deedf2c4c0c01f47b7 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Interlaced.aidl @@ -0,0 +1,41 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum Interlaced { + NONE = 0, + TOP_BOTTOM = 1, + RIGHT_LEFT = 2, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PixelFormat.aidl new file mode 100644 index 0000000000000000000000000000000000000000..59d6468d54344b752b6a23beb91d22f2c41a68f0 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PixelFormat.aidl @@ -0,0 +1,68 @@ +/* + * Copyright 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum PixelFormat { + UNSPECIFIED = 0, + RGBA_8888 = 1, + RGBX_8888 = 2, + RGB_888 = 3, + RGB_565 = 4, + BGRA_8888 = 5, + YCBCR_422_SP = 16, + YCRCB_420_SP = 17, + YCBCR_422_I = 20, + RGBA_FP16 = 22, + RAW16 = 32, + BLOB = 33, + IMPLEMENTATION_DEFINED = 34, + YCBCR_420_888 = 35, + RAW_OPAQUE = 36, + RAW10 = 37, + RAW12 = 38, + RGBA_1010102 = 43, + Y8 = 538982489, + Y16 = 540422489, + YV12 = 842094169, + DEPTH_16 = 48, + DEPTH_24 = 49, + DEPTH_24_STENCIL_8 = 50, + DEPTH_32F = 51, + DEPTH_32F_STENCIL_8 = 52, + STENCIL_8 = 53, + YCBCR_P010 = 54, + HSV_888 = 55, + R_8 = 56, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayout.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayout.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a09097511bf13153f9988841b2d484aaadbbf2ea --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayout.aidl @@ -0,0 +1,47 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable PlaneLayout { + android.hardware.graphics.common.PlaneLayoutComponent[] components; + long offsetInBytes; + long sampleIncrementInBits; + long strideInBytes; + long widthInSamples; + long heightInSamples; + long totalSizeInBytes; + long horizontalSubsampling; + long verticalSubsampling; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayoutComponent.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayoutComponent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0768240bf51c25124b7df8e1e3fc2a610d8dab5a --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayoutComponent.aidl @@ -0,0 +1,41 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable PlaneLayoutComponent { + android.hardware.graphics.common.ExtendableType type; + long offsetInBits; + long sizeInBits; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayoutComponentType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayoutComponentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8ba93811a4ed2bc85eff9a4fafeaac7f51211288 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/PlaneLayoutComponentType.aidl @@ -0,0 +1,46 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum PlaneLayoutComponentType { + Y = 1, + CB = 2, + CR = 4, + R = 1024, + G = 2048, + B = 4096, + RAW = 1048576, + A = 1073741824, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Point.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Point.aidl new file mode 100644 index 0000000000000000000000000000000000000000..af4705a1e48e1b49428c6498c902dd5797478344 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Point.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable Point { + int x; + int y; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Rect.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Rect.aidl new file mode 100644 index 0000000000000000000000000000000000000000..463a68f973033fc9c9eef54c4ddb8bd29b9137b8 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Rect.aidl @@ -0,0 +1,42 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable Rect { + int left; + int top; + int right; + int bottom; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Smpte2086.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Smpte2086.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dce9226c096d874872d5f1daf8f200a2ef3b2845 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Smpte2086.aidl @@ -0,0 +1,44 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable Smpte2086 { + android.hardware.graphics.common.XyColor primaryRed; + android.hardware.graphics.common.XyColor primaryGreen; + android.hardware.graphics.common.XyColor primaryBlue; + android.hardware.graphics.common.XyColor whitePoint; + float maxLuminance; + float minLuminance; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/StandardMetadataType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/StandardMetadataType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..06b31a203641b0232414ad5e6ac8fc181144c3ea --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/StandardMetadataType.aidl @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2019,libgralloctypes_helper 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 -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.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum StandardMetadataType { + INVALID = 0, + BUFFER_ID = 1, + NAME = 2, + WIDTH = 3, + HEIGHT = 4, + LAYER_COUNT = 5, + PIXEL_FORMAT_REQUESTED = 6, + PIXEL_FORMAT_FOURCC = 7, + PIXEL_FORMAT_MODIFIER = 8, + USAGE = 9, + ALLOCATION_SIZE = 10, + PROTECTED_CONTENT = 11, + COMPRESSION = 12, + INTERLACED = 13, + CHROMA_SITING = 14, + PLANE_LAYOUTS = 15, + CROP = 16, + DATASPACE = 17, + BLEND_MODE = 18, + SMPTE2086 = 19, + CTA861_3 = 20, + SMPTE2094_40 = 21, + SMPTE2094_10 = 22, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Transform.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Transform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..986d08902722d16c85b1ffd5cef10ad05a2f9b22 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/Transform.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Transform { + NONE = 0, + FLIP_H = 1, + FLIP_V = 2, + ROT_90 = 4, + ROT_180 = 3, + ROT_270 = 7, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/XyColor.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/XyColor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e300f25dad81863abe5dfe9ebca592acdf7d827a --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/3/android/hardware/graphics/common/XyColor.aidl @@ -0,0 +1,40 @@ +/** + * 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 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable XyColor { + float x; + float y; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/AlphaInterpretation.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/AlphaInterpretation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ea60283fe17f87c24216104da272171c629e6507 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/AlphaInterpretation.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum AlphaInterpretation { + COVERAGE = 0, + MASK = 1, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BlendMode.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BlendMode.aidl index deafdfad9050d1b07c1ee3bf92ca2066d24dcc44..d1f61beee8d4e85ac546f4a3a50d3a464b906704 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BlendMode.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BlendMode.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="int") @VintfStability enum BlendMode { INVALID = 0, diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl index 58eefc4e2c8f8a23cb7bdd87dab31208b457f11d..d3ab44f2ce2e07ddde44f566510256e8a100d8d9 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/BufferUsage.aidl @@ -1,14 +1,30 @@ +/* + * Copyright 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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="long") @VintfStability enum BufferUsage { CPU_READ_MASK = 15, @@ -38,10 +55,11 @@ enum BufferUsage { RENDERSCRIPT = 1048576, VIDEO_DECODER = 4194304, SENSOR_DIRECT_DATA = 8388608, + GPU_DATA_BUFFER = 16777216, GPU_CUBE_MAP = 33554432, GPU_MIPMAP_COMPLETE = 67108864, HW_IMAGE_ENCODER = 134217728, - GPU_DATA_BUFFER = 16777216, + FRONT_BUFFER = 4294967296, VENDOR_MASK = -268435456, VENDOR_MASK_HI = -281474976710656, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.aidl index 7ca4dfa53117461b2da58134600f6f88a6370cca..b8af6446042719ea282d46f390700afff6c4a528 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ChromaSiting.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="long") @VintfStability enum ChromaSiting { NONE = 0, diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ColorTransform.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ColorTransform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f74859b7880c635b0155088b19d42881b02e6eb8 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ColorTransform.aidl @@ -0,0 +1,45 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum ColorTransform { + IDENTITY = 0, + ARBITRARY_MATRIX = 1, + VALUE_INVERSE = 2, + GRAYSCALE = 3, + CORRECT_PROTANOPIA = 4, + CORRECT_DEUTERANOPIA = 5, + CORRECT_TRITANOPIA = 6, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Compression.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Compression.aidl index 06e40a08521a99b6434d33a70081cec033241500..4f155e19a940a567d1d09e67d5d8e59d8c6d7a4b 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Compression.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Compression.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="long") @VintfStability enum Compression { NONE = 0, diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Cta861_3.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Cta861_3.aidl index d4af501904197c3a57c291fe9fb4721eb309f851..ec90c9c64f63a18e228ecaff93fb705136cfda30 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Cta861_3.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Cta861_3.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable Cta861_3 { float maxContentLightLevel; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl index 43d7f84d2db2356819208e07c815a2a270ecbe1c..668b033174f79daa49607ee18ffb68f1d480e34f 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="int") @VintfStability enum Dataspace { UNKNOWN = 0, diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayDecorationSupport.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayDecorationSupport.aidl new file mode 100644 index 0000000000000000000000000000000000000000..27eff764325448e1f65d19b02a55659e9ae05648 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/DisplayDecorationSupport.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable DisplayDecorationSupport { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.AlphaInterpretation alphaInterpretation; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ExtendableType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ExtendableType.aidl index 6fcb794efdad7fbccdafd99acdaefe00cdd015ad..5ff17752f7c0ab4e12a2711dadc04642e1734a5d 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ExtendableType.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ExtendableType.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable ExtendableType { @utf8InCpp String name; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/FRect.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/FRect.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7972e111e259526f056fd1f2e1049ac5cd871e26 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/FRect.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable FRect { + float left; + float top; + float right; + float bottom; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl index 72222e118d3a6c7b65b9238c84b129131dfcac1b..1817769af21c404a21a058cad36fe36048aae382 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBuffer.aidl @@ -1,14 +1,30 @@ +/* + * Copyright 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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable HardwareBuffer { android.hardware.graphics.common.HardwareBufferDescription description; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl index 232e0231f1b9c9b2fbf265653bb1d2798bbe2869..70f46a1e6c473a0e861d07c9883b06b81b7b4163 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HardwareBufferDescription.aidl @@ -1,14 +1,30 @@ +/* + * Copyright 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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable HardwareBufferDescription { int width; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7bae45e94975f4f2aa3a707c8030460f94937104 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Hdr { + DOLBY_VISION = 1, + HDR10 = 2, + HLG = 3, + HDR10_PLUS = 4, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Interlaced.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Interlaced.aidl index 26674c9b1d5c6f331ee4fc2a74d8f9b19ebf9a92..e04d2ab2bde3a1ac69a9c5deedf2c4c0c01f47b7 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Interlaced.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Interlaced.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="long") @VintfStability enum Interlaced { NONE = 0, diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl index e5f04700ed3cdfce9566d6c7f62bcc9167b041aa..59d6468d54344b752b6a23beb91d22f2c41a68f0 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PixelFormat.aidl @@ -1,14 +1,30 @@ +/* + * Copyright 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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="int") @VintfStability enum PixelFormat { UNSPECIFIED = 0, @@ -47,4 +64,5 @@ enum PixelFormat { STENCIL_8 = 53, YCBCR_P010 = 54, HSV_888 = 55, + R_8 = 56, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayout.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayout.aidl index 8bca42feb1f4c0f6e1fdc6077b18bdc35daa27e1..a09097511bf13153f9988841b2d484aaadbbf2ea 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayout.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayout.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable PlaneLayout { android.hardware.graphics.common.PlaneLayoutComponent[] components; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponent.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponent.aidl index f5a649cac9027b49a9923c5e92298cfa2defef1c..0768240bf51c25124b7df8e1e3fc2a610d8dab5a 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponent.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponent.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable PlaneLayoutComponent { android.hardware.graphics.common.ExtendableType type; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.aidl index 7ff8d7652024771d94133e96f9fadddac8386be1..8ba93811a4ed2bc85eff9a4fafeaac7f51211288 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/PlaneLayoutComponentType.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="long") @VintfStability enum PlaneLayoutComponentType { Y = 1, diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Point.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Point.aidl new file mode 100644 index 0000000000000000000000000000000000000000..af4705a1e48e1b49428c6498c902dd5797478344 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Point.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@VintfStability +parcelable Point { + int x; + int y; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Rect.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Rect.aidl index e0ba69bcd0078639d4ec6c5c537c33631d19d304..463a68f973033fc9c9eef54c4ddb8bd29b9137b8 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Rect.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Rect.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable Rect { int left; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Smpte2086.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Smpte2086.aidl index 5da36f68c0bfd00698dfb44d7db435f979e4ef7a..dce9226c096d874872d5f1daf8f200a2ef3b2845 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Smpte2086.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Smpte2086.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable Smpte2086 { android.hardware.graphics.common.XyColor primaryRed; diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl index 34b53a2bba4df421e6c4d86c82b9959134142bb5..06b31a203641b0232414ad5e6ac8fc181144c3ea 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/StandardMetadataType.aidl @@ -1,14 +1,30 @@ +/** + * Copyright (c) 2019,libgralloctypes_helper 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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @Backing(type="long") @VintfStability enum StandardMetadataType { INVALID = 0, @@ -40,4 +57,5 @@ enum StandardMetadataType { SMPTE2086 = 19, CTA861_3 = 20, SMPTE2094_40 = 21, + SMPTE2094_10 = 22, } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Transform.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Transform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..986d08902722d16c85b1ffd5cef10ad05a2f9b22 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Transform.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Transform { + NONE = 0, + FLIP_H = 1, + FLIP_V = 2, + ROT_90 = 4, + ROT_180 = 3, + ROT_270 = 7, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/XyColor.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/XyColor.aidl index d96d0ac130a6b5b5873ae04e92996cde8accb8d5..e300f25dad81863abe5dfe9ebca592acdf7d827a 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/XyColor.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/XyColor.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 -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 @@ -16,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.graphics.common; +/* @hide */ @VintfStability parcelable XyColor { float x; diff --git a/graphics/common/aidl/android/hardware/graphics/common/AlphaInterpretation.aidl b/graphics/common/aidl/android/hardware/graphics/common/AlphaInterpretation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e994cf237fe4bb389c43d3705dac9c7129bb3b40 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/AlphaInterpretation.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 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. + */ + +package android.hardware.graphics.common; + +/** + * How to interperet alpha values when it may be ambiguous. + * @hide + */ +@VintfStability +@Backing(type="int") +enum AlphaInterpretation { + /** + * Alpha values are treated as coverage. + * + * Pixels in the buffer with an alpha of 0 (transparent) will be rendered in + * black, and pixels with a max value will show the content underneath. An + * alpha in between will show the content blended with black. + */ + COVERAGE = 0, + /** + * Alpha values are treated as a mask. + * + * Pixels in the buffer with an alpha of 0 (transparent) will show the + * content underneath, and pixels with a max value will be rendered in + * black. An alpha in between will show the content blended with black. + */ + MASK = 1, +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/BlendMode.aidl b/graphics/common/aidl/android/hardware/graphics/common/BlendMode.aidl index 242813555bad55f451ffe2f41f2d291394d83360..fa3f9e3364a69f4ae9bdad8e84ac158da28344e8 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/BlendMode.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/BlendMode.aidl @@ -18,6 +18,7 @@ package android.hardware.graphics.common; /** * Blend modes, settable per layer. + * @hide */ @VintfStability @Backing(type="int") diff --git a/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl b/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl index d978f4634559ab80a128f673024cb32bccc983c9..12bc441b72cc57be11f4d56481a87059f3c578f3 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/BufferUsage.aidl @@ -18,6 +18,7 @@ package android.hardware.graphics.common; /** * Buffer usage definitions. + * @hide */ @VintfStability @Backing(type="long") @@ -87,6 +88,12 @@ enum BufferUsage { /** buffer is used as a sensor direct report output */ SENSOR_DIRECT_DATA = 1 << 23, + /** + * buffer is used as as an OpenGL shader storage or uniform + * buffer object + */ + GPU_DATA_BUFFER = 1 << 24, + /** buffer is used as a cube map texture */ GPU_CUBE_MAP = 1 << 25, @@ -98,17 +105,42 @@ enum BufferUsage { */ HW_IMAGE_ENCODER = 1 << 27, + /* Bits 28-31 are reserved for vendor usage */ + /** - * buffer is used as as an OpenGL shader storage or uniform - * buffer object - */ - GPU_DATA_BUFFER = 1 << 24, + * Buffer is used for front-buffer rendering. + * + * To satisfy an allocation with this usage, the resulting buffer + * must operate as equivalent to shared memory for all targets. + * + * For CPU_USAGE_* other than NEVER, this means the buffer must + * "lock in place". The buffers must be directly accessible via mapping. + * + * For GPU_RENDER_TARGET the buffer must behave equivalent to a + * single-buffered EGL surface. For example glFlush must perform + * a flush, same as if the default framebuffer was single-buffered. + * + * For COMPOSER_* the HWC must not perform any caching for this buffer + * when submitted for composition. HWCs do not need to do any form + * of auto-refresh, and they are allowed to cache composition results between + * presents from SF (such as for panel self-refresh), but for any given + * present the buffer must be composited from even if it otherwise appears + * to be the same as a previous composition. + * + * If the GPU & HWC supports EGL_SINGLE_BUFFER, then it is recommended that + * FRONT_BUFFER usage is supported for the same formats as supported by + * EGL_SINGLE_BUFFER. In particular, it is recommended that the following + * combination is supported when possible: + * Format = RGBA_8888 + * Usage = FRONT_BUFFER | GPU_RENDER_TARGET | COMPOSER_OVERLAY + * + */ + FRONT_BUFFER = 1L << 32, - /** bits 25-27 must be zero and are reserved for future versions */ /** bits 28-31 are reserved for vendor extensions */ VENDOR_MASK = 0xf << 28, - /** bits 32-47 must be zero and are reserved for future versions */ + /** bits 33-47 must be zero and are reserved for future versions */ /** bits 48-63 are reserved for vendor extensions */ VENDOR_MASK_HI = (1L * 0xffff) << 48, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl b/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl index 562a664587c14dda468e259c8595db74e1210947..ac448535e865bfaf307d599a3ed6d36eb167182a 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/ChromaSiting.aidl @@ -18,6 +18,7 @@ package android.hardware.graphics.common; /** * Used by IAllocator/IMapper (gralloc) to describe standard chroma siting + * @hide */ @VintfStability @Backing(type="long") diff --git a/graphics/common/aidl/android/hardware/graphics/common/ColorTransform.aidl b/graphics/common/aidl/android/hardware/graphics/common/ColorTransform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..24ed8274fc22ef895be5113c8eecb172e6ced043 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/ColorTransform.aidl @@ -0,0 +1,50 @@ +/** + * 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 android.hardware.graphics.common; + +/** + * Color transforms that may be applied by hardware composer to the whole + * display. + * @hide + */ +@VintfStability +@Backing(type="int") +enum ColorTransform { + /** Applies no transform to the output color */ + IDENTITY = 0, + + /** Applies an arbitrary transform defined by a 4x4 affine matrix */ + ARBITRARY_MATRIX = 1, + + /** + * Applies a transform that inverts the value or luminance of the color, but + * does not modify hue or saturation + */ + VALUE_INVERSE = 2, + + /** Applies a transform that maps all colors to shades of gray */ + GRAYSCALE = 3, + + /** Applies a transform which corrects for protanopic color blindness */ + CORRECT_PROTANOPIA = 4, + + /** Applies a transform which corrects for deuteranopic color blindness */ + CORRECT_DEUTERANOPIA = 5, + + /** Applies a transform which corrects for tritanopic color blindness */ + CORRECT_TRITANOPIA = 6 +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/Compression.aidl b/graphics/common/aidl/android/hardware/graphics/common/Compression.aidl index 4cca1baff01afa0364a23f3d3bcd519105283863..57afa14cbb48fcd45244dea1e5278fd385faacdf 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Compression.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Compression.aidl @@ -18,6 +18,7 @@ package android.hardware.graphics.common; /** * Used by IAllocator/IMapper (gralloc) to describe standard compression strategies + * @hide */ @VintfStability @Backing(type="long") diff --git a/graphics/common/aidl/android/hardware/graphics/common/Cta861_3.aidl b/graphics/common/aidl/android/hardware/graphics/common/Cta861_3.aidl index 4fbc6b2344f889d18b53bf17d77c5c3789c9ec98..9b90a2bfe6bcd764df756c4206feab22faa65da3 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Cta861_3.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Cta861_3.aidl @@ -20,6 +20,7 @@ package android.hardware.graphics.common; * HDR static metadata extension as specified by CTA-861.3. * * This is an AIDL counterpart of the NDK struct `AHdrMetadata_cta861_3`. + * @hide */ @VintfStability parcelable Cta861_3 { diff --git a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl index 42cdd8128c41e8c5e0f39a8c474485d75bd325a3..5e9360fcedb795c9cc0c446f7e6bc7cb20ab354a 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl @@ -16,6 +16,7 @@ package android.hardware.graphics.common; +/** @hide */ @VintfStability @Backing(type="int") enum Dataspace { diff --git a/graphics/common/aidl/android/hardware/graphics/common/DisplayDecorationSupport.aidl b/graphics/common/aidl/android/hardware/graphics/common/DisplayDecorationSupport.aidl new file mode 100644 index 0000000000000000000000000000000000000000..42c23921b48868910eaa80a2ea452c2655e3f0b7 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/DisplayDecorationSupport.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 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. + */ + +package android.hardware.graphics.common; + +import android.hardware.graphics.common.PixelFormat; +import android.hardware.graphics.common.AlphaInterpretation; + +/** + * A description of how a device supports Composition.DISPLAY_DECORATION. + * + * If the device supports Composition.DISPLAY_DECORATION, a call to + * IComposerClient.getDisplayDecorationSupport should return an instance of this + * parcelable. Otherwise the method should return null. + * @hide + */ +@VintfStability +parcelable DisplayDecorationSupport { + /** + * The format to use for DISPLAY_DECORATION layers. Other formats are not + * supported. If other formats are used with DISPLAY_DECORATION, the result + * is undefined. + */ + PixelFormat format; + /** + * How the device intreprets the alpha in the pixel buffer. + */ + AlphaInterpretation alphaInterpretation; +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/ExtendableType.aidl b/graphics/common/aidl/android/hardware/graphics/common/ExtendableType.aidl index 495693c9bd287d4df528c122fcb6cff1de62dc83..3f70c1ab0aab1b4a29ccef3d8585a47f1a2cf042 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/ExtendableType.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/ExtendableType.aidl @@ -22,6 +22,7 @@ package android.hardware.graphics.common; * proprietary vendor compression strategy. Instead, compression is represented using this * ExtendableType that can support standard compression strategies while still allowing * every vendor to easily add their own non-standard definitions. + * @hide */ @VintfStability parcelable ExtendableType { diff --git a/graphics/common/aidl/android/hardware/graphics/common/FRect.aidl b/graphics/common/aidl/android/hardware/graphics/common/FRect.aidl new file mode 100644 index 0000000000000000000000000000000000000000..64595a2a77e0aa8530d8c43141ac2be173c021f0 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/FRect.aidl @@ -0,0 +1,29 @@ +/** + * 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 android.hardware.graphics.common; +/** + * General purpose definition of a rectangle with floating point corners. + * @hide + */ + +@VintfStability +parcelable FRect { + float left; + float top; + float right; + float bottom; +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl b/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl index 5a22c0f8d473e644c4e3a4564ab2ad58b39abbe4..50306dcaddf3e3c0b2c9493fd091f5aac691a7bc 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/HardwareBuffer.aidl @@ -24,6 +24,7 @@ import android.hardware.graphics.common.HardwareBufferDescription; * * @note This is different from the public HardwareBuffer. * @sa +ndk libnativewindow#AHardwareBuffer + * @hide */ @VintfStability parcelable HardwareBuffer { diff --git a/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl b/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl index 078c5126fa37ae9e2d31af1fe02691dcb8f5a04d..cc53da4cab467c85c72b58c7c2a3e95cddbdbfe4 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/HardwareBufferDescription.aidl @@ -23,6 +23,7 @@ import android.hardware.graphics.common.PixelFormat; * Stable AIDL counterpart of AHardwareBuffer_Desc. * * @sa +ndk libnativewindow#AHardwareBuffer_Desc + * @hide */ @VintfStability parcelable HardwareBufferDescription { diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f543780d65ceab8f838582582d4f098b068429df --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl @@ -0,0 +1,42 @@ +/** + * 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 android.hardware.graphics.common; + +/** + * Supported HDR formats. Must be kept in sync with equivalents in Display.java. + * @hide + */ +@VintfStability +@Backing(type="int") +enum Hdr { + /** + * Device supports Dolby Vision HDR + */ + DOLBY_VISION = 1, + /** + * Device supports HDR10 + */ + HDR10 = 2, + /** + * Device supports hybrid log-gamma HDR + */ + HLG = 3, + /** + * Device supports HDR10+ + */ + HDR10_PLUS = 4, +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/Interlaced.aidl b/graphics/common/aidl/android/hardware/graphics/common/Interlaced.aidl index a3f1baa53ac6f90bb71b282a7274c231f507cf5c..26252a5029115d89baa6eba433e977216f4c9caf 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Interlaced.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Interlaced.aidl @@ -18,6 +18,7 @@ package android.hardware.graphics.common; /** * Used by IAllocator/IMapper (gralloc) to describe standard interlaced strategies + * @hide */ @VintfStability @Backing(type="long") diff --git a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl index 4e0c5ef8d9285b87c4d35afe76928d95c55bbdd4..ccf437bdb2e7f6fb2cc272078fdebb6c64c61729 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl @@ -18,6 +18,7 @@ package android.hardware.graphics.common; /** * Pixel formats for graphics buffers. + * @hide */ @VintfStability @Backing(type="int") @@ -25,7 +26,7 @@ enum PixelFormat { /** * This value may be used in an operation where the format is optional. */ - UNSPECIFIED = 0, + UNSPECIFIED = 0, /** * 32-bit format that has 8-bit R, G, B, and A components, in that order, * from the lowest memory address to the highest memory address. @@ -33,7 +34,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - RGBA_8888 = 0x1, + RGBA_8888 = 0x1, /** * 32-bit format that has 8-bit R, G, B, and unused components, in that @@ -42,7 +43,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - RGBX_8888 = 0x2, + RGBX_8888 = 0x2, /** * 24-bit format that has 8-bit R, G, and B components, in that order, @@ -51,7 +52,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - RGB_888 = 0x3, + RGB_888 = 0x3, /** * 16-bit packed format that has 5-bit R, 6-bit G, and 5-bit B components, @@ -61,7 +62,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - RGB_565 = 0x4, + RGB_565 = 0x4, /** * 32-bit format that has 8-bit B, G, R, and A components, in that order, @@ -70,14 +71,14 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - BGRA_8888 = 0x5, + BGRA_8888 = 0x5, /** * Legacy formats deprecated in favor of YCBCR_420_888. */ - YCBCR_422_SP = 0x10, // NV16 - YCRCB_420_SP = 0x11, // NV21 - YCBCR_422_I = 0x14, // YUY2 + YCBCR_422_SP = 0x10, // NV16 + YCRCB_420_SP = 0x11, // NV21 + YCBCR_422_I = 0x14, // YUY2 /** * 64-bit format that has 16-bit R, G, B, and A components, in that order, @@ -86,7 +87,7 @@ enum PixelFormat { * The component values are signed floats, whose interpretation is defined * by the dataspace. */ - RGBA_FP16 = 0x16, + RGBA_FP16 = 0x16, /** * RAW16 is a single-channel, 16-bit, little endian format, typically @@ -129,7 +130,7 @@ enum PixelFormat { * | samples. * Other | Unsupported */ - RAW16 = 0x20, + RAW16 = 0x20, /** * BLOB is used to carry task-specific data which does not have a standard @@ -152,7 +153,7 @@ enum PixelFormat { * Dataspace::SENSOR | Sensor event data. * Other | Unsupported */ - BLOB = 0x21, + BLOB = 0x21, /** * A format indicating that the choice of format is entirely up to the @@ -168,7 +169,7 @@ enum PixelFormat { * * The interpretation of the component values is defined by the dataspace. */ - IMPLEMENTATION_DEFINED = 0x22, + IMPLEMENTATION_DEFINED = 0x22, /** * This format allows platforms to use an efficient YCbCr/YCrCb 4:2:0 @@ -185,7 +186,7 @@ enum PixelFormat { * * The interpretation of the component values is defined by the dataspace. */ - YCBCR_420_888 = 0x23, + YCBCR_420_888 = 0x23, /** * RAW_OPAQUE is a format for unprocessed raw image buffers coming from an @@ -207,7 +208,7 @@ enum PixelFormat { * Dataspace::ARBITRARY | Raw image sensor data. * Other | Unsupported */ - RAW_OPAQUE = 0x24, + RAW_OPAQUE = 0x24, /** * RAW10 is a single-channel, 10-bit per pixel, densely packed in each row, @@ -262,7 +263,7 @@ enum PixelFormat { * Dataspace::ARBITRARY | Raw image sensor data. * Other | Unsupported */ - RAW10 = 0x25, + RAW10 = 0x25, /** * RAW12 is a single-channel, 12-bit per pixel, densely packed in each row, @@ -313,7 +314,7 @@ enum PixelFormat { * Dataspace::ARBITRARY | Raw image sensor data. * Other | Unsupported */ - RAW12 = 0x26, + RAW12 = 0x26, /** 0x27 to 0x2A are reserved for flexible formats */ @@ -325,7 +326,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - RGBA_1010102 = 0x2B, + RGBA_1010102 = 0x2B, /** * 0x100 - 0x1FF @@ -357,7 +358,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - Y8 = 0x20203859, + Y8 = 0x20203859, /** * Y16 is a YUV planar format comprised of a WxH Y plane, with each pixel @@ -384,7 +385,7 @@ enum PixelFormat { * Dataspace::DEPTH, each pixel is a distance value measured by a depth * camera, plus an associated confidence value. */ - Y16 = 0x20363159, + Y16 = 0x20363159, /** * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed @@ -413,7 +414,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - YV12 = 0x32315659, // YCrCb 4:2:0 Planar + YV12 = 0x32315659, // YCrCb 4:2:0 Planar /** * 16-bit format that has a single 16-bit depth component. @@ -421,7 +422,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - DEPTH_16 = 0x30, + DEPTH_16 = 0x30, /** * 32-bit format that has a single 24-bit depth component and, optionally, @@ -430,7 +431,7 @@ enum PixelFormat { * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. */ - DEPTH_24 = 0x31, + DEPTH_24 = 0x31, /** * 32-bit format that has a 24-bit depth component and an 8-bit stencil @@ -440,7 +441,7 @@ enum PixelFormat { * whose interpretation is defined by the dataspace. The stencil values are * unsigned integers, whose interpretation is defined by the dataspace. */ - DEPTH_24_STENCIL_8 = 0x32, + DEPTH_24_STENCIL_8 = 0x32, /** * 32-bit format that has a single 32-bit depth component. @@ -448,7 +449,7 @@ enum PixelFormat { * The component values are signed floats, whose interpretation is defined * by the dataspace. */ - DEPTH_32F = 0x33, + DEPTH_32F = 0x33, /** * Two-component format that has a 32-bit depth component, an 8-bit stencil @@ -458,7 +459,7 @@ enum PixelFormat { * defined by the dataspace. The stencil bits are unsigned integers, whose * interpretation is defined by the dataspace. */ - DEPTH_32F_STENCIL_8 = 0x34, + DEPTH_32F_STENCIL_8 = 0x34, /** * 8-bit format that has a single 8-bit stencil component. @@ -466,23 +467,12 @@ enum PixelFormat { * The component values are unsigned integers, whose interpretation is * defined by the dataspace. */ - STENCIL_8 = 0x35, + STENCIL_8 = 0x35, /** * P010 is a 4:2:0 YCbCr semiplanar format comprised of a WxH Y plane - * followed immediately by a Wx(H/2) CbCr plane. Each sample is - * represented by a 16-bit little-endian value, with the lower 6 bits set - * to zero. - * - * This format assumes - * - an even height - * - a vertical stride equal to the height - * - * stride_in_bytes = stride * 2 - * y_size = stride_in_bytes * height - * cbcr_size = stride_in_bytes * (height / 2) - * cb_offset = y_size - * cr_offset = cb_offset + 2 + * followed by a Wx(H/2) CbCr plane. Each sample is represented by a 16-bit + * little-endian value, with the lower 6 bits set to zero. * * This format must be accepted by the allocator when used with the * following usage flags: @@ -499,7 +489,7 @@ enum PixelFormat { * Buffers with this format must be locked with IMapper::lockYCbCr * or with IMapper::lock. */ - YCBCR_P010 = 0x36, + YCBCR_P010 = 0x36, /** * 24-bit format that has 8-bit H, S, and V components, in that order, @@ -507,6 +497,13 @@ enum PixelFormat { * * The component values are unsigned normalized to the range [0, 1], whose * interpretation is defined by the dataspace. - */ - HSV_888 = 0x37, + */ + HSV_888 = 0x37, + + /** + * 8 bit format with a single 8-bit component. + * + * The component values are unsigned normalized to the range [0, 1]. + */ + R_8 = 0x38, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/PlaneLayout.aidl b/graphics/common/aidl/android/hardware/graphics/common/PlaneLayout.aidl index b329cb2d3c9a7a5eb6e55130a0326c648012ed02..bbbcf0991198af41020982b583cd6f9097252628 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/PlaneLayout.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/PlaneLayout.aidl @@ -32,6 +32,7 @@ import android.hardware.graphics.common.Rect; * - Pixel - a pixel is comprised of all the (non-metadata/raw) components in buffer across * all planes. For example, a buffer with a plane of Y and a plane of CbCr has a pixel * of YCbCr. + * @hide */ @VintfStability diff --git a/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponent.aidl b/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponent.aidl index c04cef021bddc9d4243c5ddbf0449b098ea34000..ccf8fe39e3f0d47bbdcc91a19087208de2f1ed7a 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponent.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponent.aidl @@ -32,6 +32,7 @@ import android.hardware.graphics.common.ExtendableType; * - Pixel - a pixel is comprised of all the (non-metadata/raw) components in buffer across * all planes. For example, a buffer with a plane of Y and a plane of CbCr has a pixel * of YCbCr. + * @hide */ @VintfStability diff --git a/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponentType.aidl b/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponentType.aidl index ce083966fed1fdd138e4c8b825646926706f10b2..1a11400df39d132006ff162b3d97f1057132ea75 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponentType.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/PlaneLayoutComponentType.aidl @@ -23,6 +23,7 @@ package android.hardware.graphics.common; * reasons. However, unlike gralloc1's android_flex_component, this field is NOT a bit field. * A plane's components should NOT be expressed by bitwise OR-ing different * PlaneLayoutComponentTypes together. + * @hide */ @VintfStability @Backing(type="long") diff --git a/graphics/common/aidl/android/hardware/graphics/common/Point.aidl b/graphics/common/aidl/android/hardware/graphics/common/Point.aidl new file mode 100644 index 0000000000000000000000000000000000000000..92372ebc2fbad3b51b5d13314f2d751c508fa55e --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/Point.aidl @@ -0,0 +1,28 @@ +/** + * 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 android.hardware.graphics.common; + +/** + * General purpose definition of a point. + * @hide + */ + +@VintfStability +parcelable Point { + int x; + int y; +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/Rect.aidl b/graphics/common/aidl/android/hardware/graphics/common/Rect.aidl index 1a3bc11e4f8aab41dbc9afc0543e7b5028e67ce8..5820261b391c956c71fd8c4f60320d58842c0df8 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Rect.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Rect.aidl @@ -18,6 +18,7 @@ package android.hardware.graphics.common; /** * General purpose definition of a rectangle. + * @hide */ @VintfStability diff --git a/graphics/common/aidl/android/hardware/graphics/common/Smpte2086.aidl b/graphics/common/aidl/android/hardware/graphics/common/Smpte2086.aidl index 60614cd9bb443959ac655a9d048e968976c60d4c..d83a35d34d40828f74af14f3ddac5c4c12bf3357 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Smpte2086.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Smpte2086.aidl @@ -21,6 +21,7 @@ import android.hardware.graphics.common.XyColor; * Mastering display metadata as specified by SMPTE ST 2086. * * This is an AIDL counterpart of the NDK struct `AHdrMetadata_smpte2086`. + * @hide */ @VintfStability parcelable Smpte2086 { diff --git a/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl b/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl index af6045e31da8ac1e83d539747aca948016724718..8126143dd0f9b911d35eb387487553ccac4a40f4 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl @@ -22,8 +22,9 @@ package android.hardware.graphics.common; * This is an enum that defines the common types of gralloc 4 buffer metadata. The comments for * each enum include a description of the metadata that is associated with the type. * - * IMapper@4.x must support getting the following standard buffer metadata types. IMapper@4.x may - * support setting these standard buffer metadata types as well. + * IMapper@4.x must support getting the following standard buffer metadata types, with the exception + * of SMPTE 2094-10 metadata. IMapper@4.x may support setting these standard buffer metadata types + * as well. * * When encoding these StandardMetadataTypes into a byte stream, the associated MetadataType is * is first encoded followed by the StandardMetadataType value. The MetadataType is encoded by @@ -33,6 +34,7 @@ package android.hardware.graphics.common; * * The StandardMetadataType encode/decode support library can be found in: * frameworks/native/libs/gralloc/types/include/gralloctypes/Gralloc4.h. + * @hide */ @VintfStability @Backing(type="long") @@ -344,7 +346,7 @@ enum StandardMetadataType { /** * Can be used to get or set dynamic HDR metadata specified by SMPTE ST 2094-40:2016. * - * This metadata is uint8_t byte array. + * This metadata is a uint8_t byte array. * * This is not used in tone mapping until it has been set for the first time. * @@ -353,4 +355,17 @@ enum StandardMetadataType { * If this is unset when encoded into a byte stream, the byte stream is empty. */ SMPTE2094_40 = 21, + + /** + * Can be used to get or set dynamic HDR metadata specified by SMPTE ST 2094-10:2016. + * + * This metadata is a uint8_t byte array. + * + * This is not used in tone mapping until it has been set for the first time. + * + * When it is encoded into a byte stream, the length of the HDR metadata byte array is written + * using 8 bytes in little endian. It is followed by the uint8_t byte array. + * If this is unset when encoded into a byte stream, the byte stream is empty. + */ + SMPTE2094_10 = 22, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/Transform.aidl b/graphics/common/aidl/android/hardware/graphics/common/Transform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8df82b5b019aa1e03817f6f761bbddf1c4a1bdbe --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/Transform.aidl @@ -0,0 +1,51 @@ +/** + * 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 android.hardware.graphics.common; + +/** + * Transformation definitions + * @hide + */ +@VintfStability +@Backing(type="int") +enum Transform { + /** + * Identity transform (i.e. no rotation or flip). + */ + NONE = 0, + + /** + * Horizontal flip. FLIP_H/FLIP_V is applied before ROT_90. + */ + FLIP_H = 1 << 0, + + /** + * Vertical flip. FLIP_H/FLIP_V is applied before ROT_90. + */ + FLIP_V = 1 << 1, + + /** + * 90 degree clockwise rotation. FLIP_H/FLIP_V is applied before ROT_90. + */ + ROT_90 = 1 << 2, + + /** + * Commonly used combinations. + */ + ROT_180 = FLIP_H | FLIP_V, + ROT_270 = FLIP_H | FLIP_V | ROT_90, +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/XyColor.aidl b/graphics/common/aidl/android/hardware/graphics/common/XyColor.aidl index 9571273d7d8a516cde38da4cb5c26e44d0d62700..6885abaaa105af68c63a66387dcda42917061ecb 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/XyColor.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/XyColor.aidl @@ -22,6 +22,7 @@ package android.hardware.graphics.common; * This is an AIDL counterpart of the NDK struct `AColor_xy`. * * @note This can be used to represent any 2-dimensional chromaticity. + * @hide */ @VintfStability parcelable XyColor { diff --git a/graphics/composer/2.1/utils/vts/Android.bp b/graphics/composer/2.1/utils/vts/Android.bp index 8732d53a448d5c20b665765f0d0aaa3c51126a5f..c0a0c078b2c99ae59ad6c5ae76f7c177b904caed 100644 --- a/graphics/composer/2.1/utils/vts/Android.bp +++ b/graphics/composer/2.1/utils/vts/Android.bp @@ -32,6 +32,7 @@ cc_library_static { "TestCommandReader.cpp", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.mapper@2.0-vts", "android.hardware.graphics.mapper@3.0-vts", @@ -39,6 +40,7 @@ cc_library_static { "libgtest", ], export_static_lib_headers: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.mapper@2.0-vts", "android.hardware.graphics.mapper@3.0-vts", diff --git a/graphics/composer/2.1/utils/vts/ComposerVts.cpp b/graphics/composer/2.1/utils/vts/ComposerVts.cpp index 55aaf12b8e39aeb860ecdc69675ec659013af3d7..4603dd1b8c4120ffe71555e375d528a42ee1dcc3 100644 --- a/graphics/composer/2.1/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.1/utils/vts/ComposerVts.cpp @@ -316,9 +316,13 @@ NativeHandleWrapper::~NativeHandleWrapper() { Gralloc::Gralloc() { [this] { - ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared("default", "default", - /*errOnFailure=*/false)); - if (mGralloc4->getAllocator() == nullptr || mGralloc4->getMapper() == nullptr) { + ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared( + /*aidlAllocatorServiceName*/ IAllocator::descriptor + + std::string("/default"), + /*hidlAllocatorServiceName*/ "default", + /*mapperServiceName*/ "default", + /*errOnFailure=*/false)); + if (!mGralloc4->hasAllocator() || mGralloc4->getMapper() == nullptr) { mGralloc4 = nullptr; ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared("default", "default", /*errOnFailure=*/false)); diff --git a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h index 29498233641863413acff8d71ae16d0429a8f42a..f8ea661f1245586a1a275e5a3ae5cbae9402b1f6 100644 --- a/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h +++ b/graphics/composer/2.1/utils/vts/include/composer-vts/2.1/ComposerVts.h @@ -49,6 +49,7 @@ using IMapper4 = android::hardware::graphics::mapper::V4_0::IMapper; using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc; using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc; using Gralloc4 = android::hardware::graphics::mapper::V4_0::vts::Gralloc; +using IAllocator = aidl::android::hardware::graphics::allocator::IAllocator; class ComposerClient; diff --git a/graphics/composer/2.1/vts/functional/Android.bp b/graphics/composer/2.1/vts/functional/Android.bp index 9ffd7d52e0f27be5203ae512a852305655e4a0c4..502036edb4761e3c983ec0fd2fb4aa50c88cd27b 100644 --- a/graphics/composer/2.1/vts/functional/Android.bp +++ b/graphics/composer/2.1/vts/functional/Android.bp @@ -32,14 +32,17 @@ cc_test { // TODO(b/64437680): Assume these libs are always available on the device. shared_libs: [ "libbase", + "libbinder_ndk", "libfmq", "libsync", + "android.hardware.common-V2-ndk", "android.hardware.graphics.mapper@2.0", "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", "android.hardware.graphics.mapper@4.0", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", @@ -49,10 +52,14 @@ cc_test { "android.hardware.graphics.mapper@2.1-vts", "android.hardware.graphics.mapper@3.0-vts", "android.hardware.graphics.mapper@4.0-vts", + "libaidlcommonsupport", ], header_libs: [ "android.hardware.graphics.composer@2.1-command-buffer", ], disable_framework: true, - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/graphics/composer/2.2/utils/resources/include/composer-resources/2.2/ComposerResources.h b/graphics/composer/2.2/utils/resources/include/composer-resources/2.2/ComposerResources.h index 33012e92c8fbeec91951020e00814b93722e59a5..18a50fecd7b7e4531f535a84af7718130c5e30bc 100644 --- a/graphics/composer/2.2/utils/resources/include/composer-resources/2.2/ComposerResources.h +++ b/graphics/composer/2.2/utils/resources/include/composer-resources/2.2/ComposerResources.h @@ -29,6 +29,8 @@ namespace composer { namespace V2_2 { namespace hal { +using V2_1::Display; +using V2_1::Error; using V2_1::hal::ComposerHandleCache; using V2_1::hal::ComposerHandleImporter; diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index 5c085cb768afe93bb8d338714f92f53fb58a2010..cca53230aec3cb8dda022f27ba5c67cddfc2a317 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp @@ -35,20 +35,25 @@ cc_library_static { "libui", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", + "android.hardware.graphics.composer3-V1-ndk", "android.hardware.graphics.mapper@2.1-vts", "libarect", "libgtest", "libmath", "libnativewindow", "librenderengine", + "libshaders", + "libtonemap", "android.hardware.graphics.mapper@3.0", "android.hardware.graphics.mapper@3.0-vts", "android.hardware.graphics.mapper@4.0", "android.hardware.graphics.mapper@4.0-vts", ], export_static_lib_headers: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.mapper@2.1-vts", diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp index a526137c4112642d1e9c00f7c8bb2f471982bd0e..b706596df443b93d1663a4a80d92fa2b98b69283 100644 --- a/graphics/composer/2.2/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.2/utils/vts/ComposerVts.cpp @@ -182,9 +182,13 @@ std::array ComposerClient::getDataspaceSaturationMatrix(Dataspace dat Gralloc::Gralloc() { [this] { ALOGD("Attempting to initialize gralloc4"); - ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared("default", "default", - /*errOnFailure=*/false)); - if (mGralloc4->getMapper() == nullptr || mGralloc4->getAllocator() == nullptr) { + ASSERT_NO_FATAL_FAILURE(mGralloc4 = std::make_shared( + /*aidlAllocatorServiceName*/ IAllocator::descriptor + + std::string("/default"), + /*hidlAllocatorServiceName*/ "default", + /*mapperServiceName*/ "default", + /*errOnFailure=*/false)); + if (mGralloc4->getMapper() == nullptr || !mGralloc4->hasAllocator()) { mGralloc4 = nullptr; ALOGD("Failed to initialize gralloc4, initializing gralloc3"); ASSERT_NO_FATAL_FAILURE(mGralloc3 = std::make_shared("default", "default", diff --git a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp index 30596fc4c9fc3efbd0552fef83a54e1b37ef55cf..a1794afeed86bfea924cee0e6663b163c5cf78d3 100644 --- a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp +++ b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp @@ -17,6 +17,7 @@ #include #include #include "renderengine/ExternalTexture.h" +#include "renderengine/impl/ExternalTexture.h" namespace android { namespace hardware { @@ -281,11 +282,11 @@ void TestBufferLayer::write(const std::shared_ptr& writer) { LayerSettings TestBufferLayer::toRenderEngineLayerSettings() { LayerSettings layerSettings = TestLayer::toRenderEngineLayerSettings(); - layerSettings.source.buffer.buffer = std::make_shared( + layerSettings.source.buffer.buffer = std::make_shared( new GraphicBuffer(mBufferHandle->get(), GraphicBuffer::CLONE_HANDLE, mWidth, mHeight, static_cast(mFormat), 1, mUsage, mStride), mRenderEngine.getInternalRenderEngine(), - renderengine::ExternalTexture::Usage::READABLE); + renderengine::impl::ExternalTexture::Usage::READABLE); layerSettings.source.buffer.usePremultipliedAlpha = mBlendMode == IComposerClient::BlendMode::PREMULTIPLIED; diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp index f78dda2689545171e6caa10242641bd3b58a380d..4a33fb5b427cc89aff4de86b02aa65baec718689 100644 --- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp +++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp @@ -15,6 +15,7 @@ */ #include +#include "renderengine/impl/ExternalTexture.h" namespace android { namespace hardware { @@ -60,19 +61,20 @@ void TestRenderEngine::initGraphicBuffer(uint32_t width, uint32_t height, uint32 void TestRenderEngine::drawLayers() { base::unique_fd bufferFence; - base::unique_fd readyFence; - std::vector compositionLayerPointers; - compositionLayerPointers.reserve(mCompositionLayers.size()); + std::vector compositionLayers; + compositionLayers.reserve(mCompositionLayers.size()); std::transform(mCompositionLayers.begin(), mCompositionLayers.end(), - std::back_insert_iterator(compositionLayerPointers), - [](renderengine::LayerSettings& settings) -> renderengine::LayerSettings* { - return &settings; + std::back_insert_iterator(compositionLayers), + [](renderengine::LayerSettings& settings) -> renderengine::LayerSettings { + return settings; }); - auto texture = std::make_shared( - mGraphicBuffer, *mRenderEngine, renderengine::ExternalTexture::Usage::WRITEABLE); - mRenderEngine->drawLayers(mDisplaySettings, compositionLayerPointers, texture, true, - std::move(bufferFence), &readyFence); + auto texture = std::make_shared( + mGraphicBuffer, *mRenderEngine, renderengine::impl::ExternalTexture::Usage::WRITEABLE); + auto [status, readyFence] = mRenderEngine + ->drawLayers(mDisplaySettings, compositionLayers, texture, + true, std::move(bufferFence)) + .get(); int fd = readyFence.release(); if (fd != -1) { ASSERT_EQ(0, sync_wait(fd, -1)); diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h index d3bba17ed31fc543f7a53702e7375e0949719088..02d7bdb9dac5de49bb0dfb9a54a6c8d245d927c4 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h @@ -48,6 +48,7 @@ using Gralloc2 = android::hardware::graphics::mapper::V2_0::vts::Gralloc; using Gralloc2_1 = android::hardware::graphics::mapper::V2_1::vts::Gralloc; using Gralloc3 = android::hardware::graphics::mapper::V3_0::vts::Gralloc; using Gralloc4 = android::hardware::graphics::mapper::V4_0::vts::Gralloc; +using IAllocator = aidl::android::hardware::graphics::allocator::IAllocator; class ComposerClient; diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index e45696dca26374c016711775bff9cc6b42677243..960b62da8af1b96cab35a6f0d7af3c13cbc94a1f 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp @@ -45,18 +45,21 @@ cc_test { "libGLESv1_CM", "libGLESv2", "libbase", + "libbinder_ndk", "libfmq", "libgui", "libhidlbase", "libprocessgroup", "libsync", "libui", + "android.hardware.common-V2-ndk", "android.hardware.graphics.mapper@2.0", "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", "android.hardware.graphics.mapper@4.0", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", @@ -65,12 +68,16 @@ cc_test { "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.composer@2.2-vts", + "android.hardware.graphics.composer3-V1-ndk", "android.hardware.graphics.mapper@2.0-vts", "android.hardware.graphics.mapper@2.1-vts", "android.hardware.graphics.mapper@3.0-vts", "android.hardware.graphics.mapper@4.0-vts", + "libaidlcommonsupport", "libgtest", "librenderengine", + "libshaders", + "libtonemap", ], header_libs: [ "android.hardware.graphics.composer@2.1-command-buffer", diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp index 7a053f1eb75f4f9bc3cf325acd4b6385ca0bf55a..e2a0f4d22fa816d10d19c2ebf7c8298bfd3a3c7d 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp @@ -97,7 +97,6 @@ class GraphicsCompositionTestBase : public ::testing::Test { renderengine::DisplaySettings clientCompositionDisplay; clientCompositionDisplay.physicalDisplay = Rect(mDisplayWidth, mDisplayHeight); clientCompositionDisplay.clip = clientCompositionDisplay.physicalDisplay; - clientCompositionDisplay.clearRegion = Region(clientCompositionDisplay.physicalDisplay); mTestRenderEngine->initGraphicBuffer( static_cast(mDisplayWidth), static_cast(mDisplayHeight), 1, diff --git a/graphics/composer/2.3/vts/functional/Android.bp b/graphics/composer/2.3/vts/functional/Android.bp index 70384ac62e3c133c818c4323a5e0ae174d4c5ef0..40b77d5a151908a5fb070ecd5e6f4416bfc0753c 100644 --- a/graphics/composer/2.3/vts/functional/Android.bp +++ b/graphics/composer/2.3/vts/functional/Android.bp @@ -32,15 +32,18 @@ cc_test { // TODO(b/64437680): Assume these libs are always available on the device. shared_libs: [ "libbase", + "libbinder_ndk", "libfmq", "libhidlbase", "libsync", + "android.hardware.common-V2-ndk", "android.hardware.graphics.mapper@2.0", "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", "android.hardware.graphics.mapper@4.0", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", @@ -54,6 +57,7 @@ cc_test { "android.hardware.graphics.mapper@2.1-vts", "android.hardware.graphics.mapper@3.0-vts", "android.hardware.graphics.mapper@4.0-vts", + "libaidlcommonsupport", ], header_libs: [ "android.hardware.graphics.composer@2.1-command-buffer", @@ -61,5 +65,8 @@ cc_test { "android.hardware.graphics.composer@2.3-command-buffer", ], disable_framework: true, - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/graphics/composer/2.4/IComposerClient.hal b/graphics/composer/2.4/IComposerClient.hal index 9e3cf0e083987abd71cc10c8bd0e726d24ddefde..476302f1bfd3e9bb2b97b7b5ce24a63b405dc42f 100644 --- a/graphics/composer/2.4/IComposerClient.hal +++ b/graphics/composer/2.4/IComposerClient.hal @@ -305,9 +305,8 @@ interface IComposerClient extends @2.3::IComposerClient { * If the display is internally connected (not through HDMI), and such modes are available, * this method should trigger them. * - * This function should only be called if the display reports support for the corresponding - * content type (ContentType::{GRAPHICS, PHOTO, CINEMA, GAME}) from getSupportedContentTypes. - * ContentType::NONE is supported by default and can always be set. + * This function can be called for a content type even if no support for it is + * reported from getSupportedContentTypes. * * @return error is NONE upon success. Otherwise, * BAD_DISPLAY when an invalid display handle was passed in. diff --git a/graphics/composer/2.4/utils/vts/Android.bp b/graphics/composer/2.4/utils/vts/Android.bp index 5ef861c4f75a04fa65542889a30e3daaa7dc40e1..de3197573d5702565b99bc209b0f1828915b0bf4 100644 --- a/graphics/composer/2.4/utils/vts/Android.bp +++ b/graphics/composer/2.4/utils/vts/Android.bp @@ -32,6 +32,7 @@ cc_library_static { "TestCommandReader.cpp", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.composer@2.3-vts", diff --git a/graphics/composer/2.4/vts/functional/Android.bp b/graphics/composer/2.4/vts/functional/Android.bp index 22ae7c48cfd1400c89dc7e1d5abf80340cc78d8e..b73ea9403ebc27276279730b78021586245025e5 100644 --- a/graphics/composer/2.4/vts/functional/Android.bp +++ b/graphics/composer/2.4/vts/functional/Android.bp @@ -32,14 +32,17 @@ cc_test { // TODO(b/64437680): Assume these libs are always available on the device. shared_libs: [ "libbase", + "libbinder_ndk", "libfmq", "libsync", + "android.hardware.common-V2-ndk", "android.hardware.graphics.mapper@2.0", "android.hardware.graphics.mapper@2.1", "android.hardware.graphics.mapper@3.0", "android.hardware.graphics.mapper@4.0", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", @@ -55,6 +58,7 @@ cc_test { "android.hardware.graphics.mapper@2.1-vts", "android.hardware.graphics.mapper@3.0-vts", "android.hardware.graphics.mapper@4.0-vts", + "libaidlcommonsupport", ], header_libs: [ "android.hardware.graphics.composer@2.1-command-buffer", @@ -63,5 +67,8 @@ cc_test { "android.hardware.graphics.composer@2.4-command-buffer", ], disable_framework: true, - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..9b88d98f9c884abd24932495de222d93a0bfad96 --- /dev/null +++ b/graphics/composer/aidl/Android.bp @@ -0,0 +1,99 @@ +/** + * 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"], +} + +aidl_interface { + name: "android.hardware.graphics.composer3", + host_supported: true, + vendor_available: true, + vndk: { + enabled: true, + support_system_process: true, + }, + srcs: [ + "android/hardware/graphics/composer3/*.aidl", + ], + stability: "vintf", + imports: [ + "android.hardware.graphics.common-V3", + "android.hardware.common-V2", + ], + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + enabled: false, + }, + ndk: { + vndk: { + enabled: true, + }, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.graphics.common-V3", + "android.hardware.common-V2", + ], + }, + ], + +} + +cc_library_headers { + name: "android.hardware.graphics.composer3-command-buffer", + vendor_available: true, + shared_libs: [ + "android.hardware.graphics.composer3-V1-ndk", + "android.hardware.common-V2-ndk", + "libbase", + "libfmq", + "libsync", + ], + static_libs: [ + "libaidlcommonsupport", + ], + export_shared_lib_headers: [ + "libfmq", + "libsync", + ], + export_include_dirs: ["include"], +} + +cc_test { + name: "android.hardware.graphics.composer3-hidl2aidl-asserts", + vendor_available: true, + srcs: ["android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp"], + shared_libs: [ + "libbinder_ndk", + "libhidlbase", + "android.hardware.graphics.composer3-V1-ndk", + "android.hardware.graphics.composer@2.1", + "android.hardware.graphics.composer@2.4", + ], +} diff --git a/graphics/composer/aidl/OWNERS b/graphics/composer/aidl/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..9028d9d5451f6bc4604bfd01420d8a3a33bfb891 --- /dev/null +++ b/graphics/composer/aidl/OWNERS @@ -0,0 +1,6 @@ +# Bug component: 1075131 + +# Graphics team +adyabr@google.com +alecmouri@google.com +sumir@google.com \ No newline at end of file diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/.hash b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..b7a3f2641cb4c8660af12d20a215b859f40f663b --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/.hash @@ -0,0 +1 @@ +6e0e98f955d0bf3e7502a30fac0465e56cc98e75 diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Buffer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Buffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a33ad23323838cc66c87541fc7b7de77d2c63c19 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Buffer.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable Buffer { + int slot; + @nullable android.hardware.common.NativeHandle handle; + @nullable ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Capability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b89f7d5105e5c895aac294e40ca006dfed23f4f3 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Capability.aidl @@ -0,0 +1,43 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum Capability { + INVALID = 0, + SIDEBAND_STREAM = 1, + SKIP_CLIENT_COLOR_TRANSFORM = 2, + PRESENT_FENCE_IS_NOT_RELIABLE = 3, + SKIP_VALIDATE = 4, + BOOT_DISPLAY_CONFIG = 5, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e47ba8b5efb11c94f3eb73e6e18b9196b8d5922 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ChangedCompositionLayer { + long layer; + android.hardware.graphics.composer3.Composition composition; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9a5ca9700da2fa0601d906e9b7ec8817b6bed498 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ChangedCompositionTypes { + long display; + android.hardware.graphics.composer3.ChangedCompositionLayer[] layers; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTarget.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTarget.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7632707ec2ae198cbfb76f838a2bbdd9fae37496 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTarget.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ClientTarget { + android.hardware.graphics.composer3.Buffer buffer; + android.hardware.graphics.common.Dataspace dataspace; + android.hardware.graphics.common.Rect[] damage; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTargetProperty.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTargetProperty.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d34d1b0ab88303ac3c3c998bc2337ab005741c62 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTargetProperty.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ClientTargetProperty { + android.hardware.graphics.common.PixelFormat pixelFormat; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8fb6933c95023294e7153fe649dd6bca28eab06c --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.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 -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.graphics.composer3; +@VintfStability +parcelable ClientTargetPropertyWithBrightness { + long display; + android.hardware.graphics.composer3.ClientTargetProperty clientTargetProperty; + float brightness; + android.hardware.graphics.composer3.DimmingStage dimmingStage; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl new file mode 100644 index 0000000000000000000000000000000000000000..480a85c27f26e26ec10c3868442b1d1c26f0656b --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ClockMonotonicTimestamp { + long timestampNanos; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Color.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Color.aidl new file mode 100644 index 0000000000000000000000000000000000000000..822290908effe3c889938f40d647ba8518e20051 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Color.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 -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.graphics.composer3; +@VintfStability +parcelable Color { + float r; + float g; + float b; + float a; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ColorMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ColorMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..53852b62703b3f6583feffd602ec1c76a0064be8 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ColorMode.aidl @@ -0,0 +1,51 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum ColorMode { + NATIVE = 0, + STANDARD_BT601_625 = 1, + STANDARD_BT601_625_UNADJUSTED = 2, + STANDARD_BT601_525 = 3, + STANDARD_BT601_525_UNADJUSTED = 4, + STANDARD_BT709 = 5, + DCI_P3 = 6, + SRGB = 7, + ADOBE_RGB = 8, + DISPLAY_P3 = 9, + BT2020 = 10, + BT2100_PQ = 11, + BT2100_HLG = 12, + DISPLAY_BT2020 = 13, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/CommandError.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/CommandError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..103bfdc6899187b5628ac8261770e829d47fb4aa --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/CommandError.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable CommandError { + int commandIndex; + int errorCode; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/CommandResultPayload.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6892f061806d92acb4a9f69b989c1f7e6ab987bd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/CommandResultPayload.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +union CommandResultPayload { + android.hardware.graphics.composer3.CommandError error; + android.hardware.graphics.composer3.ChangedCompositionTypes changedCompositionTypes; + android.hardware.graphics.composer3.DisplayRequest displayRequest; + android.hardware.graphics.composer3.PresentFence presentFence; + android.hardware.graphics.composer3.ReleaseFences releaseFences; + android.hardware.graphics.composer3.PresentOrValidate presentOrValidateResult; + android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness clientTargetProperty; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Composition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d2d8f0486a8931f1b0b375ebc575b46ad1716918 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/Composition.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum Composition { + INVALID = 0, + CLIENT = 1, + DEVICE = 2, + SOLID_COLOR = 3, + CURSOR = 4, + SIDEBAND = 5, + DISPLAY_DECORATION = 6, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ContentType.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ContentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d87b7670dd599f3603804ef20a8a83068c6d86e1 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ContentType.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum ContentType { + NONE = 0, + GRAPHICS = 1, + PHOTO = 2, + CINEMA = 3, + GAME = 4, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DimmingStage.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DimmingStage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..44457f8ec1911ca75b1a76ca7a9cb13f37e8b7ad --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DimmingStage.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DimmingStage { + NONE = 0, + LINEAR = 1, + GAMMA_OETF = 2, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayAttribute.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayAttribute.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8454c40dbe3d62b7de3c11e29d03dc27b3e1c2f6 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayAttribute.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayAttribute { + INVALID = 0, + WIDTH = 1, + HEIGHT = 2, + VSYNC_PERIOD = 3, + DPI_X = 4, + DPI_Y = 5, + CONFIG_GROUP = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e765189b96ff8032743caced34cafc12cb975652 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayBrightness.aidl @@ -0,0 +1,39 @@ +/** + * Copyright 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayBrightness { + float brightness; + float brightnessNits; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6eba887aef5e5f1802fdbb0c6c97954af9d80e88 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -0,0 +1,45 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayCapability { + INVALID = 0, + SKIP_CLIENT_COLOR_TRANSFORM = 1, + DOZE = 2, + BRIGHTNESS = 3, + PROTECTED_CONTENTS = 4, + AUTO_LOW_LATENCY_MODE = 5, + SUSPEND = 6, + DISPLAY_IDLE_TIMER = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayCommand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..662240e96ba835e344caac2ed18061acb14a0e89 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayCommand.aidl @@ -0,0 +1,48 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayCommand { + long display; + android.hardware.graphics.composer3.LayerCommand[] layers; + @nullable float[] colorTransformMatrix; + @nullable android.hardware.graphics.composer3.DisplayBrightness brightness; + @nullable android.hardware.graphics.composer3.ClientTarget clientTarget; + @nullable android.hardware.graphics.composer3.Buffer virtualDisplayOutputBuffer; + @nullable android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime; + boolean validateDisplay; + boolean acceptDisplayChanges; + boolean presentDisplay; + boolean presentOrValidateDisplay; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayConnectionType.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayConnectionType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..640f82a0cdfe573565370df4cda76403909a7721 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayConnectionType.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayConnectionType { + INTERNAL = 0, + EXTERNAL = 1, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayContentSample.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayContentSample.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c62453634f8908a273821b366264f51728fc4d20 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayContentSample.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayContentSample { + long frameCount; + long[] sampleComponent0; + long[] sampleComponent1; + long[] sampleComponent2; + long[] sampleComponent3; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7c6542f52733af85d2cba5e670fdcf0f2a8014a7 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayContentSamplingAttributes { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.Dataspace dataspace; + android.hardware.graphics.composer3.FormatColorComponent componentMask; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayIdentification.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayIdentification.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a0cc9b097b2227a903cd4f1937b31bcb15b389cb --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayIdentification.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayIdentification { + byte port; + byte[] data; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..13462ce29837b7339cd1053c5c88aa3c55a1d2a2 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/DisplayRequest.aidl @@ -0,0 +1,48 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayRequest { + long display; + int mask; + android.hardware.graphics.composer3.DisplayRequest.LayerRequest[] layerRequests; + const int FLIP_CLIENT_TARGET = 1; + const int WRITE_CLIENT_TARGET_TO_OUTPUT = 2; + @VintfStability + parcelable LayerRequest { + long layer; + int mask; + const int CLEAR_CLIENT_TARGET = 1; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/FormatColorComponent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/FormatColorComponent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b737de0c836f36db13076973ea8411dfda906f5 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/FormatColorComponent.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 -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.graphics.composer3; +@Backing(type="byte") @VintfStability +enum FormatColorComponent { + FORMAT_COMPONENT_0 = 1, + FORMAT_COMPONENT_1 = 2, + FORMAT_COMPONENT_2 = 4, + FORMAT_COMPONENT_3 = 8, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/HdrCapabilities.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/HdrCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..80141d3543028198dedae28407a14c7551965893 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/HdrCapabilities.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 -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.graphics.composer3; +@VintfStability +parcelable HdrCapabilities { + android.hardware.graphics.common.Hdr[] types; + float maxLuminance; + float maxAverageLuminance; + float minLuminance; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..21b9ad88cd68151afdcad91d15ca8b996aa914b5 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposer.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +interface IComposer { + android.hardware.graphics.composer3.IComposerClient createClient(); + android.hardware.graphics.composer3.Capability[] getCapabilities(); + const int EX_NO_RESOURCES = 6; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposerCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..21620e7f31cb6e67ae702037afeb16d6b807678c --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposerCallback.aidl @@ -0,0 +1,43 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +interface IComposerCallback { + void onHotplug(long display, boolean connected); + oneway void onRefresh(long display); + oneway void onSeamlessPossible(long display); + oneway void onVsync(long display, long timestamp, int vsyncPeriodNanos); + oneway void onVsyncPeriodTimingChanged(long display, in android.hardware.graphics.composer3.VsyncPeriodChangeTimeline updatedTimeline); + oneway void onVsyncIdle(long display); +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposerClient.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b49f239ed0c91ddf1ab296ce9c9b10efa4407520 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/IComposerClient.aidl @@ -0,0 +1,89 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +interface IComposerClient { + long createLayer(long display, int bufferSlotCount); + android.hardware.graphics.composer3.VirtualDisplay createVirtualDisplay(int width, int height, android.hardware.graphics.common.PixelFormat formatHint, int outputBufferSlotCount); + void destroyLayer(long display, long layer); + void destroyVirtualDisplay(long display); + android.hardware.graphics.composer3.CommandResultPayload[] executeCommands(in android.hardware.graphics.composer3.DisplayCommand[] commands); + int getActiveConfig(long display); + android.hardware.graphics.composer3.ColorMode[] getColorModes(long display); + float[] getDataspaceSaturationMatrix(android.hardware.graphics.common.Dataspace dataspace); + int getDisplayAttribute(long display, int config, android.hardware.graphics.composer3.DisplayAttribute attribute); + android.hardware.graphics.composer3.DisplayCapability[] getDisplayCapabilities(long display); + int[] getDisplayConfigs(long display); + android.hardware.graphics.composer3.DisplayConnectionType getDisplayConnectionType(long display); + android.hardware.graphics.composer3.DisplayIdentification getDisplayIdentificationData(long display); + String getDisplayName(long display); + int getDisplayVsyncPeriod(long display); + android.hardware.graphics.composer3.DisplayContentSample getDisplayedContentSample(long display, long maxFrames, long timestamp); + android.hardware.graphics.composer3.DisplayContentSamplingAttributes getDisplayedContentSamplingAttributes(long display); + android.hardware.graphics.common.Transform getDisplayPhysicalOrientation(long display); + android.hardware.graphics.composer3.HdrCapabilities getHdrCapabilities(long display); + int getMaxVirtualDisplayCount(); + android.hardware.graphics.composer3.PerFrameMetadataKey[] getPerFrameMetadataKeys(long display); + android.hardware.graphics.composer3.ReadbackBufferAttributes getReadbackBufferAttributes(long display); + @nullable ParcelFileDescriptor getReadbackBufferFence(long display); + android.hardware.graphics.composer3.RenderIntent[] getRenderIntents(long display, android.hardware.graphics.composer3.ColorMode mode); + android.hardware.graphics.composer3.ContentType[] getSupportedContentTypes(long display); + @nullable android.hardware.graphics.common.DisplayDecorationSupport getDisplayDecorationSupport(long display); + void registerCallback(in android.hardware.graphics.composer3.IComposerCallback callback); + void setActiveConfig(long display, int config); + android.hardware.graphics.composer3.VsyncPeriodChangeTimeline setActiveConfigWithConstraints(long display, int config, in android.hardware.graphics.composer3.VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints); + void setBootDisplayConfig(long display, int config); + void clearBootDisplayConfig(long display); + int getPreferredBootDisplayConfig(long display); + void setAutoLowLatencyMode(long display, boolean on); + void setClientTargetSlotCount(long display, int clientTargetSlotCount); + void setColorMode(long display, android.hardware.graphics.composer3.ColorMode mode, android.hardware.graphics.composer3.RenderIntent intent); + void setContentType(long display, android.hardware.graphics.composer3.ContentType type); + void setDisplayedContentSamplingEnabled(long display, boolean enable, android.hardware.graphics.composer3.FormatColorComponent componentMask, long maxFrames); + void setPowerMode(long display, android.hardware.graphics.composer3.PowerMode mode); + void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in @nullable ParcelFileDescriptor releaseFence); + void setVsyncEnabled(long display, boolean enabled); + void setIdleTimerEnabled(long display, int timeoutMs); + const int EX_BAD_CONFIG = 1; + const int EX_BAD_DISPLAY = 2; + const int EX_BAD_LAYER = 3; + const int EX_BAD_PARAMETER = 4; + const int EX_RESERVED = 5; + const int EX_NO_RESOURCES = 6; + const int EX_NOT_VALIDATED = 7; + const int EX_UNSUPPORTED = 8; + const int EX_SEAMLESS_NOT_ALLOWED = 9; + const int EX_SEAMLESS_NOT_POSSIBLE = 10; + const int INVALID_CONFIGURATION = 2147483647; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/LayerBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/LayerBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a726cc12bf246c836860ed1c0b1a11c40e712090 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/LayerBrightness.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable LayerBrightness { + float brightness; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/LayerCommand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c5fac964064a0ae4d49a0993f0e1704b2cbd294 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/LayerCommand.aidl @@ -0,0 +1,57 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable LayerCommand { + long layer; + @nullable android.hardware.graphics.common.Point cursorPosition; + @nullable android.hardware.graphics.composer3.Buffer buffer; + @nullable android.hardware.graphics.common.Rect[] damage; + @nullable android.hardware.graphics.composer3.ParcelableBlendMode blendMode; + @nullable android.hardware.graphics.composer3.Color color; + @nullable android.hardware.graphics.composer3.ParcelableComposition composition; + @nullable android.hardware.graphics.composer3.ParcelableDataspace dataspace; + @nullable android.hardware.graphics.common.Rect displayFrame; + @nullable android.hardware.graphics.composer3.PlaneAlpha planeAlpha; + @nullable android.hardware.common.NativeHandle sidebandStream; + @nullable android.hardware.graphics.common.FRect sourceCrop; + @nullable android.hardware.graphics.composer3.ParcelableTransform transform; + @nullable android.hardware.graphics.common.Rect[] visibleRegion; + @nullable android.hardware.graphics.composer3.ZOrder z; + @nullable float[] colorTransform; + @nullable android.hardware.graphics.composer3.LayerBrightness brightness; + @nullable android.hardware.graphics.composer3.PerFrameMetadata[] perFrameMetadata; + @nullable android.hardware.graphics.composer3.PerFrameMetadataBlob[] perFrameMetadataBlob; + @nullable android.hardware.graphics.common.Rect[] blockingRegion; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableBlendMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableBlendMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f1fee5f376164b84a86b5e1ee8c2388f6f972712 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableBlendMode.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableBlendMode { + android.hardware.graphics.common.BlendMode blendMode; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableComposition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableComposition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..98fbb665e2c552c360c33f12ed127ef1c76a6bb6 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableComposition.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableComposition { + android.hardware.graphics.composer3.Composition composition; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableDataspace.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableDataspace.aidl new file mode 100644 index 0000000000000000000000000000000000000000..76ecf85b9fce89e1bc74e46c2bdf5179e102b263 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableDataspace.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableDataspace { + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableTransform.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableTransform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b673656438560bce36c6aa10f3a34ea475256b1d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ParcelableTransform.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableTransform { + android.hardware.graphics.common.Transform transform; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadata.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd1f3513810a3ceaf90b1eba0697c8255b2b47c7 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadata.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PerFrameMetadata { + android.hardware.graphics.composer3.PerFrameMetadataKey key; + float value; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c1e74d9e3dc55bf6ac2aa48da1d088d21aa4189a --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PerFrameMetadataBlob { + android.hardware.graphics.composer3.PerFrameMetadataKey key; + byte[] blob; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8722f878fe385474a4f1581dbf26b20bc1873e78 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl @@ -0,0 +1,50 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum PerFrameMetadataKey { + DISPLAY_RED_PRIMARY_X = 0, + DISPLAY_RED_PRIMARY_Y = 1, + DISPLAY_GREEN_PRIMARY_X = 2, + DISPLAY_GREEN_PRIMARY_Y = 3, + DISPLAY_BLUE_PRIMARY_X = 4, + DISPLAY_BLUE_PRIMARY_Y = 5, + WHITE_POINT_X = 6, + WHITE_POINT_Y = 7, + MAX_LUMINANCE = 8, + MIN_LUMINANCE = 9, + MAX_CONTENT_LIGHT_LEVEL = 10, + MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, + HDR10_PLUS_SEI = 12, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PlaneAlpha.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PlaneAlpha.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c48c2a8a34336258ea5bb9891d896fcd8e7f06ad --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PlaneAlpha.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PlaneAlpha { + float alpha; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PowerMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PowerMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f587d4dfa8e39d2befdeed92d04fa2d4fd856bfd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PowerMode.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum PowerMode { + OFF = 0, + DOZE = 1, + DOZE_SUSPEND = 3, + ON = 2, + ON_SUSPEND = 4, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PresentFence.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PresentFence.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3bb09cdb34022964b5d15073c9b77ffb994ab7e0 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PresentFence.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PresentFence { + long display; + ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PresentOrValidate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e6ddeba784cfde7aff49aaf6112431eaf3adb635 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/PresentOrValidate.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PresentOrValidate { + long display; + android.hardware.graphics.composer3.PresentOrValidate.Result result; + @VintfStability + enum Result { + Validated = 0, + Presented = 1, + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bb51bdc04a703dd0215e7c859097fe3aab585be4 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ReadbackBufferAttributes { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ReleaseFences.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ReleaseFences.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d62366125000faa295f040039e563374ffd294f5 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ReleaseFences.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ReleaseFences { + long display; + android.hardware.graphics.composer3.ReleaseFences.Layer[] layers; + @VintfStability + parcelable Layer { + long layer; + ParcelFileDescriptor fence; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/RenderIntent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/RenderIntent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5670c106555550ca07da61a0a6f9d12cdbae07a0 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/RenderIntent.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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum RenderIntent { + COLORIMETRIC = 0, + ENHANCE = 1, + TONE_MAP_COLORIMETRIC = 2, + TONE_MAP_ENHANCE = 3, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VirtualDisplay.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VirtualDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..886be2e3d0526899228a4e6d8a363824563bfd5d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VirtualDisplay.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable VirtualDisplay { + long display; + android.hardware.graphics.common.PixelFormat format; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df38c11f5851e6f233e68747262b00b9b4050a0d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable VsyncPeriodChangeConstraints { + long desiredTimeNanos; + boolean seamlessRequired; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9fb3999e3e0ca7a7049497288850165a42cc8a26 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable VsyncPeriodChangeTimeline { + long newVsyncAppliedTimeNanos; + boolean refreshRequired; + long refreshTimeNanos; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ZOrder.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ZOrder.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ea96ea3a69db4f9c1ffab81a7ec77097fd906c6a --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/1/android/hardware/graphics/composer3/ZOrder.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ZOrder { + int z; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Buffer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Buffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a33ad23323838cc66c87541fc7b7de77d2c63c19 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Buffer.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable Buffer { + int slot; + @nullable android.hardware.common.NativeHandle handle; + @nullable ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b89f7d5105e5c895aac294e40ca006dfed23f4f3 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl @@ -0,0 +1,43 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum Capability { + INVALID = 0, + SIDEBAND_STREAM = 1, + SKIP_CLIENT_COLOR_TRANSFORM = 2, + PRESENT_FENCE_IS_NOT_RELIABLE = 3, + SKIP_VALIDATE = 4, + BOOT_DISPLAY_CONFIG = 5, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e47ba8b5efb11c94f3eb73e6e18b9196b8d5922 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ChangedCompositionLayer { + long layer; + android.hardware.graphics.composer3.Composition composition; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9a5ca9700da2fa0601d906e9b7ec8817b6bed498 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ChangedCompositionTypes { + long display; + android.hardware.graphics.composer3.ChangedCompositionLayer[] layers; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTarget.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTarget.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7632707ec2ae198cbfb76f838a2bbdd9fae37496 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTarget.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ClientTarget { + android.hardware.graphics.composer3.Buffer buffer; + android.hardware.graphics.common.Dataspace dataspace; + android.hardware.graphics.common.Rect[] damage; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetProperty.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetProperty.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d34d1b0ab88303ac3c3c998bc2337ab005741c62 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetProperty.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ClientTargetProperty { + android.hardware.graphics.common.PixelFormat pixelFormat; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8fb6933c95023294e7153fe649dd6bca28eab06c --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.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 -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.graphics.composer3; +@VintfStability +parcelable ClientTargetPropertyWithBrightness { + long display; + android.hardware.graphics.composer3.ClientTargetProperty clientTargetProperty; + float brightness; + android.hardware.graphics.composer3.DimmingStage dimmingStage; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl new file mode 100644 index 0000000000000000000000000000000000000000..480a85c27f26e26ec10c3868442b1d1c26f0656b --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ClockMonotonicTimestamp { + long timestampNanos; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Color.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Color.aidl new file mode 100644 index 0000000000000000000000000000000000000000..822290908effe3c889938f40d647ba8518e20051 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Color.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 -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.graphics.composer3; +@VintfStability +parcelable Color { + float r; + float g; + float b; + float a; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..53852b62703b3f6583feffd602ec1c76a0064be8 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ColorMode.aidl @@ -0,0 +1,51 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum ColorMode { + NATIVE = 0, + STANDARD_BT601_625 = 1, + STANDARD_BT601_625_UNADJUSTED = 2, + STANDARD_BT601_525 = 3, + STANDARD_BT601_525_UNADJUSTED = 4, + STANDARD_BT709 = 5, + DCI_P3 = 6, + SRGB = 7, + ADOBE_RGB = 8, + DISPLAY_P3 = 9, + BT2020 = 10, + BT2100_PQ = 11, + BT2100_HLG = 12, + DISPLAY_BT2020 = 13, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandError.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..103bfdc6899187b5628ac8261770e829d47fb4aa --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandError.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable CommandError { + int commandIndex; + int errorCode; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandResultPayload.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6892f061806d92acb4a9f69b989c1f7e6ab987bd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandResultPayload.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +union CommandResultPayload { + android.hardware.graphics.composer3.CommandError error; + android.hardware.graphics.composer3.ChangedCompositionTypes changedCompositionTypes; + android.hardware.graphics.composer3.DisplayRequest displayRequest; + android.hardware.graphics.composer3.PresentFence presentFence; + android.hardware.graphics.composer3.ReleaseFences releaseFences; + android.hardware.graphics.composer3.PresentOrValidate presentOrValidateResult; + android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness clientTargetProperty; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d2d8f0486a8931f1b0b375ebc575b46ad1716918 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum Composition { + INVALID = 0, + CLIENT = 1, + DEVICE = 2, + SOLID_COLOR = 3, + CURSOR = 4, + SIDEBAND = 5, + DISPLAY_DECORATION = 6, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ContentType.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ContentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d87b7670dd599f3603804ef20a8a83068c6d86e1 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ContentType.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum ContentType { + NONE = 0, + GRAPHICS = 1, + PHOTO = 2, + CINEMA = 3, + GAME = 4, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DimmingStage.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DimmingStage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..44457f8ec1911ca75b1a76ca7a9cb13f37e8b7ad --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DimmingStage.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DimmingStage { + NONE = 0, + LINEAR = 1, + GAMMA_OETF = 2, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayAttribute.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayAttribute.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8454c40dbe3d62b7de3c11e29d03dc27b3e1c2f6 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayAttribute.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayAttribute { + INVALID = 0, + WIDTH = 1, + HEIGHT = 2, + VSYNC_PERIOD = 3, + DPI_X = 4, + DPI_Y = 5, + CONFIG_GROUP = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e765189b96ff8032743caced34cafc12cb975652 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayBrightness.aidl @@ -0,0 +1,39 @@ +/** + * Copyright 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayBrightness { + float brightness; + float brightnessNits; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6eba887aef5e5f1802fdbb0c6c97954af9d80e88 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -0,0 +1,45 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayCapability { + INVALID = 0, + SKIP_CLIENT_COLOR_TRANSFORM = 1, + DOZE = 2, + BRIGHTNESS = 3, + PROTECTED_CONTENTS = 4, + AUTO_LOW_LATENCY_MODE = 5, + SUSPEND = 6, + DISPLAY_IDLE_TIMER = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..662240e96ba835e344caac2ed18061acb14a0e89 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCommand.aidl @@ -0,0 +1,48 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayCommand { + long display; + android.hardware.graphics.composer3.LayerCommand[] layers; + @nullable float[] colorTransformMatrix; + @nullable android.hardware.graphics.composer3.DisplayBrightness brightness; + @nullable android.hardware.graphics.composer3.ClientTarget clientTarget; + @nullable android.hardware.graphics.composer3.Buffer virtualDisplayOutputBuffer; + @nullable android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime; + boolean validateDisplay; + boolean acceptDisplayChanges; + boolean presentDisplay; + boolean presentOrValidateDisplay; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayConnectionType.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayConnectionType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..640f82a0cdfe573565370df4cda76403909a7721 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayConnectionType.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayConnectionType { + INTERNAL = 0, + EXTERNAL = 1, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayContentSample.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayContentSample.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c62453634f8908a273821b366264f51728fc4d20 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayContentSample.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayContentSample { + long frameCount; + long[] sampleComponent0; + long[] sampleComponent1; + long[] sampleComponent2; + long[] sampleComponent3; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7c6542f52733af85d2cba5e670fdcf0f2a8014a7 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayContentSamplingAttributes { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.Dataspace dataspace; + android.hardware.graphics.composer3.FormatColorComponent componentMask; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayIdentification.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayIdentification.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a0cc9b097b2227a903cd4f1937b31bcb15b389cb --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayIdentification.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayIdentification { + byte port; + byte[] data; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..13462ce29837b7339cd1053c5c88aa3c55a1d2a2 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl @@ -0,0 +1,48 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable DisplayRequest { + long display; + int mask; + android.hardware.graphics.composer3.DisplayRequest.LayerRequest[] layerRequests; + const int FLIP_CLIENT_TARGET = 1; + const int WRITE_CLIENT_TARGET_TO_OUTPUT = 2; + @VintfStability + parcelable LayerRequest { + long layer; + int mask; + const int CLEAR_CLIENT_TARGET = 1; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b737de0c836f36db13076973ea8411dfda906f5 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.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 -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.graphics.composer3; +@Backing(type="byte") @VintfStability +enum FormatColorComponent { + FORMAT_COMPONENT_0 = 1, + FORMAT_COMPONENT_1 = 2, + FORMAT_COMPONENT_2 = 4, + FORMAT_COMPONENT_3 = 8, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/HdrCapabilities.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/HdrCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..80141d3543028198dedae28407a14c7551965893 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/HdrCapabilities.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 -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.graphics.composer3; +@VintfStability +parcelable HdrCapabilities { + android.hardware.graphics.common.Hdr[] types; + float maxLuminance; + float maxAverageLuminance; + float minLuminance; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..21b9ad88cd68151afdcad91d15ca8b996aa914b5 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposer.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +interface IComposer { + android.hardware.graphics.composer3.IComposerClient createClient(); + android.hardware.graphics.composer3.Capability[] getCapabilities(); + const int EX_NO_RESOURCES = 6; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..21620e7f31cb6e67ae702037afeb16d6b807678c --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl @@ -0,0 +1,43 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +interface IComposerCallback { + void onHotplug(long display, boolean connected); + oneway void onRefresh(long display); + oneway void onSeamlessPossible(long display); + oneway void onVsync(long display, long timestamp, int vsyncPeriodNanos); + oneway void onVsyncPeriodTimingChanged(long display, in android.hardware.graphics.composer3.VsyncPeriodChangeTimeline updatedTimeline); + oneway void onVsyncIdle(long display); +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b49f239ed0c91ddf1ab296ce9c9b10efa4407520 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl @@ -0,0 +1,89 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +interface IComposerClient { + long createLayer(long display, int bufferSlotCount); + android.hardware.graphics.composer3.VirtualDisplay createVirtualDisplay(int width, int height, android.hardware.graphics.common.PixelFormat formatHint, int outputBufferSlotCount); + void destroyLayer(long display, long layer); + void destroyVirtualDisplay(long display); + android.hardware.graphics.composer3.CommandResultPayload[] executeCommands(in android.hardware.graphics.composer3.DisplayCommand[] commands); + int getActiveConfig(long display); + android.hardware.graphics.composer3.ColorMode[] getColorModes(long display); + float[] getDataspaceSaturationMatrix(android.hardware.graphics.common.Dataspace dataspace); + int getDisplayAttribute(long display, int config, android.hardware.graphics.composer3.DisplayAttribute attribute); + android.hardware.graphics.composer3.DisplayCapability[] getDisplayCapabilities(long display); + int[] getDisplayConfigs(long display); + android.hardware.graphics.composer3.DisplayConnectionType getDisplayConnectionType(long display); + android.hardware.graphics.composer3.DisplayIdentification getDisplayIdentificationData(long display); + String getDisplayName(long display); + int getDisplayVsyncPeriod(long display); + android.hardware.graphics.composer3.DisplayContentSample getDisplayedContentSample(long display, long maxFrames, long timestamp); + android.hardware.graphics.composer3.DisplayContentSamplingAttributes getDisplayedContentSamplingAttributes(long display); + android.hardware.graphics.common.Transform getDisplayPhysicalOrientation(long display); + android.hardware.graphics.composer3.HdrCapabilities getHdrCapabilities(long display); + int getMaxVirtualDisplayCount(); + android.hardware.graphics.composer3.PerFrameMetadataKey[] getPerFrameMetadataKeys(long display); + android.hardware.graphics.composer3.ReadbackBufferAttributes getReadbackBufferAttributes(long display); + @nullable ParcelFileDescriptor getReadbackBufferFence(long display); + android.hardware.graphics.composer3.RenderIntent[] getRenderIntents(long display, android.hardware.graphics.composer3.ColorMode mode); + android.hardware.graphics.composer3.ContentType[] getSupportedContentTypes(long display); + @nullable android.hardware.graphics.common.DisplayDecorationSupport getDisplayDecorationSupport(long display); + void registerCallback(in android.hardware.graphics.composer3.IComposerCallback callback); + void setActiveConfig(long display, int config); + android.hardware.graphics.composer3.VsyncPeriodChangeTimeline setActiveConfigWithConstraints(long display, int config, in android.hardware.graphics.composer3.VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints); + void setBootDisplayConfig(long display, int config); + void clearBootDisplayConfig(long display); + int getPreferredBootDisplayConfig(long display); + void setAutoLowLatencyMode(long display, boolean on); + void setClientTargetSlotCount(long display, int clientTargetSlotCount); + void setColorMode(long display, android.hardware.graphics.composer3.ColorMode mode, android.hardware.graphics.composer3.RenderIntent intent); + void setContentType(long display, android.hardware.graphics.composer3.ContentType type); + void setDisplayedContentSamplingEnabled(long display, boolean enable, android.hardware.graphics.composer3.FormatColorComponent componentMask, long maxFrames); + void setPowerMode(long display, android.hardware.graphics.composer3.PowerMode mode); + void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in @nullable ParcelFileDescriptor releaseFence); + void setVsyncEnabled(long display, boolean enabled); + void setIdleTimerEnabled(long display, int timeoutMs); + const int EX_BAD_CONFIG = 1; + const int EX_BAD_DISPLAY = 2; + const int EX_BAD_LAYER = 3; + const int EX_BAD_PARAMETER = 4; + const int EX_RESERVED = 5; + const int EX_NO_RESOURCES = 6; + const int EX_NOT_VALIDATED = 7; + const int EX_UNSUPPORTED = 8; + const int EX_SEAMLESS_NOT_ALLOWED = 9; + const int EX_SEAMLESS_NOT_POSSIBLE = 10; + const int INVALID_CONFIGURATION = 2147483647; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a726cc12bf246c836860ed1c0b1a11c40e712090 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerBrightness.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable LayerBrightness { + float brightness; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c5fac964064a0ae4d49a0993f0e1704b2cbd294 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl @@ -0,0 +1,57 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable LayerCommand { + long layer; + @nullable android.hardware.graphics.common.Point cursorPosition; + @nullable android.hardware.graphics.composer3.Buffer buffer; + @nullable android.hardware.graphics.common.Rect[] damage; + @nullable android.hardware.graphics.composer3.ParcelableBlendMode blendMode; + @nullable android.hardware.graphics.composer3.Color color; + @nullable android.hardware.graphics.composer3.ParcelableComposition composition; + @nullable android.hardware.graphics.composer3.ParcelableDataspace dataspace; + @nullable android.hardware.graphics.common.Rect displayFrame; + @nullable android.hardware.graphics.composer3.PlaneAlpha planeAlpha; + @nullable android.hardware.common.NativeHandle sidebandStream; + @nullable android.hardware.graphics.common.FRect sourceCrop; + @nullable android.hardware.graphics.composer3.ParcelableTransform transform; + @nullable android.hardware.graphics.common.Rect[] visibleRegion; + @nullable android.hardware.graphics.composer3.ZOrder z; + @nullable float[] colorTransform; + @nullable android.hardware.graphics.composer3.LayerBrightness brightness; + @nullable android.hardware.graphics.composer3.PerFrameMetadata[] perFrameMetadata; + @nullable android.hardware.graphics.composer3.PerFrameMetadataBlob[] perFrameMetadataBlob; + @nullable android.hardware.graphics.common.Rect[] blockingRegion; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableBlendMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableBlendMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f1fee5f376164b84a86b5e1ee8c2388f6f972712 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableBlendMode.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableBlendMode { + android.hardware.graphics.common.BlendMode blendMode; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableComposition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableComposition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..98fbb665e2c552c360c33f12ed127ef1c76a6bb6 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableComposition.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableComposition { + android.hardware.graphics.composer3.Composition composition; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableDataspace.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableDataspace.aidl new file mode 100644 index 0000000000000000000000000000000000000000..76ecf85b9fce89e1bc74e46c2bdf5179e102b263 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableDataspace.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableDataspace { + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableTransform.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableTransform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b673656438560bce36c6aa10f3a34ea475256b1d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ParcelableTransform.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ParcelableTransform { + android.hardware.graphics.common.Transform transform; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadata.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cd1f3513810a3ceaf90b1eba0697c8255b2b47c7 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadata.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PerFrameMetadata { + android.hardware.graphics.composer3.PerFrameMetadataKey key; + float value; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c1e74d9e3dc55bf6ac2aa48da1d088d21aa4189a --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PerFrameMetadataBlob { + android.hardware.graphics.composer3.PerFrameMetadataKey key; + byte[] blob; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8722f878fe385474a4f1581dbf26b20bc1873e78 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl @@ -0,0 +1,50 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum PerFrameMetadataKey { + DISPLAY_RED_PRIMARY_X = 0, + DISPLAY_RED_PRIMARY_Y = 1, + DISPLAY_GREEN_PRIMARY_X = 2, + DISPLAY_GREEN_PRIMARY_Y = 3, + DISPLAY_BLUE_PRIMARY_X = 4, + DISPLAY_BLUE_PRIMARY_Y = 5, + WHITE_POINT_X = 6, + WHITE_POINT_Y = 7, + MAX_LUMINANCE = 8, + MIN_LUMINANCE = 9, + MAX_CONTENT_LIGHT_LEVEL = 10, + MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, + HDR10_PLUS_SEI = 12, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PlaneAlpha.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PlaneAlpha.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c48c2a8a34336258ea5bb9891d896fcd8e7f06ad --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PlaneAlpha.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PlaneAlpha { + float alpha; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PowerMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PowerMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f587d4dfa8e39d2befdeed92d04fa2d4fd856bfd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PowerMode.aidl @@ -0,0 +1,42 @@ +/** + * 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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum PowerMode { + OFF = 0, + DOZE = 1, + DOZE_SUSPEND = 3, + ON = 2, + ON_SUSPEND = 4, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentFence.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentFence.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3bb09cdb34022964b5d15073c9b77ffb994ab7e0 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentFence.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PresentFence { + long display; + ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e6ddeba784cfde7aff49aaf6112431eaf3adb635 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable PresentOrValidate { + long display; + android.hardware.graphics.composer3.PresentOrValidate.Result result; + @VintfStability + enum Result { + Validated = 0, + Presented = 1, + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bb51bdc04a703dd0215e7c859097fe3aab585be4 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ReadbackBufferAttributes { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ReleaseFences.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ReleaseFences.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d62366125000faa295f040039e563374ffd294f5 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ReleaseFences.aidl @@ -0,0 +1,44 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ReleaseFences { + long display; + android.hardware.graphics.composer3.ReleaseFences.Layer[] layers; + @VintfStability + parcelable Layer { + long layer; + ParcelFileDescriptor fence; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RenderIntent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RenderIntent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5670c106555550ca07da61a0a6f9d12cdbae07a0 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RenderIntent.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 -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.graphics.composer3; +@Backing(type="int") @VintfStability +enum RenderIntent { + COLORIMETRIC = 0, + ENHANCE = 1, + TONE_MAP_COLORIMETRIC = 2, + TONE_MAP_ENHANCE = 3, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VirtualDisplay.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VirtualDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..886be2e3d0526899228a4e6d8a363824563bfd5d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VirtualDisplay.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable VirtualDisplay { + long display; + android.hardware.graphics.common.PixelFormat format; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl new file mode 100644 index 0000000000000000000000000000000000000000..df38c11f5851e6f233e68747262b00b9b4050a0d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl @@ -0,0 +1,39 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable VsyncPeriodChangeConstraints { + long desiredTimeNanos; + boolean seamlessRequired; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9fb3999e3e0ca7a7049497288850165a42cc8a26 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl @@ -0,0 +1,40 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable VsyncPeriodChangeTimeline { + long newVsyncAppliedTimeNanos; + boolean refreshRequired; + long refreshTimeNanos; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ZOrder.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ZOrder.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ea96ea3a69db4f9c1ffab81a7ec77097fd906c6a --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ZOrder.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.graphics.composer3; +@VintfStability +parcelable ZOrder { + int z; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Buffer.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Buffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..415a9b61c175e8493504e250f5e11265da3a0713 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Buffer.aidl @@ -0,0 +1,44 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.common.NativeHandle; + +@VintfStability +parcelable Buffer { + /** + * Buffer slot in the range [0, bufferSlotCount) where bufferSlotCount is + * the parameter used when the layer was created. + * @see IComposer.createLayer. + * The slot is used as a buffer caching mechanism. When the Buffer.handle + * is null, the implementation uses the previous buffer associated with this + * slot. + */ + int slot; + + /** + * Buffer Handle. Can be null if this is the same buffer that was sent + * previously on this slot. + */ + @nullable NativeHandle handle; + + /** + * Buffer fence that represents when it is safe to access the buffer. + * A null fence indicates that the buffer can be accessed immediately. + */ + @nullable ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2f9eab937cf4cc7c7e892e9874973c83b604e0c6 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl @@ -0,0 +1,69 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Optional capabilities which may be supported by some devices. The + * particular set of supported capabilities for a given device may be + * retrieved using getCapabilities. + */ +@VintfStability +@Backing(type="int") +enum Capability { + INVALID = 0, + /** + * Specifies that the device supports sideband stream layers, for + * which buffer content updates and other synchronization will not be + * provided through the usual validate/present cycle and must be + * handled by an external implementation-defined mechanism. Only + * changes to layer state (such as position, size, etc.) need to be + * performed through the validate/present cycle. + */ + SIDEBAND_STREAM = 1, + /** + * Specifies that the device will apply a color transform even when + * either the client or the device has chosen that all layers should + * be composed by the client. This will prevent the client from + * applying the color transform during its composition step. + */ + SKIP_CLIENT_COLOR_TRANSFORM = 2, + /** + * Specifies that the present fence must not be used as an accurate + * representation of the actual present time of a frame. + */ + PRESENT_FENCE_IS_NOT_RELIABLE = 3, + /** + * Specifies that a device is able to skip the validateDisplay call before + * receiving a call to presentDisplay. The client will always skip + * validateDisplay and try to call presentDisplay regardless of the changes + * in the properties of the layers. If the device returns anything else than + * no error, it will call validateDisplay then presentDisplay again. + * For this capability to be worthwhile the device implementation of + * presentDisplay should fail as fast as possible in the case a + * validateDisplay step is needed. + */ + SKIP_VALIDATE = 4, + + /** + * Specifies that the device supports setting a display configuration that + * the device should boot at. + * @see IComposerClient.setBootDisplayConfig + * @see IComposerClient.clearBootDisplayConfig + * @see IComposerClient.getPreferredBootDisplayConfig + */ + BOOT_DISPLAY_CONFIG = 5, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fb25163aa410e79866655ee29547aabb137a5f82 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl @@ -0,0 +1,33 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.Composition; + +@VintfStability +parcelable ChangedCompositionLayer { + /** + * The layer which this commands refers to. + * @see IComposer.createLayer + */ + long layer; + + /** + * The new composition type. + */ + Composition composition; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ddd45b7fdd3c74a6ade1309e06144d1dee9886d8 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl @@ -0,0 +1,34 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.ChangedCompositionLayer; +import android.hardware.graphics.composer3.Composition; + +@VintfStability +parcelable ChangedCompositionTypes { + /** + * The display which this commands refers to. + * @see IComposer.createDisplay + */ + long display; + + /** + * Indicates which layers has composition changes + */ + ChangedCompositionLayer[] layers; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTarget.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTarget.aidl new file mode 100644 index 0000000000000000000000000000000000000000..56488d56c3abef56f4f8f22e96c0bbcdfa50bf1f --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTarget.aidl @@ -0,0 +1,39 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.common.Dataspace; +import android.hardware.graphics.common.Rect; +import android.hardware.graphics.composer3.Buffer; + +@VintfStability +parcelable ClientTarget { + /** + * Client target Buffer + */ + Buffer buffer; + + /** + * The dataspace of the buffer, as described in LayerCommand.dataspace. + */ + Dataspace dataspace; + + /** + * The surface damage regions. + */ + Rect[] damage; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetProperty.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetProperty.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b4d588749924ccbac6062d673b75e2798464e4e5 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetProperty.aidl @@ -0,0 +1,23 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable ClientTargetProperty { + android.hardware.graphics.common.PixelFormat pixelFormat; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ba6fe97c3d5d6bedd8d240e5136adcd9b8fc63be --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl @@ -0,0 +1,53 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.ClientTargetProperty; +import android.hardware.graphics.composer3.DimmingStage; + +@VintfStability +parcelable ClientTargetPropertyWithBrightness { + /** + * The display which this commands refers to. + * @see IComposer.createDisplay + */ + long display; + + /** + * The Client target property. + */ + ClientTargetProperty clientTargetProperty; + + /** + * The brightness as described in CommandResultPayload.clientTargetProperty + */ + float brightness; + + /** + * The stage in which dimming operations should be performed when compositing + * the client target. + * Note that with a COLORIMETRIC RenderIntent, DimmingSpace must be LINEAR. That is, dimming + * is defined to occur in linear space. + * However, some composer implementations may, with other vendor-defined RenderIntents, + * configure their hardware such as image quality adjustments is intended to occur after + * composition. In this scenario, if the dimming operation were applied in linear space, + * then the resulting dimming operation may comepl those image quality adjustments to + * incorrectly alter the gamma curve. To avoid this issue, those implementations must opt to + * dim in gamma space. + */ + DimmingStage dimmingStage; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0cfd1c4c130100c6ab09b96ff2628b6869437204 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl @@ -0,0 +1,25 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Represents a nanoseconds timestamp in CLOCK_MONOTONIC. + */ +@VintfStability +parcelable ClockMonotonicTimestamp { + long timestampNanos; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Color.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Color.aidl new file mode 100644 index 0000000000000000000000000000000000000000..151a8540c93cfc84894c088d1779477a7a671af9 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Color.aidl @@ -0,0 +1,28 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Color representation as a floating point number in the range [0.0 - 1.0] + */ +@VintfStability +parcelable Color { + float r; + float g; + float b; + float a; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ColorMode.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ColorMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c13d207944a2caf136e83335825a262fc9cf1a35 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ColorMode.aidl @@ -0,0 +1,283 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +@Backing(type="int") +enum ColorMode { + /** + * DEFAULT is the "native" gamut of the display. + * White Point: Vendor/OEM defined + * Panel Gamma: Vendor/OEM defined (typically 2.2) + * Rendering Intent: Vendor/OEM defined (typically 'enhanced') + */ + NATIVE = 0, + /** + * STANDARD_BT601_625 corresponds with display + * settings that implement the ITU-R Recommendation BT.601 + * or Rec 601. Using 625 line version + * Rendering Intent: Colorimetric + * Primaries: + * x y + * green 0.290 0.600 + * blue 0.150 0.060 + * red 0.640 0.330 + * white (D65) 0.3127 0.3290 + * + * KR = 0.299, KB = 0.114. This adjusts the luminance interpretation + * for RGB conversion from the one purely determined by the primaries + * to minimize the color shift into RGB space that uses BT.709 + * primaries. + * + * Gamma Correction (GC): + * + * if Vlinear < 0.018 + * Vnonlinear = 4.500 * Vlinear + * else + * Vnonlinear = 1.099 * (Vlinear)^(0.45) – 0.099 + */ + STANDARD_BT601_625 = 1, + /** + * Primaries: + * x y + * green 0.290 0.600 + * blue 0.150 0.060 + * red 0.640 0.330 + * white (D65) 0.3127 0.3290 + * + * Use the unadjusted KR = 0.222, KB = 0.071 luminance interpretation + * for RGB conversion. + * + * Gamma Correction (GC): + * + * if Vlinear < 0.018 + * Vnonlinear = 4.500 * Vlinear + * else + * Vnonlinear = 1.099 * (Vlinear)^(0.45) – 0.099 + */ + STANDARD_BT601_625_UNADJUSTED = 2, + /** + * Primaries: + * x y + * green 0.310 0.595 + * blue 0.155 0.070 + * red 0.630 0.340 + * white (D65) 0.3127 0.3290 + * + * KR = 0.299, KB = 0.114. This adjusts the luminance interpretation + * for RGB conversion from the one purely determined by the primaries + * to minimize the color shift into RGB space that uses BT.709 + * primaries. + * + * Gamma Correction (GC): + * + * if Vlinear < 0.018 + * Vnonlinear = 4.500 * Vlinear + * else + * Vnonlinear = 1.099 * (Vlinear)^(0.45) – 0.099 + */ + STANDARD_BT601_525 = 3, + /** + * Primaries: + * x y + * green 0.310 0.595 + * blue 0.155 0.070 + * red 0.630 0.340 + * white (D65) 0.3127 0.3290 + * + * Use the unadjusted KR = 0.212, KB = 0.087 luminance interpretation + * for RGB conversion (as in SMPTE 240M). + * + * Gamma Correction (GC): + * + * if Vlinear < 0.018 + * Vnonlinear = 4.500 * Vlinear + * else + * Vnonlinear = 1.099 * (Vlinear)^(0.45) – 0.099 + */ + STANDARD_BT601_525_UNADJUSTED = 4, + /** + * REC709 corresponds with display settings that implement + * the ITU-R Recommendation BT.709 / Rec. 709 for high-definition television. + * Rendering Intent: Colorimetric + * Primaries: + * x y + * green 0.300 0.600 + * blue 0.150 0.060 + * red 0.640 0.330 + * white (D65) 0.3127 0.3290 + * + * HDTV REC709 Inverse Gamma Correction (IGC): V represents normalized + * (with [0 to 1] range) value of R, G, or B. + * + * if Vnonlinear < 0.081 + * Vlinear = Vnonlinear / 4.5 + * else + * Vlinear = ((Vnonlinear + 0.099) / 1.099) ^ (1/0.45) + * + * HDTV REC709 Gamma Correction (GC): + * + * if Vlinear < 0.018 + * Vnonlinear = 4.5 * Vlinear + * else + * Vnonlinear = 1.099 * (Vlinear) ^ 0.45 – 0.099 + */ + STANDARD_BT709 = 5, + /** + * DCI_P3 corresponds with display settings that implement + * SMPTE EG 432-1 and SMPTE RP 431-2 + * Rendering Intent: Colorimetric + * Primaries: + * x y + * green 0.265 0.690 + * blue 0.150 0.060 + * red 0.680 0.320 + * white (D65) 0.3127 0.3290 + * + * Gamma: 2.6 + */ + DCI_P3 = 6, + /** + * SRGB corresponds with display settings that implement + * the sRGB color space. Uses the same primaries as ITU-R Recommendation + * BT.709 + * Rendering Intent: Colorimetric + * Primaries: + * x y + * green 0.300 0.600 + * blue 0.150 0.060 + * red 0.640 0.330 + * white (D65) 0.3127 0.3290 + * + * PC/Internet (sRGB) Inverse Gamma Correction (IGC): + * + * if Vnonlinear ≤ 0.03928 + * Vlinear = Vnonlinear / 12.92 + * else + * Vlinear = ((Vnonlinear + 0.055)/1.055) ^ 2.4 + * + * PC/Internet (sRGB) Gamma Correction (GC): + * + * if Vlinear ≤ 0.0031308 + * Vnonlinear = 12.92 * Vlinear + * else + * Vnonlinear = 1.055 * (Vlinear)^(1/2.4) – 0.055 + */ + SRGB = 7, + /** + * ADOBE_RGB corresponds with the RGB color space developed + * by Adobe Systems, Inc. in 1998. + * Rendering Intent: Colorimetric + * Primaries: + * x y + * green 0.210 0.710 + * blue 0.150 0.060 + * red 0.640 0.330 + * white (D65) 0.3127 0.3290 + * + * Gamma: 2.2 + */ + ADOBE_RGB = 8, + /** + * DISPLAY_P3 is a color space that uses the DCI_P3 primaries, + * the D65 white point and the SRGB transfer functions. + * Rendering Intent: Colorimetric + * Primaries: + * x y + * green 0.265 0.690 + * blue 0.150 0.060 + * red 0.680 0.320 + * white (D65) 0.3127 0.3290 + * + * PC/Internet (sRGB) Gamma Correction (GC): + * + * if Vlinear ≤ 0.0030186 + * Vnonlinear = 12.92 * Vlinear + * else + * Vnonlinear = 1.055 * (Vlinear)^(1/2.4) – 0.055 + * + * Note: In most cases sRGB transfer function will be fine. + */ + DISPLAY_P3 = 9, + /** + * BT2020 corresponds with display settings that implement the ITU-R + * Recommendation BT.2020 / Rec. 2020 for UHDTV. + * + * Primaries: + * x y + * green 0.170 0.797 + * blue 0.131 0.046 + * red 0.708 0.292 + * white (D65) 0.3127 0.3290 + * + * Inverse Gamma Correction (IGC): V represents normalized (with [0 to 1] + * range) value of R, G, or B. + * + * if Vnonlinear < b * 4.5 + * Vlinear = Vnonlinear / 4.5 + * else + * Vlinear = ((Vnonlinear + (a - 1)) / a) ^ (1/0.45) + * + * Gamma Correction (GC): + * + * if Vlinear < b + * Vnonlinear = 4.5 * Vlinear + * else + * Vnonlinear = a * Vlinear ^ 0.45 - (a - 1) + * + * where + * + * a = 1.09929682680944, b = 0.018053968510807 + * + * For practical purposes, these a/b values can be used instead + * + * a = 1.099, b = 0.018 for 10-bit display systems + * a = 1.0993, b = 0.0181 for 12-bit display systems + */ + BT2020 = 10, + /** + * BT2100_PQ and BT2100_HLG correspond with display settings that + * implement the ITU-R Recommendation BT.2100 / Rec. 2100 for HDR TV. + * + * Primaries: + * x y + * green 0.170 0.797 + * blue 0.131 0.046 + * red 0.708 0.292 + * white (D65) 0.3127 0.3290 + * + * For BT2100_PQ, the transfer function is Perceptual Quantizer (PQ). For + * BT2100_HLG, the transfer function is Hybrid Log-Gamma (HLG). + */ + BT2100_PQ = 11, + BT2100_HLG = 12, + /** + * DISPLAY_BT2020 corresponds with display settings that implement the ITU-R + * Recommendation BT.2020 / Rec. 2020 for UHDTV, but specifies an SRGB + * transfer function. + * + * Primaries: + * x y + * green 0.170 0.797 + * blue 0.131 0.046 + * red 0.708 0.292 + * white (D65) 0.3127 0.3290 + * + * Transfer Function is sRGB + */ + DISPLAY_BT2020 = 13, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandError.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ea48600bf905b89c2ed9df5be1eedcbf8dd1ef5e --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandError.aidl @@ -0,0 +1,29 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable CommandError { + /** + * The index in the command payload array. + */ + int commandIndex; + /** + * The error generated by the command. Can be one of the IComposerClient.EX_* + */ + int errorCode; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl new file mode 100644 index 0000000000000000000000000000000000000000..106fd87ebddbbc36a7fece81877129a0d09fce91 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl @@ -0,0 +1,95 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.ChangedCompositionTypes; +import android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness; +import android.hardware.graphics.composer3.CommandError; +import android.hardware.graphics.composer3.DisplayRequest; +import android.hardware.graphics.composer3.PresentFence; +import android.hardware.graphics.composer3.PresentOrValidate; +import android.hardware.graphics.composer3.ReleaseFences; + +@VintfStability +union CommandResultPayload { + /** + * Indicates an error generated by a command. + */ + CommandError error; + + /** + * Sets the layers for which the device requires a different composition + * type than had been set prior to the last call to VALIDATE_DISPLAY. The + * client must either update its state with these types and call + * ACCEPT_DISPLAY_CHANGES, or must set new types and attempt to validate + * the display again. + */ + ChangedCompositionTypes changedCompositionTypes; + + /** + * Sets the display requests and the layer requests required for the last + * validated configuration. + * + * Display requests provide information about how the client must handle + * the client target. Layer requests provide information about how the + * client must handle an individual layer. + */ + DisplayRequest displayRequest; + + /** + * Sets the present fence as a result of PRESENT_DISPLAY. For physical + * displays, this fence must be signaled at the vsync when the result + * of composition of this frame starts to appear (for video-mode panels) + * or starts to transfer to panel memory (for command-mode panels). For + * virtual displays, this fence must be signaled when writes to the output + * buffer have completed and it is safe to read from it. + */ + PresentFence presentFence; + + /** + * Sets the release fences for device layers on this display which will + * receive new buffer contents this frame. + * + * A release fence is a file descriptor referring to a sync fence object + * which must be signaled after the device has finished reading from the + * buffer presented in the prior frame. This indicates that it is safe to + * start writing to the buffer again. If a given layer's fence is not + * returned from this function, it must be assumed that the buffer + * presented on the previous frame is ready to be written. + * + * The fences returned by this function must be unique for each layer + * (even if they point to the same underlying sync object). + * + */ + ReleaseFences releaseFences; + + /** + * Sets the state of PRESENT_OR_VALIDATE_DISPLAY command. + */ + PresentOrValidate presentOrValidateResult; + + /** + * The brightness parameter describes the intended brightness space of the client target buffer. + * The brightness is in the range [0, 1], where 1 is the current brightness of the display. + * When client composition blends both HDR and SDR content, the client must composite to the + * brightness space as specified by the hardware composer. This is so that adjusting the real + * display brightness may be applied atomically with compensating the client target output. For + * instance, client-compositing a list of SDR layers requires dimming the brightness space of + * the SDR buffers when an HDR layer is simultaneously device-composited. + */ + ClientTargetPropertyWithBrightness clientTargetProperty; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82b218be3f7f1e6eb2e4b7e81913e723e1b07780 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl @@ -0,0 +1,89 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Possible composition types for a given layer. + */ +@VintfStability +@Backing(type="int") +enum Composition { + INVALID = 0, + /** + * The client must composite this layer into the client target buffer + * (provided to the device through setClientTarget). + * + * The device must not request any composition type changes for layers + * of this type. + */ + CLIENT = 1, + /** + * The device must handle the composition of this layer through a + * hardware overlay or other similar means. + * + * Upon validateDisplay, the device may request a change from this + * type to CLIENT. + */ + DEVICE = 2, + /** + * The device must render this layer using the color set through + * setLayerColor. If this functionality is not supported on a layer + * that the client sets to SOLID_COLOR, the device must request that + * the composition type of that layer is changed to CLIENT upon the + * next call to validateDisplay. + * + * Upon validateDisplay, the device may request a change from this + * type to CLIENT. + */ + SOLID_COLOR = 3, + /** + * Similar to DEVICE, but the position of this layer may also be set + * asynchronously through setCursorPosition. If this functionality is + * not supported on a layer that the client sets to CURSOR, the device + * must request that the composition type of that layer is changed to + * CLIENT upon the next call to validateDisplay. + * + * Upon validateDisplay, the device may request a change from this + * type to either DEVICE or CLIENT. Changing to DEVICE will prevent + * the use of setCursorPosition but still permit the device to + * composite the layer. + */ + CURSOR = 4, + /** + * The device must handle the composition of this layer, as well as + * its buffer updates and content synchronization. Only supported on + * devices which provide Capability.SIDEBAND_STREAM. + * + * Upon validateDisplay, the device may request a change from this + * type to either DEVICE or CLIENT, but it is unlikely that content + * will display correctly in these cases. + */ + SIDEBAND = 5, + /** + * A display decoration layer contains a buffer which is used to provide + * anti-aliasing on the cutout region and rounded corners on the top and + * bottom of a display. + * + * Only supported if the device returns a valid struct from + * getDisplayDecorationSupport. Pixels in the buffer are interpreted + * according to the DisplayDecorationSupport.alphaInterpretation. + * + * Upon validateDisplay, the device may request a change from this type + * to either DEVICE or CLIENT. + */ + DISPLAY_DECORATION = 6, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ContentType.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ContentType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..470064a0b1611ea6c59491843b551ae0067f116a --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ContentType.aidl @@ -0,0 +1,30 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +@Backing(type="int") +enum ContentType { + NONE = 0, + /** + * These modes correspond to those found in the HDMI 1.4 specification. + */ + GRAPHICS = 1, + PHOTO = 2, + CINEMA = 3, + GAME = 4, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DimmingStage.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DimmingStage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..23d5f4a007e9ce0a1b85f82b2a865330c0ed62e7 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DimmingStage.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 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. + */ + +package android.hardware.graphics.composer3; + +@VintfStability +@Backing(type="int") +enum DimmingStage { + /** + * Corresponds to if the dimming stage is not meaningful for a scene, such as + * if client composition is not requesting dimming. + */ + NONE = 0, + /** + * Dimming operations must be applied in linear optical space + */ + LINEAR = 1, + /** + * Dimming operations must be applied in gamma space, after OETF has been applied. + * Note that for this dimming operation to be perceptually correct it must also be gamma + * corrected. The framework will assume that it is able to use the gamma 2.2 + * power function for gamma correcting the dimming matrix, for simplicity of + * implementation and the fact that gamma 2.2 is close enough to typical SDR + * transfer functions that would be used for the client target. + */ + GAMMA_OETF = 2, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayAttribute.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayAttribute.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bf667850916ba57134e584841e8ed8918d48835f --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayAttribute.aidl @@ -0,0 +1,56 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.DisplayAttribute; + +/** + * Display attributes queryable through getDisplayAttribute. + */ +@VintfStability +@Backing(type="int") +enum DisplayAttribute { + INVALID = 0, + /** + * Dimensions in pixels + */ + WIDTH = 1, + HEIGHT = 2, + /** + * Vsync period in nanoseconds + */ + VSYNC_PERIOD = 3, + /** + * Dots per thousand inches (DPI * 1000). Scaling by 1000 allows these + * numbers to be stored in an int32_t without losing too much + * precision. If the DPI for a configuration is unavailable or is + * considered unreliable, the device may return UNSUPPORTED instead. + */ + DPI_X = 4, + DPI_Y = 5, + + // 6 is reserved for legacy interfaces + + /** + * The configuration group ID (as int32_t) this config is associated to. + * Switching between configurations within the same group may be done seamlessly + * in some conditions via setActiveConfigWithConstraints. Configurations which + * share the same config group are similar in all attributes except for the + * vsync period. + */ + CONFIG_GROUP = 7, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayBrightness.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..51f4db5dbb0f136cd5e78b24efb3f42be58068fe --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayBrightness.aidl @@ -0,0 +1,35 @@ +/** + * Copyright 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable DisplayBrightness { + /** + * A number between 0.0f (minimum brightness) and 1.0f (maximum brightness), a negative value to + * turn the backlight off + */ + float brightness; + + /** + * The absolute brightness in nits of the backlight, if it is available. This will be a negative + * value if it is not known. + * + * An implementation may choose to use this value to assist with tone-mapping, as a mapping + * between the brightness float and the nits may not otherwise be known. + */ + float brightnessNits; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f4b29843b8d200834a962197cff2c6bc3159bcc0 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -0,0 +1,83 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.DisplayCapability; + +/** + * Required capabilities which are supported by the display. The + * particular set of supported capabilities for a given display may be + * retrieved using getDisplayCapabilities. + */ +@VintfStability +@Backing(type="int") +enum DisplayCapability { + INVALID = 0, + /** + * Indicates that the display must apply a color transform even when + * either the client or the device has chosen that all layers should + * be composed by the client. This prevents the client from applying + * the color transform during its composition step. + * If getDisplayCapabilities is supported, the global capability + * SKIP_CLIENT_COLOR_TRANSFORM is ignored. + * If getDisplayCapabilities is not supported, and the global capability + * SKIP_CLIENT_COLOR_TRANSFORM is returned by getCapabilities, + * then all displays must be treated as having + * SKIP_CLIENT_COLOR_TRANSFORM. + */ + SKIP_CLIENT_COLOR_TRANSFORM = 1, + /** + * Indicates that the display supports PowerMode.DOZE and + * potentially PowerMode.DOZE_SUSPEND if DisplayCapability.SUSPEND is also + * supported. DOZE_SUSPEND may not provide any benefit + * over DOZE (see the definition of PowerMode for more information), + * but if both DOZE and DOZE_SUSPEND are no different from + * PowerMode.ON, the device must not claim support. + * Must be returned by getDisplayCapabilities when getDozeSupport + * indicates the display supports PowerMode.DOZE and + * PowerMode.DOZE_SUSPEND. + */ + DOZE = 2, + /** + * Indicates that the display supports brightness operations. + */ + BRIGHTNESS = 3, + /** + * Indicates that the display supports protected contents. + * When returned, hardware composer must be able to accept client target + * with protected buffers. + */ + PROTECTED_CONTENTS = 4, + /** + * Indicates that both the composer HAL implementation and the given display + * support a low latency mode, such as HDMI 2.1 Auto Low Latency Mode. + */ + AUTO_LOW_LATENCY_MODE = 5, + /** + * Indicates that the display supports PowerMode.ON_SUSPEND. + * If PowerMode.ON_SUSPEND is no different from PowerMode.ON, the device must not + * claim support. + * If the display supports DisplayCapability.DOZE and DisplayCapability.SUSPEND, then + * PowerMode.ON_SUSPEND and PowerMode.DOZE_SUSPEND must be supported. + */ + SUSPEND = 6, + /** + * Indicates that the display supports IComposerClient.setIdleTimerEnabled and + * IComposerCallback.onVsyncIdle. + */ + DISPLAY_IDLE_TIMER = 7, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b6df147df899b4faf10caa7be1d69b8cdc9b67de --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl @@ -0,0 +1,178 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.Buffer; +import android.hardware.graphics.composer3.ClientTarget; +import android.hardware.graphics.composer3.ClockMonotonicTimestamp; +import android.hardware.graphics.composer3.DisplayBrightness; +import android.hardware.graphics.composer3.LayerCommand; + +@VintfStability +parcelable DisplayCommand { + /** + * The display which this commands refers to. + * @see IComposer.createDisplay + */ + long display; + + /** + * Sets layer commands for this display. + * @see LayerCommand. + */ + LayerCommand[] layers; + + /** + * Sets a color transform which will be applied after composition. + * + * If the device is not capable of either using the matrix to + * apply the desired color transform, it must force all layers to client + * composition during VALIDATE_DISPLAY. + * + * If Capability.SKIP_CLIENT_COLOR_TRANSFORM is present, then + * the client must never apply the color transform during client + * composition, even if all layers are being composed by the client. + * + * The matrix provided is an affine color transformation of the following + * form: + * + * |r.r r.g r.b 0| + * |g.r g.g g.b 0| + * |b.r b.g b.b 0| + * |Tr Tg Tb 1| + * + * This matrix must be provided in row-major form: + * + * {r.r, r.g, r.b, 0, g.r, ...}. + * + * Given a matrix of this form and an input color [R_in, G_in, B_in], the + * output color [R_out, G_out, B_out] will be: + * + * R_out = R_in * r.r + G_in * g.r + B_in * b.r + Tr + * G_out = R_in * r.g + G_in * g.g + B_in * b.g + Tg + * B_out = R_in * r.b + G_in * g.b + B_in * b.b + Tb + * + */ + @nullable float[] colorTransformMatrix; + + /** + * Sets the desired brightness of the display. + * + * Ideally, the brightness of the display will take effect within this frame so that it can be + * aligned with color transforms. Some display architectures may take multiple frames to apply + * the display brightness, for example when internally switching the display between multiple + * power modes to achieve higher luminance. In those cases, the underlying display panel's real + * brightness may not be applied atomically; however, layer dimming when mixing HDR and SDR + * content must be synchronized to ensure that there is no user-perceptable flicker. + * + * The display luminance must be updated by this command even if there is not pending validate + * or present command. + */ + @nullable DisplayBrightness brightness; + + /** + * Sets the buffer handle which will receive the output of client + * composition. Layers marked as Composition.CLIENT must be composited + * into this buffer prior to the call to PRESENT_DISPLAY, and layers not + * marked as Composition.CLIENT must be composited with this buffer by + * the device. + * + * The buffer handle provided may be empty if no layers are being + * composited by the client. This must not result in an error (unless an + * invalid display handle is also provided). + * + * Also provides a file descriptor referring to an acquire sync fence + * object, which must be signaled when it is safe to read from the client + * target buffer. If it is already safe to read from this buffer, an + * empty handle may be passed instead. + * + * For more about dataspaces, see SET_LAYER_DATASPACE. + * + * The damage parameter describes a surface damage region as defined in + * the description of SET_LAYER_SURFACE_DAMAGE. + * + * Will be called before PRESENT_DISPLAY if any of the layers are marked + * as Composition.CLIENT. If no layers are so marked, then it is not + * necessary to call this function. It is not necessary to call + * validateDisplay after changing the target through this function. + */ + @nullable ClientTarget clientTarget; + + /** + * Sets the output buffer for a virtual display. That is, the buffer to + * which the composition result will be written. + * + * Also provides a file descriptor referring to a release sync fence + * object, which must be signaled when it is safe to write to the output + * buffer. If it is already safe to write to the output buffer, an empty + * handle may be passed instead. + * + * Must be called at least once before PRESENT_DISPLAY, but does not have + * any interaction with layer state or display validation. + */ + @nullable Buffer virtualDisplayOutputBuffer; + + /** + * Sets the expected present time to present the current content on screen. + * The implementation should try to present the display as close as possible + * to the given expectedPresentTime. If expectedPresentTime is 0, the + * implementation should present the display as soon as possible. + */ + @nullable ClockMonotonicTimestamp expectedPresentTime; + + /** + * Instructs the device to inspect all of the layer state and determine if + * there are any composition type changes necessary before presenting the + * display. Permitted changes are described in the definition of + * Composition above. + */ + boolean validateDisplay; + + /** + * Accepts the changes required by the device from the previous + * validateDisplay call (which may be queried using + * getChangedCompositionTypes) and revalidates the display. This function + * is equivalent to requesting the changed types from + * getChangedCompositionTypes, setting those types on the corresponding + * layers, and then calling validateDisplay again. + * + * After this call it must be valid to present this display. Calling this + * after validateDisplay returns 0 changes must succeed with NONE, but + * must have no other effect. + */ + boolean acceptDisplayChanges; + + /** + * Presents the current display contents on the screen (or in the case of + * virtual displays, into the output buffer). + * + * Prior to calling this function, the display must be successfully + * validated with validateDisplay. Note that setLayerBuffer and + * setLayerSurfaceDamage specifically do not count as layer state, so if + * there are no other changes to the layer state (or to the buffer's + * properties as described in setLayerBuffer), then it is safe to call + * this function without first validating the display. + */ + boolean presentDisplay; + + /** + * Presents the current display contents on the screen (or in the case of + * virtual displays, into the output buffer) if validate can be skipped, + * or perform a VALIDATE_DISPLAY action instead. + */ + boolean presentOrValidateDisplay; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConnectionType.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConnectionType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..80333cb957ff73fc841ed5905733284ebb8c6c9a --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayConnectionType.aidl @@ -0,0 +1,30 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +@Backing(type="int") +enum DisplayConnectionType { + /** + * Display is connected through internal port, e.g. DSI, eDP. + */ + INTERNAL = 0, + /** + * Display is connected through external port, e.g. HDMI, DisplayPort. + */ + EXTERNAL = 1, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayContentSample.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayContentSample.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9457d9962d9dd3baede86a9549f6c4240630f798 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayContentSample.aidl @@ -0,0 +1,49 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Output parameters for IComposerClient.getDisplayedContentSample + */ +@VintfStability +parcelable DisplayContentSample { + /** + * The number of frames represented by this sample. + */ + long frameCount; + /** + * A histogram counting how many times a pixel of a given value was displayed + * onscreen for FORMAT_COMPONENT_0. The buckets of the histogram are evenly + * weighted, the number of buckets is device specific. eg, for RGBA_8888, + * if sampleComponent0 is {10, 6, 4, 1} this means that 10 red pixels were + * displayed onscreen in range 0x00->0x3F, 6 red pixels were displayed + * onscreen in range 0x40->0x7F, etc. + */ + long[] sampleComponent0; + /** + * The same sample definition as sampleComponent0, but for FORMAT_COMPONENT_1. + */ + long[] sampleComponent1; + /** + * The same sample definition as sampleComponent0, but for FORMAT_COMPONENT_2. + */ + long[] sampleComponent2; + /** + * The same sample definition as sampleComponent0, but for FORMAT_COMPONENT_3. + */ + long[] sampleComponent3; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82f6b729c4daa4fe60d69a67d83a69d405af0a4f --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl @@ -0,0 +1,38 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.FormatColorComponent; + +/** + * Output parameters for IComposerClient.getDisplayedContentSamplingAttributes + */ +@VintfStability +parcelable DisplayContentSamplingAttributes { + /** + * The format of the sampled pixels. + */ + android.hardware.graphics.common.PixelFormat format; + /** + * The dataspace of the sampled pixels. + */ + android.hardware.graphics.common.Dataspace dataspace; + /** + * The mask of which components can be sampled. + */ + FormatColorComponent componentMask; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayIdentification.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayIdentification.aidl new file mode 100644 index 0000000000000000000000000000000000000000..03ef8e68df9694992322c51fe95a616c32442792 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayIdentification.aidl @@ -0,0 +1,32 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Output parameters for IComposerClient.getDisplayIdentificationData + */ +@VintfStability +parcelable DisplayIdentification { + /** + * The connector to which the display is connected. + */ + byte port; + /** + * The EDID 1.3 blob identifying the display. + */ + byte[] data; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..27fe1e6ed7d52c69bcfb79556be125e4609500d3 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl @@ -0,0 +1,72 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable DisplayRequest { + /** + * Instructs the client to provide a new client target buffer, even if + * no layers are marked for client composition. + */ + const int FLIP_CLIENT_TARGET = 1 << 0; + + /** + * Instructs the client to write the result of client composition + * directly into the virtual display output buffer. If any of the + * layers are not marked as Composition.CLIENT or the given display + * is not a virtual display, this request has no effect. + */ + const int WRITE_CLIENT_TARGET_TO_OUTPUT = 1 << 1; + + /** + * The display which this commands refers to. + * @see IComposer.createDisplay + */ + long display; + + /** + * The display requests for the current validated state. This must be a + * bitwise-or of the constants in `DisplayRequest`. + */ + int mask; + + @VintfStability + parcelable LayerRequest { + /** + * The client must clear its target with transparent pixels where + * this layer would be. The client may ignore this request if the + * layer must be blended. + */ + const int CLEAR_CLIENT_TARGET = 1 << 0; + + /** + * The layer which this commands refers to. + * @see IComposer.createLayer + */ + long layer; + /** + * The layer requests for the current validated state. This must be a + * bitwise-or of the constants in `LayerRequest`. + */ + int mask; + } + + /** + * The layer requests for the current validated state. + */ + LayerRequest[] layerRequests; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/FormatColorComponent.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/FormatColorComponent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc8f424f97617b4f54e283660428efb316c4aa64 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/FormatColorComponent.aidl @@ -0,0 +1,38 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +@Backing(type="byte") +enum FormatColorComponent { + /* + * The first component (eg, for RGBA_8888, this is R) + */ + FORMAT_COMPONENT_0 = 1 << 0, + /* + * The second component (eg, for RGBA_8888, this is G) + */ + FORMAT_COMPONENT_1 = 1 << 1, + /* + * The third component (eg, for RGBA_8888, this is B) + */ + FORMAT_COMPONENT_2 = 1 << 2, + /* + * The fourth component (eg, for RGBA_8888, this is A) + */ + FORMAT_COMPONENT_3 = 1 << 3, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/HdrCapabilities.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/HdrCapabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3fb55baccdc455027965c7f01353799f82f89273 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/HdrCapabilities.aidl @@ -0,0 +1,36 @@ +/** + * 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 android.hardware.graphics.composer3; +/** + * Output parameters for IComposerClient.getHdrCapabilities + * + * @param types is an array of HDR types, may have 0 elements if the + * display is not HDR-capable. + * @param maxLuminance is the desired content maximum luminance for this + * display in cd/m^2. + * @param maxAverageLuminance - the desired content maximum frame-average + * luminance for this display in cd/m^2. + * @param minLuminance is the desired content minimum luminance for this + * display in cd/m^2. + */ +@VintfStability +parcelable HdrCapabilities { + android.hardware.graphics.common.Hdr[] types; + float maxLuminance; + float maxAverageLuminance; + float minLuminance; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d2cabff346766fd6c43462e5debdbef591228671 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp @@ -0,0 +1,353 @@ +/** + * 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. + */ + +#include "aidl/android/hardware/graphics/common/BlendMode.h" +#include "aidl/android/hardware/graphics/common/FRect.h" +#include "aidl/android/hardware/graphics/common/Rect.h" +#include "aidl/android/hardware/graphics/composer3/Capability.h" +#include "aidl/android/hardware/graphics/composer3/ClientTargetProperty.h" +#include "aidl/android/hardware/graphics/composer3/Color.h" +#include "aidl/android/hardware/graphics/composer3/Composition.h" +#include "aidl/android/hardware/graphics/composer3/ContentType.h" +#include "aidl/android/hardware/graphics/composer3/DisplayAttribute.h" +#include "aidl/android/hardware/graphics/composer3/DisplayCapability.h" +#include "aidl/android/hardware/graphics/composer3/DisplayConnectionType.h" +#include "aidl/android/hardware/graphics/composer3/FormatColorComponent.h" +#include "aidl/android/hardware/graphics/composer3/IComposer.h" +#include "aidl/android/hardware/graphics/composer3/PerFrameMetadata.h" +#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.h" +#include "aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.h" +#include "aidl/android/hardware/graphics/composer3/PowerMode.h" +#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.h" +#include "aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.h" +#include "android/hardware/graphics/composer/2.1/IComposer.h" +#include "android/hardware/graphics/composer/2.1/IComposerCallback.h" +#include "android/hardware/graphics/composer/2.1/IComposerClient.h" +#include "android/hardware/graphics/composer/2.2/IComposerClient.h" +#include "android/hardware/graphics/composer/2.3/IComposerClient.h" +#include "android/hardware/graphics/composer/2.4/IComposerClient.h" +#include "android/hardware/graphics/composer/2.4/types.h" + +namespace android::h2a { + +static_assert( + aidl::android::hardware::graphics::composer3::IComposer::EX_NO_RESOURCES == + static_cast(::android::hardware::graphics::composer::V2_4::Error::NO_RESOURCES)); + +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_BAD_CONFIG == + static_cast(::android::hardware::graphics::composer::V2_4::Error::BAD_CONFIG)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_BAD_DISPLAY == + static_cast(::android::hardware::graphics::composer::V2_4::Error::BAD_DISPLAY)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_BAD_LAYER == + static_cast(::android::hardware::graphics::composer::V2_4::Error::BAD_LAYER)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_BAD_PARAMETER == + static_cast(::android::hardware::graphics::composer::V2_4::Error::BAD_PARAMETER)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_NO_RESOURCES == + static_cast(::android::hardware::graphics::composer::V2_4::Error::NO_RESOURCES)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_NOT_VALIDATED == + static_cast(::android::hardware::graphics::composer::V2_4::Error::NOT_VALIDATED)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_UNSUPPORTED == + static_cast(::android::hardware::graphics::composer::V2_4::Error::UNSUPPORTED)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_SEAMLESS_NOT_ALLOWED == + static_cast( + ::android::hardware::graphics::composer::V2_4::Error::SEAMLESS_NOT_ALLOWED)); +static_assert( + aidl::android::hardware::graphics::composer3::IComposerClient::EX_SEAMLESS_NOT_POSSIBLE == + static_cast( + ::android::hardware::graphics::composer::V2_4::Error::SEAMLESS_NOT_POSSIBLE)); + +static_assert( + aidl::android::hardware::graphics::composer3::Capability::INVALID == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposer::Capability::INVALID)); +static_assert(aidl::android::hardware::graphics::composer3::Capability::SIDEBAND_STREAM == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposer::Capability:: + SIDEBAND_STREAM)); +static_assert( + aidl::android::hardware::graphics::composer3::Capability::SKIP_CLIENT_COLOR_TRANSFORM == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposer::Capability:: + SKIP_CLIENT_COLOR_TRANSFORM)); +static_assert( + aidl::android::hardware::graphics::composer3::Capability::PRESENT_FENCE_IS_NOT_RELIABLE == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposer::Capability:: + PRESENT_FENCE_IS_NOT_RELIABLE)); +// HWC2_CAPABILITY_SKIP_VALIDATE was never defined for HIDL, so we just hardcode its value +static_assert(aidl::android::hardware::graphics::composer3::Capability::SKIP_VALIDATE == + static_cast(4)); + +static_assert(aidl::android::hardware::graphics::composer3::DisplayRequest::LayerRequest:: + CLEAR_CLIENT_TARGET == + static_cast(::android::hardware::graphics::composer::V2_1::IComposerClient:: + LayerRequest::CLEAR_CLIENT_TARGET)); + +static_assert(aidl::android::hardware::graphics::common::BlendMode::INVALID == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::BlendMode:: + INVALID)); +static_assert( + aidl::android::hardware::graphics::common::BlendMode::NONE == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::BlendMode::NONE)); +static_assert(aidl::android::hardware::graphics::common::BlendMode::PREMULTIPLIED == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::BlendMode:: + PREMULTIPLIED)); +static_assert(aidl::android::hardware::graphics::common::BlendMode::COVERAGE == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::BlendMode:: + COVERAGE)); + +static_assert(aidl::android::hardware::graphics::composer3::Composition::INVALID == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::Composition:: + INVALID)); +static_assert(aidl::android::hardware::graphics::composer3::Composition::CLIENT == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::Composition:: + CLIENT)); +static_assert(aidl::android::hardware::graphics::composer3::Composition::DEVICE == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::Composition:: + DEVICE)); +static_assert(aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::Composition:: + SOLID_COLOR)); +static_assert(aidl::android::hardware::graphics::composer3::Composition::CURSOR == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::Composition:: + CURSOR)); +static_assert(aidl::android::hardware::graphics::composer3::Composition::SIDEBAND == + static_cast( + ::android::hardware::graphics::composer::V2_1::IComposerClient::Composition:: + SIDEBAND)); + +static_assert(aidl::android::hardware::graphics::composer3::DisplayRequest::FLIP_CLIENT_TARGET == + static_cast(::android::hardware::graphics::composer::V2_1::IComposerClient:: + DisplayRequest::FLIP_CLIENT_TARGET)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayRequest:: + WRITE_CLIENT_TARGET_TO_OUTPUT == + static_cast(::android::hardware::graphics::composer::V2_1::IComposerClient:: + DisplayRequest::WRITE_CLIENT_TARGET_TO_OUTPUT)); + +static_assert( + aidl::android::hardware::graphics::composer3::PowerMode::OFF == + static_cast( + ::android::hardware::graphics::composer::V2_2::IComposerClient::PowerMode::OFF)); +static_assert( + aidl::android::hardware::graphics::composer3::PowerMode::DOZE == + static_cast( + ::android::hardware::graphics::composer::V2_2::IComposerClient::PowerMode::DOZE)); +static_assert(aidl::android::hardware::graphics::composer3::PowerMode::DOZE_SUSPEND == + static_cast( + ::android::hardware::graphics::composer::V2_2::IComposerClient::PowerMode:: + DOZE_SUSPEND)); +static_assert( + aidl::android::hardware::graphics::composer3::PowerMode::ON == + static_cast( + ::android::hardware::graphics::composer::V2_2::IComposerClient::PowerMode::ON)); +static_assert(aidl::android::hardware::graphics::composer3::PowerMode::ON_SUSPEND == + static_cast( + ::android::hardware::graphics::composer::V2_2::IComposerClient::PowerMode:: + ON_SUSPEND)); + +static_assert(aidl::android::hardware::graphics::composer3::DisplayCapability::INVALID == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient:: + DisplayCapability::INVALID)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayCapability:: + SKIP_CLIENT_COLOR_TRANSFORM == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient:: + DisplayCapability::SKIP_CLIENT_COLOR_TRANSFORM)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayCapability::DOZE == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient:: + DisplayCapability::DOZE)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayCapability::BRIGHTNESS == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient:: + DisplayCapability::BRIGHTNESS)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayCapability::PROTECTED_CONTENTS == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient:: + DisplayCapability::PROTECTED_CONTENTS)); +static_assert( + aidl::android::hardware::graphics::composer3::DisplayCapability::AUTO_LOW_LATENCY_MODE == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::DisplayCapability:: + AUTO_LOW_LATENCY_MODE)); + +static_assert(aidl::android::hardware::graphics::composer3::DisplayAttribute::INVALID == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::Attribute:: + INVALID)); +static_assert( + aidl::android::hardware::graphics::composer3::DisplayAttribute::WIDTH == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::Attribute::WIDTH)); +static_assert( + aidl::android::hardware::graphics::composer3::DisplayAttribute::HEIGHT == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::Attribute::HEIGHT)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayAttribute::VSYNC_PERIOD == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::Attribute:: + VSYNC_PERIOD)); +static_assert( + aidl::android::hardware::graphics::composer3::DisplayAttribute::DPI_X == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::Attribute::DPI_X)); +static_assert( + aidl::android::hardware::graphics::composer3::DisplayAttribute::DPI_Y == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::Attribute::DPI_Y)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayAttribute::CONFIG_GROUP == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::Attribute:: + CONFIG_GROUP)); + +static_assert(aidl::android::hardware::graphics::composer3::DisplayConnectionType::INTERNAL == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient:: + DisplayConnectionType::INTERNAL)); +static_assert(aidl::android::hardware::graphics::composer3::DisplayConnectionType::EXTERNAL == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient:: + DisplayConnectionType::EXTERNAL)); + +static_assert( + aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::DISPLAY_RED_PRIMARY_X == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::DISPLAY_RED_PRIMARY_X)); +static_assert( + aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::DISPLAY_RED_PRIMARY_Y == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::DISPLAY_RED_PRIMARY_Y)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey:: + DISPLAY_GREEN_PRIMARY_X == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_X)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey:: + DISPLAY_GREEN_PRIMARY_Y == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_Y)); +static_assert( + aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_X == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_X)); +static_assert( + aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_Y == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_Y)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::WHITE_POINT_X == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::WHITE_POINT_X)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::WHITE_POINT_Y == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::WHITE_POINT_Y)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::MAX_LUMINANCE == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::MAX_LUMINANCE)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::MIN_LUMINANCE == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::MIN_LUMINANCE)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey:: + MAX_CONTENT_LIGHT_LEVEL == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::MAX_CONTENT_LIGHT_LEVEL)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey:: + MAX_FRAME_AVERAGE_LIGHT_LEVEL == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL)); +static_assert(aidl::android::hardware::graphics::composer3::PerFrameMetadataKey::HDR10_PLUS_SEI == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + PerFrameMetadataKey::HDR10_PLUS_SEI)); + +static_assert( + aidl::android::hardware::graphics::composer3::FormatColorComponent::FORMAT_COMPONENT_0 == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + FormatColorComponent::FORMAT_COMPONENT_0)); +static_assert( + aidl::android::hardware::graphics::composer3::FormatColorComponent::FORMAT_COMPONENT_1 == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + FormatColorComponent::FORMAT_COMPONENT_1)); +static_assert( + aidl::android::hardware::graphics::composer3::FormatColorComponent::FORMAT_COMPONENT_2 == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + FormatColorComponent::FORMAT_COMPONENT_2)); +static_assert( + aidl::android::hardware::graphics::composer3::FormatColorComponent::FORMAT_COMPONENT_3 == + static_cast( + ::android::hardware::graphics::composer::V2_3::IComposerClient:: + FormatColorComponent::FORMAT_COMPONENT_3)); + +static_assert( + aidl::android::hardware::graphics::composer3::ContentType::NONE == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::ContentType::NONE)); +static_assert(aidl::android::hardware::graphics::composer3::ContentType::GRAPHICS == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::ContentType:: + GRAPHICS)); +static_assert(aidl::android::hardware::graphics::composer3::ContentType::PHOTO == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::ContentType:: + PHOTO)); +static_assert(aidl::android::hardware::graphics::composer3::ContentType::CINEMA == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::ContentType:: + CINEMA)); +static_assert( + aidl::android::hardware::graphics::composer3::ContentType::GAME == + static_cast( + ::android::hardware::graphics::composer::V2_4::IComposerClient::ContentType::GAME)); + +static_assert( + aidl::android::hardware::graphics::composer3::PresentOrValidate::Result::Presented == + static_cast(1)); +static_assert( + aidl::android::hardware::graphics::composer3::PresentOrValidate::Result::Validated == + static_cast(0)); + +} // namespace android::h2a diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposer.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0ebc2b7c0ce321d8098a3cf52b4aed780aec9a32 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposer.aidl @@ -0,0 +1,46 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.Capability; +import android.hardware.graphics.composer3.IComposerClient; + +@VintfStability +interface IComposer { + /** + * Temporary failure due to resource contention Exception + */ + const int EX_NO_RESOURCES = 6; + + /** + * Creates a client of the composer. + * + * @return is the newly created client. + * + * @exception EX_NO_RESOURCES when the client could not be created. + */ + IComposerClient createClient(); + + /** + * Provides a list of supported capabilities (as described in the + * definition of Capability above). This list must not change after + * initialization. + * + * @return is a list of supported capabilities. + */ + Capability[] getCapabilities(); +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..67954d4cc5eed10cecb6e37e730042c31ef74fdc --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl @@ -0,0 +1,99 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline; + +@VintfStability +interface IComposerCallback { + /** + * Notifies the client that the given display has either been connected or + * disconnected. Every active display (even a built-in physical display) + * must trigger at least one hotplug notification, even if it only occurs + * immediately after callback registration. + * + * Displays which have been connected are assumed to be in PowerMode.OFF, + * and the onVsync callback should not be called for a display until vsync + * has been enabled with setVsyncEnabled. + * + * The client may call back into the device while the callback is in + * progress. The device must serialize calls to this callback such that + * only one thread is calling it at a time. + * + * @param display is the display that triggers the hotplug event. + * @param connected indicates whether the display is connected or + * disconnected. + */ + void onHotplug(long display, boolean connected); + + /** + * Notifies the client to trigger a screen refresh. This forces all layer + * state for this display to be resent, and the display to be validated + * and presented, even if there have been no changes. + * + * This refresh will occur some time after the callback is initiated, but + * not necessarily before it returns. It is safe to trigger this callback + * from other functions which call into the device. + * + * @param display is the display to refresh. + */ + oneway void onRefresh(long display); + + /** + * Notifies the client that the conditions which previously led to returning + * SEAMLESS_NOT_POSSIBLE from setActiveConfigWithConstraints have changed and now seamless may + * be possible. Client should retry calling setActiveConfigWithConstraints. + * + * @param display is a display setActiveConfigWithConstraints previously failed with + * EX_SEAMLESS_NOT_POSSIBLE. + */ + oneway void onSeamlessPossible(long display); + + /** + * Notifies the client that a vsync event has occurred. This callback must + * only be triggered when vsync is enabled for this display (through + * setVsyncEnabled). + * + * @param display is the display which has received a vsync event + * @param timestamp is the CLOCK_MONOTONIC time at which the vsync event + * occurred, in nanoseconds. + * @param vsyncPeriodNanos is the display vsync period in nanoseconds i.e. the next onVsync + * is expected to be called vsyncPeriodNanos nanoseconds after this call. + */ + oneway void onVsync(long display, long timestamp, int vsyncPeriodNanos); + + /** + * Notifies the client that the previously reported timing for vsync period change has been + * updated. This may occur if the composer missed the deadline for changing the vsync period + * or the client submitted a refresh frame too late. + * + * @param display is the display which vsync period change is in progress + * @param updatedTimeline is the new timeline for the vsync period change. + */ + oneway void onVsyncPeriodTimingChanged( + long display, in VsyncPeriodChangeTimeline updatedTimeline); + + /** + * Notifies the client that the display is idle, the refresh rate changed to a lower setting to + * preserve power and vsync cadence changed. When a new frame is queued for presentation, the + * client is expected to enable vsync callbacks to learn the new vsync cadence before sending + * a new frame. + * + * @param display is the display whose vsync cadence changed due to panel idle mode. + */ + oneway void onVsyncIdle(long display); +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a4ea64f815d39f5b203518aa10eb06f758851c33 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -0,0 +1,817 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.common.DisplayDecorationSupport; +import android.hardware.graphics.common.Transform; +import android.hardware.graphics.composer3.ClientTargetProperty; +import android.hardware.graphics.composer3.ColorMode; +import android.hardware.graphics.composer3.CommandResultPayload; +import android.hardware.graphics.composer3.ContentType; +import android.hardware.graphics.composer3.DisplayAttribute; +import android.hardware.graphics.composer3.DisplayCapability; +import android.hardware.graphics.composer3.DisplayCommand; +import android.hardware.graphics.composer3.DisplayConnectionType; +import android.hardware.graphics.composer3.DisplayContentSample; +import android.hardware.graphics.composer3.DisplayContentSamplingAttributes; +import android.hardware.graphics.composer3.DisplayIdentification; +import android.hardware.graphics.composer3.FormatColorComponent; +import android.hardware.graphics.composer3.HdrCapabilities; +import android.hardware.graphics.composer3.IComposerCallback; +import android.hardware.graphics.composer3.PerFrameMetadataKey; +import android.hardware.graphics.composer3.PowerMode; +import android.hardware.graphics.composer3.ReadbackBufferAttributes; +import android.hardware.graphics.composer3.RenderIntent; +import android.hardware.graphics.composer3.VirtualDisplay; +import android.hardware.graphics.composer3.VsyncPeriodChangeConstraints; +import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline; + +@VintfStability +interface IComposerClient { + /** + * Invalid Config Exception + */ + const int EX_BAD_CONFIG = 1; + + /** + * Invalid Display Exception + */ + const int EX_BAD_DISPLAY = 2; + + /** + * Invalid Layer Exception + */ + const int EX_BAD_LAYER = 3; + + /** + * Invalid width, height, etc. + */ + const int EX_BAD_PARAMETER = 4; + + /** + * Reserved for historical reasons + */ + const int EX_RESERVED = 5; + /** + * Temporary failure due to resource contention Exception + */ + const int EX_NO_RESOURCES = 6; + + /** + * validateDisplay has not been called Exception + */ + const int EX_NOT_VALIDATED = 7; + + /** + * Seamless cannot be required for configurations that don't share a + * config group Exception + */ + const int EX_UNSUPPORTED = 8; + + const int EX_SEAMLESS_NOT_ALLOWED = 9; + /** + * Seamless requirements cannot be met Exception + */ + const int EX_SEAMLESS_NOT_POSSIBLE = 10; + + /** + * Integer.MAX_VALUE is reserved for the invalid configuration. + * This should not be returned as a valid configuration. + */ + const int INVALID_CONFIGURATION = 0x7fffffff; + + /** + * Creates a new layer on the given display. + * + * @param display is the display on which to create the layer. + * @param bufferSlotCount is the number of buffer slot to be reserved. + * + * @return is the handle of the new layer. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_NO_RESOURCES when the device was unable to create a layer this + * time. + */ + long createLayer(long display, int bufferSlotCount); + + /** + * Creates a new virtual display with the given width and height. The + * format passed into this function is the default format requested by the + * consumer of the virtual display output buffers. + * + * The display must be assumed to be on from the time the first frame is + * presented until the display is destroyed. + * + * @param width is the width in pixels. + * @param height is the height in pixels. + * @param formatHint is the default output buffer format selected by + * the consumer. + * @param outputBufferSlotCount is the number of output buffer slots to be + * reserved. + * + * @return is the newly-created virtual display. + * + * @exception EX_UNSUPPORTED when the width or height is too large for the + * device to be able to create a virtual display. + * @exception EX_NO_RESOURCES when the device is unable to create a new virtual + * display at this time. + */ + VirtualDisplay createVirtualDisplay(int width, int height, + android.hardware.graphics.common.PixelFormat formatHint, int outputBufferSlotCount); + + /** + * Destroys the given layer. + * + * @param display is the display on which the layer was created. + * @param layer is the layer to destroy. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_LAYER when an invalid layer handle was passed in. + */ + void destroyLayer(long display, long layer); + + /** + * Destroys a virtual display. After this call all resources consumed by + * this display may be freed by the device and any operations performed on + * this display must fail. + * + * @param display is the virtual display to destroy. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_PARAMETER when the display handle which was passed in does + * not refer to a virtual display. + */ + void destroyVirtualDisplay(long display); + + /** + * Executes commands. + * + * @param commands are the commands to be processed. + * + * @return are the command statuses. + */ + CommandResultPayload[] executeCommands(in DisplayCommand[] commands); + + /** + * Retrieves which display configuration is currently active. + * + * If no display configuration is currently active, this function raise + * the exception EX_BAD_CONFIG. It is the responsibility of the client to call + * setActiveConfig with a valid configuration before attempting to present + * anything on the display. + * + * @param display is the display to which the active config is queried. + * + * @return is the currently active display configuration. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_CONFIG when no configuration is currently active. + */ + int getActiveConfig(long display); + + /** + * Returns the color modes supported on this display. + * + * All devices must support at least ColorMode.NATIVE. + * + * @param display is the display to query. + * + * @return is an array of color modes. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + */ + ColorMode[] getColorModes(long display); + + /** + * By default, layer dataspaces are mapped to the current color mode + * colorimetrically with a few exceptions. + * + * When the layer dataspace is a legacy dataspace (see + * common@1.1::Dataspace) and the display render intent is + * RenderIntent.ENHANCE, the pixel values can go through an + * implementation-defined saturation transform before being mapped to the + * current color mode colorimetrically. + * + * Colors that are out of the gamut of the current color mode are + * hard-clipped. + * + * + * Returns the saturation matrix of the specified legacy dataspace. + * + * The saturation matrix can be used to approximate the legacy dataspace + * saturation transform. It is to be applied on linear pixel values like + * this: + * + * (in GLSL) + * linearSrgb = saturationMatrix * linearSrgb; + * + * @param dataspace must be Dataspace::SRGB_LINEAR. + * + * @return is the 4x4 column-major matrix used to approximate the + * legacy dataspace saturation operation. The last row must be + * [0.0, 0.0, 0.0, 1.0]. + * + * @exception EX_BAD_PARAMETER when an invalid dataspace was passed in. + */ + float[] getDataspaceSaturationMatrix(android.hardware.graphics.common.Dataspace dataspace); + + /** + * Returns a display attribute value for a particular display + * configuration. + * + * @param display is the display to query. + * @param config is the display configuration for which to return + * attribute values. + * + * @return is the value of the attribute. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_CONFIG when config does not name a valid configuration for + * this display. + * @exception EX_BAD_PARAMETER when attribute is unrecognized. + * @exception EX_UNSUPPORTED when attribute cannot be queried for the config. + */ + int getDisplayAttribute(long display, int config, DisplayAttribute attribute); + + /** + * Provides a list of supported capabilities (as described in the + * definition of DisplayCapability above). This list must not change after + * initialization. + * + * @return is a list of supported capabilities. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + */ + DisplayCapability[] getDisplayCapabilities(long display); + + /** + * Returns handles for all of the valid display configurations on this + * display. + * This should never return INVALID_CONFIGURATION as a valid value. + * + * @param display is the display to query. + * + * @return is an array of configuration handles. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + */ + int[] getDisplayConfigs(long display); + + /** + * Returns whether the given physical display is internal or external. + * + * @return is the connection type of the display. + * + * @exception EX_BAD_DISPLAY when the given display is invalid or virtual. + */ + DisplayConnectionType getDisplayConnectionType(long display); + + /** + * Returns the port and data that describe a physical display. The port is + * a unique number that identifies a physical connector (e.g. eDP, HDMI) + * for display output. The data blob is parsed to determine its format, + * typically EDID 1.3 as specified in VESA E-EDID Standard Release A + * Revision 1. + * + * @param display is the display to query. + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_UNSUPPORTED when identification data is unavailable. + * @return the connector to which the display is connected and the EDID 1.3 + * blob identifying the display. + */ + DisplayIdentification getDisplayIdentificationData(long display); + + /** + * Returns a human-readable version of the display's name. + * + * @return is the name of the display. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + */ + String getDisplayName(long display); + + /** + * Retrieves which vsync period the display is currently using. + * + * If no display configuration is currently active, this function must + * return BAD_CONFIG. If the vsync period is about to change due to a + * setActiveConfigWithConstraints call, this function must return the current vsync period + * until the change takes place. + * + * @param display is the display for which the vsync period is queried. + * + * @return is the current vsync period of the display. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_CONFIG when no configuration is currently active. + */ + int getDisplayVsyncPeriod(long display); + + /** + * Collects the results of display content color sampling for display. + * + * Collection of data can occur whether the sampling is in ENABLE or + * DISABLE state. + * + * @param display is the display to which the sampling is collected. + * @param maxFrames is the maximum number of frames that should be represented in the sample. + * The sample represents the most-recently posted frames. + * If maxFrames is 0, all frames are to be represented by the sample. + * @param timestamp is the timestamp after which any frames were posted that should be + * included in the sample. Timestamp is CLOCK_MONOTONIC. + * If timestamp is 0, do not filter from the sample by time. + * + * @return is the sample. + * + * @exception EX_BAD_DISPLAY when an invalid display was passed in, or + * @exception EX_UNSUPPORTED when there is no efficient way to sample, or + * @exception EX_BAD_PARAMETER when the component is not supported by the hardware. + */ + DisplayContentSample getDisplayedContentSample(long display, long maxFrames, long timestamp); + + /** + * Query for what types of color sampling the hardware supports. + * + * @param display is the display where the samples are collected. + * + * @return are the sampling attributes + * + * @exception EX_BAD_DISPLAY when an invalid display was passed in, or + * @exception EX_UNSUPPORTED when there is no efficient way to sample. + */ + DisplayContentSamplingAttributes getDisplayedContentSamplingAttributes(long display); + + /** + * Queries the physical orientation of a display. Orientation 'Transform::NONE' + * represents a display that doesn't require any transformation on layers + * to be presented at their natural orientation. + * + * @param display is the display where the physical orientation is queried. + * + * @return is one of the below values: + * Transform::NONE + * Transform::ROT_90 + * Transform::ROT_180 + * Transform::ROT_270 + * + * @exception EX_BAD_DISPLAY when an invalid display was passed in. + */ + Transform getDisplayPhysicalOrientation(long display); + + /** + * Returns the high dynamic range (HDR) capabilities of the given display, + * which are invariant with regard to the active configuration. + * + * Displays which are not HDR-capable must return no types. + * + * @param display is the display to query. + * + * @return are the HDR capabilities + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + */ + HdrCapabilities getHdrCapabilities(long display); + + /** + * Returns the maximum number of virtual displays supported by this device + * (which may be 0). The client must not attempt to create more than this + * many virtual displays on this device. This number must not change for + * the lifetime of the device. + * + * @return is the maximum number of virtual displays supported. + */ + int getMaxVirtualDisplayCount(); + + /** + * Returns the PerFrameMetadataKeys that are supported by this device. + * + * @param display is the display on which to create the layer. + * @return is the vector of PerFrameMetadataKey keys that are + * supported by this device. + * @exception EX_UNSUPPORTED if not supported on underlying HAL + */ + PerFrameMetadataKey[] getPerFrameMetadataKeys(long display); + + /** + * Returns the format which should be used when allocating a buffer for use by + * device readback as well as the dataspace in which its contents must be + * interpreted. + * + * The width and height of this buffer must be those of the currently-active + * display configuration, and the usage flags must consist of the following: + * BufferUsage.CPU_READ | BufferUsage.GPU_TEXTURE | + * BufferUsage.COMPOSER_OUTPUT + * + * The format and dataspace provided must be sufficient such that if a + * correctly-configured buffer is passed into setReadbackBuffer, filled by + * the device, and then displayed by the client as a full-screen buffer, the + * output of the display remains the same (subject to the note about protected + * content in the description of setReadbackBuffer). + * + * If the active configuration or color mode of this display has changed + * since a previous call to this function, it must be called again prior to + * setting a readback buffer such that the returned format and dataspace will + * be updated accordingly. + * + * Parameters: + * @param display - the display on which to create the layer. + * + * @return is the readback buffer attributes. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_UNSUPPORTED if not supported on underlying HAL + * + * See also: + * setReadbackBuffer + * getReadbackBufferFence + */ + ReadbackBufferAttributes getReadbackBufferAttributes(long display); + + /** + * Returns an acquire sync fence file descriptor which must signal when the + * buffer provided to setReadbackBuffer has been filled by the device and is + * safe for the client to read. + * + * If it is already safe to read from this buffer, -1 may be returned instead. + * The client takes ownership of this file descriptor and is responsible for + * closing it when it is no longer needed. + * + * This function must be called immediately after the composition cycle being + * captured into the readback buffer. The complete ordering of a readback buffer + * capture is as follows: + * + * getReadbackBufferAttributes + * // Readback buffer is allocated + * // Many frames may pass + * + * setReadbackBuffer + * validateDisplay + * presentDisplay + * getReadbackBufferFence + * // Implicitly wait on the acquire fence before accessing the buffer + * + * Parameters: + * @param display - the display on which to create the layer. + * + * @return is a sync fence file descriptor as described above; pointer + * must be non-NULL + * + * @exception EX_BAD_DISPLAY - an invalid display handle was passed in + * @exception EX_NO_RESOURCES - the readback operation was successful, but + * resulted in a different validate result than would + * have occurred without readback + * @exception EX_UNSUPPORTED - the readback operation was unsuccessful because of + * resource constraints, the presence of protected + * content, or other reasons; -1 must be returned for + * acquireFence + * + * See also: + * getReadbackBufferAttributes + * setReadbackBuffer + */ + @nullable ParcelFileDescriptor getReadbackBufferFence(long display); + + /** + * Returns the render intents supported by the specified display and color + * mode. + * + * For SDR color modes, RenderIntent.COLORIMETRIC must be supported. For + * HDR color modes, RenderIntent.TONE_MAP_COLORIMETRIC must be supported. + * + * @param display is the display to query. + * @param mode is the color mode to query. + * + * @return is an array of render intents. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_PARAMETER when an invalid color mode was passed in. + */ + RenderIntent[] getRenderIntents(long display, ColorMode mode); + + /** + * Provides a list of all the content types supported by this display (any of + * ContentType.{GRAPHICS, PHOTO, CINEMA, GAME}). This list must not change after + * initialization. + * + * Content types are introduced in HDMI 1.4 and supporting them is optional. The + * ContentType.NONE is always supported and will not be returned by this method.. + * + * @return out is a list of supported content types. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + */ + ContentType[] getSupportedContentTypes(long display); + + /** + * Report whether and how this display supports Composition.DISPLAY_DECORATION. + * + * @return A description of how the display supports DISPLAY_DECORATION, or null + * if it is unsupported. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + */ + @nullable DisplayDecorationSupport getDisplayDecorationSupport(long display); + + /** + * Provides a IComposerCallback object for the device to call. + * + * This function must be called only once. + * + * @param callback is the IComposerCallback object. + */ + void registerCallback(in IComposerCallback callback); + + /** + * Sets the active configuration for this display. Upon returning, the + * given display configuration must be active and remain so until either + * this function is called again or the display is disconnected. + * + * @param display is the display to which the active config is set. + * @param config is the new display configuration. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_CONFIG when the configuration handle passed in is not valid + * for this display. + */ + void setActiveConfig(long display, int config); + + /** + * Sets the active configuration and the refresh rate for this display. + * If the new config shares the same config group as the current config, + * only the vsync period shall change. + * Upon returning, the given display configuration, except vsync period, must be active and + * remain so until either this function is called again or the display is disconnected. + * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be + * called with the new vsync period. + * + * @param display is the display for which the active config is set. + * @param config is the new display configuration. + * @param vsyncPeriodChangeConstraints are the constraints required for changing vsync period. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_CONFIG when the configuration handle passed in is not valid + * for this display. + * @exception EX_SEAMLESS_NOT_ALLOWED when seamlessRequired was true but config provided doesn't + * share the same config group as the current config. + * @exception EX_SEAMLESS_NOT_POSSIBLE when seamlessRequired was true but the display cannot + * achieve the vsync period change without a noticeable visual artifact. When the conditions + * change and it may be possible to change the vsync period seamlessly, onSeamlessPossible + * callback must be called to indicate that caller should retry. + * + * @return is the timeline for the vsync period change. + */ + VsyncPeriodChangeTimeline setActiveConfigWithConstraints( + long display, int config, in VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints); + + /** + * Sets the display config in which the device boots. + * + * If the device is unable to boot in this config for any reason (example HDMI display changed), + * the implementation should try to find a config which matches the resolution and refresh-rate + * of this config. If no such config exists, the implementation's preferred display config + * should be used. + * + * @param display is the display for which the boot config is set. + * @param config is the new boot config for the display. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_CONFIG when an invalid config id was passed in. + * @exception EX_UNSUPPORTED when not supported by the underlying HAL + * + * @see getDisplayConfigs + * @see clearBootDisplayConfig + * @see getPreferredBootDisplayConfig + */ + void setBootDisplayConfig(long display, int config); + + /** + * Clears the boot display config. + * + * The device should boot in the implementation's preferred display config. + * + * @param display is the display for which the cached boot config is cleared. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_UNSUPPORTED when not supported by the underlying HAL + * + * @see getDisplayConfigs + * @see setBootDisplayConfig + * @see getPreferredBootDisplayConfig + */ + void clearBootDisplayConfig(long display); + + /** + * Returns the implementation's preferred display config. + * + * This is the display config used by the implementation at boot time, if the boot display + * config has not been requested yet, or if it has been previously cleared. + * + * @param display is the display to which the preferred config is queried. + * @return the implementation's preferred display config. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_UNSUPPORTED when not supported by the underlying HAL + * + * @see getDisplayConfigs + * @see setBootDisplayConfig + * @see clearBootDisplayConfig + */ + int getPreferredBootDisplayConfig(long display); + + /** + * Requests the display to enable/disable its low latency mode. + * + * If the display is connected via HDMI 2.1, then Auto Low Latency Mode should be triggered. If + * the display is internally connected and a custom low latency mode is available, that should + * be triggered. + * + * This function should only be called if the display reports support for + * DisplayCapability.AUTO_LOW_LATENCY_MODE from getDisplayCapabilities_2_4. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_UNSUPPORTED when AUTO_LOW_LATENCY_MODE is not supported by the composer + * implementation or the given display + */ + void setAutoLowLatencyMode(long display, boolean on); + + /** + * Set the number of client target slots to be reserved. + * + * @param display is the display to which the slots are reserved. + * @param clientTargetSlotCount is the slot count for client targets. + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_NO_RESOURCES when unable to reserve the slots. + */ + void setClientTargetSlotCount(long display, int clientTargetSlotCount); + + /** + * Sets the color mode and render intent of the given display. + * + * The color mode and render intent change must take effect on next + * presentDisplay. + * + * All devices must support at least ColorMode.NATIVE and + * RenderIntent.COLORIMETRIC, and displays are assumed to be in this mode + * upon hotplug. + * + * @param display is the display to which the color mode is set. + * @param mode is the color mode to set to. + * @param intent is the render intent to set to. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_PARAMETER when mode or intent is invalid + * @exception EX_UNSUPPORTED when mode or intent is not supported on this + * display. + */ + void setColorMode(long display, ColorMode mode, RenderIntent intent); + + /** + * Instructs the connected display that the content being shown is of the given type - one of + * GRAPHICS, PHOTO, CINEMA, GAME. + * + * Content types are introduced in HDMI 1.4 and supporting them is optional. If they are + * supported, this signal should switch the display to a mode that is optimal for the given + * type of content. See HDMI 1.4 specification for more information. + * + * If the display is internally connected (not through HDMI), and such modes are available, + * this method should trigger them. + * + * This function can be called for a content type even if no support for it is + * reported from getSupportedContentTypes. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_UNSUPPORTED when the given content type is not supported by the composer + * implementation or the given display + */ + void setContentType(long display, ContentType type); + + /** + * Enables or disables the collection of color content statistics + * on this display. + * + * Sampling occurs on the contents of the final composition on this display + * (i.e., the contents presented on screen). Samples should be collected after all + * color transforms have been applied. + * + * Sampling support is optional, and is set to DISABLE by default. + * On each call to ENABLE, all collected statistics must be reset. + * + * Sample data can be queried via getDisplayedContentSample(). + * + * @param display is the display to which the sampling mode is set. + * @param enabled indicates whether to enable or disable sampling. + * @param componentMask The mask of which components should be sampled. If zero, all supported + * components are to be enabled. + * @param maxFrames is the maximum number of frames that should be stored before discard. + * The sample represents the most-recently posted frames. + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in, + * @exception EX_BAD_PARAMETER when enabled was an invalid value, or + * @exception EX_NO_RESOURCES when the requested ringbuffer size via maxFrames was + * not available. + * @exception EX_UNSUPPORTED when there is no efficient way to sample. + */ + void setDisplayedContentSamplingEnabled( + long display, boolean enable, FormatColorComponent componentMask, long maxFrames); + + /** + * Sets the power mode of the given display. The transition must be + * complete when this function returns. It is valid to call this function + * multiple times with the same power mode. + * + * All displays must support PowerMode.ON and PowerMode.OFF. Whether a + * display supports PowerMode.DOZE or PowerMode.DOZE_SUSPEND may be + * queried using getDozeSupport. + * + * @param display is the display to which the power mode is set. + * @param mode is the new power mode. + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_PARAMETER when mode was not a valid power mode. + * @exception EX_UNSUPPORTED when mode is not supported on this display. + */ + void setPowerMode(long display, PowerMode mode); + + /** + * Sets the readback buffer to be filled with the contents of the next + * composition performed for this display (i.e., the contents present at the + * time of the next validateDisplay/presentDisplay cycle). + * + * This buffer must have been allocated as described in + * getReadbackBufferAttributes and is in the dataspace provided by the same. + * + * Also provides a file descriptor referring to a release sync fence + * object, which must be signaled when it is safe to write to the readback + * buffer. If it is already safe to write to the readback buffer, null may be passed instead. + * + * If there is hardware protected content on the display at the time of the next + * composition, the area of the readback buffer covered by such content must be + * completely black. Any areas of the buffer not covered by such content may + * optionally be black as well. + * + * + * This function must not be called between any call to validateDisplay and a + * subsequent call to presentDisplay. + * + * Parameters: + * @param display - the display on which to create the layer. + * @param buffer - the new readback buffer + * @param releaseFence - a sync fence file descriptor as described above or null if it is + * already safe to write to the readback buffer. + * + * @exception EX_BAD_DISPLAY - an invalid display handle was passed in + * @exception EX_BAD_PARAMETER - the new readback buffer handle was invalid + * + * See also: + * getReadbackBufferAttributes + * getReadbackBufferFence + */ + void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, + in @nullable ParcelFileDescriptor releaseFence); + + /** + * Enables or disables the vsync signal for the given display. Virtual + * displays never generate vsync callbacks, and any attempt to enable + * vsync for a virtual display though this function must succeed and have + * no other effect. + * + * @param display is the display to which the vsync mode is set. + * @param enabled indicates whether to enable or disable vsync + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_PARAMETER when enabled was an invalid value. + */ + void setVsyncEnabled(long display, boolean enabled); + + /** + * Enables or disables the idle timer on this display. + * + * Idle timer is used to allow the display to go into a panel idle mode after some + * idle period. + * + * This function should only be called if the display reports support for + * DisplayCapability.DISPLAY_IDLE_TIMER from getDisplayCapabilities. + * + * @param display is the display to which the idle timer is set. + * @param timeoutMs is the minimum requirements of idle period in milliseconds. Panel + * should not go into the idle state within the minimum requirement after + * idle for a while. 0 means disabled, panel should not go into idle state. + * + * @exception EX_BAD_DISPLAY when an invalid display handle was passed in. + * @exception EX_BAD_PARAMETER when timeout is a negative number. + * @exception EX_UNSUPPORTED when idle is not supported on this display. + * + */ + void setIdleTimerEnabled(long display, int timeoutMs); +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerBrightness.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerBrightness.aidl new file mode 100644 index 0000000000000000000000000000000000000000..146e0127dfb4d5a5fe02c5f2769cc5c4aada80bd --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerBrightness.aidl @@ -0,0 +1,26 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable LayerBrightness { + /** + * Brightness of the current layer, ranging from 0 to 1, where 0 is the minimum brightness of + * the display, and 1 is the current brightness of the display. + */ + float brightness; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f3b67a99b3c4f3acfc715d31eb9d2dd01651788c --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl @@ -0,0 +1,261 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.common.NativeHandle; +import android.hardware.graphics.common.FRect; +import android.hardware.graphics.common.Point; +import android.hardware.graphics.common.Rect; +import android.hardware.graphics.composer3.Buffer; +import android.hardware.graphics.composer3.Color; +import android.hardware.graphics.composer3.LayerBrightness; +import android.hardware.graphics.composer3.ParcelableBlendMode; +import android.hardware.graphics.composer3.ParcelableComposition; +import android.hardware.graphics.composer3.ParcelableDataspace; +import android.hardware.graphics.composer3.ParcelableTransform; +import android.hardware.graphics.composer3.PerFrameMetadata; +import android.hardware.graphics.composer3.PerFrameMetadataBlob; +import android.hardware.graphics.composer3.PlaneAlpha; +import android.hardware.graphics.composer3.ZOrder; + +@VintfStability +parcelable LayerCommand { + /** + * The layer which this commands refers to. + * @see IComposer.createLayer + */ + long layer; + + /** + * Sets the position of a cursor layer. + * + * The position of a cursor layer can be updated without a validate/present display + * sequence if that layer was marked as Composition.CURSOR and validation previously succeeded + * (i.e., the device didn't request a composition). + */ + @nullable Point cursorPosition; + + /** + * Sets the buffer handle to be displayed for this layer. If the buffer + * properties set at allocation time (width, height, format, and usage) + * have not changed since the previous frame, it is not necessary to call + * validateDisplay before calling presentDisplay unless new state needs to + * be validated in the interim. + * + * Also provides a file descriptor referring to an acquire sync fence + * object, which must be signaled when it is safe to read from the given + * buffer. If it is already safe to read from the buffer, an empty handle + * may be passed instead. + * + * This function must return NONE and have no other effect if called for a + * layer with a composition type of Composition.SOLID_COLOR (because it + * has no buffer) or Composition.SIDEBAND or Composition.CLIENT (because + * synchronization and buffer updates for these layers are handled + * elsewhere). + */ + @nullable Buffer buffer; + + /** + * Provides the region of the source buffer which has been modified since + * the last frame. This region does not need to be validated before + * calling presentDisplay. + * + * Once set through this function, the damage region remains the same + * until a subsequent call to this function. + * + * If damage is non-empty, then it may be assumed that any portion of the + * source buffer not covered by one of the rects has not been modified + * this frame. If damage is empty, then the whole source buffer must be + * treated as if it has been modified. + * + * If the layer's contents are not modified relative to the prior frame, + * damage must contain exactly one empty rect([0, 0, 0, 0]). + * + * The damage rects are relative to the pre-transformed buffer, and their + * origin is the top-left corner. They must not exceed the dimensions of + * the latched buffer. + */ + @nullable Rect[] damage; + + /** + * Sets the blend mode of the given layer. + */ + @nullable ParcelableBlendMode blendMode; + + /** + * Sets the color of the given layer. If the composition type of the layer + * is not Composition.SOLID_COLOR, this call must succeed and have no + * other effect. + */ + @nullable Color color; + + /** + * Sets the desired composition type of the given layer. During + * validateDisplay, the device may request changes to the composition + * types of any of the layers as described in the definition of + * Composition above. + */ + @nullable ParcelableComposition composition; + + /** + * Sets the dataspace of the layer. + * + * The dataspace provides more information about how to interpret the buffer + * or solid color, such as the encoding standard and color transform. + * + * See the values of ParcelableDataspace for more information. + */ + @nullable ParcelableDataspace dataspace; + + /** + * Sets the display frame (the portion of the display covered by a layer) + * of the given layer. This frame must not exceed the display dimensions. + */ + @nullable Rect displayFrame; + + /** + * Sets an alpha value (a floating point value in the range [0.0, 1.0]) + * which will be applied to the whole layer. It can be conceptualized as a + * preprocessing step which applies the following function: + * if (blendMode == BlendMode.PREMULTIPLIED) + * out.rgb = in.rgb * planeAlpha + * out.a = in.a * planeAlpha + * + * If the device does not support this operation on a layer which is + * marked Composition.DEVICE, it must request a composition type change + * to Composition.CLIENT upon the next validateDisplay call. + * + */ + @nullable PlaneAlpha planeAlpha; + + /** + * Sets the sideband stream for this layer. If the composition type of the + * given layer is not Composition.SIDEBAND, this call must succeed and + * have no other effect. + */ + @nullable NativeHandle sidebandStream; + + /** + * Sets the source crop (the portion of the source buffer which will fill + * the display frame) of the given layer. This crop rectangle must not + * exceed the dimensions of the latched buffer. + * + * If the device is not capable of supporting a true float source crop + * (i.e., it will truncate or round the floats to integers), it must set + * this layer to Composition.CLIENT when crop is non-integral for the + * most accurate rendering. + * + * If the device cannot support float source crops, but still wants to + * handle the layer, it must use the following code (or similar) to + * convert to an integer crop: + * intCrop.left = (int) ceilf(crop.left); + * intCrop.top = (int) ceilf(crop.top); + * intCrop.right = (int) floorf(crop.right); + * intCrop.bottom = (int) floorf(crop.bottom); + */ + @nullable FRect sourceCrop; + + /** + * Sets the transform (rotation/flip) of the given layer. + */ + @nullable ParcelableTransform transform; + + /** + * Specifies the portion of the layer that is visible, including portions + * under translucent areas of other layers. The region is in screen space, + * and must not exceed the dimensions of the screen. + */ + @nullable Rect[] visibleRegion; + + /** + * Sets the desired Z order (height) of the given layer. A layer with a + * greater Z value occludes a layer with a lesser Z value. + */ + @nullable ZOrder z; + + /** + * Sets a matrix for color transform which will be applied on this layer + * before composition. + * + * If the device is not capable of apply the matrix on this layer, it must force + * this layer to client composition during VALIDATE_DISPLAY. + * + * The matrix provided is an affine color transformation of the following + * form: + * + * |r.r r.g r.b 0| + * |g.r g.g g.b 0| + * |b.r b.g b.b 0| + * |Tr Tg Tb 1| + * + * This matrix must be provided in row-major form: + * + * {r.r, r.g, r.b, 0, g.r, ...}. + * + * Given a matrix of this form and an input color [R_in, G_in, B_in], + * the input color must first be converted to linear space + * [R_linear, G_linear, B_linear], then the output linear color + * [R_out_linear, G_out_linear, B_out_linear] will be: + * + * R_out_linear = R_linear * r.r + G_linear * g.r + B_linear * b.r + Tr + * G_out_linear = R_linear * r.g + G_linear * g.g + B_linear * b.g + Tg + * B_out_linear = R_linear * r.b + G_linear * g.b + B_linear * b.b + Tb + * + * [R_out_linear, G_out_linear, B_out_linear] must then be converted to + * gamma space: [R_out, G_out, B_out] before blending. + */ + @nullable float[] colorTransform; + + /** + * Sets the desired brightness for the layer. This is intended to be used for instance when + * presenting an SDR layer alongside HDR content. The HDR content will be presented at the + * display brightness in nits, and accordingly SDR content shall be dimmed according to the + * provided brightness ratio. + */ + @nullable LayerBrightness brightness; + + /** + * Sets the PerFrameMetadata for the display. This metadata must be used + * by the implementation to better tone map content to that display. + * + * This is a command that may be called every frame. + */ + @nullable PerFrameMetadata[] perFrameMetadata; + + /** + * This command sends metadata that may be used for tone-mapping the + * associated layer. The metadata structure follows a {key, blob} + * format (see the PerFrameMetadataBlob struct). All keys must be + * returned by a prior call to getPerFrameMetadataKeys and must + * be part of the list of keys associated with blob-type metadata + * (see PerFrameMetadataKey). + * + * This command may be called every frame. + */ + @nullable PerFrameMetadataBlob[] perFrameMetadataBlob; + + /** + * Specifies a region of the layer that is transparent and may be skipped + * by the DPU, e.g. using a blocking region, in order to save power. This + * is only a hint, so the composition of the layer must look the same + * whether or not this region is skipped. + * + * The region is in screen space and must not exceed the dimensions of + * the screen. + */ + @nullable Rect[] blockingRegion; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableBlendMode.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableBlendMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6c016ab4be8c679d7e4dce76c576d472e71a459 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableBlendMode.aidl @@ -0,0 +1,24 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.common.BlendMode; + +@VintfStability +parcelable ParcelableBlendMode { + BlendMode blendMode; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableComposition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableComposition.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0946ce75cd6149a96e5891a88d4736d920fcb4b7 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableComposition.aidl @@ -0,0 +1,24 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.Composition; + +@VintfStability +parcelable ParcelableComposition { + Composition composition; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableDataspace.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableDataspace.aidl new file mode 100644 index 0000000000000000000000000000000000000000..528cdf96c9fb229fca30b7912ea60a694a716636 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableDataspace.aidl @@ -0,0 +1,24 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.common.Dataspace; + +@VintfStability +parcelable ParcelableDataspace { + Dataspace dataspace; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableTransform.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableTransform.aidl new file mode 100644 index 0000000000000000000000000000000000000000..75f9f7e319f7f6a2d186bd2163524e7d07782848 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ParcelableTransform.aidl @@ -0,0 +1,24 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.common.Transform; + +@VintfStability +parcelable ParcelableTransform { + Transform transform; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadata.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadata.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6588a43128241ff56cbaedf3bed4a8a71230a04 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadata.aidl @@ -0,0 +1,32 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.PerFrameMetadataKey; + +/** + * PerFrameMetadata + * This struct encapsulates float-valued + * metadata - key must not be in the list + * of keys representing blob-formatted metadata + * (see PerFrameMetadataKey) + */ +@VintfStability +parcelable PerFrameMetadata { + PerFrameMetadataKey key; + float value; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a82773c0dcdc841fcaaba65422fc7b6018eccbf1 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl @@ -0,0 +1,33 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.PerFrameMetadataKey; + +/** + * PerFrameMetadataBlob + * This struct encapsulates blob + * metadata - key must be one of the list of keys + * associated with blob-type metadata key + * and the blob must adhere to the format specified by + * that key (See PerFrameMetadataKey). + */ +@VintfStability +parcelable PerFrameMetadataBlob { + PerFrameMetadataKey key; + byte[] blob; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3962920d49688f6f95b775d4b6d58c0b049a3d62 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl @@ -0,0 +1,90 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * PerFrameMetadataKey + * + * A set of PerFrameMetadataKey pertains specifically to blob-formatted + * metadata (as opposed to float-valued metadata). + * The list of keys that represent blobs are: + * 1. HDR10_PLUS_SEI + */ +@VintfStability +@Backing(type="int") +enum PerFrameMetadataKey { + /** + * SMPTE ST 2084:2014. + * Coordinates defined in CIE 1931 xy chromaticity space + * + * + * SMPTE ST 2084:2014 + */ + DISPLAY_RED_PRIMARY_X, + /** + * SMPTE ST 2084:2014 + */ + DISPLAY_RED_PRIMARY_Y, + /** + * SMPTE ST 2084:2014 + */ + DISPLAY_GREEN_PRIMARY_X, + /** + * SMPTE ST 2084:2014 + */ + DISPLAY_GREEN_PRIMARY_Y, + /** + * SMPTE ST 2084:2014 + */ + DISPLAY_BLUE_PRIMARY_X, + /** + * SMPTE ST 2084:2014 + */ + DISPLAY_BLUE_PRIMARY_Y, + /** + * SMPTE ST 2084:2014 + */ + WHITE_POINT_X, + /** + * SMPTE ST 2084:2014 + */ + WHITE_POINT_Y, + /** + * SMPTE ST 2084:2014. + * Units: nits + * max as defined by ST 2048: 10,000 nits + */ + MAX_LUMINANCE, + /** + * SMPTE ST 2084:2014 + */ + MIN_LUMINANCE, + /** + * CTA 861.3 + */ + MAX_CONTENT_LIGHT_LEVEL, + /** + * CTA 861.3 + */ + MAX_FRAME_AVERAGE_LIGHT_LEVEL, + /** + * HDR10+ metadata + * Specifies a metadata blob adhering to + * the ST2094-40 SEI message spec, Version 1.0 + */ + HDR10_PLUS_SEI, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PlaneAlpha.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PlaneAlpha.aidl new file mode 100644 index 0000000000000000000000000000000000000000..347dc19a15d2b7e6ac9296cf7bc8561655444af9 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PlaneAlpha.aidl @@ -0,0 +1,27 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable PlaneAlpha { + /** + * An alpha value (a floating point value in the range [0.0, 1.0]) + * which will be applied to a whole layer. + * @see LayerCommand.planeAlpha + */ + float alpha; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PowerMode.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PowerMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c56933e88463dbb5938515c4d8011ea68efdff9 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PowerMode.aidl @@ -0,0 +1,68 @@ +/** + * 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 android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.PowerMode; + +@VintfStability +@Backing(type="int") +enum PowerMode { + /** + * The display is fully off (blanked). + */ + OFF = 0, + /** + * These are optional low power modes. getDozeSupport may be called to + * determine whether a given display supports these modes. + * + * + * The display is turned on and configured in a low power state that + * is suitable for presenting ambient information to the user, + * possibly with lower fidelity than ON, but with greater efficiency. + */ + DOZE = 1, + /** + * The display is configured as in DOZE but may stop applying display + * updates from the client. This is effectively a hint to the device + * that drawing to the display has been suspended and that the + * device must remain on in a low power state and continue + * displaying its current contents indefinitely until the power mode + * changes. + * + * This mode may also be used as a signal to enable hardware-based + * doze functionality. In this case, the device is free to take over + * the display and manage it autonomously to implement a low power + * always-on display. + */ + DOZE_SUSPEND = 3, + /** + * The display is fully on. + */ + ON = 2, + /** + * The display is configured as in ON but may stop applying display + * updates from the client. This is effectively a hint to the device + * that drawing to the display has been suspended and that the + * device must remain on and continue displaying its current contents + * indefinitely until the power mode changes. + * + * This mode may also be used as a signal to enable hardware-based + * functionality to take over the display and manage it autonomously + * to implement a low power always-on display. + */ + ON_SUSPEND = 4, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl new file mode 100644 index 0000000000000000000000000000000000000000..244b4e5af3a624228302cb71794e365d50e7b633 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl @@ -0,0 +1,31 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable PresentFence { + /** + * The display which this commands refers to. + * @see IComposer.createDisplay + */ + long display; + + /** + * The present fence for this display. + */ + ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5ae8940be08167b3eb9c06ace9b52b145392e907 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl @@ -0,0 +1,32 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable PresentOrValidate { + /** + * The display which this commands refers to. + * @see IComposer.createDisplay + */ + long display; + + /** + * Whether PresentOrValidate presented or validated the display. + */ + @VintfStability enum Result { Validated, Presented } + Result result; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8241dddf821c09962abd1efdedd9bbab29d34925 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl @@ -0,0 +1,23 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable ReadbackBufferAttributes { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl new file mode 100644 index 0000000000000000000000000000000000000000..459a04265f66161415d89771aea59098c5f9adb7 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl @@ -0,0 +1,44 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable ReleaseFences { + /** + * The display which this commands refers to. + * @see IComposer.createDisplay + */ + long display; + @VintfStability + parcelable Layer { + /** + * The layer which this commands refers to. + * @see IComposer.createLayer + */ + long layer; + + /** + * The release fence for this layer. + */ + ParcelFileDescriptor fence; + } + + /** + * The layers which has release fences. + */ + Layer[] layers; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/RenderIntent.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/RenderIntent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..debf32c372596dc5549f85f8b8012f3d0e0cbca6 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/RenderIntent.aidl @@ -0,0 +1,68 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * RenderIntent defines the mapping from color mode colors to display colors. + * + * A render intent must not change how it maps colors when the color mode + * changes. That is to say that when a render intent maps color C to color C', + * the fact that color C can have different pixel values in different color + * modes should not affect the mapping. + * + * RenderIntent overrides the render intents defined for individual color + * modes. It is ignored when the color mode is ColorMode.NATIVE, because + * ColorMode.NATIVE colors are already display colors. + */ +@VintfStability +@Backing(type="int") +enum RenderIntent { + /** + * Colors in the display gamut are unchanged. Colors out of the display + * gamut are hard-clipped. + * + * This implies that the display must have been calibrated unless + * ColorMode.NATIVE is the only supported color mode. + */ + COLORIMETRIC = 0, + /** + * Enhance colors that are in the display gamut. Colors out of the display + * gamut are hard-clipped. + * + * The enhancement typically picks the biggest standard color space (e.g. + * DCI-P3) that is narrower than the display gamut and stretches it to the + * display gamut. The stretching is recommended to preserve skin tones. + */ + ENHANCE = 1, + /** + * Tone map high-dynamic-range colors to the display's dynamic range. The + * dynamic range of the colors are communicated separately. After tone + * mapping, the mapping to the display gamut is as defined in + * COLORIMETRIC. + */ + TONE_MAP_COLORIMETRIC = 2, + /** + * Tone map high-dynamic-range colors to the display's dynamic range. The + * dynamic range of the colors are communicated separately. After tone + * mapping, the mapping to the display gamut is as defined in ENHANCE. + * + * The tone mapping step and the enhancing step must match + * TONE_MAP_COLORIMETRIC and ENHANCE respectively when they are also + * supported. + */ + TONE_MAP_ENHANCE = 3, +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/VirtualDisplay.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/VirtualDisplay.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8bbdfe364025f12bc983bea1b1f64ba0c12e9bd5 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/VirtualDisplay.aidl @@ -0,0 +1,32 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * The return value from IComposerClient.createVirtualDisplay + */ +@VintfStability +parcelable VirtualDisplay { + /** + * The newly-created virtual display. + */ + long display; + /** + * The format of the buffer the device will produce. + */ + android.hardware.graphics.common.PixelFormat format; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5ae6f3d648670a883bf1034ae9ac678165b039b7 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl @@ -0,0 +1,34 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Constraints for changing vsync period. + */ +@VintfStability +parcelable VsyncPeriodChangeConstraints { + /** + * Time in CLOCK_MONOTONIC after which the vsync period may change + * (i.e., the vsync period must not change before this time). + */ + long desiredTimeNanos; + /** + * If true, requires that the vsync period change must happen seamlessly without + * a noticeable visual artifact. + */ + boolean seamlessRequired; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl new file mode 100644 index 0000000000000000000000000000000000000000..13fd0510849e2a6db7afcd004fca1109306314e6 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl @@ -0,0 +1,39 @@ +/** + * 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 android.hardware.graphics.composer3; + +/** + * Timing for a vsync period change. + */ +@VintfStability +parcelable VsyncPeriodChangeTimeline { + /** + * The time in CLOCK_MONOTONIC when the new display will start to refresh at + * the new vsync period. + */ + long newVsyncAppliedTimeNanos; + /** + * Set to true if the client is required to send a frame to be displayed before + * the change can take place. + */ + boolean refreshRequired; + /** + * The time in CLOCK_MONOTONIC when the client is expected to send the new frame. + * Should be ignored if refreshRequired is false. + */ + long refreshTimeNanos; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ZOrder.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ZOrder.aidl new file mode 100644 index 0000000000000000000000000000000000000000..56cc2000ac66b09f0485f3586e8e075217dd2a0b --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ZOrder.aidl @@ -0,0 +1,27 @@ +/** + * 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 android.hardware.graphics.composer3; + +@VintfStability +parcelable ZOrder { + /** + * The desired Z order (height) of the given layer. A layer with a + * greater Z value occludes a layer with a lesser Z value. + * @see LayerCommand.z; + */ + int z; +} diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h new file mode 100644 index 0000000000000000000000000000000000000000..27dce76377def62a54251e9f18ec46f5081b2268 --- /dev/null +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h @@ -0,0 +1,227 @@ +/* + * Copyright 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + + +#include +#include + + +using aidl::android::hardware::graphics::common::Dataspace; + +namespace aidl::android::hardware::graphics::composer3 { + +class ComposerClientReader { + public: + ~ComposerClientReader() { resetData(); } + + // Parse and execute commands from the command queue. The commands are + // actually return values from the server and will be saved in ReturnData. + void parse(std::vector&& results) { + resetData(); + + for (auto& result : results) { + switch (result.getTag()) { + case CommandResultPayload::Tag::error: + parseSetError(std::move(result.get())); + break; + case CommandResultPayload::Tag::changedCompositionTypes: + parseSetChangedCompositionTypes(std::move( + result.get())); + break; + case CommandResultPayload::Tag::displayRequest: + parseSetDisplayRequests( + std::move(result.get())); + break; + case CommandResultPayload::Tag::presentFence: + parseSetPresentFence( + std::move(result.get())); + break; + case CommandResultPayload::Tag::releaseFences: + parseSetReleaseFences( + std::move(result.get())); + break; + case CommandResultPayload::Tag::presentOrValidateResult: + parseSetPresentOrValidateDisplayResult(std::move( + result.get())); + break; + case CommandResultPayload::Tag::clientTargetProperty: + parseSetClientTargetProperty(std::move( + result.get())); + break; + } + } + } + + std::vector takeErrors() { return std::move(mErrors); } + + void hasChanges(int64_t display, uint32_t* outNumChangedCompositionTypes, + uint32_t* outNumLayerRequestMasks) const { + auto found = mReturnData.find(display); + if (found == mReturnData.end()) { + *outNumChangedCompositionTypes = 0; + *outNumLayerRequestMasks = 0; + return; + } + + const ReturnData& data = found->second; + + *outNumChangedCompositionTypes = static_cast(data.changedLayers.size()); + *outNumLayerRequestMasks = static_cast(data.displayRequests.layerRequests.size()); + } + + // Get and clear saved changed composition types. + std::vector takeChangedCompositionTypes(int64_t display) { + auto found = mReturnData.find(display); + if (found == mReturnData.end()) { + return {}; + } + + ReturnData& data = found->second; + return std::move(data.changedLayers); + } + + // Get and clear saved display requests. + DisplayRequest takeDisplayRequests(int64_t display) { + auto found = mReturnData.find(display); + if (found == mReturnData.end()) { + return {}; + } + + ReturnData& data = found->second; + return std::move(data.displayRequests); + } + + // Get and clear saved release fences. + std::vector takeReleaseFences(int64_t display) { + auto found = mReturnData.find(display); + if (found == mReturnData.end()) { + return {}; + } + + ReturnData& data = found->second; + return std::move(data.releasedLayers); + } + + // Get and clear saved present fence. + ndk::ScopedFileDescriptor takePresentFence(int64_t display) { + auto found = mReturnData.find(display); + if (found == mReturnData.end()) { + return {}; + } + + ReturnData& data = found->second; + return std::move(data.presentFence); + } + + // Get what stage succeeded during PresentOrValidate: Present or Validate + std::optional takePresentOrValidateStage(int64_t display) { + auto found = mReturnData.find(display); + if (found == mReturnData.end()) { + return std::nullopt; + } + ReturnData& data = found->second; + return data.presentOrValidateState; + } + + // Get the client target properties requested by hardware composer. + ClientTargetPropertyWithBrightness takeClientTargetProperty(int64_t display) { + auto found = mReturnData.find(display); + + // If not found, return the default values. + if (found == mReturnData.end()) { + return ClientTargetPropertyWithBrightness{ + .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN}, + .brightness = 1.f, + }; + } + + ReturnData& data = found->second; + return std::move(data.clientTargetProperty); + } + + private: + void resetData() { + mErrors.clear(); + mReturnData.clear(); + } + + void parseSetError(CommandError&& error) { mErrors.emplace_back(error); } + + void parseSetChangedCompositionTypes(ChangedCompositionTypes&& changedCompositionTypes) { + auto& data = mReturnData[changedCompositionTypes.display]; + data.changedLayers = std::move(changedCompositionTypes.layers); + } + + void parseSetDisplayRequests(DisplayRequest&& displayRequest) { + auto& data = mReturnData[displayRequest.display]; + data.displayRequests = std::move(displayRequest); + } + + void parseSetPresentFence(PresentFence&& presentFence) { + auto& data = mReturnData[presentFence.display]; + data.presentFence = std::move(presentFence.fence); + } + + void parseSetReleaseFences(ReleaseFences&& releaseFences) { + auto& data = mReturnData[releaseFences.display]; + data.releasedLayers = std::move(releaseFences.layers); + } + + void parseSetPresentOrValidateDisplayResult(const PresentOrValidate&& presentOrValidate) { + auto& data = mReturnData[presentOrValidate.display]; + data.presentOrValidateState = std::move(presentOrValidate.result); + } + + void parseSetClientTargetProperty( + const ClientTargetPropertyWithBrightness&& clientTargetProperty) { + auto& data = mReturnData[clientTargetProperty.display]; + data.clientTargetProperty = std::move(clientTargetProperty); + } + + struct ReturnData { + DisplayRequest displayRequests; + std::vector changedLayers; + ndk::ScopedFileDescriptor presentFence; + std::vector releasedLayers; + PresentOrValidate::Result presentOrValidateState; + + ClientTargetPropertyWithBrightness clientTargetProperty = { + .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN}, + .brightness = 1.f, + }; + }; + + std::vector mErrors; + std::unordered_map mReturnData; +}; + +} // namespace aidl::android::hardware::graphics::composer3 diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..1d81f7b6029de1049f295ba4caca0fc26fc7062a --- /dev/null +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h @@ -0,0 +1,276 @@ +/* + * Copyright 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +using aidl::android::hardware::graphics::common::BlendMode; +using aidl::android::hardware::graphics::common::ColorTransform; +using aidl::android::hardware::graphics::common::Dataspace; +using aidl::android::hardware::graphics::common::FRect; +using aidl::android::hardware::graphics::common::Rect; +using aidl::android::hardware::graphics::common::Transform; + +using namespace aidl::android::hardware::graphics::composer3; + +using aidl::android::hardware::common::NativeHandle; + +namespace aidl::android::hardware::graphics::composer3 { + +class ComposerClientWriter { + public: + static constexpr std::optional kNoTimestamp = std::nullopt; + + ComposerClientWriter() { reset(); } + + virtual ~ComposerClientWriter() { reset(); } + + void reset() { + mDisplayCommand.reset(); + mLayerCommand.reset(); + mCommands.clear(); + } + + void setColorTransform(int64_t display, const float* matrix) { + std::vector matVec; + matVec.reserve(16); + matVec.assign(matrix, matrix + 16); + getDisplayCommand(display).colorTransformMatrix.emplace(std::move(matVec)); + } + + void setDisplayBrightness(int64_t display, float brightness, float brightnessNits) { + getDisplayCommand(display).brightness.emplace( + DisplayBrightness{.brightness = brightness, .brightnessNits = brightnessNits}); + } + + void setClientTarget(int64_t display, uint32_t slot, const native_handle_t* target, + int acquireFence, Dataspace dataspace, const std::vector& damage) { + ClientTarget clientTargetCommand; + clientTargetCommand.buffer = getBuffer(slot, target, acquireFence); + clientTargetCommand.dataspace = dataspace; + clientTargetCommand.damage.assign(damage.begin(), damage.end()); + getDisplayCommand(display).clientTarget.emplace(std::move(clientTargetCommand)); + } + + void setOutputBuffer(int64_t display, uint32_t slot, const native_handle_t* buffer, + int releaseFence) { + getDisplayCommand(display).virtualDisplayOutputBuffer.emplace( + getBuffer(slot, buffer, releaseFence)); + } + + void validateDisplay(int64_t display, + std::optional expectedPresentTime) { + auto& command = getDisplayCommand(display); + command.expectedPresentTime = expectedPresentTime; + command.validateDisplay = true; + } + + void presentOrvalidateDisplay(int64_t display, + std::optional expectedPresentTime) { + auto& command = getDisplayCommand(display); + command.expectedPresentTime = expectedPresentTime; + command.presentOrValidateDisplay = true; + } + + void acceptDisplayChanges(int64_t display) { + getDisplayCommand(display).acceptDisplayChanges = true; + } + + void presentDisplay(int64_t display) { getDisplayCommand(display).presentDisplay = true; } + + void setLayerCursorPosition(int64_t display, int64_t layer, int32_t x, int32_t y) { + common::Point cursorPosition; + cursorPosition.x = x; + cursorPosition.y = y; + getLayerCommand(display, layer).cursorPosition.emplace(std::move(cursorPosition)); + } + + void setLayerBuffer(int64_t display, int64_t layer, uint32_t slot, + const native_handle_t* buffer, int acquireFence) { + getLayerCommand(display, layer).buffer = getBuffer(slot, buffer, acquireFence); + } + + void setLayerSurfaceDamage(int64_t display, int64_t layer, const std::vector& damage) { + getLayerCommand(display, layer).damage.emplace(damage.begin(), damage.end()); + } + + void setLayerBlendMode(int64_t display, int64_t layer, BlendMode mode) { + ParcelableBlendMode parcelableBlendMode; + parcelableBlendMode.blendMode = mode; + getLayerCommand(display, layer).blendMode.emplace(std::move(parcelableBlendMode)); + } + + void setLayerColor(int64_t display, int64_t layer, Color color) { + getLayerCommand(display, layer).color.emplace(std::move(color)); + } + + void setLayerCompositionType(int64_t display, int64_t layer, Composition type) { + ParcelableComposition compositionPayload; + compositionPayload.composition = type; + getLayerCommand(display, layer).composition.emplace(std::move(compositionPayload)); + } + + void setLayerDataspace(int64_t display, int64_t layer, Dataspace dataspace) { + ParcelableDataspace dataspacePayload; + dataspacePayload.dataspace = dataspace; + getLayerCommand(display, layer).dataspace.emplace(std::move(dataspacePayload)); + } + + void setLayerDisplayFrame(int64_t display, int64_t layer, const Rect& frame) { + getLayerCommand(display, layer).displayFrame.emplace(frame); + } + + void setLayerPlaneAlpha(int64_t display, int64_t layer, float alpha) { + PlaneAlpha planeAlpha; + planeAlpha.alpha = alpha; + getLayerCommand(display, layer).planeAlpha.emplace(std::move(planeAlpha)); + } + + void setLayerSidebandStream(int64_t display, int64_t layer, const native_handle_t* stream) { + NativeHandle handle; + if (stream) handle = ::android::dupToAidl(stream); + getLayerCommand(display, layer).sidebandStream.emplace(std::move(handle)); + } + + void setLayerSourceCrop(int64_t display, int64_t layer, const FRect& crop) { + getLayerCommand(display, layer).sourceCrop.emplace(crop); + } + + void setLayerTransform(int64_t display, int64_t layer, Transform transform) { + ParcelableTransform transformPayload; + transformPayload.transform = transform; + getLayerCommand(display, layer).transform.emplace(std::move(transformPayload)); + } + + void setLayerVisibleRegion(int64_t display, int64_t layer, const std::vector& visible) { + getLayerCommand(display, layer).visibleRegion.emplace(visible.begin(), visible.end()); + } + + void setLayerZOrder(int64_t display, int64_t layer, uint32_t z) { + ZOrder zorder; + zorder.z = static_cast(z); + getLayerCommand(display, layer).z.emplace(std::move(zorder)); + } + + void setLayerPerFrameMetadata(int64_t display, int64_t layer, + const std::vector& metadataVec) { + getLayerCommand(display, layer) + .perFrameMetadata.emplace(metadataVec.begin(), metadataVec.end()); + } + + void setLayerColorTransform(int64_t display, int64_t layer, const float* matrix) { + getLayerCommand(display, layer).colorTransform.emplace(matrix, matrix + 16); + } + + void setLayerPerFrameMetadataBlobs(int64_t display, int64_t layer, + const std::vector& metadata) { + getLayerCommand(display, layer) + .perFrameMetadataBlob.emplace(metadata.begin(), metadata.end()); + } + + void setLayerBrightness(int64_t display, int64_t layer, float brightness) { + getLayerCommand(display, layer) + .brightness.emplace(LayerBrightness{.brightness = brightness}); + } + + void setLayerBlockingRegion(int64_t display, int64_t layer, const std::vector& blocking) { + getLayerCommand(display, layer).blockingRegion.emplace(blocking.begin(), blocking.end()); + } + + const std::vector& getPendingCommands() { + flushLayerCommand(); + flushDisplayCommand(); + return mCommands; + } + + private: + std::optional mDisplayCommand; + std::optional mLayerCommand; + std::vector mCommands; + + Buffer getBuffer(uint32_t slot, const native_handle_t* bufferHandle, int fence) { + Buffer bufferCommand; + bufferCommand.slot = static_cast(slot); + if (bufferHandle) bufferCommand.handle.emplace(::android::dupToAidl(bufferHandle)); + if (fence > 0) bufferCommand.fence = ::ndk::ScopedFileDescriptor(fence); + return bufferCommand; + } + + void flushLayerCommand() { + if (mLayerCommand.has_value()) { + mDisplayCommand->layers.emplace_back(std::move(*mLayerCommand)); + mLayerCommand.reset(); + } + } + + void flushDisplayCommand() { + if (mDisplayCommand.has_value()) { + mCommands.emplace_back(std::move(*mDisplayCommand)); + mDisplayCommand.reset(); + } + } + + DisplayCommand& getDisplayCommand(int64_t display) { + if (!mDisplayCommand.has_value() || mDisplayCommand->display != display) { + flushLayerCommand(); + flushDisplayCommand(); + mDisplayCommand.emplace(); + mDisplayCommand->display = display; + } + return *mDisplayCommand; + } + + LayerCommand& getLayerCommand(int64_t display, int64_t layer) { + getDisplayCommand(display); + if (!mLayerCommand.has_value() || mLayerCommand->layer != layer) { + flushLayerCommand(); + mLayerCommand.emplace(); + mLayerCommand->layer = layer; + } + return *mLayerCommand; + } +}; + +} // namespace aidl::android::hardware::graphics::composer3 diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..34cda6a7706ac2f808d941a8f132c5ddc66ed18e --- /dev/null +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h @@ -0,0 +1,128 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "Util.h" + +namespace aidl::android::hardware::graphics::composer3::impl { + +class ComposerServiceWriter { + public: + ComposerServiceWriter() { reset(); } + + virtual ~ComposerServiceWriter() { reset(); } + + void reset() { mCommandsResults.clear(); } + + void setError(int32_t index, int32_t errorCode) { + CommandError error; + error.commandIndex = index; + error.errorCode = errorCode; + mCommandsResults.emplace_back(std::move(error)); + } + + void setPresentOrValidateResult(int64_t display, PresentOrValidate::Result result) { + PresentOrValidate presentOrValidate; + presentOrValidate.display = display; + presentOrValidate.result = result; + mCommandsResults.emplace_back(std::move(presentOrValidate)); + } + + void setChangedCompositionTypes(int64_t display, const std::vector& layers, + const std::vector& types) { + ChangedCompositionTypes changedCompositionTypes; + changedCompositionTypes.display = display; + changedCompositionTypes.layers.reserve(layers.size()); + for (int i = 0; i < layers.size(); i++) { + auto layer = ChangedCompositionLayer{.layer = layers[i], .composition = types[i]}; + changedCompositionTypes.layers.emplace_back(std::move(layer)); + } + mCommandsResults.emplace_back(std::move(changedCompositionTypes)); + } + + void setDisplayRequests(int64_t display, int32_t displayRequestMask, + const std::vector& layers, + const std::vector& layerRequestMasks) { + DisplayRequest displayRequest; + displayRequest.display = display; + displayRequest.mask = displayRequestMask; + displayRequest.layerRequests.reserve(layers.size()); + for (int i = 0; i < layers.size(); i++) { + auto layerRequest = + DisplayRequest::LayerRequest{.layer = layers[i], .mask = layerRequestMasks[i]}; + displayRequest.layerRequests.emplace_back(std::move(layerRequest)); + } + mCommandsResults.emplace_back(std::move(displayRequest)); + } + + void setPresentFence(int64_t display, ::ndk::ScopedFileDescriptor presentFence) { + if (presentFence.get() >= 0) { + PresentFence presentFenceCommand; + presentFenceCommand.fence = std::move(presentFence); + presentFenceCommand.display = display; + mCommandsResults.emplace_back(std::move(presentFenceCommand)); + } else { + LOG(WARNING) << __func__ << ": invalid present fence " << presentFence.get(); + } + } + + void setReleaseFences(int64_t display, const std::vector& layers, + std::vector<::ndk::ScopedFileDescriptor> releaseFences) { + ReleaseFences releaseFencesCommand; + releaseFencesCommand.display = display; + for (int i = 0; i < layers.size(); i++) { + if (releaseFences[i].get() >= 0) { + ReleaseFences::Layer layer; + layer.layer = layers[i]; + layer.fence = std::move(releaseFences[i]); + releaseFencesCommand.layers.emplace_back(std::move(layer)); + } else { + LOG(WARNING) << __func__ << ": invalid release fence " << releaseFences[i].get(); + } + } + mCommandsResults.emplace_back(std::move(releaseFencesCommand)); + } + + void setClientTargetProperty(int64_t display, const ClientTargetProperty& clientTargetProperty, + float brightness, const DimmingStage& dimmingStage) { + ClientTargetPropertyWithBrightness clientTargetPropertyWithBrightness; + clientTargetPropertyWithBrightness.display = display; + clientTargetPropertyWithBrightness.clientTargetProperty = clientTargetProperty; + clientTargetPropertyWithBrightness.brightness = brightness; + clientTargetPropertyWithBrightness.dimmingStage = dimmingStage; + mCommandsResults.emplace_back(std::move(clientTargetPropertyWithBrightness)); + } + + std::vector getPendingCommandResults() { + return std::move(mCommandsResults); + } + + private: + std::vector mCommandsResults; +}; + +} // namespace aidl::android::hardware::graphics::composer3::impl \ No newline at end of file diff --git a/graphics/composer/aidl/vts/Android.bp b/graphics/composer/aidl/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..1e70a0ec45bed857b707a5e3f142f37810f09be6 --- /dev/null +++ b/graphics/composer/aidl/vts/Android.bp @@ -0,0 +1,100 @@ +/** + * 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: "VtsHalGraphicsComposer3_TargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + // Needed for librenderengine + "skia_deps", + ], + srcs: [ + "VtsHalGraphicsComposer3_TargetTest.cpp", + "VtsHalGraphicsComposer3_ReadbackTest.cpp", + "GraphicsComposerCallback.cpp", + "ReadbackVts.cpp", + "RenderEngineVts.cpp", + "VtsComposerClient.cpp", + ], + + shared_libs: [ + "libEGL", + "libGLESv1_CM", + "libGLESv2", + "libbinder_ndk", + "libbinder", + "libfmq", + "libbase", + "libsync", + "libui", + "libgui", + "libhidlbase", + "libprocessgroup", + "libtinyxml2", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@2.1", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + "android.hardware.graphics.allocator@2.0", + "android.hardware.graphics.allocator@3.0", + "android.hardware.graphics.allocator@4.0", + "libvndksupport", + ], + header_libs: [ + "android.hardware.graphics.composer3-command-buffer", + ], + static_libs: [ + "android.hardware.graphics.composer3-V1-ndk", + "android.hardware.graphics.common-V3-ndk", + "android.hardware.graphics.common@1.2", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", + "android.hardware.graphics.allocator@2.0", + "android.hardware.graphics.allocator@3.0", + "android.hardware.graphics.allocator@4.0", + "android.hardware.graphics.mapper@2.0-vts", + "android.hardware.graphics.mapper@2.1-vts", + "android.hardware.graphics.mapper@3.0-vts", + "android.hardware.graphics.mapper@4.0-vts", + "libaidlcommonsupport", + "libarect", + "libbase", + "libfmq", + "libgtest", + "libmath", + "librenderengine", + "libshaders", + "libsync", + "libtonemap", + ], + cflags: [ + "-Wconversion", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/graphics/composer/aidl/vts/AndroidTest.xml b/graphics/composer/aidl/vts/AndroidTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..3f9971beb3ed85a6d0a857c97bf9e939362d3c69 --- /dev/null +++ b/graphics/composer/aidl/vts/AndroidTest.xml @@ -0,0 +1,36 @@ + + + + + diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d53494325afe425227afc80c2d6a6437e3b9dd67 --- /dev/null +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp @@ -0,0 +1,163 @@ +/** + * 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. + */ + +#include "GraphicsComposerCallback.h" +#include +#include + +#pragma push_macro("LOG_TAG") +#undef LOG_TAG +#define LOG_TAG "GraphicsComposerCallback" + +namespace aidl::android::hardware::graphics::composer3::vts { + +void GraphicsComposerCallback::setVsyncAllowed(bool allowed) { + std::scoped_lock lock(mMutex); + mVsyncAllowed = allowed; +} + +std::vector GraphicsComposerCallback::getDisplays() const { + std::scoped_lock lock(mMutex); + return mDisplays; +} + +int32_t GraphicsComposerCallback::getInvalidHotplugCount() const { + std::scoped_lock lock(mMutex); + return mInvalidHotplugCount; +} + +int32_t GraphicsComposerCallback::getInvalidRefreshCount() const { + std::scoped_lock lock(mMutex); + return mInvalidRefreshCount; +} + +int32_t GraphicsComposerCallback::getInvalidVsyncCount() const { + std::scoped_lock lock(mMutex); + return mInvalidVsyncCount; +} + +int32_t GraphicsComposerCallback::getInvalidVsyncPeriodChangeCount() const { + std::scoped_lock lock(mMutex); + return mInvalidVsyncPeriodChangeCount; +} + +int32_t GraphicsComposerCallback::getInvalidSeamlessPossibleCount() const { + std::scoped_lock lock(mMutex); + return mInvalidSeamlessPossibleCount; +} + +int32_t GraphicsComposerCallback::getVsyncIdleCount() const { + std::scoped_lock lock(mMutex); + return mVsyncIdleCount; +} + +int64_t GraphicsComposerCallback::getVsyncIdleTime() const { + std::scoped_lock lock(mMutex); + return mVsyncIdleTime; +} + +std::optional +GraphicsComposerCallback::takeLastVsyncPeriodChangeTimeline() { + std::scoped_lock lock(mMutex); + + std::optional ret; + ret.swap(mTimeline); + + return ret; +} + +::ndk::ScopedAStatus GraphicsComposerCallback::onHotplug(int64_t in_display, bool in_connected) { + std::scoped_lock lock(mMutex); + + const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display); + if (in_connected) { + if (it == mDisplays.end()) { + mDisplays.push_back(in_display); + } else { + mInvalidHotplugCount++; + } + } else { + if (it != mDisplays.end()) { + mDisplays.erase(it); + } else { + mInvalidHotplugCount++; + } + } + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus GraphicsComposerCallback::onRefresh(int64_t in_display) { + std::scoped_lock lock(mMutex); + + const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display); + if (it == mDisplays.end()) { + mInvalidRefreshCount++; + } + + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus GraphicsComposerCallback::onVsync(int64_t in_display, int64_t in_timestamp, + int32_t in_vsyncPeriodNanos) { + std::scoped_lock lock(mMutex); + + const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display); + if (!mVsyncAllowed || it == mDisplays.end()) { + mInvalidVsyncCount++; + } + + ALOGV("%ld, %d", static_cast(in_timestamp), in_vsyncPeriodNanos); + + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncPeriodTimingChanged( + int64_t in_display, + const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline& + in_updatedTimeline) { + std::scoped_lock lock(mMutex); + + const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display); + if (it == mDisplays.end()) { + mInvalidVsyncPeriodChangeCount++; + } + mTimeline = in_updatedTimeline; + + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus GraphicsComposerCallback::onSeamlessPossible(int64_t in_display) { + std::scoped_lock lock(mMutex); + + const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display); + if (it != mDisplays.end()) { + mInvalidSeamlessPossibleCount++; + } + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncIdle(int64_t in_display) { + std::scoped_lock lock(mMutex); + + const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display); + if (it != mDisplays.end()) { + mVsyncIdleCount++; + mVsyncIdleTime = systemTime(); + } + return ::ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h new file mode 100644 index 0000000000000000000000000000000000000000..e54da346f5fb0402bc2d77ce7d1e2927f0c5368c --- /dev/null +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h @@ -0,0 +1,78 @@ +/** + * 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. + */ +#pragma once + +#include +#include +#include +#include + +namespace aidl::android::hardware::graphics::composer3::vts { + +class GraphicsComposerCallback : public BnComposerCallback { + public: + void setVsyncAllowed(bool allowed); + + std::vector getDisplays() const; + + int32_t getInvalidHotplugCount() const; + + int32_t getInvalidRefreshCount() const; + + int32_t getInvalidVsyncCount() const; + + int32_t getInvalidVsyncPeriodChangeCount() const; + + int32_t getInvalidSeamlessPossibleCount() const; + + int32_t getVsyncIdleCount() const; + + int64_t getVsyncIdleTime() const; + + std::optional takeLastVsyncPeriodChangeTimeline(); + + private: + virtual ::ndk::ScopedAStatus onHotplug(int64_t in_display, bool in_connected) override; + virtual ::ndk::ScopedAStatus onRefresh(int64_t in_display) override; + virtual ::ndk::ScopedAStatus onSeamlessPossible(int64_t in_display) override; + virtual ::ndk::ScopedAStatus onVsync(int64_t in_display, int64_t in_timestamp, + int32_t in_vsyncPeriodNanos) override; + virtual ::ndk::ScopedAStatus onVsyncPeriodTimingChanged( + int64_t in_display, + const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline& + in_updatedTimeline) override; + virtual ::ndk::ScopedAStatus onVsyncIdle(int64_t in_display) override; + + mutable std::mutex mMutex; + // the set of all currently connected displays + std::vector mDisplays GUARDED_BY(mMutex); + // true only when vsync is enabled + bool mVsyncAllowed GUARDED_BY(mMutex) = true; + + std::optional mTimeline GUARDED_BY(mMutex); + + int32_t mVsyncIdleCount GUARDED_BY(mMutex) = 0; + int64_t mVsyncIdleTime GUARDED_BY(mMutex) = 0; + + // track invalid callbacks + int32_t mInvalidHotplugCount GUARDED_BY(mMutex) = 0; + int32_t mInvalidRefreshCount GUARDED_BY(mMutex) = 0; + int32_t mInvalidVsyncCount GUARDED_BY(mMutex) = 0; + int32_t mInvalidVsyncPeriodChangeCount GUARDED_BY(mMutex) = 0; + int32_t mInvalidSeamlessPossibleCount GUARDED_BY(mMutex) = 0; +}; + +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/OWNERS b/graphics/composer/aidl/vts/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..d95d98d445e4910578f54d65ef4bb4a2bc797d0e --- /dev/null +++ b/graphics/composer/aidl/vts/OWNERS @@ -0,0 +1,6 @@ +# Bug component: 199413815 + +# Graphics team +adyabr@google.com +alecmouri@google.com +ramindani@google.com diff --git a/graphics/composer/aidl/vts/ReadbackVts.cpp b/graphics/composer/aidl/vts/ReadbackVts.cpp new file mode 100644 index 0000000000000000000000000000000000000000..abb58e25dde0a2ad342785c6733fe13502b7b0d0 --- /dev/null +++ b/graphics/composer/aidl/vts/ReadbackVts.cpp @@ -0,0 +1,355 @@ +/** + * 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. + */ + +#include "ReadbackVts.h" +#include +#include "RenderEngineVts.h" +#include "renderengine/ExternalTexture.h" +#include "renderengine/impl/ExternalTexture.h" + +namespace aidl::android::hardware::graphics::composer3::vts { + +const std::vector ReadbackHelper::colorModes = {ColorMode::SRGB, ColorMode::DISPLAY_P3}; +const std::vector ReadbackHelper::dataspaces = {common::Dataspace::SRGB, + common::Dataspace::DISPLAY_P3}; + +void TestLayer::write(ComposerClientWriter& writer) { + writer.setLayerDisplayFrame(mDisplay, mLayer, mDisplayFrame); + writer.setLayerSourceCrop(mDisplay, mLayer, mSourceCrop); + writer.setLayerZOrder(mDisplay, mLayer, mZOrder); + writer.setLayerSurfaceDamage(mDisplay, mLayer, mSurfaceDamage); + writer.setLayerTransform(mDisplay, mLayer, mTransform); + writer.setLayerPlaneAlpha(mDisplay, mLayer, mAlpha); + writer.setLayerBlendMode(mDisplay, mLayer, mBlendMode); + writer.setLayerBrightness(mDisplay, mLayer, mBrightness); +} + +std::string ReadbackHelper::getColorModeString(ColorMode mode) { + switch (mode) { + case ColorMode::SRGB: + return {"SRGB"}; + case ColorMode::DISPLAY_P3: + return {"DISPLAY_P3"}; + default: + return {"Unsupported color mode for readback"}; + } +} + +std::string ReadbackHelper::getDataspaceString(common::Dataspace dataspace) { + switch (dataspace) { + case common::Dataspace::SRGB: + return {"SRGB"}; + case common::Dataspace::DISPLAY_P3: + return {"DISPLAY_P3"}; + case common::Dataspace::UNKNOWN: + return {"UNKNOWN"}; + default: + return {"Unsupported dataspace for readback"}; + } +} + +Dataspace ReadbackHelper::getDataspaceForColorMode(ColorMode mode) { + switch (mode) { + case ColorMode::DISPLAY_P3: + return Dataspace::DISPLAY_P3; + case ColorMode::SRGB: + default: + return common::Dataspace::UNKNOWN; + } +} + +LayerSettings TestLayer::toRenderEngineLayerSettings() { + LayerSettings layerSettings; + + layerSettings.alpha = ::android::half(mAlpha); + layerSettings.disableBlending = mBlendMode == BlendMode::NONE; + layerSettings.source.buffer.isOpaque = mBlendMode == BlendMode::NONE; + layerSettings.geometry.boundaries = ::android::FloatRect( + static_cast(mDisplayFrame.left), static_cast(mDisplayFrame.top), + static_cast(mDisplayFrame.right), static_cast(mDisplayFrame.bottom)); + + const ::android::mat4 translation = ::android::mat4::translate(::android::vec4( + (static_cast(mTransform) & static_cast(Transform::FLIP_H) + ? static_cast(-mDisplayFrame.right) + : 0.0f), + (static_cast(mTransform) & static_cast(Transform::FLIP_V) + ? static_cast(-mDisplayFrame.bottom) + : 0.0f), + 0.0f, 1.0f)); + + const ::android::mat4 scale = ::android::mat4::scale(::android::vec4( + static_cast(mTransform) & static_cast(Transform::FLIP_H) ? -1.0f + : 1.0f, + static_cast(mTransform) & static_cast(Transform::FLIP_V) ? -1.0f + : 1.0f, + 1.0f, 1.0f)); + + layerSettings.geometry.positionTransform = scale * translation; + layerSettings.whitePointNits = mWhitePointNits; + + return layerSettings; +} + +int32_t ReadbackHelper::GetBytesPerPixel(common::PixelFormat pixelFormat) { + switch (pixelFormat) { + case common::PixelFormat::RGBA_8888: + return 4; + case common::PixelFormat::RGB_888: + return 3; + default: + return -1; + } +} + +void ReadbackHelper::fillBuffer(uint32_t width, uint32_t height, uint32_t stride, void* bufferData, + common::PixelFormat pixelFormat, + std::vector desiredPixelColors) { + ASSERT_TRUE(pixelFormat == common::PixelFormat::RGB_888 || + pixelFormat == common::PixelFormat::RGBA_8888); + int32_t bytesPerPixel = GetBytesPerPixel(pixelFormat); + ASSERT_NE(-1, bytesPerPixel); + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + auto pixel = row * static_cast(width) + col; + Color srcColor = desiredPixelColors[static_cast(pixel)]; + + int offset = (row * static_cast(stride) + col) * bytesPerPixel; + uint8_t* pixelColor = (uint8_t*)bufferData + offset; + pixelColor[0] = static_cast(std::round(255.0f * srcColor.r)); + pixelColor[1] = static_cast(std::round(255.0f * srcColor.g)); + pixelColor[2] = static_cast(std::round(255.0f * srcColor.b)); + + if (bytesPerPixel == 4) { + pixelColor[3] = static_cast(std::round(255.0f * srcColor.a)); + } + } + } +} + +void ReadbackHelper::clearColors(std::vector& expectedColors, int32_t width, int32_t height, + int32_t displayWidth) { + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + int pixel = row * displayWidth + col; + expectedColors[static_cast(pixel)] = BLACK; + } + } +} + +void ReadbackHelper::fillColorsArea(std::vector& expectedColors, int32_t stride, Rect area, + Color color) { + for (int row = area.top; row < area.bottom; row++) { + for (int col = area.left; col < area.right; col++) { + int pixel = row * stride + col; + expectedColors[static_cast(pixel)] = color; + } + } +} + +bool ReadbackHelper::readbackSupported(const common::PixelFormat& pixelFormat, + const common::Dataspace& dataspace) { + if (pixelFormat != common::PixelFormat::RGB_888 && + pixelFormat != common::PixelFormat::RGBA_8888) { + return false; + } + if (std::find(dataspaces.begin(), dataspaces.end(), dataspace) == dataspaces.end()) { + return false; + } + return true; +} + +void ReadbackHelper::compareColorBuffers(const std::vector& expectedColors, void* bufferData, + const uint32_t stride, const uint32_t width, + const uint32_t height, common::PixelFormat pixelFormat) { + const int32_t bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); + ASSERT_NE(-1, bytesPerPixel); + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + auto pixel = row * static_cast(width) + col; + int offset = (row * static_cast(stride) + col) * bytesPerPixel; + uint8_t* pixelColor = (uint8_t*)bufferData + offset; + const Color expectedColor = expectedColors[static_cast(pixel)]; + ASSERT_EQ(std::round(255.0f * expectedColor.r), pixelColor[0]); + ASSERT_EQ(std::round(255.0f * expectedColor.g), pixelColor[1]); + ASSERT_EQ(std::round(255.0f * expectedColor.b), pixelColor[2]); + } + } +} + +ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr& client, + int32_t width, int32_t height, common::PixelFormat pixelFormat, + common::Dataspace dataspace) + : mComposerClient(client) { + mDisplay = display; + + mPixelFormat = pixelFormat; + mDataspace = dataspace; + + mWidth = static_cast(width); + mHeight = static_cast(height); + mLayerCount = 1; + mUsage = static_cast(static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::GPU_TEXTURE)); + + mAccessRegion.top = 0; + mAccessRegion.left = 0; + mAccessRegion.right = static_cast(width); + mAccessRegion.bottom = static_cast(height); +} + +::android::sp<::android::GraphicBuffer> ReadbackBuffer::allocateBuffer() { + return ::android::sp<::android::GraphicBuffer>::make( + mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, mUsage, + "ReadbackBuffer"); +} + +void ReadbackBuffer::setReadbackBuffer() { + mGraphicBuffer = allocateBuffer(); + ASSERT_NE(nullptr, mGraphicBuffer); + ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); + const auto& bufferHandle = mGraphicBuffer->handle; + ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1); + EXPECT_TRUE(mComposerClient->setReadbackBuffer(mDisplay, bufferHandle, fence).isOk()); +} + +void ReadbackBuffer::checkReadbackBuffer(const std::vector& expectedColors) { + ASSERT_NE(nullptr, mGraphicBuffer); + // lock buffer for reading + const auto& [fenceStatus, bufferFence] = mComposerClient->getReadbackBufferFence(mDisplay); + EXPECT_TRUE(fenceStatus.isOk()); + + int bytesPerPixel = -1; + int bytesPerStride = -1; + void* bufData = nullptr; + + auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, &bufData, dup(bufferFence.get()), + &bytesPerPixel, &bytesPerStride); + EXPECT_EQ(::android::OK, status); + ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888); + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : mGraphicBuffer->getStride(); + ReadbackHelper::compareColorBuffers(expectedColors, bufData, stride, mWidth, mHeight, + mPixelFormat); + status = mGraphicBuffer->unlock(); + EXPECT_EQ(::android::OK, status); +} + +void TestColorLayer::write(ComposerClientWriter& writer) { + TestLayer::write(writer); + writer.setLayerCompositionType(mDisplay, mLayer, Composition::SOLID_COLOR); + writer.setLayerColor(mDisplay, mLayer, mColor); +} + +LayerSettings TestColorLayer::toRenderEngineLayerSettings() { + LayerSettings layerSettings = TestLayer::toRenderEngineLayerSettings(); + + layerSettings.source.solidColor = ::android::half3(mColor.r, mColor.g, mColor.b); + layerSettings.alpha = mAlpha * mColor.a; + return layerSettings; +} + +TestBufferLayer::TestBufferLayer(const std::shared_ptr& client, + TestRenderEngine& renderEngine, int64_t display, uint32_t width, + uint32_t height, common::PixelFormat format, + Composition composition) + : TestLayer{client, display}, mRenderEngine(renderEngine) { + mComposition = composition; + mWidth = width; + mHeight = height; + mLayerCount = 1; + mPixelFormat = format; + mUsage = (static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_OVERLAY) | + static_cast(common::BufferUsage::GPU_TEXTURE)); + + mAccessRegion.top = 0; + mAccessRegion.left = 0; + mAccessRegion.right = static_cast(width); + mAccessRegion.bottom = static_cast(height); + + setSourceCrop({0, 0, (float)width, (float)height}); +} + +void TestBufferLayer::write(ComposerClientWriter& writer) { + TestLayer::write(writer); + writer.setLayerCompositionType(mDisplay, mLayer, mComposition); + writer.setLayerVisibleRegion(mDisplay, mLayer, std::vector(1, mDisplayFrame)); + if (mGraphicBuffer) { + writer.setLayerBuffer(mDisplay, mLayer, /*slot*/ 0, mGraphicBuffer->handle, mFillFence); + } +} + +LayerSettings TestBufferLayer::toRenderEngineLayerSettings() { + LayerSettings layerSettings = TestLayer::toRenderEngineLayerSettings(); + layerSettings.source.buffer.buffer = + std::make_shared<::android::renderengine::impl::ExternalTexture>( + mGraphicBuffer, mRenderEngine.getInternalRenderEngine(), + ::android::renderengine::impl::ExternalTexture::Usage::READABLE); + + layerSettings.source.buffer.usePremultipliedAlpha = mBlendMode == BlendMode::PREMULTIPLIED; + + const float scaleX = (mSourceCrop.right - mSourceCrop.left) / (static_cast(mWidth)); + const float scaleY = (mSourceCrop.bottom - mSourceCrop.top) / (static_cast(mHeight)); + const float translateX = mSourceCrop.left / (static_cast(mWidth)); + const float translateY = mSourceCrop.top / (static_cast(mHeight)); + + layerSettings.source.buffer.textureTransform = + ::android::mat4::translate(::android::vec4(translateX, translateY, 0.0f, 1.0f)) * + ::android::mat4::scale(::android::vec4(scaleX, scaleY, 1.0f, 1.0f)); + + return layerSettings; +} + +void TestBufferLayer::fillBuffer(std::vector& expectedColors) { + void* bufData; + int32_t bytesPerPixel = -1; + int32_t bytesPerStride = -1; + auto status = mGraphicBuffer->lock(mUsage, &bufData, &bytesPerPixel, &bytesPerStride); + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : mGraphicBuffer->getStride(); + EXPECT_EQ(::android::OK, status); + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(mWidth, mHeight, stride, bufData, + mPixelFormat, expectedColors)); + + const auto unlockStatus = mGraphicBuffer->unlockAsync(&mFillFence); + ASSERT_EQ(::android::OK, unlockStatus); +} + +void TestBufferLayer::setBuffer(std::vector colors) { + mGraphicBuffer = allocateBuffer(); + ASSERT_NE(nullptr, mGraphicBuffer); + ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); + ASSERT_NO_FATAL_FAILURE(fillBuffer(colors)); +} + +::android::sp<::android::GraphicBuffer> TestBufferLayer::allocateBuffer() { + return ::android::sp<::android::GraphicBuffer>::make( + mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, mUsage, + "TestBufferLayer"); +} + +void TestBufferLayer::setDataspace(common::Dataspace dataspace, ComposerClientWriter& writer) { + writer.setLayerDataspace(mDisplay, mLayer, dataspace); +} + +void TestBufferLayer::setToClientComposition(ComposerClientWriter& writer) { + writer.setLayerCompositionType(mDisplay, mLayer, Composition::CLIENT); +} + +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/ReadbackVts.h b/graphics/composer/aidl/vts/ReadbackVts.h new file mode 100644 index 0000000000000000000000000000000000000000..ee9f0d58ad4d772e76cf78798780cbb646a8eadd --- /dev/null +++ b/graphics/composer/aidl/vts/ReadbackVts.h @@ -0,0 +1,218 @@ +/** + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include "GraphicsComposerCallback.h" +#include "VtsComposerClient.h" + +namespace aidl::android::hardware::graphics::composer3::vts { + +using ::android::renderengine::LayerSettings; +using common::Dataspace; +using common::PixelFormat; +using IMapper2_1 = ::android::hardware::graphics::mapper::V2_1::IMapper; + +static const Color BLACK = {0.0f, 0.0f, 0.0f, 1.0f}; +static const Color RED = {1.0f, 0.0f, 0.0f, 1.0f}; +// DIM_RED is 90% dimmed from RED in linear space +// hard-code as value 243 in 8-bit space here, as calculating it requires +// oetf(eotf(value) * .9), which is a complex non-linear transformation +static const Color DIM_RED = {243.f / 255.f, 0.0f, 0.0f, 1.0f}; +static const Color TRANSLUCENT_RED = {1.0f, 0.0f, 0.0f, 0.3f}; +static const Color GREEN = {0.0f, 1.0f, 0.0f, 1.0f}; +static const Color BLUE = {0.0f, 0.0f, 1.0f, 1.0f}; +static const Color WHITE = {1.0f, 1.0f, 1.0f, 1.0f}; + +class TestRenderEngine; + +class TestLayer { + public: + TestLayer(const std::shared_ptr& client, int64_t display) + : mDisplay(display) { + const auto& [status, layer] = client->createLayer(display, kBufferSlotCount); + EXPECT_TRUE(status.isOk()); + mLayer = layer; + } + + // ComposerClient will take care of destroying layers, no need to explicitly + // call destroyLayers here + virtual ~TestLayer(){}; + + virtual void write(ComposerClientWriter& writer); + virtual LayerSettings toRenderEngineLayerSettings(); + + void setDisplayFrame(Rect frame) { mDisplayFrame = frame; } + void setSourceCrop(FRect crop) { mSourceCrop = crop; } + void setZOrder(uint32_t z) { mZOrder = z; } + void setWhitePointNits(float whitePointNits) { mWhitePointNits = whitePointNits; } + void setBrightness(float brightness) { mBrightness = brightness; } + + void setSurfaceDamage(std::vector surfaceDamage) { + mSurfaceDamage = std::move(surfaceDamage); + } + + void setTransform(Transform transform) { mTransform = transform; } + void setAlpha(float alpha) { mAlpha = alpha; } + void setBlendMode(BlendMode blendMode) { mBlendMode = blendMode; } + + BlendMode getBlendMode() const { return mBlendMode; } + + uint32_t getZOrder() const { return mZOrder; } + + float getAlpha() const { return mAlpha; } + + int64_t getLayer() const { return mLayer; } + + float getBrightness() const { return mBrightness; } + + protected: + int64_t mDisplay; + int64_t mLayer; + Rect mDisplayFrame = {0, 0, 0, 0}; + float mBrightness = 1.f; + float mWhitePointNits = -1.f; + std::vector mSurfaceDamage; + Transform mTransform = static_cast(0); + FRect mSourceCrop = {0, 0, 0, 0}; + static constexpr uint32_t kBufferSlotCount = 64; + float mAlpha = 1.0; + BlendMode mBlendMode = BlendMode::NONE; + uint32_t mZOrder = 0; +}; + +class TestColorLayer : public TestLayer { + public: + TestColorLayer(const std::shared_ptr& client, int64_t display) + : TestLayer{client, display} {} + + void write(ComposerClientWriter& writer) override; + + LayerSettings toRenderEngineLayerSettings() override; + + void setColor(Color color) { mColor = color; } + + private: + Color mColor = WHITE; +}; + +class TestBufferLayer : public TestLayer { + public: + TestBufferLayer(const std::shared_ptr& client, + TestRenderEngine& renderEngine, int64_t display, uint32_t width, + uint32_t height, common::PixelFormat format, + Composition composition = Composition::DEVICE); + + void write(ComposerClientWriter& writer) override; + + LayerSettings toRenderEngineLayerSettings() override; + + void fillBuffer(std::vector& expectedColors); + + void setBuffer(std::vector colors); + + void setDataspace(Dataspace dataspace, ComposerClientWriter& writer); + + void setToClientComposition(ComposerClientWriter& writer); + + uint32_t getWidth() const { return mWidth; } + + uint32_t getHeight() const { return mHeight; } + + ::android::Rect getAccessRegion() const { return mAccessRegion; } + + uint32_t getLayerCount() const { return mLayerCount; } + + protected: + Composition mComposition; + ::android::sp<::android::GraphicBuffer> mGraphicBuffer; + TestRenderEngine& mRenderEngine; + int32_t mFillFence; + uint32_t mWidth; + uint32_t mHeight; + uint32_t mLayerCount; + PixelFormat mPixelFormat; + uint32_t mUsage; + ::android::Rect mAccessRegion; + + private: + ::android::sp<::android::GraphicBuffer> allocateBuffer(); +}; + +class ReadbackHelper { + public: + static std::string getColorModeString(ColorMode mode); + + static std::string getDataspaceString(Dataspace dataspace); + + static Dataspace getDataspaceForColorMode(ColorMode mode); + + static int32_t GetBytesPerPixel(PixelFormat pixelFormat); + + static void fillBuffer(uint32_t width, uint32_t height, uint32_t stride, void* bufferData, + PixelFormat pixelFormat, std::vector desiredPixelColors); + + static void clearColors(std::vector& expectedColors, int32_t width, int32_t height, + int32_t displayWidth); + + static void fillColorsArea(std::vector& expectedColors, int32_t stride, Rect area, + Color color); + + static bool readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace); + + static const std::vector colorModes; + static const std::vector dataspaces; + + static void compareColorBuffers(const std::vector& expectedColors, void* bufferData, + const uint32_t stride, const uint32_t width, + const uint32_t height, PixelFormat pixelFormat); +}; + +class ReadbackBuffer { + public: + ReadbackBuffer(int64_t display, const std::shared_ptr& client, int32_t width, + int32_t height, common::PixelFormat pixelFormat, common::Dataspace dataspace); + + void setReadbackBuffer(); + + void checkReadbackBuffer(const std::vector& expectedColors); + + protected: + uint32_t mWidth; + uint32_t mHeight; + uint32_t mLayerCount; + uint32_t mUsage; + PixelFormat mPixelFormat; + Dataspace mDataspace; + int64_t mDisplay; + ::android::sp<::android::GraphicBuffer> mGraphicBuffer; + std::shared_ptr mComposerClient; + ::android::Rect mAccessRegion; + native_handle_t mBufferHandle; + + private: + ::android::sp<::android::GraphicBuffer> allocateBuffer(); +}; + +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/RenderEngineVts.cpp b/graphics/composer/aidl/vts/RenderEngineVts.cpp new file mode 100644 index 0000000000000000000000000000000000000000..71b011cb12ef4ec2a9fc9e31fdc61dc3aa45a357 --- /dev/null +++ b/graphics/composer/aidl/vts/RenderEngineVts.cpp @@ -0,0 +1,95 @@ +/** + * 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. + */ + +#include "RenderEngineVts.h" +#include "renderengine/impl/ExternalTexture.h" + +namespace aidl::android::hardware::graphics::composer3::vts { + +using ::android::hardware::graphics::mapper::V2_1::IMapper; +using ::android::renderengine::DisplaySettings; +using ::android::renderengine::LayerSettings; +using ::android::renderengine::RenderEngineCreationArgs; + +TestRenderEngine::TestRenderEngine(const RenderEngineCreationArgs& args) { + mFormat = static_cast(args.pixelFormat); + mRenderEngine = ::android::renderengine::RenderEngine::create(args); +} + +TestRenderEngine::~TestRenderEngine() { + mRenderEngine.release(); +} + +void TestRenderEngine::setRenderLayers(std::vector> layers) { + sort(layers.begin(), layers.end(), + [](const std::shared_ptr& lhs, const std::shared_ptr& rhs) -> bool { + return lhs->getZOrder() < rhs->getZOrder(); + }); + + if (!mCompositionLayers.empty()) { + mCompositionLayers.clear(); + } + for (auto& layer : layers) { + LayerSettings settings = layer->toRenderEngineLayerSettings(); + mCompositionLayers.push_back(settings); + } +} + +void TestRenderEngine::initGraphicBuffer(uint32_t width, uint32_t height, uint32_t layerCount, + uint64_t usage) { + mGraphicBuffer = ::android::sp<::android::GraphicBuffer>::make( + width, height, static_cast(mFormat), layerCount, usage); +} + +void TestRenderEngine::drawLayers() { + ::android::base::unique_fd bufferFence; + + std::vector<::android::renderengine::LayerSettings> compositionLayers; + compositionLayers.reserve(mCompositionLayers.size()); + std::transform(mCompositionLayers.begin(), mCompositionLayers.end(), + std::back_insert_iterator(compositionLayers), + [](::android::renderengine::LayerSettings& settings) + -> ::android::renderengine::LayerSettings { return settings; }); + auto texture = std::make_shared<::android::renderengine::impl::ExternalTexture>( + mGraphicBuffer, *mRenderEngine, + ::android::renderengine::impl::ExternalTexture::Usage::WRITEABLE); + auto [status, readyFence] = mRenderEngine + ->drawLayers(mDisplaySettings, compositionLayers, texture, + true, std::move(bufferFence)) + .get(); + int fd = readyFence.release(); + if (fd != -1) { + ASSERT_EQ(0, sync_wait(fd, -1)); + ASSERT_EQ(0, close(fd)); + } +} + +void TestRenderEngine::checkColorBuffer(const std::vector& expectedColors) { + void* bufferData; + int32_t bytesPerPixel = -1; + int32_t bytesPerStride = -1; + ASSERT_EQ(0, mGraphicBuffer->lock(static_cast(mGraphicBuffer->getUsage()), + &bufferData, &bytesPerPixel, &bytesPerStride)); + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : mGraphicBuffer->getStride(); + ReadbackHelper::compareColorBuffers(expectedColors, bufferData, stride, + mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight(), + mFormat); + ASSERT_EQ(::android::OK, mGraphicBuffer->unlock()); +} + +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/RenderEngineVts.h b/graphics/composer/aidl/vts/RenderEngineVts.h new file mode 100644 index 0000000000000000000000000000000000000000..43d3a42808ee53bd89480393170b3233b8b77d52 --- /dev/null +++ b/graphics/composer/aidl/vts/RenderEngineVts.h @@ -0,0 +1,64 @@ +/** + * 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. + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ReadbackVts.h" + +namespace aidl::android::hardware::graphics::composer3::vts { + +using ::android::hardware::graphics::mapper::V2_1::IMapper; +using ::android::renderengine::DisplaySettings; +using ::android::renderengine::ExternalTexture; +using ::android::renderengine::RenderEngineCreationArgs; + +class TestRenderEngine { + public: + static constexpr uint32_t sMaxFrameBufferAcquireBuffers = 2; + + TestRenderEngine(const RenderEngineCreationArgs& args); + ~TestRenderEngine(); + + void setRenderLayers(std::vector> layers); + void initGraphicBuffer(uint32_t width, uint32_t height, uint32_t layerCount, uint64_t usage); + void setDisplaySettings(DisplaySettings& displaySettings) { + mDisplaySettings = displaySettings; + }; + void drawLayers(); + void checkColorBuffer(const std::vector& expectedColors); + + ::android::renderengine::RenderEngine& getInternalRenderEngine() { return *mRenderEngine; } + + private: + common::PixelFormat mFormat; + std::vector<::android::renderengine::LayerSettings> mCompositionLayers; + std::unique_ptr<::android::renderengine::RenderEngine> mRenderEngine; + std::vector<::android::renderengine::LayerSettings> mRenderLayers; + ::android::sp<::android::GraphicBuffer> mGraphicBuffer; + + DisplaySettings mDisplaySettings; +}; + +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2b607038fea2c192f6c8787ba690ea20346e580d --- /dev/null +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -0,0 +1,515 @@ +/** + * Copyright (c) 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. + */ + +#include "VtsComposerClient.h" +#include +#include +#include + +#undef LOG_TAG +#define LOG_TAG "VtsComposerClient" + +using namespace std::chrono_literals; + +namespace aidl::android::hardware::graphics::composer3::vts { + +VtsComposerClient::VtsComposerClient(const std::string& name) { + SpAIBinder binder(AServiceManager_waitForService(name.c_str())); + ALOGE_IF(binder == nullptr, "Could not initialize the service binder"); + if (binder != nullptr) { + mComposer = IComposer::fromBinder(binder); + ALOGE_IF(mComposer == nullptr, "Failed to acquire the composer from the binder"); + } +} + +ScopedAStatus VtsComposerClient::createClient() { + if (mComposer == nullptr) { + ALOGE("IComposer not initialized"); + return ScopedAStatus::fromServiceSpecificError(IComposerClient::INVALID_CONFIGURATION); + } + auto status = mComposer->createClient(&mComposerClient); + if (!status.isOk() || mComposerClient == nullptr) { + ALOGE("Failed to create client for IComposerClient with %s", + status.getDescription().c_str()); + return status; + } + mComposerCallback = SharedRefBase::make(); + if (mComposerCallback == nullptr) { + ALOGE("Unable to create ComposerCallback"); + return ScopedAStatus::fromServiceSpecificError(IComposerClient::INVALID_CONFIGURATION); + } + return mComposerClient->registerCallback(mComposerCallback); +} + +bool VtsComposerClient::tearDown() { + return verifyComposerCallbackParams() && destroyAllLayers(); +} + +std::pair VtsComposerClient::createVirtualDisplay( + int32_t width, int32_t height, PixelFormat pixelFormat, int32_t bufferSlotCount) { + VirtualDisplay outVirtualDisplay; + auto status = mComposerClient->createVirtualDisplay(width, height, pixelFormat, bufferSlotCount, + &outVirtualDisplay); + if (!status.isOk()) { + return {std::move(status), outVirtualDisplay}; + } + return {addDisplayToDisplayResources(outVirtualDisplay.display, /*isVirtual*/ true), + outVirtualDisplay}; +} + +ScopedAStatus VtsComposerClient::destroyVirtualDisplay(int64_t display) { + auto status = mComposerClient->destroyVirtualDisplay(display); + if (!status.isOk()) { + return status; + } + mDisplayResources.erase(display); + return status; +} + +std::pair VtsComposerClient::createLayer(int64_t display, + int32_t bufferSlotCount) { + int64_t outLayer; + auto status = mComposerClient->createLayer(display, bufferSlotCount, &outLayer); + + if (!status.isOk()) { + return {std::move(status), outLayer}; + } + return {addLayerToDisplayResources(display, outLayer), outLayer}; +} + +ScopedAStatus VtsComposerClient::destroyLayer(int64_t display, int64_t layer) { + auto status = mComposerClient->destroyLayer(display, layer); + + if (!status.isOk()) { + return status; + } + removeLayerFromDisplayResources(display, layer); + return status; +} + +std::pair VtsComposerClient::getActiveConfig(int64_t display) { + int32_t outConfig; + return {mComposerClient->getActiveConfig(display, &outConfig), outConfig}; +} + +ScopedAStatus VtsComposerClient::setActiveConfig(VtsDisplay* vtsDisplay, int32_t config) { + auto status = mComposerClient->setActiveConfig(vtsDisplay->getDisplayId(), config); + if (!status.isOk()) { + return status; + } + return updateDisplayProperties(vtsDisplay, config); +} + +std::pair VtsComposerClient::getDisplayAttribute( + int64_t display, int32_t config, DisplayAttribute displayAttribute) { + int32_t outDisplayAttribute; + return {mComposerClient->getDisplayAttribute(display, config, displayAttribute, + &outDisplayAttribute), + outDisplayAttribute}; +} + +ScopedAStatus VtsComposerClient::setPowerMode(int64_t display, PowerMode powerMode) { + return mComposerClient->setPowerMode(display, powerMode); +} + +ScopedAStatus VtsComposerClient::setVsync(int64_t display, bool enable) { + return mComposerClient->setVsyncEnabled(display, enable); +} + +void VtsComposerClient::setVsyncAllowed(bool isAllowed) { + mComposerCallback->setVsyncAllowed(isAllowed); +} + +std::pair> VtsComposerClient::getDataspaceSaturationMatrix( + Dataspace dataspace) { + std::vector outMatrix; + return {mComposerClient->getDataspaceSaturationMatrix(dataspace, &outMatrix), outMatrix}; +} + +std::pair> VtsComposerClient::executeCommands( + const std::vector& commands) { + std::vector outResultPayload; + return {mComposerClient->executeCommands(commands, &outResultPayload), + std::move(outResultPayload)}; +} + +std::optional VtsComposerClient::takeLastVsyncPeriodChangeTimeline() { + return mComposerCallback->takeLastVsyncPeriodChangeTimeline(); +} + +ScopedAStatus VtsComposerClient::setContentType(int64_t display, ContentType contentType) { + return mComposerClient->setContentType(display, contentType); +} + +std::pair +VtsComposerClient::setActiveConfigWithConstraints(VtsDisplay* vtsDisplay, int32_t config, + const VsyncPeriodChangeConstraints& constraints) { + VsyncPeriodChangeTimeline outTimeline; + auto status = mComposerClient->setActiveConfigWithConstraints( + vtsDisplay->getDisplayId(), config, constraints, &outTimeline); + if (!status.isOk()) { + return {std::move(status), outTimeline}; + } + return {updateDisplayProperties(vtsDisplay, config), outTimeline}; +} + +std::pair> VtsComposerClient::getDisplayCapabilities( + int64_t display) { + std::vector outCapabilities; + return {mComposerClient->getDisplayCapabilities(display, &outCapabilities), outCapabilities}; +} + +ScopedAStatus VtsComposerClient::dumpDebugInfo() { + int pipefds[2]; + if (pipe(pipefds) < 0) { + return ScopedAStatus::fromServiceSpecificError(IComposer::EX_NO_RESOURCES); + } + + const auto status = mComposer->dump(pipefds[1], /*args*/ nullptr, /*numArgs*/ 0); + close(pipefds[0]); + close(pipefds[1]); + return ScopedAStatus::fromStatus(status); +} + +std::pair VtsComposerClient::getDisplayIdentificationData( + int64_t display) { + DisplayIdentification outDisplayIdentification; + return {mComposerClient->getDisplayIdentificationData(display, &outDisplayIdentification), + outDisplayIdentification}; +} + +std::pair VtsComposerClient::getHdrCapabilities(int64_t display) { + HdrCapabilities outHdrCapabilities; + return {mComposerClient->getHdrCapabilities(display, &outHdrCapabilities), outHdrCapabilities}; +} + +std::pair> +VtsComposerClient::getPerFrameMetadataKeys(int64_t display) { + std::vector outPerFrameMetadataKeys; + return {mComposerClient->getPerFrameMetadataKeys(display, &outPerFrameMetadataKeys), + outPerFrameMetadataKeys}; +} + +std::pair VtsComposerClient::getReadbackBufferAttributes( + int64_t display) { + ReadbackBufferAttributes outReadbackBufferAttributes; + return {mComposerClient->getReadbackBufferAttributes(display, &outReadbackBufferAttributes), + outReadbackBufferAttributes}; +} + +ScopedAStatus VtsComposerClient::setReadbackBuffer(int64_t display, const native_handle_t* buffer, + const ScopedFileDescriptor& releaseFence) { + return mComposerClient->setReadbackBuffer(display, ::android::dupToAidl(buffer), releaseFence); +} + +std::pair VtsComposerClient::getReadbackBufferFence( + int64_t display) { + ScopedFileDescriptor outReleaseFence; + return {mComposerClient->getReadbackBufferFence(display, &outReleaseFence), + std::move(outReleaseFence)}; +} + +std::pair> VtsComposerClient::getColorModes(int64_t display) { + std::vector outColorModes; + return {mComposerClient->getColorModes(display, &outColorModes), outColorModes}; +} + +std::pair> VtsComposerClient::getRenderIntents( + int64_t display, ColorMode colorMode) { + std::vector outRenderIntents; + return {mComposerClient->getRenderIntents(display, colorMode, &outRenderIntents), + outRenderIntents}; +} + +ScopedAStatus VtsComposerClient::setColorMode(int64_t display, ColorMode colorMode, + RenderIntent renderIntent) { + return mComposerClient->setColorMode(display, colorMode, renderIntent); +} + +std::pair +VtsComposerClient::getDisplayedContentSamplingAttributes(int64_t display) { + DisplayContentSamplingAttributes outAttributes; + return {mComposerClient->getDisplayedContentSamplingAttributes(display, &outAttributes), + outAttributes}; +} + +ScopedAStatus VtsComposerClient::setDisplayedContentSamplingEnabled( + int64_t display, bool isEnabled, FormatColorComponent formatColorComponent, + int64_t maxFrames) { + return mComposerClient->setDisplayedContentSamplingEnabled(display, isEnabled, + formatColorComponent, maxFrames); +} + +std::pair VtsComposerClient::getDisplayedContentSample( + int64_t display, int64_t maxFrames, int64_t timestamp) { + DisplayContentSample outDisplayContentSample; + return {mComposerClient->getDisplayedContentSample(display, maxFrames, timestamp, + &outDisplayContentSample), + outDisplayContentSample}; +} + +std::pair VtsComposerClient::getDisplayConnectionType( + int64_t display) { + DisplayConnectionType outDisplayConnectionType; + return {mComposerClient->getDisplayConnectionType(display, &outDisplayConnectionType), + outDisplayConnectionType}; +} + +std::pair> VtsComposerClient::getDisplayConfigs( + int64_t display) { + std::vector outConfigs; + return {mComposerClient->getDisplayConfigs(display, &outConfigs), outConfigs}; +} + +std::pair VtsComposerClient::getDisplayVsyncPeriod(int64_t display) { + int32_t outVsyncPeriodNanos; + return {mComposerClient->getDisplayVsyncPeriod(display, &outVsyncPeriodNanos), + outVsyncPeriodNanos}; +} + +ScopedAStatus VtsComposerClient::setAutoLowLatencyMode(int64_t display, bool isEnabled) { + return mComposerClient->setAutoLowLatencyMode(display, isEnabled); +} + +std::pair> VtsComposerClient::getSupportedContentTypes( + int64_t display) { + std::vector outContentTypes; + return {mComposerClient->getSupportedContentTypes(display, &outContentTypes), outContentTypes}; +} + +std::pair> +VtsComposerClient::getDisplayDecorationSupport(int64_t display) { + std::optional outSupport; + return {mComposerClient->getDisplayDecorationSupport(display, &outSupport), outSupport}; +} + +std::pair VtsComposerClient::getMaxVirtualDisplayCount() { + int32_t outMaxVirtualDisplayCount; + return {mComposerClient->getMaxVirtualDisplayCount(&outMaxVirtualDisplayCount), + outMaxVirtualDisplayCount}; +} + +std::pair VtsComposerClient::getDisplayName(int64_t display) { + std::string outDisplayName; + return {mComposerClient->getDisplayName(display, &outDisplayName), outDisplayName}; +} + +ScopedAStatus VtsComposerClient::setClientTargetSlotCount(int64_t display, + int32_t bufferSlotCount) { + return mComposerClient->setClientTargetSlotCount(display, bufferSlotCount); +} + +std::pair> VtsComposerClient::getCapabilities() { + std::vector outCapabilities; + return {mComposer->getCapabilities(&outCapabilities), outCapabilities}; +} + +ScopedAStatus VtsComposerClient::setBootDisplayConfig(int64_t display, int32_t config) { + return mComposerClient->setBootDisplayConfig(display, config); +} + +ScopedAStatus VtsComposerClient::clearBootDisplayConfig(int64_t display) { + return mComposerClient->clearBootDisplayConfig(display); +} + +std::pair VtsComposerClient::getPreferredBootDisplayConfig( + int64_t display) { + int32_t outConfig; + return {mComposerClient->getPreferredBootDisplayConfig(display, &outConfig), outConfig}; +} + +std::pair VtsComposerClient::getDisplayPhysicalOrientation( + int64_t display) { + common::Transform outDisplayOrientation; + return {mComposerClient->getDisplayPhysicalOrientation(display, &outDisplayOrientation), + outDisplayOrientation}; +} + +ScopedAStatus VtsComposerClient::setIdleTimerEnabled(int64_t display, int32_t timeoutMs) { + return mComposerClient->setIdleTimerEnabled(display, timeoutMs); +} + +int32_t VtsComposerClient::getVsyncIdleCount() { + return mComposerCallback->getVsyncIdleCount(); +} + +int64_t VtsComposerClient::getVsyncIdleTime() { + return mComposerCallback->getVsyncIdleTime(); +} + +int64_t VtsComposerClient::getInvalidDisplayId() { + // returns an invalid display id (one that has not been registered to a + // display. Currently assuming that a device will never have close to + // std::numeric_limit::max() displays registered while running tests + int64_t id = std::numeric_limits::max(); + std::vector displays = mComposerCallback->getDisplays(); + while (id > 0) { + if (std::none_of(displays.begin(), displays.end(), + [id](const auto& display) { return id == display; })) { + return id; + } + id--; + } + + // Although 0 could be an invalid display, a return value of 0 + // from getInvalidDisplayId means all other ids are in use, a condition which + // we are assuming a device will never have + EXPECT_NE(0, id); + return id; +} + +std::pair> VtsComposerClient::getDisplays() { + while (true) { + // Sleep for a small period of time to allow all built-in displays + // to post hotplug events + std::this_thread::sleep_for(5ms); + std::vector displays = mComposerCallback->getDisplays(); + if (displays.empty()) { + continue; + } + + std::vector vtsDisplays; + vtsDisplays.reserve(displays.size()); + for (int64_t display : displays) { + auto vtsDisplay = VtsDisplay{display}; + auto configs = getDisplayConfigs(display); + if (!configs.first.isOk()) { + ALOGE("Unable to get the displays for test, failed to get the configs " + "for display %" PRId64, + display); + return {std::move(configs.first), vtsDisplays}; + } + for (int config : configs.second) { + auto status = updateDisplayProperties(&vtsDisplay, config); + if (!status.isOk()) { + ALOGE("Unable to get the displays for test, failed to update the properties " + "for display %" PRId64, + display); + return {std::move(status), vtsDisplays}; + } + } + vtsDisplays.emplace_back(vtsDisplay); + addDisplayToDisplayResources(display, /*isVirtual*/ false); + } + + return {ScopedAStatus::ok(), vtsDisplays}; + } +} + +ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config) { + const auto width = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH); + const auto height = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::HEIGHT); + const auto vsyncPeriod = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::VSYNC_PERIOD); + const auto configGroup = + getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::CONFIG_GROUP); + if (width.first.isOk() && height.first.isOk() && vsyncPeriod.first.isOk() && + configGroup.first.isOk()) { + vtsDisplay->setDimensions(width.second, height.second); + vtsDisplay->addDisplayConfig(config, {vsyncPeriod.second, configGroup.second}); + return ScopedAStatus::ok(); + } + + LOG(ERROR) << "Failed to update display property for width: " << width.first.isOk() + << ", height: " << height.first.isOk() << ", vsync: " << vsyncPeriod.first.isOk() + << ", config: " << configGroup.first.isOk(); + return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG); +} + +ScopedAStatus VtsComposerClient::addDisplayToDisplayResources(int64_t display, bool isVirtual) { + if (mDisplayResources.insert({display, DisplayResource(isVirtual)}).second) { + return ScopedAStatus::ok(); + } + + ALOGE("Duplicate display id %" PRId64, display); + return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_DISPLAY); +} + +ScopedAStatus VtsComposerClient::addLayerToDisplayResources(int64_t display, int64_t layer) { + auto resource = mDisplayResources.find(display); + if (resource == mDisplayResources.end()) { + resource = mDisplayResources.insert({display, DisplayResource(false)}).first; + } + + if (!resource->second.layers.insert(layer).second) { + ALOGE("Duplicate layer id %" PRId64, layer); + return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_LAYER); + } + return ScopedAStatus::ok(); +} + +void VtsComposerClient::removeLayerFromDisplayResources(int64_t display, int64_t layer) { + auto resource = mDisplayResources.find(display); + if (resource != mDisplayResources.end()) { + resource->second.layers.erase(layer); + } +} + +bool VtsComposerClient::verifyComposerCallbackParams() { + bool isValid = true; + if (mComposerCallback != nullptr) { + if (mComposerCallback->getInvalidHotplugCount() != 0) { + ALOGE("Invalid hotplug count"); + isValid = false; + } + if (mComposerCallback->getInvalidRefreshCount() != 0) { + ALOGE("Invalid refresh count"); + isValid = false; + } + if (mComposerCallback->getInvalidVsyncCount() != 0) { + ALOGE("Invalid vsync count"); + isValid = false; + } + if (mComposerCallback->getInvalidVsyncPeriodChangeCount() != 0) { + ALOGE("Invalid vsync period change count"); + isValid = false; + } + if (mComposerCallback->getInvalidSeamlessPossibleCount() != 0) { + ALOGE("Invalid seamless possible count"); + isValid = false; + } + } + return isValid; +} + +bool VtsComposerClient::destroyAllLayers() { + for (const auto& it : mDisplayResources) { + const auto& [display, resource] = it; + + for (auto layer : resource.layers) { + const auto status = destroyLayer(display, layer); + if (!status.isOk()) { + ALOGE("Unable to destroy all the layers, failed at layer %" PRId64 " with error %s", + layer, status.getDescription().c_str()); + return false; + } + } + + if (resource.isVirtual) { + const auto status = destroyVirtualDisplay(display); + if (!status.isOk()) { + ALOGE("Unable to destroy the display %" PRId64 " failed with error %s", display, + status.getDescription().c_str()); + return false; + } + } + } + mDisplayResources.clear(); + return true; +} +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h new file mode 100644 index 0000000000000000000000000000000000000000..3625c8ccfec365a8247d666cdab8e503f546219b --- /dev/null +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -0,0 +1,244 @@ +/** + * Copyright (c) 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. + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "GraphicsComposerCallback.h" + +using aidl::android::hardware::graphics::common::Dataspace; +using aidl::android::hardware::graphics::common::DisplayDecorationSupport; +using aidl::android::hardware::graphics::common::FRect; +using aidl::android::hardware::graphics::common::PixelFormat; +using aidl::android::hardware::graphics::common::Rect; +using namespace ::ndk; + +namespace aidl::android::hardware::graphics::composer3::vts { + +class VtsDisplay; +/** + * A wrapper to IComposerClient. + * This wrapper manages the IComposerClient instance and manages the resources for + * the tests with respect to the IComposerClient calls. + */ +class VtsComposerClient { + public: + VtsComposerClient(const std::string& name); + + ScopedAStatus createClient(); + + bool tearDown(); + + std::pair createVirtualDisplay(int32_t width, int32_t height, + PixelFormat pixelFormat, + int32_t bufferSlotCount); + + ScopedAStatus destroyVirtualDisplay(int64_t display); + + std::pair createLayer(int64_t display, int32_t bufferSlotCount); + + ScopedAStatus destroyLayer(int64_t display, int64_t layer); + + std::pair getActiveConfig(int64_t display); + + ScopedAStatus setActiveConfig(VtsDisplay* vtsDisplay, int32_t config); + + std::pair getDisplayAttribute(int64_t display, int32_t config, + DisplayAttribute displayAttribute); + + ScopedAStatus setPowerMode(int64_t display, PowerMode powerMode); + + ScopedAStatus setVsync(int64_t display, bool enable); + + void setVsyncAllowed(bool isAllowed); + + std::pair> getDataspaceSaturationMatrix(Dataspace dataspace); + + std::pair> executeCommands( + const std::vector& commands); + + std::optional takeLastVsyncPeriodChangeTimeline(); + + ScopedAStatus setContentType(int64_t display, ContentType contentType); + + std::pair setActiveConfigWithConstraints( + VtsDisplay* vtsDisplay, int32_t config, + const VsyncPeriodChangeConstraints& constraints); + + std::pair> getDisplayCapabilities( + int64_t display); + + ScopedAStatus dumpDebugInfo(); + + std::pair getDisplayIdentificationData(int64_t display); + + std::pair getHdrCapabilities(int64_t display); + + std::pair> getPerFrameMetadataKeys( + int64_t display); + + std::pair getReadbackBufferAttributes(int64_t display); + + ScopedAStatus setReadbackBuffer(int64_t display, const native_handle_t* buffer, + const ScopedFileDescriptor& releaseFence); + + std::pair getReadbackBufferFence(int64_t display); + + std::pair> getColorModes(int64_t display); + + std::pair> getRenderIntents(int64_t display, + ColorMode colorMode); + + ScopedAStatus setColorMode(int64_t display, ColorMode colorMode, RenderIntent renderIntent); + + std::pair + getDisplayedContentSamplingAttributes(int64_t display); + + ScopedAStatus setDisplayedContentSamplingEnabled(int64_t display, bool isEnabled, + FormatColorComponent formatColorComponent, + int64_t maxFrames); + + std::pair getDisplayedContentSample(int64_t display, + int64_t maxFrames, + int64_t timestamp); + + std::pair getDisplayConnectionType(int64_t display); + + std::pair> getDisplayConfigs(int64_t display); + + std::pair getDisplayVsyncPeriod(int64_t display); + + ScopedAStatus setAutoLowLatencyMode(int64_t display, bool isEnabled); + + std::pair> getSupportedContentTypes(int64_t display); + + std::pair> getDisplayDecorationSupport( + int64_t display); + + std::pair getMaxVirtualDisplayCount(); + + std::pair getDisplayName(int64_t display); + + ScopedAStatus setClientTargetSlotCount(int64_t display, int32_t bufferSlotCount); + + std::pair> getCapabilities(); + + ScopedAStatus setBootDisplayConfig(int64_t display, int32_t config); + + ScopedAStatus clearBootDisplayConfig(int64_t display); + + std::pair getPreferredBootDisplayConfig(int64_t display); + + std::pair getDisplayPhysicalOrientation(int64_t display); + + ScopedAStatus setIdleTimerEnabled(int64_t display, int32_t timeoutMs); + + int32_t getVsyncIdleCount(); + + int64_t getVsyncIdleTime(); + + int64_t getInvalidDisplayId(); + + std::pair> getDisplays(); + + private: + ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config); + + ScopedAStatus addDisplayToDisplayResources(int64_t display, bool isVirtual); + + ScopedAStatus addLayerToDisplayResources(int64_t display, int64_t layer); + + void removeLayerFromDisplayResources(int64_t display, int64_t layer); + + bool destroyAllLayers(); + + bool verifyComposerCallbackParams(); + + // Keep track of displays and layers. When a test fails/ends, + // the VtsComposerClient::tearDown should be called from the + // test tearDown to clean up the resources for the test. + struct DisplayResource { + DisplayResource(bool isVirtual_) : isVirtual(isVirtual_) {} + + bool isVirtual; + std::unordered_set layers; + }; + + std::shared_ptr mComposer; + std::shared_ptr mComposerClient; + std::shared_ptr mComposerCallback; + std::unordered_map mDisplayResources; +}; + +class VtsDisplay { + public: + VtsDisplay(int64_t displayId) : mDisplayId(displayId), mDisplayWidth(0), mDisplayHeight(0) {} + + int64_t getDisplayId() const { return mDisplayId; } + + FRect getCrop() const { + return {0, 0, static_cast(mDisplayWidth), static_cast(mDisplayHeight)}; + } + + Rect getFrameRect() const { return {0, 0, mDisplayWidth, mDisplayHeight}; } + + void setDimensions(int32_t displayWidth, int32_t displayHeight) { + mDisplayWidth = displayWidth; + mDisplayHeight = displayHeight; + } + + int32_t getDisplayWidth() const { return mDisplayWidth; } + + int32_t getDisplayHeight() const { return mDisplayHeight; } + + struct DisplayConfig { + DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_) + : vsyncPeriod(vsyncPeriod_), configGroup(configGroup_) {} + int32_t vsyncPeriod; + int32_t configGroup; + }; + + void addDisplayConfig(int32_t config, DisplayConfig displayConfig) { + displayConfigs.insert({config, displayConfig}); + } + + DisplayConfig getDisplayConfig(int32_t config) { return displayConfigs.find(config)->second; } + + private: + int64_t mDisplayId; + int32_t mDisplayWidth; + int32_t mDisplayHeight; + std::unordered_map displayConfigs; +}; +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..46dde09dd404775fdd9912fff8cd08fa87888a46 --- /dev/null +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -0,0 +1,1465 @@ +/** + * 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_TAG "graphics_composer_aidl_hal_readback_tests@3" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "GraphicsComposerCallback.h" +#include "ReadbackVts.h" +#include "RenderEngineVts.h" +#include "VtsComposerClient.h" + +// tinyxml2 does implicit conversions >:( +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" +#include +#pragma clang diagnostic pop + +namespace aidl::android::hardware::graphics::composer3::vts { +namespace { + +using ::android::Rect; +using common::Dataspace; +using common::PixelFormat; + +class GraphicsCompositionTestBase : public ::testing::Test { + protected: + void SetUpBase(const std::string& name) { + mComposerClient = std::make_shared(name); + ASSERT_TRUE(mComposerClient->createClient().isOk()); + + const auto& [status, displays] = mComposerClient->getDisplays(); + ASSERT_TRUE(status.isOk()); + mDisplays = displays; + + setTestColorModes(); + + // explicitly disable vsync + for (const auto& display : mDisplays) { + EXPECT_TRUE(mComposerClient->setVsync(display.getDisplayId(), /*enable*/ false).isOk()); + } + mComposerClient->setVsyncAllowed(/*isAllowed*/ false); + + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + + ASSERT_NO_FATAL_FAILURE( + mTestRenderEngine = std::unique_ptr(new TestRenderEngine( + ::android::renderengine::RenderEngineCreationArgs::Builder() + .setPixelFormat(static_cast(common::PixelFormat::RGBA_8888)) + .setImageCacheSize(TestRenderEngine::sMaxFrameBufferAcquireBuffers) + .setUseColorManagerment(true) + .setEnableProtectedContext(false) + .setPrecacheToneMapperShaderOnly(false) + .setContextPriority(::android::renderengine::RenderEngine:: + ContextPriority::HIGH) + .build()))); + + ::android::renderengine::DisplaySettings clientCompositionDisplay; + clientCompositionDisplay.physicalDisplay = Rect(getDisplayWidth(), getDisplayHeight()); + clientCompositionDisplay.clip = clientCompositionDisplay.physicalDisplay; + + mTestRenderEngine->initGraphicBuffer( + static_cast(getDisplayWidth()), static_cast(getDisplayHeight()), + /*layerCount*/ 1U, + static_cast( + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::GPU_RENDER_TARGET))); + mTestRenderEngine->setDisplaySettings(clientCompositionDisplay); + } + + void TearDown() override { + ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); + ASSERT_TRUE(mComposerClient->tearDown()); + mComposerClient.reset(); + const auto errors = mReader.takeErrors(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); + } + + const VtsDisplay& getPrimaryDisplay() const { return mDisplays[0]; } + + int64_t getPrimaryDisplayId() const { return getPrimaryDisplay().getDisplayId(); } + + int64_t getInvalidDisplayId() const { return mComposerClient->getInvalidDisplayId(); } + + int32_t getDisplayWidth() const { return getPrimaryDisplay().getDisplayWidth(); } + + int32_t getDisplayHeight() const { return getPrimaryDisplay().getDisplayHeight(); } + + void assertServiceSpecificError(const ScopedAStatus& status, int32_t serviceSpecificError) { + ASSERT_EQ(status.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(status.getServiceSpecificError(), serviceSpecificError); + } + + std::pair> allocateBuffer(uint32_t usage) { + const auto width = static_cast(getDisplayWidth()); + const auto height = static_cast(getDisplayHeight()); + + const auto& graphicBuffer = ::android::sp<::android::GraphicBuffer>::make( + width, height, ::android::PIXEL_FORMAT_RGBA_8888, + /*layerCount*/ 1u, usage, "VtsHalGraphicsComposer3_ReadbackTest"); + + if (graphicBuffer && ::android::OK == graphicBuffer->initCheck()) { + return {true, graphicBuffer}; + } + return {false, graphicBuffer}; + } + + uint64_t getStableDisplayId(int64_t display) { + const auto& [status, identification] = + mComposerClient->getDisplayIdentificationData(display); + EXPECT_TRUE(status.isOk()); + + if (const auto info = ::android::parseDisplayIdentificationData( + static_cast(identification.port), identification.data)) { + return info->id.value; + } + + return ::android::PhysicalDisplayId::fromPort(static_cast(identification.port)) + .value; + } + + // Gets the per-display XML config + std::unique_ptr getDisplayConfigXml(int64_t display) { + std::stringstream pathBuilder; + pathBuilder << "/vendor/etc/displayconfig/display_id_" << getStableDisplayId(display) + << ".xml"; + const std::string path = pathBuilder.str(); + auto document = std::make_unique(); + const tinyxml2::XMLError error = document->LoadFile(path.c_str()); + if (error == tinyxml2::XML_SUCCESS) { + return document; + } else { + return nullptr; + } + } + + // Gets the max display brightness for this display. + // If the display config xml does not exist, then assume that the display is not well-configured + // enough to provide a display brightness, so return nullopt. + std::optional getMaxDisplayBrightnessNits(int64_t display) { + const auto document = getDisplayConfigXml(display); + if (!document) { + // Assume the device doesn't support display brightness + return std::nullopt; + } + + const auto root = document->RootElement(); + if (!root) { + // If there's somehow no root element, then this isn't a valid config + return std::nullopt; + } + + const auto screenBrightnessMap = root->FirstChildElement("screenBrightnessMap"); + if (!screenBrightnessMap) { + // A valid display config must have a screen brightness map + return std::nullopt; + } + + auto point = screenBrightnessMap->FirstChildElement("point"); + float maxNits = -1.f; + while (point != nullptr) { + const auto nits = point->FirstChildElement("nits"); + if (nits) { + maxNits = std::max(maxNits, nits->FloatText(-1.f)); + } + point = point->NextSiblingElement("point"); + } + + if (maxNits < 0.f) { + // If we got here, then there were no point elements containing a nit value, so this + // config isn't valid + return std::nullopt; + } + + return maxNits; + } + + void writeLayers(const std::vector>& layers) { + for (const auto& layer : layers) { + layer->write(mWriter); + } + execute(); + } + + void execute() { + const auto& commands = mWriter.getPendingCommands(); + if (commands.empty()) { + mWriter.reset(); + return; + } + + auto [status, results] = mComposerClient->executeCommands(commands); + ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription(); + + mReader.parse(std::move(results)); + mWriter.reset(); + } + + bool getHasReadbackBuffer() { + auto [status, readBackBufferAttributes] = + mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); + if (status.isOk()) { + mPixelFormat = readBackBufferAttributes.format; + mDataspace = readBackBufferAttributes.dataspace; + return ReadbackHelper::readbackSupported(mPixelFormat, mDataspace); + } + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + return false; + } + + std::shared_ptr mComposerClient; + std::vector mDisplays; + // use the slot count usually set by SF + std::vector mTestColorModes; + ComposerClientWriter mWriter; + ComposerClientReader mReader; + std::unique_ptr mTestRenderEngine; + common::PixelFormat mPixelFormat; + common::Dataspace mDataspace; + + static constexpr uint32_t kClientTargetSlotCount = 64; + + private: + void setTestColorModes() { + mTestColorModes.clear(); + const auto& [status, modes] = mComposerClient->getColorModes(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + for (ColorMode mode : modes) { + if (std::find(ReadbackHelper::colorModes.begin(), ReadbackHelper::colorModes.end(), + mode) != ReadbackHelper::colorModes.end()) { + mTestColorModes.push_back(mode); + } + } + } +}; + +class GraphicsCompositionTest : public GraphicsCompositionTestBase, + public testing::WithParamInterface { + public: + void SetUp() override { SetUpBase(GetParam()); } +}; + +TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + auto layer = std::make_shared(mComposerClient, getPrimaryDisplayId()); + common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setColor(BLUE); + layer->setDisplayFrame(coloredSquare); + layer->setZOrder(10); + + std::vector> layers = {layer}; + + // expected color for each pixel + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + // if hwc cannot handle and asks for composition change, + // just succeed the test + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(layers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerBuffer) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED); + ReadbackHelper::fillColorsArea( + expectedColors, getDisplayWidth(), + {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight() / 2}, GREEN); + ReadbackHelper::fillColorsArea( + expectedColors, getDisplayWidth(), + {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE); + + auto layer = std::make_shared( + mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), + getDisplayHeight(), common::PixelFormat::RGBA_8888); + layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setZOrder(10); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors)); + + std::vector> layers = {layer}; + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(layers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + auto layer = std::make_shared(mComposerClient, getPrimaryDisplayId()); + common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setColor(BLUE); + layer->setDisplayFrame(coloredSquare); + layer->setZOrder(10); + layer->write(mWriter); + + // This following buffer call should have no effect + const auto usage = static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN); + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(usage); + ASSERT_TRUE(graphicBufferStatus); + const auto& buffer = graphicBuffer->handle; + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer->getLayer(), /*slot*/ 0, buffer, + /*acquireFence*/ -1); + + // expected color for each pixel + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetReadbackBuffer) { + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); +} + +TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) { + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + const auto usage = static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN); + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(usage); + ASSERT_TRUE(graphicBufferStatus); + const auto& bufferHandle = graphicBuffer->handle; + ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1); + + const auto status = + mComposerClient->setReadbackBuffer(getInvalidDisplayId(), bufferHandle, fence); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadParameter) { + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + const native_handle_t bufferHandle{}; + ndk::ScopedFileDescriptor releaseFence = ndk::ScopedFileDescriptor(-1); + const auto status = + mComposerClient->setReadbackBuffer(getPrimaryDisplayId(), &bufferHandle, releaseFence); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); +} + +TEST_P(GraphicsCompositionTest, GetReadbackBufferFenceInactive) { + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + const auto& [status, releaseFence] = + mComposerClient->getReadbackBufferFence(getPrimaryDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + EXPECT_EQ(-1, releaseFence.get()); +} + +TEST_P(GraphicsCompositionTest, ClientComposition) { + EXPECT_TRUE( + mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kClientTargetSlotCount) + .isOk()); + + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED); + ReadbackHelper::fillColorsArea( + expectedColors, getDisplayWidth(), + {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight() / 2}, GREEN); + ReadbackHelper::fillColorsArea( + expectedColors, getDisplayWidth(), + {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE); + + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + getPrimaryDisplayId(), getDisplayWidth(), + getDisplayHeight(), PixelFormat::RGBA_FP16); + layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setZOrder(10); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + + std::vector> layers = {layer}; + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + + auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); + if (!changedCompositionTypes.empty()) { + ASSERT_EQ(1, changedCompositionTypes.size()); + ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition); + + PixelFormat clientFormat = PixelFormat::RGBA_8888; + auto clientUsage = static_cast( + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_CLIENT_TARGET)); + Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); + common::Rect damage{0, 0, getDisplayWidth(), getDisplayHeight()}; + + // create client target buffer + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage); + ASSERT_TRUE(graphicBufferStatus); + const auto& buffer = graphicBuffer->handle; + void* clientBufData; + const auto stride = static_cast(graphicBuffer->stride); + graphicBuffer->lock(clientUsage, layer->getAccessRegion(), &clientBufData); + + ASSERT_NO_FATAL_FAILURE( + ReadbackHelper::fillBuffer(layer->getWidth(), layer->getHeight(), stride, + clientBufData, clientFormat, expectedColors)); + int32_t clientFence; + const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence); + ASSERT_EQ(::android::OK, unlockStatus); + mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, + clientDataspace, std::vector(1, damage)); + layer->setToClientComposition(mWriter); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); + ASSERT_TRUE(changedCompositionTypes.empty()); + } + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { + ASSERT_TRUE( + mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kClientTargetSlotCount) + .isOk()); + + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, 0, getDisplayWidth(), getDisplayHeight() / 2}, GREEN); + ReadbackHelper::fillColorsArea( + expectedColors, getDisplayWidth(), + {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, RED); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + auto deviceLayer = std::make_shared( + mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), getDisplayWidth(), + getDisplayHeight() / 2, PixelFormat::RGBA_8888); + std::vector deviceColors(deviceLayer->getWidth() * deviceLayer->getHeight()); + ReadbackHelper::fillColorsArea(deviceColors, static_cast(deviceLayer->getWidth()), + {0, 0, static_cast(deviceLayer->getWidth()), + static_cast(deviceLayer->getHeight())}, + GREEN); + deviceLayer->setDisplayFrame({0, 0, static_cast(deviceLayer->getWidth()), + static_cast(deviceLayer->getHeight())}); + deviceLayer->setZOrder(10); + deviceLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + ASSERT_NO_FATAL_FAILURE(deviceLayer->setBuffer(deviceColors)); + deviceLayer->write(mWriter); + + PixelFormat clientFormat = PixelFormat::RGBA_8888; + auto clientUsage = static_cast( + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_CLIENT_TARGET)); + Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); + int32_t clientWidth = getDisplayWidth(); + int32_t clientHeight = getDisplayHeight() / 2; + + auto clientLayer = std::make_shared( + mComposerClient, *mTestRenderEngine, getPrimaryDisplayId(), clientWidth, + clientHeight, PixelFormat::RGBA_FP16, Composition::DEVICE); + common::Rect clientFrame = {0, getDisplayHeight() / 2, getDisplayWidth(), + getDisplayHeight()}; + clientLayer->setDisplayFrame(clientFrame); + clientLayer->setZOrder(0); + clientLayer->write(mWriter); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + + auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); + if (changedCompositionTypes.size() != 1) { + continue; + } + // create client target buffer + ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition); + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage); + ASSERT_TRUE(graphicBufferStatus); + const auto& buffer = graphicBuffer->handle; + + void* clientBufData; + graphicBuffer->lock(clientUsage, {0, 0, getDisplayWidth(), getDisplayHeight()}, + &clientBufData); + + std::vector clientColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(clientColors, getDisplayWidth(), clientFrame, RED); + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer( + static_cast(getDisplayWidth()), static_cast(getDisplayHeight()), + graphicBuffer->getStride(), clientBufData, clientFormat, clientColors)); + int32_t clientFence; + const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence); + ASSERT_EQ(::android::OK, unlockStatus); + mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, + clientDataspace, std::vector(1, clientFrame)); + clientLayer->setToClientComposition(mWriter); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); + ASSERT_TRUE(changedCompositionTypes.empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerDamage) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + common::Rect redRect = {0, 0, getDisplayWidth() / 4, getDisplayHeight() / 4}; + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); + + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + getPrimaryDisplayId(), getDisplayWidth(), + getDisplayHeight(), PixelFormat::RGBA_8888); + layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setZOrder(10); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors)); + + std::vector> layers = {layer}; + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + + // update surface damage and recheck + redRect = {getDisplayWidth() / 4, getDisplayHeight() / 4, getDisplayWidth() / 2, + getDisplayHeight() / 2}; + ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(), + getDisplayWidth()); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); + + ASSERT_NO_FATAL_FAILURE(layer->fillBuffer(expectedColors)); + layer->setSurfaceDamage( + std::vector(1, {0, 0, getDisplayWidth() / 2, getDisplayWidth() / 2})); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + auto layer = std::make_shared(mComposerClient, getPrimaryDisplayId()); + layer->setColor(RED); + layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setZOrder(10); + layer->setAlpha(0); + layer->setBlendMode(BlendMode::PREMULTIPLIED); + + std::vector> layers = {layer}; + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(layers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED); + ReadbackHelper::fillColorsArea( + expectedColors, getDisplayWidth(), + {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE); + + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + getPrimaryDisplayId(), getDisplayWidth(), + getDisplayHeight(), PixelFormat::RGBA_8888); + layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setZOrder(10); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + layer->setSourceCrop({0, static_cast(getDisplayHeight() / 2), + static_cast(getDisplayWidth()), + static_cast(getDisplayHeight())}); + ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors)); + + std::vector> layers = {layer}; + + // update expected colors to match crop + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, 0, getDisplayWidth(), getDisplayHeight()}, BLUE); + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(layers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerZOrder) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2}; + common::Rect blueRect = {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight()}; + auto redLayer = std::make_shared(mComposerClient, getPrimaryDisplayId()); + redLayer->setColor(RED); + redLayer->setDisplayFrame(redRect); + + auto blueLayer = std::make_shared(mComposerClient, getPrimaryDisplayId()); + blueLayer->setColor(BLUE); + blueLayer->setDisplayFrame(blueRect); + blueLayer->setZOrder(5); + + std::vector> layers = {redLayer, blueLayer}; + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + + // red in front of blue + redLayer->setZOrder(10); + + // fill blue first so that red will overwrite on overlap + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), blueRect, BLUE); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + + redLayer->setZOrder(1); + ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(), + getDisplayWidth()); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), blueRect, BLUE); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(layers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { + const auto& [status, capabilities] = + mComposerClient->getDisplayCapabilities(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + const bool brightnessSupport = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::BRIGHTNESS) != capabilities.end(); + + if (!brightnessSupport) { + GTEST_SUCCEED() << "Cannot verify dimming behavior without brightness support"; + return; + } + + const std::optional maxBrightnessNitsOptional = + getMaxDisplayBrightnessNits(getPrimaryDisplayId()); + + ASSERT_TRUE(maxBrightnessNitsOptional.has_value()); + + const float maxBrightnessNits = *maxBrightnessNitsOptional; + + // Preconditions to successfully run are knowing the max brightness and successfully applying + // the max brightness + ASSERT_GT(maxBrightnessNits, 0.f); + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.f, maxBrightnessNits); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace for " + "color mode: " + << toString(mode); + continue; + } + const common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2}; + const common::Rect dimmerRedRect = {0, getDisplayHeight() / 2, getDisplayWidth(), + getDisplayHeight()}; + const auto redLayer = + std::make_shared(mComposerClient, getPrimaryDisplayId()); + redLayer->setColor(RED); + redLayer->setDisplayFrame(redRect); + redLayer->setWhitePointNits(maxBrightnessNits); + redLayer->setBrightness(1.f); + + const auto dimmerRedLayer = + std::make_shared(mComposerClient, getPrimaryDisplayId()); + dimmerRedLayer->setColor(RED); + dimmerRedLayer->setDisplayFrame(dimmerRedRect); + // Intentionally use a small dimming ratio as some implementations may be more likely to + // kick into GPU composition to apply dithering when the dimming ratio is high. + static constexpr float kDimmingRatio = 0.9f; + dimmerRedLayer->setWhitePointNits(maxBrightnessNits * kDimmingRatio); + dimmerRedLayer->setBrightness(kDimmingRatio); + + const std::vector> layers = {redLayer, dimmerRedLayer}; + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), dimmerRedRect, DIM_RED); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + writeLayers(layers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED() + << "Readback verification not supported for GPU composition for color mode: " + << toString(mode); + continue; + } + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(layers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +class GraphicsBlendModeCompositionTest + : public GraphicsCompositionTestBase, + public testing::WithParamInterface> { + public: + void SetUp() override { + SetUpBase(std::get<0>(GetParam())); + // TODO(b/219590743) we should remove the below SRGB color mode + // once we have the BlendMode test fix for all the versions of the ColorMode + mTestColorModes.erase( + std::remove_if(mTestColorModes.begin(), mTestColorModes.end(), + [](ColorMode mode) { return mode != ColorMode::SRGB; }), + mTestColorModes.end()); + mBackgroundColor = BLACK; + mTopLayerColor = RED; + } + + void setBackgroundColor(Color color) { mBackgroundColor = color; } + + void setTopLayerColor(Color color) { mTopLayerColor = color; } + + void setUpLayers(BlendMode blendMode) { + mLayers.clear(); + std::vector topLayerPixelColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(topLayerPixelColors, getDisplayWidth(), + {0, 0, getDisplayWidth(), getDisplayHeight()}, + mTopLayerColor); + + auto backgroundLayer = + std::make_shared(mComposerClient, getPrimaryDisplayId()); + backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + backgroundLayer->setZOrder(0); + backgroundLayer->setColor(mBackgroundColor); + + auto layer = std::make_shared(mComposerClient, *mTestRenderEngine, + getPrimaryDisplayId(), getDisplayWidth(), + getDisplayHeight(), PixelFormat::RGBA_8888); + layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + layer->setZOrder(10); + layer->setDataspace(Dataspace::UNKNOWN, mWriter); + ASSERT_NO_FATAL_FAILURE(layer->setBuffer(topLayerPixelColors)); + + layer->setBlendMode(blendMode); + layer->setAlpha(std::stof(std::get<1>(GetParam()))); + + mLayers.push_back(backgroundLayer); + mLayers.push_back(layer); + } + + void setExpectedColors(std::vector& expectedColors) { + ASSERT_EQ(2, mLayers.size()); + ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(), + getDisplayWidth()); + + auto layer = mLayers[1]; + BlendMode blendMode = layer->getBlendMode(); + float alpha = mTopLayerColor.a * layer->getAlpha(); + if (blendMode == BlendMode::NONE) { + for (auto& expectedColor : expectedColors) { + expectedColor.r = mTopLayerColor.r * layer->getAlpha(); + expectedColor.g = mTopLayerColor.g * layer->getAlpha(); + expectedColor.b = mTopLayerColor.b * layer->getAlpha(); + expectedColor.a = alpha; + } + } else if (blendMode == BlendMode::PREMULTIPLIED) { + for (auto& expectedColor : expectedColors) { + expectedColor.r = + mTopLayerColor.r * layer->getAlpha() + mBackgroundColor.r * (1.0f - alpha); + expectedColor.g = + mTopLayerColor.g * layer->getAlpha() + mBackgroundColor.g * (1.0f - alpha); + expectedColor.b = + mTopLayerColor.b * layer->getAlpha() + mBackgroundColor.b * (1.0f - alpha); + expectedColor.a = alpha + mBackgroundColor.a * (1.0f - alpha); + } + } else if (blendMode == BlendMode::COVERAGE) { + for (auto& expectedColor : expectedColors) { + expectedColor.r = mTopLayerColor.r * alpha + mBackgroundColor.r * (1.0f - alpha); + expectedColor.g = mTopLayerColor.g * alpha + mBackgroundColor.g * (1.0f - alpha); + expectedColor.b = mTopLayerColor.b * alpha + mBackgroundColor.b * (1.0f - alpha); + expectedColor.a = mTopLayerColor.a * alpha + mBackgroundColor.a * (1.0f - alpha); + } + } + } + + protected: + std::vector> mLayers; + Color mBackgroundColor; + Color mTopLayerColor; +}; + +TEST_P(GraphicsBlendModeCompositionTest, None) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + + setBackgroundColor(BLACK); + setTopLayerColor(TRANSLUCENT_RED); + setUpLayers(BlendMode::NONE); + setExpectedColors(expectedColors); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + writeLayers(mLayers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(mLayers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsBlendModeCompositionTest, Coverage) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + + setBackgroundColor(BLACK); + setTopLayerColor(TRANSLUCENT_RED); + + setUpLayers(BlendMode::COVERAGE); + setExpectedColors(expectedColors); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + writeLayers(mLayers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + } +} + +TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + + setBackgroundColor(BLACK); + setTopLayerColor(TRANSLUCENT_RED); + setUpLayers(BlendMode::PREMULTIPLIED); + setExpectedColors(expectedColors); + + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + writeLayers(mLayers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(mLayers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +class GraphicsTransformCompositionTest : public GraphicsCompositionTest { + protected: + void SetUp() override { + GraphicsCompositionTest::SetUp(); + + auto backgroundLayer = + std::make_shared(mComposerClient, getPrimaryDisplayId()); + backgroundLayer->setColor({0.0f, 0.0f, 0.0f, 0.0f}); + backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); + backgroundLayer->setZOrder(0); + + mSideLength = + getDisplayWidth() < getDisplayHeight() ? getDisplayWidth() : getDisplayHeight(); + common::Rect redRect = {0, 0, mSideLength / 2, mSideLength / 2}; + common::Rect blueRect = {mSideLength / 2, mSideLength / 2, mSideLength, mSideLength}; + + mLayer = std::make_shared(mComposerClient, *mTestRenderEngine, + getPrimaryDisplayId(), mSideLength, mSideLength, + PixelFormat::RGBA_8888); + mLayer->setDisplayFrame({0, 0, mSideLength, mSideLength}); + mLayer->setZOrder(10); + + std::vector baseColors(static_cast(mSideLength * mSideLength)); + ReadbackHelper::fillColorsArea(baseColors, mSideLength, redRect, RED); + ReadbackHelper::fillColorsArea(baseColors, mSideLength, blueRect, BLUE); + ASSERT_NO_FATAL_FAILURE(mLayer->setBuffer(baseColors)); + mLayers = {backgroundLayer, mLayer}; + } + + protected: + std::shared_ptr mLayer; + std::vector> mLayers; + int mSideLength; +}; + +TEST_P(GraphicsTransformCompositionTest, FLIP_H) { + for (ColorMode mode : mTestColorModes) { + auto status = mComposerClient->setColorMode(getPrimaryDisplayId(), mode, + RenderIntent::COLORIMETRIC); + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + (status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED || + status.getServiceSpecificError() == IComposerClient::EX_BAD_PARAMETER)) { + SUCCEED() << "ColorMode not supported, skip test"; + return; + } + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + mLayer->setTransform(Transform::FLIP_H); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {mSideLength / 2, 0, mSideLength, mSideLength / 2}, RED); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, mSideLength / 2, mSideLength / 2, mSideLength}, BLUE); + + writeLayers(mLayers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(mLayers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsTransformCompositionTest, FLIP_V) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + mLayer->setTransform(Transform::FLIP_V); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, mSideLength / 2, mSideLength / 2, mSideLength}, RED); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {mSideLength / 2, 0, mSideLength, mSideLength / 2}, BLUE); + + writeLayers(mLayers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(mLayers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +TEST_P(GraphicsTransformCompositionTest, ROT_180) { + for (ColorMode mode : mTestColorModes) { + EXPECT_TRUE(mComposerClient + ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC) + .isOk()); + + bool isSupported; + ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer()); + if (!isSupported) { + GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; + return; + } + ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), + getDisplayHeight(), mPixelFormat, mDataspace); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); + + mLayer->setTransform(Transform::ROT_180); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + + std::vector expectedColors( + static_cast(getDisplayWidth() * getDisplayHeight())); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {mSideLength / 2, mSideLength / 2, mSideLength, mSideLength}, + RED); + ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), + {0, 0, mSideLength / 2, mSideLength / 2}, BLUE); + + writeLayers(mLayers); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); + mTestRenderEngine->setRenderLayers(mLayers); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->drawLayers()); + ASSERT_NO_FATAL_FAILURE(mTestRenderEngine->checkColorBuffer(expectedColors)); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsCompositionTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsCompositionTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsBlendModeCompositionTest); +INSTANTIATE_TEST_SUITE_P(BlendMode, GraphicsBlendModeCompositionTest, + testing::Combine(testing::ValuesIn(::android::getAidlHalInstanceNames( + IComposer::descriptor)), + testing::Values("0.2", "1.0"))); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsTransformCompositionTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsTransformCompositionTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); + +} // namespace +} // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..047109e35f6c405a3b44795c6a19f9a6d9ca077e --- /dev/null +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -0,0 +1,2184 @@ +/** + * Copyright (c) 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. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "GraphicsComposerCallback.h" +#include "VtsComposerClient.h" + +#undef LOG_TAG +#define LOG_TAG "VtsHalGraphicsComposer3_TargetTest" + +namespace aidl::android::hardware::graphics::composer3::vts { +namespace { + +using namespace std::chrono_literals; + +using ::android::GraphicBuffer; +using ::android::sp; + +class GraphicsComposerAidlTest : public ::testing::TestWithParam { + protected: + void SetUp() override { + mComposerClient = std::make_unique(GetParam()); + ASSERT_TRUE(mComposerClient->createClient().isOk()); + + const auto& [status, displays] = mComposerClient->getDisplays(); + ASSERT_TRUE(status.isOk()); + mDisplays = displays; + + // explicitly disable vsync + for (const auto& display : mDisplays) { + EXPECT_TRUE(mComposerClient->setVsync(display.getDisplayId(), false).isOk()); + } + mComposerClient->setVsyncAllowed(false); + } + + void TearDown() override { + ASSERT_TRUE(mComposerClient->tearDown()); + mComposerClient.reset(); + } + + void assertServiceSpecificError(const ScopedAStatus& status, int32_t serviceSpecificError) { + ASSERT_EQ(status.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(status.getServiceSpecificError(), serviceSpecificError); + } + + void Test_setContentTypeForDisplay(int64_t display, + const std::vector& supportedContentTypes, + ContentType contentType, const char* contentTypeStr) { + const bool contentTypeSupport = + std::find(supportedContentTypes.begin(), supportedContentTypes.end(), + contentType) != supportedContentTypes.end(); + + if (!contentTypeSupport) { + const auto& status = mComposerClient->setContentType(display, contentType); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + GTEST_SUCCEED() << contentTypeStr << " content type is not supported on display " + << std::to_string(display) << ", skipping test"; + return; + } + + EXPECT_TRUE(mComposerClient->setContentType(display, contentType).isOk()); + EXPECT_TRUE(mComposerClient->setContentType(display, ContentType::NONE).isOk()); + } + + void Test_setContentType(ContentType contentType, const char* contentTypeStr) { + for (const auto& display : mDisplays) { + const auto& [status, supportedContentTypes] = + mComposerClient->getSupportedContentTypes(display.getDisplayId()); + EXPECT_TRUE(status.isOk()); + Test_setContentTypeForDisplay(display.getDisplayId(), supportedContentTypes, + contentType, contentTypeStr); + } + } + + bool hasCapability(Capability capability) { + const auto& [status, capabilities] = mComposerClient->getCapabilities(); + EXPECT_TRUE(status.isOk()); + return std::any_of( + capabilities.begin(), capabilities.end(), + [&](const Capability& activeCapability) { return activeCapability == capability; }); + } + + const VtsDisplay& getPrimaryDisplay() const { return mDisplays[0]; } + + int64_t getPrimaryDisplayId() const { return getPrimaryDisplay().getDisplayId(); } + + int64_t getInvalidDisplayId() const { return mComposerClient->getInvalidDisplayId(); } + + VtsDisplay& getEditablePrimaryDisplay() { return mDisplays[0]; } + + struct TestParameters { + nsecs_t delayForChange; + bool refreshMiss; + }; + + std::unique_ptr mComposerClient; + std::vector mDisplays; + // use the slot count usually set by SF + static constexpr uint32_t kBufferSlotCount = 64; +}; + +TEST_P(GraphicsComposerAidlTest, GetDisplayCapabilities_BadDisplay) { + const auto& [status, _] = mComposerClient->getDisplayCapabilities(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayCapabilities) { + for (const auto& display : mDisplays) { + const auto& [status, capabilities] = + mComposerClient->getDisplayCapabilities(display.getDisplayId()); + + EXPECT_TRUE(status.isOk()); + } +} + +TEST_P(GraphicsComposerAidlTest, DumpDebugInfo) { + ASSERT_TRUE(mComposerClient->dumpDebugInfo().isOk()); +} + +TEST_P(GraphicsComposerAidlTest, CreateClientSingleton) { + std::shared_ptr composerClient; + const auto& status = mComposerClient->createClient(); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_NO_RESOURCES)); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayIdentificationData) { + const auto& [status0, displayIdentification0] = + mComposerClient->getDisplayIdentificationData(getPrimaryDisplayId()); + if (!status0.isOk() && status0.getExceptionCode() == EX_SERVICE_SPECIFIC && + status0.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + GTEST_SUCCEED() << "Display identification data not supported, skipping test"; + return; + } + ASSERT_TRUE(status0.isOk()) << "failed to get display identification data"; + ASSERT_FALSE(displayIdentification0.data.empty()); + + constexpr size_t kEdidBlockSize = 128; + ASSERT_TRUE(displayIdentification0.data.size() % kEdidBlockSize == 0) + << "EDID blob length is not a multiple of " << kEdidBlockSize; + + const uint8_t kEdidHeader[] = {0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00}; + ASSERT_TRUE(std::equal(std::begin(kEdidHeader), std::end(kEdidHeader), + displayIdentification0.data.begin())) + << "EDID blob doesn't start with the fixed EDID header"; + ASSERT_EQ(0, std::accumulate(displayIdentification0.data.begin(), + displayIdentification0.data.begin() + kEdidBlockSize, + static_cast(0))) + << "EDID base block doesn't checksum"; + + const auto& [status1, displayIdentification1] = + mComposerClient->getDisplayIdentificationData(getPrimaryDisplayId()); + ASSERT_TRUE(status1.isOk()); + + ASSERT_EQ(displayIdentification0.port, displayIdentification1.port) << "ports are not stable"; + ASSERT_TRUE(displayIdentification0.data.size() == displayIdentification1.data.size() && + std::equal(displayIdentification0.data.begin(), displayIdentification0.data.end(), + displayIdentification1.data.begin())) + << "data is not stable"; +} + +TEST_P(GraphicsComposerAidlTest, GetHdrCapabilities) { + const auto& [status, hdrCapabilities] = + mComposerClient->getHdrCapabilities(getPrimaryDisplayId()); + + ASSERT_TRUE(status.isOk()); + EXPECT_TRUE(hdrCapabilities.maxLuminance >= hdrCapabilities.minLuminance); +} + +TEST_P(GraphicsComposerAidlTest, GetPerFrameMetadataKeys) { + const auto& [status, keys] = mComposerClient->getPerFrameMetadataKeys(getPrimaryDisplayId()); + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + GTEST_SUCCEED() << "getPerFrameMetadataKeys is not supported"; + return; + } + + ASSERT_TRUE(status.isOk()); + EXPECT_TRUE(keys.size() >= 0); +} + +TEST_P(GraphicsComposerAidlTest, GetReadbackBufferAttributes) { + const auto& [status, _] = mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + GTEST_SUCCEED() << "getReadbackBufferAttributes is not supported"; + return; + } + + ASSERT_TRUE(status.isOk()); +} + +TEST_P(GraphicsComposerAidlTest, GetRenderIntents) { + const auto& [status, modes] = mComposerClient->getColorModes(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); + + for (auto mode : modes) { + const auto& [intentStatus, intents] = + mComposerClient->getRenderIntents(getPrimaryDisplayId(), mode); + EXPECT_TRUE(intentStatus.isOk()); + bool isHdr; + switch (mode) { + case ColorMode::BT2100_PQ: + case ColorMode::BT2100_HLG: + isHdr = true; + break; + default: + isHdr = false; + break; + } + RenderIntent requiredIntent = + isHdr ? RenderIntent::TONE_MAP_COLORIMETRIC : RenderIntent::COLORIMETRIC; + + const auto iter = std::find(intents.cbegin(), intents.cend(), requiredIntent); + EXPECT_NE(intents.cend(), iter); + } +} + +TEST_P(GraphicsComposerAidlTest, GetRenderIntents_BadDisplay) { + const auto& [status, modes] = mComposerClient->getColorModes(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + for (auto mode : modes) { + const auto& [intentStatus, _] = + mComposerClient->getRenderIntents(getInvalidDisplayId(), mode); + + EXPECT_FALSE(intentStatus.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(intentStatus, IComposerClient::EX_BAD_DISPLAY)); + } +} + +TEST_P(GraphicsComposerAidlTest, GetRenderIntents_BadParameter) { + const auto& [status, _] = + mComposerClient->getRenderIntents(getPrimaryDisplayId(), static_cast(-1)); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); +} + +TEST_P(GraphicsComposerAidlTest, GetColorModes) { + const auto& [status, colorModes] = mComposerClient->getColorModes(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + const auto native = std::find(colorModes.cbegin(), colorModes.cend(), ColorMode::NATIVE); + EXPECT_NE(colorModes.cend(), native); +} + +TEST_P(GraphicsComposerAidlTest, GetColorMode_BadDisplay) { + const auto& [status, _] = mComposerClient->getColorModes(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, SetColorMode) { + const auto& [status, colorModes] = mComposerClient->getColorModes(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); + + for (auto mode : colorModes) { + const auto& [intentStatus, intents] = + mComposerClient->getRenderIntents(getPrimaryDisplayId(), mode); + EXPECT_TRUE(intentStatus.isOk()) << "failed to get render intents"; + + for (auto intent : intents) { + const auto modeStatus = + mComposerClient->setColorMode(getPrimaryDisplayId(), mode, intent); + EXPECT_TRUE(modeStatus.isOk() || + (modeStatus.getExceptionCode() == EX_SERVICE_SPECIFIC && + IComposerClient::EX_UNSUPPORTED == modeStatus.getServiceSpecificError())) + << "failed to set color mode"; + } + } + + const auto modeStatus = mComposerClient->setColorMode(getPrimaryDisplayId(), ColorMode::NATIVE, + RenderIntent::COLORIMETRIC); + EXPECT_TRUE(modeStatus.isOk() || + (modeStatus.getExceptionCode() == EX_SERVICE_SPECIFIC && + IComposerClient::EX_UNSUPPORTED == modeStatus.getServiceSpecificError())) + << "failed to set color mode"; +} + +TEST_P(GraphicsComposerAidlTest, SetColorMode_BadDisplay) { + const auto& [status, colorModes] = mComposerClient->getColorModes(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + for (auto mode : colorModes) { + const auto& [intentStatus, intents] = + mComposerClient->getRenderIntents(getPrimaryDisplayId(), mode); + ASSERT_TRUE(intentStatus.isOk()) << "failed to get render intents"; + + for (auto intent : intents) { + auto const modeStatus = + mComposerClient->setColorMode(getInvalidDisplayId(), mode, intent); + + EXPECT_FALSE(modeStatus.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(modeStatus, IComposerClient::EX_BAD_DISPLAY)); + } + } +} + +TEST_P(GraphicsComposerAidlTest, SetColorMode_BadParameter) { + auto status = mComposerClient->setColorMode(getPrimaryDisplayId(), static_cast(-1), + RenderIntent::COLORIMETRIC); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); + + status = mComposerClient->setColorMode(getPrimaryDisplayId(), ColorMode::NATIVE, + static_cast(-1)); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayedContentSamplingAttributes) { + int constexpr kInvalid = -1; + const auto& [status, format] = + mComposerClient->getDisplayedContentSamplingAttributes(getPrimaryDisplayId()); + + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + SUCCEED() << "Device does not support optional extension. Test skipped"; + return; + } + + ASSERT_TRUE(status.isOk()); + EXPECT_NE(kInvalid, static_cast(format.format)); + EXPECT_NE(kInvalid, static_cast(format.dataspace)); + EXPECT_NE(kInvalid, static_cast(format.componentMask)); +}; + +TEST_P(GraphicsComposerAidlTest, SetDisplayedContentSamplingEnabled) { + int constexpr kMaxFrames = 10; + FormatColorComponent enableAllComponents = FormatColorComponent::FORMAT_COMPONENT_0; + auto status = mComposerClient->setDisplayedContentSamplingEnabled( + getPrimaryDisplayId(), /*isEnabled*/ true, enableAllComponents, kMaxFrames); + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + SUCCEED() << "Device does not support optional extension. Test skipped"; + return; + } + EXPECT_TRUE(status.isOk()); + + status = mComposerClient->setDisplayedContentSamplingEnabled( + getPrimaryDisplayId(), /*isEnabled*/ false, enableAllComponents, kMaxFrames); + EXPECT_TRUE(status.isOk()); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayedContentSample) { + const auto& [status, displayContentSamplingAttributes] = + mComposerClient->getDisplayedContentSamplingAttributes(getPrimaryDisplayId()); + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + SUCCEED() << "Sampling attributes aren't supported on this device, test skipped"; + return; + } + + int64_t constexpr kMaxFrames = 10; + int64_t constexpr kTimestamp = 0; + const auto& [sampleStatus, displayContentSample] = mComposerClient->getDisplayedContentSample( + getPrimaryDisplayId(), kMaxFrames, kTimestamp); + if (!sampleStatus.isOk() && sampleStatus.getExceptionCode() == EX_SERVICE_SPECIFIC && + sampleStatus.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + SUCCEED() << "Device does not support optional extension. Test skipped"; + return; + } + + EXPECT_TRUE(sampleStatus.isOk()); + const std::vector> histogram = { + displayContentSample.sampleComponent0, displayContentSample.sampleComponent1, + displayContentSample.sampleComponent2, displayContentSample.sampleComponent3}; + + for (size_t i = 0; i < histogram.size(); i++) { + const bool shouldHaveHistogram = + static_cast(displayContentSamplingAttributes.componentMask) & (1 << i); + EXPECT_EQ(shouldHaveHistogram, !histogram[i].empty()); + } +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayConnectionType) { + const auto& [status, type] = mComposerClient->getDisplayConnectionType(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); + + for (const auto& display : mDisplays) { + const auto& [connectionTypeStatus, _] = + mComposerClient->getDisplayConnectionType(display.getDisplayId()); + EXPECT_TRUE(connectionTypeStatus.isOk()); + } +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayAttribute) { + for (const auto& display : mDisplays) { + const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId()); + EXPECT_TRUE(status.isOk()); + + for (const auto& config : configs) { + const std::array requiredAttributes = {{ + DisplayAttribute::WIDTH, + DisplayAttribute::HEIGHT, + DisplayAttribute::VSYNC_PERIOD, + DisplayAttribute::CONFIG_GROUP, + }}; + for (const auto& attribute : requiredAttributes) { + const auto& [attribStatus, value] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), config, attribute); + EXPECT_TRUE(attribStatus.isOk()); + EXPECT_NE(-1, value); + } + + const std::array optionalAttributes = {{ + DisplayAttribute::DPI_X, + DisplayAttribute::DPI_Y, + }}; + for (const auto& attribute : optionalAttributes) { + const auto& [attribStatus, value] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), config, attribute); + EXPECT_TRUE(attribStatus.isOk() || + (attribStatus.getExceptionCode() == EX_SERVICE_SPECIFIC && + IComposerClient::EX_UNSUPPORTED == + attribStatus.getServiceSpecificError())); + } + } + } +} + +TEST_P(GraphicsComposerAidlTest, CheckConfigsAreValid) { + for (const auto& display : mDisplays) { + const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId()); + EXPECT_TRUE(status.isOk()); + + EXPECT_FALSE(std::any_of(configs.begin(), configs.end(), [](auto config) { + return config == IComposerClient::INVALID_CONFIGURATION; + })); + } +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayVsyncPeriod_BadDisplay) { + const auto& [status, vsyncPeriodNanos] = + mComposerClient->getDisplayVsyncPeriod(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, SetActiveConfigWithConstraints_BadDisplay) { + VsyncPeriodChangeConstraints constraints; + constraints.seamlessRequired = false; + constraints.desiredTimeNanos = systemTime(); + auto invalidDisplay = VtsDisplay(getInvalidDisplayId()); + + const auto& [status, timeline] = mComposerClient->setActiveConfigWithConstraints( + &invalidDisplay, /*config*/ 0, constraints); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, SetActiveConfigWithConstraints_BadConfig) { + VsyncPeriodChangeConstraints constraints; + constraints.seamlessRequired = false; + constraints.desiredTimeNanos = systemTime(); + + for (VtsDisplay& display : mDisplays) { + int32_t constexpr kInvalidConfigId = IComposerClient::INVALID_CONFIGURATION; + const auto& [status, _] = mComposerClient->setActiveConfigWithConstraints( + &display, kInvalidConfigId, constraints); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_CONFIG)); + } +} + +TEST_P(GraphicsComposerAidlTest, SetBootDisplayConfig_BadDisplay) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + GTEST_SUCCEED() << "Boot Display Config not supported"; + return; + } + const auto& status = mComposerClient->setBootDisplayConfig(getInvalidDisplayId(), /*config*/ 0); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, SetBootDisplayConfig_BadConfig) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + GTEST_SUCCEED() << "Boot Display Config not supported"; + return; + } + for (VtsDisplay& display : mDisplays) { + int32_t constexpr kInvalidConfigId = IComposerClient::INVALID_CONFIGURATION; + const auto& status = + mComposerClient->setBootDisplayConfig(display.getDisplayId(), kInvalidConfigId); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_CONFIG)); + } +} + +TEST_P(GraphicsComposerAidlTest, SetBootDisplayConfig) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + GTEST_SUCCEED() << "Boot Display Config not supported"; + return; + } + const auto& [status, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); + for (const auto& config : configs) { + EXPECT_TRUE(mComposerClient->setBootDisplayConfig(getPrimaryDisplayId(), config).isOk()); + } +} + +TEST_P(GraphicsComposerAidlTest, ClearBootDisplayConfig_BadDisplay) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + GTEST_SUCCEED() << "Boot Display Config not supported"; + return; + } + const auto& status = mComposerClient->clearBootDisplayConfig(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, ClearBootDisplayConfig) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + GTEST_SUCCEED() << "Boot Display Config not supported"; + return; + } + EXPECT_TRUE(mComposerClient->clearBootDisplayConfig(getPrimaryDisplayId()).isOk()); +} + +TEST_P(GraphicsComposerAidlTest, GetPreferredBootDisplayConfig_BadDisplay) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + GTEST_SUCCEED() << "Boot Display Config not supported"; + return; + } + const auto& [status, _] = mComposerClient->getPreferredBootDisplayConfig(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, GetPreferredBootDisplayConfig) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + GTEST_SUCCEED() << "Boot Display Config not supported"; + return; + } + const auto& [status, preferredDisplayConfig] = + mComposerClient->getPreferredBootDisplayConfig(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); + + const auto& [configStatus, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId()); + + EXPECT_TRUE(configStatus.isOk()); + EXPECT_NE(configs.end(), std::find(configs.begin(), configs.end(), preferredDisplayConfig)); +} + +TEST_P(GraphicsComposerAidlTest, BootDisplayConfig_Unsupported) { + if (!hasCapability(Capability::BOOT_DISPLAY_CONFIG)) { + const auto& [configStatus, config] = + mComposerClient->getActiveConfig(getPrimaryDisplayId()); + EXPECT_TRUE(configStatus.isOk()); + + auto status = mComposerClient->setBootDisplayConfig(getPrimaryDisplayId(), config); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + + status = mComposerClient->getPreferredBootDisplayConfig(getPrimaryDisplayId()).first; + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + + status = mComposerClient->clearBootDisplayConfig(getPrimaryDisplayId()); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + } +} + +TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode_BadDisplay) { + auto status = mComposerClient->setAutoLowLatencyMode(getInvalidDisplayId(), /*isEnabled*/ true); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); + + status = mComposerClient->setAutoLowLatencyMode(getInvalidDisplayId(), /*isEnabled*/ false); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode) { + for (const auto& display : mDisplays) { + const auto& [status, capabilities] = + mComposerClient->getDisplayCapabilities(display.getDisplayId()); + ASSERT_TRUE(status.isOk()); + + const bool allmSupport = + std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::AUTO_LOW_LATENCY_MODE) != capabilities.end(); + + if (!allmSupport) { + const auto& statusIsOn = mComposerClient->setAutoLowLatencyMode(display.getDisplayId(), + /*isEnabled*/ true); + EXPECT_FALSE(statusIsOn.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(statusIsOn, IComposerClient::EX_UNSUPPORTED)); + const auto& statusIsOff = mComposerClient->setAutoLowLatencyMode(display.getDisplayId(), + /*isEnabled*/ false); + EXPECT_FALSE(statusIsOff.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(statusIsOff, IComposerClient::EX_UNSUPPORTED)); + GTEST_SUCCEED() << "Auto Low Latency Mode is not supported on display " + << std::to_string(display.getDisplayId()) << ", skipping test"; + return; + } + + EXPECT_TRUE(mComposerClient->setAutoLowLatencyMode(display.getDisplayId(), true).isOk()); + EXPECT_TRUE(mComposerClient->setAutoLowLatencyMode(display.getDisplayId(), false).isOk()); + } +} + +TEST_P(GraphicsComposerAidlTest, GetSupportedContentTypes_BadDisplay) { + const auto& [status, _] = mComposerClient->getSupportedContentTypes(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, GetSupportedContentTypes) { + for (const auto& display : mDisplays) { + const auto& [status, supportedContentTypes] = + mComposerClient->getSupportedContentTypes(display.getDisplayId()); + ASSERT_TRUE(status.isOk()); + + const bool noneSupported = + std::find(supportedContentTypes.begin(), supportedContentTypes.end(), + ContentType::NONE) != supportedContentTypes.end(); + + EXPECT_FALSE(noneSupported); + } +} + +TEST_P(GraphicsComposerAidlTest, SetContentTypeNoneAlwaysAccepted) { + for (const auto& display : mDisplays) { + EXPECT_TRUE( + mComposerClient->setContentType(display.getDisplayId(), ContentType::NONE).isOk()); + } +} + +TEST_P(GraphicsComposerAidlTest, SetContentType_BadDisplay) { + constexpr ContentType types[] = {ContentType::NONE, ContentType::GRAPHICS, ContentType::PHOTO, + ContentType::CINEMA, ContentType::GAME}; + for (const auto& type : types) { + const auto& status = mComposerClient->setContentType(getInvalidDisplayId(), type); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); + } +} + +TEST_P(GraphicsComposerAidlTest, SetGraphicsContentType) { + Test_setContentType(ContentType::GRAPHICS, "GRAPHICS"); +} + +TEST_P(GraphicsComposerAidlTest, SetPhotoContentType) { + Test_setContentType(ContentType::PHOTO, "PHOTO"); +} + +TEST_P(GraphicsComposerAidlTest, SetCinemaContentType) { + Test_setContentType(ContentType::CINEMA, "CINEMA"); +} + +TEST_P(GraphicsComposerAidlTest, SetGameContentType) { + Test_setContentType(ContentType::GAME, "GAME"); +} + +TEST_P(GraphicsComposerAidlTest, CreateVirtualDisplay) { + const auto& [status, maxVirtualDisplayCount] = mComposerClient->getMaxVirtualDisplayCount(); + EXPECT_TRUE(status.isOk()); + + if (maxVirtualDisplayCount == 0) { + GTEST_SUCCEED() << "no virtual display support"; + return; + } + + const auto& [virtualDisplayStatus, virtualDisplay] = mComposerClient->createVirtualDisplay( + /*width*/ 64, /*height*/ 64, common::PixelFormat::IMPLEMENTATION_DEFINED, + kBufferSlotCount); + + ASSERT_TRUE(virtualDisplayStatus.isOk()); + EXPECT_TRUE(mComposerClient->destroyVirtualDisplay(virtualDisplay.display).isOk()); +} + +TEST_P(GraphicsComposerAidlTest, DestroyVirtualDisplay_BadDisplay) { + const auto& [status, maxDisplayCount] = mComposerClient->getMaxVirtualDisplayCount(); + EXPECT_TRUE(status.isOk()); + + if (maxDisplayCount == 0) { + GTEST_SUCCEED() << "no virtual display support"; + return; + } + + const auto& destroyStatus = mComposerClient->destroyVirtualDisplay(getInvalidDisplayId()); + + EXPECT_FALSE(destroyStatus.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(destroyStatus, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, CreateLayer) { + const auto& [status, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + + EXPECT_TRUE(status.isOk()); + EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk()); +} + +TEST_P(GraphicsComposerAidlTest, CreateLayer_BadDisplay) { + const auto& [status, _] = mComposerClient->createLayer(getInvalidDisplayId(), kBufferSlotCount); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, DestroyLayer_BadDisplay) { + const auto& [status, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(status.isOk()); + + const auto& destroyStatus = mComposerClient->destroyLayer(getInvalidDisplayId(), layer); + + EXPECT_FALSE(destroyStatus.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(destroyStatus, IComposerClient::EX_BAD_DISPLAY)); + ASSERT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk()); +} + +TEST_P(GraphicsComposerAidlTest, DestroyLayer_BadLayerError) { + // We haven't created any layers yet, so any id should be invalid + const auto& status = mComposerClient->destroyLayer(getPrimaryDisplayId(), /*layer*/ 1); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_LAYER)); +} + +TEST_P(GraphicsComposerAidlTest, GetActiveConfig_BadDisplay) { + const auto& [status, _] = mComposerClient->getActiveConfig(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayConfig) { + const auto& [status, _] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayConfig_BadDisplay) { + const auto& [status, _] = mComposerClient->getDisplayConfigs(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayName) { + const auto& [status, _] = mComposerClient->getDisplayName(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) { + const auto& [status, _] = mComposerClient->getDisplayPhysicalOrientation(getInvalidDisplayId()); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation) { + const auto allowedDisplayOrientations = std::array{ + Transform::NONE, + Transform::ROT_90, + Transform::ROT_180, + Transform::ROT_270, + }; + + const auto& [status, displayOrientation] = + mComposerClient->getDisplayPhysicalOrientation(getPrimaryDisplayId()); + + EXPECT_TRUE(status.isOk()); + EXPECT_NE(std::find(allowedDisplayOrientations.begin(), allowedDisplayOrientations.end(), + displayOrientation), + allowedDisplayOrientations.end()); +} + +TEST_P(GraphicsComposerAidlTest, SetClientTargetSlotCount) { + EXPECT_TRUE(mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kBufferSlotCount) + .isOk()); +} + +TEST_P(GraphicsComposerAidlTest, SetActiveConfig) { + const auto& [status, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); + + for (const auto& config : configs) { + auto display = getEditablePrimaryDisplay(); + EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config).isOk()); + const auto& [configStatus, config1] = + mComposerClient->getActiveConfig(getPrimaryDisplayId()); + EXPECT_TRUE(configStatus.isOk()); + EXPECT_EQ(config, config1); + } +} + +TEST_P(GraphicsComposerAidlTest, SetActiveConfigPowerCycle) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + + const auto& [status, configs] = mComposerClient->getDisplayConfigs(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); + + for (const auto& config : configs) { + auto display = getEditablePrimaryDisplay(); + EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config).isOk()); + const auto& [config1Status, config1] = + mComposerClient->getActiveConfig(getPrimaryDisplayId()); + EXPECT_TRUE(config1Status.isOk()); + EXPECT_EQ(config, config1); + + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + const auto& [config2Status, config2] = + mComposerClient->getActiveConfig(getPrimaryDisplayId()); + EXPECT_TRUE(config2Status.isOk()); + EXPECT_EQ(config, config2); + } +} + +TEST_P(GraphicsComposerAidlTest, SetPowerModeUnsupported) { + const auto& [status, capabilities] = + mComposerClient->getDisplayCapabilities(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::DOZE) != capabilities.end(); + const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::SUSPEND) != capabilities.end(); + + if (!isDozeSupported) { + const auto& powerModeDozeStatus = + mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::DOZE); + EXPECT_FALSE(powerModeDozeStatus.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(powerModeDozeStatus, IComposerClient::EX_UNSUPPORTED)); + + const auto& powerModeDozeSuspendStatus = + mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::DOZE_SUSPEND); + EXPECT_FALSE(powerModeDozeSuspendStatus.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(powerModeDozeSuspendStatus, + IComposerClient::EX_UNSUPPORTED)); + } + + if (!isSuspendSupported) { + const auto& powerModeSuspendStatus = + mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON_SUSPEND); + EXPECT_FALSE(powerModeSuspendStatus.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(powerModeSuspendStatus, + IComposerClient::EX_UNSUPPORTED)); + + const auto& powerModeDozeSuspendStatus = + mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::DOZE_SUSPEND); + EXPECT_FALSE(powerModeDozeSuspendStatus.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(powerModeDozeSuspendStatus, + IComposerClient::EX_UNSUPPORTED)); + } +} + +TEST_P(GraphicsComposerAidlTest, SetVsyncEnabled) { + mComposerClient->setVsyncAllowed(true); + + EXPECT_TRUE(mComposerClient->setVsync(getPrimaryDisplayId(), true).isOk()); + usleep(60 * 1000); + EXPECT_TRUE(mComposerClient->setVsync(getPrimaryDisplayId(), false).isOk()); + + mComposerClient->setVsyncAllowed(false); +} + +TEST_P(GraphicsComposerAidlTest, SetPowerMode) { + const auto& [status, capabilities] = + mComposerClient->getDisplayCapabilities(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::DOZE) != capabilities.end(); + const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::SUSPEND) != capabilities.end(); + + std::vector modes; + modes.push_back(PowerMode::OFF); + modes.push_back(PowerMode::ON); + + if (isSuspendSupported) { + modes.push_back(PowerMode::ON_SUSPEND); + } + + if (isDozeSupported) { + modes.push_back(PowerMode::DOZE); + } + + if (isSuspendSupported && isDozeSupported) { + modes.push_back(PowerMode::DOZE_SUSPEND); + } + + for (auto mode : modes) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk()); + } +} + +TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) { + const auto& [status, capabilities] = + mComposerClient->getDisplayCapabilities(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + + const bool isDozeSupported = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::DOZE) != capabilities.end(); + const bool isSuspendSupported = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::SUSPEND) != capabilities.end(); + + std::vector modes; + + modes.push_back(PowerMode::OFF); + modes.push_back(PowerMode::ON); + modes.push_back(PowerMode::OFF); + for (auto mode : modes) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk()); + } + modes.clear(); + + modes.push_back(PowerMode::OFF); + modes.push_back(PowerMode::OFF); + for (auto mode : modes) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk()); + } + modes.clear(); + + modes.push_back(PowerMode::ON); + modes.push_back(PowerMode::ON); + for (auto mode : modes) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk()); + } + modes.clear(); + + if (isSuspendSupported) { + modes.push_back(PowerMode::ON_SUSPEND); + modes.push_back(PowerMode::ON_SUSPEND); + for (auto mode : modes) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk()); + } + modes.clear(); + } + + if (isDozeSupported) { + modes.push_back(PowerMode::DOZE); + modes.push_back(PowerMode::DOZE); + for (auto mode : modes) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk()); + } + modes.clear(); + } + + if (isSuspendSupported && isDozeSupported) { + modes.push_back(PowerMode::DOZE_SUSPEND); + modes.push_back(PowerMode::DOZE_SUSPEND); + for (auto mode : modes) { + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), mode).isOk()); + } + modes.clear(); + } +} + +TEST_P(GraphicsComposerAidlTest, SetPowerMode_BadDisplay) { + const auto& status = mComposerClient->setPowerMode(getInvalidDisplayId(), PowerMode::ON); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_DISPLAY)); +} + +TEST_P(GraphicsComposerAidlTest, SetPowerMode_BadParameter) { + const auto& status = + mComposerClient->setPowerMode(getPrimaryDisplayId(), static_cast(-1)); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); +} + +TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrix) { + const auto& [status, matrix] = + mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::SRGB_LINEAR); + ASSERT_TRUE(status.isOk()); + ASSERT_EQ(16, matrix.size()); // matrix should not be empty if call succeeded. + + // the last row is known + EXPECT_EQ(0.0f, matrix[12]); + EXPECT_EQ(0.0f, matrix[13]); + EXPECT_EQ(0.0f, matrix[14]); + EXPECT_EQ(1.0f, matrix[15]); +} + +TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrix_BadParameter) { + const auto& [status, matrix] = + mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::UNKNOWN); + + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); +} + +// Tests for Command. +class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { + protected: + void TearDown() override { + const auto errors = mReader.takeErrors(); + ASSERT_TRUE(mReader.takeErrors().empty()); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); + + ASSERT_NO_FATAL_FAILURE(GraphicsComposerAidlTest::TearDown()); + } + + void execute() { + const auto& commands = mWriter.getPendingCommands(); + if (commands.empty()) { + mWriter.reset(); + return; + } + + auto [status, results] = mComposerClient->executeCommands(commands); + ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription(); + + mReader.parse(std::move(results)); + mWriter.reset(); + } + + static inline auto toTimePoint(nsecs_t time) { + return std::chrono::time_point(std::chrono::nanoseconds(time)); + } + + void forEachTwoConfigs(int64_t display, std::function func) { + const auto& [status, displayConfigs] = mComposerClient->getDisplayConfigs(display); + ASSERT_TRUE(status.isOk()); + for (const int32_t config1 : displayConfigs) { + for (const int32_t config2 : displayConfigs) { + if (config1 != config2) { + func(config1, config2); + } + } + } + } + + void waitForVsyncPeriodChange(int64_t display, const VsyncPeriodChangeTimeline& timeline, + int64_t desiredTimeNanos, int64_t oldPeriodNanos, + int64_t newPeriodNanos) { + const auto kChangeDeadline = toTimePoint(timeline.newVsyncAppliedTimeNanos) + 100ms; + while (std::chrono::steady_clock::now() <= kChangeDeadline) { + const auto& [status, vsyncPeriodNanos] = + mComposerClient->getDisplayVsyncPeriod(display); + EXPECT_TRUE(status.isOk()); + if (systemTime() <= desiredTimeNanos) { + EXPECT_EQ(vsyncPeriodNanos, oldPeriodNanos); + } else if (vsyncPeriodNanos == newPeriodNanos) { + break; + } + std::this_thread::sleep_for(std::chrono::nanoseconds(oldPeriodNanos)); + } + } + + sp allocate(::android::PixelFormat pixelFormat) { + return sp::make( + static_cast(getPrimaryDisplay().getDisplayWidth()), + static_cast(getPrimaryDisplay().getDisplayHeight()), pixelFormat, + /*layerCount*/ 1U, + (static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_OVERLAY)), + "VtsHalGraphicsComposer3_TargetTest"); + } + + void sendRefreshFrame(const VtsDisplay& display, const VsyncPeriodChangeTimeline* timeline) { + if (timeline != nullptr) { + // Refresh time should be before newVsyncAppliedTimeNanos + EXPECT_LT(timeline->refreshTimeNanos, timeline->newVsyncAppliedTimeNanos); + + std::this_thread::sleep_until(toTimePoint(timeline->refreshTimeNanos)); + } + + EXPECT_TRUE(mComposerClient->setPowerMode(display.getDisplayId(), PowerMode::ON).isOk()); + EXPECT_TRUE(mComposerClient + ->setColorMode(display.getDisplayId(), ColorMode::NATIVE, + RenderIntent::COLORIMETRIC) + .isOk()); + + const auto& [status, layer] = + mComposerClient->createLayer(display.getDisplayId(), kBufferSlotCount); + EXPECT_TRUE(status.isOk()); + { + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer); + ASSERT_EQ(::android::OK, buffer->initCheck()); + ASSERT_NE(nullptr, buffer->handle); + + configureLayer(display, layer, Composition::DEVICE, display.getFrameRect(), + display.getCrop()); + mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); + mWriter.setLayerDataspace(display.getDisplayId(), layer, common::Dataspace::UNKNOWN); + + mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.presentDisplay(display.getDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + } + + { + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer->handle); + + mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); + mWriter.setLayerSurfaceDamage(display.getDisplayId(), layer, + std::vector(1, {0, 0, 10, 10})); + mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.presentDisplay(display.getDisplayId()); + execute(); + } + + EXPECT_TRUE(mComposerClient->destroyLayer(display.getDisplayId(), layer).isOk()); + } + + sp<::android::Fence> presentAndGetFence( + std::optional expectedPresentTime) { + mWriter.validateDisplay(getPrimaryDisplayId(), expectedPresentTime); + execute(); + EXPECT_TRUE(mReader.takeErrors().empty()); + + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + EXPECT_TRUE(mReader.takeErrors().empty()); + + auto presentFence = mReader.takePresentFence(getPrimaryDisplayId()); + // take ownership + const int fenceOwner = presentFence.get(); + *presentFence.getR() = -1; + EXPECT_NE(-1, fenceOwner); + return sp<::android::Fence>::make(fenceOwner); + } + + int32_t getVsyncPeriod() { + const auto& [status, activeConfig] = + mComposerClient->getActiveConfig(getPrimaryDisplayId()); + EXPECT_TRUE(status.isOk()); + + const auto& [vsyncPeriodStatus, vsyncPeriod] = mComposerClient->getDisplayAttribute( + getPrimaryDisplayId(), activeConfig, DisplayAttribute::VSYNC_PERIOD); + EXPECT_TRUE(vsyncPeriodStatus.isOk()); + return vsyncPeriod; + } + + int64_t createOnScreenLayer() { + const auto& [status, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(status.isOk()); + Rect displayFrame{0, 0, getPrimaryDisplay().getDisplayWidth(), + getPrimaryDisplay().getDisplayHeight()}; + FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(), + (float)getPrimaryDisplay().getDisplayHeight()}; + configureLayer(getPrimaryDisplay(), layer, Composition::DEVICE, displayFrame, cropRect); + mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, common::Dataspace::UNKNOWN); + return layer; + } + + bool hasDisplayCapability(int64_t display, DisplayCapability cap) { + const auto& [status, capabilities] = mComposerClient->getDisplayCapabilities(display); + EXPECT_TRUE(status.isOk()); + + return std::find(capabilities.begin(), capabilities.end(), cap) != capabilities.end(); + } + + void Test_setActiveConfigWithConstraints(const TestParameters& params) { + for (VtsDisplay& display : mDisplays) { + forEachTwoConfigs(display.getDisplayId(), [&](int32_t config1, int32_t config2) { + EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk()); + sendRefreshFrame(display, nullptr); + + const auto displayConfigGroup1 = display.getDisplayConfig(config1); + int32_t vsyncPeriod1 = displayConfigGroup1.vsyncPeriod; + int32_t configGroup1 = displayConfigGroup1.configGroup; + + const auto displayConfigGroup2 = display.getDisplayConfig(config2); + int32_t vsyncPeriod2 = displayConfigGroup2.vsyncPeriod; + int32_t configGroup2 = displayConfigGroup2.configGroup; + + if (vsyncPeriod1 == vsyncPeriod2) { + return; // continue + } + + // We don't allow delayed change when changing config groups + if (params.delayForChange > 0 && configGroup1 != configGroup2) { + return; // continue + } + + VsyncPeriodChangeConstraints constraints = { + .desiredTimeNanos = systemTime() + params.delayForChange, + .seamlessRequired = false}; + const auto& [status, timeline] = mComposerClient->setActiveConfigWithConstraints( + &display, config2, constraints); + EXPECT_TRUE(status.isOk()); + + EXPECT_TRUE(timeline.newVsyncAppliedTimeNanos >= constraints.desiredTimeNanos); + // Refresh rate should change within a reasonable time + constexpr std::chrono::nanoseconds kReasonableTimeForChange = 1s; // 1 second + EXPECT_TRUE(timeline.newVsyncAppliedTimeNanos - constraints.desiredTimeNanos <= + kReasonableTimeForChange.count()); + + if (timeline.refreshRequired) { + if (params.refreshMiss) { + // Miss the refresh frame on purpose to make sure the implementation sends a + // callback + std::this_thread::sleep_until(toTimePoint(timeline.refreshTimeNanos) + + 100ms); + } + sendRefreshFrame(display, &timeline); + } + waitForVsyncPeriodChange(display.getDisplayId(), timeline, + constraints.desiredTimeNanos, vsyncPeriod1, vsyncPeriod2); + + // At this point the refresh rate should have changed already, however in rare + // cases the implementation might have missed the deadline. In this case a new + // timeline should have been provided. + auto newTimeline = mComposerClient->takeLastVsyncPeriodChangeTimeline(); + if (timeline.refreshRequired && params.refreshMiss) { + EXPECT_TRUE(newTimeline.has_value()); + } + + if (newTimeline.has_value()) { + if (newTimeline->refreshRequired) { + sendRefreshFrame(display, &newTimeline.value()); + } + waitForVsyncPeriodChange(display.getDisplayId(), newTimeline.value(), + constraints.desiredTimeNanos, vsyncPeriod1, + vsyncPeriod2); + } + + const auto& [vsyncPeriodNanosStatus, vsyncPeriodNanos] = + mComposerClient->getDisplayVsyncPeriod(display.getDisplayId()); + EXPECT_TRUE(vsyncPeriodNanosStatus.isOk()); + EXPECT_EQ(vsyncPeriodNanos, vsyncPeriod2); + }); + } + } + + void Test_expectedPresentTime(std::optional framesDelay) { + if (hasCapability(Capability::PRESENT_FENCE_IS_NOT_RELIABLE)) { + GTEST_SUCCEED() << "Device has unreliable present fences capability, skipping"; + return; + } + + ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + + const auto vsyncPeriod = getVsyncPeriod(); + + const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer1); + ASSERT_NE(nullptr, buffer2); + + const auto layer = createOnScreenLayer(); + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer1->handle, + /*acquireFence*/ -1); + const sp<::android::Fence> presentFence1 = + presentAndGetFence(ComposerClientWriter::kNoTimestamp); + presentFence1->waitForever(LOG_TAG); + + auto expectedPresentTime = presentFence1->getSignalTime() + vsyncPeriod; + if (framesDelay.has_value()) { + expectedPresentTime += *framesDelay * vsyncPeriod; + } + + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer2->handle, + /*acquireFence*/ -1); + const auto setExpectedPresentTime = [&]() -> std::optional { + if (!framesDelay.has_value()) { + return ComposerClientWriter::kNoTimestamp; + } else if (*framesDelay == 0) { + return ClockMonotonicTimestamp{0}; + } + return ClockMonotonicTimestamp{expectedPresentTime}; + }(); + + const sp<::android::Fence> presentFence2 = presentAndGetFence(setExpectedPresentTime); + presentFence2->waitForever(LOG_TAG); + + const auto actualPresentTime = presentFence2->getSignalTime(); + EXPECT_GE(actualPresentTime, expectedPresentTime - vsyncPeriod / 2); + + ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); + } + + void configureLayer(const VtsDisplay& display, int64_t layer, Composition composition, + const Rect& displayFrame, const FRect& cropRect) { + mWriter.setLayerCompositionType(display.getDisplayId(), layer, composition); + mWriter.setLayerDisplayFrame(display.getDisplayId(), layer, displayFrame); + mWriter.setLayerPlaneAlpha(display.getDisplayId(), layer, /*alpha*/ 1); + mWriter.setLayerSourceCrop(display.getDisplayId(), layer, cropRect); + mWriter.setLayerTransform(display.getDisplayId(), layer, static_cast(0)); + mWriter.setLayerVisibleRegion(display.getDisplayId(), layer, + std::vector(1, displayFrame)); + mWriter.setLayerZOrder(display.getDisplayId(), layer, /*z*/ 10); + mWriter.setLayerBlendMode(display.getDisplayId(), layer, BlendMode::NONE); + mWriter.setLayerSurfaceDamage(display.getDisplayId(), layer, + std::vector(1, displayFrame)); + } + // clang-format off + const std::array kIdentity = {{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }}; + // clang-format on + + ComposerClientWriter mWriter; + ComposerClientReader mReader; +}; + +TEST_P(GraphicsComposerAidlCommandTest, SetColorTransform) { + mWriter.setColorTransform(getPrimaryDisplayId(), kIdentity.data()); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerColorTransform) { + const auto& [status, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(status.isOk()); + mWriter.setLayerColorTransform(getPrimaryDisplayId(), layer, kIdentity.data()); + execute(); + + const auto errors = mReader.takeErrors(); + if (errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_UNSUPPORTED) { + GTEST_SUCCEED() << "setLayerColorTransform is not supported"; + return; + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetDisplayBrightness) { + const auto& [status, capabilities] = + mComposerClient->getDisplayCapabilities(getPrimaryDisplayId()); + ASSERT_TRUE(status.isOk()); + bool brightnessSupport = std::find(capabilities.begin(), capabilities.end(), + DisplayCapability::BRIGHTNESS) != capabilities.end(); + if (!brightnessSupport) { + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f, -1.f); + execute(); + const auto errors = mReader.takeErrors(); + EXPECT_EQ(1, errors.size()); + EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, errors[0].errorCode); + GTEST_SUCCEED() << "SetDisplayBrightness is not supported"; + return; + } + + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.0f, -1.f); + execute(); + EXPECT_TRUE(mReader.takeErrors().empty()); + + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f, -1.f); + execute(); + EXPECT_TRUE(mReader.takeErrors().empty()); + + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.0f, -1.f); + execute(); + EXPECT_TRUE(mReader.takeErrors().empty()); + + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -1.0f, -1.f); + execute(); + EXPECT_TRUE(mReader.takeErrors().empty()); + + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 2.0f, -1.f); + execute(); + { + const auto errors = mReader.takeErrors(); + ASSERT_EQ(1, errors.size()); + EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode); + } + + mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -2.0f, -1.f); + execute(); + { + const auto errors = mReader.takeErrors(); + ASSERT_EQ(1, errors.size()); + EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode); + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetClientTarget) { + EXPECT_TRUE(mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kBufferSlotCount) + .isOk()); + + mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, nullptr, /*acquireFence*/ -1, + Dataspace::UNKNOWN, std::vector()); + + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetOutputBuffer) { + const auto& [status, virtualDisplayCount] = mComposerClient->getMaxVirtualDisplayCount(); + EXPECT_TRUE(status.isOk()); + if (virtualDisplayCount == 0) { + GTEST_SUCCEED() << "no virtual display support"; + return; + } + + const auto& [displayStatus, display] = mComposerClient->createVirtualDisplay( + /*width*/ 64, /*height*/ 64, common::PixelFormat::IMPLEMENTATION_DEFINED, + kBufferSlotCount); + EXPECT_TRUE(displayStatus.isOk()); + + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + const auto handle = buffer->handle; + mWriter.setOutputBuffer(display.display, /*slot*/ 0, handle, /*releaseFence*/ -1); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, ValidDisplay) { + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, AcceptDisplayChanges) { + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter.acceptDisplayChanges(getPrimaryDisplayId()); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, PresentDisplay) { + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); +} + +/** + * Test IComposerClient::Command::PRESENT_DISPLAY + * + * Test that IComposerClient::Command::PRESENT_DISPLAY works without + * additional call to validateDisplay when only the layer buffer handle and + * surface damage have been set + */ +TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) { + if (!hasCapability(Capability::SKIP_VALIDATE)) { + GTEST_SUCCEED() << "Device does not have skip validate capability, skipping"; + return; + } + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + + const auto& [renderIntentsStatus, renderIntents] = + mComposerClient->getRenderIntents(getPrimaryDisplayId(), ColorMode::NATIVE); + EXPECT_TRUE(renderIntentsStatus.isOk()); + for (auto intent : renderIntents) { + EXPECT_TRUE(mComposerClient->setColorMode(getPrimaryDisplayId(), ColorMode::NATIVE, intent) + .isOk()); + + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + const auto handle = buffer->handle; + ASSERT_NE(nullptr, handle); + + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + Rect displayFrame{0, 0, getPrimaryDisplay().getDisplayWidth(), + getPrimaryDisplay().getDisplayHeight()}; + FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(), + (float)getPrimaryDisplay().getDisplayHeight()}; + configureLayer(getPrimaryDisplay(), layer, Composition::CURSOR, displayFrame, cropRect); + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, + /*acquireFence*/ -1); + mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED() << "Composition change requested, skipping test"; + return; + } + + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + const auto handle2 = buffer2->handle; + ASSERT_NE(nullptr, handle2); + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, + /*acquireFence*/ -1); + mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, + std::vector(1, {0, 0, 10, 10})); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + const auto handle = buffer->handle; + ASSERT_NE(nullptr, handle); + + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1); + + Rect displayFrame{0, 0, getPrimaryDisplay().getDisplayWidth(), + getPrimaryDisplay().getDisplayHeight()}; + FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(), + (float)getPrimaryDisplay().getDisplayHeight()}; + configureLayer(getPrimaryDisplay(), layer, Composition::CURSOR, displayFrame, cropRect); + mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + + execute(); + + if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { + GTEST_SUCCEED() << "Composition change requested, skipping test"; + return; + } + mWriter.presentDisplay(getPrimaryDisplayId()); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 1, /*y*/ 1); + execute(); + + mWriter.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 0, /*y*/ 0); + mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter.presentDisplay(getPrimaryDisplayId()); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + const auto handle = buffer->handle; + ASSERT_NE(nullptr, handle); + + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerSurfaceDamage) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + Rect empty{0, 0, 0, 0}; + Rect unit{0, 0, 1, 1}; + + mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector(1, empty)); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector(1, unit)); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerBlockingRegion) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + Rect empty{0, 0, 0, 0}; + Rect unit{0, 0, 1, 1}; + + mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector(1, empty)); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector(1, unit)); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerBlendMode) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::NONE); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::PREMULTIPLIED); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::COVERAGE); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerColor) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerColor(getPrimaryDisplayId(), layer, Color{1.0f, 1.0f, 1.0f, 1.0f}); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerColor(getPrimaryDisplayId(), layer, Color{0.0f, 0.0f, 0.0f, 0.0f}); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerCompositionType) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CLIENT); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::DEVICE); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::SOLID_COLOR); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CURSOR); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { + for (VtsDisplay& display : mDisplays) { + const auto [layerStatus, layer] = + mComposerClient->createLayer(display.getDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + const auto [error, support] = + mComposerClient->getDisplayDecorationSupport(display.getDisplayId()); + + const auto format = (error.isOk() && support) ? support->format + : aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888; + const auto decorBuffer = allocate(static_cast<::android::PixelFormat>(format)); + ASSERT_NE(nullptr, decorBuffer); + if (::android::OK != decorBuffer->initCheck()) { + if (support) { + FAIL() << "Device advertised display decoration support with format " + << aidl::android::hardware::graphics::common::toString(format) + << " but failed to allocate it!"; + } else { + FAIL() << "Device advertised NO display decoration support, but it should " + << "still be able to allocate " + << aidl::android::hardware::graphics::common::toString(format); + } + } + + configureLayer(display, layer, Composition::DISPLAY_DECORATION, display.getFrameRect(), + display.getCrop()); + mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle, + /*acquireFence*/ -1); + mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + execute(); + if (support) { + ASSERT_TRUE(mReader.takeErrors().empty()); + } else { + const auto errors = mReader.takeErrors(); + ASSERT_EQ(1, errors.size()); + EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, errors[0].errorCode); + } + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerDataspace) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerDisplayFrame) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerDisplayFrame(getPrimaryDisplayId(), layer, Rect{0, 0, 1, 1}); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerPlaneAlpha) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 0.0f); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 1.0f); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerSidebandStream) { + if (!hasCapability(Capability::SIDEBAND_STREAM)) { + GTEST_SUCCEED() << "no sideband stream support"; + return; + } + + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + const auto handle = buffer->handle; + ASSERT_NE(nullptr, handle); + + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerSidebandStream(getPrimaryDisplayId(), layer, handle); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerSourceCrop) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerSourceCrop(getPrimaryDisplayId(), layer, FRect{0.0f, 0.0f, 1.0f, 1.0f}); + execute(); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerTransform) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, static_cast(0)); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_H); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_V); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_90); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_180); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_270); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, + static_cast(static_cast(Transform::FLIP_H) | + static_cast(Transform::ROT_90))); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerTransform(getPrimaryDisplayId(), layer, + static_cast(static_cast(Transform::FLIP_V) | + static_cast(Transform::ROT_90))); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerVisibleRegion) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + Rect empty{0, 0, 0, 0}; + Rect unit{0, 0, 1, 1}; + + mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector(1, empty)); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector(1, unit)); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector()); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerZOrder) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + mWriter.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 10); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 0); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerPerFrameMetadata) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + /** + * DISPLAY_P3 is a color space that uses the DCI_P3 primaries, + * the D65 white point and the SRGB transfer functions. + * Rendering Intent: Colorimetric + * Primaries: + * x y + * green 0.265 0.690 + * blue 0.150 0.060 + * red 0.680 0.320 + * white (D65) 0.3127 0.3290 + */ + + std::vector aidlMetadata; + aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_RED_PRIMARY_X, 0.680f}); + aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_RED_PRIMARY_Y, 0.320f}); + aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_X, 0.265f}); + aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_GREEN_PRIMARY_Y, 0.690f}); + aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_X, 0.150f}); + aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_BLUE_PRIMARY_Y, 0.060f}); + aidlMetadata.push_back({PerFrameMetadataKey::WHITE_POINT_X, 0.3127f}); + aidlMetadata.push_back({PerFrameMetadataKey::WHITE_POINT_Y, 0.3290f}); + aidlMetadata.push_back({PerFrameMetadataKey::MAX_LUMINANCE, 100.0f}); + aidlMetadata.push_back({PerFrameMetadataKey::MIN_LUMINANCE, 0.1f}); + aidlMetadata.push_back({PerFrameMetadataKey::MAX_CONTENT_LIGHT_LEVEL, 78.0}); + aidlMetadata.push_back({PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL, 62.0}); + mWriter.setLayerPerFrameMetadata(getPrimaryDisplayId(), layer, aidlMetadata); + execute(); + + const auto errors = mReader.takeErrors(); + if (errors.size() == 1 && errors[0].errorCode == EX_UNSUPPORTED_OPERATION) { + GTEST_SUCCEED() << "SetLayerPerFrameMetadata is not supported"; + EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk()); + return; + } + + EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer).isOk()); +} + +TEST_P(GraphicsComposerAidlCommandTest, setLayerBrightness) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + + mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 0.2f); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 1.f); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 0.f); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, -1.f); + execute(); + { + const auto errors = mReader.takeErrors(); + ASSERT_EQ(1, errors.size()); + EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode); + } + + mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, std::nanf("")); + execute(); + { + const auto errors = mReader.takeErrors(); + ASSERT_EQ(1, errors.size()); + EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode); + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints) { + Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = false}); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints_Delayed) { + Test_setActiveConfigWithConstraints({.delayForChange = 300'000'000, // 300ms + .refreshMiss = false}); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints_MissRefresh) { + Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = true}); +} + +TEST_P(GraphicsComposerAidlCommandTest, GetDisplayVsyncPeriod) { + for (VtsDisplay& display : mDisplays) { + const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId()); + EXPECT_TRUE(status.isOk()); + + for (int32_t config : configs) { + int32_t expectedVsyncPeriodNanos = display.getDisplayConfig(config).vsyncPeriod; + + VsyncPeriodChangeConstraints constraints; + + constraints.desiredTimeNanos = systemTime(); + constraints.seamlessRequired = false; + + const auto& [timelineStatus, timeline] = + mComposerClient->setActiveConfigWithConstraints(&display, config, constraints); + EXPECT_TRUE(timelineStatus.isOk()); + + if (timeline.refreshRequired) { + sendRefreshFrame(display, &timeline); + } + waitForVsyncPeriodChange(display.getDisplayId(), timeline, constraints.desiredTimeNanos, + /*odPeriodNanos*/ 0, expectedVsyncPeriodNanos); + + int32_t vsyncPeriodNanos; + int retryCount = 100; + do { + std::this_thread::sleep_for(10ms); + const auto& [vsyncPeriodNanosStatus, vsyncPeriodNanosValue] = + mComposerClient->getDisplayVsyncPeriod(display.getDisplayId()); + + EXPECT_TRUE(vsyncPeriodNanosStatus.isOk()); + vsyncPeriodNanos = vsyncPeriodNanosValue; + --retryCount; + } while (vsyncPeriodNanos != expectedVsyncPeriodNanos && retryCount > 0); + + EXPECT_EQ(vsyncPeriodNanos, expectedVsyncPeriodNanos); + + // Make sure that the vsync period stays the same if the active config is not + // changed. + auto timeout = 1ms; + for (int i = 0; i < 10; i++) { + std::this_thread::sleep_for(timeout); + timeout *= 2; + vsyncPeriodNanos = 0; + const auto& [vsyncPeriodNanosStatus, vsyncPeriodNanosValue] = + mComposerClient->getDisplayVsyncPeriod(display.getDisplayId()); + + EXPECT_TRUE(vsyncPeriodNanosStatus.isOk()); + vsyncPeriodNanos = vsyncPeriodNanosValue; + EXPECT_EQ(vsyncPeriodNanos, expectedVsyncPeriodNanos); + } + } + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetActiveConfigWithConstraints_SeamlessNotAllowed) { + VsyncPeriodChangeConstraints constraints; + constraints.seamlessRequired = true; + constraints.desiredTimeNanos = systemTime(); + + for (VtsDisplay& display : mDisplays) { + forEachTwoConfigs(display.getDisplayId(), [&](int32_t config1, int32_t config2) { + int32_t configGroup1 = display.getDisplayConfig(config1).configGroup; + int32_t configGroup2 = display.getDisplayConfig(config2).configGroup; + if (configGroup1 != configGroup2) { + EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk()); + sendRefreshFrame(display, nullptr); + const auto& [status, _] = mComposerClient->setActiveConfigWithConstraints( + &display, config2, constraints); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError( + status, IComposerClient::EX_SEAMLESS_NOT_ALLOWED)); + } + }); + } +} + +TEST_P(GraphicsComposerAidlCommandTest, ExpectedPresentTime_NoTimestamp) { + ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(/*framesDelay*/ std::nullopt)); +} + +TEST_P(GraphicsComposerAidlCommandTest, ExpectedPresentTime_0) { + ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(/*framesDelay*/ 0)); +} + +TEST_P(GraphicsComposerAidlCommandTest, ExpectedPresentTime_5) { + ASSERT_NO_FATAL_FAILURE(Test_expectedPresentTime(/*framesDelay*/ 5)); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Unsupported) { + const bool hasDisplayIdleTimerSupport = + hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER); + if (!hasDisplayIdleTimerSupport) { + const auto& status = + mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 0); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_BadParameter) { + const bool hasDisplayIdleTimerSupport = + hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER); + if (!hasDisplayIdleTimerSupport) { + GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported"; + return; + } + + const auto& status = + mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ -1); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE(assertServiceSpecificError(status, IComposerClient::EX_BAD_PARAMETER)); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Disable) { + const bool hasDisplayIdleTimerSupport = + hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER); + if (!hasDisplayIdleTimerSupport) { + GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported"; + return; + } + + EXPECT_TRUE(mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 0).isOk()); + std::this_thread::sleep_for(1s); + EXPECT_EQ(0, mComposerClient->getVsyncIdleCount()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) { + const bool hasDisplayIdleTimerSupport = + hasDisplayCapability(getPrimaryDisplayId(), DisplayCapability::DISPLAY_IDLE_TIMER); + if (!hasDisplayIdleTimerSupport) { + GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported"; + return; + } + + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk()); + EXPECT_TRUE(mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 0).isOk()); + + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer->handle); + + const auto layer = createOnScreenLayer(); + mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); + int32_t vsyncIdleCount = mComposerClient->getVsyncIdleCount(); + auto earlyVsyncIdleTime = systemTime() + std::chrono::nanoseconds(2s).count(); + EXPECT_TRUE( + mComposerClient->setIdleTimerEnabled(getPrimaryDisplayId(), /*timeout*/ 2000).isOk()); + + const sp<::android::Fence> presentFence = + presentAndGetFence(ComposerClientWriter::kNoTimestamp); + presentFence->waitForever(LOG_TAG); + + std::this_thread::sleep_for(3s); + if (vsyncIdleCount < mComposerClient->getVsyncIdleCount()) { + EXPECT_GE(mComposerClient->getVsyncIdleTime(), earlyVsyncIdleTime); + } + + EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsComposerAidlCommandTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, GraphicsComposerAidlTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)), + ::android::PrintInstanceNameToString); +} // namespace +} // namespace aidl::android::hardware::graphics::composer3::vts + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + + using namespace std::chrono_literals; + if (!android::base::WaitForProperty("init.svc.surfaceflinger", "stopped", 10s)) { + ALOGE("Failed to stop init.svc.surfaceflinger"); + return -1; + } + + android::ProcessState::self()->setThreadPoolMaxThreadCount(4); + + // The binder threadpool we start will inherit sched policy and priority + // of (this) creating thread. We want the binder thread pool to have + // SCHED_FIFO policy and priority 1 (lowest RT priority) + // Once the pool is created we reset this thread's priority back to + // original. + // This thread policy is based on what we do in the SurfaceFlinger while starting + // the thread pool and we need to replicate that for the VTS tests. + int newPriority = 0; + int origPolicy = sched_getscheduler(0); + struct sched_param origSchedParam; + + int errorInPriorityModification = sched_getparam(0, &origSchedParam); + if (errorInPriorityModification == 0) { + int policy = SCHED_FIFO; + newPriority = sched_get_priority_min(policy); + + struct sched_param param; + param.sched_priority = newPriority; + + errorInPriorityModification = sched_setscheduler(0, policy, ¶m); + } + + // start the thread pool + android::ProcessState::self()->startThreadPool(); + + // Reset current thread's policy and priority + if (errorInPriorityModification == 0) { + errorInPriorityModification = sched_setscheduler(0, origPolicy, &origSchedParam); + } else { + ALOGE("Failed to set VtsHalGraphicsComposer3_TargetTest binder threadpool priority to " + "SCHED_FIFO"); + } + + return RUN_ALL_TESTS(); +} diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp index 63fdfa6cc53ae0dea7746b196ea6ce0e8c40c7d1..6c3ef543fbc4a7a6e88d78343ce432ce061a939b 100644 --- a/graphics/mapper/2.0/Android.bp +++ b/graphics/mapper/2.0/Android.bp @@ -25,4 +25,9 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/mapper/2.1/Android.bp b/graphics/mapper/2.1/Android.bp index 4011650d85e0b021d76c4b2287faf91f11f9ba08..cc74156cbe34c695c32a7546dcffa4f149cc4fde 100644 --- a/graphics/mapper/2.1/Android.bp +++ b/graphics/mapper/2.1/Android.bp @@ -26,4 +26,9 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/mapper/3.0/Android.bp b/graphics/mapper/3.0/Android.bp index 401a3a22b5a5747f271494a86ffc230690d1427b..88992a39231e7ddfefca9c97e4a1fbd60da3fd8d 100644 --- a/graphics/mapper/3.0/Android.bp +++ b/graphics/mapper/3.0/Android.bp @@ -27,4 +27,9 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp index de886a9c705084bd145669e61a9f8e34087b5191..c470a4aca09525b24f8661bb5bfeb0da9ca2395a 100644 --- a/graphics/mapper/3.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp @@ -14,7 +14,9 @@ * limitations under the License. */ +#include #include +#include "gtest/gtest.h" namespace android { namespace hardware { @@ -94,23 +96,31 @@ std::vector Gralloc::allocate(const BufferDescriptor& de std::vector bufferHandles; bufferHandles.reserve(count); mAllocator->allocate( - descriptor, count, - [&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) { - ASSERT_EQ(Error::NONE, tmpError) << "failed to allocate buffers"; - ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array"; - - for (uint32_t i = 0; i < count; i++) { - if (import) { - ASSERT_NO_FATAL_FAILURE(bufferHandles.push_back(importBuffer(tmpBuffers[i]))); - } else { - ASSERT_NO_FATAL_FAILURE(bufferHandles.push_back(cloneBuffer(tmpBuffers[i]))); + descriptor, count, + [&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) { + if (tmpError != Error::NONE) { + if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) { + GTEST_SKIP() << "Old vendor grallocs may not support P010"; + } else { + GTEST_FAIL() << "failed to allocate buffers"; + } + } + ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array"; + + for (uint32_t i = 0; i < count; i++) { + if (import) { + ASSERT_NO_FATAL_FAILURE( + bufferHandles.push_back(importBuffer(tmpBuffers[i]))); + } else { + ASSERT_NO_FATAL_FAILURE( + bufferHandles.push_back(cloneBuffer(tmpBuffers[i]))); + } } - } - if (outStride) { - *outStride = tmpStride; - } - }); + if (outStride) { + *outStride = tmpStride; + } + }); if (::testing::Test::HasFatalFailure()) { bufferHandles.clear(); @@ -127,7 +137,7 @@ const native_handle_t* Gralloc::allocate(const IMapper::BufferDescriptorInfo& de } auto buffers = allocate(descriptor, 1, import, outStride); - if (::testing::Test::HasFatalFailure()) { + if (::testing::Test::HasFatalFailure() || ::testing::Test::IsSkipped()) { return nullptr; } diff --git a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp index 4187dd1354ca5f450f6527e885286c9da37dc743..3b1bfab8671a65c4397a3a1441b497e3d6fbab17 100644 --- a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp +++ b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp @@ -326,6 +326,43 @@ TEST_P(GraphicsMapperHidlTest, LockUnlockBasic) { } } +/** + * Test IMapper::lockYCbCr. This locks a YCbCr_P010 buffer and verifies that it's initialized. + */ +TEST_P(GraphicsMapperHidlTest, LockYCbCrP010) { + auto info = mDummyDescriptorInfo; + info.format = PixelFormat::YCBCR_P010; + + const native_handle_t* bufferHandle; + uint32_t stride; + ASSERT_NO_FATAL_FAILURE(bufferHandle = mGralloc->allocate(info, true, &stride)); + + if (::testing::Test::IsSkipped()) { + GTEST_SKIP(); + } + + ASSERT_NE(nullptr, bufferHandle); + + const IMapper::Rect region{0, 0, static_cast(info.width), + static_cast(info.height)}; + int fence = -1; + YCbCrLayout y_cb_cr_layout{}; + // lock buffer + ASSERT_NO_FATAL_FAILURE(y_cb_cr_layout = + mGralloc->lockYCbCr(bufferHandle, info.usage, region, fence)); + + ASSERT_NE(nullptr, &y_cb_cr_layout); + EXPECT_EQ(stride, info.width); + EXPECT_EQ(y_cb_cr_layout.yStride, info.height * 2); + EXPECT_EQ(y_cb_cr_layout.cStride, y_cb_cr_layout.yStride); + EXPECT_EQ(4, y_cb_cr_layout.chromaStep); + + ASSERT_NO_FATAL_FAILURE(fence = mGralloc->unlock(bufferHandle)); + if (fence >= 0) { + close(fence); + } +} + /** * Test IMapper::lockYCbCr. This locks a YV12 buffer, and makes sure we can * write to and read from it. diff --git a/graphics/mapper/4.0/Android.bp b/graphics/mapper/4.0/Android.bp index 4084dcda9136ab55231ef298370ab7e1dde497a5..0cffce4508e61e3feecff0e5edd91785b4813069 100644 --- a/graphics/mapper/4.0/Android.bp +++ b/graphics/mapper/4.0/Android.bp @@ -27,4 +27,9 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/graphics/mapper/4.0/utils/vts/Android.bp b/graphics/mapper/4.0/utils/vts/Android.bp index 633149805c1541a4795589b457c02732f05a2505..7abf5dba242171ff34f78e32934ff403704cd427 100644 --- a/graphics/mapper/4.0/utils/vts/Android.bp +++ b/graphics/mapper/4.0/utils/vts/Android.bp @@ -32,14 +32,21 @@ cc_library_static { "-g", ], static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", + "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.mapper@4.0", + "libaidlcommonsupport", ], shared_libs: [ + "libbinder_ndk", "libgralloctypes", + "libvndksupport", ], export_static_lib_headers: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", + "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.mapper@4.0", ], export_include_dirs: ["include"], diff --git a/graphics/mapper/4.0/utils/vts/MapperVts.cpp b/graphics/mapper/4.0/utils/vts/MapperVts.cpp index 5b2a94e65d169b802236829bff05364976c5ad08..c6c9834eaf754fbb9ac94438bb52de9f64939857 100644 --- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ +#include +#include +#include #include #include @@ -24,27 +27,42 @@ namespace mapper { namespace V4_0 { namespace vts { -Gralloc::Gralloc(const std::string& allocatorServiceName, const std::string& mapperServiceName, +Gralloc::Gralloc(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, const std::string& mapperServiceName, bool errOnFailure) { if (errOnFailure) { - init(allocatorServiceName, mapperServiceName); + init(aidlAllocatorServiceName, hidlAllocatorServiceName, mapperServiceName); } else { - initNoErr(allocatorServiceName, mapperServiceName); + initNoErr(aidlAllocatorServiceName, hidlAllocatorServiceName, mapperServiceName); } } -void Gralloc::init(const std::string& allocatorServiceName, const std::string& mapperServiceName) { - mAllocator = IAllocator::getService(allocatorServiceName); - ASSERT_NE(nullptr, mAllocator.get()) << "failed to get allocator service"; +void Gralloc::init(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, + const std::string& mapperServiceName) { + mAidlAllocator = aidl::android::hardware::graphics::allocator::IAllocator::fromBinder( + ndk::SpAIBinder(AServiceManager_checkService(aidlAllocatorServiceName.c_str()))); + + if (mAidlAllocator == nullptr) { + mHidlAllocator = IAllocator::getService(hidlAllocatorServiceName); + } + ASSERT_TRUE(nullptr != mAidlAllocator || mHidlAllocator != nullptr) + << "failed to get allocator service"; mMapper = IMapper::getService(mapperServiceName); ASSERT_NE(nullptr, mMapper.get()) << "failed to get mapper service"; ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode"; } -void Gralloc::initNoErr(const std::string& allocatorServiceName, +void Gralloc::initNoErr(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, const std::string& mapperServiceName) { - mAllocator = IAllocator::getService(allocatorServiceName); + mAidlAllocator = aidl::android::hardware::graphics::allocator::IAllocator::fromBinder( + ndk::SpAIBinder(AServiceManager_checkService(aidlAllocatorServiceName.c_str()))); + + if (mAidlAllocator == nullptr) { + mHidlAllocator = IAllocator::getService(hidlAllocatorServiceName); + } mMapper = IMapper::getService(mapperServiceName); if (mMapper.get()) { @@ -67,10 +85,6 @@ Gralloc::~Gralloc() { mImportedBuffers.clear(); } -sp Gralloc::getAllocator() const { - return mAllocator; -} - const native_handle_t* Gralloc::cloneBuffer(const hidl_handle& rawHandle, enum Tolerance /*tolerance*/) { const native_handle_t* bufferHandle = native_handle_clone(rawHandle.getNativeHandle()); @@ -89,33 +103,40 @@ std::vector Gralloc::allocate(const BufferDescriptor& de uint32_t* outStride) { std::vector bufferHandles; bufferHandles.reserve(count); - mAllocator->allocate(descriptor, count, - [&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) { - if (canTolerate(tolerance, tmpError)) { - return; - } - - ASSERT_EQ(Error::NONE, tmpError) << "failed to allocate buffers"; - ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array"; - - for (uint32_t i = 0; i < count; i++) { - const native_handle_t* bufferHandle = nullptr; - if (import) { - ASSERT_NO_FATAL_FAILURE( - bufferHandle = importBuffer(tmpBuffers[i], tolerance)); - } else { - ASSERT_NO_FATAL_FAILURE( - bufferHandle = cloneBuffer(tmpBuffers[i], tolerance)); - } - if (bufferHandle) { - bufferHandles.push_back(bufferHandle); - } - } - - if (outStride) { - *outStride = tmpStride; - } - }); + + auto callback = [&](Error error, uint32_t stride, + const hidl_vec& buffers) -> void { + if (canTolerate(tolerance, error)) { + return; + } + + if (error != Error::NONE) { + if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) { + GTEST_SKIP() << "Old vendor grallocs may not support P010"; + } else { + GTEST_FAIL() << "failed to allocate buffers"; + } + } + ASSERT_EQ(count, buffers.size()) << "invalid buffer array"; + + for (uint32_t i = 0; i < count; i++) { + const native_handle_t* bufferHandle = nullptr; + if (import) { + ASSERT_NO_FATAL_FAILURE(bufferHandle = importBuffer(buffers[i], tolerance)); + } else { + ASSERT_NO_FATAL_FAILURE(bufferHandle = cloneBuffer(buffers[i], tolerance)); + } + if (bufferHandle) { + bufferHandles.push_back(bufferHandle); + } + } + + if (outStride) { + *outStride = stride; + } + }; + + rawAllocate(descriptor, count, callback); if (::testing::Test::HasFatalFailure()) { bufferHandles.clear(); @@ -133,14 +154,27 @@ const native_handle_t* Gralloc::allocate(const IMapper::BufferDescriptorInfo& de } auto buffers = allocate(descriptor, 1, import, tolerance, outStride); - if (::testing::Test::HasFatalFailure()) { + if (::testing::Test::HasFatalFailure() || ::testing::Test::IsSkipped() || buffers.size() != 1) { return nullptr; } + return buffers[0]; +} - if (buffers.size() != 1) { - return nullptr; +void Gralloc::rawAllocate( + const BufferDescriptor& descriptor, uint32_t count, + std::function&)> callback) { + if (mAidlAllocator) { + aidl::android::hardware::graphics::allocator::AllocationResult result; + auto status = mAidlAllocator->allocate(descriptor, count, &result); + const Error error = toHidlError(status); + std::vector handles; + for (const auto& aidlHandle : result.buffers) { + handles.push_back(hidl_handle(makeFromAidl(aidlHandle))); + } + callback(error, result.stride, handles); + } else { + mHidlAllocator->allocate(descriptor, count, callback); } - return buffers[0]; } sp Gralloc::getMapper() const { @@ -303,6 +337,14 @@ bool Gralloc::isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo) { return supported; } +bool Gralloc::isSupportedNoFailure(const IMapper::BufferDescriptorInfo& descriptorInfo) { + bool supported = false; + mMapper->isSupported(descriptorInfo, [&](const auto& tmpError, const auto& tmpSupported) { + supported = tmpSupported && tmpError == Error::NONE; + }); + return supported; +} + Error Gralloc::get(const native_handle_t* bufferHandle, const IMapper::MetadataType& metadataType, hidl_vec* outVec) { Error err; diff --git a/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h b/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h index 22a935f26004e806f05cb4862be6a79327083e13..ecbbc58c42344900ac073d0f08b68d2b1dd5f44e 100644 --- a/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h +++ b/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include @@ -47,13 +49,39 @@ class Gralloc { kToleranceAllErrors = ~0x0U, }; - Gralloc(const std::string& allocatorServiceName = "default", + Gralloc(const std::string& aidlAllocatorServiceName = + "android.hardware.graphics.allocator.IAllocator/default", + const std::string& hidlAllocatorServiceName = "default", const std::string& mapperServiceName = "default", bool errOnFailure = true); ~Gralloc(); + static Error toHidlError(aidl::android::hardware::graphics::allocator::AllocationError error) { + switch (error) { + case aidl::android::hardware::graphics::allocator::AllocationError::BAD_DESCRIPTOR: + return Error::BAD_DESCRIPTOR; + case aidl::android::hardware::graphics::allocator::AllocationError::NO_RESOURCES: + return Error::NO_RESOURCES; + case aidl::android::hardware::graphics::allocator::AllocationError::UNSUPPORTED: + return Error::UNSUPPORTED; + } + } + static Error toHidlError(const ndk::ScopedAStatus& status) { + if (status.isOk()) { + return Error::NONE; + } + + if (status.getExceptionCode() != EX_SERVICE_SPECIFIC) { + return Error::NO_RESOURCES; + } + + return toHidlError( + static_cast( + status.getServiceSpecificError())); + } + // IAllocator methods - sp getAllocator() const; + bool hasAllocator() { return mHidlAllocator != nullptr || mAidlAllocator != nullptr; } // When import is false, this simply calls IAllocator::allocate. When import // is true, the returned buffers are also imported into the mapper. @@ -81,6 +109,10 @@ class Gralloc { return allocate(descriptorInfo, import, Tolerance::kToleranceStrict, outStride); } + // Dispatches directly to the allocator + void rawAllocate(const BufferDescriptor& descriptor, uint32_t count, + std::function&)> callback); + // IMapper methods sp getMapper() const; @@ -111,6 +143,10 @@ class Gralloc { bool isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo); + // A version of isSupported that simply treats failure as no support, so it + // does not fail the test. + bool isSupportedNoFailure(const IMapper::BufferDescriptorInfo& descriptorInfo); + Error get(const native_handle_t* bufferHandle, const IMapper::MetadataType& metadataType, hidl_vec* outVec); @@ -130,16 +166,20 @@ class Gralloc { 0x1U << std::underlying_type_t(error)) != 0; } - void init(const std::string& allocatorServiceName, const std::string& mapperServiceName); + void init(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, const std::string& mapperServiceName); // initialize without checking for failure to get service - void initNoErr(const std::string& allocatorServiceName, const std::string& mapperServiceName); + void initNoErr(const std::string& aidlAllocatorServiceName, + const std::string& hidlAllocatorServiceName, + const std::string& mapperServiceName); const native_handle_t* cloneBuffer(const hidl_handle& rawHandle, enum Tolerance tolerance); const native_handle_t* cloneBuffer(const hidl_handle& rawHandle) { return cloneBuffer(rawHandle, Tolerance::kToleranceStrict); } - sp mAllocator; + sp mHidlAllocator; + std::shared_ptr mAidlAllocator; sp mMapper; // Keep track of all cloned and imported handles. When a test fails with diff --git a/graphics/mapper/4.0/vts/functional/Android.bp b/graphics/mapper/4.0/vts/functional/Android.bp index 032bc0f741603f5f286c7af1e994bbfd162261b4..e83063367dcc4049b8621d1c4600c7d866847c72 100644 --- a/graphics/mapper/4.0/vts/functional/Android.bp +++ b/graphics/mapper/4.0/vts/functional/Android.bp @@ -25,20 +25,27 @@ package { cc_test { name: "VtsHalGraphicsMapperV4_0TargetTest", - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], srcs: ["VtsHalGraphicsMapperV4_0TargetTest.cpp"], static_libs: [ - "android.hardware.graphics.common-V2-ndk", + "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.mapper@4.0-vts", + "libaidlcommonsupport", "libgralloctypes", "libsync", ], shared_libs: [ + "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.common@1.0", "android.hardware.graphics.common@1.1", "android.hardware.graphics.common@1.2", "android.hardware.graphics.mapper@4.0", + "libbinder_ndk", + "libvndksupport", ], header_libs: [ "libsystem_headers", diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 61277ee0bb8a6d3e43d718227e20f29fba72861a..5a450e385abbed911c9fbb0d03d348cddd1f17cc 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -21,7 +21,12 @@ #include #include +#include +#include +#include +#include #include +#include #include #include @@ -59,13 +64,19 @@ using aidl::android::hardware::graphics::common::StandardMetadataType; using DecodeFunction = std::function& vec)>; +struct YCbCr { + android_ycbcr yCbCr; + int64_t horizontalSubSampling; + int64_t verticalSubSampling; +}; + class GraphicsMapperHidlTest : public ::testing::TestWithParam> { protected: void SetUp() override { ASSERT_NO_FATAL_FAILURE(mGralloc = std::make_unique(std::get<0>(GetParam()), std::get<1>(GetParam()))); - ASSERT_NE(nullptr, mGralloc->getAllocator().get()); + ASSERT_TRUE(mGralloc->hasAllocator()); ASSERT_NE(nullptr, mGralloc->getMapper().get()); mDummyDescriptorInfo.name = "dummy"; @@ -86,7 +97,13 @@ class GraphicsMapperHidlTest ASSERT_NO_FATAL_FAILURE(bufferHandle = mGralloc->allocate(descriptorInfo, true)); hidl_vec vec; - ASSERT_EQ(Error::NONE, mGralloc->get(bufferHandle, metadataType, &vec)); + const auto result = mGralloc->get(bufferHandle, metadataType, &vec); + + if (metadataType == gralloc4::MetadataType_Smpte2094_10 && result == Error::UNSUPPORTED) { + GTEST_SKIP() << "getting metadata for Smpte2094-10 is unsupported"; + } + + ASSERT_EQ(Error::NONE, result); ASSERT_NO_FATAL_FAILURE(decode(descriptorInfo, vec)); } @@ -215,8 +232,8 @@ class GraphicsMapperHidlTest } ASSERT_EQ(0, planeLayoutComponent.offsetInBits % 8); - uint8_t* tmpData = - data + planeLayout.offsetInBytes + (planeLayoutComponent.offsetInBits / 8); + uint8_t* tmpData = data + planeLayout.offsetInBytes + + bitsToBytes(planeLayoutComponent.offsetInBits); uint64_t sampleIncrementInBytes; auto type = static_cast(planeLayoutComponent.type.value); @@ -271,6 +288,96 @@ class GraphicsMapperHidlTest ASSERT_NE(nullptr, outYCbCr->cr); } + YCbCr getAndroidYCbCr_P010(const native_handle_t* bufferHandle, uint8_t* data) { + YCbCr yCbCr_P010; + hidl_vec vec; + EXPECT_EQ(Error::NONE, + mGralloc->get(bufferHandle, gralloc4::MetadataType_PlaneLayouts, &vec)); + std::vector planeLayouts; + EXPECT_EQ(NO_ERROR, gralloc4::decodePlaneLayouts(vec, &planeLayouts)); + EXPECT_EQ(2, planeLayouts.size()); + EXPECT_EQ(1, planeLayouts[0].components.size()); + EXPECT_EQ(2, planeLayouts[1].components.size()); + + yCbCr_P010.yCbCr.y = nullptr; + yCbCr_P010.yCbCr.cb = nullptr; + yCbCr_P010.yCbCr.cr = nullptr; + yCbCr_P010.yCbCr.ystride = 0; + yCbCr_P010.yCbCr.cstride = 0; + yCbCr_P010.yCbCr.chroma_step = 0; + int64_t cb_offset = 0; + int64_t cr_offset = 0; + + for (const auto& planeLayout : planeLayouts) { + for (const auto& planeLayoutComponent : planeLayout.components) { + if (!gralloc4::isStandardPlaneLayoutComponentType(planeLayoutComponent.type)) { + continue; + } + + uint8_t* tmpData = data + planeLayout.offsetInBytes + + bitsToBytes(planeLayoutComponent.offsetInBits); + uint64_t sampleIncrementInBytes = 0; + auto type = static_cast(planeLayoutComponent.type.value); + switch (type) { + case PlaneLayoutComponentType::Y: + // For specs refer: + // https://docs.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats + EXPECT_EQ(6, planeLayoutComponent.offsetInBits); + EXPECT_EQ(nullptr, yCbCr_P010.yCbCr.y); + EXPECT_EQ(10, planeLayoutComponent.sizeInBits); + EXPECT_EQ(16, planeLayout.sampleIncrementInBits); + + yCbCr_P010.yCbCr.y = tmpData; + yCbCr_P010.yCbCr.ystride = planeLayout.strideInBytes; + break; + + case PlaneLayoutComponentType::CB: + case PlaneLayoutComponentType::CR: + sampleIncrementInBytes = bitsToBytes(planeLayout.sampleIncrementInBits); + EXPECT_EQ(4, sampleIncrementInBytes); + + if (yCbCr_P010.yCbCr.cstride == 0 && yCbCr_P010.yCbCr.chroma_step == 0) { + yCbCr_P010.yCbCr.cstride = planeLayout.strideInBytes; + yCbCr_P010.yCbCr.chroma_step = sampleIncrementInBytes; + } else { + EXPECT_EQ(yCbCr_P010.yCbCr.cstride, planeLayout.strideInBytes); + EXPECT_EQ(yCbCr_P010.yCbCr.chroma_step, sampleIncrementInBytes); + } + + if (yCbCr_P010.horizontalSubSampling == 0 && + yCbCr_P010.verticalSubSampling == 0) { + yCbCr_P010.horizontalSubSampling = planeLayout.horizontalSubsampling; + yCbCr_P010.verticalSubSampling = planeLayout.verticalSubsampling; + } else { + EXPECT_EQ(yCbCr_P010.horizontalSubSampling, + planeLayout.horizontalSubsampling); + EXPECT_EQ(yCbCr_P010.verticalSubSampling, + planeLayout.verticalSubsampling); + } + + if (type == PlaneLayoutComponentType::CB) { + EXPECT_EQ(nullptr, yCbCr_P010.yCbCr.cb); + yCbCr_P010.yCbCr.cb = tmpData; + cb_offset = planeLayoutComponent.offsetInBits; + } else { + EXPECT_EQ(nullptr, yCbCr_P010.yCbCr.cr); + yCbCr_P010.yCbCr.cr = tmpData; + cr_offset = planeLayoutComponent.offsetInBits; + } + break; + default: + break; + }; + } + } + + EXPECT_EQ(cb_offset + bytesToBits(2), cr_offset); + EXPECT_NE(nullptr, yCbCr_P010.yCbCr.y); + EXPECT_NE(nullptr, yCbCr_P010.yCbCr.cb); + EXPECT_NE(nullptr, yCbCr_P010.yCbCr.cr); + return yCbCr_P010; + } + void fillRGBA8888(uint8_t* data, uint32_t height, size_t strideInBytes, size_t widthInBytes, uint32_t seed = 0) { for (uint32_t y = 0; y < height; y++) { @@ -297,9 +404,9 @@ class GraphicsMapperHidlTest } } - void traverseYCbCr888Data(const android_ycbcr& yCbCr, int32_t width, int32_t height, - int64_t hSubsampling, int64_t vSubsampling, - std::function traverseFuncion) { + void traverseYCbCrData(const android_ycbcr& yCbCr, int32_t width, int32_t height, + int64_t hSubsampling, int64_t vSubsampling, + std::function traverseFuncion) { auto yData = static_cast(yCbCr.y); auto cbData = static_cast(yCbCr.cb); auto crData = static_cast(yCbCr.cr); @@ -327,21 +434,25 @@ class GraphicsMapperHidlTest } } - void fillYCbCr888Data(const android_ycbcr& yCbCr, int32_t width, int32_t height, - int64_t hSubsampling, int64_t vSubsampling) { - traverseYCbCr888Data(yCbCr, width, height, hSubsampling, vSubsampling, - [](auto address, auto fillingData) { *address = fillingData; }); + void fillYCbCrData(const android_ycbcr& yCbCr, int32_t width, int32_t height, + int64_t hSubsampling, int64_t vSubsampling) { + traverseYCbCrData(yCbCr, width, height, hSubsampling, vSubsampling, + [](auto address, auto fillingData) { *address = fillingData; }); } - void verifyYCbCr888Data(const android_ycbcr& yCbCr, int32_t width, int32_t height, - int64_t hSubsampling, int64_t vSubsampling) { - traverseYCbCr888Data( + void verifyYCbCrData(const android_ycbcr& yCbCr, int32_t width, int32_t height, + int64_t hSubsampling, int64_t vSubsampling) { + traverseYCbCrData( yCbCr, width, height, hSubsampling, vSubsampling, [](auto address, auto expectedData) { EXPECT_EQ(*address, expectedData); }); } bool isEqual(float a, float b) { return abs(a - b) < 0.0001; } + uint64_t bitsToBytes(int64_t bits) { return bits / 8; } + + uint64_t bytesToBits(int64_t bytes) { return bytes * 8; } + std::unique_ptr mGralloc; IMapper::BufferDescriptorInfo mDummyDescriptorInfo{}; static const std::set sRequiredMetadataTypes; @@ -397,10 +508,10 @@ TEST_P(GraphicsMapperHidlTest, AllocatorAllocate) { TEST_P(GraphicsMapperHidlTest, AllocatorAllocateNegative) { // this assumes any valid descriptor is non-empty BufferDescriptor descriptor; - mGralloc->getAllocator()->allocate(descriptor, 1, - [&](const auto& tmpError, const auto&, const auto&) { - EXPECT_EQ(Error::BAD_DESCRIPTOR, tmpError); - }); + + mGralloc->rawAllocate(descriptor, 1, [&](const auto& tmpError, const auto&, const auto&) { + EXPECT_EQ(Error::BAD_DESCRIPTOR, tmpError); + }); } /** @@ -428,9 +539,9 @@ TEST_P(GraphicsMapperHidlTest, AllocatorAllocateThreaded) { std::atomic allocationCount(0); auto threadLoop = [&]() { while (!timeUp) { - mGralloc->getAllocator()->allocate( - descriptor, 1, - [&](const auto&, const auto&, const auto&) { allocationCount++; }); + mGralloc->rawAllocate(descriptor, 1, [&](const auto&, const auto&, const auto&) { + allocationCount++; + }); } }; @@ -645,7 +756,7 @@ TEST_P(GraphicsMapperHidlTest, Lock_YCRCB_420_SP) { ASSERT_EQ(crData + 1, cbData); ASSERT_EQ(2, yCbCr.chroma_step); - fillYCbCr888Data(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + fillYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); @@ -656,7 +767,7 @@ TEST_P(GraphicsMapperHidlTest, Lock_YCRCB_420_SP) { ASSERT_NO_FATAL_FAILURE( getAndroidYCbCr(bufferHandle, data, &yCbCr, &hSubsampling, &vSubsampling)); - verifyYCbCr888Data(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + verifyYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } @@ -744,7 +855,7 @@ TEST_P(GraphicsMapperHidlTest, Lock_YV12) { ASSERT_EQ(crData + yCbCr.cstride * info.height / vSubsampling, cbData); ASSERT_EQ(1, yCbCr.chroma_step); - fillYCbCr888Data(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + fillYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); @@ -755,7 +866,7 @@ TEST_P(GraphicsMapperHidlTest, Lock_YV12) { ASSERT_NO_FATAL_FAILURE( getAndroidYCbCr(bufferHandle, data, &yCbCr, &hSubsampling, &vSubsampling)); - verifyYCbCr888Data(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + verifyYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } @@ -788,7 +899,7 @@ TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_420_888) { ASSERT_EQ(kCbCrSubSampleFactor, hSubsampling); ASSERT_EQ(kCbCrSubSampleFactor, vSubsampling); - fillYCbCr888Data(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + fillYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); @@ -799,7 +910,7 @@ TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_420_888) { ASSERT_NO_FATAL_FAILURE( getAndroidYCbCr(bufferHandle, data, &yCbCr, &hSubsampling, &vSubsampling)); - verifyYCbCr888Data(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + verifyYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } @@ -888,6 +999,45 @@ TEST_P(GraphicsMapperHidlTest, Lock_RAW12) { ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } +TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_P010) { + auto info = mDummyDescriptorInfo; + info.format = PixelFormat::YCBCR_P010; + + uint32_t stride; + const native_handle_t* bufferHandle = + mGralloc->allocate(info, true, Tolerance::kToleranceStrict, &stride); + + if (::testing::Test::IsSkipped()) { + GTEST_SKIP(); + } + + const IMapper::Rect region{0, 0, static_cast(info.width), + static_cast(info.height)}; + unique_fd fence; + uint8_t* data; + + ASSERT_NO_FATAL_FAILURE(data = static_cast(mGralloc->lock(bufferHandle, info.usage, + region, fence.release()))); + + YCbCr yCbCr; + ASSERT_NO_FATAL_FAILURE(yCbCr = getAndroidYCbCr_P010(bufferHandle, data)); + + constexpr uint32_t kCbCrSubSampleFactor = 2; + ASSERT_EQ(kCbCrSubSampleFactor, yCbCr.horizontalSubSampling); + ASSERT_EQ(kCbCrSubSampleFactor, yCbCr.verticalSubSampling); + + ASSERT_EQ(0, info.height % 2); + + // fill the data + fillYCbCrData(yCbCr.yCbCr, info.width, info.height, yCbCr.horizontalSubSampling, + yCbCr.verticalSubSampling); + // verify the YCbCr data + verifyYCbCrData(yCbCr.yCbCr, info.width, info.height, yCbCr.horizontalSubSampling, + yCbCr.verticalSubSampling); + + ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); +} + /** * Test IMapper::unlock with bad access region */ @@ -1068,6 +1218,40 @@ TEST_P(GraphicsMapperHidlTest, IsSupportedY16) { ASSERT_NO_FATAL_FAILURE(supported = mGralloc->isSupported(info)); } +/** + * Test IMapper::isSupported with optional format R_8 + */ +TEST_P(GraphicsMapperHidlTest, IsSupportedR8) { + auto info = mDummyDescriptorInfo; + info.format = static_cast( + aidl::android::hardware::graphics::common::PixelFormat::R_8); + bool supported = false; + + supported = mGralloc->isSupportedNoFailure(info); + + if (!supported) { + GTEST_SUCCEED() << "R_8 is optional; unsupported so skipping allocation test"; + return; + } + + BufferDescriptor descriptor; + ASSERT_NO_FATAL_FAILURE(descriptor = mGralloc->createDescriptor(info)); + + constexpr uint32_t count = 1; + std::vector bufferHandles; + uint32_t stride; + ASSERT_NO_FATAL_FAILURE(bufferHandles = + mGralloc->allocate(descriptor, count, false, + Tolerance::kToleranceStrict, &stride)); + + EXPECT_LE(info.width, stride) << "invalid buffer stride"; + EXPECT_EQ(1u, bufferHandles.size()); + + for (auto bufferHandle : bufferHandles) { + mGralloc->freeBuffer(bufferHandle); + } +} + /** * Test IMapper::get(BufferId) */ @@ -1345,6 +1529,18 @@ TEST_P(GraphicsMapperHidlTest, GetSmpte2094_40) { }); } +/** + * Test IMapper::get(Smpte2094_10) + */ +TEST_P(GraphicsMapperHidlTest, GetSmpte2094_10) { + testGet(mDummyDescriptorInfo, gralloc4::MetadataType_Smpte2094_10, + [](const IMapper::BufferDescriptorInfo& /*info*/, const hidl_vec& vec) { + std::optional> smpte2094_10; + ASSERT_EQ(NO_ERROR, gralloc4::decodeSmpte2094_10(vec, &smpte2094_10)); + EXPECT_FALSE(smpte2094_10.has_value()); + }); +} + /** * Test IMapper::get(metadata) with a bad buffer */ @@ -1409,6 +1605,9 @@ TEST_P(GraphicsMapperHidlTest, GetMetadataBadValue) { ASSERT_EQ(Error::BAD_BUFFER, mGralloc->get(bufferHandle, gralloc4::MetadataType_Smpte2094_40, &vec)); ASSERT_EQ(0, vec.size()); + ASSERT_EQ(Error::BAD_BUFFER, + mGralloc->get(bufferHandle, gralloc4::MetadataType_Smpte2094_10, &vec)); + ASSERT_EQ(0, vec.size()); } /** @@ -1800,6 +1999,20 @@ TEST_P(GraphicsMapperHidlTest, SetSmpte2094_40) { }); } +/** + * Test IMapper::set(Smpte2094_10) + */ +TEST_P(GraphicsMapperHidlTest, SetSmpte2094_10) { + hidl_vec vec; + + testSet(mDummyDescriptorInfo, gralloc4::MetadataType_Smpte2094_10, vec, + [&](const IMapper::BufferDescriptorInfo& /*info*/, const hidl_vec& vec) { + std::optional> realSmpte2094_10; + ASSERT_EQ(NO_ERROR, gralloc4::decodeSmpte2094_10(vec, &realSmpte2094_10)); + EXPECT_FALSE(realSmpte2094_10.has_value()); + }); +} + /** * Test IMapper::set(metadata) with a bad buffer */ @@ -1841,6 +2054,8 @@ TEST_P(GraphicsMapperHidlTest, SetMetadataNullBuffer) { ASSERT_EQ(Error::BAD_BUFFER, mGralloc->set(bufferHandle, gralloc4::MetadataType_Cta861_3, vec)); ASSERT_EQ(Error::BAD_BUFFER, mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2094_40, vec)); + ASSERT_EQ(Error::BAD_BUFFER, + mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2094_10, vec)); } /** @@ -2350,6 +2565,24 @@ TEST_P(GraphicsMapperHidlTest, GetFromBufferDescriptorInfoSmpte2094_40) { EXPECT_FALSE(smpte2094_40.has_value()); } +/** + * Test IMapper::getFromBufferDescriptorInfo(Smpte2094_10) + */ +TEST_P(GraphicsMapperHidlTest, GetFromBufferDescriptorInfoSmpte2094_10) { + hidl_vec vec; + auto err = mGralloc->getFromBufferDescriptorInfo(mDummyDescriptorInfo, + gralloc4::MetadataType_Smpte2094_10, &vec); + if (err == Error::UNSUPPORTED) { + GTEST_SUCCEED() << "setting this metadata is unsupported"; + return; + } + ASSERT_EQ(err, Error::NONE); + + std::optional> smpte2094_10; + ASSERT_EQ(NO_ERROR, gralloc4::decodeSmpte2094_10(vec, &smpte2094_10)); + EXPECT_FALSE(smpte2094_10.has_value()); +} + /** * Test IMapper::getFromBufferDescriptorInfo(metadata) for unsupported metadata */ @@ -2526,8 +2759,9 @@ TEST_P(GraphicsMapperHidlTest, GetLargeReservedRegion) { BufferDescriptor descriptor; ASSERT_NO_FATAL_FAILURE(descriptor = mGralloc->createDescriptor(info)); - Error err; - mGralloc->getAllocator()->allocate( + Error err = Error::NONE; + + mGralloc->rawAllocate( descriptor, 1, [&](const auto& tmpError, const auto&, const auto& tmpBuffers) { err = tmpError; if (err == Error::NONE) { @@ -2598,11 +2832,27 @@ TEST_P(GraphicsMapperHidlTest, GetReservedRegionBadBuffer) { } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsMapperHidlTest); + +namespace { +std::vector getAllocatorInstances() { + std::vector instances; + for (auto halInstance : android::hardware::getAllHalInstanceNames(IAllocator::descriptor)) { + instances.emplace_back(std::move(halInstance)); + } + + for (auto aidlInstance : getAidlHalInstanceNames( + aidl::android::hardware::graphics::allocator::IAllocator::descriptor)) { + instances.emplace_back(std::move(aidlInstance)); + } + + return instances; +} +} // namespace + INSTANTIATE_TEST_CASE_P( PerInstance, GraphicsMapperHidlTest, testing::Combine( - testing::ValuesIn( - android::hardware::getAllHalInstanceNames(IAllocator::descriptor)), + testing::ValuesIn(getAllocatorInstances()), testing::ValuesIn(android::hardware::getAllHalInstanceNames(IMapper::descriptor))), android::hardware::PrintInstanceTupleNameToString<>); diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp index 003b106cc24f264c0ae3d956c237d901ef245be6..e793db692a5d6a9d205c76256df2f36e55d8d85b 100644 --- a/health/1.0/Android.bp +++ b/health/1.0/Android.bp @@ -20,4 +20,8 @@ hidl_interface { ], gen_java: true, gen_java_constants: true, + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], } diff --git a/health/2.0/Android.bp b/health/2.0/Android.bp index ddd983dc505e0e145a6ceec40c3328f63849e0c1..fae25b6f231a0ca9332ea84b28c5cf44bb99a457 100644 --- a/health/2.0/Android.bp +++ b/health/2.0/Android.bp @@ -22,4 +22,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], } diff --git a/health/aidl/Android.bp b/health/aidl/Android.bp index 4acf38a5b5a68543e3d5f2be657f215f9257dc63..a4d4acee65184d8c194411b66dca10c13cfb4031 100644 --- a/health/aidl/Android.bp +++ b/health/aidl/Android.bp @@ -37,6 +37,13 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + } cc_library { diff --git a/health/aidl/aidl_api/android.hardware.health/1/.hash b/health/aidl/aidl_api/android.hardware.health/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..92740100b5277ceeaa17410e13c29f4cf71048a8 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/.hash @@ -0,0 +1 @@ +94e77215594f8ad98ab33a769263d48fdabed92e diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryCapacityLevel.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryCapacityLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e5438865c1cda1ed77401aead9128e60b97b33eb --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryCapacityLevel.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.health; +@Backing(type="int") @VintfStability +enum BatteryCapacityLevel { + UNSUPPORTED = -1, + UNKNOWN = 0, + CRITICAL = 1, + LOW = 2, + NORMAL = 3, + HIGH = 4, + FULL = 5, +} diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryHealth.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryHealth.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ce7952af2aa96ce9aee6e7a0ef2003132b0553b --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryHealth.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.health; +@Backing(type="int") @VintfStability +enum BatteryHealth { + UNKNOWN = 1, + GOOD = 2, + OVERHEAT = 3, + DEAD = 4, + OVER_VOLTAGE = 5, + UNSPECIFIED_FAILURE = 6, + COLD = 7, +} diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryStatus.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..340b2ecc3f2401013c442b07068a85e3f9cc9e89 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/BatteryStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.health; +@Backing(type="int") @VintfStability +enum BatteryStatus { + UNKNOWN = 1, + CHARGING = 2, + DISCHARGING = 3, + NOT_CHARGING = 4, + FULL = 5, +} diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/DiskStats.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/DiskStats.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5aa58900bb3544c8853751cef35f9192baf98e23 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/DiskStats.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.health; +@VintfStability +parcelable DiskStats { + long reads; + long readMerges; + long readSectors; + long readTicks; + long writes; + long writeMerges; + long writeSectors; + long writeTicks; + long ioInFlight; + long ioTicks; + long ioInQueue; +} diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/HealthInfo.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/HealthInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..97d9e845db6a7a5849a74d4be44694cfc59c4c50 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/HealthInfo.aidl @@ -0,0 +1,61 @@ +/* + * 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 -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.health; +@VintfStability +parcelable HealthInfo { + boolean chargerAcOnline; + boolean chargerUsbOnline; + boolean chargerWirelessOnline; + boolean chargerDockOnline; + int maxChargingCurrentMicroamps; + int maxChargingVoltageMicrovolts; + android.hardware.health.BatteryStatus batteryStatus; + android.hardware.health.BatteryHealth batteryHealth; + boolean batteryPresent; + int batteryLevel; + int batteryVoltageMillivolts; + int batteryTemperatureTenthsCelsius; + int batteryCurrentMicroamps; + int batteryCycleCount; + int batteryFullChargeUah; + int batteryChargeCounterUah; + String batteryTechnology; + int batteryCurrentAverageMicroamps; + android.hardware.health.DiskStats[] diskStats; + android.hardware.health.StorageInfo[] storageInfos; + android.hardware.health.BatteryCapacityLevel batteryCapacityLevel; + long batteryChargeTimeToFullNowSeconds; + int batteryFullChargeDesignCapacityUah; + const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1; +} diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/IHealth.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/IHealth.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7016ae4c86f0031d8a92c406e8de57a33607e0b5 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/IHealth.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.health; +@VintfStability +interface IHealth { + void registerCallback(in android.hardware.health.IHealthInfoCallback callback); + void unregisterCallback(in android.hardware.health.IHealthInfoCallback callback); + void update(); + int getChargeCounterUah(); + int getCurrentNowMicroamps(); + int getCurrentAverageMicroamps(); + int getCapacity(); + long getEnergyCounterNwh(); + android.hardware.health.BatteryStatus getChargeStatus(); + android.hardware.health.StorageInfo[] getStorageInfo(); + android.hardware.health.DiskStats[] getDiskStats(); + android.hardware.health.HealthInfo getHealthInfo(); + const int STATUS_UNKNOWN = 2; + const int STATUS_CALLBACK_DIED = 4; +} diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/IHealthInfoCallback.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/IHealthInfoCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1b6366fa7a29dba4637ea6598c9d6694db7135cb --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/IHealthInfoCallback.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.health; +@VintfStability +interface IHealthInfoCallback { + oneway void healthInfoChanged(in android.hardware.health.HealthInfo info); +} diff --git a/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/StorageInfo.aidl b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/StorageInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..eaae5a611049de99505a2cf9cc5a439d3616d0c9 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/1/android/hardware/health/StorageInfo.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 -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.health; +@VintfStability +parcelable StorageInfo { + int eol; + int lifetimeA; + int lifetimeB; + String version; +} diff --git a/identity/aidl/Android.bp b/identity/aidl/Android.bp index 907a6b6a24211375642d3178716c49dd1c97700c..f6855e86c17744593736cd30d4dbcccc8eb4f636 100644 --- a/identity/aidl/Android.bp +++ b/identity/aidl/Android.bp @@ -26,9 +26,36 @@ aidl_interface { apps_enabled: false, }, }, - versions: [ - "1", - "2", - "3", + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.keymaster-V3", + "android.hardware.security.keymint-V1", + ], + }, + { + version: "2", + imports: [ + "android.hardware.keymaster-V3", + "android.hardware.security.keymint-V1", + ], + }, + { + version: "3", + imports: [ + "android.hardware.keymaster-V3", + "android.hardware.security.keymint-V1", + ], + }, + { + version: "4", + imports: [ + "android.hardware.keymaster-V3", + "android.hardware.security.keymint-V2", + ], + }, + ], + } diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/.hash b/identity/aidl/aidl_api/android.hardware.identity/4/.hash new file mode 100644 index 0000000000000000000000000000000000000000..244be6d9fb964a893083cf335d4ca3d0fa4c9203 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/.hash @@ -0,0 +1 @@ +2d63b17eb0f860c87b3564eda281342fb362e38d diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/Certificate.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/Certificate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..83e17973861f2a1df87ccb0049e3c0cfba54b5a3 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/Certificate.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +parcelable Certificate { + byte[] encodedCertificate; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/CipherSuite.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/CipherSuite.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e6ec04e805b321cfa18c4eee0cdde977577967a3 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/CipherSuite.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 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 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 -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.identity; +@Backing(type="int") @VintfStability +enum CipherSuite { + CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256 = 1, +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/HardwareInformation.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/HardwareInformation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9b96ea8a6827ace3c69877b5c223b5d430d75d88 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/HardwareInformation.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +parcelable HardwareInformation { + @utf8InCpp String credentialStoreName; + @utf8InCpp String credentialStoreAuthorName; + int dataChunkSize; + boolean isDirectAccess; + @utf8InCpp String[] supportedDocTypes; + boolean isRemoteKeyProvisioningSupported = false; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IIdentityCredential.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IIdentityCredential.aidl new file mode 100644 index 0000000000000000000000000000000000000000..506564110909271b43d63609cc408d9fd9d28fef --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IIdentityCredential.aidl @@ -0,0 +1,54 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +interface IIdentityCredential { + /** + * @deprecated use deleteCredentalWithChallenge() instead. + */ + byte[] deleteCredential(); + byte[] createEphemeralKeyPair(); + void setReaderEphemeralPublicKey(in byte[] publicKey); + long createAuthChallenge(); + void startRetrieval(in android.hardware.identity.SecureAccessControlProfile[] accessControlProfiles, in android.hardware.keymaster.HardwareAuthToken authToken, in byte[] itemsRequest, in byte[] signingKeyBlob, in byte[] sessionTranscript, in byte[] readerSignature, in int[] requestCounts); + void startRetrieveEntryValue(in @utf8InCpp String nameSpace, in @utf8InCpp String name, in int entrySize, in int[] accessControlProfileIds); + byte[] retrieveEntryValue(in byte[] encryptedContent); + @SuppressWarnings(value={"out-array"}) void finishRetrieval(out byte[] mac, out byte[] deviceNameSpaces); + @SuppressWarnings(value={"out-array"}) android.hardware.identity.Certificate generateSigningKeyPair(out byte[] signingKeyBlob); + void setRequestedNamespaces(in android.hardware.identity.RequestNamespace[] requestNamespaces); + void setVerificationToken(in android.hardware.keymaster.VerificationToken verificationToken); + byte[] deleteCredentialWithChallenge(in byte[] challenge); + byte[] proveOwnership(in byte[] challenge); + android.hardware.identity.IWritableIdentityCredential updateCredential(); +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IIdentityCredentialStore.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IIdentityCredentialStore.aidl new file mode 100644 index 0000000000000000000000000000000000000000..31ca8b10f34bef55bae2381dc30e440f24a87041 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IIdentityCredentialStore.aidl @@ -0,0 +1,55 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +interface IIdentityCredentialStore { + android.hardware.identity.HardwareInformation getHardwareInformation(); + android.hardware.identity.IWritableIdentityCredential createCredential(in @utf8InCpp String docType, in boolean testCredential); + android.hardware.identity.IIdentityCredential getCredential(in android.hardware.identity.CipherSuite cipherSuite, in byte[] credentialData); + android.hardware.identity.IPresentationSession createPresentationSession(in android.hardware.identity.CipherSuite cipherSuite); + android.hardware.security.keymint.IRemotelyProvisionedComponent getRemotelyProvisionedComponent(); + const int STATUS_OK = 0; + const int STATUS_FAILED = 1; + const int STATUS_CIPHER_SUITE_NOT_SUPPORTED = 2; + const int STATUS_INVALID_DATA = 3; + const int STATUS_INVALID_AUTH_TOKEN = 4; + const int STATUS_INVALID_ITEMS_REQUEST_MESSAGE = 5; + const int STATUS_READER_SIGNATURE_CHECK_FAILED = 6; + const int STATUS_EPHEMERAL_PUBLIC_KEY_NOT_FOUND = 7; + const int STATUS_USER_AUTHENTICATION_FAILED = 8; + const int STATUS_READER_AUTHENTICATION_FAILED = 9; + const int STATUS_NO_ACCESS_CONTROL_PROFILES = 10; + const int STATUS_NOT_IN_REQUEST_MESSAGE = 11; + const int STATUS_SESSION_TRANSCRIPT_MISMATCH = 12; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IPresentationSession.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IPresentationSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..705dc292c5a7528fd514e932ab3133eab520f780 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IPresentationSession.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.identity; +@VintfStability +interface IPresentationSession { + byte[] getEphemeralKeyPair(); + long getAuthChallenge(); + void setReaderEphemeralPublicKey(in byte[] publicKey); + void setSessionTranscript(in byte[] sessionTranscript); + android.hardware.identity.IIdentityCredential getCredential(in byte[] credentialData); +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IWritableIdentityCredential.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IWritableIdentityCredential.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5377349a5283f10cbbf4112e1dd2e43680207dd4 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/IWritableIdentityCredential.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +interface IWritableIdentityCredential { + android.hardware.identity.Certificate[] getAttestationCertificate(in byte[] attestationApplicationId, in byte[] attestationChallenge); + void startPersonalization(in int accessControlProfileCount, in int[] entryCounts); + android.hardware.identity.SecureAccessControlProfile addAccessControlProfile(in int id, in android.hardware.identity.Certificate readerCertificate, in boolean userAuthenticationRequired, in long timeoutMillis, in long secureUserId); + void beginAddEntry(in int[] accessControlProfileIds, in @utf8InCpp String nameSpace, in @utf8InCpp String name, in int entrySize); + byte[] addEntryValue(in byte[] content); + @SuppressWarnings(value={"out-array"}) void finishAddingEntries(out byte[] credentialData, out byte[] proofOfProvisioningSignature); + void setExpectedProofOfProvisioningSize(in int expectedProofOfProvisioningSize); + void setRemotelyProvisionedAttestationKey(in byte[] attestationKeyBlob, in byte[] attestationCertificate); +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/RequestDataItem.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/RequestDataItem.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cec8e0c94d1613c80ea5aac6770fd3f842064f07 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/RequestDataItem.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +parcelable RequestDataItem { + @utf8InCpp String name; + long size; + int[] accessControlProfileIds; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/RequestNamespace.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/RequestNamespace.aidl new file mode 100644 index 0000000000000000000000000000000000000000..05b9ec295f15c598b0648fa72bd3278af7f8db3b --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/RequestNamespace.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +parcelable RequestNamespace { + @utf8InCpp String namespaceName; + android.hardware.identity.RequestDataItem[] items; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/SecureAccessControlProfile.aidl b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/SecureAccessControlProfile.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2003594eb44e25d1c9741dc35a58a89a9f1b7959 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/4/android/hardware/identity/SecureAccessControlProfile.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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 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 -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.identity; +@VintfStability +parcelable SecureAccessControlProfile { + int id; + android.hardware.identity.Certificate readerCertificate; + boolean userAuthenticationRequired; + long timeoutMillis; + long secureUserId; + byte[] mac; +} diff --git a/identity/aidl/default/Android.bp b/identity/aidl/default/Android.bp index 32b35439ef11521e786ba22bff382a17fa59ae32..31ab40004ffd4d2d48e8004354d23740dcf54674 100644 --- a/identity/aidl/default/Android.bp +++ b/identity/aidl/default/Android.bp @@ -41,7 +41,7 @@ cc_library_static { "libpuresoftkeymasterdevice", "android.hardware.identity-support-lib", "android.hardware.identity-V4-ndk", - "android.hardware.keymaster-V4-ndk", + "android.hardware.keymaster-V3-ndk", "android.hardware.security.keymint-V2-ndk", ], } @@ -107,7 +107,7 @@ cc_binary { "libpuresoftkeymasterdevice", "android.hardware.identity-support-lib", "android.hardware.identity-V4-ndk", - "android.hardware.keymaster-V4-ndk", + "android.hardware.keymaster-V3-ndk", "android.hardware.identity-libeic-hal-common", "android.hardware.identity-libeic-library", ], diff --git a/identity/aidl/vts/Android.bp b/identity/aidl/vts/Android.bp index dc010d6b5f362df7350ede1b23a360d10a6c0260..51ab110ebdf70c1facceae5e729b5d3b47388482 100644 --- a/identity/aidl/vts/Android.bp +++ b/identity/aidl/vts/Android.bp @@ -47,8 +47,8 @@ cc_test { "android.hardware.keymaster@4.0", "android.hardware.identity-support-lib", "android.hardware.identity-V4-cpp", - "android.hardware.keymaster-V4-cpp", - "android.hardware.keymaster-V4-ndk", + "android.hardware.keymaster-V3-cpp", + "android.hardware.keymaster-V3-ndk", "libkeymaster4support", "libkeymaster4_1support", "libkeymint_remote_prov_support", diff --git a/input/classifier/README.md b/input/classifier/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a68d726318a0d552221dec0752753558e5df90c7 --- /dev/null +++ b/input/classifier/README.md @@ -0,0 +1 @@ +This HAL is deprecated. Do not use this HAL. Use IInputProcessor instead, located in `hardware/interfaces/input/processor`. \ No newline at end of file diff --git a/input/common/aidl/Android.bp b/input/common/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..390d8b54b1590c8c1b2c2a905181d29ff6e9cbda --- /dev/null +++ b/input/common/aidl/Android.bp @@ -0,0 +1,30 @@ +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"], +} + +aidl_interface { + name: "android.hardware.input.common", + vendor_available: true, + srcs: ["android/hardware/input/common/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/.hash b/input/common/aidl/aidl_api/android.hardware.input.common/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..6a5e1345b48318e1ea4f379f5ec7f75a330be329 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/.hash @@ -0,0 +1 @@ +a796f8e2fe447a0ddba069b6edd1aba2b1c9fc42 diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Action.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Action.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a2e0381188dc1112dab07c42f76a455b12291cf7 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Action.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Action { + DOWN = 0, + UP = 1, + MOVE = 2, + CANCEL = 3, + OUTSIDE = 4, + POINTER_DOWN = 5, + POINTER_UP = 6, + HOVER_MOVE = 7, + SCROLL = 8, + HOVER_ENTER = 9, + HOVER_EXIT = 10, + BUTTON_PRESS = 11, + BUTTON_RELEASE = 12, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Axis.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Axis.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2114c7deb19767279238ad4913ca32248b0f1ca1 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Axis.aidl @@ -0,0 +1,82 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Axis { + X = 0, + Y = 1, + PRESSURE = 2, + SIZE = 3, + TOUCH_MAJOR = 4, + TOUCH_MINOR = 5, + TOOL_MAJOR = 6, + TOOL_MINOR = 7, + ORIENTATION = 8, + VSCROLL = 9, + HSCROLL = 10, + Z = 11, + RX = 12, + RY = 13, + RZ = 14, + HAT_X = 15, + HAT_Y = 16, + LTRIGGER = 17, + RTRIGGER = 18, + THROTTLE = 19, + RUDDER = 20, + WHEEL = 21, + GAS = 22, + BRAKE = 23, + DISTANCE = 24, + TILT = 25, + SCROLL = 26, + RELATIVE_X = 27, + RELATIVE_Y = 28, + GENERIC_1 = 32, + GENERIC_2 = 33, + GENERIC_3 = 34, + GENERIC_4 = 35, + GENERIC_5 = 36, + GENERIC_6 = 37, + GENERIC_7 = 38, + GENERIC_8 = 39, + GENERIC_9 = 40, + GENERIC_10 = 41, + GENERIC_11 = 42, + GENERIC_12 = 43, + GENERIC_13 = 44, + GENERIC_14 = 45, + GENERIC_15 = 46, + GENERIC_16 = 47, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Button.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Button.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10ad65a19acfa0136fac72a6a64f756ecf8b3953 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Button.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Button { + NONE = 0, + PRIMARY = 1, + SECONDARY = 2, + TERTIARY = 4, + BACK = 8, + FORWARD = 16, + STYLUS_PRIMARY = 32, + STYLUS_SECONDARY = 64, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Classification.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Classification.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ddd524685fd843ceee9fcc37e901d7b965f650e7 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Classification.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="byte") @VintfStability +enum Classification { + NONE = 0, + AMBIGUOUS_GESTURE = 1, + DEEP_PRESS = 2, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/EdgeFlag.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/EdgeFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1040049b8114c3038960288f3c011a9d20935a7e --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/EdgeFlag.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum EdgeFlag { + NONE = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 4, + RIGHT = 8, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Flag.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Flag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d3fcd9ff1619feb87a874f5feee2cb48aa1b8226 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Flag.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Flag { + WINDOW_IS_OBSCURED = 1, + IS_GENERATED_GESTURE = 8, + TAINTED = -2147483648, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Meta.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Meta.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c229f9f36f3066b107f4d307152a27702844336 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Meta.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Meta { + NONE = 0, + ALT_ON = 2, + ALT_LEFT_ON = 16, + ALT_RIGHT_ON = 32, + SHIFT_ON = 1, + SHIFT_LEFT_ON = 64, + SHIFT_RIGHT_ON = 128, + SYM_ON = 4, + FUNCTION_ON = 8, + CTRL_ON = 4096, + CTRL_LEFT_ON = 8192, + CTRL_RIGHT_ON = 16384, + META_ON = 65536, + META_LEFT_ON = 131072, + META_RIGHT_ON = 262144, + CAPS_LOCK_ON = 1048576, + NUM_LOCK_ON = 2097152, + SCROLL_LOCK_ON = 4194304, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/MotionEvent.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/MotionEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84af4bf4ca5013d3fb784ac109af63dd788b561f --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/MotionEvent.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable MotionEvent { + int deviceId; + android.hardware.input.common.Source source; + int displayId; + long downTime; + long eventTime; + android.hardware.input.common.Action action; + byte actionIndex; + android.hardware.input.common.Button actionButton; + android.hardware.input.common.Flag flags; + android.hardware.input.common.PolicyFlag policyFlags; + android.hardware.input.common.EdgeFlag edgeFlags; + android.hardware.input.common.Meta metaState; + android.hardware.input.common.Button buttonState; + float xPrecision; + float yPrecision; + android.hardware.input.common.PointerProperties[] pointerProperties; + android.hardware.input.common.PointerCoords[] pointerCoords; + int deviceTimestamp; + android.hardware.input.common.VideoFrame[] frames; +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PointerCoords.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PointerCoords.aidl new file mode 100644 index 0000000000000000000000000000000000000000..353a1068688a95cd1726f8cf73d7d9744bd49c2a --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PointerCoords.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable PointerCoords { + long bits; + float[] values; +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PointerProperties.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PointerProperties.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a49581b4380a9b313c19fc4fc8ff3f870f23235d --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PointerProperties.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable PointerProperties { + int id; + android.hardware.input.common.ToolType toolType; +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PolicyFlag.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PolicyFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..247e868fcb6831a06de4953c58a05b550ee42a27 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/PolicyFlag.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum PolicyFlag { + WAKE = 1, + VIRTUAL = 2, + FUNCTION = 4, + GESTURE = 8, + INJECTED = 16777216, + TRUSTED = 33554432, + FILTERED = 67108864, + DISABLE_KEY_REPEAT = 134217728, + INTERACTIVE = 536870912, + PASS_TO_USER = 1073741824, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Source.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Source.aidl new file mode 100644 index 0000000000000000000000000000000000000000..396e06de97a60f16078d37938de3cc42b2fd13c2 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/Source.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Source { + UNKNOWN = 0, + KEYBOARD = 257, + DPAD = 513, + GAMEPAD = 1025, + TOUCHSCREEN = 4098, + MOUSE = 8194, + STYLUS = 16386, + BLUETOOTH_STYLUS = 49154, + TRACKBALL = 65540, + MOUSE_RELATIVE = 131076, + TOUCHPAD = 1048584, + TOUCH_NAVIGATION = 2097152, + ROTARY_ENCODER = 4194304, + JOYSTICK = 16777232, + HDMI = 33554433, + SENSOR = 67108864, + ANY = -256, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/SourceClass.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/SourceClass.aidl new file mode 100644 index 0000000000000000000000000000000000000000..96eede24b04bfb063ba3800f62a6d94c5e390707 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/SourceClass.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="byte") @VintfStability +enum SourceClass { + NONE = 0, + BUTTON = 1, + POINTER = 2, + NAVIGATION = 4, + POSITION = 8, + JOYSTICK = 16, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/ToolType.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/ToolType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ac1b69d74e8a887d8f0c33a3dd39d1e863595ff9 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/ToolType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="byte") @VintfStability +enum ToolType { + UNKNOWN = 0, + FINGER = 1, + STYLUS = 2, + MOUSE = 3, + ERASER = 4, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/VideoFrame.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/VideoFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14985c51d5a0469533d506c5fb0522800c56148a --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/1/android/hardware/input/common/VideoFrame.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable VideoFrame { + char[] data; + int height; + int width; + long timestamp; +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Action.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Action.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a2e0381188dc1112dab07c42f76a455b12291cf7 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Action.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Action { + DOWN = 0, + UP = 1, + MOVE = 2, + CANCEL = 3, + OUTSIDE = 4, + POINTER_DOWN = 5, + POINTER_UP = 6, + HOVER_MOVE = 7, + SCROLL = 8, + HOVER_ENTER = 9, + HOVER_EXIT = 10, + BUTTON_PRESS = 11, + BUTTON_RELEASE = 12, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2114c7deb19767279238ad4913ca32248b0f1ca1 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl @@ -0,0 +1,82 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Axis { + X = 0, + Y = 1, + PRESSURE = 2, + SIZE = 3, + TOUCH_MAJOR = 4, + TOUCH_MINOR = 5, + TOOL_MAJOR = 6, + TOOL_MINOR = 7, + ORIENTATION = 8, + VSCROLL = 9, + HSCROLL = 10, + Z = 11, + RX = 12, + RY = 13, + RZ = 14, + HAT_X = 15, + HAT_Y = 16, + LTRIGGER = 17, + RTRIGGER = 18, + THROTTLE = 19, + RUDDER = 20, + WHEEL = 21, + GAS = 22, + BRAKE = 23, + DISTANCE = 24, + TILT = 25, + SCROLL = 26, + RELATIVE_X = 27, + RELATIVE_Y = 28, + GENERIC_1 = 32, + GENERIC_2 = 33, + GENERIC_3 = 34, + GENERIC_4 = 35, + GENERIC_5 = 36, + GENERIC_6 = 37, + GENERIC_7 = 38, + GENERIC_8 = 39, + GENERIC_9 = 40, + GENERIC_10 = 41, + GENERIC_11 = 42, + GENERIC_12 = 43, + GENERIC_13 = 44, + GENERIC_14 = 45, + GENERIC_15 = 46, + GENERIC_16 = 47, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Button.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Button.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10ad65a19acfa0136fac72a6a64f756ecf8b3953 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Button.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Button { + NONE = 0, + PRIMARY = 1, + SECONDARY = 2, + TERTIARY = 4, + BACK = 8, + FORWARD = 16, + STYLUS_PRIMARY = 32, + STYLUS_SECONDARY = 64, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Classification.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Classification.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ddd524685fd843ceee9fcc37e901d7b965f650e7 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Classification.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="byte") @VintfStability +enum Classification { + NONE = 0, + AMBIGUOUS_GESTURE = 1, + DEEP_PRESS = 2, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/EdgeFlag.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/EdgeFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1040049b8114c3038960288f3c011a9d20935a7e --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/EdgeFlag.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum EdgeFlag { + NONE = 0, + TOP = 1, + BOTTOM = 2, + LEFT = 4, + RIGHT = 8, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Flag.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Flag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d3fcd9ff1619feb87a874f5feee2cb48aa1b8226 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Flag.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Flag { + WINDOW_IS_OBSCURED = 1, + IS_GENERATED_GESTURE = 8, + TAINTED = -2147483648, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Meta.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Meta.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c229f9f36f3066b107f4d307152a27702844336 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Meta.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Meta { + NONE = 0, + ALT_ON = 2, + ALT_LEFT_ON = 16, + ALT_RIGHT_ON = 32, + SHIFT_ON = 1, + SHIFT_LEFT_ON = 64, + SHIFT_RIGHT_ON = 128, + SYM_ON = 4, + FUNCTION_ON = 8, + CTRL_ON = 4096, + CTRL_LEFT_ON = 8192, + CTRL_RIGHT_ON = 16384, + META_ON = 65536, + META_LEFT_ON = 131072, + META_RIGHT_ON = 262144, + CAPS_LOCK_ON = 1048576, + NUM_LOCK_ON = 2097152, + SCROLL_LOCK_ON = 4194304, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/MotionEvent.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/MotionEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84af4bf4ca5013d3fb784ac109af63dd788b561f --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/MotionEvent.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable MotionEvent { + int deviceId; + android.hardware.input.common.Source source; + int displayId; + long downTime; + long eventTime; + android.hardware.input.common.Action action; + byte actionIndex; + android.hardware.input.common.Button actionButton; + android.hardware.input.common.Flag flags; + android.hardware.input.common.PolicyFlag policyFlags; + android.hardware.input.common.EdgeFlag edgeFlags; + android.hardware.input.common.Meta metaState; + android.hardware.input.common.Button buttonState; + float xPrecision; + float yPrecision; + android.hardware.input.common.PointerProperties[] pointerProperties; + android.hardware.input.common.PointerCoords[] pointerCoords; + int deviceTimestamp; + android.hardware.input.common.VideoFrame[] frames; +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PointerCoords.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PointerCoords.aidl new file mode 100644 index 0000000000000000000000000000000000000000..353a1068688a95cd1726f8cf73d7d9744bd49c2a --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PointerCoords.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable PointerCoords { + long bits; + float[] values; +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PointerProperties.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PointerProperties.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a49581b4380a9b313c19fc4fc8ff3f870f23235d --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PointerProperties.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable PointerProperties { + int id; + android.hardware.input.common.ToolType toolType; +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PolicyFlag.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PolicyFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..247e868fcb6831a06de4953c58a05b550ee42a27 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/PolicyFlag.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum PolicyFlag { + WAKE = 1, + VIRTUAL = 2, + FUNCTION = 4, + GESTURE = 8, + INJECTED = 16777216, + TRUSTED = 33554432, + FILTERED = 67108864, + DISABLE_KEY_REPEAT = 134217728, + INTERACTIVE = 536870912, + PASS_TO_USER = 1073741824, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Source.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Source.aidl new file mode 100644 index 0000000000000000000000000000000000000000..396e06de97a60f16078d37938de3cc42b2fd13c2 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Source.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="int") @VintfStability +enum Source { + UNKNOWN = 0, + KEYBOARD = 257, + DPAD = 513, + GAMEPAD = 1025, + TOUCHSCREEN = 4098, + MOUSE = 8194, + STYLUS = 16386, + BLUETOOTH_STYLUS = 49154, + TRACKBALL = 65540, + MOUSE_RELATIVE = 131076, + TOUCHPAD = 1048584, + TOUCH_NAVIGATION = 2097152, + ROTARY_ENCODER = 4194304, + JOYSTICK = 16777232, + HDMI = 33554433, + SENSOR = 67108864, + ANY = -256, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/SourceClass.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/SourceClass.aidl new file mode 100644 index 0000000000000000000000000000000000000000..96eede24b04bfb063ba3800f62a6d94c5e390707 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/SourceClass.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="byte") @VintfStability +enum SourceClass { + NONE = 0, + BUTTON = 1, + POINTER = 2, + NAVIGATION = 4, + POSITION = 8, + JOYSTICK = 16, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/ToolType.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/ToolType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ac1b69d74e8a887d8f0c33a3dd39d1e863595ff9 --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/ToolType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@Backing(type="byte") @VintfStability +enum ToolType { + UNKNOWN = 0, + FINGER = 1, + STYLUS = 2, + MOUSE = 3, + ERASER = 4, +} diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/VideoFrame.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/VideoFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14985c51d5a0469533d506c5fb0522800c56148a --- /dev/null +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/VideoFrame.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.common; +@VintfStability +parcelable VideoFrame { + char[] data; + int height; + int width; + long timestamp; +} diff --git a/input/common/aidl/android/hardware/input/common/Action.aidl b/input/common/aidl/android/hardware/input/common/Action.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ebe5e676dc4936a5ef98fe32e416def4edf513f7 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/Action.aidl @@ -0,0 +1,89 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Motion event actions + */ +@VintfStability +@Backing(type="int") +enum Action { + /** + * A pressed gesture has started, the motion contains the initial starting location. + */ + DOWN = 0, + /** + * A pressed gesture has finished, the motion contains the final release location + * as well as any intermediate points since the last down or move event. + */ + UP = 1, + /** + * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and + * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point. + */ + MOVE = 2, + /** + * The current gesture has been aborted. + * You will not receive any more points in it. You must treat this as + * an up event, but not perform any action that you normally would. + */ + CANCEL = 3, + /** + * A movement has happened outside of the normal bounds of the UI element. + * This does not provide a full gesture, but only the initial location of the movement/touch. + */ + OUTSIDE = 4, + /** + * A non-primary pointer has gone down. + */ + POINTER_DOWN = 5, + /** + * A non-primary pointer has gone up. + */ + POINTER_UP = 6, + /** + * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE). + * The motion contains the most recent point, as well as any intermediate points since + * the last hover move event. + */ + HOVER_MOVE = 7, + /** + * The motion event contains relative vertical and/or horizontal scroll offsets. + * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL + * and AMOTION_EVENT_AXIS_HSCROLL. + * The pointer may or may not be down when this event is dispatched. + * The framework will always deliver this action to the window under the pointer, which + * may not be the window currently touched. + */ + SCROLL = 8, + /** + * The pointer is not down but has entered the boundaries of a window or view. + */ + HOVER_ENTER = 9, + /** + * The pointer is not down but has exited the boundaries of a window or view. + */ + HOVER_EXIT = 10, + /** + * One or more buttons have been pressed. + */ + BUTTON_PRESS = 11, + /** + * One or more buttons have been released. + */ + BUTTON_RELEASE = 12, +} diff --git a/input/common/aidl/android/hardware/input/common/Axis.aidl b/input/common/aidl/android/hardware/input/common/Axis.aidl new file mode 100644 index 0000000000000000000000000000000000000000..11509494fa819bc0ff7658989f4e1e05a7e9436f --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/Axis.aidl @@ -0,0 +1,387 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Constants that identify each individual axis of a motion event. + * Each value represents a bit position. The user is expected to manually shift + * to the desired position (e.g., 1 << Axis.X) when reading or writing these + * from a bitfield manually. + */ +@VintfStability +@Backing(type="int") +enum Axis { + /** + * Axis constant: X axis of a motion event. + * + * - For a touch screen, reports the absolute X screen position of the center of + * the touch contact area. The units are display pixels. + * - For a touch pad, reports the absolute X surface position of the center of the touch + * contact area. The units are device-dependent. + * - For a mouse, reports the absolute X screen position of the mouse pointer. + * The units are display pixels. + * - For a trackball, reports the relative horizontal displacement of the trackball. + * The value is normalized to a range from -1.0 (left) to 1.0 (right). + * - For a joystick, reports the absolute X position of the joystick. + * The value is normalized to a range from -1.0 (left) to 1.0 (right). + */ + X = 0, + /** + * Axis constant: Y axis of a motion event. + * + * - For a touch screen, reports the absolute Y screen position of the center of + * the touch contact area. The units are display pixels. + * - For a touch pad, reports the absolute Y surface position of the center of the touch + * contact area. The units are device-dependent. + * - For a mouse, reports the absolute Y screen position of the mouse pointer. + * The units are display pixels. + * - For a trackball, reports the relative vertical displacement of the trackball. + * The value is normalized to a range from -1.0 (up) to 1.0 (down). + * - For a joystick, reports the absolute Y position of the joystick. + * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near). + */ + Y = 1, + /** + * Axis constant: Pressure axis of a motion event. + * + * - For a touch screen or touch pad, reports the approximate pressure applied to the surface + * by a finger or other tool. The value is normalized to a range from + * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1 + * may be generated depending on the calibration of the input device. + * - For a trackball, the value is set to 1 if the trackball button is pressed + * or 0 otherwise. + * - For a mouse, the value is set to 1 if the primary mouse button is pressed + * or 0 otherwise. + */ + PRESSURE = 2, + /** + * Axis constant: Size axis of a motion event. + * + * - For a touch screen or touch pad, reports the approximate size of the contact area in + * relation to the maximum detectable size for the device. The value is normalized + * to a range from 0 (smallest detectable size) to 1 (largest detectable size), + * although it is not a linear scale. This value is of limited use. + * To obtain calibrated size information, see + * {@link TOUCH_MAJOR} or {@link TOOL_MAJOR}. + */ + SIZE = 3, + /** + * Axis constant: TouchMajor axis of a motion event. + * + * - For a touch screen, reports the length of the major axis of an ellipse that + * represents the touch area at the point of contact. + * The units are display pixels. + * - For a touch pad, reports the length of the major axis of an ellipse that + * represents the touch area at the point of contact. + * The units are device-dependent. + */ + TOUCH_MAJOR = 4, + /** + * Axis constant: TouchMinor axis of a motion event. + * + * - For a touch screen, reports the length of the minor axis of an ellipse that + * represents the touch area at the point of contact. + * The units are display pixels. + * - For a touch pad, reports the length of the minor axis of an ellipse that + * represents the touch area at the point of contact. + * The units are device-dependent. + * + * When the touch is circular, the major and minor axis lengths will be equal to one another. + */ + TOUCH_MINOR = 5, + /** + * Axis constant: ToolMajor axis of a motion event. + * + * - For a touch screen, reports the length of the major axis of an ellipse that + * represents the size of the approaching finger or tool used to make contact. + * - For a touch pad, reports the length of the major axis of an ellipse that + * represents the size of the approaching finger or tool used to make contact. + * The units are device-dependent. + * + * When the touch is circular, the major and minor axis lengths will be equal to one another. + * + * The tool size may be larger than the touch size since the tool may not be fully + * in contact with the touch sensor. + */ + TOOL_MAJOR = 6, + /** + * Axis constant: ToolMinor axis of a motion event. + * + * - For a touch screen, reports the length of the minor axis of an ellipse that + * represents the size of the approaching finger or tool used to make contact. + * - For a touch pad, reports the length of the minor axis of an ellipse that + * represents the size of the approaching finger or tool used to make contact. + * The units are device-dependent. + * + * When the touch is circular, the major and minor axis lengths will be equal to one another. + * + * The tool size may be larger than the touch size since the tool may not be fully + * in contact with the touch sensor. + */ + TOOL_MINOR = 7, + /** + * Axis constant: Orientation axis of a motion event. + * + * - For a touch screen or touch pad, reports the orientation of the finger + * or tool in radians relative to the vertical plane of the device. + * An angle of 0 radians indicates that the major axis of contact is oriented + * upwards, is perfectly circular or is of unknown orientation. A positive angle + * indicates that the major axis of contact is oriented to the right. A negative angle + * indicates that the major axis of contact is oriented to the left. + * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians + * (finger pointing fully right). + * - For a stylus, the orientation indicates the direction in which the stylus + * is pointing in relation to the vertical axis of the current orientation of the screen. + * The range is from -PI radians to PI radians, where 0 is pointing up, + * -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians + * is pointing right. See also {@link TILT}. + */ + ORIENTATION = 8, + /** + * Axis constant: Vertical Scroll axis of a motion event. + * + * - For a mouse, reports the relative movement of the vertical scroll wheel. + * The value is normalized to a range from -1.0 (down) to 1.0 (up). + * + * The framework may use this axis to scroll views vertically. + */ + VSCROLL = 9, + /** + * Axis constant: Horizontal Scroll axis of a motion event. + * + * - For a mouse, reports the relative movement of the horizontal scroll wheel. + * The value is normalized to a range from -1.0 (left) to 1.0 (right). + * + * The framework may use this axis to scroll views horizontally. + */ + HSCROLL = 10, + /** + * Axis constant: Z axis of a motion event. + * + * - For a joystick, reports the absolute Z position of the joystick. + * The value is normalized to a range from -1.0 (high) to 1.0 (low). + * On game pads with two analog joysticks, this axis is often reinterpreted + * to report the absolute X position of the second joystick instead. + */ + Z = 11, + /** + * Axis constant: X Rotation axis of a motion event. + * + * - For a joystick, reports the absolute rotation angle about the X axis. + * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). + */ + RX = 12, + /** + * Axis constant: Y Rotation axis of a motion event. + * + * - For a joystick, reports the absolute rotation angle about the Y axis. + * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). + */ + RY = 13, + /** + * Axis constant: Z Rotation axis of a motion event. + * + * - For a joystick, reports the absolute rotation angle about the Z axis. + * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). + * On game pads with two analog joysticks, this axis is often reinterpreted + * to report the absolute Y position of the second joystick instead. + */ + RZ = 14, + /** + * Axis constant: Hat X axis of a motion event. + * + * - For a joystick, reports the absolute X position of the directional hat control. + * The value is normalized to a range from -1.0 (left) to 1.0 (right). + */ + HAT_X = 15, + /** + * Axis constant: Hat Y axis of a motion event. + * + * - For a joystick, reports the absolute Y position of the directional hat control. + * The value is normalized to a range from -1.0 (up) to 1.0 (down). + */ + HAT_Y = 16, + /** + * Axis constant: Left Trigger axis of a motion event. + * + * - For a joystick, reports the absolute position of the left trigger control. + * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed). + */ + LTRIGGER = 17, + /** + * Axis constant: Right Trigger axis of a motion event. + * + * - For a joystick, reports the absolute position of the right trigger control. + * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed). + */ + RTRIGGER = 18, + /** + * Axis constant: Throttle axis of a motion event. + * + * - For a joystick, reports the absolute position of the throttle control. + * The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed). + */ + THROTTLE = 19, + /** + * Axis constant: Rudder axis of a motion event. + * + * - For a joystick, reports the absolute position of the rudder control. + * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right). + */ + RUDDER = 20, + /** + * Axis constant: Wheel axis of a motion event. + * + * - For a joystick, reports the absolute position of the steering wheel control. + * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right). + */ + WHEEL = 21, + /** + * Axis constant: Gas axis of a motion event. + * + * - For a joystick, reports the absolute position of the gas (accelerator) control. + * The value is normalized to a range from 0.0 (no acceleration) + * to 1.0 (maximum acceleration). + */ + GAS = 22, + /** + * Axis constant: Brake axis of a motion event. + * + * - For a joystick, reports the absolute position of the brake control. + * The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking). + */ + BRAKE = 23, + /** + * Axis constant: Distance axis of a motion event. + * + * - For a stylus, reports the distance of the stylus from the screen. + * A value of 0.0 indicates direct contact and larger values indicate increasing + * distance from the surface. + */ + DISTANCE = 24, + /** + * Axis constant: Tilt axis of a motion event. + * + * - For a stylus, reports the tilt angle of the stylus in radians where + * 0 radians indicates that the stylus is being held perpendicular to the + * surface, and PI/2 radians indicates that the stylus is being held flat + * against the surface. + */ + TILT = 25, + /** + * Axis constant: Generic scroll axis of a motion event. + * + * - This is used for scroll axis motion events that can't be classified as strictly + * vertical or horizontal. The movement of a rotating scroller is an example of this. + */ + SCROLL = 26, + /** + * Axis constant: The movement of x position of a motion event. + * + * - For a mouse, reports a difference of x position between the previous position. + * This is useful when pointer is captured, in that case the mouse pointer doesn't + * change the location but this axis reports the difference which allows the app + * to see how the mouse is moved. + */ + RELATIVE_X = 27, + /** + * Axis constant: The movement of y position of a motion event. + * + * Same as {@link RELATIVE_X}, but for y position. + */ + RELATIVE_Y = 28, + /** + * Axis constant: Generic 1 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_1 = 32, + /** + * Axis constant: Generic 2 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_2 = 33, + /** + * Axis constant: Generic 3 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_3 = 34, + /** + * Axis constant: Generic 4 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_4 = 35, + /** + * Axis constant: Generic 5 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_5 = 36, + /** + * Axis constant: Generic 6 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_6 = 37, + /** + * Axis constant: Generic 7 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_7 = 38, + /** + * Axis constant: Generic 8 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_8 = 39, + /** + * Axis constant: Generic 9 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_9 = 40, + /** + * Axis constant: Generic 10 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_10 = 41, + /** + * Axis constant: Generic 11 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_11 = 42, + /** + * Axis constant: Generic 12 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_12 = 43, + /** + * Axis constant: Generic 13 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_13 = 44, + /** + * Axis constant: Generic 14 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_14 = 45, + /** + * Axis constant: Generic 15 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_15 = 46, + /** + * Axis constant: Generic 16 axis of a motion event. + * The interpretation of a generic axis is device-specific. + */ + GENERIC_16 = 47, +} diff --git a/input/common/aidl/android/hardware/input/common/Button.aidl b/input/common/aidl/android/hardware/input/common/Button.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4bbd5f5a171f76bb60453d67463e058e231c75af --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/Button.aidl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Buttons that are associated with motion events. + */ +@VintfStability +@Backing(type="int") +enum Button { + NONE = 0, + PRIMARY = 1 << 0, + SECONDARY = 1 << 1, + TERTIARY = 1 << 2, + BACK = 1 << 3, + FORWARD = 1 << 4, + STYLUS_PRIMARY = 1 << 5, + STYLUS_SECONDARY = 1 << 6, +} diff --git a/input/common/aidl/android/hardware/input/common/Classification.aidl b/input/common/aidl/android/hardware/input/common/Classification.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f573174e90dd2b32a581acafc4e2224781d2a43e --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/Classification.aidl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Classification of the current gesture, if available. + */ +@VintfStability +@Backing(type="byte") +enum Classification { + NONE = 0, + /** + * Too early to classify the gesture, need more events. + */ + AMBIGUOUS_GESTURE = 1, + /** + * User is force-pressing the screen. + */ + DEEP_PRESS = 2, +} diff --git a/input/common/aidl/android/hardware/input/common/EdgeFlag.aidl b/input/common/aidl/android/hardware/input/common/EdgeFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8d2263586ed6642920b4bb0f7e81769130e4e462 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/EdgeFlag.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Edge flags + */ +@VintfStability +@Backing(type="int") +enum EdgeFlag { + /** + * No edges are intersected + */ + NONE = 0, + /** + * Motion intersected top edge of the screen + */ + TOP = 1 << 0, + /** + * Motion intersected bottom edge of the screen + */ + BOTTOM = 1 << 1, + /** + * Motion intersected left edge of the screen + */ + LEFT = 1 << 2, + /** + * Motion intersected right edge of the screen + */ + RIGHT = 1 << 3, +} diff --git a/input/common/aidl/android/hardware/input/common/Flag.aidl b/input/common/aidl/android/hardware/input/common/Flag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..600bdd3993ecf9d7fb9b20008e4f48c623795a9d --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/Flag.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Motion event flags + */ +@VintfStability +@Backing(type="int") +enum Flag { + /** + * Indicates that the window that received this motion event is partly + * or wholly obscured by another visible window above it. This flag is set to true + * even if the event did not directly pass through the obscured area. + * A security sensitive application can check this flag to identify situations in which + * a malicious application may have covered up part of its content for the purpose + * of misleading the user or hijacking touches. An appropriate response might be + * to drop the suspect touches or to take additional precautions to confirm the user's + * actual intent. + */ + WINDOW_IS_OBSCURED = 1 << 0, + /** + * This flag indicates that the event has been generated by a gesture generator. It + * could be used, for example, to determine whether touch slop should be applied. + */ + IS_GENERATED_GESTURE = 1 << 3, + /** + * Motion event is inconsistent with previously sent motion events. + */ + TAINTED = 1 << 31, +} diff --git a/input/common/aidl/android/hardware/input/common/Meta.aidl b/input/common/aidl/android/hardware/input/common/Meta.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9ccf11b69d51559ac8ef3e5ffc383ee9deb5bc97 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/Meta.aidl @@ -0,0 +1,94 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Meta key / modifier state + */ +@VintfStability +@Backing(type="int") +enum Meta { + NONE = 0, + /** + * One of the ALT meta keys is pressed. + */ + ALT_ON = 1 << 1, + /** + * The left ALT meta key is pressed. + */ + ALT_LEFT_ON = 1 << 4, + /** + * The right ALT meta key is pressed. + */ + ALT_RIGHT_ON = 1 << 5, + /** + * One of the SHIFT meta keys is pressed. + */ + SHIFT_ON = 1 << 0, + /** + * The left SHIFT meta key is pressed. + */ + SHIFT_LEFT_ON = 1 << 6, + /** + * The right SHIFT meta key is pressed. + */ + SHIFT_RIGHT_ON = 1 << 7, + /** + * The SYM meta key is pressed. + */ + SYM_ON = 1 << 2, + /** + * The FUNCTION meta key is pressed. + */ + FUNCTION_ON = 1 << 3, + /** + * One of the CTRL meta keys is pressed. + */ + CTRL_ON = 1 << 12, + /** + * The left CTRL meta key is pressed. + */ + CTRL_LEFT_ON = 1 << 13, + /** + * The right CTRL meta key is pressed. + */ + CTRL_RIGHT_ON = 1 << 14, + /** + * One of the META meta keys is pressed. + */ + META_ON = 1 << 16, + /** + * The left META meta key is pressed. + */ + META_LEFT_ON = 1 << 17, + /** + * The right META meta key is pressed. + */ + META_RIGHT_ON = 1 << 18, + /** + * The CAPS LOCK meta key is on. + */ + CAPS_LOCK_ON = 1 << 20, + /** + * The NUM LOCK meta key is on. + */ + NUM_LOCK_ON = 1 << 21, + /** + * The SCROLL LOCK meta key is on. + */ + SCROLL_LOCK_ON = 1 << 22, +} diff --git a/input/common/aidl/android/hardware/input/common/MotionEvent.aidl b/input/common/aidl/android/hardware/input/common/MotionEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dfea7033f25c6ad1cdbda991f23241c4a4f2bbf8 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/MotionEvent.aidl @@ -0,0 +1,114 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +import android.hardware.input.common.Action; +import android.hardware.input.common.Button; +import android.hardware.input.common.EdgeFlag; +import android.hardware.input.common.Flag; +import android.hardware.input.common.Meta; +import android.hardware.input.common.PointerCoords; +import android.hardware.input.common.PointerProperties; +import android.hardware.input.common.PolicyFlag; +import android.hardware.input.common.Source; +import android.hardware.input.common.VideoFrame; + +/** + * Analogous to Android's native MotionEvent / NotifyMotionArgs. + * Stores the basic information about pointer movements. + */ +@VintfStability +parcelable MotionEvent { + /** + * The id of the device which produced this event. + */ + int deviceId; + /** + * The source type of this event. + */ + Source source; + /** + * The display id associated with this event. + */ + int displayId; + /** + * Time when the initial touch down occurred, in nanoseconds. + */ + long downTime; + /** + * Time when this event occurred, in nanoseconds. + */ + long eventTime; + /** + * The kind of action being performed. + */ + Action action; + /** + * For ACTION_POINTER_DOWN or ACTION_POINTER_UP, this contains the associated pointer index. + * The index may be used to get information about the pointer that has gone down or up. + */ + byte actionIndex; + /** + * The button that has been modified during a press or release action. + */ + Button actionButton; + /** + * The motion event flags. + */ + Flag flags; + /** + * The motion event policy flags. + */ + PolicyFlag policyFlags; + /** + * The edges, if any, that were touched by this motion event. + */ + EdgeFlag edgeFlags; + /** + * The state of any meta / modifier keys that were in effect when the event was generated. + */ + Meta metaState; + /** + * The state of buttons that are pressed. + */ + Button buttonState; + /** + * The precision of the X coordinate being reported. + */ + float xPrecision; + /** + * The precision of the Y coordinate being reported. + */ + float yPrecision; + /** + * The properties of each pointer present in this motion event. + */ + PointerProperties[] pointerProperties; + /** + * The coordinates of each pointer. + */ + PointerCoords[] pointerCoords; + /** + * Device time at which the event occurred, in microseconds. + * Will wrap after a little over an hour. + */ + int deviceTimestamp; + /** + * The video frames, if any, associated with the current or previous motion events. + */ + VideoFrame[] frames; +} diff --git a/input/common/aidl/android/hardware/input/common/PointerCoords.aidl b/input/common/aidl/android/hardware/input/common/PointerCoords.aidl new file mode 100644 index 0000000000000000000000000000000000000000..56d9a74a4f7ef3082887170bd6c777b76c75ad52 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/PointerCoords.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +import android.hardware.input.common.Axis; + +/** + * Pointer coordinate data. Analogous to Android's PointerCoords. + */ +@VintfStability +parcelable PointerCoords { + /** + * Bitfield of axes that are present in this structure. + * Each bit position matches an axis defined in Axis.aidl. + */ + long bits; + /** + * The values corresponding to each non-zero axis. This vector only + * contains non-zero entries. If an axis that is not currently specified + * in "bits" is requested, a zero value is returned. + * There are only as many values stored here + * as there are non-zero bits in the "bits" field. + * The values are position-packed. So the first non-zero axis will be + * at position 0, the next non-zero axis will be at position 1, and so on. + */ + float[] values; +} diff --git a/input/common/aidl/android/hardware/input/common/PointerProperties.aidl b/input/common/aidl/android/hardware/input/common/PointerProperties.aidl new file mode 100644 index 0000000000000000000000000000000000000000..38d815e0226d9a80378067c91ea6a15b0ce8d8ae --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/PointerProperties.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +import android.hardware.input.common.ToolType; + +/** + * Properties of a particular pointer. Analogous to Android's PointerProperties. + */ +@VintfStability +parcelable PointerProperties { + /** + * A number identifying a specific pointer. When a pointer is lifted, + * this value may be reused by another new pointer, even during the + * same gesture. For example, if there are two pointers touching the screen + * at the same time, they might have pointer ID's of 0 and 1. If the + * pointer with id = 0 is lifted, while the pointer with id = 1 remains, and + * a new pointer is placed on the screen, then the new pointer may receive + * an id of 0. While a pointer is active, it is guaranteed to keep the same + * id. + */ + int id; + /** + * Type of tool used to make contact, such as a finger or stylus, if known. + */ + ToolType toolType; +} diff --git a/input/common/aidl/android/hardware/input/common/PolicyFlag.aidl b/input/common/aidl/android/hardware/input/common/PolicyFlag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c5edd0d433bffd4d45a1bcb94d972b3be6a24fd0 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/PolicyFlag.aidl @@ -0,0 +1,70 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Policy flags. + * The values 1 << 4 through 1 << 23 are not currently used. + * When a new value is added, make sure it matches a value defined in Input.h + * and other relevant files in frameworks/base and frameworks/native. + */ +@VintfStability +@Backing(type="int") +enum PolicyFlag { + /** + * Event should wake the device + */ + WAKE = 1 << 0, + /** + * Key is virtual, and should generate haptic feedback + */ + VIRTUAL = 1 << 1, + /** + * Key is the special function modifier + */ + FUNCTION = 1 << 2, + /** + * Key represents a special gesture that has been detected + * by the touch firmware or driver. + */ + GESTURE = 1 << 3, + /** + * Event was injected + */ + INJECTED = 1 << 24, + /** + * Event comes from a trusted source, such as a directly attached input + * device or an application with system-wide event injection permission. + */ + TRUSTED = 1 << 25, + /** + * Event has passed through an input filter. + */ + FILTERED = 1 << 26, + /** + * Disable automatic key repeating behaviour. + */ + DISABLE_KEY_REPEAT = 1 << 27, + /** + * Device was in an interactive state when the event was intercepted + */ + INTERACTIVE = 1 << 29, + /** + * Event should be dispatched to applications + */ + PASS_TO_USER = 1 << 30, +} diff --git a/input/common/aidl/android/hardware/input/common/Source.aidl b/input/common/aidl/android/hardware/input/common/Source.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c6a825a4d60fe746b2205f3ee2c3734b60368223 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/Source.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +import android.hardware.input.common.SourceClass; + +/** + * Input sources + */ +@VintfStability +@Backing(type="int") +enum Source { + UNKNOWN = 0, + KEYBOARD = (1 << 8) | SourceClass.BUTTON, + DPAD = (1 << 9) | SourceClass.BUTTON, + GAMEPAD = (1 << 10) | SourceClass.BUTTON, + TOUCHSCREEN = (1 << 12) | SourceClass.POINTER, + MOUSE = (1 << 13) | SourceClass.POINTER, + STYLUS = (1 << 14) | SourceClass.POINTER, + BLUETOOTH_STYLUS = (1 << 15) | STYLUS, + TRACKBALL = (1 << 16) | SourceClass.NAVIGATION, + MOUSE_RELATIVE = (1 << 17) | SourceClass.NAVIGATION, + TOUCHPAD = (1 << 20) | SourceClass.POSITION, + TOUCH_NAVIGATION = (1 << 21) | SourceClass.NONE, + ROTARY_ENCODER = (1 << 22) | SourceClass.NONE, + JOYSTICK = (1 << 24) | SourceClass.JOYSTICK, + /** + * The input source is a device connected through HDMI-based bus. + * The keys come in through HDMI-CEC or MHL signal line. + */ + HDMI = (1 << 25) | SourceClass.BUTTON, + SENSOR = (1 << 26) | SourceClass.NONE, + ANY = 0xFFFFFF00, +} diff --git a/input/common/aidl/android/hardware/input/common/SourceClass.aidl b/input/common/aidl/android/hardware/input/common/SourceClass.aidl new file mode 100644 index 0000000000000000000000000000000000000000..43157981e3adb9b15f5cdeb0b93d4e73a86abc53 --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/SourceClass.aidl @@ -0,0 +1,28 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +@VintfStability +@Backing(type="byte") +enum SourceClass { + NONE = 0 << 0, + BUTTON = 1 << 0, + POINTER = 1 << 1, + NAVIGATION = 1 << 2, + POSITION = 1 << 3, + JOYSTICK = 1 << 4, +} diff --git a/input/common/aidl/android/hardware/input/common/ToolType.aidl b/input/common/aidl/android/hardware/input/common/ToolType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cfa057dc156f761a41f43b8dde3742a195b9835c --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/ToolType.aidl @@ -0,0 +1,30 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Tool type of a pointer + */ +@VintfStability +@Backing(type="byte") +enum ToolType { + UNKNOWN = 0, + FINGER = 1, + STYLUS = 2, + MOUSE = 3, + ERASER = 4, +} diff --git a/input/common/aidl/android/hardware/input/common/VideoFrame.aidl b/input/common/aidl/android/hardware/input/common/VideoFrame.aidl new file mode 100644 index 0000000000000000000000000000000000000000..409cee50fc984601e0e6ce8cacefc334f1a878fc --- /dev/null +++ b/input/common/aidl/android/hardware/input/common/VideoFrame.aidl @@ -0,0 +1,79 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.common; + +/** + * Touch heatmap. + * + * The array is a 2-D row-major matrix with dimensions (height, width). + * The heatmap data is rotated when device orientation changes. + * + * Example: + * + * If the data in the array is: + * data[i] = i for i in 0 .. 59, + * then it can be represented as a 10 x 6 matrix: + * + * <-- width --> + * 0 1 2 3 4 5 ^ + * 6 7 8 9 10 11 | + * 12 13 14 15 16 17 | + * 18 ... 23 | + * 24 ... 29 | height + * 30 ... 35 | + * 36 ... 41 | + * 42 ... 47 | + * 48 ... 53 | + * 54 ... 59 v + * + * Looking at the device in standard portrait orientation, + * the element "0" is the top left of the screen, + * "5" is at the top right, and "59" is the bottom right. + * Here height=10 and width=6. + * + * If the screen orientation changes to landscape (a 90 degree orientation + * change), the frame's dimensions will become 6 x 10 + * and the data will look as follows: + * 54 48 42 36 30 24 18 12 6 0 ^ + * ... 13 7 1 | + * ... 14 8 2 | height + * ... 15 9 3 | + * ... 16 10 4 | + * 59 53 47 41 35 29 23 17 11 5 v + * <-- width --> + * + * Here the element "0" is at the physical top left of the unrotated screen. + * + * Since the coordinates of a MotionEvent are also adjusted based on the + * orientation, the rotation of the video frame data ensures that + * the axes for MotionEvent and VideoFrame data are consistent. + */ +@VintfStability +parcelable VideoFrame { + /** + * Video frame data. + * Size of the data is height * width. + */ + char[] data; + int height; + int width; + /** + * Time at which the frame was collected, in nanoseconds. + * Measured with the same clock that is used to populate MotionEvent times. + */ + long timestamp; +} diff --git a/input/processor/aidl/Android.bp b/input/processor/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..354816ec74b953c876074cccba494ae756b6767d --- /dev/null +++ b/input/processor/aidl/Android.bp @@ -0,0 +1,33 @@ +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"], +} + +aidl_interface { + name: "android.hardware.input.processor", + vendor_available: true, + srcs: ["android/hardware/input/processor/*.aidl"], + imports: [ + "android.hardware.input.common", + ], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.input.common-V1"], + }, + ], + +} diff --git a/input/processor/aidl/aidl_api/android.hardware.input.processor/1/.hash b/input/processor/aidl/aidl_api/android.hardware.input.processor/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..e1f0b007741876dd491541b5292ac4db7ee482d4 --- /dev/null +++ b/input/processor/aidl/aidl_api/android.hardware.input.processor/1/.hash @@ -0,0 +1 @@ +8caabf520f562590b693af83b1d2a0c409fb0236 diff --git a/input/processor/aidl/aidl_api/android.hardware.input.processor/1/android/hardware/input/processor/IInputProcessor.aidl b/input/processor/aidl/aidl_api/android.hardware.input.processor/1/android/hardware/input/processor/IInputProcessor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9d00c70ec288f31a6f3b963ead3b05ec374e0a8a --- /dev/null +++ b/input/processor/aidl/aidl_api/android.hardware.input.processor/1/android/hardware/input/processor/IInputProcessor.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.processor; +@VintfStability +interface IInputProcessor { + android.hardware.input.common.Classification classify(in android.hardware.input.common.MotionEvent event); + void reset(); + void resetDevice(in int deviceId); +} diff --git a/input/processor/aidl/aidl_api/android.hardware.input.processor/current/android/hardware/input/processor/IInputProcessor.aidl b/input/processor/aidl/aidl_api/android.hardware.input.processor/current/android/hardware/input/processor/IInputProcessor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9d00c70ec288f31a6f3b963ead3b05ec374e0a8a --- /dev/null +++ b/input/processor/aidl/aidl_api/android.hardware.input.processor/current/android/hardware/input/processor/IInputProcessor.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.input.processor; +@VintfStability +interface IInputProcessor { + android.hardware.input.common.Classification classify(in android.hardware.input.common.MotionEvent event); + void reset(); + void resetDevice(in int deviceId); +} diff --git a/input/processor/aidl/android/hardware/input/processor/IInputProcessor.aidl b/input/processor/aidl/android/hardware/input/processor/IInputProcessor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..635ff0aca747e79cd2c7c719056befd47537161d --- /dev/null +++ b/input/processor/aidl/android/hardware/input/processor/IInputProcessor.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ + +package android.hardware.input.processor; + +@VintfStability +interface IInputProcessor { + /** + * Upon receiving the current motion event, return the classification based on the current + * sequence of motion events. + * Once the classification has been determined, it should not change until a new gesture is + * started. + */ + android.hardware.input.common.Classification classify( + in android.hardware.input.common.MotionEvent event); + + /** + * Reset the HAL internal state. The reset may be called to prevent an inconsistent + * stream of events to be sent to the HAL. + */ + void reset(); + + /** + * Called when an input device has been reset. + */ + void resetDevice(in int deviceId); +} diff --git a/input/processor/aidl/default/Android.bp b/input/processor/aidl/default/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..f4855976e676cb58ad1cf664eab13d9401b6ad55 --- /dev/null +++ b/input/processor/aidl/default/Android.bp @@ -0,0 +1,54 @@ +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_library_static { + name: "libinputprocessorexampleimpl", + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "liblog", + "libutils", + "android.hardware.input.common-V1-ndk", + "android.hardware.input.processor-V1-ndk", + ], + export_include_dirs: ["include"], + srcs: [ + "InputProcessor.cpp", + ], + visibility: [ + ":__subpackages__", + "//hardware/interfaces/tests/extension/input/processor:__subpackages__", + ], +} + +filegroup { + name: "android.hardware.input.processor.xml", + srcs: ["android.hardware.input.processor.xml"], +} + +cc_binary { + name: "android.hardware.input.processor-service.example", + relative_install_path: "hw", + init_rc: ["inputprocessor-default.rc"], + vintf_fragments: [":android.hardware.input.processor.xml"], + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "liblog", + "libutils", + "android.hardware.input.common-V1-ndk", + "android.hardware.input.processor-V1-ndk", + ], + static_libs: [ + "libinputprocessorexampleimpl", + ], + srcs: ["main.cpp"], +} diff --git a/input/processor/aidl/default/InputProcessor.cpp b/input/processor/aidl/default/InputProcessor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fb6bbd5f4dc41ec0d8ec424023b7cdc2d1ab2297 --- /dev/null +++ b/input/processor/aidl/default/InputProcessor.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 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. + */ + +#include "inputprocessor-impl/InputProcessor.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace input { +namespace processor { + +using ::aidl::android::hardware::input::common::Classification; +using aidl::android::hardware::input::common::MotionEvent; + +::ndk::ScopedAStatus InputProcessor::classify(const MotionEvent& /*in_event*/, + Classification* _aidl_return) { + *_aidl_return = Classification::NONE; + return ndk::ScopedAStatus::ok(); +} +::ndk::ScopedAStatus InputProcessor::reset() { + return ndk::ScopedAStatus::ok(); +} +::ndk::ScopedAStatus InputProcessor::resetDevice(int32_t /*in_deviceId*/) { + return ndk::ScopedAStatus::ok(); +} + +} // namespace processor +} // namespace input +} // namespace hardware +} // namespace android +} // namespace aidl \ No newline at end of file diff --git a/input/processor/aidl/default/android.hardware.input.processor.xml b/input/processor/aidl/default/android.hardware.input.processor.xml new file mode 100644 index 0000000000000000000000000000000000000000..5ecbd2af0cd35541b35bbb5eb50e9c3e8743522a --- /dev/null +++ b/input/processor/aidl/default/android.hardware.input.processor.xml @@ -0,0 +1,7 @@ + + + android.hardware.input.processor + 1 + IInputProcessor/default + + \ No newline at end of file diff --git a/input/processor/aidl/default/include/inputprocessor-impl/InputProcessor.h b/input/processor/aidl/default/include/inputprocessor-impl/InputProcessor.h new file mode 100644 index 0000000000000000000000000000000000000000..0d6bc585991d9e2c78ee039a8e81ccc48fd34387 --- /dev/null +++ b/input/processor/aidl/default/include/inputprocessor-impl/InputProcessor.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 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. + */ + +#pragma once + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace input { +namespace processor { + +class InputProcessor : public ::aidl::android::hardware::input::processor::BnInputProcessor { + public: + ::ndk::ScopedAStatus classify( + const ::aidl::android::hardware::input::common::MotionEvent& in_event, + ::aidl::android::hardware::input::common::Classification* _aidl_return) override; + ::ndk::ScopedAStatus reset() override; + ::ndk::ScopedAStatus resetDevice(int32_t in_deviceId) override; +}; + +} // namespace processor +} // namespace input +} // namespace hardware +} // namespace android +} // namespace aidl \ No newline at end of file diff --git a/input/processor/aidl/default/inputprocessor-default.rc b/input/processor/aidl/default/inputprocessor-default.rc new file mode 100644 index 0000000000000000000000000000000000000000..bcc6c02435d061014c439928306fbcb9c1060e29 --- /dev/null +++ b/input/processor/aidl/default/inputprocessor-default.rc @@ -0,0 +1,4 @@ +service vendor.inputprocessor-default /vendor/bin/hw/android.hardware.input.processor-service.example + class hal + user nobody + group nobody \ No newline at end of file diff --git a/input/processor/aidl/default/main.cpp b/input/processor/aidl/default/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7b519dd66794f7c55dfcbf22b50df4e51a3b1400 --- /dev/null +++ b/input/processor/aidl/default/main.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 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. + */ + +#include "inputprocessor-impl/InputProcessor.h" + +#include +#include +#include + +using ::aidl::android::hardware::input::processor::IInputProcessor; +using ::aidl::android::hardware::input::processor::InputProcessor; + +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(0); + + auto processor = ndk::SharedRefBase::make(); + const std::string name = std::string() + InputProcessor::descriptor + "/default"; + binder_status_t status = AServiceManager_addService(processor->asBinder().get(), name.c_str()); + CHECK_EQ(status, STATUS_OK); + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} \ No newline at end of file diff --git a/ir/aidl/Android.bp b/ir/aidl/Android.bp index a623491c36103321c247779b1d6ab90791ad0a3d..25f6c8f41710ec9faf91f4b8fb8ee8dd572c9546 100644 --- a/ir/aidl/Android.bp +++ b/ir/aidl/Android.bp @@ -33,11 +33,12 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - // TODO(b/206116595) enable this - enabled: false, - }, - }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + } diff --git a/ir/aidl/aidl_api/android.hardware.ir/1/.hash b/ir/aidl/aidl_api/android.hardware.ir/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..30d216650f8ad1a65ba5d900593e395c2f54aad6 --- /dev/null +++ b/ir/aidl/aidl_api/android.hardware.ir/1/.hash @@ -0,0 +1 @@ +3e04aed366e96850c6164287eaf78a8e4ab071b0 diff --git a/ir/aidl/aidl_api/android.hardware.ir/1/android/hardware/ir/ConsumerIrFreqRange.aidl b/ir/aidl/aidl_api/android.hardware.ir/1/android/hardware/ir/ConsumerIrFreqRange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4a0d2869387dd05a9a6e26571e5d39e2b5d81551 --- /dev/null +++ b/ir/aidl/aidl_api/android.hardware.ir/1/android/hardware/ir/ConsumerIrFreqRange.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.ir; +@VintfStability +parcelable ConsumerIrFreqRange { + int minHz; + int maxHz; +} diff --git a/ir/aidl/aidl_api/android.hardware.ir/1/android/hardware/ir/IConsumerIr.aidl b/ir/aidl/aidl_api/android.hardware.ir/1/android/hardware/ir/IConsumerIr.aidl new file mode 100644 index 0000000000000000000000000000000000000000..07bf4b4af2fdcb93907f8a884e06df39ac144777 --- /dev/null +++ b/ir/aidl/aidl_api/android.hardware.ir/1/android/hardware/ir/IConsumerIr.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.ir; +@VintfStability +interface IConsumerIr { + android.hardware.ir.ConsumerIrFreqRange[] getCarrierFreqs(); + void transmit(in int carrierFreqHz, in int[] pattern); +} diff --git a/light/aidl/Android.bp b/light/aidl/Android.bp index e7142128c6cf884e2d9b5495526b63d603dbcd49..c11934f5271acecadf31092ab1ad5d9d5b448e94 100644 --- a/light/aidl/Android.bp +++ b/light/aidl/Android.bp @@ -19,5 +19,16 @@ aidl_interface { sdk_version: "module_current", }, }, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: [], + }, + { + version: "2", + imports: [], + }, + + ], + } diff --git a/light/aidl/aidl_api/android.hardware.light/2/.hash b/light/aidl/aidl_api/android.hardware.light/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..d27f4ad9d423f94bb88f5de6489b4a8e83feb29d --- /dev/null +++ b/light/aidl/aidl_api/android.hardware.light/2/.hash @@ -0,0 +1 @@ +c8b1e8ebb88c57dcb2c350a8d9b722e77dd864c8 diff --git a/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/BrightnessMode.aidl b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/BrightnessMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..881390764f814e1eeafc0eadc98a2cc09fdb0baf --- /dev/null +++ b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/BrightnessMode.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.light; +@VintfStability +enum BrightnessMode { + USER = 0, + SENSOR = 1, + LOW_PERSISTENCE = 2, +} diff --git a/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/FlashMode.aidl b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/FlashMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0411f82904633065d537a4f1c8e11b408a9ac0db --- /dev/null +++ b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/FlashMode.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.light; +@VintfStability +enum FlashMode { + NONE = 0, + TIMED = 1, + HARDWARE = 2, +} diff --git a/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/HwLight.aidl b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/HwLight.aidl new file mode 100644 index 0000000000000000000000000000000000000000..25a2dce37d688c8e7bf3dc26bcf5b9ba3a895495 --- /dev/null +++ b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/HwLight.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.light; +@VintfStability +parcelable HwLight { + int id; + int ordinal; + android.hardware.light.LightType type; +} diff --git a/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/HwLightState.aidl b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/HwLightState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..40e520b796f9c7f27c18230f4721bca1f91fc23a --- /dev/null +++ b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/HwLightState.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.light; +@VintfStability +parcelable HwLightState { + int color; + android.hardware.light.FlashMode flashMode; + int flashOnMs; + int flashOffMs; + android.hardware.light.BrightnessMode brightnessMode; +} diff --git a/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/ILights.aidl b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/ILights.aidl new file mode 100644 index 0000000000000000000000000000000000000000..30bb3c3d8bc79478f51e198de9ca2a7f5a285470 --- /dev/null +++ b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/ILights.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.light; +@VintfStability +interface ILights { + void setLightState(in int id, in android.hardware.light.HwLightState state); + android.hardware.light.HwLight[] getLights(); +} diff --git a/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/LightType.aidl b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/LightType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b978ab8d5b82a4e405ee19feb8a583581dea334 --- /dev/null +++ b/light/aidl/aidl_api/android.hardware.light/2/android/hardware/light/LightType.aidl @@ -0,0 +1,47 @@ +/* + * 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 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 -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.light; +@VintfStability +enum LightType { + BACKLIGHT = 0, + KEYBOARD = 1, + BUTTONS = 2, + BATTERY = 3, + NOTIFICATIONS = 4, + ATTENTION = 5, + BLUETOOTH = 6, + WIFI = 7, + MICROPHONE = 8, + CAMERA = 9, +} 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 c4c6d64786008668c7526fd2ab7f170898eea35e..881390764f814e1eeafc0eadc98a2cc09fdb0baf 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 -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 349f9f321c7564f2c5f16164d15320d8253ac41f..0411f82904633065d537a4f1c8e11b408a9ac0db 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 -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 c397f91060ae6975a29853d1a5dd828fa041638d..25a2dce37d688c8e7bf3dc26bcf5b9ba3a895495 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 -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 44a088234f70c74a9010e5f33b77e541406d0c8a..40e520b796f9c7f27c18230f4721bca1f91fc23a 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 -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 fc6c6265af5948ce2ab1683e7fe368cd925f5c07..30bb3c3d8bc79478f51e198de9ca2a7f5a285470 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 -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 77ab98c1cfa4dc64b7ffb61d6fccdafc73b7fe3f..2b978ab8d5b82a4e405ee19feb8a583581dea334 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 -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 @@ enum LightType { 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 9a7f65619d1cd5f4d862bac7f443e12d3b083693..f7161d04d371531d8ae3fb96496f3b60b3e1b795 100644 --- a/light/aidl/android/hardware/light/LightType.aidl +++ b/light/aidl/android/hardware/light/LightType.aidl @@ -32,4 +32,5 @@ enum LightType { BLUETOOTH = 6, WIFI = 7, MICROPHONE = 8, + CAMERA = 9, } diff --git a/light/aidl/default/Android.bp b/light/aidl/default/Android.bp index 2ccf1407fddf3d65c886bc579ab2e234d8806566..7920503ac51d50ba66e9bd024bb0537538bdf26d 100644 --- a/light/aidl/default/Android.bp +++ b/light/aidl/default/Android.bp @@ -16,7 +16,7 @@ cc_binary { 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 db604d61f0291a373c2f5b9599c6b017e9035d59..abdd74e491a85e8711918cb577a9be1a53f2eede 100644 --- a/light/aidl/default/lights-default.xml +++ b/light/aidl/default/lights-default.xml @@ -1,6 +1,7 @@ android.hardware.light + 2 ILights/default diff --git a/light/aidl/vts/functional/Android.bp b/light/aidl/vts/functional/Android.bp index c5a85620d2673b177988b31a6d620285f4cc5bd4..16804ea09fcc32fd511de8ff92c8a95ee84b1e21 100644 --- a/light/aidl/vts/functional/Android.bp +++ b/light/aidl/vts/functional/Android.bp @@ -36,7 +36,7 @@ cc_test { "libbinder", ], static_libs: [ - "android.hardware.light-V1-cpp", + "android.hardware.light-V2-cpp", ], test_suites: [ "vts", diff --git a/media/1.0/Android.bp b/media/1.0/Android.bp index 6e823f6e4dbf19ea1895c53acc2613ca1455bf40..22a6d59f6f144a4197ad755e32d38d353aedbc5b 100644 --- a/media/1.0/Android.bp +++ b/media/1.0/Android.bp @@ -22,4 +22,8 @@ hidl_interface { "android.hardware.graphics.common@1.0", ], gen_java: true, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], } diff --git a/media/bufferpool/2.0/Android.bp b/media/bufferpool/2.0/Android.bp index 01273c11d640b1310f5a26eb908a460c7cf91d6b..56597db3967c1d9827e6bc7ec6a4474762f6d209 100644 --- a/media/bufferpool/2.0/Android.bp +++ b/media/bufferpool/2.0/Android.bp @@ -26,4 +26,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], } diff --git a/media/c2/1.0/Android.bp b/media/c2/1.0/Android.bp index dc56fef7d8c9bc746e9b7f631858ae19f2e52306..a591dc770239bf1f9f6018da8c22eb935808f1a2 100644 --- a/media/c2/1.0/Android.bp +++ b/media/c2/1.0/Android.bp @@ -36,4 +36,9 @@ hidl_interface { "android.hidl.safe_union@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/media/c2/1.1/Android.bp b/media/c2/1.1/Android.bp index 885a4c8845f65dd980407e480c5f0dc1a2e56d4d..bec3a068f382a4dbdeab60e98c2e810da9fb7bb7 100644 --- a/media/c2/1.1/Android.bp +++ b/media/c2/1.1/Android.bp @@ -30,4 +30,9 @@ hidl_interface { "android.hidl.safe_union@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], } diff --git a/media/omx/1.0/Android.bp b/media/omx/1.0/Android.bp index e33bab39ddaf9012bca7f6d7d759bf810e21ff24..ea6346758d29b02d7a59b2be13f1fd3271b849df 100644 --- a/media/omx/1.0/Android.bp +++ b/media/omx/1.0/Android.bp @@ -31,4 +31,8 @@ hidl_interface { "android.hidl.base@1.0", ], gen_java: false, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], } diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp old mode 100644 new mode 100755 index 5fa13e7c5a8935d58969ec999e57a2e0bf763566..00e983771074ef4c0a0d5746ac5c2cece1d88d2c --- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp +++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp @@ -375,6 +375,11 @@ TEST_P(StoreHidlTest, ListRoles) { } static int getFirstApiLevel() { + int boardApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0); + if (boardApiLevel != 0) { + return boardApiLevel; + } + return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__); } @@ -395,9 +400,18 @@ TEST_P(StoreHidlTest, OmxCodecAllowedTest) { << " Component: " << info.mName.c_str() << " Role: " << role.c_str() << " not allowed for devices launching with Android T and above"; } else { - ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__) + std::string codecName = info.mName; + bool isAndroidCodec = (codecName.rfind("OMX.google", 0) != std::string::npos); + if (isAndroidCodec && (getFirstApiLevel() <= __ANDROID_API_S__)) { + // refer b/230582620 + // S AOSP build did not remove the OMX.google video codecs + // so it is infeasible to require no OMX.google.* video codecs + // on S launching devices + } else { + ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__) << " Component: " << info.mName.c_str() << " Role: " << role.c_str() << " not allowed for devices launching with Android S and above"; + } } } if (role.find("audio_decoder") != std::string::npos || diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp index aa4c4b634ddb61bf0894111cf76620dc23c7ea52..db1188d814d443ae26f9679abb901aa4c81494c0 100644 --- a/neuralnetworks/aidl/Android.bp +++ b/neuralnetworks/aidl/Android.bp @@ -17,7 +17,7 @@ aidl_interface { stability: "vintf", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V2", + "android.hardware.graphics.common-V3", ], backend: { java: { @@ -35,9 +35,36 @@ aidl_interface { min_sdk_version: "30", }, }, - versions: [ - "1", - "2", - "3", + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V3", + ], + }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V3", + ], + }, + { + version: "3", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V3", + ], + }, + { + version: "4", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V3", + ], + }, + ], + } diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/.hash b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/.hash new file mode 100644 index 0000000000000000000000000000000000000000..81025c7a1ade920938226b0c882fb892ef50091c --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/.hash @@ -0,0 +1 @@ +53178f8de9b8861df391cf0593f6f3e08adad33d diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/BufferDesc.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/BufferDesc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..05cec76c886140e09456994ef809b0e3c1dcff66 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/BufferDesc.aidl @@ -0,0 +1,38 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable BufferDesc { + int[] dimensions; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/BufferRole.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/BufferRole.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10a6b75ac7a3ab2eb1e0d4fea72ef7eecf1d46a7 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/BufferRole.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable BufferRole { + int modelIndex; + int ioIndex; + float probability; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Capabilities.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Capabilities.aidl new file mode 100644 index 0000000000000000000000000000000000000000..30877c0294f9b4fdc8a020e42d7d2d37d47f28db --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Capabilities.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Capabilities { + android.hardware.neuralnetworks.PerformanceInfo relaxedFloat32toFloat16PerformanceScalar; + android.hardware.neuralnetworks.PerformanceInfo relaxedFloat32toFloat16PerformanceTensor; + android.hardware.neuralnetworks.OperandPerformance[] operandPerformance; + android.hardware.neuralnetworks.PerformanceInfo ifPerformance; + android.hardware.neuralnetworks.PerformanceInfo whilePerformance; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DataLocation.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DataLocation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..db49a3897993518d4d3d4eb8acc722205d1adce5 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DataLocation.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable DataLocation { + int poolIndex; + long offset; + long length; + long padding; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DeviceBuffer.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DeviceBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7cdd6db742d6a1950341dd047771283be7c541c9 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DeviceBuffer.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable DeviceBuffer { + android.hardware.neuralnetworks.IBuffer buffer; + int token; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DeviceType.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DeviceType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82fe8ae3e73e952e0744cb89e852335bb3f6d02e --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/DeviceType.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum DeviceType { + OTHER = 1, + CPU = 2, + GPU = 3, + ACCELERATOR = 4, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ErrorStatus.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ErrorStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57d5d6e4cd1e7ded8aeb334d65bd9122a37a800d --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ErrorStatus.aidl @@ -0,0 +1,46 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum ErrorStatus { + NONE = 0, + DEVICE_UNAVAILABLE = 1, + GENERAL_FAILURE = 2, + OUTPUT_INSUFFICIENT_SIZE = 3, + INVALID_ARGUMENT = 4, + MISSED_DEADLINE_TRANSIENT = 5, + MISSED_DEADLINE_PERSISTENT = 6, + RESOURCE_EXHAUSTED_TRANSIENT = 7, + RESOURCE_EXHAUSTED_PERSISTENT = 8, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionConfig.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cb85743a0122ba750517b2c603e2a5b5f6d0a2e0 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionConfig.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 -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.neuralnetworks; +@VintfStability +parcelable ExecutionConfig { + boolean measureTiming; + long loopTimeoutDurationNs; + android.hardware.neuralnetworks.TokenValuePair[] executionHints; + android.hardware.neuralnetworks.ExtensionNameAndPrefix[] extensionNameToPrefix; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionPreference.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionPreference.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4352d8f3347c3eea7006138bb416a2bce99ff174 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionPreference.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum ExecutionPreference { + LOW_POWER = 0, + FAST_SINGLE_ANSWER = 1, + SUSTAINED_SPEED = 2, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionResult.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..44e9922f52e9c258d299c1d2e1e007c1394e3776 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExecutionResult.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.neuralnetworks; +@VintfStability +parcelable ExecutionResult { + boolean outputSufficientSize; + android.hardware.neuralnetworks.OutputShape[] outputShapes; + android.hardware.neuralnetworks.Timing timing; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Extension.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Extension.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c47028d99fcd49c399a7c3bd92047c09a402d065 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Extension.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Extension { + String name; + android.hardware.neuralnetworks.ExtensionOperandTypeInformation[] operandTypes; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExtensionNameAndPrefix.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExtensionNameAndPrefix.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6c287fd4603b33b0c2bdaab60a730025d58236d8 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExtensionNameAndPrefix.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable ExtensionNameAndPrefix { + String name; + char prefix; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a3680aa9dd57b32af09bb7fa34efe5a9053a4078 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable ExtensionOperandTypeInformation { + char type; + boolean isTensor; + int byteSize; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/FencedExecutionResult.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/FencedExecutionResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7952b346325df543d2d053cef59a9db60e2e71dd --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/FencedExecutionResult.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.neuralnetworks; +@VintfStability +parcelable FencedExecutionResult { + android.hardware.neuralnetworks.IFencedExecutionCallback callback; + @nullable ParcelFileDescriptor syncFence; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/FusedActivationFunc.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/FusedActivationFunc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e61bbbdb181aaf2ea58b836a53df38411373814 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/FusedActivationFunc.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum FusedActivationFunc { + NONE = 0, + RELU = 1, + RELU1 = 2, + RELU6 = 3, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IBuffer.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IBuffer.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f10e7e24cad45b658d8c31f247ed9e5ce8acdbda --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IBuffer.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +interface IBuffer { + void copyFrom(in android.hardware.neuralnetworks.Memory src, in int[] dimensions); + void copyTo(in android.hardware.neuralnetworks.Memory dst); +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IBurst.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IBurst.aidl new file mode 100644 index 0000000000000000000000000000000000000000..461fdfa2c634e116d5f2591264a4a27ef8e73e75 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IBurst.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.neuralnetworks; +@VintfStability +interface IBurst { + android.hardware.neuralnetworks.ExecutionResult executeSynchronously(in android.hardware.neuralnetworks.Request request, in long[] memoryIdentifierTokens, in boolean measureTiming, in long deadlineNs, in long loopTimeoutDurationNs); + void releaseMemoryResource(in long memoryIdentifierToken); + android.hardware.neuralnetworks.ExecutionResult executeSynchronouslyWithConfig(in android.hardware.neuralnetworks.Request request, in long[] memoryIdentifierTokens, in android.hardware.neuralnetworks.ExecutionConfig config, in long deadlineNs); +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IDevice.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IDevice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c0fba47d0e1d33c84d4e43238e779f3f35d6ac7a --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IDevice.aidl @@ -0,0 +1,53 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +interface IDevice { + android.hardware.neuralnetworks.DeviceBuffer allocate(in android.hardware.neuralnetworks.BufferDesc desc, in android.hardware.neuralnetworks.IPreparedModelParcel[] preparedModels, in android.hardware.neuralnetworks.BufferRole[] inputRoles, in android.hardware.neuralnetworks.BufferRole[] outputRoles); + android.hardware.neuralnetworks.Capabilities getCapabilities(); + android.hardware.neuralnetworks.NumberOfCacheFiles getNumberOfCacheFilesNeeded(); + android.hardware.neuralnetworks.Extension[] getSupportedExtensions(); + boolean[] getSupportedOperations(in android.hardware.neuralnetworks.Model model); + android.hardware.neuralnetworks.DeviceType getType(); + String getVersionString(); + void prepareModel(in android.hardware.neuralnetworks.Model model, in android.hardware.neuralnetworks.ExecutionPreference preference, in android.hardware.neuralnetworks.Priority priority, in long deadlineNs, in ParcelFileDescriptor[] modelCache, in ParcelFileDescriptor[] dataCache, in byte[] token, in android.hardware.neuralnetworks.IPreparedModelCallback callback); + void prepareModelFromCache(in long deadlineNs, in ParcelFileDescriptor[] modelCache, in ParcelFileDescriptor[] dataCache, in byte[] token, in android.hardware.neuralnetworks.IPreparedModelCallback callback); + void prepareModelWithConfig(in android.hardware.neuralnetworks.Model model, in android.hardware.neuralnetworks.PrepareModelConfig config, in android.hardware.neuralnetworks.IPreparedModelCallback callback); + const int BYTE_SIZE_OF_CACHE_TOKEN = 32; + const int MAX_NUMBER_OF_CACHE_FILES = 32; + const int EXTENSION_TYPE_HIGH_BITS_PREFIX = 15; + const int EXTENSION_TYPE_LOW_BITS_TYPE = 16; + const int OPERAND_TYPE_BASE_MAX = 65535; + const int OPERATION_TYPE_BASE_MAX = 65535; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IExecution.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IExecution.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ab5275e58247f798a861e785d04a2210f991ba95 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IExecution.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.neuralnetworks; +@VintfStability +interface IExecution { + android.hardware.neuralnetworks.ExecutionResult executeSynchronously(in long deadlineNs); + android.hardware.neuralnetworks.FencedExecutionResult executeFenced(in ParcelFileDescriptor[] waitFor, in long deadlineNs, in long durationNs); +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IFencedExecutionCallback.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IFencedExecutionCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0bfb80ac789139c897bff489f4599b2fafe7c661 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IFencedExecutionCallback.aidl @@ -0,0 +1,38 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +interface IFencedExecutionCallback { + android.hardware.neuralnetworks.ErrorStatus getExecutionInfo(out android.hardware.neuralnetworks.Timing timingLaunched, out android.hardware.neuralnetworks.Timing timingFenced); +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModel.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fb0c372267e962137e9b2bf1b1411707c1cef9c1 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModel.aidl @@ -0,0 +1,45 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +interface IPreparedModel { + android.hardware.neuralnetworks.ExecutionResult executeSynchronously(in android.hardware.neuralnetworks.Request request, in boolean measureTiming, in long deadlineNs, in long loopTimeoutDurationNs); + android.hardware.neuralnetworks.FencedExecutionResult executeFenced(in android.hardware.neuralnetworks.Request request, in ParcelFileDescriptor[] waitFor, in boolean measureTiming, in long deadlineNs, in long loopTimeoutDurationNs, in long durationNs); + android.hardware.neuralnetworks.IBurst configureExecutionBurst(); + android.hardware.neuralnetworks.IExecution createReusableExecution(in android.hardware.neuralnetworks.Request request, in android.hardware.neuralnetworks.ExecutionConfig config); + android.hardware.neuralnetworks.ExecutionResult executeSynchronouslyWithConfig(in android.hardware.neuralnetworks.Request request, in android.hardware.neuralnetworks.ExecutionConfig config, in long deadlineNs); + android.hardware.neuralnetworks.FencedExecutionResult executeFencedWithConfig(in android.hardware.neuralnetworks.Request request, in ParcelFileDescriptor[] waitFor, in android.hardware.neuralnetworks.ExecutionConfig config, in long deadlineNs, in long durationNs); + const long DEFAULT_LOOP_TIMEOUT_DURATION_NS = 2000000000; + const long MAXIMUM_LOOP_TIMEOUT_DURATION_NS = 15000000000; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModelCallback.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModelCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e0c763bc2a710769dd688a2d092b799372f20598 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModelCallback.aidl @@ -0,0 +1,38 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +interface IPreparedModelCallback { + void notify(in android.hardware.neuralnetworks.ErrorStatus status, in android.hardware.neuralnetworks.IPreparedModel preparedModel); +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModelParcel.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModelParcel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dbedf127722a4805707df3ea94748f8f659daee8 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/IPreparedModelParcel.aidl @@ -0,0 +1,38 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable IPreparedModelParcel { + android.hardware.neuralnetworks.IPreparedModel preparedModel; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Memory.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Memory.aidl new file mode 100644 index 0000000000000000000000000000000000000000..37fa102cf4ea828021567f29604512d185aaa9e8 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Memory.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +union Memory { + android.hardware.common.Ashmem ashmem; + android.hardware.common.MappableFile mappableFile; + android.hardware.graphics.common.HardwareBuffer hardwareBuffer; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Model.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Model.aidl new file mode 100644 index 0000000000000000000000000000000000000000..30d8dda55de03ad11c2a06b8c5a8ecbb8d835b16 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Model.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Model { + android.hardware.neuralnetworks.Subgraph main; + android.hardware.neuralnetworks.Subgraph[] referenced; + byte[] operandValues; + android.hardware.neuralnetworks.Memory[] pools; + boolean relaxComputationFloat32toFloat16; + android.hardware.neuralnetworks.ExtensionNameAndPrefix[] extensionNameToPrefix; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/NumberOfCacheFiles.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/NumberOfCacheFiles.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9314760a4397846562bc2d7c71a72eed307592d1 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/NumberOfCacheFiles.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable NumberOfCacheFiles { + int numModelCache; + int numDataCache; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Operand.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Operand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1d9bdd844617009ae0dc1a332d9d70dbc7463e11 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Operand.aidl @@ -0,0 +1,44 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Operand { + android.hardware.neuralnetworks.OperandType type = android.hardware.neuralnetworks.OperandType.FLOAT32; + int[] dimensions; + float scale; + int zeroPoint; + android.hardware.neuralnetworks.OperandLifeTime lifetime = android.hardware.neuralnetworks.OperandLifeTime.TEMPORARY_VARIABLE; + android.hardware.neuralnetworks.DataLocation location; + @nullable android.hardware.neuralnetworks.OperandExtraParams extraParams; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandExtraParams.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandExtraParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..14792cff089f918b3d6e6881a8568ab3709b83ac --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandExtraParams.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +union OperandExtraParams { + android.hardware.neuralnetworks.SymmPerChannelQuantParams channelQuant; + byte[] extension; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandLifeTime.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandLifeTime.aidl new file mode 100644 index 0000000000000000000000000000000000000000..40adfb1dd803dfb9e568e22ff74135a6e0212111 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandLifeTime.aidl @@ -0,0 +1,44 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum OperandLifeTime { + TEMPORARY_VARIABLE = 0, + SUBGRAPH_INPUT = 1, + SUBGRAPH_OUTPUT = 2, + CONSTANT_COPY = 3, + CONSTANT_POOL = 4, + NO_VALUE = 5, + SUBGRAPH = 6, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandPerformance.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandPerformance.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ebb361b7629c7a58d07b4c104961fe31f897e55a --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandPerformance.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable OperandPerformance { + android.hardware.neuralnetworks.OperandType type = android.hardware.neuralnetworks.OperandType.FLOAT32; + android.hardware.neuralnetworks.PerformanceInfo info; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandType.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9f2c759d383b90af6737fdf790115a64aecb7443 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperandType.aidl @@ -0,0 +1,53 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum OperandType { + FLOAT32 = 0, + INT32 = 1, + UINT32 = 2, + TENSOR_FLOAT32 = 3, + TENSOR_INT32 = 4, + TENSOR_QUANT8_ASYMM = 5, + BOOL = 6, + TENSOR_QUANT16_SYMM = 7, + TENSOR_FLOAT16 = 8, + TENSOR_BOOL8 = 9, + FLOAT16 = 10, + TENSOR_QUANT8_SYMM_PER_CHANNEL = 11, + TENSOR_QUANT16_ASYMM = 12, + TENSOR_QUANT8_SYMM = 13, + TENSOR_QUANT8_ASYMM_SIGNED = 14, + SUBGRAPH = 15, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Operation.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Operation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a4a3fbee60c1eb517846eccc00f060c68a58ad1a --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Operation.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Operation { + android.hardware.neuralnetworks.OperationType type = android.hardware.neuralnetworks.OperationType.ADD; + int[] inputs; + int[] outputs; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperationType.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..34506c88603a0c8e4b857fe72c9f20fd10db6c4a --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OperationType.aidl @@ -0,0 +1,143 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum OperationType { + ADD = 0, + AVERAGE_POOL_2D = 1, + CONCATENATION = 2, + CONV_2D = 3, + DEPTHWISE_CONV_2D = 4, + DEPTH_TO_SPACE = 5, + DEQUANTIZE = 6, + EMBEDDING_LOOKUP = 7, + FLOOR = 8, + FULLY_CONNECTED = 9, + HASHTABLE_LOOKUP = 10, + L2_NORMALIZATION = 11, + L2_POOL_2D = 12, + LOCAL_RESPONSE_NORMALIZATION = 13, + LOGISTIC = 14, + LSH_PROJECTION = 15, + LSTM = 16, + MAX_POOL_2D = 17, + MUL = 18, + RELU = 19, + RELU1 = 20, + RELU6 = 21, + RESHAPE = 22, + RESIZE_BILINEAR = 23, + RNN = 24, + SOFTMAX = 25, + SPACE_TO_DEPTH = 26, + SVDF = 27, + TANH = 28, + BATCH_TO_SPACE_ND = 29, + DIV = 30, + MEAN = 31, + PAD = 32, + SPACE_TO_BATCH_ND = 33, + SQUEEZE = 34, + STRIDED_SLICE = 35, + SUB = 36, + TRANSPOSE = 37, + ABS = 38, + ARGMAX = 39, + ARGMIN = 40, + AXIS_ALIGNED_BBOX_TRANSFORM = 41, + BIDIRECTIONAL_SEQUENCE_LSTM = 42, + BIDIRECTIONAL_SEQUENCE_RNN = 43, + BOX_WITH_NMS_LIMIT = 44, + CAST = 45, + CHANNEL_SHUFFLE = 46, + DETECTION_POSTPROCESSING = 47, + EQUAL = 48, + EXP = 49, + EXPAND_DIMS = 50, + GATHER = 51, + GENERATE_PROPOSALS = 52, + GREATER = 53, + GREATER_EQUAL = 54, + GROUPED_CONV_2D = 55, + HEATMAP_MAX_KEYPOINT = 56, + INSTANCE_NORMALIZATION = 57, + LESS = 58, + LESS_EQUAL = 59, + LOG = 60, + LOGICAL_AND = 61, + LOGICAL_NOT = 62, + LOGICAL_OR = 63, + LOG_SOFTMAX = 64, + MAXIMUM = 65, + MINIMUM = 66, + NEG = 67, + NOT_EQUAL = 68, + PAD_V2 = 69, + POW = 70, + PRELU = 71, + QUANTIZE = 72, + QUANTIZED_16BIT_LSTM = 73, + RANDOM_MULTINOMIAL = 74, + REDUCE_ALL = 75, + REDUCE_ANY = 76, + REDUCE_MAX = 77, + REDUCE_MIN = 78, + REDUCE_PROD = 79, + REDUCE_SUM = 80, + ROI_ALIGN = 81, + ROI_POOLING = 82, + RSQRT = 83, + SELECT = 84, + SIN = 85, + SLICE = 86, + SPLIT = 87, + SQRT = 88, + TILE = 89, + TOPK_V2 = 90, + TRANSPOSE_CONV_2D = 91, + UNIDIRECTIONAL_SEQUENCE_LSTM = 92, + UNIDIRECTIONAL_SEQUENCE_RNN = 93, + RESIZE_NEAREST_NEIGHBOR = 94, + QUANTIZED_LSTM = 95, + IF = 96, + WHILE = 97, + ELU = 98, + HARD_SWISH = 99, + FILL = 100, + RANK = 101, + BATCH_MATMUL = 102, + PACK = 103, + MIRROR_PAD = 104, + REVERSE = 105, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OutputShape.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OutputShape.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f7335054cfa9e8c5ad77b956cb84f43b08b2e8ef --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/OutputShape.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable OutputShape { + int[] dimensions; + boolean isSufficient; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/PerformanceInfo.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/PerformanceInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..04910f54107dc7a4d1137b0fb3cffc8dcf8b82ad --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/PerformanceInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable PerformanceInfo { + float execTime; + float powerUsage; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/PrepareModelConfig.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/PrepareModelConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1f44ba724fd946bc09f2b96720b8454437ccd886 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/PrepareModelConfig.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.neuralnetworks; +@VintfStability +parcelable PrepareModelConfig { + android.hardware.neuralnetworks.ExecutionPreference preference; + android.hardware.neuralnetworks.Priority priority; + long deadlineNs; + ParcelFileDescriptor[] modelCache; + ParcelFileDescriptor[] dataCache; + byte[32] cacheToken; + android.hardware.neuralnetworks.TokenValuePair[] compilationHints; + android.hardware.neuralnetworks.ExtensionNameAndPrefix[] extensionNameToPrefix; + const int BYTE_SIZE_OF_CACHE_TOKEN = 32; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Priority.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Priority.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8f357097abf894cc94ba95dfad5a17ae4f448bec --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Priority.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@Backing(type="int") @VintfStability +enum Priority { + LOW = 0, + MEDIUM = 1, + HIGH = 2, +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Request.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Request.aidl new file mode 100644 index 0000000000000000000000000000000000000000..39ec7a9acdbf2c7e79e1e2d496fb7b4f7417000e --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Request.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Request { + android.hardware.neuralnetworks.RequestArgument[] inputs; + android.hardware.neuralnetworks.RequestArgument[] outputs; + android.hardware.neuralnetworks.RequestMemoryPool[] pools; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/RequestArgument.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/RequestArgument.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e3541c0ece261a9af685c1cdcb67719248ce0077 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/RequestArgument.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable RequestArgument { + boolean hasNoValue; + android.hardware.neuralnetworks.DataLocation location; + int[] dimensions; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/RequestMemoryPool.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/RequestMemoryPool.aidl new file mode 100644 index 0000000000000000000000000000000000000000..312f5813bc0a663bd8c607e6cf8616ea4ef8ed54 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/RequestMemoryPool.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +union RequestMemoryPool { + android.hardware.neuralnetworks.Memory pool; + int token; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Subgraph.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Subgraph.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b7d44515f45b569d0ac5f96b5e31fe175f5c2b88 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Subgraph.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Subgraph { + android.hardware.neuralnetworks.Operand[] operands; + android.hardware.neuralnetworks.Operation[] operations; + int[] inputIndexes; + int[] outputIndexes; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/SymmPerChannelQuantParams.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/SymmPerChannelQuantParams.aidl new file mode 100644 index 0000000000000000000000000000000000000000..02d68f9ed168b363a850144832fb1be424ccbb5b --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/SymmPerChannelQuantParams.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable SymmPerChannelQuantParams { + float[] scales; + int channelDim; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Timing.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Timing.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bcc83cfbee38dd38b7e415f628d7056025cb385f --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/Timing.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.neuralnetworks; +@VintfStability +parcelable Timing { + long timeOnDeviceNs; + long timeInDriverNs; +} diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/TokenValuePair.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/TokenValuePair.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e477d6e555bde3cad3210e6c82f39cbfc4ed8e03 --- /dev/null +++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/4/android/hardware/neuralnetworks/TokenValuePair.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.neuralnetworks; +@VintfStability +parcelable TokenValuePair { + int token; + byte[] value; +} diff --git a/neuralnetworks/aidl/utils/Android.bp b/neuralnetworks/aidl/utils/Android.bp index 2b7b78704e38fd7a8b3b1cda176b530e889beaf4..325809213c7ad3853c625d3054cea3c2d0214064 100644 --- a/neuralnetworks/aidl/utils/Android.bp +++ b/neuralnetworks/aidl/utils/Android.bp @@ -38,7 +38,7 @@ cc_defaults { export_include_dirs: ["include"], cflags: ["-Wthread-safety"], static_libs: [ - "android.hardware.graphics.common-V2-ndk", + "android.hardware.graphics.common-V3-ndk", "libaidlcommonsupport", "libarect", "neuralnetworks_types", @@ -92,7 +92,7 @@ cc_defaults { name: "neuralnetworks_use_latest_utils_hal_aidl", static_libs: [ "android.hardware.common-V2-ndk", - "android.hardware.graphics.common-V2-ndk", + "android.hardware.graphics.common-V3-ndk", "android.hardware.neuralnetworks-V4-ndk", "neuralnetworks_utils_hal_aidl", ], diff --git a/nfc/aidl/Android.bp b/nfc/aidl/Android.bp index a2422b1a229ca30c4e5798cdfe826cb626f486d4..09a45d12dee35db7b8ca2e4fe63458a01d0a7a6c 100644 --- a/nfc/aidl/Android.bp +++ b/nfc/aidl/Android.bp @@ -35,4 +35,11 @@ aidl_interface { enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + } diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/.hash b/nfc/aidl/aidl_api/android.hardware.nfc/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..46ec1e2a338123f0c9f03490ff51b587d81d6feb --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/.hash @@ -0,0 +1 @@ +37acf94ceb095ad537b66c3bd77c30a6ad5f5b0e diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/INfc.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/INfc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7a0ae54963a7104b270a9bdfe834b3e4f4e87a8d --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/INfc.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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.nfc; +@VintfStability +interface INfc { + void open(in android.hardware.nfc.INfcClientCallback clientCallback); + void close(in android.hardware.nfc.NfcCloseType type); + void coreInitialized(); + void factoryReset(); + android.hardware.nfc.NfcConfig getConfig(); + void powerCycle(); + void preDiscover(); + int write(in byte[] data); + void setEnableVerboseLogging(in boolean enable); + boolean isVerboseLoggingEnabled(); +} diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/INfcClientCallback.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/INfcClientCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8150e818d7fbab89c04d6ded47ea6c83b78ef26f --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/INfcClientCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.nfc; +@VintfStability +interface INfcClientCallback { + void sendData(in byte[] data); + void sendEvent(in android.hardware.nfc.NfcEvent event, in android.hardware.nfc.NfcStatus status); +} diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcCloseType.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcCloseType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7d44d48e3eee721a3fd903200b2dca96d1829aac --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcCloseType.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.nfc; +@Backing(type="int") @VintfStability +enum NfcCloseType { + DISABLE = 0, + HOST_SWITCHED_OFF = 1, +} diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcConfig.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..92e0a9a82c18536e8361e6328670483aaffb2574 --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcConfig.aidl @@ -0,0 +1,52 @@ +/* + * 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 -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.nfc; +@VintfStability +parcelable NfcConfig { + boolean nfaPollBailOutMode; + android.hardware.nfc.PresenceCheckAlgorithm presenceCheckAlgorithm; + android.hardware.nfc.ProtocolDiscoveryConfig nfaProprietaryCfg; + byte defaultOffHostRoute; + byte defaultOffHostRouteFelica; + byte defaultSystemCodeRoute; + byte defaultSystemCodePowerState; + byte defaultRoute; + byte offHostESEPipeId; + byte offHostSIMPipeId; + int maxIsoDepTransceiveLength; + byte[] hostAllowlist; + byte[] offHostRouteUicc; + byte[] offHostRouteEse; + byte defaultIsoDepRoute; +} diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcEvent.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcEvent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dda258eb08e699528bd9f1cc629245a3dcf688ed --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcEvent.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.nfc; +@Backing(type="int") @VintfStability +enum NfcEvent { + OPEN_CPLT = 0, + CLOSE_CPLT = 1, + POST_INIT_CPLT = 2, + PRE_DISCOVER_CPLT = 3, + HCI_NETWORK_RESET = 4, + ERROR = 5, +} diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcStatus.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2632480bdbfe4b93544ae5f0c5dd2a8f93117f17 --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/NfcStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.nfc; +@Backing(type="int") @VintfStability +enum NfcStatus { + OK = 0, + FAILED = 1, + ERR_TRANSPORT = 2, + ERR_CMD_TIMEOUT = 3, + REFUSED = 4, +} diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/PresenceCheckAlgorithm.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/PresenceCheckAlgorithm.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9a9be215a605dfc87b95284196aa3e067d3c27f3 --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/PresenceCheckAlgorithm.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.nfc; +@Backing(type="byte") @VintfStability +enum PresenceCheckAlgorithm { + DEFAULT = 0, + I_BLOCK = 1, + ISO_DEP_NAK = 2, +} diff --git a/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/ProtocolDiscoveryConfig.aidl b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/ProtocolDiscoveryConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..021dfe22d4e46c69ed5244601963b05fd00b6661 --- /dev/null +++ b/nfc/aidl/aidl_api/android.hardware.nfc/1/android/hardware/nfc/ProtocolDiscoveryConfig.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.nfc; +@VintfStability +parcelable ProtocolDiscoveryConfig { + byte protocol18092Active; + byte protocolBPrime; + byte protocolDual; + byte protocol15693; + byte protocolKovio; + byte protocolMifare; + byte discoveryPollKovio; + byte discoveryPollBPrime; + byte discoveryListenBPrime; +} diff --git a/power/aidl/Android.bp b/power/aidl/Android.bp index 63a40ed015f8020a9594c2cc9ab4a8ef2f0bf0a1..70b1203031e901924b9db377a721bfcc0556ec1f 100644 --- a/power/aidl/Android.bp +++ b/power/aidl/Android.bp @@ -36,8 +36,20 @@ aidl_interface { platform_apis: true, }, }, - versions: [ - "1", - "2", + versions_with_info: [ + { + version: "1", + imports: [], + }, + { + version: "2", + imports: [], + }, + { + version: "3", + imports: [], + }, + ], + } diff --git a/power/aidl/aidl_api/android.hardware.power/3/.hash b/power/aidl/aidl_api/android.hardware.power/3/.hash new file mode 100644 index 0000000000000000000000000000000000000000..c697a13c1d217dfe5fbe770da3e6fe909458d4e0 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/3/.hash @@ -0,0 +1 @@ +fd3434f993d791e75d959a042010dd6fca13e33c diff --git a/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/Boost.aidl b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/Boost.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c792d4e0c21c84249e4da7adda65a34ed1150ba4 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/Boost.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.power; +@Backing(type="int") @VintfStability +enum Boost { + INTERACTION = 0, + DISPLAY_UPDATE_IMMINENT = 1, + ML_ACC = 2, + AUDIO_LAUNCH = 3, + CAMERA_LAUNCH = 4, + CAMERA_SHOT = 5, +} diff --git a/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/IPower.aidl b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/IPower.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ae03313f11ed79eede8281bb92eef1e624408ebf --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/IPower.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.power; +@VintfStability +interface IPower { + oneway void setMode(in android.hardware.power.Mode type, in boolean enabled); + boolean isModeSupported(in android.hardware.power.Mode type); + oneway void setBoost(in android.hardware.power.Boost type, in int durationMs); + boolean isBoostSupported(in android.hardware.power.Boost type); + android.hardware.power.IPowerHintSession createHintSession(in int tgid, in int uid, in int[] threadIds, in long durationNanos); + long getHintSessionPreferredRate(); +} diff --git a/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/IPowerHintSession.aidl b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/IPowerHintSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1d3ecb7eee7dfbd24b7ccc473e7466f8621c9518 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/IPowerHintSession.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.power; +@VintfStability +interface IPowerHintSession { + oneway void updateTargetWorkDuration(long targetDurationNanos); + oneway void reportActualWorkDuration(in android.hardware.power.WorkDuration[] durations); + oneway void pause(); + oneway void resume(); + oneway void close(); +} diff --git a/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/Mode.aidl b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/Mode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f38426b785343b6e0f6a47f4f1b0cbca02c5fcf5 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/Mode.aidl @@ -0,0 +1,54 @@ +/* + * 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 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 -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.power; +@Backing(type="int") @VintfStability +enum Mode { + DOUBLE_TAP_TO_WAKE = 0, + LOW_POWER = 1, + SUSTAINED_PERFORMANCE = 2, + FIXED_PERFORMANCE = 3, + VR = 4, + LAUNCH = 5, + EXPENSIVE_RENDERING = 6, + INTERACTIVE = 7, + DEVICE_IDLE = 8, + DISPLAY_INACTIVE = 9, + AUDIO_STREAMING_LOW_LATENCY = 10, + CAMERA_STREAMING_SECURE = 11, + CAMERA_STREAMING_LOW = 12, + CAMERA_STREAMING_MID = 13, + CAMERA_STREAMING_HIGH = 14, + GAME = 15, + GAME_LOADING = 16, +} diff --git a/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/WorkDuration.aidl b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/WorkDuration.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e86cd40ec29b431889cdfb7d1d6d824b196dd67c --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/3/android/hardware/power/WorkDuration.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.power; +@VintfStability +parcelable WorkDuration { + long timeStampNanos; + long durationNanos; +} diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl index 8920c014e37bf224a121ad212c78b2e82bfcde04..f38426b785343b6e0f6a47f4f1b0cbca02c5fcf5 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/Mode.aidl @@ -49,4 +49,6 @@ enum Mode { CAMERA_STREAMING_LOW = 12, CAMERA_STREAMING_MID = 13, CAMERA_STREAMING_HIGH = 14, + GAME = 15, + GAME_LOADING = 16, } diff --git a/power/aidl/android/hardware/power/Mode.aidl b/power/aidl/android/hardware/power/Mode.aidl index ae113e3799c094af8e6e2f4fdf1c834768e2f7a2..cc4b1308d25ef160ead31770d3b04b0ebddfc565 100644 --- a/power/aidl/android/hardware/power/Mode.aidl +++ b/power/aidl/android/hardware/power/Mode.aidl @@ -162,4 +162,14 @@ enum Mode { * This hint indicates that camera high resolution stream is being started. */ CAMERA_STREAMING_HIGH, + + /** + * This mode indicates that user is playing a game. + */ + GAME, + + /** + * This mode indicates that the user is waiting for loading in a game. + */ + GAME_LOADING, } diff --git a/power/aidl/default/Android.bp b/power/aidl/default/Android.bp index 9acb9e044e0d4fd8f81d7ced4887e05626fa3712..223b9d5e6b831ba203a12d0d12dece663da039a2 100644 --- a/power/aidl/default/Android.bp +++ b/power/aidl/default/Android.bp @@ -30,7 +30,7 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.power-V2-ndk", + "android.hardware.power-V3-ndk", ], srcs: [ "main.cpp", diff --git a/power/aidl/default/power-default.xml b/power/aidl/default/power-default.xml index 9f56debdae5239484dff2a8aeb927515833e4fb8..927ba22dbf7fb7c625796a79579912ca29bae90e 100644 --- a/power/aidl/default/power-default.xml +++ b/power/aidl/default/power-default.xml @@ -1,7 +1,7 @@ android.hardware.power - 2 + 3 IPower/default diff --git a/power/aidl/vts/Android.bp b/power/aidl/vts/Android.bp index eccd87271614297f7f8e66e611181150b5afdec8..ea398ac6b211ddaaee51c69201f0d3d57a63742e 100644 --- a/power/aidl/vts/Android.bp +++ b/power/aidl/vts/Android.bp @@ -32,7 +32,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.power-V2-ndk", + "android.hardware.power-V3-ndk", ], test_suites: [ "vts", diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index ffab66c3125b2b7a23ea0d0bf0aceac92ffdd4f4..2cfa04ada9b42e7588c639ed236ac24fc77b505a 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -201,10 +201,7 @@ TEST_P(PowerAidl, updateAndReportDurations) { // FIXED_PERFORMANCE mode is required for all devices which ship on Android 11 // or later TEST_P(PowerAidl, hasFixedPerformance) { - auto apiLevel = GetUintProperty("ro.product.first_api_level", 0); - if (apiLevel == 0) { - apiLevel = GetUintProperty("ro.build.version.sdk", 0); - } + auto apiLevel = GetUintProperty("ro.vendor.api_level", 0); ASSERT_NE(apiLevel, 0); if (apiLevel >= 30) { diff --git a/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp b/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp index c7ba96cec357f7f16cba011424b497e09b2fad1a..4ee14e3bd9569506ad0fa020913467d8b6261bee 100644 --- a/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp +++ b/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp @@ -65,6 +65,11 @@ class PowerStatsAidl : public testing::TestWithParam { template void testMatching(std::vector const& c1, R T::*f1, std::vector const& c2, R S::*f2); + bool containsTimedEntity(const std::string& str); + + void excludeTimedEntities(std::vector* entities, + std::vector* results); + std::shared_ptr powerstats; }; @@ -111,6 +116,29 @@ void PowerStatsAidl::testMatching(std::vector const& c1, R T::*f1, std::vecto EXPECT_EQ(c1fields, c2fields); } +bool PowerStatsAidl::containsTimedEntity(const std::string& str) { + // TODO(b/229698505): Extend PowerEntityInfo to identify timed power entity + return str.find("AoC") != std::string::npos; +} + +void PowerStatsAidl::excludeTimedEntities(std::vector* entities, + std::vector* results) { + for (auto it = entities->begin(); it != entities->end(); it++) { + if (containsTimedEntity((*it).name)) { + auto entityId = (*it).id; + entities->erase(it--); + + // Erase result element matching the entity ID + for (auto resultsIt = results->begin(); resultsIt != results->end(); resultsIt++) { + if ((*resultsIt).id == entityId) { + results->erase(resultsIt--); + break; + } + } + } + } +} + // Each PowerEntity must have a valid name TEST_P(PowerStatsAidl, ValidatePowerEntityNames) { std::vector infos; @@ -185,19 +213,20 @@ TEST_P(PowerStatsAidl, TestGetStateResidency) { ASSERT_OK(powerstats->getStateResidency({}, &results)); } -// State residency must return all results -TEST_P(PowerStatsAidl, TestGetStateResidencyAllResults) { +// State residency must return all results except timed power entities +TEST_P(PowerStatsAidl, TestGetStateResidencyAllResultsExceptTimedEntities) { std::vector entities; ASSERT_OK(powerstats->getPowerEntityInfo(&entities)); std::vector results; ASSERT_OK(powerstats->getStateResidency({}, &results)); + excludeTimedEntities(&entities, &results); testMatching(entities, &PowerEntity::id, results, &StateResidencyResult::id); } -// Each result must contain all state residencies -TEST_P(PowerStatsAidl, TestGetStateResidencyAllStateResidencies) { +// Each result must contain all state residencies except timed power entities +TEST_P(PowerStatsAidl, TestGetStateResidencyAllStateResidenciesExceptTimedEntities) { std::vector entities; ASSERT_OK(powerstats->getPowerEntityInfo(&entities)); @@ -205,16 +234,18 @@ TEST_P(PowerStatsAidl, TestGetStateResidencyAllStateResidencies) { ASSERT_OK(powerstats->getStateResidency({}, &results)); for (auto entity : entities) { - auto it = std::find_if(results.begin(), results.end(), - [&entity](const auto& x) { return x.id == entity.id; }); - ASSERT_NE(it, results.end()); + if (!containsTimedEntity(entity.name)) { + auto it = std::find_if(results.begin(), results.end(), + [&entity](const auto& x) { return x.id == entity.id; }); + ASSERT_NE(it, results.end()); - testMatching(entity.states, &State::id, it->stateResidencyData, &StateResidency::id); + testMatching(entity.states, &State::id, it->stateResidencyData, &StateResidency::id); + } } } -// State residency must return results for each requested power entity -TEST_P(PowerStatsAidl, TestGetStateResidencySelectedResults) { +// State residency must return results for each requested power entity except timed power entities +TEST_P(PowerStatsAidl, TestGetStateResidencySelectedResultsExceptTimedEntities) { std::vector entities; ASSERT_OK(powerstats->getPowerEntityInfo(&entities)); if (entities.empty()) { @@ -223,8 +254,12 @@ TEST_P(PowerStatsAidl, TestGetStateResidencySelectedResults) { std::vector selectedEntities = getRandomSubset(entities); std::vector selectedIds; - for (auto const& entity : selectedEntities) { - selectedIds.push_back(entity.id); + for (auto it = selectedEntities.begin(); it != selectedEntities.end(); it++) { + if (!containsTimedEntity((*it).name)) { + selectedIds.push_back((*it).id); + } else { + selectedEntities.erase(it--); + } } std::vector selectedResults; diff --git a/radio/1.6/Android.bp b/radio/1.6/Android.bp index 4b79c0a43ee0678639c16d5dd59ad73c0cc40292..2137e8d7d92c29e3a7df1ba2f199a03502ce4028 100644 --- a/radio/1.6/Android.bp +++ b/radio/1.6/Android.bp @@ -29,4 +29,5 @@ hidl_interface { "android.hidl.safe_union@1.0", ], gen_java: true, + system_ext_specific: true, } diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index cfd6ebf2682589f9607a25fc2ef89669b61977e0..98eafc1bdaf01e2091a4a213a90c4863e5665c95 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -21,6 +21,13 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + } aidl_interface { @@ -38,6 +45,13 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.radio-V1"], + }, + ], + } aidl_interface { @@ -55,6 +69,13 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.radio-V1"], + }, + ], + } aidl_interface { @@ -72,6 +93,13 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.radio-V1"], + }, + ], + } aidl_interface { @@ -89,6 +117,13 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.radio-V1"], + }, + ], + } aidl_interface { @@ -106,6 +141,13 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.radio-V1"], + }, + ], + } aidl_interface { @@ -126,6 +168,16 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.radio-V1", + "android.hardware.radio.config-V1", + ], + }, + ], + } aidl_interface { @@ -143,4 +195,11 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.radio-V1"], + }, + ], + } diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.config/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..960539da6ab516462f86defcf440c26c9543828a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/.hash @@ -0,0 +1,2 @@ +6e0b1fb58d66a76df8f46a1a6dae5c346ea17d7b +dd9c3f8e21930f9b4c46a4125bd5f5cec90318ec diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a48a89b458aac795bf148b3b3db599100628d5ca --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfig.aidl @@ -0,0 +1,53 @@ +/* + * 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 interface is used by telephony and telecom to talk to cellular radio for the purpose of + * radio configuration, and it is not associated with any specific modem or slot. + * All the functions have minimum one parameter: + * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the + * duration of a method call. If clients provide colliding serials (including passing the same + * serial to different methods), multiple responses (one for each method call) must still be served. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.radio.config; +@VintfStability +interface IRadioConfig { + oneway void getHalDeviceCapabilities(in int serial); + oneway void getNumOfLiveModems(in int serial); + oneway void getPhoneCapability(in int serial); + oneway void getSimSlotsStatus(in int serial); + oneway void setNumOfLiveModems(in int serial, in byte numOfLiveModems); + oneway void setPreferredDataModem(in int serial, in byte modemId); + oneway void setResponseFunctions(in android.hardware.radio.config.IRadioConfigResponse radioConfigResponse, in android.hardware.radio.config.IRadioConfigIndication radioConfigIndication); + oneway void setSimSlotsMapping(in int serial, in android.hardware.radio.config.SlotPortMapping[] slotMap); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfigIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfigIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..994e337c04445fc2901a3ac4b19172d639a7bca0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfigIndication.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.radio.config; +@VintfStability +interface IRadioConfigIndication { + oneway void simSlotsStatusChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.config.SimSlotStatus[] slotStatus); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfigResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..038b0aeb5870548c2739337f469ff29709e373b9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/IRadioConfigResponse.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.config; +@VintfStability +interface IRadioConfigResponse { + oneway void getHalDeviceCapabilitiesResponse(in android.hardware.radio.RadioResponseInfo info, in boolean modemReducedFeatureSet1); + oneway void getNumOfLiveModemsResponse(in android.hardware.radio.RadioResponseInfo info, in byte numOfLiveModems); + oneway void getPhoneCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.config.PhoneCapability phoneCapability); + oneway void getSimSlotsStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.config.SimSlotStatus[] slotStatus); + oneway void setNumOfLiveModemsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setPreferredDataModemResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSimSlotsMappingResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/PhoneCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/PhoneCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..db3a4c65f3a752ab24f73f715fb6bebb6dcfe621 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/PhoneCapability.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 -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.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable PhoneCapability { + byte maxActiveData; + byte maxActiveInternetData; + boolean isInternetLingeringSupported; + byte[] logicalModemIds; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimPortInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b5d31ada35726998a09d48591231420ed807d713 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimPortInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable SimPortInfo { + String iccId; + int logicalSlotId; + boolean portActive; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimSlotStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..be4c08064a39fc1091101005af146161180752cc --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimSlotStatus.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 -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.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable SimSlotStatus { + int cardState; + String atr; + String eid; + android.hardware.radio.config.SimPortInfo[] portInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SlotPortMapping.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SlotPortMapping.aidl new file mode 100644 index 0000000000000000000000000000000000000000..31271eed8d465ae36482dec00d71fcc8d3791056 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SlotPortMapping.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable SlotPortMapping { + int physicalSlotId; + int portId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.data/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..0c0c93608df1f2d3340f11b5b112fc5b7819736d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/.hash @@ -0,0 +1,2 @@ +21e60e4149e36bed0fe2af962995f021e88a1da7 +6d7a86008ea4fe79ced2a86b526a92618eb4c84a diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnAuthType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..86272c22eb3ba5020389112437caad27af6c4885 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnAuthType.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 -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.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ApnAuthType { + NO_PAP_NO_CHAP = 0, + PAP_NO_CHAP = 1, + NO_PAP_CHAP = 2, + PAP_CHAP = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnTypes.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1518a5749eabdff19d843e47c54e2791c265d2e5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnTypes.aidl @@ -0,0 +1,53 @@ +/* + * 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 -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.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ApnTypes { + NONE = 0, + DEFAULT = 1, + MMS = 2, + SUPL = 4, + DUN = 8, + HIPRI = 16, + FOTA = 32, + IMS = 64, + CBS = 128, + IA = 256, + EMERGENCY = 512, + MCX = 1024, + XCAP = 2048, + VSIM = 4096, + BIP = 8192, + ENTERPRISE = 16384, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataCallFailCause.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d7d6983236e58581ac4be41f69b60973df85915e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataCallFailCause.aidl @@ -0,0 +1,377 @@ +/* + * 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 -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.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum DataCallFailCause { + NONE = 0, + OPERATOR_BARRED = 8, + NAS_SIGNALLING = 14, + INSUFFICIENT_RESOURCES = 26, + MISSING_UNKNOWN_APN = 27, + UNKNOWN_PDP_ADDRESS_TYPE = 28, + USER_AUTHENTICATION = 29, + ACTIVATION_REJECT_GGSN = 30, + ACTIVATION_REJECT_UNSPECIFIED = 31, + SERVICE_OPTION_NOT_SUPPORTED = 32, + SERVICE_OPTION_NOT_SUBSCRIBED = 33, + SERVICE_OPTION_OUT_OF_ORDER = 34, + NSAPI_IN_USE = 35, + REGULAR_DEACTIVATION = 36, + QOS_NOT_ACCEPTED = 37, + NETWORK_FAILURE = 38, + UMTS_REACTIVATION_REQ = 39, + FEATURE_NOT_SUPP = 40, + TFT_SEMANTIC_ERROR = 41, + TFT_SYTAX_ERROR = 42, + UNKNOWN_PDP_CONTEXT = 43, + FILTER_SEMANTIC_ERROR = 44, + FILTER_SYTAX_ERROR = 45, + PDP_WITHOUT_ACTIVE_TFT = 46, + ONLY_IPV4_ALLOWED = 50, + ONLY_IPV6_ALLOWED = 51, + ONLY_SINGLE_BEARER_ALLOWED = 52, + ESM_INFO_NOT_RECEIVED = 53, + PDN_CONN_DOES_NOT_EXIST = 54, + MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 55, + MAX_ACTIVE_PDP_CONTEXT_REACHED = 65, + UNSUPPORTED_APN_IN_CURRENT_PLMN = 66, + INVALID_TRANSACTION_ID = 81, + MESSAGE_INCORRECT_SEMANTIC = 95, + INVALID_MANDATORY_INFO = 96, + MESSAGE_TYPE_UNSUPPORTED = 97, + MSG_TYPE_NONCOMPATIBLE_STATE = 98, + UNKNOWN_INFO_ELEMENT = 99, + CONDITIONAL_IE_ERROR = 100, + MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 101, + PROTOCOL_ERRORS = 111, + APN_TYPE_CONFLICT = 112, + INVALID_PCSCF_ADDR = 113, + INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 114, + EMM_ACCESS_BARRED = 115, + EMERGENCY_IFACE_ONLY = 116, + IFACE_MISMATCH = 117, + COMPANION_IFACE_IN_USE = 118, + IP_ADDRESS_MISMATCH = 119, + IFACE_AND_POL_FAMILY_MISMATCH = 120, + EMM_ACCESS_BARRED_INFINITE_RETRY = 121, + AUTH_FAILURE_ON_EMERGENCY_CALL = 122, + OEM_DCFAILCAUSE_1 = 4097, + OEM_DCFAILCAUSE_2 = 4098, + OEM_DCFAILCAUSE_3 = 4099, + OEM_DCFAILCAUSE_4 = 4100, + OEM_DCFAILCAUSE_5 = 4101, + OEM_DCFAILCAUSE_6 = 4102, + OEM_DCFAILCAUSE_7 = 4103, + OEM_DCFAILCAUSE_8 = 4104, + OEM_DCFAILCAUSE_9 = 4105, + OEM_DCFAILCAUSE_10 = 4106, + OEM_DCFAILCAUSE_11 = 4107, + OEM_DCFAILCAUSE_12 = 4108, + OEM_DCFAILCAUSE_13 = 4109, + OEM_DCFAILCAUSE_14 = 4110, + OEM_DCFAILCAUSE_15 = 4111, + VOICE_REGISTRATION_FAIL = -1, + DATA_REGISTRATION_FAIL = -2, + SIGNAL_LOST = -3, + PREF_RADIO_TECH_CHANGED = -4, + RADIO_POWER_OFF = -5, + TETHERED_CALL_ACTIVE = -6, + ERROR_UNSPECIFIED = 65535, + LLC_SNDCP = 25, + ACTIVATION_REJECTED_BCM_VIOLATION = 48, + COLLISION_WITH_NETWORK_INITIATED_REQUEST = 56, + ONLY_IPV4V6_ALLOWED = 57, + ONLY_NON_IP_ALLOWED = 58, + UNSUPPORTED_QCI_VALUE = 59, + BEARER_HANDLING_NOT_SUPPORTED = 60, + INVALID_DNS_ADDR = 123, + INVALID_PCSCF_OR_DNS_ADDRESS = 124, + CALL_PREEMPT_BY_EMERGENCY_APN = 127, + UE_INITIATED_DETACH_OR_DISCONNECT = 128, + MIP_FA_REASON_UNSPECIFIED = 2000, + MIP_FA_ADMIN_PROHIBITED = 2001, + MIP_FA_INSUFFICIENT_RESOURCES = 2002, + MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2003, + MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 2004, + MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 2005, + MIP_FA_MALFORMED_REQUEST = 2006, + MIP_FA_MALFORMED_REPLY = 2007, + MIP_FA_ENCAPSULATION_UNAVAILABLE = 2008, + MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 2009, + MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 2010, + MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 2011, + MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 2012, + MIP_FA_MISSING_NAI = 2013, + MIP_FA_MISSING_HOME_AGENT = 2014, + MIP_FA_MISSING_HOME_ADDRESS = 2015, + MIP_FA_UNKNOWN_CHALLENGE = 2016, + MIP_FA_MISSING_CHALLENGE = 2017, + MIP_FA_STALE_CHALLENGE = 2018, + MIP_HA_REASON_UNSPECIFIED = 2019, + MIP_HA_ADMIN_PROHIBITED = 2020, + MIP_HA_INSUFFICIENT_RESOURCES = 2021, + MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2022, + MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 2023, + MIP_HA_REGISTRATION_ID_MISMATCH = 2024, + MIP_HA_MALFORMED_REQUEST = 2025, + MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 2026, + MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 2027, + MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 2028, + MIP_HA_ENCAPSULATION_UNAVAILABLE = 2029, + CLOSE_IN_PROGRESS = 2030, + NETWORK_INITIATED_TERMINATION = 2031, + MODEM_APP_PREEMPTED = 2032, + PDN_IPV4_CALL_DISALLOWED = 2033, + PDN_IPV4_CALL_THROTTLED = 2034, + PDN_IPV6_CALL_DISALLOWED = 2035, + PDN_IPV6_CALL_THROTTLED = 2036, + MODEM_RESTART = 2037, + PDP_PPP_NOT_SUPPORTED = 2038, + UNPREFERRED_RAT = 2039, + PHYSICAL_LINK_CLOSE_IN_PROGRESS = 2040, + APN_PENDING_HANDOVER = 2041, + PROFILE_BEARER_INCOMPATIBLE = 2042, + SIM_CARD_CHANGED = 2043, + LOW_POWER_MODE_OR_POWERING_DOWN = 2044, + APN_DISABLED = 2045, + MAX_PPP_INACTIVITY_TIMER_EXPIRED = 2046, + IPV6_ADDRESS_TRANSFER_FAILED = 2047, + TRAT_SWAP_FAILED = 2048, + EHRPD_TO_HRPD_FALLBACK = 2049, + MIP_CONFIG_FAILURE = 2050, + PDN_INACTIVITY_TIMER_EXPIRED = 2051, + MAX_IPV4_CONNECTIONS = 2052, + MAX_IPV6_CONNECTIONS = 2053, + APN_MISMATCH = 2054, + IP_VERSION_MISMATCH = 2055, + DUN_CALL_DISALLOWED = 2056, + INTERNAL_EPC_NONEPC_TRANSITION = 2057, + INTERFACE_IN_USE = 2058, + APN_DISALLOWED_ON_ROAMING = 2059, + APN_PARAMETERS_CHANGED = 2060, + NULL_APN_DISALLOWED = 2061, + THERMAL_MITIGATION = 2062, + DATA_SETTINGS_DISABLED = 2063, + DATA_ROAMING_SETTINGS_DISABLED = 2064, + DDS_SWITCHED = 2065, + FORBIDDEN_APN_NAME = 2066, + DDS_SWITCH_IN_PROGRESS = 2067, + CALL_DISALLOWED_IN_ROAMING = 2068, + NON_IP_NOT_SUPPORTED = 2069, + PDN_NON_IP_CALL_THROTTLED = 2070, + PDN_NON_IP_CALL_DISALLOWED = 2071, + CDMA_LOCK = 2072, + CDMA_INTERCEPT = 2073, + CDMA_REORDER = 2074, + CDMA_RELEASE_DUE_TO_SO_REJECTION = 2075, + CDMA_INCOMING_CALL = 2076, + CDMA_ALERT_STOP = 2077, + CHANNEL_ACQUISITION_FAILURE = 2078, + MAX_ACCESS_PROBE = 2079, + CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 2080, + NO_RESPONSE_FROM_BASE_STATION = 2081, + REJECTED_BY_BASE_STATION = 2082, + CONCURRENT_SERVICES_INCOMPATIBLE = 2083, + NO_CDMA_SERVICE = 2084, + RUIM_NOT_PRESENT = 2085, + CDMA_RETRY_ORDER = 2086, + ACCESS_BLOCK = 2087, + ACCESS_BLOCK_ALL = 2088, + IS707B_MAX_ACCESS_PROBES = 2089, + THERMAL_EMERGENCY = 2090, + CONCURRENT_SERVICES_NOT_ALLOWED = 2091, + INCOMING_CALL_REJECTED = 2092, + NO_SERVICE_ON_GATEWAY = 2093, + NO_GPRS_CONTEXT = 2094, + ILLEGAL_MS = 2095, + ILLEGAL_ME = 2096, + GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 2097, + GPRS_SERVICES_NOT_ALLOWED = 2098, + MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 2099, + IMPLICITLY_DETACHED = 2100, + PLMN_NOT_ALLOWED = 2101, + LOCATION_AREA_NOT_ALLOWED = 2102, + GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 2103, + PDP_DUPLICATE = 2104, + UE_RAT_CHANGE = 2105, + CONGESTION = 2106, + NO_PDP_CONTEXT_ACTIVATED = 2107, + ACCESS_CLASS_DSAC_REJECTION = 2108, + PDP_ACTIVATE_MAX_RETRY_FAILED = 2109, + RADIO_ACCESS_BEARER_FAILURE = 2110, + ESM_UNKNOWN_EPS_BEARER_CONTEXT = 2111, + DRB_RELEASED_BY_RRC = 2112, + CONNECTION_RELEASED = 2113, + EMM_DETACHED = 2114, + EMM_ATTACH_FAILED = 2115, + EMM_ATTACH_STARTED = 2116, + LTE_NAS_SERVICE_REQUEST_FAILED = 2117, + DUPLICATE_BEARER_ID = 2118, + ESM_COLLISION_SCENARIOS = 2119, + ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 2120, + ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 2121, + ESM_BAD_OTA_MESSAGE = 2122, + ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 2123, + ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 2124, + DS_EXPLICIT_DEACTIVATION = 2125, + ESM_LOCAL_CAUSE_NONE = 2126, + LTE_THROTTLING_NOT_REQUIRED = 2127, + ACCESS_CONTROL_LIST_CHECK_FAILURE = 2128, + SERVICE_NOT_ALLOWED_ON_PLMN = 2129, + EMM_T3417_EXPIRED = 2130, + EMM_T3417_EXT_EXPIRED = 2131, + RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 2132, + RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 2133, + RRC_UPLINK_CONNECTION_RELEASE = 2134, + RRC_UPLINK_RADIO_LINK_FAILURE = 2135, + RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 2136, + RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 2137, + RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 2138, + RRC_CONNECTION_ACCESS_BARRED = 2139, + RRC_CONNECTION_CELL_RESELECTION = 2140, + RRC_CONNECTION_CONFIG_FAILURE = 2141, + RRC_CONNECTION_TIMER_EXPIRED = 2142, + RRC_CONNECTION_LINK_FAILURE = 2143, + RRC_CONNECTION_CELL_NOT_CAMPED = 2144, + RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 2145, + RRC_CONNECTION_REJECT_BY_NETWORK = 2146, + RRC_CONNECTION_NORMAL_RELEASE = 2147, + RRC_CONNECTION_RADIO_LINK_FAILURE = 2148, + RRC_CONNECTION_REESTABLISHMENT_FAILURE = 2149, + RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 2150, + RRC_CONNECTION_ABORT_REQUEST = 2151, + RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 2152, + NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 2153, + NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 2154, + ESM_PROCEDURE_TIME_OUT = 2155, + INVALID_CONNECTION_ID = 2156, + MAXIMIUM_NSAPIS_EXCEEDED = 2157, + INVALID_PRIMARY_NSAPI = 2158, + CANNOT_ENCODE_OTA_MESSAGE = 2159, + RADIO_ACCESS_BEARER_SETUP_FAILURE = 2160, + PDP_ESTABLISH_TIMEOUT_EXPIRED = 2161, + PDP_MODIFY_TIMEOUT_EXPIRED = 2162, + PDP_INACTIVE_TIMEOUT_EXPIRED = 2163, + PDP_LOWERLAYER_ERROR = 2164, + PDP_MODIFY_COLLISION = 2165, + MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 2166, + NAS_REQUEST_REJECTED_BY_NETWORK = 2167, + RRC_CONNECTION_INVALID_REQUEST = 2168, + RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 2169, + RRC_CONNECTION_RF_UNAVAILABLE = 2170, + RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 2171, + RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 2172, + RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 2173, + RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 2174, + RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 2175, + IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 2176, + IMEI_NOT_ACCEPTED = 2177, + EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 2178, + EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 2179, + MSC_TEMPORARILY_NOT_REACHABLE = 2180, + CS_DOMAIN_NOT_AVAILABLE = 2181, + ESM_FAILURE = 2182, + MAC_FAILURE = 2183, + SYNCHRONIZATION_FAILURE = 2184, + UE_SECURITY_CAPABILITIES_MISMATCH = 2185, + SECURITY_MODE_REJECTED = 2186, + UNACCEPTABLE_NON_EPS_AUTHENTICATION = 2187, + CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 2188, + NO_EPS_BEARER_CONTEXT_ACTIVATED = 2189, + INVALID_EMM_STATE = 2190, + NAS_LAYER_FAILURE = 2191, + MULTIPLE_PDP_CALL_NOT_ALLOWED = 2192, + EMBMS_NOT_ENABLED = 2193, + IRAT_HANDOVER_FAILED = 2194, + EMBMS_REGULAR_DEACTIVATION = 2195, + TEST_LOOPBACK_REGULAR_DEACTIVATION = 2196, + LOWER_LAYER_REGISTRATION_FAILURE = 2197, + DATA_PLAN_EXPIRED = 2198, + UMTS_HANDOVER_TO_IWLAN = 2199, + EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 2200, + EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 2201, + EVDO_HDR_CHANGED = 2202, + EVDO_HDR_EXITED = 2203, + EVDO_HDR_NO_SESSION = 2204, + EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 2205, + EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 2206, + FAILED_TO_ACQUIRE_COLOCATED_HDR = 2207, + OTASP_COMMIT_IN_PROGRESS = 2208, + NO_HYBRID_HDR_SERVICE = 2209, + HDR_NO_LOCK_GRANTED = 2210, + DBM_OR_SMS_IN_PROGRESS = 2211, + HDR_FADE = 2212, + HDR_ACCESS_FAILURE = 2213, + UNSUPPORTED_1X_PREV = 2214, + LOCAL_END = 2215, + NO_SERVICE = 2216, + FADE = 2217, + NORMAL_RELEASE = 2218, + ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 2219, + REDIRECTION_OR_HANDOFF_IN_PROGRESS = 2220, + EMERGENCY_MODE = 2221, + PHONE_IN_USE = 2222, + INVALID_MODE = 2223, + INVALID_SIM_STATE = 2224, + NO_COLLOCATED_HDR = 2225, + UE_IS_ENTERING_POWERSAVE_MODE = 2226, + DUAL_SWITCH = 2227, + PPP_TIMEOUT = 2228, + PPP_AUTH_FAILURE = 2229, + PPP_OPTION_MISMATCH = 2230, + PPP_PAP_FAILURE = 2231, + PPP_CHAP_FAILURE = 2232, + PPP_CLOSE_IN_PROGRESS = 2233, + LIMITED_TO_IPV4 = 2234, + LIMITED_TO_IPV6 = 2235, + VSNCP_TIMEOUT = 2236, + VSNCP_GEN_ERROR = 2237, + VSNCP_APN_UNAUTHORIZED = 2238, + VSNCP_PDN_LIMIT_EXCEEDED = 2239, + VSNCP_NO_PDN_GATEWAY_ADDRESS = 2240, + VSNCP_PDN_GATEWAY_UNREACHABLE = 2241, + VSNCP_PDN_GATEWAY_REJECT = 2242, + VSNCP_INSUFFICIENT_PARAMETERS = 2243, + VSNCP_RESOURCE_UNAVAILABLE = 2244, + VSNCP_ADMINISTRATIVELY_PROHIBITED = 2245, + VSNCP_PDN_ID_IN_USE = 2246, + VSNCP_SUBSCRIBER_LIMITATION = 2247, + VSNCP_PDN_EXISTS_FOR_THIS_APN = 2248, + VSNCP_RECONNECT_NOT_ALLOWED = 2249, + IPV6_PREFIX_UNAVAILABLE = 2250, + HANDOFF_PREFERENCE_CHANGED = 2251, + SLICE_REJECTED = 2252, + MATCH_ALL_RULE_NOT_ALLOWED = 2253, + ALL_MATCHING_RULES_FAILED = 2254, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataProfileInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..16fada1d76c9f0a3b8ae7c65f2d7a131b32b467d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataProfileInfo.aidl @@ -0,0 +1,67 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable DataProfileInfo { + int profileId; + String apn; + android.hardware.radio.data.PdpProtocolType protocol; + android.hardware.radio.data.PdpProtocolType roamingProtocol; + android.hardware.radio.data.ApnAuthType authType; + String user; + String password; + int type; + int maxConnsTime; + int maxConns; + int waitTime; + boolean enabled; + int supportedApnTypesBitmap; + int bearerBitmap; + int mtuV4; + int mtuV6; + boolean preferred; + boolean persistent; + boolean alwaysOn; + android.hardware.radio.data.TrafficDescriptor trafficDescriptor; + const int ID_DEFAULT = 0; + const int ID_TETHERED = 1; + const int ID_IMS = 2; + const int ID_FOTA = 3; + const int ID_CBS = 4; + const int ID_OEM_BASE = 1000; + const int ID_INVALID = -1; + const int TYPE_COMMON = 0; + const int TYPE_3GPP = 1; + const int TYPE_3GPP2 = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataRequestReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataRequestReason.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0ddaff1662caba2a0ea6fe49f2ef7ce1e0f92e16 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataRequestReason.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum DataRequestReason { + NORMAL = 1, + SHUTDOWN = 2, + HANDOVER = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataThrottlingAction.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f976cd59310cdf196b4aa54932c25554a426109 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataThrottlingAction.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 -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.radio.data; +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability +enum DataThrottlingAction { + NO_DATA_THROTTLING = 0, + THROTTLE_SECONDARY_CARRIER = 1, + THROTTLE_ANCHOR_CARRIER = 2, + HOLD = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/EpsQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/EpsQos.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5b9aaa0b1ee06f8e5b145c4c8edf9dada933cdaf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/EpsQos.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable EpsQos { + int qci; + android.hardware.radio.data.QosBandwidth downlink; + android.hardware.radio.data.QosBandwidth uplink; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioData.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7b572f1f8e8e535ef658d3387f78f395ba39a1eb --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioData.aidl @@ -0,0 +1,53 @@ +/* + * 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 -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.radio.data; +@VintfStability +interface IRadioData { + oneway void allocatePduSessionId(in int serial); + oneway void cancelHandover(in int serial, in int callId); + oneway void deactivateDataCall(in int serial, in int cid, in android.hardware.radio.data.DataRequestReason reason); + oneway void getDataCallList(in int serial); + oneway void getSlicingConfig(in int serial); + oneway void releasePduSessionId(in int serial, in int id); + oneway void responseAcknowledgement(); + oneway void setDataAllowed(in int serial, in boolean allow); + oneway void setDataProfile(in int serial, in android.hardware.radio.data.DataProfileInfo[] profiles); + oneway void setDataThrottling(in int serial, in android.hardware.radio.data.DataThrottlingAction dataThrottlingAction, in long completionDurationMillis); + oneway void setInitialAttachApn(in int serial, in @nullable android.hardware.radio.data.DataProfileInfo dataProfileInfo); + oneway void setResponseFunctions(in android.hardware.radio.data.IRadioDataResponse radioDataResponse, in android.hardware.radio.data.IRadioDataIndication radioDataIndication); + oneway void setupDataCall(in int serial, in android.hardware.radio.AccessNetwork accessNetwork, in android.hardware.radio.data.DataProfileInfo dataProfileInfo, in boolean roamingAllowed, in android.hardware.radio.data.DataRequestReason reason, in android.hardware.radio.data.LinkAddress[] addresses, in String[] dnses, in int pduSessionId, in @nullable android.hardware.radio.data.SliceInfo sliceInfo, in boolean matchAllRuleAllowed); + oneway void startHandover(in int serial, in int callId); + oneway void startKeepalive(in int serial, in android.hardware.radio.data.KeepaliveRequest keepalive); + oneway void stopKeepalive(in int serial, in int sessionHandle); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioDataIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0ffa1f7ddf2f8976e81f786da302559e9e9a8b49 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioDataIndication.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.data; +@VintfStability +interface IRadioDataIndication { + oneway void dataCallListChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SetupDataCallResult[] dcList); + oneway void keepaliveStatus(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.KeepaliveStatus status); + oneway void pcoData(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.PcoDataInfo pco); + oneway void unthrottleApn(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.DataProfileInfo dataProfileInfo); + oneway void slicingConfigChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SlicingConfig slicingConfig); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioDataResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioDataResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4edc17d4ad508b843acf9ee57c5333ceaf6b79cf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/IRadioDataResponse.aidl @@ -0,0 +1,52 @@ +/* + * 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 -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.radio.data; +@VintfStability +interface IRadioDataResponse { + oneway void acknowledgeRequest(in int serial); + oneway void allocatePduSessionIdResponse(in android.hardware.radio.RadioResponseInfo info, in int id); + oneway void cancelHandoverResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void deactivateDataCallResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getDataCallListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.SetupDataCallResult[] dcResponse); + oneway void getSlicingConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.SlicingConfig slicingConfig); + oneway void releasePduSessionIdResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setDataAllowedResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setDataProfileResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setDataThrottlingResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setInitialAttachApnResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setupDataCallResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.SetupDataCallResult dcResponse); + oneway void startHandoverResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startKeepaliveResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.KeepaliveStatus status); + oneway void stopKeepaliveResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..592a54a90c124edc77a2225aa297225e304eaebe --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveRequest.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable KeepaliveRequest { + int type; + byte[] sourceAddress; + int sourcePort; + byte[] destinationAddress; + int destinationPort; + int maxKeepaliveIntervalMillis; + int cid; + const int TYPE_NATT_IPV4 = 0; + const int TYPE_NATT_IPV6 = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..82b0fc8ec1c801acdb37fc4d99aa29940fa12418 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable KeepaliveStatus { + int sessionHandle; + int code; + const int CODE_ACTIVE = 0; + const int CODE_INACTIVE = 1; + const int CODE_PENDING = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/LinkAddress.aidl new file mode 100644 index 0000000000000000000000000000000000000000..48e646ea226506f2a887f9276bbef1455035d0fb --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/LinkAddress.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable LinkAddress { + String address; + int addressProperties; + long deprecationTime; + long expirationTime; + const int ADDRESS_PROPERTY_NONE = 0; + const int ADDRESS_PROPERTY_DEPRECATED = 32; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/NrQos.aidl new file mode 100644 index 0000000000000000000000000000000000000000..62f6204038cf5b10b2bca117d7fbd01ea6f0bce7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/NrQos.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable NrQos { + int fiveQi; + android.hardware.radio.data.QosBandwidth downlink; + android.hardware.radio.data.QosBandwidth uplink; + byte qfi; + char averagingWindowMs; + const byte FLOW_ID_RANGE_MIN = 1; + const byte FLOW_ID_RANGE_MAX = 63; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/OsAppId.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/OsAppId.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8595d5206d3637f9bc5a2f5b66404665f23398c8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/OsAppId.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable OsAppId { + byte[] osAppId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PcoDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PcoDataInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..033b12f4eefe921d45ac04564411c42e61f0eb07 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PcoDataInfo.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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable PcoDataInfo { + int cid; + String bearerProto; + int pcoId; + byte[] contents; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PdpProtocolType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9771e5ccc11077d671af4f93a6e35ef3a04e1203 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PdpProtocolType.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PdpProtocolType { + UNKNOWN = -1, + IP = 0, + IPV6 = 1, + IPV4V6 = 2, + PPP = 3, + NON_IP = 4, + UNSTRUCTURED = 5, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PortRange.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PortRange.aidl new file mode 100644 index 0000000000000000000000000000000000000000..470a9c11b3a4e1e49802483e33dafd9e1a95ecb2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PortRange.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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable PortRange { + int start; + int end; + const int PORT_RANGE_MIN = 20; + const int PORT_RANGE_MAX = 65535; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/Qos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/Qos.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ca06e4112bcb87faf7ffd9fb9441211acc9e9714 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/Qos.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +union Qos { + boolean noinit; + android.hardware.radio.data.EpsQos eps; + android.hardware.radio.data.NrQos nr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosBandwidth.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6d4b7a9f49ff7e62fe9d3a2ea17453475391bae6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosBandwidth.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable QosBandwidth { + int maxBitrateKbps; + int guaranteedBitrateKbps; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilter.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e22b359163d97ebbce4d7b9a74209ddf29dcd69f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilter.aidl @@ -0,0 +1,55 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable QosFilter { + String[] localAddresses; + String[] remoteAddresses; + @nullable android.hardware.radio.data.PortRange localPort; + @nullable android.hardware.radio.data.PortRange remotePort; + byte protocol; + android.hardware.radio.data.QosFilterTypeOfService tos; + android.hardware.radio.data.QosFilterIpv6FlowLabel flowLabel; + android.hardware.radio.data.QosFilterIpsecSpi spi; + byte direction; + int precedence; + const byte DIRECTION_DOWNLINK = 0; + const byte DIRECTION_UPLINK = 1; + const byte DIRECTION_BIDIRECTIONAL = 2; + const byte PROTOCOL_UNSPECIFIED = -1; + const byte PROTOCOL_TCP = 6; + const byte PROTOCOL_UDP = 17; + const byte PROTOCOL_ESP = 50; + const byte PROTOCOL_AH = 51; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpsecSpi.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpsecSpi.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b75340276a27aabc7baa3c5c864e3082e0cf806 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpsecSpi.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +union QosFilterIpsecSpi { + boolean noinit; + int value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3fb34ea3752fc5b314c8fe13d0c48a909729ff83 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +union QosFilterIpv6FlowLabel { + boolean noinit; + int value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterTypeOfService.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterTypeOfService.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fa85b5acc35b1ea488c4f49454d7c4d2e9e77a8f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterTypeOfService.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +union QosFilterTypeOfService { + boolean noinit; + byte value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosSession.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bbfdd2d48cebf4b5d06251fd853aa521d63de063 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosSession.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable QosSession { + int qosSessionId; + android.hardware.radio.data.Qos qos; + android.hardware.radio.data.QosFilter[] qosFilters; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/RouteSelectionDescriptor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..434ee7d10296e100362338a43fe58654b8268bd6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable RouteSelectionDescriptor { + byte precedence; + android.hardware.radio.data.PdpProtocolType sessionType; + byte sscMode; + android.hardware.radio.data.SliceInfo[] sliceInfo; + String[] dnn; + const byte SSC_MODE_UNKNOWN = -1; + const byte SSC_MODE_1 = 1; + const byte SSC_MODE_2 = 2; + const byte SSC_MODE_3 = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SetupDataCallResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SetupDataCallResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..83f9db61acd9e5d8c461b62e45fadc57a7c22b85 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SetupDataCallResult.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable SetupDataCallResult { + android.hardware.radio.data.DataCallFailCause cause; + long suggestedRetryTime; + int cid; + int active; + android.hardware.radio.data.PdpProtocolType type; + String ifname; + android.hardware.radio.data.LinkAddress[] addresses; + String[] dnses; + String[] gateways; + String[] pcscf; + int mtuV4; + int mtuV6; + android.hardware.radio.data.Qos defaultQos; + android.hardware.radio.data.QosSession[] qosSessions; + byte handoverFailureMode; + int pduSessionId; + @nullable android.hardware.radio.data.SliceInfo sliceInfo; + android.hardware.radio.data.TrafficDescriptor[] trafficDescriptors; + const int DATA_CONNECTION_STATUS_INACTIVE = 0; + const int DATA_CONNECTION_STATUS_DORMANT = 1; + const int DATA_CONNECTION_STATUS_ACTIVE = 2; + const byte HANDOVER_FAILURE_MODE_LEGACY = 0; + const byte HANDOVER_FAILURE_MODE_DO_FALLBACK = 1; + const byte HANDOVER_FAILURE_MODE_NO_FALLBACK_RETRY_HANDOVER = 2; + const byte HANDOVER_FAILURE_MODE_NO_FALLBACK_RETRY_SETUP_NORMAL = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SliceInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SliceInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..efe48165ee1634a33769ca73233fa5080f112f42 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SliceInfo.aidl @@ -0,0 +1,52 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable SliceInfo { + byte sliceServiceType; + int sliceDifferentiator; + byte mappedHplmnSst; + int mappedHplmnSd; + byte status; + const byte SERVICE_TYPE_NONE = 0; + const byte SERVICE_TYPE_EMBB = 1; + const byte SERVICE_TYPE_URLLC = 2; + const byte SERVICE_TYPE_MIOT = 3; + const byte STATUS_UNKNOWN = 0; + const byte STATUS_CONFIGURED = 1; + const byte STATUS_ALLOWED = 2; + const byte STATUS_REJECTED_NOT_AVAILABLE_IN_PLMN = 3; + const byte STATUS_REJECTED_NOT_AVAILABLE_IN_REG_AREA = 4; + const byte STATUS_DEFAULT_CONFIGURED = 5; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SlicingConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SlicingConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b00febebaf19721deb895a8019c9166355a4313c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SlicingConfig.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable SlicingConfig { + android.hardware.radio.data.UrspRule[] urspRules; + android.hardware.radio.data.SliceInfo[] sliceInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/TrafficDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/TrafficDescriptor.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d7b0654970db166be0692b63a504d252bad98318 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/TrafficDescriptor.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable TrafficDescriptor { + @nullable String dnn; + @nullable android.hardware.radio.data.OsAppId osAppId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/UrspRule.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/UrspRule.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7002fd118ce44eeb52eef87b8fcfd63ed3ea0015 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/UrspRule.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable UrspRule { + int precedence; + android.hardware.radio.data.TrafficDescriptor[] trafficDescriptors; + android.hardware.radio.data.RouteSelectionDescriptor[] routeSelectionDescriptor; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..b972bab2e2609fc1892a585aedbe51d896af304b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash @@ -0,0 +1,2 @@ +725d66fbe595788886858e33291c8a9048825f85 +5237ec5f500627b6b844b155e356e603157f9ba6 diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..39e2be2f632a46d5b1230e2e4f911fae665c3538 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaBroadcastSmsConfigInfo { + int serviceCategory; + int language; + boolean selected; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAck.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAck.aidl new file mode 100644 index 0000000000000000000000000000000000000000..befdbdefb624a24ec12b402bf6fe6eaa839d6251 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAck.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsAck { + boolean errorClass; + int smsCauseCode; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAddress.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ab29c775dd64e375aedddf00067f97f8aadc9f82 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAddress.aidl @@ -0,0 +1,68 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsAddress { + int digitMode; + boolean isNumberModeDataNetwork; + int numberType; + int numberPlan; + byte[] digits; + const int DIGIT_MODE_FOUR_BIT = 0; + const int DIGIT_MODE_EIGHT_BIT = 1; + const int NUMBER_PLAN_UNKNOWN = 0; + const int NUMBER_PLAN_TELEPHONY = 1; + const int NUMBER_PLAN_RESERVED_2 = 2; + const int NUMBER_PLAN_DATA = 3; + const int NUMBER_PLAN_TELEX = 4; + const int NUMBER_PLAN_RESERVED_5 = 5; + const int NUMBER_PLAN_RESERVED_6 = 6; + const int NUMBER_PLAN_RESERVED_7 = 7; + const int NUMBER_PLAN_RESERVED_8 = 8; + const int NUMBER_PLAN_PRIVATE = 9; + const int NUMBER_PLAN_RESERVED_10 = 10; + const int NUMBER_PLAN_RESERVED_11 = 11; + const int NUMBER_PLAN_RESERVED_12 = 12; + const int NUMBER_PLAN_RESERVED_13 = 13; + const int NUMBER_PLAN_RESERVED_14 = 14; + const int NUMBER_PLAN_RESERVED_15 = 15; + const int NUMBER_TYPE_UNKNOWN = 0; + const int NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP = 1; + const int NUMBER_TYPE_NATIONAL_OR_INTERNET_MAIL = 2; + const int NUMBER_TYPE_NETWORK = 3; + const int NUMBER_TYPE_SUBSCRIBER = 4; + const int NUMBER_TYPE_ALPHANUMERIC = 5; + const int NUMBER_TYPE_ABBREVIATED = 6; + const int NUMBER_TYPE_RESERVED_7 = 7; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..867596c81b59cb09f52579b1f4061d9d873692df --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsMessage.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsMessage { + int teleserviceId; + boolean isServicePresent; + int serviceCategory; + android.hardware.radio.messaging.CdmaSmsAddress address; + android.hardware.radio.messaging.CdmaSmsSubaddress subAddress; + byte[] bearerData; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d67fe8c577ea7dd9619dc58992121dfe955744a3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsSubaddress { + int subaddressType; + boolean odd; + byte[] digits; + const int SUBADDRESS_TYPE_NSAP = 0; + const int SUBADDRESS_TYPE_USER_SPECIFIED = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b0a7f98dc6cec50f4bedf77b43234930e4619393 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsWriteArgs { + int status; + android.hardware.radio.messaging.CdmaSmsMessage message; + const int STATUS_REC_UNREAD = 0; + const int STATUS_REC_READ = 1; + const int STATUS_STO_UNSENT = 2; + const int STATUS_STO_SENT = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..46604cabe636f26c1800af69c5352008b89ed51f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable GsmBroadcastSmsConfigInfo { + int fromServiceId; + int toServiceId; + int fromCodeScheme; + int toCodeScheme; + boolean selected; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmSmsMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4df7fd2508c8e9ed556c5c9eba10e8dd0934054f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmSmsMessage.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable GsmSmsMessage { + String smscPdu; + String pdu; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessaging.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessaging.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dfec59ae45c60f7e0484f524f9d4982c23573a26 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessaging.aidl @@ -0,0 +1,60 @@ +/* + * 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 -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.radio.messaging; +@VintfStability +interface IRadioMessaging { + oneway void acknowledgeIncomingGsmSmsWithPdu(in int serial, in boolean success, in String ackPdu); + oneway void acknowledgeLastIncomingCdmaSms(in int serial, in android.hardware.radio.messaging.CdmaSmsAck smsAck); + oneway void acknowledgeLastIncomingGsmSms(in int serial, in boolean success, in android.hardware.radio.messaging.SmsAcknowledgeFailCause cause); + oneway void deleteSmsOnRuim(in int serial, in int index); + oneway void deleteSmsOnSim(in int serial, in int index); + oneway void getCdmaBroadcastConfig(in int serial); + oneway void getGsmBroadcastConfig(in int serial); + oneway void getSmscAddress(in int serial); + oneway void reportSmsMemoryStatus(in int serial, in boolean available); + oneway void responseAcknowledgement(); + oneway void sendCdmaSms(in int serial, in android.hardware.radio.messaging.CdmaSmsMessage sms); + oneway void sendCdmaSmsExpectMore(in int serial, in android.hardware.radio.messaging.CdmaSmsMessage sms); + oneway void sendImsSms(in int serial, in android.hardware.radio.messaging.ImsSmsMessage message); + oneway void sendSms(in int serial, in android.hardware.radio.messaging.GsmSmsMessage message); + oneway void sendSmsExpectMore(in int serial, in android.hardware.radio.messaging.GsmSmsMessage message); + oneway void setCdmaBroadcastActivation(in int serial, in boolean activate); + oneway void setCdmaBroadcastConfig(in int serial, in android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo[] configInfo); + oneway void setGsmBroadcastActivation(in int serial, in boolean activate); + oneway void setGsmBroadcastConfig(in int serial, in android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo[] configInfo); + oneway void setResponseFunctions(in android.hardware.radio.messaging.IRadioMessagingResponse radioMessagingResponse, in android.hardware.radio.messaging.IRadioMessagingIndication radioMessagingIndication); + oneway void setSmscAddress(in int serial, in String smsc); + oneway void writeSmsToRuim(in int serial, in android.hardware.radio.messaging.CdmaSmsWriteArgs cdmaSms); + oneway void writeSmsToSim(in int serial, in android.hardware.radio.messaging.SmsWriteArgs smsWriteArgs); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessagingIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessagingIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8f7824f515f7601b5d160676ad116d31ccd122fe --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessagingIndication.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.messaging; +@VintfStability +interface IRadioMessagingIndication { + oneway void cdmaNewSms(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.messaging.CdmaSmsMessage msg); + oneway void cdmaRuimSmsStorageFull(in android.hardware.radio.RadioIndicationType type); + oneway void newBroadcastSms(in android.hardware.radio.RadioIndicationType type, in byte[] data); + oneway void newSms(in android.hardware.radio.RadioIndicationType type, in byte[] pdu); + oneway void newSmsOnSim(in android.hardware.radio.RadioIndicationType type, in int recordNumber); + oneway void newSmsStatusReport(in android.hardware.radio.RadioIndicationType type, in byte[] pdu); + oneway void simSmsStorageFull(in android.hardware.radio.RadioIndicationType type); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessagingResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessagingResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c3af7a684cd5e38999adfaaaa0a84f9d17ca917c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/IRadioMessagingResponse.aidl @@ -0,0 +1,59 @@ +/* + * 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 -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.radio.messaging; +@VintfStability +interface IRadioMessagingResponse { + oneway void acknowledgeIncomingGsmSmsWithPduResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeLastIncomingCdmaSmsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeLastIncomingGsmSmsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeRequest(in int serial); + oneway void deleteSmsOnRuimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void deleteSmsOnSimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getCdmaBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo[] configs); + oneway void getGsmBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo[] configs); + oneway void getSmscAddressResponse(in android.hardware.radio.RadioResponseInfo info, in String smsc); + oneway void reportSmsMemoryStatusResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendCdmaSmsExpectMoreResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendCdmaSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendImsSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendSmsExpectMoreResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void setCdmaBroadcastActivationResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCdmaBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setGsmBroadcastActivationResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setGsmBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSmscAddressResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void writeSmsToRuimResponse(in android.hardware.radio.RadioResponseInfo info, in int index); + oneway void writeSmsToSimResponse(in android.hardware.radio.RadioResponseInfo info, in int index); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/ImsSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/ImsSmsMessage.aidl new file mode 100644 index 0000000000000000000000000000000000000000..85f62b781d79deb42bf17faa5fa2d01f8e962bf2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/ImsSmsMessage.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable ImsSmsMessage { + android.hardware.radio.RadioTechnologyFamily tech; + boolean retry; + int messageRef; + android.hardware.radio.messaging.CdmaSmsMessage[] cdmaMessage; + android.hardware.radio.messaging.GsmSmsMessage[] gsmMessage; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SendSmsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SendSmsResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..32f7a5cb7129fb2cd8768de882259570e003e831 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SendSmsResult.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable SendSmsResult { + int messageRef; + String ackPDU; + int errorCode; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl new file mode 100644 index 0000000000000000000000000000000000000000..019b18539f33309f665a7e5574eb615aee8b3ca9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.messaging; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SmsAcknowledgeFailCause { + MEMORY_CAPACITY_EXCEEDED = 211, + UNSPECIFIED_ERROR = 255, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsWriteArgs.aidl new file mode 100644 index 0000000000000000000000000000000000000000..489cc07068fd2048cd55109d19a0a578a5d4d32e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsWriteArgs.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable SmsWriteArgs { + int status; + String pdu; + String smsc; + const int STATUS_REC_UNREAD = 0; + const int STATUS_REC_READ = 1; + const int STATUS_STO_UNSENT = 2; + const int STATUS_STO_SENT = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..a6d3c50263bbcb155366ae4993846cb0c765757b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash @@ -0,0 +1,2 @@ +8883a1066be2bbc8c65a2db115b02e3e92bbfc98 +9dee2319b599d654955c05268c1eed6ca4373b58 diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e22ee046e0928c7590cd31b153e3591af346d8b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable ActivityStatsInfo { + int sleepModeTimeMs; + int idleModeTimeMs; + android.hardware.radio.modem.ActivityStatsTechSpecificInfo[] techSpecificInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..08ed9a529ede566d025169018c0cb570ab15ab8e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable ActivityStatsTechSpecificInfo { + android.hardware.radio.AccessNetwork rat; + int frequencyRange; + int[] txmModetimeMs; + int rxModeTimeMs; + const int FREQUENCY_RANGE_UNKNOWN = 0; + const int FREQUENCY_RANGE_LOW = 1; + const int FREQUENCY_RANGE_MID = 2; + const int FREQUENCY_RANGE_HIGH = 3; + const int FREQUENCY_RANGE_MMWAVE = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/DeviceStateType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/DeviceStateType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4e8c6d75458a9b69a008107e5d094b6f07181c21 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/DeviceStateType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.modem; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum DeviceStateType { + POWER_SAVE_MODE = 0, + CHARGING_STATE = 1, + LOW_DATA_EXPECTED = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3a0ec2514b0a81b030df8d77f7116b7ec5e4e8a6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfig.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable HardwareConfig { + int type; + String uuid; + int state; + android.hardware.radio.modem.HardwareConfigModem[] modem; + android.hardware.radio.modem.HardwareConfigSim[] sim; + const int STATE_ENABLED = 0; + const int STATE_STANDBY = 1; + const int STATE_DISABLED = 2; + const int TYPE_MODEM = 0; + const int TYPE_SIM = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigModem.aidl new file mode 100644 index 0000000000000000000000000000000000000000..62bb160fc4228eccc1b3c7c3c06509adf6452f2f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigModem.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable HardwareConfigModem { + int rilModel; + android.hardware.radio.RadioTechnology rat; + int maxVoiceCalls; + int maxDataCalls; + int maxStandby; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigSim.aidl new file mode 100644 index 0000000000000000000000000000000000000000..581098297539613f67dd93d75b634c439de59bd1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigSim.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable HardwareConfigSim { + String modemUuid; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModem.aidl new file mode 100644 index 0000000000000000000000000000000000000000..41eff517730f1869896fad115ece21ae05f19ef3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModem.aidl @@ -0,0 +1,54 @@ +/* + * 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 -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.radio.modem; +@VintfStability +interface IRadioModem { + oneway void enableModem(in int serial, in boolean on); + oneway void getBasebandVersion(in int serial); + oneway void getDeviceIdentity(in int serial); + oneway void getHardwareConfig(in int serial); + oneway void getModemActivityInfo(in int serial); + oneway void getModemStackStatus(in int serial); + oneway void getRadioCapability(in int serial); + oneway void nvReadItem(in int serial, in android.hardware.radio.modem.NvItem itemId); + oneway void nvResetConfig(in int serial, in android.hardware.radio.modem.ResetNvType resetType); + oneway void nvWriteCdmaPrl(in int serial, in byte[] prl); + oneway void nvWriteItem(in int serial, in android.hardware.radio.modem.NvWriteItem item); + oneway void requestShutdown(in int serial); + oneway void responseAcknowledgement(); + oneway void sendDeviceState(in int serial, in android.hardware.radio.modem.DeviceStateType deviceStateType, in boolean state); + oneway void setRadioCapability(in int serial, in android.hardware.radio.modem.RadioCapability rc); + oneway void setRadioPower(in int serial, in boolean powerOn, in boolean forEmergencyCall, in boolean preferredForEmergencyCall); + oneway void setResponseFunctions(in android.hardware.radio.modem.IRadioModemResponse radioModemResponse, in android.hardware.radio.modem.IRadioModemIndication radioModemIndication); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModemIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModemIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..514ff9a03e760513c7fcba74b89a5586f7e45f61 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModemIndication.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.modem; +@VintfStability +interface IRadioModemIndication { + oneway void hardwareConfigChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.HardwareConfig[] configs); + oneway void modemReset(in android.hardware.radio.RadioIndicationType type, in String reason); + oneway void radioCapabilityIndication(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.RadioCapability rc); + oneway void radioStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.RadioState radioState); + oneway void rilConnected(in android.hardware.radio.RadioIndicationType type); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModemResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dcaff4501765584a9b008e38d2c0347edf938c61 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -0,0 +1,53 @@ +/* + * 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 -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.radio.modem; +@VintfStability +interface IRadioModemResponse { + oneway void acknowledgeRequest(in int serial); + oneway void enableModemResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getBasebandVersionResponse(in android.hardware.radio.RadioResponseInfo info, in String version); + oneway void getDeviceIdentityResponse(in android.hardware.radio.RadioResponseInfo info, in String imei, in String imeisv, in String esn, in String meid); + oneway void getHardwareConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.HardwareConfig[] config); + oneway void getModemActivityInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.ActivityStatsInfo activityInfo); + oneway void getModemStackStatusResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); + oneway void getRadioCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.RadioCapability rc); + oneway void nvReadItemResponse(in android.hardware.radio.RadioResponseInfo info, in String result); + oneway void nvResetConfigResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void nvWriteCdmaPrlResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void nvWriteItemResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void requestShutdownResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendDeviceStateResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setRadioCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.RadioCapability rc); + oneway void setRadioPowerResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvItem.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3e276434ac1e864df5eb9e6ccb8051d26087ce27 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvItem.aidl @@ -0,0 +1,78 @@ +/* + * 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 -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.radio.modem; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum NvItem { + CDMA_MEID = 1, + CDMA_MIN = 2, + CDMA_MDN = 3, + CDMA_ACCOLC = 4, + DEVICE_MSL = 11, + RTN_RECONDITIONED_STATUS = 12, + RTN_ACTIVATION_DATE = 13, + RTN_LIFE_TIMER = 14, + RTN_LIFE_CALLS = 15, + RTN_LIFE_DATA_TX = 16, + RTN_LIFE_DATA_RX = 17, + OMADM_HFA_LEVEL = 18, + MIP_PROFILE_NAI = 31, + MIP_PROFILE_HOME_ADDRESS = 32, + MIP_PROFILE_AAA_AUTH = 33, + MIP_PROFILE_HA_AUTH = 34, + MIP_PROFILE_PRI_HA_ADDR = 35, + MIP_PROFILE_SEC_HA_ADDR = 36, + MIP_PROFILE_REV_TUN_PREF = 37, + MIP_PROFILE_HA_SPI = 38, + MIP_PROFILE_AAA_SPI = 39, + MIP_PROFILE_MN_HA_SS = 40, + MIP_PROFILE_MN_AAA_SS = 41, + CDMA_PRL_VERSION = 51, + CDMA_BC10 = 52, + CDMA_BC14 = 53, + CDMA_SO68 = 54, + CDMA_SO73_COP0 = 55, + CDMA_SO73_COP1TO7 = 56, + CDMA_1X_ADVANCED_ENABLED = 57, + CDMA_EHRPD_ENABLED = 58, + CDMA_EHRPD_FORCED = 59, + LTE_BAND_ENABLE_25 = 71, + LTE_BAND_ENABLE_26 = 72, + LTE_BAND_ENABLE_41 = 73, + LTE_SCAN_PRIORITY_25 = 74, + LTE_SCAN_PRIORITY_26 = 75, + LTE_SCAN_PRIORITY_41 = 76, + LTE_HIDDEN_BAND_PRIORITY_25 = 77, + LTE_HIDDEN_BAND_PRIORITY_26 = 78, + LTE_HIDDEN_BAND_PRIORITY_41 = 79, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvWriteItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvWriteItem.aidl new file mode 100644 index 0000000000000000000000000000000000000000..17b7de0a745d8e90b070769486bc0f585874e035 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvWriteItem.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable NvWriteItem { + android.hardware.radio.modem.NvItem itemId; + String value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioCapability.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f2e2858590904dbc43e1c9fde48f747bbbb571f9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioCapability.aidl @@ -0,0 +1,50 @@ +/* + * 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 -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.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable RadioCapability { + int session; + int phase; + int raf; + String logicalModemUuid; + int status; + const int PHASE_CONFIGURED = 0; + const int PHASE_START = 1; + const int PHASE_APPLY = 2; + const int PHASE_UNSOL_RSP = 3; + const int PHASE_FINISH = 4; + const int STATUS_NONE = 0; + const int STATUS_SUCCESS = 1; + const int STATUS_FAIL = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioState.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57f29410c510967dca7533080df713e20fbd8c8a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.modem; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioState { + OFF = 0, + UNAVAILABLE = 1, + ON = 10, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ResetNvType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e3b5796cfcf017ba5d2be73cb9338afb6e1c4b14 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ResetNvType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.modem; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ResetNvType { + RELOAD = 0, + ERASE = 1, + FACTORY_RESET = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.network/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..43dd434edc60db13a6cc8dbed96583e7daf983ea --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/.hash @@ -0,0 +1,2 @@ +ffa236a8203511b871b2d141b0f7c6d37f746bb4 +57e8e923513d80a26102e450d335e89b4346be66 diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..28d886256d51b06afc071f156a54c171fdf71c2c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +union AccessTechnologySpecificInfo { + boolean noinit; + android.hardware.radio.network.Cdma2000RegistrationInfo cdmaInfo; + android.hardware.radio.network.EutranRegistrationInfo eutranInfo; + android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; + boolean geranDtmSupported; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e105b391016d8cb18558e3d94de53a24ad8d156b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringInfo.aidl @@ -0,0 +1,85 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable BarringInfo { + int serviceType; + int barringType; + @nullable android.hardware.radio.network.BarringTypeSpecificInfo barringTypeSpecificInfo; + const int BARRING_TYPE_NONE = 0; + const int BARRING_TYPE_CONDITIONAL = 1; + const int BARRING_TYPE_UNCONDITIONAL = 2; + const int SERVICE_TYPE_CS_SERVICE = 0; + const int SERVICE_TYPE_PS_SERVICE = 1; + const int SERVICE_TYPE_CS_VOICE = 2; + const int SERVICE_TYPE_MO_SIGNALLING = 3; + const int SERVICE_TYPE_MO_DATA = 4; + const int SERVICE_TYPE_CS_FALLBACK = 5; + const int SERVICE_TYPE_MMTEL_VOICE = 6; + const int SERVICE_TYPE_MMTEL_VIDEO = 7; + const int SERVICE_TYPE_EMERGENCY = 8; + const int SERVICE_TYPE_SMS = 9; + const int SERVICE_TYPE_OPERATOR_1 = 1001; + const int SERVICE_TYPE_OPERATOR_2 = 1002; + const int SERVICE_TYPE_OPERATOR_3 = 1003; + const int SERVICE_TYPE_OPERATOR_4 = 1004; + const int SERVICE_TYPE_OPERATOR_5 = 1005; + const int SERVICE_TYPE_OPERATOR_6 = 1006; + const int SERVICE_TYPE_OPERATOR_7 = 1007; + const int SERVICE_TYPE_OPERATOR_8 = 1008; + const int SERVICE_TYPE_OPERATOR_9 = 1009; + const int SERVICE_TYPE_OPERATOR_10 = 1010; + const int SERVICE_TYPE_OPERATOR_11 = 1011; + const int SERVICE_TYPE_OPERATOR_12 = 1012; + const int SERVICE_TYPE_OPERATOR_13 = 1013; + const int SERVICE_TYPE_OPERATOR_14 = 1014; + const int SERVICE_TYPE_OPERATOR_15 = 1015; + const int SERVICE_TYPE_OPERATOR_16 = 1016; + const int SERVICE_TYPE_OPERATOR_17 = 1017; + const int SERVICE_TYPE_OPERATOR_18 = 1018; + const int SERVICE_TYPE_OPERATOR_19 = 1019; + const int SERVICE_TYPE_OPERATOR_20 = 1020; + const int SERVICE_TYPE_OPERATOR_21 = 1021; + const int SERVICE_TYPE_OPERATOR_22 = 1022; + const int SERVICE_TYPE_OPERATOR_23 = 1023; + const int SERVICE_TYPE_OPERATOR_24 = 1024; + const int SERVICE_TYPE_OPERATOR_25 = 1025; + const int SERVICE_TYPE_OPERATOR_26 = 1026; + const int SERVICE_TYPE_OPERATOR_27 = 1027; + const int SERVICE_TYPE_OPERATOR_28 = 1028; + const int SERVICE_TYPE_OPERATOR_29 = 1029; + const int SERVICE_TYPE_OPERATOR_30 = 1030; + const int SERVICE_TYPE_OPERATOR_31 = 1031; + const int SERVICE_TYPE_OPERATOR_32 = 1032; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringTypeSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringTypeSpecificInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a81363339e621f2ec67db7c4b2629d1ac01521a5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringTypeSpecificInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable BarringTypeSpecificInfo { + int factor; + int timeSeconds; + boolean isBarred; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..74c4e29d2ba16f71f4bbca982d4c7cba3ae18c96 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable Cdma2000RegistrationInfo { + boolean cssSupported; + int roamingIndicator; + int systemIsInPrl; + int defaultRoamingIndicator; + const int PRL_INDICATOR_NOT_REGISTERED = -1; + const int PRL_INDICATOR_NOT_IN_PRL = 0; + const int PRL_INDICATOR_IN_PRL = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaRoamingType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaRoamingType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..24ec26b893a12c7a0e8605051e451eb2db180e83 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaRoamingType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CdmaRoamingType { + HOME_NETWORK = 0, + AFFILIATED_ROAM = 1, + ANY_ROAM = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaSignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e2f97bf98f0c5cb15bf97ee98fc474640d8aebe4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaSignalStrength.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSignalStrength { + int dbm; + int ecio; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellConnectionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellConnectionStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8986d719c4a61748ab61fc597343377c9412f712 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellConnectionStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CellConnectionStatus { + NONE = 0, + PRIMARY_SERVING = 1, + SECONDARY_SERVING = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentity.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentity.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2ee92dee29e66a4486434a401d6bace1be484553 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentity.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +union CellIdentity { + boolean noinit; + android.hardware.radio.network.CellIdentityGsm gsm; + android.hardware.radio.network.CellIdentityWcdma wcdma; + android.hardware.radio.network.CellIdentityTdscdma tdscdma; + android.hardware.radio.network.CellIdentityCdma cdma; + android.hardware.radio.network.CellIdentityLte lte; + android.hardware.radio.network.CellIdentityNr nr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityCdma.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d659a2891cbd318aeecb5221f0b50563a2c604ea --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityCdma.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityCdma { + int networkId; + int systemId; + int baseStationId; + int longitude; + int latitude; + android.hardware.radio.network.OperatorInfo operatorNames; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityGsm.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d3193be0722abaaaf87e0e673ab56038d8ee484e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityGsm.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityGsm { + String mcc; + String mnc; + int lac; + int cid; + int arfcn; + byte bsic; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityLte.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2ae7b43e2dc32077c040ffeb7809e13aac6389a5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityLte.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityLte { + String mcc; + String mnc; + int ci; + int pci; + int tac; + int earfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + int bandwidth; + String[] additionalPlmns; + @nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo; + android.hardware.radio.network.EutranBands[] bands; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityNr.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b30af506d88d44ee9c1910aae7ded537e3e2fe1c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityNr.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityNr { + String mcc; + String mnc; + long nci; + int pci; + int tac; + int nrarfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; + android.hardware.radio.network.NgranBands[] bands; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityTdscdma.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e99d14771c802cf71b738230906ae7e7aedad6e1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityTdscdma.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityTdscdma { + String mcc; + String mnc; + int lac; + int cid; + int cpid; + int uarfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; + @nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityWcdma.aidl new file mode 100644 index 0000000000000000000000000000000000000000..12001fcd6798edf18cab11d6236d4b2cb63c3f9e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityWcdma.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityWcdma { + String mcc; + String mnc; + int lac; + int cid; + int psc; + int uarfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; + @nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..467c6b77ccc45cc95af95f8aedf412206f784ecb --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfo { + boolean registered; + android.hardware.radio.network.CellConnectionStatus connectionStatus; + android.hardware.radio.network.CellInfoRatSpecificInfo ratSpecificInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoCdma.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e3bf46b91890f52096d0dbf3aa8cbbefdf8599b0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoCdma.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoCdma { + android.hardware.radio.network.CellIdentityCdma cellIdentityCdma; + android.hardware.radio.network.CdmaSignalStrength signalStrengthCdma; + android.hardware.radio.network.EvdoSignalStrength signalStrengthEvdo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoGsm.aidl new file mode 100644 index 0000000000000000000000000000000000000000..84dcd07d72927e0bd40c7a1eb4c8f423d3800f01 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoGsm.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoGsm { + android.hardware.radio.network.CellIdentityGsm cellIdentityGsm; + android.hardware.radio.network.GsmSignalStrength signalStrengthGsm; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoLte.aidl new file mode 100644 index 0000000000000000000000000000000000000000..221340b06a7d0907696b4d686f80ff059d6140e7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoLte.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoLte { + android.hardware.radio.network.CellIdentityLte cellIdentityLte; + android.hardware.radio.network.LteSignalStrength signalStrengthLte; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoNr.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b392c1d2c78f1de0eaa5f4e59c6e41ea0b5f20c2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoNr.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoNr { + android.hardware.radio.network.CellIdentityNr cellIdentityNr; + android.hardware.radio.network.NrSignalStrength signalStrengthNr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ab0640b29bc448aa43a8a0c0e0c666b7cd4f470 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +union CellInfoRatSpecificInfo { + android.hardware.radio.network.CellInfoGsm gsm; + android.hardware.radio.network.CellInfoWcdma wcdma; + android.hardware.radio.network.CellInfoTdscdma tdscdma; + android.hardware.radio.network.CellInfoLte lte; + android.hardware.radio.network.CellInfoNr nr; + android.hardware.radio.network.CellInfoCdma cdma; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoTdscdma.aidl new file mode 100644 index 0000000000000000000000000000000000000000..138b35ce62d63bb7f752def35acace8828d1acf5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoTdscdma.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoTdscdma { + android.hardware.radio.network.CellIdentityTdscdma cellIdentityTdscdma; + android.hardware.radio.network.TdscdmaSignalStrength signalStrengthTdscdma; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoWcdma.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cf7b135c6340b1dbf0ec0afbff65ec28897b2e90 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoWcdma.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoWcdma { + android.hardware.radio.network.CellIdentityWcdma cellIdentityWcdma; + android.hardware.radio.network.WcdmaSignalStrength signalStrengthWcdma; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..fe734c8f78a25581d41eb401290e29c11243ad79 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable ClosedSubscriberGroupInfo { + boolean csgIndication; + String homeNodebName; + int csgIdentity; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Domain.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Domain.aidl new file mode 100644 index 0000000000000000000000000000000000000000..209cf5e8020999640da9a6da0c14312c86f5d3ac --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Domain.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum Domain { + CS = 1, + PS = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranBands.aidl new file mode 100644 index 0000000000000000000000000000000000000000..57fac3f5d78c3392597d7ff7677553b412b89ddb --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranBands.aidl @@ -0,0 +1,97 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EutranBands { + BAND_1 = 1, + BAND_2 = 2, + BAND_3 = 3, + BAND_4 = 4, + BAND_5 = 5, + BAND_6 = 6, + BAND_7 = 7, + BAND_8 = 8, + BAND_9 = 9, + BAND_10 = 10, + BAND_11 = 11, + BAND_12 = 12, + BAND_13 = 13, + BAND_14 = 14, + BAND_17 = 17, + BAND_18 = 18, + BAND_19 = 19, + BAND_20 = 20, + BAND_21 = 21, + BAND_22 = 22, + BAND_23 = 23, + BAND_24 = 24, + BAND_25 = 25, + BAND_26 = 26, + BAND_27 = 27, + BAND_28 = 28, + BAND_30 = 30, + BAND_31 = 31, + BAND_33 = 33, + BAND_34 = 34, + BAND_35 = 35, + BAND_36 = 36, + BAND_37 = 37, + BAND_38 = 38, + BAND_39 = 39, + BAND_40 = 40, + BAND_41 = 41, + BAND_42 = 42, + BAND_43 = 43, + BAND_44 = 44, + BAND_45 = 45, + BAND_46 = 46, + BAND_47 = 47, + BAND_48 = 48, + BAND_65 = 65, + BAND_66 = 66, + BAND_68 = 68, + BAND_70 = 70, + BAND_49 = 49, + BAND_50 = 50, + BAND_51 = 51, + BAND_52 = 52, + BAND_53 = 53, + BAND_71 = 71, + BAND_72 = 72, + BAND_73 = 73, + BAND_74 = 74, + BAND_85 = 85, + BAND_87 = 87, + BAND_88 = 88, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranRegistrationInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dfbf881353cda5d06938367648924a48fd1c8bdf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EutranRegistrationInfo { + android.hardware.radio.network.LteVopsInfo lteVopsInfo; + android.hardware.radio.network.NrIndicators nrIndicators; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EvdoSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EvdoSignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7c567119f814247f26339849c3fe5bd32a589495 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EvdoSignalStrength.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EvdoSignalStrength { + int dbm; + int ecio; + int signalNoiseRatio; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GeranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GeranBands.aidl new file mode 100644 index 0000000000000000000000000000000000000000..135935ff8f2a056fd7b4a98735e12cdfdc54330d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GeranBands.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum GeranBands { + BAND_T380 = 1, + BAND_T410 = 2, + BAND_450 = 3, + BAND_480 = 4, + BAND_710 = 5, + BAND_750 = 6, + BAND_T810 = 7, + BAND_850 = 8, + BAND_P900 = 9, + BAND_E900 = 10, + BAND_R900 = 11, + BAND_DCS1800 = 12, + BAND_PCS1900 = 13, + BAND_ER900 = 14, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GsmSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GsmSignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b53b393177bcaf790209cc71d53d7393f6d9173 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GsmSignalStrength.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable GsmSignalStrength { + int signalStrength; + int bitErrorRate; + int timingAdvance; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetwork.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b70e450842a67cde6ab3b1992b872710f3a6028 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetwork.aidl @@ -0,0 +1,73 @@ +/* + * 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 -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.radio.network; +@VintfStability +interface IRadioNetwork { + oneway void getAllowedNetworkTypesBitmap(in int serial); + oneway void getAvailableBandModes(in int serial); + oneway void getAvailableNetworks(in int serial); + oneway void getBarringInfo(in int serial); + oneway void getCdmaRoamingPreference(in int serial); + oneway void getCellInfoList(in int serial); + oneway void getDataRegistrationState(in int serial); + oneway void getImsRegistrationState(in int serial); + oneway void getNetworkSelectionMode(in int serial); + oneway void getOperator(in int serial); + oneway void getSignalStrength(in int serial); + oneway void getSystemSelectionChannels(in int serial); + oneway void getVoiceRadioTechnology(in int serial); + oneway void getVoiceRegistrationState(in int serial); + oneway void isNrDualConnectivityEnabled(in int serial); + oneway void responseAcknowledgement(); + oneway void setAllowedNetworkTypesBitmap(in int serial, in int networkTypeBitmap); + oneway void setBandMode(in int serial, in android.hardware.radio.network.RadioBandMode mode); + oneway void setBarringPassword(in int serial, in String facility, in String oldPassword, in String newPassword); + oneway void setCdmaRoamingPreference(in int serial, in android.hardware.radio.network.CdmaRoamingType type); + oneway void setCellInfoListRate(in int serial, in int rate); + oneway void setIndicationFilter(in int serial, in int indicationFilter); + oneway void setLinkCapacityReportingCriteria(in int serial, in int hysteresisMs, in int hysteresisDlKbps, in int hysteresisUlKbps, in int[] thresholdsDownlinkKbps, in int[] thresholdsUplinkKbps, in android.hardware.radio.AccessNetwork accessNetwork); + oneway void setLocationUpdates(in int serial, in boolean enable); + oneway void setNetworkSelectionModeAutomatic(in int serial); + oneway void setNetworkSelectionModeManual(in int serial, in String operatorNumeric, in android.hardware.radio.AccessNetwork ran); + oneway void setNrDualConnectivityState(in int serial, in android.hardware.radio.network.NrDualConnectivityState nrDualConnectivityState); + oneway void setResponseFunctions(in android.hardware.radio.network.IRadioNetworkResponse radioNetworkResponse, in android.hardware.radio.network.IRadioNetworkIndication radioNetworkIndication); + oneway void setSignalStrengthReportingCriteria(in int serial, in android.hardware.radio.network.SignalThresholdInfo[] signalThresholdInfos); + oneway void setSuppServiceNotifications(in int serial, in boolean enable); + oneway void setSystemSelectionChannels(in int serial, in boolean specifyChannels, in android.hardware.radio.network.RadioAccessSpecifier[] specifiers); + oneway void startNetworkScan(in int serial, in android.hardware.radio.network.NetworkScanRequest request); + oneway void stopNetworkScan(in int serial); + oneway void supplyNetworkDepersonalization(in int serial, in String netPin); + oneway void setUsageSetting(in int serial, in android.hardware.radio.network.UsageSetting usageSetting); + oneway void getUsageSetting(in int serial); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetworkIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bd03c51ec79bac8cef04cc4644be6b7cd52b0721 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.radio.network; +@VintfStability +interface IRadioNetworkIndication { + oneway void barringInfoChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos); + oneway void cdmaPrlChanged(in android.hardware.radio.RadioIndicationType type, in int version); + oneway void cellInfoList(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellInfo[] records); + oneway void currentLinkCapacityEstimate(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.LinkCapacityEstimate lce); + oneway void currentPhysicalChannelConfigs(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhysicalChannelConfig[] configs); + oneway void currentSignalStrength(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SignalStrength signalStrength); + oneway void imsNetworkStateChanged(in android.hardware.radio.RadioIndicationType type); + oneway void networkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.NetworkScanResult result); + oneway void networkStateChanged(in android.hardware.radio.RadioIndicationType type); + oneway void nitzTimeReceived(in android.hardware.radio.RadioIndicationType type, in String nitzTime, in long receivedTimeMs, in long ageMs); + oneway void registrationFailed(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in String chosenPlmn, in int domain, in int causeCode, in int additionalCauseCode); + oneway void restrictedStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhoneRestrictedState state); + oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc); + oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetworkResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5f6c7369f41d45f3e93a463a217ae0472b2bf51a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -0,0 +1,72 @@ +/* + * 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 -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.radio.network; +@VintfStability +interface IRadioNetworkResponse { + oneway void acknowledgeRequest(in int serial); + oneway void getAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info, in int networkTypeBitmap); + oneway void getAvailableBandModesResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioBandMode[] bandModes); + oneway void getAvailableNetworksResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.OperatorInfo[] networkInfos); + oneway void getBarringInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos); + oneway void getCdmaRoamingPreferenceResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CdmaRoamingType type); + oneway void getCellInfoListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellInfo[] cellInfo); + oneway void getDataRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult dataRegResponse); + oneway void getImsRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isRegistered, in android.hardware.radio.RadioTechnologyFamily ratFamily); + oneway void getNetworkSelectionModeResponse(in android.hardware.radio.RadioResponseInfo info, in boolean manual); + oneway void getOperatorResponse(in android.hardware.radio.RadioResponseInfo info, in String longName, in String shortName, in String numeric); + oneway void getSignalStrengthResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.SignalStrength signalStrength); + oneway void getSystemSelectionChannelsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioAccessSpecifier[] specifiers); + oneway void getVoiceRadioTechnologyResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.RadioTechnology rat); + oneway void getVoiceRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult voiceRegResponse); + oneway void isNrDualConnectivityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); + oneway void setAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setBandModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setBarringPasswordResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCdmaRoamingPreferenceResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCellInfoListRateResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setIndicationFilterResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setLinkCapacityReportingCriteriaResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setLocationUpdatesResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNetworkSelectionModeAutomaticResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNetworkSelectionModeManualResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNrDualConnectivityStateResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSignalStrengthReportingCriteriaResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSuppServiceNotificationsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSystemSelectionChannelsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void stopNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void supplyNetworkDepersonalizationResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void setUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.UsageSetting usageSetting); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IndicationFilter.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d9ed68ed6df85d4dad980b617695296f96732a93 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IndicationFilter.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum IndicationFilter { + NONE = 0, + ALL = -1, + SIGNAL_STRENGTH = 1, + FULL_NETWORK_STATE = 2, + DATA_CALL_DORMANCY_CHANGED = 4, + LINK_CAPACITY_ESTIMATE = 8, + PHYSICAL_CHANNEL_CONFIG = 16, + REGISTRATION_FAILURE = 32, + BARRING_INFO = 64, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LceDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LceDataInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..27b16c11fb8875b245829753677805fb15bba37c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LceDataInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LceDataInfo { + int lastHopCapacityKbps; + byte confidenceLevel; + boolean lceSuspended; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LinkCapacityEstimate.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LinkCapacityEstimate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5707b8e99023870a286c6845bd149e66a77d85d0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LinkCapacityEstimate.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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LinkCapacityEstimate { + int downlinkCapacityKbps; + int uplinkCapacityKbps; + int secondaryDownlinkCapacityKbps; + int secondaryUplinkCapacityKbps; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteSignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b5b857930571ff8adaac9643ff4f88160a33e965 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteSignalStrength.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LteSignalStrength { + int signalStrength; + int rsrp; + int rsrq; + int rssnr; + int cqi; + int timingAdvance; + int cqiTableIndex; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteVopsInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6d8dd4e83a6a1a5d543f7ab8d5ed56c293ed39aa --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteVopsInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LteVopsInfo { + boolean isVopsSupported; + boolean isEmcBearerSupported; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanRequest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6039740167a3af2a181294d7e67a5877d861614e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanRequest.aidl @@ -0,0 +1,53 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NetworkScanRequest { + int type; + int interval; + android.hardware.radio.network.RadioAccessSpecifier[] specifiers; + int maxSearchTime; + boolean incrementalResults; + int incrementalResultsPeriodicity; + String[] mccMncs; + const int RADIO_ACCESS_SPECIFIER_MAX_SIZE = 8; + const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MIN = 1; + const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MAX = 10; + const int MAX_SEARCH_TIME_RANGE_MIN = 60; + const int MAX_SEARCH_TIME_RANGE_MAX = 3600; + const int SCAN_INTERVAL_RANGE_MIN = 5; + const int SCAN_INTERVAL_RANGE_MAX = 300; + const int SCAN_TYPE_ONE_SHOT = 0; + const int SCAN_TYPE_PERIODIC = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4e392d0c5ccfece6d67ec82cddd7be8ad40b2435 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanResult.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NetworkScanResult { + int status; + android.hardware.radio.RadioError error; + android.hardware.radio.network.CellInfo[] networkInfos; + const int SCAN_STATUS_PARTIAL = 1; + const int SCAN_STATUS_COMPLETE = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NgranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NgranBands.aidl new file mode 100644 index 0000000000000000000000000000000000000000..590469076a484452ab8f1c81addb5cf18f995a2b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NgranBands.aidl @@ -0,0 +1,90 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum NgranBands { + BAND_1 = 1, + BAND_2 = 2, + BAND_3 = 3, + BAND_5 = 5, + BAND_7 = 7, + BAND_8 = 8, + BAND_12 = 12, + BAND_14 = 14, + BAND_18 = 18, + BAND_20 = 20, + BAND_25 = 25, + BAND_26 = 26, + BAND_28 = 28, + BAND_29 = 29, + BAND_30 = 30, + BAND_34 = 34, + BAND_38 = 38, + BAND_39 = 39, + BAND_40 = 40, + BAND_41 = 41, + BAND_46 = 46, + BAND_48 = 48, + BAND_50 = 50, + BAND_51 = 51, + BAND_53 = 53, + BAND_65 = 65, + BAND_66 = 66, + BAND_70 = 70, + BAND_71 = 71, + BAND_74 = 74, + BAND_75 = 75, + BAND_76 = 76, + BAND_77 = 77, + BAND_78 = 78, + BAND_79 = 79, + BAND_80 = 80, + BAND_81 = 81, + BAND_82 = 82, + BAND_83 = 83, + BAND_84 = 84, + BAND_86 = 86, + BAND_89 = 89, + BAND_90 = 90, + BAND_91 = 91, + BAND_92 = 92, + BAND_93 = 93, + BAND_94 = 94, + BAND_95 = 95, + BAND_96 = 96, + BAND_257 = 257, + BAND_258 = 258, + BAND_260 = 260, + BAND_261 = 261, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrDualConnectivityState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrDualConnectivityState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..62c2a56c8d7f11093661147df09ccb3da1caff03 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrDualConnectivityState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability +enum NrDualConnectivityState { + ENABLE = 1, + DISABLE = 2, + DISABLE_IMMEDIATE = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrIndicators.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrIndicators.aidl new file mode 100644 index 0000000000000000000000000000000000000000..88429f6f38e35c566af6fae3571d85a43d529a39 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrIndicators.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NrIndicators { + boolean isEndcAvailable; + boolean isDcNrRestricted; + boolean isNrAvailable; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrSignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..98bbe6bd94910996b8430236ffa012aeb87cb4d3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrSignalStrength.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NrSignalStrength { + int ssRsrp; + int ssRsrq; + int ssSinr; + int csiRsrp; + int csiRsrq; + int csiSinr; + int csiCqiTableIndex; + byte[] csiCqiReport; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrVopsInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e5a0a700ca93d211cc0b577554ead5c5b333b207 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrVopsInfo.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NrVopsInfo { + byte vopsSupported; + byte emcSupported; + byte emfSupported; + const byte EMC_INDICATOR_NOT_SUPPORTED = 0; + const byte EMC_INDICATOR_NR_CONNECTED_TO_5GCN = 1; + const byte EMC_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; + const byte EMC_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; + const byte EMF_INDICATOR_NOT_SUPPORTED = 0; + const byte EMF_INDICATOR_NR_CONNECTED_TO_5GCN = 1; + const byte EMF_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; + const byte EMF_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; + const byte VOPS_INDICATOR_VOPS_NOT_SUPPORTED = 0; + const byte VOPS_INDICATOR_VOPS_OVER_3GPP = 1; + const byte VOPS_INDICATOR_VOPS_OVER_NON_3GPP = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/OperatorInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/OperatorInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..034150e61ffc17b8a1ac5d41f33adc9911827171 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/OperatorInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable OperatorInfo { + String alphaLong; + String alphaShort; + String operatorNumeric; + int status; + const int STATUS_UNKNOWN = 0; + const int STATUS_AVAILABLE = 1; + const int STATUS_CURRENT = 2; + const int STATUS_FORBIDDEN = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhoneRestrictedState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhoneRestrictedState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..41555f9e3d6826d25a010f53fb3cd7d94162f6e2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhoneRestrictedState.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PhoneRestrictedState { + NONE = 0, + CS_EMERGENCY = 1, + CS_NORMAL = 2, + CS_ALL = 4, + PS_ALL = 16, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfig.aidl new file mode 100644 index 0000000000000000000000000000000000000000..928c6b728c1ec5024e67987e2078f8718d6d7885 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfig.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable PhysicalChannelConfig { + android.hardware.radio.network.CellConnectionStatus status; + android.hardware.radio.RadioTechnology rat; + int downlinkChannelNumber; + int uplinkChannelNumber; + int cellBandwidthDownlinkKhz; + int cellBandwidthUplinkKhz; + int[] contextIds; + int physicalCellId; + android.hardware.radio.network.PhysicalChannelConfigBand band; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfigBand.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfigBand.aidl new file mode 100644 index 0000000000000000000000000000000000000000..efc64a69302fbdf8645e77c7da0c57d6c2093e5d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfigBand.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +union PhysicalChannelConfigBand { + boolean noinit; + android.hardware.radio.network.GeranBands geranBand; + android.hardware.radio.network.UtranBands utranBand; + android.hardware.radio.network.EutranBands eutranBand; + android.hardware.radio.network.NgranBands ngranBand; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifier.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifier.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1566bb5224e3a57250afa5f7711b684a5f421ab9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifier.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable RadioAccessSpecifier { + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.network.RadioAccessSpecifierBands bands; + int[] channels; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifierBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifierBands.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a6ac12a28abac2de92da580d7afc585b1195b7d3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifierBands.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +union RadioAccessSpecifierBands { + boolean noinit; + android.hardware.radio.network.GeranBands[] geranBands; + android.hardware.radio.network.UtranBands[] utranBands; + android.hardware.radio.network.EutranBands[] eutranBands; + android.hardware.radio.network.NgranBands[] ngranBands; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioBandMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioBandMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e9a9f6034ce3c973e4911ed391689feaebdbb459 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioBandMode.aidl @@ -0,0 +1,56 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioBandMode { + BAND_MODE_UNSPECIFIED = 0, + BAND_MODE_EURO = 1, + BAND_MODE_USA = 2, + BAND_MODE_JPN = 3, + BAND_MODE_AUS = 4, + BAND_MODE_AUS_2 = 5, + BAND_MODE_CELL_800 = 6, + BAND_MODE_PCS = 7, + BAND_MODE_JTACS = 8, + BAND_MODE_KOREA_PCS = 9, + BAND_MODE_5_450M = 10, + BAND_MODE_IMT2000 = 11, + BAND_MODE_7_700M_2 = 12, + BAND_MODE_8_1800M = 13, + BAND_MODE_9_900M = 14, + BAND_MODE_10_800M_2 = 15, + BAND_MODE_EURO_PAMR_400M = 16, + BAND_MODE_AWS = 17, + BAND_MODE_USA_2500M = 18, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e6e7999f6da8ab93632626e5d62af80f95350760 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegState.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RegState { + NOT_REG_MT_NOT_SEARCHING_OP = 0, + REG_HOME = 1, + NOT_REG_MT_SEARCHING_OP = 2, + REG_DENIED = 3, + UNKNOWN = 4, + REG_ROAMING = 5, + NOT_REG_MT_NOT_SEARCHING_OP_EM = 10, + NOT_REG_MT_SEARCHING_OP_EM = 12, + REG_DENIED_EM = 13, + UNKNOWN_EM = 14, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegStateResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f0a03aea4f23cf66049420e1b715ec1002cb2082 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegStateResult.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable RegStateResult { + android.hardware.radio.network.RegState regState; + android.hardware.radio.RadioTechnology rat; + android.hardware.radio.network.RegistrationFailCause reasonForDenial; + android.hardware.radio.network.CellIdentity cellIdentity; + String registeredPlmn; + android.hardware.radio.network.AccessTechnologySpecificInfo accessTechnologySpecificInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegistrationFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegistrationFailCause.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e2cd44ce0c35c26887068cd4fd0e287d256f836a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegistrationFailCause.aidl @@ -0,0 +1,89 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RegistrationFailCause { + NONE = 0, + IMSI_UNKNOWN_IN_HLR = 2, + ILLEGAL_MS = 3, + IMSI_UNKNOWN_IN_VLR = 4, + IMEI_NOT_ACCEPTED = 5, + ILLEGAL_ME = 6, + GPRS_SERVICES_NOT_ALLOWED = 7, + GPRS_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 8, + MS_IDENTITY_CANNOT_BE_DERIVED_BY_NETWORK = 9, + IMPLICITLY_DETACHED = 10, + PLMN_NOT_ALLOWED = 11, + LOCATION_AREA_NOT_ALLOWED = 12, + ROAMING_NOT_ALLOWED = 13, + GPRS_SERVICES_NOT_ALLOWED_IN_PLMN = 14, + NO_SUITABLE_CELLS = 15, + MSC_TEMPORARILY_NOT_REACHABLE = 15, + NETWORK_FAILURE = 17, + MAC_FAILURE = 20, + SYNC_FAILURE = 21, + CONGESTION = 22, + GSM_AUTHENTICATION_UNACCEPTABLE = 23, + NOT_AUTHORIZED_FOR_THIS_CSG = 25, + SMS_PROVIDED_BY_GPRS_IN_ROUTING_AREA = 26, + SERVICE_OPTION_NOT_SUPPORTED = 32, + SERVICE_OPTION_NOT_SUBSCRIBED = 33, + SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER = 34, + CALL_CANNOT_BE_IDENTIFIED = 38, + NO_PDP_CONTEXT_ACTIVATED = 40, + RETRY_UPON_ENTRY_INTO_NEW_CELL_1 = 48, + RETRY_UPON_ENTRY_INTO_NEW_CELL_2 = 49, + RETRY_UPON_ENTRY_INTO_NEW_CELL_3 = 50, + RETRY_UPON_ENTRY_INTO_NEW_CELL_4 = 51, + RETRY_UPON_ENTRY_INTO_NEW_CELL_5 = 52, + RETRY_UPON_ENTRY_INTO_NEW_CELL_6 = 53, + RETRY_UPON_ENTRY_INTO_NEW_CELL_7 = 54, + RETRY_UPON_ENTRY_INTO_NEW_CELL_8 = 55, + RETRY_UPON_ENTRY_INTO_NEW_CELL_9 = 56, + RETRY_UPON_ENTRY_INTO_NEW_CELL_10 = 57, + RETRY_UPON_ENTRY_INTO_NEW_CELL_11 = 58, + RETRY_UPON_ENTRY_INTO_NEW_CELL_12 = 59, + RETRY_UPON_ENTRY_INTO_NEW_CELL_13 = 60, + RETRY_UPON_ENTRY_INTO_NEW_CELL_14 = 61, + RETRY_UPON_ENTRY_INTO_NEW_CELL_15 = 62, + RETRY_UPON_ENTRY_INTO_NEW_CELL_16 = 63, + SEMANTICALLY_INCORRECT_MESSAGE = 95, + INVALID_MANDATORY_INFORMATION = 96, + MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97, + MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98, + INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99, + CONDITIONAL_IE_ERROR = 100, + MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101, + PROTOCOL_ERROR_UNSPECIFIED = 111, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1c501909475f1c97e61a914cfa38dff7d2b7fb82 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalStrength.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable SignalStrength { + android.hardware.radio.network.GsmSignalStrength gsm; + android.hardware.radio.network.CdmaSignalStrength cdma; + android.hardware.radio.network.EvdoSignalStrength evdo; + android.hardware.radio.network.LteSignalStrength lte; + android.hardware.radio.network.TdscdmaSignalStrength tdscdma; + android.hardware.radio.network.WcdmaSignalStrength wcdma; + android.hardware.radio.network.NrSignalStrength nr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalThresholdInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..040932cf5b750a0c78ce6e63838c6e12bc5b08b5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalThresholdInfo.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable SignalThresholdInfo { + int signalMeasurement; + int hysteresisMs; + int hysteresisDb; + int[] thresholds; + boolean isEnabled; + android.hardware.radio.AccessNetwork ran; + const int SIGNAL_MEASUREMENT_TYPE_RSSI = 1; + const int SIGNAL_MEASUREMENT_TYPE_RSCP = 2; + const int SIGNAL_MEASUREMENT_TYPE_RSRP = 3; + const int SIGNAL_MEASUREMENT_TYPE_RSRQ = 4; + const int SIGNAL_MEASUREMENT_TYPE_RSSNR = 5; + const int SIGNAL_MEASUREMENT_TYPE_SSRSRP = 6; + const int SIGNAL_MEASUREMENT_TYPE_SSRSRQ = 7; + const int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SuppSvcNotification.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SuppSvcNotification.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b62c71bd37246d241142b2a7900514c108f3aaf8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SuppSvcNotification.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable SuppSvcNotification { + boolean isMT; + int code; + int index; + int type; + String number; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/TdscdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/TdscdmaSignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d74c950bde4f80851e45dfa8bc30e5429ce56035 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/TdscdmaSignalStrength.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable TdscdmaSignalStrength { + int signalStrength; + int bitErrorRate; + int rscp; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UsageSetting.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UsageSetting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3ca16b5eaa840326af2d5b4dc9d27ee191b434cf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UsageSetting.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum UsageSetting { + VOICE_CENTRIC = 1, + DATA_CENTRIC = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UtranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UtranBands.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8be3da28f3ab4423702be6aac8a13bb93f667d68 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UtranBands.aidl @@ -0,0 +1,63 @@ +/* + * 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 -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.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum UtranBands { + BAND_1 = 1, + BAND_2 = 2, + BAND_3 = 3, + BAND_4 = 4, + BAND_5 = 5, + BAND_6 = 6, + BAND_7 = 7, + BAND_8 = 8, + BAND_9 = 9, + BAND_10 = 10, + BAND_11 = 11, + BAND_12 = 12, + BAND_13 = 13, + BAND_14 = 14, + BAND_19 = 19, + BAND_20 = 20, + BAND_21 = 21, + BAND_22 = 22, + BAND_25 = 25, + BAND_26 = 26, + BAND_A = 101, + BAND_B = 102, + BAND_C = 103, + BAND_D = 104, + BAND_E = 105, + BAND_F = 106, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/WcdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/WcdmaSignalStrength.aidl new file mode 100644 index 0000000000000000000000000000000000000000..91125271d25a4e16437fe227319119d9fce19d20 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/WcdmaSignalStrength.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 -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.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable WcdmaSignalStrength { + int signalStrength; + int bitErrorRate; + int rscp; + int ecno; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..77252d7e8257898035c653ce6ab8edfd292498e4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash @@ -0,0 +1,2 @@ +6c75ba42a812cccc0f73ada23e5b2581dfedcacb +01cea196fdf8f5e41fda8dc41125f1cc2b96f757 diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/AppStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/AppStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8a41fb9d9028eaf9fb1bf8395c0ebd4583212332 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/AppStatus.aidl @@ -0,0 +1,57 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable AppStatus { + int appType; + int appState; + android.hardware.radio.sim.PersoSubstate persoSubstate; + String aidPtr; + String appLabelPtr; + boolean pin1Replaced; + android.hardware.radio.sim.PinState pin1; + android.hardware.radio.sim.PinState pin2; + const int APP_STATE_UNKNOWN = 0; + const int APP_STATE_DETECTED = 1; + const int APP_STATE_PIN = 2; + const int APP_STATE_PUK = 3; + const int APP_STATE_SUBSCRIPTION_PERSO = 4; + const int APP_STATE_READY = 5; + const int APP_TYPE_UNKNOWN = 0; + const int APP_TYPE_SIM = 1; + const int APP_TYPE_USIM = 2; + const int APP_TYPE_RUIM = 3; + const int APP_TYPE_CSIM = 4; + const int APP_TYPE_ISIM = 5; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardPowerState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardPowerState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..05bc13ac458d62ea065dd02cdd047f70b3ba3547 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardPowerState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CardPowerState { + POWER_DOWN = 0, + POWER_UP = 1, + POWER_UP_PASS_THROUGH = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9000d435063dab3df07cdb75e27fbdde8a10677b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardStatus.aidl @@ -0,0 +1,51 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable CardStatus { + int cardState; + android.hardware.radio.sim.PinState universalPinState; + int gsmUmtsSubscriptionAppIndex; + int cdmaSubscriptionAppIndex; + int imsSubscriptionAppIndex; + android.hardware.radio.sim.AppStatus[] applications; + String atr; + String iccid; + String eid; + android.hardware.radio.config.SlotPortMapping slotMap; + const int STATE_ABSENT = 0; + const int STATE_PRESENT = 1; + const int STATE_ERROR = 2; + const int STATE_RESTRICTED = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/Carrier.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/Carrier.aidl new file mode 100644 index 0000000000000000000000000000000000000000..cc56888f3147ea22326da9270a9159af7b90b89b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/Carrier.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable Carrier { + String mcc; + String mnc; + int matchType; + String matchData; + const int MATCH_TYPE_ALL = 0; + const int MATCH_TYPE_SPN = 1; + const int MATCH_TYPE_IMSI_PREFIX = 2; + const int MATCH_TYPE_GID1 = 3; + const int MATCH_TYPE_GID2 = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CarrierRestrictions.aidl new file mode 100644 index 0000000000000000000000000000000000000000..944f1ca981fd7a8d9857e8352f2721ab544a20e2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable CarrierRestrictions { + android.hardware.radio.sim.Carrier[] allowedCarriers; + android.hardware.radio.sim.Carrier[] excludedCarriers; + boolean allowedCarriersPrioritized; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl new file mode 100644 index 0000000000000000000000000000000000000000..13469f3d6ad1981f4a1e95ac8f69c5e502b4f982 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CdmaSubscriptionSource { + RUIM_SIM = 0, + NV = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSim.aidl new file mode 100644 index 0000000000000000000000000000000000000000..85a0c710d8276ea3ea10fc69ac3a332122de44c2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSim.aidl @@ -0,0 +1,73 @@ +/* + * 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 -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.radio.sim; +@VintfStability +interface IRadioSim { + oneway void areUiccApplicationsEnabled(in int serial); + oneway void changeIccPin2ForApp(in int serial, in String oldPin2, in String newPin2, in String aid); + oneway void changeIccPinForApp(in int serial, in String oldPin, in String newPin, in String aid); + oneway void enableUiccApplications(in int serial, in boolean enable); + oneway void getAllowedCarriers(in int serial); + oneway void getCdmaSubscription(in int serial); + oneway void getCdmaSubscriptionSource(in int serial); + oneway void getFacilityLockForApp(in int serial, in String facility, in String password, in int serviceClass, in String appId); + oneway void getIccCardStatus(in int serial); + oneway void getImsiForApp(in int serial, in String aid); + oneway void getSimPhonebookCapacity(in int serial); + oneway void getSimPhonebookRecords(in int serial); + oneway void iccCloseLogicalChannel(in int serial, in int channelId); + oneway void iccIoForApp(in int serial, in android.hardware.radio.sim.IccIo iccIo); + oneway void iccOpenLogicalChannel(in int serial, in String aid, in int p2); + oneway void iccTransmitApduBasicChannel(in int serial, in android.hardware.radio.sim.SimApdu message); + oneway void iccTransmitApduLogicalChannel(in int serial, in android.hardware.radio.sim.SimApdu message); + oneway void reportStkServiceIsRunning(in int serial); + oneway void requestIccSimAuthentication(in int serial, in int authContext, in String authData, in String aid); + oneway void responseAcknowledgement(); + oneway void sendEnvelope(in int serial, in String contents); + oneway void sendEnvelopeWithStatus(in int serial, in String contents); + oneway void sendTerminalResponseToSim(in int serial, in String contents); + oneway void setAllowedCarriers(in int serial, in android.hardware.radio.sim.CarrierRestrictions carriers, in android.hardware.radio.sim.SimLockMultiSimPolicy multiSimPolicy); + oneway void setCarrierInfoForImsiEncryption(in int serial, in android.hardware.radio.sim.ImsiEncryptionInfo imsiEncryptionInfo); + oneway void setCdmaSubscriptionSource(in int serial, in android.hardware.radio.sim.CdmaSubscriptionSource cdmaSub); + oneway void setFacilityLockForApp(in int serial, in String facility, in boolean lockState, in String password, in int serviceClass, in String appId); + oneway void setResponseFunctions(in android.hardware.radio.sim.IRadioSimResponse radioSimResponse, in android.hardware.radio.sim.IRadioSimIndication radioSimIndication); + oneway void setSimCardPower(in int serial, in android.hardware.radio.sim.CardPowerState powerUp); + oneway void setUiccSubscription(in int serial, in android.hardware.radio.sim.SelectUiccSub uiccSub); + oneway void supplyIccPin2ForApp(in int serial, in String pin2, in String aid); + oneway void supplyIccPinForApp(in int serial, in String pin, in String aid); + oneway void supplyIccPuk2ForApp(in int serial, in String puk2, in String pin2, in String aid); + oneway void supplyIccPukForApp(in int serial, in String puk, in String pin, in String aid); + oneway void supplySimDepersonalization(in int serial, in android.hardware.radio.sim.PersoSubstate persoType, in String controlKey); + oneway void updateSimPhonebookRecords(in int serial, in android.hardware.radio.sim.PhonebookRecordInfo recordInfo); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSimIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSimIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d4371b8e69619efa4482f3a56803108cc9c34eff --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSimIndication.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.radio.sim; +@VintfStability +interface IRadioSimIndication { + oneway void carrierInfoForImsiEncryption(in android.hardware.radio.RadioIndicationType info); + oneway void cdmaSubscriptionSourceChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.sim.CdmaSubscriptionSource cdmaSource); + oneway void simPhonebookChanged(in android.hardware.radio.RadioIndicationType type); + oneway void simPhonebookRecordsReceived(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.sim.PbReceivedStatus status, in android.hardware.radio.sim.PhonebookRecordInfo[] records); + oneway void simRefresh(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.sim.SimRefreshResult refreshResult); + oneway void simStatusChanged(in android.hardware.radio.RadioIndicationType type); + oneway void stkEventNotify(in android.hardware.radio.RadioIndicationType type, in String cmd); + oneway void stkProactiveCommand(in android.hardware.radio.RadioIndicationType type, in String cmd); + oneway void stkSessionEnd(in android.hardware.radio.RadioIndicationType type); + oneway void subscriptionStatusChanged(in android.hardware.radio.RadioIndicationType type, in boolean activate); + oneway void uiccApplicationsEnablementChanged(in android.hardware.radio.RadioIndicationType type, in boolean enabled); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSimResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8e68e3042d06d0e6b8a42a57e54ee7bb7e40e7f9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IRadioSimResponse.aidl @@ -0,0 +1,72 @@ +/* + * 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 -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.radio.sim; +@VintfStability +interface IRadioSimResponse { + oneway void acknowledgeRequest(in int serial); + oneway void areUiccApplicationsEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enabled); + oneway void changeIccPin2ForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void changeIccPinForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void enableUiccApplicationsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getAllowedCarriersResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.CarrierRestrictions carriers, in android.hardware.radio.sim.SimLockMultiSimPolicy multiSimPolicy); + oneway void getCdmaSubscriptionResponse(in android.hardware.radio.RadioResponseInfo info, in String mdn, in String hSid, in String hNid, in String min, in String prl); + oneway void getCdmaSubscriptionSourceResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.CdmaSubscriptionSource source); + oneway void getFacilityLockForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int response); + oneway void getIccCardStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.CardStatus cardStatus); + oneway void getImsiForAppResponse(in android.hardware.radio.RadioResponseInfo info, in String imsi); + oneway void getSimPhonebookCapacityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.PhonebookCapacity capacity); + oneway void getSimPhonebookRecordsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void iccCloseLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void iccIoForAppResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult iccIo); + oneway void iccOpenLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info, in int channelId, in byte[] selectResponse); + oneway void iccTransmitApduBasicChannelResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result); + oneway void iccTransmitApduLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result); + oneway void reportStkServiceIsRunningResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void requestIccSimAuthenticationResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result); + oneway void sendEnvelopeResponse(in android.hardware.radio.RadioResponseInfo info, in String commandResponse); + oneway void sendEnvelopeWithStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult iccIo); + oneway void sendTerminalResponseToSimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setAllowedCarriersResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCarrierInfoForImsiEncryptionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCdmaSubscriptionSourceResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setFacilityLockForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int retry); + oneway void setSimCardPowerResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setUiccSubscriptionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void supplyIccPin2ForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplyIccPinForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplyIccPuk2ForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplyIccPukForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplySimDepersonalizationResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.PersoSubstate persoType, in int remainingRetries); + oneway void updateSimPhonebookRecordsResponse(in android.hardware.radio.RadioResponseInfo info, in int updatedRecordIndex); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5a312dc4fd15b1c30e08e895666d6f817be82fe6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIo.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable IccIo { + int command; + int fileId; + String path; + int p1; + int p2; + int p3; + String data; + String pin2; + String aid; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIoResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIoResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6c6bde2012d9d6723e69522db000282280b2ac96 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIoResult.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable IccIoResult { + int sw1; + int sw2; + String simResponse; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..05e71cd1025cd6421dc88da0f7b1d52fd95b4b1b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable ImsiEncryptionInfo { + String mcc; + String mnc; + byte[] carrierKey; + String keyIdentifier; + long expirationTime; + byte keyType; + const byte PUBLIC_KEY_TYPE_EPDG = 1; + const byte PUBLIC_KEY_TYPE_WLAN = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PbReceivedStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PbReceivedStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5e96fc6f22bef11e5362f353a16f013a426db741 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PbReceivedStatus.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 -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.radio.sim; +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability +enum PbReceivedStatus { + PB_RECEIVED_OK = 1, + PB_RECEIVED_ERROR = 2, + PB_RECEIVED_ABORT = 3, + PB_RECEIVED_FINAL = 4, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PersoSubstate.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PersoSubstate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e33769e812c3a126b3b9a4efbc239bc3d5539e88 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PersoSubstate.aidl @@ -0,0 +1,72 @@ +/* + * 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 -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.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PersoSubstate { + UNKNOWN = 0, + IN_PROGRESS = 1, + READY = 2, + SIM_NETWORK = 3, + SIM_NETWORK_SUBSET = 4, + SIM_CORPORATE = 5, + SIM_SERVICE_PROVIDER = 6, + SIM_SIM = 7, + SIM_NETWORK_PUK = 8, + SIM_NETWORK_SUBSET_PUK = 9, + SIM_CORPORATE_PUK = 10, + SIM_SERVICE_PROVIDER_PUK = 11, + SIM_SIM_PUK = 12, + RUIM_NETWORK1 = 13, + RUIM_NETWORK2 = 14, + RUIM_HRPD = 15, + RUIM_CORPORATE = 16, + RUIM_SERVICE_PROVIDER = 17, + RUIM_RUIM = 18, + RUIM_NETWORK1_PUK = 19, + RUIM_NETWORK2_PUK = 20, + RUIM_HRPD_PUK = 21, + RUIM_CORPORATE_PUK = 22, + RUIM_SERVICE_PROVIDER_PUK = 23, + RUIM_RUIM_PUK = 24, + SIM_SPN = 25, + SIM_SPN_PUK = 26, + SIM_SP_EHPLMN = 27, + SIM_SP_EHPLMN_PUK = 28, + SIM_ICCID = 29, + SIM_ICCID_PUK = 30, + SIM_IMPI = 31, + SIM_IMPI_PUK = 32, + SIM_NS_SP = 33, + SIM_NS_SP_PUK = 34, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookCapacity.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookCapacity.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7531c9638a38de6142f6fca38b5b6de385d737d6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookCapacity.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable PhonebookCapacity { + int maxAdnRecords; + int usedAdnRecords; + int maxEmailRecords; + int usedEmailRecords; + int maxAdditionalNumberRecords; + int usedAdditionalNumberRecords; + int maxNameLen; + int maxNumberLen; + int maxEmailLen; + int maxAdditionalNumberLen; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookRecordInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookRecordInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2e96a4bf549da7155124160ae37e284ada6400d1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookRecordInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable PhonebookRecordInfo { + int recordId; + String name; + String number; + String[] emails; + String[] additionalNumbers; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PinState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PinState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5cdc6d17d40f461c2ab8a67669cb016ec93d59ca --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PinState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PinState { + UNKNOWN = 0, + ENABLED_NOT_VERIFIED = 1, + ENABLED_VERIFIED = 2, + DISABLED = 3, + ENABLED_BLOCKED = 4, + ENABLED_PERM_BLOCKED = 5, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SelectUiccSub.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SelectUiccSub.aidl new file mode 100644 index 0000000000000000000000000000000000000000..02121e632c9e154889b4e43dd40a34177722161c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SelectUiccSub.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SelectUiccSub { + int slot; + int appIndex; + int subType; + int actStatus; + const int SUBSCRIPTION_TYPE_1 = 0; + const int SUBSCRIPTION_TYPE_2 = 1; + const int SUBSCRIPTION_TYPE_3 = 2; + const int ACT_STATUS_DEACTIVATE = 0; + const int ACT_STATUS_ACTIVATE = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimApdu.aidl new file mode 100644 index 0000000000000000000000000000000000000000..220134569563e7a6c8a5da19b8da3f45d6f1b305 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimApdu.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SimApdu { + int sessionId; + int cla; + int instruction; + int p1; + int p2; + int p3; + String data; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ded3e96ecfd73e9006cb93761c482c73bb4264e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SimLockMultiSimPolicy { + NO_MULTISIM_POLICY = 0, + ONE_VALID_SIM_MUST_BE_PRESENT = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimRefreshResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimRefreshResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..69bf4767d37bd6057fd9f8dee35f290f3c4b7847 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimRefreshResult.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SimRefreshResult { + int type; + int efId; + String aid; + const int TYPE_SIM_FILE_UPDATE = 0; + const int TYPE_SIM_INIT = 1; + const int TYPE_SIM_RESET = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..fd705aff5c43089cec72960e9a77ac2547c9a154 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash @@ -0,0 +1,2 @@ +bc19c55b40e9ed285c21b6c1aaa66fe855bf031b +e9ffc70247a89e6c1e526c6334c37da46f33ebea diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/AudioQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/AudioQuality.aidl new file mode 100644 index 0000000000000000000000000000000000000000..15669ac4839db4e19bed9ae0425b228b14525fc1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/AudioQuality.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum AudioQuality { + UNSPECIFIED = 0, + AMR = 1, + AMR_WB = 2, + GSM_EFR = 3, + GSM_FR = 4, + GSM_HR = 5, + EVRC = 6, + EVRC_B = 7, + EVRC_WB = 8, + EVRC_NW = 9, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Call.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Call.aidl new file mode 100644 index 0000000000000000000000000000000000000000..10d2ee751b8fe67b13cc7609dbaf9d1342b121ab --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Call.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable Call { + int state; + int index; + int toa; + boolean isMpty; + boolean isMT; + byte als; + boolean isVoice; + boolean isVoicePrivacy; + String number; + int numberPresentation; + String name; + int namePresentation; + android.hardware.radio.voice.UusInfo[] uusInfo; + android.hardware.radio.voice.AudioQuality audioQuality; + String forwardedNumber; + const int PRESENTATION_ALLOWED = 0; + const int PRESENTATION_RESTRICTED = 1; + const int PRESENTATION_UNKNOWN = 2; + const int PRESENTATION_PAYPHONE = 3; + const int STATE_ACTIVE = 0; + const int STATE_HOLDING = 1; + const int STATE_DIALING = 2; + const int STATE_ALERTING = 3; + const int STATE_INCOMING = 4; + const int STATE_WAITING = 5; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CallForwardInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CallForwardInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8e7aaab565b4b49fa7baec3757fae2037b3ba85a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CallForwardInfo.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CallForwardInfo { + int status; + int reason; + int serviceClass; + int toa; + String number; + int timeSeconds; + const int STATUS_DISABLE = 0; + const int STATUS_ENABLE = 1; + const int STATUS_INTERROGATE = 2; + const int STATUS_REGISTRATION = 3; + const int STATUS_ERASURE = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaCallWaiting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaCallWaiting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..310f9a0fac459fa803ce05c52224fb2d93dcbf4b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaCallWaiting.aidl @@ -0,0 +1,57 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaCallWaiting { + String number; + int numberPresentation; + String name; + android.hardware.radio.voice.CdmaSignalInfoRecord signalInfoRecord; + int numberType; + int numberPlan; + const int NUMBER_PLAN_UNKNOWN = 0; + const int NUMBER_PLAN_ISDN = 1; + const int NUMBER_PLAN_DATA = 3; + const int NUMBER_PLAN_TELEX = 4; + const int NUMBER_PLAN_NATIONAL = 8; + const int NUMBER_PLAN_PRIVATE = 9; + const int NUMBER_PRESENTATION_ALLOWED = 0; + const int NUMBER_PRESENTATION_RESTRICTED = 1; + const int NUMBER_PRESENTATION_UNKNOWN = 2; + const int NUMBER_TYPE_UNKNOWN = 0; + const int NUMBER_TYPE_INTERNATIONAL = 1; + const int NUMBER_TYPE_NATIONAL = 2; + const int NUMBER_TYPE_NETWORK_SPECIFIC = 3; + const int NUMBER_TYPE_SUBSCRIBER = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b6b562c028a2a2a27bb38665a189e5d789441edd --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaDisplayInfoRecord { + String alphaBuf; + const int CDMA_ALPHA_INFO_BUFFER_LENGTH = 64; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaInformationRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaInformationRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..24ae7754790d4319d4560943e3c6d274eddd85cc --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaInformationRecord.aidl @@ -0,0 +1,57 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaInformationRecord { + int name; + android.hardware.radio.voice.CdmaDisplayInfoRecord[] display; + android.hardware.radio.voice.CdmaNumberInfoRecord[] number; + android.hardware.radio.voice.CdmaSignalInfoRecord[] signal; + android.hardware.radio.voice.CdmaRedirectingNumberInfoRecord[] redir; + android.hardware.radio.voice.CdmaLineControlInfoRecord[] lineCtrl; + android.hardware.radio.voice.CdmaT53ClirInfoRecord[] clir; + android.hardware.radio.voice.CdmaT53AudioControlInfoRecord[] audioCtrl; + const int CDMA_MAX_NUMBER_OF_INFO_RECS = 10; + const int NAME_DISPLAY = 0; + const int NAME_CALLED_PARTY_NUMBER = 1; + const int NAME_CALLING_PARTY_NUMBER = 2; + const int NAME_CONNECTED_NUMBER = 3; + const int NAME_SIGNAL = 4; + const int NAME_REDIRECTING_NUMBER = 5; + const int NAME_LINE_CONTROL = 6; + const int NAME_EXTENDED_DISPLAY = 7; + const int NAME_T53_CLIR = 8; + const int NAME_T53_RELEASE = 9; + const int NAME_T53_AUDIO_CONTROL = 10; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e34b3937b4f7d1d80840d5d5f9e109ec964defe3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaLineControlInfoRecord.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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaLineControlInfoRecord { + byte lineCtrlPolarityIncluded; + byte lineCtrlToggle; + byte lineCtrlReverse; + byte lineCtrlPowerDenial; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..aeb0347d67b3f75714d4bb61e605184b13ad105e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaNumberInfoRecord { + String number; + byte numberType; + byte numberPlan; + byte pi; + byte si; + const int CDMA_NUMBER_INFO_BUFFER_LENGTH = 81; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7877fda730785c6214a53b7434a65c2502aa955f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl @@ -0,0 +1,49 @@ +/* + * 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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CdmaOtaProvisionStatus { + SPL_UNLOCKED = 0, + SPC_RETRIES_EXCEEDED = 1, + A_KEY_EXCHANGED = 2, + SSD_UPDATED = 3, + NAM_DOWNLOADED = 4, + MDN_DOWNLOADED = 5, + IMSI_DOWNLOADED = 6, + PRL_DOWNLOADED = 7, + COMMITTED = 8, + OTAPA_STARTED = 9, + OTAPA_STOPPED = 10, + OTAPA_ABORTED = 11, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b61b91b34f7cb14dc656b484b0c905ad8c51278c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl @@ -0,0 +1,46 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaRedirectingNumberInfoRecord { + android.hardware.radio.voice.CdmaNumberInfoRecord redirectingNumber; + int redirectingReason; + const int REDIRECTING_REASON_UNKNOWN = 0; + const int REDIRECTING_REASON_CALL_FORWARDING_BUSY = 1; + const int REDIRECTING_REASON_CALL_FORWARDING_NO_REPLY = 2; + const int REDIRECTING_REASON_CALLED_DTE_OUT_OF_ORDER = 9; + const int REDIRECTING_REASON_CALL_FORWARDING_BY_THE_CALLED_DTE = 10; + const int REDIRECTING_REASON_CALL_FORWARDING_UNCONDITIONAL = 15; + const int REDIRECTING_REASON_RESERVED = 16; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6c7b264476753069b25f941d950a6c6a55b13310 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaSignalInfoRecord.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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSignalInfoRecord { + boolean isPresent; + byte signalType; + byte alertPitch; + byte signal; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..438231cbad6686a96bacea7c1827784d16b1e6b3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaT53AudioControlInfoRecord { + byte upLink; + byte downLink; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1b254f56a0e2513820405b071d3a257d55be1563 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaT53ClirInfoRecord { + byte cause; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CfData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CfData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7e799c7b036846bbf267c52adc827af9838b6ee6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CfData.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CfData { + android.hardware.radio.voice.CallForwardInfo[] cfInfo; + const int NUM_SERVICE_CLASSES = 7; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/ClipStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/ClipStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..3fbb0d8f7f37d1ff0ef20abfd577d785f4738f37 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/ClipStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ClipStatus { + CLIP_PROVISIONED = 0, + CLIP_UNPROVISIONED = 1, + UNKNOWN = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Dial.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Dial.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2b2e7590bcd0bb45e2516a9c2ae450d744e6eae1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Dial.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable Dial { + String address; + int clir; + android.hardware.radio.voice.UusInfo[] uusInfo; + const int CLIR_DEFAULT = 0; + const int CLIR_INVOCATION = 1; + const int CLIR_SUPPRESSION = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyCallRouting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyCallRouting.aidl new file mode 100644 index 0000000000000000000000000000000000000000..07f011d3490c034036415e5f88cf65d9369211a7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyCallRouting.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyCallRouting { + UNKNOWN = 0, + EMERGENCY = 1, + NORMAL = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyNumber.aidl new file mode 100644 index 0000000000000000000000000000000000000000..98df8cd62510ebce548d476da8a4d54221d3dfce --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyNumber.aidl @@ -0,0 +1,47 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable EmergencyNumber { + String number; + String mcc; + String mnc; + int categories; + String[] urns; + int sources; + const int SOURCE_NETWORK_SIGNALING = 1; + const int SOURCE_SIM = 2; + const int SOURCE_MODEM_CONFIG = 4; + const int SOURCE_DEFAULT = 8; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyServiceCategory.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyServiceCategory.aidl new file mode 100644 index 0000000000000000000000000000000000000000..042dd6155e5a17b989efae53d73f371fef310fc2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyServiceCategory.aidl @@ -0,0 +1,45 @@ +/* + * 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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyServiceCategory { + UNSPECIFIED = 0, + POLICE = 1, + AMBULANCE = 2, + FIRE_BRIGADE = 4, + MARINE_GUARD = 8, + MOUNTAIN_RESCUE = 16, + MIEC = 32, + AIEC = 64, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..603b1d67aafac0852b8c3a734f05820ca207fac9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoice.aidl @@ -0,0 +1,76 @@ +/* + * 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 -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.radio.voice; +@VintfStability +interface IRadioVoice { + oneway void acceptCall(in int serial); + oneway void cancelPendingUssd(in int serial); + oneway void conference(in int serial); + oneway void dial(in int serial, in android.hardware.radio.voice.Dial dialInfo); + oneway void emergencyDial(in int serial, in android.hardware.radio.voice.Dial dialInfo, in int categories, in String[] urns, in android.hardware.radio.voice.EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, in boolean isTesting); + oneway void exitEmergencyCallbackMode(in int serial); + oneway void explicitCallTransfer(in int serial); + oneway void getCallForwardStatus(in int serial, in android.hardware.radio.voice.CallForwardInfo callInfo); + oneway void getCallWaiting(in int serial, in int serviceClass); + oneway void getClip(in int serial); + oneway void getClir(in int serial); + oneway void getCurrentCalls(in int serial); + oneway void getLastCallFailCause(in int serial); + oneway void getMute(in int serial); + oneway void getPreferredVoicePrivacy(in int serial); + oneway void getTtyMode(in int serial); + oneway void handleStkCallSetupRequestFromSim(in int serial, in boolean accept); + oneway void hangup(in int serial, in int gsmIndex); + oneway void hangupForegroundResumeBackground(in int serial); + oneway void hangupWaitingOrBackground(in int serial); + oneway void isVoNrEnabled(in int serial); + oneway void rejectCall(in int serial); + oneway void responseAcknowledgement(); + oneway void sendBurstDtmf(in int serial, in String dtmf, in int on, in int off); + oneway void sendCdmaFeatureCode(in int serial, in String featureCode); + oneway void sendDtmf(in int serial, in String s); + oneway void sendUssd(in int serial, in String ussd); + oneway void separateConnection(in int serial, in int gsmIndex); + oneway void setCallForward(in int serial, in android.hardware.radio.voice.CallForwardInfo callInfo); + oneway void setCallWaiting(in int serial, in boolean enable, in int serviceClass); + oneway void setClir(in int serial, in int status); + oneway void setMute(in int serial, in boolean enable); + oneway void setPreferredVoicePrivacy(in int serial, in boolean enable); + oneway void setResponseFunctions(in android.hardware.radio.voice.IRadioVoiceResponse radioVoiceResponse, in android.hardware.radio.voice.IRadioVoiceIndication radioVoiceIndication); + oneway void setTtyMode(in int serial, in android.hardware.radio.voice.TtyMode mode); + oneway void setVoNrEnabled(in int serial, in boolean enable); + oneway void startDtmf(in int serial, in String s); + oneway void stopDtmf(in int serial); + oneway void switchWaitingOrHoldingAndActive(in int serial); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoiceIndication.aidl new file mode 100644 index 0000000000000000000000000000000000000000..189ed43cf959da9f8d7747d10f98cc26c66df524 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoiceIndication.aidl @@ -0,0 +1,52 @@ +/* + * 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 -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.radio.voice; +@VintfStability +interface IRadioVoiceIndication { + oneway void callRing(in android.hardware.radio.RadioIndicationType type, in boolean isGsm, in android.hardware.radio.voice.CdmaSignalInfoRecord record); + oneway void callStateChanged(in android.hardware.radio.RadioIndicationType type); + oneway void cdmaCallWaiting(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaCallWaiting callWaitingRecord); + oneway void cdmaInfoRec(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaInformationRecord[] records); + oneway void cdmaOtaProvisionStatus(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaOtaProvisionStatus status); + oneway void currentEmergencyNumberList(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.EmergencyNumber[] emergencyNumberList); + oneway void enterEmergencyCallbackMode(in android.hardware.radio.RadioIndicationType type); + oneway void exitEmergencyCallbackMode(in android.hardware.radio.RadioIndicationType type); + oneway void indicateRingbackTone(in android.hardware.radio.RadioIndicationType type, in boolean start); + oneway void onSupplementaryServiceIndication(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.StkCcUnsolSsResult ss); + oneway void onUssd(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.UssdModeType modeType, in String msg); + oneway void resendIncallMute(in android.hardware.radio.RadioIndicationType type); + oneway void srvccStateNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.SrvccState state); + oneway void stkCallControlAlphaNotify(in android.hardware.radio.RadioIndicationType type, in String alpha); + oneway void stkCallSetup(in android.hardware.radio.RadioIndicationType type, in long timeout); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoiceResponse.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7acc0446ddc6566ac26df6730a3fc7d8e454b4f5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/IRadioVoiceResponse.aidl @@ -0,0 +1,75 @@ +/* + * 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 -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.radio.voice; +@VintfStability +interface IRadioVoiceResponse { + oneway void acceptCallResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeRequest(in int serial); + oneway void cancelPendingUssdResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void conferenceResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void dialResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void emergencyDialResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void exitEmergencyCallbackModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void explicitCallTransferResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getCallForwardStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.CallForwardInfo[] callForwardInfos); + oneway void getCallWaitingResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable, in int serviceClass); + oneway void getClipResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.ClipStatus status); + oneway void getClirResponse(in android.hardware.radio.RadioResponseInfo info, in int n, in int m); + oneway void getCurrentCallsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.Call[] calls); + oneway void getLastCallFailCauseResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.LastCallFailCauseInfo failCauseinfo); + oneway void getMuteResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable); + oneway void getPreferredVoicePrivacyResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable); + oneway void getTtyModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.TtyMode mode); + oneway void handleStkCallSetupRequestFromSimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void hangupConnectionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void hangupForegroundResumeBackgroundResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void hangupWaitingOrBackgroundResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void isVoNrEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable); + oneway void rejectCallResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendBurstDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendCdmaFeatureCodeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendUssdResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void separateConnectionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCallForwardResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCallWaitingResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setClirResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setMuteResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setPreferredVoicePrivacyResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setTtyModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setVoNrEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void stopDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void switchWaitingOrHoldingAndActiveResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCause.aidl new file mode 100644 index 0000000000000000000000000000000000000000..1740134ef0ceacf188886a2216e419b1c12c26f6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCause.aidl @@ -0,0 +1,133 @@ +/* + * 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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum LastCallFailCause { + UNOBTAINABLE_NUMBER = 1, + NO_ROUTE_TO_DESTINATION = 3, + CHANNEL_UNACCEPTABLE = 6, + OPERATOR_DETERMINED_BARRING = 8, + NORMAL = 16, + BUSY = 17, + NO_USER_RESPONDING = 18, + NO_ANSWER_FROM_USER = 19, + CALL_REJECTED = 21, + NUMBER_CHANGED = 22, + PREEMPTION = 25, + DESTINATION_OUT_OF_ORDER = 27, + INVALID_NUMBER_FORMAT = 28, + FACILITY_REJECTED = 29, + RESP_TO_STATUS_ENQUIRY = 30, + NORMAL_UNSPECIFIED = 31, + CONGESTION = 34, + NETWORK_OUT_OF_ORDER = 38, + TEMPORARY_FAILURE = 41, + SWITCHING_EQUIPMENT_CONGESTION = 42, + ACCESS_INFORMATION_DISCARDED = 43, + REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE = 44, + RESOURCES_UNAVAILABLE_OR_UNSPECIFIED = 47, + QOS_UNAVAILABLE = 49, + REQUESTED_FACILITY_NOT_SUBSCRIBED = 50, + INCOMING_CALLS_BARRED_WITHIN_CUG = 55, + BEARER_CAPABILITY_NOT_AUTHORIZED = 57, + BEARER_CAPABILITY_UNAVAILABLE = 58, + SERVICE_OPTION_NOT_AVAILABLE = 63, + BEARER_SERVICE_NOT_IMPLEMENTED = 65, + ACM_LIMIT_EXCEEDED = 68, + REQUESTED_FACILITY_NOT_IMPLEMENTED = 69, + ONLY_DIGITAL_INFORMATION_BEARER_AVAILABLE = 70, + SERVICE_OR_OPTION_NOT_IMPLEMENTED = 79, + INVALID_TRANSACTION_IDENTIFIER = 81, + USER_NOT_MEMBER_OF_CUG = 87, + INCOMPATIBLE_DESTINATION = 88, + INVALID_TRANSIT_NW_SELECTION = 91, + SEMANTICALLY_INCORRECT_MESSAGE = 95, + INVALID_MANDATORY_INFORMATION = 96, + MESSAGE_TYPE_NON_IMPLEMENTED = 97, + MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98, + INFORMATION_ELEMENT_NON_EXISTENT = 99, + CONDITIONAL_IE_ERROR = 100, + MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101, + RECOVERY_ON_TIMER_EXPIRED = 102, + PROTOCOL_ERROR_UNSPECIFIED = 111, + INTERWORKING_UNSPECIFIED = 127, + CALL_BARRED = 240, + FDN_BLOCKED = 241, + IMSI_UNKNOWN_IN_VLR = 242, + IMEI_NOT_ACCEPTED = 243, + DIAL_MODIFIED_TO_USSD = 244, + DIAL_MODIFIED_TO_SS = 245, + DIAL_MODIFIED_TO_DIAL = 246, + RADIO_OFF = 247, + OUT_OF_SERVICE = 248, + NO_VALID_SIM = 249, + RADIO_INTERNAL_ERROR = 250, + NETWORK_RESP_TIMEOUT = 251, + NETWORK_REJECT = 252, + RADIO_ACCESS_FAILURE = 253, + RADIO_LINK_FAILURE = 254, + RADIO_LINK_LOST = 255, + RADIO_UPLINK_FAILURE = 256, + RADIO_SETUP_FAILURE = 257, + RADIO_RELEASE_NORMAL = 258, + RADIO_RELEASE_ABNORMAL = 259, + ACCESS_CLASS_BLOCKED = 260, + NETWORK_DETACH = 261, + CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000, + CDMA_DROP = 1001, + CDMA_INTERCEPT = 1002, + CDMA_REORDER = 1003, + CDMA_SO_REJECT = 1004, + CDMA_RETRY_ORDER = 1005, + CDMA_ACCESS_FAILURE = 1006, + CDMA_PREEMPTED = 1007, + CDMA_NOT_EMERGENCY = 1008, + CDMA_ACCESS_BLOCKED = 1009, + OEM_CAUSE_1 = 61441, + OEM_CAUSE_2 = 61442, + OEM_CAUSE_3 = 61443, + OEM_CAUSE_4 = 61444, + OEM_CAUSE_5 = 61445, + OEM_CAUSE_6 = 61446, + OEM_CAUSE_7 = 61447, + OEM_CAUSE_8 = 61448, + OEM_CAUSE_9 = 61449, + OEM_CAUSE_10 = 61450, + OEM_CAUSE_11 = 61451, + OEM_CAUSE_12 = 61452, + OEM_CAUSE_13 = 61453, + OEM_CAUSE_14 = 61454, + OEM_CAUSE_15 = 61455, + ERROR_UNSPECIFIED = 65535, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..221acf73069a41f93ae81e97eff23936802aa90c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable LastCallFailCauseInfo { + android.hardware.radio.voice.LastCallFailCause causeCode; + String vendorCause; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SrvccState.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SrvccState.aidl new file mode 100644 index 0000000000000000000000000000000000000000..864374b50814f0fd0bbce6d79ff1bb8625639b24 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SrvccState.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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SrvccState { + HANDOVER_STARTED = 0, + HANDOVER_COMPLETED = 1, + HANDOVER_FAILED = 2, + HANDOVER_CANCELED = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SsInfoData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SsInfoData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f18b404605a98df106cbeae1f23e17be0360495e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SsInfoData.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable SsInfoData { + int[] ssInfo; + const int SS_INFO_MAX = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..50bb1fd35bcfd3e61f5fc2c9de83545fcd069206 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl @@ -0,0 +1,84 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable StkCcUnsolSsResult { + int serviceType; + int requestType; + int teleserviceType; + int serviceClass; + android.hardware.radio.RadioError result; + android.hardware.radio.voice.SsInfoData[] ssInfo; + android.hardware.radio.voice.CfData[] cfData; + const int REQUEST_TYPE_ACTIVATION = 0; + const int REQUEST_TYPE_DEACTIVATION = 1; + const int REQUEST_TYPE_INTERROGATION = 2; + const int REQUEST_TYPE_REGISTRATION = 3; + const int REQUEST_TYPE_ERASURE = 4; + const int SERVICE_TYPE_CFU = 0; + const int SERVICE_TYPE_CF_BUSY = 1; + const int SERVICE_TYPE_CF_NO_REPLY = 2; + const int SERVICE_TYPE_CF_NOT_REACHABLE = 3; + const int SERVICE_TYPE_CF_ALL = 4; + const int SERVICE_TYPE_CF_ALL_CONDITIONAL = 5; + const int SERVICE_TYPE_CLIP = 6; + const int SERVICE_TYPE_CLIR = 7; + const int SERVICE_TYPE_COLP = 8; + const int SERVICE_TYPE_COLR = 9; + const int SERVICE_TYPE_WAIT = 10; + const int SERVICE_TYPE_BAOC = 11; + const int SERVICE_TYPE_BAOIC = 12; + const int SERVICE_TYPE_BAOIC_EXC_HOME = 13; + const int SERVICE_TYPE_BAIC = 14; + const int SERVICE_TYPE_BAIC_ROAMING = 15; + const int SERVICE_TYPE_ALL_BARRING = 16; + const int SERVICE_TYPE_OUTGOING_BARRING = 17; + const int SERVICE_TYPE_INCOMING_BARRING = 18; + const int TELESERVICE_TYPE_ALL_TELE_AND_BEARER_SERVICES = 0; + const int TELESERVICE_TYPE_ALL_TELESEVICES = 1; + const int TELESERVICE_TYPE_TELEPHONY = 2; + const int TELESERVICE_TYPE_ALL_DATA_TELESERVICES = 3; + const int TELESERVICE_TYPE_SMS_SERVICES = 4; + const int TELESERVICE_TYPE_ALL_TELESERVICES_EXCEPT_SMS = 5; + const int SUPP_SERVICE_CLASS_NONE = 0; + const int SUPP_SERVICE_CLASS_VOICE = 1; + const int SUPP_SERVICE_CLASS_DATA = 2; + const int SUPP_SERVICE_CLASS_FAX = 4; + const int SUPP_SERVICE_CLASS_SMS = 8; + const int SUPP_SERVICE_CLASS_DATA_SYNC = 16; + const int SUPP_SERVICE_CLASS_DATA_ASYNC = 32; + const int SUPP_SERVICE_CLASS_PACKET = 64; + const int SUPP_SERVICE_CLASS_PAD = 128; + const int SUPP_SERVICE_CLASS_MAX = 128; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/TtyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/TtyMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..77417e8718c7356e21be5a5d2e20fb484fb563fc --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/TtyMode.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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum TtyMode { + OFF = 0, + FULL = 1, + HCO = 2, + VCO = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UssdModeType.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UssdModeType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ad243d2de7e950029130124469f9855d25c9d13d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UssdModeType.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum UssdModeType { + NOTIFY = 0, + REQUEST = 1, + NW_RELEASE = 2, + LOCAL_CLIENT = 3, + NOT_SUPPORTED = 4, + NW_TIMEOUT = 5, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UusInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UusInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..931376014c0594c6ea18bf1301637ef5307872c4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UusInfo.aidl @@ -0,0 +1,52 @@ +/* + * 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 -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.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable UusInfo { + int uusType; + int uusDcs; + String uusData; + const int UUS_DCS_USP = 0; + const int UUS_DCS_OSIHLP = 1; + const int UUS_DCS_X244 = 2; + const int UUS_DCS_RMCF = 3; + const int UUS_DCS_IA5C = 4; + const int UUS_TYPE_TYPE1_IMPLICIT = 0; + const int UUS_TYPE_TYPE1_REQUIRED = 1; + const int UUS_TYPE_TYPE1_NOT_REQUIRED = 2; + const int UUS_TYPE_TYPE2_REQUIRED = 3; + const int UUS_TYPE_TYPE2_NOT_REQUIRED = 4; + const int UUS_TYPE_TYPE3_REQUIRED = 5; + const int UUS_TYPE_TYPE3_NOT_REQUIRED = 6; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/.hash b/radio/aidl/aidl_api/android.hardware.radio/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..f6b2564745eff4a6565b681981caa19ad459ebb7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/.hash @@ -0,0 +1 @@ +31b668688e937e8e1eff48fea7b4bb37681114a0 diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/AccessNetwork.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8ce689f501f541bcb9687fc65f2131ef52d2c56e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/AccessNetwork.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum AccessNetwork { + UNKNOWN = 0, + GERAN = 1, + UTRAN = 2, + EUTRAN = 3, + CDMA2000 = 4, + IWLAN = 5, + NGRAN = 6, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioAccessFamily.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ecc2a9be7cc8f47bdb3d814e09f50300bb7c4c7e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioAccessFamily.aidl @@ -0,0 +1,58 @@ +/* + * 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 -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.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioAccessFamily { + UNKNOWN = 1, + GPRS = 2, + EDGE = 4, + UMTS = 8, + IS95A = 16, + IS95B = 32, + ONE_X_RTT = 64, + EVDO_0 = 128, + EVDO_A = 256, + HSDPA = 512, + HSUPA = 1024, + HSPA = 2048, + EVDO_B = 4096, + EHRPD = 8192, + LTE = 16384, + HSPAP = 32768, + GSM = 65536, + TD_SCDMA = 131072, + IWLAN = 262144, + LTE_CA = 524288, + NR = 1048576, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioConst.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b91bf035116db5e72c2c9e264e9316d80bb2df7b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioConst.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 -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.radio; +@JavaDerive(toString=true) @VintfStability +parcelable RadioConst { + const int MAX_RILDS = 3; + const int MAX_UUID_LENGTH = 64; + const int CARD_MAX_APPS = 8; + const int P2_CONSTANT_NO_P2 = -1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioError.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioError.aidl new file mode 100644 index 0000000000000000000000000000000000000000..98606e588bb15596b90e800c4a43bed5b1142515 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioError.aidl @@ -0,0 +1,126 @@ +/* + * 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 -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.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioError { + NONE = 0, + RADIO_NOT_AVAILABLE = 1, + GENERIC_FAILURE = 2, + PASSWORD_INCORRECT = 3, + SIM_PIN2 = 4, + SIM_PUK2 = 5, + REQUEST_NOT_SUPPORTED = 6, + CANCELLED = 7, + OP_NOT_ALLOWED_DURING_VOICE_CALL = 8, + OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9, + SMS_SEND_FAIL_RETRY = 10, + SIM_ABSENT = 11, + SUBSCRIPTION_NOT_AVAILABLE = 12, + MODE_NOT_SUPPORTED = 13, + FDN_CHECK_FAILURE = 14, + ILLEGAL_SIM_OR_ME = 15, + MISSING_RESOURCE = 16, + NO_SUCH_ELEMENT = 17, + DIAL_MODIFIED_TO_USSD = 18, + DIAL_MODIFIED_TO_SS = 19, + DIAL_MODIFIED_TO_DIAL = 20, + USSD_MODIFIED_TO_DIAL = 21, + USSD_MODIFIED_TO_SS = 22, + USSD_MODIFIED_TO_USSD = 23, + SS_MODIFIED_TO_DIAL = 24, + SS_MODIFIED_TO_USSD = 25, + SUBSCRIPTION_NOT_SUPPORTED = 26, + SS_MODIFIED_TO_SS = 27, + LCE_NOT_SUPPORTED = 36, + NO_MEMORY = 37, + INTERNAL_ERR = 38, + SYSTEM_ERR = 39, + MODEM_ERR = 40, + INVALID_STATE = 41, + NO_RESOURCES = 42, + SIM_ERR = 43, + INVALID_ARGUMENTS = 44, + INVALID_SIM_STATE = 45, + INVALID_MODEM_STATE = 46, + INVALID_CALL_ID = 47, + NO_SMS_TO_ACK = 48, + NETWORK_ERR = 49, + REQUEST_RATE_LIMITED = 50, + SIM_BUSY = 51, + SIM_FULL = 52, + NETWORK_REJECT = 53, + OPERATION_NOT_ALLOWED = 54, + EMPTY_RECORD = 55, + INVALID_SMS_FORMAT = 56, + ENCODING_ERR = 57, + INVALID_SMSC_ADDRESS = 58, + NO_SUCH_ENTRY = 59, + NETWORK_NOT_READY = 60, + NOT_PROVISIONED = 61, + NO_SUBSCRIPTION = 62, + NO_NETWORK_FOUND = 63, + DEVICE_IN_USE = 64, + ABORTED = 65, + INVALID_RESPONSE = 66, + OEM_ERROR_1 = 501, + OEM_ERROR_2 = 502, + OEM_ERROR_3 = 503, + OEM_ERROR_4 = 504, + OEM_ERROR_5 = 505, + OEM_ERROR_6 = 506, + OEM_ERROR_7 = 507, + OEM_ERROR_8 = 508, + OEM_ERROR_9 = 509, + OEM_ERROR_10 = 510, + OEM_ERROR_11 = 511, + OEM_ERROR_12 = 512, + OEM_ERROR_13 = 513, + OEM_ERROR_14 = 514, + OEM_ERROR_15 = 515, + OEM_ERROR_16 = 516, + OEM_ERROR_17 = 517, + OEM_ERROR_18 = 518, + OEM_ERROR_19 = 519, + OEM_ERROR_20 = 520, + OEM_ERROR_21 = 521, + OEM_ERROR_22 = 522, + OEM_ERROR_23 = 523, + OEM_ERROR_24 = 524, + OEM_ERROR_25 = 525, + SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED = 67, + ACCESS_BARRED = 68, + BLOCKED_DUE_TO_CALL = 69, + RF_HARDWARE_ISSUE = 70, + NO_RF_CALIBRATION_INFO = 71, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioIndicationType.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioIndicationType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..54ea3a4b4f8956a0a8f70c1062a87bbd049a431e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioIndicationType.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioIndicationType { + UNSOLICITED = 0, + UNSOLICITED_ACK_EXP = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b2a7a062f9f28c14b93d75e1f130997bf1734487 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio; +@JavaDerive(toString=true) @VintfStability +parcelable RadioResponseInfo { + android.hardware.radio.RadioResponseType type; + int serial; + android.hardware.radio.RadioError error; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseInfoModem.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseInfoModem.aidl new file mode 100644 index 0000000000000000000000000000000000000000..37ed7bb230f4a172150e8db2d71e498c29e796f5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseInfoModem.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 -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.radio; +@JavaDerive(toString=true) @VintfStability +parcelable RadioResponseInfoModem { + android.hardware.radio.RadioResponseType type; + int serial; + android.hardware.radio.RadioError error; + boolean isEnabled; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseType.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5cd99c43b0782a152a9af01874cbbc4a6e4e4db7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioResponseType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioResponseType { + SOLICITED = 0, + SOLICITED_ACK = 1, + SOLICITED_ACK_EXP = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioTechnology.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9dad0a4977b7fd8ef5db4dd5dcbe847d4598472c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioTechnology.aidl @@ -0,0 +1,58 @@ +/* + * 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 -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.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioTechnology { + UNKNOWN = 0, + GPRS = 1, + EDGE = 2, + UMTS = 3, + IS95A = 4, + IS95B = 5, + ONE_X_RTT = 6, + EVDO_0 = 7, + EVDO_A = 8, + HSDPA = 9, + HSUPA = 10, + HSPA = 11, + EVDO_B = 12, + EHRPD = 13, + LTE = 14, + HSPAP = 15, + GSM = 16, + TD_SCDMA = 17, + IWLAN = 18, + LTE_CA = 19, + NR = 20, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioTechnologyFamily.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e6fdce269d1a1bfc3c76396d94e8ba4e76d345aa --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/1/android/hardware/radio/RadioTechnologyFamily.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioTechnologyFamily { + THREE_GPP = 0, + THREE_GPP2 = 1, +} diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h index bbfff61ec33d4255bb2a782e2c38970c48f1ef3f..89ddea0d49c40a35f0d5d4e1c19188fed780a2fc 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h @@ -39,8 +39,6 @@ class RadioConfig : public aidl::android::hardware::radio::config::BnRadioConfig const sp mRadioConfigResponse; const sp mRadioConfigIndication; - std::shared_ptr<::aidl::android::hardware::radio::config::IRadioConfigResponse> respond(); - ::ndk::ScopedAStatus getHalDeviceCapabilities(int32_t serial) override; ::ndk::ScopedAStatus getNumOfLiveModems(int32_t serial) override; ::ndk::ScopedAStatus getPhoneCapability(int32_t serial) override; @@ -57,6 +55,9 @@ class RadioConfig : public aidl::android::hardware::radio::config::BnRadioConfig const std::vector& slotMap) override; + protected: + std::shared_ptr<::aidl::android::hardware::radio::config::IRadioConfigResponse> respond(); + public: /** * Constructs AIDL IRadioConfig instance wrapping existing HIDL IRadioConfig instance. diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h index c2c0de3b059530431cda0d06ca0c82e0b844a0bb..da198116051da23fef7c0d5d28477c27115730a1 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioData.h @@ -22,8 +22,6 @@ namespace android::hardware::radio::compat { class RadioData : public RadioCompatBase, public aidl::android::hardware::radio::data::BnRadioData { - std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> respond(); - ::ndk::ScopedAStatus allocatePduSessionId(int32_t serial) override; ::ndk::ScopedAStatus cancelHandover(int32_t serial, int32_t callId) override; ::ndk::ScopedAStatus deactivateDataCall( @@ -65,6 +63,9 @@ class RadioData : public RadioCompatBase, public aidl::android::hardware::radio: const ::aidl::android::hardware::radio::data::KeepaliveRequest& keepalive) override; ::ndk::ScopedAStatus stopKeepalive(int32_t serial, int32_t sessionHandle) override; + protected: + std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> respond(); + public: using RadioCompatBase::RadioCompatBase; }; diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h index 047f8361632ff4607a134bb290382e355496af4b..1af406aa03bf3fdce0e46a3250e06e127e32b0a6 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioMessaging.h @@ -23,8 +23,6 @@ namespace android::hardware::radio::compat { class RadioMessaging : public RadioCompatBase, public aidl::android::hardware::radio::messaging::BnRadioMessaging { - std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> respond(); - ::ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, const std::string& ackPdu) override; ::ndk::ScopedAStatus acknowledgeLastIncomingCdmaSms( @@ -82,6 +80,9 @@ class RadioMessaging : public RadioCompatBase, int32_t serial, const ::aidl::android::hardware::radio::messaging::SmsWriteArgs& smsWriteArgs) override; + protected: + std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> respond(); + public: using RadioCompatBase::RadioCompatBase; }; diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h index fdca1244ae66af01ee4562156f444f38f85d1396..beb1fb0b492609ca857ae1481cd0c656f64f00c2 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h @@ -23,8 +23,6 @@ namespace android::hardware::radio::compat { class RadioModem : public RadioCompatBase, public aidl::android::hardware::radio::modem::BnRadioModem { - std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse> respond(); - ::ndk::ScopedAStatus enableModem(int32_t serial, bool on) override; ::ndk::ScopedAStatus getBasebandVersion(int32_t serial) override; ::ndk::ScopedAStatus getDeviceIdentity(int32_t serial) override; @@ -54,6 +52,9 @@ class RadioModem : public RadioCompatBase, const std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemIndication>& radioModemIndication) override; + protected: + std::shared_ptr<::aidl::android::hardware::radio::modem::IRadioModemResponse> respond(); + public: using RadioCompatBase::RadioCompatBase; }; diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index 1731b788515013c8ee51c10b44d2bc99bef7f5a5..9784665ef7d67cc7484bcc66878b39996e238fa0 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -23,8 +23,6 @@ namespace android::hardware::radio::compat { class RadioNetwork : public RadioCompatBase, public aidl::android::hardware::radio::network::BnRadioNetwork { - std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); - ::ndk::ScopedAStatus getAllowedNetworkTypesBitmap(int32_t serial) override; ::ndk::ScopedAStatus getAvailableBandModes(int32_t serial) override; ::ndk::ScopedAStatus getAvailableNetworks(int32_t serial) override; @@ -92,6 +90,9 @@ class RadioNetwork : public RadioCompatBase, ::aidl::android::hardware::radio::network::UsageSetting usageSetting) override; ::ndk::ScopedAStatus getUsageSetting(int32_t serial) override; + protected: + std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); + public: using RadioCompatBase::RadioCompatBase; }; diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h index 84bb68b57fe090ebcfd1ccd003f7a783146da820..ff91aef5fa22cef71a02e03d4621c99c68c7f3df 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h @@ -22,8 +22,6 @@ namespace android::hardware::radio::compat { class RadioSim : public RadioCompatBase, public aidl::android::hardware::radio::sim::BnRadioSim { - std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> respond(); - ::ndk::ScopedAStatus areUiccApplicationsEnabled(int32_t serial) override; ::ndk::ScopedAStatus changeIccPin2ForApp(int32_t serial, const std::string& oldPin2, const std::string& newPin2, @@ -102,6 +100,9 @@ class RadioSim : public RadioCompatBase, public aidl::android::hardware::radio:: int32_t serial, const ::aidl::android::hardware::radio::sim::PhonebookRecordInfo& recordInfo) override; + protected: + std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> respond(); + public: using RadioCompatBase::RadioCompatBase; }; diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h index 0f1d5fda613e247c654a5e8487f022d4f8ee380d..7bc998e1761ca1e1f2e802fd2ae510e744555b69 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioVoice.h @@ -23,8 +23,6 @@ namespace android::hardware::radio::compat { class RadioVoice : public RadioCompatBase, public aidl::android::hardware::radio::voice::BnRadioVoice { - std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> respond(); - ::ndk::ScopedAStatus acceptCall(int32_t serial) override; ::ndk::ScopedAStatus cancelPendingUssd(int32_t serial) override; ::ndk::ScopedAStatus conference(int32_t serial) override; @@ -80,6 +78,9 @@ class RadioVoice : public RadioCompatBase, ::ndk::ScopedAStatus stopDtmf(int32_t serial) override; ::ndk::ScopedAStatus switchWaitingOrHoldingAndActive(int32_t serial) override; + protected: + std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> respond(); + public: using RadioCompatBase::RadioCompatBase; }; diff --git a/security/dice/aidl/Android.bp b/security/dice/aidl/Android.bp index 48c3e7e37b4879781cb8ee64c5eb06f5726d0543..5625d702692442d124628c5c0aa824487901b79a 100644 --- a/security/dice/aidl/Android.bp +++ b/security/dice/aidl/Android.bp @@ -48,5 +48,12 @@ aidl_interface { ], }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + // versions: ["1"], } diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/.hash b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..3f08fd85f5f88294f2ae1a21c00fca807c133a9d --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/.hash @@ -0,0 +1 @@ +02994f275fd7b1b40610c10eaeb0573f4312e358 diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Bcc.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Bcc.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5af73583aa505808135c607b57e4ab8c9ffe86f8 --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Bcc.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.security.dice; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable Bcc { + byte[] data; +} diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/BccHandover.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/BccHandover.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8baca94ce8280410a8dab7280acf4ecb6fdfba39 --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/BccHandover.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.security.dice; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable BccHandover { + byte[32] cdiAttest; + byte[32] cdiSeal; + android.hardware.security.dice.Bcc bcc; +} diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Config.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Config.aidl new file mode 100644 index 0000000000000000000000000000000000000000..78dd2f886c1ad83e3e803f4bd0a347c55273e7a8 --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Config.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.security.dice; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable Config { + byte[] desc; +} diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/IDiceDevice.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/IDiceDevice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..383f4d1f26f22acb15c7173c721d3c49579ce133 --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/IDiceDevice.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.security.dice; +/* @hide */ +@SensitiveData @VintfStability +interface IDiceDevice { + android.hardware.security.dice.Signature sign(in android.hardware.security.dice.InputValues[] id, in byte[] payload); + android.hardware.security.dice.Bcc getAttestationChain(in android.hardware.security.dice.InputValues[] inputValues); + android.hardware.security.dice.BccHandover derive(in android.hardware.security.dice.InputValues[] inputValues); + void demote(in android.hardware.security.dice.InputValues[] inputValues); +} diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/InputValues.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/InputValues.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e43c4292e48717a0db31f89d74fb72a89ef81bd2 --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/InputValues.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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 -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.security.dice; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable InputValues { + byte[64] codeHash; + android.hardware.security.dice.Config config; + byte[64] authorityHash; + @nullable byte[] authorityDescriptor; + android.hardware.security.dice.Mode mode = android.hardware.security.dice.Mode.NOT_INITIALIZED; + byte[64] hidden; +} diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Mode.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Mode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..295c32ec0c15170803bf00e9bb5f27a317944501 --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Mode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.security.dice; +/* @hide */ +@Backing(type="int") @VintfStability +enum Mode { + NOT_INITIALIZED = 0, + NORMAL = 1, + DEBUG = 2, + RECOVERY = 3, +} diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/ResponseCode.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/ResponseCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c13afa6d95ac11c66f8e07f5bb60b03fada55c81 --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/ResponseCode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 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 -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.security.dice; +@Backing(type="int") @VintfStability +enum ResponseCode { + PERMISSION_DENIED = 1, + SYSTEM_ERROR = 2, + NOT_IMPLEMENTED = 3, + DEMOTION_FAILED = 4, +} diff --git a/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Signature.aidl b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Signature.aidl new file mode 100644 index 0000000000000000000000000000000000000000..294170d11f388b9f79a394c7c511e354d7d01c3b --- /dev/null +++ b/security/dice/aidl/aidl_api/android.hardware.security.dice/1/android/hardware/security/dice/Signature.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.security.dice; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable Signature { + byte[] data; +} diff --git a/security/keymint/aidl/Android.bp b/security/keymint/aidl/Android.bp index 73c7b97257655e90ed4ccd45e6823f5e871bb8f0..96d44a7935d9026db843743c7717d60a88845ed5 100644 --- a/security/keymint/aidl/Android.bp +++ b/security/keymint/aidl/Android.bp @@ -32,7 +32,18 @@ aidl_interface { ], }, }, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.security.secureclock-V1"], + }, + { + version: "2", + imports: ["android.hardware.security.secureclock-V1"], + }, + + ], + } // cc_defaults that includes the latest KeyMint AIDL library. diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash new file mode 100644 index 0000000000000000000000000000000000000000..69ba9a6bc58c74c9fc723f09beee941e36b4d41d --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash @@ -0,0 +1 @@ +207c9f218b9b9e4e74ff5232eb16511eca9d7d2e diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Algorithm.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Algorithm.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6da124f6016053d934c544550dbaa517d4e9b858 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Algorithm.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum Algorithm { + RSA = 1, + EC = 3, + AES = 32, + TRIPLE_DES = 33, + HMAC = 128, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/AttestationKey.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/AttestationKey.aidl new file mode 100644 index 0000000000000000000000000000000000000000..90f2e6ee5474d997c9302215c9cd4a25c7edb733 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/AttestationKey.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 -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.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable AttestationKey { + byte[] keyBlob; + android.hardware.security.keymint.KeyParameter[] attestKeyParams; + byte[] issuerSubjectName; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/BeginResult.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/BeginResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c952a3152a376bbecbe40c54e58ffa5c48d7664b --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/BeginResult.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@VintfStability +parcelable BeginResult { + long challenge; + android.hardware.security.keymint.KeyParameter[] params; + android.hardware.security.keymint.IKeyMintOperation operation; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/BlockMode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/BlockMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..004988326b4c19c32f3bc89e2b073fcd73e5d0b5 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/BlockMode.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum BlockMode { + ECB = 1, + CBC = 2, + CTR = 3, + GCM = 32, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Certificate.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Certificate.aidl new file mode 100644 index 0000000000000000000000000000000000000000..645f0a72ee62bbb051260f37162d452ea7c75fd1 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Certificate.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 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 -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.security.keymint; +/* @hide */ +@VintfStability +parcelable Certificate { + byte[] encodedCertificate; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d04d49cea83d17bcf077b49a3f818b7acf6f9fcb --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.security.keymint; +/* @hide */ +@VintfStability +parcelable DeviceInfo { + byte[] deviceInfo; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Digest.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Digest.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0df709609f3778ab2818368385d3a50a9487e52f --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Digest.aidl @@ -0,0 +1,45 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum Digest { + NONE = 0, + MD5 = 1, + SHA1 = 2, + SHA_2_224 = 3, + SHA_2_256 = 4, + SHA_2_384 = 5, + SHA_2_512 = 6, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/EcCurve.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/EcCurve.aidl new file mode 100644 index 0000000000000000000000000000000000000000..ffc7efe0e7c240eb28e2abad235173fd3d46a040 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/EcCurve.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum EcCurve { + P_224 = 0, + P_256 = 1, + P_384 = 2, + P_521 = 3, + CURVE_25519 = 4, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ErrorCode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ErrorCode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b05a0f3d8352b4aa3cc8f4714bbd18adf3841035 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ErrorCode.aidl @@ -0,0 +1,125 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum ErrorCode { + OK = 0, + ROOT_OF_TRUST_ALREADY_SET = -1, + UNSUPPORTED_PURPOSE = -2, + INCOMPATIBLE_PURPOSE = -3, + UNSUPPORTED_ALGORITHM = -4, + INCOMPATIBLE_ALGORITHM = -5, + UNSUPPORTED_KEY_SIZE = -6, + UNSUPPORTED_BLOCK_MODE = -7, + INCOMPATIBLE_BLOCK_MODE = -8, + UNSUPPORTED_MAC_LENGTH = -9, + UNSUPPORTED_PADDING_MODE = -10, + INCOMPATIBLE_PADDING_MODE = -11, + UNSUPPORTED_DIGEST = -12, + INCOMPATIBLE_DIGEST = -13, + INVALID_EXPIRATION_TIME = -14, + INVALID_USER_ID = -15, + INVALID_AUTHORIZATION_TIMEOUT = -16, + UNSUPPORTED_KEY_FORMAT = -17, + INCOMPATIBLE_KEY_FORMAT = -18, + UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM = -19, + UNSUPPORTED_KEY_VERIFICATION_ALGORITHM = -20, + INVALID_INPUT_LENGTH = -21, + KEY_EXPORT_OPTIONS_INVALID = -22, + DELEGATION_NOT_ALLOWED = -23, + KEY_NOT_YET_VALID = -24, + KEY_EXPIRED = -25, + KEY_USER_NOT_AUTHENTICATED = -26, + OUTPUT_PARAMETER_NULL = -27, + INVALID_OPERATION_HANDLE = -28, + INSUFFICIENT_BUFFER_SPACE = -29, + VERIFICATION_FAILED = -30, + TOO_MANY_OPERATIONS = -31, + UNEXPECTED_NULL_POINTER = -32, + INVALID_KEY_BLOB = -33, + IMPORTED_KEY_NOT_ENCRYPTED = -34, + IMPORTED_KEY_DECRYPTION_FAILED = -35, + IMPORTED_KEY_NOT_SIGNED = -36, + IMPORTED_KEY_VERIFICATION_FAILED = -37, + INVALID_ARGUMENT = -38, + UNSUPPORTED_TAG = -39, + INVALID_TAG = -40, + MEMORY_ALLOCATION_FAILED = -41, + IMPORT_PARAMETER_MISMATCH = -44, + SECURE_HW_ACCESS_DENIED = -45, + OPERATION_CANCELLED = -46, + CONCURRENT_ACCESS_CONFLICT = -47, + SECURE_HW_BUSY = -48, + SECURE_HW_COMMUNICATION_FAILED = -49, + UNSUPPORTED_EC_FIELD = -50, + MISSING_NONCE = -51, + INVALID_NONCE = -52, + MISSING_MAC_LENGTH = -53, + KEY_RATE_LIMIT_EXCEEDED = -54, + CALLER_NONCE_PROHIBITED = -55, + KEY_MAX_OPS_EXCEEDED = -56, + INVALID_MAC_LENGTH = -57, + MISSING_MIN_MAC_LENGTH = -58, + UNSUPPORTED_MIN_MAC_LENGTH = -59, + UNSUPPORTED_KDF = -60, + UNSUPPORTED_EC_CURVE = -61, + KEY_REQUIRES_UPGRADE = -62, + ATTESTATION_CHALLENGE_MISSING = -63, + KEYMINT_NOT_CONFIGURED = -64, + ATTESTATION_APPLICATION_ID_MISSING = -65, + CANNOT_ATTEST_IDS = -66, + ROLLBACK_RESISTANCE_UNAVAILABLE = -67, + HARDWARE_TYPE_UNAVAILABLE = -68, + PROOF_OF_PRESENCE_REQUIRED = -69, + CONCURRENT_PROOF_OF_PRESENCE_REQUESTED = -70, + NO_USER_CONFIRMATION = -71, + DEVICE_LOCKED = -72, + EARLY_BOOT_ENDED = -73, + ATTESTATION_KEYS_NOT_PROVISIONED = -74, + ATTESTATION_IDS_NOT_PROVISIONED = -75, + INVALID_OPERATION = -76, + STORAGE_KEY_UNSUPPORTED = -77, + INCOMPATIBLE_MGF_DIGEST = -78, + UNSUPPORTED_MGF_DIGEST = -79, + MISSING_NOT_BEFORE = -80, + MISSING_NOT_AFTER = -81, + MISSING_ISSUER_SUBJECT = -82, + INVALID_ISSUER_SUBJECT = -83, + BOOT_LEVEL_EXCEEDED = -84, + HARDWARE_NOT_YET_AVAILABLE = -85, + UNIMPLEMENTED = -100, + VERSION_MISMATCH = -101, + UNKNOWN_ERROR = -1000, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/HardwareAuthToken.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/HardwareAuthToken.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2e07924382f5045adcf1229ab5789f73abff1ef9 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/HardwareAuthToken.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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 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 -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.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable HardwareAuthToken { + long challenge; + long userId; + long authenticatorId; + android.hardware.security.keymint.HardwareAuthenticatorType authenticatorType = android.hardware.security.keymint.HardwareAuthenticatorType.NONE; + android.hardware.security.secureclock.Timestamp timestamp; + byte[] mac; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/HardwareAuthenticatorType.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/HardwareAuthenticatorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dfc98f0066808308ea9a52a2e915c9419dc9dcdf --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/HardwareAuthenticatorType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum HardwareAuthenticatorType { + NONE = 0, + PASSWORD = 1, + FINGERPRINT = 2, + ANY = -1, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IKeyMintDevice.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dcc22c4ba7b602b2e648bf2bc7657c21ca278e50 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IKeyMintDevice.aidl @@ -0,0 +1,56 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@SensitiveData @VintfStability +interface IKeyMintDevice { + android.hardware.security.keymint.KeyMintHardwareInfo getHardwareInfo(); + void addRngEntropy(in byte[] data); + android.hardware.security.keymint.KeyCreationResult generateKey(in android.hardware.security.keymint.KeyParameter[] keyParams, in @nullable android.hardware.security.keymint.AttestationKey attestationKey); + android.hardware.security.keymint.KeyCreationResult importKey(in android.hardware.security.keymint.KeyParameter[] keyParams, in android.hardware.security.keymint.KeyFormat keyFormat, in byte[] keyData, in @nullable android.hardware.security.keymint.AttestationKey attestationKey); + android.hardware.security.keymint.KeyCreationResult importWrappedKey(in byte[] wrappedKeyData, in byte[] wrappingKeyBlob, in byte[] maskingKey, in android.hardware.security.keymint.KeyParameter[] unwrappingParams, in long passwordSid, in long biometricSid); + byte[] upgradeKey(in byte[] keyBlobToUpgrade, in android.hardware.security.keymint.KeyParameter[] upgradeParams); + void deleteKey(in byte[] keyBlob); + void deleteAllKeys(); + void destroyAttestationIds(); + android.hardware.security.keymint.BeginResult begin(in android.hardware.security.keymint.KeyPurpose purpose, in byte[] keyBlob, in android.hardware.security.keymint.KeyParameter[] params, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken); + void deviceLocked(in boolean passwordOnly, in @nullable android.hardware.security.secureclock.TimeStampToken timestampToken); + void earlyBootEnded(); + byte[] convertStorageKeyToEphemeral(in byte[] storageKeyBlob); + android.hardware.security.keymint.KeyCharacteristics[] getKeyCharacteristics(in byte[] keyBlob, in byte[] appId, in byte[] appData); + byte[16] getRootOfTrustChallenge(); + byte[] getRootOfTrust(in byte[16] challenge); + void sendRootOfTrust(in byte[] rootOfTrust); + const int AUTH_TOKEN_MAC_LENGTH = 32; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IKeyMintOperation.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IKeyMintOperation.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4ab4ffed1162d79ed0ee2b1a6a3be484973496be --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IKeyMintOperation.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@SensitiveData @VintfStability +interface IKeyMintOperation { + void updateAad(in byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timeStampToken); + byte[] update(in byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timeStampToken); + byte[] finish(in @nullable byte[] input, in @nullable byte[] signature, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timestampToken, in @nullable byte[] confirmationToken); + void abort(); +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f56646227b9915b8f39956a66a6f3c138aafe30f --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl @@ -0,0 +1,46 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@VintfStability +interface IRemotelyProvisionedComponent { + android.hardware.security.keymint.RpcHardwareInfo getHardwareInfo(); + byte[] generateEcdsaP256KeyPair(in boolean testMode, out android.hardware.security.keymint.MacedPublicKey macedPublicKey); + byte[] generateCertificateRequest(in boolean testMode, in android.hardware.security.keymint.MacedPublicKey[] keysToSign, in byte[] endpointEncryptionCertChain, in byte[] challenge, out android.hardware.security.keymint.DeviceInfo deviceInfo, out android.hardware.security.keymint.ProtectedData protectedData); + const int STATUS_FAILED = 1; + const int STATUS_INVALID_MAC = 2; + const int STATUS_PRODUCTION_KEY_IN_TEST_REQUEST = 3; + const int STATUS_TEST_KEY_IN_PRODUCTION_REQUEST = 4; + const int STATUS_INVALID_EEK = 5; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyCharacteristics.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyCharacteristics.aidl new file mode 100644 index 0000000000000000000000000000000000000000..008381f2828f650eb6cf132c597d3585519b8aae --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyCharacteristics.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@VintfStability +parcelable KeyCharacteristics { + android.hardware.security.keymint.SecurityLevel securityLevel = android.hardware.security.keymint.SecurityLevel.SOFTWARE; + android.hardware.security.keymint.KeyParameter[] authorizations; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyCreationResult.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyCreationResult.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9f77d3e3d55dcec73c1e02d0a1cb5a37b05e63c5 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyCreationResult.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 -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.security.keymint; +/* @hide */ +@VintfStability +parcelable KeyCreationResult { + byte[] keyBlob; + android.hardware.security.keymint.KeyCharacteristics[] keyCharacteristics; + android.hardware.security.keymint.Certificate[] certificateChain; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyFormat.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyFormat.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9560d8d2b5303dc4949dbd34aa17b60e3fcba31f --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyFormat.aidl @@ -0,0 +1,41 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum KeyFormat { + X509 = 0, + PKCS8 = 1, + RAW = 3, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyMintHardwareInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyMintHardwareInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2113e42a8ece6242b5cefc706ad420df53f80292 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyMintHardwareInfo.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable KeyMintHardwareInfo { + int versionNumber; + android.hardware.security.keymint.SecurityLevel securityLevel = android.hardware.security.keymint.SecurityLevel.SOFTWARE; + @utf8InCpp String keyMintName; + @utf8InCpp String keyMintAuthorName; + boolean timestampTokenRequired; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyOrigin.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyOrigin.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b3c659ffe661cf74483342cc80b2e31792d8fc3 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyOrigin.aidl @@ -0,0 +1,43 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum KeyOrigin { + GENERATED = 0, + DERIVED = 1, + IMPORTED = 2, + RESERVED = 3, + SECURELY_IMPORTED = 4, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyParameter.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyParameter.aidl new file mode 100644 index 0000000000000000000000000000000000000000..c5a1e011d218f5a4fce6047e832901280cf79539 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyParameter.aidl @@ -0,0 +1,40 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable KeyParameter { + android.hardware.security.keymint.Tag tag = android.hardware.security.keymint.Tag.INVALID; + android.hardware.security.keymint.KeyParameterValue value; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyParameterValue.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyParameterValue.aidl new file mode 100644 index 0000000000000000000000000000000000000000..7a0b074fe555683f84a334b03cba59413573f440 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyParameterValue.aidl @@ -0,0 +1,53 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +union KeyParameterValue { + int invalid; + android.hardware.security.keymint.Algorithm algorithm; + android.hardware.security.keymint.BlockMode blockMode; + android.hardware.security.keymint.PaddingMode paddingMode; + android.hardware.security.keymint.Digest digest; + android.hardware.security.keymint.EcCurve ecCurve; + android.hardware.security.keymint.KeyOrigin origin; + android.hardware.security.keymint.KeyPurpose keyPurpose; + android.hardware.security.keymint.HardwareAuthenticatorType hardwareAuthenticatorType; + android.hardware.security.keymint.SecurityLevel securityLevel; + boolean boolValue; + int integer; + long longInteger; + long dateTime; + byte[] blob; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyPurpose.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyPurpose.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b84bec1fc0b790c5811254265179eb18710cdc81 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/KeyPurpose.aidl @@ -0,0 +1,45 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum KeyPurpose { + ENCRYPT = 0, + DECRYPT = 1, + SIGN = 2, + VERIFY = 3, + WRAP_KEY = 5, + AGREE_KEY = 6, + ATTEST_KEY = 7, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8095e8ce0436344be4c0ef701a987de0b2cc695d --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl @@ -0,0 +1,39 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@VintfStability +parcelable MacedPublicKey { + byte[] macedKey; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/PaddingMode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/PaddingMode.aidl new file mode 100644 index 0000000000000000000000000000000000000000..dba4a8a06e2a902a64c854d960c421bab70d709f --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/PaddingMode.aidl @@ -0,0 +1,44 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum PaddingMode { + NONE = 1, + RSA_OAEP = 2, + RSA_PSS = 3, + RSA_PKCS1_1_5_ENCRYPT = 4, + RSA_PKCS1_1_5_SIGN = 5, + PKCS7 = 64, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d1610b4d6fd21f01d724aa57c963b264fec4c4f2 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.security.keymint; +/* @hide */ +@VintfStability +parcelable ProtectedData { + byte[] protectedData; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..5ff45f8a94390d03dc9cba1662dc6e3f4595077f --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable RpcHardwareInfo { + int versionNumber; + @utf8InCpp String rpcAuthorName; + int supportedEekCurve = 0; + @nullable @utf8InCpp String uniqueId; + const int CURVE_NONE = 0; + const int CURVE_P256 = 1; + const int CURVE_25519 = 2; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/SecurityLevel.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/SecurityLevel.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0d278e0af9d9d38ef00d15fc936a8d158ef44feb --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/SecurityLevel.aidl @@ -0,0 +1,42 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum SecurityLevel { + SOFTWARE = 0, + TRUSTED_ENVIRONMENT = 1, + STRONGBOX = 2, + KEYSTORE = 100, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Tag.aidl new file mode 100644 index 0000000000000000000000000000000000000000..e310b4448f8af647ad04015f64251f560a208b55 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/Tag.aidl @@ -0,0 +1,103 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum Tag { + INVALID = 0, + PURPOSE = 536870913, + ALGORITHM = 268435458, + KEY_SIZE = 805306371, + BLOCK_MODE = 536870916, + DIGEST = 536870917, + PADDING = 536870918, + CALLER_NONCE = 1879048199, + MIN_MAC_LENGTH = 805306376, + EC_CURVE = 268435466, + RSA_PUBLIC_EXPONENT = 1342177480, + INCLUDE_UNIQUE_ID = 1879048394, + RSA_OAEP_MGF_DIGEST = 536871115, + BOOTLOADER_ONLY = 1879048494, + ROLLBACK_RESISTANCE = 1879048495, + HARDWARE_TYPE = 268435760, + EARLY_BOOT_ONLY = 1879048497, + ACTIVE_DATETIME = 1610613136, + ORIGINATION_EXPIRE_DATETIME = 1610613137, + USAGE_EXPIRE_DATETIME = 1610613138, + MIN_SECONDS_BETWEEN_OPS = 805306771, + MAX_USES_PER_BOOT = 805306772, + USAGE_COUNT_LIMIT = 805306773, + USER_ID = 805306869, + USER_SECURE_ID = -1610612234, + NO_AUTH_REQUIRED = 1879048695, + USER_AUTH_TYPE = 268435960, + AUTH_TIMEOUT = 805306873, + ALLOW_WHILE_ON_BODY = 1879048698, + TRUSTED_USER_PRESENCE_REQUIRED = 1879048699, + TRUSTED_CONFIRMATION_REQUIRED = 1879048700, + UNLOCKED_DEVICE_REQUIRED = 1879048701, + APPLICATION_ID = -1879047591, + APPLICATION_DATA = -1879047492, + CREATION_DATETIME = 1610613437, + ORIGIN = 268436158, + ROOT_OF_TRUST = -1879047488, + OS_VERSION = 805307073, + OS_PATCHLEVEL = 805307074, + UNIQUE_ID = -1879047485, + ATTESTATION_CHALLENGE = -1879047484, + ATTESTATION_APPLICATION_ID = -1879047483, + ATTESTATION_ID_BRAND = -1879047482, + ATTESTATION_ID_DEVICE = -1879047481, + ATTESTATION_ID_PRODUCT = -1879047480, + ATTESTATION_ID_SERIAL = -1879047479, + ATTESTATION_ID_IMEI = -1879047478, + ATTESTATION_ID_MEID = -1879047477, + ATTESTATION_ID_MANUFACTURER = -1879047476, + ATTESTATION_ID_MODEL = -1879047475, + VENDOR_PATCHLEVEL = 805307086, + BOOT_PATCHLEVEL = 805307087, + DEVICE_UNIQUE_ATTESTATION = 1879048912, + IDENTITY_CREDENTIAL_KEY = 1879048913, + STORAGE_KEY = 1879048914, + ASSOCIATED_DATA = -1879047192, + NONCE = -1879047191, + MAC_LENGTH = 805307371, + RESET_SINCE_ID_ROTATION = 1879049196, + CONFIRMATION_TOKEN = -1879047187, + CERTIFICATE_SERIAL = -2147482642, + CERTIFICATE_SUBJECT = -1879047185, + CERTIFICATE_NOT_BEFORE = 1610613744, + CERTIFICATE_NOT_AFTER = 1610613745, + MAX_BOOT_LEVEL = 805307378, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/TagType.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/TagType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..a7d1de5fd406dd0c390b82f8f8748121b7a45e7e --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/TagType.aidl @@ -0,0 +1,49 @@ +/* + * 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 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 -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.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum TagType { + INVALID = 0, + ENUM = 268435456, + ENUM_REP = 536870912, + UINT = 805306368, + UINT_REP = 1073741824, + ULONG = 1342177280, + DATE = 1610612736, + BOOL = 1879048192, + BIGNUM = -2147483648, + BYTES = -1879048192, + ULONG_REP = -1610612736, +} diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp index 53ceb0d92f3fcb9a245fc7d226b0ca35be2ddfd7..43ee3276b957019dfbc8c94db205630807092f13 100644 --- a/sensors/1.0/default/convert.cpp +++ b/sensors/1.0/default/convert.cpp @@ -190,8 +190,6 @@ void convertFromSensorEvent(const sensors_event_t &src, Event *dst) { } default: { - CHECK_GE((int32_t)dst->sensorType, (int32_t)SensorType::DEVICE_PRIVATE_BASE); - memcpy(dst->u.data.data(), src.data, 16 * sizeof(float)); break; } @@ -330,9 +328,6 @@ void convertToSensorEvent(const Event &src, sensors_event_t *dst) { } default: { - CHECK_GE((int32_t)src.sensorType, - (int32_t)SensorType::DEVICE_PRIVATE_BASE); - memcpy(dst->data, src.u.data.data(), 16 * sizeof(float)); break; } diff --git a/sensors/1.0/vts/functional/Android.bp b/sensors/1.0/vts/functional/Android.bp index 274cfa7fd65ca7e5cdfd689eca8ec4ddbd2ac87d..d53179a3801e040c9dd29041273259a7a744fe71 100644 --- a/sensors/1.0/vts/functional/Android.bp +++ b/sensors/1.0/vts/functional/Android.bp @@ -26,7 +26,10 @@ package { cc_test { name: "VtsHalSensorsV1_0TargetTest", cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalSensorsDefaults", + "VtsHalTargetTestDefaults", + ], tidy_timeout_srcs: [ "VtsHalSensorsV1_0TargetTest.cpp", ], @@ -34,9 +37,12 @@ cc_test { "SensorsHidlEnvironmentV1_0.cpp", "VtsHalSensorsV1_0TargetTest.cpp", ], + shared_libs: [ + "libbinder_ndk", + "libvndksupport", + ], static_libs: [ "android.hardware.sensors@1.0", - "VtsHalSensorsTargetTestUtils", ], test_suites: [ "general-tests", diff --git a/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.cpp b/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.cpp index aca6961e0d77f3e8da25ab006a2b7fa8e4ff8998..c69f32a76d3e539d1fa089944de2b77c114f3ead 100644 --- a/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.cpp +++ b/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.cpp @@ -25,7 +25,7 @@ using ::android::hardware::sensors::V1_0::ISensors; using ::android::hardware::sensors::V1_0::Result; using ::android::hardware::sensors::V1_0::SensorInfo; -void SensorsHidlEnvironmentV1_0::HidlTearDown() { +void SensorsHidlEnvironmentV1_0::TearDown() { mStopThread = true; if (mPollThread.joinable()) { mPollThread.detach(); diff --git a/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h b/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h index 168777d8be1499ce49ef2c67935257f056898a3f..b802e6c4b1ec92c0bb8aca06f97331b62697a68f 100644 --- a/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h +++ b/sensors/1.0/vts/functional/SensorsHidlEnvironmentV1_0.h @@ -17,7 +17,7 @@ #ifndef ANDROID_SENSORS_HIDL_ENVIRONMENT_V1_0_H #define ANDROID_SENSORS_HIDL_ENVIRONMENT_V1_0_H -#include "sensors-vts-utils/SensorsHidlEnvironmentBase.h" +#include "sensors-vts-utils/SensorsVtsEnvironmentBase.h" #include #include @@ -30,13 +30,13 @@ using ::android::sp; class SensorsHidlTest; class SensorsHidlEnvironmentV1_0 - : public SensorsHidlEnvironmentBase<::android::hardware::sensors::V1_0::Event> { + : public SensorsVtsEnvironmentBase<::android::hardware::sensors::V1_0::Event> { public: - void HidlTearDown() override; + void TearDown() override; using Event = ::android::hardware::sensors::V1_0::Event; SensorsHidlEnvironmentV1_0(const std::string& service_name) - : SensorsHidlEnvironmentBase(service_name) {} + : SensorsVtsEnvironmentBase(service_name) {} private: friend SensorsHidlTest; diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp index d46cf5a4908da348246e5448bf9daf431dc94603..e4fa96930c17e9ad5b654215007e23fcddf69c1b 100644 --- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp +++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp @@ -39,12 +39,12 @@ class SensorsHidlTest : public SensorsHidlTestBaseHidlSetUp(); + mEnvironment->SetUp(); // Ensure that we have a valid environment before performing tests ASSERT_NE(S(), nullptr); } - virtual void TearDown() override { mEnvironment->HidlTearDown(); } + virtual void TearDown() override { mEnvironment->TearDown(); } protected: SensorInfo defaultSensorByType(SensorType type) override; @@ -81,7 +81,7 @@ class SensorsHidlTest : public SensorsHidlTestBase& S() { return mEnvironment->sensors; } - SensorsHidlEnvironmentBase* getEnvironment() override { return mEnvironment; } + SensorsVtsEnvironmentBase* getEnvironment() override { return mEnvironment; } private: // Test environment for sensors HAL. diff --git a/sensors/2.0/vts/functional/Android.bp b/sensors/2.0/vts/functional/Android.bp index c4ec866fc1fa4961c1674ef1d21de549da57e69f..62eaf6b765c051205bab7afc08e75a9503c23e22 100644 --- a/sensors/2.0/vts/functional/Android.bp +++ b/sensors/2.0/vts/functional/Android.bp @@ -26,7 +26,10 @@ package { cc_test { name: "VtsHalSensorsV2_0TargetTest", cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalSensorsDefaults", + "VtsHalTargetTestDefaults", + ], tidy_timeout_srcs: [ "VtsHalSensorsV2_0TargetTest.cpp", ], @@ -36,13 +39,15 @@ cc_test { header_libs: [ "android.hardware.sensors@2.X-shared-utils", ], + shared_libs: [ + "libbinder_ndk", + ], static_libs: [ "android.hardware.sensors@1.0", "android.hardware.sensors@1.0-convert", "android.hardware.sensors@2.0", "android.hardware.sensors@2.1", "libfmq", - "VtsHalSensorsTargetTestUtils", "VtsHalSensorsV2_0TargetTest-lib", ], test_suites: [ diff --git a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp index e212423fa7a27dffc5923501828c3367334e6ab7..d7d061a48e6bc078a6c8f5530d1bf84984623bbc 100644 --- a/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp +++ b/sensors/2.0/vts/functional/VtsHalSensorsV2_0TargetTest.cpp @@ -256,8 +256,8 @@ TEST_P(SensorsHidlTest, CleanupDirectConnectionOnInitialize) { // Clear the active direct connections so they are not stopped during TearDown auto handles = mDirectChannelHandles; mDirectChannelHandles.clear(); - getEnvironment()->HidlTearDown(); - getEnvironment()->HidlSetUp(); + getEnvironment()->TearDown(); + getEnvironment()->SetUp(); if (HasFatalFailure()) { return; // Exit early if resetting the environment failed } diff --git a/sensors/2.1/vts/functional/Android.bp b/sensors/2.1/vts/functional/Android.bp index 3659e11ffc89289d66065e7307bca55b042ad82d..61cfd14d15b5e35a88a922184af50cc748edd7c1 100644 --- a/sensors/2.1/vts/functional/Android.bp +++ b/sensors/2.1/vts/functional/Android.bp @@ -28,7 +28,10 @@ cc_test { cflags: [ "-DLOG_TAG=\"sensors_hidl_hal_test\"", ], - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalSensorsDefaults", + "VtsHalTargetTestDefaults", + ], srcs: [ "VtsHalSensorsV2_1TargetTest.cpp", ], @@ -41,7 +44,6 @@ cc_test { "android.hardware.sensors@2.0", "android.hardware.sensors@2.1", "libfmq", - "VtsHalSensorsTargetTestUtils", "VtsHalSensorsV2_1TargetTest-lib", ], test_suites: [ diff --git a/sensors/aidl/Android.bp b/sensors/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..d04017ccd0b46e84886a83eb779569b7a4afeb58 --- /dev/null +++ b/sensors/aidl/Android.bp @@ -0,0 +1,37 @@ +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"], +} + +aidl_interface { + name: "android.hardware.sensors", + vendor_available: true, + srcs: ["android/hardware/sensors/*.aidl"], + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + ], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + ], + }, + ], + +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/.hash b/sensors/aidl/aidl_api/android.hardware.sensors/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..4002c53793d1ae88294899e6f7b7cc0da129530c --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/.hash @@ -0,0 +1 @@ +c38c6b75e592ba5a6400b6348ad7f27db3064410 diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/AdditionalInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/AdditionalInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..518472305de74f121e7aae5c1b8809590b9ef6ff --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/AdditionalInfo.aidl @@ -0,0 +1,76 @@ +/* + * 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 -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.sensors; +@FixedSize @VintfStability +parcelable AdditionalInfo { + android.hardware.sensors.AdditionalInfo.AdditionalInfoType type; + int serial; + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload payload; + @FixedSize @VintfStability + union AdditionalInfoPayload { + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload.Int32Values dataInt32; + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload.FloatValues dataFloat; + @FixedSize @VintfStability + parcelable Int32Values { + int[14] values; + } + @FixedSize @VintfStability + parcelable FloatValues { + float[14] values; + } + } + @Backing(type="int") @VintfStability + enum AdditionalInfoType { + AINFO_BEGIN = 0, + AINFO_END = 1, + AINFO_UNTRACKED_DELAY = 65536, + AINFO_INTERNAL_TEMPERATURE = 65537, + AINFO_VEC3_CALIBRATION = 65538, + AINFO_SENSOR_PLACEMENT = 65539, + AINFO_SAMPLING = 65540, + AINFO_CHANNEL_NOISE = 131072, + AINFO_CHANNEL_SAMPLER = 131073, + AINFO_CHANNEL_FILTER = 131074, + AINFO_CHANNEL_LINEAR_TRANSFORM = 131075, + AINFO_CHANNEL_NONLINEAR_MAP = 131076, + AINFO_CHANNEL_RESAMPLER = 131077, + AINFO_LOCAL_GEOMAGNETIC_FIELD = 196608, + AINFO_LOCAL_GRAVITY = 196609, + AINFO_DOCK_STATE = 196610, + AINFO_HIGH_PERFORMANCE_MODE = 196611, + AINFO_MAGNETIC_FIELD_CALIBRATION = 196612, + AINFO_CUSTOM_START = 268435456, + AINFO_DEBUGGING_START = 1073741824, + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/DynamicSensorInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/DynamicSensorInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c9a493a91ebae64b045cbe73a3d85238855cc25 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/DynamicSensorInfo.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.sensors; +@FixedSize @VintfStability +parcelable DynamicSensorInfo { + boolean connected; + int sensorHandle; + android.hardware.sensors.DynamicSensorInfo.Uuid uuid; + @FixedSize @VintfStability + parcelable Uuid { + byte[16] values; + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/Event.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/Event.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f49002fce80532a772b1bad6d82893e377f4213 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/Event.aidl @@ -0,0 +1,139 @@ +/* + * 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 -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.sensors; +@FixedSize @VintfStability +parcelable Event { + long timestamp; + int sensorHandle; + android.hardware.sensors.SensorType sensorType; + android.hardware.sensors.Event.EventPayload payload; + @FixedSize @VintfStability + union EventPayload { + android.hardware.sensors.Event.EventPayload.Vec3 vec3; + android.hardware.sensors.Event.EventPayload.Vec4 vec4; + android.hardware.sensors.Event.EventPayload.Uncal uncal; + android.hardware.sensors.Event.EventPayload.MetaData meta; + float scalar; + long stepCount; + android.hardware.sensors.Event.EventPayload.HeartRate heartRate; + android.hardware.sensors.Event.EventPayload.Pose6Dof pose6DOF; + android.hardware.sensors.DynamicSensorInfo dynamic; + android.hardware.sensors.AdditionalInfo additional; + android.hardware.sensors.Event.EventPayload.Data data; + android.hardware.sensors.Event.EventPayload.HeadTracker headTracker; + android.hardware.sensors.Event.EventPayload.LimitedAxesImu limitedAxesImu; + android.hardware.sensors.Event.EventPayload.LimitedAxesImuUncal limitedAxesImuUncal; + android.hardware.sensors.Event.EventPayload.Heading heading; + @FixedSize @VintfStability + parcelable Vec4 { + float x; + float y; + float z; + float w; + } + @FixedSize @VintfStability + parcelable Vec3 { + float x; + float y; + float z; + android.hardware.sensors.SensorStatus status; + } + @FixedSize @VintfStability + parcelable Uncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + } + @FixedSize @VintfStability + parcelable HeadTracker { + float rx; + float ry; + float rz; + float vx; + float vy; + float vz; + int discontinuityCount; + } + @FixedSize @VintfStability + parcelable LimitedAxesImu { + float x; + float y; + float z; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability + parcelable LimitedAxesImuUncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability + parcelable HeartRate { + float bpm; + android.hardware.sensors.SensorStatus status; + } + @FixedSize @VintfStability + parcelable Heading { + float heading; + float accuracy; + } + @FixedSize @VintfStability + parcelable MetaData { + android.hardware.sensors.Event.EventPayload.MetaData.MetaDataEventType what; + @Backing(type="int") @VintfStability + enum MetaDataEventType { + META_DATA_FLUSH_COMPLETE = 1, + } + } + @FixedSize @VintfStability + parcelable Pose6Dof { + float[15] values; + } + @FixedSize @VintfStability + parcelable Data { + float[16] values; + } + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/ISensors.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/ISensors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f60f5bb24771c16a438e77d95864c7bba185eb5f --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/ISensors.aidl @@ -0,0 +1,89 @@ +/* + * 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 -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.sensors; +@VintfStability +interface ISensors { + void activate(in int sensorHandle, in boolean enabled); + void batch(in int sensorHandle, in long samplingPeriodNs, in long maxReportLatencyNs); + int configDirectReport(in int sensorHandle, in int channelHandle, in android.hardware.sensors.ISensors.RateLevel rate); + void flush(in int sensorHandle); + android.hardware.sensors.SensorInfo[] getSensorsList(); + void initialize(in android.hardware.common.fmq.MQDescriptor eventQueueDescriptor, in android.hardware.common.fmq.MQDescriptor wakeLockDescriptor, in android.hardware.sensors.ISensorsCallback sensorsCallback); + void injectSensorData(in android.hardware.sensors.Event event); + int registerDirectChannel(in android.hardware.sensors.ISensors.SharedMemInfo mem); + void setOperationMode(in android.hardware.sensors.ISensors.OperationMode mode); + void unregisterDirectChannel(in int channelHandle); + const int ERROR_NO_MEMORY = -12; + const int ERROR_BAD_VALUE = -22; + const int WAKE_LOCK_TIMEOUT_SECONDS = 1; + const int EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS = 1; + const int EVENT_QUEUE_FLAG_BITS_EVENTS_READ = 2; + const int WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN = 1; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD = 0; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_REPORT_TOKEN = 4; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_SENSOR_TYPE = 8; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER = 12; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_TIMESTAMP = 16; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 24; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 88; + const int DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH = 104; + @Backing(type="int") @VintfStability + enum RateLevel { + STOP = 0, + NORMAL = 1, + FAST = 2, + VERY_FAST = 3, + } + @Backing(type="int") @VintfStability + enum OperationMode { + NORMAL = 0, + DATA_INJECTION = 1, + } + @VintfStability + parcelable SharedMemInfo { + android.hardware.sensors.ISensors.SharedMemInfo.SharedMemType type; + android.hardware.sensors.ISensors.SharedMemInfo.SharedMemFormat format; + int size; + android.hardware.common.NativeHandle memoryHandle; + @Backing(type="int") @VintfStability + enum SharedMemFormat { + SENSORS_EVENT = 1, + } + @Backing(type="int") @VintfStability + enum SharedMemType { + ASHMEM = 1, + GRALLOC = 2, + } + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/ISensorsCallback.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/ISensorsCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..78ab56711bd567be0fa6630ca7d19a8ebc301735 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/ISensorsCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.sensors; +@VintfStability +interface ISensorsCallback { + void onDynamicSensorsConnected(in android.hardware.sensors.SensorInfo[] sensorInfos); + void onDynamicSensorsDisconnected(in int[] sensorHandles); +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..996be3d4dbd4a85beba35dd5dac6e3ab5c31e8c1 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorInfo.aidl @@ -0,0 +1,71 @@ +/* + * 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 -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.sensors; +@VintfStability +parcelable SensorInfo { + int sensorHandle; + String name; + String vendor; + int version; + android.hardware.sensors.SensorType type; + String typeAsString; + float maxRange; + float resolution; + float power; + int minDelayUs; + int fifoReservedEventCount; + int fifoMaxEventCount; + String requiredPermission; + int maxDelayUs; + int flags; + const int SENSOR_FLAG_BITS_WAKE_UP = 1; + const int SENSOR_FLAG_BITS_CONTINUOUS_MODE = 0; + const int SENSOR_FLAG_BITS_ON_CHANGE_MODE = 2; + const int SENSOR_FLAG_BITS_ONE_SHOT_MODE = 4; + const int SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE = 6; + const int SENSOR_FLAG_BITS_DATA_INJECTION = 16; + const int SENSOR_FLAG_BITS_DYNAMIC_SENSOR = 32; + const int SENSOR_FLAG_BITS_ADDITIONAL_INFO = 64; + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM = 1024; + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_GRALLOC = 2048; + const int SENSOR_FLAG_BITS_MASK_REPORTING_MODE = 14; + const int SENSOR_FLAG_BITS_MASK_DIRECT_REPORT = 896; + const int SENSOR_FLAG_BITS_MASK_DIRECT_CHANNEL = 3072; + const int SENSOR_FLAG_SHIFT_REPORTING_MODE = 1; + const int SENSOR_FLAG_SHIFT_DATA_INJECTION = 4; + const int SENSOR_FLAG_SHIFT_DYNAMIC_SENSOR = 5; + const int SENSOR_FLAG_SHIFT_ADDITIONAL_INFO = 6; + const int SENSOR_FLAG_SHIFT_DIRECT_REPORT = 7; + const int SENSOR_FLAG_SHIFT_DIRECT_CHANNEL = 10; +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorStatus.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..45217107fc6d9f16007f313c94e6beaf007c8956 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.sensors; +@Backing(type="byte") @VintfStability +enum SensorStatus { + NO_CONTACT = -1, + UNRELIABLE = 0, + ACCURACY_LOW = 1, + ACCURACY_MEDIUM = 2, + ACCURACY_HIGH = 3, +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorType.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8c864e90be18e1e9f328404ed7cb7a27306b62d3 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/1/android/hardware/sensors/SensorType.aidl @@ -0,0 +1,80 @@ +/* + * 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 -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.sensors; +@Backing(type="int") @VintfStability +enum SensorType { + META_DATA = 0, + ACCELEROMETER = 1, + MAGNETIC_FIELD = 2, + ORIENTATION = 3, + GYROSCOPE = 4, + LIGHT = 5, + PRESSURE = 6, + PROXIMITY = 8, + GRAVITY = 9, + LINEAR_ACCELERATION = 10, + ROTATION_VECTOR = 11, + RELATIVE_HUMIDITY = 12, + AMBIENT_TEMPERATURE = 13, + MAGNETIC_FIELD_UNCALIBRATED = 14, + GAME_ROTATION_VECTOR = 15, + GYROSCOPE_UNCALIBRATED = 16, + SIGNIFICANT_MOTION = 17, + STEP_DETECTOR = 18, + STEP_COUNTER = 19, + GEOMAGNETIC_ROTATION_VECTOR = 20, + HEART_RATE = 21, + TILT_DETECTOR = 22, + WAKE_GESTURE = 23, + GLANCE_GESTURE = 24, + PICK_UP_GESTURE = 25, + WRIST_TILT_GESTURE = 26, + DEVICE_ORIENTATION = 27, + POSE_6DOF = 28, + STATIONARY_DETECT = 29, + MOTION_DETECT = 30, + HEART_BEAT = 31, + DYNAMIC_SENSOR_META = 32, + ADDITIONAL_INFO = 33, + LOW_LATENCY_OFFBODY_DETECT = 34, + ACCELEROMETER_UNCALIBRATED = 35, + HINGE_ANGLE = 36, + HEAD_TRACKER = 37, + ACCELEROMETER_LIMITED_AXES = 38, + GYROSCOPE_LIMITED_AXES = 39, + ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40, + GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, + HEADING = 42, + DEVICE_PRIVATE_BASE = 65536, +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/AdditionalInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/AdditionalInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..518472305de74f121e7aae5c1b8809590b9ef6ff --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/AdditionalInfo.aidl @@ -0,0 +1,76 @@ +/* + * 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 -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.sensors; +@FixedSize @VintfStability +parcelable AdditionalInfo { + android.hardware.sensors.AdditionalInfo.AdditionalInfoType type; + int serial; + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload payload; + @FixedSize @VintfStability + union AdditionalInfoPayload { + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload.Int32Values dataInt32; + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload.FloatValues dataFloat; + @FixedSize @VintfStability + parcelable Int32Values { + int[14] values; + } + @FixedSize @VintfStability + parcelable FloatValues { + float[14] values; + } + } + @Backing(type="int") @VintfStability + enum AdditionalInfoType { + AINFO_BEGIN = 0, + AINFO_END = 1, + AINFO_UNTRACKED_DELAY = 65536, + AINFO_INTERNAL_TEMPERATURE = 65537, + AINFO_VEC3_CALIBRATION = 65538, + AINFO_SENSOR_PLACEMENT = 65539, + AINFO_SAMPLING = 65540, + AINFO_CHANNEL_NOISE = 131072, + AINFO_CHANNEL_SAMPLER = 131073, + AINFO_CHANNEL_FILTER = 131074, + AINFO_CHANNEL_LINEAR_TRANSFORM = 131075, + AINFO_CHANNEL_NONLINEAR_MAP = 131076, + AINFO_CHANNEL_RESAMPLER = 131077, + AINFO_LOCAL_GEOMAGNETIC_FIELD = 196608, + AINFO_LOCAL_GRAVITY = 196609, + AINFO_DOCK_STATE = 196610, + AINFO_HIGH_PERFORMANCE_MODE = 196611, + AINFO_MAGNETIC_FIELD_CALIBRATION = 196612, + AINFO_CUSTOM_START = 268435456, + AINFO_DEBUGGING_START = 1073741824, + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/DynamicSensorInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/DynamicSensorInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0c9a493a91ebae64b045cbe73a3d85238855cc25 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/DynamicSensorInfo.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.sensors; +@FixedSize @VintfStability +parcelable DynamicSensorInfo { + boolean connected; + int sensorHandle; + android.hardware.sensors.DynamicSensorInfo.Uuid uuid; + @FixedSize @VintfStability + parcelable Uuid { + byte[16] values; + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4f49002fce80532a772b1bad6d82893e377f4213 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl @@ -0,0 +1,139 @@ +/* + * 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 -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.sensors; +@FixedSize @VintfStability +parcelable Event { + long timestamp; + int sensorHandle; + android.hardware.sensors.SensorType sensorType; + android.hardware.sensors.Event.EventPayload payload; + @FixedSize @VintfStability + union EventPayload { + android.hardware.sensors.Event.EventPayload.Vec3 vec3; + android.hardware.sensors.Event.EventPayload.Vec4 vec4; + android.hardware.sensors.Event.EventPayload.Uncal uncal; + android.hardware.sensors.Event.EventPayload.MetaData meta; + float scalar; + long stepCount; + android.hardware.sensors.Event.EventPayload.HeartRate heartRate; + android.hardware.sensors.Event.EventPayload.Pose6Dof pose6DOF; + android.hardware.sensors.DynamicSensorInfo dynamic; + android.hardware.sensors.AdditionalInfo additional; + android.hardware.sensors.Event.EventPayload.Data data; + android.hardware.sensors.Event.EventPayload.HeadTracker headTracker; + android.hardware.sensors.Event.EventPayload.LimitedAxesImu limitedAxesImu; + android.hardware.sensors.Event.EventPayload.LimitedAxesImuUncal limitedAxesImuUncal; + android.hardware.sensors.Event.EventPayload.Heading heading; + @FixedSize @VintfStability + parcelable Vec4 { + float x; + float y; + float z; + float w; + } + @FixedSize @VintfStability + parcelable Vec3 { + float x; + float y; + float z; + android.hardware.sensors.SensorStatus status; + } + @FixedSize @VintfStability + parcelable Uncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + } + @FixedSize @VintfStability + parcelable HeadTracker { + float rx; + float ry; + float rz; + float vx; + float vy; + float vz; + int discontinuityCount; + } + @FixedSize @VintfStability + parcelable LimitedAxesImu { + float x; + float y; + float z; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability + parcelable LimitedAxesImuUncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability + parcelable HeartRate { + float bpm; + android.hardware.sensors.SensorStatus status; + } + @FixedSize @VintfStability + parcelable Heading { + float heading; + float accuracy; + } + @FixedSize @VintfStability + parcelable MetaData { + android.hardware.sensors.Event.EventPayload.MetaData.MetaDataEventType what; + @Backing(type="int") @VintfStability + enum MetaDataEventType { + META_DATA_FLUSH_COMPLETE = 1, + } + } + @FixedSize @VintfStability + parcelable Pose6Dof { + float[15] values; + } + @FixedSize @VintfStability + parcelable Data { + float[16] values; + } + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..f60f5bb24771c16a438e77d95864c7bba185eb5f --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl @@ -0,0 +1,89 @@ +/* + * 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 -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.sensors; +@VintfStability +interface ISensors { + void activate(in int sensorHandle, in boolean enabled); + void batch(in int sensorHandle, in long samplingPeriodNs, in long maxReportLatencyNs); + int configDirectReport(in int sensorHandle, in int channelHandle, in android.hardware.sensors.ISensors.RateLevel rate); + void flush(in int sensorHandle); + android.hardware.sensors.SensorInfo[] getSensorsList(); + void initialize(in android.hardware.common.fmq.MQDescriptor eventQueueDescriptor, in android.hardware.common.fmq.MQDescriptor wakeLockDescriptor, in android.hardware.sensors.ISensorsCallback sensorsCallback); + void injectSensorData(in android.hardware.sensors.Event event); + int registerDirectChannel(in android.hardware.sensors.ISensors.SharedMemInfo mem); + void setOperationMode(in android.hardware.sensors.ISensors.OperationMode mode); + void unregisterDirectChannel(in int channelHandle); + const int ERROR_NO_MEMORY = -12; + const int ERROR_BAD_VALUE = -22; + const int WAKE_LOCK_TIMEOUT_SECONDS = 1; + const int EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS = 1; + const int EVENT_QUEUE_FLAG_BITS_EVENTS_READ = 2; + const int WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN = 1; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD = 0; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_REPORT_TOKEN = 4; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_SENSOR_TYPE = 8; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER = 12; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_TIMESTAMP = 16; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 24; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 88; + const int DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH = 104; + @Backing(type="int") @VintfStability + enum RateLevel { + STOP = 0, + NORMAL = 1, + FAST = 2, + VERY_FAST = 3, + } + @Backing(type="int") @VintfStability + enum OperationMode { + NORMAL = 0, + DATA_INJECTION = 1, + } + @VintfStability + parcelable SharedMemInfo { + android.hardware.sensors.ISensors.SharedMemInfo.SharedMemType type; + android.hardware.sensors.ISensors.SharedMemInfo.SharedMemFormat format; + int size; + android.hardware.common.NativeHandle memoryHandle; + @Backing(type="int") @VintfStability + enum SharedMemFormat { + SENSORS_EVENT = 1, + } + @Backing(type="int") @VintfStability + enum SharedMemType { + ASHMEM = 1, + GRALLOC = 2, + } + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensorsCallback.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensorsCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..78ab56711bd567be0fa6630ca7d19a8ebc301735 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensorsCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.sensors; +@VintfStability +interface ISensorsCallback { + void onDynamicSensorsConnected(in android.hardware.sensors.SensorInfo[] sensorInfos); + void onDynamicSensorsDisconnected(in int[] sensorHandles); +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..996be3d4dbd4a85beba35dd5dac6e3ab5c31e8c1 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorInfo.aidl @@ -0,0 +1,71 @@ +/* + * 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 -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.sensors; +@VintfStability +parcelable SensorInfo { + int sensorHandle; + String name; + String vendor; + int version; + android.hardware.sensors.SensorType type; + String typeAsString; + float maxRange; + float resolution; + float power; + int minDelayUs; + int fifoReservedEventCount; + int fifoMaxEventCount; + String requiredPermission; + int maxDelayUs; + int flags; + const int SENSOR_FLAG_BITS_WAKE_UP = 1; + const int SENSOR_FLAG_BITS_CONTINUOUS_MODE = 0; + const int SENSOR_FLAG_BITS_ON_CHANGE_MODE = 2; + const int SENSOR_FLAG_BITS_ONE_SHOT_MODE = 4; + const int SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE = 6; + const int SENSOR_FLAG_BITS_DATA_INJECTION = 16; + const int SENSOR_FLAG_BITS_DYNAMIC_SENSOR = 32; + const int SENSOR_FLAG_BITS_ADDITIONAL_INFO = 64; + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM = 1024; + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_GRALLOC = 2048; + const int SENSOR_FLAG_BITS_MASK_REPORTING_MODE = 14; + const int SENSOR_FLAG_BITS_MASK_DIRECT_REPORT = 896; + const int SENSOR_FLAG_BITS_MASK_DIRECT_CHANNEL = 3072; + const int SENSOR_FLAG_SHIFT_REPORTING_MODE = 1; + const int SENSOR_FLAG_SHIFT_DATA_INJECTION = 4; + const int SENSOR_FLAG_SHIFT_DYNAMIC_SENSOR = 5; + const int SENSOR_FLAG_SHIFT_ADDITIONAL_INFO = 6; + const int SENSOR_FLAG_SHIFT_DIRECT_REPORT = 7; + const int SENSOR_FLAG_SHIFT_DIRECT_CHANNEL = 10; +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorStatus.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..45217107fc6d9f16007f313c94e6beaf007c8956 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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 -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.sensors; +@Backing(type="byte") @VintfStability +enum SensorStatus { + NO_CONTACT = -1, + UNRELIABLE = 0, + ACCURACY_LOW = 1, + ACCURACY_MEDIUM = 2, + ACCURACY_HIGH = 3, +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..8c864e90be18e1e9f328404ed7cb7a27306b62d3 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl @@ -0,0 +1,80 @@ +/* + * 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 -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.sensors; +@Backing(type="int") @VintfStability +enum SensorType { + META_DATA = 0, + ACCELEROMETER = 1, + MAGNETIC_FIELD = 2, + ORIENTATION = 3, + GYROSCOPE = 4, + LIGHT = 5, + PRESSURE = 6, + PROXIMITY = 8, + GRAVITY = 9, + LINEAR_ACCELERATION = 10, + ROTATION_VECTOR = 11, + RELATIVE_HUMIDITY = 12, + AMBIENT_TEMPERATURE = 13, + MAGNETIC_FIELD_UNCALIBRATED = 14, + GAME_ROTATION_VECTOR = 15, + GYROSCOPE_UNCALIBRATED = 16, + SIGNIFICANT_MOTION = 17, + STEP_DETECTOR = 18, + STEP_COUNTER = 19, + GEOMAGNETIC_ROTATION_VECTOR = 20, + HEART_RATE = 21, + TILT_DETECTOR = 22, + WAKE_GESTURE = 23, + GLANCE_GESTURE = 24, + PICK_UP_GESTURE = 25, + WRIST_TILT_GESTURE = 26, + DEVICE_ORIENTATION = 27, + POSE_6DOF = 28, + STATIONARY_DETECT = 29, + MOTION_DETECT = 30, + HEART_BEAT = 31, + DYNAMIC_SENSOR_META = 32, + ADDITIONAL_INFO = 33, + LOW_LATENCY_OFFBODY_DETECT = 34, + ACCELEROMETER_UNCALIBRATED = 35, + HINGE_ANGLE = 36, + HEAD_TRACKER = 37, + ACCELEROMETER_LIMITED_AXES = 38, + GYROSCOPE_LIMITED_AXES = 39, + ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40, + GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, + HEADING = 42, + DEVICE_PRIVATE_BASE = 65536, +} diff --git a/sensors/aidl/android/hardware/sensors/AdditionalInfo.aidl b/sensors/aidl/android/hardware/sensors/AdditionalInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9fe2d3970051cce75ec27bc907818acd71691820 --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/AdditionalInfo.aidl @@ -0,0 +1,234 @@ +/* + * 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 android.hardware.sensors; + +@FixedSize +@VintfStability +parcelable AdditionalInfo { + /** + * type of payload data, see AdditionalInfoType + */ + AdditionalInfoType type; + + /** + * sequence number of this frame for this type + */ + int serial; + + AdditionalInfoPayload payload; + + @FixedSize + @VintfStability + union AdditionalInfoPayload { + Int32Values dataInt32; + FloatValues dataFloat; + + @FixedSize + @VintfStability + parcelable Int32Values { + int[14] values; + } + + @FixedSize + @VintfStability + parcelable FloatValues { + float[14] values; + } + } + + @VintfStability + @Backing(type="int") + enum AdditionalInfoType { + /** + * Marks the beginning of additional information frames + */ + AINFO_BEGIN = 0, + + /** + * Marks the end of additional information frames + */ + AINFO_END = 1, + + /** + * Estimation of the delay that is not tracked by sensor timestamps. This + * includes delay introduced by sensor front-end filtering, data transport, + * etc. + * float[2]: delay in seconds, standard deviation of estimated value + */ + AINFO_UNTRACKED_DELAY = 0x10000, + + /** + * float: Celsius temperature + */ + AINFO_INTERNAL_TEMPERATURE, + + /** + * First three rows of a homogeneous matrix, which represents calibration to + * a three-element vector raw sensor reading. + * float[12]: 3x4 matrix in row major order + */ + AINFO_VEC3_CALIBRATION, + + /** + * Provides the orientation and location of the sensor element in terms of + * the Android coordinate system. This data is given as a 3x4 matrix + * consisting of a 3x3 rotation matrix (R) concatenated with a 3x1 location + * vector (t). The rotation matrix provides the orientation of the Android + * device coordinate frame relative to the local coordinate frame of the + * sensor. Note that assuming the axes conventions of the sensor are the + * same as Android, this is the inverse of the matrix applied to raw + * samples read from the sensor to convert them into the Android + * representation. The location vector represents the translation from the + * origin of the Android sensor coordinate system to the geometric center + * of the sensor, specified in millimeters (mm). + * + * float[12]: 3x4 matrix in row major order [R; t] + * + * Example: + * This raw buffer: {0, 1, 0, 0, -1, 0, 0, 10, 0, 0, 1, -2.5} + * Corresponds to this 3x4 matrix: + * 0 1 0 0 + * -1 0 0 10 + * 0 0 1 -2.5 + * The sensor is oriented such that: + * - the device X axis corresponds to the sensor's local -Y axis + * - the device Y axis corresponds to the sensor's local X axis + * - the device Z axis and sensor's local Z axis are equivalent + * In other words, if viewing the origin of the Android coordinate + * system from the positive Z direction, the device coordinate frame is + * to be rotated 90 degrees counter-clockwise about the Z axis to align + * with the sensor's local coordinate frame. Equivalently, a vector in + * the Android coordinate frame may be multiplied with R to rotate it + * 90 degrees clockwise (270 degrees counter-clockwise), yielding its + * representation in the sensor's coordinate frame. + * Relative to the origin of the Android coordinate system, the physical + * center of the sensor is located 10mm in the positive Y direction, and + * 2.5mm in the negative Z direction. + */ + AINFO_SENSOR_PLACEMENT, + + /** + * float[2]: raw sample period in seconds, + * standard deviation of sampling period + */ + AINFO_SAMPLING, + + /** + * int32_t: noise type + * float[n]: parameters + */ + AINFO_CHANNEL_NOISE = 0x20000, + + /** + * float[3]: sample period, standard deviation of sample period, + * quantization unit + */ + AINFO_CHANNEL_SAMPLER, + + /** + * Represents a filter: + * \sum_j a_j y[n-j] == \sum_i b_i x[n-i] + * + * int32_t[3]: number of feedforward coeffients M, + * number of feedback coefficients N (for FIR filter, N = 1). + * bit mask that represents which element the filter is applied + * to. (bit 0==1 means this filter applies to vector element 0). + * float[M+N]: filter coefficients (b0, b1, ..., b_{M-1}), then + * (a0, a1, ..., a_{N-1}), a0 is always 1. + * + * Multiple frames may be needed for higher number of taps. + */ + AINFO_CHANNEL_FILTER, + + /** + * int32_t[2]: size in (row, column) ... 1st frame + * float[n]: matrix element values in row major order. + */ + AINFO_CHANNEL_LINEAR_TRANSFORM, + + /** + * int32_t[2]: extrapolate method, interpolate method + * float[n]: mapping key points in pairs, (in, out)... + * (may be used to model saturation). + */ + AINFO_CHANNEL_NONLINEAR_MAP, + + /** + * int32_t: resample method (0-th order, 1st order...) + * float[1]: resample ratio (upsampling if < 1.0, downsampling if > 1.0). + */ + AINFO_CHANNEL_RESAMPLER, + + /** + * Operation environment parameters section + * Types in the following section is sent down (instead of reported from) + * device as additional information to aid sensor operation. Data is sent + * via injectSensorData() function to sensor handle -1 denoting all sensors + * in device. + * + * + * Local geomagnetic field information based on device geo location. This + * type is primarily for for magnetic field calibration and rotation vector + * sensor fusion. + * float[3]: strength (uT), declination and inclination angle (rad). + */ + AINFO_LOCAL_GEOMAGNETIC_FIELD = 0x30000, + + /** + * Local gravitational acceleration strength at device geo location. + * float: gravitational acceleration norm in m/s^2. + */ + AINFO_LOCAL_GRAVITY, + + /** + * Device dock state. + * int32_t: dock state following Android API Intent.EXTRA_DOCK_STATE + * definition, undefined value is ignored. + */ + AINFO_DOCK_STATE, + + /** + * High performance mode hint. Device is able to use up more power and take + * more resources to improve throughput and latency in high performance mode. + * One possible use case is virtual reality, when sensor latency need to be + * carefully controlled. + * int32_t: 1 or 0, denote if device is in/out of high performance mode, + * other values is ignored. + */ + AINFO_HIGH_PERFORMANCE_MODE, + + /** + * Magnetic field calibration hint. Device is notified when manually + * triggered magnetic field calibration procedure is started or stopped. The + * calibration procedure is assumed timed out after 1 minute from start, + * even if an explicit stop is not received. + * + * int32_t: 1 for start, 0 for stop, other value is ignored. + */ + AINFO_MAGNETIC_FIELD_CALIBRATION, + + /** + * Custom information + */ + AINFO_CUSTOM_START = 0x10000000, + + /** + * Debugging + */ + AINFO_DEBUGGING_START = 0x40000000, + } +} diff --git a/sensors/aidl/android/hardware/sensors/DynamicSensorInfo.aidl b/sensors/aidl/android/hardware/sensors/DynamicSensorInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..4b14ed0b2037758c9fa243f728ebcbc922332ccf --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/DynamicSensorInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 android.hardware.sensors; + +@VintfStability +@FixedSize +parcelable DynamicSensorInfo { + boolean connected; + + int sensorHandle; + + /** + * UUID of a dynamic sensor (using RFC 4122 byte order) + * For UUID 12345678-90AB-CDEF-1122-334455667788 the uuid field is + * initialized as: + * {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF, 0x11, ...} + */ + Uuid uuid; + + @FixedSize + @VintfStability + parcelable Uuid { + byte[16] values; + } +} diff --git a/sensors/aidl/android/hardware/sensors/Event.aidl b/sensors/aidl/android/hardware/sensors/Event.aidl new file mode 100644 index 0000000000000000000000000000000000000000..b95299c50699651a58d5978c0f5b78c69ca2e837 --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/Event.aidl @@ -0,0 +1,347 @@ +/* + * 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 android.hardware.sensors; + +import android.hardware.sensors.AdditionalInfo; +import android.hardware.sensors.DynamicSensorInfo; +import android.hardware.sensors.SensorStatus; +import android.hardware.sensors.SensorType; + +@VintfStability +@FixedSize +parcelable Event { + /** + * Time measured in nanoseconds, in "elapsedRealtimeNano()'s" timebase. + */ + long timestamp; + + /** + * sensor identifier + */ + int sensorHandle; + + SensorType sensorType; + + /** + * Union discriminated on sensorType + */ + EventPayload payload; + + /* + * acceleration values are in meter per second per second (m/s^2) + * magnetic vector values are in micro-Tesla (uT) + * orientation values are in degrees + * gyroscope values are in rad/s + * temperature is in degrees centigrade (Celsius) + * distance in centimeters + * light in SI lux units + * pressure in hectopascal (hPa) + * relative humidity in percent + */ + @VintfStability + @FixedSize + union EventPayload { + /** + * SensorType::ACCELEROMETER, SensorType::MAGNETIC_FIELD, + * SensorType::ORIENTATION, SensorType::GYROSCOPE, SensorType::GRAVITY, + * SensorType::LINEAR_ACCELERATION + */ + Vec3 vec3; + + /** + * SensorType::GAME_ROTATION_VECTOR + */ + Vec4 vec4; + + /** + * SensorType::MAGNETIC_FIELD_UNCALIBRATED, + * SensorType::GYROSCOPE_UNCALIBRATED + * SensorType::ACCELEROMETER_UNCALIBRATED + */ + Uncal uncal; + + /** + * SensorType::META_DATA + */ + MetaData meta; + + /** + * SensorType::DEVICE_ORIENTATION, SensorType::LIGHT, SensorType::PRESSURE, + * SensorType::TEMPERATURE, SensorType::PROXIMITY, + * SensorType::RELATIVE_HUMIDITY, SensorType::AMBIENT_TEMPERATURE, + * SensorType::SIGNIFICANT_MOTION, SensorType::STEP_DETECTOR, + * SensorType::TILT_DETECTOR, SensorType::WAKE_GESTURE, + * SensorType::GLANCE_GESTURE, SensorType::PICK_UP_GESTURE, + * SensorType::WRIST_TILT_GESTURE, SensorType::STATIONARY_DETECT, + * SensorType::MOTION_DETECT, SensorType::HEART_BEAT, + * SensorType::LOW_LATENCY_OFFBODY_DETECT + */ + float scalar; + + /** + * SensorType::STEP_COUNTER + */ + long stepCount; + + /** + * SensorType::HEART_RATE + */ + HeartRate heartRate; + + /** + * SensorType::POSE_6DOF + */ + Pose6Dof pose6DOF; + + /** + * SensorType::DYNAMIC_SENSOR_META + */ + DynamicSensorInfo dynamic; + + /** + * SensorType::ADDITIONAL_INFO + */ + AdditionalInfo additional; + + /** + * The following sensors should use the data field: + * - Undefined/custom sensor type >= SensorType::DEVICE_PRIVATE_BASE + * - SensorType::ROTATION_VECTOR, SensorType::GEOMAGNETIC_ROTATION_VECTOR: + * - These are Vec4 types with an additional float accuracy field, + * where data[4] is the estimated heading accuracy in radians + * (-1 if unavailable, and invalid if not in the range (0, 2 * pi]). + */ + Data data; + + /** + * SensorType::HEAD_TRACKER + */ + HeadTracker headTracker; + + /** + * SensorType::ACCELEROMETER_LIMITED_AXES + * SensorType::GYROSCOPE_LIMITED_AXES + */ + LimitedAxesImu limitedAxesImu; + + /** + * SensorType::ACCELEROMETER_LIMITED_AXES_UNCALIBRATED + * SensorType::GYROSCOPE_LIMITED_AXES_UNCALIBRATED + */ + LimitedAxesImuUncal limitedAxesImuUncal; + + /** + * SensorType::HEADING + */ + Heading heading; + + @FixedSize + @VintfStability + parcelable Vec4 { + float x; + float y; + float z; + float w; + } + + @FixedSize + @VintfStability + parcelable Vec3 { + float x; + float y; + float z; + SensorStatus status; + } + + @FixedSize + @VintfStability + parcelable Uncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + } + + /** + * Payload of the HEAD_TRACKER sensor type. Note that the axis + * definition of this sensor type differs from the rest of Android. See + * SensorType::HEAD_TRACKER for more information. + */ + @FixedSize + @VintfStability + parcelable HeadTracker { + /** + * An Euler vector (rotation vector, i.e. a vector whose direction + * indicates the axis of rotation and magnitude indicates the angle + * to rotate around that axis) representing the transform from + * the (arbitrary, possibly slowly drifting) reference frame to the + * head frame. Expressed in radians. Magnitude of the vector must be + * in the range [0, pi], while the value of individual axes are + * in the range [-pi, pi]. + */ + float rx; + float ry; + float rz; + + /** + * An Euler vector (rotation vector) representing the angular + * velocity of the head (relative to itself), in radians per second. + * The direction of this vector indicates the axis of rotation, and + * the magnitude indicates the rate of rotation. + * If this head tracker sensor instance does not support detecting + * velocity, then these fields must be set to 0. + */ + float vx; + float vy; + float vz; + + /** + * This value increments (or wraps around to 0) each time the + * reference frame is suddenly and significantly changed, for + * example if an orientation filter algorithm used for determining + * the orientation has had its state reset. + */ + int discontinuityCount; + } + + /** + * Payload of the ACCELEROMETER_LIMITED_AXES and GYROSCOPE_LIMITED_AXES + * sensor types. + */ + @FixedSize + @VintfStability + parcelable LimitedAxesImu { + /** + * Acceleration or angular speed values. If certain axes are not + * supported, the associated value must be set to 0. + */ + float x; + float y; + float z; + + /** + * Limited axes sensors must not be supported for all three axes. + * These values indicate which axes are supported with a 1.0 for + * supported, and a 0 for not supported. The supported axes should + * be determined at build time and these values must not change + * during runtime. + */ + float xSupported; + float ySupported; + float zSupported; + } + + /** + * Payload of the ACCELEROMETER_LIMITED_AXES_UNCALIBRATED and + * GYROSCOPE_LIMITED_AXES_UNCALIBRATED sensor types. + */ + @FixedSize + @VintfStability + parcelable LimitedAxesImuUncal { + /** + * Acceleration (without bias compensation) or angular (speed + * (without drift compensation) values. If certain axes are not + * supported, the associated value must be set to 0. + */ + float x; + float y; + float z; + + /** + * Estimated bias values for uncalibrated accelerometer or + * estimated drift values for uncalibrated gyroscope. If certain + * axes are not supported, the associated value must be set to 0. + */ + float xBias; + float yBias; + float zBias; + + /** + * Limited axes sensors must not be supported for all three axes. + * These values indicate which axes are supported with a 1.0 for + * supported, and a 0 for not supported. The supported axes should + * be determined at build time and these values must not change + * during runtime. + */ + float xSupported; + float ySupported; + float zSupported; + } + + @FixedSize + @VintfStability + parcelable HeartRate { + /** + * Heart rate in beats per minute. + * Set to 0 when status is SensorStatus::UNRELIABLE or + * SensorStatus::NO_CONTACT + */ + float bpm; + /** + * Status of the heart rate sensor for this reading. + */ + SensorStatus status; + } + + @FixedSize + @VintfStability + parcelable Heading { + /** + * The direction in which the device is pointing relative to true + * north in degrees. The value must be between 0.0 (inclusive) and + * 360.0 (exclusive), with 0 indicating north, 90 east, 180 south, + * and 270 west. + */ + float heading; + /** + * Accuracy is defined at 68% confidence. In the case where the + * underlying distribution is assumed Gaussian normal, this would be + * considered one standard deviation. For example, if the heading + * returns 60 degrees, and accuracy returns 10 degrees, then there + * is a 68 percent probability of the true heading being between 50 + * degrees and 70 degrees. + */ + float accuracy; + } + + @FixedSize + @VintfStability + parcelable MetaData { + MetaDataEventType what; + + @VintfStability + @Backing(type="int") + enum MetaDataEventType { + META_DATA_FLUSH_COMPLETE = 1, + } + } + + @FixedSize + @VintfStability + parcelable Pose6Dof { + float[15] values; + } + + @FixedSize + @VintfStability + parcelable Data { + float[16] values; + } + } +} diff --git a/sensors/aidl/android/hardware/sensors/ISensors.aidl b/sensors/aidl/android/hardware/sensors/ISensors.aidl new file mode 100644 index 0000000000000000000000000000000000000000..2c684897cfb349433140701287fb7d7a43cc6175 --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/ISensors.aidl @@ -0,0 +1,374 @@ +/* + * 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 android.hardware.sensors; + +import android.hardware.common.NativeHandle; +import android.hardware.common.fmq.MQDescriptor; +import android.hardware.common.fmq.SynchronizedReadWrite; +import android.hardware.sensors.Event; +import android.hardware.sensors.ISensorsCallback; +import android.hardware.sensors.SensorInfo; + +@VintfStability +interface ISensors { + /** + * Activate/de-activate one sensor. + * + * After sensor de-activation, existing sensor events that have not + * been written to the event queue must be abandoned immediately so that + * subsequent activations do not get stale sensor events (events + * that are generated prior to the latter activation). + * + * @param sensorHandle is the handle of the sensor to change. + * @param enabled set to true to enable, or false to disable the sensor. + * @return Status::ok on success + * EX_ILLEGAL_ARGUMENT if the sensorHandle is invalid. + */ + void activate(in int sensorHandle, in boolean enabled); + + /** + * Sets a sensor’s parameters, including sampling frequency and maximum + * report latency. This function can be called while the sensor is + * activated, in which case it must not cause any sensor measurements to + * be lost: transitioning from one sampling rate to the other cannot cause + * lost events, nor can transitioning from a high maximum report latency to + * a low maximum report latency. + * + * @param sensorHandle handle of sensor to be changed. + * @param samplingPeriodNs specifies sensor sample period in nanoseconds. + * @param maxReportLatencyNs allowed delay time before an event is sampled + * to time of report. + * @return Status::ok on success + * EX_ILLEGAL_ARGUMENT if any parameters are invalid. + */ + void batch(in int sensorHandle, in long samplingPeriodNs, in long maxReportLatencyNs); + + /** + * Configure direct sensor event report in direct channel. + * + * This function start, modify rate or stop direct report of a sensor in a + * certain direct channel. + * + * @param sensorHandle handle of sensor to be configured. When combined + * with STOP rate, sensorHandle can be -1 to denote all active sensors + * in the direct channel specified by channel Handle. + * @param channelHandle handle of direct channel to be configured. + * @param rate rate level, see RateLevel enum. + * @param out reportToken The report token, ignored if rate is STOP. + * See SharedMemFormat. + * @return The direct report token to identify multiple sensors of the same type in a single + * direct channel. + * @return Status::ok on success + * EX_ILLEGAL_ARGUMENT if the parameter is invalid (e.g. unsupported rate level + * for sensor, channelHandle does not exist, etc). + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + */ + int configDirectReport(in int sensorHandle, in int channelHandle, in RateLevel rate); + + /** + * Trigger a flush of internal FIFO. + * + * Flush adds a FLUSH_COMPLETE metadata event to the end of the "batch mode" + * FIFO for the specified sensor and flushes the FIFO. If the FIFO is empty + * or if the sensor doesn't support batching (FIFO size zero), return + * SUCCESS and add a trivial FLUSH_COMPLETE event added to the event stream. + * This applies to all sensors other than one-shot sensors. If the sensor + * is a one-shot sensor, flush must return EX_ILLEGAL_ARGUMENT and not generate any + * flush complete metadata. If the sensor is not active at the time flush() + * is called, flush() return EX_ILLEGAL_ARGUMENT. + * + * @param sensorHandle handle of sensor to be flushed. + * @return Status::ok on success + * EX_ILLEGAL_ARGUMENT if the sensorHandle is invalid. + */ + void flush(in int sensorHandle); + + /** + * Enumerate all available (static) sensors. + * + * The SensorInfo for each sensor returned by getSensorsList must be stable + * from the initial call to getSensorsList after a device boot until the + * entire system restarts. The SensorInfo for each sensor must not change + * between subsequent calls to getSensorsList, even across restarts of the + * HAL and its dependencies (for example, the sensor handle for a given + * sensor must not change across HAL restarts). + */ + SensorInfo[] getSensorsList(); + + /** + * Initialize the Sensors HAL's Fast Message Queues (FMQ) and callback. + * + * The Fast Message Queues (FMQ) that are used to send data between the + * framework and the HAL. The callback is used by the HAL to notify the + * framework of asynchronous events, such as a dynamic sensor connection. + * + * The Event FMQ is used to transport sensor events from the HAL to the + * framework. The Event FMQ is created using the eventQueueDescriptor. + * Data may only be written to the Event FMQ. Data must not be read from + * the Event FMQ since the framework is the only reader. Upon receiving + * sensor events, the HAL writes the sensor events to the Event FMQ. + * + * Once the HAL is finished writing sensor events to the Event FMQ, the HAL + * must notify the framework that sensor events are available to be read and + * processed. This is accomplished by either: + * 1) Calling the Event FMQ’s EventFlag::wake() function with + * EventQueueFlagBits::READ_AND_PROCESS + * 2) Setting the write notification in the Event FMQ’s writeBlocking() + * function to EventQueueFlagBits::READ_AND_PROCESS. + * + * If the Event FMQ’s writeBlocking() function is used, the read + * notification must be set to EventQueueFlagBits::EVENTS_READ in order to + * be notified and unblocked when the framework has successfully read events + * from the Event FMQ. + * + * The Wake Lock FMQ is used by the framework to notify the HAL when it is + * safe to release its wake_lock. When the framework receives WAKE_UP events + * from the Event FMQ and the framework has acquired a wake_lock, the + * framework must write the number of WAKE_UP events processed to the Wake + * Lock FMQ. When the HAL reads the data from the Wake Lock FMQ, the HAL + * decrements its current count of unprocessed WAKE_UP events and releases + * its wake_lock if the current count of unprocessed WAKE_UP events is + * zero. It is important to note that the HAL must acquire the wake lock and + * update its internal state regarding the number of outstanding WAKE_UP + * events _before_ posting the event to the Wake Lock FMQ, in order to avoid + * a race condition that can lead to loss of wake lock synchronization with + * the framework. + * + * The framework must use the WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN value to + * notify the HAL that data has been written to the Wake Lock FMQ and must + * be read by HAL. + * + * The ISensorsCallback is used by the HAL to notify the framework of + * asynchronous events, such as a dynamic sensor connection. + * + * The name of any wake_lock acquired by the Sensors HAL for WAKE_UP events + * must begin with "SensorsHAL_WAKEUP". + * + * If WAKE_LOCK_TIMEOUT_SECONDS has elapsed since the most recent WAKE_UP + * event was written to the Event FMQ without receiving a message on the + * Wake Lock FMQ, then any held wake_lock for WAKE_UP events must be + * released. + * + * If either the Event FMQ or the Wake Lock FMQ is already initialized when + * initialize is invoked, then both existing FMQs must be discarded and the + * new descriptors must be used to create new FMQs within the HAL. The + * number of outstanding WAKE_UP events should also be reset to zero, and + * any outstanding wake_locks held as a result of WAKE_UP events should be + * released. + * + * All active sensor requests and direct channels must be closed and + * properly cleaned up when initialize is called in order to ensure that the + * HAL and framework's state is consistent (e.g. after a runtime restart). + * + * initialize must be thread safe and prevent concurrent calls + * to initialize from simultaneously modifying state. + * + * @param eventQueueDescriptor Fast Message Queue descriptor that is used to + * create the Event FMQ which is where sensor events are written. The + * descriptor is obtained from the framework's FMQ that is used to read + * sensor events. + * @param wakeLockDescriptor Fast Message Queue descriptor that is used to + * create the Wake Lock FMQ which is where wake_lock events are read + * from. The descriptor is obtained from the framework's FMQ that is + * used to write wake_lock events. + * @param sensorsCallback sensors callback that receives asynchronous data + * from the Sensors HAL. + * @return Status::ok on success + * EX_ILLEGAL_ARGUMENT if the descriptor is invalid (such as null). + */ + void initialize(in MQDescriptor eventQueueDescriptor, + in MQDescriptor wakeLockDescriptor, + in ISensorsCallback sensorsCallback); + + /** + * Inject a single sensor event or push operation environment parameters to + * device. + * + * When device is in NORMAL mode, this function is called to push operation + * environment data to device. In this operation, Event is always of + * SensorType::AdditionalInfo type. See operation environment parameters + * section in AdditionalInfoType. + * + * When device is in DATA_INJECTION mode, this function is also used for + * injecting sensor events. + * + * Regardless of OperationMode, injected SensorType::ADDITIONAL_INFO + * type events should not be routed back to the sensor event queue. + * + * @see AdditionalInfoType + * @see OperationMode + * @param event sensor event to be injected + * @return Status::ok on success + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + * EX_SECURITY if the operation is not allowed. + * EX_SERVICE_SPECIFIC on error + * - ERROR_BAD_VALUE if the sensor event cannot be injected. + */ + void injectSensorData(in Event event); + + /** + * Register direct report channel. + * + * Register a direct channel with supplied shared memory information. Upon + * return, the sensor hardware is responsible for resetting the memory + * content to initial value (depending on memory format settings). + * + * @param mem shared memory info data structure. + * @param out channelHandle The registered channel handle. + * @return The direct channel handle, which is positive if successfully registered. + * @return Status::ok on success + * EX_ILLEGAL_ARGUMENT if the shared memory information is not consistent. + * EX_UNSUPPORTED_OPERATION if this functionality is unsupported. + * EX_SERVICE_SPECIFIC on error + * - ERROR_NO_MEMORY if shared memory cannot be used by sensor system. + */ + int registerDirectChannel(in SharedMemInfo mem); + + /** + * Place the module in a specific mode. + * + * @see OperationMode + * @param mode The operation mode. + * @return Status::ok on success + * EX_UNSUPPORTED_OPERATION or EX_ILLEGAL_ARGUMENT if requested mode is not supported. + * EX_SECURITY if the operation is not allowed. + */ + void setOperationMode(in OperationMode mode); + + /** + * Unregister direct report channel. + * + * Unregister a direct channel previously registered using + * registerDirectChannel, and remove all active sensor report configured in + * still active sensor report configured in the direct channel. + * + * @param channelHandle handle of direct channel to be unregistered. + * @return Status::ok on success + * EX_UNSUPPORTED_OPERATION if direct report is not supported. + */ + void unregisterDirectChannel(in int channelHandle); + + /** + * Direct report rate level definition. Except for SENSOR_DIRECT_RATE_STOP, each + * rate level covers the range (55%, 220%] * nominal report rate. For example, + * if config direct report specify a rate level SENSOR_DIRECT_RATE_FAST, it is + * legal for sensor hardware to report event at a rate greater than 110Hz, and + * less or equal to 440Hz. Note that rate has to remain steady without variation + * before new rate level is configured, i.e. if a sensor is configured to + * SENSOR_DIRECT_RATE_FAST and starts to report event at 256Hz, it cannot + * change rate to 128Hz after a few seconds of running even if 128Hz is also in + * the legal range of SENSOR_DIRECT_RATE_FAST. Thus, it is recommended to + * associate report rate with RateLvel statically for single sensor. + */ + @VintfStability + @Backing(type="int") + enum RateLevel { + STOP, + NORMAL, + FAST, + VERY_FAST, + } + + @VintfStability + @Backing(type="int") + enum OperationMode { + // Normal operation. Default state of the module. + NORMAL = 0, + // Loopback mode. Data is injected for the supported sensors by the sensor service in this + // mode. + DATA_INJECTION = 1, + } + + @VintfStability + parcelable SharedMemInfo { + SharedMemType type; + SharedMemFormat format; + int size; + NativeHandle memoryHandle; + + @VintfStability + @Backing(type="int") + enum SharedMemFormat { + SENSORS_EVENT = 1, + } + + @VintfStability + @Backing(type="int") + enum SharedMemType { + ASHMEM = 1, + GRALLOC, + } + } + + /** + * Error codes that are used as service specific errors with the AIDL return + * value EX_SERVICE_SPECIFIC. + */ + const int ERROR_NO_MEMORY = -12; + const int ERROR_BAD_VALUE = -22; + + /** + * The maximum number of seconds to wait for a message on the Wake Lock FMQ + * before automatically releasing any wake_lock held for a WAKE_UP event. + */ + const int WAKE_LOCK_TIMEOUT_SECONDS = 1; + + /** + * Used to notify the Event FMQ that events should be read and processed. + */ + const int EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS = 1 << 0; + + /** + * Used by the framework to signal to the HAL when events have been + * successfully read from the Event FMQ. + * + * If the MessageQueue::writeBlocking function is being used to write sensor + * events to the Event FMQ, then the readNotification parameter must be set + * to EVENTS_READ. + */ + const int EVENT_QUEUE_FLAG_BITS_EVENTS_READ = 1 << 1; + + /** + * Used to notify the HAL that the framework has written data to the Wake + * Lock FMQ. + */ + const int WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN = 1 << 0; + + /** + * Constants related to direct sensor events. The following table illustrates the + * data format. + * + * Offset Type Name + * ----------------------------------- + * 0x0000 int32_t Size (always DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH) + * 0x0004 int32_t Sensor report token + * 0x0008 int32_t Type (see SensorType.aidl) + * 0x000C uint32_t Atomic counter + * 0x0010 int64_t Timestamp (see Event.aidl) + * 0x0018 float[16]/ Data + * int64_t[8] + * 0x0058 int32_t[4] Reserved (set to zero) + */ + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD = 0x0; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_REPORT_TOKEN = 0x4; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_SENSOR_TYPE = 0x8; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER = 0xC; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_TIMESTAMP = 0x10; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 0x18; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 0x58; + const int DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH = 104; +} diff --git a/sensors/aidl/android/hardware/sensors/ISensorsCallback.aidl b/sensors/aidl/android/hardware/sensors/ISensorsCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..01bae52d2456d9568be23bd2e8ddef8c073edc98 --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/ISensorsCallback.aidl @@ -0,0 +1,49 @@ +/* + * 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 android.hardware.sensors; + +import android.hardware.sensors.SensorInfo; + +@VintfStability +interface ISensorsCallback { + /** + * Notify the framework that new dynamic sensors have been connected. + * + * If a dynamic sensor was previously connected and has not been + * disconnected, then that sensor must not be included in sensorInfos. + * + * @param sensorInfos vector of SensorInfo for each dynamic sensor that + * was connected. + */ + void onDynamicSensorsConnected(in SensorInfo[] sensorInfos); + + /** + * Notify the framework that previously connected dynamic sensors have been + * disconnected. + * + * If a dynamic sensor was previously disconnected and has not been + * reconnected, then that sensor must not be included in sensorHandles. + * + * The HAL must ensure that all sensor events from departing dynamic + * sensors have been written to the Event FMQ before calling + * onDynamicSensorsDisconnected. + * + * @param sensorHandles vector of sensor handles for each dynamic sensors + * that was disconnected. + */ + void onDynamicSensorsDisconnected(in int[] sensorHandles); +} diff --git a/sensors/aidl/android/hardware/sensors/SensorInfo.aidl b/sensors/aidl/android/hardware/sensors/SensorInfo.aidl new file mode 100644 index 0000000000000000000000000000000000000000..065642ae86c3894d6d992ae970d17cdb018c1f81 --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/SensorInfo.aidl @@ -0,0 +1,217 @@ +/* + * 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 android.hardware.sensors; + +import android.hardware.sensors.SensorType; + +@VintfStability +parcelable SensorInfo { + /** + * Handle that identifies this sensors. This handle is used to reference + * this sensor throughout the HAL API. + */ + int sensorHandle; + + /** + * Name of this sensor. + * All sensors of the same "type" must have a different "name". + */ + String name; + + /** + * Vendor of the hardware part. + */ + String vendor; + + /** + * Version of the hardware part + driver, used for informational purposes. + * The value of this field must increase when the driver is updated in a + * way that changes the output of this sensor. This is important for fused + * sensors when the fusion algorithm is updated. + */ + int version; + + /** + * This sensor's type. + */ + SensorType type; + + /** + * Type of this sensor as a string. + * + * When defining an OEM specific sensor or sensor manufacturer specific + * sensor, use your reserve domain name as a prefix. + * e.g. com.google.glass.onheaddetector + * + * For sensors of known type defined in SensorType (value < + * SensorType::DEVICE_PRIVATE_BASE), this can be an empty string. + */ + String typeAsString; + + /** + * Maximum range of this sensor's value in SI units + */ + float maxRange; + + /** + * Smallest difference between two values reported by this sensor + */ + float resolution; + + /** + * Rough estimate of this sensor's power consumption in mA + */ + float power; + + /** + * This value depends on the reporting mode: + * + * continuous: minimum sample period allowed in microseconds + * on-change : 0 + * one-shot :-1 + * special : 0, unless otherwise noted + */ + int minDelayUs; + + /** + * Number of events reserved for this sensor in the batch mode FIFO. + * If there is a dedicated FIFO for this sensor, then this is the + * size of this FIFO. If the FIFO is shared with other sensors, + * this is the size reserved for that sensor and it can be zero. + */ + int fifoReservedEventCount; + + /** + * Maximum number of events of this sensor that could be batched. + * This is especially relevant when the FIFO is shared between + * several sensors; this value is then set to the size of that FIFO. + */ + int fifoMaxEventCount; + + /** + * Permission required to see this sensor, register to it and receive data. + * Set to "" if no permission is required. Some sensor types like the + * heart rate monitor have a mandatory require_permission. + * For sensors that always require a specific permission, like the heart + * rate monitor, the android framework might overwrite this string + * automatically. + */ + String requiredPermission; + + /** + * This value is defined only for continuous mode and on-change sensors. + * It is the delay between two sensor events corresponding to the lowest + * frequency that this sensor supports. When lower frequencies are requested + * through batch()/setDelay() the events will be generated at this frequency + * instead. + * It can be used by the framework or applications to estimate when the + * batch FIFO may be full. + * + * continuous, on-change: maximum sampling period allowed in microseconds. + * one-shot, special : 0 + */ + int maxDelayUs; + + /** + * Bitmasks defined in SENSOR_FLAG_BITS_* below. + */ + int flags; + + /** + * Whether this sensor wakes up the AP from suspend mode when data is + * available. Whenever sensor events are delivered from a wake_up sensor, + * the driver needs to hold a wake_lock till the events are read by the + * SensorService i.e. till ISensors::poll() is called the next time. + * Once poll is called again it means events have been read by the + * SensorService, the driver can safely release the wake_lock. SensorService + * will continue to hold a wake_lock till the app actually reads the events. + */ + const int SENSOR_FLAG_BITS_WAKE_UP = 1; + + /** + * Reporting modes for various sensors. Each sensor will have exactly one of + * these modes set. + * The least significant 2nd, 3rd and 4th bits are used to represent four + * possible reporting modes. + */ + const int SENSOR_FLAG_BITS_CONTINUOUS_MODE = 0; + const int SENSOR_FLAG_BITS_ON_CHANGE_MODE = 2; + const int SENSOR_FLAG_BITS_ONE_SHOT_MODE = 4; + const int SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE = 6; + + /** + * Set this flag if the sensor supports data_injection mode and allows data + * to be injected from the SensorService. When in data_injection ONLY + * sensors with this flag set are injected sensor data and only sensors with + * this flag set are activated. Eg: Accelerometer and Step Counter sensors + * can be set with this flag and SensorService will inject accelerometer + * data and read the corresponding step counts. + */ + const int SENSOR_FLAG_BITS_DATA_INJECTION = 0x10; + + /** + * Set this flag if the sensor is a dynamically connected sensor. See + * DynamicSensorInfo and DYNAMIC_SENSOR_META for details. + */ + const int SENSOR_FLAG_BITS_DYNAMIC_SENSOR = 0x20; + + /** + * Set this flag if sensor additional information is supported. + * See ADDITIONAL_INFO and AdditionalInfo for details. + */ + const int SENSOR_FLAG_BITS_ADDITIONAL_INFO = 0x40; + + /** + * Set this flag if sensor suppor direct channel backed by ashmem. + * See SharedMemType and registerDirectChannel for more details. + */ + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM = 0x400; + + /** + * Set this flag if sensor suppor direct channel backed by gralloc HAL memory. + * See SharedMemType and registerDirectChannel for more details. + */ + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_GRALLOC = 0x800; + + /** + * Flags mask for reporting mode of sensor. + */ + const int SENSOR_FLAG_BITS_MASK_REPORTING_MODE = 0xE; + + /** + * Flags mask for direct report maximum rate level support. + * See RateLevel. + */ + const int SENSOR_FLAG_BITS_MASK_DIRECT_REPORT = 0x380; + + /** + * Flags mask for all direct channel support bits. + * See SharedMemType. + */ + const int SENSOR_FLAG_BITS_MASK_DIRECT_CHANNEL = 0xC00; + + /** + * Defines the number of bits different pieces of information are shifted in the + * SENSOR_FLAG_BITS_* bitmask. + */ + const int SENSOR_FLAG_SHIFT_REPORTING_MODE = 1; + const int SENSOR_FLAG_SHIFT_DATA_INJECTION = 4; + const int SENSOR_FLAG_SHIFT_DYNAMIC_SENSOR = 5; + const int SENSOR_FLAG_SHIFT_ADDITIONAL_INFO = 6; + const int SENSOR_FLAG_SHIFT_DIRECT_REPORT = 7; + const int SENSOR_FLAG_SHIFT_DIRECT_CHANNEL = 10; +} diff --git a/sensors/aidl/android/hardware/sensors/SensorStatus.aidl b/sensors/aidl/android/hardware/sensors/SensorStatus.aidl new file mode 100644 index 0000000000000000000000000000000000000000..0fd86975f527d5ede69887ee08e2e456a55b6e8f --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/SensorStatus.aidl @@ -0,0 +1,27 @@ +/* + * 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 android.hardware.sensors; + +@VintfStability +@Backing(type="byte") +enum SensorStatus { + NO_CONTACT = -1, + UNRELIABLE = 0, + ACCURACY_LOW = 1, + ACCURACY_MEDIUM = 2, + ACCURACY_HIGH = 3, +} diff --git a/sensors/aidl/android/hardware/sensors/SensorType.aidl b/sensors/aidl/android/hardware/sensors/SensorType.aidl new file mode 100644 index 0000000000000000000000000000000000000000..9098894cc743edff2c655cd9d858fe3239cc5d5a --- /dev/null +++ b/sensors/aidl/android/hardware/sensors/SensorType.aidl @@ -0,0 +1,725 @@ +/* + * 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 android.hardware.sensors; + +@VintfStability +@Backing(type="int") +enum SensorType { + /** + * META_DATA is a special event type used to populate the MetaData + * structure. It doesn't correspond to a physical sensor. Events of this + * type exist only inside the HAL, their primary purpose is to signal the + * completion of a flush request. + */ + META_DATA = 0, + + /** + * ACCELEROMETER + * reporting-mode: continuous + * + * All values are in SI units (m/s^2) and measure the acceleration of the + * device minus the acceleration due to gravity. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + ACCELEROMETER = 1, + + /** + * MAGNETIC_FIELD + * reporting-mode: continuous + * + * All values are in micro-Tesla (uT) and measure the geomagnetic + * field in the X, Y and Z axis. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + MAGNETIC_FIELD = 2, + + /** + * ORIENTATION + * reporting-mode: continuous + * + * All values are angles in degrees. + * + * Orientation sensors return sensor events for all 3 axes at a constant + * rate defined by setDelay(). + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + ORIENTATION = 3, + + /** + * GYROSCOPE + * reporting-mode: continuous + * + * All values are in radians/second and measure the rate of rotation + * around the X, Y and Z axis. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + GYROSCOPE = 4, + + /** + * LIGHT + * reporting-mode: on-change + * + * The light sensor value is returned in SI lux units. + * + * Both wake-up and non wake-up versions are useful. + */ + LIGHT = 5, + + /** + * PRESSURE + * reporting-mode: continuous + * + * The pressure sensor return the athmospheric pressure in hectopascal (hPa) + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + PRESSURE = 6, + + /** + * PROXIMITY + * reporting-mode: on-change + * + * The proximity sensor which turns the screen off and back on during calls + * is the wake-up proximity sensor. Implement wake-up proximity sensor + * before implementing a non wake-up proximity sensor. For the wake-up + * proximity sensor set the flag SENSOR_FLAG_WAKE_UP. + * The value corresponds to the distance to the nearest object in + * centimeters. + */ + PROXIMITY = 8, + + /** + * GRAVITY + * reporting-mode: continuous + * + * A gravity output indicates the direction of and magnitude of gravity in + * the devices's coordinates. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + GRAVITY = 9, + + /** + * LINEAR_ACCELERATION + * reporting-mode: continuous + * + * Indicates the linear acceleration of the device in device coordinates, + * not including gravity. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + LINEAR_ACCELERATION = 10, + + /** + * ROTATION_VECTOR + * reporting-mode: continuous + * + * The rotation vector symbolizes the orientation of the device relative to + * the East-North-Up coordinates frame. + * + * Note that despite the name, SensorType::ROTATION_VECTOR uses + * quaternion representation, rather than the rotation vector representation + * (aka Euler vector) seen in SensorType::HEAD_TRACKER. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + ROTATION_VECTOR = 11, + + /** + * RELATIVE_HUMIDITY + * reporting-mode: on-change + * + * A relative humidity sensor measures relative ambient air humidity and + * returns a value in percent. + * + * Both wake-up and non wake-up versions are useful. + */ + RELATIVE_HUMIDITY = 12, + + /** + * AMBIENT_TEMPERATURE + * reporting-mode: on-change + * + * The ambient (room) temperature in degree Celsius. + * + * Both wake-up and non wake-up versions are useful. + */ + AMBIENT_TEMPERATURE = 13, + + /** + * MAGNETIC_FIELD_UNCALIBRATED + * reporting-mode: continuous + * + * Similar to MAGNETIC_FIELD, but the hard iron calibration is + * reported separately instead of being included in the measurement. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + MAGNETIC_FIELD_UNCALIBRATED = 14, + + /** + * GAME_ROTATION_VECTOR + * reporting-mode: continuous + * + * Similar to ROTATION_VECTOR, but not using the geomagnetic + * field. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + GAME_ROTATION_VECTOR = 15, + + /** + * GYROSCOPE_UNCALIBRATED + * reporting-mode: continuous + * + * All values are in radians/second and measure the rate of rotation + * around the X, Y and Z axis. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + GYROSCOPE_UNCALIBRATED = 16, + + /** + * SIGNIFICANT_MOTION + * reporting-mode: one-shot + * + * A sensor of this type triggers an event each time significant motion + * is detected and automatically disables itself. + * For Significant Motion sensor to be useful, it must be defined as a + * wake-up sensor. (set SENSOR_FLAG_WAKE_UP). Implement the wake-up + * significant motion sensor. A non wake-up version is not useful. + * The only allowed value to return is 1.0. + */ + SIGNIFICANT_MOTION = 17, + + /** + * STEP_DETECTOR + * reporting-mode: special + * + * A sensor of this type triggers an event each time a step is taken + * by the user. The only allowed value to return is 1.0 and an event + * is generated for each step. + * + * Both wake-up and non wake-up versions are useful. + */ + STEP_DETECTOR = 18, + + /** + * STEP_COUNTER + * reporting-mode: on-change + * + * A sensor of this type returns the number of steps taken by the user since + * the last reboot while activated. The value is returned as a uint64_t and + * is reset to zero only on a system / android reboot. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + STEP_COUNTER = 19, + + /** + * GEOMAGNETIC_ROTATION_VECTOR + * reporting-mode: continuous + * + * Similar to ROTATION_VECTOR, but using a magnetometer instead + * of using a gyroscope. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + GEOMAGNETIC_ROTATION_VECTOR = 20, + + /** + * HEART_RATE + * reporting-mode: on-change + * + * A sensor of this type returns the current heart rate. + * The events contain the current heart rate in beats per minute (BPM) and + * the status of the sensor during the measurement. See "HeartRate" below + * for more details. + * + * Because this sensor is on-change, events must be generated when and only + * when heart_rate.bpm or heart_rate.status have changed since the last + * event. In particular, upon the first activation, unless the device is + * known to not be on the body, the status field of the first event must be + * set to SensorStatus::UNRELIABLE. The event should be generated no faster + * than every period_ns passed to setDelay() or to batch(). + * See the definition of the on-change reporting mode for more information. + * + * SensorInfo.requiredPermission must be set to + * SENSOR_PERMISSION_BODY_SENSORS. + * + * Both wake-up and non wake-up versions are useful. + */ + HEART_RATE = 21, + + /** + * WAKE_UP_TILT_DETECTOR + * reporting-mode: special (setDelay has no impact) + * + * A sensor of this type generates an event each time a tilt event is + * detected. A tilt event must be generated if the direction of the + * 2-seconds window average gravity changed by at least 35 degrees since the + * activation or the last trigger of the sensor. + * + * reference_estimated_gravity = average of accelerometer measurements over + * the first 1 second after activation or the estimated gravity at the last + * trigger. + * + * current_estimated_gravity = average of accelerometer measurements over + * the last 2 seconds. + * + * trigger when + * angle(reference_estimated_gravity, current_estimated_gravity) + * > 35 degrees + * + * Large accelerations without a change in phone orientation must not + * trigger a tilt event. + * For example, a sharp turn or strong acceleration while driving a car + * must not trigger a tilt event, even though the angle of the average + * acceleration might vary by more than 35 degrees. + * + * Typically, this sensor is implemented with the help of only an + * accelerometer. Other sensors can be used as well if they do not increase + * the power consumption significantly. This is a low power sensor that + * must allow the AP to go into suspend mode. Do not emulate this sensor + * in the HAL. + * Like other wake up sensors, the driver is expected to a hold a wake_lock + * with a timeout of 200 ms while reporting this event. The only allowed + * return value is 1.0. + * + * Implement only the wake-up version of this sensor. + */ + TILT_DETECTOR = 22, + + /** + * WAKE_GESTURE + * reporting-mode: one-shot + * + * A sensor enabling waking up the device based on a device specific motion. + * + * When this sensor triggers, the device behaves as if the power button was + * pressed, turning the screen on. This behavior (turning on the screen when + * this sensor triggers) might be deactivated by the user in the device + * settings. Changes in settings do not impact the behavior of the sensor: + * only whether the framework turns the screen on when it triggers. + * + * The actual gesture to be detected is not specified, and can be chosen by + * the manufacturer of the device. + * This sensor must be low power, as it is likely to be activated 24/7. + * The only allowed value to return is 1.0. + * + * Implement only the wake-up version of this sensor. + */ + WAKE_GESTURE = 23, + + /** + * GLANCE_GESTURE + * reporting-mode: one-shot + * + * A sensor enabling briefly turning the screen on to enable the user to + * glance content on screen based on a specific motion. The device must + * turn the screen off after a few moments. + * + * When this sensor triggers, the device turns the screen on momentarily + * to allow the user to glance notifications or other content while the + * device remains locked in a non-interactive state (dozing). This behavior + * (briefly turning on the screen when this sensor triggers) might be + * deactivated by the user in the device settings. + * Changes in settings do not impact the behavior of the sensor: only + * whether the framework briefly turns the screen on when it triggers. + * + * The actual gesture to be detected is not specified, and can be chosen by + * the manufacturer of the device. + * This sensor must be low power, as it is likely to be activated 24/7. + * The only allowed value to return is 1.0. + * + * Implement only the wake-up version of this sensor. + */ + GLANCE_GESTURE = 24, + + /** + * PICK_UP_GESTURE + * reporting-mode: one-shot + * + * A sensor of this type triggers when the device is picked up regardless of + * wherever is was before (desk, pocket, bag). The only allowed return value + * is 1.0. This sensor de-activates itself immediately after it triggers. + * + * Implement only the wake-up version of this sensor. + */ + PICK_UP_GESTURE = 25, + + /** + * WRIST_TILT_GESTURE + * trigger-mode: special + * wake-up sensor: yes + * + * A sensor of this type triggers an event each time a tilt of the + * wrist-worn device is detected. + * + * This sensor must be low power, as it is likely to be activated 24/7. + * The only allowed value to return is 1.0. + * + * Implement only the wake-up version of this sensor. + */ + WRIST_TILT_GESTURE = 26, + + /** + * DEVICE_ORIENTATION + * reporting-mode: on-change + * + * The current orientation of the device. The value is reported in + * the "scalar" element of the EventPayload in Event. The + * only values that can be reported are (please refer to Android Sensor + * Coordinate System to understand the X and Y axis direction with respect + * to default orientation): + * - 0: device is in default orientation (Y axis is vertical and points up) + * - 1: device is rotated 90 degrees counter-clockwise from default + * orientation (X axis is vertical and points up) + * - 2: device is rotated 180 degrees from default orientation (Y axis is + * vertical and points down) + * - 3: device is rotated 90 degrees clockwise from default orientation + * (X axis is vertical and points down) + * + * Moving the device to an orientation where the Z axis is vertical (either + * up or down) must not cause a new event to be reported. + * + * To improve the user experience of this sensor, it is recommended to + * implement some physical (i.e., rotation angle) and temporal (i.e., delay) + * hysteresis. In other words, minor or transient rotations must not cause + * a new event to be reported. + * + * This is a low power sensor that intended to reduce interrupts of + * application processor and thus allow it to go sleep. Use hardware + * implementation based on low power consumption sensors, such as + * accelerometer. Device must not emulate this sensor in the HAL. + * + * Both wake-up and non wake-up versions are useful. + */ + DEVICE_ORIENTATION = 27, + + /** + * POSE_6DOF + * trigger-mode: continuous + * + * A sensor of this type returns the pose of the device. + * Pose of the device is defined as the orientation of the device from a + * Earth Centered Earth Fixed frame and the translation from an arbitrary + * point at subscription. + * + * This sensor can be high power. It can use any and all of the following + * . Accelerometer + * . Gyroscope + * . Camera + * . Depth Camera + * + */ + POSE_6DOF = 28, + + /** + * STATIONARY_DETECT + * trigger mode: one shot + * + * A sensor of this type returns an event if the device is still/stationary + * for a while. The period of time to monitor for stationarity must be + * greater than 5 seconds. The latency must be less than 10 seconds. + * + * Stationarity here refers to absolute stationarity. eg: device on desk. + * + * The only allowed value to return is 1.0. + */ + STATIONARY_DETECT = 29, + + /** + * MOTION_DETECT + * trigger mode: one shot + * + * A sensor of this type returns an event if the device is not still for + * for a while. The period of time to monitor for stationarity must be + * greater than 5 seconds. The latency must be less than 10 seconds. + * + * Motion here refers to any mechanism in which the device is causes to be + * moved in its inertial frame. eg: Pickin up the device and walking with it + * to a nearby room may trigger motion wherewas keeping the device on a + * table on a smooth train moving at constant velocity may not trigger + * motion. + * + * The only allowed value to return is 1.0. + */ + MOTION_DETECT = 30, + + /** + * HEART_BEAT + * trigger mode: continuous + * + * A sensor of this type returns an event everytime a hear beat peak is + * detected. + * + * Peak here ideally corresponds to the positive peak in the QRS complex of + * and ECG signal. + * + * The sensor is not expected to be optimized for latency. As a guide, a + * latency of up to 10 seconds is acceptable. However, the timestamp attached + * to the event must be accuratly correspond to the time the peak occurred. + * + * The sensor event contains a parameter for the confidence in the detection + * of the peak where 0.0 represent no information at all, and 1.0 represents + * certainty. + */ + HEART_BEAT = 31, + + /** + * DYNAMIC_SENSOR_META + * trigger-mode: special + * wake-up sensor: yes + * + * A sensor event of this type is received when a dynamic sensor is added to + * or removed from the system. At most one sensor of this type can be + * present in one sensor HAL implementation and presence of a sensor of this + * type in sensor HAL implementation indicates that this sensor HAL supports + * dynamic sensor feature. Operations, such as batch, activate and setDelay, + * to this special purpose sensor must be treated as no-op and return + * successful; flush() also has to generate flush complete event as if this + * is a sensor that does not support batching. + * + * A dynamic sensor connection indicates connection of a physical device or + * instantiation of a virtual sensor backed by algorithm; and a dynamic + * sensor disconnection indicates the opposite. A sensor event of + * DYNAMIC_SENSOR_META type should be delivered regardless of + * the activation status of the sensor in the event of dynamic sensor + * connection and disconnection. In the sensor event, besides the common + * data entries, "dynamic_sensor_meta", which includes fields for connection + * status, handle of the sensor involved, pointer to sensor_t structure and + * a uuid field, must be populated. + * + * At a dynamic sensor connection event, fields of sensor_t structure + * referenced by a pointer in dynamic_sensor_meta must be filled as if it + * was regular sensors. Sensor HAL is responsible for recovery of memory if + * the corresponding data is dynamicially allocated. However, the + * pointer must be valid until the first activate call to the sensor + * reported in this connection event. At a dynamic sensor disconnection, + * the sensor_t pointer must be NULL. + * + * The sensor handle assigned to dynamic sensors must never be the same as + * that of any regular static sensors, and must be unique until next boot. + * In another word, if a handle h is used for a dynamic sensor A, that same + * number cannot be used for the same dynamic sensor A or another dynamic + * sensor B even after disconnection of A until reboot. + * + * The UUID field will be used for identifying the sensor in addition to + * name, vendor and version and type. For physical sensors of the same + * model, all sensors will have the same values in sensor_t, but the UUID + * must be unique and persistent for each individual unit. An all zero + * UUID indicates it is not possible to differentiate individual sensor + * unit. + * + */ + DYNAMIC_SENSOR_META = 32, + + /** + * ADDITIONAL_INFO + * reporting-mode: N/A + * + * This sensor type is for delivering additional sensor information aside + * from sensor event data. + * Additional information may include sensor front-end group delay, internal + * calibration parameters, noise level metrics, device internal temperature, + * etc. + * + * This type will never bind to a sensor. In other words, no sensor in the + * sensor list can have the type SENSOR_TYPE_ADDITIONAL_INFO. If a + * sensor HAL supports sensor additional information feature, it reports + * sensor_event_t with "sensor" field set to handle of the reporting sensor + * and "type" field set to ADDITIONAL_INFO. Delivery of + * additional information events is triggered under two conditions: an + * enable activate() call or a flush() call to the corresponding sensor. + * Besides, time varying parameters can update infrequently without being + * triggered. Device is responsible to control update rate. The recommend + * update rate is less than 1/1000 of sensor event rate or less than once + * per minute in average. + * + * A single additional information report consists of multiple frames. + * Sequences of these frames are ordered using timestamps, which means the + * timestamps of sequential frames have to be at least 1 nanosecond apart + * from each other. Each frame is a sensor_event_t delivered through the HAL + * interface, with related data stored in the "additional_info" field, which + * is of type additional_info_event_t. + * The "type" field of additional_info_event_t denotes the nature of the + * payload data (see additional_info_type_t). + * The "serial" field is used to keep the sequence of payload data that + * spans multiple frames. The first frame of the entire report is always of + * type AINFO_BEGIN, and the last frame is always AINFO_END. + * + * If flush() was triggering the report, all additional information frames + * must be delivered after flush complete event. + */ + ADDITIONAL_INFO = 33, + + /** + * LOW_LATENCY_OFFBODY_DETECT + * trigger-mode: on-change + * wake-up sensor: yes + * + * A sensor of this type is defined for devices that are supposed to be worn + * by the user in the normal use case (such as a watch, wristband, etc) and + * is not yet defined for other device. + * + * A sensor of this type triggers an event each time the wearable device + * is removed from the body and each time it's put back onto the body. + * It must be low-latency and be able to detect the on-body to off-body + * transition within one second (event delivery time included), + * and 3-second latency to determine the off-body to on-body transition + * (event delivery time included). + * + * There are only two valid event values for the sensor to return : + * 0.0 for off-body + * 1.0 for on-body + * + */ + LOW_LATENCY_OFFBODY_DETECT = 34, + + /** + * ACCELEROMETER_UNCALIBRATED + * reporting-mode: continuous + * + * All values are in SI units (m/s^2) and measure the acceleration of the + * device minus the acceleration due to gravity. + * + * Implement the non-wake-up version of this sensor and implement the + * wake-up version if the system possesses a wake up fifo. + */ + ACCELEROMETER_UNCALIBRATED = 35, + + /** + * HINGE_ANGLE + * reporting-mode: on-change + * wake-up sensor: yes + * + * A sensor of this type measures the angle, in degrees, between two + * integral parts of the device. Movement of a hinge measured by this sensor + * type is expected to alter the ways in which the user may interact with + * the device, for example by unfolding or revealing a display. + * + * Sensor data is output using EventPayload.scalar. + * + * Implement wake-up proximity sensor before implementing a non wake-up + * proximity sensor. + */ + HINGE_ANGLE = 36, + + /** + * HEAD_TRACKER + * reporting-mode: continuous + * + * A sensor of this type measures the orientation of a user's head relative + * to an arbitrary reference frame, and the rate of rotation. + * + * Events produced by this sensor follow a special head-centric coordinate + * frame, where: + * - The X axis crosses through the user's ears, with the positive X + * direction extending out of the user's right ear + * - The Y axis crosses from the back of the user's head through their + * nose, with the positive direction extending out of the nose, and the + * X/Y plane being nominally parallel to the ground when the user is + * upright and looking straight ahead + * - The Z axis crosses from the neck through the top of the user's head, + * with the positive direction extending out from the top of the head + * + * When this sensor type is exposed as a dynamic sensor through a + * communications channel that uses HID, such as Bluetooth or USB, as part + * of a device with audio output capability (e.g. headphones), then the + * DynamicSensorInfo::uuid field shall be set to contents of the HID + * Persistent Unique ID to permit association between the sensor and audio + * device. Accordingly, the HID Persistent Unique ID (Sensors Page 0x20, + * Usage ID 0x302) must be populated as a UUID in binary representation, + * following RFC 4122 byte order. + */ + HEAD_TRACKER = 37, + + /** + * ACCELEROMETER_LIMITED_AXES + * reporting-mode: continuous + * + * Equivalent to ACCELEROMETER, but supporting cases where one or two axes + * are not supported. + */ + ACCELEROMETER_LIMITED_AXES = 38, + + /** + * GYROSCOPE_LIMITED_AXES + * reporting-mode: continuous + * + * Equivalent to GYROSCOPE, but supporting cases where one or two axes are + * not supported. + */ + GYROSCOPE_LIMITED_AXES = 39, + + /** + * ACCELEROMETER_LIMITED_AXES_UNCALIBRATED + * reporting-mode: continuous + * + * Equivalent to ACCELEROMETER_UNCALIBRATED, but supporting cases where one + * or two axes are not supported. + */ + ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40, + + /** + * GYROSCOPE_LIMITED_AXES_UNCALIBRATED + * reporting-mode: continuous + * + * Equivalent to GYROSCOPE_UNCALIBRATED, but supporting cases where one or + * two axes are not supported. + */ + GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, + + /** + * HEADING + * reporting-mode: continuous + * + * A sensor of this type measures the direction in which the device is + * pointing relative to true north in degrees. + * + * This sensor was added for automotive form factors. Other devices with a + * clear forward direction might find it useful as well. However, devices + * with a more ambiguous orientation such as phones or wearables might want + * to consider using other sensors such as Sensor.TYPE_ROTATION_VECTOR + * which might be more suitable. + */ + HEADING = 42, + + /** + * Base for device manufacturers private sensor types. + * These sensor types can't be exposed in the SDK. + */ + DEVICE_PRIVATE_BASE = 0x10000, +} diff --git a/sensors/aidl/default/Android.bp b/sensors/aidl/default/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..49841a456b094d0f0c822cb87db984337ac93e6e --- /dev/null +++ b/sensors/aidl/default/Android.bp @@ -0,0 +1,67 @@ +/* + * 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_library_static { + name: "libsensorsexampleimpl", + vendor: true, + shared_libs: [ + "libbase", + "libfmq", + "libpower", + "libbinder_ndk", + "android.hardware.sensors-V1-ndk", + ], + export_include_dirs: ["include"], + srcs: [ + "Sensors.cpp", + "Sensor.cpp", + ], + visibility: [ + ":__subpackages__", + "//hardware/interfaces/tests/extension/sensors:__subpackages__", + ], +} + +cc_binary { + name: "android.hardware.sensors-service.example", + relative_install_path: "hw", + init_rc: ["sensors-default.rc"], + vintf_fragments: ["sensors-default.xml"], + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "libfmq", + "libpower", + "libcutils", + "liblog", + "libutils", + "android.hardware.sensors-V1-ndk", + ], + static_libs: [ + "libsensorsexampleimpl", + ], + srcs: ["main.cpp"], +} diff --git a/sensors/aidl/default/OWNERS b/sensors/aidl/default/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..e9556700d6dd58fb500e1c41db654110b5d3717e --- /dev/null +++ b/sensors/aidl/default/OWNERS @@ -0,0 +1,3 @@ +arthuri@google.com +bduddie@google.com +stange@google.com \ No newline at end of file diff --git a/sensors/aidl/default/Sensor.cpp b/sensors/aidl/default/Sensor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..62193d6c9b6c83bbc2c52ea0dbb881dbee5e3971 --- /dev/null +++ b/sensors/aidl/default/Sensor.cpp @@ -0,0 +1,434 @@ +/* + * 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. + */ + +#include "sensors-impl/Sensor.h" + +#include "utils/SystemClock.h" + +#include + +using ::ndk::ScopedAStatus; + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { + +static constexpr int32_t kDefaultMaxDelayUs = 10 * 1000 * 1000; + +Sensor::Sensor(ISensorsEventCallback* callback) + : mIsEnabled(false), + mSamplingPeriodNs(0), + mLastSampleTimeNs(0), + mCallback(callback), + mMode(OperationMode::NORMAL) { + mRunThread = std::thread(startThread, this); +} + +Sensor::~Sensor() { + std::unique_lock lock(mRunMutex); + mStopThread = true; + mIsEnabled = false; + mWaitCV.notify_all(); + lock.release(); + mRunThread.join(); +} + +const SensorInfo& Sensor::getSensorInfo() const { + return mSensorInfo; +} + +void Sensor::batch(int64_t samplingPeriodNs) { + if (samplingPeriodNs < mSensorInfo.minDelayUs * 1000LL) { + samplingPeriodNs = mSensorInfo.minDelayUs * 1000LL; + } else if (samplingPeriodNs > mSensorInfo.maxDelayUs * 1000LL) { + samplingPeriodNs = mSensorInfo.maxDelayUs * 1000LL; + } + + if (mSamplingPeriodNs != samplingPeriodNs) { + mSamplingPeriodNs = samplingPeriodNs; + // Wake up the 'run' thread to check if a new event should be generated now + mWaitCV.notify_all(); + } +} + +void Sensor::activate(bool enable) { + if (mIsEnabled != enable) { + std::unique_lock lock(mRunMutex); + mIsEnabled = enable; + mWaitCV.notify_all(); + } +} + +ScopedAStatus Sensor::flush() { + // Only generate a flush complete event if the sensor is enabled and if the sensor is not a + // one-shot sensor. + if (!mIsEnabled || + (mSensorInfo.flags & static_cast(SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE))) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(BnSensors::ERROR_BAD_VALUE)); + } + + // Note: If a sensor supports batching, write all of the currently batched events for the sensor + // to the Event FMQ prior to writing the flush complete event. + Event ev; + ev.sensorHandle = mSensorInfo.sensorHandle; + ev.sensorType = SensorType::META_DATA; + EventPayload::MetaData meta = { + .what = MetaDataEventType::META_DATA_FLUSH_COMPLETE, + }; + ev.payload.set(meta); + std::vector evs{ev}; + mCallback->postEvents(evs, isWakeUpSensor()); + + return ScopedAStatus::ok(); +} + +void Sensor::startThread(Sensor* sensor) { + sensor->run(); +} + +void Sensor::run() { + std::unique_lock runLock(mRunMutex); + constexpr int64_t kNanosecondsInSeconds = 1000 * 1000 * 1000; + + while (!mStopThread) { + if (!mIsEnabled || mMode == OperationMode::DATA_INJECTION) { + mWaitCV.wait(runLock, [&] { + return ((mIsEnabled && mMode == OperationMode::NORMAL) || mStopThread); + }); + } else { + timespec curTime; + clock_gettime(CLOCK_BOOTTIME, &curTime); + int64_t now = (curTime.tv_sec * kNanosecondsInSeconds) + curTime.tv_nsec; + int64_t nextSampleTime = mLastSampleTimeNs + mSamplingPeriodNs; + + if (now >= nextSampleTime) { + mLastSampleTimeNs = now; + nextSampleTime = mLastSampleTimeNs + mSamplingPeriodNs; + mCallback->postEvents(readEvents(), isWakeUpSensor()); + } + + mWaitCV.wait_for(runLock, std::chrono::nanoseconds(nextSampleTime - now)); + } + } +} + +bool Sensor::isWakeUpSensor() { + return mSensorInfo.flags & static_cast(SensorInfo::SENSOR_FLAG_BITS_WAKE_UP); +} + +std::vector Sensor::readEvents() { + std::vector events; + Event event; + event.sensorHandle = mSensorInfo.sensorHandle; + event.sensorType = mSensorInfo.type; + event.timestamp = ::android::elapsedRealtimeNano(); + memset(&event.payload, 0, sizeof(event.payload)); + readEventPayload(event.payload); + events.push_back(event); + return events; +} + +void Sensor::setOperationMode(OperationMode mode) { + if (mMode != mode) { + std::unique_lock lock(mRunMutex); + mMode = mode; + mWaitCV.notify_all(); + } +} + +bool Sensor::supportsDataInjection() const { + return mSensorInfo.flags & static_cast(SensorInfo::SENSOR_FLAG_BITS_DATA_INJECTION); +} + +ScopedAStatus Sensor::injectEvent(const Event& event) { + if (event.sensorType == SensorType::ADDITIONAL_INFO) { + return ScopedAStatus::ok(); + // When in OperationMode::NORMAL, SensorType::ADDITIONAL_INFO is used to push operation + // environment data into the device. + } + + if (!supportsDataInjection()) { + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); + } + + if (mMode == OperationMode::DATA_INJECTION) { + mCallback->postEvents(std::vector{event}, isWakeUpSensor()); + return ScopedAStatus::ok(); + } + + return ScopedAStatus::fromServiceSpecificError( + static_cast(BnSensors::ERROR_BAD_VALUE)); +} + +OnChangeSensor::OnChangeSensor(ISensorsEventCallback* callback) + : Sensor(callback), mPreviousEventSet(false) {} + +void OnChangeSensor::activate(bool enable) { + Sensor::activate(enable); + if (!enable) { + mPreviousEventSet = false; + } +} + +std::vector OnChangeSensor::readEvents() { + std::vector events = Sensor::readEvents(); + std::vector outputEvents; + + for (auto iter = events.begin(); iter != events.end(); ++iter) { + Event ev = *iter; + if (!mPreviousEventSet || + memcmp(&mPreviousEvent.payload, &ev.payload, sizeof(ev.payload)) != 0) { + outputEvents.push_back(ev); + mPreviousEvent = ev; + mPreviousEventSet = true; + } + } + return outputEvents; +} + +AccelSensor::AccelSensor(int32_t sensorHandle, ISensorsEventCallback* callback) : Sensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Accel Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::ACCELEROMETER; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 78.4f; // +/- 8g + mSensorInfo.resolution = 1.52e-5; + mSensorInfo.power = 0.001f; // mA + mSensorInfo.minDelayUs = 10 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = static_cast(SensorInfo::SENSOR_FLAG_BITS_DATA_INJECTION); +}; + +void AccelSensor::readEventPayload(EventPayload& payload) { + EventPayload::Vec3 vec3 = { + .x = 0, + .y = 0, + .z = -9.8, + .status = SensorStatus::ACCURACY_HIGH, + }; + payload.set(vec3); +} + +PressureSensor::PressureSensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : Sensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Pressure Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::PRESSURE; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 1100.0f; // hPa + mSensorInfo.resolution = 0.005f; // hPa + mSensorInfo.power = 0.001f; // mA + mSensorInfo.minDelayUs = 100 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = 0; +}; + +void PressureSensor::readEventPayload(EventPayload& payload) { + payload.set(1013.25f); +} + +MagnetometerSensor::MagnetometerSensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : Sensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Magnetic Field Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::MAGNETIC_FIELD; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 1300.0f; + mSensorInfo.resolution = 0.01f; + mSensorInfo.power = 0.001f; // mA + mSensorInfo.minDelayUs = 20 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = 0; +}; + +void MagnetometerSensor::readEventPayload(EventPayload& payload) { + EventPayload::Vec3 vec3 = { + .x = 100.0, + .y = 0, + .z = 50.0, + .status = SensorStatus::ACCURACY_HIGH, + }; + payload.set(vec3); +} + +LightSensor::LightSensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : OnChangeSensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Light Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::LIGHT; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 43000.0f; + mSensorInfo.resolution = 10.0f; + mSensorInfo.power = 0.001f; // mA + mSensorInfo.minDelayUs = 200 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = static_cast(SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE); +}; + +void LightSensor::readEventPayload(EventPayload& payload) { + payload.set(80.0f); +} + +ProximitySensor::ProximitySensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : OnChangeSensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Proximity Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::PROXIMITY; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 5.0f; + mSensorInfo.resolution = 1.0f; + mSensorInfo.power = 0.012f; // mA + mSensorInfo.minDelayUs = 200 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = static_cast(SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE | + SensorInfo::SENSOR_FLAG_BITS_WAKE_UP); +}; + +void ProximitySensor::readEventPayload(EventPayload& payload) { + payload.set(2.5f); +} + +GyroSensor::GyroSensor(int32_t sensorHandle, ISensorsEventCallback* callback) : Sensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Gyro Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::GYROSCOPE; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 1000.0f * M_PI / 180.0f; + mSensorInfo.resolution = 1000.0f * M_PI / (180.0f * 32768.0f); + mSensorInfo.power = 0.001f; + mSensorInfo.minDelayUs = 10 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = 0; +}; + +void GyroSensor::readEventPayload(EventPayload& payload) { + EventPayload::Vec3 vec3 = { + .x = 0, + .y = 0, + .z = 0, + .status = SensorStatus::ACCURACY_HIGH, + }; + payload.set(vec3); +} + +AmbientTempSensor::AmbientTempSensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : OnChangeSensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Ambient Temp Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::AMBIENT_TEMPERATURE; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 80.0f; + mSensorInfo.resolution = 0.01f; + mSensorInfo.power = 0.001f; + mSensorInfo.minDelayUs = 40 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = static_cast(SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE); +}; + +void AmbientTempSensor::readEventPayload(EventPayload& payload) { + payload.set(40.0f); +} + +RelativeHumiditySensor::RelativeHumiditySensor(int32_t sensorHandle, + ISensorsEventCallback* callback) + : OnChangeSensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Relative Humidity Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::RELATIVE_HUMIDITY; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 100.0f; + mSensorInfo.resolution = 0.1f; + mSensorInfo.power = 0.001f; + mSensorInfo.minDelayUs = 40 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = static_cast(SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE); +} + +void RelativeHumiditySensor::readEventPayload(EventPayload& payload) { + payload.set(50.0f); +} + +HingeAngleSensor::HingeAngleSensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : OnChangeSensor(callback) { + mSensorInfo.sensorHandle = sensorHandle; + mSensorInfo.name = "Hinge Angle Sensor"; + mSensorInfo.vendor = "Vendor String"; + mSensorInfo.version = 1; + mSensorInfo.type = SensorType::HINGE_ANGLE; + mSensorInfo.typeAsString = ""; + mSensorInfo.maxRange = 360.0f; + mSensorInfo.resolution = 1.0f; + mSensorInfo.power = 0.001f; + mSensorInfo.minDelayUs = 40 * 1000; // microseconds + mSensorInfo.maxDelayUs = kDefaultMaxDelayUs; + mSensorInfo.fifoReservedEventCount = 0; + mSensorInfo.fifoMaxEventCount = 0; + mSensorInfo.requiredPermission = ""; + mSensorInfo.flags = static_cast(SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE | + SensorInfo::SENSOR_FLAG_BITS_WAKE_UP | + SensorInfo::SENSOR_FLAG_BITS_DATA_INJECTION); +} + +void HingeAngleSensor::readEventPayload(EventPayload& payload) { + payload.set(180.0f); +} + +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/Sensors.cpp b/sensors/aidl/default/Sensors.cpp new file mode 100644 index 0000000000000000000000000000000000000000..65dd304b2c1febadbbf760c485ba9340a71ad005 --- /dev/null +++ b/sensors/aidl/default/Sensors.cpp @@ -0,0 +1,157 @@ +/* + * 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. + */ + +#include "sensors-impl/Sensors.h" + +#include + +using ::aidl::android::hardware::common::fmq::MQDescriptor; +using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using ::aidl::android::hardware::sensors::Event; +using ::aidl::android::hardware::sensors::ISensors; +using ::aidl::android::hardware::sensors::ISensorsCallback; +using ::aidl::android::hardware::sensors::SensorInfo; +using ::ndk::ScopedAStatus; + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { + +ScopedAStatus Sensors::activate(int32_t in_sensorHandle, bool in_enabled) { + auto sensor = mSensors.find(in_sensorHandle); + if (sensor != mSensors.end()) { + sensor->second->activate(in_enabled); + return ScopedAStatus::ok(); + } + + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +} + +ScopedAStatus Sensors::batch(int32_t in_sensorHandle, int64_t in_samplingPeriodNs, + int64_t /* in_maxReportLatencyNs */) { + auto sensor = mSensors.find(in_sensorHandle); + if (sensor != mSensors.end()) { + sensor->second->batch(in_samplingPeriodNs); + return ScopedAStatus::ok(); + } + + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +} + +ScopedAStatus Sensors::configDirectReport(int32_t /* in_sensorHandle */, + int32_t /* in_channelHandle */, + ISensors::RateLevel /* in_rate */, + int32_t* _aidl_return) { + *_aidl_return = EX_UNSUPPORTED_OPERATION; + + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +ScopedAStatus Sensors::flush(int32_t in_sensorHandle) { + auto sensor = mSensors.find(in_sensorHandle); + if (sensor != mSensors.end()) { + return sensor->second->flush(); + } + + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +} + +ScopedAStatus Sensors::getSensorsList(std::vector* _aidl_return) { + for (const auto& sensor : mSensors) { + _aidl_return->push_back(sensor.second->getSensorInfo()); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus Sensors::initialize( + const MQDescriptor& in_eventQueueDescriptor, + const MQDescriptor& in_wakeLockDescriptor, + const std::shared_ptr<::aidl::android::hardware::sensors::ISensorsCallback>& + in_sensorsCallback) { + ScopedAStatus result = ScopedAStatus::ok(); + + mEventQueue = std::make_unique>( + in_eventQueueDescriptor, true /* resetPointers */); + + // Ensure that all sensors are disabled. + for (auto sensor : mSensors) { + sensor.second->activate(false); + } + + // Stop the Wake Lock thread if it is currently running + if (mReadWakeLockQueueRun.load()) { + mReadWakeLockQueueRun = false; + mWakeLockThread.join(); + } + + // Save a reference to the callback + mCallback = in_sensorsCallback; + + // Ensure that any existing EventFlag is properly deleted + deleteEventFlag(); + + // Create the EventFlag that is used to signal to the framework that sensor events have been + // written to the Event FMQ + if (EventFlag::createEventFlag(mEventQueue->getEventFlagWord(), &mEventQueueFlag) != OK) { + result = ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + + // Create the Wake Lock FMQ that is used by the framework to communicate whenever WAKE_UP + // events have been successfully read and handled by the framework. + mWakeLockQueue = std::make_unique>( + in_wakeLockDescriptor, true /* resetPointers */); + + if (!mCallback || !mEventQueue || !mWakeLockQueue || mEventQueueFlag == nullptr) { + result = ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + + // Start the thread to read events from the Wake Lock FMQ + mReadWakeLockQueueRun = true; + mWakeLockThread = std::thread(startReadWakeLockThread, this); + return result; +} + +ScopedAStatus Sensors::injectSensorData(const Event& in_event) { + auto sensor = mSensors.find(in_event.sensorHandle); + if (sensor != mSensors.end()) { + return sensor->second->injectEvent(in_event); + } + return ScopedAStatus::fromServiceSpecificError(static_cast(ERROR_BAD_VALUE)); +} + +ScopedAStatus Sensors::registerDirectChannel(const ISensors::SharedMemInfo& /* in_mem */, + int32_t* _aidl_return) { + *_aidl_return = EX_UNSUPPORTED_OPERATION; + + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +ScopedAStatus Sensors::setOperationMode(OperationMode in_mode) { + for (auto sensor : mSensors) { + sensor.second->setOperationMode(in_mode); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus Sensors::unregisterDirectChannel(int32_t /* in_channelHandle */) { + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/include/sensors-impl/Sensor.h b/sensors/aidl/default/include/sensors-impl/Sensor.h new file mode 100644 index 0000000000000000000000000000000000000000..e6cd3e6970dc8a59c959957792b7768f124a8f43 --- /dev/null +++ b/sensors/aidl/default/include/sensors-impl/Sensor.h @@ -0,0 +1,168 @@ +/* + * 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. + */ + +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { + +class ISensorsEventCallback { + public: + using Event = ::aidl::android::hardware::sensors::Event; + + virtual ~ISensorsEventCallback(){}; + virtual void postEvents(const std::vector& events, bool wakeup) = 0; +}; + +class Sensor { + public: + using OperationMode = ::aidl::android::hardware::sensors::ISensors::OperationMode; + using Event = ::aidl::android::hardware::sensors::Event; + using EventPayload = ::aidl::android::hardware::sensors::Event::EventPayload; + using SensorInfo = ::aidl::android::hardware::sensors::SensorInfo; + using SensorType = ::aidl::android::hardware::sensors::SensorType; + using MetaDataEventType = + ::aidl::android::hardware::sensors::Event::EventPayload::MetaData::MetaDataEventType; + + Sensor(ISensorsEventCallback* callback); + virtual ~Sensor(); + + const SensorInfo& getSensorInfo() const; + void batch(int64_t samplingPeriodNs); + virtual void activate(bool enable); + ndk::ScopedAStatus flush(); + + void setOperationMode(OperationMode mode); + bool supportsDataInjection() const; + ndk::ScopedAStatus injectEvent(const Event& event); + + protected: + void run(); + virtual std::vector readEvents(); + virtual void readEventPayload(EventPayload&) = 0; + static void startThread(Sensor* sensor); + + bool isWakeUpSensor(); + + bool mIsEnabled; + int64_t mSamplingPeriodNs; + int64_t mLastSampleTimeNs; + SensorInfo mSensorInfo; + + std::atomic_bool mStopThread; + std::condition_variable mWaitCV; + std::mutex mRunMutex; + std::thread mRunThread; + + ISensorsEventCallback* mCallback; + + OperationMode mMode; +}; + +class OnChangeSensor : public Sensor { + public: + OnChangeSensor(ISensorsEventCallback* callback); + + virtual void activate(bool enable) override; + + protected: + virtual std::vector readEvents() override; + + protected: + Event mPreviousEvent; + bool mPreviousEventSet; +}; + +class AccelSensor : public Sensor { + public: + AccelSensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class GyroSensor : public Sensor { + public: + GyroSensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class AmbientTempSensor : public OnChangeSensor { + public: + AmbientTempSensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class PressureSensor : public Sensor { + public: + PressureSensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class MagnetometerSensor : public Sensor { + public: + MagnetometerSensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class LightSensor : public OnChangeSensor { + public: + LightSensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class ProximitySensor : public OnChangeSensor { + public: + ProximitySensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class RelativeHumiditySensor : public OnChangeSensor { + public: + RelativeHumiditySensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +class HingeAngleSensor : public OnChangeSensor { + public: + HingeAngleSensor(int32_t sensorHandle, ISensorsEventCallback* callback); + + protected: + virtual void readEventPayload(EventPayload& payload) override; +}; + +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/include/sensors-impl/Sensors.h b/sensors/aidl/default/include/sensors-impl/Sensors.h new file mode 100644 index 0000000000000000000000000000000000000000..e270d9682edfc12beb8e7a3aa44b8a62a23ab10b --- /dev/null +++ b/sensors/aidl/default/include/sensors-impl/Sensors.h @@ -0,0 +1,216 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include "Sensor.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { + +using aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using ::android::AidlMessageQueue; +using ::android::OK; +using ::android::status_t; +using ::android::hardware::EventFlag; + +class Sensors : public BnSensors, public ISensorsEventCallback { + static constexpr const char* kWakeLockName = "SensorsHAL_WAKEUP"; + + public: + Sensors() + : mEventQueueFlag(nullptr), + mNextHandle(1), + mOutstandingWakeUpEvents(0), + mReadWakeLockQueueRun(false), + mAutoReleaseWakeLockTime(0), + mHasWakeLock(false) { + AddSensor(); + AddSensor(); + AddSensor(); + AddSensor(); + AddSensor(); + AddSensor(); + AddSensor(); + AddSensor(); + AddSensor(); + } + + virtual ~Sensors() { + deleteEventFlag(); + mReadWakeLockQueueRun = false; + mWakeLockThread.join(); + } + + ::ndk::ScopedAStatus activate(int32_t in_sensorHandle, bool in_enabled) override; + ::ndk::ScopedAStatus batch(int32_t in_sensorHandle, int64_t in_samplingPeriodNs, + int64_t in_maxReportLatencyNs) override; + ::ndk::ScopedAStatus configDirectReport( + int32_t in_sensorHandle, int32_t in_channelHandle, + ::aidl::android::hardware::sensors::ISensors::RateLevel in_rate, + int32_t* _aidl_return) override; + ::ndk::ScopedAStatus flush(int32_t in_sensorHandle) override; + ::ndk::ScopedAStatus getSensorsList( + std::vector<::aidl::android::hardware::sensors::SensorInfo>* _aidl_return) override; + ::ndk::ScopedAStatus initialize( + const ::aidl::android::hardware::common::fmq::MQDescriptor< + ::aidl::android::hardware::sensors::Event, + ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>& + in_eventQueueDescriptor, + const ::aidl::android::hardware::common::fmq::MQDescriptor< + int32_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>& + in_wakeLockDescriptor, + const std::shared_ptr<::aidl::android::hardware::sensors::ISensorsCallback>& + in_sensorsCallback) override; + ::ndk::ScopedAStatus injectSensorData( + const ::aidl::android::hardware::sensors::Event& in_event) override; + ::ndk::ScopedAStatus registerDirectChannel( + const ::aidl::android::hardware::sensors::ISensors::SharedMemInfo& in_mem, + int32_t* _aidl_return) override; + ::ndk::ScopedAStatus setOperationMode( + ::aidl::android::hardware::sensors::ISensors::OperationMode in_mode) override; + ::ndk::ScopedAStatus unregisterDirectChannel(int32_t in_channelHandle) override; + + void postEvents(const std::vector& events, bool wakeup) override { + std::lock_guard lock(mWriteLock); + if (mEventQueue == nullptr) { + return; + } + if (mEventQueue->write(&events.front(), events.size())) { + mEventQueueFlag->wake( + static_cast(BnSensors::EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS)); + + if (wakeup) { + // Keep track of the number of outstanding WAKE_UP events in order to properly hold + // a wake lock until the framework has secured a wake lock + updateWakeLock(events.size(), 0 /* eventsHandled */); + } + } + } + + protected: + // Add a new sensor + template + void AddSensor() { + std::shared_ptr sensor = + std::make_shared(mNextHandle++ /* sensorHandle */, this /* callback */); + mSensors[sensor->getSensorInfo().sensorHandle] = sensor; + } + + // Utility function to delete the Event Flag + void deleteEventFlag() { + if (mEventQueueFlag != nullptr) { + status_t status = EventFlag::deleteEventFlag(&mEventQueueFlag); + if (status != OK) { + ALOGI("Failed to delete event flag: %d", status); + } + } + } + + static void startReadWakeLockThread(Sensors* sensors) { sensors->readWakeLockFMQ(); } + + // Function to read the Wake Lock FMQ and release the wake lock when appropriate + void readWakeLockFMQ() { + while (mReadWakeLockQueueRun.load()) { + constexpr int64_t kReadTimeoutNs = 500 * 1000 * 1000; // 500 ms + int32_t eventsHandled = 0; + + // Read events from the Wake Lock FMQ. Timeout after a reasonable amount of time to + // ensure that any held wake lock is able to be released if it is held for too long. + mWakeLockQueue->readBlocking( + &eventsHandled, 1 /* count */, 0 /* readNotification */, + static_cast(WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN), kReadTimeoutNs); + updateWakeLock(0 /* eventsWritten */, eventsHandled); + } + } + + /** + * Responsible for acquiring and releasing a wake lock when there are unhandled WAKE_UP events + */ + void updateWakeLock(int32_t eventsWritten, int32_t eventsHandled) { + std::lock_guard lock(mWakeLockLock); + int32_t newVal = mOutstandingWakeUpEvents + eventsWritten - eventsHandled; + if (newVal < 0) { + mOutstandingWakeUpEvents = 0; + } else { + mOutstandingWakeUpEvents = newVal; + } + + if (eventsWritten > 0) { + // Update the time at which the last WAKE_UP event was sent + mAutoReleaseWakeLockTime = ::android::uptimeMillis() + + static_cast(WAKE_LOCK_TIMEOUT_SECONDS) * 1000; + } + + if (!mHasWakeLock && mOutstandingWakeUpEvents > 0 && + acquire_wake_lock(PARTIAL_WAKE_LOCK, kWakeLockName) == 0) { + mHasWakeLock = true; + } else if (mHasWakeLock) { + // Check if the wake lock should be released automatically if + // SensorTimeout::WAKE_LOCK_SECONDS has elapsed since the last WAKE_UP event was written + // to the Wake Lock FMQ. + if (::android::uptimeMillis() > mAutoReleaseWakeLockTime) { + ALOGD("No events read from wake lock FMQ for %d seconds, auto releasing wake lock", + WAKE_LOCK_TIMEOUT_SECONDS); + mOutstandingWakeUpEvents = 0; + } + + if (mOutstandingWakeUpEvents == 0 && release_wake_lock(kWakeLockName) == 0) { + mHasWakeLock = false; + } + } + } + + private: + // The Event FMQ where sensor events are written + std::unique_ptr> mEventQueue; + // The Wake Lock FMQ that is read to determine when the framework has handled WAKE_UP events + std::unique_ptr> mWakeLockQueue; + // Event Flag to signal to the framework when sensor events are available to be read + EventFlag* mEventQueueFlag; + // Callback for asynchronous events, such as dynamic sensor connections. + std::shared_ptr<::aidl::android::hardware::sensors::ISensorsCallback> mCallback; + // A map of the available sensors. + std::map> mSensors; + // The next available sensor handle. + int32_t mNextHandle; + // Lock to protect writes to the FMQs. + std::mutex mWriteLock; + // Lock to protect acquiring and releasing the wake lock + std::mutex mWakeLockLock; + // Track the number of WAKE_UP events that have not been handled by the framework + uint32_t mOutstandingWakeUpEvents; + // A thread to read the Wake Lock FMQ + std::thread mWakeLockThread; + // Flag to indicate that the Wake Lock Thread should continue to run + std::atomic_bool mReadWakeLockQueueRun; + // Track the time when the wake lock should automatically be released + int64_t mAutoReleaseWakeLockTime; + // Flag to indicate if a wake lock has been acquired + bool mHasWakeLock; +}; + +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/main.cpp b/sensors/aidl/default/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8a5a7de1244fe8b8c350977dd7446e5ee1f060ee --- /dev/null +++ b/sensors/aidl/default/main.cpp @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#include "sensors-impl/Sensors.h" + +#include +#include +#include + +using aidl::android::hardware::sensors::Sensors; + +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(0); + + // Make a default sensors service + auto sensor = ndk::SharedRefBase::make(); + const std::string sensorName = std::string() + Sensors::descriptor + "/default"; + binder_status_t status = + AServiceManager_addService(sensor->asBinder().get(), sensorName.c_str()); + CHECK_EQ(status, STATUS_OK); + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} diff --git a/sensors/aidl/default/multihal/Android.bp b/sensors/aidl/default/multihal/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..eee10625bbf82270a51b1e1a3ce474c23cc43f6d --- /dev/null +++ b/sensors/aidl/default/multihal/Android.bp @@ -0,0 +1,58 @@ +// +// 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_library_static { + name: "android.hardware.sensors@aidl-multihal", + vendor: true, + header_libs: [ + "android.hardware.sensors@2.X-multihal.header", + "android.hardware.sensors@2.X-shared-utils", + ], + shared_libs: [ + "libfmq", + "libpower", + "libbase", + "libbinder_ndk", + "android.hardware.sensors@1.0", + "android.hardware.sensors@2.0", + "android.hardware.sensors@2.1", + "android.hardware.sensors-V1-ndk", + ], + export_include_dirs: ["include"], + srcs: [ + "HalProxyAidl.cpp", + "ConvertUtils.cpp", + ], + visibility: [ + ":__subpackages__", + "//hardware/interfaces/sensors/aidl/multihal:__subpackages__", + "//hardware/interfaces/tests/extension/sensors:__subpackages__", + ], + static_libs: [ + "android.hardware.sensors@1.0-convert", + "android.hardware.sensors@2.X-multihal", + "libaidlcommonsupport", + ], +} diff --git a/sensors/aidl/default/multihal/ConvertUtils.cpp b/sensors/aidl/default/multihal/ConvertUtils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bf56ed52a3346f2685830f53afae24b673491435 --- /dev/null +++ b/sensors/aidl/default/multihal/ConvertUtils.cpp @@ -0,0 +1,363 @@ +/* + * 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. + */ + +#include "ConvertUtils.h" +#include +#include + +using AidlSensorInfo = ::aidl::android::hardware::sensors::SensorInfo; +using AidlSensorType = ::aidl::android::hardware::sensors::SensorType; +using AidlEvent = ::aidl::android::hardware::sensors::Event; +using AidlSensorStatus = ::aidl::android::hardware::sensors::SensorStatus; +using ::aidl::android::hardware::sensors::AdditionalInfo; +using ::aidl::android::hardware::sensors::DynamicSensorInfo; +using ::android::hardware::sensors::V1_0::MetaDataEventType; +using V1_0SensorStatus = ::android::hardware::sensors::V1_0::SensorStatus; +using ::android::hardware::sensors::V1_0::AdditionalInfoType; +using V2_1SensorInfo = ::android::hardware::sensors::V2_1::SensorInfo; +using V2_1Event = ::android::hardware::sensors::V2_1::Event; +using V2_1SensorType = ::android::hardware::sensors::V2_1::SensorType; + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { +namespace implementation { + +AidlSensorInfo convertSensorInfo(const V2_1SensorInfo& sensorInfo) { + AidlSensorInfo aidlSensorInfo; + aidlSensorInfo.sensorHandle = sensorInfo.sensorHandle; + aidlSensorInfo.name = sensorInfo.name; + aidlSensorInfo.vendor = sensorInfo.vendor; + aidlSensorInfo.version = sensorInfo.version; + aidlSensorInfo.type = (AidlSensorType)sensorInfo.type; + aidlSensorInfo.typeAsString = sensorInfo.typeAsString; + aidlSensorInfo.maxRange = sensorInfo.maxRange; + aidlSensorInfo.resolution = sensorInfo.resolution; + aidlSensorInfo.power = sensorInfo.power; + aidlSensorInfo.minDelayUs = sensorInfo.minDelay; + aidlSensorInfo.fifoReservedEventCount = sensorInfo.fifoReservedEventCount; + aidlSensorInfo.fifoMaxEventCount = sensorInfo.fifoMaxEventCount; + aidlSensorInfo.requiredPermission = sensorInfo.requiredPermission; + aidlSensorInfo.maxDelayUs = sensorInfo.maxDelay; + aidlSensorInfo.flags = sensorInfo.flags; + return aidlSensorInfo; +} + +void convertToHidlEvent(const AidlEvent& aidlEvent, V2_1Event* hidlEvent) { + static_assert(decltype(hidlEvent->u.data)::elementCount() == 16); + hidlEvent->timestamp = aidlEvent.timestamp; + hidlEvent->sensorHandle = aidlEvent.sensorHandle; + hidlEvent->sensorType = (V2_1SensorType)aidlEvent.sensorType; + + switch (aidlEvent.sensorType) { + case AidlSensorType::META_DATA: + hidlEvent->u.meta.what = + (MetaDataEventType)aidlEvent.payload.get().what; + break; + case AidlSensorType::ACCELEROMETER: + case AidlSensorType::MAGNETIC_FIELD: + case AidlSensorType::ORIENTATION: + case AidlSensorType::GYROSCOPE: + case AidlSensorType::GRAVITY: + case AidlSensorType::LINEAR_ACCELERATION: + hidlEvent->u.vec3.x = aidlEvent.payload.get().x; + hidlEvent->u.vec3.y = aidlEvent.payload.get().y; + hidlEvent->u.vec3.z = aidlEvent.payload.get().z; + hidlEvent->u.vec3.status = + (V1_0SensorStatus)aidlEvent.payload.get().status; + break; + case AidlSensorType::GAME_ROTATION_VECTOR: + hidlEvent->u.vec4.x = aidlEvent.payload.get().x; + hidlEvent->u.vec4.y = aidlEvent.payload.get().y; + hidlEvent->u.vec4.z = aidlEvent.payload.get().z; + hidlEvent->u.vec4.w = aidlEvent.payload.get().w; + break; + case AidlSensorType::ROTATION_VECTOR: + case AidlSensorType::GEOMAGNETIC_ROTATION_VECTOR: + std::copy(aidlEvent.payload.get().values.data(), + aidlEvent.payload.get().values.data() + 5, + hidlEvent->u.data.data()); + break; + case AidlSensorType::ACCELEROMETER_UNCALIBRATED: + case AidlSensorType::MAGNETIC_FIELD_UNCALIBRATED: + case AidlSensorType::GYROSCOPE_UNCALIBRATED: + hidlEvent->u.uncal.x = aidlEvent.payload.get().x; + hidlEvent->u.uncal.y = aidlEvent.payload.get().y; + hidlEvent->u.uncal.z = aidlEvent.payload.get().z; + hidlEvent->u.uncal.x_bias = aidlEvent.payload.get().xBias; + hidlEvent->u.uncal.y_bias = aidlEvent.payload.get().yBias; + hidlEvent->u.uncal.z_bias = aidlEvent.payload.get().zBias; + break; + case AidlSensorType::DEVICE_ORIENTATION: + case AidlSensorType::LIGHT: + case AidlSensorType::PRESSURE: + case AidlSensorType::PROXIMITY: + case AidlSensorType::RELATIVE_HUMIDITY: + case AidlSensorType::AMBIENT_TEMPERATURE: + case AidlSensorType::SIGNIFICANT_MOTION: + case AidlSensorType::STEP_DETECTOR: + case AidlSensorType::TILT_DETECTOR: + case AidlSensorType::WAKE_GESTURE: + case AidlSensorType::GLANCE_GESTURE: + case AidlSensorType::PICK_UP_GESTURE: + case AidlSensorType::WRIST_TILT_GESTURE: + case AidlSensorType::STATIONARY_DETECT: + case AidlSensorType::MOTION_DETECT: + case AidlSensorType::HEART_BEAT: + case AidlSensorType::LOW_LATENCY_OFFBODY_DETECT: + case AidlSensorType::HINGE_ANGLE: + hidlEvent->u.scalar = aidlEvent.payload.get(); + break; + case AidlSensorType::STEP_COUNTER: + hidlEvent->u.stepCount = aidlEvent.payload.get(); + break; + case AidlSensorType::HEART_RATE: + hidlEvent->u.heartRate.bpm = + aidlEvent.payload.get().bpm; + hidlEvent->u.heartRate.status = + (V1_0SensorStatus)aidlEvent.payload.get() + .status; + break; + case AidlSensorType::POSE_6DOF: + std::copy(std::begin(aidlEvent.payload.get().values), + std::end(aidlEvent.payload.get().values), + hidlEvent->u.pose6DOF.data()); + break; + case AidlSensorType::DYNAMIC_SENSOR_META: + hidlEvent->u.dynamic.connected = + aidlEvent.payload.get().connected; + hidlEvent->u.dynamic.sensorHandle = + aidlEvent.payload.get().sensorHandle; + std::copy( + std::begin( + aidlEvent.payload.get().uuid.values), + std::end(aidlEvent.payload.get().uuid.values), + hidlEvent->u.dynamic.uuid.data()); + break; + case AidlSensorType::ADDITIONAL_INFO: { + const AdditionalInfo& additionalInfo = + aidlEvent.payload.get(); + hidlEvent->u.additional.type = (AdditionalInfoType)additionalInfo.type; + hidlEvent->u.additional.serial = additionalInfo.serial; + + switch (additionalInfo.payload.getTag()) { + case AdditionalInfo::AdditionalInfoPayload::Tag::dataInt32: { + const auto& aidlData = + additionalInfo.payload + .get() + .values; + std::copy(std::begin(aidlData), std::end(aidlData), + hidlEvent->u.additional.u.data_int32.data()); + break; + } + case AdditionalInfo::AdditionalInfoPayload::Tag::dataFloat: { + const auto& aidlData = + additionalInfo.payload + .get() + .values; + std::copy(std::begin(aidlData), std::end(aidlData), + hidlEvent->u.additional.u.data_float.data()); + break; + } + default: + ALOGE("Invalid sensor additioanl info tag: %d", + static_cast(additionalInfo.payload.getTag())); + break; + } + break; + } + case AidlSensorType::HEAD_TRACKER: { + const auto& ht = aidlEvent.payload.get(); + hidlEvent->u.data[0] = ht.rx; + hidlEvent->u.data[1] = ht.ry; + hidlEvent->u.data[2] = ht.rz; + hidlEvent->u.data[3] = ht.vx; + hidlEvent->u.data[4] = ht.vy; + hidlEvent->u.data[5] = ht.vz; + + // IMPORTANT: Because we want to preserve the data range of discontinuityCount, + // we assume the data can be interpreted as an int32_t directly (e.g. the underlying + // HIDL HAL must be using memcpy or equivalent to store this value). + *(reinterpret_cast(&hidlEvent->u.data[6])) = ht.discontinuityCount; + break; + } + default: { + CHECK_GE((int32_t)aidlEvent.sensorType, (int32_t)SensorType::DEVICE_PRIVATE_BASE); + std::copy(std::begin(aidlEvent.payload.get().values), + std::end(aidlEvent.payload.get().values), + hidlEvent->u.data.data()); + break; + } + } +} + +void convertToAidlEvent(const V2_1Event& hidlEvent, AidlEvent* aidlEvent) { + static_assert(decltype(hidlEvent.u.data)::elementCount() == 16); + aidlEvent->timestamp = hidlEvent.timestamp; + aidlEvent->sensorHandle = hidlEvent.sensorHandle; + aidlEvent->sensorType = (AidlSensorType)hidlEvent.sensorType; + switch (hidlEvent.sensorType) { + case V2_1SensorType::META_DATA: { + AidlEvent::EventPayload::MetaData meta; + meta.what = (Event::EventPayload::MetaData::MetaDataEventType)hidlEvent.u.meta.what; + aidlEvent->payload.set(meta); + break; + } + case V2_1SensorType::ACCELEROMETER: + case V2_1SensorType::MAGNETIC_FIELD: + case V2_1SensorType::ORIENTATION: + case V2_1SensorType::GYROSCOPE: + case V2_1SensorType::GRAVITY: + case V2_1SensorType::LINEAR_ACCELERATION: { + AidlEvent::EventPayload::Vec3 vec3; + vec3.x = hidlEvent.u.vec3.x; + vec3.y = hidlEvent.u.vec3.y; + vec3.z = hidlEvent.u.vec3.z; + vec3.status = (SensorStatus)hidlEvent.u.vec3.status; + aidlEvent->payload.set(vec3); + break; + } + case V2_1SensorType::GAME_ROTATION_VECTOR: { + AidlEvent::EventPayload::Vec4 vec4; + vec4.x = hidlEvent.u.vec4.x; + vec4.y = hidlEvent.u.vec4.y; + vec4.z = hidlEvent.u.vec4.z; + vec4.w = hidlEvent.u.vec4.w; + aidlEvent->payload.set(vec4); + break; + } + case V2_1SensorType::ROTATION_VECTOR: + case V2_1SensorType::GEOMAGNETIC_ROTATION_VECTOR: { + AidlEvent::EventPayload::Data data; + std::copy(hidlEvent.u.data.data(), hidlEvent.u.data.data() + 5, + std::begin(data.values)); + aidlEvent->payload.set(data); + break; + } + case V2_1SensorType::MAGNETIC_FIELD_UNCALIBRATED: + case V2_1SensorType::GYROSCOPE_UNCALIBRATED: + case V2_1SensorType::ACCELEROMETER_UNCALIBRATED: { + AidlEvent::EventPayload::Uncal uncal; + uncal.x = hidlEvent.u.uncal.x; + uncal.y = hidlEvent.u.uncal.y; + uncal.z = hidlEvent.u.uncal.z; + uncal.xBias = hidlEvent.u.uncal.x_bias; + uncal.yBias = hidlEvent.u.uncal.y_bias; + uncal.zBias = hidlEvent.u.uncal.z_bias; + aidlEvent->payload.set(uncal); + break; + } + case V2_1SensorType::DEVICE_ORIENTATION: + case V2_1SensorType::LIGHT: + case V2_1SensorType::PRESSURE: + case V2_1SensorType::PROXIMITY: + case V2_1SensorType::RELATIVE_HUMIDITY: + case V2_1SensorType::AMBIENT_TEMPERATURE: + case V2_1SensorType::SIGNIFICANT_MOTION: + case V2_1SensorType::STEP_DETECTOR: + case V2_1SensorType::TILT_DETECTOR: + case V2_1SensorType::WAKE_GESTURE: + case V2_1SensorType::GLANCE_GESTURE: + case V2_1SensorType::PICK_UP_GESTURE: + case V2_1SensorType::WRIST_TILT_GESTURE: + case V2_1SensorType::STATIONARY_DETECT: + case V2_1SensorType::MOTION_DETECT: + case V2_1SensorType::HEART_BEAT: + case V2_1SensorType::LOW_LATENCY_OFFBODY_DETECT: + case V2_1SensorType::HINGE_ANGLE: + aidlEvent->payload.set(hidlEvent.u.scalar); + break; + case V2_1SensorType::STEP_COUNTER: + aidlEvent->payload.set(hidlEvent.u.stepCount); + break; + case V2_1SensorType::HEART_RATE: { + AidlEvent::EventPayload::HeartRate heartRate; + heartRate.bpm = hidlEvent.u.heartRate.bpm; + heartRate.status = (SensorStatus)hidlEvent.u.heartRate.status; + aidlEvent->payload.set(heartRate); + break; + } + case V2_1SensorType::POSE_6DOF: { + AidlEvent::EventPayload::Pose6Dof pose6Dof; + std::copy(hidlEvent.u.pose6DOF.data(), + hidlEvent.u.pose6DOF.data() + hidlEvent.u.pose6DOF.size(), + std::begin(pose6Dof.values)); + aidlEvent->payload.set(pose6Dof); + break; + } + case V2_1SensorType::DYNAMIC_SENSOR_META: { + DynamicSensorInfo dynamicSensorInfo; + dynamicSensorInfo.connected = hidlEvent.u.dynamic.connected; + dynamicSensorInfo.sensorHandle = hidlEvent.u.dynamic.sensorHandle; + std::copy(hidlEvent.u.dynamic.uuid.data(), + hidlEvent.u.dynamic.uuid.data() + hidlEvent.u.dynamic.uuid.size(), + std::begin(dynamicSensorInfo.uuid.values)); + aidlEvent->payload.set(dynamicSensorInfo); + break; + } + case V2_1SensorType::ADDITIONAL_INFO: { + AdditionalInfo additionalInfo; + additionalInfo.type = (AdditionalInfo::AdditionalInfoType)hidlEvent.u.additional.type; + additionalInfo.serial = hidlEvent.u.additional.serial; + + AdditionalInfo::AdditionalInfoPayload::Int32Values int32Values; + std::copy(hidlEvent.u.additional.u.data_int32.data(), + hidlEvent.u.additional.u.data_int32.data() + + hidlEvent.u.additional.u.data_int32.size(), + std::begin(int32Values.values)); + additionalInfo.payload.set( + int32Values); + aidlEvent->payload.set(additionalInfo); + break; + } + default: { + if (static_cast(hidlEvent.sensorType) == + static_cast(AidlSensorType::HEAD_TRACKER)) { + Event::EventPayload::HeadTracker headTracker; + headTracker.rx = hidlEvent.u.data[0]; + headTracker.ry = hidlEvent.u.data[1]; + headTracker.rz = hidlEvent.u.data[2]; + headTracker.vx = hidlEvent.u.data[3]; + headTracker.vy = hidlEvent.u.data[4]; + headTracker.vz = hidlEvent.u.data[5]; + + // IMPORTANT: Because we want to preserve the data range of discontinuityCount, + // we assume the data can be interpreted as an int32_t directly (e.g. the underlying + // HIDL HAL must be using memcpy or equivalent to store this value). + headTracker.discontinuityCount = + *(reinterpret_cast(&hidlEvent.u.data[6])); + + aidlEvent->payload.set(headTracker); + } else { + CHECK_GE((int32_t)hidlEvent.sensorType, + (int32_t)V2_1SensorType::DEVICE_PRIVATE_BASE); + AidlEvent::EventPayload::Data data; + std::copy(hidlEvent.u.data.data(), + hidlEvent.u.data.data() + hidlEvent.u.data.size(), + std::begin(data.values)); + aidlEvent->payload.set(data); + } + break; + } + } +} + +} // namespace implementation +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/multihal/HalProxyAidl.cpp b/sensors/aidl/default/multihal/HalProxyAidl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e6bcdada5241f4d0e2226fe72c97c596e47af2d0 --- /dev/null +++ b/sensors/aidl/default/multihal/HalProxyAidl.cpp @@ -0,0 +1,244 @@ +/* + * 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. + */ + +#include "HalProxyAidl.h" +#include +#include +#include +#include "ConvertUtils.h" +#include "EventMessageQueueWrapperAidl.h" +#include "ISensorsCallbackWrapperAidl.h" +#include "WakeLockMessageQueueWrapperAidl.h" +#include "convertV2_1.h" + +using ::aidl::android::hardware::common::fmq::MQDescriptor; +using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using ::aidl::android::hardware::sensors::ISensors; +using ::aidl::android::hardware::sensors::ISensorsCallback; +using ::android::hardware::sensors::V2_1::implementation::convertToOldEvent; +using ::ndk::ScopedAStatus; + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { +namespace implementation { + +static ScopedAStatus +resultToAStatus(::android::hardware::sensors::V1_0::Result result) { + switch (result) { + case ::android::hardware::sensors::V1_0::Result::OK: + return ScopedAStatus::ok(); + case ::android::hardware::sensors::V1_0::Result::PERMISSION_DENIED: + return ScopedAStatus::fromExceptionCode(EX_SECURITY); + case ::android::hardware::sensors::V1_0::Result::NO_MEMORY: + return ScopedAStatus::fromServiceSpecificError(ISensors::ERROR_NO_MEMORY); + case ::android::hardware::sensors::V1_0::Result::BAD_VALUE: + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + case ::android::hardware::sensors::V1_0::Result::INVALID_OPERATION: + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); + default: + return ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED); + } +} + +static ::android::hardware::sensors::V1_0::RateLevel convertRateLevel( + ISensors::RateLevel rateLevel) { + switch (rateLevel) { + case ISensors::RateLevel::STOP: + return ::android::hardware::sensors::V1_0::RateLevel::STOP; + case ISensors::RateLevel::NORMAL: + return ::android::hardware::sensors::V1_0::RateLevel::NORMAL; + case ISensors::RateLevel::FAST: + return ::android::hardware::sensors::V1_0::RateLevel::FAST; + case ISensors::RateLevel::VERY_FAST: + return ::android::hardware::sensors::V1_0::RateLevel::VERY_FAST; + default: + assert(false); + } +} + +static ::android::hardware::sensors::V1_0::OperationMode convertOperationMode( + ISensors::OperationMode operationMode) { + switch (operationMode) { + case ISensors::OperationMode::NORMAL: + return ::android::hardware::sensors::V1_0::OperationMode::NORMAL; + case ISensors::OperationMode::DATA_INJECTION: + return ::android::hardware::sensors::V1_0::OperationMode::DATA_INJECTION; + default: + assert(false); + } +} + +static ::android::hardware::sensors::V1_0::SharedMemType convertSharedMemType( + ISensors::SharedMemInfo::SharedMemType sharedMemType) { + switch (sharedMemType) { + case ISensors::SharedMemInfo::SharedMemType::ASHMEM: + return ::android::hardware::sensors::V1_0::SharedMemType::ASHMEM; + case ISensors::SharedMemInfo::SharedMemType::GRALLOC: + return ::android::hardware::sensors::V1_0::SharedMemType::GRALLOC; + default: + assert(false); + } +} + +static ::android::hardware::sensors::V1_0::SharedMemFormat convertSharedMemFormat( + ISensors::SharedMemInfo::SharedMemFormat sharedMemFormat) { + switch (sharedMemFormat) { + case ISensors::SharedMemInfo::SharedMemFormat::SENSORS_EVENT: + return ::android::hardware::sensors::V1_0::SharedMemFormat::SENSORS_EVENT; + default: + assert(false); + } +} + +static ::android::hardware::sensors::V1_0::SharedMemInfo convertSharedMemInfo( + const ISensors::SharedMemInfo& sharedMemInfo) { + ::android::hardware::sensors::V1_0::SharedMemInfo v1SharedMemInfo; + v1SharedMemInfo.type = convertSharedMemType(sharedMemInfo.type); + v1SharedMemInfo.format = convertSharedMemFormat(sharedMemInfo.format); + v1SharedMemInfo.size = sharedMemInfo.size; + v1SharedMemInfo.memoryHandle = + ::android::hardware::hidl_handle(::android::makeFromAidl(sharedMemInfo.memoryHandle)); + return v1SharedMemInfo; +} + +ScopedAStatus HalProxyAidl::activate(int32_t in_sensorHandle, bool in_enabled) { + return resultToAStatus(HalProxy::activate(in_sensorHandle, in_enabled)); +} + +ScopedAStatus HalProxyAidl::batch(int32_t in_sensorHandle, + int64_t in_samplingPeriodNs, + int64_t in_maxReportLatencyNs) { + return resultToAStatus(HalProxy::batch(in_sensorHandle, in_samplingPeriodNs, + in_maxReportLatencyNs)); +} + +ScopedAStatus HalProxyAidl::configDirectReport(int32_t in_sensorHandle, + int32_t in_channelHandle, + ISensors::RateLevel in_rate, + int32_t *_aidl_return) { + ScopedAStatus status = + ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); + HalProxy::configDirectReport( + in_sensorHandle, in_channelHandle, convertRateLevel(in_rate), + [&status, _aidl_return](::android::hardware::sensors::V1_0::Result result, + int32_t reportToken) { + status = resultToAStatus(result); + *_aidl_return = reportToken; + }); + + return status; +} + +ScopedAStatus HalProxyAidl::flush(int32_t in_sensorHandle) { + return resultToAStatus(HalProxy::flush(in_sensorHandle)); +} + +ScopedAStatus HalProxyAidl::getSensorsList( + std::vector<::aidl::android::hardware::sensors::SensorInfo> *_aidl_return) { + for (const auto &sensor : HalProxy::getSensors()) { + _aidl_return->push_back(convertSensorInfo(sensor.second)); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus HalProxyAidl::initialize( + const MQDescriptor<::aidl::android::hardware::sensors::Event, + SynchronizedReadWrite> &in_eventQueueDescriptor, + const MQDescriptor &in_wakeLockDescriptor, + const std::shared_ptr &in_sensorsCallback) { + ::android::sp<::android::hardware::sensors::V2_1::implementation:: + ISensorsCallbackWrapperBase> + dynamicCallback = new ISensorsCallbackWrapperAidl(in_sensorsCallback); + + auto aidlEventQueue = std::make_unique<::android::AidlMessageQueue< + ::aidl::android::hardware::sensors::Event, SynchronizedReadWrite>>( + in_eventQueueDescriptor, true /* resetPointers */); + std::unique_ptr<::android::hardware::sensors::V2_1::implementation:: + EventMessageQueueWrapperBase> + eventQueue = + std::make_unique(aidlEventQueue); + + auto aidlWakeLockQueue = std::make_unique< + ::android::AidlMessageQueue>( + in_wakeLockDescriptor, true /* resetPointers */); + std::unique_ptr<::android::hardware::sensors::V2_1::implementation:: + WakeLockMessageQueueWrapperBase> + wakeLockQueue = + std::make_unique(aidlWakeLockQueue); + + return resultToAStatus( + initializeCommon(eventQueue, wakeLockQueue, dynamicCallback)); +} + +ScopedAStatus HalProxyAidl::injectSensorData( + const ::aidl::android::hardware::sensors::Event &in_event) { + ::android::hardware::sensors::V2_1::Event hidlEvent; + convertToHidlEvent(in_event, &hidlEvent); + return resultToAStatus( + HalProxy::injectSensorData(convertToOldEvent(hidlEvent))); +} + +ScopedAStatus +HalProxyAidl::registerDirectChannel(const ISensors::SharedMemInfo &in_mem, + int32_t *_aidl_return) { + ScopedAStatus status = + ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); + ::android::hardware::sensors::V1_0::SharedMemInfo sharedMemInfo = + convertSharedMemInfo(in_mem); + + HalProxy::registerDirectChannel( + sharedMemInfo, + [&status, _aidl_return](::android::hardware::sensors::V1_0::Result result, + int32_t reportToken) { + status = resultToAStatus(result); + *_aidl_return = reportToken; + }); + + native_handle_delete(const_cast( + sharedMemInfo.memoryHandle.getNativeHandle())); + + return status; +} + +ScopedAStatus HalProxyAidl::setOperationMode( + ::aidl::android::hardware::sensors::ISensors::OperationMode in_mode) { + return resultToAStatus( + HalProxy::setOperationMode(convertOperationMode(in_mode))); +} + +ScopedAStatus HalProxyAidl::unregisterDirectChannel(int32_t in_channelHandle) { + return resultToAStatus(HalProxy::unregisterDirectChannel(in_channelHandle)); +} + +binder_status_t HalProxyAidl::dump(int fd, const char ** /* args */, + uint32_t /* numArgs */) { + native_handle_t *nativeHandle = + native_handle_create(1 /* numFds */, 0 /* numInts */); + nativeHandle->data[0] = fd; + + HalProxy::debug(nativeHandle, {} /* args */); + + native_handle_delete(nativeHandle); + return STATUS_OK; +} + +} // namespace implementation +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl \ No newline at end of file diff --git a/sensors/aidl/default/multihal/include/ConvertUtils.h b/sensors/aidl/default/multihal/include/ConvertUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..91dfabde3a34ef146eb04a58e352d9d2f27621da --- /dev/null +++ b/sensors/aidl/default/multihal/include/ConvertUtils.h @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { +namespace implementation { + +/** + * Generates an AIDL SensorInfo instance from the passed HIDL V2.1 SensorInfo instance. + */ +::aidl::android::hardware::sensors::SensorInfo convertSensorInfo( + const ::android::hardware::sensors::V2_1::SensorInfo& sensorInfo); + +/** + * Populates a HIDL V2.1 Event instance based on an AIDL Event instance. + */ +void convertToHidlEvent(const ::aidl::android::hardware::sensors::Event& aidlEvent, + ::android::hardware::sensors::V2_1::Event* hidlEvent); + +/** + * Populates an AIDL Event instance based on a HIDL V2.1 Event instance. + */ +void convertToAidlEvent(const ::android::hardware::sensors::V2_1::Event& hidlEvent, + ::aidl::android::hardware::sensors::Event* aidlEvent); + +} // namespace implementation +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl \ No newline at end of file diff --git a/sensors/aidl/default/multihal/include/EventMessageQueueWrapperAidl.h b/sensors/aidl/default/multihal/include/EventMessageQueueWrapperAidl.h new file mode 100644 index 0000000000000000000000000000000000000000..3eaa1d4335e0d1957569d1b5327c77818d8c867d --- /dev/null +++ b/sensors/aidl/default/multihal/include/EventMessageQueueWrapperAidl.h @@ -0,0 +1,99 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include "ConvertUtils.h" +#include "EventMessageQueueWrapper.h" +#include "ISensorsWrapper.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { +namespace implementation { + +class EventMessageQueueWrapperAidl + : public ::android::hardware::sensors::V2_1::implementation::EventMessageQueueWrapperBase { + public: + EventMessageQueueWrapperAidl( + std::unique_ptr<::android::AidlMessageQueue< + ::aidl::android::hardware::sensors::Event, + ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>>& queue) + : mQueue(std::move(queue)) {} + + virtual std::atomic* getEventFlagWord() override { + return mQueue->getEventFlagWord(); + } + + virtual size_t availableToRead() override { return mQueue->availableToRead(); } + + size_t availableToWrite() override { return mQueue->availableToWrite(); } + + virtual bool read(::android::hardware::sensors::V2_1::Event* events, + size_t numToRead) override { + bool success = mQueue->read(mIntermediateEventBuffer.data(), numToRead); + for (int i = 0; i < numToRead; ++i) { + convertToHidlEvent(mIntermediateEventBuffer[i], &events[i]); + } + return success; + } + + bool write(const ::android::hardware::sensors::V2_1::Event* events, + size_t numToWrite) override { + for (int i = 0; i < numToWrite; ++i) { + convertToAidlEvent(events[i], &mIntermediateEventBuffer[i]); + } + return mQueue->write(mIntermediateEventBuffer.data(), numToWrite); + } + + virtual bool write( + const std::vector<::android::hardware::sensors::V2_1::Event>& events) override { + for (int i = 0; i < events.size(); ++i) { + convertToAidlEvent(events[i], &mIntermediateEventBuffer[i]); + } + return mQueue->write(mIntermediateEventBuffer.data(), events.size()); + } + + bool writeBlocking(const ::android::hardware::sensors::V2_1::Event* events, size_t count, + uint32_t readNotification, uint32_t writeNotification, int64_t timeOutNanos, + ::android::hardware::EventFlag* evFlag) override { + for (int i = 0; i < count; ++i) { + convertToAidlEvent(events[i], &mIntermediateEventBuffer[i]); + } + return mQueue->writeBlocking(mIntermediateEventBuffer.data(), count, readNotification, + writeNotification, timeOutNanos, evFlag); + } + + size_t getQuantumCount() override { return mQueue->getQuantumCount(); } + + private: + std::unique_ptr<::android::AidlMessageQueue< + ::aidl::android::hardware::sensors::Event, + ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>> + mQueue; + std::array<::aidl::android::hardware::sensors::Event, + ::android::hardware::sensors::V2_1::implementation::MAX_RECEIVE_BUFFER_EVENT_COUNT> + mIntermediateEventBuffer; +}; + +} // namespace implementation +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/multihal/include/HalProxyAidl.h b/sensors/aidl/default/multihal/include/HalProxyAidl.h new file mode 100644 index 0000000000000000000000000000000000000000..5c8171593323d2a606784aced7db53ace5d99e8c --- /dev/null +++ b/sensors/aidl/default/multihal/include/HalProxyAidl.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#pragma once + +#include +#include "HalProxy.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { +namespace implementation { + +class HalProxyAidl : public ::android::hardware::sensors::V2_1::implementation::HalProxy, + public ::aidl::android::hardware::sensors::BnSensors { + ::ndk::ScopedAStatus activate(int32_t in_sensorHandle, bool in_enabled) override; + ::ndk::ScopedAStatus batch(int32_t in_sensorHandle, int64_t in_samplingPeriodNs, + int64_t in_maxReportLatencyNs) override; + ::ndk::ScopedAStatus configDirectReport( + int32_t in_sensorHandle, int32_t in_channelHandle, + ::aidl::android::hardware::sensors::ISensors::RateLevel in_rate, + int32_t* _aidl_return) override; + ::ndk::ScopedAStatus flush(int32_t in_sensorHandle) override; + ::ndk::ScopedAStatus getSensorsList( + std::vector<::aidl::android::hardware::sensors::SensorInfo>* _aidl_return) override; + ::ndk::ScopedAStatus initialize( + const ::aidl::android::hardware::common::fmq::MQDescriptor< + ::aidl::android::hardware::sensors::Event, + ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>& + in_eventQueueDescriptor, + const ::aidl::android::hardware::common::fmq::MQDescriptor< + int32_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>& + in_wakeLockDescriptor, + const std::shared_ptr<::aidl::android::hardware::sensors::ISensorsCallback>& + in_sensorsCallback) override; + ::ndk::ScopedAStatus injectSensorData( + const ::aidl::android::hardware::sensors::Event& in_event) override; + ::ndk::ScopedAStatus registerDirectChannel( + const ::aidl::android::hardware::sensors::ISensors::SharedMemInfo& in_mem, + int32_t* _aidl_return) override; + ::ndk::ScopedAStatus setOperationMode( + ::aidl::android::hardware::sensors::ISensors::OperationMode in_mode) override; + ::ndk::ScopedAStatus unregisterDirectChannel(int32_t in_channelHandle) override; + + binder_status_t dump(int fd, const char **args, uint32_t numArgs) override; +}; + +} // namespace implementation +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/multihal/include/ISensorsCallbackWrapperAidl.h b/sensors/aidl/default/multihal/include/ISensorsCallbackWrapperAidl.h new file mode 100644 index 0000000000000000000000000000000000000000..6ef6c6398d99448646185b4de530693c01f7b3e5 --- /dev/null +++ b/sensors/aidl/default/multihal/include/ISensorsCallbackWrapperAidl.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#pragma once + +#include "ConvertUtils.h" +#include "ISensorsCallbackWrapper.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { +namespace implementation { + +static std::vector<::aidl::android::hardware::sensors::SensorInfo> convertToAidlSensorInfos( + const ::android::hardware::hidl_vec<::android::hardware::sensors::V2_1::SensorInfo>& + sensorInfos) { + std::vector<::aidl::android::hardware::sensors::SensorInfo> aidlSensorInfos; + for (const auto& sensorInfo : sensorInfos) { + aidlSensorInfos.push_back(convertSensorInfo(sensorInfo)); + } + return aidlSensorInfos; +} + +class ISensorsCallbackWrapperAidl + : public ::android::hardware::sensors::V2_1::implementation::ISensorsCallbackWrapperBase { + public: + ISensorsCallbackWrapperAidl( + std::shared_ptr<::aidl::android::hardware::sensors::ISensorsCallback> sensorsCallback) + : mSensorsCallback(sensorsCallback) {} + + ::android::hardware::Return onDynamicSensorsConnected( + const ::android::hardware::hidl_vec<::android::hardware::sensors::V2_1::SensorInfo>& + sensorInfos) override { + mSensorsCallback->onDynamicSensorsConnected(convertToAidlSensorInfos(sensorInfos)); + return ::android::hardware::Void(); + } + + ::android::hardware::Return onDynamicSensorsDisconnected( + const ::android::hardware::hidl_vec& sensorHandles) override { + mSensorsCallback->onDynamicSensorsDisconnected(sensorHandles); + return ::android::hardware::Void(); + } + + private: + std::shared_ptr<::aidl::android::hardware::sensors::ISensorsCallback> mSensorsCallback; +}; + +} // namespace implementation +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl \ No newline at end of file diff --git a/sensors/aidl/default/multihal/include/WakeLockMessageQueueWrapperAidl.h b/sensors/aidl/default/multihal/include/WakeLockMessageQueueWrapperAidl.h new file mode 100644 index 0000000000000000000000000000000000000000..6be0b69aa334ea94a985e07a55504aae8fc80af2 --- /dev/null +++ b/sensors/aidl/default/multihal/include/WakeLockMessageQueueWrapperAidl.h @@ -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. + */ + +#pragma once + +#include +#include +#include "WakeLockMessageQueueWrapper.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace sensors { +namespace implementation { + +class WakeLockMessageQueueWrapperAidl + : public ::android::hardware::sensors::V2_1::implementation::WakeLockMessageQueueWrapperBase { + public: + WakeLockMessageQueueWrapperAidl( + std::unique_ptr<::android::AidlMessageQueue< + int32_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>>& queue) + : mQueue(std::move(queue)) {} + + virtual std::atomic* getEventFlagWord() override { + return mQueue->getEventFlagWord(); + } + + bool readBlocking(uint32_t* wakeLocks, size_t numToRead, uint32_t readNotification, + uint32_t writeNotification, int64_t timeOutNanos, + ::android::hardware::EventFlag* evFlag) override { + return mQueue->readBlocking(reinterpret_cast(wakeLocks), numToRead, + readNotification, writeNotification, timeOutNanos, evFlag); + } + + bool write(const uint32_t* wakeLock) override { + return mQueue->write(reinterpret_cast(wakeLock)); + } + + private: + std::unique_ptr<::android::AidlMessageQueue< + int32_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>> + mQueue; +}; + +} // namespace implementation +} // namespace sensors +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/sensors/aidl/default/sensors-default.rc b/sensors/aidl/default/sensors-default.rc new file mode 100644 index 0000000000000000000000000000000000000000..96da85dc29ce40ac8b37ce9217bd7a2ab07fe4eb --- /dev/null +++ b/sensors/aidl/default/sensors-default.rc @@ -0,0 +1,5 @@ +service vendor.sensors-default /vendor/bin/hw/android.hardware.sensors-service.example + class hal + user system + group system + rlimit rtprio 10 10 diff --git a/sensors/aidl/default/sensors-default.xml b/sensors/aidl/default/sensors-default.xml new file mode 100644 index 0000000000000000000000000000000000000000..7898a6bab0fab293b9673d281020d9fa21b3e15a --- /dev/null +++ b/sensors/aidl/default/sensors-default.xml @@ -0,0 +1,7 @@ + + + android.hardware.sensors + 1 + ISensors/default + + diff --git a/sensors/aidl/multihal/Android.bp b/sensors/aidl/multihal/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..6d35dafd6d7d2633ba0a20c276b5e6df5fa62df8 --- /dev/null +++ b/sensors/aidl/multihal/Android.bp @@ -0,0 +1,59 @@ +// +// 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_binary { + name: "android.hardware.sensors-service.multihal", + vendor: true, + relative_install_path: "hw", + srcs: [ + "service.cpp", + ], + header_libs: [ + "android.hardware.sensors@2.X-multihal.header", + "android.hardware.sensors@2.X-shared-utils", + ], + init_rc: ["android.hardware.sensors-service-multihal.rc"], + vintf_fragments: ["android.hardware.sensors-multihal.xml"], + shared_libs: [ + "android.hardware.sensors@2.0-ScopedWakelock", + "android.hardware.sensors@2.0", + "android.hardware.sensors@2.1", + "android.hardware.sensors-V1-ndk", + "libbase", + "libcutils", + "libfmq", + "liblog", + "libpower", + "libutils", + "libbinder_ndk", + "libhidlbase", + ], + static_libs: [ + "libaidlcommonsupport", + "android.hardware.sensors@1.0-convert", + "android.hardware.sensors@2.X-multihal", + "android.hardware.sensors@aidl-multihal", + ], +} diff --git a/sensors/aidl/multihal/OWNERS b/sensors/aidl/multihal/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..e9556700d6dd58fb500e1c41db654110b5d3717e --- /dev/null +++ b/sensors/aidl/multihal/OWNERS @@ -0,0 +1,3 @@ +arthuri@google.com +bduddie@google.com +stange@google.com \ No newline at end of file diff --git a/sensors/aidl/multihal/android.hardware.sensors-multihal.xml b/sensors/aidl/multihal/android.hardware.sensors-multihal.xml new file mode 100644 index 0000000000000000000000000000000000000000..d78edffaf9980779656d2210e402c1004d5bee1e --- /dev/null +++ b/sensors/aidl/multihal/android.hardware.sensors-multihal.xml @@ -0,0 +1,23 @@ + + + + + android.hardware.sensors + 1 + ISensors/default + + diff --git a/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc new file mode 100644 index 0000000000000000000000000000000000000000..3f91a0a04a790687021d578f19d4c6e4e562f371 --- /dev/null +++ b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc @@ -0,0 +1,7 @@ +service vendor.sensors-hal-multihal /vendor/bin/hw/android.hardware.sensors-service.multihal + class hal + user system + group system wakelock context_hub + task_profiles ServiceCapacityLow + capabilities BLOCK_SUSPEND + rlimit rtprio 10 10 \ No newline at end of file diff --git a/sensors/aidl/multihal/service.cpp b/sensors/aidl/multihal/service.cpp new file mode 100644 index 0000000000000000000000000000000000000000..11c108a3958681302915537a2b4bcabf9d29c625 --- /dev/null +++ b/sensors/aidl/multihal/service.cpp @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#include +#include +#include +#include "HalProxyAidl.h" + +using ::aidl::android::hardware::sensors::implementation::HalProxyAidl; + +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(0); + + // Make a default multihal sensors service + auto halProxy = ndk::SharedRefBase::make(); + const std::string halProxyName = std::string() + HalProxyAidl::descriptor + "/default"; + binder_status_t status = + AServiceManager_addService(halProxy->asBinder().get(), halProxyName.c_str()); + CHECK_EQ(status, STATUS_OK); + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} diff --git a/sensors/aidl/vts/Android.bp b/sensors/aidl/vts/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..f3972ec2a309d586b390336ca6549ba74a734d9c --- /dev/null +++ b/sensors/aidl/vts/Android.bp @@ -0,0 +1,52 @@ +// Copyright 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: "VtsAidlHalSensorsTargetTest", + defaults: [ + "use_libaidlvintf_gtest_helper_static", + "VtsHalSensorsDefaults", + "VtsHalTargetTestDefaults", + ], + srcs: [ + "VtsAidlHalSensorsTargetTest.cpp", + "SensorsAidlEnvironment.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + "libfmq", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", + ], + static_libs: [ + "android.hardware.sensors-V1-ndk", + "VtsHalSensorsTargetTestUtils", + "libaidlcommonsupport", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/sensors/aidl/vts/OWNERS b/sensors/aidl/vts/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..90c233030ed137ec27c0e66ecb58a0758c0233f0 --- /dev/null +++ b/sensors/aidl/vts/OWNERS @@ -0,0 +1,3 @@ +arthuri@google.com +bduddie@google.com +stange@google.com diff --git a/sensors/aidl/vts/SensorsAidlEnvironment.cpp b/sensors/aidl/vts/SensorsAidlEnvironment.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e71251f69861111d14aee703e5d27ed8d47e1541 --- /dev/null +++ b/sensors/aidl/vts/SensorsAidlEnvironment.cpp @@ -0,0 +1,164 @@ +/* + * 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. + */ + +#include "SensorsAidlEnvironment.h" + +#include +#include + +#include + +using aidl::android::hardware::sensors::BnSensorsCallback; +using aidl::android::hardware::sensors::SensorInfo; +using android::hardware::EventFlag; +using ndk::ScopedAStatus; +using ndk::SpAIBinder; + +namespace { + +void serviceDied(void* /* cookie */) { + ALOGE("Sensors HAL died (likely crashed) during test"); + FAIL() << "Sensors HAL died during test"; +} + +class NoOpSensorsCallback : public BnSensorsCallback { + public: + ScopedAStatus onDynamicSensorsConnected( + const std::vector& /* sensorInfos */) override { + return ScopedAStatus::ok(); + } + + ScopedAStatus onDynamicSensorsDisconnected( + const std::vector& /* sensorHandles */) override { + return ScopedAStatus::ok(); + } +}; + +} // anonymous namespace + +SensorsAidlEnvironment::SensorsAidlEnvironment(const std::string& service_name) + : SensorsVtsEnvironmentBase(service_name), + mCallback(ndk::SharedRefBase::make()), + mDeathRecipient(AIBinder_DeathRecipient_new(serviceDied)) {} + +bool SensorsAidlEnvironment::resetHal() { + bool succeed = false; + do { + mSensors = ISensors::fromBinder( + SpAIBinder(AServiceManager_waitForService(mServiceName.c_str()))); + if (mSensors == nullptr) { + break; + } + + AIBinder_linkToDeath(mSensors->asBinder().get(), mDeathRecipient.get(), this); + + // Initialize FMQs + mWakeLockQueue = std::make_unique(MAX_RECEIVE_BUFFER_EVENT_COUNT, + true /* configureEventFlagWord */); + mEventQueue = std::make_unique(MAX_RECEIVE_BUFFER_EVENT_COUNT, + true /* configureEventFlagWord */); + + if (mWakeLockQueue == nullptr || mEventQueue == nullptr) { + break; + } + + EventFlag::deleteEventFlag(&mEventQueueFlag); + EventFlag::createEventFlag(mEventQueue->getEventFlagWord(), &mEventQueueFlag); + if (mEventQueueFlag == nullptr) { + break; + } + + mSensors->initialize(mEventQueue->dupeDesc(), mWakeLockQueue->dupeDesc(), mCallback); + + std::vector sensorList; + if (!mSensors->getSensorsList(&sensorList).isOk()) { + break; + } + + // stop each sensor individually + bool ok = true; + for (const auto& i : sensorList) { + if (!mSensors->activate(i.sensorHandle, false).isOk()) { + ok = false; + break; + } + } + + if (!ok) { + break; + } + + // mark it done + succeed = true; + } while (0); + + if (!succeed) { + mSensors = nullptr; + } + + return succeed; +} + +void SensorsAidlEnvironment::TearDown() { + mStopThread = true; + + if (mEventQueueFlag != nullptr) { + // Wake up the event queue so the poll thread can exit + mEventQueueFlag->wake(ISensors::EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS); + if (mPollThread.joinable()) { + mPollThread.join(); + } + + EventFlag::deleteEventFlag(&mEventQueueFlag); + } +} + +void SensorsAidlEnvironment::startPollingThread() { + mStopThread = false; + mEvents.reserve(MAX_RECEIVE_BUFFER_EVENT_COUNT); + mPollThread = std::thread(pollingThread, this); +} + +void SensorsAidlEnvironment::readEvents() { + size_t availableEvents = mEventQueue->availableToRead(); + + if (availableEvents == 0) { + uint32_t eventFlagState = 0; + + mEventQueueFlag->wait(ISensors::EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS, &eventFlagState); + availableEvents = mEventQueue->availableToRead(); + } + + size_t eventsToRead = std::min(availableEvents, mEventBuffer.size()); + if (eventsToRead > 0) { + if (mEventQueue->read(mEventBuffer.data(), eventsToRead)) { + mEventQueueFlag->wake(ISensors::EVENT_QUEUE_FLAG_BITS_EVENTS_READ); + for (size_t i = 0; i < eventsToRead; i++) { + addEvent(mEventBuffer[i]); + } + } + } +} + +void SensorsAidlEnvironment::pollingThread(SensorsAidlEnvironment* env) { + ALOGD("polling thread start"); + + while (!env->mStopThread.load()) { + env->readEvents(); + } + + ALOGD("polling thread end"); +} diff --git a/sensors/aidl/vts/SensorsAidlEnvironment.h b/sensors/aidl/vts/SensorsAidlEnvironment.h new file mode 100644 index 0000000000000000000000000000000000000000..2f5f28712b3470aa9c0ffc818b7105613b370548 --- /dev/null +++ b/sensors/aidl/vts/SensorsAidlEnvironment.h @@ -0,0 +1,110 @@ +/* + * 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. + */ + +#ifndef ANDROID_SENSORS_AIDL_ENVIRONMENT_H +#define ANDROID_SENSORS_AIDL_ENVIRONMENT_H + +#include "sensors-vts-utils/SensorsVtsEnvironmentBase.h" + +#include +#include +#include +#include +#include + +#include +#include + +using aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using aidl::android::hardware::sensors::Event; +using aidl::android::hardware::sensors::ISensors; +using aidl::android::hardware::sensors::ISensorsCallback; + +static constexpr size_t MAX_RECEIVE_BUFFER_EVENT_COUNT = 256; + +class SensorsAidlTest; + +class SensorsAidlEnvironment : public SensorsVtsEnvironmentBase { + public: + virtual void TearDown() override; + + protected: + friend SensorsAidlTest; + SensorsAidlEnvironment(const std::string& service_name); + + /** + * Resets the HAL with new FMQs and a new Event Flag + * + * @return bool true if successful, false otherwise + */ + bool resetHal() override; + + /** + * Starts the polling thread that reads sensor events from the Event FMQ + */ + void startPollingThread() override; + + /** + * Thread responsible for calling functions to read Event FMQ + * + * @param env SensorEnvironment to being polling for events on + */ + static void pollingThread(SensorsAidlEnvironment* env); + + /** + * Reads and saves sensor events from the Event FMQ + */ + void readEvents(); + + GTEST_DISALLOW_COPY_AND_ASSIGN_(SensorsAidlEnvironment); + + /** + * Pointer to the Sensors HAL Interface that allows the test to call HAL functions. + */ + std::shared_ptr mSensors; + std::shared_ptr mCallback; + + ndk::ScopedAIBinder_DeathRecipient mDeathRecipient; + + /** + * Type used to simplify the creation of the Wake Lock FMQ + */ + typedef android::AidlMessageQueue WakeLockQueue; + typedef android::AidlMessageQueue EventQueue; + + /** + * The Wake Lock FMQ is used by the test to notify the Sensors HAL whenever it has processed + * WAKE_UP sensor events. + */ + std::unique_ptr mWakeLockQueue; + std::unique_ptr mEventQueue; + + /** + * The Event Queue Flag notifies the test framework when sensor events have been written to the + * Event FMQ by the Sensors HAL. + */ + ::android::hardware::EventFlag* mEventQueueFlag; + + std::atomic_bool mStopThread; + std::thread mPollThread; + + /** + * An array that is used to store sensor events read from the Event FMQ + */ + std::array mEventBuffer; +}; + +#endif // ANDROID_SENSORS_AIDL_ENVIRONMENT_H diff --git a/sensors/aidl/vts/SensorsAidlTestSharedMemory.h b/sensors/aidl/vts/SensorsAidlTestSharedMemory.h new file mode 100644 index 0000000000000000000000000000000000000000..4b5916a0d713ea77662a16d0db1cad534a068a55 --- /dev/null +++ b/sensors/aidl/vts/SensorsAidlTestSharedMemory.h @@ -0,0 +1,218 @@ +/* + * Copyright (C) 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. + */ + +#ifndef ANDROID_SENSORS_AIDL_TEST_SHARED_MEMORY_H +#define ANDROID_SENSORS_AIDL_TEST_SHARED_MEMORY_H + +#include "sensors-vts-utils/GrallocWrapper.h" + +#include +#include +#include + +#include +#include + +#include + +using ::aidl::android::hardware::sensors::BnSensors; +using ::aidl::android::hardware::sensors::Event; +using ::aidl::android::hardware::sensors::ISensors; +using ::aidl::android::hardware::sensors::SensorType; + +template +class SensorsAidlTestSharedMemory { + public: + static SensorsAidlTestSharedMemory* create(ISensors::SharedMemInfo::SharedMemType type, + size_t size) { + constexpr size_t kMaxSize = + 128 * 1024 * 1024; // sensor test should not need more than 128M + if (size == 0 || size >= kMaxSize) { + return nullptr; + } + + auto m = new SensorsAidlTestSharedMemory(type, size); + if (m->mSize != size || m->mBuffer == nullptr) { + delete m; + m = nullptr; + } + return m; + } + + ISensors::SharedMemInfo getSharedMemInfo() const { + ISensors::SharedMemInfo mem = { + .type = mType, + .format = ISensors::SharedMemInfo::SharedMemFormat::SENSORS_EVENT, + .size = static_cast(mSize), + .memoryHandle = android::dupToAidl(mNativeHandle)}; + return mem; + } + char* getBuffer() const { return mBuffer; } + size_t getSize() const { return mSize; } + std::vector parseEvents(int64_t lastCounter = -1, size_t offset = 0) const { + constexpr size_t kEventSize = + static_cast(BnSensors::DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH); + constexpr size_t kOffsetSize = + static_cast(BnSensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD); + constexpr size_t kOffsetToken = + static_cast(BnSensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_REPORT_TOKEN); + constexpr size_t kOffsetType = + static_cast(BnSensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_SENSOR_TYPE); + constexpr size_t kOffsetAtomicCounter = static_cast( + BnSensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER); + constexpr size_t kOffsetTimestamp = + static_cast(BnSensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_TIMESTAMP); + constexpr size_t kOffsetData = + static_cast(BnSensors::DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA); + + std::vector events; + std::vector data(16); + + while (offset + kEventSize <= mSize) { + int64_t atomicCounter = + *reinterpret_cast(mBuffer + offset + kOffsetAtomicCounter); + if (atomicCounter <= lastCounter) { + ALOGV("atomicCounter = %" PRId64 ", lastCounter = %" PRId64, atomicCounter, + lastCounter); + break; + } + + int32_t size = *reinterpret_cast(mBuffer + offset + kOffsetSize); + if (size != kEventSize) { + // unknown error, events parsed may be wrong, remove all + events.clear(); + break; + } + + int32_t token = *reinterpret_cast(mBuffer + offset + kOffsetToken); + int32_t type = *reinterpret_cast(mBuffer + offset + kOffsetType); + int64_t timestamp = *reinterpret_cast(mBuffer + offset + kOffsetTimestamp); + + ALOGV("offset = %zu, cnt %" PRId64 ", token %" PRId32 ", type %" PRId32 + ", timestamp %" PRId64, + offset, atomicCounter, token, type, timestamp); + + Event event = { + .timestamp = timestamp, + .sensorHandle = token, + .sensorType = type, + }; + + event.set(reinterpret_cast(mBuffer + offset + kOffsetData)); + // event.u.data = android::hardware::hidl_array(reinterpret_cast(mBuffer + offset + kOffsetData)); + + events.push_back(event); + + lastCounter = atomicCounter; + offset += kEventSize; + } + + return events; + } + + virtual ~SensorsAidlTestSharedMemory() { + switch (mType) { + case ISensors::SharedMemInfo::SharedMemType::ASHMEM: { + if (mSize != 0) { + ::munmap(mBuffer, mSize); + mBuffer = nullptr; + + ::native_handle_close(mNativeHandle); + ::native_handle_delete(mNativeHandle); + + mNativeHandle = nullptr; + mSize = 0; + } + break; + } + case ISensors::SharedMemInfo::SharedMemType::GRALLOC: { + if (mSize != 0) { + mGrallocWrapper->freeBuffer(mNativeHandle); + mNativeHandle = nullptr; + mSize = 0; + } + break; + } + default: { + if (mNativeHandle != nullptr || mSize != 0 || mBuffer != nullptr) { + ALOGE("SensorsAidlTestSharedMemory %p not properly destructed: " + "type %d, native handle %p, size %zu, buffer %p", + this, static_cast(mType), mNativeHandle, mSize, mBuffer); + } + break; + } + } + } + + private: + SensorsAidlTestSharedMemory(ISensors::SharedMemInfo::SharedMemType type, size_t size) + : mType(type), mSize(0), mBuffer(nullptr) { + native_handle_t* handle = nullptr; + char* buffer = nullptr; + switch (type) { + case ISensors::SharedMemInfo::SharedMemType::ASHMEM: { + int fd; + handle = ::native_handle_create(1 /*nFds*/, 0 /*nInts*/); + if (handle != nullptr) { + handle->data[0] = fd = + ::ashmem_create_region("SensorsAidlTestSharedMemory", size); + if (handle->data[0] > 0) { + // memory is pinned by default + buffer = static_cast( + ::mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)); + if (buffer != reinterpret_cast(MAP_FAILED)) { + break; + } + ::native_handle_close(handle); + } + ::native_handle_delete(handle); + handle = nullptr; + } + break; + } + case ISensors::SharedMemInfo::SharedMemType::GRALLOC: { + mGrallocWrapper = std::make_unique<::android::GrallocWrapper>(); + if (!mGrallocWrapper->isInitialized()) { + break; + } + + std::pair buf = mGrallocWrapper->allocate(size); + handle = buf.first; + buffer = static_cast(buf.second); + break; + } + default: + break; + } + + if (buffer != nullptr) { + mNativeHandle = handle; + mSize = size; + mBuffer = buffer; + } + } + + ISensors::SharedMemInfo::SharedMemType mType; + native_handle_t* mNativeHandle; + size_t mSize; + char* mBuffer; + std::unique_ptr<::android::GrallocWrapper> mGrallocWrapper; + + DISALLOW_COPY_AND_ASSIGN(SensorsAidlTestSharedMemory); +}; + +#endif // ANDROID_SENSORS_TEST_SHARED_MEMORY_H diff --git a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d536e290b235629cdae74206ffb03dfae2a326b3 --- /dev/null +++ b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp @@ -0,0 +1,1081 @@ +/* + * 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. + */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SensorsAidlEnvironment.h" +#include "SensorsAidlTestSharedMemory.h" +#include "sensors-vts-utils/SensorsVtsEnvironmentBase.h" + +#include +#include +#include +#include +#include +#include + +using aidl::android::hardware::sensors::Event; +using aidl::android::hardware::sensors::ISensors; +using aidl::android::hardware::sensors::SensorInfo; +using aidl::android::hardware::sensors::SensorStatus; +using aidl::android::hardware::sensors::SensorType; +using android::ProcessState; +using std::chrono::duration_cast; + +constexpr size_t kEventSize = + static_cast(ISensors::DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH); + +namespace { + +static void assertTypeMatchStringType(SensorType type, const std::string& stringType) { + if (type >= SensorType::DEVICE_PRIVATE_BASE) { + return; + } + + switch (type) { +#define CHECK_TYPE_STRING_FOR_SENSOR_TYPE(type) \ + case SensorType::type: \ + ASSERT_STREQ(SENSOR_STRING_TYPE_##type, stringType.c_str()); \ + break; + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER_LIMITED_AXES); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER_LIMITED_AXES_UNCALIBRATED); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER_UNCALIBRATED); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ADDITIONAL_INFO); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(AMBIENT_TEMPERATURE); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(DEVICE_ORIENTATION); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(DYNAMIC_SENSOR_META); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GAME_ROTATION_VECTOR); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GEOMAGNETIC_ROTATION_VECTOR); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GLANCE_GESTURE); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GRAVITY); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE_LIMITED_AXES); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE_LIMITED_AXES_UNCALIBRATED); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(GYROSCOPE_UNCALIBRATED); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(HEADING); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(HEART_BEAT); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(HEART_RATE); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(LIGHT); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(LINEAR_ACCELERATION); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(LOW_LATENCY_OFFBODY_DETECT); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(MAGNETIC_FIELD); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(MAGNETIC_FIELD_UNCALIBRATED); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(MOTION_DETECT); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ORIENTATION); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(PICK_UP_GESTURE); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(POSE_6DOF); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(PRESSURE); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(PROXIMITY); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(RELATIVE_HUMIDITY); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ROTATION_VECTOR); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(SIGNIFICANT_MOTION); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(STATIONARY_DETECT); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(STEP_COUNTER); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(STEP_DETECTOR); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(TILT_DETECTOR); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(WAKE_GESTURE); + CHECK_TYPE_STRING_FOR_SENSOR_TYPE(WRIST_TILT_GESTURE); + default: + FAIL() << "Type " << static_cast(type) + << " in android defined range is not checked, " + << "stringType = " << stringType; +#undef CHECK_TYPE_STRING_FOR_SENSOR_TYPE + } +} + +bool isDirectChannelTypeSupported(SensorInfo sensor, ISensors::SharedMemInfo::SharedMemType type) { + switch (type) { + case ISensors::SharedMemInfo::SharedMemType::ASHMEM: + return (sensor.flags & SensorInfo::SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM) != 0; + case ISensors::SharedMemInfo::SharedMemType::GRALLOC: + return (sensor.flags & SensorInfo::SENSOR_FLAG_BITS_DIRECT_CHANNEL_GRALLOC) != 0; + default: + return false; + } +} + +bool isDirectReportRateSupported(SensorInfo sensor, ISensors::RateLevel rate) { + unsigned int r = static_cast(sensor.flags & + SensorInfo::SENSOR_FLAG_BITS_MASK_DIRECT_REPORT) >> + static_cast(SensorInfo::SENSOR_FLAG_SHIFT_DIRECT_REPORT); + return r >= static_cast(rate); +} + +int expectedReportModeForType(SensorType type) { + switch (type) { + case SensorType::ACCELEROMETER: + case SensorType::ACCELEROMETER_LIMITED_AXES: + case SensorType::ACCELEROMETER_UNCALIBRATED: + case SensorType::ACCELEROMETER_LIMITED_AXES_UNCALIBRATED: + case SensorType::GYROSCOPE: + case SensorType::GYROSCOPE_LIMITED_AXES: + case SensorType::MAGNETIC_FIELD: + case SensorType::ORIENTATION: + case SensorType::PRESSURE: + case SensorType::GRAVITY: + case SensorType::LINEAR_ACCELERATION: + case SensorType::ROTATION_VECTOR: + case SensorType::MAGNETIC_FIELD_UNCALIBRATED: + case SensorType::GAME_ROTATION_VECTOR: + case SensorType::GYROSCOPE_UNCALIBRATED: + case SensorType::GYROSCOPE_LIMITED_AXES_UNCALIBRATED: + case SensorType::GEOMAGNETIC_ROTATION_VECTOR: + case SensorType::POSE_6DOF: + case SensorType::HEART_BEAT: + case SensorType::HEADING: + return SensorInfo::SENSOR_FLAG_BITS_CONTINUOUS_MODE; + + case SensorType::LIGHT: + case SensorType::PROXIMITY: + case SensorType::RELATIVE_HUMIDITY: + case SensorType::AMBIENT_TEMPERATURE: + case SensorType::HEART_RATE: + case SensorType::DEVICE_ORIENTATION: + case SensorType::STEP_COUNTER: + case SensorType::LOW_LATENCY_OFFBODY_DETECT: + return SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE; + + case SensorType::SIGNIFICANT_MOTION: + case SensorType::WAKE_GESTURE: + case SensorType::GLANCE_GESTURE: + case SensorType::PICK_UP_GESTURE: + case SensorType::MOTION_DETECT: + case SensorType::STATIONARY_DETECT: + return SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE; + + case SensorType::STEP_DETECTOR: + case SensorType::TILT_DETECTOR: + case SensorType::WRIST_TILT_GESTURE: + case SensorType::DYNAMIC_SENSOR_META: + return SensorInfo::SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE; + + default: + ALOGW("Type %d is not implemented in expectedReportModeForType", (int)type); + return INT32_MAX; + } +} + +void assertTypeMatchReportMode(SensorType type, int reportMode) { + if (type >= SensorType::DEVICE_PRIVATE_BASE) { + return; + } + + int expected = expectedReportModeForType(type); + + ASSERT_TRUE(expected == INT32_MAX || expected == reportMode) + << "reportMode=" << static_cast(reportMode) + << "expected=" << static_cast(expected); +} + +void assertDelayMatchReportMode(int32_t minDelayUs, int32_t maxDelayUs, int reportMode) { + switch (reportMode) { + case SensorInfo::SENSOR_FLAG_BITS_CONTINUOUS_MODE: + ASSERT_LT(0, minDelayUs); + ASSERT_LE(0, maxDelayUs); + break; + case SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE: + ASSERT_LE(0, minDelayUs); + ASSERT_LE(0, maxDelayUs); + break; + case SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE: + ASSERT_EQ(-1, minDelayUs); + ASSERT_EQ(0, maxDelayUs); + break; + case SensorInfo::SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE: + // do not enforce anything for special reporting mode + break; + default: + FAIL() << "Report mode " << static_cast(reportMode) << " not checked"; + } +} + +void checkIsOk(ndk::ScopedAStatus status) { + ASSERT_TRUE(status.isOk()); +} + +} // namespace + +class EventCallback : public IEventCallback { + public: + void reset() { + mFlushMap.clear(); + mEventMap.clear(); + } + + void onEvent(const Event& event) override { + if (event.sensorType == SensorType::META_DATA && + event.payload.get().what == + Event::EventPayload::MetaData::MetaDataEventType::META_DATA_FLUSH_COMPLETE) { + std::unique_lock lock(mFlushMutex); + mFlushMap[event.sensorHandle]++; + mFlushCV.notify_all(); + } else if (event.sensorType != SensorType::ADDITIONAL_INFO) { + std::unique_lock lock(mEventMutex); + mEventMap[event.sensorHandle].push_back(event); + mEventCV.notify_all(); + } + } + + int32_t getFlushCount(int32_t sensorHandle) { + std::unique_lock lock(mFlushMutex); + return mFlushMap[sensorHandle]; + } + + void waitForFlushEvents(const std::vector& sensorsToWaitFor, + int32_t numCallsToFlush, std::chrono::milliseconds timeout) { + std::unique_lock lock(mFlushMutex); + mFlushCV.wait_for(lock, timeout, + [&] { return flushesReceived(sensorsToWaitFor, numCallsToFlush); }); + } + + const std::vector getEvents(int32_t sensorHandle) { + std::unique_lock lock(mEventMutex); + return mEventMap[sensorHandle]; + } + + void waitForEvents(const std::vector& sensorsToWaitFor, + std::chrono::milliseconds timeout) { + std::unique_lock lock(mEventMutex); + mEventCV.wait_for(lock, timeout, [&] { return eventsReceived(sensorsToWaitFor); }); + } + + protected: + bool flushesReceived(const std::vector& sensorsToWaitFor, int32_t numCallsToFlush) { + for (const SensorInfo& sensor : sensorsToWaitFor) { + if (getFlushCount(sensor.sensorHandle) < numCallsToFlush) { + return false; + } + } + return true; + } + + bool eventsReceived(const std::vector& sensorsToWaitFor) { + for (const SensorInfo& sensor : sensorsToWaitFor) { + if (getEvents(sensor.sensorHandle).size() == 0) { + return false; + } + } + return true; + } + + std::map mFlushMap; + std::recursive_mutex mFlushMutex; + std::condition_variable_any mFlushCV; + + std::map> mEventMap; + std::recursive_mutex mEventMutex; + std::condition_variable_any mEventCV; +}; + +class SensorsAidlTest : public testing::TestWithParam { + public: + virtual void SetUp() override { + mEnvironment = new SensorsAidlEnvironment(GetParam()); + mEnvironment->SetUp(); + + // Ensure that we have a valid environment before performing tests + ASSERT_NE(getSensors(), nullptr); + } + + virtual void TearDown() override { + for (int32_t handle : mSensorHandles) { + activate(handle, false); + } + mSensorHandles.clear(); + + mEnvironment->TearDown(); + delete mEnvironment; + mEnvironment = nullptr; + } + + protected: + std::vector getNonOneShotSensors(); + std::vector getNonOneShotAndNonSpecialSensors(); + std::vector getNonOneShotAndNonOnChangeAndNonSpecialSensors(); + std::vector getOneShotSensors(); + std::vector getInjectEventSensors(); + + void verifyDirectChannel(ISensors::SharedMemInfo::SharedMemType memType); + + void verifyRegisterDirectChannel( + std::shared_ptr> mem, + int32_t* directChannelHandle, bool supportsSharedMemType, + bool supportsAnyDirectChannel); + + void verifyConfigure(const SensorInfo& sensor, ISensors::SharedMemInfo::SharedMemType memType, + int32_t directChannelHandle, bool directChannelSupported); + + void queryDirectChannelSupport(ISensors::SharedMemInfo::SharedMemType memType, + bool* supportsSharedMemType, bool* supportsAnyDirectChannel); + + void verifyUnregisterDirectChannel(int32_t* directChannelHandle, bool supportsAnyDirectChannel); + + void checkRateLevel(const SensorInfo& sensor, int32_t directChannelHandle, + ISensors::RateLevel rateLevel, int32_t* reportToken); + + inline std::shared_ptr& getSensors() { return mEnvironment->mSensors; } + + inline SensorsAidlEnvironment* getEnvironment() { return mEnvironment; } + + inline bool isValidType(SensorType sensorType) { return (int)sensorType > 0; } + + std::vector getSensorsList(); + + int32_t getInvalidSensorHandle() { + // Find a sensor handle that does not exist in the sensor list + int32_t maxHandle = 0; + for (const SensorInfo& sensor : getSensorsList()) { + maxHandle = std::max(maxHandle, sensor.sensorHandle); + } + return maxHandle + 1; + } + + ndk::ScopedAStatus activate(int32_t sensorHandle, bool enable); + void activateAllSensors(bool enable); + + ndk::ScopedAStatus batch(int32_t sensorHandle, int64_t samplingPeriodNs, + int64_t maxReportLatencyNs) { + return getSensors()->batch(sensorHandle, samplingPeriodNs, maxReportLatencyNs); + } + + ndk::ScopedAStatus flush(int32_t sensorHandle) { return getSensors()->flush(sensorHandle); } + + ndk::ScopedAStatus registerDirectChannel(const ISensors::SharedMemInfo& mem, + int32_t* aidlReturn); + + ndk::ScopedAStatus unregisterDirectChannel(int32_t* channelHandle) { + return getSensors()->unregisterDirectChannel(*channelHandle); + } + + ndk::ScopedAStatus configDirectReport(int32_t sensorHandle, int32_t channelHandle, + ISensors::RateLevel rate, int32_t* reportToken) { + return getSensors()->configDirectReport(sensorHandle, channelHandle, rate, reportToken); + } + + void runSingleFlushTest(const std::vector& sensors, bool activateSensor, + int32_t expectedFlushCount, bool expectedResult); + + void runFlushTest(const std::vector& sensors, bool activateSensor, + int32_t flushCalls, int32_t expectedFlushCount, bool expectedResult); + + inline static int32_t extractReportMode(int32_t flag) { + return (flag & (SensorInfo::SENSOR_FLAG_BITS_CONTINUOUS_MODE | + SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE | + SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE | + SensorInfo::SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE)); + } + + // All sensors and direct channnels used + std::unordered_set mSensorHandles; + std::unordered_set mDirectChannelHandles; + + private: + SensorsAidlEnvironment* mEnvironment; +}; + +ndk::ScopedAStatus SensorsAidlTest::registerDirectChannel(const ISensors::SharedMemInfo& mem, + int32_t* aidlReturn) { + // If registeration of a channel succeeds, add the handle of channel to a set so that it can be + // unregistered when test fails. Unregister a channel does not remove the handle on purpose. + // Unregistering a channel more than once should not have negative effect. + + ndk::ScopedAStatus status = getSensors()->registerDirectChannel(mem, aidlReturn); + if (status.isOk()) { + mDirectChannelHandles.insert(*aidlReturn); + } + return status; +} + +std::vector SensorsAidlTest::getSensorsList() { + std::vector sensorInfoList; + checkIsOk(getSensors()->getSensorsList(&sensorInfoList)); + return sensorInfoList; +} + +ndk::ScopedAStatus SensorsAidlTest::activate(int32_t sensorHandle, bool enable) { + // If activating a sensor, add the handle in a set so that when test fails it can be turned off. + // The handle is not removed when it is deactivating on purpose so that it is not necessary to + // check the return value of deactivation. Deactivating a sensor more than once does not have + // negative effect. + if (enable) { + mSensorHandles.insert(sensorHandle); + } + return getSensors()->activate(sensorHandle, enable); +} + +void SensorsAidlTest::activateAllSensors(bool enable) { + for (const SensorInfo& sensorInfo : getSensorsList()) { + if (isValidType(sensorInfo.type)) { + checkIsOk(batch(sensorInfo.sensorHandle, sensorInfo.minDelayUs, + 0 /* maxReportLatencyNs */)); + checkIsOk(activate(sensorInfo.sensorHandle, enable)); + } + } +} + +std::vector SensorsAidlTest::getNonOneShotSensors() { + std::vector sensors; + for (const SensorInfo& info : getSensorsList()) { + if (extractReportMode(info.flags) != SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE) { + sensors.push_back(info); + } + } + return sensors; +} + +std::vector SensorsAidlTest::getNonOneShotAndNonSpecialSensors() { + std::vector sensors; + for (const SensorInfo& info : getSensorsList()) { + int reportMode = extractReportMode(info.flags); + if (reportMode != SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE && + reportMode != SensorInfo::SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE) { + sensors.push_back(info); + } + } + return sensors; +} + +std::vector SensorsAidlTest::getNonOneShotAndNonOnChangeAndNonSpecialSensors() { + std::vector sensors; + for (const SensorInfo& info : getSensorsList()) { + int reportMode = extractReportMode(info.flags); + if (reportMode != SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE && + reportMode != SensorInfo::SENSOR_FLAG_BITS_ON_CHANGE_MODE && + reportMode != SensorInfo::SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE) { + sensors.push_back(info); + } + } + return sensors; +} + +std::vector SensorsAidlTest::getOneShotSensors() { + std::vector sensors; + for (const SensorInfo& info : getSensorsList()) { + if (extractReportMode(info.flags) == SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE) { + sensors.push_back(info); + } + } + return sensors; +} + +std::vector SensorsAidlTest::getInjectEventSensors() { + std::vector out; + std::vector sensorInfoList = getSensorsList(); + for (const SensorInfo& info : sensorInfoList) { + if (info.flags & SensorInfo::SENSOR_FLAG_BITS_DATA_INJECTION) { + out.push_back(info); + } + } + return out; +} + +void SensorsAidlTest::runSingleFlushTest(const std::vector& sensors, + bool activateSensor, int32_t expectedFlushCount, + bool expectedResult) { + runFlushTest(sensors, activateSensor, 1 /* flushCalls */, expectedFlushCount, expectedResult); +} + +void SensorsAidlTest::runFlushTest(const std::vector& sensors, bool activateSensor, + int32_t flushCalls, int32_t expectedFlushCount, + bool expectedResult) { + EventCallback callback; + getEnvironment()->registerCallback(&callback); + + for (const SensorInfo& sensor : sensors) { + // Configure and activate the sensor + batch(sensor.sensorHandle, sensor.maxDelayUs, 0 /* maxReportLatencyNs */); + activate(sensor.sensorHandle, activateSensor); + + // Flush the sensor + for (int32_t i = 0; i < flushCalls; i++) { + SCOPED_TRACE(::testing::Message() + << "Flush " << i << "/" << flushCalls << ": " + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec + << " type=" << static_cast(sensor.type) << " name=" << sensor.name); + + EXPECT_EQ(flush(sensor.sensorHandle).isOk(), expectedResult); + } + } + + // Wait up to one second for the flush events + callback.waitForFlushEvents(sensors, flushCalls, std::chrono::milliseconds(1000) /* timeout */); + + // Deactivate all sensors after waiting for flush events so pending flush events are not + // abandoned by the HAL. + for (const SensorInfo& sensor : sensors) { + activate(sensor.sensorHandle, false); + } + getEnvironment()->unregisterCallback(); + + // Check that the correct number of flushes are present for each sensor + for (const SensorInfo& sensor : sensors) { + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec << " type=" << static_cast(sensor.type) + << " name=" << sensor.name); + ASSERT_EQ(callback.getFlushCount(sensor.sensorHandle), expectedFlushCount); + } +} + +TEST_P(SensorsAidlTest, SensorListValid) { + std::vector sensorInfoList = getSensorsList(); + std::unordered_map> sensorTypeNameMap; + for (size_t i = 0; i < sensorInfoList.size(); ++i) { + const SensorInfo& info = sensorInfoList[i]; + SCOPED_TRACE(::testing::Message() + << i << "/" << sensorInfoList.size() << ": " + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << info.sensorHandle << std::dec << " type=" << static_cast(info.type) + << " name=" << info.name); + + // Test type string non-empty only for private sensor typeinfo. + if (info.type >= SensorType::DEVICE_PRIVATE_BASE) { + EXPECT_FALSE(info.typeAsString.empty()); + } else if (!info.typeAsString.empty()) { + // Test type string matches framework string if specified for non-private typeinfo. + EXPECT_NO_FATAL_FAILURE(assertTypeMatchStringType(info.type, info.typeAsString)); + } + + // Test if all sensor has name and vendor + EXPECT_FALSE(info.name.empty()); + EXPECT_FALSE(info.vendor.empty()); + + // Make sure that sensors of the same type have a unique name. + std::vector& v = sensorTypeNameMap[static_cast(info.type)]; + bool isUniqueName = std::find(v.begin(), v.end(), info.name) == v.end(); + EXPECT_TRUE(isUniqueName) << "Duplicate sensor Name: " << info.name; + if (isUniqueName) { + v.push_back(info.name); + } + + EXPECT_LE(0, info.power); + EXPECT_LT(0, info.maxRange); + + // Info type, should have no sensor + EXPECT_FALSE(info.type == SensorType::ADDITIONAL_INFO || + info.type == SensorType::META_DATA); + + EXPECT_GE(info.fifoMaxEventCount, info.fifoReservedEventCount); + + // Test Reporting mode valid + EXPECT_NO_FATAL_FAILURE( + assertTypeMatchReportMode(info.type, extractReportMode(info.flags))); + + // Test min max are in the right order + EXPECT_LE(info.minDelayUs, info.maxDelayUs); + // Test min/max delay matches reporting mode + EXPECT_NO_FATAL_FAILURE(assertDelayMatchReportMode(info.minDelayUs, info.maxDelayUs, + extractReportMode(info.flags))); + } +} + +TEST_P(SensorsAidlTest, SetOperationMode) { + if (getInjectEventSensors().size() > 0) { + ASSERT_TRUE(getSensors()->setOperationMode(ISensors::OperationMode::NORMAL).isOk()); + ASSERT_TRUE(getSensors()->setOperationMode(ISensors::OperationMode::DATA_INJECTION).isOk()); + ASSERT_TRUE(getSensors()->setOperationMode(ISensors::OperationMode::NORMAL).isOk()); + } else { + int errorCode = + getSensors() + ->setOperationMode(ISensors::OperationMode::DATA_INJECTION) + .getExceptionCode(); + ASSERT_TRUE((errorCode == EX_UNSUPPORTED_OPERATION) || + (errorCode == EX_ILLEGAL_ARGUMENT)); + } +} + +TEST_P(SensorsAidlTest, InjectSensorEventData) { + std::vector sensors = getInjectEventSensors(); + if (sensors.size() == 0) { + return; + } + + ASSERT_TRUE(getSensors()->setOperationMode(ISensors::OperationMode::DATA_INJECTION).isOk()); + + EventCallback callback; + getEnvironment()->registerCallback(&callback); + + // AdditionalInfo event should not be sent to Event FMQ + Event additionalInfoEvent; + additionalInfoEvent.sensorType = SensorType::ADDITIONAL_INFO; + additionalInfoEvent.timestamp = android::elapsedRealtimeNano(); + + Event injectedEvent; + injectedEvent.timestamp = android::elapsedRealtimeNano(); + Event::EventPayload::Vec3 data = {1, 2, 3, SensorStatus::ACCURACY_HIGH}; + injectedEvent.payload.set(data); + + for (const auto& s : sensors) { + additionalInfoEvent.sensorHandle = s.sensorHandle; + ASSERT_TRUE(getSensors()->injectSensorData(additionalInfoEvent).isOk()); + + injectedEvent.sensorType = s.type; + injectedEvent.sensorHandle = s.sensorHandle; + ASSERT_TRUE(getSensors()->injectSensorData(injectedEvent).isOk()); + } + + // Wait for events to be written back to the Event FMQ + callback.waitForEvents(sensors, std::chrono::milliseconds(1000) /* timeout */); + getEnvironment()->unregisterCallback(); + + for (const auto& s : sensors) { + auto events = callback.getEvents(s.sensorHandle); + if (events.empty()) { + FAIL() << "Received no events"; + } else { + auto lastEvent = events.back(); + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << s.sensorHandle << std::dec << " type=" << static_cast(s.type) + << " name=" << s.name); + + // Verify that only a single event has been received + ASSERT_EQ(events.size(), 1); + + // Verify that the event received matches the event injected and is not the additional + // info event + ASSERT_EQ(lastEvent.sensorType, s.type); + ASSERT_EQ(lastEvent.timestamp, injectedEvent.timestamp); + ASSERT_EQ(lastEvent.payload.get().x, + injectedEvent.payload.get().x); + ASSERT_EQ(lastEvent.payload.get().y, + injectedEvent.payload.get().y); + ASSERT_EQ(lastEvent.payload.get().z, + injectedEvent.payload.get().z); + ASSERT_EQ(lastEvent.payload.get().status, + injectedEvent.payload.get().status); + } + } + + ASSERT_TRUE(getSensors()->setOperationMode(ISensors::OperationMode::NORMAL).isOk()); +} + +TEST_P(SensorsAidlTest, CallInitializeTwice) { + // Create a helper class so that a second environment is able to be instantiated + class SensorsAidlEnvironmentTest : public SensorsAidlEnvironment { + public: + SensorsAidlEnvironmentTest(const std::string& service_name) + : SensorsAidlEnvironment(service_name) {} + }; + + if (getSensorsList().size() == 0) { + // No sensors + return; + } + + constexpr useconds_t kCollectionTimeoutUs = 1000 * 1000; // 1s + constexpr int32_t kNumEvents = 1; + + // Create a new environment that calls initialize() + std::unique_ptr newEnv = + std::make_unique(GetParam()); + newEnv->SetUp(); + if (HasFatalFailure()) { + return; // Exit early if setting up the new environment failed + } + + activateAllSensors(true); + // Verify that the old environment does not receive any events + EXPECT_EQ(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), 0); + // Verify that the new event queue receives sensor events + EXPECT_GE(newEnv.get()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); + activateAllSensors(false); + + // Cleanup the test environment + newEnv->TearDown(); + + // Restore the test environment for future tests + getEnvironment()->TearDown(); + getEnvironment()->SetUp(); + if (HasFatalFailure()) { + return; // Exit early if resetting the environment failed + } + + // Ensure that the original environment is receiving events + activateAllSensors(true); + EXPECT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); + activateAllSensors(false); +} + +TEST_P(SensorsAidlTest, CleanupConnectionsOnInitialize) { + activateAllSensors(true); + + // Verify that events are received + constexpr useconds_t kCollectionTimeoutUs = 1000 * 1000; // 1s + constexpr int32_t kNumEvents = 1; + ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); + + // Clear the active sensor handles so they are not disabled during TearDown + auto handles = mSensorHandles; + mSensorHandles.clear(); + getEnvironment()->TearDown(); + getEnvironment()->SetUp(); + if (HasFatalFailure()) { + return; // Exit early if resetting the environment failed + } + + // Verify no events are received until sensors are re-activated + ASSERT_EQ(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), 0); + activateAllSensors(true); + ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); + + // Disable sensors + activateAllSensors(false); + + // Restore active sensors prior to clearing the environment + mSensorHandles = handles; +} + +TEST_P(SensorsAidlTest, FlushSensor) { + std::vector sensors = getNonOneShotSensors(); + if (sensors.size() == 0) { + return; + } + + constexpr int32_t kFlushes = 5; + runSingleFlushTest(sensors, true /* activateSensor */, 1 /* expectedFlushCount */, + true /* expectedResult */); + runFlushTest(sensors, true /* activateSensor */, kFlushes, kFlushes, true /* expectedResult */); +} + +TEST_P(SensorsAidlTest, FlushOneShotSensor) { + // Find a sensor that is a one-shot sensor + std::vector sensors = getOneShotSensors(); + if (sensors.size() == 0) { + return; + } + + runSingleFlushTest(sensors, true /* activateSensor */, 0 /* expectedFlushCount */, + false /* expectedResult */); +} + +TEST_P(SensorsAidlTest, FlushInactiveSensor) { + // Attempt to find a non-one shot sensor, then a one-shot sensor if necessary + std::vector sensors = getNonOneShotSensors(); + if (sensors.size() == 0) { + sensors = getOneShotSensors(); + if (sensors.size() == 0) { + return; + } + } + + runSingleFlushTest(sensors, false /* activateSensor */, 0 /* expectedFlushCount */, + false /* expectedResult */); +} + +TEST_P(SensorsAidlTest, Batch) { + if (getSensorsList().size() == 0) { + return; + } + + activateAllSensors(false /* enable */); + for (const SensorInfo& sensor : getSensorsList()) { + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec << " type=" << static_cast(sensor.type) + << " name=" << sensor.name); + + // Call batch on inactive sensor + // One shot sensors have minDelay set to -1 which is an invalid + // parameter. Use 0 instead to avoid errors. + int64_t samplingPeriodNs = + extractReportMode(sensor.flags) == SensorInfo::SENSOR_FLAG_BITS_ONE_SHOT_MODE + ? 0 + : sensor.minDelayUs; + checkIsOk(batch(sensor.sensorHandle, samplingPeriodNs, 0 /* maxReportLatencyNs */)); + + // Activate the sensor + activate(sensor.sensorHandle, true /* enabled */); + + // Call batch on an active sensor + checkIsOk(batch(sensor.sensorHandle, sensor.maxDelayUs, 0 /* maxReportLatencyNs */)); + } + activateAllSensors(false /* enable */); + + // Call batch on an invalid sensor + SensorInfo sensor = getSensorsList().front(); + sensor.sensorHandle = getInvalidSensorHandle(); + ASSERT_EQ(batch(sensor.sensorHandle, sensor.minDelayUs, 0 /* maxReportLatencyNs */) + .getExceptionCode(), + EX_ILLEGAL_ARGUMENT); +} + +TEST_P(SensorsAidlTest, Activate) { + if (getSensorsList().size() == 0) { + return; + } + + // Verify that sensor events are generated when activate is called + for (const SensorInfo& sensor : getSensorsList()) { + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec << " type=" << static_cast(sensor.type) + << " name=" << sensor.name); + + checkIsOk(batch(sensor.sensorHandle, sensor.minDelayUs, 0 /* maxReportLatencyNs */)); + checkIsOk(activate(sensor.sensorHandle, true)); + + // Call activate on a sensor that is already activated + checkIsOk(activate(sensor.sensorHandle, true)); + + // Deactivate the sensor + checkIsOk(activate(sensor.sensorHandle, false)); + + // Call deactivate on a sensor that is already deactivated + checkIsOk(activate(sensor.sensorHandle, false)); + } + + // Attempt to activate an invalid sensor + int32_t invalidHandle = getInvalidSensorHandle(); + ASSERT_EQ(activate(invalidHandle, true).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + ASSERT_EQ(activate(invalidHandle, false).getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +TEST_P(SensorsAidlTest, NoStaleEvents) { + constexpr std::chrono::milliseconds kFiveHundredMs(500); + constexpr std::chrono::milliseconds kOneSecond(1000); + + // Register the callback to receive sensor events + EventCallback callback; + getEnvironment()->registerCallback(&callback); + + // This test is not valid for one-shot, on-change or special-report-mode sensors + const std::vector sensors = getNonOneShotAndNonOnChangeAndNonSpecialSensors(); + std::chrono::milliseconds maxMinDelay(0); + for (const SensorInfo& sensor : sensors) { + std::chrono::milliseconds minDelay = duration_cast( + std::chrono::microseconds(sensor.minDelayUs)); + maxMinDelay = std::chrono::milliseconds(std::max(maxMinDelay.count(), minDelay.count())); + } + + // Activate the sensors so that they start generating events + activateAllSensors(true); + + // According to the CDD, the first sample must be generated within 400ms + 2 * sample_time + // and the maximum reporting latency is 100ms + 2 * sample_time. Wait a sufficient amount + // of time to guarantee that a sample has arrived. + callback.waitForEvents(sensors, kFiveHundredMs + (5 * maxMinDelay)); + activateAllSensors(false); + + // Save the last received event for each sensor + std::map lastEventTimestampMap; + for (const SensorInfo& sensor : sensors) { + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec << " type=" << static_cast(sensor.type) + << " name=" << sensor.name); + + if (callback.getEvents(sensor.sensorHandle).size() >= 1) { + lastEventTimestampMap[sensor.sensorHandle] = + callback.getEvents(sensor.sensorHandle).back().timestamp; + } + } + + // Allow some time to pass, reset the callback, then reactivate the sensors + usleep(duration_cast(kOneSecond + (5 * maxMinDelay)).count()); + callback.reset(); + activateAllSensors(true); + callback.waitForEvents(sensors, kFiveHundredMs + (5 * maxMinDelay)); + activateAllSensors(false); + + getEnvironment()->unregisterCallback(); + + for (const SensorInfo& sensor : sensors) { + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec << " type=" << static_cast(sensor.type) + << " name=" << sensor.name); + + // Skip sensors that did not previously report an event + if (lastEventTimestampMap.find(sensor.sensorHandle) == lastEventTimestampMap.end()) { + continue; + } + + // Ensure that the first event received is not stale by ensuring that its timestamp is + // sufficiently different from the previous event + const Event newEvent = callback.getEvents(sensor.sensorHandle).front(); + std::chrono::milliseconds delta = + duration_cast(std::chrono::nanoseconds( + newEvent.timestamp - lastEventTimestampMap[sensor.sensorHandle])); + std::chrono::milliseconds sensorMinDelay = duration_cast( + std::chrono::microseconds(sensor.minDelayUs)); + ASSERT_GE(delta, kFiveHundredMs + (3 * sensorMinDelay)); + } +} + +void SensorsAidlTest::checkRateLevel(const SensorInfo& sensor, int32_t directChannelHandle, + ISensors::RateLevel rateLevel, int32_t* reportToken) { + ndk::ScopedAStatus status = + configDirectReport(sensor.sensorHandle, directChannelHandle, rateLevel, reportToken); + + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec << " type=" << static_cast(sensor.type) + << " name=" << sensor.name); + + if (isDirectReportRateSupported(sensor, rateLevel)) { + ASSERT_TRUE(status.isOk()); + if (rateLevel != ISensors::RateLevel::STOP) { + ASSERT_GT(*reportToken, 0); + } + } else { + ASSERT_EQ(status.getExceptionCode(), EX_ILLEGAL_ARGUMENT); + } +} + +void SensorsAidlTest::queryDirectChannelSupport(ISensors::SharedMemInfo::SharedMemType memType, + bool* supportsSharedMemType, + bool* supportsAnyDirectChannel) { + *supportsSharedMemType = false; + *supportsAnyDirectChannel = false; + for (const SensorInfo& curSensor : getSensorsList()) { + if (isDirectChannelTypeSupported(curSensor, memType)) { + *supportsSharedMemType = true; + } + if (isDirectChannelTypeSupported(curSensor, + ISensors::SharedMemInfo::SharedMemType::ASHMEM) || + isDirectChannelTypeSupported(curSensor, + ISensors::SharedMemInfo::SharedMemType::GRALLOC)) { + *supportsAnyDirectChannel = true; + } + + if (*supportsSharedMemType && *supportsAnyDirectChannel) { + break; + } + } +} + +void SensorsAidlTest::verifyRegisterDirectChannel( + std::shared_ptr> mem, + int32_t* directChannelHandle, bool supportsSharedMemType, bool supportsAnyDirectChannel) { + char* buffer = mem->getBuffer(); + size_t size = mem->getSize(); + + if (supportsSharedMemType) { + memset(buffer, 0xff, size); + } + + int32_t channelHandle; + + ::ndk::ScopedAStatus status = registerDirectChannel(mem->getSharedMemInfo(), &channelHandle); + if (supportsSharedMemType) { + ASSERT_TRUE(status.isOk()); + ASSERT_GT(channelHandle, 0); + + // Verify that the memory has been zeroed + for (size_t i = 0; i < mem->getSize(); i++) { + ASSERT_EQ(buffer[i], 0x00); + } + } else { + int32_t error = supportsAnyDirectChannel ? EX_ILLEGAL_ARGUMENT : EX_UNSUPPORTED_OPERATION; + ASSERT_EQ(status.getExceptionCode(), error); + } + *directChannelHandle = channelHandle; +} + +void SensorsAidlTest::verifyUnregisterDirectChannel(int32_t* channelHandle, + bool supportsAnyDirectChannel) { + int result = supportsAnyDirectChannel ? EX_NONE : EX_UNSUPPORTED_OPERATION; + ndk::ScopedAStatus status = unregisterDirectChannel(channelHandle); + ASSERT_EQ(status.getExceptionCode(), result); +} + +void SensorsAidlTest::verifyDirectChannel(ISensors::SharedMemInfo::SharedMemType memType) { + constexpr size_t kNumEvents = 1; + constexpr size_t kMemSize = kNumEvents * kEventSize; + + std::shared_ptr> mem( + SensorsAidlTestSharedMemory::create(memType, kMemSize)); + ASSERT_NE(mem, nullptr); + + bool supportsSharedMemType; + bool supportsAnyDirectChannel; + queryDirectChannelSupport(memType, &supportsSharedMemType, &supportsAnyDirectChannel); + + for (const SensorInfo& sensor : getSensorsList()) { + int32_t directChannelHandle = 0; + verifyRegisterDirectChannel(mem, &directChannelHandle, supportsSharedMemType, + supportsAnyDirectChannel); + verifyConfigure(sensor, memType, directChannelHandle, supportsAnyDirectChannel); + verifyUnregisterDirectChannel(&directChannelHandle, supportsAnyDirectChannel); + } +} + +void SensorsAidlTest::verifyConfigure(const SensorInfo& sensor, + ISensors::SharedMemInfo::SharedMemType memType, + int32_t directChannelHandle, bool supportsAnyDirectChannel) { + SCOPED_TRACE(::testing::Message() + << " handle=0x" << std::hex << std::setw(8) << std::setfill('0') + << sensor.sensorHandle << std::dec << " type=" << static_cast(sensor.type) + << " name=" << sensor.name); + + int32_t reportToken = 0; + if (isDirectChannelTypeSupported(sensor, memType)) { + // Verify that each rate level is properly supported + checkRateLevel(sensor, directChannelHandle, ISensors::RateLevel::NORMAL, &reportToken); + checkRateLevel(sensor, directChannelHandle, ISensors::RateLevel::FAST, &reportToken); + checkRateLevel(sensor, directChannelHandle, ISensors::RateLevel::VERY_FAST, &reportToken); + checkRateLevel(sensor, directChannelHandle, ISensors::RateLevel::STOP, &reportToken); + + // Verify that a sensor handle of -1 is only acceptable when using RateLevel::STOP + ndk::ScopedAStatus status = configDirectReport(-1 /* sensorHandle */, directChannelHandle, + ISensors::RateLevel::NORMAL, &reportToken); + ASSERT_EQ(status.getExceptionCode(), EX_ILLEGAL_ARGUMENT); + + status = configDirectReport(-1 /* sensorHandle */, directChannelHandle, + ISensors::RateLevel::STOP, &reportToken); + ASSERT_TRUE(status.isOk()); + } else { + // directChannelHandle will be -1 here, HAL should either reject it as a bad value if there + // is some level of direct channel report, otherwise return INVALID_OPERATION if direct + // channel is not supported at all + int error = supportsAnyDirectChannel ? EX_ILLEGAL_ARGUMENT : EX_UNSUPPORTED_OPERATION; + ndk::ScopedAStatus status = configDirectReport(sensor.sensorHandle, directChannelHandle, + ISensors::RateLevel::NORMAL, &reportToken); + ASSERT_EQ(status.getExceptionCode(), error); + } +} + +TEST_P(SensorsAidlTest, DirectChannelAshmem) { + verifyDirectChannel(ISensors::SharedMemInfo::SharedMemType::ASHMEM); +} + +TEST_P(SensorsAidlTest, DirectChannelGralloc) { + verifyDirectChannel(ISensors::SharedMemInfo::SharedMemType::GRALLOC); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SensorsAidlTest); +INSTANTIATE_TEST_SUITE_P(Sensors, SensorsAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(ISensors::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ProcessState::self()->setThreadPoolMaxThreadCount(1); + ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/sensors/common/default/2.X/multihal/HalProxy.cpp b/sensors/common/default/2.X/multihal/HalProxy.cpp index ccc4172511b9b3fa68bb4d1465486d5d44516840..f44f5c40a686dbdc83c1fe8fedafb04e576bd104 100644 --- a/sensors/common/default/2.X/multihal/HalProxy.cpp +++ b/sensors/common/default/2.X/multihal/HalProxy.cpp @@ -176,7 +176,13 @@ Return HalProxy::initialize_2_1( std::unique_ptr queue = std::make_unique(eventQueue); - return initializeCommon(queue, wakeLockDescriptor, dynamicCallback); + // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions. + auto hidlWakeLockQueue = + std::make_unique(wakeLockDescriptor, true /* resetPointers */); + std::unique_ptr wakeLockQueue = + std::make_unique(hidlWakeLockQueue); + + return initializeCommon(queue, wakeLockQueue, dynamicCallback); } Return HalProxy::initialize( @@ -192,12 +198,18 @@ Return HalProxy::initialize( std::unique_ptr queue = std::make_unique(eventQueue); - return initializeCommon(queue, wakeLockDescriptor, dynamicCallback); + // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions. + auto hidlWakeLockQueue = + std::make_unique(wakeLockDescriptor, true /* resetPointers */); + std::unique_ptr wakeLockQueue = + std::make_unique(hidlWakeLockQueue); + + return initializeCommon(queue, wakeLockQueue, dynamicCallback); } Return HalProxy::initializeCommon( std::unique_ptr& eventQueue, - const ::android::hardware::MQDescriptorSync& wakeLockDescriptor, + std::unique_ptr& wakeLockQueue, const sp& sensorsCallback) { Result result = Result::OK; @@ -222,8 +234,7 @@ Return HalProxy::initializeCommon( // Create the Wake Lock FMQ that is used by the framework to communicate whenever WAKE_UP // events have been successfully read and handled by the framework. - mWakeLockQueue = - std::make_unique(wakeLockDescriptor, true /* resetPointers */); + mWakeLockQueue = std::move(wakeLockQueue); if (mEventQueueFlag != nullptr) { EventFlag::deleteEventFlag(&mEventQueueFlag); diff --git a/sensors/common/default/2.X/multihal/include/HalProxy.h b/sensors/common/default/2.X/multihal/include/HalProxy.h index 35d7c8bae139c10632ac373f5f0e19218254fe58..61745281f875af97940000298ef5ef701e74e589 100644 --- a/sensors/common/default/2.X/multihal/include/HalProxy.h +++ b/sensors/common/default/2.X/multihal/include/HalProxy.h @@ -23,6 +23,7 @@ #include "V2_0/ScopedWakelock.h" #include "V2_0/SubHal.h" #include "V2_1/SubHal.h" +#include "WakeLockMessageQueueWrapper.h" #include "convertV2_1.h" #include @@ -98,10 +99,9 @@ class HalProxy : public V2_0::implementation::IScopedWakelockRefCounter, const ::android::hardware::MQDescriptorSync& wakeLockDescriptor, const sp& sensorsCallback); - Return initializeCommon( - std::unique_ptr& eventQueue, - const ::android::hardware::MQDescriptorSync& wakeLockDescriptor, - const sp& sensorsCallback); + Return initializeCommon(std::unique_ptr& eventQueue, + std::unique_ptr& wakeLockQueue, + const sp& sensorsCallback); Return batch(int32_t sensorHandle, int64_t samplingPeriodNs, int64_t maxReportLatencyNs); @@ -141,6 +141,8 @@ class HalProxy : public V2_0::implementation::IScopedWakelockRefCounter, void decrementRefCountAndMaybeReleaseWakelock(size_t delta, int64_t timeoutStart = -1) override; + const std::map& getSensors() { return mSensors; } + private: using EventMessageQueueV2_1 = MessageQueue; using EventMessageQueueV2_0 = MessageQueue; @@ -154,7 +156,7 @@ class HalProxy : public V2_0::implementation::IScopedWakelockRefCounter, /** * The Wake Lock FMQ that is read to determine when the framework has handled WAKE_UP events */ - std::unique_ptr mWakeLockQueue; + std::unique_ptr mWakeLockQueue; /** * Event Flag to signal to the framework when sensor events are available to be read and to diff --git a/sensors/common/utils/WakeLockMessageQueueWrapper.h b/sensors/common/utils/WakeLockMessageQueueWrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..3a219cffbe3b2f65a93626d8e1ca3a1e3aabb375 --- /dev/null +++ b/sensors/common/utils/WakeLockMessageQueueWrapper.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#pragma once + +#include "convertV2_1.h" + +#include +#include +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace sensors { +namespace V2_1 { +namespace implementation { + +class WakeLockMessageQueueWrapperBase { + public: + virtual ~WakeLockMessageQueueWrapperBase() {} + + virtual std::atomic* getEventFlagWord() = 0; + virtual bool readBlocking(uint32_t* events, size_t numToRead, uint32_t readNotification, + uint32_t writeNotification, int64_t timeOutNanos, + ::android::hardware::EventFlag* evFlag = nullptr) = 0; + virtual bool write(const uint32_t* wakeLock) = 0; +}; + +class WakeLockMessageQueueWrapperHidl : public WakeLockMessageQueueWrapperBase { + public: + WakeLockMessageQueueWrapperHidl( + std::unique_ptr<::android::hardware::MessageQueue>& + queue) + : mQueue(std::move(queue)) {} + + std::atomic* getEventFlagWord() override { return mQueue->getEventFlagWord(); } + + bool readBlocking(uint32_t* wakeLocks, size_t numToRead, uint32_t readNotification, + uint32_t writeNotification, int64_t timeOutNanos, + ::android::hardware::EventFlag* evFlag) override { + return mQueue->readBlocking(wakeLocks, numToRead, readNotification, writeNotification, + timeOutNanos, evFlag); + } + + bool write(const uint32_t* wakeLock) override { return mQueue->write(wakeLock); } + + private: + std::unique_ptr<::android::hardware::MessageQueue> mQueue; +}; + +} // namespace implementation +} // namespace V2_1 +} // namespace sensors +} // namespace hardware +} // namespace android diff --git a/sensors/common/utils/convertV2_1.h b/sensors/common/utils/convertV2_1.h index 9231011f3dad0250b0f86d27b83417c9ff768673..003590431f6d4c5356d0a322a32183a1d8b32eb0 100644 --- a/sensors/common/utils/convertV2_1.h +++ b/sensors/common/utils/convertV2_1.h @@ -77,6 +77,25 @@ inline const hidl_vec& convertToOldSensorInfos( return reinterpret_cast&>(infos); } +inline void convertToSensor(const V2_1::SensorInfo& src, sensor_t* dst) { + dst->name = strdup(src.name.c_str()); + dst->vendor = strdup(src.vendor.c_str()); + dst->version = src.version; + dst->handle = src.sensorHandle; + dst->type = (int)src.type; + dst->maxRange = src.maxRange; + dst->resolution = src.resolution; + dst->power = src.power; + dst->minDelay = src.minDelay; + dst->fifoReservedEventCount = src.fifoReservedEventCount; + dst->fifoMaxEventCount = src.fifoMaxEventCount; + dst->stringType = strdup(src.typeAsString.c_str()); + dst->requiredPermission = strdup(src.requiredPermission.c_str()); + dst->maxDelay = src.maxDelay; + dst->flags = src.flags; + dst->reserved[0] = dst->reserved[1] = 0; +} + inline void convertFromSensorEvent(const sensors_event_t& src, V2_1::Event* dst) { switch ((SensorType)src.type) { case SensorType::HINGE_ANGLE: diff --git a/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.cpp b/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.cpp index a8c2513e9ffe4ac512f3744823b5b5b63bc13459..d3958209f5df08cf6899ec117afec687b9e0017f 100644 --- a/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.cpp +++ b/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.cpp @@ -103,7 +103,7 @@ bool SensorsHidlEnvironmentV2_X::resetHal() { return succeed; } -void SensorsHidlEnvironmentV2_X::HidlTearDown() { +void SensorsHidlEnvironmentV2_X::TearDown() { mStopThread = true; if (mEventQueueFlag != nullptr) { diff --git a/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h b/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h index 01f451f5ad813bfc696da24192eaa7f7899aacdf..5fe4d8b54f5c36b1bf5e651cfb6fa2f896c7d092 100644 --- a/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h +++ b/sensors/common/vts/2_X/SensorsHidlEnvironmentV2_X.h @@ -18,7 +18,7 @@ #define ANDROID_SENSORS_HIDL_ENVIRONMENT_V2_X_H #include "ISensorsWrapper.h" -#include "sensors-vts-utils/SensorsHidlEnvironmentBase.h" +#include "sensors-vts-utils/SensorsVtsEnvironmentBase.h" #include #include @@ -46,14 +46,14 @@ class SensorsHalDeathRecipient : public ::android::hardware::hidl_death_recipien }; class SensorsHidlEnvironmentV2_X - : public SensorsHidlEnvironmentBase<::android::hardware::sensors::V2_1::Event> { + : public SensorsVtsEnvironmentBase<::android::hardware::sensors::V2_1::Event> { public: - virtual void HidlTearDown() override; + virtual void TearDown() override; protected: friend SensorsHidlTest; SensorsHidlEnvironmentV2_X(const std::string& service_name) - : SensorsHidlEnvironmentBase(service_name), mEventQueueFlag(nullptr) {} + : SensorsVtsEnvironmentBase(service_name), mEventQueueFlag(nullptr) {} /** * Resets the HAL with new FMQs and a new Event Flag diff --git a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h index ea5dc70c5b5acdba91cb23fd2b2519d522b19350..7e22b1902fa76993df3011063a6e6611a4c26c1a 100644 --- a/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h +++ b/sensors/common/vts/2_X/VtsHalSensorsV2_XTargetTest.h @@ -170,12 +170,12 @@ class SensorsHidlTest : public SensorsHidlTestBaseV2_X { public: virtual void SetUp() override { mEnvironment = new SensorsHidlEnvironmentV2_X(GetParam()); - mEnvironment->HidlSetUp(); + mEnvironment->SetUp(); // Ensure that we have a valid environment before performing tests ASSERT_NE(getSensors(), nullptr); } - virtual void TearDown() override { mEnvironment->HidlTearDown(); } + virtual void TearDown() override { mEnvironment->TearDown(); } protected: SensorInfoType defaultSensorByType(SensorTypeVersion type) override; @@ -216,7 +216,7 @@ class SensorsHidlTest : public SensorsHidlTestBaseV2_X { inline sp& getSensors() { return mEnvironment->mSensors; } - SensorsHidlEnvironmentBase* getEnvironment() override { return mEnvironment; } + SensorsVtsEnvironmentBase* getEnvironment() override { return mEnvironment; } // Test helpers void runSingleFlushTest(const std::vector& sensors, bool activateSensor, @@ -530,32 +530,31 @@ TEST_P(SensorsHidlTest, CallInitializeTwice) { // Create a new environment that calls initialize() std::unique_ptr newEnv = std::make_unique(GetParam()); - newEnv->HidlSetUp(); + newEnv->SetUp(); if (HasFatalFailure()) { return; // Exit early if setting up the new environment failed } activateAllSensors(true); // Verify that the old environment does not receive any events - EXPECT_EQ(collectEvents(kCollectionTimeoutUs, kNumEvents, getEnvironment()).size(), 0); + EXPECT_EQ(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), 0); // Verify that the new event queue receives sensor events - EXPECT_GE(collectEvents(kCollectionTimeoutUs, kNumEvents, newEnv.get(), newEnv.get()).size(), - kNumEvents); + EXPECT_GE(newEnv.get()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); activateAllSensors(false); // Cleanup the test environment - newEnv->HidlTearDown(); + newEnv->TearDown(); // Restore the test environment for future tests - getEnvironment()->HidlTearDown(); - getEnvironment()->HidlSetUp(); + getEnvironment()->TearDown(); + getEnvironment()->SetUp(); if (HasFatalFailure()) { return; // Exit early if resetting the environment failed } // Ensure that the original environment is receiving events activateAllSensors(true); - EXPECT_GE(collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); + EXPECT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); activateAllSensors(false); } @@ -565,21 +564,21 @@ TEST_P(SensorsHidlTest, CleanupConnectionsOnInitialize) { // Verify that events are received constexpr useconds_t kCollectionTimeoutUs = 1000 * 1000; // 1s constexpr int32_t kNumEvents = 1; - ASSERT_GE(collectEvents(kCollectionTimeoutUs, kNumEvents, getEnvironment()).size(), kNumEvents); + ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); // Clear the active sensor handles so they are not disabled during TearDown auto handles = mSensorHandles; mSensorHandles.clear(); - getEnvironment()->HidlTearDown(); - getEnvironment()->HidlSetUp(); + getEnvironment()->TearDown(); + getEnvironment()->SetUp(); if (HasFatalFailure()) { return; // Exit early if resetting the environment failed } // Verify no events are received until sensors are re-activated - ASSERT_EQ(collectEvents(kCollectionTimeoutUs, kNumEvents, getEnvironment()).size(), 0); + ASSERT_EQ(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), 0); activateAllSensors(true); - ASSERT_GE(collectEvents(kCollectionTimeoutUs, kNumEvents, getEnvironment()).size(), kNumEvents); + ASSERT_GE(getEnvironment()->collectEvents(kCollectionTimeoutUs, kNumEvents).size(), kNumEvents); // Disable sensors activateAllSensors(false); diff --git a/sensors/common/vts/utils/Android.bp b/sensors/common/vts/utils/Android.bp index 44bed6e002bf3bff31b287c8f6af96838ab074da..08b6afa20260410dbd45a74d3c5a102518b3cc0a 100644 --- a/sensors/common/vts/utils/Android.bp +++ b/sensors/common/vts/utils/Android.bp @@ -23,6 +23,23 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } +// Prefer to use these defaults to pull in VtsHalSensorsTargetTestUtils + its +// dependencies +cc_defaults { + name: "VtsHalSensorsDefaults", + shared_libs: [ + "android.hardware.graphics.allocator-V1-ndk", + "android.hardware.graphics.common-V3-ndk", + "libbinder_ndk", + "libutils", + "libvndksupport", + ], + static_libs: [ + "libaidlcommonsupport", + "VtsHalSensorsTargetTestUtils", + ], +} + cc_library_static { name: "VtsHalSensorsTargetTestUtils", defaults: ["VtsHalTargetTestDefaults"], @@ -36,13 +53,19 @@ cc_library_static { local_include_dirs: [ "include/sensors-vts-utils", ], + // Targets that depend on us need to also include these shared_libs: [ + "android.hardware.graphics.allocator-V1-ndk", + "android.hardware.graphics.common-V3-ndk", + "libbinder_ndk", "libutils", + "libvndksupport", ], static_libs: [ "android.hardware.sensors@1.0", "android.hardware.sensors@2.0", "android.hardware.sensors@2.1", + "libaidlcommonsupport", ], whole_static_libs: [ "android.hardware.graphics.allocator@2.0", diff --git a/sensors/common/vts/utils/GrallocWrapper.cpp b/sensors/common/vts/utils/GrallocWrapper.cpp index 47d1f4215271dda1ec501961b763413d50f211ce..e6e088826b3e22a542ccee14e11883dbf6194ce4 100644 --- a/sensors/common/vts/utils/GrallocWrapper.cpp +++ b/sensors/common/vts/utils/GrallocWrapper.cpp @@ -16,6 +16,9 @@ #include "GrallocWrapper.h" +#include +#include +#include #include #include #include @@ -27,8 +30,10 @@ #include #include +#include #include +using IAllocatorAidl = ::aidl::android::hardware::graphics::allocator::IAllocator; using IAllocator2 = ::android::hardware::graphics::allocator::V2_0::IAllocator; using IAllocator3 = ::android::hardware::graphics::allocator::V3_0::IAllocator; using IAllocator4 = ::android::hardware::graphics::allocator::V4_0::IAllocator; @@ -41,6 +46,9 @@ using Error2 = ::android::hardware::graphics::mapper::V2_0::Error; using Error3 = ::android::hardware::graphics::mapper::V3_0::Error; using Error4 = ::android::hardware::graphics::mapper::V4_0::Error; +using ::aidl::android::hardware::common::NativeHandle; +using ::aidl::android::hardware::graphics::allocator::AllocationResult; + using ::android::hardware::graphics::common::V1_0::BufferUsage; using ::android::hardware::graphics::common::V1_0::PixelFormat; @@ -97,10 +105,11 @@ using BaseTypeOfFirstArg = typename std::remove_const< // Since all the type and function names are the same for the things we use across the major HAL // versions, we use template magic to avoid repeating ourselves. -template +template typename AllocatorWrapperT = sp> class GrallocHalWrapper : public IGrallocHalWrapper { public: - GrallocHalWrapper(const sp& allocator, const sp& mapper) + GrallocHalWrapper(const AllocatorWrapperT& allocator, const sp& mapper) : mAllocator(allocator), mMapper(mapper) { if (mapper->isRemote()) { ALOGE("Mapper is in passthrough mode"); @@ -116,7 +125,7 @@ class GrallocHalWrapper : public IGrallocHalWrapper { private: static constexpr uint64_t kBufferUsage = static_cast(BufferUsage::SENSOR_DIRECT_DATA | BufferUsage::CPU_READ_OFTEN); - sp mAllocator; + AllocatorWrapperT mAllocator; sp mMapper; // v2.0 and v3.0 use vec for BufferDescriptor, but v4.0 uses vec, so use @@ -128,8 +137,34 @@ class GrallocHalWrapper : public IGrallocHalWrapper { native_handle_t* importBuffer(const hidl_handle& rawHandle); }; -template -native_handle_t* GrallocHalWrapper::allocate(uint32_t size) { +template <> +native_handle_t* GrallocHalWrapper::allocate( + uint32_t size) { + constexpr uint32_t kBufferCount = 1; + BufferDescriptorT descriptor = getDescriptor(size); + native_handle_t* bufferHandle = nullptr; + + AllocationResult result; + auto status = mAllocator->allocate(descriptor, kBufferCount, &result); + if (!status.isOk()) { + status_t error = status.getExceptionCode(); + ALOGE("Failed to allocate buffer: %" PRId32, static_cast(error)); + } else if (result.buffers.size() != kBufferCount) { + ALOGE("Invalid buffer array size (got %zu, expected %" PRIu32 ")", result.buffers.size(), + kBufferCount); + } else { + // Convert from AIDL NativeHandle to native_handle_t to hidl_handle + hidl_handle hidlHandle; + hidlHandle.setTo(dupFromAidl(result.buffers[0]), /*shouldOwn*/ true); + bufferHandle = importBuffer(hidlHandle); + } + + return bufferHandle; +} + +template typename AllocatorWrapperT> +native_handle_t* GrallocHalWrapper::allocate( + uint32_t size) { constexpr uint32_t kBufferCount = 1; BufferDescriptorT descriptor = getDescriptor(size); native_handle_t* bufferHandle = nullptr; @@ -149,17 +184,18 @@ native_handle_t* GrallocHalWrapper::allocate(uint32_t size) return bufferHandle; } -template -void GrallocHalWrapper::freeBuffer(native_handle_t* bufferHandle) { +template typename AllocatorWrapperT> +void GrallocHalWrapper::freeBuffer( + native_handle_t* bufferHandle) { auto error = mMapper->freeBuffer(bufferHandle); if (!error.isOk() || failed(error)) { ALOGE("Failed to free buffer %p", bufferHandle); } } -template -typename GrallocHalWrapper::BufferDescriptorT -GrallocHalWrapper::getDescriptor(uint32_t size) { +template typename AllocatorWrapperT> +typename GrallocHalWrapper::BufferDescriptorT +GrallocHalWrapper::getDescriptor(uint32_t size) { typename MapperT::BufferDescriptorInfo descriptorInfo = { .width = size, .height = 1, @@ -181,8 +217,8 @@ GrallocHalWrapper::getDescriptor(uint32_t size) { return descriptor; } -template -native_handle_t* GrallocHalWrapper::importBuffer( +template typename AllocatorWrapperT> +native_handle_t* GrallocHalWrapper::importBuffer( const hidl_handle& rawHandle) { native_handle_t* bufferHandle = nullptr; @@ -198,8 +234,9 @@ native_handle_t* GrallocHalWrapper::importBuffer( return bufferHandle; } -template -void* GrallocHalWrapper::lock(native_handle_t* bufferHandle) { +template typename AllocatorWrapperT> +void* GrallocHalWrapper::lock( + native_handle_t* bufferHandle) { // Per the HAL, all-zeros Rect means the entire buffer typename MapperT::Rect accessRegion = {}; hidl_handle acquireFenceHandle; // No fence needed, already safe to lock @@ -218,8 +255,9 @@ void* GrallocHalWrapper::lock(native_handle_t* bufferHandle return data; } -template -void GrallocHalWrapper::unlock(native_handle_t* bufferHandle) { +template typename AllocatorWrapperT> +void GrallocHalWrapper::unlock( + native_handle_t* bufferHandle) { mMapper->unlock(bufferHandle, [&](auto error, const hidl_handle& /*releaseFence*/) { if (failed(error)) { ALOGE("Failed to unlock buffer %p: %" PRId32, bufferHandle, @@ -234,8 +272,22 @@ GrallocWrapper::GrallocWrapper() { sp allocator4 = IAllocator4::getService(); sp mapper4 = IMapper4::getService(); - if (allocator4 != nullptr && mapper4 != nullptr) { - ALOGD("Using IAllocator/IMapper v4.0"); + const auto kAllocatorSvc = std::string(IAllocatorAidl::descriptor) + "/default"; + std::shared_ptr allocatorAidl; + if (AServiceManager_isDeclared(kAllocatorSvc.c_str())) { + allocatorAidl = IAllocatorAidl::fromBinder( + ndk::SpAIBinder(AServiceManager_checkService(kAllocatorSvc.c_str()))); + } + + // As of T, AIDL Allocator is supported only with HIDL Mapper4 + // (ref: VtsHalGraphicsAllocatorAidl_TargetTest.cpp) + if (allocatorAidl != nullptr && mapper4 != nullptr) { + ALOGD("Using AIDL IAllocator + HIDL IMapper v4.0"); + mGrallocHal = std::unique_ptr( + new GrallocHalWrapper(allocatorAidl, + mapper4)); + } else if (allocator4 != nullptr && mapper4 != nullptr) { + ALOGD("AIDL IAllocator not found, using HIDL IAllocator/IMapper v4.0"); mGrallocHal = std::unique_ptr( new GrallocHalWrapper(allocator4, mapper4)); } else { diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlEnvironmentBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlEnvironmentBase.h deleted file mode 100644 index 19dfbe55e4fa33a6e00d2479bf3d4fb8619f6f91..0000000000000000000000000000000000000000 --- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlEnvironmentBase.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#ifndef ANDROID_SENSORS_HIDL_ENVIRONMENT_BASE_H -#define ANDROID_SENSORS_HIDL_ENVIRONMENT_BASE_H - -#include - -#include -#include -#include -#include -#include - -template -class IEventCallback { - public: - virtual ~IEventCallback() = default; - virtual void onEvent(const Event& event) = 0; -}; - -template -class SensorsHidlEnvironmentBase { - public: - virtual void HidlSetUp() { - ASSERT_TRUE(resetHal()) << "could not get hidl service"; - - mCollectionEnabled = false; - startPollingThread(); - - // In case framework just stopped for test and there is sensor events in the pipe, - // wait some time for those events to be cleared to avoid them messing up the test. - std::this_thread::sleep_for(std::chrono::seconds(3)); - } - - virtual void HidlTearDown() = 0; - - // Get and clear all events collected so far (like "cat" shell command). - // If output is nullptr, it clears all collected events. - void catEvents(std::vector* output) { - std::lock_guard lock(mEventsMutex); - if (output) { - output->insert(output->end(), mEvents.begin(), mEvents.end()); - } - mEvents.clear(); - } - - // set sensor event collection status - void setCollection(bool enable) { - std::lock_guard lock(mEventsMutex); - mCollectionEnabled = enable; - } - - void registerCallback(IEventCallback* callback) { - std::lock_guard lock(mEventsMutex); - mCallback = callback; - } - - void unregisterCallback() { - std::lock_guard lock(mEventsMutex); - mCallback = nullptr; - } - - protected: - SensorsHidlEnvironmentBase(const std::string& service_name) - : mCollectionEnabled(false), mCallback(nullptr) { - mServiceName = service_name; - } - virtual ~SensorsHidlEnvironmentBase(){}; - - void addEvent(const Event& ev) { - std::lock_guard lock(mEventsMutex); - if (mCollectionEnabled) { - mEvents.push_back(ev); - } - - if (mCallback != nullptr) { - mCallback->onEvent(ev); - } - } - - virtual void startPollingThread() = 0; - virtual bool resetHal() = 0; - - std::string mServiceName; - bool mCollectionEnabled; - std::atomic_bool mStopThread; - std::thread mPollThread; - std::vector mEvents; - std::mutex mEventsMutex; - - IEventCallback* mCallback; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(SensorsHidlEnvironmentBase); -}; - -#endif // ANDROID_SENSORS_HIDL_ENVIRONMENT_BASE_H \ No newline at end of file diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h index af140096b871bf7f5b1c804770c2f4a80ddfe5c8..f3cbd78a207cfff6690986aa2e0c8c3f7eb6d320 100644 --- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h +++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h @@ -18,8 +18,8 @@ #define ANDROID_SENSORS_HIDL_TEST_BASE_H #include "sensors-vts-utils/SensorEventsChecker.h" -#include "sensors-vts-utils/SensorsHidlEnvironmentBase.h" #include "sensors-vts-utils/SensorsTestSharedMemory.h" +#include "sensors-vts-utils/SensorsVtsEnvironmentBase.h" #include #include @@ -163,7 +163,7 @@ class SensorsHidlTestBase : public testing::TestWithParam { : mAccelNormChecker(Vec3NormChecker::byNominal(GRAVITY_EARTH, 1.0f /*m/s^2*/)), mGyroNormChecker(Vec3NormChecker::byNominal(0.f, 0.1f /*rad/s*/)) {} - virtual SensorsHidlEnvironmentBase* getEnvironment() = 0; + virtual SensorsVtsEnvironmentBase* getEnvironment() = 0; virtual void SetUp() override {} @@ -198,49 +198,6 @@ class SensorsHidlTestBase : public testing::TestWithParam { RateLevel rate, ISensors::configDirectReport_cb _hidl_cb) = 0; - std::vector collectEvents(useconds_t timeLimitUs, size_t nEventLimit, - bool clearBeforeStart = true, - bool changeCollection = true) { - return collectEvents(timeLimitUs, nEventLimit, getEnvironment(), clearBeforeStart, - changeCollection); - } - - std::vector collectEvents(useconds_t timeLimitUs, size_t nEventLimit, - SensorsHidlEnvironmentBase* environment, - bool clearBeforeStart = true, - bool changeCollection = true) { - std::vector events; - constexpr useconds_t SLEEP_GRANULARITY = 100 * 1000; // granularity 100 ms - - ALOGI("collect max of %zu events for %d us, clearBeforeStart %d", nEventLimit, timeLimitUs, - clearBeforeStart); - - if (changeCollection) { - environment->setCollection(true); - } - if (clearBeforeStart) { - environment->catEvents(nullptr); - } - - while (timeLimitUs > 0) { - useconds_t duration = std::min(SLEEP_GRANULARITY, timeLimitUs); - usleep(duration); - timeLimitUs -= duration; - - environment->catEvents(&events); - if (events.size() >= nEventLimit) { - break; - } - ALOGV("time to go = %d, events to go = %d", (int)timeLimitUs, - (int)(nEventLimit - events.size())); - } - - if (changeCollection) { - environment->setCollection(false); - } - return events; - } - void testStreamingOperation(SensorTypeVersion type, std::chrono::nanoseconds samplingPeriod, std::chrono::seconds duration, const SensorEventsChecker& checker) { @@ -268,7 +225,7 @@ class SensorsHidlTestBase : public testing::TestWithParam { ASSERT_EQ(batch(handle, samplingPeriodInNs, batchingPeriodInNs), Result::OK); ASSERT_EQ(activate(handle, 1), Result::OK); - events = collectEvents(minTimeUs, minNEvent, getEnvironment(), true /*clearBeforeStart*/); + events = getEnvironment()->collectEvents(minTimeUs, minNEvent, true /*clearBeforeStart*/); ASSERT_EQ(activate(handle, 0), Result::OK); ALOGI("Collected %zu samples", events.size()); @@ -335,13 +292,13 @@ class SensorsHidlTestBase : public testing::TestWithParam { ASSERT_EQ(activate(handle, 1), Result::OK); usleep(500000); // sleep 0.5 sec to wait for change rate to happen - events1 = collectEvents(collectionTimeoutUs, minNEvent, getEnvironment()); + events1 = getEnvironment()->collectEvents(collectionTimeoutUs, minNEvent); // second collection, without stopping the sensor ASSERT_EQ(batch(handle, secondCollectionPeriod, batchingPeriodInNs), Result::OK); usleep(500000); // sleep 0.5 sec to wait for change rate to happen - events2 = collectEvents(collectionTimeoutUs, minNEvent, getEnvironment()); + events2 = getEnvironment()->collectEvents(collectionTimeoutUs, minNEvent); // end of collection, stop sensor ASSERT_EQ(activate(handle, 0), Result::OK); @@ -447,16 +404,17 @@ class SensorsHidlTestBase : public testing::TestWithParam { getEnvironment()->setCollection(true); // clean existing collections - collectEvents(0 /*timeLimitUs*/, 0 /*nEventLimit*/, true /*clearBeforeStart*/, - false /*change collection*/); + getEnvironment()->collectEvents(0 /*timeLimitUs*/, 0 /*nEventLimit*/, + true /*clearBeforeStart*/, false /*change collection*/); // 0.8 + 0.2 times the batching period usleep(batchingPeriodInNs / 1000 * 2 / 10); ASSERT_EQ(flush(handle), Result::OK); // plus some time for the event to deliver - events = collectEvents(allowedBatchDeliverTimeNs / 1000, minFifoCount, - false /*clearBeforeStart*/, false /*change collection*/); + events = getEnvironment()->collectEvents(allowedBatchDeliverTimeNs / 1000, minFifoCount, + false /*clearBeforeStart*/, + false /*change collection*/); getEnvironment()->setCollection(false); ASSERT_EQ(activate(handle, 0), Result::OK); diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h new file mode 100644 index 0000000000000000000000000000000000000000..17a96ed7399d6e6400f099e27732a89846c28073 --- /dev/null +++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_SENSORS_VTS_ENVIRONMENT_BASE_H +#define ANDROID_SENSORS_VTS_ENVIRONMENT_BASE_H + +#include + +#include +#include +#include +#include +#include + +#include + +template +class IEventCallback { + public: + virtual ~IEventCallback() = default; + virtual void onEvent(const Event& event) = 0; +}; + +template +class SensorsVtsEnvironmentBase { + public: + virtual void SetUp() { + ASSERT_TRUE(resetHal()) << "could not get hidl service"; + + mCollectionEnabled = false; + startPollingThread(); + + // In case framework just stopped for test and there is sensor events in the pipe, + // wait some time for those events to be cleared to avoid them messing up the test. + std::this_thread::sleep_for(std::chrono::seconds(3)); + } + + virtual void TearDown() = 0; + + // Get and clear all events collected so far (like "cat" shell command). + // If output is nullptr, it clears all collected events. + void catEvents(std::vector* output) { + std::lock_guard lock(mEventsMutex); + if (output) { + output->insert(output->end(), mEvents.begin(), mEvents.end()); + } + mEvents.clear(); + } + + // set sensor event collection status + void setCollection(bool enable) { + std::lock_guard lock(mEventsMutex); + mCollectionEnabled = enable; + } + + void registerCallback(IEventCallback* callback) { + std::lock_guard lock(mEventsMutex); + mCallback = callback; + } + + void unregisterCallback() { + std::lock_guard lock(mEventsMutex); + mCallback = nullptr; + } + + std::vector collectEvents(useconds_t timeLimitUs, size_t nEventLimit, + bool clearBeforeStart = true, bool changeCollection = true) { + std::vector events; + constexpr useconds_t SLEEP_GRANULARITY = 100 * 1000; // granularity 100 ms + + ALOGI("collect max of %zu events for %d us, clearBeforeStart %d", nEventLimit, timeLimitUs, + clearBeforeStart); + + if (changeCollection) { + setCollection(true); + } + if (clearBeforeStart) { + catEvents(nullptr); + } + + while (timeLimitUs > 0) { + useconds_t duration = std::min(SLEEP_GRANULARITY, timeLimitUs); + usleep(duration); + timeLimitUs -= duration; + + catEvents(&events); + if (events.size() >= nEventLimit) { + break; + } + ALOGV("time to go = %d, events to go = %d", (int)timeLimitUs, + (int)(nEventLimit - events.size())); + } + + if (changeCollection) { + setCollection(false); + } + return events; + } + + protected: + SensorsVtsEnvironmentBase(const std::string& service_name) + : mCollectionEnabled(false), mCallback(nullptr) { + mServiceName = service_name; + } + virtual ~SensorsVtsEnvironmentBase(){}; + + void addEvent(const Event& ev) { + std::lock_guard lock(mEventsMutex); + if (mCollectionEnabled) { + mEvents.push_back(ev); + } + + if (mCallback != nullptr) { + mCallback->onEvent(ev); + } + } + + virtual void startPollingThread() = 0; + virtual bool resetHal() = 0; + + std::string mServiceName; + bool mCollectionEnabled; + std::atomic_bool mStopThread; + std::thread mPollThread; + std::vector mEvents; + std::mutex mEventsMutex; + + IEventCallback* mCallback; + + GTEST_DISALLOW_COPY_AND_ASSIGN_(SensorsVtsEnvironmentBase); +}; + +#endif // ANDROID_SENSORS_VTS_ENVIRONMENT_BASE_H \ No newline at end of file diff --git a/soundtrigger/2.3/cli/Android.bp b/soundtrigger/2.3/cli/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..27d7b301eba8233c2e2db10bfb92e0a9612c04be --- /dev/null +++ b/soundtrigger/2.3/cli/Android.bp @@ -0,0 +1,17 @@ +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"], +} + +java_binary { + name: "sthal_cli_2.3", + wrapper: "sthal_cli_2.3", + srcs: ["java/**/*.java"], + static_libs: [ + "android.hardware.soundtrigger-V2.3-java", + ], +} diff --git a/soundtrigger/2.3/cli/OWNERS b/soundtrigger/2.3/cli/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..4fd27f3451559681225946853a386ea55eb02bed --- /dev/null +++ b/soundtrigger/2.3/cli/OWNERS @@ -0,0 +1 @@ +include platform/frameworks/base:/services/core/java/com/android/server/soundtrigger_middleware/OWNERS diff --git a/soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java b/soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java new file mode 100644 index 0000000000000000000000000000000000000000..68b04f4d5f2c85a2ae4a599822d93fcfffda9303 --- /dev/null +++ b/soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java @@ -0,0 +1,344 @@ +/* + * Copyright 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 android.hardware.soundtrigger.V2_3.cli; + +import android.hardware.soundtrigger.V2_0.PhraseRecognitionExtra; +import android.hardware.soundtrigger.V2_0.RecognitionMode; +import android.hardware.soundtrigger.V2_0.SoundModelType; +import android.hardware.soundtrigger.V2_3.OptionalModelParameterRange; +import android.hardware.soundtrigger.V2_3.ISoundTriggerHw; +import android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback; +import android.os.HidlMemoryUtil; +import android.os.HwBinder; +import android.os.RemoteException; +import android.os.SystemProperties; + +import java.util.Scanner; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/** + * This is a quick-and-dirty sound trigger HAL console mock. + * + * It would only work on userdebug builds. + * + * When this app is started, it will initially: + * - Register a ISoundTriggerHw HAL with an instance name "mock". + * - Set a sysprop that tells SoundTriggerMiddlewareService to try to connect to the mock instance + * rather than the default one. + * - Reboot the real (default) HAL. + * + * In response to that, SoundTriggerMiddlewareService is going to connect to the mock HAL and resume + * normal operation. + * + * Our mock HAL will print to stdout every call it receives as well as expose a basic set of + * operations for sending event callbacks to the client. This allows us to simulate the frameworks + * behavior in response to different HAL behaviors. + */ +public class SthalCli { + private static SoundTriggerImpl mService; + private static final Scanner mScanner = new Scanner(System.in); + + public static void main(String[] args) { + try { + System.out.println("Registering mock STHAL"); + HwBinder.setTrebleTestingOverride(true); + mService = new SoundTriggerImpl(); + mService.registerAsService("mock"); + + System.out.println("Rebooting STHAL"); + SystemProperties.set("debug.soundtrigger_middleware.use_mock_hal", "2"); + SystemProperties.set("sys.audio.restart.hal", "1"); + + while (processCommand()) ; + } catch (Exception e) { + e.printStackTrace(); + } finally { + cleanup(); + } + } + + private static void cleanup() { + System.out.println("Cleaning up."); + SystemProperties.set("debug.soundtrigger_middleware.use_mock_hal", null); + HwBinder.setTrebleTestingOverride(false); + } + + private static boolean processCommand() { + String line = mScanner.nextLine(); + String[] tokens = line.split("\\s+"); + if (tokens.length < 1) { + return false; + } + switch (tokens[0]) { + case "q": + return false; + + case "r": + mService.sendRecognitionEvent(Integer.parseInt(tokens[1]), + Integer.parseInt(tokens[2])); + return true; + + case "p": + mService.sendPhraseRecognitionEvent(Integer.parseInt(tokens[1]), + Integer.parseInt(tokens[2])); + return true; + + case "d": + mService.dumpModels(); + return true; + + case "h": + System.out.print("Available commands:\n" + "h - help\n" + "q - quit\n" + + "r - send recognitionEvent\n" + + "p - send phraseRecognitionEvent\n" + + "d - dump models\n"); + + default: + return true; + } + } + + private static class SoundTriggerImpl extends ISoundTriggerHw.Stub { + static class Model { + final ISoundTriggerHwCallback callback; + final SoundModel model; + final PhraseSoundModel phraseModel; + public android.hardware.soundtrigger.V2_3.RecognitionConfig config = null; + + Model(ISoundTriggerHwCallback callback, SoundModel model) { + this.callback = callback; + this.model = model; + this.phraseModel = null; + } + + Model(ISoundTriggerHwCallback callback, PhraseSoundModel model) { + this.callback = callback; + this.model = null; + this.phraseModel = model; + } + } + + private final ConcurrentMap mLoadedModels = new ConcurrentHashMap<>(); + private int mHandleCounter = 1; + + public void dumpModels() { + mLoadedModels.forEach((handle, model) -> { + System.out.println("+++ Model " + handle); + System.out.println(" config = " + model.config); + android.hardware.soundtrigger.V2_3.RecognitionConfig recognitionConfig = + model.config; + if (recognitionConfig != null) { + System.out.println(" ACTIVE recognitionConfig = " + recognitionConfig); + } else { + System.out.println(" INACTIVE"); + } + }); + } + + public void sendRecognitionEvent(int modelHandle, int status) { + Model model = mLoadedModels.get(modelHandle); + if (model != null && model.config != null) { + android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.RecognitionEvent event = + new android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.RecognitionEvent(); + event.header.model = modelHandle; + event.header.type = SoundModelType.GENERIC; + event.header.status = status; + event.header.captureSession = model.config.base.header.captureHandle; + event.header.captureAvailable = true; + event.header.audioConfig.channelMask = 16; + event.header.audioConfig.format = 1; + event.header.audioConfig.sampleRateHz = 16000; + event.data = HidlMemoryUtil.byteArrayToHidlMemory(new byte[0]); + try { + model.callback.recognitionCallback_2_1(event, 0); + } catch (RemoteException e) { + e.printStackTrace(); + } + model.config = null; + } + } + + public void sendPhraseRecognitionEvent(int modelHandle, int status) { + Model model = mLoadedModels.get(modelHandle); + if (model != null && model.config != null) { + android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.PhraseRecognitionEvent + event = + new android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.PhraseRecognitionEvent(); + event.common.header.model = modelHandle; + event.common.header.type = SoundModelType.KEYPHRASE; + event.common.header.status = status; + event.common.header.captureSession = model.config.base.header.captureHandle; + event.common.header.captureAvailable = true; + event.common.header.audioConfig.channelMask = 16; + event.common.header.audioConfig.format = 1; + event.common.header.audioConfig.sampleRateHz = 16000; + event.common.data = HidlMemoryUtil.byteArrayToHidlMemory(new byte[0]); + if (!model.phraseModel.phrases.isEmpty()) { + PhraseRecognitionExtra extra = new PhraseRecognitionExtra(); + extra.id = model.phraseModel.phrases.get(0).id; + extra.confidenceLevel = 100; + extra.recognitionModes = model.phraseModel.phrases.get(0).recognitionModes; + event.phraseExtras.add(extra); + } + try { + model.callback.phraseRecognitionCallback_2_1(event, 0); + } catch (RemoteException e) { + e.printStackTrace(); + } + model.config = null; + } + } + + @Override + public void loadSoundModel_2_1(SoundModel soundModel, + android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie, + loadSoundModel_2_1Callback _hidl_cb) { + int handle = mHandleCounter++; + System.out.printf("loadSoundModel_2_1(soundModel=%s) -> %d%n", soundModel, handle); + mLoadedModels.put(handle, new Model(callback, soundModel)); + _hidl_cb.onValues(0, handle); + } + + @Override + public void loadPhraseSoundModel_2_1(PhraseSoundModel soundModel, + android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie, + loadPhraseSoundModel_2_1Callback _hidl_cb) { + int handle = mHandleCounter++; + System.out.printf("loadPhraseSoundModel_2_1(soundModel=%s) -> %d%n", soundModel, + handle); + mLoadedModels.put(handle, new Model(callback, soundModel)); + _hidl_cb.onValues(0, handle); + } + + @Override + public int startRecognition_2_3(int modelHandle, + android.hardware.soundtrigger.V2_3.RecognitionConfig config) { + System.out.printf("startRecognition_2_3(modelHandle=%d)%n", modelHandle); + Model model = mLoadedModels.get(modelHandle); + if (model != null) { + model.config = config; + } + return 0; + } + + @Override + public void getProperties_2_3(getProperties_2_3Callback _hidl_cb) { + System.out.println("getProperties_2_3()"); + android.hardware.soundtrigger.V2_3.Properties properties = + new android.hardware.soundtrigger.V2_3.Properties(); + properties.base.implementor = "Android"; + properties.base.description = "Mock STHAL"; + properties.base.maxSoundModels = 2; + properties.base.maxKeyPhrases = 1; + properties.base.recognitionModes = + RecognitionMode.VOICE_TRIGGER | RecognitionMode.GENERIC_TRIGGER; + _hidl_cb.onValues(0, properties); + } + + @Override + public void queryParameter(int modelHandle, int modelParam, + queryParameterCallback _hidl_cb) { + _hidl_cb.onValues(0, new OptionalModelParameterRange()); + } + + @Override + public int getModelState(int modelHandle) { + System.out.printf("getModelState(modelHandle=%d)%n", modelHandle); + return 0; + } + + @Override + public int unloadSoundModel(int modelHandle) { + System.out.printf("unloadSoundModel(modelHandle=%d)%n", modelHandle); + return 0; + } + + @Override + public int stopRecognition(int modelHandle) { + System.out.printf("stopRecognition(modelHandle=%d)%n", modelHandle); + Model model = mLoadedModels.get(modelHandle); + if (model != null) { + model.config = null; + } + return 0; + } + + @Override + public void debug(android.os.NativeHandle fd, java.util.ArrayList options) { + if (!options.isEmpty()) { + switch (options.get(0)) { + case "reboot": + System.out.println("Received a reboot request. Exiting."); + cleanup(); + System.exit(1); + } + } + } + + //////////////////////////////////////////////////////////////////////////////////////////// + // Everything below is not implemented and not expected to be called. + + @Override + public int setParameter(int modelHandle, int modelParam, int value) { + throw new UnsupportedOperationException(); + } + + @Override + public void getParameter(int modelHandle, int modelParam, getParameterCallback _hidl_cb) { + throw new UnsupportedOperationException(); + } + + @Override + public int startRecognition_2_1(int modelHandle, RecognitionConfig config, + android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie) { + throw new UnsupportedOperationException(); + } + + @Override + public void getProperties(getPropertiesCallback _hidl_cb) { + throw new UnsupportedOperationException(); + } + + @Override + public void loadSoundModel( + android.hardware.soundtrigger.V2_0.ISoundTriggerHw.SoundModel soundModel, + android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback callback, int cookie, + loadSoundModelCallback _hidl_cb) { + throw new UnsupportedOperationException(); + } + + @Override + public void loadPhraseSoundModel( + android.hardware.soundtrigger.V2_0.ISoundTriggerHw.PhraseSoundModel soundModel, + android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback callback, int cookie, + loadPhraseSoundModelCallback _hidl_cb) { + throw new UnsupportedOperationException(); + } + + @Override + public int startRecognition(int modelHandle, + android.hardware.soundtrigger.V2_0.ISoundTriggerHw.RecognitionConfig config, + android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback callback, int cookie) { + throw new UnsupportedOperationException(); + } + + @Override + public int stopAllRecognitions() { + throw new UnsupportedOperationException(); + } + } +} diff --git a/soundtrigger/2.3/cli/sthal_cli_2.3 b/soundtrigger/2.3/cli/sthal_cli_2.3 new file mode 100644 index 0000000000000000000000000000000000000000..78e9f9b52e9cfe974a1cc3829a3d8fd65022a734 --- /dev/null +++ b/soundtrigger/2.3/cli/sthal_cli_2.3 @@ -0,0 +1,7 @@ +#!/system/bin/sh +# Script to start "sthal_cli_2.3" on the device +# +base=/system +export CLASSPATH=$base/framework/sthal_cli_2.3.jar +exec app_process $base/bin android.hardware.soundtrigger.V2_3.cli.SthalCli "$@" + diff --git a/soundtrigger/aidl/Android.bp b/soundtrigger/aidl/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..0658519bd93079f24dafed8094b9fe3fea6f89cf --- /dev/null +++ b/soundtrigger/aidl/Android.bp @@ -0,0 +1,44 @@ +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"], +} + +aidl_interface { + name: "android.hardware.soundtrigger3", + vendor_available: true, + host_supported: true, + flags: [ + "-Werror", + "-Weverything", + "-Wno-missing-permission-annotation", + ], + srcs: [ + "android/hardware/soundtrigger3/ISoundTriggerHw.aidl", + "android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl", + "android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl", + ], + stability: "vintf", + imports: [ + "android.media.soundtrigger.types-V1", + ], + backend: { + cpp: { + // prefer NDK backend which can be used anywhere + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + }, + versions_with_info: [ + { + version: "1", + imports: ["android.media.soundtrigger.types-V1"], + }, + ], + +} diff --git a/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/.hash b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/.hash new file mode 100644 index 0000000000000000000000000000000000000000..4ec3b8cab66c652a0f8c4b87444508fcfcd3abe2 --- /dev/null +++ b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/.hash @@ -0,0 +1 @@ +7d8d63478cd50e766d2072140c8aa3457f9fb585 diff --git a/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHw.aidl b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHw.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bbfe7d91610b11b623ef2a3414cc1a97b24ab9b6 --- /dev/null +++ b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHw.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 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 -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.soundtrigger3; +@VintfStability +interface ISoundTriggerHw { + android.media.soundtrigger.Properties getProperties(); + void registerGlobalCallback(in android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback callback); + int loadSoundModel(in android.media.soundtrigger.SoundModel soundModel, in android.hardware.soundtrigger3.ISoundTriggerHwCallback callback); + int loadPhraseSoundModel(in android.media.soundtrigger.PhraseSoundModel soundModel, in android.hardware.soundtrigger3.ISoundTriggerHwCallback callback); + void unloadSoundModel(in int modelHandle); + void startRecognition(in int modelHandle, in int deviceHandle, in int ioHandle, in android.media.soundtrigger.RecognitionConfig config); + void stopRecognition(in int modelHandle); + void forceRecognitionEvent(in int modelHandle); + @nullable android.media.soundtrigger.ModelParameterRange queryParameter(in int modelHandle, in android.media.soundtrigger.ModelParameter modelParam); + int getParameter(in int modelHandle, in android.media.soundtrigger.ModelParameter modelParam); + void setParameter(in int modelHandle, in android.media.soundtrigger.ModelParameter modelParam, in int value); +} diff --git a/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..152dfed637127403b47ef1122497d07d3b104e54 --- /dev/null +++ b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.soundtrigger3; +@VintfStability +interface ISoundTriggerHwCallback { + void modelUnloaded(in int model); + void phraseRecognitionCallback(in int model, in android.media.soundtrigger.PhraseRecognitionEvent event); + void recognitionCallback(in int model, in android.media.soundtrigger.RecognitionEvent event); +} diff --git a/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6dfee9fa2fd903b81da53781ee98c5732b0e82a9 --- /dev/null +++ b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/1/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 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 -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.soundtrigger3; +@VintfStability +interface ISoundTriggerHwGlobalCallback { + void onResourcesAvailable(); +} diff --git a/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHw.aidl b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHw.aidl new file mode 100644 index 0000000000000000000000000000000000000000..bbfe7d91610b11b623ef2a3414cc1a97b24ab9b6 --- /dev/null +++ b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHw.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 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 -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.soundtrigger3; +@VintfStability +interface ISoundTriggerHw { + android.media.soundtrigger.Properties getProperties(); + void registerGlobalCallback(in android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback callback); + int loadSoundModel(in android.media.soundtrigger.SoundModel soundModel, in android.hardware.soundtrigger3.ISoundTriggerHwCallback callback); + int loadPhraseSoundModel(in android.media.soundtrigger.PhraseSoundModel soundModel, in android.hardware.soundtrigger3.ISoundTriggerHwCallback callback); + void unloadSoundModel(in int modelHandle); + void startRecognition(in int modelHandle, in int deviceHandle, in int ioHandle, in android.media.soundtrigger.RecognitionConfig config); + void stopRecognition(in int modelHandle); + void forceRecognitionEvent(in int modelHandle); + @nullable android.media.soundtrigger.ModelParameterRange queryParameter(in int modelHandle, in android.media.soundtrigger.ModelParameter modelParam); + int getParameter(in int modelHandle, in android.media.soundtrigger.ModelParameter modelParam); + void setParameter(in int modelHandle, in android.media.soundtrigger.ModelParameter modelParam, in int value); +} diff --git a/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..152dfed637127403b47ef1122497d07d3b104e54 --- /dev/null +++ b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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 -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.soundtrigger3; +@VintfStability +interface ISoundTriggerHwCallback { + void modelUnloaded(in int model); + void phraseRecognitionCallback(in int model, in android.media.soundtrigger.PhraseRecognitionEvent event); + void recognitionCallback(in int model, in android.media.soundtrigger.RecognitionEvent event); +} diff --git a/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..6dfee9fa2fd903b81da53781ee98c5732b0e82a9 --- /dev/null +++ b/soundtrigger/aidl/aidl_api/android.hardware.soundtrigger3/current/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 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 -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.soundtrigger3; +@VintfStability +interface ISoundTriggerHwGlobalCallback { + void onResourcesAvailable(); +} diff --git a/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHw.aidl b/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHw.aidl new file mode 100644 index 0000000000000000000000000000000000000000..618331b3aa8c7d18631f3a929c841518293b2216 --- /dev/null +++ b/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHw.aidl @@ -0,0 +1,267 @@ +/* + * Copyright 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 android.hardware.soundtrigger3; + +import android.hardware.soundtrigger3.ISoundTriggerHwCallback; +import android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback; +import android.media.soundtrigger.ModelParameter; +import android.media.soundtrigger.ModelParameterRange; +import android.media.soundtrigger.PhraseSoundModel; +import android.media.soundtrigger.Properties; +import android.media.soundtrigger.RecognitionConfig; +import android.media.soundtrigger.SoundModel; + +/** + * SoundTrigger HAL interface. Used for hardware recognition of hotwords + * and other sounds. + * + * Basic usage: + * ============ + * ISoundTriggerHw supports the ability to have one of more detection sessions running at a given + * time, and listening to acoustic events. The basic flow of setting up such a session is: + * - Load a model using loadSoundModel() or loadPhraseSoundModel(). The provided model object would + * indicate the (implementation-specific) detection algorithm (engine) to use, as well as any + * parameters applicable for this agorithm. Upon success, those methods would return a handle + * which will be used to reference this model in subsequent calls. + * - Once the model had been successfully loaded, detection can begin by calling startRecognition(). + * - Recognition will continue running in the background until one of the following events occurs: + * - stopRecognition() has been called on this model. + * - A detection has occurred. + * - Detection was aborted, typically for resource constraints, for example, when a higher- + * priority use-case has been initiated. + * - In the latter two cases, a recognition event will be sent via a the callback interface that was + * registered by the client upon loading. In either case, after any of these events occur, the + * detection becomes inactive and no more recognition callbacks are allowed. + * - The same model maybe started again at a later time, and this process may repeat as many times + * as needed. + * - Finally, an inactive model that is no longer needed may be unloaded via unloadModel(). + * + * Important notes about the threading model: + * ========================================== + * Both this interface and the corresponding callback interface use a synchronous calling + * convention. This model comes with some advantages, but also with some risks of deadlocks if the + * implementation does not handle this correctly. Please consider the following: + * - After stopRecognition() returns, no more recognition events for that model may be sent. This + * implies that any queues holding such events must be flushed before the call returns and that + * may imply that callback from the HAL to the client are done while stopRecognition() is blocked. + * This is OK, and supported by the framework. + * - Similarly, the same relationship applies between unloadModel() and subsequent callbacks to + * modelUnloaded(). + * - Other than these two cases, calls into the HAL *MAY NOT* block on callbacks from the HAL, or + * else deadlock conditions may result, which may be handled by rebooting of the HAL process and + * cause service outages. + * + * Due to the asynchronous nature of recognition events and preemptive model unloading, the HAL must + * correctly handle requests that would have been valid before an event has been delivered, but + * became moot as result of the event. Namely: + * - stopRecognition() may be called on a model that has already delivered an event and became + * inactive as a result. The HAL must return a successful return code in this case. + * - Furthermore, if a model is preemptively unloaded after it triggers (typically, this would + * happen when it is first aborted and immediately preemptively unloaded), stopRecognition() may + * be called on it. The HAL must return successfully in this case. + * - startRecognition() may be called on a model that has been preemptively unloaded. In this case, + * the HAL must signal a ServiceSpecificException(RESOURCE_CONTENTION) to indicate that the + * operation is temporarily unsuccessful. + * - unloadSoundModel() may be called on a model that has been preemptively unloaded. The HAL must + * return a successful return code in this case. This also implies that model handles should + * generally not be reused until explicitly unloaded. To avoid the rare possibility of running out + * of handles, the framework may call unloadModel() on models that have been preemptively unloaded + * by the HAL. + * + * Important notes about resource constraints and concurrency + * ========================================================= + * Up until this version, the framework would enforce concurrency constraints expressed by the + * Properties presented by the soundtrigger instance. These include constraints on the maximum + * amount of models that can be loaded at the same time and on running recognition while capturing + * from the microphone. + * This version changes the approach for how these constraints are modeled, both offering the HAL + * implementation more flexibility and simplifying the framework's job in enforcing these + * limitations. Note that there is no change for how the framework behaves with earlier versions, + * everything described below only applies to this version and onward. + * The way this is achieved is as following: + * - The framework will no longer enforce constraints on concurrent loading of models, as expressed + * in the Properties.maxSoundModels field (this property is merely a hint at this point and may be + * deprecated in the future), or any other implicit constraints. + * - The framework will no longer enforce constraints on concurrency of audio recording and + * soundtrigger operation, as expressed in the Properties.concurrentCapture field (this property + * is merely a hint at this point and may be deprecated in the future). + * - The HAL implementation is free to reject loading of any model at any time by having the + * respective load*() method signal a ServiceSpecificException(RESOURCE_CONTENTION). + * - The HAL implementation is free to reject starting of any model at any time by having the + * respective start*() method signal a ServiceSpecificException(RESOURCE_CONTENTION). + * - The HAL implementation is free to preemptively stop a previously started model at its own + * discretion (for example, if a higher priority use-case which cannot coexist with detection + * has been requested). The HAL must notify the framework of the preemption by sending a + * recognition event with an `ABORTED` status. The implementation must NOT attempt to restart the + * recognition automatically when conditions change. + * - The HAL implementation is free to preemptively unload a previously loaded model at its own + * discretion (for example, if a higher-priority model is being loaded and the two cannot + * coexist). When doing so, it must first abort the detection if active (as per above) and then + * notify the framework of the unload using the modelUnloaded() callback. + * - When conditions change, such that a model that couldn't previously load or start or that had + * previously been preemptively stopped or unloaded, the HAL must notify the framework via the + * newly added onResourcesAvailable() callback. This callback is not a guarantee that any + * operation would now succeed, but merely a hint that retrying something that had previously + * failed, now MAY succeed. Until this callback is invoked, the client may assume that any + * operation that had previously failed or aborted would still fail if retried, so the + * implementation should not forget to deliver it. + * There are no guarantees regarding how the framework may respond to this event and the order in + * which it may choose to reload/restart its models. Typically, as result of this event the + * framework will make a single attempt per model to bring this model to its desired state + * (loaded, started). + */ +@VintfStability +interface ISoundTriggerHw { + /** + * Retrieve implementation properties. + * + * @return A Properties structure containing implementation description and capabilities. + */ + Properties getProperties(); + + /** + * This will get called at most once per every attachment to the service. + * + * All events not tied to a specific model should go through this callback. + * + * @param callback An interface to receive global event callbacks. + */ + void registerGlobalCallback(in ISoundTriggerHwGlobalCallback callback); + + /** + * Load a sound model. Once loaded, recognition of this model can be started and stopped. + * + * @param soundModel A SoundModel structure describing the sound model to load. + * @param callback The callback interface on which the recognitionCallback() + * method will be called upon completion and modelUnloaded() upon preemptive unload. + * @return A unique handle assigned by the HAL for use by the client when controlling + * activity for this sound model. + * @throws ServiceSpecificException(RESOURCE_CONTENTION) if the model cannot be loaded due + * to resource constraints. This is typically a temporary condition and the client may + * retry after the onResourcesAvailable() global callback is invoked. + */ + int loadSoundModel(in SoundModel soundModel, in ISoundTriggerHwCallback callback); + + /** + * Load a key phrase sound model. Once loaded, recognition of this model can be started and + * stopped. + * + * @param soundModel A PhraseSoundModel structure describing the sound model to load. + * @param callback The callback interface on which the phraseRecognitionCallback() method will + * be called upon completion and modelUnloaded() upon preempted unload. + * @return A unique handle assigned by the HAL for use by the framework when controlling + * activity for this sound model. + * @throws ServiceSpecificException(RESOURCE_CONTENTION) if the model cannot be loaded due + * to resource constraints. This is typically a temporary condition and the client may + * retry after the onResourcesAvailable() global callback is invoked. + */ + int loadPhraseSoundModel(in PhraseSoundModel soundModel, in ISoundTriggerHwCallback callback); + + /** + * Unload a sound model. A sound model may be unloaded to free up resources and make room for a + * new one to overcome implementation limitations. + * This call is idempotent, to avoid any race conditions. + * + * @param modelHandle the handle of the sound model to unload. + */ + void unloadSoundModel(in int modelHandle); + + /** + * Start recognition on a given model. + * This must be called on a model that is in the stopped state. + * The state of this model becomes active and will remain so until explicitly stopped, or a + * recognition event had been delivered to the client. + * + * @param modelHandle the handle of the sound model to use for recognition + * @param deviceHandle The handle of the audio device to be used for recognition, as declared by + * the audio subsystem. + * @param ioHandle A handle assigned by the framework, which will later be used to retrieve + * an audio stream associated with this recognition session. + * @param config A RecognitionConfig structure containing attributes of the recognition to + * perform. + * @throws ServiceSpecificException(RESOURCE_CONTENTION) if the model cannot be started due + * to resource constraints. This is typically a temporary condition and the client may + * retry after the onResourcesAvailable() global callback is invoked. + */ + void startRecognition( + in int modelHandle, in int deviceHandle, in int ioHandle, in RecognitionConfig config); + + /** + * Stop recognition on a given model. + * This call is idempotent, to avoid any race conditions. + * + * @param modelHandle The handle of the sound model to use for recognition + */ + void stopRecognition(in int modelHandle); + + /** + * Request a recognition event to be generated. + * The model must be in the started state and will remain started after the event is sent. + * The model state is returned asynchronously as a RecognitionEvent via the callback that was + * registered upon loading. That event must have a RecognitionStatus.FORCED status. + * + * @param modelHandle The handle of the sound model whose state is being + * queried. + */ + void forceRecognitionEvent(in int modelHandle); + + /** + * Get supported parameter attributes with respect to the provided model handle. + * Model parameters are used to query/control model-specific detection behavior during a + * detection session. + * Along with determining the valid range, this API is also used to determine if a given + * parameter ID is supported at all by the modelHandle for use with getParameter() and + * setParameter() APIs. + * + * @param modelHandle The sound model handle indicating which model to query. + * @param modelParam Parameter to set which will be validated against the ModelParameter type. + * @return This structure indicates supported attributes of the parameter for the given model + * handle. If the parameter is not supported, null is returned. + */ + @nullable ModelParameterRange queryParameter( + in int modelHandle, in ModelParameter modelParam); + + /** + * Get a model specific parameter. + * If the value has not been set, a default value is returned. See ModelParameter for parameter + * default values. + * The caller must check if the handle supports the parameter via the queryParameter API prior + * to calling this method. + * + * @param modelHandle The sound model associated with given modelParam + * @param modelParam Parameter to set which will be validated against the ModelParameter type. + * Not putting ModelParameter type directly in the definition and validating internally + * allows for forward compatibility. + * @return Value set to the requested parameter. + */ + int getParameter(in int modelHandle, in ModelParameter modelParam); + + /** + * Set a model specific parameter with the given value. + * This parameter will keep its value for the duration the model is loaded regardless of + * starting and stopping recognition. Once the model is unloaded, the value will be lost. + * The caller must check if the handle supports the parameter via the queryParameter API prior + * to calling this method. + * + * @param modelHandle The sound model handle indicating which model to modify parameters + * @param modelParam Parameter to set which will be validated against the ModelParameter type. + * Not putting ModelParameter type directly in the definition and validating internally + * allows for forward compatibility. + * @param value The value to set for the given model parameter. + */ + void setParameter(in int modelHandle, in ModelParameter modelParam, in int value); +} diff --git a/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl b/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..049ca6574a7db73ba371e873d9457eaae1256b8c --- /dev/null +++ b/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHwCallback.aidl @@ -0,0 +1,59 @@ +/* + * Copyright 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 android.hardware.soundtrigger3; + +import android.media.soundtrigger.PhraseRecognitionEvent; +import android.media.soundtrigger.RecognitionEvent; + +/** + * SoundTrigger HAL per-model Callback interface. + */ +@VintfStability +interface ISoundTriggerHwCallback { + /** + * Callback method called by the HAL when a model has been unloaded at the HAL implementation's + * discretion. + * This event may only be delivered when the model state is 'stopped'. + * This event is NOT sent as part of an unload sequence initiated by the client. + * + * @param model The model handle. + */ + void modelUnloaded(in int model); + + /** + * Callback method called by the HAL when the sound recognition triggers for a key phrase sound + * model. + * This event may only be delivered when the model state is 'started'. + * Unless the status of the event is RecognitionStatus.FORCED, this event indicates that the + * state of this model has become 'stopped'. + * + * @param event A RecognitionEvent structure containing detailed results of the recognition + * triggered + */ + void phraseRecognitionCallback(in int model, in PhraseRecognitionEvent event); + + /** + * Callback method called by the HAL when the sound recognition triggers. + * This event may only be delivered when the model state is 'started'. + * Unless the status of the event is RecognitionStatus.FORCED, this event indicates that the + * state of this model has become 'stopped'. + * + * @param event A RecognitionEvent structure containing detailed results of the recognition + * triggered + */ + void recognitionCallback(in int model, in RecognitionEvent event); +} diff --git a/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl b/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl new file mode 100644 index 0000000000000000000000000000000000000000..d6d86308ba581cc8bf462f517b97d5c668110054 --- /dev/null +++ b/soundtrigger/aidl/android/hardware/soundtrigger3/ISoundTriggerHwGlobalCallback.aidl @@ -0,0 +1,34 @@ +/* + * Copyright 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 android.hardware.soundtrigger3; + +/** + * SoundTrigger HAL callback interface for events not associated with a particular model. + */ +@VintfStability +interface ISoundTriggerHwGlobalCallback { + /** + * Callback method called by the HAL whenever internal conditions have been made available, such + * that a call that would previously have failed with an -EBUSY status may now succeed. + * There is no guarantee that any call would succeed following this event. It is merely a hint + * to the client that it may retry. + * Conversely, any call that have failed previously with a + * ServiceSpecificException(RESOURCE_CONTENTION) is guaranteed to fail again if retried, until + * this callback is delivered. + */ + void onResourcesAvailable(); +} diff --git a/soundtrigger/aidl/cli/Android.bp b/soundtrigger/aidl/cli/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..e8999ff6b1a46e53bda469327cfb6332bddc7a86 --- /dev/null +++ b/soundtrigger/aidl/cli/Android.bp @@ -0,0 +1,17 @@ +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"], +} + +java_binary { + name: "sthal_cli_3", + wrapper: "sthal_cli_3", + srcs: ["java/**/*.java"], + static_libs: [ + "android.hardware.soundtrigger3-V1-java", + ], +} diff --git a/soundtrigger/aidl/cli/OWNERS b/soundtrigger/aidl/cli/OWNERS new file mode 100644 index 0000000000000000000000000000000000000000..9f87c4cdb534047f333865357d45eb748b742b83 --- /dev/null +++ b/soundtrigger/aidl/cli/OWNERS @@ -0,0 +1 @@ +include platform/frameworks/base:/media/aidl/android/media/soundtrigger_middleware/OWNERS diff --git a/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java new file mode 100644 index 0000000000000000000000000000000000000000..127f0629ffbc8dd4508856f49f62158bd3c2adc4 --- /dev/null +++ b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java @@ -0,0 +1,371 @@ +/* + * Copyright 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 android.hardware.soundtrigger3.cli; + +import android.annotation.NonNull; +import android.hardware.soundtrigger3.ISoundTriggerHw; +import android.hardware.soundtrigger3.ISoundTriggerHwCallback; +import android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback; +import android.media.audio.common.AudioChannelLayout; +import android.media.audio.common.AudioConfig; +import android.media.audio.common.AudioConfigBase; +import android.media.audio.common.AudioFormatDescription; +import android.media.audio.common.AudioFormatType; +import android.media.audio.common.PcmType; +import android.media.soundtrigger.ConfidenceLevel; +import android.media.soundtrigger.ModelParameterRange; +import android.media.soundtrigger.PhraseRecognitionEvent; +import android.media.soundtrigger.PhraseRecognitionExtra; +import android.media.soundtrigger.PhraseSoundModel; +import android.media.soundtrigger.Properties; +import android.media.soundtrigger.RecognitionConfig; +import android.media.soundtrigger.RecognitionEvent; +import android.media.soundtrigger.RecognitionMode; +import android.media.soundtrigger.SoundModel; +import android.media.soundtrigger.SoundModelType; +import android.os.HwBinder; +import android.os.ParcelFileDescriptor; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.SystemProperties; +import java.util.Scanner; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/** + * This is a quick-and-dirty sound trigger HAL console mock. + * + * It would only work on userdebug builds. + * + * When this app is started, it will initially: + * - Register a ISoundTriggerHw HAL with an instance name "mock". + * - Set a sysprop that tells SoundTriggerMiddlewareService to try to connect to the mock instance + * rather than the default one. + * - Reboot the real (default) HAL. + * + * In response to that, SoundTriggerMiddlewareService is going to connect to the mock HAL and resume + * normal operation. + * + * Our mock HAL will print to stdout every call it receives as well as expose a basic set of + * operations for sending event callbacks to the client. This allows us to simulate the frameworks + * behavior in response to different HAL behaviors. + */ +public class SthalCli { + private static SoundTriggerImpl mService; + private static final Scanner scanner = new Scanner(System.in); + + public static void main(String[] args) { + try { + printUsage(); + + System.out.println("Registering mock STHAL"); + mService = new SoundTriggerImpl(); + // This allows us to register the service, even if it is not declared in the manifest. + mService.forceDowngradeToSystemStability(); + ServiceManager.addService(ISoundTriggerHw.class.getCanonicalName() + "/mock", mService); + + System.out.println("Rebooting STHAL"); + SystemProperties.set("debug.soundtrigger_middleware.use_mock_hal", "3"); + SystemProperties.set("sys.audio.restart.hal", "1"); + + while (processCommand()) ; + } catch (Exception e) { + e.printStackTrace(); + } finally { + cleanup(); + } + } + + private static void cleanup() { + System.out.println("Cleaning up."); + SystemProperties.set("debug.soundtrigger_middleware.use_mock_hal", null); + HwBinder.setTrebleTestingOverride(false); + } + + private static boolean processCommand() { + String line = scanner.nextLine(); + String[] tokens = line.split("\\s+"); + if (tokens.length < 1) { + return false; + } + switch (tokens[0]) { + case "q": + return false; + + case "a": + mService.sendOnResourcesAvailable(); + return true; + + case "u": + mService.sendModelUnloaded(Integer.parseInt(tokens[1])); + return true; + + case "r": + mService.sendRecognitionEvent(Integer.parseInt(tokens[1]), + Integer.parseInt(tokens[2])); + return true; + + case "p": + mService.sendPhraseRecognitionEvent(Integer.parseInt(tokens[1]), + Integer.parseInt(tokens[2])); + return true; + + case "d": + mService.dumpModels(); + return true; + + default: + printUsage(); + return true; + } + } + + private static void printUsage() { + System.out.print( + "Sound Trigger HAL v3 mock\n" + + "Available commands:\n" + + "h - help\n" + + "q - quit\n" + + "a - send onResourcesAvailable event\n" + + "u - send modelUnloaded event\n" + + "r - send recognitionEvent\n" + + "p - send phraseRecognitionEvent\n" + + "d - dump models\n"); + } + + private static class SoundTriggerImpl extends ISoundTriggerHw.Stub { + static class Model { + final ISoundTriggerHwCallback callback; + final SoundModel model; + final PhraseSoundModel phraseModel; + public RecognitionConfig config = null; + + Model(ISoundTriggerHwCallback callback, SoundModel model) { + this.callback = callback; + this.model = model; + this.phraseModel = null; + } + + Model(ISoundTriggerHwCallback callback, PhraseSoundModel model) { + this.callback = callback; + this.model = null; + this.phraseModel = model; + } + } + + private ISoundTriggerHwGlobalCallback mGlobalCallback; + private final ConcurrentMap mLoadedModels = new ConcurrentHashMap<>(); + private int mHandleCounter = 1; + + public void dumpModels() { + mLoadedModels.forEach((handle, model) -> { + System.out.println("+++ Model " + handle); + System.out.println(" config = " + model.config); + RecognitionConfig recognitionConfig = model.config; + if (recognitionConfig != null) { + System.out.println(" ACTIVE recognitionConfig = " + recognitionConfig); + } else { + System.out.println(" INACTIVE"); + } + }); + } + + public void sendOnResourcesAvailable() { + if (mGlobalCallback != null) { + try { + mGlobalCallback.onResourcesAvailable(); + } catch (RemoteException e) { + e.printStackTrace(); + } + } + } + + public void sendRecognitionEvent(int modelHandle, int status) { + Model model = mLoadedModels.get(modelHandle); + if (model != null && model.config != null) { + RecognitionEvent event = new RecognitionEvent(); + event.type = SoundModelType.GENERIC; + event.status = status; + event.captureAvailable = true; + event.audioConfig = createConfig(); + try { + model.callback.recognitionCallback(modelHandle, event); + } catch (RemoteException e) { + e.printStackTrace(); + } + model.config = null; + } + } + + public void sendPhraseRecognitionEvent(int modelHandle, int status) { + Model model = mLoadedModels.get(modelHandle); + if (model != null && model.config != null) { + PhraseRecognitionEvent event = new PhraseRecognitionEvent(); + event.common = new RecognitionEvent(); + event.common.type = SoundModelType.KEYPHRASE; + event.common.status = status; + event.common.captureAvailable = true; + event.common.audioConfig = createConfig(); + if (model.phraseModel.phrases.length > 0) { + PhraseRecognitionExtra extra = new PhraseRecognitionExtra(); + extra.id = model.phraseModel.phrases[0].id; + extra.confidenceLevel = 100; + extra.recognitionModes = model.phraseModel.phrases[0].recognitionModes; + extra.levels = new ConfidenceLevel[0]; + event.phraseExtras = new PhraseRecognitionExtra[]{extra}; + } else { + event.phraseExtras = new PhraseRecognitionExtra[0]; + } + try { + model.callback.phraseRecognitionCallback(modelHandle, event); + } catch (RemoteException e) { + e.printStackTrace(); + } + model.config = null; + } + } + + public void sendModelUnloaded(int modelHandle) { + Model model = mLoadedModels.remove(modelHandle); + if (model != null) { + try { + model.callback.modelUnloaded(modelHandle); + } catch (RemoteException e) { + e.printStackTrace(); + } + } + } + + @Override + public void registerGlobalCallback(ISoundTriggerHwGlobalCallback callback) { + System.out.println("registerGlobalCallback()"); + mGlobalCallback = callback; + } + + @Override + public int loadSoundModel(SoundModel soundModel, ISoundTriggerHwCallback callback) { + int handle = mHandleCounter++; + System.out.printf("loadSoundModel(soundModel=%s) -> %d%n", soundModel, handle); + mLoadedModels.put(handle, new Model(callback, soundModel)); + return handle; + } + + @Override + public int loadPhraseSoundModel(PhraseSoundModel soundModel, + ISoundTriggerHwCallback callback) { + int handle = mHandleCounter++; + System.out.printf("loadPhraseSoundModel(soundModel=%s) -> %d%n", soundModel, handle); + mLoadedModels.put(handle, new Model(callback, soundModel)); + return handle; + } + + @Override + public void startRecognition(int modelHandle, int deviceHandle, int ioHandle, + RecognitionConfig config) { + System.out.printf("startRecognition(modelHandle=%d, deviceHandle=%d, ioHandle=%d)%n", + modelHandle, deviceHandle, ioHandle); + Model model = mLoadedModels.get(modelHandle); + if (model != null) { + model.config = config; + } + } + + @Override + public Properties getProperties() { + System.out.println("getProperties()"); + Properties properties = new Properties(); + properties.implementor = "Android"; + properties.description = "Mock STHAL"; + properties.maxSoundModels = 2; + properties.maxKeyPhrases = 1; + properties.recognitionModes = + RecognitionMode.VOICE_TRIGGER | RecognitionMode.GENERIC_TRIGGER; + return properties; + } + + @Override + public ModelParameterRange queryParameter(int modelHandle, int modelParam) { + System.out.printf("queryParameter(modelHandle=%d, modelParam=%d)%n", modelHandle, + modelParam); + return null; + } + + @Override + public void forceRecognitionEvent(int modelHandle) { + System.out.printf("getModelState(modelHandle=%d)%n", modelHandle); + } + + @Override + public void unloadSoundModel(int modelHandle) { + System.out.printf("unloadSoundModel(modelHandle=%d)%n", modelHandle); + } + + @Override + public void stopRecognition(int modelHandle) { + System.out.printf("stopRecognition(modelHandle=%d)%n", modelHandle); + Model model = mLoadedModels.get(modelHandle); + if (model != null) { + model.config = null; + } + } + + @Override + public int handleShellCommand(@NonNull ParcelFileDescriptor in, + @NonNull ParcelFileDescriptor out, @NonNull ParcelFileDescriptor err, + @NonNull String[] args) { + if (args.length > 0) { + switch (args[0]) { + case "reboot": + System.out.println("Received a reboot request. Exiting."); + cleanup(); + System.exit(1); + } + } + return 0; + } + + @Override + public void setParameter(int modelHandle, int modelParam, int value) { + throw new IllegalArgumentException(); + } + + @Override + public int getParameter(int modelHandle, int modelParam) { + throw new IllegalArgumentException(); + } + + private static AudioConfig createConfig() { + AudioConfig config = new AudioConfig(); + config.base = new AudioConfigBase(); + config.base.channelMask = AudioChannelLayout.layoutMask(AudioChannelLayout.LAYOUT_MONO); + config.base.format = new AudioFormatDescription(); + config.base.format.type = AudioFormatType.PCM; + config.base.format.pcm = PcmType.INT_16_BIT; + config.base.sampleRate = 16000; + return config; + } + + @Override + public int getInterfaceVersion() { + return ISoundTriggerHw.VERSION; + } + + @Override + public String getInterfaceHash() { + return ISoundTriggerHw.HASH; + } + } +} diff --git a/soundtrigger/aidl/cli/sthal_cli_3 b/soundtrigger/aidl/cli/sthal_cli_3 new file mode 100644 index 0000000000000000000000000000000000000000..f157c50276542dec58766fb2541200bfa570c9b5 --- /dev/null +++ b/soundtrigger/aidl/cli/sthal_cli_3 @@ -0,0 +1,6 @@ +#!/system/bin/sh +# Script to start "sthal_cli_3" on the device +# +base=/system +export CLASSPATH=$base/framework/sthal_cli_3.jar +exec app_process $base/bin android.hardware.soundtrigger3.cli.SthalCli "$@" diff --git a/tv/tuner/1.0/default/Dvr.cpp b/tv/tuner/1.0/default/Dvr.cpp index c3edac973eb40168fc68d6c29a1083036c80b5f4..40879f2041ad8f4cabbd4960471ed37ce27c25e3 100644 --- a/tv/tuner/1.0/default/Dvr.cpp +++ b/tv/tuner/1.0/default/Dvr.cpp @@ -37,7 +37,10 @@ Dvr::Dvr(DvrType type, uint32_t bufferSize, const sp& cb, sp Dvr::getQueueDesc(getQueueDesc_cb _hidl_cb) { ALOGV("%s", __FUNCTION__); @@ -112,8 +115,7 @@ Return Dvr::start() { } if (mType == DvrType::PLAYBACK) { - pthread_create(&mDvrThread, NULL, __threadLoopPlayback, this); - pthread_setname_np(mDvrThread, "playback_waiting_loop"); + mDvrThread = std::thread(&Dvr::playbackThreadLoop, this); } else if (mType == DvrType::RECORD) { mRecordStatus = RecordStatus::DATA_READY; mDemux->setIsRecording(mType == DvrType::RECORD); @@ -128,10 +130,11 @@ Return Dvr::stop() { ALOGV("%s", __FUNCTION__); mDvrThreadRunning = false; - - lock_guard lock(mDvrThreadLock); - - mIsRecordStarted = false; + if (mDvrThread.joinable()) { + mDvrThread.join(); + } + // thread should always be joinable if it is running, + // so it should be safe to assume recording stopped. mDemux->setIsRecording(false); return Result::SUCCESS; @@ -147,7 +150,7 @@ Return Dvr::flush() { Return Dvr::close() { ALOGV("%s", __FUNCTION__); - + stop(); return Result::SUCCESS; } @@ -174,15 +177,8 @@ EventFlag* Dvr::getDvrEventFlag() { return mDvrEventFlag; } -void* Dvr::__threadLoopPlayback(void* user) { - Dvr* const self = static_cast(user); - self->playbackThreadLoop(); - return 0; -} - void Dvr::playbackThreadLoop() { ALOGD("[Dvr] playback threadLoop start."); - lock_guard lock(mDvrThreadLock); mDvrThreadRunning = true; while (mDvrThreadRunning) { diff --git a/tv/tuner/1.0/default/Dvr.h b/tv/tuner/1.0/default/Dvr.h index 30695866ca7d2c0c39d0c9e69e890c77a4d6a6b7..fd7fba2c0a43f5327f2436a4a874e14e7469d446 100644 --- a/tv/tuner/1.0/default/Dvr.h +++ b/tv/tuner/1.0/default/Dvr.h @@ -20,7 +20,9 @@ #include #include #include +#include #include +#include #include "Demux.h" #include "Frontend.h" #include "Tuner.h" @@ -119,10 +121,7 @@ class Dvr : public IDvr { * Each filter handler handles the data filtering/output writing/filterEvent updating. */ void startTpidFilter(vector data); - static void* __threadLoopPlayback(void* user); - static void* __threadLoopRecord(void* user); void playbackThreadLoop(); - void recordThreadLoop(); unique_ptr mDvrMQ; EventFlag* mDvrEventFlag; @@ -133,7 +132,7 @@ class Dvr : public IDvr { DvrSettings mDvrSettings; // Thread handlers - pthread_t mDvrThread; + std::thread mDvrThread; // FMQ status local records PlaybackStatus mPlaybackStatus; @@ -141,7 +140,7 @@ class Dvr : public IDvr { /** * If a specific filter's writing loop is still running */ - bool mDvrThreadRunning; + std::atomic mDvrThreadRunning; bool mKeepFetchingDataFromFrontend; /** * Lock to protect writes to the FMQs @@ -152,13 +151,8 @@ class Dvr : public IDvr { */ std::mutex mPlaybackStatusLock; std::mutex mRecordStatusLock; - std::mutex mDvrThreadLock; const bool DEBUG_DVR = false; - - // Booleans to check if recording is running. - // Recording is ready when both of the following are set to true. - bool mIsRecordStarted = false; }; } // namespace implementation @@ -168,4 +162,4 @@ class Dvr : public IDvr { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_DVR_H_ \ No newline at end of file +#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_DVR_H_ diff --git a/tv/tuner/1.0/default/Frontend.cpp b/tv/tuner/1.0/default/Frontend.cpp index 6561c92cafdc06f40e31d10288ef9a2bbfa01b79..6e82b8b978589d1b754de534a6fb2c19d94299be 100644 --- a/tv/tuner/1.0/default/Frontend.cpp +++ b/tv/tuner/1.0/default/Frontend.cpp @@ -104,7 +104,7 @@ Return Frontend::scan(const FrontendSettings& settings, FrontendScanType uint32_t frequency = settings.dvbt().frequency; if (type == FrontendScanType::SCAN_BLIND) { - frequency += 100; + frequency += 100 * 1000; } msg.frequencies({frequency}); mCallback->onScanMessage(FrontendScanMessageType::FREQUENCY, msg); diff --git a/tv/tuner/1.0/default/Lnb.cpp b/tv/tuner/1.0/default/Lnb.cpp index 6025339ba7a66dbfd7dc3fcc4f48457236366017..c770e911458ebdb708d50cee9eb3eabcc71b9ecc 100644 --- a/tv/tuner/1.0/default/Lnb.cpp +++ b/tv/tuner/1.0/default/Lnb.cpp @@ -33,9 +33,10 @@ Lnb::Lnb(int id) { Lnb::~Lnb() {} -Return Lnb::setCallback(const sp& /* callback */) { +Return Lnb::setCallback(const sp& callback) { ALOGV("%s", __FUNCTION__); + mCallback = callback; return Result::SUCCESS; } @@ -57,9 +58,16 @@ Return Lnb::setSatellitePosition(LnbPosition /* position */) { return Result::SUCCESS; } -Return Lnb::sendDiseqcMessage(const hidl_vec& /* diseqcMessage */) { +Return Lnb::sendDiseqcMessage(const hidl_vec& diseqcMessage) { ALOGV("%s", __FUNCTION__); + if (mCallback != nullptr) { + // The correct implementation should be to return the response from the + // device via onDiseqcMessage(). The below implementation is only to enable + // testing for LnbCallbacks. + ALOGV("[hidl] %s - this is for test purpose only, and must be replaced!", __FUNCTION__); + mCallback->onDiseqcMessage(diseqcMessage); + } return Result::SUCCESS; } diff --git a/tv/tuner/1.0/default/Lnb.h b/tv/tuner/1.0/default/Lnb.h index 1e9721443084aa5f317e58ea6e7ae3b0a7ec0404..c14bbd8735c2c95d9caeb65c3cd69b407e89b5e5 100644 --- a/tv/tuner/1.0/default/Lnb.h +++ b/tv/tuner/1.0/default/Lnb.h @@ -57,6 +57,7 @@ class Lnb : public ILnb { private: int mId; virtual ~Lnb(); + sp mCallback; }; } // namespace implementation diff --git a/tv/tuner/1.0/default/Tuner.cpp b/tv/tuner/1.0/default/Tuner.cpp index c4f610ee23c7b35cf049318cf2d69d74f4b7c426..2157bdfbd31b7c8f217d60f5b48a1945ea383f08 100644 --- a/tv/tuner/1.0/default/Tuner.cpp +++ b/tv/tuner/1.0/default/Tuner.cpp @@ -175,8 +175,8 @@ Return Tuner::getFrontendInfo(FrontendId frontendId, getFrontendInfo_cb _h // assign randomly selected values for testing. info = { .type = mFrontends[frontendId]->getFrontendType(), - .minFrequency = 139, - .maxFrequency = 1139, + .minFrequency = 139000000, + .maxFrequency = 1139000000, .minSymbolRate = 45, .maxSymbolRate = 1145, .acquireRange = 30, diff --git a/tv/tuner/1.0/default/android.hardware.tv.tuner@1.0-service.rc b/tv/tuner/1.0/default/android.hardware.tv.tuner@1.0-service.rc index 5d5b943c473f801d2ba0d8277e00be91da0f3830..2b1b37925147c372e850baf877f076f8529ce799 100644 --- a/tv/tuner/1.0/default/android.hardware.tv.tuner@1.0-service.rc +++ b/tv/tuner/1.0/default/android.hardware.tv.tuner@1.0-service.rc @@ -4,3 +4,4 @@ service vendor.tuner-hal-1-0 /vendor/bin/hw/android.hardware.tv.tuner@1.0-servic group mediadrm drmrpc ioprio rt 4 task_profiles ProcessCapacityHigh + onrestart restart media.tuner diff --git a/tv/tuner/1.0/vts/functional/DvrTests.cpp b/tv/tuner/1.0/vts/functional/DvrTests.cpp index 599abfb0b9e3320e5edeef327d7c774ddf6aa882..83f98584fb984ea96d96515f53b08a94da1e87c9 100644 --- a/tv/tuner/1.0/vts/functional/DvrTests.cpp +++ b/tv/tuner/1.0/vts/functional/DvrTests.cpp @@ -124,11 +124,9 @@ void DvrCallback::testRecordOutput() { while (mDataOutputBuffer.empty()) { if (-ETIMEDOUT == mMsgCondition.waitRelative(mMsgLock, WAIT_TIMEOUT)) { EXPECT_TRUE(false) << "record output matching pid does not output within timeout"; - stopRecordThread(); return; } } - stopRecordThread(); ALOGW("[vts] record pass and stop"); } @@ -193,9 +191,10 @@ void DvrCallback::recordThreadLoop(RecordSettings* /*recordSettings*/, bool* kee bool DvrCallback::readRecordFMQ() { android::Mutex::Autolock autoLock(mMsgLock); bool result = false; + int readSize = mRecordMQ->availableToRead(); mDataOutputBuffer.clear(); - mDataOutputBuffer.resize(mRecordMQ->availableToRead()); - result = mRecordMQ->read(mDataOutputBuffer.data(), mRecordMQ->availableToRead()); + mDataOutputBuffer.resize(readSize); + result = mRecordMQ->read(mDataOutputBuffer.data(), readSize); EXPECT_TRUE(result) << "can't read from Record MQ"; mMsgCondition.signal(); return result; diff --git a/tv/tuner/1.0/vts/functional/FilterTests.cpp b/tv/tuner/1.0/vts/functional/FilterTests.cpp index f47024526da636d238eef304220ce13bbb1fbfbf..a7792f5a850f2e59b1e1479802e32175091fb83d 100644 --- a/tv/tuner/1.0/vts/functional/FilterTests.cpp +++ b/tv/tuner/1.0/vts/functional/FilterTests.cpp @@ -16,7 +16,7 @@ #include "FilterTests.h" -void FilterCallback::startFilterEventThread(DemuxFilterEvent event) { +void FilterCallback::startFilterEventThread(DemuxFilterEvent& event) { struct FilterThreadArgs* threadArgs = (struct FilterThreadArgs*)malloc(sizeof(struct FilterThreadArgs)); threadArgs->user = this; @@ -69,9 +69,8 @@ void FilterCallback::filterThreadLoop(DemuxFilterEvent& /* event */) { // end thread } -bool FilterCallback::readFilterEventData() { +bool FilterCallback::readFilterEventData(const DemuxFilterEvent& filterEvent) { bool result = false; - DemuxFilterEvent filterEvent = mFilterEvent; ALOGW("[vts] reading from filter FMQ or buffer %d", mFilterId); // todo separate filter handlers for (auto event : filterEvent.events) { @@ -107,7 +106,7 @@ bool FilterCallback::readFilterEventData() { return result; } -bool FilterCallback::dumpAvData(DemuxFilterMediaEvent event) { +bool FilterCallback::dumpAvData(DemuxFilterMediaEvent& event) { uint32_t length = event.dataLength; uint64_t dataId = event.avDataId; // read data from buffer pointed by a handle @@ -127,7 +126,7 @@ bool FilterCallback::dumpAvData(DemuxFilterMediaEvent event) { return true; } -bool FilterCallback::readRecordData(DemuxFilterTsRecordEvent event) { +bool FilterCallback::readRecordData(DemuxFilterTsRecordEvent& event) { ALOGD("[vts] got DemuxFilterTsRecordEvent with pid=%d.", event.pid.tPid()); return true; } diff --git a/tv/tuner/1.0/vts/functional/FilterTests.h b/tv/tuner/1.0/vts/functional/FilterTests.h index 7bc4832171fc63c138db9d5b05880b0f2397d744..d37b9e1d847f5cc42a064c8c3ab38945f395c3cb 100644 --- a/tv/tuner/1.0/vts/functional/FilterTests.h +++ b/tv/tuner/1.0/vts/functional/FilterTests.h @@ -77,8 +77,7 @@ class FilterCallback : public IFilterCallback { android::Mutex::Autolock autoLock(mMsgLock); // Temprarily we treat the first coming back filter data on the matching pid a success // once all of the MQ are cleared, means we got all the expected output - mFilterEvent = filterEvent; - readFilterEventData(); + readFilterEventData(filterEvent); mPidFilterOutputCount++; // mFilterIdToMQ.erase(filterEvent.filterId); @@ -96,15 +95,15 @@ class FilterCallback : public IFilterCallback { void testFilterDataOutput(); - void startFilterEventThread(DemuxFilterEvent event); + void startFilterEventThread(DemuxFilterEvent& event); static void* __threadLoopFilter(void* threadArgs); void filterThreadLoop(DemuxFilterEvent& event); void updateFilterMQ(MQDesc& filterMQDescriptor); void updateGoldenOutputMap(string goldenOutputFile); - bool readFilterEventData(); - bool dumpAvData(DemuxFilterMediaEvent event); - bool readRecordData(DemuxFilterTsRecordEvent event); + bool readFilterEventData(const DemuxFilterEvent& filterEvent); + bool dumpAvData(DemuxFilterMediaEvent& event); + bool readRecordData(DemuxFilterTsRecordEvent& event); private: struct FilterThreadArgs { @@ -120,7 +119,6 @@ class FilterCallback : public IFilterCallback { sp mFilter; std::unique_ptr mFilterMQ; EventFlag* mFilterMQEventFlag; - DemuxFilterEvent mFilterEvent; android::Mutex mMsgLock; android::Mutex mFilterOutputLock; diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.cpp b/tv/tuner/1.0/vts/functional/FrontendTests.cpp old mode 100644 new mode 100755 index 6cf7d1df864762f63b79cab6c2dce2be248c2f12..acc524b026fdb575b157ff3864d26a8ae76de8bf --- a/tv/tuner/1.0/vts/functional/FrontendTests.cpp +++ b/tv/tuner/1.0/vts/functional/FrontendTests.cpp @@ -85,7 +85,7 @@ void FrontendCallback::scanTest(sp& frontend, FrontendConfig config, // passed in means the real input config on the transponder connected to the DUT. // We want the blind the test to start from lower frequency than this to check the blind // scan implementation. - resetBlindScanStartingFrequency(config, targetFrequency - 100); + resetBlindScanStartingFrequency(config, targetFrequency - 100 * 1000); } Result result = frontend->scan(config.settings, type); @@ -371,11 +371,13 @@ AssertionResult FrontendTests::tuneFrontend(FrontendConfig config, bool testWith mIsSoftwareFe = config.isSoftwareFe; bool result = true; if (mIsSoftwareFe && testWithDemux) { - result &= mDvrTests.openDvrInDemux(mDvrConfig.type, mDvrConfig.bufferSize) == success(); - result &= mDvrTests.configDvrPlayback(mDvrConfig.settings) == success(); - result &= mDvrTests.getDvrPlaybackMQDescriptor() == success(); - mDvrTests.startPlaybackInputThread(mDvrConfig.playbackInputFile, - mDvrConfig.settings.playback()); + result &= + getDvrTests()->openDvrInDemux(mDvrConfig.type, mDvrConfig.bufferSize) == success(); + result &= getDvrTests()->configDvrPlayback(mDvrConfig.settings) == success(); + result &= getDvrTests()->getDvrPlaybackMQDescriptor() == success(); + getDvrTests()->startPlaybackInputThread(mDvrConfig.playbackInputFile, + mDvrConfig.settings.playback()); + getDvrTests()->startDvrPlayback(); if (!result) { ALOGW("[vts] Software frontend dvr configure failed."); return failure(); @@ -398,8 +400,9 @@ AssertionResult FrontendTests::stopTuneFrontend(bool testWithDemux) { Result status; status = mFrontend->stopTune(); if (mIsSoftwareFe && testWithDemux) { - mDvrTests.stopPlaybackThread(); - mDvrTests.closeDvrPlayback(); + getDvrTests()->stopPlaybackThread(); + getDvrTests()->stopDvrPlayback(); + getDvrTests()->closeDvrPlayback(); } return AssertionResult(status == Result::SUCCESS); } @@ -415,7 +418,6 @@ AssertionResult FrontendTests::closeFrontend() { void FrontendTests::getFrontendIdByType(FrontendType feType, uint32_t& feId) { ASSERT_TRUE(getFrontendIds()); - ASSERT_TRUE(mFeIds.size() > 0); for (size_t i = 0; i < mFeIds.size(); i++) { ASSERT_TRUE(getFrontendInfo(mFeIds[i])); if (mFrontendInfo.type != feType) { diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.h b/tv/tuner/1.0/vts/functional/FrontendTests.h index 33ff603b85b7fcd61df4ba92a10d9750efd0d069..c789d94c2b618546ff52b9fd642b04ee05e5c307 100644 --- a/tv/tuner/1.0/vts/functional/FrontendTests.h +++ b/tv/tuner/1.0/vts/functional/FrontendTests.h @@ -103,7 +103,7 @@ class FrontendTests { void setService(sp tuner) { mService = tuner; - mDvrTests.setService(tuner); + getDvrTests()->setService(tuner); getDefaultSoftwareFrontendPlaybackConfig(mDvrConfig); } @@ -124,8 +124,8 @@ class FrontendTests { void tuneTest(FrontendConfig frontendConf); void scanTest(FrontendConfig frontend, FrontendScanType type); - void setDvrTests(DvrTests dvrTests) { mDvrTests = dvrTests; } - void setDemux(sp demux) { mDvrTests.setDemux(demux); } + void setDvrTests(DvrTests* dvrTests) { mExternalDvrTests = dvrTests; } + void setDemux(sp demux) { getDvrTests()->setDemux(demux); } void setSoftwareFrontendDvrConfig(DvrConfig conf) { mDvrConfig = conf; } protected: @@ -147,11 +147,16 @@ class FrontendTests { dvrConfig.settings.playback(playbackSettings); } + DvrTests* getDvrTests() { + return (mExternalDvrTests != nullptr ? mExternalDvrTests : &mDvrTests); + } + sp mFrontend; FrontendInfo mFrontendInfo; sp mFrontendCallback; hidl_vec mFeIds; + DvrTests* mExternalDvrTests = nullptr; DvrTests mDvrTests; bool mIsSoftwareFe = false; DvrConfig mDvrConfig; diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp index 53280d7a1c51194a3accb450fc88128171cba91c..59b7939833027062a05da670654496a11cbdf250 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp @@ -177,7 +177,7 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf, mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]); } ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); - mFrontendTests.setDvrTests(mDvrTests); + mFrontendTests.setDvrTests(&mDvrTests); } else { dvrSourceConfig = dvrMap[record.dvrSourceId]; ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize)); diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h index 7243a42c60384b14bf1e0463054b1b18672cac18..0b84b58bf717854beb06975f51ac79988b4c4c0a 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h @@ -50,7 +50,7 @@ bool initConfiguration() { return true; } -AssertionResult filterDataOutputTestBase(FilterTests tests) { +AssertionResult filterDataOutputTestBase(FilterTests& tests) { // Data Verify Module std::map>::iterator it; std::map> filterCallbacks = tests.getFilterCallbacks(); diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h index 2cea18126821e60c7040a1b20c87be29d44e1844..008879d3bd446baba44fb33cdb45aaa0312fbcb0 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h @@ -68,7 +68,7 @@ inline void initFrontendConfig() { // without overriding in the xml config. string defaultFeId = "FE_DEFAULT"; FrontendDvbtSettings dvbtSettings{ - .frequency = 578000, + .frequency = 578000000, .transmissionMode = FrontendDvbtTransmissionMode::AUTO, .bandwidth = FrontendDvbtBandwidth::BANDWIDTH_8MHZ, .isHighPriority = true, diff --git a/tv/tuner/1.1/default/Dvr.cpp b/tv/tuner/1.1/default/Dvr.cpp index 93f4519f1013d57b47230deb2dcfb0f31add6a7b..fdb66c1fd4f161887dd5a858d4500ce67536b497 100644 --- a/tv/tuner/1.1/default/Dvr.cpp +++ b/tv/tuner/1.1/default/Dvr.cpp @@ -38,8 +38,8 @@ Dvr::Dvr(DvrType type, uint32_t bufferSize, const sp& cb, sp lock(mDvrThreadLock); + // make sure thread has joined + close(); } Return Dvr::getQueueDesc(getQueueDesc_cb _hidl_cb) { @@ -134,8 +134,7 @@ Return Dvr::start() { if (mType == DvrType::PLAYBACK) { mDvrThreadRunning = true; - pthread_create(&mDvrThread, NULL, __threadLoopPlayback, this); - pthread_setname_np(mDvrThread, "playback_waiting_loop"); + mDvrThread = std::thread(&Dvr::playbackThreadLoop, this); } else if (mType == DvrType::RECORD) { mRecordStatus = RecordStatus::DATA_READY; mDemux->setIsRecording(mType == DvrType::RECORD); @@ -150,9 +149,11 @@ Return Dvr::stop() { ALOGV("%s", __FUNCTION__); mDvrThreadRunning = false; - lock_guard lock(mDvrThreadLock); - - mIsRecordStarted = false; + if (mDvrThread.joinable()) { + mDvrThread.join(); + } + // thread should always be joinable if it is running, + // so it should be safe to assume recording stopped. mDemux->setIsRecording(false); return Result::SUCCESS; @@ -168,9 +169,7 @@ Return Dvr::flush() { Return Dvr::close() { ALOGV("%s", __FUNCTION__); - - mDvrThreadRunning = false; - lock_guard lock(mDvrThreadLock); + stop(); return Result::SUCCESS; } @@ -197,15 +196,8 @@ EventFlag* Dvr::getDvrEventFlag() { return mDvrEventFlag; } -void* Dvr::__threadLoopPlayback(void* user) { - Dvr* const self = static_cast(user); - self->playbackThreadLoop(); - return 0; -} - void Dvr::playbackThreadLoop() { ALOGD("[Dvr] playback threadLoop start."); - lock_guard lock(mDvrThreadLock); while (mDvrThreadRunning) { uint32_t efState = 0; diff --git a/tv/tuner/1.1/default/Dvr.h b/tv/tuner/1.1/default/Dvr.h index 7b7efefada155f495e028ea170ff887b09003fe9..1bbb55c45e645af25dc608a31fbd3adada8e4689 100644 --- a/tv/tuner/1.1/default/Dvr.h +++ b/tv/tuner/1.1/default/Dvr.h @@ -19,7 +19,9 @@ #include #include +#include #include +#include #include "Demux.h" #include "Frontend.h" #include "Tuner.h" @@ -115,10 +117,7 @@ class Dvr : public IDvr { * Each filter handler handles the data filtering/output writing/filterEvent updating. */ void startTpidFilter(vector data); - static void* __threadLoopPlayback(void* user); - static void* __threadLoopRecord(void* user); void playbackThreadLoop(); - void recordThreadLoop(); unique_ptr mDvrMQ; EventFlag* mDvrEventFlag; @@ -129,7 +128,7 @@ class Dvr : public IDvr { DvrSettings mDvrSettings; // Thread handlers - pthread_t mDvrThread; + std::thread mDvrThread; // FMQ status local records PlaybackStatus mPlaybackStatus; @@ -137,7 +136,7 @@ class Dvr : public IDvr { /** * If a specific filter's writing loop is still running */ - bool mDvrThreadRunning; + std::atomic mDvrThreadRunning; bool mKeepFetchingDataFromFrontend; /** * Lock to protect writes to the FMQs @@ -148,13 +147,8 @@ class Dvr : public IDvr { */ std::mutex mPlaybackStatusLock; std::mutex mRecordStatusLock; - std::mutex mDvrThreadLock; const bool DEBUG_DVR = false; - - // Booleans to check if recording is running. - // Recording is ready when both of the following are set to true. - bool mIsRecordStarted = false; }; } // namespace implementation @@ -164,4 +158,4 @@ class Dvr : public IDvr { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_DVR_H_ \ No newline at end of file +#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_DVR_H_ diff --git a/tv/tuner/1.1/default/Filter.cpp b/tv/tuner/1.1/default/Filter.cpp index 7d609ea3dc456ce267d14df7910e3122ddd59faa..e0c785eae4d38f8e2e59bcd38cdc0ce4d6acebb4 100644 --- a/tv/tuner/1.1/default/Filter.cpp +++ b/tv/tuner/1.1/default/Filter.cpp @@ -532,7 +532,7 @@ uint16_t Filter::getTpid() { return mTpid; } -void Filter::updateFilterOutput(vector data) { +void Filter::updateFilterOutput(const vector& data) { std::lock_guard lock(mFilterOutputLock); mFilterOutput.insert(mFilterOutput.end(), data.begin(), data.end()); } @@ -542,7 +542,7 @@ void Filter::updatePts(uint64_t pts) { mPts = pts; } -void Filter::updateRecordOutput(vector data) { +void Filter::updateRecordOutput(const vector& data) { std::lock_guard lock(mRecordFilterOutputLock); mRecordFilterOutput.insert(mRecordFilterOutput.end(), data.begin(), data.end()); } @@ -689,9 +689,7 @@ Result Filter::startMediaFilterHandler() { Result result; if (mPts) { result = createMediaFilterEventWithIon(mFilterOutput); - if (result == Result::SUCCESS) { - mFilterOutput.clear(); - } + mFilterOutput.clear(); return result; } @@ -729,6 +727,7 @@ Result Filter::startMediaFilterHandler() { } result = createMediaFilterEventWithIon(mPesOutput); + mPesOutput.clear(); if (result != Result::SUCCESS) { return result; } @@ -739,7 +738,7 @@ Result Filter::startMediaFilterHandler() { return Result::SUCCESS; } -Result Filter::createMediaFilterEventWithIon(vector output) { +Result Filter::createMediaFilterEventWithIon(const vector& output) { if (mUsingSharedAvMem) { if (mSharedAvMemHandle.getNativeHandle() == nullptr) { return Result::UNKNOWN_ERROR; @@ -793,7 +792,7 @@ Result Filter::startTemiFilterHandler() { return Result::SUCCESS; } -bool Filter::writeSectionsAndCreateEvent(vector data) { +bool Filter::writeSectionsAndCreateEvent(const vector& data) { // TODO check how many sections has been read ALOGD("[Filter] section handler"); std::lock_guard lock(mFilterEventLock); @@ -874,7 +873,7 @@ native_handle_t* Filter::createNativeHandle(int fd) { return nativeHandle; } -Result Filter::createIndependentMediaEvents(vector output) { +Result Filter::createIndependentMediaEvents(const vector& output) { int av_fd = createAvIonFd(output.size()); if (av_fd == -1) { return Result::UNKNOWN_ERROR; @@ -912,8 +911,6 @@ Result Filter::createIndependentMediaEvents(vector output) { mFilterEvent.events.resize(size + 1); mFilterEvent.events[size].media(mediaEvent); - // Clear and log - output.clear(); mAvBufferCopyCount = 0; ::close(av_fd); if (DEBUG_FILTER) { @@ -922,7 +919,7 @@ Result Filter::createIndependentMediaEvents(vector output) { return Result::SUCCESS; } -Result Filter::createShareMemMediaEvents(vector output) { +Result Filter::createShareMemMediaEvents(const vector& output) { // copy the filtered data to the shared buffer uint8_t* sharedAvBuffer = getIonBuffer(mSharedAvMemHandle.getNativeHandle()->data[0], output.size() + mSharedAvMemOffset); @@ -955,8 +952,6 @@ Result Filter::createShareMemMediaEvents(vector output) { mFilterEvent.events.resize(size + 1); mFilterEvent.events[size].media(mediaEvent); - // Clear and log - output.clear(); if (DEBUG_FILTER) { ALOGD("[Filter] shared av data length %d", mediaEvent.dataLength); } diff --git a/tv/tuner/1.1/default/Filter.h b/tv/tuner/1.1/default/Filter.h index 659bebf1781ef0a087691ce2ba6cbbf7a15aa88f..1ea2f513a4beefed39e2934cd8fd33ded116c1ab 100644 --- a/tv/tuner/1.1/default/Filter.h +++ b/tv/tuner/1.1/default/Filter.h @@ -93,8 +93,8 @@ class Filter : public V1_1::IFilter { */ bool createFilterMQ(); uint16_t getTpid(); - void updateFilterOutput(vector data); - void updateRecordOutput(vector data); + void updateFilterOutput(const vector& data); + void updateRecordOutput(const vector& data); void updatePts(uint64_t pts); Result startFilterHandler(); Result startRecordFilterHandler(); @@ -177,7 +177,7 @@ class Filter : public V1_1::IFilter { void deleteEventFlag(); bool writeDataToFilterMQ(const std::vector& data); bool readDataFromMQ(); - bool writeSectionsAndCreateEvent(vector data); + bool writeSectionsAndCreateEvent(const vector& data); void maySendFilterStatusCallback(); DemuxFilterStatus checkFilterStatusChange(uint32_t availableToWrite, uint32_t availableToRead, uint32_t highThreshold, uint32_t lowThreshold); @@ -193,9 +193,9 @@ class Filter : public V1_1::IFilter { int createAvIonFd(int size); uint8_t* getIonBuffer(int fd, int size); native_handle_t* createNativeHandle(int fd); - Result createMediaFilterEventWithIon(vector output); - Result createIndependentMediaEvents(vector output); - Result createShareMemMediaEvents(vector output); + Result createMediaFilterEventWithIon(const vector& output); + Result createIndependentMediaEvents(const vector& output); + Result createShareMemMediaEvents(const vector& output); bool sameFile(int fd1, int fd2); DemuxFilterEvent createMediaEvent(); diff --git a/tv/tuner/1.1/default/Frontend.cpp b/tv/tuner/1.1/default/Frontend.cpp index e3fbdadc3f0cf14aa690fd2f8c675e1b878684a0..919c95639269600034349749e44c1b0cbcf436a5 100644 --- a/tv/tuner/1.1/default/Frontend.cpp +++ b/tv/tuner/1.1/default/Frontend.cpp @@ -88,47 +88,61 @@ Return Frontend::stopTune() { Return Frontend::scan(const FrontendSettings& settings, FrontendScanType type) { ALOGV("%s", __FUNCTION__); + + // If it's in middle of scanning, stop it first. + if (mScanThread.joinable()) { + mScanThread.join(); + } + + mFrontendSettings = settings; + mFrontendScanType = type; + mScanThread = std::thread(&Frontend::scanThreadLoop, this); + + return Result::SUCCESS; +} + +void Frontend::scanThreadLoop() { FrontendScanMessage msg; if (mIsLocked) { msg.isEnd(true); mCallback->onScanMessage(FrontendScanMessageType::END, msg); - return Result::SUCCESS; + return; } uint32_t frequency; - switch (settings.getDiscriminator()) { + switch (mFrontendSettings.getDiscriminator()) { case FrontendSettings::hidl_discriminator::analog: - frequency = settings.analog().frequency; + frequency = mFrontendSettings.analog().frequency; break; case FrontendSettings::hidl_discriminator::atsc: - frequency = settings.atsc().frequency; + frequency = mFrontendSettings.atsc().frequency; break; case FrontendSettings::hidl_discriminator::atsc3: - frequency = settings.atsc3().frequency; + frequency = mFrontendSettings.atsc3().frequency; break; case FrontendSettings::hidl_discriminator::dvbs: - frequency = settings.dvbs().frequency; + frequency = mFrontendSettings.dvbs().frequency; break; case FrontendSettings::hidl_discriminator::dvbc: - frequency = settings.dvbc().frequency; + frequency = mFrontendSettings.dvbc().frequency; break; case FrontendSettings::hidl_discriminator::dvbt: - frequency = settings.dvbt().frequency; + frequency = mFrontendSettings.dvbt().frequency; break; case FrontendSettings::hidl_discriminator::isdbs: - frequency = settings.isdbs().frequency; + frequency = mFrontendSettings.isdbs().frequency; break; case FrontendSettings::hidl_discriminator::isdbs3: - frequency = settings.isdbs3().frequency; + frequency = mFrontendSettings.isdbs3().frequency; break; case FrontendSettings::hidl_discriminator::isdbt: - frequency = settings.isdbt().frequency; + frequency = mFrontendSettings.isdbt().frequency; break; } - if (type == FrontendScanType::SCAN_BLIND) { - frequency += 100; + if (mFrontendScanType == FrontendScanType::SCAN_BLIND) { + frequency += 100 * 1000; } msg.frequencies({frequency}); @@ -204,8 +218,6 @@ Return Frontend::scan(const FrontendSettings& settings, FrontendScanType msg.isLocked(true); mCallback->onScanMessage(FrontendScanMessageType::LOCKED, msg); mIsLocked = true; - - return Result::SUCCESS; } Return Frontend::scan_1_1(const FrontendSettings& settings, FrontendScanType type, @@ -218,6 +230,10 @@ Return Frontend::scan_1_1(const FrontendSettings& settings, FrontendScan Return Frontend::stopScan() { ALOGV("%s", __FUNCTION__); + if (mScanThread.joinable()) { + mScanThread.join(); + } + mIsLocked = false; return Result::SUCCESS; } diff --git a/tv/tuner/1.1/default/Frontend.h b/tv/tuner/1.1/default/Frontend.h index a28fb6483bff786b20d15e77c7c5d85832a00e2c..bf739a8a98fd9e956de6e286a57452aa72941ea5 100644 --- a/tv/tuner/1.1/default/Frontend.h +++ b/tv/tuner/1.1/default/Frontend.h @@ -20,6 +20,7 @@ #include #include #include +#include #include "Tuner.h" using namespace std; @@ -81,13 +82,17 @@ class Frontend : public V1_1::IFrontend { private: virtual ~Frontend(); bool supportsSatellite(); + void scanThreadLoop(); + sp mCallback; sp mTunerService; FrontendType mType = FrontendType::UNDEFINED; FrontendId mId = 0; bool mIsLocked = false; uint32_t mCiCamId; - + std::thread mScanThread; + FrontendSettings mFrontendSettings; + FrontendScanType mFrontendScanType; std::ifstream mFrontendData; }; diff --git a/tv/tuner/1.1/default/Lnb.cpp b/tv/tuner/1.1/default/Lnb.cpp index 044727ff544b1042e6056cf0d1c735694751e0b8..5dd01472d5ada0aa2483614b899d8fda684337e3 100644 --- a/tv/tuner/1.1/default/Lnb.cpp +++ b/tv/tuner/1.1/default/Lnb.cpp @@ -33,9 +33,10 @@ Lnb::Lnb(int id) { Lnb::~Lnb() {} -Return Lnb::setCallback(const sp& /* callback */) { +Return Lnb::setCallback(const sp& callback) { ALOGV("%s", __FUNCTION__); + mCallback = callback; return Result::SUCCESS; } @@ -57,9 +58,16 @@ Return Lnb::setSatellitePosition(LnbPosition /* position */) { return Result::SUCCESS; } -Return Lnb::sendDiseqcMessage(const hidl_vec& /* diseqcMessage */) { +Return Lnb::sendDiseqcMessage(const hidl_vec& diseqcMessage) { ALOGV("%s", __FUNCTION__); + if (mCallback != nullptr) { + // The correct implementation should be to return the response from the + // device via onDiseqcMessage(). The below implementation is only to enable + // testing for LnbCallbacks. + ALOGV("[hidl] %s - this is for test purpose only, and must be replaced!", __FUNCTION__); + mCallback->onDiseqcMessage(diseqcMessage); + } return Result::SUCCESS; } diff --git a/tv/tuner/1.1/default/Lnb.h b/tv/tuner/1.1/default/Lnb.h index 70a8e41b8b9ab27157a0424cbe910b407f817e6c..b34ca396ca933666243e56557ab9a33172f11928 100644 --- a/tv/tuner/1.1/default/Lnb.h +++ b/tv/tuner/1.1/default/Lnb.h @@ -51,6 +51,7 @@ class Lnb : public ILnb { private: int mId; virtual ~Lnb(); + sp mCallback; }; } // namespace implementation diff --git a/tv/tuner/1.1/default/Tuner.cpp b/tv/tuner/1.1/default/Tuner.cpp index 1e940ba0987bf31ce913e2ba4bafa3b04af732b1..6d94fbd4b0d2b6ffe252d43b024ae1147d3c2c0f 100644 --- a/tv/tuner/1.1/default/Tuner.cpp +++ b/tv/tuner/1.1/default/Tuner.cpp @@ -264,8 +264,8 @@ Return Tuner::getFrontendInfo(FrontendId frontendId, getFrontendInfo_cb _h // assign randomly selected values for testing. info = { .type = mFrontends[frontendId]->getFrontendType(), - .minFrequency = 139, - .maxFrequency = 1139, + .minFrequency = 139000000, + .maxFrequency = 1139000000, .minSymbolRate = 45, .maxSymbolRate = 1145, .acquireRange = 30, diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc index bc62c7dc627d3e5cd23381b727487215a285a2c5..4ee6fa9a279457a935b964072d062cde408944cd 100644 --- a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc +++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc @@ -4,3 +4,4 @@ service vendor.tuner-hal-1-1 /vendor/bin/hw/android.hardware.tv.tuner@1.1-servic group mediadrm drmrpc ioprio rt 4 task_profiles ProcessCapacityHigh + onrestart restart media.tuner diff --git a/tv/tuner/1.1/vts/functional/AndroidTest.xml b/tv/tuner/1.1/vts/functional/AndroidTest.xml index 3e6878ce39f4e7ff058ab7e56e728da7765095bb..848cfc0957099a65e5aca6290ecdfdcc95109e99 100644 --- a/tv/tuner/1.1/vts/functional/AndroidTest.xml +++ b/tv/tuner/1.1/vts/functional/AndroidTest.xml @@ -24,6 +24,7 @@