Merge "Fix library dependencies for VtsHalAudio tests" into sc-dev
diff --git a/audio/7.0/config/api/current.txt b/audio/7.0/config/api/current.txt
index 78f2f29..dd2f0a2 100644
--- a/audio/7.0/config/api/current.txt
+++ b/audio/7.0/config/api/current.txt
@@ -223,6 +223,10 @@
enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MAT_2_1;
enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MP2;
enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MP3;
+ enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MPEGH_BL_L3;
+ enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MPEGH_BL_L4;
+ enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MPEGH_LC_L3;
+ enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_MPEGH_LC_L4;
enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_OPUS;
enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_PCM_16_BIT;
enum_constant public static final android.audio.policy.configuration.V7_0.AudioFormat AUDIO_FORMAT_PCM_24_BIT_PACKED;
diff --git a/audio/7.0/config/audio_policy_configuration.xsd b/audio/7.0/config/audio_policy_configuration.xsd
index 50c1793..fada505 100644
--- a/audio/7.0/config/audio_policy_configuration.xsd
+++ b/audio/7.0/config/audio_policy_configuration.xsd
@@ -403,6 +403,10 @@
<xs:enumeration value="AUDIO_FORMAT_LHDC_LL"/>
<xs:enumeration value="AUDIO_FORMAT_APTX_TWSP"/>
<xs:enumeration value="AUDIO_FORMAT_LC3"/>
+ <xs:enumeration value="AUDIO_FORMAT_MPEGH_BL_L3"/>
+ <xs:enumeration value="AUDIO_FORMAT_MPEGH_BL_L4"/>
+ <xs:enumeration value="AUDIO_FORMAT_MPEGH_LC_L3"/>
+ <xs:enumeration value="AUDIO_FORMAT_MPEGH_LC_L4"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="extendableAudioFormat">
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 9e2b077..d621344 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -888,6 +888,8 @@
static Status getSystemCameraKind(const camera_metadata_t* staticMeta,
SystemCameraKind* systemCameraKind);
+ static V3_2::DataspaceFlags getDataspace(PixelFormat format);
+
void processCaptureRequestInternal(uint64_t bufferusage, RequestTemplate reqTemplate,
bool useSecureOnlyCameras);
@@ -3196,7 +3198,6 @@
}
}
-
// Verify that all supported stream formats and sizes can be configured
// successfully.
TEST_P(CameraHidlTest, configureStreamsAvailableOutputs) {
@@ -3239,17 +3240,7 @@
uint32_t streamConfigCounter = 0;
for (auto& it : outputStreams) {
V3_2::Stream stream3_2;
- V3_2::DataspaceFlags dataspaceFlag = 0;
- switch (static_cast<PixelFormat>(it.format)) {
- case PixelFormat::BLOB:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
- break;
- case PixelFormat::Y16:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
- break;
- default:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::UNKNOWN);
- }
+ V3_2::DataspaceFlags dataspaceFlag = getDataspace(static_cast<PixelFormat>(it.format));
stream3_2 = {streamId,
StreamType::OUTPUT,
static_cast<uint32_t>(it.width),
@@ -3369,17 +3360,8 @@
size_t j = 0;
for (const auto& it : outputStreams) {
V3_2::Stream stream3_2;
- V3_2::DataspaceFlags dataspaceFlag = 0;
- switch (static_cast<PixelFormat>(it.format)) {
- case PixelFormat::BLOB:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
- break;
- case PixelFormat::Y16:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
- break;
- default:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::UNKNOWN);
- }
+ V3_2::DataspaceFlags dataspaceFlag = getDataspace(
+ static_cast<PixelFormat>(it.format));
stream3_2 = {streamId++,
StreamType::OUTPUT,
static_cast<uint32_t>(it.width),
@@ -5919,6 +5901,23 @@
return ret;
}
+// Select an appropriate dataspace given a specific pixel format.
+V3_2::DataspaceFlags CameraHidlTest::getDataspace(PixelFormat format) {
+ switch (format) {
+ case PixelFormat::BLOB:
+ return static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
+ case PixelFormat::Y16:
+ return static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
+ case PixelFormat::RAW16:
+ case PixelFormat::RAW_OPAQUE:
+ case PixelFormat::RAW10:
+ case PixelFormat::RAW12:
+ return static_cast<V3_2::DataspaceFlags>(Dataspace::ARBITRARY);
+ default:
+ return static_cast<V3_2::DataspaceFlags>(Dataspace::UNKNOWN);
+ }
+}
+
// Check whether this is a monochrome camera using the static camera characteristics.
Status CameraHidlTest::isMonochromeCamera(const camera_metadata_t *staticMeta) {
Status ret = Status::METHOD_NOT_SUPPORTED;
@@ -6293,17 +6292,8 @@
ASSERT_EQ(Status::OK, rc);
ASSERT_FALSE(outputStreams.empty());
- V3_2::DataspaceFlags dataspaceFlag = 0;
- switch (static_cast<PixelFormat>(outputStreams[idx].format)) {
- case PixelFormat::BLOB:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF);
- break;
- case PixelFormat::Y16:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::DEPTH);
- break;
- default:
- dataspaceFlag = static_cast<V3_2::DataspaceFlags>(Dataspace::UNKNOWN);
- }
+ V3_2::DataspaceFlags dataspaceFlag = getDataspace(
+ static_cast<PixelFormat>(outputStreams[idx].format));
::android::hardware::hidl_vec<V3_4::Stream> streams3_4(/*size*/1);
V3_4::Stream stream3_4 = {{ 0 /*streamId*/, StreamType::OUTPUT,
diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml
index 5e1266e..e5e012c 100644
--- a/compatibility_matrices/compatibility_matrix.4.xml
+++ b/compatibility_matrices/compatibility_matrix.4.xml
@@ -432,7 +432,6 @@
<hal format="hidl" optional="true">
<name>android.hardware.tv.cec</name>
<version>1.0</version>
- <version>2.0</version>
<interface>
<name>IHdmiCec</name>
<instance>default</instance>
diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml
index 8bc663d..e772b6f 100644
--- a/compatibility_matrices/compatibility_matrix.5.xml
+++ b/compatibility_matrices/compatibility_matrix.5.xml
@@ -467,7 +467,6 @@
<hal format="hidl" optional="true">
<name>android.hardware.tv.cec</name>
<version>1.0</version>
- <version>2.0</version>
<interface>
<name>IHdmiCec</name>
<instance>default</instance>
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 93a46dd..8e44be0 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -73,6 +73,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.automotive.occupant_awareness</name>
+ <version>1</version>
<interface>
<name>IOccupantAwareness</name>
<instance>default</instance>
@@ -336,6 +337,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.security.keymint</name>
+ <version>1</version>
<interface>
<name>IKeyMintDevice</name>
<instance>default</instance>
@@ -344,6 +346,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.light</name>
+ <version>1</version>
<interface>
<name>ILights</name>
<instance>default</instance>
@@ -372,6 +375,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.memtrack</name>
+ <version>1</version>
<interface>
<name>IMemtrack</name>
<instance>default</instance>
@@ -411,6 +415,7 @@
</hal>
<hal format="aidl" optional="false">
<name>android.hardware.power</name>
+ <version>1</version>
<interface>
<name>IPower</name>
<instance>default</instance>
@@ -470,6 +475,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.rebootescrow</name>
+ <version>1</version>
<interface>
<name>IRebootEscrow</name>
<instance>default</instance>
@@ -486,6 +492,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.security.secureclock</name>
+ <version>1</version>
<interface>
<name>ISecureClock</name>
<instance>default</instance>
@@ -493,6 +500,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.security.sharedsecret</name>
+ <version>1</version>
<interface>
<name>ISharedSecret</name>
<instance>default</instance>
@@ -509,7 +517,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.soundtrigger</name>
- <version>2.0-3</version>
+ <version>2.3</version>
<interface>
<name>ISoundTriggerHw</name>
<instance>default</instance>
@@ -542,7 +550,6 @@
<hal format="hidl" optional="true">
<name>android.hardware.tv.cec</name>
<version>1.0</version>
- <version>2.0</version>
<interface>
<name>IHdmiCec</name>
<instance>default</instance>
diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp
index 6725a98..e67c892 100644
--- a/compatibility_matrices/exclude/fcm_exclude.cpp
+++ b/compatibility_matrices/exclude/fcm_exclude.cpp
@@ -67,7 +67,7 @@
// TODO(b/171260360) Remove when HAL definition is removed
"android.hardware.audio.effect@2.0",
"android.hardware.audio@2.0",
- // TODO(b/171260613) Remove when HAL definition is removed
+ // Health 1.0 HAL is deprecated. The top level interface are deleted.
"android.hardware.health@1.0",
// TODO(b/171260670) Remove when HAL definition is removed
"android.hardware.nfc@1.0",
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp
index 2db3607..e6d4e84 100644
--- a/drm/1.0/default/CryptoPlugin.cpp
+++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -124,7 +124,11 @@
return Void();
}
- if (source.offset + offset + source.size > sourceBase->getSize()) {
+ size_t totalSize = 0;
+ if (__builtin_add_overflow(source.offset, offset, &totalSize) ||
+ __builtin_add_overflow(totalSize, source.size, &totalSize) ||
+ totalSize > sourceBase->getSize()) {
+ android_errorWriteLog(0x534e4554, "176496160");
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size");
return Void();
}
diff --git a/drm/1.4/Android.bp b/drm/1.4/Android.bp
index 8e1dc93..f40ff87 100644
--- a/drm/1.4/Android.bp
+++ b/drm/1.4/Android.bp
@@ -8,6 +8,7 @@
"ICryptoPlugin.hal",
"IDrmFactory.hal",
"IDrmPlugin.hal",
+ "types.hal",
],
interfaces: [
"android.hardware.drm@1.0",
diff --git a/drm/1.4/ICryptoPlugin.hal b/drm/1.4/ICryptoPlugin.hal
index 874ef4c..addfdd0 100644
--- a/drm/1.4/ICryptoPlugin.hal
+++ b/drm/1.4/ICryptoPlugin.hal
@@ -16,6 +16,8 @@
package android.hardware.drm@1.4;
import @1.2::ICryptoPlugin;
+import @1.4::LogMessage;
+import @1.4::Status;
/**
* ICryptoPlugin is the HAL for vendor-provided crypto plugins.
@@ -23,4 +25,15 @@
* load crypto keys for a codec to decrypt protected video content.
*/
interface ICryptoPlugin extends @1.2::ICryptoPlugin {
+
+ /**
+ * @return logMessages latest plugin level log messages. Can be used
+ * by apps in diagnosis of errors.
+ * @return status the status of the call. The status must be:
+ * OK on success;
+ * GENERAL_OEM_ERROR on OEM-provided, low-level component failures;
+ * GENERAL_PLUGIN_ERROR on unexpected plugin-level errors.
+ */
+ getLogMessages() generates (@1.4::Status status, vec<LogMessage> logMessages);
+
};
diff --git a/drm/1.4/IDrmPlugin.hal b/drm/1.4/IDrmPlugin.hal
index e8af230..df04b9f 100644
--- a/drm/1.4/IDrmPlugin.hal
+++ b/drm/1.4/IDrmPlugin.hal
@@ -19,6 +19,8 @@
import @1.0::SessionId;
import @1.1::SecurityLevel;
import @1.2::IDrmPlugin;
+import @1.4::LogMessage;
+import @1.4::Status;
/**
* IDrmPlugin is used to interact with a specific drm plugin that was
@@ -61,4 +63,14 @@
*/
setPlaybackId(SessionId sessionId, string playbackId) generates (@1.0::Status status);
+ /**
+ * @return logMessages latest plugin level log messages. Can be used
+ * by apps in diagnosis of errors.
+ * @return status the status of the call. The status must be:
+ * OK on success;
+ * GENERAL_OEM_ERROR on OEM-provided, low-level component failures;
+ * GENERAL_PLUGIN_ERROR on unexpected plugin-level errors.
+ */
+ getLogMessages() generates (@1.4::Status status, vec<LogMessage> logMessages);
+
};
diff --git a/drm/1.4/types.hal b/drm/1.4/types.hal
new file mode 100644
index 0000000..706c3aa
--- /dev/null
+++ b/drm/1.4/types.hal
@@ -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@1.4;
+
+import @1.2::Status;
+
+enum LogPriority : uint32_t {
+ ERROR,
+ WARN,
+ INFO,
+ DEBUG,
+ VERBOSE
+};
+
+/**
+ * Returned by getLogMessages to report error diagnostics to the
+ * app.
+ */
+struct LogMessage {
+ int64_t timeMs;
+ LogPriority priority;
+ string message;
+};
+
+enum Status : @1.2::Status {
+
+ /**
+ * Non-specific error reported by the device OEM subsystem.
+ */
+ GENERAL_OEM_ERROR,
+
+ /**
+ * Unexpected internal failure in the drm/crypto plugin.
+ */
+ GENERAL_PLUGIN_ERROR,
+
+};
diff --git a/health/storage/impl_common/impl_common.cpp b/health/storage/impl_common/impl_common.cpp
index 6e753d4..1a7a7f1 100644
--- a/health/storage/impl_common/impl_common.cpp
+++ b/health/storage/impl_common/impl_common.cpp
@@ -45,32 +45,59 @@
return "";
}
-Result GarbageCollect(uint64_t timeout_seconds) {
- std::string path = GetGarbageCollectPath();
+static std::string GetWriteBoosterPath() {
+ Fstab fstab;
+ ReadDefaultFstab(&fstab);
- if (path.empty()) {
+ for (const auto& entry : fstab) {
+ if (!entry.sysfs_path.empty()) {
+ return entry.sysfs_path + "/attributes/wb_avail_buf";
+ }
+ }
+
+ return "";
+}
+
+Result GarbageCollect(uint64_t timeout_seconds) {
+ std::string gc_path = GetGarbageCollectPath();
+
+ if (gc_path.empty()) {
LOG(WARNING) << "Cannot find Dev GC path";
return Result::UNKNOWN_ERROR;
}
Result result = Result::SUCCESS;
Timer timer;
- LOG(INFO) << "Start Dev GC on " << path;
+ LOG(INFO) << "Start Dev GC on " << gc_path;
while (1) {
- std::string require;
- if (!ReadFileToString(path, &require)) {
- PLOG(WARNING) << "Reading manual_gc failed in " << path;
+ std::string require_gc;
+ if (!ReadFileToString(gc_path, &require_gc)) {
+ PLOG(WARNING) << "Reading manual_gc failed in " << gc_path;
result = Result::IO_ERROR;
break;
}
- require = Trim(require);
- if (require == "" || require == "off" || require == "disabled") {
+ require_gc = Trim(require_gc);
+
+ std::string wb_path = GetWriteBoosterPath();
+ // Let's flush WB till 100% available
+ std::string wb_avail = "0x0000000A";
+ if (!wb_path.empty() && !ReadFileToString(wb_path, &wb_avail)) {
+ PLOG(WARNING) << "Reading wb_avail_buf failed in " << wb_path;
+ }
+ wb_avail = Trim(wb_avail);
+
+ if (require_gc == "disabled") {
+ LOG(DEBUG) << "Disabled Dev GC";
+ break;
+ }
+ if ((require_gc == "" || require_gc == "off") && wb_avail == "0x0000000A") {
LOG(DEBUG) << "No more to do Dev GC";
break;
}
- LOG(DEBUG) << "Trigger Dev GC on " << path;
- if (!WriteStringToFile("1", path)) {
- PLOG(WARNING) << "Start Dev GC failed on " << path;
+ LOG(DEBUG) << "Trigger Dev GC on " << gc_path << " having " << require_gc << ", WB on "
+ << wb_path << " having " << wb_avail;
+ if (!WriteStringToFile("1", gc_path)) {
+ PLOG(WARNING) << "Start Dev GC failed on " << gc_path;
result = Result::IO_ERROR;
break;
}
@@ -81,9 +108,9 @@
}
sleep(2);
}
- LOG(INFO) << "Stop Dev GC on " << path;
- if (!WriteStringToFile("0", path)) {
- PLOG(WARNING) << "Stop Dev GC failed on " << path;
+ LOG(INFO) << "Stop Dev GC on " << gc_path;
+ if (!WriteStringToFile("0", gc_path)) {
+ PLOG(WARNING) << "Stop Dev GC failed on " << gc_path;
result = Result::IO_ERROR;
}
@@ -97,17 +124,26 @@
if (path.empty()) {
output << "Cannot find Dev GC path";
} else {
- std::string require;
+ std::string require_gc;
- if (ReadFileToString(path, &require)) {
- output << path << ":" << require << std::endl;
+ if (ReadFileToString(path, &require_gc)) {
+ output << path << ":" << require_gc << std::endl;
}
if (WriteStringToFile("0", path)) {
output << "stop success" << std::endl;
}
}
+ std::string wb_path = GetWriteBoosterPath();
+ if (wb_path.empty()) {
+ output << "Cannot find Dev WriteBooster path";
+ } else {
+ std::string wb_available;
+ if (ReadFileToString(wb_path, &wb_available)) {
+ output << wb_path << ":" << wb_available << std::endl;
+ }
+ }
if (!WriteStringToFd(output.str(), fd)) {
PLOG(WARNING) << "debug: cannot write to fd";
}
diff --git a/memtrack/aidl/vts/VtsHalMemtrackTargetTest.cpp b/memtrack/aidl/vts/VtsHalMemtrackTargetTest.cpp
index 2393c56..d5f4612 100644
--- a/memtrack/aidl/vts/VtsHalMemtrackTargetTest.cpp
+++ b/memtrack/aidl/vts/VtsHalMemtrackTargetTest.cpp
@@ -79,10 +79,10 @@
auto status = memtrack_->getGpuDeviceInfo(&device_info);
- // Devices with < 5.10 kernels aren't required to provide an implementation of
+ // Devices with < 5.4 kernels aren't required to provide an implementation of
// getGpuDeviceInfo(), and can return EX_UNSUPPORTED_OPERATION
if (status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
- KernelVersion min_kernel_version = KernelVersion(5, 10, 0);
+ KernelVersion min_kernel_version = KernelVersion(5, 4, 0);
KernelVersion kernel_version = VintfObject::GetInstance()
->getRuntimeInfo(RuntimeInfo::FetchFlag::CPU_VERSION)
->kernelVersion();
diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/IPowerStats.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/IPowerStats.aidl
index 0b6387e..5b11695 100644
--- a/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/IPowerStats.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/IPowerStats.aidl
@@ -38,5 +38,5 @@
android.hardware.power.stats.EnergyConsumer[] getEnergyConsumerInfo();
android.hardware.power.stats.EnergyConsumerResult[] getEnergyConsumed(in int[] energyConsumerIds);
android.hardware.power.stats.Channel[] getEnergyMeterInfo();
- android.hardware.power.stats.EnergyMeasurement[] readEnergyMeters(in int[] channelIds);
+ android.hardware.power.stats.EnergyMeasurement[] readEnergyMeter(in int[] channelIds);
}
diff --git a/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl b/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
index 24a8f67..7a95f74 100644
--- a/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
@@ -107,5 +107,5 @@
* - STATUS_BAD_VALUE if an invalid channelId is provided
* - STATUS_FAILED_TRANSACTION if any EnergyMeasurement fails to be returned
*/
- EnergyMeasurement[] readEnergyMeters(in int[] channelIds);
-}
\ No newline at end of file
+ EnergyMeasurement[] readEnergyMeter(in int[] channelIds);
+}
diff --git a/power/stats/aidl/default/PowerStats.cpp b/power/stats/aidl/default/PowerStats.cpp
index 6cb0a73..0ffbd08 100644
--- a/power/stats/aidl/default/PowerStats.cpp
+++ b/power/stats/aidl/default/PowerStats.cpp
@@ -53,8 +53,8 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus PowerStats::readEnergyMeters(const std::vector<int32_t>& in_channelIds,
- std::vector<EnergyMeasurement>* _aidl_return) {
+ndk::ScopedAStatus PowerStats::readEnergyMeter(const std::vector<int32_t>& in_channelIds,
+ std::vector<EnergyMeasurement>* _aidl_return) {
(void)in_channelIds;
(void)_aidl_return;
return ndk::ScopedAStatus::ok();
diff --git a/power/stats/aidl/default/PowerStats.h b/power/stats/aidl/default/PowerStats.h
index 04c2d54..cb98e55 100644
--- a/power/stats/aidl/default/PowerStats.h
+++ b/power/stats/aidl/default/PowerStats.h
@@ -35,8 +35,8 @@
ndk::ScopedAStatus getEnergyConsumed(const std::vector<int32_t>& in_energyConsumerIds,
std::vector<EnergyConsumerResult>* _aidl_return) override;
ndk::ScopedAStatus getEnergyMeterInfo(std::vector<Channel>* _aidl_return) override;
- ndk::ScopedAStatus readEnergyMeters(const std::vector<int32_t>& in_channelIds,
- std::vector<EnergyMeasurement>* _aidl_return) override;
+ ndk::ScopedAStatus readEnergyMeter(const std::vector<int32_t>& in_channelIds,
+ std::vector<EnergyMeasurement>* _aidl_return) override;
};
} // namespace stats
diff --git a/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp b/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp
index f293773..bed3fdf 100644
--- a/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp
+++ b/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp
@@ -21,10 +21,21 @@
#include <android/binder_manager.h>
#include <android/binder_process.h>
+#include <algorithm>
+#include <iterator>
+#include <random>
+#include <unordered_map>
+
using aidl::android::hardware::power::stats::Channel;
+using aidl::android::hardware::power::stats::EnergyConsumer;
+using aidl::android::hardware::power::stats::EnergyConsumerAttribution;
+using aidl::android::hardware::power::stats::EnergyConsumerResult;
+using aidl::android::hardware::power::stats::EnergyConsumerType;
using aidl::android::hardware::power::stats::EnergyMeasurement;
using aidl::android::hardware::power::stats::IPowerStats;
using aidl::android::hardware::power::stats::PowerEntity;
+using aidl::android::hardware::power::stats::State;
+using aidl::android::hardware::power::stats::StateResidency;
using aidl::android::hardware::power::stats::StateResidencyResult;
using ndk::SpAIBinder;
@@ -37,12 +48,61 @@
ASSERT_NE(nullptr, powerstats.get());
}
+ template <typename T>
+ std::vector<T> getRandomSubset(std::vector<T> const& collection);
+
+ void testNameValid(const std::string& name);
+
+ template <typename T, typename S>
+ void testUnique(std::vector<T> const& collection, S T::*field);
+
+ template <typename T, typename S, typename R>
+ void testMatching(std::vector<T> const& c1, R T::*f1, std::vector<S> const& c2, R S::*f2);
+
std::shared_ptr<IPowerStats> powerstats;
};
-TEST_P(PowerStatsAidl, TestReadEnergyMeter) {
- std::vector<EnergyMeasurement> data;
- ASSERT_TRUE(powerstats->readEnergyMeters({}, &data).isOk());
+// Returns a random subset from a collection
+template <typename T>
+std::vector<T> PowerStatsAidl::getRandomSubset(std::vector<T> const& collection) {
+ if (collection.empty()) {
+ return {};
+ }
+
+ std::vector<T> selected;
+ std::sample(collection.begin(), collection.end(), std::back_inserter(selected),
+ rand() % collection.size() + 1, std::mt19937{std::random_device{}()});
+
+ return selected;
+}
+
+// Tests whether a name is valid
+void PowerStatsAidl::testNameValid(const std::string& name) {
+ EXPECT_NE(name, "");
+}
+
+// Tests whether the fields in a given collection are unique
+template <typename T, typename S>
+void PowerStatsAidl::testUnique(std::vector<T> const& collection, S T::*field) {
+ std::set<S> cSet;
+ for (auto const& elem : collection) {
+ EXPECT_TRUE(cSet.insert(elem.*field).second);
+ }
+}
+
+template <typename T, typename S, typename R>
+void PowerStatsAidl::testMatching(std::vector<T> const& c1, R T::*f1, std::vector<S> const& c2,
+ R S::*f2) {
+ std::set<R> c1fields, c2fields;
+ for (auto elem : c1) {
+ c1fields.insert(elem.*f1);
+ }
+
+ for (auto elem : c2) {
+ c2fields.insert(elem.*f2);
+ }
+
+ EXPECT_EQ(c1fields, c2fields);
}
// Each PowerEntity must have a valid name
@@ -51,80 +111,304 @@
ASSERT_TRUE(powerstats->getPowerEntityInfo(&infos).isOk());
for (auto info : infos) {
- EXPECT_NE(info.name, "");
+ testNameValid(info.name);
}
}
// Each power entity must have a unique name
TEST_P(PowerStatsAidl, ValidatePowerEntityUniqueNames) {
- std::vector<PowerEntity> infos;
- ASSERT_TRUE(powerstats->getPowerEntityInfo(&infos).isOk());
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
- std::set<std::string> names;
- for (auto info : infos) {
- EXPECT_TRUE(names.insert(info.name).second);
- }
+ testUnique(entities, &PowerEntity::name);
}
// Each PowerEntity must have a unique ID
TEST_P(PowerStatsAidl, ValidatePowerEntityIds) {
- std::vector<PowerEntity> infos;
- ASSERT_TRUE(powerstats->getPowerEntityInfo(&infos).isOk());
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
- std::set<int32_t> ids;
- for (auto info : infos) {
- EXPECT_TRUE(ids.insert(info.id).second);
+ testUnique(entities, &PowerEntity::id);
+}
+
+// Each power entity must have at least one state
+TEST_P(PowerStatsAidl, ValidateStateSize) {
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
+
+ for (auto entity : entities) {
+ EXPECT_GT(entity.states.size(), 0);
}
}
// Each state must have a valid name
TEST_P(PowerStatsAidl, ValidateStateNames) {
- std::vector<PowerEntity> infos;
- ASSERT_TRUE(powerstats->getPowerEntityInfo(&infos).isOk());
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
- for (auto info : infos) {
- for (auto state : info.states) {
- EXPECT_NE(state.name, "");
+ for (auto entity : entities) {
+ for (auto state : entity.states) {
+ testNameValid(state.name);
}
}
}
// Each state must have a name that is unique to the given PowerEntity
TEST_P(PowerStatsAidl, ValidateStateUniqueNames) {
- std::vector<PowerEntity> infos;
- ASSERT_TRUE(powerstats->getPowerEntityInfo(&infos).isOk());
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
- for (auto info : infos) {
- std::set<std::string> stateNames;
- for (auto state : info.states) {
- EXPECT_TRUE(stateNames.insert(state.name).second);
- }
+ for (auto entity : entities) {
+ testUnique(entity.states, &State::name);
}
}
// Each state must have an ID that is unique to the given PowerEntity
TEST_P(PowerStatsAidl, ValidateStateUniqueIds) {
- std::vector<PowerEntity> infos;
- ASSERT_TRUE(powerstats->getPowerEntityInfo(&infos).isOk());
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
- for (auto info : infos) {
- std::set<int32_t> stateIds;
- for (auto state : info.states) {
- EXPECT_TRUE(stateIds.insert(state.id).second);
- }
+ for (auto entity : entities) {
+ testUnique(entity.states, &State::id);
}
}
+// State residency must return a valid status
TEST_P(PowerStatsAidl, TestGetStateResidency) {
std::vector<StateResidencyResult> results;
ASSERT_TRUE(powerstats->getStateResidency({}, &results).isOk());
}
+// State residency must return all results
+TEST_P(PowerStatsAidl, TestGetStateResidencyAllResults) {
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
+
+ std::vector<StateResidencyResult> results;
+ ASSERT_TRUE(powerstats->getStateResidency({}, &results).isOk());
+
+ testMatching(entities, &PowerEntity::id, results, &StateResidencyResult::id);
+}
+
+// Each result must contain all state residencies
+TEST_P(PowerStatsAidl, TestGetStateResidencyAllStateResidencies) {
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
+
+ std::vector<StateResidencyResult> results;
+ ASSERT_TRUE(powerstats->getStateResidency({}, &results).isOk());
+
+ 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());
+
+ testMatching(entity.states, &State::id, it->stateResidencyData, &StateResidency::id);
+ }
+}
+
+// State residency must return results for each requested power entity
+TEST_P(PowerStatsAidl, TestGetStateResidencySelectedResults) {
+ std::vector<PowerEntity> entities;
+ ASSERT_TRUE(powerstats->getPowerEntityInfo(&entities).isOk());
+ if (entities.empty()) {
+ return;
+ }
+
+ std::vector<PowerEntity> selectedEntities = getRandomSubset(entities);
+ std::vector<int32_t> selectedIds;
+ for (auto const& entity : selectedEntities) {
+ selectedIds.push_back(entity.id);
+ }
+
+ std::vector<StateResidencyResult> selectedResults;
+ ASSERT_TRUE(powerstats->getStateResidency(selectedIds, &selectedResults).isOk());
+
+ testMatching(selectedEntities, &PowerEntity::id, selectedResults, &StateResidencyResult::id);
+}
+
+// Energy meter info must return a valid status
TEST_P(PowerStatsAidl, TestGetEnergyMeterInfo) {
std::vector<Channel> info;
ASSERT_TRUE(powerstats->getEnergyMeterInfo(&info).isOk());
}
+// Each channel must have a valid name and subsystem
+TEST_P(PowerStatsAidl, ValidateChannelNames) {
+ std::vector<Channel> channels;
+ ASSERT_TRUE(powerstats->getEnergyMeterInfo(&channels).isOk());
+ for (auto channel : channels) {
+ testNameValid(channel.name);
+ testNameValid(channel.subsystem);
+ }
+}
+
+// Each channel must have a unique name
+TEST_P(PowerStatsAidl, ValidateChannelUniqueNames) {
+ std::vector<Channel> channels;
+ ASSERT_TRUE(powerstats->getEnergyMeterInfo(&channels).isOk());
+
+ testUnique(channels, &Channel::name);
+}
+
+// Each channel must have a unique ID
+TEST_P(PowerStatsAidl, ValidateChannelUniqueIds) {
+ std::vector<Channel> channels;
+ ASSERT_TRUE(powerstats->getEnergyMeterInfo(&channels).isOk());
+
+ testUnique(channels, &Channel::id);
+}
+
+// Reading energy meter must return a valid status
+TEST_P(PowerStatsAidl, TestReadEnergyMeter) {
+ std::vector<EnergyMeasurement> data;
+ ASSERT_TRUE(powerstats->readEnergyMeter({}, &data).isOk());
+}
+
+// Reading energy meter must return results for all available channels
+TEST_P(PowerStatsAidl, TestGetAllEnergyMeasurements) {
+ std::vector<Channel> channels;
+ ASSERT_TRUE(powerstats->getEnergyMeterInfo(&channels).isOk());
+
+ std::vector<EnergyMeasurement> measurements;
+ ASSERT_TRUE(powerstats->readEnergyMeter({}, &measurements).isOk());
+
+ testMatching(channels, &Channel::id, measurements, &EnergyMeasurement::id);
+}
+
+// Reading energy must must return results for each selected channel
+TEST_P(PowerStatsAidl, TestGetSelectedEnergyMeasurements) {
+ std::vector<Channel> channels;
+ ASSERT_TRUE(powerstats->getEnergyMeterInfo(&channels).isOk());
+ if (channels.empty()) {
+ return;
+ }
+
+ std::vector<Channel> selectedChannels = getRandomSubset(channels);
+ std::vector<int32_t> selectedIds;
+ for (auto const& channel : selectedChannels) {
+ selectedIds.push_back(channel.id);
+ }
+
+ std::vector<EnergyMeasurement> selectedMeasurements;
+ ASSERT_TRUE(powerstats->readEnergyMeter(selectedIds, &selectedMeasurements).isOk());
+
+ testMatching(selectedChannels, &Channel::id, selectedMeasurements, &EnergyMeasurement::id);
+}
+
+// Energy consumer info must return a valid status
+TEST_P(PowerStatsAidl, TestGetEnergyConsumerInfo) {
+ std::vector<EnergyConsumer> consumers;
+ ASSERT_TRUE(powerstats->getEnergyConsumerInfo(&consumers).isOk());
+}
+
+// Each energy consumer must have a unique id
+TEST_P(PowerStatsAidl, TestGetEnergyConsumerUniqueId) {
+ std::vector<EnergyConsumer> consumers;
+ ASSERT_TRUE(powerstats->getEnergyConsumerInfo(&consumers).isOk());
+
+ testUnique(consumers, &EnergyConsumer::id);
+}
+
+// Each energy consumer must have a valid name
+TEST_P(PowerStatsAidl, ValidateEnergyConsumerNames) {
+ std::vector<EnergyConsumer> consumers;
+ ASSERT_TRUE(powerstats->getEnergyConsumerInfo(&consumers).isOk());
+
+ for (auto consumer : consumers) {
+ testNameValid(consumer.name);
+ }
+}
+
+// Each energy consumer must have a unique name
+TEST_P(PowerStatsAidl, ValidateEnergyConsumerUniqueNames) {
+ std::vector<EnergyConsumer> consumers;
+ ASSERT_TRUE(powerstats->getEnergyConsumerInfo(&consumers).isOk());
+
+ testUnique(consumers, &EnergyConsumer::name);
+}
+
+// Energy consumers of the same type must have ordinals that are 0,1,2,..., N - 1
+TEST_P(PowerStatsAidl, ValidateEnergyConsumerOrdinals) {
+ std::vector<EnergyConsumer> consumers;
+ ASSERT_TRUE(powerstats->getEnergyConsumerInfo(&consumers).isOk());
+
+ std::unordered_map<EnergyConsumerType, std::set<int32_t>> ordinalMap;
+
+ // Ordinals must be unique for each type
+ for (auto consumer : consumers) {
+ EXPECT_TRUE(ordinalMap[consumer.type].insert(consumer.ordinal).second);
+ }
+
+ // Min ordinal must be 0, max ordinal must be N - 1
+ for (const auto& [unused, ordinals] : ordinalMap) {
+ EXPECT_EQ(0, *std::min_element(ordinals.begin(), ordinals.end()));
+ EXPECT_EQ(ordinals.size() - 1, *std::max_element(ordinals.begin(), ordinals.end()));
+ }
+}
+
+// Energy consumed must return a valid status
+TEST_P(PowerStatsAidl, TestGetEnergyConsumed) {
+ std::vector<EnergyConsumerResult> results;
+ ASSERT_TRUE(powerstats->getEnergyConsumed({}, &results).isOk());
+}
+
+// Energy consumed must return data for all energy consumers
+TEST_P(PowerStatsAidl, TestGetAllEnergyConsumed) {
+ std::vector<EnergyConsumer> consumers;
+ ASSERT_TRUE(powerstats->getEnergyConsumerInfo(&consumers).isOk());
+
+ std::vector<EnergyConsumerResult> results;
+ ASSERT_TRUE(powerstats->getEnergyConsumed({}, &results).isOk());
+
+ testMatching(consumers, &EnergyConsumer::id, results, &EnergyConsumerResult::id);
+}
+
+// Energy consumed must return data for each selected energy consumer
+TEST_P(PowerStatsAidl, TestGetSelectedEnergyConsumed) {
+ std::vector<EnergyConsumer> consumers;
+ ASSERT_TRUE(powerstats->getEnergyConsumerInfo(&consumers).isOk());
+ if (consumers.empty()) {
+ return;
+ }
+
+ std::vector<EnergyConsumer> selectedConsumers = getRandomSubset(consumers);
+ std::vector<int32_t> selectedIds;
+ for (auto const& consumer : selectedConsumers) {
+ selectedIds.push_back(consumer.id);
+ }
+
+ std::vector<EnergyConsumerResult> selectedResults;
+ ASSERT_TRUE(powerstats->getEnergyConsumed(selectedIds, &selectedResults).isOk());
+
+ testMatching(selectedConsumers, &EnergyConsumer::id, selectedResults,
+ &EnergyConsumerResult::id);
+}
+
+// Energy consumed attribution uids must be unique for a given energy consumer
+TEST_P(PowerStatsAidl, ValidateEnergyConsumerAttributionUniqueUids) {
+ std::vector<EnergyConsumerResult> results;
+ ASSERT_TRUE(powerstats->getEnergyConsumed({}, &results).isOk());
+
+ for (auto result : results) {
+ testUnique(result.attribution, &EnergyConsumerAttribution::uid);
+ }
+}
+
+// Energy consumed total energy >= sum total of uid-attributed energy
+TEST_P(PowerStatsAidl, TestGetEnergyConsumedAttributedEnergy) {
+ std::vector<EnergyConsumerResult> results;
+ ASSERT_TRUE(powerstats->getEnergyConsumed({}, &results).isOk());
+
+ for (auto result : results) {
+ int64_t totalAttributedEnergyUWs = 0;
+ for (auto attribution : result.attribution) {
+ totalAttributedEnergyUWs += attribution.energyUWs;
+ }
+ EXPECT_TRUE(result.energyUWs >= totalAttributedEnergyUWs);
+ }
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PowerStatsAidl);
INSTANTIATE_TEST_SUITE_P(
PowerStats, PowerStatsAidl,
diff --git a/radio/1.6/IRadio.hal b/radio/1.6/IRadio.hal
index 1862800..7bb3536 100644
--- a/radio/1.6/IRadio.hal
+++ b/radio/1.6/IRadio.hal
@@ -18,9 +18,12 @@
import @1.0::CdmaSmsMessage;
+import @1.0::Dial;
import @1.0::GsmSmsMessage;
import @1.1::CardPowerState;
import @1.2::DataRequestReason;
+import @1.4::EmergencyCallRouting;
+import @1.4::EmergencyServiceCategory;
import @1.4::RadioAccessFamily;
import @1.5::IRadio;
import @1.5::AccessNetwork;
@@ -120,6 +123,18 @@
* @param sliceInfo SliceInfo to be used for the data connection when a handover occurs from
* EPDG to 5G. It is valid only when accessNetwork is AccessNetwork:NGRAN. If the slice
* passed from EPDG is rejected, then the data failure cause must be DataCallFailCause:SLICE_REJECTED.
+ * @param trafficDescriptor TrafficDescriptor for which data connection needs to be
+ * established. It is used for URSP traffic matching as described in TS 24.526
+ * Section 4.2.2. It includes an optional DNN which, if present, must be used for traffic
+ * matching -- it does not specify the end point to be used for the data call. The end
+ * point is specified by DataProfileInfo.apn; DataProfileInfo.apn must be used as the end
+ * point if one is not specified through URSP rules.
+ * @param matchAllRuleAllowed bool to indicate if using default match-all URSP rule for this
+ * request is allowed. If false, this request must not use the match-all URSP rule and if
+ * a non-match-all rule is not found (or if URSP rules are not available) it should return
+ * failure with cause DataCallFailCause:MATCH_ALL_RULE_NOT_ALLOWED. This is needed as some
+ * requests need to have a hard failure if the intention cannot be met, for example, a
+ * zero-rating slice.
*
* Response function is IRadioResponse.setupDataCallResponse_1_6()
*
@@ -128,7 +143,8 @@
oneway setupDataCall_1_6(int32_t serial, AccessNetwork accessNetwork,
DataProfileInfo dataProfileInfo, bool roamingAllowed,
DataRequestReason reason, vec<LinkAddress> addresses, vec<string> dnses,
- int32_t pduSessionId, OptionalSliceInfo sliceInfo);
+ int32_t pduSessionId, OptionalSliceInfo sliceInfo,
+ OptionalTrafficDescriptor trafficDescriptor, bool matchAllRuleAllowed);
/**
* Send an SMS message
@@ -374,6 +390,64 @@
int64_t completionDurationMillis);
/**
+ * Initiate emergency voice call, with zero or more emergency service category(s), zero or
+ * more emergency Uniform Resource Names (URN), and routing information for handling the call.
+ * Android uses this request to make its emergency call instead of using @1.0::IRadio.dial
+ * if the 'address' in the 'dialInfo' field is identified as an emergency number by Android.
+ *
+ * In multi-sim scenario, if the emergency number is from a specific subscription, this radio
+ * request can still be sent out on the other subscription as long as routing is set to
+ * @1.4::EmergencyNumberRouting#EMERGENCY. This radio request will not be sent on an inactive
+ * (PIN/PUK locked) subscription unless both subscriptions are PIN/PUK locked. In this case,
+ * the request will be sent on the primary subscription.
+ *
+ * Some countries or carriers require some emergency numbers that must be handled with normal
+ * call routing if possible or emergency routing. 1) if the 'routing' field is specified as
+ * @1.4::EmergencyNumberRouting#NORMAL, the implementation must try the full radio service to
+ * use normal call routing to handle the call; if service cannot support normal routing, the
+ * implementation must use emergency routing to handle the call. 2) if 'routing' is specified
+ * as @1.4::EmergencyNumberRouting#EMERGENCY, the implementation must use emergency routing to
+ * handle the call. 3) if 'routing' is specified as @1.4::EmergencyNumberRouting#UNKNOWN,
+ * Android does not know how to handle the call.
+ *
+ * If the dialed emergency number does not have a specified emergency service category, the
+ * 'categories' field is set to @1.4::EmergencyServiceCategory#UNSPECIFIED; if the dialed
+ * emergency number does not have specified emergency Uniform Resource Names, the 'urns' field
+ * is set to an empty list. If the underlying technology used to request emergency services
+ * does not support the emergency service category or emergency uniform resource names, the
+ * field 'categories' or 'urns' may be ignored.
+ *
+ * In the scenarios that the 'address' in the 'dialInfo' field has other functions besides the
+ * emergency number function, if the 'hasKnownUserIntentEmergency' field is true, the user's
+ * intent for this dial request is emergency call, and the modem must treat this as an actual
+ * emergency dial; if the 'hasKnownUserIntentEmergency' field is false, Android does not know
+ * user's intent for this call.
+ *
+ * If 'isTesting' is true, this request is for testing purpose, and must not be sent to a real
+ * emergency service; otherwise it's for a real emergency call request.
+ *
+ * Reference: 3gpp 22.101, Section 10 - Emergency Calls;
+ * 3gpp 23.167, Section 6 - Functional description;
+ * 3gpp 24.503, Section 5.1.6.8.1 - General;
+ * RFC 5031
+ *
+ * @param serial Serial number of request.
+ * @param dialInfo the same @1.0::Dial information used by @1.0::IRadio.dial.
+ * @param categories bitfield<@1.4::EmergencyServiceCategory> the Emergency Service Category(s)
+ * of the call.
+ * @param urns the emergency Uniform Resource Names (URN)
+ * @param routing @1.4::EmergencyCallRouting the emergency call routing information.
+ * @param hasKnownUserIntentEmergency Flag indicating if user's intent for the emergency call
+ * is known.
+ * @param isTesting Flag indicating if this request is for testing purpose.
+ *
+ * Response function is IRadioResponse.emergencyDialResponse()
+ */
+ oneway emergencyDial_1_6(int32_t serial, Dial dialInfo,
+ bitfield<EmergencyServiceCategory> categories, vec<string> urns,
+ EmergencyCallRouting routing, bool hasKnownUserIntentEmergency, bool isTesting);
+
+ /**
* Get which bands the modem's background scan is acting on.
*
* @param serial Serial number of request.
diff --git a/radio/1.6/types.hal b/radio/1.6/types.hal
index 4eaf7be..c02a43f 100644
--- a/radio/1.6/types.hal
+++ b/radio/1.6/types.hal
@@ -365,6 +365,13 @@
* AccessNetwork:NGRAN.
*/
OptionalSliceInfo sliceInfo;
+
+ /**
+ * TrafficDescriptors for which this data call must be used. It only includes
+ * the TDs for which a data call has been requested so far; it is not an
+ * exhaustive list.
+ */
+ vec<TrafficDescriptor> trafficDescriptors;
};
/**
@@ -737,6 +744,14 @@
*/
NrVopsInfo nrVopsInfo;
} ngranInfo;
+
+ struct GeranRegistrationInfo {
+ /**
+ * True if the dual transfer mode is supported.
+ * Refer to 3GPP TS 44.108 section 3.4.25.3
+ */
+ bool dtmSupported;
+ } geranInfo;
} accessTechnologySpecificInfo;
};
@@ -824,6 +839,16 @@
* Data call fail due to the slice not being allowed for the data call.
*/
SLICE_REJECTED = 0x8CC,
+
+ /**
+ * No matching rule available for the request, and match-all rule is not allowed for it.
+ */
+ MATCH_ALL_RULE_NOT_ALLOWED = 0x8CD,
+
+ /**
+ * If connection failed for all matching URSP rules
+ */
+ ALL_MATCHING_RULES_FAILED = 0x8CE,
};
struct PhysicalChannelConfig {
@@ -892,3 +917,57 @@
BAND_53 = 53,
BAND_96 = 96,
};
+
+/**
+ * This safe_union represents an optional DNN. DNN stands for Data Network Name
+ * and represents an APN as defined in 3GPP TS 23.003.
+ */
+safe_union OptionalDNN {
+ Monostate noinit;
+ string value;
+};
+
+/**
+ * This safe_union represents an optional OSAppId.
+ */
+safe_union OptionalOSAppId {
+ Monostate noinit;
+ OSAppId value;
+};
+
+/**
+ * This safe_union represents an optional TrafficDescriptor.
+ */
+safe_union OptionalTrafficDescriptor {
+ Monostate noinit;
+ TrafficDescriptor value;
+};
+
+/**
+ * This struct represents a traffic descriptor. A valid struct must have at least
+ * one of the optional values present. This is based on the definition of traffic
+ * descriptor in TS 24.526 Section 5.2.
+ */
+struct TrafficDescriptor {
+ /**
+ * DNN stands for Data Network Name and represents an APN as defined in
+ * 3GPP TS 23.003.
+ */
+ OptionalDNN dnn;
+ /**
+ * Indicates the OSId + OSAppId (used as category in Android).
+ */
+ OptionalOSAppId osAppId;
+};
+
+/**
+ * This struct represents the OSId + OSAppId as defined in TS 24.526 Section 5.2
+ */
+struct OSAppId {
+ /**
+ * Byte array representing OSId + OSAppId. The minimum length of the array is
+ * 18 and maximum length is 272 (16 bytes for OSId + 1 byte for OSAppId length
+ * + up to 255 bytes for OSAppId).
+ */
+ vec<uint8_t> osAppId;
+};
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
index 8b87292..be24535 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
@@ -59,9 +59,15 @@
::android::hardware::radio::V1_6::OptionalSliceInfo optionalSliceInfo;
memset(&optionalSliceInfo, 0, sizeof(optionalSliceInfo));
+ ::android::hardware::radio::V1_6::OptionalTrafficDescriptor optionalTrafficDescriptor;
+ memset(&optionalTrafficDescriptor, 0, sizeof(optionalTrafficDescriptor));
+
+ bool matchAllRuleAllowed = true;
+
Return<void> res =
radio_v1_6->setupDataCall_1_6(serial, accessNetwork, dataProfileInfo, roamingAllowed,
- reason, addresses, dnses, -1, optionalSliceInfo);
+ reason, addresses, dnses, -1, optionalSliceInfo,
+ optionalTrafficDescriptor, matchAllRuleAllowed);
ASSERT_OK(res);
EXPECT_EQ(std::cv_status::no_timeout, wait());
@@ -82,6 +88,81 @@
}
}
+TEST_P(RadioHidlTest_v1_6, setupDataCall_1_6_osAppId) {
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_5::AccessNetwork accessNetwork =
+ ::android::hardware::radio::V1_5::AccessNetwork::EUTRAN;
+
+ android::hardware::radio::V1_5::DataProfileInfo dataProfileInfo;
+ memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+ dataProfileInfo.profileId = DataProfileId::DEFAULT;
+ dataProfileInfo.apn = hidl_string("internet");
+ dataProfileInfo.protocol = PdpProtocolType::IP;
+ dataProfileInfo.roamingProtocol = PdpProtocolType::IP;
+ dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+ dataProfileInfo.user = hidl_string("username");
+ dataProfileInfo.password = hidl_string("password");
+ dataProfileInfo.type = DataProfileInfoType::THREE_GPP;
+ dataProfileInfo.maxConnsTime = 300;
+ dataProfileInfo.maxConns = 20;
+ dataProfileInfo.waitTime = 0;
+ dataProfileInfo.enabled = true;
+ dataProfileInfo.supportedApnTypesBitmap = 320;
+ dataProfileInfo.bearerBitmap = 161543;
+ dataProfileInfo.mtuV4 = 0;
+ dataProfileInfo.mtuV6 = 0;
+ dataProfileInfo.preferred = true;
+ dataProfileInfo.persistent = false;
+
+ bool roamingAllowed = false;
+
+ std::vector<::android::hardware::radio::V1_5::LinkAddress> addresses = {};
+ std::vector<hidl_string> dnses = {};
+
+ ::android::hardware::radio::V1_2::DataRequestReason reason =
+ ::android::hardware::radio::V1_2::DataRequestReason::NORMAL;
+
+ ::android::hardware::radio::V1_6::OptionalSliceInfo optionalSliceInfo;
+ memset(&optionalSliceInfo, 0, sizeof(optionalSliceInfo));
+
+ ::android::hardware::radio::V1_6::OptionalTrafficDescriptor optionalTrafficDescriptor;
+ memset(&optionalTrafficDescriptor, 0, sizeof(optionalTrafficDescriptor));
+
+ ::android::hardware::radio::V1_6::TrafficDescriptor trafficDescriptor;
+ ::android::hardware::radio::V1_6::OSAppId osAppId;
+ osAppId.osAppId = 1;
+ trafficDescriptor.osAppId.value(osAppId);
+ optionalTrafficDescriptor.value(trafficDescriptor);
+
+ bool matchAllRuleAllowed = true;
+
+ Return<void> res =
+ radio_v1_6->setupDataCall_1_6(serial, accessNetwork, dataProfileInfo, roamingAllowed,
+ reason, addresses, dnses, -1, optionalSliceInfo,
+ optionalTrafficDescriptor, matchAllRuleAllowed);
+ ASSERT_OK(res);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial);
+ if (cardStatus.base.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::SIM_ABSENT,
+ ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
+ ::android::hardware::radio::V1_6::RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_6->rspInfo.error,
+ {::android::hardware::radio::V1_6::RadioError::NONE,
+ ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
+ ::android::hardware::radio::V1_6::RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW}));
+ EXPECT_EQ(optionalTrafficDescriptor.value().osAppId.value().osAppId,
+ radioRsp_v1_6->setupDataCallResult.trafficDescriptors[0].osAppId.value().osAppId);
+ }
+}
+
/*
* Test IRadio_1_6.sendSms() for the response returned.
*/
@@ -412,6 +493,167 @@
}
/*
+ * Test IRadio.emergencyDial() for the response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, emergencyDial_1_6) {
+ if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
+ ALOGI("Skipping emergencyDial because voice call is not supported in device");
+ return;
+ } else {
+ ALOGI("Running emergencyDial because voice call is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_0::Dial dialInfo;
+ dialInfo.address = hidl_string("911");
+ int categories = static_cast<int>(
+ ::android::hardware::radio::V1_4::EmergencyServiceCategory::UNSPECIFIED);
+ std::vector<hidl_string> urns = {""};
+ ::android::hardware::radio::V1_4::EmergencyCallRouting routing =
+ ::android::hardware::radio::V1_4::EmergencyCallRouting::UNKNOWN;
+
+ Return<void> res =
+ radio_v1_6->emergencyDial_1_6(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo_v1_0.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo_v1_0.serial);
+
+ ALOGI("emergencyDial, rspInfo_v1_0.error = %s\n",
+ toString(radioRsp_v1_6->rspInfo_v1_0.error).c_str());
+
+ ::android::hardware::radio::V1_0::RadioError rspEmergencyDial =
+ radioRsp_v1_6->rspInfo_v1_0.error;
+ // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
+ // or Emergency_Only.
+ if (isDsDsEnabled() || isTsTsEnabled()) {
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getVoiceRegistrationState(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ EXPECT_EQ(::android::hardware::radio::V1_0::RadioError::NONE, rspEmergencyDial);
+ }
+ } else {
+ EXPECT_EQ(::android::hardware::radio::V1_0::RadioError::NONE, rspEmergencyDial);
+ }
+
+ // Give some time for modem to establish the emergency call channel.
+ sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
+
+ // Disconnect all the potential established calls to prevent them affecting other tests.
+ clearPotentialEstablishedCalls();
+}
+
+/*
+ * Test IRadio.emergencyDial() with specified service and its response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, emergencyDial_1_6_withServices) {
+ if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
+ ALOGI("Skipping emergencyDial because voice call is not supported in device");
+ return;
+ } else {
+ ALOGI("Running emergencyDial because voice call is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_0::Dial dialInfo;
+ dialInfo.address = hidl_string("911");
+ int categories =
+ static_cast<int>(::android::hardware::radio::V1_4::EmergencyServiceCategory::AMBULANCE);
+ std::vector<hidl_string> urns = {"urn:service:sos.ambulance"};
+ ::android::hardware::radio::V1_4::EmergencyCallRouting routing =
+ ::android::hardware::radio::V1_4::EmergencyCallRouting::UNKNOWN;
+
+ Return<void> res =
+ radio_v1_6->emergencyDial_1_6(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo_v1_0.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo_v1_0.serial);
+
+ ALOGI("emergencyDial_withServices, rspInfo_v1_0.error = %s\n",
+ toString(radioRsp_v1_6->rspInfo_v1_0.error).c_str());
+ ::android::hardware::radio::V1_0::RadioError rspEmergencyDial =
+ radioRsp_v1_6->rspInfo_v1_0.error;
+
+ // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
+ // or Emergency_Only.
+ if (isDsDsEnabled() || isTsTsEnabled()) {
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getVoiceRegistrationState(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ EXPECT_EQ(::android::hardware::radio::V1_0::RadioError::NONE, rspEmergencyDial);
+ }
+ } else {
+ EXPECT_EQ(::android::hardware::radio::V1_0::RadioError::NONE, rspEmergencyDial);
+ }
+ // Give some time for modem to establish the emergency call channel.
+ sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
+
+ // Disconnect all the potential established calls to prevent them affecting other tests.
+ clearPotentialEstablishedCalls();
+}
+
+/*
+ * Test IRadio.emergencyDial() with known emergency call routing and its response returned.
+ */
+TEST_P(RadioHidlTest_v1_6, emergencyDial_1_6_withEmergencyRouting) {
+ if (!deviceSupportsFeature(FEATURE_VOICE_CALL)) {
+ ALOGI("Skipping emergencyDial because voice call is not supported in device");
+ return;
+ } else {
+ ALOGI("Running emergencyDial because voice call is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_0::Dial dialInfo;
+ dialInfo.address = hidl_string("911");
+ int categories = static_cast<int>(
+ ::android::hardware::radio::V1_4::EmergencyServiceCategory::UNSPECIFIED);
+ std::vector<hidl_string> urns = {""};
+ ::android::hardware::radio::V1_4::EmergencyCallRouting routing =
+ ::android::hardware::radio::V1_4::EmergencyCallRouting::EMERGENCY;
+
+ Return<void> res =
+ radio_v1_6->emergencyDial_1_6(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo_v1_0.type);
+ EXPECT_EQ(serial, radioRsp_v1_6->rspInfo_v1_0.serial);
+
+ ALOGI("emergencyDial_withEmergencyRouting, rspInfo_v1_0.error = %s\n",
+ toString(radioRsp_v1_6->rspInfo_v1_0.error).c_str());
+ ::android::hardware::radio::V1_0::RadioError rspEmergencyDial =
+ radioRsp_v1_6->rspInfo_v1_0.error;
+
+ // In DSDS or TSTS, we only check the result if the current slot is IN_SERVICE
+ // or Emergency_Only.
+ if (isDsDsEnabled() || isTsTsEnabled()) {
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getVoiceRegistrationState(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ if (isVoiceEmergencyOnly(radioRsp_v1_6->voiceRegResp.regState) ||
+ isVoiceInService(radioRsp_v1_6->voiceRegResp.regState)) {
+ EXPECT_EQ(::android::hardware::radio::V1_0::RadioError::NONE, rspEmergencyDial);
+ }
+ } else {
+ EXPECT_EQ(::android::hardware::radio::V1_0::RadioError::NONE, rspEmergencyDial);
+ }
+
+ // Give some time for modem to establish the emergency call channel.
+ sleep(MODEM_EMERGENCY_CALL_ESTABLISH_TIME);
+
+ // Disconnect all the potential established calls to prevent them affecting other tests.
+ clearPotentialEstablishedCalls();
+}
+
+/*
* Test IRadio.getCurrentCalls_1_6() for the response returned.
*/
TEST_P(RadioHidlTest_v1_6, getCurrentCalls_1_6) {
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_test.cpp b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp
index 79c3cde..59f7682 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_test.cpp
@@ -74,6 +74,29 @@
return status;
}
+void RadioHidlTest_v1_6::clearPotentialEstablishedCalls() {
+ // Get the current call Id to hangup the established emergency call.
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getCurrentCalls_1_6(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+
+ // Hang up to disconnect the established call channels.
+ for (const ::android::hardware::radio::V1_6::Call& call : radioRsp_v1_6->currentCalls) {
+ serial = GetRandomSerialNumber();
+ radio_v1_6->hangup(serial, call.base.base.index);
+ ALOGI("Hang up to disconnect the established call channel: %d", call.base.base.index);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ // Give some time for modem to disconnect the established call channel.
+ sleep(MODEM_EMERGENCY_CALL_DISCONNECT_TIME);
+ }
+
+ // Verify there are no more current calls.
+ serial = GetRandomSerialNumber();
+ radio_v1_6->getCurrentCalls_1_6(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(0, radioRsp_v1_6->currentCalls.size());
+}
+
void RadioHidlTest_v1_6::updateSimCardStatus() {
serial = GetRandomSerialNumber();
radio_v1_6->getIccCardStatus(serial);
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
index 334fec3..010d36b 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
+++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
@@ -70,7 +70,8 @@
::android::hardware::radio::V1_6::RadioResponseInfo rspInfo;
// Call
- hidl_vec<::android::hardware::radio::V1_2::Call> currentCalls;
+ hidl_vec<::android::hardware::radio::V1_6::Call> currentCalls;
+ ::android::hardware::radio::V1_2::VoiceRegStateResult voiceRegResp;
// Sms
SendSmsResult sendSmsResult;
@@ -88,6 +89,7 @@
// Data
::android::hardware::radio::V1_4::DataRegStateResult dataRegResp;
+ ::android::hardware::radio::V1_6::SetupDataCallResult setupDataCallResult;
// SimLock status
::android::hardware::radio::V1_4::CarrierRestrictionsWithPriority carrierRestrictionsResp;
diff --git a/radio/1.6/vts/functional/radio_response.cpp b/radio/1.6/vts/functional/radio_response.cpp
index 100fabd..81f4f10 100644
--- a/radio/1.6/vts/functional/radio_response.cpp
+++ b/radio/1.6/vts/functional/radio_response.cpp
@@ -816,8 +816,11 @@
}
Return<void> RadioResponse_v1_6::getVoiceRegistrationStateResponse_1_2(
- const ::android::hardware::radio::V1_0::RadioResponseInfo& /*info*/,
- const ::android::hardware::radio::V1_2::VoiceRegStateResult& /*voiceRegResponse*/) {
+ const ::android::hardware::radio::V1_0::RadioResponseInfo& info,
+ const ::android::hardware::radio::V1_2::VoiceRegStateResult& voiceRegResponse) {
+ rspInfo_v1_0 = info;
+ voiceRegResp = voiceRegResponse;
+ parent_v1_6.notify(info.serial);
return Void();
}
@@ -1050,8 +1053,9 @@
Return<void> RadioResponse_v1_6::setupDataCallResponse_1_6(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
- const android::hardware::radio::V1_6::SetupDataCallResult& /* dcResponse */) {
+ const android::hardware::radio::V1_6::SetupDataCallResult& dcResponse) {
rspInfo = info;
+ setupDataCallResult = dcResponse;
parent_v1_6.notify(info.serial);
return Void();
}
@@ -1210,8 +1214,9 @@
Return<void> RadioResponse_v1_6::getCurrentCallsResponse_1_6(
const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
- const ::android::hardware::hidl_vec<::android::hardware::radio::V1_6::Call>& /*calls*/) {
+ const ::android::hardware::hidl_vec<::android::hardware::radio::V1_6::Call>& calls) {
rspInfo = info;
+ currentCalls = calls;
parent_v1_6.notify(info.serial);
return Void();
}
diff --git a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl
index bc07235..f52e32b 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl
@@ -27,7 +27,7 @@
* data are stored in KeyParameter.
*/
@VintfStability
-@Backing(type = "int")
+@Backing(type="int")
enum Tag {
/**
* Tag::INVALID should never be set. It means you hit an error.
@@ -82,7 +82,6 @@
*/
BLOCK_MODE = (2 << 28) /* TagType:ENUM_REP */ | 4,
-
/**
* Tag::DIGEST specifies the digest algorithms that may be used with the key to perform signing
* and verification operations. This tag is relevant to RSA, ECDSA and HMAC keys. Possible
@@ -187,21 +186,21 @@
*/
INCLUDE_UNIQUE_ID = (7 << 28) /* TagType:BOOL */ | 202,
- /**
- * Tag::RSA_OAEP_MGF_DIGEST specifies the MGF1 digest algorithms that may be used with
- * RSA encryption/decryption with OAEP padding. If the key characteristics supports OAEP
- * and this tag is absent then SHA1 digest is selected by default for MGF1.
- *
- * This tag is repeatable for key generation/import. If this tag is present in the key
- * characteristics with one or more values from @4.0::Digest, then for RSA cipher
- * operations with OAEP Padding, the caller must specify a digest in the additionalParams
- * argument of begin operation. If this tag is missing or the specified digest is not in
- * the digests associated with the key then begin operation must fail with
- * ErrorCode::INCOMPATIBLE_MGF_DIGEST.
- *
- * Must be hardware-enforced.
- */
- RSA_OAEP_MGF_DIGEST = (2 << 28) /* TagType:ENUM_REP */ | 203,
+ /**
+ * Tag::RSA_OAEP_MGF_DIGEST specifies the MGF1 digest algorithms that may be used with
+ * RSA encryption/decryption with OAEP padding. If the key characteristics supports OAEP
+ * and this tag is absent then SHA1 digest is selected by default for MGF1.
+ *
+ * This tag is repeatable for key generation/import. If this tag is present in the key
+ * characteristics with one or more values from @4.0::Digest, then for RSA cipher
+ * operations with OAEP Padding, the caller must specify a digest in the additionalParams
+ * argument of begin operation. If this tag is missing or the specified digest is not in
+ * the digests associated with the key then begin operation must fail with
+ * ErrorCode::INCOMPATIBLE_MGF_DIGEST.
+ *
+ * Must be hardware-enforced.
+ */
+ RSA_OAEP_MGF_DIGEST = (2 << 28) /* TagType:ENUM_REP */ | 203,
/**
* TODO(seleneh) this tag needs to be deleted from all codes.
@@ -346,14 +345,14 @@
* At this point, if the caller specifies count > 1, it is not expected that any TEE will be
* able to enforce this feature in the hardware due to limited resources of secure
* storage. In this case, the tag with the value of maximum usage must be added to the key
- * characteristics with SecurityLevel::SOFTWARE by the IKeyMintDevice.
+ * characteristics with SecurityLevel::KEYSTORE by the IKeyMintDevice.
*
* On the other hand, if the caller specifies count = 1, some TEEs may have the ability
* to enforce this feature in the hardware with its secure storage. If the IKeyMintDevice
* implementation can enforce this feature, the tag with value = 1 must be added to the key
* characteristics with the SecurityLevel of the IKeyMintDevice. If the IKeyMintDevice can't
* enforce this feature even when the count = 1, the tag must be added to the key
- * characteristics with the SecurityLevel::SOFTWARE.
+ * characteristics with the SecurityLevel::KEYSTORE.
*
* When the key is attested, this tag with the same value must also be added to the attestation
* record. This tag must have the same SecurityLevel as the tag that is added to the key
@@ -497,7 +496,8 @@
*/
TRUSTED_USER_PRESENCE_REQUIRED = (7 << 28) /* TagType:BOOL */ | 507,
- /** Tag::TRUSTED_CONFIRMATION_REQUIRED is only applicable to keys with KeyPurpose SIGN, and
+ /**
+ * Tag::TRUSTED_CONFIRMATION_REQUIRED is only applicable to keys with KeyPurpose SIGN, and
* specifies that this key must not be usable unless the user provides confirmation of the data
* to be signed. Confirmation is proven to keyMint via an approval token. See
* CONFIRMATION_TOKEN, as well as the ConfirmatinUI HAL.
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index 766c02d..6555157 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -55,6 +55,9 @@
for (auto& entry : key_characteristics) {
if (entry.authorizations.empty()) return false;
+ // Just ignore the SecurityLevel::KEYSTORE as the KM won't do any enforcement on this.
+ if (entry.securityLevel == SecurityLevel::KEYSTORE) continue;
+
if (levels_seen.find(entry.securityLevel) != levels_seen.end()) return false;
levels_seen.insert(entry.securityLevel);
@@ -824,22 +827,36 @@
return (found == key_characteristics.end()) ? kEmptyAuthList : found->authorizations;
}
-const vector<KeyParameter>& KeyMintAidlTestBase::HwEnforcedAuthorizations(
- const vector<KeyCharacteristics>& key_characteristics) {
- auto found =
- std::find_if(key_characteristics.begin(), key_characteristics.end(), [](auto& entry) {
- return entry.securityLevel == SecurityLevel::STRONGBOX ||
- entry.securityLevel == SecurityLevel::TRUSTED_ENVIRONMENT;
- });
+const vector<KeyParameter>& KeyMintAidlTestBase::SecLevelAuthorizations(
+ const vector<KeyCharacteristics>& key_characteristics, SecurityLevel securityLevel) {
+ auto found = std::find_if(
+ key_characteristics.begin(), key_characteristics.end(),
+ [securityLevel](auto& entry) { return entry.securityLevel == securityLevel; });
return (found == key_characteristics.end()) ? kEmptyAuthList : found->authorizations;
}
-const vector<KeyParameter>& KeyMintAidlTestBase::SwEnforcedAuthorizations(
+AuthorizationSet KeyMintAidlTestBase::HwEnforcedAuthorizations(
const vector<KeyCharacteristics>& key_characteristics) {
- auto found = std::find_if(
- key_characteristics.begin(), key_characteristics.end(),
- [](auto& entry) { return entry.securityLevel == SecurityLevel::SOFTWARE; });
- return (found == key_characteristics.end()) ? kEmptyAuthList : found->authorizations;
+ AuthorizationSet authList;
+ for (auto& entry : key_characteristics) {
+ if (entry.securityLevel == SecurityLevel::STRONGBOX ||
+ entry.securityLevel == SecurityLevel::TRUSTED_ENVIRONMENT) {
+ authList.push_back(AuthorizationSet(entry.authorizations));
+ }
+ }
+ return authList;
+}
+
+AuthorizationSet KeyMintAidlTestBase::SwEnforcedAuthorizations(
+ const vector<KeyCharacteristics>& key_characteristics) {
+ AuthorizationSet authList;
+ for (auto& entry : key_characteristics) {
+ if (entry.securityLevel == SecurityLevel::SOFTWARE ||
+ entry.securityLevel == SecurityLevel::KEYSTORE) {
+ authList.push_back(AuthorizationSet(entry.authorizations));
+ }
+ }
+ return authList;
}
} // namespace test
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
index c1a1dd9..780971d 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
@@ -175,9 +175,12 @@
inline const vector<KeyParameter>& SecLevelAuthorizations() {
return SecLevelAuthorizations(key_characteristics_);
}
- const vector<KeyParameter>& HwEnforcedAuthorizations(
+ const vector<KeyParameter>& SecLevelAuthorizations(
+ const vector<KeyCharacteristics>& key_characteristics, SecurityLevel securityLevel);
+
+ AuthorizationSet HwEnforcedAuthorizations(
const vector<KeyCharacteristics>& key_characteristics);
- const vector<KeyParameter>& SwEnforcedAuthorizations(
+ AuthorizationSet SwEnforcedAuthorizations(
const vector<KeyCharacteristics>& key_characteristics);
private:
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index c876440..c849bad 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -646,6 +646,61 @@
}
/*
+ * NewKeyGenerationTest.LimitedUsageRsaWithAttestation
+ *
+ * Verifies that KeyMint can generate all required RSA key sizes with limited usage, and that the
+ * resulting keys have correct characteristics and attestation.
+ */
+TEST_P(NewKeyGenerationTest, LimitedUsageRsaWithAttestation) {
+ for (auto key_size : ValidKeySizes(Algorithm::RSA)) {
+ auto challenge = "hello";
+ auto app_id = "foo";
+
+ vector<uint8_t> key_blob;
+ vector<KeyCharacteristics> key_characteristics;
+ ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+ .RsaSigningKey(key_size, 65537)
+ .Digest(Digest::NONE)
+ .Padding(PaddingMode::NONE)
+ .AttestationChallenge(challenge)
+ .AttestationApplicationId(app_id)
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .Authorization(TAG_USAGE_COUNT_LIMIT, 1),
+ &key_blob, &key_characteristics));
+
+ ASSERT_GT(key_blob.size(), 0U);
+ CheckBaseParams(key_characteristics);
+
+ AuthorizationSet crypto_params = SecLevelAuthorizations(key_characteristics);
+
+ EXPECT_TRUE(crypto_params.Contains(TAG_ALGORITHM, Algorithm::RSA));
+ EXPECT_TRUE(crypto_params.Contains(TAG_KEY_SIZE, key_size))
+ << "Key size " << key_size << "missing";
+ EXPECT_TRUE(crypto_params.Contains(TAG_RSA_PUBLIC_EXPONENT, 65537U));
+
+ // Check the usage count limit tag appears in the authorizations.
+ AuthorizationSet auths;
+ for (auto& entry : key_characteristics) {
+ auths.push_back(AuthorizationSet(entry.authorizations));
+ }
+ EXPECT_TRUE(auths.Contains(TAG_USAGE_COUNT_LIMIT, 1U))
+ << "key usage count limit " << 1U << " missing";
+
+ // Check the usage count limit tag also appears in the attestation.
+ EXPECT_TRUE(verify_chain(cert_chain_));
+ ASSERT_GT(cert_chain_.size(), 0);
+
+ AuthorizationSet hw_enforced = HwEnforcedAuthorizations(key_characteristics);
+ AuthorizationSet sw_enforced = SwEnforcedAuthorizations(key_characteristics);
+ EXPECT_TRUE(verify_attestation_record(challenge, app_id, //
+ sw_enforced, hw_enforced, SecLevel(),
+ cert_chain_[0].encodedCertificate));
+
+ CheckedDeleteKey(&key_blob);
+ }
+}
+
+/*
* NewKeyGenerationTest.NoInvalidRsaSizes
*
* Verifies that keymint cannot generate any RSA key sizes that are designated as invalid.
@@ -4297,11 +4352,11 @@
typedef KeyMintAidlTestBase UsageCountLimitTest;
/*
- * UsageCountLimitTest.TestLimitAes
+ * UsageCountLimitTest.TestSingleUseAes
*
- * Verifies that the usage count limit tag works correctly with AES keys.
+ * Verifies that the usage count limit tag = 1 works correctly with AES keys.
*/
-TEST_P(UsageCountLimitTest, TestLimitAes) {
+TEST_P(UsageCountLimitTest, TestSingleUseAes) {
if (SecLevel() == SecurityLevel::STRONGBOX) return;
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
@@ -4322,31 +4377,75 @@
string message = "1234567890123456";
auto params = AuthorizationSetBuilder().EcbMode().Padding(PaddingMode::NONE);
+ AuthorizationSet hardware_auths = HwEnforcedAuthorizations(key_characteristics_);
+ AuthorizationSet keystore_auths =
+ SecLevelAuthorizations(key_characteristics_, SecurityLevel::KEYSTORE);
+
// First usage of AES key should work.
EncryptMessage(message, params);
- AuthorizationSet hardware_auths;
- for (auto& entry : key_characteristics_) {
- if (entry.securityLevel != SecurityLevel::SOFTWARE) {
- auths.push_back(AuthorizationSet(entry.authorizations));
- }
- }
if (hardware_auths.Contains(TAG_USAGE_COUNT_LIMIT, 1U)) {
// Usage count limit tag is enforced by hardware. After using the key, the key blob
// must be invalidated from secure storage (such as RPMB partition).
EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB, Begin(KeyPurpose::ENCRYPT, params));
} else {
- // Usage count limit tag is enforced by software, keymint does nothing.
+ // Usage count limit tag is enforced by keystore, keymint does nothing.
+ EXPECT_TRUE(keystore_auths.Contains(TAG_USAGE_COUNT_LIMIT, 1U));
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
}
}
/*
- * UsageCountLimitTest.TestLimitRsa
+ * UsageCountLimitTest.TestLimitedUseAes
*
- * Verifies that the usage count limit tag works correctly with RSA keys.
+ * Verifies that the usage count limit tag > 1 works correctly with AES keys.
*/
-TEST_P(UsageCountLimitTest, TestLimitRsa) {
+TEST_P(UsageCountLimitTest, TestLimitedUseAes) {
+ if (SecLevel() == SecurityLevel::STRONGBOX) return;
+
+ ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .AesEncryptionKey(128)
+ .EcbMode()
+ .Padding(PaddingMode::NONE)
+ .Authorization(TAG_USAGE_COUNT_LIMIT, 3)));
+
+ // Check the usage count limit tag appears in the authorizations.
+ AuthorizationSet auths;
+ for (auto& entry : key_characteristics_) {
+ auths.push_back(AuthorizationSet(entry.authorizations));
+ }
+ EXPECT_TRUE(auths.Contains(TAG_USAGE_COUNT_LIMIT, 3U))
+ << "key usage count limit " << 3U << " missing";
+
+ string message = "1234567890123456";
+ auto params = AuthorizationSetBuilder().EcbMode().Padding(PaddingMode::NONE);
+
+ AuthorizationSet hardware_auths = HwEnforcedAuthorizations(key_characteristics_);
+ AuthorizationSet keystore_auths =
+ SecLevelAuthorizations(key_characteristics_, SecurityLevel::KEYSTORE);
+
+ EncryptMessage(message, params);
+ EncryptMessage(message, params);
+ EncryptMessage(message, params);
+
+ if (hardware_auths.Contains(TAG_USAGE_COUNT_LIMIT, 3U)) {
+ // Usage count limit tag is enforced by hardware. After using the key, the key blob
+ // must be invalidated from secure storage (such as RPMB partition).
+ EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB, Begin(KeyPurpose::ENCRYPT, params));
+ } else {
+ // Usage count limit tag is enforced by keystore, keymint does nothing.
+ EXPECT_TRUE(keystore_auths.Contains(TAG_USAGE_COUNT_LIMIT, 3U));
+ EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
+ }
+}
+
+/*
+ * UsageCountLimitTest.TestSingleUseRsa
+ *
+ * Verifies that the usage count limit tag = 1 works correctly with RSA keys.
+ */
+TEST_P(UsageCountLimitTest, TestSingleUseRsa) {
if (SecLevel() == SecurityLevel::STRONGBOX) return;
ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
@@ -4366,22 +4465,64 @@
string message = "1234567890123456";
auto params = AuthorizationSetBuilder().NoDigestOrPadding();
+ AuthorizationSet hardware_auths = HwEnforcedAuthorizations(key_characteristics_);
+ AuthorizationSet keystore_auths =
+ SecLevelAuthorizations(key_characteristics_, SecurityLevel::KEYSTORE);
+
// First usage of RSA key should work.
SignMessage(message, params);
- AuthorizationSet hardware_auths;
- for (auto& entry : key_characteristics_) {
- if (entry.securityLevel != SecurityLevel::SOFTWARE) {
- auths.push_back(AuthorizationSet(entry.authorizations));
- }
- }
-
if (hardware_auths.Contains(TAG_USAGE_COUNT_LIMIT, 1U)) {
// Usage count limit tag is enforced by hardware. After using the key, the key blob
// must be invalidated from secure storage (such as RPMB partition).
EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB, Begin(KeyPurpose::SIGN, params));
} else {
- // Usage count limit tag is enforced by software, keymint does nothing.
+ // Usage count limit tag is enforced by keystore, keymint does nothing.
+ EXPECT_TRUE(keystore_auths.Contains(TAG_USAGE_COUNT_LIMIT, 1U));
+ EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::SIGN, params));
+ }
+}
+
+/*
+ * UsageCountLimitTest.TestLimitUseRsa
+ *
+ * Verifies that the usage count limit tag > 1 works correctly with RSA keys.
+ */
+TEST_P(UsageCountLimitTest, TestLimitUseRsa) {
+ if (SecLevel() == SecurityLevel::STRONGBOX) return;
+
+ ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .RsaSigningKey(1024, 65537)
+ .NoDigestOrPadding()
+ .Authorization(TAG_USAGE_COUNT_LIMIT, 3)));
+
+ // Check the usage count limit tag appears in the authorizations.
+ AuthorizationSet auths;
+ for (auto& entry : key_characteristics_) {
+ auths.push_back(AuthorizationSet(entry.authorizations));
+ }
+ EXPECT_TRUE(auths.Contains(TAG_USAGE_COUNT_LIMIT, 3U))
+ << "key usage count limit " << 3U << " missing";
+
+ string message = "1234567890123456";
+ auto params = AuthorizationSetBuilder().NoDigestOrPadding();
+
+ AuthorizationSet hardware_auths = HwEnforcedAuthorizations(key_characteristics_);
+ AuthorizationSet keystore_auths =
+ SecLevelAuthorizations(key_characteristics_, SecurityLevel::KEYSTORE);
+
+ SignMessage(message, params);
+ SignMessage(message, params);
+ SignMessage(message, params);
+
+ if (hardware_auths.Contains(TAG_USAGE_COUNT_LIMIT, 3U)) {
+ // Usage count limit tag is enforced by hardware. After using the key, the key blob
+ // must be invalidated from secure storage (such as RPMB partition).
+ EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB, Begin(KeyPurpose::SIGN, params));
+ } else {
+ // Usage count limit tag is enforced by keystore, keymint does nothing.
+ EXPECT_TRUE(keystore_auths.Contains(TAG_USAGE_COUNT_LIMIT, 3U));
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::SIGN, params));
}
}
diff --git a/security/keymint/support/attestation_record.cpp b/security/keymint/support/attestation_record.cpp
index 596b097..a48f770 100644
--- a/security/keymint/support/attestation_record.cpp
+++ b/security/keymint/support/attestation_record.cpp
@@ -97,6 +97,7 @@
ASN1_NULL* device_unique_attestation;
ASN1_NULL* storage_key;
ASN1_NULL* identity_credential;
+ ASN1_INTEGER* usage_count_limit;
} KM_AUTH_LIST;
ASN1_SEQUENCE(KM_AUTH_LIST) = {
@@ -143,7 +144,8 @@
ASN1_EXP_OPT(KM_AUTH_LIST, storage_key, ASN1_NULL, TAG_STORAGE_KEY.maskedTag()),
ASN1_EXP_OPT(KM_AUTH_LIST, identity_credential, ASN1_NULL,
TAG_IDENTITY_CREDENTIAL_KEY.maskedTag()),
-
+ ASN1_EXP_OPT(KM_AUTH_LIST, usage_count_limit, ASN1_INTEGER,
+ TAG_USAGE_COUNT_LIMIT.maskedTag()),
} ASN1_SEQUENCE_END(KM_AUTH_LIST);
IMPLEMENT_ASN1_FUNCTIONS(KM_AUTH_LIST);
@@ -285,6 +287,7 @@
copyAuthTag(record->device_unique_attestation, TAG_DEVICE_UNIQUE_ATTESTATION, auth_list);
copyAuthTag(record->storage_key, TAG_STORAGE_KEY, auth_list);
copyAuthTag(record->identity_credential, TAG_IDENTITY_CREDENTIAL_KEY, auth_list);
+ copyAuthTag(record->usage_count_limit, TAG_USAGE_COUNT_LIMIT, auth_list);
return ErrorCode::OK;
}
diff --git a/sensors/common/default/2.X/Sensor.cpp b/sensors/common/default/2.X/Sensor.cpp
index 642fc89..1a7c628 100644
--- a/sensors/common/default/2.X/Sensor.cpp
+++ b/sensors/common/default/2.X/Sensor.cpp
@@ -313,7 +313,7 @@
mSensorInfo.maxRange = 1000.0f * M_PI / 180.0f;
mSensorInfo.resolution = 1000.0f * M_PI / (180.0f * 32768.0f);
mSensorInfo.power = 0.001f;
- mSensorInfo.minDelay = 2.5f * 1000; // microseconds
+ mSensorInfo.minDelay = 10 * 1000; // microseconds
mSensorInfo.maxDelay = kDefaultMaxDelayUs;
mSensorInfo.fifoReservedEventCount = 0;
mSensorInfo.fifoMaxEventCount = 0;
diff --git a/tv/cec/2.0/Android.bp b/tv/cec/2.0/Android.bp
deleted file mode 100644
index 5463b6d..0000000
--- a/tv/cec/2.0/Android.bp
+++ /dev/null
@@ -1,16 +0,0 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
-hidl_interface {
- name: "android.hardware.tv.cec@2.0",
- root: "android.hardware",
- srcs: [
- "types.hal",
- "IHdmiCec.hal",
- "IHdmiCecCallback.hal",
- ],
- interfaces: [
- "android.hidl.base@1.0",
- "android.hidl.safe_union@1.0",
- ],
- gen_java: true,
-}
diff --git a/tv/cec/2.0/IHdmiCec.hal b/tv/cec/2.0/IHdmiCec.hal
deleted file mode 100644
index 0723bad..0000000
--- a/tv/cec/2.0/IHdmiCec.hal
+++ /dev/null
@@ -1,209 +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.
- */
-
-package android.hardware.tv.cec@2.0;
-
-import IHdmiCecCallback;
-
-/**
- * HDMI-CEC HAL interface definition.
- */
-interface IHdmiCec {
- /**
- * Passes Primary Device Type that must be used in this system.
- *
- * HAL must use it to allocate logical address as specified in CEC section
- * 11.3.2 of the CEC spec 2.0b. Then CEC commands addressed the given
- * logical address can be filtered in.
- * This method shall be able to be called up to twice to support two Primary
- * Device Type as specified in CEC Table 11-8 of the CEC spec 2.0b.
- *
- * @param deviceType that must be used in this system. It must be a valid
- * value in CecDeviceType for the call to succeed.
- * @return result Result status of the operation. SUCCESS if successful,
- * FAILURE_INVALID_ARGS if the given device type is invalid,
- * FAILURE_BUSY if device or resource is busy
- */
- @callflow(next={"*"})
- addDeviceType(CecDeviceType deviceType) generates (Result result);
-
- /**
- * Clears all Primary Device Types.
- *
- * It is used when the system plan to reconfigure Primary Device Type,
- * hence to tell HAL to release all logical address associated to them,
- * and change the state back to the beginning.
- */
- @callflow(next="addDeviceType")
- @exit
- clearDeviceTypes();
-
- /**
- * Set All Device Types for a Primary Device Type.
- *
- * This value must be used in REPORT_FEATURES message to response
- * GIVE_FEATURES message in HAL.
- *
- * @param allDeviceTypes device all device types for a Primary Device Type.
- */
- @callflow(next="addDeviceType")
- setAllDeviceTypes(CecAllDeviceTypes allDeviceTypes);
-
- /**
- * Set Device Features for a Primary Device Type.
- *
- * This value must be used in REPORT_FEATURES message to response
- * GIVE_FEATURES message in HAL.
- *
- * @param deviceType The device Primary Device Type.
- * @param deviceFeatures device features for a Primary Device Type.
- */
- @callflow(next="addDeviceType")
- setDeviceFeatures(CecDeviceType deviceType,
- CecDeviceFeatures deviceFeatures);
-
- /**
- * Set Remote Control Profile for a Primary Device Type.
- *
- * This value must be used in REPORT_FEATURES message to response
- * GIVE_FEATURES message in HAL.
- *
- * @param deviceType The device Primary Device Type.
- * @param rcProliles remote control profiles for a Primary Device Type.
- */
- @callflow(next="addDeviceType")
- setRcProfile(CecDeviceType deviceType, CecRcProfile rcProfile);
-
- /**
- * Retrieve CEC device information.
- *
- * CEC section 11.3 of the CEC spec 2.0b specify that a device should not
- * ask for static information that another device has already supplied.
- * Therefore, CEC 2.0 software stack need a map to store all cec
- * devices’ information of current CEC network.
- * The device information is broadcasted by a device after it allocates a
- * logical address. Messages used to send out these information are
- * REPORT_FEATURES, REPORT_PHYSICAL_ADDRESS, DEVICE_VENDOR_ID.
- * The spec also requires less than 1 second between REPORT_FEATURES and
- * REPORT_PHYSICAL_ADDRESS message, and less than 2 second between
- * REPORT_PHYSICAL_ADDRESS and DEVICE_VENDOR_ID. An Implementation of
- * device information map in hal can help to meet the timing constraints.
- * Logical addressing is part of the process to build this map, so the
- * implementation shall include allocating logical address too.
- * Whenever a device plug/unplug, the topology of CEC network changes.
- * The hal implementation shall update devices’ information map, and
- * send out onTopologyEvent to Android system. Then Android system
- * will use readDeviceInfo to retreive latest devices’ information of CEC
- * network.
- * If SYSTEM_CEC_CONTROL is false, the hal implementation need continue to
- * maintain and update device information map, and send out pending
- * onTopologyEvent to Android system when SYSTEM_CEC_CONTROL is
- * changed to true.
- *
- * @param logicalAddress logical address of CEC device.
- * @param physicalAddress physical address of CEC device.
- * @return CecDeviceInfo from device information map.
- * @return result Result status of the operation. SUCCESS if successful,
- * FAILURE_INVALID_ARGS if logical or physical address is invalid.
- * FAILURE_INVALID_STATE if device information isn't available yet.
- */
- @callflow(next="onTopologyChangeEvent")
- readDeviceInfo(CecLogicalAddress logicalAddress,
- CecPhysicalAddress physicalAddress)
- generates (Result result, CecDeviceInfo deviceInfo);
-
- /**
- * Transmits HDMI-CEC message to other HDMI device.
- *
- * The method must be designed to return in a certain amount of time and not
- * hanging forever. This method MUST complete with in 1 second.
- *
- * It must try retransmission at least once as specified in the section '7.1
- * Frame Re-transmissions' of the CEC Spec 1.4b.
- *
- * @param message CEC message to be sent to other HDMI device.
- * @return result Result status of the operation. SUCCESS if successful,
- * NACK if the sent message is not acknowledged,
- * BUSY if the CEC bus is busy.
- */
- @callflow(next="*")
- sendMessage(CecMessage message) generates (SendMessageResult result);
-
- /**
- * Set the callback
- *
- * It is used by the framework to receive CecMessages, HDMI hotplug event
- * and topology update event. Only one callback client is supported.
- *
- * @param callback Callback object to pass hdmi events to the system. The
- * previously registered callback must be replaced with this one.
- */
- @callflow(next={"*"})
- @entry
- setCallback(IHdmiCecCallback callback);
-
- /**
- * Gets the hdmi port information of underlying hardware.
- *
- * @return infos The list of HDMI port information
- */
- @callflow(next={"*"})
- getPortInfo() generates (vec<HdmiPortInfo> infos);
-
- /**
- * Sets flags controlling the way HDMI-CEC service works down to HAL
- * implementation. Those flags must be used in case the feature needs update
- * in HAL itself, firmware or microcontroller.
- *
- * @param key The key of the option to be updated with a new value.
- * @param value Value to be set.
- */
- @callflow(next="*")
- setOption(OptionKey key, bool value);
-
- /**
- * Passes the updated language information of Android system. Contains
- * three-letter code as defined in ISO/FDIS 639-2. Must be used for HAL to
- * respond to <Get Menu Language> while in standby mode.
- *
- * @param language Three-letter code defined in ISO/FDIS 639-2. Must be
- * lowercase letters. (e.g., eng for English)
- */
- @callflow(next="*")
- setLanguage(string language);
-
- /**
- * Configures ARC circuit in the hardware logic to start or stop the
- * feature.
- *
- * @param portId Port id to be configured.
- * @param enable Flag must be either true to start the feature or false to
- * stop it.
- */
- @callflow(next="*")
- enableAudioReturnChannel(HdmiPortId portId, bool enable);
-
- /**
- * Gets the connection status of the specified port.
- *
- * It's specified in CEC section 10.8 of the CEC spec 2.0b
- *
- * @param portId Port id to be inspected for the connection status.
- * @return status True if a device is connected, otherwise false.
- */
- @callflow(next="*")
- isConnected(HdmiPortId portId) generates (bool connected);
-};
diff --git a/tv/cec/2.0/IHdmiCecCallback.hal b/tv/cec/2.0/IHdmiCecCallback.hal
deleted file mode 100644
index 1a8a489..0000000
--- a/tv/cec/2.0/IHdmiCecCallback.hal
+++ /dev/null
@@ -1,41 +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.
- */
-
-package android.hardware.tv.cec@2.0;
-
-interface IHdmiCecCallback {
- /**
- * The callback function that must be called by HAL implementation to notify
- * the system of new CEC message arrival.
- */
- oneway onCecMessage(CecMessage message);
-
- /**
- * The callback function that must be called by HAL implementation to notify
- * the system of new hotplug event.
- */
- oneway onHotplugEvent(HotplugEvent event);
-
- /**
- * The callback function must be called by HAL implementation to notify the
- * system whenever CEC device information of CEC network change.
- * HAL shall be ready for readDeviceInfo call before invoke this callback.
- * This event is triggered by topology change of whole CEC network. It's
- * different from HotplugEvent which is triggered between devices which are
- * connected directly through HDMI cable.
- */
- oneway onTopologyEvent(CecTopologyEvent event);
-};
diff --git a/tv/cec/2.0/default/Android.bp b/tv/cec/2.0/default/Android.bp
deleted file mode 100644
index d3d5342..0000000
--- a/tv/cec/2.0/default/Android.bp
+++ /dev/null
@@ -1,40 +0,0 @@
-cc_library_shared {
- name: "android.hardware.tv.cec@2.0-impl",
- defaults: ["hidl_defaults"],
- vendor: true,
- relative_install_path: "hw",
- srcs: ["HdmiCec.cpp"],
-
- shared_libs: [
- "libhidlbase",
- "liblog",
- "libbase",
- "libutils",
- "libhardware",
- "android.hardware.tv.cec@2.0",
- ],
-
-}
-
-cc_binary {
- name: "android.hardware.tv.cec@2.0-service",
- vintf_fragments: ["android.hardware.tv.cec@2.0-service.xml"],
- defaults: ["hidl_defaults"],
- relative_install_path: "hw",
- vendor: true,
- init_rc: ["android.hardware.tv.cec@2.0-service.rc"],
- srcs: ["service.cpp"],
-
- shared_libs: [
- "liblog",
- "libcutils",
- "libdl",
- "libbase",
- "libutils",
- "libhardware_legacy",
- "libhardware",
- "libhidlbase",
- "android.hardware.tv.cec@2.0",
- ],
-
-}
diff --git a/tv/cec/2.0/default/HdmiCec.cpp b/tv/cec/2.0/default/HdmiCec.cpp
deleted file mode 100644
index f451719..0000000
--- a/tv/cec/2.0/default/HdmiCec.cpp
+++ /dev/null
@@ -1,421 +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 "android.hardware.tv.cec@2.0-impl"
-#include <android-base/logging.h>
-
-#include <hardware/hardware.h>
-#include <hardware/hdmi_cec.h>
-#include "HdmiCec.h"
-
-namespace android {
-namespace hardware {
-namespace tv {
-namespace cec {
-namespace V2_0 {
-namespace implementation {
-
-static_assert(CEC_DEVICE_INACTIVE == static_cast<int>(CecDeviceType::INACTIVE),
- "CecDeviceType::INACTIVE must match legacy value.");
-static_assert(CEC_DEVICE_TV == static_cast<int>(CecDeviceType::TV),
- "CecDeviceType::TV must match legacy value.");
-static_assert(CEC_DEVICE_RECORDER == static_cast<int>(CecDeviceType::RECORDER),
- "CecDeviceType::RECORDER must match legacy value.");
-static_assert(CEC_DEVICE_TUNER == static_cast<int>(CecDeviceType::TUNER),
- "CecDeviceType::TUNER must match legacy value.");
-static_assert(CEC_DEVICE_PLAYBACK == static_cast<int>(CecDeviceType::PLAYBACK),
- "CecDeviceType::PLAYBACK must match legacy value.");
-static_assert(CEC_DEVICE_AUDIO_SYSTEM == static_cast<int>(CecDeviceType::AUDIO_SYSTEM),
- "CecDeviceType::AUDIO_SYSTEM must match legacy value.");
-/* TODO: Adjust for cec@2.0
-static_assert(CEC_DEVICE_MAX == static_cast<int>(CecDeviceType::MAX),
- "CecDeviceType::MAX must match legacy value.");
-*/
-static_assert(CEC_ADDR_TV == static_cast<int>(CecLogicalAddress::TV),
- "CecLogicalAddress::TV must match legacy value.");
-static_assert(CEC_ADDR_RECORDER_1 == static_cast<int>(CecLogicalAddress::RECORDER_1),
- "CecLogicalAddress::RECORDER_1 must match legacy value.");
-static_assert(CEC_ADDR_RECORDER_2 == static_cast<int>(CecLogicalAddress::RECORDER_2),
- "CecLogicalAddress::RECORDER_2 must match legacy value.");
-static_assert(CEC_ADDR_TUNER_1 == static_cast<int>(CecLogicalAddress::TUNER_1),
- "CecLogicalAddress::TUNER_1 must match legacy value.");
-static_assert(CEC_ADDR_PLAYBACK_1 == static_cast<int>(CecLogicalAddress::PLAYBACK_1),
- "CecLogicalAddress::PLAYBACK_1 must match legacy value.");
-static_assert(CEC_ADDR_AUDIO_SYSTEM == static_cast<int>(CecLogicalAddress::AUDIO_SYSTEM),
- "CecLogicalAddress::AUDIO_SYSTEM must match legacy value.");
-static_assert(CEC_ADDR_TUNER_2 == static_cast<int>(CecLogicalAddress::TUNER_2),
- "CecLogicalAddress::TUNER_2 must match legacy value.");
-static_assert(CEC_ADDR_TUNER_3 == static_cast<int>(CecLogicalAddress::TUNER_3),
- "CecLogicalAddress::TUNER_3 must match legacy value.");
-static_assert(CEC_ADDR_PLAYBACK_2 == static_cast<int>(CecLogicalAddress::PLAYBACK_2),
- "CecLogicalAddress::PLAYBACK_2 must match legacy value.");
-static_assert(CEC_ADDR_RECORDER_3 == static_cast<int>(CecLogicalAddress::RECORDER_3),
- "CecLogicalAddress::RECORDER_3 must match legacy value.");
-static_assert(CEC_ADDR_TUNER_4 == static_cast<int>(CecLogicalAddress::TUNER_4),
- "CecLogicalAddress::TUNER_4 must match legacy value.");
-static_assert(CEC_ADDR_PLAYBACK_3 == static_cast<int>(CecLogicalAddress::PLAYBACK_3),
- "CecLogicalAddress::PLAYBACK_3 must match legacy value.");
-/* TODO: Adjust for cec@2.0
-static_assert(CEC_ADDR_FREE_USE == static_cast<int>(CecLogicalAddress::FREE_USE),
- "CecLogicalAddress::FREE_USE must match legacy value.");
-*/
-static_assert(CEC_ADDR_UNREGISTERED == static_cast<int>(CecLogicalAddress::UNREGISTERED),
- "CecLogicalAddress::UNREGISTERED must match legacy value.");
-static_assert(CEC_ADDR_BROADCAST == static_cast<int>(CecLogicalAddress::BROADCAST),
- "CecLogicalAddress::BROADCAST must match legacy value.");
-
-static_assert(CEC_MESSAGE_FEATURE_ABORT == static_cast<int>(CecMessageType::FEATURE_ABORT),
- "CecMessageType::FEATURE_ABORT must match legacy value.");
-static_assert(CEC_MESSAGE_IMAGE_VIEW_ON == static_cast<int>(CecMessageType::IMAGE_VIEW_ON),
- "CecMessageType::IMAGE_VIEW_ON must match legacy value.");
-static_assert(CEC_MESSAGE_TUNER_STEP_INCREMENT ==
- static_cast<int>(CecMessageType::TUNER_STEP_INCREMENT),
- "CecMessageType::TUNER_STEP_INCREMENT must match legacy value.");
-static_assert(CEC_MESSAGE_TUNER_STEP_DECREMENT ==
- static_cast<int>(CecMessageType::TUNER_STEP_DECREMENT),
- "CecMessageType::TUNER_STEP_DECREMENT must match legacy value.");
-static_assert(CEC_MESSAGE_TUNER_DEVICE_STATUS ==
- static_cast<int>(CecMessageType::TUNER_DEVICE_STATUS),
- "CecMessageType::TUNER_DEVICE_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_TUNER_DEVICE_STATUS ==
- static_cast<int>(CecMessageType::GIVE_TUNER_DEVICE_STATUS),
- "CecMessageType::GIVE_TUNER_DEVICE_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_RECORD_ON == static_cast<int>(CecMessageType::RECORD_ON),
- "CecMessageType::RECORD_ON must match legacy value.");
-static_assert(CEC_MESSAGE_RECORD_STATUS == static_cast<int>(CecMessageType::RECORD_STATUS),
- "CecMessageType::RECORD_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_RECORD_OFF == static_cast<int>(CecMessageType::RECORD_OFF),
- "CecMessageType::RECORD_OFF must match legacy value.");
-static_assert(CEC_MESSAGE_TEXT_VIEW_ON == static_cast<int>(CecMessageType::TEXT_VIEW_ON),
- "CecMessageType::TEXT_VIEW_ON must match legacy value.");
-static_assert(CEC_MESSAGE_RECORD_TV_SCREEN == static_cast<int>(CecMessageType::RECORD_TV_SCREEN),
- "CecMessageType::RECORD_TV_SCREEN must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_DECK_STATUS == static_cast<int>(CecMessageType::GIVE_DECK_STATUS),
- "CecMessageType::GIVE_DECK_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_STANDBY == static_cast<int>(CecMessageType::STANDBY),
- "CecMessageType::STANDBY must match legacy value.");
-static_assert(CEC_MESSAGE_PLAY == static_cast<int>(CecMessageType::PLAY),
- "CecMessageType::PLAY must match legacy value.");
-static_assert(CEC_MESSAGE_DECK_CONTROL == static_cast<int>(CecMessageType::DECK_CONTROL),
- "CecMessageType::DECK_CONTROL must match legacy value.");
-static_assert(CEC_MESSAGE_TIMER_CLEARED_STATUS ==
- static_cast<int>(CecMessageType::TIMER_CLEARED_STATUS),
- "CecMessageType::TIMER_CLEARED_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_USER_CONTROL_PRESSED ==
- static_cast<int>(CecMessageType::USER_CONTROL_PRESSED),
- "CecMessageType::USER_CONTROL_PRESSED must match legacy value.");
-static_assert(CEC_MESSAGE_USER_CONTROL_RELEASED ==
- static_cast<int>(CecMessageType::USER_CONTROL_RELEASED),
- "CecMessageType::USER_CONTROL_RELEASED must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_OSD_NAME == static_cast<int>(CecMessageType::GIVE_OSD_NAME),
- "CecMessageType::GIVE_OSD_NAME must match legacy value.");
-static_assert(CEC_MESSAGE_SET_OSD_NAME == static_cast<int>(CecMessageType::SET_OSD_NAME),
- "CecMessageType::SET_OSD_NAME must match legacy value.");
-static_assert(CEC_MESSAGE_SYSTEM_AUDIO_MODE_REQUEST ==
- static_cast<int>(CecMessageType::SYSTEM_AUDIO_MODE_REQUEST),
- "CecMessageType::SYSTEM_AUDIO_MODE_REQUEST must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_AUDIO_STATUS == static_cast<int>(CecMessageType::GIVE_AUDIO_STATUS),
- "CecMessageType::GIVE_AUDIO_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_SET_SYSTEM_AUDIO_MODE ==
- static_cast<int>(CecMessageType::SET_SYSTEM_AUDIO_MODE),
- "CecMessageType::SET_SYSTEM_AUDIO_MODE must match legacy value.");
-static_assert(CEC_MESSAGE_REPORT_AUDIO_STATUS ==
- static_cast<int>(CecMessageType::REPORT_AUDIO_STATUS),
- "CecMessageType::REPORT_AUDIO_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_SYSTEM_AUDIO_MODE_STATUS ==
- static_cast<int>(CecMessageType::GIVE_SYSTEM_AUDIO_MODE_STATUS),
- "CecMessageType::GIVE_SYSTEM_AUDIO_MODE_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_SYSTEM_AUDIO_MODE_STATUS ==
- static_cast<int>(CecMessageType::SYSTEM_AUDIO_MODE_STATUS),
- "CecMessageType::SYSTEM_AUDIO_MODE_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_ROUTING_CHANGE == static_cast<int>(CecMessageType::ROUTING_CHANGE),
- "CecMessageType::ROUTING_CHANGE must match legacy value.");
-static_assert(CEC_MESSAGE_ROUTING_INFORMATION ==
- static_cast<int>(CecMessageType::ROUTING_INFORMATION),
- "CecMessageType::ROUTING_INFORMATION must match legacy value.");
-static_assert(CEC_MESSAGE_ACTIVE_SOURCE == static_cast<int>(CecMessageType::ACTIVE_SOURCE),
- "CecMessageType::ACTIVE_SOURCE must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_PHYSICAL_ADDRESS ==
- static_cast<int>(CecMessageType::GIVE_PHYSICAL_ADDRESS),
- "CecMessageType::GIVE_PHYSICAL_ADDRESS must match legacy value.");
-static_assert(CEC_MESSAGE_REPORT_PHYSICAL_ADDRESS ==
- static_cast<int>(CecMessageType::REPORT_PHYSICAL_ADDRESS),
- "CecMessageType::REPORT_PHYSICAL_ADDRESS must match legacy value.");
-static_assert(CEC_MESSAGE_REQUEST_ACTIVE_SOURCE ==
- static_cast<int>(CecMessageType::REQUEST_ACTIVE_SOURCE),
- "CecMessageType::REQUEST_ACTIVE_SOURCE must match legacy value.");
-static_assert(CEC_MESSAGE_SET_STREAM_PATH == static_cast<int>(CecMessageType::SET_STREAM_PATH),
- "CecMessageType::SET_STREAM_PATH must match legacy value.");
-static_assert(CEC_MESSAGE_DEVICE_VENDOR_ID == static_cast<int>(CecMessageType::DEVICE_VENDOR_ID),
- "CecMessageType::DEVICE_VENDOR_ID must match legacy value.");
-static_assert(CEC_MESSAGE_VENDOR_COMMAND == static_cast<int>(CecMessageType::VENDOR_COMMAND),
- "CecMessageType::VENDOR_COMMAND must match legacy value.");
-static_assert(CEC_MESSAGE_VENDOR_REMOTE_BUTTON_DOWN ==
- static_cast<int>(CecMessageType::VENDOR_REMOTE_BUTTON_DOWN),
- "CecMessageType::VENDOR_REMOTE_BUTTON_DOWN must match legacy value.");
-static_assert(CEC_MESSAGE_VENDOR_REMOTE_BUTTON_UP ==
- static_cast<int>(CecMessageType::VENDOR_REMOTE_BUTTON_UP),
- "CecMessageType::VENDOR_REMOTE_BUTTON_UP must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_DEVICE_VENDOR_ID ==
- static_cast<int>(CecMessageType::GIVE_DEVICE_VENDOR_ID),
- "CecMessageType::GIVE_DEVICE_VENDOR_ID must match legacy value.");
-static_assert(CEC_MESSAGE_MENU_REQUEST == static_cast<int>(CecMessageType::MENU_REQUEST),
- "CecMessageType::MENU_REQUEST must match legacy value.");
-static_assert(CEC_MESSAGE_MENU_STATUS == static_cast<int>(CecMessageType::MENU_STATUS),
- "CecMessageType::MENU_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_GIVE_DEVICE_POWER_STATUS ==
- static_cast<int>(CecMessageType::GIVE_DEVICE_POWER_STATUS),
- "CecMessageType::GIVE_DEVICE_POWER_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_REPORT_POWER_STATUS ==
- static_cast<int>(CecMessageType::REPORT_POWER_STATUS),
- "CecMessageType::REPORT_POWER_STATUS must match legacy value.");
-static_assert(CEC_MESSAGE_GET_MENU_LANGUAGE == static_cast<int>(CecMessageType::GET_MENU_LANGUAGE),
- "CecMessageType::GET_MENU_LANGUAGE must match legacy value.");
-static_assert(CEC_MESSAGE_SELECT_ANALOG_SERVICE ==
- static_cast<int>(CecMessageType::SELECT_ANALOG_SERVICE),
- "CecMessageType::SELECT_ANALOG_SERVICE must match legacy value.");
-static_assert(CEC_MESSAGE_SELECT_DIGITAL_SERVICE ==
- static_cast<int>(CecMessageType::SELECT_DIGITAL_SERVICE),
- "CecMessageType::SELECT_DIGITAL_SERVICE must match legacy value.");
-static_assert(CEC_MESSAGE_SET_DIGITAL_TIMER == static_cast<int>(CecMessageType::SET_DIGITAL_TIMER),
- "CecMessageType::SET_DIGITAL_TIMER must match legacy value.");
-static_assert(CEC_MESSAGE_CLEAR_DIGITAL_TIMER ==
- static_cast<int>(CecMessageType::CLEAR_DIGITAL_TIMER),
- "CecMessageType::CLEAR_DIGITAL_TIMER must match legacy value.");
-static_assert(CEC_MESSAGE_SET_AUDIO_RATE == static_cast<int>(CecMessageType::SET_AUDIO_RATE),
- "CecMessageType::SET_AUDIO_RATE must match legacy value.");
-static_assert(CEC_MESSAGE_INACTIVE_SOURCE == static_cast<int>(CecMessageType::INACTIVE_SOURCE),
- "CecMessageType::INACTIVE_SOURCE must match legacy value.");
-static_assert(CEC_MESSAGE_CEC_VERSION == static_cast<int>(CecMessageType::CEC_VERSION),
- "CecMessageType::CEC_VERSION must match legacy value.");
-static_assert(CEC_MESSAGE_GET_CEC_VERSION == static_cast<int>(CecMessageType::GET_CEC_VERSION),
- "CecMessageType::GET_CEC_VERSION must match legacy value.");
-static_assert(CEC_MESSAGE_VENDOR_COMMAND_WITH_ID ==
- static_cast<int>(CecMessageType::VENDOR_COMMAND_WITH_ID),
- "CecMessageType::VENDOR_COMMAND_WITH_ID must match legacy value.");
-static_assert(CEC_MESSAGE_CLEAR_EXTERNAL_TIMER ==
- static_cast<int>(CecMessageType::CLEAR_EXTERNAL_TIMER),
- "CecMessageType::CLEAR_EXTERNAL_TIMER must match legacy value.");
-static_assert(CEC_MESSAGE_SET_EXTERNAL_TIMER ==
- static_cast<int>(CecMessageType::SET_EXTERNAL_TIMER),
- "CecMessageType::SET_EXTERNAL_TIMER must match legacy value.");
-static_assert(CEC_MESSAGE_INITIATE_ARC == static_cast<int>(CecMessageType::INITIATE_ARC),
- "CecMessageType::INITIATE_ARC must match legacy value.");
-static_assert(CEC_MESSAGE_REPORT_ARC_INITIATED ==
- static_cast<int>(CecMessageType::REPORT_ARC_INITIATED),
- "CecMessageType::REPORT_ARC_INITIATED must match legacy value.");
-static_assert(CEC_MESSAGE_REPORT_ARC_TERMINATED ==
- static_cast<int>(CecMessageType::REPORT_ARC_TERMINATED),
- "CecMessageType::REPORT_ARC_TERMINATED must match legacy value.");
-static_assert(CEC_MESSAGE_REQUEST_ARC_INITIATION ==
- static_cast<int>(CecMessageType::REQUEST_ARC_INITIATION),
- "CecMessageType::REQUEST_ARC_INITIATION must match legacy value.");
-static_assert(CEC_MESSAGE_REQUEST_ARC_TERMINATION ==
- static_cast<int>(CecMessageType::REQUEST_ARC_TERMINATION),
- "CecMessageType::REQUEST_ARC_TERMINATION must match legacy value.");
-static_assert(CEC_MESSAGE_TERMINATE_ARC == static_cast<int>(CecMessageType::TERMINATE_ARC),
- "CecMessageType::TERMINATE_ARC must match legacy value.");
-static_assert(CEC_MESSAGE_ABORT == static_cast<int>(CecMessageType::ABORT),
- "CecMessageType::ABORT must match legacy value.");
-
-static_assert(ABORT_UNRECOGNIZED_MODE == static_cast<int>(AbortReason::UNRECOGNIZED_MODE),
- "AbortReason::UNRECOGNIZED_MODE must match legacy value.");
-static_assert(ABORT_NOT_IN_CORRECT_MODE == static_cast<int>(AbortReason::NOT_IN_CORRECT_MODE),
- "AbortReason::NOT_IN_CORRECT_MODE must match legacy value.");
-static_assert(ABORT_CANNOT_PROVIDE_SOURCE == static_cast<int>(AbortReason::CANNOT_PROVIDE_SOURCE),
- "AbortReason::CANNOT_PROVIDE_SOURCE must match legacy value.");
-static_assert(ABORT_INVALID_OPERAND == static_cast<int>(AbortReason::INVALID_OPERAND),
- "AbortReason::INVALID_OPERAND must match legacy value.");
-static_assert(ABORT_REFUSED == static_cast<int>(AbortReason::REFUSED),
- "AbortReason::REFUSED must match legacy value.");
-static_assert(ABORT_UNABLE_TO_DETERMINE == static_cast<int>(AbortReason::UNABLE_TO_DETERMINE),
- "AbortReason::UNABLE_TO_DETERMINE must match legacy value.");
-
-static_assert(HDMI_RESULT_SUCCESS == static_cast<int>(SendMessageResult::SUCCESS),
- "SendMessageResult::SUCCESS must match legacy value.");
-static_assert(HDMI_RESULT_NACK == static_cast<int>(SendMessageResult::NACK),
- "SendMessageResult::NACK must match legacy value.");
-static_assert(HDMI_RESULT_BUSY == static_cast<int>(SendMessageResult::BUSY),
- "SendMessageResult::BUSY must match legacy value.");
-static_assert(HDMI_RESULT_FAIL == static_cast<int>(SendMessageResult::FAIL),
- "SendMessageResult::FAIL must match legacy value.");
-
-static_assert(HDMI_INPUT == static_cast<int>(HdmiPortType::INPUT),
- "HdmiPortType::INPUT must match legacy value.");
-static_assert(HDMI_OUTPUT == static_cast<int>(HdmiPortType::OUTPUT),
- "HdmiPortType::OUTPUT must match legacy value.");
-
-static_assert(HDMI_OPTION_WAKEUP == static_cast<int>(OptionKey::WAKEUP),
- "OptionKey::WAKEUP must match legacy value.");
-static_assert(HDMI_OPTION_ENABLE_CEC == static_cast<int>(OptionKey::ENABLE_CEC),
- "OptionKey::ENABLE_CEC must match legacy value.");
-static_assert(HDMI_OPTION_SYSTEM_CEC_CONTROL == static_cast<int>(OptionKey::SYSTEM_CEC_CONTROL),
- "OptionKey::SYSTEM_CEC_CONTROL must match legacy value.");
-
-sp<IHdmiCecCallback> HdmiCec::mCallback = nullptr;
-
-HdmiCec::HdmiCec(hdmi_cec_device_t* device) : mDevice(device) {}
-
-// Methods from ::android::hardware::tv::cec::V2_0::IHdmiCec follow.
-Return<Result> HdmiCec::addDeviceType(CecDeviceType deviceType) {
- // TODO implement
- if (deviceType <= CecDeviceType::MAX) {
- return Result::SUCCESS;
- } else {
- return Result::FAILURE_INVALID_ARGS;
- }
-}
-
-Return<void> HdmiCec::clearDeviceTypes() {
- // TODO implement
- return Void();
-}
-
-Return<void> HdmiCec::setAllDeviceTypes(CecAllDeviceTypes allDeviceTypes) {
- // TODO implement
- if (allDeviceTypes == 1) {
- }
- return Void();
-}
-
-Return<void> HdmiCec::setDeviceFeatures(CecDeviceType deviceType,
- CecDeviceFeatures /* deviceFeatures */) {
- // TODO implement
- if (deviceType != CecDeviceType::MAX) {
- }
- return Void();
-}
-
-Return<void> HdmiCec::setRcProfile(CecDeviceType deviceType, const CecRcProfile& /* rcProfile */) {
- // TODO implement
- if (deviceType != CecDeviceType::MAX) {
- }
- return Void();
-}
-
-Return<void> HdmiCec::readDeviceInfo(CecLogicalAddress logicalAddress,
- CecPhysicalAddress physicalAddress,
- const readDeviceInfo_cb _hidl_cb) {
- // TODO implement
- CecDeviceInfo deviceInfo;
-
- if (logicalAddress == CecLogicalAddress::TV) {
- _hidl_cb(Result::SUCCESS, deviceInfo);
- if (physicalAddress) {
- }
- }
- return Void();
-}
-
-Return<SendMessageResult> HdmiCec::sendMessage(const CecMessage& message) {
- cec_message_t legacyMessage{
- .initiator = static_cast<cec_logical_address_t>(message.initiator),
- .destination = static_cast<cec_logical_address_t>(message.destination),
- .length = message.body.size(),
- };
- for (size_t i = 0; i < message.body.size(); ++i) {
- legacyMessage.body[i] = static_cast<unsigned char>(message.body[i]);
- }
- return static_cast<SendMessageResult>(mDevice->send_message(mDevice, &legacyMessage));
-}
-
-Return<void> HdmiCec::setCallback(const sp<IHdmiCecCallback>& callback) {
- if (mCallback != nullptr) {
- mCallback->unlinkToDeath(this);
- mCallback = nullptr;
- }
-
- if (callback != nullptr) {
- mCallback = callback;
- mCallback->linkToDeath(this, 0 /*cookie*/);
- mDevice->register_event_callback(mDevice, eventCallback, nullptr);
- }
- return Void();
-}
-
-Return<void> HdmiCec::getPortInfo(getPortInfo_cb _hidl_cb) {
- struct hdmi_port_info* legacyPorts;
- int numPorts;
- hidl_vec<HdmiPortInfo> portInfos;
- mDevice->get_port_info(mDevice, &legacyPorts, &numPorts);
- portInfos.resize(numPorts);
- for (int i = 0; i < numPorts; ++i) {
- portInfos[i] = {.type = static_cast<HdmiPortType>(legacyPorts[i].type),
- .portId = static_cast<HdmiPortId>(legacyPorts[i].port_id),
- .cecSupported = legacyPorts[i].cec_supported != 0,
- .arcSupported = legacyPorts[i].arc_supported != 0,
- .physicalAddress = legacyPorts[i].physical_address};
- }
- _hidl_cb(portInfos);
- return Void();
-}
-
-Return<void> HdmiCec::setOption(OptionKey key, bool value) {
- mDevice->set_option(mDevice, static_cast<int>(key), value ? 1 : 0);
- return Void();
-}
-
-Return<void> HdmiCec::setLanguage(const hidl_string& language) {
- if (language.size() != 3) {
- LOG(ERROR) << "Wrong language code: expected 3 letters, but it was " << language.size()
- << ".";
- return Void();
- }
- const char* languageStr = language.c_str();
- int convertedLanguage = ((languageStr[0] & 0xFF) << 16) | ((languageStr[1] & 0xFF) << 8) |
- (languageStr[2] & 0xFF);
- mDevice->set_option(mDevice, HDMI_OPTION_SET_LANG, convertedLanguage);
- return Void();
-}
-
-Return<void> HdmiCec::enableAudioReturnChannel(HdmiPortId portId, bool enable) {
- mDevice->set_audio_return_channel(mDevice, portId, enable ? 1 : 0);
- return Void();
-}
-
-Return<bool> HdmiCec::isConnected(HdmiPortId portId) {
- return mDevice->is_connected(mDevice, portId) > 0;
-}
-
-IHdmiCec* HIDL_FETCH_IHdmiCec(const char* hal) {
- hdmi_cec_device_t* hdmi_cec_device;
- int ret = 0;
- const hw_module_t* hw_module = nullptr;
-
- ret = hw_get_module(HDMI_CEC_HARDWARE_MODULE_ID, &hw_module);
- if (ret == 0) {
- ret = hdmi_cec_open(hw_module, &hdmi_cec_device);
- if (ret != 0) {
- LOG(ERROR) << "hdmi_cec_open " << hal << " failed: " << ret;
- }
- } else {
- LOG(ERROR) << "hw_get_module " << hal << " failed: " << ret;
- }
-
- if (ret == 0) {
- return new HdmiCec(hdmi_cec_device);
- } else {
- LOG(ERROR) << "Passthrough failed to load legacy HAL.";
- return nullptr;
- }
-}
-
-} // namespace implementation
-} // namespace V2_0
-} // namespace cec
-} // namespace tv
-} // namespace hardware
-} // namespace android
diff --git a/tv/cec/2.0/default/HdmiCec.h b/tv/cec/2.0/default/HdmiCec.h
deleted file mode 100644
index ab54770..0000000
--- a/tv/cec/2.0/default/HdmiCec.h
+++ /dev/null
@@ -1,115 +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.
- */
-
-#ifndef ANDROID_HARDWARE_TV_CEC_V2_0_HDMICEC_H
-#define ANDROID_HARDWARE_TV_CEC_V2_0_HDMICEC_H
-
-#include <algorithm>
-
-#include <android/hardware/tv/cec/2.0/IHdmiCec.h>
-#include <hardware/hardware.h>
-#include <hardware/hdmi_cec.h>
-#include <hidl/Status.h>
-
-#include <hidl/MQDescriptor.h>
-namespace android {
-namespace hardware {
-namespace tv {
-namespace cec {
-namespace V2_0 {
-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::tv::cec::V2_0::CecLogicalAddress;
-using ::android::hardware::tv::cec::V2_0::CecMessage;
-using ::android::hardware::tv::cec::V2_0::CecPhysicalAddress;
-using ::android::hardware::tv::cec::V2_0::HdmiPortId;
-using ::android::hardware::tv::cec::V2_0::HdmiPortInfo;
-using ::android::hardware::tv::cec::V2_0::IHdmiCec;
-using ::android::hardware::tv::cec::V2_0::IHdmiCecCallback;
-using ::android::hardware::tv::cec::V2_0::MaxLength;
-using ::android::hardware::tv::cec::V2_0::OptionKey;
-using ::android::hardware::tv::cec::V2_0::Result;
-using ::android::hardware::tv::cec::V2_0::SendMessageResult;
-
-struct HdmiCec : public IHdmiCec, public hidl_death_recipient {
- HdmiCec(hdmi_cec_device_t* device);
- // Methods from ::android::hardware::tv::cec::V2_0::IHdmiCec follow.
- Return<Result> addDeviceType(CecDeviceType deviceType) override;
- Return<void> clearDeviceTypes() override;
- Return<void> setAllDeviceTypes(CecAllDeviceTypes allDeviceTypes) override;
- Return<void> setDeviceFeatures(CecDeviceType deviceType,
- CecDeviceFeatures /* deviceFeatures */) override;
- Return<void> setRcProfile(CecDeviceType deviceType,
- const CecRcProfile& /* rcProfile */) override;
- Return<void> readDeviceInfo(CecLogicalAddress logicalAddress,
- CecPhysicalAddress physicalAddress,
- const readDeviceInfo_cb _hidl_cb) override;
- Return<SendMessageResult> sendMessage(const CecMessage& message) override;
- Return<void> setCallback(const sp<IHdmiCecCallback>& callback) override;
- Return<void> getPortInfo(getPortInfo_cb _hidl_cb) override;
- Return<void> setOption(OptionKey key, bool value) override;
- Return<void> setLanguage(const hidl_string& language) override;
- Return<void> enableAudioReturnChannel(HdmiPortId portId, bool enable) override;
- Return<bool> isConnected(HdmiPortId portId) override;
-
- static void eventCallback(const hdmi_event_t* event, void* /* arg */) {
- if (mCallback != nullptr && event != nullptr) {
- if (event->type == HDMI_EVENT_CEC_MESSAGE) {
- size_t length =
- std::min(event->cec.length, static_cast<size_t>(MaxLength::MESSAGE_BODY));
- CecMessage cecMessage{
- .initiator = static_cast<CecLogicalAddress>(event->cec.initiator),
- .destination = static_cast<CecLogicalAddress>(event->cec.destination),
- };
- cecMessage.body.resize(length);
- for (size_t i = 0; i < length; ++i) {
- cecMessage.body[i] = static_cast<uint8_t>(event->cec.body[i]);
- }
- mCallback->onCecMessage(cecMessage);
- } else if (event->type == HDMI_EVENT_HOT_PLUG) {
- HotplugEvent hotplugEvent{
- .connected = event->hotplug.connected > 0,
- .portId = static_cast<HdmiPortId>(event->hotplug.port_id)};
- mCallback->onHotplugEvent(hotplugEvent);
- }
- }
- }
-
- virtual void serviceDied(uint64_t /*cookie*/,
- const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
- setCallback(nullptr);
- }
-
- private:
- static sp<IHdmiCecCallback> mCallback;
- const hdmi_cec_device_t* mDevice;
-};
-
-extern "C" IHdmiCec* HIDL_FETCH_IHdmiCec(const char* name);
-
-} // namespace implementation
-} // namespace V2_0
-} // namespace cec
-} // namespace tv
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_TV_CEC_V2_0_HDMICEC_H
diff --git a/tv/cec/2.0/default/OWNERS b/tv/cec/2.0/default/OWNERS
deleted file mode 100644
index 1b3d095..0000000
--- a/tv/cec/2.0/default/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-nchalko@google.com
-amyjojo@google.com
-shubang@google.com
-quxiangfang@google.com
diff --git a/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.rc b/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.rc
deleted file mode 100644
index 1e8cd80..0000000
--- a/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.cec-hal-2-0 /vendor/bin/hw/android.hardware.tv.cec@2.0-service
- class hal
- user system
- group system
diff --git a/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.xml b/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.xml
deleted file mode 100644
index 61fb1bb..0000000
--- a/tv/cec/2.0/default/android.hardware.tv.cec@2.0-service.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest version="1.0" type="device">
- <hal format="hidl">
- <name>android.hardware.tv.cec</name>
- <transport>hwbinder</transport>
- <version>2.0</version>
- <interface>
- <name>IHdmiCec</name>
- <instance>default</instance>
- </interface>
- </hal>
-</manifest>
diff --git a/tv/cec/2.0/default/service.cpp b/tv/cec/2.0/default/service.cpp
deleted file mode 100644
index dacc38c..0000000
--- a/tv/cec/2.0/default/service.cpp
+++ /dev/null
@@ -1,27 +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 "android.hardware.tv.cec@2.0-service"
-
-#include <android/hardware/tv/cec/2.0/IHdmiCec.h>
-#include <hidl/LegacySupport.h>
-
-using android::hardware::defaultPassthroughServiceImplementation;
-using android::hardware::tv::cec::V2_0::IHdmiCec;
-
-int main() {
- return defaultPassthroughServiceImplementation<IHdmiCec>();
-}
diff --git a/tv/cec/2.0/types.hal b/tv/cec/2.0/types.hal
deleted file mode 100644
index cad6c39..0000000
--- a/tv/cec/2.0/types.hal
+++ /dev/null
@@ -1,548 +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.
- */
-
-package android.hardware.tv.cec@2.0;
-
-import android.hidl.safe_union@1.0;
-
-/**
- * CEC device type as specified in CEC Table 11-7 of the CEC spec 2.0b.
- */
-enum CecDeviceType : int32_t {
- INACTIVE = -1,
- TV = 0,
- RECORDER = 1,
- TUNER = 3,
- PLAYBACK = 4,
- AUDIO_SYSTEM = 5,
- PURE_CEC_SWITCH = 6,
- PROCESSOR = 7,
- MAX = PROCESSOR,
-};
-
-/**
- * CEC logical address as specified in CEC Table 11-9 of the CEC spec 2.0b.
- */
-enum CecLogicalAddress : int32_t {
- TV = 0,
- RECORDER_1 = 1,
- RECORDER_2 = 2,
- TUNER_1 = 3,
- PLAYBACK_1 = 4,
- AUDIO_SYSTEM = 5,
- TUNER_2 = 6,
- TUNER_3 = 7,
- PLAYBACK_2 = 8,
- RECORDER_3 = 9,
- TUNER_4 = 10,
- PLAYBACK_3 = 11,
- BACKUP_1 = 12, // backup1 for Playback/Recording/Tuner/Processor device
- BACKUP_2 = 13, // backup2 for Playback/Recording/Tuner/Processor device
- SPECIFIC_USE = 14,
- UNREGISTERED = 15, // as Initiator address
- BROADCAST = 15, // as Destination address
-};
-
-/**
- * HDMI CEC message types.
- *
- * The assigned values represent opcode used in CEC frame as specified in
- * Section 11.10 of the CEC spec 2.0b on top of Section CEC 15 of the CEC
- * Spec 1.4b.
- */
-enum CecMessageType : int32_t {
- FEATURE_ABORT = 0x00,
- IMAGE_VIEW_ON = 0x04,
- TUNER_STEP_INCREMENT = 0x05,
- TUNER_STEP_DECREMENT = 0x06,
- TUNER_DEVICE_STATUS = 0x07,
- GIVE_TUNER_DEVICE_STATUS = 0x08,
- RECORD_ON = 0x09,
- RECORD_STATUS = 0x0A,
- RECORD_OFF = 0x0B,
- TEXT_VIEW_ON = 0x0D,
- RECORD_TV_SCREEN = 0x0F,
- GIVE_DECK_STATUS = 0x1A,
- DECK_STATUS = 0x1B,
- SET_MENU_LANGUAGE = 0x32,
- CLEAR_ANALOG_TIMER = 0x33,
- SET_ANALOG_TIMER = 0x34,
- TIMER_STATUS = 0x35,
- STANDBY = 0x36,
- PLAY = 0x41,
- DECK_CONTROL = 0x42,
- TIMER_CLEARED_STATUS = 0x43,
- USER_CONTROL_PRESSED = 0x44,
- USER_CONTROL_RELEASED = 0x45,
- GIVE_OSD_NAME = 0x46,
- SET_OSD_NAME = 0x47,
- SET_OSD_STRING = 0x64,
- SET_TIMER_PROGRAM_TITLE = 0x67,
- SYSTEM_AUDIO_MODE_REQUEST = 0x70,
- GIVE_AUDIO_STATUS = 0x71,
- SET_SYSTEM_AUDIO_MODE = 0x72,
- REPORT_AUDIO_STATUS = 0x7A,
- GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D,
- SYSTEM_AUDIO_MODE_STATUS = 0x7E,
- ROUTING_CHANGE = 0x80,
- ROUTING_INFORMATION = 0x81,
- ACTIVE_SOURCE = 0x82,
- GIVE_PHYSICAL_ADDRESS = 0x83,
- REPORT_PHYSICAL_ADDRESS = 0x84,
- REQUEST_ACTIVE_SOURCE = 0x85,
- SET_STREAM_PATH = 0x86,
- DEVICE_VENDOR_ID = 0x87,
- VENDOR_COMMAND = 0x89,
- VENDOR_REMOTE_BUTTON_DOWN = 0x8A,
- VENDOR_REMOTE_BUTTON_UP = 0x8B,
- GIVE_DEVICE_VENDOR_ID = 0x8C,
- MENU_REQUEST = 0x8D,
- MENU_STATUS = 0x8E,
- GIVE_DEVICE_POWER_STATUS = 0x8F,
- REPORT_POWER_STATUS = 0x90,
- GET_MENU_LANGUAGE = 0x91,
- SELECT_ANALOG_SERVICE = 0x92,
- SELECT_DIGITAL_SERVICE = 0x93,
- SET_DIGITAL_TIMER = 0x97,
- CLEAR_DIGITAL_TIMER = 0x99,
- SET_AUDIO_RATE = 0x9A,
- INACTIVE_SOURCE = 0x9D,
- CEC_VERSION = 0x9E,
- GET_CEC_VERSION = 0x9F,
- VENDOR_COMMAND_WITH_ID = 0xA0,
- CLEAR_EXTERNAL_TIMER = 0xA1,
- SET_EXTERNAL_TIMER = 0xA2,
- REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3,
- REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4,
- GIVE_FEATURES = 0XA5,
- REPORT_FEATURES = 0xA6,
- REQUEST_CURRENT_LATENCY = 0xA7,
- REPORT_CURRENT_LATENCY = 0xA8,
- INITIATE_ARC = 0xC0,
- REPORT_ARC_INITIATED = 0xC1,
- REPORT_ARC_TERMINATED = 0xC2,
- REQUEST_ARC_INITIATION = 0xC3,
- REQUEST_ARC_TERMINATION = 0xC4,
- TERMINATE_ARC = 0xC5,
- ABORT = 0xFF,
- POLLING_MESSAGE = 0xFFFFFF00, // used for cec polling message
-};
-
-/**
- * Abort Reason as specified in CEC Table 29 of the CEC spec 1.4b.
- */
-enum AbortReason : int32_t {
- UNRECOGNIZED_MODE = 0,
- NOT_IN_CORRECT_MODE = 1,
- CANNOT_PROVIDE_SOURCE = 2,
- INVALID_OPERAND = 3,
- REFUSED = 4,
- UNABLE_TO_DETERMINE = 5,
-};
-
-enum MaxLength : int32_t {
- MESSAGE_BODY = 14,
-};
-
-struct CecMessage {
- /** logical address of sender */
- CecLogicalAddress initiator;
-
- /** logical address of receiver */
- CecLogicalAddress destination;
-
- /** cec message type */
- CecMessageType cecMessageType;
-
- /**
- * The maximum size of body is 14 (MaxLength::MESSAGE_BODY) as specified in
- * the section 6 of the CEC Spec 1.4b. Overflowed data must be ignored.
- */
- vec<uint8_t> body;
-};
-
-/**
- * error code used for send_message.
- */
-enum SendMessageResult : int32_t {
- SUCCESS = 0,
- NACK = 1, // not acknowledged
- BUSY = 2, // bus is busy
- FAIL = 3,
-};
-
-/**
- * CEC All Device Type Value as specified in Table 11-30 of the CEC spec 2.0b.
- */
-enum CecAllDeviceTypeValue : uint8_t {
- RESERVED_DEVICE_2 = 1 << 0,
- RESERVED_DEVICE_1 = 1 << 1,
- CEC_SWITCH_DEVICE = 1 << 2,
- AUDIO_DEVICE = 1 << 3,
- PLAYBACK_DEVICE = 1 << 4,
- TUNER_DEVICE = 1 << 5,
- RECORDING_DEVICE = 1 << 6,
- TV_DEVICE = 1 << 7,
-};
-
-/**
- * CEC All Device Types
- *
- * It is a combination of all supported type from CecAllDeviceTypeValue.
- * For example a record with tuner functionalitye,
- * cecAllDeviceTypes = ((CecAllDeviceTypeValue::RECORDING_DEVICE)
- * |(CecAllDeviceTypeValue::TUNER_DEVICE))
- */
-typedef bitfield<CecAllDeviceTypeValue> CecAllDeviceTypes;
-
-/**
- * CEC Versions as specified in CEC Table 11-30 of the CEC spec 2.0b.
- */
-enum CecVersion : int32_t {
- V_1_3_A = 0x04,
- V_1_4 = 0x05, // indicate CEC 1.4, 1.4a or 1.4b
- V_2_0 = 0x06,
-};
-
-/**
- * Device Feature
- *
- * It is specified in CEC Table 11-30 of the CEC spec 2.0b. As a uint32 there
- * is room for future extensions aka DeviceFeature2 through DeviceFeature4.
- */
-enum CecDeviceFeature : uint32_t {
- RESERVED = 1 << 0,
- SOURCE_SUPPORT_ARC_RX = 1 << 1,
- SINK_SUPPORT_ARC_TX = 1 << 2,
- SOURCE_SUPPORT_SET_AUDIO_RATE = 1 << 3,
- SUPPORT_CONTROLLED_BY_DECK = 1 << 4,
- TV_SUPPORT_SET_OSD_STRINGS = 1 << 5,
- TV_SUPPORT_RECORD_TV_SCREEN = 1 << 6,
-};
-
-/**
- * CEC Device Features
- *
- * It is a combination of all supported features from CecDeviceFeature.
- * For example a TV with OSD and ARC capabilities,
- * CecDeviceFeatures = ((CecDeviceFeature::TV_SUPPORT_SET_OSD_STRINGS)
- * |(CecDeviceFeature::SINK_SUPPORT_ARC_TX))
- */
-typedef bitfield<CecDeviceFeature> CecDeviceFeatures;
-
-/**
- * Remote Control Profile
- *
- * It is specified in CEC Table 11-30 of the CEC spec 2.0b.
- */
-enum CecRcProfileId : uint8_t {
- NONE = 0, // TV doesn’t support any of these profiles
- RC_PROFILE_1 = 0x02, // minimalistic zapper (low button count)
- RC_PROFILE_2 = 0x06, // intermediate between profile 1 and profile 3
- RC_PROFILE_3 = 0x0A, // typical TV remote
- RC_PROFILE_4 = 0x0E, // extended form of profile 3
-};
-
-/**
- * Remote Control Profile Source
- *
- * It is specified in CEC Table 11-30 of the CEC spec 2.0b.
- */
-enum CecRcProfileSource : uint8_t {
- MEDIA_CONTEXT_SENSITIVE = 1 << 0, // source can handle UI command 0x11
- MEDIA_TO = 1 << 1, // source can handle UI command 0x10
- CONTENTS = 1 << 2, // source can handle UI command 0x0B
- DEVICE_SETUP = 1 << 3, // source can handle UI command 0x0A
- DEVICE_ROOT = 1 << 4, // source can handle UI command 0x09
- SOURCE_FLAG = 1 << 6, // Indicate the profile is for source
-};
-
-/**
- * Remote Control Profile for either TV or Source.
- */
-safe_union CecRcProfile1 {
- /** CEC remote control profile for TV. */
- CecRcProfileId profileId;
-
- /* CEC remote control profile for source
- *
- * It is a combination of all supported profiles from CecRcProfileSource.
- * For example a playback device support root menu and setup menu,
- * profileSource = ((CecRcProfileSource::DEVICE_ROOT)
- * |(CecRcProfileSource::DEVICE_SETUP)
- * |(CecRcProfileSource::SOURCE_FLAG))
- */
- bitfield<CecRcProfileSource> profileSource;
-};
-
-/**
- * CEC Remote Control Profiles
- *
- * CEC 2.0 only use one byte to represent Remote Control Profile.
- */
-struct CecRcProfile {
- CecRcProfile1 rcProfile1;
-};
-
-/**
- * CEC device power states as specified in CEC Table 11-10 of the CEC spec 2.0b
- */
-enum CecPowerState : int8_t {
- ON = 0,
- STANDBY = 1,
- ON_TO_STANDBY = 2,
- STANDBY_TO_ON = 4,
- UNKNOWN = 0xFF, // some devices may not report power status
-};
-
-/** CEC physical address of device */
-typedef uint16_t CecPhysicalAddress;
-
-/**
- * CEC device information
- *
- * It is initially built during addressing specified in CEC section 11.3 of
- * the CEC spec 2.0b. It may be updated with cec devices's status changed.
- */
-struct CecDeviceInfo {
- /** CEC version which device supports */
- CecVersion version;
-
- /** CEC device primary type */
- CecDeviceType devceType;
-
- /** CEC all device types */
- CecAllDeviceTypes allDeviceTypes;
-
- /** CEC device features */
- CecDeviceFeatures deviceFeatures;
-
- /** CEC Device Remote Control Profile */
- CecRcProfile rcProfile;
-
- /** CEC Device Vendor ID */
- uint32_t vendorId;
-
- /** logical address of device */
- CecLogicalAddress logicalAddress;
-
- /** physical of device */
- CecPhysicalAddress physicalAddress;
-
- /** power status of device */
- CecPowerState powerState;
-};
-
-/**
- * Topology Event Type.
- */
-enum CecTopologyEventType : int32_t {
- DEVICE_ADDED,
- DEVICE_REMOVED,
- DEVICE_UPDATED,
-};
-
-/**
- * Topology Event.
- */
-struct CecTopologyEvent {
- CecTopologyEventType eventType;
- CecLogicalAddress logicalAddress;
- CecPhysicalAddress physicalAddress;
-
- /** true if the event is about the device which the system run on */
- bool isHostDevice;
-};
-
-
-/**
- * CEC UI Command Codes as specified in CEC Table 11-31 of the CEC spec 2.0b
- */
-enum CecUICommandCodes : int32_t {
- SELECT_OK = 0x00,
- UP = 0x01,
- DOWN = 0x02,
- LEFT = 0x03,
- RIGHT = 0x04,
- RIGHT_UP = 0x05,
- RIGHT_DOWN = 0x06,
- LEFT_UP = 0x07,
- LEFT_DOWN = 0x08,
- DEVICE_ROOT_MENU = 0x09,
- DEVICE_SETUP_MENU = 0x0A,
- CONTENTS_MENU = 0x0B,
- FAVORITE_MENU = 0x0C,
- BACK = 0x0D,
- MEDIA_TOP_MENU = 0x10,
- MEDIA_CONTEXT_SENSITIVE_MENU = 0x11,
- NUMBER_ENTRY_MODE = 0x1D,
- NUMBER_11 = 0x1E,
- NUMBER_12 = 0x1F,
- NUMBER_0 = 0x20, // or NUMBER 10
- NUMBER_1 = 0x21,
- NUMBER_2 = 0x22,
- NUMBER_3 = 0x23,
- NUMBER_4 = 0x24,
- NUMBER_5 = 0x25,
- NUMBER_6 = 0x26,
- NUMBER_7 = 0x27,
- NUMBER_8 = 0x28,
- NUMBER_9 = 0x29,
- DOT = 0x2A,
- ENTER = 0x2B,
- CLEAR = 0x2C,
- NEXT_FAVORITE = 0x2F,
- CHANNEL_UP = 0x30,
- CHANNEL_DOWN = 0x31,
- PREVIOUS_CHANNEL = 0x32,
- SOUND_SELECT = 0x33,
- INPUT_SELECT = 0x34,
- DISPLAY_INFORMATION = 0x35,
- HELP = 0x36,
- PAGE_UP = 0x37,
- PAGE_DOWN = 0x38,
- POWER = 0x40,
- VOLUME_UP = 0x41,
- VOLUME_DOWN = 0x42,
- MUTE = 0x43,
- PLAY = 0x44,
- STOP = 0x45,
- PAUSE = 0x46,
- RECORD = 0x47,
- REWIND = 0x48,
- FAST_FORWARD = 0x49,
- EJECT = 0x4A,
- SKIP_FORWARD = 0x4B,
- SKIP_BACKWARD = 0x4C,
- STOP_RECORD = 0x4D,
- PAUSE_RECORD = 0x4E,
- ANGLE = 0x50,
- SUB_PICTURE = 0x51,
- VIDEO_ON_DEMAND = 0x52,
- ELECTRONIC_PROGRAM_GUIDE = 0x53,
- TIMER_PROGRAMMING = 0x54,
- INITIAL_CONFIGURATION = 0x55,
- SELECT_BROADCAST_TYPE = 0x56,
- SELECT_SOUND_PRESENTATION = 0x57,
- AUDIO_DESCRIPTION = 0x58,
- INTERNET = 0x59,
- THREE_DIMENSIONAL_MODE = 0x5A,
- PLAY_FUNCTION = 0x60,
- PAUSE_PLAY_FUNCTION = 0x61,
- RECORD_FUNCTION = 0x62,
- PAUSE_RECORD_FUNCTION = 0x63,
- STOP_FUNCTION = 0x64,
- MUTE_FUNCTION = 0x65,
- RESTORE_VOLUME_FUNCTION = 0x66,
- TUNE_FUNCTION = 0x67,
- SELECT_MEDIA_FUNCTION = 0x68,
- SELECT_AV_INPUT_FUNCTION = 0x69,
- SELECT_AUDIO_INPUT_FUNCTION = 0x6A,
- POWER_TOGGLE_FUNCTION = 0x6B,
- POWER_OFF_FUNCTION = 0x6C,
- POWER_ON_FUNCTION = 0x6D,
- F1 = 0x71, // BLUE
- F2 = 0x72, // RED
- F3 = 0x73, // GREEN
- F4 = 0x74, // YELLOW
- F5 = 0x75,
- DATA = 0x76,
-};
-
-/**
- * HDMI port type.
- */
-enum HdmiPortType : int32_t {
- INPUT = 0,
- OUTPUT = 1,
-};
-
-/**
- * Options used for IHdmiCec.setOption()
- */
-enum OptionKey : int32_t {
- /**
- * When set to false, HAL does not wake up the system upon receiving <Image
- * View On> or <Text View On>. Used when user changes the TV settings to
- * disable the auto TV on functionality.
- * Deprecated since <Image View On> and <Text View On> become mandatory
- * featrues for CEC device. Use ENABLE_CEC OptionKey to disable CEC
- * functionality instead.
- * True by Default
- */
- WAKEUP = 1,
-
- /**
- * When set to false, all the CEC commands are discarded. if logical address
- * is ever used, it shall be released. Used when user changes the TV
- * settings to disable CEC functionality.
- * True by default.
- *
- */
- ENABLE_CEC = 2,
-
- /**
- * Setting this flag to false means Android system must stop handling CEC
- * service and yield the control over to the microprocessor that is powered
- * on through the standby mode.The microprocessor shall keep current logical
- * and physical address. It shall response POLLING_MESSAGE, GIVE_FEATURES,
- * GIVE_DEVICE_POWER_STATUS,GIVE_DEVICE_VENDOR_ID and GIVE_PHYSICAL_ADDRESS
- * to allow other CEC devices to build CEC devices map specified in CEC
- * section 11.3 of the CEC spec 2.0b.
- * When set to true, the system must gain the control over, hence telling
- * the microprocessor to start forwarding CEC messages to Android system.
- * For example, this may be called when system goes in and out of
- * standby mode to notify the microprocessor that it should start/stop
- * handling CEC commands on behalf of the system.
- * True by default.
- */
- SYSTEM_CEC_CONTROL = 3,
-
- /* Option 4 not used */
-};
-
-/**
- * Hdmi port ID.
- *
- * It shall start from 1 which corresponds to HDMI "port 1".
- */
-typedef uint32_t HdmiPortId;
-
-/** Hdmi hotplug event */
-struct HotplugEvent {
- bool connected;
- HdmiPortId portId;
-};
-
-/**
- * HDMI port descriptor
- */
-struct HdmiPortInfo {
- HdmiPortType type;
- HdmiPortId portId;
- bool cecSupported;
- bool arcSupported;
- CecPhysicalAddress physicalAddress;
-};
-
-enum Result : int32_t {
- SUCCESS = 0,
- FAILURE_UNKNOWN = 1,
- FAILURE_INVALID_ARGS = 2,
- FAILURE_INVALID_STATE = 3,
- FAILURE_NOT_SUPPORTED = 4,
- FAILURE_BUSY = 5,
-};