Merge "Move canhalconfigurator to /system_ext"
diff --git a/audio/README.md b/audio/README.md
index 1938ad4..3f40d72 100644
--- a/audio/README.md
+++ b/audio/README.md
@@ -2,10 +2,29 @@
Directory structure of the audio HAL related code.
-Run `common/all-versions/copyHAL.sh` to create a new version of the audio HAL
-based on an existing one.
+## Directory Structure for AIDL audio HAL
-## Directory Structure
+The AIDL version is located inside `aidl` directory. The tree below explains
+the role of each subdirectory:
+
+* `aidl_api` — snapshots of the API created each Android release. Every
+ release, the current version of the API becomes "frozen" and gets assigned
+ the next version number. If the API needs further modifications, they are
+ made on the "current" version. After making modifications, run
+ `m <package name>-update-api` to update the snapshot of the "current"
+ version.
+* `android/hardware/audio/common` — data structures and interfaces shared
+ between various HALs: BT HAL, core and effects audio HALs.
+* `android/hardware/audio/core` — data structures and interfaces of the
+ core audio HAL.
+* `default` — the default, reference implementation of the audio HAL service.
+* `vts` — VTS tests for the AIDL HAL.
+
+## Directory Structure for HIDL audio HAL
+
+Run `common/all-versions/copyHAL.sh` to create a new version of the HIDL audio
+HAL based on an existing one. Note that this isn't possible since Android T
+release. Android U and above uses AIDL audio HAL.
* `2.0` — version 2.0 of the core HIDL API. Note that `.hal` files
can not be moved into the `core` directory because that would change
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 56ac510..01af940 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -226,6 +226,7 @@
srcs: [
"android/hardware/audio/effect/AcousticEchoCanceler.aidl",
"android/hardware/audio/effect/AutomaticGainControl.aidl",
+ "android/hardware/audio/effect/AutomaticGainControlV1.aidl",
"android/hardware/audio/effect/BassBoost.aidl",
"android/hardware/audio/effect/Capability.aidl",
"android/hardware/audio/effect/CommandId.aidl",
@@ -243,6 +244,7 @@
"android/hardware/audio/effect/Parameter.aidl",
"android/hardware/audio/effect/PresetReverb.aidl",
"android/hardware/audio/effect/Processing.aidl",
+ "android/hardware/audio/effect/Range.aidl",
"android/hardware/audio/effect/State.aidl",
"android/hardware/audio/effect/VendorExtension.aidl",
"android/hardware/audio/effect/Virtualizer.aidl",
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
index e8fdd74..45217e7 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
@@ -70,6 +70,10 @@
void removeDeviceEffect(int portConfigId, in android.hardware.audio.effect.IEffect effect);
android.media.audio.common.AudioMMapPolicyInfo[] getMmapPolicyInfos(android.media.audio.common.AudioMMapPolicyType mmapPolicyType);
boolean supportsVariableLatency();
+ int getAAudioMixerBurstCount();
+ int getAAudioHardwareBurstMinUsec();
+ const int DEFAULT_AAUDIO_MIXER_BURST_COUNT = 2;
+ const int DEFAULT_AAUDIO_HARDWARE_BURST_MIN_DURATION_US = 1000;
@VintfStability
parcelable OpenInputStreamArguments {
int portConfigId;
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
new file mode 100644
index 0000000..ff010c6
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+union AutomaticGainControlV1 {
+ android.hardware.audio.effect.VendorExtension vendor;
+ int targetPeakLevelDbFs;
+ int maxCompressionGainDb;
+ boolean enableLimiter;
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ android.hardware.audio.effect.AutomaticGainControlV1.Tag commonTag;
+ }
+ @VintfStability
+ parcelable Capability {
+ ParcelableHolder extension;
+ android.hardware.audio.effect.Range[] ranges;
+ }
+}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
index 397f897..1cf92ef 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -50,5 +50,6 @@
LOW,
MEDIUM,
HIGH,
+ VERY_HIGH,
}
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
new file mode 100644
index 0000000..531d3a1
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.effect;
+@VintfStability
+parcelable Range {
+ int tag;
+ android.hardware.audio.effect.Range.Types types;
+ @VintfStability
+ parcelable Int {
+ int min;
+ int max;
+ }
+ @VintfStability
+ parcelable Float {
+ float min;
+ float max;
+ }
+ @VintfStability
+ parcelable Long {
+ long min;
+ long max;
+ }
+ @VintfStability
+ parcelable Byte {
+ byte min;
+ byte max;
+ }
+ @VintfStability
+ union Types {
+ android.hardware.audio.effect.Range.Int rangeInt;
+ android.hardware.audio.effect.Range.Float rangeFloat;
+ android.hardware.audio.effect.Range.Long rangeLong;
+ android.hardware.audio.effect.Range.Byte rangeByte;
+ }
+}
diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index 1b25f17..968b573 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -833,4 +833,31 @@
* @return Whether the module supports variable latency control.
*/
boolean supportsVariableLatency();
+
+ /**
+ * Default value for number of bursts per aaudio mixer cycle. This is a suggested value
+ * to return for the HAL module, unless it is known that a better option exists.
+ */
+ const int DEFAULT_AAUDIO_MIXER_BURST_COUNT = 2;
+ /**
+ * Get the number of bursts per aaudio mixer cycle.
+ *
+ * @return The number of burst per aaudio mixer cycle.
+ * @throw EX_UNSUPPORTED_OPERATION If the module does not support aaudio MMAP.
+ */
+ int getAAudioMixerBurstCount();
+
+ /**
+ * Default value for minimum duration in microseconds for a MMAP hardware burst. This
+ * is a suggested value to return for the HAL module, unless it is known that a better
+ * option exists.
+ */
+ const int DEFAULT_AAUDIO_HARDWARE_BURST_MIN_DURATION_US = 1000;
+ /**
+ * Get the minimum duration in microseconds for a MMAP hardware burst.
+ *
+ * @return The minimum number of microseconds for a MMAP hardware burst.
+ * @throw EX_UNSUPPORTED_OPERATION If the module does not support aaudio MMAP.
+ */
+ int getAAudioHardwareBurstMinUsec();
}
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
new file mode 100644
index 0000000..d6e0648
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+import android.hardware.audio.effect.Range;
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * Automatic Gain Control (AGC) is an audio pre-processor which automatically normalizes the output
+ * of the captured signal by boosting or lowering input from the microphone to match a preset level
+ * so that the output signal level is virtually constant. AGC can be used by applications where the
+ * input signal dynamic range is not important but where a constant strong capture level is desired.
+ *
+ * All parameters defined in union AutomaticGainControlV1 must be gettable and settable. The
+ * capabilities defined in AutomaticGainControlV1.Capability can only acquired with
+ * IEffect.getDescriptor() and not settable.
+ */
+@VintfStability
+union AutomaticGainControlV1 {
+ /**
+ * Effect parameter tag to identify the parameters for getParameter().
+ */
+ @VintfStability
+ union Id {
+ int vendorExtensionTag;
+ AutomaticGainControlV1.Tag commonTag;
+ }
+
+ /**
+ * Vendor AutomaticGainControlV1 implementation definition for additional parameters.
+ */
+ VendorExtension vendor;
+
+ /**
+ * Capability supported by AutomaticGainControlV1 implementation.
+ */
+ @VintfStability
+ parcelable Capability {
+ /**
+ * AutomaticGainControlV1 capability extension, vendor can use this extension in case
+ * existing capability definition not enough.
+ */
+ ParcelableHolder extension;
+ /**
+ * Supported range for parameters.
+ */
+ Range[] ranges;
+ }
+
+ /**
+ * Target peak level (or envelope) of the AGC implementation in dBFs (dB relative to full
+ * scale).
+ * Must be in range of AutomaticGainControlV1.Capability.ranges with targetPeakLevelDbFs tag.
+ */
+ int targetPeakLevelDbFs;
+ /*
+ * Sets the maximum gain the digital compression stage may apply, in dB. A higher number
+ * corresponds to greater compression, while a value of 0 will leave the signal uncompressed.
+ * Must be in range of AutomaticGainControlV1.Capability.ranges with maxCompressionGainDb tag.
+ */
+ int maxCompressionGainDb;
+ /**
+ * Enable or disable limiter.
+ * When enabled, the compression stage will hard limit the signal to the target level.
+ * Otherwise, the signal will be compressed but not limited above the target level.
+ */
+ boolean enableLimiter;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
index 946fa87..9969a0b 100644
--- a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -62,7 +62,7 @@
* suppression, NsConfig::SuppressionLevel::k12dB for MEDIUM, and
* NsConfig::SuppressionLevel::k18dB for HIGH.
*/
- @VintfStability @Backing(type="int") enum Level { LOW, MEDIUM, HIGH }
+ @VintfStability @Backing(type="int") enum Level { LOW, MEDIUM, HIGH, VERY_HIGH }
/**
* The NS level.
diff --git a/audio/aidl/android/hardware/audio/effect/Range.aidl b/audio/aidl/android/hardware/audio/effect/Range.aidl
new file mode 100644
index 0000000..c052502
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/Range.aidl
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio.effect;
+
+/**
+ * Define the range (min and max) of a certain field, identified by tag.
+ * Can be used by effect capabilities to define supported value ranges.
+ */
+@VintfStability
+parcelable Range {
+ /**
+ * The union tag name which the range is defined for.
+ * For example: if used in AutomaticGainControlV1.Capability, value of Range.tag could be
+ * targetLevelDbFs or compressionGainDb.
+ */
+ int tag;
+
+ @VintfStability
+ parcelable Int {
+ int min;
+ int max;
+ }
+
+ @VintfStability
+ parcelable Float {
+ float min;
+ float max;
+ }
+
+ @VintfStability
+ parcelable Long {
+ long min;
+ long max;
+ }
+
+ @VintfStability
+ parcelable Byte {
+ byte min;
+ byte max;
+ }
+
+ @VintfStability
+ union Types {
+ Int rangeInt;
+ Float rangeFloat;
+ Long rangeLong;
+ Byte rangeByte;
+ }
+
+ Types types;
+}
diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp
index 6d5357b..854c7f3 100644
--- a/audio/aidl/default/Configuration.cpp
+++ b/audio/aidl/default/Configuration.cpp
@@ -76,6 +76,11 @@
std::string connection = "") {
AudioPortDeviceExt deviceExt;
deviceExt.device.type.type = devType;
+ if (devType == AudioDeviceType::IN_MICROPHONE && connection.empty()) {
+ deviceExt.device.address = "bottom";
+ } else if (devType == AudioDeviceType::IN_MICROPHONE_BACK && connection.empty()) {
+ deviceExt.device.address = "back";
+ }
deviceExt.device.type.connection = std::move(connection);
deviceExt.flags = flags;
return AudioPortExt::make<AudioPortExt::Tag::device>(deviceExt);
@@ -393,4 +398,73 @@
return std::make_unique<Configuration>(configuration);
}
+// Usb configuration:
+//
+// Device ports:
+// * "USB Headset Out", OUT_HEADSET, CONNECTION_USB
+// - no profiles specified
+// * "USB Headset In", IN_HEADSET, CONNECTION_USB
+// - no profiles specified
+//
+// Mix ports:
+// * "usb_headset output", 1 max open, 1 max active stream
+// - no profiles specified
+// * "usb_headset input", 1 max open, 1 max active stream
+// - no profiles specified
+//
+// Profiles for device port connected state:
+// * USB Headset Out":
+// - profile PCM 16-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+// - profile PCM 24-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+// * USB Headset In":
+// - profile PCM 16-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+// - profile PCM 24-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+//
+std::unique_ptr<Configuration> getUsbConfiguration() {
+ static const Configuration configuration = []() {
+ const std::vector<AudioProfile> standardPcmAudioProfiles = {
+ createProfile(PcmType::INT_16_BIT,
+ {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO,
+ AudioChannelLayout::INDEX_MASK_1, AudioChannelLayout::INDEX_MASK_2},
+ {44100, 48000}),
+ createProfile(PcmType::INT_24_BIT,
+ {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO,
+ AudioChannelLayout::INDEX_MASK_1, AudioChannelLayout::INDEX_MASK_2},
+ {44100, 48000})};
+ Configuration c;
+
+ // Device ports
+
+ AudioPort usbOutHeadset =
+ createPort(c.nextPortId++, "USB Headset Out", 0, false,
+ createDeviceExt(AudioDeviceType::OUT_HEADSET, 0,
+ AudioDeviceDescription::CONNECTION_USB));
+ c.ports.push_back(usbOutHeadset);
+ c.connectedProfiles[usbOutHeadset.id] = standardPcmAudioProfiles;
+
+ AudioPort usbInHeadset =
+ createPort(c.nextPortId++, "USB Headset In", 0, true,
+ createDeviceExt(AudioDeviceType::IN_HEADSET, 0,
+ AudioDeviceDescription::CONNECTION_USB));
+ c.ports.push_back(usbInHeadset);
+ c.connectedProfiles[usbInHeadset.id] = standardPcmAudioProfiles;
+
+ // Mix ports
+
+ AudioPort usbHeadsetOutMix =
+ createPort(c.nextPortId++, "usb_headset output", 0, false, createPortMixExt(1, 1));
+ c.ports.push_back(usbHeadsetOutMix);
+
+ AudioPort usbHeadsetInMix =
+ createPort(c.nextPortId++, "usb_headset input", 0, true, createPortMixExt(1, 1));
+ c.ports.push_back(usbHeadsetInMix);
+
+ c.routes.push_back(createRoute({usbHeadsetOutMix}, usbOutHeadset));
+ c.routes.push_back(createRoute({usbInHeadset}, usbHeadsetInMix));
+
+ return c;
+ }();
+ return std::make_unique<Configuration>(configuration);
+}
+
} // namespace aidl::android::hardware::audio::core::internal
diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp
index b24ca63..403a4b9 100644
--- a/audio/aidl/default/EffectImpl.cpp
+++ b/audio/aidl/default/EffectImpl.cpp
@@ -49,7 +49,6 @@
auto context = createContext(common);
RETURN_IF(!context, EX_NULL_POINTER, "createContextFailed");
- RETURN_IF_ASTATUS_NOT_OK(setParameterCommon(common), "setCommParamErr");
if (specific.has_value()) {
RETURN_IF_ASTATUS_NOT_OK(setParameterSpecific(specific.value()), "setSpecParamErr");
}
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 40d32b3..82d1ef8 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -259,6 +259,8 @@
case Type::R_SUBMIX:
mConfig = std::move(internal::getRSubmixConfiguration());
break;
+ case Type::USB:
+ mConfig = std::move(internal::getUsbConfiguration());
}
}
return *mConfig;
@@ -1151,4 +1153,41 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Module::getAAudioMixerBurstCount(int32_t* _aidl_return) {
+ if (!isMmapSupported()) {
+ LOG(DEBUG) << __func__ << ": mmap is not supported ";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ *_aidl_return = DEFAULT_AAUDIO_MIXER_BURST_COUNT;
+ LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Module::getAAudioHardwareBurstMinUsec(int32_t* _aidl_return) {
+ if (!isMmapSupported()) {
+ LOG(DEBUG) << __func__ << ": mmap is not supported ";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ *_aidl_return = DEFAULT_AAUDIO_HARDWARE_BURST_MIN_DURATION_US;
+ LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+ return ndk::ScopedAStatus::ok();
+}
+
+bool Module::isMmapSupported() {
+ if (mIsMmapSupported.has_value()) {
+ return mIsMmapSupported.value();
+ }
+ std::vector<AudioMMapPolicyInfo> mmapPolicyInfos;
+ if (!getMmapPolicyInfos(AudioMMapPolicyType::DEFAULT, &mmapPolicyInfos).isOk()) {
+ mIsMmapSupported = false;
+ } else {
+ mIsMmapSupported =
+ std::find_if(mmapPolicyInfos.begin(), mmapPolicyInfos.end(), [](const auto& info) {
+ return info.mmapPolicy == AudioMMapPolicy::AUTO ||
+ info.mmapPolicy == AudioMMapPolicy::ALWAYS;
+ }) != mmapPolicyInfos.end();
+ }
+ return mIsMmapSupported.value();
+}
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/android.hardware.audio.service-aidl.xml b/audio/aidl/default/android.hardware.audio.service-aidl.xml
index 46b665f..9636a58 100644
--- a/audio/aidl/default/android.hardware.audio.service-aidl.xml
+++ b/audio/aidl/default/android.hardware.audio.service-aidl.xml
@@ -12,6 +12,11 @@
<hal format="aidl">
<name>android.hardware.audio.core</name>
<version>1</version>
+ <fqname>IModule/usb</fqname>
+ </hal>
+ <hal format="aidl">
+ <name>android.hardware.audio.core</name>
+ <version>1</version>
<fqname>IConfig/default</fqname>
</hal>
</manifest>
diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h
index 3b4c494..1aca1fe 100644
--- a/audio/aidl/default/include/core-impl/Configuration.h
+++ b/audio/aidl/default/include/core-impl/Configuration.h
@@ -44,5 +44,6 @@
std::unique_ptr<Configuration> getPrimaryConfiguration();
std::unique_ptr<Configuration> getRSubmixConfiguration();
+std::unique_ptr<Configuration> getUsbConfiguration();
} // namespace aidl::android::hardware::audio::core::internal
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index c09520f..80a22dc 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -31,7 +31,7 @@
public:
// This value is used for all AudioPatches and reported by all streams.
static constexpr int32_t kLatencyMs = 10;
- enum Type : int { DEFAULT, R_SUBMIX };
+ enum Type : int { DEFAULT, R_SUBMIX, USB };
explicit Module(Type type) : mType(type) {}
@@ -115,6 +115,8 @@
std::vector<::aidl::android::media::audio::common::AudioMMapPolicyInfo>* _aidl_return)
override;
ndk::ScopedAStatus supportsVariableLatency(bool* _aidl_return) override;
+ ndk::ScopedAStatus getAAudioMixerBurstCount(int32_t* _aidl_return) override;
+ ndk::ScopedAStatus getAAudioHardwareBurstMinUsec(int32_t* _aidl_return) override;
void cleanUpPatch(int32_t patchId);
ndk::ScopedAStatus createStreamContext(
@@ -132,6 +134,7 @@
std::set<int32_t> portIdsFromPortConfigIds(C portConfigIds);
void registerPatch(const AudioPatch& patch);
void updateStreamsConnectedState(const AudioPatch& oldPatch, const AudioPatch& newPatch);
+ bool isMmapSupported();
// This value is used for all AudioPatches.
static constexpr int32_t kMinimumStreamBufferSizeFrames = 16;
@@ -159,6 +162,7 @@
bool mMicMute = false;
std::shared_ptr<sounddose::ISoundDose> mSoundDose;
ndk::SpAIBinder mSoundDoseBinder;
+ std::optional<bool> mIsMmapSupported;
};
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/effect-impl/EffectContext.h b/audio/aidl/default/include/effect-impl/EffectContext.h
index 7bbf19e..2ab0ade 100644
--- a/audio/aidl/default/include/effect-impl/EffectContext.h
+++ b/audio/aidl/default/include/effect-impl/EffectContext.h
@@ -37,7 +37,6 @@
DataMQ;
EffectContext(size_t statusDepth, const Parameter::Common& common) {
- mSessionId = common.session;
auto& input = common.input;
auto& output = common.output;
@@ -63,6 +62,7 @@
LOG(ERROR) << __func__ << " created invalid FMQ";
}
mWorkBuffer.reserve(std::max(inBufferSizeInFloat, outBufferSizeInFloat));
+ mCommon = common;
}
virtual ~EffectContext() {}
@@ -88,7 +88,8 @@
}
size_t getInputFrameSize() { return mInputFrameSize; }
size_t getOutputFrameSize() { return mOutputFrameSize; }
- int getSessionId() { return mSessionId; }
+ int getSessionId() { return mCommon.session; }
+ int getIoHandle() { return mCommon.ioHandle; }
virtual RetCode setOutputDevice(
const std::vector<aidl::android::media::audio::common::AudioDeviceDescription>&
@@ -96,6 +97,7 @@
mOutputDevice = device;
return RetCode::SUCCESS;
}
+
virtual std::vector<aidl::android::media::audio::common::AudioDeviceDescription>
getOutputDevice() {
return mOutputDevice;
@@ -131,7 +133,6 @@
protected:
// common parameters
- int mSessionId = INVALID_AUDIO_SESSION_ID;
size_t mInputFrameSize;
size_t mOutputFrameSize;
Parameter::Common mCommon;
diff --git a/audio/aidl/default/main.cpp b/audio/aidl/default/main.cpp
index b66c134..1933509 100644
--- a/audio/aidl/default/main.cpp
+++ b/audio/aidl/default/main.cpp
@@ -55,7 +55,8 @@
return std::make_pair(module, moduleBinder);
};
auto modules = {createModule(Module::Type::DEFAULT, "default"),
- createModule(Module::Type::R_SUBMIX, "r_submix")};
+ createModule(Module::Type::R_SUBMIX, "r_submix"),
+ createModule(Module::Type::USB, "usb")};
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp
index b48d1ba..7b002ad 100644
--- a/audio/aidl/vts/ModuleConfig.cpp
+++ b/audio/aidl/vts/ModuleConfig.cpp
@@ -438,3 +438,11 @@
}
return result;
}
+
+bool ModuleConfig::isMmapSupported() const {
+ const std::vector<AudioPort> mmapOutMixPorts =
+ getMmapOutMixPorts(false /*attachedOnly*/, false /*singlePort*/);
+ const std::vector<AudioPort> mmapInMixPorts =
+ getMmapInMixPorts(false /*attachedOnly*/, false /*singlePort*/);
+ return !mmapOutMixPorts.empty() || !mmapInMixPorts.empty();
+}
diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h
index 8a55754..6a22075 100644
--- a/audio/aidl/vts/ModuleConfig.h
+++ b/audio/aidl/vts/ModuleConfig.h
@@ -139,6 +139,8 @@
return *config.begin();
}
+ bool isMmapSupported() const;
+
std::string toString() const;
private:
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index c0908c0..3ca51c7 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -1893,17 +1893,13 @@
TEST_P(AudioCoreModule, GetMmapPolicyInfos) {
ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig());
- const std::vector<AudioPort> mmapOutMixPorts =
- moduleConfig->getMmapOutMixPorts(true /*attachedOnly*/, false /*singlePort*/);
- const std::vector<AudioPort> mmapInMixPorts =
- moduleConfig->getMmapInMixPorts(true /*attachedOnly*/, false /*singlePort*/);
- const bool mmapSupported = (!mmapOutMixPorts.empty() || !mmapInMixPorts.empty());
+ const bool isMmapSupported = moduleConfig->isMmapSupported();
for (const auto mmapPolicyType :
{AudioMMapPolicyType::DEFAULT, AudioMMapPolicyType::EXCLUSIVE}) {
std::vector<AudioMMapPolicyInfo> policyInfos;
EXPECT_IS_OK(module->getMmapPolicyInfos(mmapPolicyType, &policyInfos))
<< toString(mmapPolicyType);
- EXPECT_EQ(mmapSupported, !policyInfos.empty());
+ EXPECT_EQ(isMmapSupported, !policyInfos.empty());
}
}
@@ -1913,6 +1909,33 @@
LOG(INFO) << "supportsVariableLatency: " << isSupported;
}
+TEST_P(AudioCoreModule, GetAAudioMixerBurstCount) {
+ ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig());
+ const bool isMmapSupported = moduleConfig->isMmapSupported();
+ int32_t mixerBursts = 0;
+ ndk::ScopedAStatus status = module->getAAudioMixerBurstCount(&mixerBursts);
+ EXPECT_EQ(isMmapSupported, status.getExceptionCode() != EX_UNSUPPORTED_OPERATION)
+ << "Support for AAudio MMAP and getting AAudio mixer burst count must be consistent";
+ if (!isMmapSupported) {
+ GTEST_SKIP() << "AAudio MMAP is not supported";
+ }
+ EXPECT_GE(mixerBursts, 0);
+}
+
+TEST_P(AudioCoreModule, GetAAudioHardwareBurstMinUsec) {
+ ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig());
+ const bool isMmapSupported = moduleConfig->isMmapSupported();
+ int32_t aaudioHardwareBurstMinUsec = 0;
+ ndk::ScopedAStatus status = module->getAAudioHardwareBurstMinUsec(&aaudioHardwareBurstMinUsec);
+ EXPECT_EQ(isMmapSupported, status.getExceptionCode() != EX_UNSUPPORTED_OPERATION)
+ << "Support for AAudio MMAP and getting AAudio hardware burst minimum usec "
+ << "must be consistent";
+ if (!isMmapSupported) {
+ GTEST_SKIP() << "AAudio MMAP is not supported";
+ }
+ EXPECT_GE(aaudioHardwareBurstMinUsec, 0);
+}
+
class AudioCoreBluetooth : public AudioCoreModuleBase, public testing::TestWithParam<std::string> {
public:
void SetUp() override {
diff --git a/bluetooth/aidl/TEST_MAPPING b/bluetooth/aidl/TEST_MAPPING
new file mode 100644
index 0000000..342a1e4
--- /dev/null
+++ b/bluetooth/aidl/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit" : [
+ {
+ "name" : "VtsHalBluetoothTargetTest"
+ }
+ ]
+}
diff --git a/bluetooth/aidl/default/BluetoothHci.cpp b/bluetooth/aidl/default/BluetoothHci.cpp
index dd102a1..eebbbc0 100644
--- a/bluetooth/aidl/default/BluetoothHci.cpp
+++ b/bluetooth/aidl/default/BluetoothHci.cpp
@@ -143,17 +143,17 @@
[](const std::vector<uint8_t>& /* raw_command */) {
LOG_ALWAYS_FATAL("Unexpected command!");
},
+ [this](const std::vector<uint8_t>& raw_acl) {
+ mCb->aclDataReceived(raw_acl);
+ },
+ [this](const std::vector<uint8_t>& raw_sco) {
+ mCb->scoDataReceived(raw_sco);
+ },
[this](const std::vector<uint8_t>& raw_event) {
mCb->hciEventReceived(raw_event);
},
- [this](const std::vector<uint8_t>& raw_acl) {
- mCb->hciEventReceived(raw_acl);
- },
- [this](const std::vector<uint8_t>& raw_sco) {
- mCb->hciEventReceived(raw_sco);
- },
[this](const std::vector<uint8_t>& raw_iso) {
- mCb->hciEventReceived(raw_iso);
+ mCb->isoDataReceived(raw_iso);
},
[this]() {
ALOGI("HCI socket device disconnected");
diff --git a/bluetooth/aidl/vts/Android.bp b/bluetooth/aidl/vts/Android.bp
index c6c9b9e..414f707 100644
--- a/bluetooth/aidl/vts/Android.bp
+++ b/bluetooth/aidl/vts/Android.bp
@@ -15,12 +15,12 @@
],
srcs: ["VtsHalBluetoothTargetTest.cpp"],
shared_libs: [
- "android.hardware.bluetooth-V1-ndk",
"libbase",
"libbinder_ndk",
"libcutils",
],
static_libs: [
+ "android.hardware.bluetooth-V1-ndk",
"libbluetooth-types",
],
test_config: "VtsHalBluetoothTargetTest.xml",
diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
index 27e6ebf..57a3361 100644
--- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
+++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
@@ -46,8 +46,13 @@
// Bluetooth Core Specification 3.0 + HS
static constexpr uint8_t kHciMinimumLmpVersion = 5;
+static constexpr size_t kNumHciCommandsBandwidth = 100;
+static constexpr size_t kNumScoPacketsBandwidth = 100;
+static constexpr size_t kNumAclPacketsBandwidth = 100;
static constexpr std::chrono::milliseconds kWaitForInitTimeout(2000);
static constexpr std::chrono::milliseconds kWaitForHciEventTimeout(2000);
+static constexpr std::chrono::milliseconds kWaitForScoDataTimeout(1000);
+static constexpr std::chrono::milliseconds kWaitForAclDataTimeout(1000);
static constexpr std::chrono::milliseconds kInterfaceCloseDelayMs(200);
static constexpr uint8_t kCommandHciShouldBeUnknown[] = {
@@ -55,15 +60,24 @@
static constexpr uint8_t kCommandHciReadLocalVersionInformation[] = {0x01, 0x10,
0x00};
static constexpr uint8_t kCommandHciReadBufferSize[] = {0x05, 0x10, 0x00};
+static constexpr uint8_t kCommandHciWriteLoopbackModeLocal[] = {0x02, 0x18,
+ 0x01, 0x01};
static constexpr uint8_t kCommandHciReset[] = {0x03, 0x0c, 0x00};
+static constexpr uint8_t kCommandHciSynchronousFlowControlEnable[] = {
+ 0x2f, 0x0c, 0x01, 0x01};
+static constexpr uint8_t kCommandHciWriteLocalName[] = {0x13, 0x0c, 0xf8};
static constexpr uint8_t kHciStatusSuccess = 0x00;
static constexpr uint8_t kHciStatusUnknownHciCommand = 0x01;
+static constexpr uint8_t kEventConnectionComplete = 0x03;
static constexpr uint8_t kEventCommandComplete = 0x0e;
static constexpr uint8_t kEventCommandStatus = 0x0f;
static constexpr uint8_t kEventNumberOfCompletedPackets = 0x13;
+static constexpr uint8_t kEventLoopbackCommand = 0x19;
static constexpr size_t kEventCodeByte = 0;
+static constexpr size_t kEventLengthByte = 1;
+static constexpr size_t kEventFirstPayloadByte = 2;
static constexpr size_t kEventCommandStatusStatusByte = 2;
static constexpr size_t kEventCommandStatusOpcodeLsByte = 4; // Bytes 4 and 5
static constexpr size_t kEventCommandCompleteOpcodeLsByte = 3; // Bytes 3 and 4
@@ -74,15 +88,33 @@
static constexpr size_t kEventLocalLmpVersionByte =
kEventLocalHciVersionByte + 3;
+static constexpr size_t kEventConnectionCompleteParamLength = 11;
+static constexpr size_t kEventConnectionCompleteType = 11;
+static constexpr size_t kEventConnectionCompleteTypeSco = 0;
+static constexpr size_t kEventConnectionCompleteTypeAcl = 1;
+static constexpr size_t kEventConnectionCompleteHandleLsByte = 3;
+
static constexpr size_t kEventNumberOfCompletedPacketsNumHandles = 2;
+static constexpr size_t kAclBroadcastFlagOffset = 6;
+static constexpr uint8_t kAclBroadcastFlagPointToPoint = 0x0;
+static constexpr uint8_t kAclBroadcastPointToPoint =
+ (kAclBroadcastFlagPointToPoint << kAclBroadcastFlagOffset);
+
+static constexpr uint8_t kAclPacketBoundaryFlagOffset = 4;
+static constexpr uint8_t kAclPacketBoundaryFlagFirstAutoFlushable = 0x2;
+static constexpr uint8_t kAclPacketBoundaryFirstAutoFlushable =
+ kAclPacketBoundaryFlagFirstAutoFlushable << kAclPacketBoundaryFlagOffset;
+
// To discard Qualcomm ACL debugging
static constexpr uint16_t kAclHandleQcaDebugMessage = 0xedc;
class ThroughputLogger {
public:
ThroughputLogger(std::string task)
- : task_(task), start_time_(std::chrono::steady_clock::now()) {}
+ : total_bytes_(0),
+ task_(task),
+ start_time_(std::chrono::steady_clock::now()) {}
~ThroughputLogger() {
if (total_bytes_ == 0) {
@@ -153,6 +185,7 @@
ASSERT_TRUE(hci->close().isOk());
std::this_thread::sleep_for(kInterfaceCloseDelayMs);
handle_no_ops();
+ discard_qca_debugging();
EXPECT_EQ(static_cast<size_t>(0), event_queue.size());
EXPECT_EQ(static_cast<size_t>(0), sco_queue.size());
EXPECT_EQ(static_cast<size_t>(0), acl_queue.size());
@@ -160,9 +193,18 @@
}
void setBufferSizes();
+ void setSynchronousFlowControlEnable();
+
+ // Functions called from within tests in loopback mode
+ void sendAndCheckHci(int num_packets);
+ void sendAndCheckSco(int num_packets, size_t size, uint16_t handle);
+ void sendAndCheckAcl(int num_packets, size_t size, uint16_t handle);
// Helper functions to try to get a handle on verbosity
+ void reset();
+ void enterLoopbackMode();
void handle_no_ops();
+ void discard_qca_debugging();
void wait_for_event(bool timeout_is_error);
void wait_for_command_complete_event(std::vector<uint8_t> cmd);
int wait_for_completed_packets_event(uint16_t handle);
@@ -304,6 +346,9 @@
int max_sco_data_packet_length;
int max_acl_data_packets;
int max_sco_data_packets;
+
+ std::vector<uint16_t> sco_connection_handles;
+ std::vector<uint16_t> acl_connection_handles;
};
// Discard NO-OPs from the event queue.
@@ -326,7 +371,10 @@
break;
}
}
- // Discard Qualcomm ACL debugging
+}
+
+// Discard Qualcomm ACL debugging
+void BluetoothAidlTest::discard_qca_debugging() {
while (!acl_queue.empty()) {
std::vector<uint8_t> acl_packet;
acl_queue.front(acl_packet);
@@ -344,24 +392,28 @@
// Receive an event, discarding NO-OPs.
void BluetoothAidlTest::wait_for_event(bool timeout_is_error = true) {
- if (timeout_is_error) {
- ASSERT_TRUE(event_queue.waitWithTimeout(kWaitForHciEventTimeout));
- } else {
- event_queue.wait();
+ // Wait until we get something that's not a no-op.
+ while (true) {
+ bool event_ready = event_queue.waitWithTimeout(kWaitForHciEventTimeout);
+ ASSERT_TRUE(event_ready || !timeout_is_error);
+ if (event_queue.empty()) {
+ // waitWithTimeout timed out
+ return;
+ }
+ handle_no_ops();
+ if (!event_queue.empty()) {
+ // There's an event in the queue that's not a no-op.
+ return;
+ }
}
- ASSERT_LT(static_cast<size_t>(0), event_queue.size());
- if (event_queue.empty()) {
- // waitWithTimeout timed out
- return;
- }
- handle_no_ops();
}
// Wait until a command complete is received.
void BluetoothAidlTest::wait_for_command_complete_event(
std::vector<uint8_t> cmd) {
- wait_for_event();
+ ASSERT_NO_FATAL_FAILURE(wait_for_event());
std::vector<uint8_t> event;
+ ASSERT_FALSE(event_queue.empty());
ASSERT_TRUE(event_queue.pop(event));
ASSERT_GT(event.size(), static_cast<size_t>(kEventCommandCompleteStatusByte));
@@ -378,7 +430,7 @@
kCommandHciReadBufferSize + sizeof(kCommandHciReadBufferSize)};
hci->sendHciCommand(cmd);
- wait_for_event();
+ ASSERT_NO_FATAL_FAILURE(wait_for_event());
if (event_queue.empty()) {
return;
}
@@ -406,6 +458,155 @@
static_cast<int>(max_sco_data_packets));
}
+// Enable flow control packets for SCO
+void BluetoothAidlTest::setSynchronousFlowControlEnable() {
+ std::vector<uint8_t> cmd{kCommandHciSynchronousFlowControlEnable,
+ kCommandHciSynchronousFlowControlEnable +
+ sizeof(kCommandHciSynchronousFlowControlEnable)};
+ hci->sendHciCommand(cmd);
+
+ wait_for_command_complete_event(cmd);
+}
+
+// Send an HCI command (in Loopback mode) and check the response.
+void BluetoothAidlTest::sendAndCheckHci(int num_packets) {
+ ThroughputLogger logger = {__func__};
+ int command_size = 0;
+ for (int n = 0; n < num_packets; n++) {
+ // Send an HCI packet
+ std::vector<uint8_t> write_name{
+ kCommandHciWriteLocalName,
+ kCommandHciWriteLocalName + sizeof(kCommandHciWriteLocalName)};
+ // With a name
+ char new_name[] = "John Jacob Jingleheimer Schmidt ___________________0";
+ size_t new_name_length = strlen(new_name);
+ for (size_t i = 0; i < new_name_length; i++) {
+ write_name.push_back(static_cast<uint8_t>(new_name[i]));
+ }
+ // And the packet number
+ size_t i = new_name_length - 1;
+ for (int digits = n; digits > 0; digits = digits / 10, i--) {
+ write_name[i] = static_cast<uint8_t>('0' + digits % 10);
+ }
+ // And padding
+ for (size_t i = 0; i < 248 - new_name_length; i++) {
+ write_name.push_back(static_cast<uint8_t>(0));
+ }
+
+ hci->sendHciCommand(write_name);
+
+ // Check the loopback of the HCI packet
+ ASSERT_NO_FATAL_FAILURE(wait_for_event());
+
+ std::vector<uint8_t> event;
+ ASSERT_TRUE(event_queue.pop(event));
+
+ size_t compare_length = (write_name.size() > static_cast<size_t>(0xff)
+ ? static_cast<size_t>(0xff)
+ : write_name.size());
+ ASSERT_GT(event.size(), compare_length + kEventFirstPayloadByte - 1);
+
+ ASSERT_EQ(kEventLoopbackCommand, event[kEventCodeByte]);
+ ASSERT_EQ(compare_length, event[kEventLengthByte]);
+
+ // Don't compare past the end of the event.
+ if (compare_length + kEventFirstPayloadByte > event.size()) {
+ compare_length = event.size() - kEventFirstPayloadByte;
+ ALOGE("Only comparing %d bytes", static_cast<int>(compare_length));
+ }
+
+ if (n == num_packets - 1) {
+ command_size = write_name.size();
+ }
+
+ for (size_t i = 0; i < compare_length; i++) {
+ ASSERT_EQ(write_name[i], event[kEventFirstPayloadByte + i]);
+ }
+ }
+ logger.setTotalBytes(command_size * num_packets * 2);
+}
+
+// Send a SCO data packet (in Loopback mode) and check the response.
+void BluetoothAidlTest::sendAndCheckSco(int num_packets, size_t size,
+ uint16_t handle) {
+ ThroughputLogger logger = {__func__};
+ for (int n = 0; n < num_packets; n++) {
+ // Send a SCO packet
+ std::vector<uint8_t> sco_packet;
+ sco_packet.push_back(static_cast<uint8_t>(handle & 0xff));
+ sco_packet.push_back(static_cast<uint8_t>((handle & 0x0f00) >> 8));
+ sco_packet.push_back(static_cast<uint8_t>(size & 0xff));
+ for (size_t i = 0; i < size; i++) {
+ sco_packet.push_back(static_cast<uint8_t>(i + n));
+ }
+ hci->sendScoData(sco_packet);
+
+ // Check the loopback of the SCO packet
+ std::vector<uint8_t> sco_loopback;
+ ASSERT_TRUE(
+ sco_queue.tryPopWithTimeout(sco_loopback, kWaitForScoDataTimeout));
+
+ ASSERT_EQ(sco_packet.size(), sco_loopback.size());
+ size_t successful_bytes = 0;
+
+ for (size_t i = 0; i < sco_packet.size(); i++) {
+ if (sco_packet[i] == sco_loopback[i]) {
+ successful_bytes = i;
+ } else {
+ ALOGE("Miscompare at %d (expected %x, got %x)", static_cast<int>(i),
+ sco_packet[i], sco_loopback[i]);
+ ALOGE("At %d (expected %x, got %x)", static_cast<int>(i + 1),
+ sco_packet[i + 1], sco_loopback[i + 1]);
+ break;
+ }
+ }
+ ASSERT_EQ(sco_packet.size(), successful_bytes + 1);
+ }
+ logger.setTotalBytes(num_packets * size * 2);
+}
+
+// Send an ACL data packet (in Loopback mode) and check the response.
+void BluetoothAidlTest::sendAndCheckAcl(int num_packets, size_t size,
+ uint16_t handle) {
+ ThroughputLogger logger = {__func__};
+ for (int n = 0; n < num_packets; n++) {
+ // Send an ACL packet
+ std::vector<uint8_t> acl_packet;
+ acl_packet.push_back(static_cast<uint8_t>(handle & 0xff));
+ acl_packet.push_back(static_cast<uint8_t>((handle & 0x0f00) >> 8) |
+ kAclBroadcastPointToPoint |
+ kAclPacketBoundaryFirstAutoFlushable);
+ acl_packet.push_back(static_cast<uint8_t>(size & 0xff));
+ acl_packet.push_back(static_cast<uint8_t>((size & 0xff00) >> 8));
+ for (size_t i = 0; i < size; i++) {
+ acl_packet.push_back(static_cast<uint8_t>(i + n));
+ }
+ hci->sendAclData(acl_packet);
+
+ std::vector<uint8_t> acl_loopback;
+ // Check the loopback of the ACL packet
+ ASSERT_TRUE(
+ acl_queue.tryPopWithTimeout(acl_loopback, kWaitForAclDataTimeout));
+
+ ASSERT_EQ(acl_packet.size(), acl_loopback.size());
+ size_t successful_bytes = 0;
+
+ for (size_t i = 0; i < acl_packet.size(); i++) {
+ if (acl_packet[i] == acl_loopback[i]) {
+ successful_bytes = i;
+ } else {
+ ALOGE("Miscompare at %d (expected %x, got %x)", static_cast<int>(i),
+ acl_packet[i], acl_loopback[i]);
+ ALOGE("At %d (expected %x, got %x)", static_cast<int>(i + 1),
+ acl_packet[i + 1], acl_loopback[i + 1]);
+ break;
+ }
+ }
+ ASSERT_EQ(acl_packet.size(), successful_bytes + 1);
+ }
+ logger.setTotalBytes(num_packets * size * 2);
+}
+
// Return the number of completed packets reported by the controller.
int BluetoothAidlTest::wait_for_completed_packets_event(uint16_t handle) {
int packets_processed = 0;
@@ -429,11 +630,8 @@
return packets_processed;
}
-// Empty test: Initialize()/Close() are called in SetUp()/TearDown().
-TEST_P(BluetoothAidlTest, InitializeAndClose) {}
-
-// Send an HCI Reset with sendHciCommand and wait for a command complete event.
-TEST_P(BluetoothAidlTest, HciReset) {
+// Send the reset command and wait for a response.
+void BluetoothAidlTest::reset() {
std::vector<uint8_t> reset{kCommandHciReset,
kCommandHciReset + sizeof(kCommandHciReset)};
hci->sendHciCommand(reset);
@@ -441,17 +639,74 @@
wait_for_command_complete_event(reset);
}
+// Send local loopback command and initialize SCO and ACL handles.
+void BluetoothAidlTest::enterLoopbackMode() {
+ std::vector<uint8_t> cmd{kCommandHciWriteLoopbackModeLocal,
+ kCommandHciWriteLoopbackModeLocal +
+ sizeof(kCommandHciWriteLoopbackModeLocal)};
+ hci->sendHciCommand(cmd);
+
+ // Receive connection complete events with data channels
+ int connection_event_count = 0;
+ bool command_complete_received = false;
+ while (true) {
+ wait_for_event(false);
+ if (event_queue.empty()) {
+ // Fail if there was no event received or no connections completed.
+ ASSERT_TRUE(command_complete_received);
+ ASSERT_LT(0, connection_event_count);
+ return;
+ }
+ std::vector<uint8_t> event;
+ ASSERT_TRUE(event_queue.pop(event));
+ ASSERT_GT(event.size(),
+ static_cast<size_t>(kEventCommandCompleteStatusByte));
+ if (event[kEventCodeByte] == kEventConnectionComplete) {
+ ASSERT_GT(event.size(),
+ static_cast<size_t>(kEventConnectionCompleteType));
+ ASSERT_EQ(event[kEventLengthByte], kEventConnectionCompleteParamLength);
+ uint8_t connection_type = event[kEventConnectionCompleteType];
+
+ ASSERT_TRUE(connection_type == kEventConnectionCompleteTypeSco ||
+ connection_type == kEventConnectionCompleteTypeAcl);
+
+ // Save handles
+ uint16_t handle = event[kEventConnectionCompleteHandleLsByte] |
+ event[kEventConnectionCompleteHandleLsByte + 1] << 8;
+ if (connection_type == kEventConnectionCompleteTypeSco) {
+ sco_connection_handles.push_back(handle);
+ } else {
+ acl_connection_handles.push_back(handle);
+ }
+
+ ALOGD("Connect complete type = %d handle = %d",
+ event[kEventConnectionCompleteType], handle);
+ connection_event_count++;
+ } else {
+ ASSERT_EQ(kEventCommandComplete, event[kEventCodeByte]);
+ ASSERT_EQ(cmd[0], event[kEventCommandCompleteOpcodeLsByte]);
+ ASSERT_EQ(cmd[1], event[kEventCommandCompleteOpcodeLsByte + 1]);
+ ASSERT_EQ(kHciStatusSuccess, event[kEventCommandCompleteStatusByte]);
+ command_complete_received = true;
+ }
+ }
+}
+
+// Empty test: Initialize()/Close() are called in SetUp()/TearDown().
+TEST_P(BluetoothAidlTest, InitializeAndClose) {}
+
+// Send an HCI Reset with sendHciCommand and wait for a command complete event.
+TEST_P(BluetoothAidlTest, HciReset) { reset(); }
+
// Read and check the HCI version of the controller.
TEST_P(BluetoothAidlTest, HciVersionTest) {
+ reset();
std::vector<uint8_t> cmd{kCommandHciReadLocalVersionInformation,
kCommandHciReadLocalVersionInformation +
sizeof(kCommandHciReadLocalVersionInformation)};
hci->sendHciCommand(cmd);
- wait_for_event();
- if (event_queue.empty()) {
- return;
- }
+ ASSERT_NO_FATAL_FAILURE(wait_for_event());
std::vector<uint8_t> event;
ASSERT_TRUE(event_queue.pop(event));
@@ -468,15 +723,13 @@
// Send an unknown HCI command and wait for the error message.
TEST_P(BluetoothAidlTest, HciUnknownCommand) {
+ reset();
std::vector<uint8_t> cmd{
kCommandHciShouldBeUnknown,
kCommandHciShouldBeUnknown + sizeof(kCommandHciShouldBeUnknown)};
hci->sendHciCommand(cmd);
- wait_for_event();
- if (event_queue.empty()) {
- return;
- }
+ ASSERT_NO_FATAL_FAILURE(wait_for_event());
std::vector<uint8_t> event;
ASSERT_TRUE(event_queue.pop(event));
@@ -496,8 +749,121 @@
}
}
+// Enter loopback mode, but don't send any packets.
+TEST_P(BluetoothAidlTest, WriteLoopbackMode) {
+ reset();
+ enterLoopbackMode();
+}
+
+// Enter loopback mode and send a single command.
+TEST_P(BluetoothAidlTest, LoopbackModeSingleCommand) {
+ reset();
+ setBufferSizes();
+
+ enterLoopbackMode();
+
+ sendAndCheckHci(1);
+}
+
+// Enter loopback mode and send a single SCO packet.
+TEST_P(BluetoothAidlTest, LoopbackModeSingleSco) {
+ reset();
+ setBufferSizes();
+ setSynchronousFlowControlEnable();
+
+ enterLoopbackMode();
+
+ if (!sco_connection_handles.empty()) {
+ ASSERT_LT(0, max_sco_data_packet_length);
+ sendAndCheckSco(1, max_sco_data_packet_length, sco_connection_handles[0]);
+ int sco_packets_sent = 1;
+ int completed_packets =
+ wait_for_completed_packets_event(sco_connection_handles[0]);
+ if (sco_packets_sent != completed_packets) {
+ ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+ sco_packets_sent, completed_packets);
+ }
+ }
+}
+
+// Enter loopback mode and send a single ACL packet.
+TEST_P(BluetoothAidlTest, LoopbackModeSingleAcl) {
+ reset();
+ setBufferSizes();
+
+ enterLoopbackMode();
+
+ if (!acl_connection_handles.empty()) {
+ ASSERT_LT(0, max_acl_data_packet_length);
+ sendAndCheckAcl(1, max_acl_data_packet_length - 1,
+ acl_connection_handles[0]);
+ int acl_packets_sent = 1;
+ int completed_packets =
+ wait_for_completed_packets_event(acl_connection_handles[0]);
+ if (acl_packets_sent != completed_packets) {
+ ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+ acl_packets_sent, completed_packets);
+ }
+ }
+ ASSERT_GE(acl_cb_count, 1);
+}
+
+// Enter loopback mode and send command packets for bandwidth measurements.
+TEST_P(BluetoothAidlTest, LoopbackModeCommandBandwidth) {
+ reset();
+ setBufferSizes();
+
+ enterLoopbackMode();
+
+ sendAndCheckHci(kNumHciCommandsBandwidth);
+}
+
+// Enter loopback mode and send SCO packets for bandwidth measurements.
+TEST_P(BluetoothAidlTest, LoopbackModeScoBandwidth) {
+ reset();
+ setBufferSizes();
+ setSynchronousFlowControlEnable();
+
+ enterLoopbackMode();
+
+ if (!sco_connection_handles.empty()) {
+ ASSERT_LT(0, max_sco_data_packet_length);
+ sendAndCheckSco(kNumScoPacketsBandwidth, max_sco_data_packet_length,
+ sco_connection_handles[0]);
+ int sco_packets_sent = kNumScoPacketsBandwidth;
+ int completed_packets =
+ wait_for_completed_packets_event(sco_connection_handles[0]);
+ if (sco_packets_sent != completed_packets) {
+ ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+ sco_packets_sent, completed_packets);
+ }
+ }
+}
+
+// Enter loopback mode and send packets for ACL bandwidth measurements.
+TEST_P(BluetoothAidlTest, LoopbackModeAclBandwidth) {
+ reset();
+ setBufferSizes();
+
+ enterLoopbackMode();
+
+ if (!acl_connection_handles.empty()) {
+ ASSERT_LT(0, max_acl_data_packet_length);
+ sendAndCheckAcl(kNumAclPacketsBandwidth, max_acl_data_packet_length - 1,
+ acl_connection_handles[0]);
+ int acl_packets_sent = kNumAclPacketsBandwidth;
+ int completed_packets =
+ wait_for_completed_packets_event(acl_connection_handles[0]);
+ if (acl_packets_sent != completed_packets) {
+ ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+ acl_packets_sent, completed_packets);
+ }
+ }
+}
+
// Set all bits in the event mask
TEST_P(BluetoothAidlTest, SetEventMask) {
+ reset();
std::vector<uint8_t> set_event_mask{
0x01, 0x0c, 0x08 /*parameter bytes*/, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff};
@@ -507,6 +873,7 @@
// Set all bits in the LE event mask
TEST_P(BluetoothAidlTest, SetLeEventMask) {
+ reset();
std::vector<uint8_t> set_event_mask{
0x20, 0x0c, 0x08 /*parameter bytes*/, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff};
diff --git a/bluetooth/hci/h4_protocol.cc b/bluetooth/hci/h4_protocol.cc
index 97ba7aa..51a624f 100644
--- a/bluetooth/hci/h4_protocol.cc
+++ b/bluetooth/hci/h4_protocol.cc
@@ -58,10 +58,8 @@
while (1) {
ret = TEMP_FAILURE_RETRY(writev(uart_fd_, iov, 2));
if (ret == -1) {
- if (errno == EAGAIN) {
- ALOGE("%s error writing to UART (%s)", __func__, strerror(errno));
- continue;
- }
+ LOG_ALWAYS_FATAL("%s error writing to UART (%s)", __func__,
+ strerror(errno));
} else if (ret == 0) {
// Nothing written :(
ALOGE("%s zero bytes written - something went wrong...", __func__);
diff --git a/camera/common/1.0/default/OWNERS b/camera/OWNERS
similarity index 65%
rename from camera/common/1.0/default/OWNERS
rename to camera/OWNERS
index f48a95c..b946264 100644
--- a/camera/common/1.0/default/OWNERS
+++ b/camera/OWNERS
@@ -1 +1,3 @@
+# Bug component: 41727
+
include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/1.0/default/OWNERS b/camera/device/1.0/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/1.0/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.2/default/OWNERS b/camera/device/3.2/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.2/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.3/default/OWNERS b/camera/device/3.3/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.3/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.4/default/OWNERS b/camera/device/3.4/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.4/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.5/default/OWNERS b/camera/device/3.5/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.5/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.6/default/OWNERS b/camera/device/3.6/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.6/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/provider/2.4/default/OWNERS b/camera/provider/2.4/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/provider/2.4/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/provider/2.4/vts/OWNERS b/camera/provider/2.4/vts/OWNERS
deleted file mode 100644
index eb4f0e4..0000000
--- a/camera/provider/2.4/vts/OWNERS
+++ /dev/null
@@ -1,8 +0,0 @@
-# Bug component: 41727
-
-# Camera team
-include platform/frameworks/av:/camera/OWNERS
-
-# VTS team
-yim@google.com
-zhuoyao@google.com
diff --git a/camera/provider/2.4/vts/functional/OWNERS b/camera/provider/2.4/vts/functional/OWNERS
deleted file mode 100644
index 479f465..0000000
--- a/camera/provider/2.4/vts/functional/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 41727
-epeev@google.com
diff --git a/camera/provider/2.5/default/OWNERS b/camera/provider/2.5/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/provider/2.5/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/provider/aidl/vts/OWNERS b/camera/provider/aidl/vts/OWNERS
deleted file mode 100644
index 27d370b..0000000
--- a/camera/provider/aidl/vts/OWNERS
+++ /dev/null
@@ -1,6 +0,0 @@
-# Camera team
-include platform/frameworks/av:/camera/OWNERS
-
-# VTS team
-yim@google.com
-zhuoyao@google.com
\ No newline at end of file
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 70ab7a0..2c98db8 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -1846,7 +1846,6 @@
// Generate and verify 10-bit dynamic range request
TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
- int64_t bufferId = 1;
CameraMetadata settings;
for (const auto& name : cameraDeviceNames) {
@@ -1927,12 +1926,12 @@
// Stream as long as needed to fill the Hal inflight queue
std::vector<CaptureRequest> requests(halStreams[0].maxBuffers);
- for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+ for (int32_t requestId = 0; requestId < requests.size(); requestId++) {
std::shared_ptr<InFlightRequest> inflightReq = std::make_shared<InFlightRequest>(
static_cast<ssize_t>(halStreams.size()), false, supportsPartialResults,
partialResultCount, std::unordered_set<std::string>(), resultQueue);
- CaptureRequest& request = requests[frameNumber];
+ CaptureRequest& request = requests[requestId];
std::vector<StreamBuffer>& outputBuffers = request.outputBuffers;
outputBuffers.resize(halStreams.size());
@@ -1941,6 +1940,7 @@
std::vector<buffer_handle_t> graphicBuffers;
graphicBuffers.reserve(halStreams.size());
+ auto bufferId = requestId + 1; // Buffer id value 0 is not valid
for (const auto& halStream : halStreams) {
buffer_handle_t buffer_handle;
if (useHalBufManager) {
@@ -1959,14 +1959,13 @@
outputBuffers[k] = {halStream.id, bufferId,
android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(),
NativeHandle()};
- bufferId++;
}
k++;
}
request.inputBuffer = {
-1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()};
- request.frameNumber = frameNumber;
+ request.frameNumber = bufferId;
request.fmqSettingsSize = 0;
request.settings = settings;
request.inputWidth = 0;
@@ -1974,7 +1973,7 @@
{
std::unique_lock<std::mutex> l(mLock);
- mInflightMap[frameNumber] = inflightReq;
+ mInflightMap[bufferId] = inflightReq;
}
}
@@ -1990,7 +1989,10 @@
std::vector<int32_t> {halStreams[0].id});
ASSERT_TRUE(returnStatus.isOk());
- for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+ // We are keeping frame numbers and buffer ids consistent. Buffer id value of 0
+ // is used to indicate a buffer that is not present/available so buffer ids as well
+ // as frame numbers begin with 1.
+ for (int32_t frameNumber = 1; frameNumber <= requests.size(); frameNumber++) {
const auto& inflightReq = mInflightMap[frameNumber];
std::unique_lock<std::mutex> l(mLock);
while (!inflightReq->errorCodeValid &&
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 2c2f1b2..48816ad9 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -167,7 +167,7 @@
ScopedAStatus physicalCameraDeviceStatusChange(
const std::string&, const std::string&,
::aidl::android::hardware::camera::common::CameraDeviceStatus) override {
- return ndk::ScopedAStatus();
+ return ScopedAStatus::ok();
}
std::vector<std::string> externalCameraDeviceNames;
diff --git a/camera/provider/aidl/vts/device_cb.cpp b/camera/provider/aidl/vts/device_cb.cpp
index 4698b4a..3ec96a1 100644
--- a/camera/provider/aidl/vts/device_cb.cpp
+++ b/camera/provider/aidl/vts/device_cb.cpp
@@ -429,10 +429,11 @@
CameraAidlTest::InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
auto outstandingBuffers = mUseHalBufManager ? mOutstandingBufferIds :
request->mOutstandingBufferIds;
+ auto bufferId = mUseHalBufManager ? buffer.bufferId : results.frameNumber;
auto outputBuffer = outstandingBuffers.empty() ? ::android::makeFromAidl(buffer.buffer) :
- outstandingBuffers[buffer.streamId][buffer.bufferId];
+ outstandingBuffers[buffer.streamId][bufferId];
streamBufferAndTimestamp.buffer = {buffer.streamId,
- buffer.bufferId,
+ bufferId,
outputBuffer,
buffer.status,
::android::makeFromAidl(buffer.acquireFence),
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index 37c2820..7e2f788 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -83,10 +83,10 @@
}
vintf_compatibility_matrix {
- name: "framework_compatibility_matrix.current.xml",
- stem: "compatibility_matrix.current.xml",
+ name: "framework_compatibility_matrix.8.xml",
+ stem: "compatibility_matrix.8.xml",
srcs: [
- "compatibility_matrix.current.xml",
+ "compatibility_matrix.8.xml",
],
kernel_configs: [
"kernel_config_current_5.10",
diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk
index d19f0da..a20f985 100644
--- a/compatibility_matrices/Android.mk
+++ b/compatibility_matrices/Android.mk
@@ -103,7 +103,7 @@
framework_compatibility_matrix.5.xml \
framework_compatibility_matrix.6.xml \
framework_compatibility_matrix.7.xml \
- framework_compatibility_matrix.current.xml \
+ framework_compatibility_matrix.8.xml \
framework_compatibility_matrix.device.xml \
my_framework_matrix_deps += \
diff --git a/compatibility_matrices/compatibility_matrix.7.xml b/compatibility_matrices/compatibility_matrix.7.xml
index 26b8d63..5694945 100644
--- a/compatibility_matrices/compatibility_matrix.7.xml
+++ b/compatibility_matrices/compatibility_matrix.7.xml
@@ -7,7 +7,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.audio</name>
<version>6.0</version>
<version>7.0-1</version>
@@ -16,7 +16,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.audio.effect</name>
<version>6.0</version>
<version>7.0</version>
@@ -238,7 +238,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
@@ -316,7 +316,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.graphics.mapper</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
<version>2.1</version>
@@ -682,7 +682,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="false">
+ <hal format="hidl" optional="true">
<name>android.hardware.thermal</name>
<version>2.0</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.8.xml
similarity index 98%
rename from compatibility_matrices/compatibility_matrix.current.xml
rename to compatibility_matrices/compatibility_matrix.8.xml
index a21428c..5225f5f 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.8.xml
@@ -349,7 +349,7 @@
</hal>
<hal format="aidl" optional="false">
<name>android.hardware.health</name>
- <version>1</version>
+ <version>1-2</version>
<interface>
<name>IHealth</name>
<instance>default</instance>
@@ -692,7 +692,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="false">
+ <hal format="aidl" optional="true">
<name>android.hardware.thermal</name>
<version>1</version>
<interface>
@@ -802,7 +802,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl" optional="true" updatable-via-apex="true">
<name>android.hardware.wifi</name>
<version>1</version>
<interface>
@@ -810,7 +810,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl" optional="true" updatable-via-apex="true">
<name>android.hardware.wifi</name>
<version>1.3-6</version>
<interface>
@@ -846,7 +846,6 @@
<name>mapper</name>
<version>5.0</version>
<interface>
- <name>I</name>
<regex-instance>.*</regex-instance>
</interface>
</hal>
diff --git a/drm/README.md b/drm/README.md
new file mode 100644
index 0000000..d56288e
--- /dev/null
+++ b/drm/README.md
@@ -0,0 +1,13 @@
+# DRM HAL
+
+This is the underlying HAL implementation for `MediaDrm`/`MediaCrypto` (and
+their NDK counterparts).
+
+## Plugin-vendor-specific VTS modules
+
+The interface `DrmHalVTSVendorModule_V1` is compatible with all versions of the
+DRM HAL (hidl 1.0-1.4, aidl).
+
+Please see `./1.0/vts/doc/Drm_Vendor_Modules_v1.pdf`.
+
+TODO(b/266091099): convert `Drm_Vendor_Modules_v1.pdf` to Markdown.
\ No newline at end of file
diff --git a/fastboot/aidl/default/Android.bp b/fastboot/aidl/default/Android.bp
index 0c96b33..cb38dcc 100644
--- a/fastboot/aidl/default/Android.bp
+++ b/fastboot/aidl/default/Android.bp
@@ -26,7 +26,7 @@
name: "android.hardware.fastboot-service.example_recovery",
init_rc: ["android.hardware.fastboot-service.example_recovery.rc"],
vintf_fragments: ["android.hardware.fastboot-service.example.xml"],
- recovery_available: true,
+ recovery: true,
srcs: [
"Fastboot.cpp",
"main.cpp",
diff --git a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl
index 04bacf0..227210b 100644
--- a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl
+++ b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl
@@ -22,11 +22,12 @@
@VintfStability
parcelable GatekeeperEnrollResponse {
/**
- * Request completion status
+ * Request completion status. The status code can be IGatekeeper::STATUS_OK
+ * or IGatekeeper::ERROR_RETRY_TIMEOUT.
*/
int statusCode;
/**
- * Retry timeout in ms, if code == ERROR_RETRY_TIMEOUT
+ * Retry timeout in ms, if code == IGatekeeper::ERROR_RETRY_TIMEOUT
* otherwise unused (0)
*/
int timeoutMs;
diff --git a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl
index bcf2d76..f8dbeeb 100644
--- a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl
+++ b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl
@@ -24,11 +24,12 @@
@VintfStability
parcelable GatekeeperVerifyResponse {
/**
- * Request completion status
+ * Request completion status. The status code can be IGatekeeper::STATUS_OK
+ * or IGatekeeper::ERROR_RETRY_TIMEOUT or IGatekeeper::STATUS_REENROLL.
*/
int statusCode;
/**
- * Retry timeout in ms, if code == ERROR_RETRY_TIMEOUT
+ * Retry timeout in ms, if code == IGatekeeper::ERROR_RETRY_TIMEOUT
* otherwise unused (0)
*/
int timeoutMs;
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 3696233..c7fc32a 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -526,6 +526,11 @@
EXPECT_EQ(gnssPowerIndicationCallback->capabilities_cbq_.calledCount(), 1);
+ if (gnssPowerIndicationCallback->last_capabilities_ == 0) {
+ // Skipping the test since GnssPowerIndication is not supported.
+ return;
+ }
+
// Request and verify a GnssPowerStats is received
gnssPowerIndicationCallback->gnss_power_stats_cbq_.reset();
iGnssPowerIndication->requestGnssPowerStats();
diff --git a/graphics/mapper/stable-c/README.md b/graphics/mapper/stable-c/README.md
index 30f3ccc..0b9b499 100644
--- a/graphics/mapper/stable-c/README.md
+++ b/graphics/mapper/stable-c/README.md
@@ -15,7 +15,6 @@
<name>mapper</name>
<version>5.0</version>
<interface>
- <name>I</name>
<instance>minigbm</instance>
</interface>
</hal>
diff --git a/graphics/mapper/stable-c/implutils/impltests.cpp b/graphics/mapper/stable-c/implutils/impltests.cpp
index f12b069..01a1db9 100644
--- a/graphics/mapper/stable-c/implutils/impltests.cpp
+++ b/graphics/mapper/stable-c/implutils/impltests.cpp
@@ -359,35 +359,35 @@
auto mpbuf = encode<StandardMetadataType::BUFFER_ID>(42);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeBufferId(42, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Name) {
auto mpbuf = encode<StandardMetadataType::NAME>("Hello, Interop!");
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeName("Hello, Interop!", &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Width) {
auto mpbuf = encode<StandardMetadataType::WIDTH>(128);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeWidth(128, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Height) {
auto mpbuf = encode<StandardMetadataType::HEIGHT>(64);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeHeight(64, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, LayerCount) {
auto mpbuf = encode<StandardMetadataType::LAYER_COUNT>(3);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeLayerCount(3, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, PixelFormatRequested) {
@@ -395,21 +395,21 @@
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatRequested(
hardware::graphics::common::V1_2::PixelFormat::RGBX_8888, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, PixelFormatFourcc) {
auto mpbuf = encode<StandardMetadataType::PIXEL_FORMAT_FOURCC>(DRM_FORMAT_ABGR8888);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatFourCC(DRM_FORMAT_ABGR8888, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, PixelFormatModifier) {
auto mpbuf = encode<StandardMetadataType::PIXEL_FORMAT_MODIFIER>(123456);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatModifier(123456, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Usage) {
@@ -420,21 +420,21 @@
static_cast<uint64_t>(
hardware::graphics::common::V1_2::BufferUsage::COMPOSER_OVERLAY),
&g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, AllocationSize) {
auto mpbuf = encode<StandardMetadataType::ALLOCATION_SIZE>(10200);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeAllocationSize(10200, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, ProtectedContent) {
auto mpbuf = encode<StandardMetadataType::PROTECTED_CONTENT>(1);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeProtectedContent(1, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Compression) {
@@ -443,14 +443,14 @@
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR,
gralloc4::encodeCompression(gralloc4::Compression_DisplayStreamCompression, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Interlaced) {
auto mpbuf = encode<StandardMetadataType::INTERLACED>(gralloc4::Interlaced_TopBottom);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeInterlaced(gralloc4::Interlaced_TopBottom, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, ChromeSitting) {
@@ -459,14 +459,14 @@
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR,
gralloc4::encodeChromaSiting(gralloc4::ChromaSiting_SitedInterstitial, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, PlaneLayouts) {
auto mpbuf = encode<StandardMetadataType::PLANE_LAYOUTS>(fakePlaneLayouts());
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodePlaneLayouts(fakePlaneLayouts(), &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Crop) {
@@ -474,21 +474,21 @@
auto mpbuf = encode<StandardMetadataType::CROP>(cropRects);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeCrop(cropRects, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Dataspace) {
auto mpbuf = encode<StandardMetadataType::DATASPACE>(Dataspace::DISPLAY_P3);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::DISPLAY_P3, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, BlendMode) {
auto mpbuf = encode<StandardMetadataType::BLEND_MODE>(BlendMode::PREMULTIPLIED);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeBlendMode(BlendMode::PREMULTIPLIED, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Smpte2086) {
@@ -498,7 +498,7 @@
auto mpbuf = encode<StandardMetadataType::SMPTE2086>(hdrdata);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2086(hdrdata, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Cta861_3) {
@@ -506,29 +506,29 @@
auto mpbuf = encode<StandardMetadataType::CTA861_3>(hdrdata);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeCta861_3(hdrdata, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Smpte2094_10) {
auto mpbuf = encode<StandardMetadataType::SMPTE2094_10>(std::nullopt);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_10(std::nullopt, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
std::vector<uint8_t> hdrdata{1, 2, 3, 4, 5, 6};
mpbuf = encode<StandardMetadataType::SMPTE2094_10>(hdrdata);
ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_10(hdrdata, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
TEST(MetadataGralloc4Interop, Smpte2094_40) {
auto mpbuf = encode<StandardMetadataType::SMPTE2094_40>(std::nullopt);
hidl_vec<uint8_t> g4buf;
ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_40(std::nullopt, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
std::vector<uint8_t> hdrdata{1, 2, 3, 4, 5, 6};
mpbuf = encode<StandardMetadataType::SMPTE2094_40>(hdrdata);
ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_40(hdrdata, &g4buf));
- EXPECT_EQ(mpbuf, g4buf);
+ EXPECT_EQ(g4buf, mpbuf);
}
diff --git a/health/aidl/Android.bp b/health/aidl/Android.bp
index 64d83f3..6d4f914 100644
--- a/health/aidl/Android.bp
+++ b/health/aidl/Android.bp
@@ -74,7 +74,7 @@
name: "android.hardware.health-translate-ndk",
defaults: ["android.hardware.health-translate-ndk_defaults"],
shared_libs: [
- "android.hardware.health-V1-ndk",
+ "android.hardware.health-V2-ndk",
],
}
@@ -91,7 +91,7 @@
name: "android.hardware.health-translate-java",
srcs: ["android/hardware/health/Translate.java"],
libs: [
- "android.hardware.health-V1-java",
+ "android.hardware.health-V2-java",
"android.hardware.health-V2.0-java",
"android.hardware.health-V2.1-java",
],
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingPolicy.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingPolicy.aidl
new file mode 100644
index 0000000..42fbf95
--- /dev/null
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingPolicy.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.health;
+@Backing(type="int") @VintfStability
+enum BatteryChargingPolicy {
+ INVALID = 0,
+ DEFAULT = 1,
+ LONG_LIFE = 2,
+ ADAPTIVE = 3,
+}
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingState.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingState.aidl
new file mode 100644
index 0000000..e21eb28
--- /dev/null
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingState.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.health;
+@Backing(type="int") @VintfStability
+enum BatteryChargingState {
+ INVALID = 0,
+ NORMAL = 1,
+ TOO_COLD = 2,
+ TOO_HOT = 3,
+ LONG_LIFE = 4,
+ ADAPTIVE = 5,
+}
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl
index 4ce7952..8d13198 100644
--- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl
@@ -41,4 +41,7 @@
OVER_VOLTAGE = 5,
UNSPECIFIED_FAILURE = 6,
COLD = 7,
+ FAIR = 8,
+ NOT_AVAILABLE = 11,
+ INCONSISTENT = 12,
}
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl
new file mode 100644
index 0000000..d523fad
--- /dev/null
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.health;
+@VintfStability
+parcelable BatteryHealthData {
+ long batteryManufacturingDateSeconds;
+ long batteryFirstUsageSeconds;
+}
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl
index 97d9e84..664cc70 100644
--- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl
@@ -57,5 +57,9 @@
android.hardware.health.BatteryCapacityLevel batteryCapacityLevel;
long batteryChargeTimeToFullNowSeconds;
int batteryFullChargeDesignCapacityUah;
+ int batteryStateOfHealth;
+ android.hardware.health.BatteryChargingState chargingState;
+ android.hardware.health.BatteryChargingPolicy chargingPolicy;
+ @nullable android.hardware.health.BatteryHealthData batteryHealthData;
const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1;
}
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl
index 7016ae4..b49dfff 100644
--- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl
@@ -46,6 +46,9 @@
android.hardware.health.StorageInfo[] getStorageInfo();
android.hardware.health.DiskStats[] getDiskStats();
android.hardware.health.HealthInfo getHealthInfo();
+ void setChargingPolicy(android.hardware.health.BatteryChargingPolicy in_value);
+ android.hardware.health.BatteryChargingPolicy getChargingPolicy();
+ android.hardware.health.BatteryHealthData getBatteryHealthData();
const int STATUS_UNKNOWN = 2;
const int STATUS_CALLBACK_DIED = 4;
}
diff --git a/health/aidl/android/hardware/health/BatteryChargingPolicy.aidl b/health/aidl/android/hardware/health/BatteryChargingPolicy.aidl
new file mode 100644
index 0000000..0aeee41
--- /dev/null
+++ b/health/aidl/android/hardware/health/BatteryChargingPolicy.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.health;
+
+/**
+ * Battery charging policy.
+ */
+@VintfStability
+@Backing(type="int")
+enum BatteryChargingPolicy {
+ INVALID = 0,
+ /**
+ * default policy
+ */
+ DEFAULT = 1,
+ /**
+ * @see BatteryChargingState.LONG_LIFE
+ */
+ LONG_LIFE = 2,
+ /**
+ * @see BatteryChargingState.ADAPTIVE
+ */
+ ADAPTIVE = 3,
+}
diff --git a/health/aidl/android/hardware/health/BatteryChargingState.aidl b/health/aidl/android/hardware/health/BatteryChargingState.aidl
new file mode 100644
index 0000000..af62077
--- /dev/null
+++ b/health/aidl/android/hardware/health/BatteryChargingState.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.health;
+
+/**
+ * Possible values for Battery Health.
+ * Note: These are currently in sync with BatteryManager and must not
+ * be extended / altered.
+ */
+@VintfStability
+@Backing(type="int")
+enum BatteryChargingState {
+ INVALID = 0,
+ /**
+ * Default state.
+ */
+ NORMAL = 1,
+ /**
+ * Reported when the battery is too cold to charge at a normal
+ * rate or stopped charging due to low temperature.
+ */
+ TOO_COLD = 2,
+ /**
+ * Reported when the battery is too hot to charge at a normal
+ * rate or stopped charging due to hot temperature.
+ */
+ TOO_HOT = 3,
+ /**
+ * The device is using a special charging profile that designed
+ * to prevent accelerated aging.
+ */
+ LONG_LIFE = 4,
+ /**
+ * The device is using a special charging profile designed to
+ * improve battery cycle life, performances or both.
+ */
+ ADAPTIVE = 5,
+}
diff --git a/health/aidl/android/hardware/health/BatteryHealth.aidl b/health/aidl/android/hardware/health/BatteryHealth.aidl
index 2b6e51f..65abdc2 100644
--- a/health/aidl/android/hardware/health/BatteryHealth.aidl
+++ b/health/aidl/android/hardware/health/BatteryHealth.aidl
@@ -24,8 +24,15 @@
@VintfStability
@Backing(type="int")
enum BatteryHealth {
+ /**
+ * Battery health is not supported from the device.
+ */
UNKNOWN = 1,
GOOD = 2,
+ /**
+ * Must be consistent with BatteryChargingState.
+ * If BatteryHealth is OVERHEAT, then BatteryChargingState must be TOO_HOT.
+ */
OVERHEAT = 3,
DEAD = 4,
OVER_VOLTAGE = 5,
@@ -33,5 +40,28 @@
* Battery experienced an unknown/unspecified failure.
*/
UNSPECIFIED_FAILURE = 6,
+ /**
+ * Must be consistent with BatteryChargingState.
+ * If BatteryHealth is COLD, then BatteryChargingState must be TOO_COLD.
+ */
COLD = 7,
+ /**
+ * Battery health is marginal.
+ */
+ FAIR = 8,
+ /**
+ * The reserve data below 10 are used to recognize the battery real health.
+ */
+ /**
+ * There is not enough information to determine an accurate
+ * value. The value might become UNSPECIFIED_FAILURE, DEAD
+ * or any other state except for UNKNOWN later.
+ */
+ NOT_AVAILABLE = 11,
+ /**
+ * The internal data is inconsistent and the battery needs to
+ * go through a recalibration process. The value might become
+ * UNSPECIFIED_FAILURE, DEAD or any other state except for UNKNOWN later.
+ */
+ INCONSISTENT = 12,
}
diff --git a/health/aidl/android/hardware/health/BatteryHealthData.aidl b/health/aidl/android/hardware/health/BatteryHealthData.aidl
new file mode 100644
index 0000000..fb17f63
--- /dev/null
+++ b/health/aidl/android/hardware/health/BatteryHealthData.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.health;
+
+/*
+ * Battery health data
+ */
+@VintfStability
+parcelable BatteryHealthData {
+ /**
+ * Battery manufacturing date is reported in epoch.
+ */
+ long batteryManufacturingDateSeconds;
+ /**
+ * The date of first usage is reported in epoch.
+ */
+ long batteryFirstUsageSeconds;
+}
diff --git a/health/aidl/android/hardware/health/HealthInfo.aidl b/health/aidl/android/hardware/health/HealthInfo.aidl
index 5b98baf..238f524 100644
--- a/health/aidl/android/hardware/health/HealthInfo.aidl
+++ b/health/aidl/android/hardware/health/HealthInfo.aidl
@@ -17,7 +17,10 @@
package android.hardware.health;
import android.hardware.health.BatteryCapacityLevel;
+import android.hardware.health.BatteryChargingPolicy;
+import android.hardware.health.BatteryChargingState;
import android.hardware.health.BatteryHealth;
+import android.hardware.health.BatteryHealthData;
import android.hardware.health.BatteryStatus;
import android.hardware.health.DiskStats;
import android.hardware.health.StorageInfo;
@@ -133,4 +136,23 @@
* Value must be less than 100 000 000 µAh if known.
*/
int batteryFullChargeDesignCapacityUah;
+ /**
+ * Measured battery state of health (remaining estimate full charge capacity
+ * relative to the rated capacity in %).
+ * Value must be 0 if batteryStatus is UNKNOWN.
+ * Otherwise, value must be in the range 0 to 100.
+ */
+ int batteryStateOfHealth;
+ /**
+ * Battery charging state
+ */
+ BatteryChargingState chargingState;
+ /**
+ * Battery charging policy. See {@link BatteryChargingPolicy} for more details.
+ */
+ BatteryChargingPolicy chargingPolicy;
+ /**
+ * Battery health data
+ */
+ @nullable BatteryHealthData batteryHealthData;
}
diff --git a/health/aidl/android/hardware/health/IHealth.aidl b/health/aidl/android/hardware/health/IHealth.aidl
index d541eca..bdfe07a 100644
--- a/health/aidl/android/hardware/health/IHealth.aidl
+++ b/health/aidl/android/hardware/health/IHealth.aidl
@@ -16,6 +16,8 @@
package android.hardware.health;
+import android.hardware.health.BatteryChargingPolicy;
+import android.hardware.health.BatteryHealthData;
import android.hardware.health.BatteryStatus;
import android.hardware.health.DiskStats;
import android.hardware.health.HealthInfo;
@@ -102,7 +104,7 @@
* if this property is not supported
* (e.g. the file that stores this property does not exist),
* - Return service specific error with code STATUS_UNKNOWN
- * for for other errors.
+ * for other errors.
*/
int getCurrentNowMicroamps();
@@ -120,7 +122,7 @@
* if this property is not supported
* (e.g. the file that stores this property does not exist),
* - Return service specific error with code STATUS_UNKNOWN
- * for for other errors.
+ * for other errors.
*/
int getCurrentAverageMicroamps();
@@ -134,7 +136,7 @@
* if this property is not supported
* (e.g. the file that stores this property does not exist),
* - Return service specific error with code STATUS_UNKNOWN
- * for for other errors.
+ * for other errors.
*/
int getCapacity();
@@ -146,7 +148,7 @@
* - Return exception with code EX_UNSUPPORTED_OPERATION
* if this property is not supported,
* - Return service specific error with code STATUS_UNKNOWN
- * for for other errors.
+ * for other errors.
*/
long getEnergyCounterNwh();
@@ -197,7 +199,47 @@
* - Return exception with code EX_UNSUPPORTED_OPERATION
* if this API is not supported,
* - Return service specific error with code STATUS_UNKNOWN
- * for for other errors.
+ * for other errors.
*/
HealthInfo getHealthInfo();
+
+ /**
+ * Set battery charging policy
+ *
+ * @return If error, return service specific error with code:
+ * - Return exception with code EX_UNSUPPORTED_OPERATION
+ * if this property is not supported
+ * (e.g. the file that stores this property does not exist),
+ * - Return status with code INVALID_OPERATION
+ * if the operation failed.
+ * - Return service specific error with code STATUS_UNKNOWN
+ * for other errors.
+ */
+ void setChargingPolicy(BatteryChargingPolicy in_value);
+
+ /**
+ * Get current battery charging policy
+ *
+ * @return current battery charging policy if successful.
+ * If error:
+ * - Return exception with code EX_UNSUPPORTED_OPERATION
+ * if this property is not supported
+ * (e.g. the file that stores this property does not exist),
+ * - Return service specific error with code STATUS_UNKNOWN
+ * for other errors.
+ */
+ BatteryChargingPolicy getChargingPolicy();
+
+ /**
+ * Get battery health data
+ *
+ * @return Battery health data if successful.
+ * If error:
+ * - Return exception with code EX_UNSUPPORTED_OPERATION
+ * if this property is not supported
+ * (e.g. the file that stores this property does not exist),
+ * - Return service specific error with code STATUS_UNKNOWN
+ * for other errors.
+ */
+ BatteryHealthData getBatteryHealthData();
}
diff --git a/health/aidl/default/Android.bp b/health/aidl/default/Android.bp
index 4eb3cb1..b51e4f3 100644
--- a/health/aidl/default/Android.bp
+++ b/health/aidl/default/Android.bp
@@ -29,7 +29,7 @@
"libcutils",
"liblog",
"libutils",
- "android.hardware.health-V1-ndk",
+ "android.hardware.health-V2-ndk",
// TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo.
"libhidlbase",
@@ -48,7 +48,7 @@
name: "libhealth_aidl_charger_defaults",
shared_libs: [
// common
- "android.hardware.health-V1-ndk",
+ "android.hardware.health-V2-ndk",
"libbase",
"libcutils",
"liblog",
@@ -195,7 +195,7 @@
"service_fuzzer_defaults",
],
static_libs: [
- "android.hardware.health-V1-ndk",
+ "android.hardware.health-V2-ndk",
"libbase",
"liblog",
"fuzz_libhealth_aidl_impl",
diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp
index d41d01a..15a3dbc 100644
--- a/health/aidl/default/Health.cpp
+++ b/health/aidl/default/Health.cpp
@@ -115,6 +115,42 @@
BatteryStatus::UNKNOWN, out);
}
+ndk::ScopedAStatus Health::setChargingPolicy(BatteryChargingPolicy in_value) {
+ ::android::status_t err = battery_monitor_.setChargingPolicy(static_cast<int>(in_value));
+
+ switch (err) {
+ case ::android::OK:
+ return ndk::ScopedAStatus::ok();
+ case ::android::NAME_NOT_FOUND:
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ case ::android::BAD_VALUE:
+ return ndk::ScopedAStatus::fromStatus(::android::INVALID_OPERATION);
+ default:
+ return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ IHealth::STATUS_UNKNOWN, ::android::statusToString(err).c_str());
+ }
+}
+
+ndk::ScopedAStatus Health::getChargingPolicy(BatteryChargingPolicy* out) {
+ return GetProperty(&battery_monitor_, ::android::BATTERY_PROP_CHARGING_POLICY,
+ BatteryChargingPolicy::DEFAULT, out);
+}
+
+ndk::ScopedAStatus Health::getBatteryHealthData(BatteryHealthData* out) {
+ if (auto res =
+ GetProperty<int64_t>(&battery_monitor_, ::android::BATTERY_PROP_MANUFACTURING_DATE,
+ 0, &out->batteryManufacturingDateSeconds);
+ !res.isOk()) {
+ LOG(WARNING) << "Cannot get Manufacturing_date: " << res.getDescription();
+ }
+ if (auto res = GetProperty<int64_t>(&battery_monitor_, ::android::BATTERY_PROP_FIRST_USAGE_DATE,
+ 0, &out->batteryFirstUsageSeconds);
+ !res.isOk()) {
+ LOG(WARNING) << "Cannot get First_usage_date: " << res.getDescription();
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus Health::getDiskStats(std::vector<DiskStats>*) {
// This implementation does not support DiskStats. An implementation may extend this
// class and override this function to support disk stats.
diff --git a/health/aidl/default/android.hardware.health-service.example.xml b/health/aidl/default/android.hardware.health-service.example.xml
index 98026cb..1fe9b8d 100644
--- a/health/aidl/default/android.hardware.health-service.example.xml
+++ b/health/aidl/default/android.hardware.health-service.example.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.health</name>
- <version>1</version>
+ <version>2</version>
<fqname>IHealth/default</fqname>
</hal>
</manifest>
diff --git a/health/aidl/default/include/health-impl/Health.h b/health/aidl/default/include/health-impl/Health.h
index 6bd4946..dc3a0ef 100644
--- a/health/aidl/default/include/health-impl/Health.h
+++ b/health/aidl/default/include/health-impl/Health.h
@@ -72,6 +72,10 @@
ndk::ScopedAStatus getDiskStats(std::vector<DiskStats>* out) override;
ndk::ScopedAStatus getStorageInfo(std::vector<StorageInfo>* out) override;
+ ndk::ScopedAStatus setChargingPolicy(BatteryChargingPolicy in_value) override;
+ ndk::ScopedAStatus getChargingPolicy(BatteryChargingPolicy* out) override;
+ ndk::ScopedAStatus getBatteryHealthData(BatteryHealthData* out) override;
+
// A subclass may override these to provide a different implementation.
binder_status_t dump(int fd, const char** args, uint32_t num_args) override;
diff --git a/health/aidl/vts/functional/Android.bp b/health/aidl/vts/functional/Android.bp
index f9da79f..b735a87 100644
--- a/health/aidl/vts/functional/Android.bp
+++ b/health/aidl/vts/functional/Android.bp
@@ -39,7 +39,7 @@
"libbinder_ndk",
],
static_libs: [
- "android.hardware.health-V1-ndk",
+ "android.hardware.health-V2-ndk",
"libgmock",
],
header_libs: [
diff --git a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
index 3e07188..dd0bd81 100644
--- a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
+++ b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
@@ -225,6 +225,61 @@
ASSERT_THAT(value, IsValidEnum<BatteryStatus>());
}
+/*
+ * Tests the values returned by getChargingPolicy() from interface IHealth.
+ */
+TEST_P(HealthAidl, getChargingPolicy) {
+ BatteryChargingPolicy value;
+ auto status = health->getChargingPolicy(&value);
+ ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+ if (!status.isOk()) return;
+ ASSERT_THAT(value, IsValidEnum<BatteryChargingPolicy>());
+}
+
+/*
+ * Tests that setChargingPolicy() writes the value and compared the returned
+ * value by getChargingPolicy() from interface IHealth.
+ */
+TEST_P(HealthAidl, setChargingPolicy) {
+ BatteryChargingPolicy value;
+
+ /* set ChargingPolicy*/
+ auto status = health->setChargingPolicy(static_cast<BatteryChargingPolicy>(2)); // LONG_LIFE
+ ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+ if (!status.isOk()) return;
+
+ /* get ChargingPolicy*/
+ status = health->getChargingPolicy(&value);
+ ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+ if (!status.isOk()) return;
+ ASSERT_THAT(static_cast<int>(value), Eq(2));
+}
+
+MATCHER(IsValidHealthData, "") {
+ *result_listener << "value is " << arg.toString() << ".";
+ if (!ExplainMatchResult(Ge(-1), arg.batteryManufacturingDateSeconds, result_listener)) {
+ *result_listener << " for batteryManufacturingDateSeconds.";
+ return false;
+ }
+ if (!ExplainMatchResult(Ge(-1), arg.batteryFirstUsageSeconds, result_listener)) {
+ *result_listener << " for batteryFirstUsageSeconds.";
+ return false;
+ }
+
+ return true;
+}
+
+/*
+ * Tests the values returned by getBatteryHealthData() from interface IHealth.
+ */
+TEST_P(HealthAidl, getBatteryHealthData) {
+ BatteryHealthData value;
+ auto status = health->getBatteryHealthData(&value);
+ ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+ if (!status.isOk()) return;
+ ASSERT_THAT(value, IsValidHealthData());
+}
+
MATCHER(IsValidStorageInfo, "") {
*result_listener << "value is " << arg.toString() << ".";
if (!ExplainMatchResult(InClosedRange(0, 3), arg.eol, result_listener)) {
diff --git a/health/utils/libhealthshim/Android.bp b/health/utils/libhealthshim/Android.bp
index 3a1415f..14c32ae 100644
--- a/health/utils/libhealthshim/Android.bp
+++ b/health/utils/libhealthshim/Android.bp
@@ -34,7 +34,7 @@
"-Werror",
],
static_libs: [
- "android.hardware.health-V1-ndk",
+ "android.hardware.health-V2-ndk",
"android.hardware.health-translate-ndk",
"android.hardware.health@1.0",
"android.hardware.health@2.0",
diff --git a/health/utils/libhealthshim/include/health-shim/shim.h b/health/utils/libhealthshim/include/health-shim/shim.h
index f36fa5d..ff6849b 100644
--- a/health/utils/libhealthshim/include/health-shim/shim.h
+++ b/health/utils/libhealthshim/include/health-shim/shim.h
@@ -45,6 +45,9 @@
ndk::ScopedAStatus getStorageInfo(std::vector<StorageInfo>* _aidl_return) override;
ndk::ScopedAStatus getDiskStats(std::vector<DiskStats>* _aidl_return) override;
ndk::ScopedAStatus getHealthInfo(HealthInfo* _aidl_return) override;
+ ndk::ScopedAStatus setChargingPolicy(BatteryChargingPolicy in_value) override;
+ ndk::ScopedAStatus getChargingPolicy(BatteryChargingPolicy* _aidl_return) override;
+ ndk::ScopedAStatus getBatteryHealthData(BatteryHealthData* _aidl_return) override;
private:
::android::sp<HidlHealth> service_;
diff --git a/health/utils/libhealthshim/shim.cpp b/health/utils/libhealthshim/shim.cpp
index 1329679..6a5f512 100644
--- a/health/utils/libhealthshim/shim.cpp
+++ b/health/utils/libhealthshim/shim.cpp
@@ -217,4 +217,20 @@
return ReturnAndResultToStatus(ret, out_result);
}
+ScopedAStatus HealthShim::setChargingPolicy(BatteryChargingPolicy in_value) {
+ in_value = static_cast<BatteryChargingPolicy>(0);
+ return ResultToStatus(Result::NOT_SUPPORTED);
+}
+
+ScopedAStatus HealthShim::getChargingPolicy(BatteryChargingPolicy* out) {
+ *out = static_cast<BatteryChargingPolicy>(0);
+ return ResultToStatus(Result::NOT_SUPPORTED);
+}
+
+ScopedAStatus HealthShim::getBatteryHealthData(BatteryHealthData* out) {
+ out->batteryManufacturingDateSeconds = 0;
+ out->batteryFirstUsageSeconds = 0;
+ return ResultToStatus(Result::NOT_SUPPORTED);
+}
+
} // namespace aidl::android::hardware::health
diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp
index f38a958..1cc6a36 100644
--- a/radio/aidl/vts/radio_data_test.cpp
+++ b/radio/aidl/vts/radio_data_test.cpp
@@ -143,9 +143,20 @@
TrafficDescriptor trafficDescriptor;
OsAppId osAppId;
- std::string osAppIdString("osAppId");
- std::vector<unsigned char> osAppIdVec(osAppIdString.begin(), osAppIdString.end());
- osAppId.osAppId = osAppIdVec;
+ osAppId.osAppId = {static_cast<unsigned char>(-105), static_cast<unsigned char>(-92),
+ static_cast<unsigned char>(-104), static_cast<unsigned char>(-29),
+ static_cast<unsigned char>(-4), static_cast<unsigned char>(-110),
+ static_cast<unsigned char>(92), static_cast<unsigned char>(-108),
+ static_cast<unsigned char>(-119), static_cast<unsigned char>(-122),
+ static_cast<unsigned char>(3), static_cast<unsigned char>(51),
+ static_cast<unsigned char>(-48), static_cast<unsigned char>(110),
+ static_cast<unsigned char>(78), static_cast<unsigned char>(71),
+ static_cast<unsigned char>(10), static_cast<unsigned char>(69),
+ static_cast<unsigned char>(78), static_cast<unsigned char>(84),
+ static_cast<unsigned char>(69), static_cast<unsigned char>(82),
+ static_cast<unsigned char>(80), static_cast<unsigned char>(82),
+ static_cast<unsigned char>(73), static_cast<unsigned char>(83),
+ static_cast<unsigned char>(69)};
trafficDescriptor.osAppId = osAppId;
DataProfileInfo dataProfileInfo;
diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp
index 58b0645..26e91bd 100644
--- a/security/keymint/aidl/vts/functional/Android.bp
+++ b/security/keymint/aidl/vts/functional/Android.bp
@@ -34,6 +34,7 @@
"libbinder",
"libbinder_ndk",
"libcrypto",
+ "libbase",
"packagemanager_aidl-cpp",
],
static_libs: [
diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
index ea4ba18..99d2510 100644
--- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
+++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
@@ -15,6 +15,8 @@
*/
#define LOG_TAG "keymint_1_attest_key_test"
+#include <android-base/logging.h>
+#include <android-base/strings.h>
#include <cutils/log.h>
#include <cutils/properties.h>
@@ -26,12 +28,61 @@
namespace aidl::android::hardware::security::keymint::test {
namespace {
+string TELEPHONY_CMD_GET_IMEI = "cmd phone get-imei ";
bool IsSelfSigned(const vector<Certificate>& chain) {
if (chain.size() != 1) return false;
return ChainSignaturesAreValid(chain);
}
+/*
+ * Run a shell command and collect the output of it. If any error, set an empty string as the
+ * output.
+ */
+string exec_command(string command) {
+ char buffer[128];
+ string result = "";
+
+ FILE* pipe = popen(command.c_str(), "r");
+ if (!pipe) {
+ LOG(ERROR) << "popen failed.";
+ return result;
+ }
+
+ // read till end of process:
+ while (!feof(pipe)) {
+ if (fgets(buffer, 128, pipe) != NULL) {
+ result += buffer;
+ }
+ }
+
+ pclose(pipe);
+ return result;
+}
+
+/*
+ * Get IMEI using Telephony service shell command. If any error while executing the command
+ * then empty string will be returned as output.
+ */
+string get_imei(int slot) {
+ string cmd = TELEPHONY_CMD_GET_IMEI + std::to_string(slot);
+ string output = exec_command(cmd);
+
+ if (output.empty()) {
+ LOG(ERROR) << "Command failed. Cmd: " << cmd;
+ return "";
+ }
+
+ vector<string> out = ::android::base::Tokenize(::android::base::Trim(output), "Device IMEI:");
+
+ if (out.size() != 1) {
+ LOG(ERROR) << "Error in parsing the command output. Cmd: " << cmd;
+ return "";
+ }
+
+ return ::android::base::Trim(out[0]);
+}
+
} // namespace
class AttestKeyTest : public KeyMintAidlTestBase {
@@ -795,13 +846,44 @@
// Collection of valid attestation ID tags.
auto attestation_id_tags = AuthorizationSetBuilder();
- add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
+ // Use ro.product.brand_for_attestation property for attestation if it is present else fallback
+ // to ro.product.brand
+ std::string prop_value =
+ ::android::base::GetProperty("ro.product.brand_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_BRAND,
+ "ro.product.brand_for_attestation");
+ } else {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
+ }
add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_DEVICE, "ro.product.device");
- add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
+ // Use ro.product.name_for_attestation property for attestation if it is present else fallback
+ // to ro.product.name
+ prop_value = ::android::base::GetProperty("ro.product.name_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_PRODUCT,
+ "ro.product.name_for_attestation");
+ } else {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
+ }
add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_SERIAL, "ro.serialno");
add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MANUFACTURER,
"ro.product.manufacturer");
- add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
+ // Use ro.product.model_for_attestation property for attestation if it is present else fallback
+ // to ro.product.model
+ prop_value =
+ ::android::base::GetProperty("ro.product.model_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MODEL,
+ "ro.product.model_for_attestation");
+ } else {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
+ }
+
+ string imei = get_imei(0);
+ if (!imei.empty()) {
+ attestation_id_tags.Authorization(TAG_ATTESTATION_ID_IMEI, imei.data(), imei.size());
+ }
for (const KeyParameter& tag : attestation_id_tags) {
SCOPED_TRACE(testing::Message() << "+tag-" << tag);
diff --git a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
index 26dc3f5..55bb5b4 100644
--- a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
+++ b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
@@ -249,13 +249,39 @@
// Collection of valid attestation ID tags.
auto attestation_id_tags = AuthorizationSetBuilder();
- add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
+ // Use ro.product.brand_for_attestation property for attestation if it is present else fallback
+ // to ro.product.brand
+ std::string prop_value =
+ ::android::base::GetProperty("ro.product.brand_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_BRAND,
+ "ro.product.brand_for_attestation");
+ } else {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
+ }
add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_DEVICE, "ro.product.device");
- add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
+ // Use ro.product.name_for_attestation property for attestation if it is present else fallback
+ // to ro.product.name
+ prop_value = ::android::base::GetProperty("ro.product.name_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_PRODUCT,
+ "ro.product.name_for_attestation");
+ } else {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
+ }
add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_SERIAL, "ro.serialno");
add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MANUFACTURER,
"ro.product.manufacturer");
- add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
+ // Use ro.product.model_for_attestation property for attestation if it is present else fallback
+ // to ro.product.model
+ prop_value =
+ ::android::base::GetProperty("ro.product.model_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MODEL,
+ "ro.product.model_for_attestation");
+ } else {
+ add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
+ }
vector<uint8_t> key_blob;
vector<KeyCharacteristics> key_characteristics;
diff --git a/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp b/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp
index c952012..2091b4b 100644
--- a/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp
@@ -588,7 +588,7 @@
ASSERT_EQ(ErrorCode::OK, DeleteKey(&keyblob));
// Remove all files relating to the deleted key.
- std::cerr << "Deleting files for deleted key '" << name << ";";
+ std::cerr << "Deleting files for deleted key '" << name << "';\n";
delete_keyblob(subdir, name);
// Attempting to use the keyblob after deletion should fail.
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index 2440977..1b9e758 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -2080,12 +2080,38 @@
// Various ATTESTATION_ID_* tags that map to fields in the attestation extension ASN.1 schema.
auto extra_tags = AuthorizationSetBuilder();
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
+ // Use ro.product.brand_for_attestation property for attestation if it is present else fallback
+ // to ro.product.brand
+ std::string prop_value =
+ ::android::base::GetProperty("ro.product.brand_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_BRAND,
+ "ro.product.brand_for_attestation");
+ } else {
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_BRAND, "ro.product.brand");
+ }
add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_DEVICE, "ro.product.device");
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
+ // Use ro.product.name_for_attestation property for attestation if it is present else fallback
+ // to ro.product.name
+ prop_value = ::android::base::GetProperty("ro.product.name_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_PRODUCT,
+ "ro.product.name_for_attestation");
+ } else {
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_PRODUCT, "ro.product.name");
+ }
add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_SERIAL, "ro.serialno");
add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MANUFACTURER, "ro.product.manufacturer");
- add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
+ // Use ro.product.model_for_attestation property for attestation if it is present else fallback
+ // to ro.product.model
+ prop_value =
+ ::android::base::GetProperty("ro.product.model_for_attestation", /* default= */ "");
+ if (!prop_value.empty()) {
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MODEL,
+ "ro.product.model_for_attestation");
+ } else {
+ add_tag_from_prop(&extra_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
+ }
for (const KeyParameter& tag : extra_tags) {
SCOPED_TRACE(testing::Message() << "tag-" << tag);
diff --git a/security/rkp/CHANGELOG.md b/security/rkp/CHANGELOG.md
index 715cf28..9409a6d 100644
--- a/security/rkp/CHANGELOG.md
+++ b/security/rkp/CHANGELOG.md
@@ -41,6 +41,7 @@
payload and the implementation-defined payload itself. This is done by creating a typed
`AuthenticatedRequest<T>` object representing the top level data required to authenticate
the data provided in the payload, `T`.
+ * The new CSR format supports P-384 signing keys and SHA-384 hashes in the DICE chain.
* RpcHardwareInfo
* `supportedNumKeysInCsr` added to report the maximum number of keys supported in a CSR.
* `supportedEekCurve` is no longer used, due to the removal of the EEK from the scheme.
diff --git a/security/rkp/README.md b/security/rkp/README.md
index 5fb4948..9090ac5 100644
--- a/security/rkp/README.md
+++ b/security/rkp/README.md
@@ -172,31 +172,28 @@
* ECDSA P-256 for attestation signing keys;
* Remote provisioning protocol signing keys:
- * Ed25519 / P-256
+ * Ed25519 / P-256 / P-384
* ECDH keys:
* X25519 / P-256
* AES-GCM for all encryption;
-* SHA-256 for all message digesting;
-* HMAC-SHA-256 for all MACing; and
-* HKDF-SHA-256 for all key derivation.
+* SHA-256 / SHA-384 / SHA-512 for message digesting;
+* HMAC with a supported message digest for all MACing; and
+* HKDF with a supported message digest for all key derivation.
We believe that Curve25519 offers the best tradeoff in terms of security,
efficiency and global trustworthiness, and that it is now sufficiently
widely-used and widely-implemented to make it a practical choice.
-However, since Secure Elements (SE) do not currently offer support for curve
-25519, we are allowing implementations to instead make use of EC P-256 for
-signing and ECDH. To put it simply, the device unique key pair will be a P-256
-key pair for ECDSA instead of Ed25519, and the ProtectedData COSE\_Encrypt
-message will have its payload encrypted with P-256 ECDH key exchange instead of
-X25519.
+However, since hardware such as Secure Elements (SE) do not currently offer
+support for curve 25519, we are allowing implementations to instead make use of
+ECDSA and ECDH.
The CDDL in the rest of the document will use the '/' operator to show areas
-where either curve 25519 or P-256 may be used. Since there is no easy way to
-bind choices across different CDDL groups, it is important that the implementor
-stays consistent in which type is chosen. E.g. taking ES256 as the choice for
-algorithm implies the implementor should also choose the P256 public key group
-further down in the COSE structure.
+where either curve 25519, P-256 or P-384 may be used. Since there is no easy way
+to bind choices across different CDDL groups, it is important that the
+implementor stays consistent in which type is chosen. E.g. taking ES256 as the
+choice for algorithm implies the implementor should also choose the P256 public
+key group further down in the COSE structure.
### Testability
diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
index 75990da..5bd2145 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
@@ -159,18 +159,27 @@
* IRemotelyProvisionedComponent must validate the MACs on each key. If any entry in the
* array lacks a valid MAC, the method must return STATUS_INVALID_MAC.
*
- * If testMode is true, the keysToCertify array must contain only keys flagged as test
+ * If testMode is true, the keysToSign array must contain only keys flagged as test
* keys. Otherwise, the method must return STATUS_PRODUCTION_KEY_IN_TEST_REQUEST.
*
- * If testMode is false, the keysToCertify array must not contain any keys flagged as
+ * If testMode is false, the keysToSign array must not contain any keys flagged as
* test keys. Otherwise, the method must return STATUS_TEST_KEY_IN_PRODUCTION_REQUEST.
*
- * @param in endpointEncryptionKey contains an X25519 public key which will be used to encrypt
- * the BCC. For flexibility, this is represented as a certificate chain, represented as a
- * CBOR array of COSE_Sign1 objects, ordered from root to leaf. The leaf contains the
- * X25519 encryption key, each other element is an Ed25519 key signing the next in the
- * chain. The root is self-signed. An implementor may also choose to use P256 as an
- * alternative curve for signing and encryption instead of Curve 25519.
+ * @param in endpointEncryptionKey contains an X25519 or P-256 public key which will be used to
+ * encrypt the BCC. For flexibility, this is represented as a certificate chain
+ * in the form of a CBOR array of COSE_Sign1 objects, ordered from root to leaf. An
+ * implementor may also choose to use P256 as an alternative curve for signing and
+ * encryption instead of Curve 25519, as indicated by the supportedEekCurve field in
+ * RpcHardwareInfo; the contents of the EEK chain will match the specified
+ * supportedEekCurve.
+ *
+ * - For CURVE_25519 the leaf contains the X25519 agreement key, each other element is an
+ * Ed25519 key signing the next in the chain.
+ *
+ * - For CURVE_P256 the leaf contains the P-256 agreement key, each other element is a
+ * P-256 key signing the next in the chain.
+ *
+ * In either case, the root is self-signed.
*
* EekChain = [ + SignedSignatureKey, SignedEek ]
*
@@ -342,7 +351,7 @@
*
* ; COSE_Sign1 (untagged)
* SignedData<Data> = [
- * protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+ * protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
* unprotected: {},
* payload: bstr .cbor Data / nil,
* signature: bstr ; PureEd25519(CDI_Leaf_Priv, SignedDataSigStruct<Data>) /
@@ -352,7 +361,7 @@
* ; Sig_structure for SignedData
* SignedDataSigStruct<Data> = [
* context: "Signature1",
- * protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+ * protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
* external_aad: bstr .size 0,
* payload: bstr .cbor Data / nil,
* ]
@@ -384,7 +393,7 @@
* ; after the first describe a link in the boot chain (e.g. bootloaders: BL1, BL2, ... BLN)
* ; Note that there is no DiceChainEntry for UDS_pub, only a "bare" COSE_key.
* DiceCertChain = [
- * PubKeyEd25519 / PubKeyECDSA256, ; UDS_Pub
+ * PubKeyEd25519 / PubKeyECDSA256 / PubKeyECDSA384, ; UDS_Pub
* + DiceChainEntry, ; First CDI_Certificate -> Last CDI_Certificate
* ; Last certificate corresponds to KeyMint's DICE key.
* ]
@@ -392,16 +401,17 @@
* ; This is the signed payload for each entry in the DICE chain. Note that the "Configuration
* ; Input Values" described by the Open Profile are not used here. Instead, the DICE chain
* ; defines its own configuration values for the Configuration Descriptor field. See
- * ; the Open Profile for DICE for more details on the fields. SHA256 and SHA512 are acceptable
- * ; hash algorithms. The digest bstr values in the payload are the digest values without any
- * ; padding. Note that for SHA256, this implies the digest bstr is 32 bytes. This is an
- * ; intentional, minor deviation from Open Profile for DICE, which specifies all digests are
- * ; 64 bytes.
+ * ; the Open Profile for DICE for more details on the fields. SHA256, SHA384 and SHA512 are
+ * ; acceptable hash algorithms. The digest bstr values in the payload are the digest values
+ * ; without any padding. Note that this implies that the digest is a 32-byte bstr for SHA256
+ * ; and a 48-byte bstr for SHA384. This is an intentional, minor deviation from Open Profile
+ * ; for DICE, which specifies all digests are 64 bytes.
* DiceChainEntryPayload = { ; CWT [RFC8392]
* 1 : tstr, ; Issuer
* 2 : tstr, ; Subject
* -4670552 : bstr .cbor PubKeyEd25519 /
- * bstr .cbor PubKeyECDSA256, ; Subject Public Key
+ * bstr .cbor PubKeyECDSA256,
+ * bstr .cbor PubKeyECDSA384, ; Subject Public Key
* -4670553 : bstr ; Key Usage
*
* ; NOTE: All of the following fields may be omitted for a "Degenerate DICE Chain", as
@@ -422,7 +432,7 @@
* ; Each entry in the DICE chain is a DiceChainEntryPayload signed by the key from the previous
* ; entry in the DICE chain array.
* DiceChainEntry = [ ; COSE_Sign1 (untagged)
- * protected : bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+ * protected : bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
* unprotected: {},
* payload: bstr .cbor DiceChainEntryPayload,
* signature: bstr ; PureEd25519(SigningKey, DiceChainEntryInput) /
@@ -433,7 +443,7 @@
*
* DiceChainEntryInput = [
* context: "Signature1",
- * protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+ * protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
* external_aad: bstr .size 0,
* payload: bstr .cbor DiceChainEntryPayload
* ]
@@ -458,7 +468,16 @@
* -3 : bstr ; Y coordinate, big-endian
* }
*
+ * PubKeyECDSA384 = { ; COSE_Key
+ * 1 : 2, ; Key type : EC2
+ * 3 : AlgorithmES384, ; Algorithm : ECDSA w/ SHA-384
+ * -1 : 2, ; Curve: P384
+ * -2 : bstr, ; X coordinate
+ * -3 : bstr ; Y coordinate
+ * }
+ *
* AlgorithmES256 = -7
+ * AlgorithmES384 = -35
* AlgorithmEdDSA = -8
*/
byte[] generateCertificateRequestV2(in MacedPublicKey[] keysToSign, in byte[] challenge);
diff --git a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
index bfe8417..57ee8cf 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
@@ -50,6 +50,8 @@
* ; salt = null
* ; info = .cbor Context (see below)
* ; K = HKDF-SHA-256(ikm, salt, info)
+ * ; AAD for the encryption is a CBOR-serialized
+ * ; Enc_structure (RFC 8152 s5.3) with empty external_aad.
* recipients : [
* [ ; COSE_Recipient
* protected : bstr .cbor {
@@ -65,7 +67,10 @@
* ]
*
* ; The COSE_KDF_Context that is used to derive the ProtectedData encryption key with
- * ; HKDF. See details on use in ProtectedData comments above.
+ * ; HKDF. See details on use in ProtectedData comments above. The public key data
+ * ; included in the other field of PartyUInfo / PartyVInfo is encoded as:
+ * ; - a raw 32-byte public key for X25519
+ * ; - uncompressed SEC-1 coordinate data (0x04 || x || y) for P-256
* Context = [
* AlgorithmID : 3 ; AES-GCM 256
* PartyUInfo : [
@@ -138,7 +143,7 @@
* ; bytes inclusive
* VerifiedDeviceInfo,
* tag: bstr ; This is the tag from COSE_Mac0 of
- * ; KeysToCertify, to tie the key set to
+ * ; KeysToSign, to tie the key set to
* ; the signature.
* ]
*
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl
index d2eb389..1f87cf2 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/CoolingType.aidl
@@ -35,15 +35,15 @@
/* @hide */
@Backing(type="int") @VintfStability
enum CoolingType {
- FAN = 0,
- BATTERY = 1,
- CPU = 2,
- GPU = 3,
- MODEM = 4,
- NPU = 5,
- COMPONENT = 6,
- TPU = 7,
- POWER_AMPLIFIER = 8,
- DISPLAY = 9,
- SPEAKER = 10,
+ FAN,
+ BATTERY,
+ CPU,
+ GPU,
+ MODEM,
+ NPU,
+ COMPONENT,
+ TPU,
+ POWER_AMPLIFIER,
+ DISPLAY,
+ SPEAKER,
}
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl
index 0a9efdd..e9710a7 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/TemperatureType.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum TemperatureType {
- UNKNOWN = -1,
+ UNKNOWN = (-1),
CPU = 0,
GPU = 1,
BATTERY = 2,
diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/ThrottlingSeverity.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/ThrottlingSeverity.aidl
index 8fe3df6..183344d 100644
--- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/ThrottlingSeverity.aidl
+++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/ThrottlingSeverity.aidl
@@ -36,10 +36,10 @@
@Backing(type="int") @VintfStability
enum ThrottlingSeverity {
NONE = 0,
- LIGHT = 1,
- MODERATE = 2,
- SEVERE = 3,
- CRITICAL = 4,
- EMERGENCY = 5,
- SHUTDOWN = 6,
+ LIGHT,
+ MODERATE,
+ SEVERE,
+ CRITICAL,
+ EMERGENCY,
+ SHUTDOWN,
}
diff --git a/thermal/aidl/android/hardware/thermal/IThermal.aidl b/thermal/aidl/android/hardware/thermal/IThermal.aidl
index dd87b3a..7c23c17 100644
--- a/thermal/aidl/android/hardware/thermal/IThermal.aidl
+++ b/thermal/aidl/android/hardware/thermal/IThermal.aidl
@@ -104,9 +104,9 @@
* they go offline, if these devices exist on boot. The method
* always returns and never removes such temperatures. The thresholds
* are returned as static values and must not change across calls. The actual
- * throttling state is determined in device thermal mitigation policy/agorithm
+ * throttling state is determined in device thermal mitigation policy/algorithm
* which might not be simple thresholds so these values Thermal HAL provided
- * may not be accurate to detemin the throttling status. To get accurate
+ * may not be accurate to determine the throttling status. To get accurate
* throttling status, use getTemperatures or registerThermalChangedCallback
* and listen to the callback.
*
@@ -129,9 +129,9 @@
* they go offline, if these devices exist on boot. The method
* always returns and never removes such temperatures. The thresholds
* are returned as static values and must not change across calls. The actual
- * throttling state is determined in device thermal mitigation policy/agorithm
+ * throttling state is determined in device thermal mitigation policy/algorithm
* which might not be simple thresholds so these values Thermal HAL provided
- * may not be accurate to detemin the throttling status. To get accurate
+ * may not be accurate to determine the throttling status. To get accurate
* throttling status, use getTemperatures or registerThermalChangedCallback
* and listen to the callback.
*
diff --git a/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl b/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
index 8065f76..0714c82 100644
--- a/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
+++ b/thermal/aidl/android/hardware/thermal/TemperatureThreshold.aidl
@@ -36,7 +36,7 @@
* level defined in ThrottlingSeverity including shutdown. Throttling
* happens when temperature >= threshold. If not available, set to NAN.
* Unit is same as Temperature's value.
- * The number of thresholds must be the same as ThrottlingSeverity#len.
+ * The array size must be the same as ThrottlingSeverity's enum cardinality.
*/
float[] hotThrottlingThresholds;
/**
@@ -44,7 +44,7 @@
* level defined in ThrottlingSeverity including shutdown. Throttling
* happens when temperature <= threshold. If not available, set to NAN.
* Unit is same as Temperature's value.
- * The number of theresholds must be the same as ThrottlingSeverity#len.
+ * The array size must be the same as ThrottlingSeverity's enum cardinality.
*/
float[] coldThrottlingThresholds;
}
diff --git a/tv/hdmi/aidl/vts/functional/VtsHalTvHdmiAidlTargetTest.cpp b/tv/hdmi/aidl/vts/functional/VtsHalTvHdmiAidlTargetTest.cpp
deleted file mode 100644
index fd4d94f..0000000
--- a/tv/hdmi/aidl/vts/functional/VtsHalTvHdmiAidlTargetTest.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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 "Hdmi_hal_test"
-
-#include <aidl/Gtest.h>
-#include <aidl/Vintf.h>
-#include <aidl/android/hardware/tv/hdmi/BnHdmi.h>
-#include <aidl/android/hardware/tv/hdmi/BnHdmiCallback.h>
-#include <android-base/logging.h>
-#include <android/binder_manager.h>
-#include <android/binder_process.h>
-#include <gtest/gtest.h>
-#include <log/log.h>
-#include <sstream>
-#include <vector>
-
-using ::aidl::android::hardware::tv::hdmi::BnHdmiCallback;
-using ::aidl::android::hardware::tv::hdmi::HdmiPortInfo;
-using ::aidl::android::hardware::tv::hdmi::HdmiPortType;
-using ::aidl::android::hardware::tv::hdmi::HpdSignal;
-using ::aidl::android::hardware::tv::hdmi::IHdmi;
-using ::aidl::android::hardware::tv::hdmi::IHdmiCallback;
-using ::ndk::SpAIBinder;
-
-#define INCORRECT_VENDOR_ID 0x00
-#define TV_PHYSICAL_ADDRESS 0x0000
-
-// The main test class for TV HDMI HAL.
-class HdmiTest : public ::testing::TestWithParam<std::string> {
- static void serviceDied(void* /* cookie */) { ALOGE("VtsHalTvCecAidlTargetTest died"); }
-
- public:
- void SetUp() override {
- hdmi = IHdmi::fromBinder(SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
- ASSERT_NE(hdmi, nullptr);
- ALOGI("%s: getService() for hdmi is %s", __func__, hdmi->isRemote() ? "remote" : "local");
-
- hdmiCallback = ::ndk::SharedRefBase::make<HdmiCallback>();
- ASSERT_NE(hdmiCallback, nullptr);
- hdmiDeathRecipient =
- ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(&serviceDied));
- ASSERT_EQ(AIBinder_linkToDeath(hdmi->asBinder().get(), hdmiDeathRecipient.get(), 0),
- STATUS_OK);
- }
-
- class HdmiCallback : public BnHdmiCallback {
- public:
- ::ndk::ScopedAStatus onHotplugEvent(bool connected __unused, int32_t portId __unused) {
- return ::ndk::ScopedAStatus::ok();
- };
- };
-
- std::shared_ptr<IHdmi> hdmi;
- std::shared_ptr<IHdmiCallback> hdmiCallback;
- ::ndk::ScopedAIBinder_DeathRecipient hdmiDeathRecipient;
-};
-
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HdmiTest);
-INSTANTIATE_TEST_SUITE_P(PerInstance, HdmiTest,
- testing::ValuesIn(android::getAidlHalInstanceNames(IHdmi::descriptor)),
- android::PrintInstanceNameToString);
-
-TEST_P(HdmiTest, SetCallback) {
- ASSERT_TRUE(hdmi->setCallback(::ndk::SharedRefBase::make<HdmiCallback>()).isOk());
-}
-
-TEST_P(HdmiTest, GetPortInfo) {
- std::vector<HdmiPortInfo> ports;
- ASSERT_TRUE(hdmi->getPortInfo(&ports).isOk());
-
- bool cecSupportedOnDevice = false;
- for (size_t i = 0; i < ports.size(); ++i) {
- EXPECT_TRUE((ports[i].type == HdmiPortType::OUTPUT) ||
- (ports[i].type == HdmiPortType::INPUT));
- if (ports[i].portId == 0) {
- ALOGW("%s: Port id should start from 1", __func__);
- }
- cecSupportedOnDevice = cecSupportedOnDevice | ports[i].cecSupported;
- }
- EXPECT_NE(cecSupportedOnDevice, false) << "At least one port should support CEC";
-}
-
-TEST_P(HdmiTest, IsConnected) {
- std::vector<HdmiPortInfo> ports;
- ASSERT_TRUE(hdmi->getPortInfo(&ports).isOk());
- for (size_t i = 0; i < ports.size(); ++i) {
- bool connected;
- ASSERT_TRUE(hdmi->isConnected(ports[i].portId, &connected).isOk());
- }
-}
-
-TEST_P(HdmiTest, HdpSignal) {
- HpdSignal originalSignal;
- HpdSignal signal = HpdSignal::HDMI_HPD_STATUS_BIT;
- HpdSignal readSignal;
- ASSERT_TRUE(hdmi->getHpdSignal(&originalSignal).isOk());
- ASSERT_TRUE(hdmi->setHpdSignal(signal).isOk());
- ASSERT_TRUE(hdmi->getHpdSignal(&readSignal).isOk());
- EXPECT_EQ(readSignal, signal);
- signal = HpdSignal::HDMI_HPD_PHYSICAL;
- ASSERT_TRUE(hdmi->setHpdSignal(signal).isOk());
- ASSERT_TRUE(hdmi->getHpdSignal(&readSignal).isOk());
- EXPECT_EQ(readSignal, signal);
- ASSERT_TRUE(hdmi->setHpdSignal(originalSignal).isOk());
-}
diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
index c8a10d1..1d2ef4a 100644
--- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
+++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
@@ -24,7 +24,7 @@
@VintfStability
parcelable HdmiPortInfo {
HdmiPortType type;
- int portId; // Should start from 1 which corresponds to HDMI "port 1".
+ int portId; // Output ports should start from 1 which corresponds to HDMI "port 1".
boolean cecSupported;
boolean arcSupported;
boolean eArcSupported;
diff --git a/wifi/apex/Android.bp b/wifi/apex/Android.bp
index 0afb96b..45f17a6 100644
--- a/wifi/apex/Android.bp
+++ b/wifi/apex/Android.bp
@@ -30,6 +30,7 @@
name: "com.android.hardware.wifi.xml",
src: ":default-android.hardware.wifi@1.0-service.xml",
installable: false,
+ sub_dir: "vintf",
}
apex {
@@ -38,7 +39,6 @@
key: "com.android.hardware.wifi.key",
certificate: ":com.android.hardware.wifi.certificate",
file_contexts: "file_contexts",
- vintf_fragments: [":com.android.hardware.wifi.xml"],
use_vndk_as_stable: true,
updatable: false,
soc_specific: true,
diff --git a/wifi/apex/file_contexts b/wifi/apex/file_contexts
index 812d51d..04e8a62 100644
--- a/wifi/apex/file_contexts
+++ b/wifi/apex/file_contexts
@@ -1,3 +1,3 @@
-(/.*)? u:object_r:vendor_file:s0
-/bin/hw/android\.hardware\.wifi@1.0-service u:object_r:hal_wifi_default_exec:s0
-
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.wifi@1.0-service u:object_r:hal_wifi_default_exec:s0