Merge "KeyMint VTS: don't combine ATTEST_KEY with SIGN"
diff --git a/audio/common/all-versions/default/service/Android.bp b/audio/common/all-versions/default/service/Android.bp
index 0d4775c6a..1bd6abe 100644
--- a/audio/common/all-versions/default/service/Android.bp
+++ b/audio/common/all-versions/default/service/Android.bp
@@ -7,17 +7,40 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
+soong_config_module_type {
+ name: "android_hardware_audio_config_default",
+ module_type: "cc_defaults",
+ config_namespace: "android_hardware_audio",
+ bool_variables: [
+ "run_64bit",
+ ],
+ properties: ["compile_multilib"],
+}
+
+android_hardware_audio_config_default {
+ name: "android_hardware_audio_config_defaults",
+
+ soong_config_variables: {
+ run_64bit: {
+ conditions_default: {
+ // Prefer 32 bit as the binary must always be installed at the same
+ // location for init to start it and the build system does not support
+ // having two binaries installable to the same location even if they are
+ // not installed in the same build.
+ compile_multilib: "prefer32",
+ },
+ compile_multilib: "64",
+ },
+ },
+}
+
cc_binary {
name: "android.hardware.audio.service",
init_rc: ["android.hardware.audio.service.rc"],
relative_install_path: "hw",
vendor: true,
- // Prefer 32 bit as the binary must always be installed at the same
- // location for init to start it and the build system does not support
- // having two binaries installable to the same location even if they are
- // not installed in the same build.
- compile_multilib: "prefer32",
+
srcs: ["service.cpp"],
cflags: [
@@ -34,6 +57,10 @@
"libutils",
"libhardware",
],
+
+ defaults: [
+ "android_hardware_audio_config_defaults",
+ ],
}
// Legacy service name, use android.hardware.audio.service instead
diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp
index 898c22d..89585b0 100644
--- a/audio/common/all-versions/default/service/service.cpp
+++ b/audio/common/all-versions/default/service/service.cpp
@@ -90,6 +90,7 @@
},
{
"Bluetooth Audio API",
+ "android.hardware.bluetooth.audio@2.2::IBluetoothAudioProvidersFactory",
"android.hardware.bluetooth.audio@2.1::IBluetoothAudioProvidersFactory",
"android.hardware.bluetooth.audio@2.0::IBluetoothAudioProvidersFactory",
},
diff --git a/audio/core/all-versions/vts/functional/7.0/Generators.cpp b/audio/core/all-versions/vts/functional/7.0/Generators.cpp
index d2ba339..8c92cbd 100644
--- a/audio/core/all-versions/vts/functional/7.0/Generators.cpp
+++ b/audio/core/all-versions/vts/functional/7.0/Generators.cpp
@@ -102,6 +102,9 @@
if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile
auto [flags, isOffload] = generateOutFlags(mixPort);
for (const auto& profile : mixPort.getProfile()) {
+ if (!profile.hasFormat() || !profile.hasSamplingRates() ||
+ !profile.hasChannelMasks())
+ continue;
auto configs = combineAudioConfig(profile.getChannelMasks(),
profile.getSamplingRates(), profile.getFormat());
for (auto& config : configs) {
@@ -231,6 +234,9 @@
std::back_inserter(flags), [](auto flag) { return toString(flag); });
}
for (const auto& profile : mixPort.getProfile()) {
+ if (!profile.hasFormat() || !profile.hasSamplingRates() ||
+ !profile.hasChannelMasks())
+ continue;
auto configs = combineAudioConfig(profile.getChannelMasks(),
profile.getSamplingRates(), profile.getFormat());
for (const auto& config : configs) {
diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp
index e446a7f..c576060 100644
--- a/audio/core/all-versions/vts/functional/Android.bp
+++ b/audio/core/all-versions/vts/functional/Android.bp
@@ -239,6 +239,7 @@
data: [
"tests/apm_config_no_vx_7_0.xml",
"tests/apm_config_with_vx_7_0.xml",
+ "tests/apm_config_b_204314749_7_0.xml",
],
test_config: "tests/HalAudioV7_0GeneratorTest.xml",
}
diff --git a/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml b/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml
index 2e79455..3dc5b33 100644
--- a/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml
+++ b/audio/core/all-versions/vts/functional/tests/HalAudioV7_0GeneratorTest.xml
@@ -24,6 +24,7 @@
<option name="cleanup" value="true" />
<option name="push" value="apm_config_no_vx_7_0.xml->/data/local/tmp/apm_config_no_vx.xml" />
<option name="push" value="apm_config_with_vx_7_0.xml->/data/local/tmp/apm_config_with_vx.xml" />
+ <option name="push" value="apm_config_b_204314749_7_0.xml->/data/local/tmp/apm_config_b_204314749_7_0.xml" />
<option name="push" value="HalAudioV7_0GeneratorTest->/data/local/tmp/HalAudioV7_0GeneratorTest" />
</target_preparer>
diff --git a/audio/core/all-versions/vts/functional/tests/apm_config_b_204314749_7_0.xml b/audio/core/all-versions/vts/functional/tests/apm_config_b_204314749_7_0.xml
new file mode 100644
index 0000000..5bdca9a
--- /dev/null
+++ b/audio/core/all-versions/vts/functional/tests/apm_config_b_204314749_7_0.xml
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<audioPolicyConfiguration version="7.0" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <!-- version section contains a “version” tag in the form “major.minor” e.g. version=”1.0” -->
+
+ <!-- Global configuration Decalaration -->
+ <globalConfiguration speaker_drc_enabled="false"/>
+
+
+ <!-- Modules section:
+ There is one section per audio HW module present on the platform.
+ Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
+ The module names are the same as in current .conf file:
+ “primary”, “A2DP”, “remote_submix”, “USB”
+ Each module will contain the following sections:
+ “devicePorts”: a list of device descriptors for all input and output devices accessible via this
+ module.
+ This contains both permanently attached devices and removable devices.
+ “mixPorts”: listing all output and input streams exposed by the audio HAL
+ “routes”: list of possible connections between input and output devices or between stream and
+ devices.
+ "route": is defined by an attribute:
+ -"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
+ -"sink": the sink involved in this route
+ -"sources": all the sources than can be connected to the sink via vis route
+ “attachedDevices”: permanently attached devices.
+ The attachedDevices section is a list of devices names. The names correspond to device names
+ defined in <devicePorts> section.
+ “defaultOutputDevice”: device to be used by default when no policy rule applies
+ -->
+ <modules>
+ <!-- Primary Audio HAL -->
+ <module name="primary" halVersion="3.0">
+ <attachedDevices>
+ <item>Speaker</item>
+ <item>Built-In Mic</item>
+ <item>Built-In Back Mic</item>
+ <item>Echo Reference</item>
+ <item>Tuner</item>
+ </attachedDevices>
+ <defaultOutputDevice>Speaker</defaultOutputDevice>
+ <mixPorts>
+ <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="tunnel pcm" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_HW_AV_SYNC">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="32000 44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="direct pcm" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="32000 44100 48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="direct output" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT">
+ <profile name=""/>
+ </mixPort>
+ <mixPort name="tunnel direct output" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_HW_AV_SYNC">
+ <profile name=""/>
+ </mixPort>
+ <mixPort name="mmap_no_irq_out" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_MMAP_NOIRQ">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="primary input" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
+ </mixPort>
+ <mixPort name="tunnel a2dp" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT AUDIO_OUTPUT_FLAG_HW_AV_SYNC">
+ <profile name=""/>
+ </mixPort>
+ <mixPort name="direct a2dp" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT">
+ <profile name=""/>
+ </mixPort>
+ <mixPort name="echo reference" role="sink">
+ <profile name="echo_reference" format="AUDIO_FORMAT_PCM_32_BIT"
+ samplingRates="48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
+ </mixPort>
+ <mixPort name="built-in mic" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
+ samplingRates="16000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
+ </mixPort>
+ <mixPort name="ble_in" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <!-- Output devices declaration, i.e. Sink DEVICE PORT -->
+ <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER">
+ <gains>
+ <gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT"
+ minValueMB="-10000"
+ maxValueMB="0"
+ defaultValueMB="-6000"
+ stepValueMB="100"/>
+ </gains>
+ </devicePort>
+ <devicePort tagName="HDMI Out" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
+ </devicePort>
+ <devicePort tagName="Tuner" role="source" type="AUDIO_DEVICE_IN_TV_TUNER">
+ <gains>
+ <gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT"
+ minValueMB="-10000"
+ maxValueMB="0"
+ defaultValueMB="-6000"
+ stepValueMB="100"/>
+ </gains>
+ </devicePort>
+ <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
+ </devicePort>
+ <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+
+ <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source" address="top">
+ <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
+ </devicePort>
+ <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
+ </devicePort>
+ <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
+ </devicePort>
+ <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </devicePort>
+ <devicePort tagName="Echo Reference" type="AUDIO_DEVICE_IN_ECHO_REFERENCE" role="source">
+ <profile name="echo_reference" format="AUDIO_FORMAT_PCM_32_BIT"
+ samplingRates="48000"
+ channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BLE-In" type="AUDIO_DEVICE_IN_BLUETOOTH_BLE" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </devicePort>
+ </devicePorts>
+ <!-- route declaration, i.e. list all available sources for a given sink -->
+ <routes>
+ <route type="mix" sink="HDMI Out"
+ sources="primary output,tunnel pcm,direct output,Tuner,mmap_no_irq_out,tunnel direct output"/>
+ <route type="mix" sink="Speaker"
+ sources="primary output,tunnel pcm,direct pcm,BT SCO Headset Mic,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="BT SCO"
+ sources="primary output,BT SCO Headset Mic,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="BT SCO Headset"
+ sources="primary output,BT SCO Headset Mic,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="Wired Headset"
+ sources="primary output,tunnel pcm,BT SCO Headset Mic,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="Wired Headphones"
+ sources="primary output,tunnel pcm,BT SCO Headset Mic,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="primary input"
+ sources="Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,Tuner"/>
+ <route type="mix" sink="BT A2DP Out"
+ sources="primary output,tunnel a2dp,direct a2dp,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="BT A2DP Headphones"
+ sources="primary output,tunnel a2dp,direct a2dp,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="BT A2DP Speaker"
+ sources="primary output,tunnel a2dp,direct a2dp,Tuner,mmap_no_irq_out"/>
+ <route type="mix" sink="echo reference"
+ sources="Echo Reference"/>
+ <route type="mix" sink="built-in mic"
+ sources="Built-In Mic"/>
+ <route type="mix" sink="ble_in"
+ sources="BLE-In"/>
+ </routes>
+
+ </module>
+
+ <!-- A2dp Audio HAL -->
+ <!-- <xi:include href="a2dp_audio_policy_configuration.xml"/> -->
+
+ <!-- Usb Audio HAL -->
+ <!-- <xi:include href="usb_audio_policy_configuration.xml"/> -->
+
+ <!-- Remote Submix Audio HAL -->
+ <!-- <xi:include href="r_submix_audio_policy_configuration.xml"/> -->
+
+ <!-- Hearing aid Audio HAL -->
+ <!-- <xi:include href="hearing_aid_audio_policy_configuration.xml"/> -->
+
+ <!-- MSD Audio HAL (optional) -->
+ <!-- <xi:include href="msd_audio_policy_configuration.xml"/> -->
+
+ </modules>
+ <!-- End of Modules section -->
+
+ <!-- Volume section -->
+
+ <!-- <xi:include href="audio_policy_volumes.xml"/> -->
+ <!-- <xi:include href="default_volume_tables.xml"/> -->
+
+ <!-- End of Volume section -->
+
+ <!-- Surround Sound configuration -->
+
+ <surroundSound>
+ <!-- Each of the listed formats gets an entry in Surround Settings dialog on TV devices.
+ There must be a corresponding Java ENCODING_... constant defined in AudioFormat.java,
+ and a display name defined in AudioFormat.toDisplayName. For the formats that don't
+ need a dedicated Surrond Settings dialog entry, a subformats list has to be used. -->
+ <formats>
+ <format name="AUDIO_FORMAT_AC3" />
+ <format name="AUDIO_FORMAT_E_AC3" />
+ <format name="AUDIO_FORMAT_E_AC3_JOC" />
+ <format name="AUDIO_FORMAT_DTS" />
+ </formats>
+ </surroundSound>
+
+ <!-- End of Surround Sound configuration -->
+
+</audioPolicyConfiguration>
diff --git a/audio/core/all-versions/vts/functional/tests/generators_tests.cpp b/audio/core/all-versions/vts/functional/tests/generators_tests.cpp
index 583ff01..7caa712 100644
--- a/audio/core/all-versions/vts/functional/tests/generators_tests.cpp
+++ b/audio/core/all-versions/vts/functional/tests/generators_tests.cpp
@@ -128,5 +128,11 @@
}
// Target file names are the same for all versions, see 'HalAudioVx_0GeneratorTest.xml' test configs
+// clang-format off
INSTANTIATE_TEST_SUITE_P(Generators, GeneratorsTest,
- ::testing::Values("apm_config_no_vx.xml", "apm_config_with_vx.xml"));
+ ::testing::Values("apm_config_no_vx.xml", "apm_config_with_vx.xml"
+#if MAJOR_VERSION == 7
+ , "apm_config_b_204314749_7_0.xml"
+#endif
+ ));
+// clang-format on
diff --git a/bluetooth/a2dp/1.0/vts/OWNERS b/bluetooth/a2dp/1.0/vts/OWNERS
index 4e982a1..d3aab51 100644
--- a/bluetooth/a2dp/1.0/vts/OWNERS
+++ b/bluetooth/a2dp/1.0/vts/OWNERS
@@ -1,4 +1,4 @@
# Bug component: 27441
-include platform/system/bt:/OWNERS
+include platform/packages/modules/Bluetooth:/OWNERS
cheneyni@google.com
diff --git a/bluetooth/audio/2.0/vts/OWNERS b/bluetooth/audio/2.0/vts/OWNERS
index b6c0813..b266b06 100644
--- a/bluetooth/audio/2.0/vts/OWNERS
+++ b/bluetooth/audio/2.0/vts/OWNERS
@@ -1,3 +1,3 @@
-include platform/system/bt:/OWNERS
+include platform/packages/modules/Bluetooth:/OWNERS
cheneyni@google.com
diff --git a/bluetooth/audio/2.1/vts/OWNERS b/bluetooth/audio/2.1/vts/OWNERS
index b6c0813..b266b06 100644
--- a/bluetooth/audio/2.1/vts/OWNERS
+++ b/bluetooth/audio/2.1/vts/OWNERS
@@ -1,3 +1,3 @@
-include platform/system/bt:/OWNERS
+include platform/packages/modules/Bluetooth:/OWNERS
cheneyni@google.com
diff --git a/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal b/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal
index eeff4de..7fb5b6c 100644
--- a/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal
+++ b/bluetooth/audio/2.2/IBluetoothAudioProvidersFactory.hal
@@ -16,7 +16,10 @@
package android.hardware.bluetooth.audio@2.2;
+import IBluetoothAudioProvider;
import @2.1::IBluetoothAudioProvidersFactory;
+import @2.0::Status;
+import @2.1::SessionType;
/**
* This factory allows a HAL implementation to be split into multiple
@@ -30,4 +33,19 @@
* for return value must be invoked synchronously before the API call returns.
*/
interface IBluetoothAudioProvidersFactory extends @2.1::IBluetoothAudioProvidersFactory {
+ /**
+ * Opens an audio provider for a session type. To close the provider, it is
+ * necessary to release references to the returned provider object.
+ *
+ * @param sessionType The session type (e.g.
+ * LE_AUDIO_SOFTWARE_ENCODING_DATAPATH).
+ *
+ * @return status One of the following
+ * SUCCESS if the Audio HAL successfully opens the provider with the
+ * given session type
+ * FAILURE if the Audio HAL cannot open the provider
+ * @return provider The provider of the specified session type
+ */
+ openProvider_2_2(SessionType sessionType)
+ generates (Status status, IBluetoothAudioProvider provider);
};
diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp
index 7438c80..510833d 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.cpp
@@ -122,6 +122,49 @@
return Void();
}
+Return<void> BluetoothAudioProvidersFactory::openProvider_2_2(
+ const V2_1::SessionType sessionType, openProvider_2_2_cb _hidl_cb) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(sessionType);
+ BluetoothAudioStatus status = BluetoothAudioStatus::SUCCESS;
+ BluetoothAudioProvider* provider = nullptr;
+
+ switch (sessionType) {
+ case V2_1::SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH:
+ provider = &a2dp_software_provider_instance_;
+ break;
+ case V2_1::SessionType::A2DP_HARDWARE_OFFLOAD_DATAPATH:
+ provider = &a2dp_offload_provider_instance_;
+ break;
+ case V2_1::SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH:
+ provider = &hearing_aid_provider_instance_;
+ break;
+ case V2_1::SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH:
+ provider = &leaudio_output_provider_instance_;
+ break;
+ case V2_1::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
+ provider = &leaudio_offload_output_provider_instance_;
+ break;
+ case V2_1::SessionType::LE_AUDIO_SOFTWARE_DECODED_DATAPATH:
+ provider = &leaudio_input_provider_instance_;
+ break;
+ case V2_1::SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
+ provider = &leaudio_offload_input_provider_instance_;
+ break;
+ default:
+ status = BluetoothAudioStatus::FAILURE;
+ }
+
+ if (provider == nullptr || !provider->isValid(sessionType)) {
+ provider = nullptr;
+ status = BluetoothAudioStatus::FAILURE;
+ LOG(ERROR) << __func__ << " - SessionType=" << toString(sessionType)
+ << ", status=" << toString(status);
+ }
+
+ _hidl_cb(status, provider);
+ return Void();
+}
+
Return<void> BluetoothAudioProvidersFactory::getProviderCapabilities(
const V2_0::SessionType sessionType, getProviderCapabilities_cb _hidl_cb) {
hidl_vec<V2_0::AudioCapabilities> audio_capabilities =
diff --git a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h
index 8db330b..658249b 100644
--- a/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h
+++ b/bluetooth/audio/2.2/default/BluetoothAudioProvidersFactory.h
@@ -46,6 +46,9 @@
Return<void> openProvider_2_1(const V2_1::SessionType sessionType,
openProvider_2_1_cb _hidl_cb) override;
+ Return<void> openProvider_2_2(const V2_1::SessionType sessionType,
+ openProvider_2_2_cb _hidl_cb) override;
+
Return<void> getProviderCapabilities_2_1(
const V2_1::SessionType sessionType,
getProviderCapabilities_2_1_cb _hidl_cb) override;
diff --git a/bluetooth/audio/utils/OWNERS b/bluetooth/audio/utils/OWNERS
index a35dde2..ed92847 100644
--- a/bluetooth/audio/utils/OWNERS
+++ b/bluetooth/audio/utils/OWNERS
@@ -1,3 +1,3 @@
-include platform/system/bt:/OWNERS
+include platform/packages/modules/Bluetooth:/OWNERS
cheneyni@google.com
\ No newline at end of file
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h
new file mode 100644
index 0000000..e20914e
--- /dev/null
+++ b/bluetooth/audio/utils/session/BluetoothAudioSessionControl_2_2.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "BluetoothAudioSession_2_2.h"
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+
+class BluetoothAudioSessionControl_2_2 {
+ using SessionType_2_1 =
+ ::android::hardware::bluetooth::audio::V2_1::SessionType;
+ using AudioConfiguration_2_2 =
+ ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration;
+
+ public:
+ // The control API helps to check if session is ready or not
+ // @return: true if the Bluetooth stack has started th specified session
+ static bool IsSessionReady(const SessionType_2_1& session_type) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->IsSessionReady();
+ }
+ return false;
+ }
+
+ // The control API helps the bluetooth_audio module to register
+ // PortStatusCallbacks
+ // @return: cookie - the assigned number to this bluetooth_audio output
+ static uint16_t RegisterControlResultCback(
+ const SessionType_2_1& session_type, const PortStatusCallbacks& cbacks) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioSession()->RegisterStatusCback(cbacks);
+ }
+ return kObserversCookieUndefined;
+ }
+
+ // The control API helps the bluetooth_audio module to unregister
+ // PortStatusCallbacks
+ // @param: cookie - indicates which bluetooth_audio output is
+ static void UnregisterControlResultCback(const SessionType_2_1& session_type,
+ uint16_t cookie) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->GetAudioSession()->UnregisterStatusCback(cookie);
+ }
+ }
+
+ // The control API for the bluetooth_audio module to get current
+ // AudioConfiguration
+ static const AudioConfiguration_2_2 GetAudioConfig(
+ const SessionType_2_1& session_type) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioConfig();
+ } else if (session_type ==
+ SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH) {
+ return BluetoothAudioSession_2_2::kInvalidOffloadAudioConfiguration;
+ } else {
+ return BluetoothAudioSession_2_2::kInvalidSoftwareAudioConfiguration;
+ }
+ }
+
+ // Those control APIs for the bluetooth_audio module to start / suspend / stop
+ // stream, to check position, and to update metadata.
+ static bool StartStream(const SessionType_2_1& session_type) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioSession()->StartStream();
+ }
+ return false;
+ }
+
+ static bool SuspendStream(const SessionType_2_1& session_type) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioSession()->SuspendStream();
+ }
+ return false;
+ }
+
+ static void StopStream(const SessionType_2_1& session_type) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->GetAudioSession()->StopStream();
+ }
+ }
+
+ static bool GetPresentationPosition(const SessionType_2_1& session_type,
+ uint64_t* remote_delay_report_ns,
+ uint64_t* total_bytes_readed,
+ timespec* data_position) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioSession()->GetPresentationPosition(
+ remote_delay_report_ns, total_bytes_readed, data_position);
+ }
+ return false;
+ }
+
+ static void UpdateTracksMetadata(
+ const SessionType_2_1& session_type,
+ const struct source_metadata* source_metadata) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ session_ptr->GetAudioSession()->UpdateTracksMetadata(source_metadata);
+ }
+ }
+
+ // The control API writes stream to FMQ
+ static size_t OutWritePcmData(const SessionType_2_1& session_type,
+ const void* buffer, size_t bytes) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioSession()->OutWritePcmData(buffer, bytes);
+ }
+ return 0;
+ }
+
+ // The control API reads stream from FMQ
+ static size_t InReadPcmData(const SessionType_2_1& session_type, void* buffer,
+ size_t bytes) {
+ std::shared_ptr<BluetoothAudioSession_2_2> session_ptr =
+ BluetoothAudioSessionInstance_2_2::GetSessionInstance(session_type);
+ if (session_ptr != nullptr) {
+ return session_ptr->GetAudioSession()->InReadPcmData(buffer, bytes);
+ }
+ return 0;
+ }
+};
+
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp
index 9d9ea41..5a6b2e7 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp
+++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.cpp
@@ -29,6 +29,9 @@
using SessionType_2_0 =
::android::hardware::bluetooth::audio::V2_0::SessionType;
+using AudioConfiguration_2_1 =
+ ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration;
+
::android::hardware::bluetooth::audio::V2_2::AudioConfiguration
BluetoothAudioSession_2_2::invalidSoftwareAudioConfiguration = {};
::android::hardware::bluetooth::audio::V2_2::AudioConfiguration
@@ -52,7 +55,9 @@
const ::android::hardware::bluetooth::audio::V2_1::SessionType&
session_type)
: audio_session(BluetoothAudioSessionInstance::GetSessionInstance(
- static_cast<SessionType_2_0>(session_type))) {
+ static_cast<SessionType_2_0>(session_type))),
+ audio_session_2_1(
+ BluetoothAudioSessionInstance_2_1::GetSessionInstance(session_type)) {
if (is_2_0_session_type(session_type)) {
session_type_2_1_ = (SessionType_2_1::UNKNOWN);
} else {
@@ -74,6 +79,10 @@
BluetoothAudioSession_2_2::GetAudioSession() {
return audio_session;
}
+std::shared_ptr<BluetoothAudioSession_2_1>
+BluetoothAudioSession_2_2::GetAudioSession_2_1() {
+ return audio_session_2_1;
+}
// The control function is for the bluetooth_audio module to get the current
// AudioConfiguration
@@ -82,7 +91,19 @@
std::lock_guard<std::recursive_mutex> guard(audio_session->mutex_);
if (IsSessionReady()) {
// If session is unknown it means it should be 2.0 type
- if (session_type_2_1_ != SessionType_2_1::UNKNOWN) return audio_config_2_2_;
+ if (session_type_2_1_ != SessionType_2_1::UNKNOWN) {
+ if (audio_config_2_2_ != invalidSoftwareAudioConfiguration)
+ return audio_config_2_2_;
+
+ ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration toConf;
+ const AudioConfiguration_2_1 fromConf =
+ GetAudioSession_2_1()->GetAudioConfig();
+ if (fromConf.getDiscriminator() ==
+ AudioConfiguration_2_1::hidl_discriminator::pcmConfig) {
+ toConf.pcmConfig() = fromConf.pcmConfig();
+ return toConf;
+ }
+ }
::android::hardware::bluetooth::audio::V2_2::AudioConfiguration toConf;
const AudioConfiguration fromConf = GetAudioSession()->GetAudioConfig();
diff --git a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h
index d3d0bd3..7213ede 100644
--- a/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h
+++ b/bluetooth/audio/utils/session/BluetoothAudioSession_2_2.h
@@ -22,6 +22,7 @@
#include <unordered_map>
#include "BluetoothAudioSession.h"
+#include "BluetoothAudioSession_2_1.h"
namespace android {
namespace bluetooth {
@@ -30,6 +31,7 @@
class BluetoothAudioSession_2_2 {
private:
std::shared_ptr<BluetoothAudioSession> audio_session;
+ std::shared_ptr<BluetoothAudioSession_2_1> audio_session_2_1;
::android::hardware::bluetooth::audio::V2_1::SessionType session_type_2_1_;
@@ -56,6 +58,7 @@
bool IsSessionReady();
std::shared_ptr<BluetoothAudioSession> GetAudioSession();
+ std::shared_ptr<BluetoothAudioSession_2_1> GetAudioSession_2_1();
// The report function is used to report that the Bluetooth stack has started
// this session without any failure, and will invoke session_changed_cb_ to
diff --git a/cas/1.0/vts/functional/OWNERS b/cas/1.0/vts/functional/OWNERS
index aec93b0..7d8c2ee 100644
--- a/cas/1.0/vts/functional/OWNERS
+++ b/cas/1.0/vts/functional/OWNERS
@@ -1,2 +1,2 @@
# Bug component: 1344
-quxiangfang@google.com
+include ../../../1.2/vts/functional/OWNERS
diff --git a/cas/1.1/vts/functional/OWNERS b/cas/1.1/vts/functional/OWNERS
index 29246ed..7d8c2ee 100644
--- a/cas/1.1/vts/functional/OWNERS
+++ b/cas/1.1/vts/functional/OWNERS
@@ -1,3 +1,2 @@
-nchalko@google.com
-chz@google.com
-quxiangfang@google.com
+# Bug component: 1344
+include ../../../1.2/vts/functional/OWNERS
diff --git a/cas/1.2/vts/functional/OWNERS b/cas/1.2/vts/functional/OWNERS
index 29246ed..4c55752 100644
--- a/cas/1.2/vts/functional/OWNERS
+++ b/cas/1.2/vts/functional/OWNERS
@@ -1,3 +1,3 @@
-nchalko@google.com
-chz@google.com
+# Bug component: 1344
quxiangfang@google.com
+hgchen@google.com
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index a59be21..193fd2b 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -81,5 +81,6 @@
],
kernel_configs: [
"kernel_config_current_5.10",
+ "kernel_config_current_5.15",
],
}
diff --git a/health/aidl/README.md b/health/aidl/README.md
new file mode 100644
index 0000000..3ee5232
--- /dev/null
+++ b/health/aidl/README.md
@@ -0,0 +1,310 @@
+# Health AIDL HAL
+
+## Determine whether the example service implementation is sufficient {#determine}
+
+You need a custom implementation if any of the following is true:
+
+* You are migrating from a custom
+ [health 2.1 HIDL HAL implementation](../2.1/README.md).
+* System properties `ro.charger.enable_suspend` and/or `ro.charger.no_ui`
+ are set to a `true` value. See [below](#charger-sysprops).
+* The device supports offline charging mode, and the `service`
+ declaration with `class charger` in `init.rc` is different from the one
+ provided by the example implementation. See [below](#charger-init-rc).
+
+If the example HAL service is sufficient, [install it](#use-example). Otherwise,
+[implement a custom HAL service](#use-custom).
+
+### System properties for charger {#charger-sysprops}
+
+The health AIDL HAL service also provides functionalities of `charger`. As a
+result, the system charger at `/system/bin/charger` is deprecated.
+
+However, the health AIDL HAL service is not allowed to read `ro.charger.*`
+system properties. These properties include:
+* `ro.charger.enable_suspend`. If set, you need a custom health AIDL HAL
+ service. See [below](#charger-enable-suspend).
+* `ro.charger.no_ui`. If set, you need a custom health AIDL HAL service.
+ See [below](#charger-no-ui).
+* `ro.charger.draw_split_screen`. The system property is deprecated.
+* `ro.charger.draw_split_offset`. The system property is deprecated.
+* `ro.charger.disable_init_blank`. The system property is deprecated.
+
+If you need to set any of the deprecated system properties, contact
+[OWNERS](OWNERS).
+
+### Default `service` declaration for charger in `init.rc` {#charger-init-rc}
+
+See
+[android.hardware.health-service.example.rc](default/android.hardware.health-service.example.rc).
+
+Check the `service` declaration in your device-specific `init.rc` file that
+has `class charger`. Most likely, the declaration looks something like this
+(Below is an excerpt from Pixel 3):
+
+```text
+service vendor.charger /system/bin/charger
+ class charger
+ seclabel u:r:charger:s0
+ user system
+ group system wakelock input
+ capabilities SYS_BOOT
+ file /dev/kmsg w
+ file /sys/fs/pstore/console-ramoops-0 r
+ file /sys/fs/pstore/console-ramoops r
+ file /proc/last_kmsg r
+```
+
+Compare each line against the one provided by the example health AIDL HAL
+service in
+[android.hardware.health-service.example.rc](default/android.hardware.health-service.example.rc).
+Specifically:
+
+* You may ignore the `service` line. The name of the service does not matter.
+* If your service belongs to additional classes beside `charger`, you need a
+ custom health AIDL service.
+* You may ignore the `seclabel` line. When the health AIDL service runs in
+ charger mode, its original SELinux domain is kept.
+* If your service has a different `user` (not `system`), you need a custom
+ health AIDL service.
+* If your service belongs to additional `group`s beside
+ `system wakelock input`, you need a custom health AIDL service.
+* If your service requires additional capabilities beside `SYS_BOOT`,
+ you need a custom health AIDL service.
+* If your service requires additional `file`s to be opened prior to execution,
+ you need a custom health AIDL service.
+
+## Using the example health AIDL HAL service {#use-example}
+
+If you [determined](#determine) that the example health AIDL HAL service works
+for your device, install it with
+
+```mk
+PRODUCT_PACKAGES += android.hardware.health-service.example
+```
+
+Then, delete any existing `service` with `class charger` in your device-specific
+`init.rc` files, because
+[android.hardware.health-service.example.rc](default/android.hardware.health-service.example.rc)
+already contains an entry for charger.
+
+If your device supports charger mode and it has custom charger resources,
+[move charger resources to `/vendor`](#charger-res)
+
+## Implementing a custom health AIDL HAL service {#use-custom}
+
+### Override the `Health` class {#health-impl}
+
+See [`Health.h`](default/include/health-impl/Health.h) for its class
+declaration. Inherit the class to customize for your device.
+
+```c++
+namespace aidl::android::hardware::health {
+class HealthImpl : public Health {
+ // ...
+};
+} // namespace aidl::android::hardware::health
+int main(int, char**) {
+ // ...
+ auto binder = ndk::SharedRefBase::make<aidl::android::hardware::health::HealthImpl>(
+ "default", std::move(config));
+ // ...
+}
+```
+
+* The logic to modify `healthd_config`, traditionally in `healthd_board_init()`
+ should be called before passing the `healthd_config` struct to your
+ `HealthImpl` class in [`main()`](#main).
+
+* The following functions are similar to the ones in the health 2.1 HIDL HAL:
+
+| AIDL implementation | HIDL implementation |
+|-------------------------------------|-----------------------------|
+| `Health::getChargeCounterUah` | `Health::getChargeCounter` |
+| `Health::getCurrentNowMicroamps` | `Health::getCurrentNow` |
+| `Health::getCurrentAverageMicroamps`| `Health::getCurrentAverage` |
+| `Health::getCapacity` | `Health::getCapacity` |
+| `Health::getChargeStatus` | `Health::getChargeStatus` |
+| `Health::getEnergyCounterNwh` | `Health::getEnergyCounter` |
+| `Health::getDiskStats` | `Health::getDiskStats` |
+| `Health::getStorageInfo` | `Health::getStorageInfo` |
+| `Health::BinderEvent` | `BinderHealth::BinderEvent` |
+| `Health::dump` | `Health::debug` |
+| `Health::ShouldKeepScreenOn` | `Health::shouldKeepScreenOn`|
+| `Health::UpdateHealthInfo` | `Health::UpdateHealthInfo` |
+
+### Implement `main()` {#main}
+
+See the [`main.cpp`](default/main.cpp) for the example health AIDL service for
+an example.
+
+If you need to modify `healthd_config`, do it before passing it to the
+constructor of `HealthImpl` (or `Health` if you did not implement a subclass
+of it).
+
+```c++
+int main(int argc, char** argv) {
+ auto config = std::make_unique<healthd_config>();
+ ::android::hardware::health::InitHealthdConfig(config.get());
+ healthd_board_init(config.get());
+ auto binder = ndk::SharedRefBase::make<Health>("default", std::move(config));
+ // ...
+}
+```
+
+If your device does not support off-line charging mode, or does not have a UI
+for charger (`ro.charger.no_ui=true`), skip the invocation of
+`ChargerModeMain()` in `main()`.
+
+### SELinux rules
+
+Add device specific permissions to the domain where the health HAL
+process is executed, especially if a device-specific `libhealthd` is used
+and/or device-specific storage related APIs are implemented.
+
+Example (assuming that your health AIDL service runs in domain
+`hal_health_tuna`:
+
+```text
+type hal_health_tuna, domain;
+hal_server_domain(hal_health_tuna, hal_health)
+type hal_health_tuna_exec, exec_type, vendor_file_type, file_type;
+
+# allow hal_health_tuna ...;
+```
+
+If you did not define a separate domain, the domain is likely
+`hal_health_default`. The device-specific rules for it is likely at
+`device/<manufacturer>/<device>/sepolicy/vendor/hal_health_default.te`.
+In this case, the aforementioned SELinux rules and types has already been
+defined. You only need to add device-specific permissions.
+
+```text
+# allow hal_health_default ...;
+```
+
+### Implementing charger {#charger}
+
+#### Move charger resources to `/vendor`
+
+Ensure that charger resources are installed to `/vendor`, not `/product`.
+
+`animation.txt` must be moved to the following location:
+
+```text
+/vendor/etc/res/values/charger/animation.txt
+```
+
+Charger resources in `/system` is not read by the health HAL service in
+`/vendor`. Specifically, resources should be installed to the following
+location:
+
+```
+/vendor/etc/res/images/charger/*.png
+```
+
+If resources are not found in these locations, the health HAL service falls
+back to the following locations:
+
+```
+/vendor/etc/res/images/charger/default/*.png
+```
+
+You can use the default resources by installing the default module:
+
+```makefile
+PRODUCT_PACKAGES += charger_res_images_vendor
+```
+
+#### Modify `init.rc` for charger
+
+It is recommended that you move the existing `service` entry with
+`class charger` to the `init.rc` file in your custom health service.
+
+Modify the entry to invoke the health service binary with `--charger` argument.
+See
+[android.hardware.health-service.example.rc](default/android.hardware.health-service.example.rc)
+for an example:
+
+```text
+service vendor.charger-tuna /vendor/bin/hw/android.hardware.health-service-tuna --charger
+ # ...
+```
+
+#### No charger mode {#no-charger}
+
+If your device does not support off-line charging mode, skip the invocation of
+`ChargerModeMain()` in `main()`.
+
+```c++
+int main(int, char**) {
+ // ...
+ // Skip checking if arguments contain "--charger"
+ auto hal_health_loop = std::make_shared<HalHealthLoop>(binder, binder);
+ return hal_health_loop->StartLoop();
+}
+```
+
+You may optionally delete the `service` entry with `class charger` in the
+`init.rc` file.
+
+#### No charger UI {#charger-no-ui}
+
+If your device does not have a UI for charger (`ro.charger.no_ui=true`), skip
+the invocation of `ChargerModeMain()` in `main()`.
+
+You may want to keep the `KernelLogger` so that charger still logs battery
+information to the kernel logs.
+
+```c++
+int main(int argc, char** argv) {
+ // ...
+ if (argc >= 2 && argv[1] == "--charger"sv) {
+ android::base::InitLogging(argv, &android::base::KernelLogger);
+ // fallthrough to HalHealthLoop::StartLoop()
+ }
+ auto hal_health_loop = std::make_shared<HalHealthLoop>(binder, binder);
+ return hal_health_loop->StartLoop();
+}
+```
+
+#### Enable suspend {#charger-enable-suspend}
+
+If your device has `ro.charger.enable_suspend=true`, implement a new class,
+`ChargerCallbackImpl`, that inherits from
+[`ChargerCallback`](default/include/health-impl/ChargerUtils.h). Then
+override the `ChargerEnableSuspend` function to return `true`. Then pass an
+instance of `ChargerCallbackImpl` to `ChargerModeMain()` instead.
+
+```c++
+namespace aidl::android::hardware::health {
+class ChargerCallbackImpl : public ChargerCallback {
+ bool ChargerEnableSuspend() override { return true; }
+};
+} // namespace aidl::android::hardware::health
+int main(int argc, char** argv) {
+ // ...
+ if (argc >= 2 && argv[1] == "--charger"sv) {
+ android::base::InitLogging(argv, &android::base::KernelLogger);
+#if !CHARGER_FORCE_NO_UI
+ return ChargerModeMain(binder,
+ std::make_shared<aidl::android::hardware::health::ChargerCallbackImpl>(binder));
+#endif
+ }
+ // ...
+}
+```
+
+#### SELinux rules for charger
+
+If your health AIDL service runs in a domain other than `hal_health_default`,
+add `charger_type` to it so the health HAL service can have charger-specific
+permissions. Example (assuming that your health AIDL service runs in domain
+`hal_health_tuna`:
+
+```text
+type hal_health_tuna, charger_type, domain;
+hal_server_domain(hal_health_default, hal_health)
+```
+
+[comment: TODO(b/170338625): explain recovery]: #
diff --git a/health/aidl/android/hardware/health/Translate.java b/health/aidl/android/hardware/health/Translate.java
index c8ace1c..4f840b8 100644
--- a/health/aidl/android/hardware/health/Translate.java
+++ b/health/aidl/android/hardware/health/Translate.java
@@ -44,25 +44,37 @@
return out;
}
+ private static void h2aTranslateInternal(
+ android.hardware.health.HealthInfo out, android.hardware.health.V1_0.HealthInfo in) {
+ out.chargerAcOnline = in.chargerAcOnline;
+ out.chargerUsbOnline = in.chargerUsbOnline;
+ out.chargerWirelessOnline = in.chargerWirelessOnline;
+ out.maxChargingCurrentMicroamps = in.maxChargingCurrent;
+ out.maxChargingVoltageMicrovolts = in.maxChargingVoltage;
+ out.batteryStatus = in.batteryStatus;
+ out.batteryHealth = in.batteryHealth;
+ out.batteryPresent = in.batteryPresent;
+ out.batteryLevel = in.batteryLevel;
+ out.batteryVoltageMillivolts = in.batteryVoltage;
+ out.batteryTemperatureTenthsCelsius = in.batteryTemperature;
+ out.batteryCurrentMicroamps = in.batteryCurrent;
+ out.batteryCycleCount = in.batteryCycleCount;
+ out.batteryFullChargeUah = in.batteryFullCharge;
+ out.batteryChargeCounterUah = in.batteryChargeCounter;
+ out.batteryTechnology = in.batteryTechnology;
+ }
+
+ public static android.hardware.health.HealthInfo h2aTranslate(
+ android.hardware.health.V1_0.HealthInfo in) {
+ android.hardware.health.HealthInfo out = new android.hardware.health.HealthInfo();
+ h2aTranslateInternal(out, in);
+ return out;
+ }
+
static public android.hardware.health.HealthInfo h2aTranslate(
android.hardware.health.V2_1.HealthInfo in) {
android.hardware.health.HealthInfo out = new android.hardware.health.HealthInfo();
- out.chargerAcOnline = in.legacy.legacy.chargerAcOnline;
- out.chargerUsbOnline = in.legacy.legacy.chargerUsbOnline;
- out.chargerWirelessOnline = in.legacy.legacy.chargerWirelessOnline;
- out.maxChargingCurrentMicroamps = in.legacy.legacy.maxChargingCurrent;
- out.maxChargingVoltageMicrovolts = in.legacy.legacy.maxChargingVoltage;
- out.batteryStatus = in.legacy.legacy.batteryStatus;
- out.batteryHealth = in.legacy.legacy.batteryHealth;
- out.batteryPresent = in.legacy.legacy.batteryPresent;
- out.batteryLevel = in.legacy.legacy.batteryLevel;
- out.batteryVoltageMillivolts = in.legacy.legacy.batteryVoltage;
- out.batteryTemperatureTenthsCelsius = in.legacy.legacy.batteryTemperature;
- out.batteryCurrentMicroamps = in.legacy.legacy.batteryCurrent;
- out.batteryCycleCount = in.legacy.legacy.batteryCycleCount;
- out.batteryFullChargeUah = in.legacy.legacy.batteryFullCharge;
- out.batteryChargeCounterUah = in.legacy.legacy.batteryChargeCounter;
- out.batteryTechnology = in.legacy.legacy.batteryTechnology;
+ h2aTranslateInternal(out, in.legacy.legacy);
out.batteryCurrentAverageMicroamps = in.legacy.batteryCurrentAverage;
out.diskStats = new android.hardware.health.DiskStats[in.legacy.diskStats.size()];
for (int i = 0; i < in.legacy.diskStats.size(); i++) {
diff --git a/health/aidl/default/Android.bp b/health/aidl/default/Android.bp
index 7e635d4..a13c677 100644
--- a/health/aidl/default/Android.bp
+++ b/health/aidl/default/Android.bp
@@ -45,6 +45,52 @@
],
}
+// Dependency to libhealthd_charger_ui. No UI in recovery.
+cc_defaults {
+ name: "libhealth_aidl_charger_defaults",
+ shared_libs: [
+ // common
+ "android.hardware.health-V1-ndk",
+ "libbase",
+ "libcutils",
+ "liblog",
+ "libutils",
+
+ // charger UI only
+ "libpng",
+ ],
+
+ static_libs: [
+ // common
+ "libbatterymonitor",
+ "libhealthloop",
+
+ // charger UI only
+ "libhealthd_draw",
+ "libhealthd_charger_ui",
+ "libminui",
+ "libsuspend",
+ ],
+
+ target: {
+ recovery: {
+ // No UI and libsuspend for recovery charger.
+ cflags: [
+ "-DCHARGER_FORCE_NO_UI=1",
+ ],
+ exclude_shared_libs: [
+ "libpng",
+ ],
+ exclude_static_libs: [
+ "libhealthd_draw",
+ "libhealthd_charger_ui",
+ "libminui",
+ "libsuspend",
+ ],
+ },
+ },
+}
+
// AIDL version of libhealth2impl.
// A helper library for health HAL implementation.
// HAL implementations can link to this library and extend the Health class.
@@ -52,21 +98,26 @@
name: "libhealth_aidl_impl",
defaults: [
"libhealth_aidl_common_defaults",
+ "libhealth_aidl_charger_defaults",
],
export_include_dirs: ["include"],
export_static_lib_headers: [
"libbatterymonitor",
],
srcs: [
+ "ChargerUtils.cpp",
"health-convert.cpp",
"HalHealthLoop.cpp",
"Health.cpp",
"LinkedCallback.cpp",
],
- visibility: [
- ":__subpackages__",
- "//hardware/interfaces/tests/extension/health:__subpackages__",
- ],
+ target: {
+ recovery: {
+ exclude_srcs: [
+ "ChargerUtils.cpp",
+ ],
+ },
+ },
}
// AIDL version of android.hardware.health@2.1-service.
@@ -78,9 +129,13 @@
vintf_fragments: ["android.hardware.health-service.example.xml"],
defaults: [
"libhealth_aidl_common_defaults",
+ "libhealth_aidl_charger_defaults",
],
static_libs: [
"libhealth_aidl_impl",
],
srcs: ["main.cpp"],
+ overrides: [
+ "charger",
+ ],
}
diff --git a/health/aidl/default/ChargerUtils.cpp b/health/aidl/default/ChargerUtils.cpp
new file mode 100644
index 0000000..f8e208b
--- /dev/null
+++ b/health/aidl/default/ChargerUtils.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android-base/logging.h>
+#include <health-impl/ChargerUtils.h>
+
+namespace aidl::android::hardware::health::charger {
+
+std::optional<bool> ChargerCallback::ChargerShouldKeepScreenOn() {
+ return service_->ShouldKeepScreenOn();
+}
+
+bool ChargerCallback::ChargerIsOnline() {
+ auto hal_health_loop_sp = hal_health_loop_.lock();
+ if (hal_health_loop_sp == nullptr) {
+ // Assume no charger
+ return false;
+ }
+ return hal_health_loop_sp->charger_online();
+}
+
+void ChargerCallback::ChargerInitConfig(healthd_config* config) {
+ auto hal_health_loop_sp = hal_health_loop_.lock();
+ if (hal_health_loop_sp == nullptr) {
+ return;
+ }
+ return service_->OnInit(hal_health_loop_sp.get(), config);
+}
+
+int ChargerCallback::ChargerRegisterEvent(int fd, BoundFunction func, EventWakeup wakeup) {
+ auto hal_health_loop_sp = hal_health_loop_.lock();
+ if (hal_health_loop_sp == nullptr) {
+ return -1;
+ }
+ return hal_health_loop_sp->RegisterEvent(fd, func, wakeup);
+}
+
+void ChargerCallback::set_hal_health_loop(const std::weak_ptr<HalHealthLoop>& hal_health_loop) {
+ hal_health_loop_ = std::move(hal_health_loop);
+}
+
+// Implements HalHealthLoopCallback for AIDL charger
+// Adapter of (Charger, Health) -> HalHealthLoopCallback
+class LoopCallback : public HalHealthLoopCallback {
+ public:
+ LoopCallback(const std::shared_ptr<Health>& service, ChargerCallback* charger_callback)
+ : service_(service), charger_(std::make_unique<::android::Charger>(charger_callback)) {}
+
+ void OnHeartbeat() override {
+ service_->OnHeartbeat();
+ charger_->OnHeartbeat();
+ }
+ // Return the minimum timeout. Negative values are treated as no values.
+ int OnPrepareToWait() override {
+ int timeout1 = service_->OnPrepareToWait();
+ int timeout2 = charger_->OnPrepareToWait();
+
+ if (timeout1 < 0) return timeout2;
+ if (timeout2 < 0) return timeout1;
+ return std::min(timeout1, timeout2);
+ }
+
+ void OnInit(HalHealthLoop*, struct healthd_config* config) override {
+ // Charger::OnInit calls ChargerInitConfig, which calls into the real Health::OnInit.
+ charger_->OnInit(config);
+ }
+
+ void OnHealthInfoChanged(const HealthInfo& health_info) override {
+ charger_->OnHealthInfoChanged(::android::ChargerHealthInfo{
+ .battery_level = health_info.batteryLevel,
+ .battery_status = health_info.batteryStatus,
+ });
+ service_->OnHealthInfoChanged(health_info);
+ }
+
+ private:
+ std::shared_ptr<Health> service_;
+ std::unique_ptr<::android::Charger> charger_;
+};
+
+int ChargerModeMain(const std::shared_ptr<Health>& binder,
+ const std::shared_ptr<ChargerCallback>& charger_callback) {
+ LOG(INFO) << "Starting charger mode.";
+ // parent stack ==========================================
+ // current stack ||
+ // || ||
+ // V V
+ // hal_health_loop => loop_callback => charger --(raw)--> charger_callback
+ // ^----------------(weak)---------------------------------'
+ auto loop_callback = std::make_shared<LoopCallback>(binder, charger_callback.get());
+ auto hal_health_loop = std::make_shared<HalHealthLoop>(binder, std::move(loop_callback));
+ charger_callback->set_hal_health_loop(hal_health_loop);
+ return hal_health_loop->StartLoop();
+}
+
+} // namespace aidl::android::hardware::health::charger
diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp
index 812e64a..e1d1982 100644
--- a/health/aidl/default/Health.cpp
+++ b/health/aidl/default/Health.cpp
@@ -60,6 +60,8 @@
battery_monitor_.init(healthd_config_.get());
}
+Health::~Health() {}
+
//
// Getters.
//
diff --git a/health/aidl/default/android.hardware.health-service.example.rc b/health/aidl/default/android.hardware.health-service.example.rc
index b393c58..dee3d11 100644
--- a/health/aidl/default/android.hardware.health-service.example.rc
+++ b/health/aidl/default/android.hardware.health-service.example.rc
@@ -4,3 +4,13 @@
group system
capabilities WAKE_ALARM BLOCK_SUSPEND
file /dev/kmsg w
+
+service vendor.charger-default /vendor/bin/hw/android.hardware.health-service.example --charger
+ class charger
+ user system
+ group system wakelock input
+ capabilities SYS_BOOT
+ file /dev/kmsg w
+ file /sys/fs/pstore/console-ramoops-0 r
+ file /sys/fs/pstore/console-ramoops r
+ file /proc/last_kmsg r
diff --git a/health/aidl/default/include/health-impl/ChargerUtils.h b/health/aidl/default/include/health-impl/ChargerUtils.h
new file mode 100644
index 0000000..8f94181
--- /dev/null
+++ b/health/aidl/default/include/health-impl/ChargerUtils.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <optional>
+#include <type_traits>
+
+#include <android/binder_auto_utils.h>
+#include <charger/healthd_mode_charger.h>
+#include <health-impl/Health.h>
+
+#pragma once
+
+namespace aidl::android::hardware::health::charger {
+
+// Implements ChargerHalHealthLoopInterface for AIDL charger
+// Adapter of (Health, HalHealthLoop) -> ChargerHalHealthLoopInterface
+class ChargerCallback : public ::android::ChargerConfigurationInterface {
+ public:
+ ChargerCallback(const std::shared_ptr<Health>& service) : service_(service) {}
+ std::optional<bool> ChargerShouldKeepScreenOn() override;
+ bool ChargerIsOnline() override;
+ void ChargerInitConfig(healthd_config* config) override;
+ int ChargerRegisterEvent(int fd, BoundFunction func, EventWakeup wakeup) override;
+
+ // Override to return true to replace `ro.charger.enable_suspend=true`
+ bool ChargerEnableSuspend() override { return false; }
+
+ void set_hal_health_loop(const std::weak_ptr<HalHealthLoop>& hal_health_loop);
+
+ private:
+ std::shared_ptr<Health> service_;
+ std::weak_ptr<HalHealthLoop> hal_health_loop_;
+};
+
+int ChargerModeMain(const std::shared_ptr<Health>& binder,
+ const std::shared_ptr<ChargerCallback>& charger_callback);
+
+} // namespace aidl::android::hardware::health::charger
diff --git a/health/aidl/default/include/health-impl/Health.h b/health/aidl/default/include/health-impl/Health.h
index e49f44c..6bd4946 100644
--- a/health/aidl/default/include/health-impl/Health.h
+++ b/health/aidl/default/include/health-impl/Health.h
@@ -43,6 +43,7 @@
// A subclass may modify |config| before passing it to the parent constructor.
// See implementation of Health for code samples.
Health(std::string_view instance_name, std::unique_ptr<struct healthd_config>&& config);
+ virtual ~Health();
ndk::ScopedAStatus registerCallback(
const std::shared_ptr<IHealthInfoCallback>& callback) override;
diff --git a/health/aidl/default/main.cpp b/health/aidl/default/main.cpp
index 014ae34..76c6ba0 100644
--- a/health/aidl/default/main.cpp
+++ b/health/aidl/default/main.cpp
@@ -19,17 +19,46 @@
#include <health-impl/Health.h>
#include <health/utils.h>
+#ifndef CHARGER_FORCE_NO_UI
+#define CHARGER_FORCE_NO_UI 0
+#endif
+
+#if !CHARGER_FORCE_NO_UI
+#include <health-impl/ChargerUtils.h>
+#endif
+
using aidl::android::hardware::health::HalHealthLoop;
using aidl::android::hardware::health::Health;
-static constexpr const char* gInstanceName = "default";
+#if !CHARGER_FORCE_NO_UI
+using aidl::android::hardware::health::charger::ChargerCallback;
+using aidl::android::hardware::health::charger::ChargerModeMain;
+#endif
-int main() {
- // TODO(b/203246116): handle charger
+static constexpr const char* gInstanceName = "default";
+static constexpr std::string_view gChargerArg{"--charger"};
+
+int main(int argc, char** argv) {
// make a default health service
auto config = std::make_unique<healthd_config>();
::android::hardware::health::InitHealthdConfig(config.get());
auto binder = ndk::SharedRefBase::make<Health>(gInstanceName, std::move(config));
+
+ if (argc >= 2 && argv[1] == gChargerArg) {
+ android::base::InitLogging(argv, &android::base::KernelLogger);
+
+#if !CHARGER_FORCE_NO_UI
+ // If charger shouldn't have UI for your device, simply drop the line below
+ // for your service implementation. This corresponds to
+ // ro.charger.no_ui=true
+ return ChargerModeMain(binder, std::make_shared<ChargerCallback>(binder));
+#endif
+
+ LOG(INFO) << "Starting charger mode without UI.";
+ } else {
+ LOG(INFO) << "Starting health HAL.";
+ }
+
auto hal_health_loop = std::make_shared<HalHealthLoop>(binder, binder);
return hal_health_loop->StartLoop();
}
diff --git a/health/utils/libhealthtest/Android.bp b/health/utils/libhealthtest/Android.bp
index dbe02d6..0993cb6 100644
--- a/health/utils/libhealthtest/Android.bp
+++ b/health/utils/libhealthtest/Android.bp
@@ -13,6 +13,15 @@
// limitations under the License.
// Utils library for VTS tests.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
cc_library_headers {
name: "libhealthtest_headers",
static_libs: [
diff --git a/neuralnetworks/1.0/utils/OWNERS b/neuralnetworks/1.0/utils/OWNERS
deleted file mode 100644
index e4feee3..0000000
--- a/neuralnetworks/1.0/utils/OWNERS
+++ /dev/null
@@ -1,11 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-galarragas@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
diff --git a/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Callbacks.h b/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Callbacks.h
index 1ab9dcb..244001f 100644
--- a/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Callbacks.h
+++ b/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Callbacks.h
@@ -41,7 +41,7 @@
// Converts the results of IDevice::prepareModel* to the NN canonical format. On success, this
// function returns with a non-null nn::SharedPreparedModel with a feature level of
-// nn::Version::ANDROID_OC_MR1. On failure, this function returns with the appropriate
+// nn::kVersionFeatureLevel1. On failure, this function returns with the appropriate
// nn::GeneralError.
nn::GeneralResult<nn::SharedPreparedModel> prepareModelCallback(
ErrorStatus status, const sp<IPreparedModel>& preparedModel);
diff --git a/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Utils.h b/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Utils.h
index 5c1480e..7710a7e 100644
--- a/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Utils.h
+++ b/neuralnetworks/1.0/utils/include/nnapi/hal/1.0/Utils.h
@@ -28,7 +28,7 @@
namespace android::hardware::neuralnetworks::V1_0::utils {
-constexpr auto kVersion = nn::Version::ANDROID_OC_MR1;
+constexpr auto kVersion = nn::kVersionFeatureLevel1;
template <typename Type>
nn::Result<void> validate(const Type& halObject) {
@@ -51,7 +51,7 @@
template <typename Type>
nn::Result<void> compliantVersion(const Type& canonical) {
const auto version = NN_TRY(nn::validate(canonical));
- if (version > kVersion) {
+ if (!nn::isCompliantVersion(version, kVersion)) {
return NN_ERROR() << "Insufficient version: " << version << " vs required " << kVersion;
}
return {};
diff --git a/neuralnetworks/1.0/utils/src/Device.cpp b/neuralnetworks/1.0/utils/src/Device.cpp
index 49913a2..b0c236e 100644
--- a/neuralnetworks/1.0/utils/src/Device.cpp
+++ b/neuralnetworks/1.0/utils/src/Device.cpp
@@ -99,7 +99,7 @@
}
nn::Version Device::getFeatureLevel() const {
- return nn::Version::ANDROID_OC_MR1;
+ return kVersion;
}
nn::DeviceType Device::getType() const {
diff --git a/neuralnetworks/1.0/utils/test/DeviceTest.cpp b/neuralnetworks/1.0/utils/test/DeviceTest.cpp
index e881da2..83e555f 100644
--- a/neuralnetworks/1.0/utils/test/DeviceTest.cpp
+++ b/neuralnetworks/1.0/utils/test/DeviceTest.cpp
@@ -233,7 +233,7 @@
const auto featureLevel = device->getFeatureLevel();
// verify result
- EXPECT_EQ(featureLevel, nn::Version::ANDROID_OC_MR1);
+ EXPECT_EQ(featureLevel, nn::kVersionFeatureLevel1);
}
TEST(DeviceTest, getCachedData) {
diff --git a/neuralnetworks/1.0/vts/OWNERS b/neuralnetworks/1.0/vts/OWNERS
deleted file mode 100644
index b5a8e1f..0000000
--- a/neuralnetworks/1.0/vts/OWNERS
+++ /dev/null
@@ -1,16 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-mikie@google.com
-mks@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
-
-# VTS team
-yim@google.com
-yuexima@google.com
diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp
index b33c581..29b31d2 100644
--- a/neuralnetworks/1.0/vts/functional/Android.bp
+++ b/neuralnetworks/1.0/vts/functional/Android.bp
@@ -50,7 +50,7 @@
"libgmock",
"libhidlmemory",
"libneuralnetworks_generated_test_harness",
- "libneuralnetworks_utils",
+ "libneuralnetworks_common",
],
header_libs: [
"libneuralnetworks_headers",
@@ -81,7 +81,7 @@
"libgmock",
"libhidlmemory",
"libneuralnetworks_generated_test_harness",
- "libneuralnetworks_utils",
+ "libneuralnetworks_common",
],
whole_static_libs: [
"neuralnetworks_generated_V1_0_example",
diff --git a/neuralnetworks/1.0/vts/functional/OWNERS b/neuralnetworks/1.0/vts/functional/OWNERS
deleted file mode 100644
index a48301d..0000000
--- a/neuralnetworks/1.0/vts/functional/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Bug component: 195575
-jeanluc@google.com
-miaowang@google.com
-pszczepaniak@google.com
diff --git a/neuralnetworks/1.1/utils/OWNERS b/neuralnetworks/1.1/utils/OWNERS
deleted file mode 100644
index e4feee3..0000000
--- a/neuralnetworks/1.1/utils/OWNERS
+++ /dev/null
@@ -1,11 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-galarragas@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
diff --git a/neuralnetworks/1.1/utils/include/nnapi/hal/1.1/Utils.h b/neuralnetworks/1.1/utils/include/nnapi/hal/1.1/Utils.h
index 4660ff7..ff06739 100644
--- a/neuralnetworks/1.1/utils/include/nnapi/hal/1.1/Utils.h
+++ b/neuralnetworks/1.1/utils/include/nnapi/hal/1.1/Utils.h
@@ -30,7 +30,7 @@
namespace android::hardware::neuralnetworks::V1_1::utils {
constexpr auto kDefaultExecutionPreference = ExecutionPreference::FAST_SINGLE_ANSWER;
-constexpr auto kVersion = nn::Version::ANDROID_P;
+constexpr auto kVersion = nn::kVersionFeatureLevel2;
template <typename Type>
nn::Result<void> validate(const Type& halObject) {
@@ -53,7 +53,7 @@
template <typename Type>
nn::Result<void> compliantVersion(const Type& canonical) {
const auto version = NN_TRY(nn::validate(canonical));
- if (version > kVersion) {
+ if (!nn::isCompliantVersion(version, kVersion)) {
return NN_ERROR() << "Insufficient version: " << version << " vs required " << kVersion;
}
return {};
diff --git a/neuralnetworks/1.1/utils/src/Device.cpp b/neuralnetworks/1.1/utils/src/Device.cpp
index 7d54cab..3effa84 100644
--- a/neuralnetworks/1.1/utils/src/Device.cpp
+++ b/neuralnetworks/1.1/utils/src/Device.cpp
@@ -99,7 +99,7 @@
}
nn::Version Device::getFeatureLevel() const {
- return nn::Version::ANDROID_P;
+ return kVersion;
}
nn::DeviceType Device::getType() const {
diff --git a/neuralnetworks/1.1/utils/test/DeviceTest.cpp b/neuralnetworks/1.1/utils/test/DeviceTest.cpp
index 41e0e30..2248da6 100644
--- a/neuralnetworks/1.1/utils/test/DeviceTest.cpp
+++ b/neuralnetworks/1.1/utils/test/DeviceTest.cpp
@@ -243,7 +243,7 @@
const auto featureLevel = device->getFeatureLevel();
// verify result
- EXPECT_EQ(featureLevel, nn::Version::ANDROID_P);
+ EXPECT_EQ(featureLevel, nn::kVersionFeatureLevel2);
}
TEST(DeviceTest, getCachedData) {
diff --git a/neuralnetworks/1.1/vts/OWNERS b/neuralnetworks/1.1/vts/OWNERS
deleted file mode 100644
index b5a8e1f..0000000
--- a/neuralnetworks/1.1/vts/OWNERS
+++ /dev/null
@@ -1,16 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-mikie@google.com
-mks@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
-
-# VTS team
-yim@google.com
-yuexima@google.com
diff --git a/neuralnetworks/1.1/vts/functional/Android.bp b/neuralnetworks/1.1/vts/functional/Android.bp
index c001112..e9d4b76 100644
--- a/neuralnetworks/1.1/vts/functional/Android.bp
+++ b/neuralnetworks/1.1/vts/functional/Android.bp
@@ -48,7 +48,7 @@
"libgmock",
"libhidlmemory",
"libneuralnetworks_generated_test_harness",
- "libneuralnetworks_utils",
+ "libneuralnetworks_common",
],
whole_static_libs: [
"neuralnetworks_generated_V1_0_example",
diff --git a/neuralnetworks/1.1/vts/functional/OWNERS b/neuralnetworks/1.1/vts/functional/OWNERS
deleted file mode 100644
index a48301d..0000000
--- a/neuralnetworks/1.1/vts/functional/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Bug component: 195575
-jeanluc@google.com
-miaowang@google.com
-pszczepaniak@google.com
diff --git a/neuralnetworks/1.2/utils/OWNERS b/neuralnetworks/1.2/utils/OWNERS
deleted file mode 100644
index e4feee3..0000000
--- a/neuralnetworks/1.2/utils/OWNERS
+++ /dev/null
@@ -1,11 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-galarragas@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
diff --git a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstController.h b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Burst.h
similarity index 83%
rename from neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstController.h
rename to neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Burst.h
index 8078693..ac9411c 100644
--- a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstController.h
+++ b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Burst.h
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_CONTROLLER_H
-#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_CONTROLLER_H
+#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_BURST_H
+#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_BURST_H
-#include "ExecutionBurstUtils.h"
+#include "nnapi/hal/1.2/BurstUtils.h"
#include <android-base/thread_annotations.h>
#include <android/hardware/neuralnetworks/1.0/types.h>
@@ -49,13 +49,11 @@
namespace android::hardware::neuralnetworks::V1_2::utils {
/**
- * The ExecutionBurstController class manages both the serialization and deserialization of data
- * across FMQ, making it appear to the runtime as a regular synchronous inference. Additionally,
- * this class manages the burst's memory cache.
+ * The Burst class manages both the serialization and deserialization of data across FMQ, making it
+ * appear to the runtime as a regular synchronous inference. Additionally, this class manages the
+ * burst's memory cache.
*/
-class ExecutionBurstController final
- : public nn::IBurst,
- public std::enable_shared_from_this<ExecutionBurstController> {
+class Burst final : public nn::IBurst, public std::enable_shared_from_this<Burst> {
struct PrivateConstructorTag {};
public:
@@ -150,21 +148,21 @@
* Creates a burst controller on a prepared model.
*
* @param preparedModel Model prepared for execution to execute on.
- * @param pollingTimeWindow How much time (in microseconds) the ExecutionBurstController is
- * allowed to poll the FMQ before waiting on the blocking futex. Polling may result in lower
- * latencies at the potential cost of more power usage.
- * @return ExecutionBurstController Execution burst controller object.
+ * @param pollingTimeWindow How much time (in microseconds) the Burst is allowed to poll the FMQ
+ * before waiting on the blocking futex. Polling may result in lower latencies at the
+ * potential cost of more power usage.
+ * @return Burst Execution burst controller object.
*/
- static nn::GeneralResult<std::shared_ptr<const ExecutionBurstController>> create(
+ static nn::GeneralResult<std::shared_ptr<const Burst>> create(
nn::SharedPreparedModel preparedModel, const sp<IPreparedModel>& hidlPreparedModel,
std::chrono::microseconds pollingTimeWindow);
- ExecutionBurstController(PrivateConstructorTag tag, nn::SharedPreparedModel preparedModel,
- std::unique_ptr<RequestChannelSender> requestChannelSender,
- std::unique_ptr<ResultChannelReceiver> resultChannelReceiver,
- sp<ExecutionBurstCallback> callback, sp<IBurstContext> burstContext,
- std::shared_ptr<MemoryCache> memoryCache,
- neuralnetworks::utils::DeathHandler deathHandler);
+ Burst(PrivateConstructorTag tag, nn::SharedPreparedModel preparedModel,
+ std::unique_ptr<RequestChannelSender> requestChannelSender,
+ std::unique_ptr<ResultChannelReceiver> resultChannelReceiver,
+ sp<ExecutionBurstCallback> callback, sp<IBurstContext> burstContext,
+ std::shared_ptr<MemoryCache> memoryCache,
+ neuralnetworks::utils::DeathHandler deathHandler);
// See IBurst::cacheMemory for information on this method.
OptionalCacheHold cacheMemory(const nn::SharedMemory& memory) const override;
@@ -202,4 +200,4 @@
} // namespace android::hardware::neuralnetworks::V1_2::utils
-#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_CONTROLLER_H
+#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_BURST_H
diff --git a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstUtils.h b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/BurstUtils.h
similarity index 98%
rename from neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstUtils.h
rename to neuralnetworks/1.2/utils/include/nnapi/hal/1.2/BurstUtils.h
index c081305..7a6a241 100644
--- a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstUtils.h
+++ b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/BurstUtils.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_UTILS_H
-#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_UTILS_H
+#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_BURST_UTILS_H
+#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_BURST_UTILS_H
#include <android/hardware/neuralnetworks/1.0/types.h>
#include <android/hardware/neuralnetworks/1.2/types.h>
@@ -298,4 +298,4 @@
} // namespace android::hardware::neuralnetworks::V1_2::utils
-#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_UTILS_H
+#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_BURST_UTILS_H
diff --git a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Callbacks.h b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Callbacks.h
index 6dd8138..fc04303 100644
--- a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Callbacks.h
+++ b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Callbacks.h
@@ -38,7 +38,8 @@
// Converts the results of IDevice::prepareModel* to the NN canonical format. On success, this
// function returns with a non-null nn::SharedPreparedModel with a feature level of
-// nn::Version::ANDROID_Q. On failure, this function returns with the appropriate nn::GeneralError.
+// nn::kVersionFeatureLevel3. On failure, this function returns with the appropriate
+// nn::GeneralError.
nn::GeneralResult<nn::SharedPreparedModel> prepareModelCallback(
V1_0::ErrorStatus status, const sp<IPreparedModel>& preparedModel);
diff --git a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Utils.h b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Utils.h
index 23e336a..a06f2ac 100644
--- a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Utils.h
+++ b/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/Utils.h
@@ -39,7 +39,7 @@
constexpr auto kDefaultMesaureTiming = MeasureTiming::NO;
constexpr auto kNoTiming = Timing{.timeOnDevice = std::numeric_limits<uint64_t>::max(),
.timeInDriver = std::numeric_limits<uint64_t>::max()};
-constexpr auto kVersion = nn::Version::ANDROID_Q;
+constexpr auto kVersion = nn::kVersionFeatureLevel3;
template <typename Type>
nn::Result<void> validate(const Type& halObject) {
@@ -62,7 +62,7 @@
template <typename Type>
nn::Result<void> compliantVersion(const Type& canonical) {
const auto version = NN_TRY(nn::validate(canonical));
- if (version > kVersion) {
+ if (!nn::isCompliantVersion(version, kVersion)) {
return NN_ERROR() << "Insufficient version: " << version << " vs required " << kVersion;
}
return {};
diff --git a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp b/neuralnetworks/1.2/utils/src/Burst.cpp
similarity index 78%
rename from neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp
rename to neuralnetworks/1.2/utils/src/Burst.cpp
index a8ded9e..911fbfa 100644
--- a/neuralnetworks/1.2/utils/src/ExecutionBurstController.cpp
+++ b/neuralnetworks/1.2/utils/src/Burst.cpp
@@ -14,10 +14,8 @@
* limitations under the License.
*/
-#define LOG_TAG "ExecutionBurstController"
-
-#include "ExecutionBurstController.h"
-#include "ExecutionBurstUtils.h"
+#include "Burst.h"
+#include "BurstUtils.h"
#include <android-base/logging.h>
#include <android-base/thread_annotations.h>
@@ -57,14 +55,13 @@
public:
static nn::GeneralResult<std::shared_ptr<const BurstExecution>> create(
- std::shared_ptr<const ExecutionBurstController> controller,
- std::vector<FmqRequestDatum> request, hal::utils::RequestRelocation relocation,
- std::vector<ExecutionBurstController::OptionalCacheHold> cacheHolds);
+ std::shared_ptr<const Burst> controller, std::vector<FmqRequestDatum> request,
+ hal::utils::RequestRelocation relocation,
+ std::vector<Burst::OptionalCacheHold> cacheHolds);
- BurstExecution(PrivateConstructorTag tag,
- std::shared_ptr<const ExecutionBurstController> controller,
+ BurstExecution(PrivateConstructorTag tag, std::shared_ptr<const Burst> controller,
std::vector<FmqRequestDatum> request, hal::utils::RequestRelocation relocation,
- std::vector<ExecutionBurstController::OptionalCacheHold> cacheHolds);
+ std::vector<Burst::OptionalCacheHold> cacheHolds);
nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> compute(
const nn::OptionalTimePoint& deadline) const override;
@@ -74,10 +71,10 @@
const nn::OptionalDuration& timeoutDurationAfterFence) const override;
private:
- const std::shared_ptr<const ExecutionBurstController> kController;
+ const std::shared_ptr<const Burst> kController;
const std::vector<FmqRequestDatum> kRequest;
const hal::utils::RequestRelocation kRelocation;
- const std::vector<ExecutionBurstController::OptionalCacheHold> kCacheHolds;
+ const std::vector<Burst::OptionalCacheHold> kCacheHolds;
};
nn::GeneralResult<sp<IBurstContext>> executionBurstResultCallback(
@@ -92,8 +89,7 @@
}
nn::GeneralResult<hidl_vec<hidl_memory>> getMemoriesHelper(
- const hidl_vec<int32_t>& slots,
- const std::shared_ptr<ExecutionBurstController::MemoryCache>& memoryCache) {
+ const hidl_vec<int32_t>& slots, const std::shared_ptr<Burst::MemoryCache>& memoryCache) {
hidl_vec<hidl_memory> memories(slots.size());
for (size_t i = 0; i < slots.size(); ++i) {
const int32_t slot = slots[i];
@@ -110,7 +106,7 @@
// MemoryCache methods
-ExecutionBurstController::MemoryCache::MemoryCache() {
+Burst::MemoryCache::MemoryCache() {
constexpr size_t kPreallocatedCount = 1024;
std::vector<int32_t> freeSlotsSpace;
freeSlotsSpace.reserve(kPreallocatedCount);
@@ -119,13 +115,13 @@
mCacheCleaner.reserve(kPreallocatedCount);
}
-void ExecutionBurstController::MemoryCache::setBurstContext(sp<IBurstContext> burstContext) {
+void Burst::MemoryCache::setBurstContext(sp<IBurstContext> burstContext) {
std::lock_guard guard(mMutex);
mBurstContext = std::move(burstContext);
}
-std::pair<int32_t, ExecutionBurstController::MemoryCache::SharedCleanup>
-ExecutionBurstController::MemoryCache::cacheMemory(const nn::SharedMemory& memory) {
+std::pair<int32_t, Burst::MemoryCache::SharedCleanup> Burst::MemoryCache::cacheMemory(
+ const nn::SharedMemory& memory) {
std::unique_lock lock(mMutex);
base::ScopedLockAssertion lockAssert(mMutex);
@@ -163,7 +159,7 @@
return std::make_pair(slot, std::move(cleaner));
}
-nn::GeneralResult<nn::SharedMemory> ExecutionBurstController::MemoryCache::getMemory(int32_t slot) {
+nn::GeneralResult<nn::SharedMemory> Burst::MemoryCache::getMemory(int32_t slot) {
std::lock_guard guard(mMutex);
if (slot < 0 || static_cast<size_t>(slot) >= mMemoryCache.size()) {
return NN_ERROR() << "Invalid slot: " << slot << " vs " << mMemoryCache.size();
@@ -171,7 +167,7 @@
return mMemoryCache[slot];
}
-void ExecutionBurstController::MemoryCache::freeMemory(const nn::SharedMemory& memory) {
+void Burst::MemoryCache::freeMemory(const nn::SharedMemory& memory) {
{
std::lock_guard guard(mMutex);
const int32_t slot = mMemoryIdToSlot.at(memory);
@@ -189,7 +185,7 @@
mCond.notify_all();
}
-int32_t ExecutionBurstController::MemoryCache::allocateSlotLocked() {
+int32_t Burst::MemoryCache::allocateSlotLocked() {
constexpr size_t kMaxNumberOfSlots = std::numeric_limits<int32_t>::max();
// If there is a free slot, use it.
@@ -210,18 +206,18 @@
// ExecutionBurstCallback methods
-ExecutionBurstController::ExecutionBurstCallback::ExecutionBurstCallback(
+Burst::ExecutionBurstCallback::ExecutionBurstCallback(
const std::shared_ptr<MemoryCache>& memoryCache)
: kMemoryCache(memoryCache) {
CHECK(memoryCache != nullptr);
}
-Return<void> ExecutionBurstController::ExecutionBurstCallback::getMemories(
- const hidl_vec<int32_t>& slots, getMemories_cb cb) {
+Return<void> Burst::ExecutionBurstCallback::getMemories(const hidl_vec<int32_t>& slots,
+ getMemories_cb cb) {
const auto memoryCache = kMemoryCache.lock();
if (memoryCache == nullptr) {
- LOG(ERROR) << "ExecutionBurstController::ExecutionBurstCallback::getMemories called after "
- "the MemoryCache has been freed";
+ LOG(ERROR) << "Burst::ExecutionBurstCallback::getMemories called after the MemoryCache has "
+ "been freed";
cb(V1_0::ErrorStatus::GENERAL_FAILURE, {});
return Void();
}
@@ -229,8 +225,8 @@
const auto maybeMemories = getMemoriesHelper(slots, memoryCache);
if (!maybeMemories.has_value()) {
const auto& [message, code] = maybeMemories.error();
- LOG(ERROR) << "ExecutionBurstController::ExecutionBurstCallback::getMemories failed with "
- << code << ": " << message;
+ LOG(ERROR) << "Burst::ExecutionBurstCallback::getMemories failed with " << code << ": "
+ << message;
cb(V1_0::ErrorStatus::INVALID_ARGUMENT, {});
return Void();
}
@@ -239,14 +235,14 @@
return Void();
}
-// ExecutionBurstController methods
+// Burst methods
-nn::GeneralResult<std::shared_ptr<const ExecutionBurstController>> ExecutionBurstController::create(
+nn::GeneralResult<std::shared_ptr<const Burst>> Burst::create(
nn::SharedPreparedModel preparedModel, const sp<V1_2::IPreparedModel>& hidlPreparedModel,
std::chrono::microseconds pollingTimeWindow) {
// check inputs
if (preparedModel == nullptr || hidlPreparedModel == nullptr) {
- return NN_ERROR() << "ExecutionBurstController::create passed a nullptr";
+ return NN_ERROR() << "Burst::create passed a nullptr";
}
// create FMQ objects
@@ -282,18 +278,18 @@
deathHandler.protectCallbackForLifetimeOfDeathHandler(resultChannelReceiver.get());
// make and return controller
- return std::make_shared<const ExecutionBurstController>(
+ return std::make_shared<const Burst>(
PrivateConstructorTag{}, std::move(preparedModel), std::move(requestChannelSender),
std::move(resultChannelReceiver), std::move(burstCallback), std::move(burstContext),
std::move(memoryCache), std::move(deathHandler));
}
-ExecutionBurstController::ExecutionBurstController(
- PrivateConstructorTag /*tag*/, nn::SharedPreparedModel preparedModel,
- std::unique_ptr<RequestChannelSender> requestChannelSender,
- std::unique_ptr<ResultChannelReceiver> resultChannelReceiver,
- sp<ExecutionBurstCallback> callback, sp<IBurstContext> burstContext,
- std::shared_ptr<MemoryCache> memoryCache, neuralnetworks::utils::DeathHandler deathHandler)
+Burst::Burst(PrivateConstructorTag /*tag*/, nn::SharedPreparedModel preparedModel,
+ std::unique_ptr<RequestChannelSender> requestChannelSender,
+ std::unique_ptr<ResultChannelReceiver> resultChannelReceiver,
+ sp<ExecutionBurstCallback> callback, sp<IBurstContext> burstContext,
+ std::shared_ptr<MemoryCache> memoryCache,
+ neuralnetworks::utils::DeathHandler deathHandler)
: kPreparedModel(std::move(preparedModel)),
mRequestChannelSender(std::move(requestChannelSender)),
mResultChannelReceiver(std::move(resultChannelReceiver)),
@@ -302,25 +298,24 @@
mMemoryCache(std::move(memoryCache)),
kDeathHandler(std::move(deathHandler)) {}
-ExecutionBurstController::OptionalCacheHold ExecutionBurstController::cacheMemory(
- const nn::SharedMemory& memory) const {
+Burst::OptionalCacheHold Burst::cacheMemory(const nn::SharedMemory& memory) const {
auto [slot, hold] = mMemoryCache->cacheMemory(memory);
return hold;
}
-nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>>
-ExecutionBurstController::execute(const nn::Request& request, nn::MeasureTiming measure,
- const nn::OptionalTimePoint& deadline,
- const nn::OptionalDuration& loopTimeoutDuration) const {
+nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> Burst::execute(
+ const nn::Request& request, nn::MeasureTiming measure,
+ const nn::OptionalTimePoint& deadline,
+ const nn::OptionalDuration& loopTimeoutDuration) const {
// This is the first point when we know an execution is occurring, so begin to collect
// systraces. Note that the first point we can begin collecting systraces in
// ExecutionBurstServer is when the RequestChannelReceiver realizes there is data in the FMQ, so
// ExecutionBurstServer collects systraces at different points in the code.
- NNTRACE_RT(NNTRACE_PHASE_EXECUTION, "ExecutionBurstController::execute");
+ NNTRACE_RT(NNTRACE_PHASE_EXECUTION, "Burst::execute");
// if the request is valid but of a higher version than what's supported in burst execution,
// fall back to another execution path
- if (const auto version = NN_TRY(nn::validate(request)); version > nn::Version::ANDROID_Q) {
+ if (!compliantVersion(request).ok()) {
// fallback to another execution path if the packet could not be sent
return kPreparedModel->execute(request, measure, deadline, loopTimeoutDuration);
}
@@ -357,14 +352,14 @@
}
// See IBurst::createReusableExecution for information on this method.
-nn::GeneralResult<nn::SharedExecution> ExecutionBurstController::createReusableExecution(
+nn::GeneralResult<nn::SharedExecution> Burst::createReusableExecution(
const nn::Request& request, nn::MeasureTiming measure,
const nn::OptionalDuration& loopTimeoutDuration) const {
- NNTRACE_RT(NNTRACE_PHASE_EXECUTION, "ExecutionBurstController::createReusableExecution");
+ NNTRACE_RT(NNTRACE_PHASE_EXECUTION, "Burst::createReusableExecution");
// if the request is valid but of a higher version than what's supported in burst execution,
// fall back to another execution path
- if (const auto version = NN_TRY(nn::validate(request)); version > nn::Version::ANDROID_Q) {
+ if (!compliantVersion(request).ok()) {
// fallback to another execution path if the packet could not be sent
return kPreparedModel->createReusableExecution(request, measure, loopTimeoutDuration);
}
@@ -397,12 +392,10 @@
std::move(relocation), std::move(holds));
}
-nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>>
-ExecutionBurstController::executeInternal(const std::vector<FmqRequestDatum>& requestPacket,
- const hal::utils::RequestRelocation& relocation,
- FallbackFunction fallback) const {
- NNTRACE_FULL(NNTRACE_LAYER_IPC, NNTRACE_PHASE_EXECUTION,
- "ExecutionBurstController::executeInternal");
+nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> Burst::executeInternal(
+ const std::vector<FmqRequestDatum>& requestPacket,
+ const hal::utils::RequestRelocation& relocation, FallbackFunction fallback) const {
+ NNTRACE_FULL(NNTRACE_LAYER_IPC, NNTRACE_PHASE_EXECUTION, "Burst::executeInternal");
// Ensure that at most one execution is in flight at any given time.
const bool alreadyInFlight = mExecutionInFlight.test_and_set();
@@ -435,9 +428,9 @@
}
nn::GeneralResult<std::shared_ptr<const BurstExecution>> BurstExecution::create(
- std::shared_ptr<const ExecutionBurstController> controller,
- std::vector<FmqRequestDatum> request, hal::utils::RequestRelocation relocation,
- std::vector<ExecutionBurstController::OptionalCacheHold> cacheHolds) {
+ std::shared_ptr<const Burst> controller, std::vector<FmqRequestDatum> request,
+ hal::utils::RequestRelocation relocation,
+ std::vector<Burst::OptionalCacheHold> cacheHolds) {
if (controller == nullptr) {
return NN_ERROR() << "V1_2::utils::BurstExecution::create must have non-null controller";
}
@@ -448,10 +441,10 @@
}
BurstExecution::BurstExecution(PrivateConstructorTag /*tag*/,
- std::shared_ptr<const ExecutionBurstController> controller,
+ std::shared_ptr<const Burst> controller,
std::vector<FmqRequestDatum> request,
hal::utils::RequestRelocation relocation,
- std::vector<ExecutionBurstController::OptionalCacheHold> cacheHolds)
+ std::vector<Burst::OptionalCacheHold> cacheHolds)
: kController(std::move(controller)),
kRequest(std::move(request)),
kRelocation(std::move(relocation)),
diff --git a/neuralnetworks/1.2/utils/src/ExecutionBurstUtils.cpp b/neuralnetworks/1.2/utils/src/BurstUtils.cpp
similarity index 99%
rename from neuralnetworks/1.2/utils/src/ExecutionBurstUtils.cpp
rename to neuralnetworks/1.2/utils/src/BurstUtils.cpp
index e0d029a..b589c46 100644
--- a/neuralnetworks/1.2/utils/src/ExecutionBurstUtils.cpp
+++ b/neuralnetworks/1.2/utils/src/BurstUtils.cpp
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "ExecutionBurstUtils"
-
-#include "ExecutionBurstUtils.h"
+#include "BurstUtils.h"
#include <android-base/logging.h>
#include <android-base/properties.h>
diff --git a/neuralnetworks/1.2/utils/src/Device.cpp b/neuralnetworks/1.2/utils/src/Device.cpp
index f12669a..e7acecd 100644
--- a/neuralnetworks/1.2/utils/src/Device.cpp
+++ b/neuralnetworks/1.2/utils/src/Device.cpp
@@ -192,7 +192,7 @@
}
nn::Version Device::getFeatureLevel() const {
- return nn::Version::ANDROID_Q;
+ return kVersion;
}
nn::DeviceType Device::getType() const {
diff --git a/neuralnetworks/1.2/utils/src/PreparedModel.cpp b/neuralnetworks/1.2/utils/src/PreparedModel.cpp
index b8a5ae0..6df3df3 100644
--- a/neuralnetworks/1.2/utils/src/PreparedModel.cpp
+++ b/neuralnetworks/1.2/utils/src/PreparedModel.cpp
@@ -16,11 +16,11 @@
#include "PreparedModel.h"
+#include "Burst.h"
+#include "BurstUtils.h"
#include "Callbacks.h"
#include "Conversions.h"
#include "Execution.h"
-#include "ExecutionBurstController.h"
-#include "ExecutionBurstUtils.h"
#include "Utils.h"
#include <android/hardware/neuralnetworks/1.0/types.h>
@@ -150,16 +150,8 @@
}
nn::GeneralResult<nn::SharedBurst> PreparedModel::configureExecutionBurst() const {
- auto self = shared_from_this();
- auto fallback = [preparedModel = std::move(self)](
- const nn::Request& request, nn::MeasureTiming measure,
- const nn::OptionalTimePoint& deadline,
- const nn::OptionalDuration& loopTimeoutDuration)
- -> nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> {
- return preparedModel->execute(request, measure, deadline, loopTimeoutDuration);
- };
const auto pollingTimeWindow = getBurstControllerPollingTimeWindow();
- return ExecutionBurstController::create(shared_from_this(), kPreparedModel, pollingTimeWindow);
+ return Burst::create(shared_from_this(), kPreparedModel, pollingTimeWindow);
}
std::any PreparedModel::getUnderlyingResource() const {
diff --git a/neuralnetworks/1.2/utils/test/DeviceTest.cpp b/neuralnetworks/1.2/utils/test/DeviceTest.cpp
index 215d44c..1dc6285 100644
--- a/neuralnetworks/1.2/utils/test/DeviceTest.cpp
+++ b/neuralnetworks/1.2/utils/test/DeviceTest.cpp
@@ -483,7 +483,7 @@
const auto featureLevel = device->getFeatureLevel();
// verify result
- EXPECT_EQ(featureLevel, nn::Version::ANDROID_Q);
+ EXPECT_EQ(featureLevel, nn::kVersionFeatureLevel3);
}
TEST(DeviceTest, getCachedData) {
diff --git a/neuralnetworks/1.2/vts/OWNERS b/neuralnetworks/1.2/vts/OWNERS
deleted file mode 100644
index b5a8e1f..0000000
--- a/neuralnetworks/1.2/vts/OWNERS
+++ /dev/null
@@ -1,16 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-mikie@google.com
-mks@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
-
-# VTS team
-yim@google.com
-yuexima@google.com
diff --git a/neuralnetworks/1.2/vts/functional/Android.bp b/neuralnetworks/1.2/vts/functional/Android.bp
index e313b47..52d51e2 100644
--- a/neuralnetworks/1.2/vts/functional/Android.bp
+++ b/neuralnetworks/1.2/vts/functional/Android.bp
@@ -71,7 +71,7 @@
"libgmock",
"libhidlmemory",
"libneuralnetworks_generated_test_harness",
- "libneuralnetworks_utils",
+ "libneuralnetworks_common",
],
whole_static_libs: [
"neuralnetworks_generated_V1_0_example",
diff --git a/neuralnetworks/1.2/vts/functional/OWNERS b/neuralnetworks/1.2/vts/functional/OWNERS
deleted file mode 100644
index a48301d..0000000
--- a/neuralnetworks/1.2/vts/functional/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Bug component: 195575
-jeanluc@google.com
-miaowang@google.com
-pszczepaniak@google.com
diff --git a/neuralnetworks/1.3/utils/OWNERS b/neuralnetworks/1.3/utils/OWNERS
deleted file mode 100644
index e4feee3..0000000
--- a/neuralnetworks/1.3/utils/OWNERS
+++ /dev/null
@@ -1,11 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-galarragas@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
diff --git a/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Callbacks.h b/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Callbacks.h
index 4b8ddc1..10892bc 100644
--- a/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Callbacks.h
+++ b/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Callbacks.h
@@ -47,7 +47,8 @@
// Converts the results of IDevice::prepareModel* to the NN canonical format. On success, this
// function returns with a non-null nn::SharedPreparedModel with a feature level of
-// nn::Version::ANDROID_R. On failure, this function returns with the appropriate nn::GeneralError.
+// nn::kVersionFeatureLevel4. On failure, this function returns with the appropriate
+// nn::GeneralError.
nn::GeneralResult<nn::SharedPreparedModel> prepareModelCallback(
ErrorStatus status, const sp<IPreparedModel>& preparedModel);
diff --git a/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Utils.h b/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Utils.h
index 2812db2..594d727 100644
--- a/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Utils.h
+++ b/neuralnetworks/1.3/utils/include/nnapi/hal/1.3/Utils.h
@@ -39,7 +39,7 @@
using V1_2::utils::kNoTiming;
constexpr auto kDefaultPriority = Priority::MEDIUM;
-constexpr auto kVersion = nn::Version::ANDROID_R;
+constexpr auto kVersion = nn::kVersionFeatureLevel4;
template <typename Type>
nn::Result<void> validate(const Type& halObject) {
@@ -62,7 +62,7 @@
template <typename Type>
nn::Result<void> compliantVersion(const Type& canonical) {
const auto version = NN_TRY(nn::validate(canonical));
- if (version > kVersion) {
+ if (!nn::isCompliantVersion(version, kVersion)) {
return NN_ERROR() << "Insufficient version: " << version << " vs required " << kVersion;
}
return {};
diff --git a/neuralnetworks/1.3/utils/src/Device.cpp b/neuralnetworks/1.3/utils/src/Device.cpp
index a73ce82..9517fda 100644
--- a/neuralnetworks/1.3/utils/src/Device.cpp
+++ b/neuralnetworks/1.3/utils/src/Device.cpp
@@ -143,7 +143,7 @@
}
nn::Version Device::getFeatureLevel() const {
- return nn::Version::ANDROID_R;
+ return kVersion;
}
nn::DeviceType Device::getType() const {
diff --git a/neuralnetworks/1.3/utils/src/PreparedModel.cpp b/neuralnetworks/1.3/utils/src/PreparedModel.cpp
index 2c81cb2..ce977e5 100644
--- a/neuralnetworks/1.3/utils/src/PreparedModel.cpp
+++ b/neuralnetworks/1.3/utils/src/PreparedModel.cpp
@@ -32,9 +32,9 @@
#include <nnapi/Types.h>
#include <nnapi/hal/1.0/HandleError.h>
#include <nnapi/hal/1.0/ProtectCallback.h>
+#include <nnapi/hal/1.2/Burst.h>
+#include <nnapi/hal/1.2/BurstUtils.h>
#include <nnapi/hal/1.2/Conversions.h>
-#include <nnapi/hal/1.2/ExecutionBurstController.h>
-#include <nnapi/hal/1.2/ExecutionBurstUtils.h>
#include <nnapi/hal/CommonUtils.h>
#include <memory>
@@ -246,17 +246,8 @@
}
nn::GeneralResult<nn::SharedBurst> PreparedModel::configureExecutionBurst() const {
- auto self = shared_from_this();
- auto fallback = [preparedModel = std::move(self)](
- const nn::Request& request, nn::MeasureTiming measure,
- const nn::OptionalTimePoint& deadline,
- const nn::OptionalDuration& loopTimeoutDuration)
- -> nn::ExecutionResult<std::pair<std::vector<nn::OutputShape>, nn::Timing>> {
- return preparedModel->execute(request, measure, deadline, loopTimeoutDuration);
- };
const auto pollingTimeWindow = V1_2::utils::getBurstControllerPollingTimeWindow();
- return V1_2::utils::ExecutionBurstController::create(shared_from_this(), kPreparedModel,
- pollingTimeWindow);
+ return V1_2::utils::Burst::create(shared_from_this(), kPreparedModel, pollingTimeWindow);
}
std::any PreparedModel::getUnderlyingResource() const {
diff --git a/neuralnetworks/1.3/utils/test/DeviceTest.cpp b/neuralnetworks/1.3/utils/test/DeviceTest.cpp
index 2d1b2f2..7eba4bc 100644
--- a/neuralnetworks/1.3/utils/test/DeviceTest.cpp
+++ b/neuralnetworks/1.3/utils/test/DeviceTest.cpp
@@ -505,7 +505,7 @@
const auto featureLevel = device->getFeatureLevel();
// verify result
- EXPECT_EQ(featureLevel, nn::Version::ANDROID_R);
+ EXPECT_EQ(featureLevel, nn::kVersionFeatureLevel4);
}
TEST(DeviceTest, getCachedData) {
diff --git a/neuralnetworks/1.3/vts/OWNERS b/neuralnetworks/1.3/vts/OWNERS
deleted file mode 100644
index b5a8e1f..0000000
--- a/neuralnetworks/1.3/vts/OWNERS
+++ /dev/null
@@ -1,16 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-mikie@google.com
-mks@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
-
-# VTS team
-yim@google.com
-yuexima@google.com
diff --git a/neuralnetworks/1.3/vts/functional/Android.bp b/neuralnetworks/1.3/vts/functional/Android.bp
index ab0a018..8951760 100644
--- a/neuralnetworks/1.3/vts/functional/Android.bp
+++ b/neuralnetworks/1.3/vts/functional/Android.bp
@@ -66,7 +66,6 @@
"VtsHalNeuralNetworksV1_0_utils",
"VtsHalNeuralNetworksV1_2_utils",
"VtsHalNeuralNetworksV1_3_utils",
- "android.hardware.neuralnetworks-V2-ndk",
"android.hardware.neuralnetworks@1.0",
"android.hardware.neuralnetworks@1.1",
"android.hardware.neuralnetworks@1.2",
@@ -76,7 +75,7 @@
"libgmock",
"libhidlmemory",
"libneuralnetworks_generated_test_harness",
- "libneuralnetworks_utils",
+ "libneuralnetworks_common",
"libsync",
],
whole_static_libs: [
diff --git a/neuralnetworks/1.3/vts/functional/OWNERS b/neuralnetworks/1.3/vts/functional/OWNERS
deleted file mode 100644
index a48301d..0000000
--- a/neuralnetworks/1.3/vts/functional/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Bug component: 195575
-jeanluc@google.com
-miaowang@google.com
-pszczepaniak@google.com
diff --git a/neuralnetworks/aidl/vts/OWNERS b/neuralnetworks/OWNERS
similarity index 78%
rename from neuralnetworks/aidl/vts/OWNERS
rename to neuralnetworks/OWNERS
index f1a757a..def3ea9 100644
--- a/neuralnetworks/aidl/vts/OWNERS
+++ b/neuralnetworks/OWNERS
@@ -1,9 +1,10 @@
+# Bug component: 195575
# Neuralnetworks team
butlermichael@google.com
dgross@google.com
+galarragas@google.com
+ianhua@google.com
jeanluc@google.com
miaowang@google.com
-mikie@google.com
pszczepaniak@google.com
xusongw@google.com
-ianhua@google.com
diff --git a/neuralnetworks/README b/neuralnetworks/README
index d8c8f5d..b0c605d 100644
--- a/neuralnetworks/README
+++ b/neuralnetworks/README
@@ -1,2 +1,2 @@
NeuralNetworks sample driver implementation is located at
-frameworks/ml/nn/driver/sample.
+packages/modules/NeuralNetworks/driver/sample*.
diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp
index 3a69936..065105a 100644
--- a/neuralnetworks/aidl/Android.bp
+++ b/neuralnetworks/aidl/Android.bp
@@ -35,5 +35,8 @@
min_sdk_version: "30",
},
},
- versions: ["1"],
+ versions: [
+ "1",
+ "2",
+ ],
}
diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/.hash b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/.hash
new file mode 100644
index 0000000..35f32ea
--- /dev/null
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/.hash
@@ -0,0 +1 @@
+04c95c94c96062e5faf35c00b4ae0e50a3f11d0d
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/BufferDesc.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/BufferDesc.aidl
index 6eadbb7..05cec76 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/BufferDesc.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,8 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable BufferDesc {
+ int[] dimensions;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapApduType.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/BufferRole.aidl
similarity index 89%
rename from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapApduType.aidl
rename to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/BufferRole.aidl
index 9bfb725..10a6b75 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapApduType.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/BufferRole.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapApduType {
- APDU = 0,
- APDU7816 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable BufferRole {
+ int modelIndex;
+ int ioIndex;
+ float probability;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Capabilities.aidl
similarity index 75%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Capabilities.aidl
index 0c6c513..30877c0 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Capabilities.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,15 +31,12 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapResultCode {
- SUCCESS = 0,
- GENERIC_FAILURE = 1,
- CARD_NOT_ACCESSSIBLE = 2,
- CARD_ALREADY_POWERED_OFF = 3,
- CARD_REMOVED = 4,
- CARD_ALREADY_POWERED_ON = 5,
- DATA_NOT_AVAILABLE = 6,
- NOT_SUPPORTED = 7,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable Capabilities {
+ android.hardware.neuralnetworks.PerformanceInfo relaxedFloat32toFloat16PerformanceScalar;
+ android.hardware.neuralnetworks.PerformanceInfo relaxedFloat32toFloat16PerformanceTensor;
+ android.hardware.neuralnetworks.OperandPerformance[] operandPerformance;
+ android.hardware.neuralnetworks.PerformanceInfo ifPerformance;
+ android.hardware.neuralnetworks.PerformanceInfo whilePerformance;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DataLocation.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DataLocation.aidl
index a03f519..db49a38 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DataLocation.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,11 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.network;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CellIdentityOperatorNames {
- String alphaLong;
- String alphaShort;
+parcelable DataLocation {
+ int poolIndex;
+ long offset;
+ long length;
+ long padding;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DeviceBuffer.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DeviceBuffer.aidl
index a03f519..7cdd6db 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DeviceBuffer.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.network;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CellIdentityOperatorNames {
- String alphaLong;
- String alphaShort;
+parcelable DeviceBuffer {
+ android.hardware.neuralnetworks.IBuffer buffer;
+ int token;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DeviceType.aidl
similarity index 90%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DeviceType.aidl
index 6eadbb7..82fe8ae 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/DeviceType.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,11 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
+package android.hardware.neuralnetworks;
@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+enum DeviceType {
+ OTHER = 1,
+ CPU = 2,
+ GPU = 3,
+ ACCELERATOR = 4,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ErrorStatus.aidl
similarity index 81%
rename from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
rename to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ErrorStatus.aidl
index 0c6c513..57d5d6e 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ErrorStatus.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,15 +31,16 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
+package android.hardware.neuralnetworks;
@Backing(type="int") @VintfStability
-enum SapResultCode {
- SUCCESS = 0,
- GENERIC_FAILURE = 1,
- CARD_NOT_ACCESSSIBLE = 2,
- CARD_ALREADY_POWERED_OFF = 3,
- CARD_REMOVED = 4,
- CARD_ALREADY_POWERED_ON = 5,
- DATA_NOT_AVAILABLE = 6,
- NOT_SUPPORTED = 7,
+enum ErrorStatus {
+ NONE = 0,
+ DEVICE_UNAVAILABLE = 1,
+ GENERAL_FAILURE = 2,
+ OUTPUT_INSUFFICIENT_SIZE = 3,
+ INVALID_ARGUMENT = 4,
+ MISSED_DEADLINE_TRANSIENT = 5,
+ MISSED_DEADLINE_PERSISTENT = 6,
+ RESOURCE_EXHAUSTED_TRANSIENT = 7,
+ RESOURCE_EXHAUSTED_PERSISTENT = 8,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExecutionPreference.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExecutionPreference.aidl
index 6eadbb7..4352d8f 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExecutionPreference.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
+package android.hardware.neuralnetworks;
@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+enum ExecutionPreference {
+ LOW_POWER = 0,
+ FAST_SINGLE_ANSWER = 1,
+ SUSTAINED_SPEED = 2,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExecutionResult.aidl
similarity index 88%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExecutionResult.aidl
index d7eecbb..44e9922 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExecutionResult.aidl
@@ -31,8 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable ExecutionResult {
+ boolean outputSufficientSize;
+ android.hardware.neuralnetworks.OutputShape[] outputShapes;
+ android.hardware.neuralnetworks.Timing timing;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Extension.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Extension.aidl
index d7eecbb..c47028d 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Extension.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable Extension {
+ String name;
+ android.hardware.neuralnetworks.ExtensionOperandTypeInformation[] operandTypes;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExtensionNameAndPrefix.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExtensionNameAndPrefix.aidl
index 6eadbb7..6c287fd 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExtensionNameAndPrefix.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable ExtensionNameAndPrefix {
+ String name;
+ char prefix;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.aidl
similarity index 88%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.aidl
index 6eadbb7..a3680aa 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable ExtensionOperandTypeInformation {
+ char type;
+ boolean isTensor;
+ int byteSize;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/FencedExecutionResult.aidl
similarity index 89%
rename from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
rename to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/FencedExecutionResult.aidl
index d7eecbb..7952b34 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/FencedExecutionResult.aidl
@@ -31,8 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable FencedExecutionResult {
+ android.hardware.neuralnetworks.IFencedExecutionCallback callback;
+ @nullable ParcelFileDescriptor syncFence;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/FusedActivationFunc.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/FusedActivationFunc.aidl
index 6eadbb7..7e61bbb 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/FusedActivationFunc.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,11 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
+package android.hardware.neuralnetworks;
@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+enum FusedActivationFunc {
+ NONE = 0,
+ RELU = 1,
+ RELU1 = 2,
+ RELU6 = 3,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IBuffer.aidl
similarity index 85%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IBuffer.aidl
index d7eecbb..f10e7e2 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IBuffer.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+interface IBuffer {
+ void copyFrom(in android.hardware.neuralnetworks.Memory src, in int[] dimensions);
+ void copyTo(in android.hardware.neuralnetworks.Memory dst);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IBurst.aidl
similarity index 82%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IBurst.aidl
index d7eecbb..eb3d0b0 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IBurst.aidl
@@ -31,8 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+interface IBurst {
+ android.hardware.neuralnetworks.ExecutionResult executeSynchronously(in android.hardware.neuralnetworks.Request request, in long[] memoryIdentifierTokens, in boolean measureTiming, in long deadlineNs, in long loopTimeoutDurationNs);
+ void releaseMemoryResource(in long memoryIdentifierToken);
}
diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IDevice.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IDevice.aidl
new file mode 100644
index 0000000..c9c67f2
--- /dev/null
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IDevice.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.neuralnetworks;
+@VintfStability
+interface IDevice {
+ android.hardware.neuralnetworks.DeviceBuffer allocate(in android.hardware.neuralnetworks.BufferDesc desc, in android.hardware.neuralnetworks.IPreparedModelParcel[] preparedModels, in android.hardware.neuralnetworks.BufferRole[] inputRoles, in android.hardware.neuralnetworks.BufferRole[] outputRoles);
+ android.hardware.neuralnetworks.Capabilities getCapabilities();
+ android.hardware.neuralnetworks.NumberOfCacheFiles getNumberOfCacheFilesNeeded();
+ android.hardware.neuralnetworks.Extension[] getSupportedExtensions();
+ boolean[] getSupportedOperations(in android.hardware.neuralnetworks.Model model);
+ android.hardware.neuralnetworks.DeviceType getType();
+ String getVersionString();
+ void prepareModel(in android.hardware.neuralnetworks.Model model, in android.hardware.neuralnetworks.ExecutionPreference preference, in android.hardware.neuralnetworks.Priority priority, in long deadlineNs, in ParcelFileDescriptor[] modelCache, in ParcelFileDescriptor[] dataCache, in byte[] token, in android.hardware.neuralnetworks.IPreparedModelCallback callback);
+ void prepareModelFromCache(in long deadlineNs, in ParcelFileDescriptor[] modelCache, in ParcelFileDescriptor[] dataCache, in byte[] token, in android.hardware.neuralnetworks.IPreparedModelCallback callback);
+ const int BYTE_SIZE_OF_CACHE_TOKEN = 32;
+ const int MAX_NUMBER_OF_CACHE_FILES = 32;
+ const int EXTENSION_TYPE_HIGH_BITS_PREFIX = 15;
+ const int EXTENSION_TYPE_LOW_BITS_TYPE = 16;
+ const int OPERAND_TYPE_BASE_MAX = 65535;
+ const int OPERATION_TYPE_BASE_MAX = 65535;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IFencedExecutionCallback.aidl
similarity index 83%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IFencedExecutionCallback.aidl
index d7eecbb..0bfb80a 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IFencedExecutionCallback.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,8 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+interface IFencedExecutionCallback {
+ android.hardware.neuralnetworks.ErrorStatus getExecutionInfo(out android.hardware.neuralnetworks.Timing timingLaunched, out android.hardware.neuralnetworks.Timing timingFenced);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModel.aidl
similarity index 67%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModel.aidl
index 0c6c513..fccb5dc 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModel.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,15 +31,12 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapResultCode {
- SUCCESS = 0,
- GENERIC_FAILURE = 1,
- CARD_NOT_ACCESSSIBLE = 2,
- CARD_ALREADY_POWERED_OFF = 3,
- CARD_REMOVED = 4,
- CARD_ALREADY_POWERED_ON = 5,
- DATA_NOT_AVAILABLE = 6,
- NOT_SUPPORTED = 7,
+package android.hardware.neuralnetworks;
+@VintfStability
+interface IPreparedModel {
+ android.hardware.neuralnetworks.ExecutionResult executeSynchronously(in android.hardware.neuralnetworks.Request request, in boolean measureTiming, in long deadlineNs, in long loopTimeoutDurationNs);
+ android.hardware.neuralnetworks.FencedExecutionResult executeFenced(in android.hardware.neuralnetworks.Request request, in ParcelFileDescriptor[] waitFor, in boolean measureTiming, in long deadlineNs, in long loopTimeoutDurationNs, in long durationNs);
+ android.hardware.neuralnetworks.IBurst configureExecutionBurst();
+ const long DEFAULT_LOOP_TIMEOUT_DURATION_NS = 2000000000;
+ const long MAXIMUM_LOOP_TIMEOUT_DURATION_NS = 15000000000;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModelCallback.aidl
similarity index 85%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModelCallback.aidl
index d7eecbb..e0c763b 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModelCallback.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,8 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+interface IPreparedModelCallback {
+ void notify(in android.hardware.neuralnetworks.ErrorStatus status, in android.hardware.neuralnetworks.IPreparedModel preparedModel);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModelParcel.aidl
similarity index 88%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModelParcel.aidl
index 6eadbb7..dbedf12 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/IPreparedModelParcel.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,8 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable IPreparedModelParcel {
+ android.hardware.neuralnetworks.IPreparedModel preparedModel;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Memory.aidl
similarity index 85%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Memory.aidl
index d7eecbb..37fa102 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Memory.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+union Memory {
+ android.hardware.common.Ashmem ashmem;
+ android.hardware.common.MappableFile mappableFile;
+ android.hardware.graphics.common.HardwareBuffer hardwareBuffer;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Model.aidl
similarity index 79%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Model.aidl
index d7eecbb..30d8dda 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Model.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,13 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable Model {
+ android.hardware.neuralnetworks.Subgraph main;
+ android.hardware.neuralnetworks.Subgraph[] referenced;
+ byte[] operandValues;
+ android.hardware.neuralnetworks.Memory[] pools;
+ boolean relaxComputationFloat32toFloat16;
+ android.hardware.neuralnetworks.ExtensionNameAndPrefix[] extensionNameToPrefix;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/NumberOfCacheFiles.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/NumberOfCacheFiles.aidl
index 6eadbb7..9314760 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/NumberOfCacheFiles.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable NumberOfCacheFiles {
+ int numModelCache;
+ int numDataCache;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Operand.aidl
similarity index 75%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Operand.aidl
index d7eecbb..1d9bdd8 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Operand.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,14 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable Operand {
+ android.hardware.neuralnetworks.OperandType type = android.hardware.neuralnetworks.OperandType.FLOAT32;
+ int[] dimensions;
+ float scale;
+ int zeroPoint;
+ android.hardware.neuralnetworks.OperandLifeTime lifetime = android.hardware.neuralnetworks.OperandLifeTime.TEMPORARY_VARIABLE;
+ android.hardware.neuralnetworks.DataLocation location;
+ @nullable android.hardware.neuralnetworks.OperandExtraParams extraParams;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandExtraParams.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandExtraParams.aidl
index d7eecbb..14792cf 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandExtraParams.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+union OperandExtraParams {
+ android.hardware.neuralnetworks.SymmPerChannelQuantParams channelQuant;
+ byte[] extension;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandLifeTime.aidl
similarity index 85%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandLifeTime.aidl
index 6eadbb7..40adfb1 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandLifeTime.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,14 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
+package android.hardware.neuralnetworks;
@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+enum OperandLifeTime {
+ TEMPORARY_VARIABLE = 0,
+ SUBGRAPH_INPUT = 1,
+ SUBGRAPH_OUTPUT = 2,
+ CONSTANT_COPY = 3,
+ CONSTANT_POOL = 4,
+ NO_VALUE = 5,
+ SUBGRAPH = 6,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandPerformance.aidl
similarity index 84%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandPerformance.aidl
index d7eecbb..ebb361b 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandPerformance.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable OperandPerformance {
+ android.hardware.neuralnetworks.OperandType type = android.hardware.neuralnetworks.OperandType.FLOAT32;
+ android.hardware.neuralnetworks.PerformanceInfo info;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandType.aidl
similarity index 77%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandType.aidl
index 0c6c513..9f2c759 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapResultCode.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperandType.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,15 +31,23 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
+package android.hardware.neuralnetworks;
@Backing(type="int") @VintfStability
-enum SapResultCode {
- SUCCESS = 0,
- GENERIC_FAILURE = 1,
- CARD_NOT_ACCESSSIBLE = 2,
- CARD_ALREADY_POWERED_OFF = 3,
- CARD_REMOVED = 4,
- CARD_ALREADY_POWERED_ON = 5,
- DATA_NOT_AVAILABLE = 6,
- NOT_SUPPORTED = 7,
+enum OperandType {
+ FLOAT32 = 0,
+ INT32 = 1,
+ UINT32 = 2,
+ TENSOR_FLOAT32 = 3,
+ TENSOR_INT32 = 4,
+ TENSOR_QUANT8_ASYMM = 5,
+ BOOL = 6,
+ TENSOR_QUANT16_SYMM = 7,
+ TENSOR_FLOAT16 = 8,
+ TENSOR_BOOL8 = 9,
+ FLOAT16 = 10,
+ TENSOR_QUANT8_SYMM_PER_CHANNEL = 11,
+ TENSOR_QUANT16_ASYMM = 12,
+ TENSOR_QUANT8_SYMM = 13,
+ TENSOR_QUANT8_ASYMM_SIGNED = 14,
+ SUBGRAPH = 15,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Operation.aidl
similarity index 85%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Operation.aidl
index 6eadbb7..a4a3fbe 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Operation.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable Operation {
+ android.hardware.neuralnetworks.OperationType type = android.hardware.neuralnetworks.OperationType.ADD;
+ int[] inputs;
+ int[] outputs;
}
diff --git a/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperationType.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperationType.aidl
new file mode 100644
index 0000000..2eff11b
--- /dev/null
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OperationType.aidl
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <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.neuralnetworks;
+@Backing(type="int") @VintfStability
+enum OperationType {
+ ADD = 0,
+ AVERAGE_POOL_2D = 1,
+ CONCATENATION = 2,
+ CONV_2D = 3,
+ DEPTHWISE_CONV_2D = 4,
+ DEPTH_TO_SPACE = 5,
+ DEQUANTIZE = 6,
+ EMBEDDING_LOOKUP = 7,
+ FLOOR = 8,
+ FULLY_CONNECTED = 9,
+ HASHTABLE_LOOKUP = 10,
+ L2_NORMALIZATION = 11,
+ L2_POOL_2D = 12,
+ LOCAL_RESPONSE_NORMALIZATION = 13,
+ LOGISTIC = 14,
+ LSH_PROJECTION = 15,
+ LSTM = 16,
+ MAX_POOL_2D = 17,
+ MUL = 18,
+ RELU = 19,
+ RELU1 = 20,
+ RELU6 = 21,
+ RESHAPE = 22,
+ RESIZE_BILINEAR = 23,
+ RNN = 24,
+ SOFTMAX = 25,
+ SPACE_TO_DEPTH = 26,
+ SVDF = 27,
+ TANH = 28,
+ BATCH_TO_SPACE_ND = 29,
+ DIV = 30,
+ MEAN = 31,
+ PAD = 32,
+ SPACE_TO_BATCH_ND = 33,
+ SQUEEZE = 34,
+ STRIDED_SLICE = 35,
+ SUB = 36,
+ TRANSPOSE = 37,
+ ABS = 38,
+ ARGMAX = 39,
+ ARGMIN = 40,
+ AXIS_ALIGNED_BBOX_TRANSFORM = 41,
+ BIDIRECTIONAL_SEQUENCE_LSTM = 42,
+ BIDIRECTIONAL_SEQUENCE_RNN = 43,
+ BOX_WITH_NMS_LIMIT = 44,
+ CAST = 45,
+ CHANNEL_SHUFFLE = 46,
+ DETECTION_POSTPROCESSING = 47,
+ EQUAL = 48,
+ EXP = 49,
+ EXPAND_DIMS = 50,
+ GATHER = 51,
+ GENERATE_PROPOSALS = 52,
+ GREATER = 53,
+ GREATER_EQUAL = 54,
+ GROUPED_CONV_2D = 55,
+ HEATMAP_MAX_KEYPOINT = 56,
+ INSTANCE_NORMALIZATION = 57,
+ LESS = 58,
+ LESS_EQUAL = 59,
+ LOG = 60,
+ LOGICAL_AND = 61,
+ LOGICAL_NOT = 62,
+ LOGICAL_OR = 63,
+ LOG_SOFTMAX = 64,
+ MAXIMUM = 65,
+ MINIMUM = 66,
+ NEG = 67,
+ NOT_EQUAL = 68,
+ PAD_V2 = 69,
+ POW = 70,
+ PRELU = 71,
+ QUANTIZE = 72,
+ QUANTIZED_16BIT_LSTM = 73,
+ RANDOM_MULTINOMIAL = 74,
+ REDUCE_ALL = 75,
+ REDUCE_ANY = 76,
+ REDUCE_MAX = 77,
+ REDUCE_MIN = 78,
+ REDUCE_PROD = 79,
+ REDUCE_SUM = 80,
+ ROI_ALIGN = 81,
+ ROI_POOLING = 82,
+ RSQRT = 83,
+ SELECT = 84,
+ SIN = 85,
+ SLICE = 86,
+ SPLIT = 87,
+ SQRT = 88,
+ TILE = 89,
+ TOPK_V2 = 90,
+ TRANSPOSE_CONV_2D = 91,
+ UNIDIRECTIONAL_SEQUENCE_LSTM = 92,
+ UNIDIRECTIONAL_SEQUENCE_RNN = 93,
+ RESIZE_NEAREST_NEIGHBOR = 94,
+ QUANTIZED_LSTM = 95,
+ IF = 96,
+ WHILE = 97,
+ ELU = 98,
+ HARD_SWISH = 99,
+ FILL = 100,
+ RANK = 101,
+ BATCH_MATMUL = 102,
+ PACK = 103,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OutputShape.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OutputShape.aidl
index 6eadbb7..f733505 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/OutputShape.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable OutputShape {
+ int[] dimensions;
+ boolean isSufficient;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/PerformanceInfo.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/PerformanceInfo.aidl
index 6eadbb7..04910f5 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/PerformanceInfo.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable PerformanceInfo {
+ float execTime;
+ float powerUsage;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Priority.aidl
similarity index 91%
rename from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
rename to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Priority.aidl
index 6eadbb7..8f35709 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Priority.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
+package android.hardware.neuralnetworks;
@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+enum Priority {
+ LOW = 0,
+ MEDIUM = 1,
+ HIGH = 2,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Request.aidl
similarity index 84%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Request.aidl
index d7eecbb..39ec7a9 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Request.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable Request {
+ android.hardware.neuralnetworks.RequestArgument[] inputs;
+ android.hardware.neuralnetworks.RequestArgument[] outputs;
+ android.hardware.neuralnetworks.RequestMemoryPool[] pools;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/RequestArgument.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/RequestArgument.aidl
index d7eecbb..e3541c0 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/RequestArgument.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,10 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable RequestArgument {
+ boolean hasNoValue;
+ android.hardware.neuralnetworks.DataLocation location;
+ int[] dimensions;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/RequestMemoryPool.aidl
similarity index 89%
rename from radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl
rename to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/RequestMemoryPool.aidl
index a03f519..312f581 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityOperatorNames.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/RequestMemoryPool.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.network;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CellIdentityOperatorNames {
- String alphaLong;
- String alphaShort;
+union RequestMemoryPool {
+ android.hardware.neuralnetworks.Memory pool;
+ int token;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Subgraph.aidl
similarity index 85%
copy from radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Subgraph.aidl
index d7eecbb..b7d4451 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Subgraph.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,8 +31,11 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio.voice;
+package android.hardware.neuralnetworks;
@VintfStability
-parcelable CdmaInformationRecords {
- android.hardware.radio.voice.CdmaInformationRecord[] infoRec;
+parcelable Subgraph {
+ android.hardware.neuralnetworks.Operand[] operands;
+ android.hardware.neuralnetworks.Operation[] operations;
+ int[] inputIndexes;
+ int[] outputIndexes;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/SymmPerChannelQuantParams.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/SymmPerChannelQuantParams.aidl
index 6eadbb7..02d68f9 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/SymmPerChannelQuantParams.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable SymmPerChannelQuantParams {
+ float[] scales;
+ int channelDim;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Timing.aidl
similarity index 89%
copy from radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
copy to neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Timing.aidl
index 6eadbb7..bcc83cf 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapTransferProtocol.aidl
+++ b/neuralnetworks/aidl/aidl_api/android.hardware.neuralnetworks/2/android/hardware/neuralnetworks/Timing.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,9 +31,9 @@
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
-package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum SapTransferProtocol {
- T0 = 0,
- T1 = 1,
+package android.hardware.neuralnetworks;
+@VintfStability
+parcelable Timing {
+ long timeOnDeviceNs;
+ long timeInDriverNs;
}
diff --git a/neuralnetworks/aidl/utils/Android.bp b/neuralnetworks/aidl/utils/Android.bp
index 2ff7534..bf8fc2d 100644
--- a/neuralnetworks/aidl/utils/Android.bp
+++ b/neuralnetworks/aidl/utils/Android.bp
@@ -23,8 +23,8 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
-cc_library_static {
- name: "neuralnetworks_utils_hal_aidl",
+cc_defaults {
+ name: "neuralnetworks_utils_hal_aidl_defaults",
defaults: ["neuralnetworks_utils_defaults"],
srcs: ["src/*"],
local_include_dirs: ["include/nnapi/hal/aidl/"],
@@ -38,7 +38,6 @@
"neuralnetworks_utils_hal_common",
],
shared_libs: [
- "android.hardware.neuralnetworks-V2-ndk",
"libbinder_ndk",
],
target: {
@@ -48,21 +47,49 @@
},
}
-cc_test {
- name: "neuralnetworks_utils_hal_aidl_test",
- defaults: ["neuralnetworks_utils_defaults"],
- srcs: [
- "test/*.cpp",
+cc_library_static {
+ name: "neuralnetworks_utils_hal_aidl_v1",
+ defaults: ["neuralnetworks_utils_hal_aidl_defaults"],
+ shared_libs: [
+ "android.hardware.neuralnetworks-V1-ndk",
],
+}
+
+cc_library_static {
+ name: "neuralnetworks_utils_hal_aidl",
+ defaults: ["neuralnetworks_utils_hal_aidl_defaults"],
+ shared_libs: [
+ "android.hardware.neuralnetworks-V2-ndk",
+ ],
+}
+
+// A cc_defaults that includes the latest non-experimental AIDL utilities and other AIDL libraries
+// that are commonly used together. Modules that always depend on the latest non-experimental
+// AIDL features can include this cc_defaults to avoid managing dependency versions explicitly.
+cc_defaults {
+ name: "neuralnetworks_use_latest_utils_hal_aidl",
static_libs: [
"android.hardware.common-V2-ndk",
"android.hardware.graphics.common-V2-ndk",
"android.hardware.neuralnetworks-V2-ndk",
+ "neuralnetworks_utils_hal_aidl",
+ ],
+}
+
+cc_test {
+ name: "neuralnetworks_utils_hal_aidl_test",
+ defaults: [
+ "neuralnetworks_use_latest_utils_hal_aidl",
+ "neuralnetworks_utils_defaults",
+ ],
+ srcs: [
+ "test/*.cpp",
+ ],
+ static_libs: [
"libaidlcommonsupport",
"libgmock",
"libneuralnetworks_common",
"neuralnetworks_types",
- "neuralnetworks_utils_hal_aidl",
"neuralnetworks_utils_hal_common",
],
shared_libs: [
diff --git a/neuralnetworks/aidl/utils/OWNERS b/neuralnetworks/aidl/utils/OWNERS
deleted file mode 100644
index e4feee3..0000000
--- a/neuralnetworks/aidl/utils/OWNERS
+++ /dev/null
@@ -1,11 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-galarragas@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/BufferTracker.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/BufferTracker.h
new file mode 100644
index 0000000..18d01e2
--- /dev/null
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/BufferTracker.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_BUFFER_TRACKER_H
+#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_BUFFER_TRACKER_H
+
+#include <android-base/macros.h>
+#include <android-base/thread_annotations.h>
+
+#include <map>
+#include <memory>
+#include <mutex>
+#include <set>
+#include <stack>
+#include <utility>
+#include <vector>
+
+#include "nnapi/hal/aidl/HalInterfaces.h"
+#include "nnapi/hal/aidl/ValidateHal.h"
+
+namespace android::nn {
+
+// This class manages a CPU buffer allocated on heap and provides validation methods.
+class AidlManagedBuffer {
+ public:
+ static std::shared_ptr<AidlManagedBuffer> create(uint32_t size,
+ std::set<AidlHalPreparedModelRole> roles,
+ const Operand& operand);
+
+ // Prefer AidlManagedBuffer::create.
+ AidlManagedBuffer(std::unique_ptr<uint8_t[]> buffer, uint32_t size,
+ std::set<AidlHalPreparedModelRole> roles, const Operand& operand);
+
+ uint8_t* getPointer() const { return kBuffer.get(); }
+ uint32_t getSize() const { return kSize; }
+
+ // "poolIndex" is the index of this buffer in the request.pools.
+ ErrorStatus validateRequest(uint32_t poolIndex, const Request& request,
+ const aidl_hal::IPreparedModel* preparedModel) const;
+
+ // "size" is the byte size of the Memory provided to the copyFrom or copyTo method.
+ ErrorStatus validateCopyFrom(const std::vector<uint32_t>& dimensions, uint32_t size) const;
+ ErrorStatus validateCopyTo(uint32_t size) const;
+
+ bool updateDimensions(const std::vector<uint32_t>& dimensions);
+ void setInitialized(bool initialized);
+
+ private:
+ mutable std::mutex mMutex;
+ const std::unique_ptr<uint8_t[]> kBuffer;
+ const uint32_t kSize;
+ const std::set<AidlHalPreparedModelRole> kRoles;
+ const OperandType kOperandType;
+ const std::vector<uint32_t> kInitialDimensions;
+ std::vector<uint32_t> mUpdatedDimensions GUARDED_BY(mMutex);
+ bool mInitialized GUARDED_BY(mMutex) = false;
+};
+
+// Keep track of all AidlManagedBuffers and assign each with a unique token.
+class AidlBufferTracker : public std::enable_shared_from_this<AidlBufferTracker> {
+ DISALLOW_COPY_AND_ASSIGN(AidlBufferTracker);
+
+ public:
+ // A RAII class to help manage the lifetime of the token.
+ // It is only supposed to be constructed in AidlBufferTracker::add.
+ class Token {
+ DISALLOW_COPY_AND_ASSIGN(Token);
+
+ public:
+ Token(uint32_t token, std::shared_ptr<AidlBufferTracker> tracker)
+ : kToken(token), kBufferTracker(std::move(tracker)) {}
+ ~Token() { kBufferTracker->free(kToken); }
+ uint32_t get() const { return kToken; }
+
+ private:
+ const uint32_t kToken;
+ const std::shared_ptr<AidlBufferTracker> kBufferTracker;
+ };
+
+ // The factory of AidlBufferTracker. This ensures that the AidlBufferTracker is always managed
+ // by a shared_ptr.
+ static std::shared_ptr<AidlBufferTracker> create() {
+ return std::make_shared<AidlBufferTracker>();
+ }
+
+ // Prefer AidlBufferTracker::create.
+ AidlBufferTracker() : mTokenToBuffers(1) {}
+
+ std::unique_ptr<Token> add(std::shared_ptr<AidlManagedBuffer> buffer);
+ std::shared_ptr<AidlManagedBuffer> get(uint32_t token) const;
+
+ private:
+ void free(uint32_t token);
+
+ mutable std::mutex mMutex;
+ std::stack<uint32_t, std::vector<uint32_t>> mFreeTokens GUARDED_BY(mMutex);
+
+ // Since the tokens are allocated in a non-sparse way, we use a vector to represent the mapping.
+ // The index of the vector is the token. When the token gets freed, the corresponding entry is
+ // set to nullptr. mTokenToBuffers[0] is always set to nullptr because 0 is an invalid token.
+ std::vector<std::shared_ptr<AidlManagedBuffer>> mTokenToBuffers GUARDED_BY(mMutex);
+};
+
+} // namespace android::nn
+
+#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_BUFFER_TRACKER_H
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h
index 1457646..d558f66 100644
--- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Device.h
@@ -43,11 +43,12 @@
public:
static nn::GeneralResult<std::shared_ptr<const Device>> create(
- std::string name, std::shared_ptr<aidl_hal::IDevice> device);
+ std::string name, std::shared_ptr<aidl_hal::IDevice> device, nn::Version featureLevel);
Device(PrivateConstructorTag tag, std::string name, std::string versionString,
- nn::DeviceType deviceType, std::vector<nn::Extension> extensions,
- nn::Capabilities capabilities, std::pair<uint32_t, uint32_t> numberOfCacheFilesNeeded,
+ nn::Version featureLevel, nn::DeviceType deviceType,
+ std::vector<nn::Extension> extensions, nn::Capabilities capabilities,
+ std::pair<uint32_t, uint32_t> numberOfCacheFilesNeeded,
std::shared_ptr<aidl_hal::IDevice> device, DeathHandler deathHandler);
const std::string& getName() const override;
@@ -84,6 +85,7 @@
private:
const std::string kName;
const std::string kVersionString;
+ const nn::Version kFeatureLevel;
const nn::DeviceType kDeviceType;
const std::vector<nn::Extension> kExtensions;
const nn::Capabilities kCapabilities;
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/HalInterfaces.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/HalInterfaces.h
new file mode 100644
index 0000000..3fb443c
--- /dev/null
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/HalInterfaces.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_HAL_INTERFACES_H
+#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_HAL_INTERFACES_H
+
+#include <aidl/android/hardware/neuralnetworks/BnBuffer.h>
+#include <aidl/android/hardware/neuralnetworks/BnBurst.h>
+#include <aidl/android/hardware/neuralnetworks/BnDevice.h>
+#include <aidl/android/hardware/neuralnetworks/BnFencedExecutionCallback.h>
+#include <aidl/android/hardware/neuralnetworks/BnPreparedModel.h>
+#include <aidl/android/hardware/neuralnetworks/BnPreparedModelCallback.h>
+#include <aidl/android/hardware/neuralnetworks/BufferDesc.h>
+#include <aidl/android/hardware/neuralnetworks/BufferRole.h>
+#include <aidl/android/hardware/neuralnetworks/Capabilities.h>
+#include <aidl/android/hardware/neuralnetworks/DataLocation.h>
+#include <aidl/android/hardware/neuralnetworks/DeviceBuffer.h>
+#include <aidl/android/hardware/neuralnetworks/DeviceType.h>
+#include <aidl/android/hardware/neuralnetworks/ErrorStatus.h>
+#include <aidl/android/hardware/neuralnetworks/ExecutionPreference.h>
+#include <aidl/android/hardware/neuralnetworks/Extension.h>
+#include <aidl/android/hardware/neuralnetworks/ExtensionNameAndPrefix.h>
+#include <aidl/android/hardware/neuralnetworks/ExtensionOperandTypeInformation.h>
+#include <aidl/android/hardware/neuralnetworks/FusedActivationFunc.h>
+#include <aidl/android/hardware/neuralnetworks/IBuffer.h>
+#include <aidl/android/hardware/neuralnetworks/IDevice.h>
+#include <aidl/android/hardware/neuralnetworks/IFencedExecutionCallback.h>
+#include <aidl/android/hardware/neuralnetworks/IPreparedModel.h>
+#include <aidl/android/hardware/neuralnetworks/IPreparedModelCallback.h>
+#include <aidl/android/hardware/neuralnetworks/IPreparedModelParcel.h>
+#include <aidl/android/hardware/neuralnetworks/Memory.h>
+#include <aidl/android/hardware/neuralnetworks/Model.h>
+#include <aidl/android/hardware/neuralnetworks/NumberOfCacheFiles.h>
+#include <aidl/android/hardware/neuralnetworks/Operand.h>
+#include <aidl/android/hardware/neuralnetworks/OperandExtraParams.h>
+#include <aidl/android/hardware/neuralnetworks/OperandLifeTime.h>
+#include <aidl/android/hardware/neuralnetworks/OperandPerformance.h>
+#include <aidl/android/hardware/neuralnetworks/OperandType.h>
+#include <aidl/android/hardware/neuralnetworks/Operation.h>
+#include <aidl/android/hardware/neuralnetworks/OperationType.h>
+#include <aidl/android/hardware/neuralnetworks/OutputShape.h>
+#include <aidl/android/hardware/neuralnetworks/PerformanceInfo.h>
+#include <aidl/android/hardware/neuralnetworks/Priority.h>
+#include <aidl/android/hardware/neuralnetworks/Request.h>
+#include <aidl/android/hardware/neuralnetworks/RequestArgument.h>
+#include <aidl/android/hardware/neuralnetworks/RequestMemoryPool.h>
+#include <aidl/android/hardware/neuralnetworks/Subgraph.h>
+#include <aidl/android/hardware/neuralnetworks/SymmPerChannelQuantParams.h>
+#include <aidl/android/hardware/neuralnetworks/Timing.h>
+
+namespace android::nn {
+
+namespace aidl_hal = ::aidl::android::hardware::neuralnetworks;
+
+inline constexpr aidl_hal::Priority kDefaultPriorityAidl = aidl_hal::Priority::MEDIUM;
+
+} // namespace android::nn
+
+#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_HAL_INTERFACES_H
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/HalUtils.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/HalUtils.h
new file mode 100644
index 0000000..89552bc
--- /dev/null
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/HalUtils.h
@@ -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.
+ */
+
+#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_HAL_UTILS_H
+#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_HAL_UTILS_H
+
+#include <vector>
+
+#include "nnapi/hal/aidl/HalInterfaces.h"
+
+namespace android {
+namespace nn {
+
+// Return a vector with one entry for each non-extension OperandType except
+// SUBGRAPH, set to the specified PerformanceInfo value. The vector will be
+// sorted by OperandType.
+//
+// Control flow (OperandType::SUBGRAPH) operation performance is specified
+// separately using Capabilities::ifPerformance and
+// Capabilities::whilePerformance.
+std::vector<aidl_hal::OperandPerformance> nonExtensionOperandPerformance(
+ aidl_hal::PerformanceInfo perf);
+
+// Update the vector entry corresponding to the specified OperandType with the
+// specified PerformanceInfo value. The vector must already have an entry for
+// that OperandType, and must be sorted by OperandType.
+void update(std::vector<aidl_hal::OperandPerformance>* operandPerformance,
+ aidl_hal::OperandType type, aidl_hal::PerformanceInfo perf);
+
+// Returns true if an operand type is an extension type.
+bool isExtensionOperandType(aidl_hal::OperandType type);
+
+// Returns true if an operand type is a scalar type.
+bool isNonExtensionScalar(aidl_hal::OperandType type);
+
+} // namespace nn
+} // namespace android
+
+#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_HAL_UTILS_H
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Utils.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Utils.h
index f2ab479..b4e747e 100644
--- a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Utils.h
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/Utils.h
@@ -19,6 +19,7 @@
#include "nnapi/hal/aidl/Conversions.h"
+#include <aidl/android/hardware/neuralnetworks/IDevice.h>
#include <android-base/logging.h>
#include <nnapi/Result.h>
#include <nnapi/TypeUtils.h>
@@ -28,7 +29,19 @@
namespace aidl::android::hardware::neuralnetworks::utils {
constexpr auto kDefaultPriority = Priority::MEDIUM;
-constexpr auto kVersion = nn::Version::FEATURE_LEVEL_6;
+
+constexpr std::optional<nn::Version> aidlVersionToCanonicalVersion(int aidlVersion) {
+ switch (aidlVersion) {
+ case 1:
+ return nn::kVersionFeatureLevel5;
+ case 2:
+ return nn::kVersionFeatureLevel6;
+ default:
+ return std::nullopt;
+ }
+}
+
+constexpr auto kVersion = aidlVersionToCanonicalVersion(IDevice::version).value();
template <typename Type>
nn::Result<void> validate(const Type& halObject) {
@@ -51,7 +64,7 @@
template <typename Type>
nn::Result<void> compliantVersion(const Type& canonical) {
const auto version = NN_TRY(nn::validate(canonical));
- if (version > kVersion) {
+ if (!nn::isCompliantVersion(version, kVersion)) {
return NN_ERROR() << "Insufficient version: " << version << " vs required " << kVersion;
}
return {};
diff --git a/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ValidateHal.h b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ValidateHal.h
new file mode 100644
index 0000000..62aba31
--- /dev/null
+++ b/neuralnetworks/aidl/utils/include/nnapi/hal/aidl/ValidateHal.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_VALIDATE_HAL_H
+#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_VALIDATE_HAL_H
+
+#include "nnapi/hal/aidl/HalInterfaces.h"
+
+#include <memory>
+#include <set>
+#include <tuple>
+#include <vector>
+
+#include <nnapi/TypeUtils.h>
+#include <nnapi/Validation.h>
+
+namespace android {
+namespace nn {
+
+using AidlHalPreparedModelRole = std::tuple<const aidl_hal::IPreparedModel*, IOType, uint32_t>;
+
+bool validateMemoryDesc(
+ const aidl_hal::BufferDesc& desc,
+ const std::vector<std::shared_ptr<aidl_hal::IPreparedModel>>& preparedModels,
+ const std::vector<aidl_hal::BufferRole>& inputRoles,
+ const std::vector<aidl_hal::BufferRole>& outputRoles,
+ std::function<const aidl_hal::Model*(const std::shared_ptr<aidl_hal::IPreparedModel>&)>
+ getModel,
+ std::set<AidlHalPreparedModelRole>* preparedModelRoles, aidl_hal::Operand* combinedOperand);
+
+} // namespace nn
+} // namespace android
+
+#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_AIDL_UTILS_VALIDATE_HAL_H
diff --git a/neuralnetworks/aidl/utils/src/Buffer.cpp b/neuralnetworks/aidl/utils/src/Buffer.cpp
index c729a68..9af3c9e 100644
--- a/neuralnetworks/aidl/utils/src/Buffer.cpp
+++ b/neuralnetworks/aidl/utils/src/Buffer.cpp
@@ -22,7 +22,6 @@
#include "Conversions.h"
#include "Utils.h"
-#include "nnapi/hal/aidl/Conversions.h"
#include <memory>
#include <utility>
diff --git a/neuralnetworks/aidl/utils/src/BufferTracker.cpp b/neuralnetworks/aidl/utils/src/BufferTracker.cpp
new file mode 100644
index 0000000..94dc891
--- /dev/null
+++ b/neuralnetworks/aidl/utils/src/BufferTracker.cpp
@@ -0,0 +1,227 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BufferTracker.h"
+
+#include "HalInterfaces.h"
+
+#include <android-base/macros.h>
+#include <nnapi/TypeUtils.h>
+
+#include <memory>
+#include <mutex>
+#include <set>
+#include <stack>
+#include <utility>
+#include <vector>
+
+namespace android::nn {
+
+std::shared_ptr<AidlManagedBuffer> AidlManagedBuffer::create(
+ uint32_t size, std::set<AidlHalPreparedModelRole> roles, const Operand& operand) {
+ std::unique_ptr<uint8_t[]> buffer(new (std::nothrow) uint8_t[size]);
+ if (buffer == nullptr) {
+ return nullptr;
+ }
+ if (isExtension(operand.type)) {
+ LOG(ERROR) << "AidlManagedBuffer cannot handle extension operands.";
+ return nullptr;
+ }
+ return std::make_shared<AidlManagedBuffer>(std::move(buffer), size, std::move(roles), operand);
+}
+
+AidlManagedBuffer::AidlManagedBuffer(std::unique_ptr<uint8_t[]> buffer, uint32_t size,
+ std::set<AidlHalPreparedModelRole> roles,
+ const Operand& operand)
+ : kBuffer(std::move(buffer)),
+ kSize(size),
+ kRoles(std::move(roles)),
+ kOperandType(operand.type),
+ kInitialDimensions(operand.dimensions),
+ mUpdatedDimensions(operand.dimensions) {
+ CHECK(!isExtension(kOperandType));
+}
+
+ErrorStatus AidlManagedBuffer::validateRequest(
+ uint32_t poolIndex, const Request& request,
+ const aidl_hal::IPreparedModel* preparedModel) const {
+ CHECK_LT(poolIndex, request.pools.size());
+ CHECK(std::holds_alternative<Request::MemoryDomainToken>(request.pools[poolIndex]));
+ std::lock_guard<std::mutex> guard(mMutex);
+
+ bool usedAsInput = false, usedAsOutput = false;
+ for (uint32_t i = 0; i < request.inputs.size(); i++) {
+ if (request.inputs[i].lifetime != Request::Argument::LifeTime::POOL) continue;
+ if (request.inputs[i].location.poolIndex != poolIndex) continue;
+ // Validate if the input role is specified during allocation.
+ if (kRoles.count({preparedModel, IOType::INPUT, i}) == 0) {
+ LOG(ERROR) << "AidlManagedBuffer::validateRequest -- invalid buffer role.";
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ if (!mInitialized) {
+ LOG(ERROR)
+ << "AidlManagedBuffer::validateRequest -- using uninitialized buffer as input "
+ "request.";
+ return ErrorStatus::GENERAL_FAILURE;
+ }
+ auto combined = combineDimensions(mUpdatedDimensions, request.inputs[i].dimensions);
+ if (!combined.has_value()) {
+ LOG(ERROR) << "AidlManagedBuffer::validateRequest -- incompatible dimensions ("
+ << toString(mUpdatedDimensions) << " vs "
+ << toString(request.inputs[i].dimensions) << ")";
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ usedAsInput = true;
+ }
+ for (uint32_t i = 0; i < request.outputs.size(); i++) {
+ if (request.outputs[i].lifetime != Request::Argument::LifeTime::POOL) continue;
+ if (request.outputs[i].location.poolIndex != poolIndex) continue;
+ if (usedAsInput || usedAsOutput) {
+ LOG(ERROR) << "AidlManagedBuffer::validateRequest -- using the same device memory for "
+ "input/output or multiple outputs";
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ // Validate if the output role is specified during allocation.
+ if (kRoles.count({preparedModel, IOType::OUTPUT, i}) == 0) {
+ LOG(ERROR) << "AidlManagedBuffer::validateRequest -- invalid buffer role.";
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ auto combined = combineDimensions(kInitialDimensions, request.outputs[i].dimensions);
+ if (!combined.has_value()) {
+ LOG(ERROR) << "AidlManagedBuffer::validateRequest -- incompatible dimensions ("
+ << toString(kInitialDimensions) << " vs "
+ << toString(request.outputs[i].dimensions) << ")";
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ usedAsOutput = true;
+ }
+ return ErrorStatus::NONE;
+}
+
+ErrorStatus AidlManagedBuffer::validateCopyFrom(const std::vector<uint32_t>& dimensions,
+ uint32_t size) const {
+ if (size != kSize) {
+ LOG(ERROR) << "AidlManagedBuffer::validateCopyFrom -- invalid memory size: " << kSize
+ << " vs " << size;
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+
+ if (isNonExtensionScalar(kOperandType)) {
+ if (!dimensions.empty()) {
+ LOG(ERROR) << "AidlManagedBuffer::validateCopyFrom -- invalid dimensions for scalar "
+ "operand: "
+ << toString(dimensions);
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ return ErrorStatus::NONE;
+ }
+
+ if (dimensions.empty()) {
+ if (tensorHasUnspecifiedDimensions(kOperandType, kInitialDimensions)) {
+ LOG(ERROR) << "AidlManagedBuffer::validateCopyFrom -- the initial dimensions are not "
+ "fully "
+ "specified and no dimension update is provided: "
+ << toString(kInitialDimensions);
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ } else {
+ if (tensorHasUnspecifiedDimensions(kOperandType, dimensions)) {
+ LOG(ERROR) << "AidlManagedBuffer::validateCopyFrom -- the updated dimensions are not "
+ "fully "
+ "specified: "
+ << toString(dimensions);
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ }
+
+ const auto combined = combineDimensions(kInitialDimensions, dimensions);
+ if (!combined.has_value()) {
+ LOG(ERROR) << "AidlManagedBuffer::validateCopyFrom -- incompatible dimensions ("
+ << toString(kInitialDimensions) << " vs " << toString(dimensions) << ")";
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ return ErrorStatus::NONE;
+}
+
+ErrorStatus AidlManagedBuffer::validateCopyTo(uint32_t size) const {
+ if (size != kSize) {
+ LOG(ERROR) << "AidlManagedBuffer::validateCopyTo -- invalid memory size: " << kSize
+ << " vs " << size;
+ return ErrorStatus::INVALID_ARGUMENT;
+ }
+ std::lock_guard<std::mutex> guard(mMutex);
+ if (!mInitialized) {
+ LOG(ERROR) << "AidlManagedBuffer::validateCopyTo -- using uninitialized buffer as source.";
+ return ErrorStatus::GENERAL_FAILURE;
+ }
+ return ErrorStatus::NONE;
+}
+
+bool AidlManagedBuffer::updateDimensions(const std::vector<uint32_t>& dimensions) {
+ auto combined = combineDimensions(kInitialDimensions, dimensions);
+ if (!combined.has_value()) {
+ LOG(ERROR) << "AidlManagedBuffer::updateDimensions -- incompatible dimensions ("
+ << toString(kInitialDimensions) << " vs " << toString(dimensions) << ")";
+ return false;
+ }
+ std::lock_guard<std::mutex> guard(mMutex);
+ mUpdatedDimensions = std::move(combined).value();
+ return true;
+}
+
+void AidlManagedBuffer::setInitialized(bool initialized) {
+ std::lock_guard<std::mutex> guard(mMutex);
+ mInitialized = initialized;
+}
+
+std::unique_ptr<AidlBufferTracker::Token> AidlBufferTracker::add(
+ std::shared_ptr<AidlManagedBuffer> buffer) {
+ if (buffer == nullptr) {
+ return nullptr;
+ }
+ std::lock_guard<std::mutex> guard(mMutex);
+ uint32_t token = 0;
+ if (mFreeTokens.empty()) {
+ token = mTokenToBuffers.size();
+ mTokenToBuffers.push_back(std::move(buffer));
+ } else {
+ token = mFreeTokens.top();
+ mFreeTokens.pop();
+ mTokenToBuffers[token] = std::move(buffer);
+ }
+ VLOG(MEMORY) << "AidlBufferTracker::add -- new token = " << token;
+ return std::make_unique<Token>(token, shared_from_this());
+}
+
+std::shared_ptr<AidlManagedBuffer> AidlBufferTracker::get(uint32_t token) const {
+ std::lock_guard<std::mutex> guard(mMutex);
+ if (mTokenToBuffers.size() <= token || mTokenToBuffers[token] == nullptr) {
+ LOG(ERROR) << "AidlBufferTracker::get -- unknown token " << token;
+ return nullptr;
+ }
+ return mTokenToBuffers[token];
+}
+
+void AidlBufferTracker::free(uint32_t token) {
+ std::lock_guard<std::mutex> guard(mMutex);
+ CHECK_LT(token, mTokenToBuffers.size());
+ CHECK(mTokenToBuffers[token] != nullptr);
+ VLOG(MEMORY) << "AidlBufferTracker::free -- release token = " << token;
+ mTokenToBuffers[token] = nullptr;
+ mFreeTokens.push(token);
+}
+
+} // namespace android::nn
diff --git a/neuralnetworks/aidl/utils/src/Callbacks.cpp b/neuralnetworks/aidl/utils/src/Callbacks.cpp
index a321477..8084970 100644
--- a/neuralnetworks/aidl/utils/src/Callbacks.cpp
+++ b/neuralnetworks/aidl/utils/src/Callbacks.cpp
@@ -35,7 +35,8 @@
// Converts the results of IDevice::prepareModel* to the NN canonical format. On success, this
// function returns with a non-null nn::SharedPreparedModel with a feature level of
-// nn::Version::ANDROID_S. On failure, this function returns with the appropriate nn::GeneralError.
+// nn::kVersionFeatureLevel5. On failure, this function returns with the appropriate
+// nn::GeneralError.
nn::GeneralResult<nn::SharedPreparedModel> prepareModelCallback(
ErrorStatus status, const std::shared_ptr<IPreparedModel>& preparedModel) {
HANDLE_STATUS_AIDL(status) << "model preparation failed with " << toString(status);
diff --git a/neuralnetworks/aidl/utils/src/Device.cpp b/neuralnetworks/aidl/utils/src/Device.cpp
index e80de0b..5b7ec4e 100644
--- a/neuralnetworks/aidl/utils/src/Device.cpp
+++ b/neuralnetworks/aidl/utils/src/Device.cpp
@@ -125,7 +125,7 @@
} // namespace
nn::GeneralResult<std::shared_ptr<const Device>> Device::create(
- std::string name, std::shared_ptr<aidl_hal::IDevice> device) {
+ std::string name, std::shared_ptr<aidl_hal::IDevice> device, nn::Version featureLevel) {
if (name.empty()) {
return NN_ERROR(nn::ErrorStatus::INVALID_ARGUMENT)
<< "aidl_hal::utils::Device::create must have non-empty name";
@@ -143,18 +143,19 @@
auto deathHandler = NN_TRY(DeathHandler::create(device));
return std::make_shared<const Device>(
- PrivateConstructorTag{}, std::move(name), std::move(versionString), deviceType,
- std::move(extensions), std::move(capabilities), numberOfCacheFilesNeeded,
+ PrivateConstructorTag{}, std::move(name), std::move(versionString), featureLevel,
+ deviceType, std::move(extensions), std::move(capabilities), numberOfCacheFilesNeeded,
std::move(device), std::move(deathHandler));
}
Device::Device(PrivateConstructorTag /*tag*/, std::string name, std::string versionString,
- nn::DeviceType deviceType, std::vector<nn::Extension> extensions,
- nn::Capabilities capabilities,
+ nn::Version featureLevel, nn::DeviceType deviceType,
+ std::vector<nn::Extension> extensions, nn::Capabilities capabilities,
std::pair<uint32_t, uint32_t> numberOfCacheFilesNeeded,
std::shared_ptr<aidl_hal::IDevice> device, DeathHandler deathHandler)
: kName(std::move(name)),
kVersionString(std::move(versionString)),
+ kFeatureLevel(featureLevel),
kDeviceType(deviceType),
kExtensions(std::move(extensions)),
kCapabilities(std::move(capabilities)),
@@ -171,7 +172,7 @@
}
nn::Version Device::getFeatureLevel() const {
- return nn::Version::ANDROID_S;
+ return kFeatureLevel;
}
nn::DeviceType Device::getType() const {
diff --git a/neuralnetworks/aidl/utils/src/HalUtils.cpp b/neuralnetworks/aidl/utils/src/HalUtils.cpp
new file mode 100644
index 0000000..64b6259
--- /dev/null
+++ b/neuralnetworks/aidl/utils/src/HalUtils.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// This file contains pre-canonical-types utility code and includes HAL
+// utilities. LegacyUtils.h is the subset of these utilities that do not touch
+// HAL.
+
+#include "HalUtils.h"
+
+#include "HalInterfaces.h"
+
+#include <android-base/logging.h>
+#include <nnapi/TypeUtils.h>
+#include <nnapi/hal/aidl/Conversions.h>
+
+#include <algorithm>
+#include <iterator>
+#include <type_traits>
+#include <vector>
+
+namespace android::nn {
+
+std::vector<aidl_hal::OperandPerformance> nonExtensionOperandPerformance(
+ aidl_hal::PerformanceInfo perf) {
+ static constexpr ndk::enum_range<aidl_hal::OperandType> kOperandTypeRange;
+ std::vector<aidl_hal::OperandPerformance> ret;
+ ret.reserve(std::distance(kOperandTypeRange.begin(), kOperandTypeRange.end()));
+ for (aidl_hal::OperandType type : kOperandTypeRange) {
+ if (type != aidl_hal::OperandType::SUBGRAPH) {
+ ret.push_back(aidl_hal::OperandPerformance{type, perf});
+ }
+ }
+ std::sort(ret.begin(), ret.end(),
+ [](const aidl_hal::OperandPerformance& a, const aidl_hal::OperandPerformance& b) {
+ return a.type < b.type;
+ });
+
+ return ret;
+}
+
+void update(std::vector<aidl_hal::OperandPerformance>* operandPerformance,
+ aidl_hal::OperandType type, aidl_hal::PerformanceInfo perf) {
+ CHECK(operandPerformance != nullptr);
+ const auto it = std::lower_bound(operandPerformance->begin(), operandPerformance->end(), type,
+ [](const aidl_hal::OperandPerformance& perf,
+ aidl_hal::OperandType type) { return perf.type < type; });
+ CHECK(it != operandPerformance->end())
+ << toString(type) << " not in operand performance vector";
+ it->info = perf;
+}
+
+bool isExtensionOperandType(aidl_hal::OperandType type) {
+ return isExtension(convert(type).value());
+}
+
+bool isNonExtensionScalar(aidl_hal::OperandType type) {
+ return isNonExtensionScalar(convert(type).value());
+}
+
+} // namespace android::nn
diff --git a/neuralnetworks/aidl/utils/src/Service.cpp b/neuralnetworks/aidl/utils/src/Service.cpp
index ac182a2..e48593c 100644
--- a/neuralnetworks/aidl/utils/src/Service.cpp
+++ b/neuralnetworks/aidl/utils/src/Service.cpp
@@ -17,6 +17,7 @@
#include "Service.h"
#include <AndroidVersionUtil.h>
+#include <aidl/android/hardware/neuralnetworks/IDevice.h>
#include <android/binder_auto_utils.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
@@ -28,8 +29,31 @@
#include <string>
#include "Device.h"
+#include "Utils.h"
namespace aidl::android::hardware::neuralnetworks::utils {
+namespace {
+
+// Map the AIDL version of an IDevice to NNAPI canonical feature level.
+nn::GeneralResult<nn::Version> getAidlServiceFeatureLevel(IDevice* service) {
+ CHECK(service != nullptr);
+ int aidlVersion;
+ const auto ret = service->getInterfaceVersion(&aidlVersion);
+ HANDLE_ASTATUS(ret) << "getInterfaceVersion failed";
+
+ // For service AIDL versions greater than or equal to the AIDL library version that the runtime
+ // was built against, clamp it to the runtime AIDL library version.
+ aidlVersion = std::min(aidlVersion, IDevice::version);
+
+ // Map stable AIDL versions to canonical versions.
+ auto version = aidlVersionToCanonicalVersion(aidlVersion);
+ if (!version.has_value()) {
+ return NN_ERROR() << "Unknown AIDL service version: " << aidlVersion;
+ }
+ return version.value();
+}
+
+} // namespace
nn::GeneralResult<nn::SharedDevice> getDevice(const std::string& instanceName) {
auto fullName = std::string(IDevice::descriptor) + "/" + instanceName;
@@ -55,7 +79,8 @@
<< " returned nullptr";
}
ABinderProcess_startThreadPool();
- return Device::create(instanceName, std::move(service));
+ const auto featureLevel = NN_TRY(getAidlServiceFeatureLevel(service.get()));
+ return Device::create(instanceName, std::move(service), featureLevel);
};
return hal::utils::ResilientDevice::create(std::move(makeDevice));
diff --git a/neuralnetworks/aidl/utils/src/ValidateHal.cpp b/neuralnetworks/aidl/utils/src/ValidateHal.cpp
new file mode 100644
index 0000000..a56de21
--- /dev/null
+++ b/neuralnetworks/aidl/utils/src/ValidateHal.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "ValidateHal"
+
+#include "ValidateHal.h"
+
+#include "HalUtils.h"
+
+#include <android-base/logging.h>
+#include <nnapi/TypeUtils.h>
+#include <nnapi/hal/aidl/Conversions.h>
+
+#include <algorithm>
+#include <memory>
+#include <set>
+#include <utility>
+#include <vector>
+
+namespace android {
+namespace nn {
+
+bool validateMemoryDesc(
+ const aidl_hal::BufferDesc& desc,
+ const std::vector<std::shared_ptr<aidl_hal::IPreparedModel>>& preparedModels,
+ const std::vector<aidl_hal::BufferRole>& inputRoles,
+ const std::vector<aidl_hal::BufferRole>& outputRoles,
+ std::function<const aidl_hal::Model*(const std::shared_ptr<aidl_hal::IPreparedModel>&)>
+ getModel,
+ std::set<AidlHalPreparedModelRole>* preparedModelRoles,
+ aidl_hal::Operand* combinedOperand) {
+ NN_RET_CHECK(!preparedModels.empty());
+ NN_RET_CHECK(!inputRoles.empty() || !outputRoles.empty());
+
+ std::set<AidlHalPreparedModelRole> roles;
+ std::vector<aidl_hal::Operand> operands;
+ operands.reserve(inputRoles.size() + outputRoles.size());
+ for (const auto& role : inputRoles) {
+ NN_RET_CHECK_GE(role.modelIndex, 0);
+ NN_RET_CHECK_LT(static_cast<size_t>(role.modelIndex), preparedModels.size());
+ const auto& preparedModel = preparedModels[role.modelIndex];
+ NN_RET_CHECK(preparedModel != nullptr);
+ const auto* model = getModel(preparedModel);
+ NN_RET_CHECK(model != nullptr);
+ const auto& inputIndexes = model->main.inputIndexes;
+ NN_RET_CHECK_GE(role.ioIndex, 0);
+ NN_RET_CHECK_LT(static_cast<size_t>(role.ioIndex), inputIndexes.size());
+ NN_RET_CHECK_GT(role.probability, 0.0f);
+ NN_RET_CHECK_LE(role.probability, 1.0f);
+ const auto [it, success] = roles.emplace(preparedModel.get(), IOType::INPUT, role.ioIndex);
+ NN_RET_CHECK(success);
+ operands.push_back(model->main.operands[inputIndexes[role.ioIndex]]);
+ }
+ for (const auto& role : outputRoles) {
+ NN_RET_CHECK_GE(role.modelIndex, 0);
+ NN_RET_CHECK_LT(static_cast<size_t>(role.modelIndex), preparedModels.size());
+ const auto& preparedModel = preparedModels[role.modelIndex];
+ NN_RET_CHECK(preparedModel != nullptr);
+ const auto* model = getModel(preparedModel);
+ NN_RET_CHECK(model != nullptr);
+ const auto& outputIndexes = model->main.outputIndexes;
+ NN_RET_CHECK_GE(role.ioIndex, 0);
+ NN_RET_CHECK_LT(static_cast<size_t>(role.ioIndex), outputIndexes.size());
+ NN_RET_CHECK_GT(role.probability, 0.0f);
+ NN_RET_CHECK_LE(role.probability, 1.0f);
+ const auto [it, success] = roles.emplace(preparedModel.get(), IOType::OUTPUT, role.ioIndex);
+ NN_RET_CHECK(success);
+ operands.push_back(model->main.operands[outputIndexes[role.ioIndex]]);
+ }
+
+ CHECK(!operands.empty());
+ const auto opType = operands[0].type;
+ const auto canonicalOperandType = convert(opType);
+ NN_RET_CHECK(canonicalOperandType.has_value()) << canonicalOperandType.error().message;
+ const bool isExtensionOperand = isExtension(canonicalOperandType.value());
+
+ auto maybeDimensions = toUnsigned(desc.dimensions);
+ NN_RET_CHECK(maybeDimensions.has_value()) << maybeDimensions.error().message;
+ std::vector<uint32_t> dimensions = std::move(maybeDimensions).value();
+
+ for (const auto& operand : operands) {
+ NN_RET_CHECK(operand.type == operands[0].type)
+ << toString(operand.type) << " vs " << toString(operands[0].type);
+ NN_RET_CHECK_EQ(operand.scale, operands[0].scale);
+ NN_RET_CHECK_EQ(operand.zeroPoint, operands[0].zeroPoint);
+ // NOTE: validateMemoryDesc cannot validate extra parameters for extension operand type.
+ if (!isExtensionOperand) {
+ const auto& lhsExtraParams = operand.extraParams;
+ const auto& rhsExtraParams = operands[0].extraParams;
+ NN_RET_CHECK(lhsExtraParams == rhsExtraParams)
+ << (lhsExtraParams.has_value() ? lhsExtraParams.value().toString()
+ : "std::nullopt")
+ << " vs "
+ << (rhsExtraParams.has_value() ? rhsExtraParams.value().toString()
+ : "std::nullopt");
+ }
+ const auto maybeRhsDimensions = toUnsigned(operand.dimensions);
+ NN_RET_CHECK(maybeRhsDimensions.has_value()) << maybeRhsDimensions.error().message;
+ const auto combined = combineDimensions(dimensions, maybeRhsDimensions.value());
+ NN_RET_CHECK(combined.has_value());
+ dimensions = combined.value();
+ }
+
+ // NOTE: validateMemoryDesc cannot validate scalar dimensions with extension operand type.
+ if (!isExtensionOperand) {
+ NN_RET_CHECK(!isNonExtensionScalar(opType) || dimensions.empty())
+ << "invalid dimensions with scalar operand type.";
+ }
+
+ if (preparedModelRoles != nullptr) {
+ *preparedModelRoles = std::move(roles);
+ }
+ if (combinedOperand != nullptr) {
+ *combinedOperand = operands[0];
+ // No need to check that values fit int32_t here, since the original values are obtained
+ // from int32_t.
+ combinedOperand->dimensions = aidl_hal::utils::toSigned(dimensions).value();
+ }
+ return true;
+}
+
+} // namespace nn
+} // namespace android
diff --git a/neuralnetworks/aidl/utils/test/DeviceTest.cpp b/neuralnetworks/aidl/utils/test/DeviceTest.cpp
index f121aca..4e9fc46 100644
--- a/neuralnetworks/aidl/utils/test/DeviceTest.cpp
+++ b/neuralnetworks/aidl/utils/test/DeviceTest.cpp
@@ -146,28 +146,47 @@
return ndk::ScopedAStatus::fromStatus(STATUS_DEAD_OBJECT);
};
+class DeviceTest : public ::testing::TestWithParam<nn::Version> {
+ protected:
+ const nn::Version kVersion = GetParam();
+};
+
+std::string printDeviceTest(const testing::TestParamInfo<nn::Version>& info) {
+ const nn::Version version = info.param;
+ CHECK(!version.runtimeOnlyFeatures);
+ switch (version.level) {
+ case nn::Version::Level::FEATURE_LEVEL_5:
+ return "v1";
+ case nn::Version::Level::FEATURE_LEVEL_6:
+ return "v2";
+ default:
+ LOG(FATAL) << "Invalid AIDL version: " << version;
+ return "invalid";
+ }
+}
+
} // namespace
-TEST(DeviceTest, invalidName) {
+TEST_P(DeviceTest, invalidName) {
// run test
const auto device = MockDevice::create();
- const auto result = Device::create(kInvalidName, device);
+ const auto result = Device::create(kInvalidName, device, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::INVALID_ARGUMENT);
}
-TEST(DeviceTest, invalidDevice) {
+TEST_P(DeviceTest, invalidDevice) {
// run test
- const auto result = Device::create(kName, kInvalidDevice);
+ const auto result = Device::create(kName, kInvalidDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::INVALID_ARGUMENT);
}
-TEST(DeviceTest, getVersionStringError) {
+TEST_P(DeviceTest, getVersionStringError) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getVersionString(_))
@@ -175,14 +194,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getVersionStringTransportFailure) {
+TEST_P(DeviceTest, getVersionStringTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getVersionString(_))
@@ -190,14 +209,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getVersionStringDeadObject) {
+TEST_P(DeviceTest, getVersionStringDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getVersionString(_))
@@ -205,27 +224,27 @@
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, getTypeError) {
+TEST_P(DeviceTest, getTypeError) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getType(_)).Times(1).WillOnce(InvokeWithoutArgs(makeGeneralFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getTypeTransportFailure) {
+TEST_P(DeviceTest, getTypeTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getType(_))
@@ -233,14 +252,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getTypeDeadObject) {
+TEST_P(DeviceTest, getTypeDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getType(_))
@@ -248,14 +267,14 @@
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, getSupportedExtensionsError) {
+TEST_P(DeviceTest, getSupportedExtensionsError) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getSupportedExtensions(_))
@@ -263,14 +282,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getSupportedExtensionsTransportFailure) {
+TEST_P(DeviceTest, getSupportedExtensionsTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getSupportedExtensions(_))
@@ -278,14 +297,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getSupportedExtensionsDeadObject) {
+TEST_P(DeviceTest, getSupportedExtensionsDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getSupportedExtensions(_))
@@ -293,20 +312,20 @@
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, getNumberOfCacheFilesNeeded) {
+TEST_P(DeviceTest, getNumberOfCacheFilesNeeded) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)).Times(1);
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_TRUE(result.has_value());
@@ -315,7 +334,7 @@
EXPECT_EQ(result.value()->getNumberOfCacheFilesNeeded(), kNumberOfCacheFilesPair);
}
-TEST(DeviceTest, getNumberOfCacheFilesNeededError) {
+TEST_P(DeviceTest, getNumberOfCacheFilesNeededError) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_))
@@ -323,14 +342,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, dataCacheFilesExceedsSpecifiedMax) {
+TEST_P(DeviceTest, dataCacheFilesExceedsSpecifiedMax) {
// setup test
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_))
@@ -341,14 +360,14 @@
InvokeWithoutArgs(makeStatusOk)));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, modelCacheFilesExceedsSpecifiedMax) {
+TEST_P(DeviceTest, modelCacheFilesExceedsSpecifiedMax) {
// setup test
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_))
@@ -359,14 +378,14 @@
InvokeWithoutArgs(makeStatusOk)));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getNumberOfCacheFilesNeededTransportFailure) {
+TEST_P(DeviceTest, getNumberOfCacheFilesNeededTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_))
@@ -374,14 +393,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getNumberOfCacheFilesNeededDeadObject) {
+TEST_P(DeviceTest, getNumberOfCacheFilesNeededDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_))
@@ -389,14 +408,14 @@
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, getCapabilitiesError) {
+TEST_P(DeviceTest, getCapabilitiesError) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getCapabilities(_))
@@ -404,14 +423,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getCapabilitiesTransportFailure) {
+TEST_P(DeviceTest, getCapabilitiesTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getCapabilities(_))
@@ -419,14 +438,14 @@
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getCapabilitiesDeadObject) {
+TEST_P(DeviceTest, getCapabilitiesDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getCapabilities(_))
@@ -434,17 +453,17 @@
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
// run test
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
// verify result
ASSERT_FALSE(result.has_value());
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, getName) {
+TEST_P(DeviceTest, getName) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
// run test
const auto& name = device->getName();
@@ -453,19 +472,19 @@
EXPECT_EQ(name, kName);
}
-TEST(DeviceTest, getFeatureLevel) {
+TEST_P(DeviceTest, getFeatureLevel) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
// run test
const auto featureLevel = device->getFeatureLevel();
// verify result
- EXPECT_EQ(featureLevel, nn::Version::ANDROID_S);
+ EXPECT_EQ(featureLevel, kVersion);
}
-TEST(DeviceTest, getCachedData) {
+TEST_P(DeviceTest, getCachedData) {
// setup call
const auto mockDevice = createMockDevice();
EXPECT_CALL(*mockDevice, getVersionString(_)).Times(1);
@@ -474,7 +493,7 @@
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)).Times(1);
EXPECT_CALL(*mockDevice, getCapabilities(_)).Times(1);
- const auto result = Device::create(kName, mockDevice);
+ const auto result = Device::create(kName, mockDevice, kVersion);
ASSERT_TRUE(result.has_value())
<< "Failed with " << result.error().code << ": " << result.error().message;
const auto& device = result.value();
@@ -487,10 +506,10 @@
EXPECT_EQ(device->getCapabilities(), device->getCapabilities());
}
-TEST(DeviceTest, getSupportedOperations) {
+TEST_P(DeviceTest, getSupportedOperations) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, getSupportedOperations(_, _))
.Times(1)
.WillOnce(DoAll(
@@ -508,10 +527,10 @@
EXPECT_THAT(supportedOperations, Each(testing::IsTrue()));
}
-TEST(DeviceTest, getSupportedOperationsError) {
+TEST_P(DeviceTest, getSupportedOperationsError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, getSupportedOperations(_, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeGeneralFailure));
@@ -524,10 +543,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getSupportedOperationsTransportFailure) {
+TEST_P(DeviceTest, getSupportedOperationsTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, getSupportedOperations(_, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
@@ -540,10 +559,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, getSupportedOperationsDeadObject) {
+TEST_P(DeviceTest, getSupportedOperationsDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, getSupportedOperations(_, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
@@ -556,10 +575,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, prepareModel) {
+TEST_P(DeviceTest, prepareModel) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
const auto mockPreparedModel = MockPreparedModel::create();
EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _))
.Times(1)
@@ -576,10 +595,10 @@
EXPECT_NE(result.value(), nullptr);
}
-TEST(DeviceTest, prepareModelLaunchError) {
+TEST_P(DeviceTest, prepareModelLaunchError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _))
.Times(1)
.WillOnce(Invoke(makePreparedModelReturn(ErrorStatus::GENERAL_FAILURE,
@@ -594,10 +613,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelReturnError) {
+TEST_P(DeviceTest, prepareModelReturnError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _))
.Times(1)
.WillOnce(Invoke(makePreparedModelReturn(ErrorStatus::NONE,
@@ -612,10 +631,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelNullptrError) {
+TEST_P(DeviceTest, prepareModelNullptrError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _))
.Times(1)
.WillOnce(
@@ -630,10 +649,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelTransportFailure) {
+TEST_P(DeviceTest, prepareModelTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
@@ -647,10 +666,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelDeadObject) {
+TEST_P(DeviceTest, prepareModelDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModel(_, _, _, _, _, _, _, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
@@ -664,10 +683,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, prepareModelAsyncCrash) {
+TEST_P(DeviceTest, prepareModelAsyncCrash) {
// setup test
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
const auto ret = [&device]() {
DeathMonitor::serviceDied(device->getDeathMonitor());
return ndk::ScopedAStatus::ok();
@@ -685,10 +704,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, prepareModelFromCache) {
+TEST_P(DeviceTest, prepareModelFromCache) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
const auto mockPreparedModel = MockPreparedModel::create();
EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _))
.Times(1)
@@ -704,10 +723,10 @@
EXPECT_NE(result.value(), nullptr);
}
-TEST(DeviceTest, prepareModelFromCacheLaunchError) {
+TEST_P(DeviceTest, prepareModelFromCacheLaunchError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _))
.Times(1)
.WillOnce(Invoke(makePreparedModelFromCacheReturn(
@@ -721,10 +740,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelFromCacheReturnError) {
+TEST_P(DeviceTest, prepareModelFromCacheReturnError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _))
.Times(1)
.WillOnce(Invoke(makePreparedModelFromCacheReturn(
@@ -738,10 +757,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelFromCacheNullptrError) {
+TEST_P(DeviceTest, prepareModelFromCacheNullptrError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _))
.Times(1)
.WillOnce(Invoke(makePreparedModelFromCacheReturn(ErrorStatus::NONE, ErrorStatus::NONE,
@@ -755,10 +774,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelFromCacheTransportFailure) {
+TEST_P(DeviceTest, prepareModelFromCacheTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
@@ -771,10 +790,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, prepareModelFromCacheDeadObject) {
+TEST_P(DeviceTest, prepareModelFromCacheDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, prepareModelFromCache(_, _, _, _, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
@@ -787,10 +806,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, prepareModelFromCacheAsyncCrash) {
+TEST_P(DeviceTest, prepareModelFromCacheAsyncCrash) {
// setup test
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
const auto ret = [&device]() {
DeathMonitor::serviceDied(device->getDeathMonitor());
return ndk::ScopedAStatus::ok();
@@ -807,10 +826,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-TEST(DeviceTest, allocate) {
+TEST_P(DeviceTest, allocate) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
const auto mockBuffer = DeviceBuffer{.buffer = MockBuffer::create(), .token = 1};
EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _))
.Times(1)
@@ -825,10 +844,10 @@
EXPECT_NE(result.value(), nullptr);
}
-TEST(DeviceTest, allocateError) {
+TEST_P(DeviceTest, allocateError) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeGeneralFailure));
@@ -841,10 +860,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, allocateTransportFailure) {
+TEST_P(DeviceTest, allocateTransportFailure) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeGeneralTransportFailure));
@@ -857,10 +876,10 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::GENERAL_FAILURE);
}
-TEST(DeviceTest, allocateDeadObject) {
+TEST_P(DeviceTest, allocateDeadObject) {
// setup call
const auto mockDevice = createMockDevice();
- const auto device = Device::create(kName, mockDevice).value();
+ const auto device = Device::create(kName, mockDevice, kVersion).value();
EXPECT_CALL(*mockDevice, allocate(_, _, _, _, _))
.Times(1)
.WillOnce(InvokeWithoutArgs(makeDeadObjectFailure));
@@ -873,4 +892,8 @@
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
+INSTANTIATE_TEST_SUITE_P(TestDevice, DeviceTest,
+ ::testing::Values(nn::kVersionFeatureLevel5, nn::kVersionFeatureLevel6),
+ printDeviceTest);
+
} // namespace aidl::android::hardware::neuralnetworks::utils
diff --git a/neuralnetworks/aidl/vts/functional/Android.bp b/neuralnetworks/aidl/vts/functional/Android.bp
index 3558d12..a102fe0 100644
--- a/neuralnetworks/aidl/vts/functional/Android.bp
+++ b/neuralnetworks/aidl/vts/functional/Android.bp
@@ -26,6 +26,7 @@
cc_test {
name: "VtsHalNeuralnetworksTargetTest",
defaults: [
+ "neuralnetworks_use_latest_utils_hal_aidl",
"neuralnetworks_vts_functional_defaults",
"use_libaidlvintf_gtest_helper_static",
],
@@ -49,18 +50,14 @@
"libvndksupport",
],
static_libs: [
- "android.hardware.common-V2-ndk",
- "android.hardware.graphics.common-V2-ndk",
- "android.hardware.neuralnetworks-V2-ndk",
"android.hidl.allocator@1.0",
"android.hidl.memory@1.0",
"libaidlcommonsupport",
"libgmock",
"libhidlmemory",
+ "libneuralnetworks_common",
"libneuralnetworks_generated_test_harness",
- "libneuralnetworks_utils",
"libsync",
- "neuralnetworks_utils_hal_aidl",
],
whole_static_libs: [
"neuralnetworks_generated_AIDL_V2_example",
diff --git a/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp b/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp
index 1819699..cd5475c 100644
--- a/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp
+++ b/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp
@@ -28,9 +28,9 @@
#include <Utils.h>
#include <nnapi/SharedMemory.h>
#include <nnapi/hal/aidl/Conversions.h>
+#include <nnapi/hal/aidl/HalInterfaces.h>
#include <nnapi/hal/aidl/Utils.h>
-#include "AidlHalInterfaces.h"
#include "Callbacks.h"
#include "GeneratedTestHarness.h"
#include "MemoryUtils.h"
diff --git a/neuralnetworks/utils/OWNERS b/neuralnetworks/utils/OWNERS
deleted file mode 100644
index e4feee3..0000000
--- a/neuralnetworks/utils/OWNERS
+++ /dev/null
@@ -1,11 +0,0 @@
-# Neuralnetworks team
-butlermichael@google.com
-dgross@google.com
-galarragas@google.com
-jeanluc@google.com
-levp@google.com
-miaowang@google.com
-pszczepaniak@google.com
-slavash@google.com
-vddang@google.com
-xusongw@google.com
diff --git a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstServer.h b/neuralnetworks/utils/adapter/include/nnapi/hal/Burst.h
similarity index 66%
rename from neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstServer.h
rename to neuralnetworks/utils/adapter/include/nnapi/hal/Burst.h
index 500aa0c..a3aa706 100644
--- a/neuralnetworks/1.2/utils/include/nnapi/hal/1.2/ExecutionBurstServer.h
+++ b/neuralnetworks/utils/adapter/include/nnapi/hal/Burst.h
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_SERVER_H
-#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_SERVER_H
-
-#include "ExecutionBurstUtils.h"
+#ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_BURST_H
+#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_BURST_H
#include <android-base/thread_annotations.h>
#include <android/hardware/neuralnetworks/1.0/types.h>
#include <android/hardware/neuralnetworks/1.2/IBurstCallback.h>
+#include <android/hardware/neuralnetworks/1.2/IBurstContext.h>
#include <android/hardware/neuralnetworks/1.2/IPreparedModel.h>
#include <android/hardware/neuralnetworks/1.2/types.h>
#include <fmq/MessageQueue.h>
@@ -30,6 +29,7 @@
#include <nnapi/Result.h>
#include <nnapi/Types.h>
#include <nnapi/hal/1.0/ProtectCallback.h>
+#include <nnapi/hal/1.2/BurstUtils.h>
#include <atomic>
#include <chrono>
@@ -39,13 +39,13 @@
#include <tuple>
#include <vector>
-namespace android::hardware::neuralnetworks::V1_2::utils {
+namespace android::hardware::neuralnetworks::adapter {
/**
- * The ExecutionBurstServer class is responsible for waiting for and deserializing a request object
- * from a FMQ, performing the inference, and serializing the result back across another FMQ.
+ * The Burst class is responsible for waiting for and deserializing a request object from a FMQ,
+ * performing the inference, and serializing the result back across another FMQ.
*/
-class ExecutionBurstServer : public IBurstContext {
+class Burst : public V1_2::IBurstContext {
struct PrivateConstructorTag {};
public:
@@ -58,13 +58,13 @@
public:
// Precondition: burstExecutor != nullptr
// Precondition: burstCallback != nullptr
- MemoryCache(nn::SharedBurst burstExecutor, sp<IBurstCallback> burstCallback);
+ MemoryCache(nn::SharedBurst burstExecutor, sp<V1_2::IBurstCallback> burstCallback);
/**
* Get the cached memory objects corresponding to provided slot identifiers.
*
- * If the slot entry is not present in the cache, this class will use IBurstCallback to
- * retrieve those entries that are not present in the cache, then cache them.
+ * If the slot entry is not present in the cache, this class will use V1_2::IBurstCallback
+ * to retrieve those entries that are not present in the cache, then cache them.
*
* @param slots Identifiers of memory objects to be retrieved.
* @return A vector where each element is the memory object and a ref-counted cache "hold"
@@ -93,7 +93,7 @@
std::map<int32_t, std::pair<nn::SharedMemory, nn::IBurst::OptionalCacheHold>> mCache
GUARDED_BY(mMutex);
nn::SharedBurst kBurstExecutor;
- const sp<IBurstCallback> kBurstCallback;
+ const sp<V1_2::IBurstCallback> kBurstCallback;
};
/**
@@ -111,45 +111,45 @@
* execution.
* @param burstExecutor Object which maintains a local cache of the memory pools and executes
* using the cached memory pools.
- * @param pollingTimeWindow How much time (in microseconds) the ExecutionBurstServer is allowed
- * to poll the FMQ before waiting on the blocking futex. Polling may result in lower
- * latencies at the potential cost of more power usage.
- * @return IBurstContext Handle to the burst context.
+ * @param pollingTimeWindow How much time (in microseconds) the Burst is allowed to poll the FMQ
+ * before waiting on the blocking futex. Polling may result in lower latencies at the
+ * potential cost of more power usage.
+ * @return V1_2::IBurstContext Handle to the burst context.
*/
- static nn::GeneralResult<sp<ExecutionBurstServer>> create(
- const sp<IBurstCallback>& callback,
- const MQDescriptorSync<FmqRequestDatum>& requestChannel,
- const MQDescriptorSync<FmqResultDatum>& resultChannel, nn::SharedBurst burstExecutor,
+ static nn::GeneralResult<sp<Burst>> create(
+ const sp<V1_2::IBurstCallback>& callback,
+ const MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel,
+ const MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel,
+ nn::SharedBurst burstExecutor,
std::chrono::microseconds pollingTimeWindow = std::chrono::microseconds{0});
- ExecutionBurstServer(PrivateConstructorTag tag, const sp<IBurstCallback>& callback,
- std::unique_ptr<RequestChannelReceiver> requestChannel,
- std::unique_ptr<ResultChannelSender> resultChannel,
- nn::SharedBurst burstExecutor);
- ~ExecutionBurstServer();
+ Burst(PrivateConstructorTag tag, const sp<V1_2::IBurstCallback>& callback,
+ std::unique_ptr<V1_2::utils::RequestChannelReceiver> requestChannel,
+ std::unique_ptr<V1_2::utils::ResultChannelSender> resultChannel,
+ nn::SharedBurst burstExecutor);
+ ~Burst();
// Used by the NN runtime to preemptively remove any stored memory. See
- // IBurstContext::freeMemory for more information.
+ // V1_2::IBurstContext::freeMemory for more information.
Return<void> freeMemory(int32_t slot) override;
private:
- // Work loop that will continue processing execution requests until the ExecutionBurstServer
- // object is freed.
+ // Work loop that will continue processing execution requests until the Burst object is freed.
void task();
- nn::ExecutionResult<std::pair<hidl_vec<OutputShape>, Timing>> execute(
+ nn::ExecutionResult<std::pair<hidl_vec<V1_2::OutputShape>, V1_2::Timing>> execute(
const V1_0::Request& requestWithoutPools, const std::vector<int32_t>& slotsOfPools,
- MeasureTiming measure);
+ V1_2::MeasureTiming measure);
std::thread mWorker;
std::atomic<bool> mTeardown{false};
- const sp<IBurstCallback> mCallback;
- const std::unique_ptr<RequestChannelReceiver> mRequestChannelReceiver;
- const std::unique_ptr<ResultChannelSender> mResultChannelSender;
+ const sp<V1_2::IBurstCallback> mCallback;
+ const std::unique_ptr<V1_2::utils::RequestChannelReceiver> mRequestChannelReceiver;
+ const std::unique_ptr<V1_2::utils::ResultChannelSender> mResultChannelSender;
const nn::SharedBurst mBurstExecutor;
MemoryCache mMemoryCache;
};
-} // namespace android::hardware::neuralnetworks::V1_2::utils
+} // namespace android::hardware::neuralnetworks::adapter
-#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_2_UTILS_EXECUTION_BURST_SERVER_H
+#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_ADAPTER_BURST_H
diff --git a/neuralnetworks/1.2/utils/src/ExecutionBurstServer.cpp b/neuralnetworks/utils/adapter/src/Burst.cpp
similarity index 67%
rename from neuralnetworks/1.2/utils/src/ExecutionBurstServer.cpp
rename to neuralnetworks/utils/adapter/src/Burst.cpp
index f30b662..8b2e1dd 100644
--- a/neuralnetworks/1.2/utils/src/ExecutionBurstServer.cpp
+++ b/neuralnetworks/utils/adapter/src/Burst.cpp
@@ -14,11 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "ExecutionBurstServer"
-
-#include "ExecutionBurstServer.h"
-#include "Conversions.h"
-#include "ExecutionBurstUtils.h"
+#include "Burst.h"
#include <android-base/logging.h>
#include <nnapi/IBurst.h>
@@ -29,6 +25,8 @@
#include <nnapi/hal/1.0/Conversions.h>
#include <nnapi/hal/1.0/HandleError.h>
#include <nnapi/hal/1.0/ProtectCallback.h>
+#include <nnapi/hal/1.2/BurstUtils.h>
+#include <nnapi/hal/1.2/Conversions.h>
#include <nnapi/hal/TransferValue.h>
#include <algorithm>
@@ -42,11 +40,11 @@
#include "Tracing.h"
-namespace android::hardware::neuralnetworks::V1_2::utils {
+namespace android::hardware::neuralnetworks::adapter {
namespace {
-constexpr V1_2::Timing kNoTiming = {std::numeric_limits<uint64_t>::max(),
- std::numeric_limits<uint64_t>::max()};
+constexpr V1_2::Timing kTiming = {std::numeric_limits<uint64_t>::max(),
+ std::numeric_limits<uint64_t>::max()};
nn::GeneralResult<std::vector<nn::SharedMemory>> getMemoriesCallback(
V1_0::ErrorStatus status, const hidl_vec<hidl_memory>& memories) {
@@ -61,15 +59,15 @@
} // anonymous namespace
-ExecutionBurstServer::MemoryCache::MemoryCache(nn::SharedBurst burstExecutor,
- sp<IBurstCallback> burstCallback)
+Burst::MemoryCache::MemoryCache(nn::SharedBurst burstExecutor,
+ sp<V1_2::IBurstCallback> burstCallback)
: kBurstExecutor(std::move(burstExecutor)), kBurstCallback(std::move(burstCallback)) {
CHECK(kBurstExecutor != nullptr);
CHECK(kBurstCallback != nullptr);
}
nn::GeneralResult<std::vector<std::pair<nn::SharedMemory, nn::IBurst::OptionalCacheHold>>>
-ExecutionBurstServer::MemoryCache::getCacheEntries(const std::vector<int32_t>& slots) {
+Burst::MemoryCache::getCacheEntries(const std::vector<int32_t>& slots) {
std::lock_guard guard(mMutex);
NN_TRY(ensureCacheEntriesArePresentLocked(slots));
@@ -82,7 +80,7 @@
return results;
}
-nn::GeneralResult<void> ExecutionBurstServer::MemoryCache::ensureCacheEntriesArePresentLocked(
+nn::GeneralResult<void> Burst::MemoryCache::ensureCacheEntriesArePresentLocked(
const std::vector<int32_t>& slots) {
const auto slotIsKnown = [this](int32_t slot)
REQUIRES(mMutex) { return mCache.count(slot) > 0; };
@@ -107,11 +105,10 @@
auto returnedMemories = NN_TRY(cb.take());
if (returnedMemories.size() != unknownSlots.size()) {
- return NN_ERROR()
- << "ExecutionBurstServer::MemoryCache::ensureCacheEntriesArePresentLocked: Error "
- "retrieving memories -- count mismatch between requested memories ("
- << unknownSlots.size() << ") and returned memories (" << returnedMemories.size()
- << ")";
+ return NN_ERROR() << "Burst::MemoryCache::ensureCacheEntriesArePresentLocked: Error "
+ "retrieving memories -- count mismatch between requested memories ("
+ << unknownSlots.size() << ") and returned memories ("
+ << returnedMemories.size() << ")";
}
// add memories to unknown slots
@@ -123,56 +120,54 @@
}
nn::GeneralResult<std::pair<nn::SharedMemory, nn::IBurst::OptionalCacheHold>>
-ExecutionBurstServer::MemoryCache::getCacheEntryLocked(int32_t slot) {
+Burst::MemoryCache::getCacheEntryLocked(int32_t slot) {
if (const auto iter = mCache.find(slot); iter != mCache.end()) {
return iter->second;
}
- return NN_ERROR()
- << "ExecutionBurstServer::MemoryCache::getCacheEntryLocked failed because slot " << slot
- << " is not present in the cache";
+ return NN_ERROR() << "Burst::MemoryCache::getCacheEntryLocked failed because slot " << slot
+ << " is not present in the cache";
}
-void ExecutionBurstServer::MemoryCache::addCacheEntryLocked(int32_t slot, nn::SharedMemory memory) {
+void Burst::MemoryCache::addCacheEntryLocked(int32_t slot, nn::SharedMemory memory) {
auto hold = kBurstExecutor->cacheMemory(memory);
mCache.emplace(slot, std::make_pair(std::move(memory), std::move(hold)));
}
-void ExecutionBurstServer::MemoryCache::removeCacheEntry(int32_t slot) {
+void Burst::MemoryCache::removeCacheEntry(int32_t slot) {
std::lock_guard guard(mMutex);
mCache.erase(slot);
}
-// ExecutionBurstServer methods
+// Burst methods
-nn::GeneralResult<sp<ExecutionBurstServer>> ExecutionBurstServer::create(
- const sp<IBurstCallback>& callback, const MQDescriptorSync<FmqRequestDatum>& requestChannel,
- const MQDescriptorSync<FmqResultDatum>& resultChannel, nn::SharedBurst burstExecutor,
+nn::GeneralResult<sp<Burst>> Burst::create(
+ const sp<V1_2::IBurstCallback>& callback,
+ const MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel,
+ const MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel, nn::SharedBurst burstExecutor,
std::chrono::microseconds pollingTimeWindow) {
// check inputs
if (callback == nullptr || burstExecutor == nullptr) {
- return NN_ERROR() << "ExecutionBurstServer::create passed a nullptr";
+ return NN_ERROR() << "Burst::create passed a nullptr";
}
// create FMQ objects
auto requestChannelReceiver =
- NN_TRY(RequestChannelReceiver::create(requestChannel, pollingTimeWindow));
- auto resultChannelSender = NN_TRY(ResultChannelSender::create(resultChannel));
+ NN_TRY(V1_2::utils::RequestChannelReceiver::create(requestChannel, pollingTimeWindow));
+ auto resultChannelSender = NN_TRY(V1_2::utils::ResultChannelSender::create(resultChannel));
// check FMQ objects
CHECK(requestChannelReceiver != nullptr);
CHECK(resultChannelSender != nullptr);
// make and return context
- return sp<ExecutionBurstServer>::make(PrivateConstructorTag{}, callback,
- std::move(requestChannelReceiver),
- std::move(resultChannelSender), std::move(burstExecutor));
+ return sp<Burst>::make(PrivateConstructorTag{}, callback, std::move(requestChannelReceiver),
+ std::move(resultChannelSender), std::move(burstExecutor));
}
-ExecutionBurstServer::ExecutionBurstServer(PrivateConstructorTag /*tag*/,
- const sp<IBurstCallback>& callback,
- std::unique_ptr<RequestChannelReceiver> requestChannel,
- std::unique_ptr<ResultChannelSender> resultChannel,
- nn::SharedBurst burstExecutor)
+Burst::Burst(PrivateConstructorTag /*tag*/, const sp<V1_2::IBurstCallback>& callback,
+ std::unique_ptr<V1_2::utils::RequestChannelReceiver> requestChannel,
+ std::unique_ptr<V1_2::utils::ResultChannelSender> resultChannel,
+ nn::SharedBurst burstExecutor)
: mCallback(callback),
mRequestChannelReceiver(std::move(requestChannel)),
mResultChannelSender(std::move(resultChannel)),
@@ -182,7 +177,7 @@
mWorker = std::thread([this] { task(); });
}
-ExecutionBurstServer::~ExecutionBurstServer() {
+Burst::~Burst() {
// set teardown flag
mTeardown = true;
mRequestChannelReceiver->invalidate();
@@ -191,12 +186,12 @@
mWorker.join();
}
-Return<void> ExecutionBurstServer::freeMemory(int32_t slot) {
+Return<void> Burst::freeMemory(int32_t slot) {
mMemoryCache.removeCacheEntry(slot);
return Void();
}
-void ExecutionBurstServer::task() {
+void Burst::task() {
// loop until the burst object is being destroyed
while (!mTeardown) {
// receive request
@@ -208,12 +203,12 @@
// if the burst is being torn down, skip the execution so the "task" function can end
if (!arguments.has_value()) {
if (!mTeardown) {
- mResultChannelSender->send(V1_0::ErrorStatus::GENERAL_FAILURE, {}, kNoTiming);
+ mResultChannelSender->send(V1_0::ErrorStatus::GENERAL_FAILURE, {}, kTiming);
}
continue;
}
- // unpack the arguments; types are Request, std::vector<int32_t>, and MeasureTiming,
+ // unpack the arguments; types are Request, std::vector<int32_t>, and V1_2::MeasureTiming,
// respectively
const auto [requestWithoutPools, slotsOfPools, measure] = std::move(arguments).value();
@@ -226,17 +221,17 @@
} else {
const auto& [message, code, outputShapes] = result.error();
LOG(ERROR) << "IBurst::execute failed with " << code << ": " << message;
- mResultChannelSender->send(convert(code).value(), convert(outputShapes).value(),
- kNoTiming);
+ mResultChannelSender->send(V1_2::utils::convert(code).value(),
+ V1_2::utils::convert(outputShapes).value(), kTiming);
}
}
}
-nn::ExecutionResult<std::pair<hidl_vec<OutputShape>, Timing>> ExecutionBurstServer::execute(
+nn::ExecutionResult<std::pair<hidl_vec<V1_2::OutputShape>, V1_2::Timing>> Burst::execute(
const V1_0::Request& requestWithoutPools, const std::vector<int32_t>& slotsOfPools,
- MeasureTiming measure) {
+ V1_2::MeasureTiming measure) {
NNTRACE_FULL(NNTRACE_LAYER_IPC, NNTRACE_PHASE_EXECUTION,
- "ExecutionBurstServer getting memory, executing, and returning results");
+ "Burst getting memory, executing, and returning results");
// ensure executor with cache has required memory
const auto cacheEntries = NN_TRY(mMemoryCache.getCacheEntries(slotsOfPools));
@@ -257,7 +252,8 @@
const auto [outputShapes, timing] =
NN_TRY(mBurstExecutor->execute(canonicalRequest, canonicalMeasure, {}, {}));
- return std::make_pair(NN_TRY(convert(outputShapes)), NN_TRY(convert(timing)));
+ return std::make_pair(NN_TRY(V1_2::utils::convert(outputShapes)),
+ NN_TRY(V1_2::utils::convert(timing)));
}
-} // namespace android::hardware::neuralnetworks::V1_2::utils
+} // namespace android::hardware::neuralnetworks::adapter
diff --git a/neuralnetworks/utils/adapter/src/PreparedModel.cpp b/neuralnetworks/utils/adapter/src/PreparedModel.cpp
index 40c0888..a14e782 100644
--- a/neuralnetworks/utils/adapter/src/PreparedModel.cpp
+++ b/neuralnetworks/utils/adapter/src/PreparedModel.cpp
@@ -16,7 +16,8 @@
#include "PreparedModel.h"
-#include <ExecutionBurstServer.h>
+#include "Burst.h"
+
#include <android-base/logging.h>
#include <android/hardware/neuralnetworks/1.0/IExecutionCallback.h>
#include <android/hardware/neuralnetworks/1.0/types.h>
@@ -272,6 +273,15 @@
return syncFences;
}
+nn::GeneralResult<sp<V1_2::IBurstContext>> configureExecutionBurst(
+ const nn::SharedPreparedModel& preparedModel, const sp<V1_2::IBurstCallback>& callback,
+ const MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel,
+ const MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel) {
+ auto burstExecutor = NN_TRY(preparedModel->configureExecutionBurst());
+ return Burst::create(callback, requestChannel, resultChannel, std::move(burstExecutor),
+ V1_2::utils::getBurstServerPollingTimeWindow());
+}
+
nn::GeneralResult<std::pair<hidl_handle, sp<V1_3::IFencedExecutionCallback>>> executeFenced(
const nn::SharedPreparedModel& preparedModel, const V1_3::Request& request,
const hidl_vec<hidl_handle>& waitFor, V1_2::MeasureTiming measure,
@@ -388,14 +398,17 @@
const MQDescriptorSync<V1_2::FmqRequestDatum>& requestChannel,
const MQDescriptorSync<V1_2::FmqResultDatum>& resultChannel,
configureExecutionBurst_cb cb) {
- const sp<V1_2::IBurstContext> burst = nn::ExecutionBurstServer::create(
- callback, requestChannel, resultChannel, this, std::chrono::microseconds{0});
-
- if (burst == nullptr) {
- cb(V1_0::ErrorStatus::GENERAL_FAILURE, {});
- } else {
- cb(V1_0::ErrorStatus::NONE, burst);
+ auto result = adapter::configureExecutionBurst(kPreparedModel, callback, requestChannel,
+ resultChannel);
+ if (!result.has_value()) {
+ auto [message, code] = std::move(result).error();
+ LOG(ERROR) << "adapter::PreparedModel::configureExecutionBurst failed with " << code << ": "
+ << message;
+ cb(V1_2::utils::convert(code).value(), nullptr);
+ return Void();
}
+ auto burstContext = std::move(result).value();
+ cb(V1_0::ErrorStatus::NONE, std::move(burstContext));
return Void();
}
diff --git a/neuralnetworks/utils/common/Android.bp b/neuralnetworks/utils/common/Android.bp
index e02a202..39927a3 100644
--- a/neuralnetworks/utils/common/Android.bp
+++ b/neuralnetworks/utils/common/Android.bp
@@ -31,7 +31,6 @@
export_include_dirs: ["include"],
cflags: ["-Wthread-safety"],
static_libs: ["neuralnetworks_types"],
- shared_libs: ["libbinder_ndk"],
}
cc_test {
diff --git a/neuralnetworks/utils/common/test/ResilientDeviceTest.cpp b/neuralnetworks/utils/common/test/ResilientDeviceTest.cpp
index 3abd724..0488b63 100644
--- a/neuralnetworks/utils/common/test/ResilientDeviceTest.cpp
+++ b/neuralnetworks/utils/common/test/ResilientDeviceTest.cpp
@@ -28,7 +28,6 @@
namespace {
using ::testing::_;
-using ::testing::InvokeWithoutArgs;
using ::testing::Return;
using SharedMockDevice = std::shared_ptr<const nn::MockDevice>;
@@ -54,7 +53,7 @@
// Setup default actions for each relevant call.
constexpr auto getName_ret = []() -> const std::string& { return kName; };
constexpr auto getVersionString_ret = []() -> const std::string& { return kVersionString; };
- constexpr auto kFeatureLevel = nn::Version::ANDROID_OC_MR1;
+ constexpr auto kFeatureLevel = nn::kVersionFeatureLevel1;
constexpr auto kDeviceType = nn::DeviceType::ACCELERATOR;
constexpr auto getSupportedExtensions_ret = []() -> const std::vector<nn::Extension>& {
return kExtensions;
@@ -142,7 +141,7 @@
TEST(ResilientDeviceTest, getFeatureLevel) {
// setup call
const auto [mockDevice, mockDeviceFactory, device] = setup();
- constexpr auto kFeatureLevel = nn::Version::ANDROID_OC_MR1;
+ constexpr auto kFeatureLevel = nn::kVersionFeatureLevel1;
EXPECT_CALL(*mockDevice, getFeatureLevel()).Times(1).WillOnce(Return(kFeatureLevel));
// run test
@@ -592,7 +591,7 @@
const auto recoveredMockDevice = createConfiguredMockDevice();
EXPECT_CALL(*recoveredMockDevice, getFeatureLevel())
.Times(1)
- .WillOnce(Return(nn::Version::ANDROID_P));
+ .WillOnce(Return(nn::kVersionFeatureLevel2));
EXPECT_CALL(*mockDeviceFactory, Call(false)).Times(1).WillOnce(Return(recoveredMockDevice));
// run test
diff --git a/neuralnetworks/utils/service/Android.bp b/neuralnetworks/utils/service/Android.bp
index fbb8679..c3272ae 100644
--- a/neuralnetworks/utils/service/Android.bp
+++ b/neuralnetworks/utils/service/Android.bp
@@ -25,7 +25,10 @@
cc_library_static {
name: "neuralnetworks_utils_hal_service",
- defaults: ["neuralnetworks_utils_defaults"],
+ defaults: [
+ "neuralnetworks_use_latest_utils_hal_aidl",
+ "neuralnetworks_utils_defaults",
+ ],
srcs: ["src/*"],
local_include_dirs: ["include/nnapi/hal"],
export_include_dirs: ["include"],
@@ -35,15 +38,12 @@
"neuralnetworks_utils_hal_1_1",
"neuralnetworks_utils_hal_1_2",
"neuralnetworks_utils_hal_1_3",
- "neuralnetworks_utils_hal_aidl",
"neuralnetworks_utils_hal_common",
],
shared_libs: [
- "android.hardware.neuralnetworks-V2-ndk",
"android.hardware.neuralnetworks@1.0",
"android.hardware.neuralnetworks@1.1",
"android.hardware.neuralnetworks@1.2",
"android.hardware.neuralnetworks@1.3",
- "libbinder_ndk",
],
}
diff --git a/power/aidl/default/Android.bp b/power/aidl/default/Android.bp
index e10d329..9acb9e0 100644
--- a/power/aidl/default/Android.bp
+++ b/power/aidl/default/Android.bp
@@ -24,8 +24,8 @@
cc_binary {
name: "android.hardware.power-service.example",
relative_install_path: "hw",
- init_rc: ["power-default.rc"],
- vintf_fragments: ["power-default.xml"],
+ init_rc: [":android.hardware.power.rc"],
+ vintf_fragments: [":android.hardware.power.xml"],
vendor: true,
shared_libs: [
"libbase",
@@ -37,3 +37,13 @@
"Power.cpp",
],
}
+
+filegroup {
+ name: "android.hardware.power.xml",
+ srcs: ["power-default.xml"],
+}
+
+filegroup {
+ name: "android.hardware.power.rc",
+ srcs: ["power-default.rc"],
+}
diff --git a/power/aidl/default/apex/Android.bp b/power/aidl/default/apex/Android.bp
new file mode 100644
index 0000000..eb04087
--- /dev/null
+++ b/power/aidl/default/apex/Android.bp
@@ -0,0 +1,72 @@
+// Copyright (C) 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+apex_key {
+ name: "com.android.hardware.power.key",
+ public_key: "com.android.hardware.power.avbpubkey",
+ private_key: "com.android.hardware.power.pem",
+}
+
+android_app_certificate {
+ name: "com.android.hardware.power.certificate",
+ certificate: "com.android.hardware.power",
+}
+
+genrule {
+ name: "com.android.hardware.power.rc-srcs",
+ srcs: [
+ ":android.hardware.power.rc",
+ ":android.hardware.power.stats.rc",
+ ],
+ out: ["com.android.hardware.power.rc"],
+ cmd: "sed -E 's/\\/vendor/\\/apex\\/com.android.hardware.power/' $(in) > $(out)",
+}
+
+prebuilt_etc {
+ name: "com.android.hardware.power.rc",
+ src: ":com.android.hardware.power.rc-srcs",
+ installable: false,
+}
+
+apex {
+ name: "com.android.hardware.power",
+ manifest: "apex_manifest.json",
+ key: "com.android.hardware.power.key",
+ certificate: ":com.android.hardware.power.certificate",
+ file_contexts: "file_contexts",
+ use_vndk_as_stable: true,
+ updatable: false,
+ // Install the apex in /vendor/apex
+ soc_specific: true,
+ // Bundle the Power and PowerStats HALs into this one APEX.
+ binaries: [
+ "android.hardware.power-service.example",
+ "android.hardware.power.stats-service.example",
+ ],
+ prebuilts: [
+ "com.android.hardware.power.rc",
+ ],
+ vintf_fragments: [
+ ":android.hardware.power.xml",
+ ":android.hardware.power.stats.xml",
+ ],
+ overrides: [
+ // Shared lib installed by default but unused by the AIDL implementation.
+ "power.default",
+ ],
+}
diff --git a/power/aidl/default/apex/apex_manifest.json b/power/aidl/default/apex/apex_manifest.json
new file mode 100644
index 0000000..faa937d
--- /dev/null
+++ b/power/aidl/default/apex/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.power",
+ "version": 1
+}
diff --git a/power/aidl/default/apex/com.android.hardware.power.avbpubkey b/power/aidl/default/apex/com.android.hardware.power.avbpubkey
new file mode 100644
index 0000000..3b6411d
--- /dev/null
+++ b/power/aidl/default/apex/com.android.hardware.power.avbpubkey
Binary files differ
diff --git a/power/aidl/default/apex/com.android.hardware.power.pem b/power/aidl/default/apex/com.android.hardware.power.pem
new file mode 100644
index 0000000..d18ae98
--- /dev/null
+++ b/power/aidl/default/apex/com.android.hardware.power.pem
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJKQIBAAKCAgEAsUdFjtLq05tWKdQd4aj8V7tmV4KXw41pKGT5Q1CPzrdHF3yJ
+B/8VWdMpjZ+eQO1q8SijPgfvWExeWQVMfxKmwTmj26xWXhIOgo5G02Zva7zOptig
+KGnl/RdFlOiIGC36XeWDhzdIOhlGv+er9Sykf6Ot84OvktTBUTZNJrXQsyYTBRUX
+6B+wloPdBVxVf1HgzjeHUyCy5dTz0xZSWWELoW24tHIvV5FtJVKSY8ZDfuXWLLfT
+he7E93TepjT027U/J/iW4ITJzw4Qq87ick1D/jZDUbTrkqUMFEgPdgCouZ9zt5xG
+pcHAZ/Fcz9DZfEdX9Xy0R5/XbfrJdvDPguJlwK1pZnr/Pe13xxmE+TEohMmaQDqX
+jQNX3UlcfOYUAjnFMGucHDM10KjTMbP8ytCys88aNLiv7FOgVGrQ/djZN8rkMyVP
+ccoksUBMQmjYaQQZ2yZuJMiLD3P6aYkgU5tMEMoMTrBzfcx05GfElal+ZqOFKAzj
+eUxoZTR27wJb684FRbeE45D+y4jpFfrTEXry+aI7GrfDsVDnUqmyObCUttRtaT04
+6kuUmC44wFEg1EBfcWZc1szI192GBjMuZjFcYvJ4vMdCuennqvLNPBDY1PtqzCOf
+D8vpOE3T9rjS23xxFmmSmorwKKQOGChKqO/SaY0axkXgt+FbSsvTBQtZTSsCAwEA
+AQKCAgEArEu3t+MYJcdwS8EDtcF2V5IkGmMrOvziOkdA14Kh8efBKXt49xOc3atU
+VHfQ6AuXh4DWf0BZB7lZbS2wNkSbW2q47ZSmcFEeVxcOkQGawtxDAHfD2ONrirqm
+ft4s/0sYbU/WsIEzKnxMfdEdGHFmA0PCmczfxFYQ+OxMuZW1m5ginirtDEZYa0EH
+e+FMmyypz+K6HDnIhYWd4Aduy718/0zTWlUr2/DUYpTJAD2+dcPNj7Kt2xq/xj2I
+84K+hBa4phF+GgIU3a8u1ryA61RbA+QbM3siBWlxvvh2RlrHoXjuj4JMS2dup9c2
+PCggaCAyxb2IvaAFUbePPJE5LVz6RFT4HnLEydd5Yt+CEAm+iZKfCzyUgFRtb5y0
+HHTME1eVAt/rf/yIXUYA7q8nQ/PtSzIol5KLX4FUjX1MVKNmIWMa+836kxbuYDFB
+K1M1IKc1k0t9Q9F3TRCMhP/6qH/vJfubCGQhSRUMq7JyjivK9GjYST8R07Dpgu9Z
+4i9TRI8d+UVERsg8niCXONVkmNa3U49u2duUvqV3KmKgQ/Hgyy3keDjz6x56ie5w
+e0EusHAsot60W1BvHrdwlmGZjW3JmZEyazUPh9nBUAaQve1rIOpn80kGXx4EAE2o
+HcrcInJx/zVBk1Wk3UQDwmhUNpa64q9+nd9VMaR9SQNK3ah4NDECggEBAOeput2F
+CgRrvzka69i7FbgY4VmpNMIICPIB6gxvwpir/g4/GgYknuBB6ep1ksf/IZfsMp5A
+JTH1KdXqqQm8nV9v+ETYQAO+VnmWKSBKHsNJqONxsKkQ+xIJcusmKBTYLfL88XQg
+YWH3VMXgqPP8DnJYCeVRIKj1WqfEFFHiaLJJB8FgKhtZBwBnibkVG1K0XCkTdUfY
+mME2GRKW/C7DMvuFOpcFVj7Obwn68R2k3zsOhWA5NQGZF5mqhg5KYLVDg3IbMJQQ
+D+DymQxnc2s2ar0q24isy1Y/FOXrA057j1vAN951+pk6F/PCJM/mtAiRjhP0Aru1
+P6bbR11p+wnpU7MCggEBAMPm8Jmwu3F0xsyFC+1sWPAzPiwaMa7/30wANNKKqHVO
+7lUv1WYFbFMyAOzYPp3Y5HxdxNa43reULGk0R20kSu6W6FkApSvAws0rLKRlS5UI
+oZqhLGHUH2M7q07m2RgQY2TJkU2Zq6AH1kjcbSr127ISXKanKpqonwSHy38BTcGt
+Dl2fVioPzK/vwmiNo2njhh95TV4kqlbUfl7xtDt56tbg8oFBwOsK7UGajXYOxTGB
+o1DtO5E+oiOmlclXuo3m4qpSSMv+wM91aRFhHZVIx0vmO8y5lrfU2kM/5DDhJBxV
+FM4TaA+c5tFOTuCLejHc7nM99wVx7O4QZ0wBwETUxKkCggEAH0tBT+1J1iEL+tXV
+KDjVjUHnJyqBUvis5Kw3hqiOO/t33UrO5CeMQrUEuURaqKOhURl6GQCHRcFdfmUt
+ooAVLjA89GfV9et/WPtc4NzCXRUVOGxCNgRyNhSKrpM/9NjjFCDxKQO6w/YaQITB
+rfvNo8qaw5x68ff64BDPweP4yqSs5IVuCrWzCW3zH8pnH3v3uyDCxgrPT8JUDrvQ
+oyyBNZLgwEfbR66xN0Lr0VpVQXALulzf+TBKDNsJMuL/P104Y3Ci1k15J6T94bwT
+zlbSgm1IrKTS7vqkgw6FKtPsILPNmEKNsKc1VxtRx7fdeA7Zh3595Adu6sZSVJ8d
+Z1BamwKCAQAnbu0vgqu4gtEhigaEnDKq5yW0qvElUMwZ+FCpsM+IDYNcEmzaRG0x
+sfcNtdmk3GvhvN5KepwaR/FInAVkqtGKhUXv5Hla/Uo5El/CF8HHFh2xio/sgU5w
+IyqwjzdT6LiZKRnejPhHFkzEDdrLswGuLpQH185zo02fE9aakiCcw8EIh3JItTV2
+lMSFVz11qx7sZvZz5N2E7PEjG3Q0JK5o4o7uBdZXebOYaQvgn8iB1p6RQ6+h5QGu
+O3IbPVWICtnFfxq4NWeKWw/zN6FE04mKdaXD5/e2uVnV/55nWGp0aYvuj2l6+xJb
+P3ARMwI910MIX4jBx9TxdsvUOOYC9PFBAoIBAQDWswLnaNth4pgutngVWbMenSpv
+eK1RA1ldw2NoTZrGlqPB+LvjEMSH/7ioby8YtOyJRIWs3si8HpVF12qneu8qi7b7
+QlUtqyJOTnGalvhrlq5zPhdW+kk2DXvtTylUnz3vSxxi2I7cLhQRryLC/1kAwy67
+wEr0+u59bOvaqe8L1zgtYJpLQZeskUMzdSMIRVDdFShEFrMJU7adUvGpA7OZ6Ogf
+ux2jWr2vv/eKq6fU6kDPi/66MQjPbZPf2Uq6+XedkNkAeELpN4o3hw0/l/rfiK/r
+YUMJBwtjQw/hehtvC4GlgsH1tMZWzCZULo0tcW4qbzyi9PBrWFPteb33OjBc
+-----END RSA PRIVATE KEY-----
diff --git a/power/aidl/default/apex/com.android.hardware.power.pk8 b/power/aidl/default/apex/com.android.hardware.power.pk8
new file mode 100644
index 0000000..e45435d
--- /dev/null
+++ b/power/aidl/default/apex/com.android.hardware.power.pk8
Binary files differ
diff --git a/power/aidl/default/apex/com.android.hardware.power.x509.pem b/power/aidl/default/apex/com.android.hardware.power.x509.pem
new file mode 100644
index 0000000..9f0c5f0
--- /dev/null
+++ b/power/aidl/default/apex/com.android.hardware.power.x509.pem
@@ -0,0 +1,34 @@
+-----BEGIN CERTIFICATE-----
+MIIF2TCCA8ECFDFsXbm5CdS/UtQZgTiF8Umr8LrLMA0GCSqGSIb3DQEBCwUAMIGn
+MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91
+bnRhaW4gVmlldzEQMA4GA1UECgwHQW5kcm9pZDEQMA4GA1UECwwHQW5kcm9pZDEi
+MCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTEjMCEGA1UEAwwaY29t
+LmFuZHJvaWQuaGFyZHdhcmUucG93ZXIwIBcNMjExMDIwMTcwNTA0WhgPNDc1OTA5
+MTYxNzA1MDRaMIGnMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEW
+MBQGA1UEBwwNTW91bnRhaW4gVmlldzEQMA4GA1UECgwHQW5kcm9pZDEQMA4GA1UE
+CwwHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTEj
+MCEGA1UEAwwaY29tLmFuZHJvaWQuaGFyZHdhcmUucG93ZXIwggIiMA0GCSqGSIb3
+DQEBAQUAA4ICDwAwggIKAoICAQC/37fhOkOfgM2e+M7bMJ1baLFif8dKGwRa6mkJ
+9HWmuOgRcTKllzuEHtrJ0jzur3cDy6/0oZSfA/E1ck3DdRHMQadW26JSNSg6fCU9
+h1kDzkakZgyr3DsJnKGoSHCJ2V2kVbCnd6GuOaOU1ZZISw1I+BWJDc3t1mZPs80D
+ar7/hoIZnsWRoE/eWgJDcWWscRsquSi+q6hyqlCbRvwRznPaDGwmb4geHNugCXkz
+EtCswfc5jiT8DjMDkgVsGO/WcYj2GWT0K0H+Zf1CmEO9fAoXTLfVBjdumtGILgii
+d/TJe2tOBSWyZz6sVzfac2PvUH5Lm8TNUXuLV5IEdcpySge0vqYQwAyd2EgsTH1e
+mRNSk9NerpmfCFEySRRP3BWMGRhbST1d8M3v9Bq0QFhrxoAF12r6GXBUpp9XcOL5
+pBTcAkA9XI++mfz4pDzyGRGOy4WX+8XtsaVZ/14JklupSLr0Tt7oaNocUhoXB03g
+4B0jUTX0hNnVzCxzJypw6YJ60Zc8z+z8pEF34FWarHec1QbkFuyWxbaTPQ4d2NLH
+8zDxQpMILErWdAgKsRL0d8RFG5fBcleEoBM2kKHMAgnP+1qyDqBgt8zloWbmmblw
+JXMuoePFOgeVcgPrZ3EGJSx+s4+dQGQc6r/GwKLKSWpUvHxTIGug76IX9xmptB+I
+F3xb2QIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQANISf3Vi2eueOlzzfnEGGa+CXz
+nvlgUXKv8Gv0/Pbg5uC1BaHTAUgRu5rvrfP9p3Mdj86I/HbE/F4Vkuzqb8/JTWGA
+mG636zAsJRJr0fnkbPma9wVEPSK8MF1QqM6PmKXboixX82TqV1R1sRYG+9hh9W3u
+isDzYDb2ODE0X9M8/3hLS28zdCdtl4zCRK6KB86aGxvkVEj4qDA5l+AbVYevS/SU
+hz1+K/aM0Fi6MZovo5kd/Mof5l05e1TEgCoL1FtFX79r+PYGHJ8/LjtEMkFgwqvG
+CLx2sOV09EHZU27EbVvSs1JYMMXgeAvKaHsVZ51QlSzW4esg/E6z4pw654p8qyK/
+WLXIZ7BMILl1sHYmGqXitnu19puvNks2/+hyqVr0seM5GyQDuwBE8nx6xZzTRxdj
+4TZyN9LuMc9/cKJFvOPqD152bkA2frCLEzYCQreDWwxsWcUHzYrQT+v2SqzP6Ue2
+Xn06HDLx9wBL7Dz6no05SlNS0u1KdvKas6FKZHO+QaKKsBlDmXbMrBTcuUI6OXv2
+6NpVbeyDd0+A23hDiNSgI6zTY6jMidesNExB7rW/bCE4ltPyxFAB+sffyXounODc
+groB5CaS2bv+H1IXJzMMe4LkgQPl1C7G+I3KvJmnrYwmIhLIDuxP82arClIDzccS
+ExRR7ugEg91XCc87Zg==
+-----END CERTIFICATE-----
diff --git a/power/aidl/default/apex/file_contexts b/power/aidl/default/apex/file_contexts
new file mode 100644
index 0000000..3433851
--- /dev/null
+++ b/power/aidl/default/apex/file_contexts
@@ -0,0 +1,3 @@
+(/.*)? u:object_r:vendor_file:s0
+/bin/hw/android\.hardware\.power-service\.example u:object_r:hal_power_default_exec:s0
+/bin/hw/android\.hardware\.power\.stats-service\.example u:object_r:hal_power_stats_default_exec:s0
diff --git a/power/stats/aidl/default/Android.bp b/power/stats/aidl/default/Android.bp
index 7c0caf3..66be5f9 100644
--- a/power/stats/aidl/default/Android.bp
+++ b/power/stats/aidl/default/Android.bp
@@ -24,8 +24,8 @@
cc_binary {
name: "android.hardware.power.stats-service.example",
relative_install_path: "hw",
- init_rc: ["power.stats-default.rc"],
- vintf_fragments: ["power.stats-default.xml"],
+ init_rc: [":android.hardware.power.stats.rc"],
+ vintf_fragments: [":android.hardware.power.stats.xml"],
vendor: true,
shared_libs: [
"libbase",
@@ -37,3 +37,13 @@
"PowerStats.cpp",
],
}
+
+filegroup {
+ name: "android.hardware.power.stats.xml",
+ srcs: ["power.stats-default.xml"],
+}
+
+filegroup {
+ name: "android.hardware.power.stats.rc",
+ srcs: ["power.stats-default.rc"],
+}
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
index 44f9865..c167a6d 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
@@ -612,6 +612,9 @@
EXPECT_EQ(0, cardStatus.applications.size());
}
+ // Give some time for modem to fully power down the SIM card
+ sleep(MODEM_SET_SIM_POWER_DELAY_IN_SECONDS);
+
/* Test setSimCardPower power up */
serial = GetRandomSerialNumber();
radio_v1_6->setSimCardPower_1_6(serial, CardPowerState::POWER_UP);
@@ -624,6 +627,9 @@
::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE,
::android::hardware::radio::V1_6::RadioError::SIM_ERR}));
+ // Give some time for modem to fully power up the SIM card
+ sleep(MODEM_SET_SIM_POWER_DELAY_IN_SECONDS);
+
// setSimCardPower_1_6 does not return until the request is handled. Just verify that we still
// have CardState::PRESENT after turning the power back on
if (radioRsp_v1_6->rspInfo.error == ::android::hardware::radio::V1_6::RadioError::NONE) {
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
index 54c2977..f041865 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
+++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
@@ -47,6 +47,7 @@
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
+#define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2
#define RADIO_SERVICE_SLOT1_NAME "slot1" // HAL instance name for SIM slot 1 or single SIM device
#define RADIO_SERVICE_SLOT2_NAME "slot2" // HAL instance name for SIM slot 2 on dual SIM device
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl
index 2cfb8d0..5cc9017 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimPortInfo.aidl
@@ -36,7 +36,5 @@
parcelable SimPortInfo {
String iccId;
int logicalSlotId;
- int portState;
- const int PORT_STATE_INACTIVE = 0;
- const int PORT_STATE_ACTIVE = 1;
+ boolean portActive;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl
index 0febcd1..0dd8127 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/SliceInfo.aidl
@@ -37,7 +37,7 @@
byte sliceServiceType;
int sliceDifferentiator;
byte mappedHplmnSst;
- int mappedHplmnSD;
+ int mappedHplmnSd;
byte status;
const byte SERVICE_TYPE_NONE = 0;
const byte SERVICE_TYPE_EMBB = 1;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl
index 7dd1341..8c1fdfa 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityCdma.aidl
@@ -39,5 +39,5 @@
int baseStationId;
int longitude;
int latitude;
- android.hardware.radio.network.CellIdentityOperatorNames operatorNames;
+ android.hardware.radio.network.OperatorInfo operatorNames;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl
index 3991af7..2e384e9 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityGsm.aidl
@@ -40,6 +40,6 @@
int cid;
int arfcn;
byte bsic;
- android.hardware.radio.network.CellIdentityOperatorNames operatorNames;
+ android.hardware.radio.network.OperatorInfo operatorNames;
String[] additionalPlmns;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl
index 9ea0974..c83997e 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityLte.aidl
@@ -40,7 +40,7 @@
int pci;
int tac;
int earfcn;
- android.hardware.radio.network.CellIdentityOperatorNames operatorNames;
+ android.hardware.radio.network.OperatorInfo operatorNames;
int bandwidth;
String[] additionalPlmns;
@nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl
index 865e0dd..6bdfd99 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityNr.aidl
@@ -40,7 +40,7 @@
int pci;
int tac;
int nrarfcn;
- android.hardware.radio.network.CellIdentityOperatorNames operatorNames;
+ android.hardware.radio.network.OperatorInfo operatorNames;
String[] additionalPlmns;
android.hardware.radio.network.NgranBands[] bands;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl
index 836b5b5..4100805 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityTdscdma.aidl
@@ -40,7 +40,7 @@
int cid;
int cpid;
int uarfcn;
- android.hardware.radio.network.CellIdentityOperatorNames operatorNames;
+ android.hardware.radio.network.OperatorInfo operatorNames;
String[] additionalPlmns;
@nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl
index f832449..907f30d 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellIdentityWcdma.aidl
@@ -40,7 +40,7 @@
int cid;
int psc;
int uarfcn;
- android.hardware.radio.network.CellIdentityOperatorNames operatorNames;
+ android.hardware.radio.network.OperatorInfo operatorNames;
String[] additionalPlmns;
@nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
index 8131007..16433be 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
@@ -42,7 +42,6 @@
oneway void getCellInfoList(in int serial);
oneway void getDataRegistrationState(in int serial);
oneway void getImsRegistrationState(in int serial);
- oneway void getNeighboringCids(in int serial);
oneway void getNetworkSelectionMode(in int serial);
oneway void getOperator(in int serial);
oneway void getSignalStrength(in int serial);
@@ -50,7 +49,6 @@
oneway void getVoiceRadioTechnology(in int serial);
oneway void getVoiceRegistrationState(in int serial);
oneway void isNrDualConnectivityEnabled(in int serial);
- oneway void pullLceData(in int serial);
oneway void responseAcknowledgement();
oneway void setAllowedNetworkTypesBitmap(in int serial, in android.hardware.radio.RadioAccessFamily networkTypeBitmap);
oneway void setBandMode(in int serial, in android.hardware.radio.network.RadioBandMode mode);
@@ -64,7 +62,7 @@
oneway void setNetworkSelectionModeManual(in int serial, in String operatorNumeric, in android.hardware.radio.AccessNetwork ran);
oneway void setNrDualConnectivityState(in int serial, in android.hardware.radio.network.NrDualConnectivityState nrDualConnectivityState);
oneway void setResponseFunctions(in android.hardware.radio.network.IRadioNetworkResponse radioNetworkResponse, in android.hardware.radio.network.IRadioNetworkIndication radioNetworkIndication);
- oneway void setSignalStrengthReportingCriteria(in int serial, in android.hardware.radio.network.SignalThresholdInfo signalThresholdInfo, in android.hardware.radio.AccessNetwork accessNetwork);
+ oneway void setSignalStrengthReportingCriteria(in int serial, in android.hardware.radio.network.SignalThresholdInfo[] signalThresholdInfos);
oneway void setSuppServiceNotifications(in int serial, in boolean enable);
oneway void setSystemSelectionChannels(in int serial, in boolean specifyChannels, in android.hardware.radio.network.RadioAccessSpecifier[] specifiers);
oneway void startNetworkScan(in int serial, in android.hardware.radio.network.NetworkScanRequest request);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
index e03e4df..ff95396 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
@@ -43,7 +43,6 @@
oneway void getCellInfoListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellInfo[] cellInfo);
oneway void getDataRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult dataRegResponse);
oneway void getImsRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isRegistered, in android.hardware.radio.RadioTechnologyFamily ratFamily);
- oneway void getNeighboringCidsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.NeighboringCell[] cells);
oneway void getNetworkSelectionModeResponse(in android.hardware.radio.RadioResponseInfo info, in boolean manual);
oneway void getOperatorResponse(in android.hardware.radio.RadioResponseInfo info, in String longName, in String shortName, in String numeric);
oneway void getSignalStrengthResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.SignalStrength signalStrength);
@@ -51,7 +50,6 @@
oneway void getVoiceRadioTechnologyResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.RadioTechnology rat);
oneway void getVoiceRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult voiceRegResponse);
oneway void isNrDualConnectivityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled);
- oneway void pullLceDataResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.LceDataInfo lceInfo);
oneway void setAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setBandModeResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setBarringPasswordResponse(in android.hardware.radio.RadioResponseInfo info);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl
index 948a1f6..1e657e5 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NetworkScanRequest.aidl
@@ -41,6 +41,7 @@
boolean incrementalResults;
int incrementalResultsPeriodicity;
String[] mccMncs;
+ const int RADIO_ACCESS_SPECIFIER_MAX_SIZE = 8;
const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MIN = 1;
const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MAX = 10;
const int MAX_SEARCH_TIME_RANGE_MIN = 60;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl
index 3ea6c4e..159d9c1 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl
@@ -39,6 +39,7 @@
int hysteresisDb;
int[] thresholds;
boolean isEnabled;
+ android.hardware.radio.AccessNetwork ran;
const int SIGNAL_MEASUREMENT_TYPE_RSSI = 1;
const int SIGNAL_MEASUREMENT_TYPE_RSCP = 2;
const int SIGNAL_MEASUREMENT_TYPE_RSRP = 3;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl
index cc5a53e..85a0c71 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl
@@ -53,11 +53,10 @@
oneway void iccTransmitApduLogicalChannel(in int serial, in android.hardware.radio.sim.SimApdu message);
oneway void reportStkServiceIsRunning(in int serial);
oneway void requestIccSimAuthentication(in int serial, in int authContext, in String authData, in String aid);
- oneway void requestIsimAuthentication(in int serial, in String challenge);
oneway void responseAcknowledgement();
- oneway void sendEnvelope(in int serial, in String command);
+ oneway void sendEnvelope(in int serial, in String contents);
oneway void sendEnvelopeWithStatus(in int serial, in String contents);
- oneway void sendTerminalResponseToSim(in int serial, in String commandResponse);
+ oneway void sendTerminalResponseToSim(in int serial, in String contents);
oneway void setAllowedCarriers(in int serial, in android.hardware.radio.sim.CarrierRestrictions carriers, in android.hardware.radio.sim.SimLockMultiSimPolicy multiSimPolicy);
oneway void setCarrierInfoForImsiEncryption(in int serial, in android.hardware.radio.sim.ImsiEncryptionInfo imsiEncryptionInfo);
oneway void setCdmaSubscriptionSource(in int serial, in android.hardware.radio.sim.CdmaSubscriptionSource cdmaSub);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl
index e164257..8e68e30 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl
@@ -54,7 +54,6 @@
oneway void iccTransmitApduLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result);
oneway void reportStkServiceIsRunningResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void requestIccSimAuthenticationResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result);
- oneway void requestIsimAuthenticationResponse(in android.hardware.radio.RadioResponseInfo info, in String response);
oneway void sendEnvelopeResponse(in android.hardware.radio.RadioResponseInfo info, in String commandResponse);
oneway void sendEnvelopeWithStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult iccIo);
oneway void sendTerminalResponseToSimResponse(in android.hardware.radio.RadioResponseInfo info);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl
index 579dd29..b373aa5 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl
@@ -35,4 +35,5 @@
@VintfStability
parcelable CdmaDisplayInfoRecord {
String alphaBuf;
+ const int CDMA_ALPHA_INFO_BUFFER_LENGTH = 64;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl
index 6648358..cc4d3fa 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaInformationRecord.aidl
@@ -42,6 +42,7 @@
android.hardware.radio.voice.CdmaLineControlInfoRecord[] lineCtrl;
android.hardware.radio.voice.CdmaT53ClirInfoRecord[] clir;
android.hardware.radio.voice.CdmaT53AudioControlInfoRecord[] audioCtrl;
+ const int CDMA_MAX_NUMBER_OF_INFO_RECS = 10;
const int NAME_DISPLAY = 0;
const int NAME_CALLED_PARTY_NUMBER = 1;
const int NAME_CALLING_PARTY_NUMBER = 2;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl
index f3fcb2f..26a7df5 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl
@@ -39,4 +39,5 @@
byte numberPlan;
byte pi;
byte si;
+ const int CDMA_NUMBER_INFO_BUFFER_LENGTH = 81;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl
index d48102b..744e7ae 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CfData.aidl
@@ -35,4 +35,5 @@
@VintfStability
parcelable CfData {
android.hardware.radio.voice.CallForwardInfo[] cfInfo;
+ const int NUM_SERVICE_CLASSES = 7;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl
index 4cac560..68c82fa 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoice.aidl
@@ -53,6 +53,7 @@
oneway void hangup(in int serial, in int gsmIndex);
oneway void hangupForegroundResumeBackground(in int serial);
oneway void hangupWaitingOrBackground(in int serial);
+ oneway void isVoNrEnabled(in int serial);
oneway void rejectCall(in int serial);
oneway void responseAcknowledgement();
oneway void sendBurstDtmf(in int serial, in String dtmf, in int on, in int off);
@@ -66,6 +67,7 @@
oneway void setPreferredVoicePrivacy(in int serial, in boolean enable);
oneway void setResponseFunctions(in android.hardware.radio.voice.IRadioVoiceResponse radioVoiceResponse, in android.hardware.radio.voice.IRadioVoiceIndication radioVoiceIndication);
oneway void setTtyMode(in int serial, in android.hardware.radio.voice.TtyMode mode);
+ oneway void setVoNrEnabled(in int serial, in boolean enable);
oneway void startDtmf(in int serial, in String s);
oneway void stopDtmf(in int serial);
oneway void switchWaitingOrHoldingAndActive(in int serial);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl
index 4f87c12..af3417d 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceIndication.aidl
@@ -37,7 +37,7 @@
oneway void callRing(in android.hardware.radio.RadioIndicationType type, in boolean isGsm, in android.hardware.radio.voice.CdmaSignalInfoRecord record);
oneway void callStateChanged(in android.hardware.radio.RadioIndicationType type);
oneway void cdmaCallWaiting(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaCallWaiting callWaitingRecord);
- oneway void cdmaInfoRec(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaInformationRecords records);
+ oneway void cdmaInfoRec(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaInformationRecord[] records);
oneway void cdmaOtaProvisionStatus(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaOtaProvisionStatus status);
oneway void currentEmergencyNumberList(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.EmergencyNumber[] emergencyNumberList);
oneway void enterEmergencyCallbackMode(in android.hardware.radio.RadioIndicationType type);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl
index 9f490a8..a3b5e58 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/IRadioVoiceResponse.aidl
@@ -54,6 +54,7 @@
oneway void hangupConnectionResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void hangupForegroundResumeBackgroundResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void hangupWaitingOrBackgroundResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void isVoNrEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable);
oneway void rejectCallResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void sendBurstDtmfResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void sendCdmaFeatureCodeResponse(in android.hardware.radio.RadioResponseInfo info);
@@ -65,6 +66,7 @@
oneway void setMuteResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setPreferredVoicePrivacyResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void setTtyModeResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void setVoNrEnabledResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void startDtmfResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void stopDtmfResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void switchWaitingOrHoldingAndActiveResponse(in android.hardware.radio.RadioResponseInfo info);
diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl
index c5ba293..9517847 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SsInfoData.aidl
@@ -35,4 +35,5 @@
@VintfStability
parcelable SsInfoData {
int[] ssInfo;
+ const int SS_INFO_MAX = 4;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/ISap.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/ISap.aidl
deleted file mode 100644
index 2a111c6..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/ISap.aidl
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make 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.radio;
-@VintfStability
-interface ISap {
- oneway void apduReq(in int token, in android.hardware.radio.SapApduType type, in byte[] command);
- oneway void connectReq(in int token, in int maxMsgSize);
- oneway void disconnectReq(in int token);
- oneway void powerReq(in int token, in boolean state);
- oneway void resetSimReq(in int token);
- oneway void setCallback(in android.hardware.radio.ISapCallback sapCallback);
- oneway void setTransferProtocolReq(in int token, in android.hardware.radio.SapTransferProtocol transferProtocol);
- oneway void transferAtrReq(in int token);
- oneway void transferCardReaderStatusReq(in int token);
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/ISapCallback.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/ISapCallback.aidl
deleted file mode 100644
index 5ae0392..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/ISapCallback.aidl
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make 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.radio;
-@VintfStability
-interface ISapCallback {
- oneway void apduResponse(in int token, in android.hardware.radio.SapResultCode resultCode, in byte[] apduRsp);
- oneway void connectResponse(in int token, in android.hardware.radio.SapConnectRsp sapConnectRsp, in int maxMsgSize);
- oneway void disconnectIndication(in int token, in android.hardware.radio.SapDisconnectType disconnectType);
- oneway void disconnectResponse(in int token);
- oneway void errorResponse(in int token);
- oneway void powerResponse(in int token, in android.hardware.radio.SapResultCode resultCode);
- oneway void resetSimResponse(in int token, in android.hardware.radio.SapResultCode resultCode);
- oneway void statusIndication(in int token, in android.hardware.radio.SapStatus status);
- oneway void transferAtrResponse(in int token, in android.hardware.radio.SapResultCode resultCode, in byte[] atr);
- oneway void transferCardReaderStatusResponse(in int token, in android.hardware.radio.SapResultCode resultCode, in int cardReaderStatus);
- oneway void transferProtocolResponse(in int token, in android.hardware.radio.SapResultCode resultCode);
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
index 10a956e..9bb17fe 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
@@ -52,6 +52,7 @@
HSPAP = 32768,
GSM = 65536,
TD_SCDMA = 131072,
+ IWLAN = 262144,
LTE_CA = 524288,
NR = 1048576,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl
index d111a0d..f411ca2 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl
@@ -32,21 +32,10 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.radio;
-@Backing(type="int") @VintfStability
-enum RadioConst {
- CDMA_ALPHA_INFO_BUFFER_LENGTH = 64,
- CDMA_NUMBER_INFO_BUFFER_LENGTH = 81,
- MAX_RILDS = 3,
- MAX_SOCKET_NAME_LENGTH = 6,
- MAX_CLIENT_ID_LENGTH = 2,
- MAX_DEBUG_SOCKET_NAME_LENGTH = 12,
- MAX_QEMU_PIPE_NAME_LENGTH = 11,
- MAX_UUID_LENGTH = 64,
- CARD_MAX_APPS = 8,
- CDMA_MAX_NUMBER_OF_INFO_RECS = 10,
- SS_INFO_MAX = 4,
- NUM_SERVICE_CLASSES = 7,
- NUM_TX_POWER_LEVELS = 5,
- RADIO_ACCESS_SPECIFIER_MAX_SIZE = 8,
- P2_CONSTANT_NO_P2 = -1,
+@VintfStability
+parcelable RadioConst {
+ const int MAX_RILDS = 3;
+ const int MAX_UUID_LENGTH = 64;
+ const int CARD_MAX_APPS = 8;
+ const int P2_CONSTANT_NO_P2 = -1;
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapConnectRsp.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapConnectRsp.aidl
deleted file mode 100644
index 7e4d246..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapConnectRsp.aidl
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make 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.radio;
-@Backing(type="int") @VintfStability
-enum SapConnectRsp {
- SUCCESS = 0,
- CONNECT_FAILURE = 1,
- MSG_SIZE_TOO_LARGE = 2,
- MSG_SIZE_TOO_SMALL = 3,
- CONNECT_OK_CALL_ONGOING = 4,
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapDisconnectType.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapDisconnectType.aidl
deleted file mode 100644
index e0d8eb2..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapDisconnectType.aidl
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make 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.radio;
-@Backing(type="int") @VintfStability
-enum SapDisconnectType {
- GRACEFUL = 0,
- IMMEDIATE = 1,
-}
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapStatus.aidl
deleted file mode 100644
index 715c507..0000000
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/SapStatus.aidl
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make 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.radio;
-@Backing(type="int") @VintfStability
-enum SapStatus {
- UNKNOWN_ERROR = 0,
- CARD_RESET = 1,
- CARD_NOT_ACCESSIBLE = 2,
- CARD_REMOVED = 3,
- CARD_INSERTED = 4,
- RECOVERED = 5,
-}
diff --git a/radio/aidl/android/hardware/radio/ISap.aidl b/radio/aidl/android/hardware/radio/ISap.aidl
deleted file mode 100644
index 1ca4fe7..0000000
--- a/radio/aidl/android/hardware/radio/ISap.aidl
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-import android.hardware.radio.ISapCallback;
-import android.hardware.radio.SapApduType;
-import android.hardware.radio.SapTransferProtocol;
-
-/**
- * Empty top level interface.
- */
-@VintfStability
-oneway interface ISap {
- /**
- * TRANSFER_APDU_REQ from SAP 1.1 spec 5.1.6
- *
- * @param token Id to match req-resp. Resp must include same token.
- * @param type APDU command type
- * @param command CommandAPDU/CommandAPDU7816 parameter depending on type
- */
- void apduReq(in int token, in SapApduType type, in byte[] command);
-
- /**
- * CONNECT_REQ from SAP 1.1 spec 5.1.1
- *
- * @param token Id to match req-resp. Resp must include same token.
- * @param maxMsgSize MaxMsgSize to be used for SIM Access Profile connection
- */
- void connectReq(in int token, in int maxMsgSize);
-
- /**
- * DISCONNECT_REQ from SAP 1.1 spec 5.1.3
- *
- * @param token Id to match req-resp. Resp must include same token.
- */
- void disconnectReq(in int token);
-
- /**
- * POWER_SIM_OFF_REQ and POWER_SIM_ON_REQ from SAP 1.1 spec 5.1.10 + 5.1.12
- *
- * @param token Id to match req-resp. Resp must include same token.
- * @param state true for on, false for off
- */
- void powerReq(in int token, in boolean state);
-
- /**
- * RESET_SIM_REQ from SAP 1.1 spec 5.1.14
- *
- * @param token Id to match req-resp. Resp must include same token.
- */
- void resetSimReq(in int token);
-
- /**
- * Set callback that has response and unsolicited indication functions
- *
- * @param sapCallback Object containing response and unosolicited indication callbacks
- */
- void setCallback(in ISapCallback sapCallback);
-
- /**
- * SET_TRANSPORT_PROTOCOL_REQ from SAP 1.1 spec 5.1.20
- *
- * @param token Id to match req-resp. Resp must include same token.
- * @param transferProtocol Transport Protocol
- */
- void setTransferProtocolReq(in int token, in SapTransferProtocol transferProtocol);
-
- /**
- * TRANSFER_ATR_REQ from SAP 1.1 spec 5.1.8
- *
- * @param token Id to match req-resp. Resp must include same token.
- */
- void transferAtrReq(in int token);
-
- /**
- * TRANSFER_CARD_READER_STATUS_REQ from SAP 1.1 spec 5.1.17
- *
- * @param token Id to match req-resp. Resp must include same token.
- */
- void transferCardReaderStatusReq(in int token);
-}
diff --git a/radio/aidl/android/hardware/radio/ISapCallback.aidl b/radio/aidl/android/hardware/radio/ISapCallback.aidl
deleted file mode 100644
index 00e543b..0000000
--- a/radio/aidl/android/hardware/radio/ISapCallback.aidl
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-import android.hardware.radio.SapConnectRsp;
-import android.hardware.radio.SapDisconnectType;
-import android.hardware.radio.SapResultCode;
-import android.hardware.radio.SapStatus;
-
-@VintfStability
-oneway interface ISapCallback {
- /**
- * TRANSFER_APDU_RESP from SAP 1.1 spec 5.1.7
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param resultCode ResultCode to indicate if command was processed correctly
- * Possible values:
- * SapResultCode:SUCCESS,
- * SapResultCode:GENERIC_FAILURE,
- * SapResultCode:CARD_NOT_ACCESSSIBLE,
- * SapResultCode:CARD_ALREADY_POWERED_OFF,
- * SapResultCode:CARD_REMOVED
- * @param apduRsp APDU Response. Valid only if command was processed correctly and no error
- * occurred.
- */
- void apduResponse(in int token, in SapResultCode resultCode, in byte[] apduRsp);
-
- /**
- * CONNECT_RESP from SAP 1.1 spec 5.1.2
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param sapConnectRsp Connection Status
- * @param maxMsgSize MaxMsgSize supported by server if request cannot be fulfilled.
- * Valid only if connectResponse is SapConnectResponse:MSG_SIZE_TOO_LARGE.
- */
- void connectResponse(in int token, in SapConnectRsp sapConnectRsp, in int maxMsgSize);
-
- /**
- * DISCONNECT_IND from SAP 1.1 spec 5.1.5
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param disconnectType Disconnect Type to indicate if shutdown is graceful or immediate
- */
- void disconnectIndication(in int token, in SapDisconnectType disconnectType);
-
- /**
- * DISCONNECT_RESP from SAP 1.1 spec 5.1.4
- *
- * @param token Id to match req-resp. Value must match the one in req.
- */
- void disconnectResponse(in int token);
-
- /**
- * ERROR_RESP from SAP 1.1 spec 5.1.19
- *
- * @param token Id to match req-resp. Value must match the one in req.
- */
- void errorResponse(in int token);
-
- /**
- * POWER_SIM_OFF_RESP and POWER_SIM_ON_RESP from SAP 1.1 spec 5.1.11 + 5.1.13
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param resultCode ResultCode to indicate if command was processed correctly
- * Possible values:
- * SapResultCode:SUCCESS,
- * SapResultCode:GENERIC_FAILURE,
- * SapResultCode:CARD_NOT_ACCESSSIBLE, (possible only for power on req)
- * SapResultCode:CARD_ALREADY_POWERED_OFF, (possible only for power off req)
- * SapResultCode:CARD_REMOVED,
- * SapResultCode:CARD_ALREADY_POWERED_ON (possible only for power on req)
- */
- void powerResponse(in int token, in SapResultCode resultCode);
-
- /**
- * RESET_SIM_RESP from SAP 1.1 spec 5.1.15
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param resultCode ResultCode to indicate if command was processed correctly
- * Possible values:
- * SapResultCode:SUCCESS,
- * SapResultCode:GENERIC_FAILURE,
- * SapResultCode:CARD_NOT_ACCESSSIBLE,
- * SapResultCode:CARD_ALREADY_POWERED_OFF,
- * SapResultCode:CARD_REMOVED
- */
- void resetSimResponse(in int token, in SapResultCode resultCode);
-
- /**
- * STATUS_IND from SAP 1.1 spec 5.1.16
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param status Parameter to indicate reason for the status change.
- */
- void statusIndication(in int token, in SapStatus status);
-
- /**
- * TRANSFER_ATR_RESP from SAP 1.1 spec 5.1.9
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param resultCode ResultCode to indicate if command was processed correctly
- * Possible values:
- * SapResultCode:SUCCESS,
- * SapResultCode:GENERIC_FAILURE,
- * SapResultCode:CARD_ALREADY_POWERED_OFF,
- * SapResultCode:CARD_REMOVED,
- * SapResultCode:DATA_NOT_AVAILABLE
- * @param atr Answer to Reset from the subscription module. Included only if no error occurred,
- * otherwise empty.
- */
- void transferAtrResponse(in int token, in SapResultCode resultCode, in byte[] atr);
-
- /**
- * TRANSFER_CARD_READER_STATUS_REQ from SAP 1.1 spec 5.1.18
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param resultCode ResultCode to indicate if command was processed correctly
- * Possible values:
- * SapResultCode:SUCCESS,
- * SapResultCode:GENERIC_FAILURE
- * SapResultCode:DATA_NOT_AVAILABLE
- * @param cardReaderStatus Card Reader Status coded as described in 3GPP TS 11.14 Section 12.33
- * and TS 31.111 Section 8.33
- */
- void transferCardReaderStatusResponse(
- in int token, in SapResultCode resultCode, in int cardReaderStatus);
-
- /**
- * SET_TRANSPORT_PROTOCOL_RESP from SAP 1.1 spec 5.1.21
- *
- * @param token Id to match req-resp. Value must match the one in req.
- * @param resultCode ResultCode to indicate if command was processed correctly
- * Possible values:
- * SapResultCode:SUCCESS
- * SapResultCode:NOT_SUPPORTED
- */
- void transferProtocolResponse(in int token, in SapResultCode resultCode);
-}
diff --git a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl
index 719837d..b8fbf9b 100644
--- a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl
+++ b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl
@@ -39,6 +39,7 @@
HSPAP = 1 << RadioTechnology.HSPAP,
GSM = 1 << RadioTechnology.GSM,
TD_SCDMA = 1 << RadioTechnology.TD_SCDMA,
+ IWLAN = 1 << RadioTechnology.IWLAN,
LTE_CA = 1 << RadioTechnology.LTE_CA,
/**
* 5G NR. This is only use in 5G Standalone mode.
diff --git a/radio/aidl/android/hardware/radio/RadioConst.aidl b/radio/aidl/android/hardware/radio/RadioConst.aidl
index 2e1bcf0..cd03f84 100644
--- a/radio/aidl/android/hardware/radio/RadioConst.aidl
+++ b/radio/aidl/android/hardware/radio/RadioConst.aidl
@@ -17,24 +17,12 @@
package android.hardware.radio;
@VintfStability
-@Backing(type="int")
-enum RadioConst {
- CDMA_ALPHA_INFO_BUFFER_LENGTH = 64,
- CDMA_NUMBER_INFO_BUFFER_LENGTH = 81,
- MAX_RILDS = 3,
- MAX_SOCKET_NAME_LENGTH = 6,
- MAX_CLIENT_ID_LENGTH = 2,
- MAX_DEBUG_SOCKET_NAME_LENGTH = 12,
- MAX_QEMU_PIPE_NAME_LENGTH = 11,
- MAX_UUID_LENGTH = 64,
- CARD_MAX_APPS = 8,
- CDMA_MAX_NUMBER_OF_INFO_RECS = 10,
- SS_INFO_MAX = 4,
- NUM_SERVICE_CLASSES = 7,
- NUM_TX_POWER_LEVELS = 5,
- RADIO_ACCESS_SPECIFIER_MAX_SIZE = 8,
+parcelable RadioConst {
+ const int MAX_RILDS = 3;
+ const int MAX_UUID_LENGTH = 64;
+ const int CARD_MAX_APPS = 8;
/**
* No P2 value is provided
*/
- P2_CONSTANT_NO_P2 = -1,
+ const int P2_CONSTANT_NO_P2 = -1;
}
diff --git a/radio/aidl/android/hardware/radio/SapApduType.aidl b/radio/aidl/android/hardware/radio/SapApduType.aidl
deleted file mode 100644
index f697e58..0000000
--- a/radio/aidl/android/hardware/radio/SapApduType.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-@VintfStability
-@Backing(type="int")
-enum SapApduType {
- APDU,
- APDU7816,
-}
diff --git a/radio/aidl/android/hardware/radio/SapConnectRsp.aidl b/radio/aidl/android/hardware/radio/SapConnectRsp.aidl
deleted file mode 100644
index d2046d2..0000000
--- a/radio/aidl/android/hardware/radio/SapConnectRsp.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-@VintfStability
-@Backing(type="int")
-enum SapConnectRsp {
- SUCCESS,
- CONNECT_FAILURE,
- MSG_SIZE_TOO_LARGE,
- MSG_SIZE_TOO_SMALL,
- CONNECT_OK_CALL_ONGOING,
-}
diff --git a/radio/aidl/android/hardware/radio/SapDisconnectType.aidl b/radio/aidl/android/hardware/radio/SapDisconnectType.aidl
deleted file mode 100644
index 30a04bd..0000000
--- a/radio/aidl/android/hardware/radio/SapDisconnectType.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-@VintfStability
-@Backing(type="int")
-enum SapDisconnectType {
- GRACEFUL,
- IMMEDIATE,
-}
diff --git a/radio/aidl/android/hardware/radio/SapResultCode.aidl b/radio/aidl/android/hardware/radio/SapResultCode.aidl
deleted file mode 100644
index db87374..0000000
--- a/radio/aidl/android/hardware/radio/SapResultCode.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-@VintfStability
-@Backing(type="int")
-enum SapResultCode {
- SUCCESS,
- GENERIC_FAILURE,
- CARD_NOT_ACCESSSIBLE,
- CARD_ALREADY_POWERED_OFF,
- CARD_REMOVED,
- CARD_ALREADY_POWERED_ON,
- DATA_NOT_AVAILABLE,
- NOT_SUPPORTED,
-}
diff --git a/radio/aidl/android/hardware/radio/SapStatus.aidl b/radio/aidl/android/hardware/radio/SapStatus.aidl
deleted file mode 100644
index 0a6b4a7..0000000
--- a/radio/aidl/android/hardware/radio/SapStatus.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-@VintfStability
-@Backing(type="int")
-enum SapStatus {
- UNKNOWN_ERROR,
- CARD_RESET,
- CARD_NOT_ACCESSIBLE,
- CARD_REMOVED,
- CARD_INSERTED,
- RECOVERED,
-}
diff --git a/radio/aidl/android/hardware/radio/SapTransferProtocol.aidl b/radio/aidl/android/hardware/radio/SapTransferProtocol.aidl
deleted file mode 100644
index 7f385de..0000000
--- a/radio/aidl/android/hardware/radio/SapTransferProtocol.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio;
-
-@VintfStability
-@Backing(type="int")
-enum SapTransferProtocol {
- T0,
- T1,
-}
diff --git a/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
index 78f1309..54b9890 100644
--- a/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
+++ b/radio/aidl/android/hardware/radio/config/SimPortInfo.aidl
@@ -34,18 +34,10 @@
* Logical slot id is identifier of the active slot
*/
int logicalSlotId;
- /*
- * Port is Inactive
- * Inactive means logical modem is no longer associated to the port
- */
- const int PORT_STATE_INACTIVE = 0;
- /*
- * Port is Active
- * Active means logical modem is associated to the port
- */
- const int PORT_STATE_ACTIVE = 1;
/**
- * Port state in the slot. Values are portState.[PORT_STATE_INACTIVE, PORT_STATE_ACTIVE].
+ * Port active status in the slot.
+ * Inactive means logical modem is no longer associated to the port.
+ * Active means logical modem is associated to the port.
*/
- int portState;
+ boolean portActive;
}
diff --git a/radio/aidl/android/hardware/radio/data/SliceInfo.aidl b/radio/aidl/android/hardware/radio/data/SliceInfo.aidl
index dd315e8..0943031 100644
--- a/radio/aidl/android/hardware/radio/data/SliceInfo.aidl
+++ b/radio/aidl/android/hardware/radio/data/SliceInfo.aidl
@@ -83,7 +83,7 @@
* value. A value of -1 indicates that there is no corresponding SliceInfo of the HPLMN.
* See: 3GPP TS 24.501 Section 9.11.2.8.
*/
- int mappedHplmnSD;
+ int mappedHplmnSd;
/**
* Field to indicate the current status of the slice.
* Values are STATUS_
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl
index e271e50..ae6fda4 100644
--- a/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl
+++ b/radio/aidl/android/hardware/radio/network/CellIdentityCdma.aidl
@@ -16,7 +16,7 @@
package android.hardware.radio.network;
-import android.hardware.radio.network.CellIdentityOperatorNames;
+import android.hardware.radio.network.OperatorInfo;
@VintfStability
parcelable CellIdentityCdma {
@@ -44,5 +44,8 @@
* (corresponding to a range of -90 to +90 degrees). INT_MAX if unknown
*/
int latitude;
- CellIdentityOperatorNames operatorNames;
+ /**
+ * OperatorInfo containing alphaLong and alphaShort
+ */
+ OperatorInfo operatorNames;
}
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl
index 7b711ad..75a96e8 100644
--- a/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl
+++ b/radio/aidl/android/hardware/radio/network/CellIdentityGsm.aidl
@@ -16,7 +16,7 @@
package android.hardware.radio.network;
-import android.hardware.radio.network.CellIdentityOperatorNames;
+import android.hardware.radio.network.OperatorInfo;
@VintfStability
parcelable CellIdentityGsm {
@@ -44,7 +44,10 @@
* 6-bit Base Station Identity Code, 0xFF if unknown
*/
byte bsic;
- CellIdentityOperatorNames operatorNames;
+ /**
+ * OperatorInfo containing alphaLong and alphaShort
+ */
+ OperatorInfo operatorNames;
/**
* Additional PLMN-IDs beyond the primary PLMN broadcast for this cell
*/
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl
index d4f83a3..ae52cf2 100644
--- a/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl
+++ b/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl
@@ -16,9 +16,9 @@
package android.hardware.radio.network;
-import android.hardware.radio.network.CellIdentityOperatorNames;
import android.hardware.radio.network.ClosedSubscriberGroupInfo;
import android.hardware.radio.network.EutranBands;
+import android.hardware.radio.network.OperatorInfo;
@VintfStability
parcelable CellIdentityLte {
@@ -46,7 +46,10 @@
* 18-bit LTE Absolute RF Channel Number; this value must be valid
*/
int earfcn;
- CellIdentityOperatorNames operatorNames;
+ /**
+ * OperatorInfo containing alphaLong and alphaShort
+ */
+ OperatorInfo operatorNames;
/**
* Cell bandwidth, in kHz.
*/
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl
index dfccbf7..73a56ea 100644
--- a/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl
+++ b/radio/aidl/android/hardware/radio/network/CellIdentityNr.aidl
@@ -16,8 +16,8 @@
package android.hardware.radio.network;
-import android.hardware.radio.network.CellIdentityOperatorNames;
import android.hardware.radio.network.NgranBands;
+import android.hardware.radio.network.OperatorInfo;
/**
* The CellIdentity structure should be reported once for each element of the PLMN-IdentityInfoList
@@ -55,7 +55,10 @@
* This value must be valid.
*/
int nrarfcn;
- CellIdentityOperatorNames operatorNames;
+ /**
+ * OperatorInfo containing alphaLong and alphaShort
+ */
+ OperatorInfo operatorNames;
/**
* Additional PLMN-IDs beyond the primary PLMN broadcast for this cell
*/
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityOperatorNames.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityOperatorNames.aidl
deleted file mode 100644
index 540014a..0000000
--- a/radio/aidl/android/hardware/radio/network/CellIdentityOperatorNames.aidl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.network;
-
-@VintfStability
-parcelable CellIdentityOperatorNames {
- /**
- * Long alpha operator name string or enhanced operator name string.
- */
- String alphaLong;
- /**
- * Short alpha operator name string or enhanced operator name string.
- */
- String alphaShort;
-}
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl
index 99c8151..5b00df1 100644
--- a/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl
+++ b/radio/aidl/android/hardware/radio/network/CellIdentityTdscdma.aidl
@@ -16,8 +16,8 @@
package android.hardware.radio.network;
-import android.hardware.radio.network.CellIdentityOperatorNames;
import android.hardware.radio.network.ClosedSubscriberGroupInfo;
+import android.hardware.radio.network.OperatorInfo;
@VintfStability
parcelable CellIdentityTdscdma {
@@ -45,7 +45,10 @@
* 16-bit UMTS Absolute RF Channel Number defined in TS 25.102 5.4.4; this value must be valid.
*/
int uarfcn;
- CellIdentityOperatorNames operatorNames;
+ /**
+ * OperatorInfo containing alphaLong and alphaShort
+ */
+ OperatorInfo operatorNames;
/**
* Additional PLMN-IDs beyond the primary PLMN broadcast for this cell.
*/
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl
index 302be96..bf4d6cb 100644
--- a/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl
+++ b/radio/aidl/android/hardware/radio/network/CellIdentityWcdma.aidl
@@ -16,8 +16,8 @@
package android.hardware.radio.network;
-import android.hardware.radio.network.CellIdentityOperatorNames;
import android.hardware.radio.network.ClosedSubscriberGroupInfo;
+import android.hardware.radio.network.OperatorInfo;
@VintfStability
parcelable CellIdentityWcdma {
@@ -45,7 +45,10 @@
* 16-bit UMTS Absolute RF Channel Number; this value must be valid.
*/
int uarfcn;
- CellIdentityOperatorNames operatorNames;
+ /**
+ * OperatorInfo containing alphaLong and alphaShort
+ */
+ OperatorInfo operatorNames;
/**
* Additional PLMN-IDs beyond the primary PLMN broadcast for this cell.
*/
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
index 0db918d..1081a75 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
@@ -114,15 +114,6 @@
void getImsRegistrationState(in int serial);
/**
- * Request neighboring cell id in GSM network
- *
- * @param serial Serial number of request.
- *
- * Response function is IRadioNetworkResponse.getNeighboringCidsResponse()
- */
- void getNeighboringCids(in int serial);
-
- /**
* Query current network selection mode
*
* @param serial Serial number of request.
@@ -187,15 +178,6 @@
void isNrDualConnectivityEnabled(in int serial);
/**
- * Pull LCE service for capacity information.
- *
- * @param serial Serial number of request.
- *
- * Response function is IRadioNetworkResponse.pullLceDataResponse()
- */
- void pullLceData(in int serial);
-
- /**
* When response type received from a radio indication or radio response is
* RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively,
* acknowledge the receipt of those messages by sending responseAcknowledgement().
@@ -364,29 +346,22 @@
in IRadioNetworkIndication radioNetworkIndication);
/**
- * Sets the signal strength reporting criteria. The resulting reporting rules are the AND of all
- * the supplied criteria. For each RAN the hysteresisDb and thresholds apply to only the
- * following measured quantities:
- * -GERAN - RSSI
- * -CDMA2000 - RSSI
- * -UTRAN - RSCP
- * -EUTRAN - RSRP/RSRQ/RSSNR
- * -NGRAN - SSRSRP/SSRSRQ/SSSINR
- * Note that reporting criteria must be individually set for each RAN. For each RAN, if none of
- * reporting criteria of any measurement is set enabled (see SignalThresholdInfo.isEnabled),
- * the reporting criteria for this RAN is implementation-defined. For each RAN, if any reporting
- * criteria of any measure is set enabled, the reporting criteria of the other measures in this
- * RAN are set disabled (see SignalThresholdInfo.isEnabled) until they are set enabled.
+ * Sets or clears the signal strength reporting criteria for multiple RANs in one request.
+ *
+ * The reporting criteria are set individually for each combination of RAN and measurement type.
+ * For each RAN type, if no reporting criteria are set, then the reporting of SignalStrength for
+ * that RAN is implementation-defined. If any criteria are supplied for a RAN type, then
+ * SignalStrength is only reported as specified by those criteria. For any RAN types not defined
+ * by this HAL, reporting is implementation-defined.
*
* @param serial Serial number of request.
- * @param signalThresholdInfo Signal threshold info including the threshold values,
- * hysteresisDb, hysteresisMs and isEnabled. See SignalThresholdInfo for details.
- * @param accessNetwork The type of network for which to apply these thresholds.
+ * @param signalThresholdInfos Collection of SignalThresholdInfo specifying the reporting
+ * criteria. See SignalThresholdInfo for details.
*
* Response function is IRadioNetworkResponse.setSignalStrengthReportingCriteriaResponse()
*/
- void setSignalStrengthReportingCriteria(in int serial,
- in SignalThresholdInfo signalThresholdInfo, in AccessNetwork accessNetwork);
+ void setSignalStrengthReportingCriteria(
+ in int serial, in SignalThresholdInfo[] signalThresholdInfos);
/**
* Enables/disables supplementary service related notifications from the network.
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
index ae2646d..429b5a8 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
@@ -179,25 +179,6 @@
/**
* @param info Response info struct containing response type, serial no. and error
- * @param cells Vector of neighboring radio cell
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:INVALID_ARGUMENTS
- * RadioError:NO_MEMORY
- * RadioError:INTERNAL_ERR
- * RadioError:SYSTEM_ERR
- * RadioError:MODEM_ERR
- * RadioError:NO_NETWORK_FOUND
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:NO_RESOURCES
- * RadioError:CANCELLED
- */
- void getNeighboringCidsResponse(in RadioResponseInfo info, in NeighboringCell[] cells);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
* @param selection false for automatic selection, true for manual selection
*
* Valid errors returned:
@@ -299,23 +280,6 @@
/**
* @param info Response info struct containing response type, serial no. and error
- * @param lceInfo LceDataInfo indicating LCE data
- *
- * Valid errors returned:
- * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported.
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:LCE_NOT_SUPPORTED
- * RadioError:INTERNAL_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:CANCELLED
- * RadioError:SIM_ABSENT
- */
- void pullLceDataResponse(in RadioResponseInfo info, in LceDataInfo lceInfo);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
*
* Valid errors returned:
* RadioError:NONE
diff --git a/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl b/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl
index ec8aa95..7cea1de 100644
--- a/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl
+++ b/radio/aidl/android/hardware/radio/network/NetworkScanRequest.aidl
@@ -20,6 +20,8 @@
@VintfStability
parcelable NetworkScanRequest {
+ const int RADIO_ACCESS_SPECIFIER_MAX_SIZE = 8;
+
const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MIN = 1;
const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MAX = 10;
@@ -50,7 +52,7 @@
int interval;
/**
* Networks with bands/channels to scan.
- * Maximum length of the vector is RadioConst:RADIO_ACCESS_SPECIFIER_MAX_SIZE.
+ * Maximum length of the vector is RADIO_ACCESS_SPECIFIER_MAX_SIZE.
*/
RadioAccessSpecifier[] specifiers;
/**
diff --git a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl
index bd681e7..312182e 100644
--- a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl
+++ b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl
@@ -32,10 +32,11 @@
*/
RegState regState;
/**
- * Indicates the available voice radio technology, valid values as defined by RadioTechnology,
- * except LTE_CA, which is no longer a valid value on 1.5 or above. When the device is on
- * carrier aggregation, vendor RIL service should properly report multiple PhysicalChannelConfig
- * elements through IRadioNetwork::currentPhysicalChannelConfigs.
+ * Indicates the radio technology (except LTE_CA, which is no longer a valid value), which
+ * must not be UNKNOWN if regState is REG_HOME, REG_ROAMING, NOT_REG_MT_NOT_SEARCHING_OP_EM,
+ * NOT_REG_MT_SEARCHING_OP_EM, REG_DENIED_EM, or UNKNOWN_EM.
+ * When the device is on carrier aggregation, vendor RIL service must properly report multiple
+ * PhysicalChannelConfig elements through IRadioNetwork::currentPhysicalChannelConfigs.
*/
RadioTechnology rat;
/**
diff --git a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl
index 696292d..584ea38 100644
--- a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl
+++ b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl
@@ -16,6 +16,8 @@
package android.hardware.radio.network;
+import android.hardware.radio.AccessNetwork;
+
/**
* Contains the threshold values of each signal measurement type.
*/
@@ -86,18 +88,20 @@
*/
int signalMeasurement;
/**
- * A hysteresis time in milliseconds to prevent flapping. A value of 0 disables hysteresis.
+ * A hysteresis time in milliseconds for current signal measurement type to prevent flapping.
+ * A value of 0 disables hysteresis.
*/
int hysteresisMs;
/**
- * An interval in dB defining the required magnitude change between reports. This must be
- * smaller than the smallest threshold delta. An interval value of 0 disables hysteresis.
+ * An interval in dB for current signal measurement type defining the required magnitude change
+ * between reports. This must be smaller than the smallest threshold delta. An interval value of
+ * 0 disables hysteresis.
*/
int hysteresisDb;
/**
- * List of threshold values. Range and unit must reference specific SignalMeasurementType.
- * The threshold values for which to apply criteria. A vector size of 0 disables the use of
- * thresholds for reporting.
+ * List of threshold values for current signal measurement type. Range and unit must reference
+ * specific SignalMeasurementType. The threshold values for which to apply criteria. A vector
+ * size of 0 disables the use of thresholds for reporting.
*/
int[] thresholds;
/**
@@ -106,4 +110,8 @@
* If disabled, modem must not trigger the report based on the criteria.
*/
boolean isEnabled;
+ /**
+ * The Radio Access Network for current threshold info.
+ */
+ AccessNetwork ran;
}
diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl
index 902c90c..c731caf 100644
--- a/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl
+++ b/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl
@@ -262,17 +262,6 @@
in int serial, in int authContext, in String authData, in String aid);
/**
- * Request the ISIM application on the UICC to perform AKA challenge/response algorithm
- * for IMS authentication
- *
- * @param serial Serial number of request.
- * @param challenge challenge string in Base64 format
- *
- * Response function is IRadioSimResponse.requestIsimAuthenticationResponse()
- */
- void requestIsimAuthentication(in int serial, in String challenge);
-
- /**
* When response type received from a radio indication or radio response is
* RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively,
* acknowledge the receipt of those messages by sending responseAcknowledgement().
@@ -284,11 +273,11 @@
* The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111
*
* @param serial Serial number of request.
- * @param command SAT/USAT command in hexadecimal format string starting with command tag
+ * @param contents SAT/USAT command in hexadecimal format string starting with command tag
*
* Response function is IRadioSimResponse.sendEnvelopeResponse()
*/
- void sendEnvelope(in int serial, in String command);
+ void sendEnvelope(in int serial, in String contents);
/**
* Requests to send a SAT/USAT envelope command to SIM. The SAT/USAT envelope command refers to
@@ -309,12 +298,12 @@
* Requests to send a terminal response to SIM for a received proactive command
*
* @param serial Serial number of request.
- * @param commandResponse SAT/USAT response in hexadecimal format string starting with
+ * @param contents SAT/USAT response in hexadecimal format string starting with
* first byte of response data
*
* Response function is IRadioSimResponse.sendTerminalResponseResponseToSim()
*/
- void sendTerminalResponseToSim(in int serial, in String commandResponse);
+ void sendTerminalResponseToSim(in int serial, in String contents);
/**
* Set carrier restrictions. Expected modem behavior:
diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl
index dcc7029..750a29a 100644
--- a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl
+++ b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl
@@ -365,24 +365,6 @@
/**
* @param info Response info struct containing response type, serial no. and error
- * @param response response string of the challenge/response algo for ISIM auth in base64 format
- *
- * Valid errors returned:
- * RadioError:NONE
- * RadioError:RADIO_NOT_AVAILABLE
- * RadioError:INTERNAL_ERR
- * RadioError:NO_MEMORY
- * RadioError:NO_RESOURCES
- * RadioError:CANCELLED
- * RadioError:INVALID_MODEM_STATE
- * RadioError:INVALID_ARGUMENTS
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:SIM_ABSENT
- */
- void requestIsimAuthenticationResponse(in RadioResponseInfo info, in String response);
-
- /**
- * @param info Response info struct containing response type, serial no. and error
* @param commandResponse SAT/USAT response in hexadecimal format string starting with first
* byte of response
*
diff --git a/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl
index 18a1ce4..ac66237 100644
--- a/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl
+++ b/radio/aidl/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl
@@ -25,8 +25,9 @@
*/
@VintfStability
parcelable CdmaDisplayInfoRecord {
+ const int CDMA_ALPHA_INFO_BUFFER_LENGTH = 64;
/**
- * Max length = RadioConst:CDMA_ALPHA_INFO_BUFFER_LENGTH
+ * Max length = CDMA_ALPHA_INFO_BUFFER_LENGTH
*/
String alphaBuf;
}
diff --git a/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl
index af37dac..6920462 100644
--- a/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl
+++ b/radio/aidl/android/hardware/radio/voice/CdmaInformationRecord.aidl
@@ -25,7 +25,11 @@
import android.hardware.radio.voice.CdmaT53ClirInfoRecord;
@VintfStability
+/**
+ * Max length of CdmaInformationRecords[] is CDMA_MAX_NUMBER_OF_INFO_RECS
+ */
parcelable CdmaInformationRecord {
+ const int CDMA_MAX_NUMBER_OF_INFO_RECS = 10;
/**
* Names of the CDMA info records (C.S0005 section 3.7.5)
*/
diff --git a/radio/aidl/android/hardware/radio/voice/CdmaInformationRecords.aidl b/radio/aidl/android/hardware/radio/voice/CdmaInformationRecords.aidl
deleted file mode 100644
index 46a9b1a..0000000
--- a/radio/aidl/android/hardware/radio/voice/CdmaInformationRecords.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.radio.voice;
-
-import android.hardware.radio.voice.CdmaInformationRecord;
-
-@VintfStability
-parcelable CdmaInformationRecords {
- /**
- * Max length = RadioConst:CDMA_MAX_NUMBER_OF_INFO_RECS
- */
- CdmaInformationRecord[] infoRec;
-}
diff --git a/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl b/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl
index 41ce08f..265bf67 100644
--- a/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl
+++ b/radio/aidl/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl
@@ -23,8 +23,9 @@
*/
@VintfStability
parcelable CdmaNumberInfoRecord {
+ const int CDMA_NUMBER_INFO_BUFFER_LENGTH = 81;
/**
- * Max length = RadioConst::CDMA_NUMBER_INFO_BUFFER_LENGTH
+ * Max length = CDMA_NUMBER_INFO_BUFFER_LENGTH
*/
String number;
byte numberType;
diff --git a/radio/aidl/android/hardware/radio/voice/CfData.aidl b/radio/aidl/android/hardware/radio/voice/CfData.aidl
index 8d7c4bd..f28c7c8 100644
--- a/radio/aidl/android/hardware/radio/voice/CfData.aidl
+++ b/radio/aidl/android/hardware/radio/voice/CfData.aidl
@@ -20,9 +20,10 @@
@VintfStability
parcelable CfData {
+ const int NUM_SERVICE_CLASSES = 7;
/**
* This is the response data for SS request to query call forward status.
- * See getCallForwardStatus(). Max size = RadioConst:NUM_SERVICE_CLASSES.
+ * See getCallForwardStatus(). Max size = NUM_SERVICE_CLASSES.
*/
CallForwardInfo[] cfInfo;
}
diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
index 1e60de5..a012be4 100644
--- a/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
+++ b/radio/aidl/android/hardware/radio/voice/IRadioVoice.aidl
@@ -267,6 +267,15 @@
void hangupWaitingOrBackground(in int serial);
/**
+ * Query current Voice NR enable state
+ *
+ * @param serial Serial number of request.
+ *
+ * Response function is IRadioVoiceResponse.isVoNrEnabledResponse()
+ */
+ void isVoNrEnabled(in int serial);
+
+ /**
* Send UDUB (user determined user busy) to ringing or waiting call answer)
*
* @param serial Serial number of request.
@@ -404,6 +413,16 @@
void setTtyMode(in int serial, in TtyMode mode);
/**
+ * Set Voice NR enable state
+ *
+ * @param serial Serial number of request.
+ * @param enable true for "enable vonr" and false for "disable vonr"
+ *
+ * Response function is IRadioVoiceResponse.setVoNrEnabledResponse()
+ */
+ void setVoNrEnabled(in int serial, in boolean enable);
+
+ /**
* Start playing a DTMF tone. Continue playing DTMF tone until stopDtmf is received. If a
* startDtmf() is received while a tone is currently playing, it must cancel the previous tone
* and play the new one.
diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl
index 81640f3..25e87b3 100644
--- a/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl
+++ b/radio/aidl/android/hardware/radio/voice/IRadioVoiceIndication.aidl
@@ -18,7 +18,7 @@
import android.hardware.radio.RadioIndicationType;
import android.hardware.radio.voice.CdmaCallWaiting;
-import android.hardware.radio.voice.CdmaInformationRecords;
+import android.hardware.radio.voice.CdmaInformationRecord;
import android.hardware.radio.voice.CdmaOtaProvisionStatus;
import android.hardware.radio.voice.CdmaSignalInfoRecord;
import android.hardware.radio.voice.EmergencyNumber;
@@ -67,9 +67,10 @@
* Indicates when CDMA radio receives one or more info recs.
*
* @param type Type of radio indication
- * @param records New Cdma Information
+ * @param records New CDMA information records.
+ * Max length is RadioConst:CDMA_MAX_NUMBER_OF_INFO_RECS
*/
- void cdmaInfoRec(in RadioIndicationType type, in CdmaInformationRecords records);
+ void cdmaInfoRec(in RadioIndicationType type, in CdmaInformationRecord[] records);
/**
* Indicates when CDMA radio receives an update of the progress of an OTASP/OTAPA call.
diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl
index f3cf5fb..d126fc1 100644
--- a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl
+++ b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl
@@ -468,6 +468,20 @@
/**
* @param info Response info struct containing response type, serial no. and error
+ * @param enable true for "vonr enabled" and false for "vonr disabled"
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:REQUEST_NOT_SUPPORTED
+ */
+ void isVoNrEnabledResponse(in RadioResponseInfo info, in boolean enable);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
*
* Valid errors returned:
* RadioError:NONE
@@ -694,6 +708,20 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INVALID_ARGUMENTS
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:REQUEST_NOT_SUPPORTED
+ */
+ void setVoNrEnabledResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_ARGUMENTS
* RadioError:NO_RESOURCES
* RadioError:NO_MEMORY
* RadioError:SYSTEM_ERR
diff --git a/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl b/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl
index 40af393..d562925 100644
--- a/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl
+++ b/radio/aidl/android/hardware/radio/voice/SsInfoData.aidl
@@ -18,11 +18,12 @@
@VintfStability
parcelable SsInfoData {
+ const int SS_INFO_MAX = 4;
/**
* This is the response data for all of the SS GET/SET Radio requests.
* E.g. IRadioVoice.getClir() returns two ints, so first two values of ssInfo[] will be used for
* response if serviceType is SS_CLIR and requestType is SS_INTERROGATION.
- * Max size = RadioConst:SS_INFO_MAX
+ * Max size = SS_INFO_MAX
*/
int[] ssInfo;
}
diff --git a/security/keymint/aidl/OWNERS b/security/OWNERS
similarity index 100%
rename from security/keymint/aidl/OWNERS
rename to security/OWNERS
diff --git a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
index 6f2f189..3cbffbf 100644
--- a/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
+++ b/security/keymint/aidl/vts/functional/DeviceUniqueAttestationTest.cpp
@@ -78,6 +78,7 @@
.Digest(Digest::SHA_2_256)
.Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)
.Authorization(TAG_INCLUDE_UNIQUE_ID)
+ .Authorization(TAG_CREATION_DATETIME, 1619621648000)
.AttestationChallenge("challenge")
.AttestationApplicationId("foo")
.Authorization(TAG_DEVICE_UNIQUE_ATTESTATION),
@@ -106,6 +107,7 @@
.EcdsaSigningKey(EcCurve::P_256)
.Digest(Digest::SHA_2_256)
.Authorization(TAG_INCLUDE_UNIQUE_ID)
+ .Authorization(TAG_CREATION_DATETIME, 1619621648000)
.AttestationChallenge("challenge")
.AttestationApplicationId("foo")
.Authorization(TAG_DEVICE_UNIQUE_ATTESTATION),
@@ -135,6 +137,7 @@
.Digest(Digest::SHA_2_256)
.Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)
.Authorization(TAG_INCLUDE_UNIQUE_ID)
+ .Authorization(TAG_CREATION_DATETIME, 1619621648000)
.AttestationChallenge("challenge")
.AttestationApplicationId("foo")
.Authorization(TAG_DEVICE_UNIQUE_ATTESTATION),
@@ -192,6 +195,7 @@
.EcdsaSigningKey(EcCurve::P_256)
.Digest(Digest::SHA_2_256)
.Authorization(TAG_INCLUDE_UNIQUE_ID)
+ .Authorization(TAG_CREATION_DATETIME, 1619621648000)
.AttestationChallenge("challenge")
.AttestationApplicationId("foo")
.Authorization(TAG_DEVICE_UNIQUE_ATTESTATION),
@@ -252,14 +256,16 @@
for (const KeyParameter& tag : attestation_id_tags) {
SCOPED_TRACE(testing::Message() << "+tag-" << tag);
- AuthorizationSetBuilder builder = AuthorizationSetBuilder()
- .Authorization(TAG_NO_AUTH_REQUIRED)
- .EcdsaSigningKey(EcCurve::P_256)
- .Digest(Digest::SHA_2_256)
- .Authorization(TAG_INCLUDE_UNIQUE_ID)
- .AttestationChallenge("challenge")
- .AttestationApplicationId("foo")
- .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION);
+ AuthorizationSetBuilder builder =
+ AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .EcdsaSigningKey(EcCurve::P_256)
+ .Digest(Digest::SHA_2_256)
+ .Authorization(TAG_INCLUDE_UNIQUE_ID)
+ .Authorization(TAG_CREATION_DATETIME, 1619621648000)
+ .AttestationChallenge("challenge")
+ .AttestationApplicationId("foo")
+ .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION);
builder.push_back(tag);
auto result = GenerateKey(builder, &key_blob, &key_characteristics);
@@ -322,14 +328,16 @@
for (const KeyParameter& invalid_tag : attestation_id_tags) {
SCOPED_TRACE(testing::Message() << "+tag-" << invalid_tag);
- AuthorizationSetBuilder builder = AuthorizationSetBuilder()
- .Authorization(TAG_NO_AUTH_REQUIRED)
- .EcdsaSigningKey(EcCurve::P_256)
- .Digest(Digest::SHA_2_256)
- .Authorization(TAG_INCLUDE_UNIQUE_ID)
- .AttestationChallenge("challenge")
- .AttestationApplicationId("foo")
- .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION);
+ AuthorizationSetBuilder builder =
+ AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .EcdsaSigningKey(EcCurve::P_256)
+ .Digest(Digest::SHA_2_256)
+ .Authorization(TAG_INCLUDE_UNIQUE_ID)
+ .Authorization(TAG_CREATION_DATETIME, 1619621648000)
+ .AttestationChallenge("challenge")
+ .AttestationApplicationId("foo")
+ .Authorization(TAG_DEVICE_UNIQUE_ATTESTATION);
// Add the tag that doesn't match the local device's real ID.
builder.push_back(invalid_tag);
auto result = GenerateKey(builder, &key_blob, &key_characteristics);
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index 670043d..92aa2ac 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -1627,13 +1627,13 @@
*/
TEST_P(NewKeyGenerationTest, EcdsaAttestationUniqueId) {
auto get_unique_id = [this](const std::string& app_id, uint64_t datetime,
- vector<uint8_t>* unique_id) {
+ vector<uint8_t>* unique_id, bool reset = false) {
auto challenge = "hello";
auto subject = "cert subj 2";
vector<uint8_t> subject_der(make_name_from_str(subject));
uint64_t serial_int = 0x1010;
vector<uint8_t> serial_blob(build_serial_blob(serial_int));
- const AuthorizationSetBuilder builder =
+ AuthorizationSetBuilder builder =
AuthorizationSetBuilder()
.Authorization(TAG_NO_AUTH_REQUIRED)
.Authorization(TAG_INCLUDE_UNIQUE_ID)
@@ -1645,6 +1645,9 @@
.AttestationApplicationId(app_id)
.Authorization(TAG_CREATION_DATETIME, datetime)
.SetDefaultValidity();
+ if (reset) {
+ builder.Authorization(TAG_RESET_SINCE_ID_ROTATION);
+ }
ASSERT_EQ(ErrorCode::OK, GenerateKey(builder));
ASSERT_GT(key_blob_.size(), 0U);
@@ -1706,6 +1709,11 @@
vector<uint8_t> unique_id8;
get_unique_id(app_id, min_date - 1, &unique_id8);
EXPECT_NE(unique_id, unique_id8);
+
+ // Marking RESET_SINCE_ID_ROTATION should give a different unique ID.
+ vector<uint8_t> unique_id9;
+ get_unique_id(app_id, cert_date, &unique_id9, /* reset_id = */ true);
+ EXPECT_NE(unique_id, unique_id9);
}
/*
diff --git a/security/keymint/support/OWNERS b/security/keymint/support/OWNERS
deleted file mode 100644
index a93b171..0000000
--- a/security/keymint/support/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-jbires@google.com
-jdanis@google.com
-seleneh@google.com
-swillden@google.com
diff --git a/security/secureclock/aidl/OWNERS b/security/secureclock/aidl/OWNERS
deleted file mode 100644
index a93b171..0000000
--- a/security/secureclock/aidl/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-jbires@google.com
-jdanis@google.com
-seleneh@google.com
-swillden@google.com
diff --git a/security/sharedsecret/aidl/OWNERS b/security/sharedsecret/aidl/OWNERS
deleted file mode 100644
index a93b171..0000000
--- a/security/sharedsecret/aidl/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-jbires@google.com
-jdanis@google.com
-seleneh@google.com
-swillden@google.com
diff --git a/sensors/1.0/vts/functional/OWNERS b/sensors/1.0/vts/functional/OWNERS
index 892da15..e20125b 100644
--- a/sensors/1.0/vts/functional/OWNERS
+++ b/sensors/1.0/vts/functional/OWNERS
@@ -1,8 +1,2 @@
-# Sensors team
-arthuri@google.com
-bduddie@google.com
-stange@google.com
-
-# VTS team
-trong@google.com
-yim@google.com
+# Bug component: 62965
+include ../../../common/vts/OWNERS
diff --git a/sensors/2.0/vts/functional/OWNERS b/sensors/2.0/vts/functional/OWNERS
index 892da15..e20125b 100644
--- a/sensors/2.0/vts/functional/OWNERS
+++ b/sensors/2.0/vts/functional/OWNERS
@@ -1,8 +1,2 @@
-# Sensors team
-arthuri@google.com
-bduddie@google.com
-stange@google.com
-
-# VTS team
-trong@google.com
-yim@google.com
+# Bug component: 62965
+include ../../../common/vts/OWNERS
diff --git a/sensors/2.1/vts/functional/OWNERS b/sensors/2.1/vts/functional/OWNERS
index 892da15..e20125b 100644
--- a/sensors/2.1/vts/functional/OWNERS
+++ b/sensors/2.1/vts/functional/OWNERS
@@ -1,8 +1,2 @@
-# Sensors team
-arthuri@google.com
-bduddie@google.com
-stange@google.com
-
-# VTS team
-trong@google.com
-yim@google.com
+# Bug component: 62965
+include ../../../common/vts/OWNERS
diff --git a/tv/cec/1.0/default/Android.bp b/tv/cec/1.0/default/Android.bp
index b4053df..e4c226d 100644
--- a/tv/cec/1.0/default/Android.bp
+++ b/tv/cec/1.0/default/Android.bp
@@ -15,6 +15,7 @@
srcs: [
"HdmiCec.cpp",
"HdmiCecDefault.cpp",
+ "HdmiCecPort.cpp",
],
shared_libs: [
diff --git a/tv/cec/1.0/default/HdmiCecDefault.cpp b/tv/cec/1.0/default/HdmiCecDefault.cpp
index 299bcf0..26ccb7d 100644
--- a/tv/cec/1.0/default/HdmiCecDefault.cpp
+++ b/tv/cec/1.0/default/HdmiCecDefault.cpp
@@ -16,19 +16,22 @@
#define LOG_TAG "android.hardware.tv.cec@1.0-impl"
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <cutils/properties.h>
+#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
-#include <linux/cec.h>
#include <linux/ioctl.h>
#include <poll.h>
-#include <pthread.h>
-#include <sys/eventfd.h>
-#include <algorithm>
#include "HdmiCecDefault.h"
+#define PROPERTY_DEVICE_TYPE "ro.hdmi.device_type"
+#define MIN_PORT_ID 0
+#define MAX_PORT_ID 15
+#define INVALID_PHYSICAL_ADDRESS 0xFFFF
+
namespace android {
namespace hardware {
namespace tv {
@@ -36,24 +39,14 @@
namespace V1_0 {
namespace implementation {
-// When set to false, all the CEC commands are discarded. True by default after initialization.
-bool mCecEnabled;
-/*
- * When set to false, HAL does not wake up the system upon receiving <Image View On> or
- * <Text View On>. True by default after initialization.
- */
-bool mWakeupEnabled;
-
-int mCecFd;
-int mExitFd;
-pthread_t mEventThread;
-sp<IHdmiCecCallback> mCallback;
+using android::base::GetUintProperty;
+using std::stoi;
+using std::string;
HdmiCecDefault::HdmiCecDefault() {
- mCecFd = -1;
- mExitFd = -1;
mCecEnabled = false;
mWakeupEnabled = false;
+ mCecControlEnabled = false;
mCallback = nullptr;
}
@@ -68,8 +61,8 @@
return Result::FAILURE_INVALID_ARGS;
}
- struct cec_log_addrs cecLogAddrs;
- int ret = ioctl(mCecFd, CEC_ADAP_G_LOG_ADDRS, &cecLogAddrs);
+ cec_log_addrs cecLogAddrs;
+ int ret = ioctl(mHdmiCecPorts[MIN_PORT_ID]->mCecFd, CEC_ADAP_G_LOG_ADDRS, &cecLogAddrs);
if (ret) {
LOG(ERROR) << "Add logical address failed, Error = " << strerror(errno);
return Result::FAILURE_BUSY;
@@ -135,27 +128,36 @@
cecLogAddrs.features[logAddrIndex][0] = 0;
cecLogAddrs.features[logAddrIndex][1] = 0;
- ret = ioctl(mCecFd, CEC_ADAP_S_LOG_ADDRS, &cecLogAddrs);
- if (ret) {
- LOG(ERROR) << "Add logical address failed, Error = " << strerror(errno);
- return Result::FAILURE_BUSY;
+ // Return failure only if add logical address fails for all the ports
+ Return<Result> result = Result::FAILURE_BUSY;
+ for (int i = 0; i < mHdmiCecPorts.size(); i++) {
+ ret = ioctl(mHdmiCecPorts[i]->mCecFd, CEC_ADAP_S_LOG_ADDRS, &cecLogAddrs);
+ if (ret) {
+ LOG(ERROR) << "Add logical address failed for port " << mHdmiCecPorts[i]->mPortId
+ << ", Error = " << strerror(errno);
+ } else {
+ result = Result::SUCCESS;
+ }
}
- return Result::SUCCESS;
+ return result;
}
Return<void> HdmiCecDefault::clearLogicalAddress() {
- struct cec_log_addrs cecLogAddrs;
+ cec_log_addrs cecLogAddrs;
memset(&cecLogAddrs, 0, sizeof(cecLogAddrs));
- int ret = ioctl(mCecFd, CEC_ADAP_S_LOG_ADDRS, &cecLogAddrs);
- if (ret) {
- LOG(ERROR) << "Clear logical Address failed, Error = " << strerror(errno);
+ for (int i = 0; i < mHdmiCecPorts.size(); i++) {
+ int ret = ioctl(mHdmiCecPorts[i]->mCecFd, CEC_ADAP_S_LOG_ADDRS, &cecLogAddrs);
+ if (ret) {
+ LOG(ERROR) << "Clear logical Address failed for port " << mHdmiCecPorts[i]->mPortId
+ << ", Error = " << strerror(errno);
+ }
}
return Void();
}
Return<void> HdmiCecDefault::getPhysicalAddress(getPhysicalAddress_cb callback) {
uint16_t addr;
- int ret = ioctl(mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
+ int ret = ioctl(mHdmiCecPorts[MIN_PORT_ID]->mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
if (ret) {
LOG(ERROR) << "Get physical address failed, Error = " << strerror(errno);
callback(Result::FAILURE_INVALID_STATE, addr);
@@ -170,7 +172,7 @@
return SendMessageResult::FAIL;
}
- struct cec_msg cecMsg;
+ cec_msg cecMsg;
memset(&cecMsg, 0, sizeof(cec_msg));
int initiator = static_cast<cec_logical_address_t>(message.initiator);
@@ -182,27 +184,25 @@
}
cecMsg.len = message.body.size() + 1;
- int ret = ioctl(mCecFd, CEC_TRANSMIT, &cecMsg);
+ // Return failure only if send message fails for all the ports
+ Return<SendMessageResult> result = SendMessageResult::FAIL;
+ for (int i = 0; i < mHdmiCecPorts.size(); i++) {
+ int ret = ioctl(mHdmiCecPorts[i]->mCecFd, CEC_TRANSMIT, &cecMsg);
- if (ret) {
- LOG(ERROR) << "Send message failed, Error = " << strerror(errno);
- return SendMessageResult::FAIL;
- }
+ if (ret) {
+ LOG(ERROR) << "Send message failed, Error = " << strerror(errno);
+ continue;
+ }
- if (cecMsg.tx_status != CEC_TX_STATUS_OK) {
- LOG(ERROR) << "Send message tx_status = " << cecMsg.tx_status;
- }
+ if (cecMsg.tx_status != CEC_TX_STATUS_OK) {
+ LOG(ERROR) << "Send message tx_status = " << cecMsg.tx_status;
+ }
- switch (cecMsg.tx_status) {
- case CEC_TX_STATUS_OK:
- return SendMessageResult::SUCCESS;
- case CEC_TX_STATUS_ARB_LOST:
- return SendMessageResult::BUSY;
- case CEC_TX_STATUS_NACK:
- return SendMessageResult::NACK;
- default:
- return SendMessageResult::FAIL;
+ if (result != SendMessageResult::SUCCESS) {
+ result = getSendMessageResult(cecMsg.tx_status);
+ }
}
+ return result;
}
Return<void> HdmiCecDefault::setCallback(const sp<IHdmiCecCallback>& callback) {
@@ -227,19 +227,25 @@
}
Return<void> HdmiCecDefault::getPortInfo(getPortInfo_cb callback) {
- uint16_t addr;
- int ret = ioctl(mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
- if (ret) {
- LOG(ERROR) << "Get port info failed, Error = " << strerror(errno);
+ hidl_vec<HdmiPortInfo> portInfos(mHdmiCecPorts.size());
+ for (int i = 0; i < mHdmiCecPorts.size(); i++) {
+ uint16_t addr = INVALID_PHYSICAL_ADDRESS;
+ int ret = ioctl(mHdmiCecPorts[i]->mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
+ if (ret) {
+ LOG(ERROR) << "Get port info failed for port : " << mHdmiCecPorts[i]->mPortId
+ << ", Error = " << strerror(errno);
+ }
+ HdmiPortType type = HdmiPortType::INPUT;
+ uint32_t deviceType = GetUintProperty<uint32_t>(PROPERTY_DEVICE_TYPE, CEC_DEVICE_PLAYBACK);
+ if (deviceType != CEC_DEVICE_TV && i == MIN_PORT_ID) {
+ type = HdmiPortType::OUTPUT;
+ }
+ portInfos[i] = {.type = type,
+ .portId = mHdmiCecPorts[i]->mPortId,
+ .cecSupported = true,
+ .arcSupported = false,
+ .physicalAddress = addr};
}
-
- unsigned int type = property_get_int32("ro.hdmi.device_type", CEC_DEVICE_PLAYBACK);
- hidl_vec<HdmiPortInfo> portInfos(1);
- portInfos[0] = {.type = (type == CEC_DEVICE_TV ? HdmiPortType::INPUT : HdmiPortType::OUTPUT),
- .portId = 1,
- .cecSupported = true,
- .arcSupported = false,
- .physicalAddress = addr};
callback(portInfos);
return Void();
}
@@ -254,7 +260,9 @@
LOG(DEBUG) << "setOption: WAKEUP: " << value;
mWakeupEnabled = value;
break;
- default:
+ case OptionKey::SYSTEM_CEC_CONTROL:
+ LOG(DEBUG) << "setOption: SYSTEM_CEC_CONTROL: " << value;
+ mCecControlEnabled = value;
break;
}
return Void();
@@ -268,9 +276,9 @@
return Void();
}
-Return<bool> HdmiCecDefault::isConnected(int32_t /*portId*/) {
+Return<bool> HdmiCecDefault::isConnected(int32_t portId) {
uint16_t addr;
- int ret = ioctl(mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
+ int ret = ioctl(mHdmiCecPorts[portId]->mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
if (ret) {
LOG(ERROR) << "Is connected failed, Error = " << strerror(errno);
return false;
@@ -281,79 +289,70 @@
return true;
}
-// Initialise the cec file descriptor
+int getPortId(string cecFilename) {
+ int portId = stoi(cecFilename.substr(3));
+ if (portId >= MIN_PORT_ID && portId <= MAX_PORT_ID) {
+ return portId;
+ } else {
+ return -1;
+ }
+}
+
+// Initialise the cec file descriptors
Return<Result> HdmiCecDefault::init() {
- const char* path = "/dev/cec0";
- mCecFd = open(path, O_RDWR);
- if (mCecFd < 0) {
- LOG(ERROR) << "Failed to open " << path << ", Error = " << strerror(errno);
- return Result::FAILURE_NOT_SUPPORTED;
- }
- mExitFd = eventfd(0, EFD_NONBLOCK);
- if (mExitFd < 0) {
- LOG(ERROR) << "Failed to open eventfd, Error = " << strerror(errno);
- release();
- return Result::FAILURE_NOT_SUPPORTED;
+ const char* parentPath = "/dev/";
+ DIR* dir = opendir(parentPath);
+ const char* cecFilename = "cec";
+
+ while (struct dirent* dirEntry = readdir(dir)) {
+ string filename = dirEntry->d_name;
+ if (filename.compare(0, 3, cecFilename, 0, 3) == 0) {
+ int portId = getPortId(filename);
+ if (portId == -1) {
+ continue;
+ }
+ shared_ptr<HdmiCecPort> hdmiCecPort(new HdmiCecPort(portId));
+ string filepath = parentPath + filename;
+ Result result = hdmiCecPort->init(filepath.c_str());
+ if (result != Result::SUCCESS) {
+ continue;
+ }
+ thread eventThread(&HdmiCecDefault::event_thread, this, hdmiCecPort.get());
+ mEventThreads.push_back(std::move(eventThread));
+ mHdmiCecPorts.push_back(std::move(hdmiCecPort));
+ }
}
- // Ensure the CEC device supports required capabilities
- struct cec_caps caps = {};
- int ret = ioctl(mCecFd, CEC_ADAP_G_CAPS, &caps);
- if (ret) {
- LOG(ERROR) << "Unable to query cec adapter capabilities, Error = " << strerror(errno);
- release();
- return Result::FAILURE_NOT_SUPPORTED;
- }
-
- if (!(caps.capabilities & (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | CEC_CAP_PASSTHROUGH))) {
- LOG(ERROR) << "Wrong cec adapter capabilities " << caps.capabilities;
- release();
- return Result::FAILURE_NOT_SUPPORTED;
- }
-
- uint32_t mode = CEC_MODE_INITIATOR | CEC_MODE_EXCL_FOLLOWER_PASSTHRU;
- ret = ioctl(mCecFd, CEC_S_MODE, &mode);
- if (ret) {
- LOG(ERROR) << "Unable to set initiator mode, Error = " << strerror(errno);
- release();
- return Result::FAILURE_NOT_SUPPORTED;
- }
-
- /* thread loop for receiving cec messages and hotplug events*/
- if (pthread_create(&mEventThread, NULL, event_thread, NULL)) {
- LOG(ERROR) << "Can't create event thread: " << strerror(errno);
- release();
+ if (mHdmiCecPorts.empty()) {
return Result::FAILURE_NOT_SUPPORTED;
}
mCecEnabled = true;
mWakeupEnabled = true;
+ mCecControlEnabled = true;
return Result::SUCCESS;
}
Return<void> HdmiCecDefault::release() {
- if (mExitFd > 0) {
- uint64_t tmp = 1;
- write(mExitFd, &tmp, sizeof(tmp));
- pthread_join(mEventThread, NULL);
- }
- if (mExitFd > 0) {
- close(mExitFd);
- }
- if (mCecFd > 0) {
- close(mCecFd);
- }
mCecEnabled = false;
mWakeupEnabled = false;
+ mCecControlEnabled = false;
+ for (thread& eventThread : mEventThreads) {
+ if (eventThread.joinable()) {
+ eventThread.join();
+ }
+ }
setCallback(nullptr);
+ mHdmiCecPorts.clear();
+ mEventThreads.clear();
return Void();
}
-void* HdmiCecDefault::event_thread(void*) {
+void HdmiCecDefault::event_thread(HdmiCecPort* hdmiCecPort) {
struct pollfd ufds[3] = {
- {mCecFd, POLLIN, 0},
- {mCecFd, POLLERR, 0},
- {mExitFd, POLLIN, 0},
+ {hdmiCecPort->mCecFd, POLLIN, 0},
+ {hdmiCecPort->mCecFd, POLLERR, 0},
+ {hdmiCecPort->mExitFd, POLLIN, 0},
};
while (1) {
@@ -372,23 +371,23 @@
}
if (ufds[1].revents == POLLERR) { /* CEC Event */
- struct cec_event ev;
- ret = ioctl(mCecFd, CEC_DQEVENT, &ev);
-
- if (!mCecEnabled) {
- continue;
- }
+ cec_event ev;
+ ret = ioctl(hdmiCecPort->mCecFd, CEC_DQEVENT, &ev);
if (ret) {
LOG(ERROR) << "CEC_DQEVENT failed, Error = " << strerror(errno);
continue;
}
+ if (!mCecEnabled) {
+ continue;
+ }
+
if (ev.event == CEC_EVENT_STATE_CHANGE) {
if (mCallback != nullptr) {
HotplugEvent hotplugEvent{
.connected = (ev.state_change.phys_addr != CEC_PHYS_ADDR_INVALID),
- .portId = 1};
+ .portId = hdmiCecPort->mPortId};
mCallback->onHotplugEvent(hotplugEvent);
} else {
LOG(ERROR) << "No event callback for hotplug";
@@ -397,12 +396,8 @@
}
if (ufds[0].revents == POLLIN) { /* CEC Driver */
- struct cec_msg msg = {};
- ret = ioctl(mCecFd, CEC_RECEIVE, &msg);
-
- if (!mCecEnabled) {
- continue;
- }
+ cec_msg msg = {};
+ ret = ioctl(hdmiCecPort->mCecFd, CEC_RECEIVE, &msg);
if (ret) {
LOG(ERROR) << "CEC_RECEIVE failed, Error = " << strerror(errno);
@@ -414,11 +409,20 @@
continue;
}
+ if (!mCecEnabled) {
+ continue;
+ }
+
if (!mWakeupEnabled && isWakeupMessage(msg)) {
LOG(DEBUG) << "Filter wakeup message";
continue;
}
+ if (!mCecControlEnabled && !isTransferableInSleep(msg)) {
+ LOG(DEBUG) << "Filter message in standby mode";
+ continue;
+ }
+
if (mCallback != nullptr) {
size_t length = std::min(msg.len - 1, (uint32_t)MaxLength::MESSAGE_BODY);
CecMessage cecMessage{
@@ -435,14 +439,13 @@
}
}
}
- return NULL;
}
-int HdmiCecDefault::getOpcode(struct cec_msg message) {
- return (static_cast<uint8_t>(message.msg[1]) & 0xff);
+int HdmiCecDefault::getOpcode(cec_msg message) {
+ return static_cast<uint8_t>(message.msg[1]);
}
-bool HdmiCecDefault::isWakeupMessage(struct cec_msg message) {
+bool HdmiCecDefault::isWakeupMessage(cec_msg message) {
int opcode = getOpcode(message);
switch (opcode) {
case CEC_MESSAGE_TEXT_VIEW_ON:
@@ -453,6 +456,61 @@
}
}
+bool HdmiCecDefault::isTransferableInSleep(cec_msg message) {
+ int opcode = getOpcode(message);
+ switch (opcode) {
+ case CEC_MESSAGE_ABORT:
+ case CEC_MESSAGE_DEVICE_VENDOR_ID:
+ case CEC_MESSAGE_GET_CEC_VERSION:
+ case CEC_MESSAGE_GET_MENU_LANGUAGE:
+ case CEC_MESSAGE_GIVE_DEVICE_POWER_STATUS:
+ case CEC_MESSAGE_GIVE_DEVICE_VENDOR_ID:
+ case CEC_MESSAGE_GIVE_OSD_NAME:
+ case CEC_MESSAGE_GIVE_PHYSICAL_ADDRESS:
+ case CEC_MESSAGE_REPORT_PHYSICAL_ADDRESS:
+ case CEC_MESSAGE_REPORT_POWER_STATUS:
+ case CEC_MESSAGE_SET_OSD_NAME:
+ case CEC_MESSAGE_DECK_CONTROL:
+ case CEC_MESSAGE_PLAY:
+ case CEC_MESSAGE_IMAGE_VIEW_ON:
+ case CEC_MESSAGE_TEXT_VIEW_ON:
+ case CEC_MESSAGE_SYSTEM_AUDIO_MODE_REQUEST:
+ return true;
+ case CEC_MESSAGE_USER_CONTROL_PRESSED:
+ return isPowerUICommand(message);
+ default:
+ return false;
+ }
+}
+
+int HdmiCecDefault::getFirstParam(cec_msg message) {
+ return static_cast<uint8_t>(message.msg[2]);
+}
+
+bool HdmiCecDefault::isPowerUICommand(cec_msg message) {
+ int uiCommand = getFirstParam(message);
+ switch (uiCommand) {
+ case CEC_OP_UI_CMD_POWER:
+ case CEC_OP_UI_CMD_DEVICE_ROOT_MENU:
+ case CEC_OP_UI_CMD_POWER_ON_FUNCTION:
+ return true;
+ default:
+ return false;
+ }
+}
+
+Return<SendMessageResult> HdmiCecDefault::getSendMessageResult(int tx_status) {
+ switch (tx_status) {
+ case CEC_TX_STATUS_OK:
+ return SendMessageResult::SUCCESS;
+ case CEC_TX_STATUS_ARB_LOST:
+ return SendMessageResult::BUSY;
+ case CEC_TX_STATUS_NACK:
+ return SendMessageResult::NACK;
+ default:
+ return SendMessageResult::FAIL;
+ }
+}
} // namespace implementation
} // namespace V1_0
} // namespace cec
diff --git a/tv/cec/1.0/default/HdmiCecDefault.h b/tv/cec/1.0/default/HdmiCecDefault.h
index c1bb2c7..6574429 100644
--- a/tv/cec/1.0/default/HdmiCecDefault.h
+++ b/tv/cec/1.0/default/HdmiCecDefault.h
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#include <android/hardware/tv/cec/1.0/IHdmiCec.h>
#include <hardware/hdmi_cec.h>
+#include <linux/cec.h>
+#include <thread>
+#include <vector>
+#include "HdmiCecPort.h"
namespace android {
namespace hardware {
@@ -24,7 +26,12 @@
namespace V1_0 {
namespace implementation {
-struct HdmiCecDefault : public IHdmiCec, public hidl_death_recipient {
+using std::shared_ptr;
+using std::thread;
+using std::vector;
+
+class HdmiCecDefault : public IHdmiCec, public hidl_death_recipient {
+ public:
HdmiCecDefault();
~HdmiCecDefault();
// Methods from ::android::hardware::tv::cec::V1_0::IHdmiCec follow.
@@ -47,11 +54,35 @@
Return<Result> init();
Return<void> release();
- static void* event_thread(void*);
- static int getOpcode(struct cec_msg message);
- static bool isWakeupMessage(struct cec_msg message);
-};
+ private:
+ void event_thread(HdmiCecPort* hdmiCecPort);
+ static int getOpcode(cec_msg message);
+ static int getFirstParam(cec_msg message);
+ static bool isWakeupMessage(cec_msg message);
+ static bool isTransferableInSleep(cec_msg message);
+ static bool isPowerUICommand(cec_msg message);
+ static Return<SendMessageResult> getSendMessageResult(int tx_status);
+
+ vector<thread> mEventThreads;
+ vector<shared_ptr<HdmiCecPort>> mHdmiCecPorts;
+
+ // When set to false, all the CEC commands are discarded. True by default after initialization.
+ bool mCecEnabled;
+ /*
+ * When set to false, HAL does not wake up the system upon receiving <Image View On> or
+ * <Text View On>. True by default after initialization.
+ */
+ bool mWakeupEnabled;
+ /*
+ * Updated when system goes into or comes out of standby mode.
+ * When set to true, Android system is handling CEC commands.
+ * When set to false, microprocessor is handling CEC commands.
+ * True by default after initialization.
+ */
+ bool mCecControlEnabled;
+ sp<IHdmiCecCallback> mCallback;
+};
} // namespace implementation
} // namespace V1_0
} // namespace cec
diff --git a/tv/cec/1.0/default/HdmiCecPort.cpp b/tv/cec/1.0/default/HdmiCecPort.cpp
new file mode 100755
index 0000000..73dda12
--- /dev/null
+++ b/tv/cec/1.0/default/HdmiCecPort.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.tv.cec@1.0-impl"
+
+#include <android-base/logging.h>
+#include <errno.h>
+#include <linux/cec.h>
+#include <linux/ioctl.h>
+#include <sys/eventfd.h>
+#include <algorithm>
+
+#include "HdmiCecPort.h"
+
+namespace android {
+namespace hardware {
+namespace tv {
+namespace cec {
+namespace V1_0 {
+namespace implementation {
+
+HdmiCecPort::HdmiCecPort(unsigned int portId) {
+ mPortId = portId;
+ mCecFd = -1;
+ mExitFd = -1;
+}
+
+HdmiCecPort::~HdmiCecPort() {
+ release();
+}
+
+// Initialise the cec file descriptor
+Return<Result> HdmiCecPort::init(const char* path) {
+ mCecFd = open(path, O_RDWR);
+ if (mCecFd < 0) {
+ LOG(ERROR) << "Failed to open " << path << ", Error = " << strerror(errno);
+ return Result::FAILURE_NOT_SUPPORTED;
+ }
+ mExitFd = eventfd(0, EFD_NONBLOCK);
+ if (mExitFd < 0) {
+ LOG(ERROR) << "Failed to open eventfd, Error = " << strerror(errno);
+ release();
+ return Result::FAILURE_NOT_SUPPORTED;
+ }
+
+ // Ensure the CEC device supports required capabilities
+ struct cec_caps caps = {};
+ int ret = ioctl(mCecFd, CEC_ADAP_G_CAPS, &caps);
+ if (ret) {
+ LOG(ERROR) << "Unable to query cec adapter capabilities, Error = " << strerror(errno);
+ release();
+ return Result::FAILURE_NOT_SUPPORTED;
+ }
+
+ if (!(caps.capabilities & (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | CEC_CAP_PASSTHROUGH))) {
+ LOG(ERROR) << "Wrong cec adapter capabilities " << caps.capabilities;
+ release();
+ return Result::FAILURE_NOT_SUPPORTED;
+ }
+
+ uint32_t mode = CEC_MODE_INITIATOR | CEC_MODE_EXCL_FOLLOWER_PASSTHRU;
+ ret = ioctl(mCecFd, CEC_S_MODE, &mode);
+ if (ret) {
+ LOG(ERROR) << "Unable to set initiator mode, Error = " << strerror(errno);
+ release();
+ return Result::FAILURE_NOT_SUPPORTED;
+ }
+ return Result::SUCCESS;
+}
+
+Return<void> HdmiCecPort::release() {
+ if (mExitFd > 0) {
+ uint64_t tmp = 1;
+ write(mExitFd, &tmp, sizeof(tmp));
+ }
+ if (mExitFd > 0) {
+ close(mExitFd);
+ }
+ if (mCecFd > 0) {
+ close(mCecFd);
+ }
+ return Void();
+}
+} // namespace implementation
+} // namespace V1_0
+} // namespace cec
+} // namespace tv
+} // namespace hardware
+} // namespace android
diff --git a/tv/cec/1.0/default/HdmiCecPort.h b/tv/cec/1.0/default/HdmiCecPort.h
new file mode 100755
index 0000000..2a2fdef
--- /dev/null
+++ b/tv/cec/1.0/default/HdmiCecPort.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <android/hardware/tv/cec/1.0/IHdmiCec.h>
+
+namespace android {
+namespace hardware {
+namespace tv {
+namespace cec {
+namespace V1_0 {
+namespace implementation {
+
+class HdmiCecPort {
+ public:
+ HdmiCecPort(unsigned int portId);
+ ~HdmiCecPort();
+ Return<Result> init(const char* path);
+ Return<void> release();
+
+ unsigned int mPortId;
+ int mCecFd;
+ int mExitFd;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace cec
+} // namespace tv
+} // namespace hardware
+} // namespace android
diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.cpp b/tv/tuner/1.0/vts/functional/FrontendTests.cpp
index b35d112..6cf7d1d 100644
--- a/tv/tuner/1.0/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/1.0/vts/functional/FrontendTests.cpp
@@ -128,7 +128,8 @@
}
EXPECT_TRUE(scanMsgLockedReceived) << "Scan message LOCKED not received before END";
- EXPECT_TRUE(targetFrequencyReceived) << "frequency not received before LOCKED on blindScan";
+ if (type == FrontendScanType::SCAN_BLIND)
+ EXPECT_TRUE(targetFrequencyReceived) << "frequency not received before LOCKED on blindScan";
mScanMessageReceived = false;
mScanMsgProcessed = true;
}
diff --git a/tv/tuner/1.1/vts/functional/FrontendTests.cpp b/tv/tuner/1.1/vts/functional/FrontendTests.cpp
index 9c575ff..7afffb8 100644
--- a/tv/tuner/1.1/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/1.1/vts/functional/FrontendTests.cpp
@@ -180,7 +180,8 @@
}
EXPECT_TRUE(scanMsgLockedReceived) << "Scan message LOCKED not received before END";
- EXPECT_TRUE(targetFrequencyReceived) << "frequency not received before LOCKED on blindScan";
+ if (type == FrontendScanType::SCAN_BLIND)
+ EXPECT_TRUE(targetFrequencyReceived) << "frequency not received before LOCKED on blindScan";
mScanMessageReceived = false;
mScanMsgProcessed = true;
}
diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp
index d37da08..e58cf5e 100644
--- a/wifi/hostapd/aidl/vts/functional/Android.bp
+++ b/wifi/hostapd/aidl/vts/functional/Android.bp
@@ -16,9 +16,10 @@
srcs: ["VtsHalHostapdTargetTest.cpp"],
shared_libs: [
"libbinder",
+ "libbinder_ndk",
],
static_libs: [
- "android.hardware.wifi.hostapd-V1-cpp",
+ "android.hardware.wifi.hostapd-V1-ndk",
],
test_suites: [
"general-tests",
diff --git a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp
index 92fbf50..41c54b3 100644
--- a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp
+++ b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp
@@ -14,33 +14,33 @@
* limitations under the License.
*/
#include <VtsCoreUtil.h>
-
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
-#include <android/hardware/wifi/hostapd/BnHostapd.h>
+#include <aidl/android/hardware/wifi/hostapd/BnHostapd.h>
+#include <aidl/android/hardware/wifi/hostapd/BnHostapdCallback.h>
+#include <android/binder_manager.h>
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
+using aidl::android::hardware::wifi::hostapd::BandMask;
+using aidl::android::hardware::wifi::hostapd::BnHostapdCallback;
+using aidl::android::hardware::wifi::hostapd::ChannelParams;
+using aidl::android::hardware::wifi::hostapd::DebugLevel;
+using aidl::android::hardware::wifi::hostapd::EncryptionType;
+using aidl::android::hardware::wifi::hostapd::FrequencyRange;
+using aidl::android::hardware::wifi::hostapd::Ieee80211ReasonCode;
+using aidl::android::hardware::wifi::hostapd::IfaceParams;
+using aidl::android::hardware::wifi::hostapd::IHostapd;
+using aidl::android::hardware::wifi::hostapd::NetworkParams;
using android::ProcessState;
-using android::sp;
-using android::String16;
-using android::hardware::wifi::hostapd::BandMask;
-using android::hardware::wifi::hostapd::ChannelParams;
-using android::hardware::wifi::hostapd::DebugLevel;
-using android::hardware::wifi::hostapd::EncryptionType;
-using android::hardware::wifi::hostapd::FrequencyRange;
-using android::hardware::wifi::hostapd::Ieee80211ReasonCode;
-using android::hardware::wifi::hostapd::IfaceParams;
-using android::hardware::wifi::hostapd::IHostapd;
-using android::hardware::wifi::hostapd::NetworkParams;
namespace {
const unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1', '2', '3', '4', '5'};
-const String16 kIfaceName = String16("wlan0");
-const String16 kPassphrase = String16("test12345");
-const String16 kInvalidMinPassphrase = String16("test");
-const String16 kInvalidMaxPassphrase = String16(
- "0123456789012345678901234567890123456789012345678901234567890123456789");
+const std::string kIfaceName = "wlan0";
+const std::string kPassphrase = "test12345";
+const std::string kInvalidMinPassphrase = "test";
+const std::string kInvalidMaxPassphrase =
+ "0123456789012345678901234567890123456789012345678901234567890123456789";
const int kIfaceChannel = 6;
const int kIfaceInvalidChannel = 567;
const std::vector<uint8_t> kTestZeroMacAddr(6, 0x0);
@@ -56,8 +56,8 @@
class HostapdAidl : public testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
- hostapd = android::waitForDeclaredService<IHostapd>(
- String16(GetParam().c_str()));
+ hostapd = IHostapd::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService(GetParam().c_str())));
ASSERT_NE(hostapd, nullptr);
EXPECT_TRUE(hostapd->setDebugParams(DebugLevel::EXCESSIVE).isOk());
isAcsSupport = testing::checkSubstringInCommandOutput(
@@ -77,12 +77,12 @@
sleep(3);
}
- sp<IHostapd> hostapd;
+ std::shared_ptr<IHostapd> hostapd;
bool isAcsSupport;
bool isWpa3SaeSupport;
bool isBridgedSupport;
- IfaceParams getIfaceParamsWithoutAcs(String16 iface_name) {
+ IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) {
IfaceParams iface_params;
ChannelParams channelParams;
std::vector<ChannelParams> vec_channelParams;
@@ -103,7 +103,7 @@
return iface_params;
}
- IfaceParams getIfaceParamsWithBridgedModeACS(String16 iface_name) {
+ IfaceParams getIfaceParamsWithBridgedModeACS(std::string iface_name) {
IfaceParams iface_params = getIfaceParamsWithoutAcs(iface_name);
iface_params.channelParams[0].enableAcs = true;
iface_params.channelParams[0].acsShouldExcludeDfs = true;
@@ -121,7 +121,7 @@
return iface_params;
}
- IfaceParams getIfaceParamsWithAcs(String16 iface_name) {
+ IfaceParams getIfaceParamsWithAcs(std::string iface_name) {
IfaceParams iface_params = getIfaceParamsWithoutAcs(iface_name);
iface_params.channelParams[0].enableAcs = true;
iface_params.channelParams[0].acsShouldExcludeDfs = true;
@@ -131,7 +131,7 @@
return iface_params;
}
- IfaceParams getIfaceParamsWithAcsAndFreqRange(String16 iface_name) {
+ IfaceParams getIfaceParamsWithAcsAndFreqRange(std::string iface_name) {
IfaceParams iface_params = getIfaceParamsWithAcs(iface_name);
FrequencyRange freqRange;
freqRange.startMhz = 2412;
@@ -143,7 +143,8 @@
return iface_params;
}
- IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange(String16 iface_name) {
+ IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange(
+ std::string iface_name) {
IfaceParams iface_params =
getIfaceParamsWithAcsAndFreqRange(iface_name);
iface_params.channelParams[0].acsChannelFreqRangesMhz[0].startMhz =
@@ -153,7 +154,7 @@
return iface_params;
}
- IfaceParams getIfaceParamsWithInvalidChannel(String16 iface_name) {
+ IfaceParams getIfaceParamsWithInvalidChannel(std::string iface_name) {
IfaceParams iface_params = getIfaceParamsWithoutAcs(iface_name);
iface_params.channelParams[0].channel = kIfaceInvalidChannel;
return iface_params;
@@ -215,11 +216,37 @@
NetworkParams getInvalidSaeNwParams() {
NetworkParams nw_params = getOpenNwParams();
nw_params.encryptionType = EncryptionType::WPA3_SAE;
- nw_params.passphrase = String16("");
+ nw_params.passphrase = "";
return nw_params;
}
};
+class HostapdCallback : public BnHostapdCallback {
+ public:
+ HostapdCallback() = default;
+ ::ndk::ScopedAStatus onApInstanceInfoChanged(
+ const ::aidl::android::hardware::wifi::hostapd::ApInfo &) override {
+ return ndk::ScopedAStatus::ok();
+ }
+ ::ndk::ScopedAStatus onConnectedClientsChanged(
+ const ::aidl::android::hardware::wifi::hostapd::ClientInfo &) override {
+ return ndk::ScopedAStatus::ok();
+ }
+ ::ndk::ScopedAStatus onFailure(const std::string &) override {
+ return ndk::ScopedAStatus::ok();
+ }
+};
+
+/**
+ * Register callback
+ */
+TEST_P(HostapdAidl, RegisterCallback) {
+ std::shared_ptr<HostapdCallback> callback =
+ ndk::SharedRefBase::make<HostapdCallback>();
+ ASSERT_NE(callback, nullptr);
+ EXPECT_TRUE(hostapd->registerCallback(callback).isOk());
+}
+
/**
* Adds an access point with PSK network config & ACS enabled.
* Access point creation should pass.
diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_p2p_iface_hidl_test.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_p2p_iface_hidl_test.cpp
index 4427c390..d68520a 100644
--- a/wifi/supplicant/1.4/vts/functional/supplicant_p2p_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.4/vts/functional/supplicant_p2p_iface_hidl_test.cpp
@@ -49,6 +49,9 @@
public:
virtual void SetUp() override {
SupplicantHidlTestBaseV1_4::SetUp();
+ if (!isP2pOn_) {
+ GTEST_SKIP() << "Wi-Fi Direct is not supported, skip this test.";
+ }
p2p_iface_ = getSupplicantP2pIface_1_4(supplicant_);
ASSERT_NE(p2p_iface_.get(), nullptr);
}