Merge "[email protected]: remove from current.txt"
diff --git a/audio/6.0/config/api/current.txt b/audio/6.0/config/api/current.txt
index 7aa147c..e67831c 100644
--- a/audio/6.0/config/api/current.txt
+++ b/audio/6.0/config/api/current.txt
@@ -250,7 +250,9 @@
public class GlobalConfiguration {
ctor public GlobalConfiguration();
+ method public boolean getCall_screen_mode_supported();
method public boolean getSpeaker_drc_enabled();
+ method public void setCall_screen_mode_supported(boolean);
method public void setSpeaker_drc_enabled(boolean);
}
diff --git a/audio/6.0/config/audio_policy_configuration.xsd b/audio/6.0/config/audio_policy_configuration.xsd
index 0dc89bb..29f6f38 100644
--- a/audio/6.0/config/audio_policy_configuration.xsd
+++ b/audio/6.0/config/audio_policy_configuration.xsd
@@ -66,6 +66,7 @@
</xs:element>
<xs:complexType name="globalConfiguration">
<xs:attribute name="speaker_drc_enabled" type="xs:boolean" use="required"/>
+ <xs:attribute name="call_screen_mode_supported" type="xs:boolean" use="optional"/>
</xs:complexType>
<xs:complexType name="modules">
<xs:annotation>
diff --git a/audio/common/6.0/types.hal b/audio/common/6.0/types.hal
index 132f86d..0c97c36 100644
--- a/audio/common/6.0/types.hal
+++ b/audio/common/6.0/types.hal
@@ -556,6 +556,8 @@
IN_CALL = 2,
/** Calls handled by apps (Eg: Hangout). */
IN_COMMUNICATION = 3,
+ /** Call screening in progress */
+ CALL_SCREEN = 4,
};
@export(name="", value_prefix="AUDIO_DEVICE_")
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 3fd0539..ed09859 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -71,10 +71,10 @@
whole_static_libs: ["[email protected]"],
shared_libs: [
"libbase",
+ "libjsoncpp",
"libprotobuf-cpp-lite",
],
static_libs: [
- "libjsoncpp",
"libqemu_pipe",
"[email protected]",
],
@@ -106,13 +106,13 @@
srcs: ["VehicleService.cpp"],
shared_libs: [
"libbase",
+ "libjsoncpp",
"libprotobuf-cpp-lite",
],
static_libs: [
"[email protected]",
"[email protected]",
"[email protected]",
- "libjsoncpp",
"libqemu_pipe",
],
}
diff --git a/boot/1.1/vts/functional/VtsHalBootV1_1TargetTest.cpp b/boot/1.1/vts/functional/VtsHalBootV1_1TargetTest.cpp
index fba9a5e..7c58ef3 100644
--- a/boot/1.1/vts/functional/VtsHalBootV1_1TargetTest.cpp
+++ b/boot/1.1/vts/functional/VtsHalBootV1_1TargetTest.cpp
@@ -81,6 +81,6 @@
}
INSTANTIATE_TEST_SUITE_P(
- , BootHidlTest,
+ PerInstance, BootHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IBootControl::descriptor)),
android::hardware::PrintInstanceNameToString);
diff --git a/cas/1.2/types.hal b/cas/1.2/types.hal
index 40c06cf..06199cd 100644
--- a/cas/1.2/types.hal
+++ b/cas/1.2/types.hal
@@ -45,6 +45,10 @@
* ERROR_CAS_BLACKOUT is used to report geographical blackout.
*/
ERROR_CAS_BLACKOUT,
+ /**
+ * ERROR_CAS_REBOOTING is used to report CAS is during rebooting.
+ */
+ ERROR_CAS_REBOOTING,
};
/**
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 8ffed4b..1535979 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -123,7 +123,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.cas</name>
- <version>1.1</version>
+ <version>1.1-2</version>
<interface>
<name>IMediaCasService</name>
<instance>default</instance>
diff --git a/current.txt b/current.txt
index 7712835..a114bf4 100644
--- a/current.txt
+++ b/current.txt
@@ -587,19 +587,23 @@
# HALs released in Android R
07d0a252b2d8fa35887908a996ba395cf392968395fc30afab791f46e0c22a52 [email protected]::IBootControl
74049a402be913963edfdd80828a53736570e9d8124a1bf18166b6ed46a6b0ab [email protected]::types
+c1aa508d00b66ed5feefea398fd5edf28fa651ac89773adad7dfda4e0a73a952 [email protected]::ICas
+9811f867def49b420d8c707f7e38d3bdd64f835244e1d2a5e9762ab9835672dc [email protected]::ICasListener
+f18695dd36ee205640b8326a17453858a7b4596653aaa6ef0016b0aef1bd4dac [email protected]::IMediaCasService
+4d85e814f94949dae4dc6cb82bbd7d6bb24ffafda6ddb2eac928d2a4fc2e21ce [email protected]::types
ce8dbe76eb9ee94b46ef98f725be992e760a5751073d4f4912484026541371f3 [email protected]::IHealth
26f04510a0b57aba5167c5c0a7c2f077c2acbb98b81902a072517829fd9fd67f [email protected]::IHealthInfoCallback
db47f4ceceb1f06c656f39caa70c557b0f8471ef59fd58611bea667ffca20101 [email protected]::types
-34515afa2bb792d3c6d8495a5f5d907d179c8507ca5e55c10050d02ae1d516ef [email protected]::IDevice
+9e59fffceed0dd72a9799e04505db5f777bbbea1af0695ba4107ef6d967c6fda [email protected]::IDevice
+fd5a2b723b75acbdd9f31bd07e0f83293c52f99f8d9b87bf58eeb6018f665fde [email protected]::IPreparedModelCallback
b74fe72cfe438f50e772e6a307657ff449d5bde83c15dd1f140ff2edbe73499c [email protected]::types
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b [email protected]::IWifi
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 [email protected]::ISupplicant
-0a7ff83fd0326b82232e1609da98f34960be11335df72fc407ad238d7bd0e081 [email protected]::ISupplicantStaIface
+44445b8a03d7b9e68b2fbd954672c18a8fce9e32851b0692f4f4ab3407f86ecb [email protected]::ISupplicantStaIface
619fc9839ec6e369cfa9b28e3e9412e6885720ff8f9b5750c1b6ffb905120391 [email protected]::ISupplicantStaIfaceCallback
c9273429fcf98d797d3bb07fdba6f1be95bf960f9255cde169fd1ca4db85f856 [email protected]::ISupplicantStaNetwork
-b0f8c9cd61a45a8c1b4a8e40913ecaea0921011cbe2305a6fa5a2feaa0d36c30 [email protected]::types
+9b0a3ab6f4f74b971ed094426d8a443e29b512ff03e1ab50c07156396cdb2483 [email protected]::types
41c602462ccd1b19cfd645994be4de4c07fc197ff58a54e84476b31908e61e21 [email protected]::types
a8691c71747c3f14f7a043598e856425077f755e55990507a9132ad62f8ab3f7 [email protected]::IRadio
a62a93faf173b14a6175b683ebf61ffa568dc61f81e369d2dce7b1265e86cf2f [email protected]::IRadioIndication
15daf260aaf6781b911450bc94e1a164901f9c0fe0bda68f8434f0a903f66e05 [email protected]::IRadioResponse
-
diff --git a/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp b/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp
index 0af9745..ec7a0b9 100644
--- a/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp
+++ b/graphics/composer/2.1/utils/hwc2on1adapter/Android.bp
@@ -22,40 +22,12 @@
"-Werror",
],
cppflags: [
- "-Weverything",
+ "-Wextra",
"-Wunused",
"-Wunreachable-code",
- // The static constructors and destructors in this library have not been noted to
- // introduce significant overheads
- "-Wno-exit-time-destructors",
- "-Wno-global-constructors",
-
- // We only care about compiling as C++14
- "-Wno-c++98-compat-pedantic",
-
- // android/sensors.h uses nested anonymous unions and anonymous structs
- "-Wno-nested-anon-types",
- "-Wno-gnu-anonymous-struct",
-
- // Don't warn about struct padding
- "-Wno-padded",
-
- // hwcomposer2.h features switch covering all cases.
- "-Wno-covered-switch-default",
-
- // hwcomposer.h features zero size array.
- "-Wno-zero-length-array",
-
// Disabling warning specific to hwc2on1adapter code
- "-Wno-double-promotion",
- "-Wno-sign-conversion",
- "-Wno-switch-enum",
- "-Wno-float-equal",
- "-Wno-shorten-64-to-32",
"-Wno-sign-compare",
- "-Wno-missing-prototypes",
- "-Wno-format-pedantic",
],
srcs: [
diff --git a/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp b/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp
index 7df4926..da9f5bb 100644
--- a/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp
+++ b/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp
@@ -252,7 +252,7 @@
}
INSTANTIATE_TEST_SUITE_P(
- , HealthHidlTest,
+ PerInstance, HealthHidlTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IHealth::descriptor)),
android::hardware::PrintInstanceNameToString);
diff --git a/neuralnetworks/1.3/Android.bp b/neuralnetworks/1.3/Android.bp
index 0615ec6..8e3e9f1 100644
--- a/neuralnetworks/1.3/Android.bp
+++ b/neuralnetworks/1.3/Android.bp
@@ -9,6 +9,7 @@
srcs: [
"types.hal",
"IDevice.hal",
+ "IPreparedModelCallback.hal",
],
interfaces: [
"[email protected]",
diff --git a/neuralnetworks/1.3/IDevice.hal b/neuralnetworks/1.3/IDevice.hal
index ee36fb4..1295d6a 100644
--- a/neuralnetworks/1.3/IDevice.hal
+++ b/neuralnetworks/1.3/IDevice.hal
@@ -22,7 +22,7 @@
import @1.2::DeviceType;
import @1.2::Extension;
import @1.2::IDevice;
-import @1.2::IPreparedModelCallback;
+import IPreparedModelCallback;
/**
* This interface represents a device driver.
@@ -134,18 +134,18 @@
* not provided, or match the numModelCache returned from
* getNumberOfCacheFilesNeeded. The cache handles will be provided in
* the same order when retrieving the preparedModel from cache files
- * with prepareModelFromCache.
+ * with prepareModelFromCache_1_3.
* @param dataCache A vector of handles with each entry holding exactly one
* cache file descriptor for the constants' cache. The length of the
* vector must either be 0 indicating that caching information is not
* provided, or match the numDataCache returned from
* getNumberOfCacheFilesNeeded. The cache handles will be provided in
* the same order when retrieving the preparedModel from cache files
- * with prepareModelFromCache.
+ * with prepareModelFromCache_1_3.
* @param token A caching token of length Constant::BYTE_SIZE_OF_CACHE_TOKEN
* identifying the prepared model. The same token will be provided when
* retrieving the prepared model from the cache files with
- * prepareModelFromCache. Tokens should be chosen to have a low rate of
+ * prepareModelFromCache_1_3. Tokens should be chosen to have a low rate of
* collision for a particular application. The driver cannot detect a
* collision; a collision will result in a failed execution or in a
* successful execution that produces incorrect output values. If both
@@ -168,4 +168,83 @@
uint8_t[Constant:BYTE_SIZE_OF_CACHE_TOKEN] token,
IPreparedModelCallback callback)
generates (ErrorStatus status);
+
+ /**
+ * Creates a prepared model from cache files for execution.
+ *
+ * prepareModelFromCache_1_3 is used to retrieve a prepared model directly from
+ * cache files to avoid slow model compilation time. There are
+ * two types of cache file handles provided to the driver: model cache
+ * and data cache. For more information on the two types of cache handles,
+ * refer to getNumberOfCacheFilesNeeded.
+ *
+ * The file descriptors must be opened with read and write permission. A file may
+ * have any size, and the corresponding file descriptor may have any offset. The
+ * driver must truncate a file to zero size before writing to that file. The file
+ * descriptors may be closed by the client once the asynchronous preparation has
+ * finished. The driver must dup a file descriptor if it wants to get access to
+ * the cache file later.
+ *
+ * The model is prepared asynchronously with respect to the caller. The
+ * prepareModelFromCache_1_3 function must verify the inputs to the
+ * prepareModelFromCache_1_3 function are correct, and that the security-sensitive
+ * cache has not been modified since it was last written by the driver.
+ * If there is an error, or if compilation caching is not supported, or if the
+ * security-sensitive cache has been modified, prepareModelFromCache_1_3 must
+ * immediately invoke the callback with the appropriate ErrorStatus value and
+ * nullptr for the IPreparedModel, then return with the same ErrorStatus. If
+ * the inputs to the prepareModelFromCache_1_3 function are valid, the security-sensitive
+ * cache is not modified, and there is no error, prepareModelFromCache_1_3 must launch an
+ * asynchronous task to prepare the model in the background, and immediately return
+ * from prepareModelFromCache_1_3 with ErrorStatus::NONE. If the asynchronous task
+ * fails to launch, prepareModelFromCache_1_3 must immediately invoke the callback
+ * with ErrorStatus::GENERAL_FAILURE and nullptr for the IPreparedModel, then
+ * return with ErrorStatus::GENERAL_FAILURE.
+ *
+ * When the asynchronous task has finished preparing the model, it must
+ * immediately invoke the callback function provided as an input to
+ * prepareModelFromCache_1_3. If the model was prepared successfully, the
+ * callback object must be invoked with an error status of ErrorStatus::NONE
+ * and the produced IPreparedModel object. If an error occurred preparing
+ * the model, the callback object must be invoked with the appropriate
+ * ErrorStatus value and nullptr for the IPreparedModel.
+ *
+ * The only information that may be unknown to the model at this stage is
+ * the shape of the tensors, which may only be known at execution time. As
+ * such, some driver services may return partially prepared models, where
+ * the prepared model may only be finished when it is paired with a set of
+ * inputs to the model. Note that the same prepared model object may be
+ * used with different shapes of inputs on different (possibly concurrent)
+ * executions.
+ *
+ * @param modelCache A vector of handles with each entry holding exactly one
+ * cache file descriptor for the security-sensitive cache. The length of
+ * the vector must match the numModelCache returned from getNumberOfCacheFilesNeeded.
+ * The cache handles will be provided in the same order as with prepareModel_1_3.
+ * @param dataCache A vector of handles with each entry holding exactly one
+ * cache file descriptor for the constants' cache. The length of the vector
+ * must match the numDataCache returned from getNumberOfCacheFilesNeeded.
+ * The cache handles will be provided in the same order as with prepareModel_1_3.
+ * @param token A caching token of length Constant::BYTE_SIZE_OF_CACHE_TOKEN
+ * identifying the prepared model. It is the same token provided when saving
+ * the cache files with prepareModel_1_3. Tokens should be chosen
+ * to have a low rate of collision for a particular application. The driver
+ * cannot detect a collision; a collision will result in a failed execution
+ * or in a successful execution that produces incorrect output values.
+ * @param callback A callback object used to return the error status of
+ * preparing the model for execution and the prepared model if
+ * successful, nullptr otherwise. The callback object's notify function
+ * must be called exactly once, even if the model could not be prepared.
+ * @return status Error status of launching a task which prepares the model
+ * in the background; must be:
+ * - NONE if preparation task is successfully launched
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if caching is not supported or if there is an
+ * unspecified error
+ * - INVALID_ARGUMENT if one of the input arguments is invalid
+ */
+ prepareModelFromCache_1_3(vec<handle> modelCache, vec<handle> dataCache,
+ uint8_t[Constant:BYTE_SIZE_OF_CACHE_TOKEN] token,
+ IPreparedModelCallback callback)
+ generates (ErrorStatus status);
};
diff --git a/neuralnetworks/1.3/IPreparedModelCallback.hal b/neuralnetworks/1.3/IPreparedModelCallback.hal
new file mode 100644
index 0000000..7cc5ae0
--- /dev/null
+++ b/neuralnetworks/1.3/IPreparedModelCallback.hal
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package [email protected];
+
+import @1.0::ErrorStatus;
+import @1.2::IPreparedModelCallback;
+import @1.2::IPreparedModel;
+
+/**
+ * IPreparedModelCallback must be used to return a prepared model produced by an
+ * asynchronous task launched from IDevice::prepareModel.
+ */
+interface IPreparedModelCallback extends @1.2::IPreparedModelCallback {
+
+ /**
+ * There are three notify methods declared for the IPreparedModelCallback
+ * interface: notify_1_3, notify_1_2, and notify. One of the three
+ * notify methods must be invoked immediately after the asynchronous
+ * task holding this callback has finished preparing the model. If the model was
+ * successfully prepared, one of the notify methods must be invoked with
+ * ErrorStatus::NONE and the prepared model. If the model was not able to be
+ * successfully prepared, one of the notify methods must be invoked with the
+ * appropriate ErrorStatus and nullptr as the IPreparedModel. If the asynchronous
+ * task holding this callback fails to launch or if the model provided to
+ * IDevice::prepareModel is invalid, one of the notify methods must be invoked
+ * with the appropriate error as well as nullptr for the IPreparedModel.
+ *
+ * @param status Error status returned from the asynchronous model
+ * preparation task; must be:
+ * - NONE if the asynchronous task successfully prepared the
+ * model
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if the asynchronous task resulted in an
+ * unspecified error
+ * - INVALID_ARGUMENT if one of the input arguments to
+ * prepareModel is invalid
+ * @param preparedModel A model that has been asynchronously prepared for
+ * execution. If the model was unable to be prepared
+ * due to an error, nullptr must be passed in place of
+ * the IPreparedModel object.
+ */
+ oneway notify_1_3(ErrorStatus status, IPreparedModel preparedModel);
+};
diff --git a/neuralnetworks/1.3/vts/functional/Android.bp b/neuralnetworks/1.3/vts/functional/Android.bp
index 0f2720e..e2795de 100644
--- a/neuralnetworks/1.3/vts/functional/Android.bp
+++ b/neuralnetworks/1.3/vts/functional/Android.bp
@@ -14,6 +14,24 @@
// limitations under the License.
//
+cc_library_static {
+ name: "VtsHalNeuralNetworksV1_3Callbacks",
+ defaults: ["VtsHalTargetTestDefaults"],
+ export_include_dirs: ["include"],
+ srcs: [
+ "Callbacks.cpp",
+ ],
+ static_libs: [
+ "[email protected]",
+ "[email protected]",
+ "[email protected]",
+ "[email protected]",
+ ],
+ header_libs: [
+ "libbase_headers",
+ ]
+}
+
cc_test {
name: "VtsHalNeuralnetworksV1_3TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
@@ -44,6 +62,7 @@
"libneuralnetworks_utils",
"VtsHalNeuralNetworksV1_0_utils",
"VtsHalNeuralNetworksV1_2Callbacks",
+ "VtsHalNeuralNetworksV1_3Callbacks",
],
whole_static_libs: [
"neuralnetworks_generated_V1_0_example",
diff --git a/neuralnetworks/1.3/vts/functional/Callbacks.cpp b/neuralnetworks/1.3/vts/functional/Callbacks.cpp
new file mode 100644
index 0000000..435db46
--- /dev/null
+++ b/neuralnetworks/1.3/vts/functional/Callbacks.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Callbacks"
+
+#include "1.3/Callbacks.h"
+
+#include <android-base/logging.h>
+
+#include <limits>
+
+namespace android::hardware::neuralnetworks::V1_3::implementation {
+
+using V1_0::ErrorStatus;
+
+// PreparedModelCallback methods begin here
+
+Return<void> PreparedModelCallback::notify(ErrorStatus errorStatus,
+ const sp<V1_0::IPreparedModel>& preparedModel) {
+ {
+ std::lock_guard<std::mutex> hold(mMutex);
+
+ // quick-return if object has already been notified
+ if (mNotified) {
+ return Void();
+ }
+
+ // store results and mark as notified
+ mErrorStatus = errorStatus;
+ mPreparedModel = preparedModel;
+ mNotified = true;
+ }
+
+ mCondition.notify_all();
+ return Void();
+}
+
+Return<void> PreparedModelCallback::notify_1_2(ErrorStatus errorStatus,
+ const sp<V1_2::IPreparedModel>& preparedModel) {
+ return notify(errorStatus, preparedModel);
+}
+
+Return<void> PreparedModelCallback::notify_1_3(ErrorStatus errorStatus,
+ const sp<V1_2::IPreparedModel>& preparedModel) {
+ return notify(errorStatus, preparedModel);
+}
+
+void PreparedModelCallback::wait() const {
+ std::unique_lock<std::mutex> lock(mMutex);
+ mCondition.wait(lock, [this] { return mNotified; });
+}
+
+ErrorStatus PreparedModelCallback::getStatus() const {
+ wait();
+ return mErrorStatus;
+}
+
+sp<V1_0::IPreparedModel> PreparedModelCallback::getPreparedModel() const {
+ wait();
+ return mPreparedModel;
+}
+
+} // namespace android::hardware::neuralnetworks::V1_3::implementation
diff --git a/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp
index 0ac4738..ea2398b 100644
--- a/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp
+++ b/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp
@@ -28,7 +28,7 @@
#include <random>
#include <thread>
-#include "1.2/Callbacks.h"
+#include "1.3/Callbacks.h"
#include "GeneratedTestHarness.h"
#include "MemoryUtils.h"
#include "TestHarness.h"
@@ -48,12 +48,12 @@
namespace android::hardware::neuralnetworks::V1_3::vts::functional {
using namespace test_helper;
+using implementation::PreparedModelCallback;
using V1_0::ErrorStatus;
using V1_1::ExecutionPreference;
using V1_2::Constant;
using V1_2::IPreparedModel;
using V1_2::OperationType;
-using V1_2::implementation::PreparedModelCallback;
namespace float32_model {
@@ -231,7 +231,7 @@
ASSERT_NE(kDevice.get(), nullptr);
// Create cache directory. The cache directory and a temporary cache file is always created
- // to test the behavior of prepareModelFromCache, even when caching is not supported.
+ // to test the behavior of prepareModelFromCache_1_3, even when caching is not supported.
char cacheDirTemp[] = "/data/local/tmp/TestCompilationCachingXXXXXX";
char* cacheDir = mkdtemp(cacheDirTemp);
ASSERT_NE(cacheDir, nullptr);
@@ -370,7 +370,7 @@
// Launch prepare model from cache.
sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
hidl_array<uint8_t, sizeof(mToken)> cacheToken(mToken);
- Return<ErrorStatus> prepareLaunchStatus = kDevice->prepareModelFromCache(
+ Return<ErrorStatus> prepareLaunchStatus = kDevice->prepareModelFromCache_1_3(
modelCache, dataCache, cacheToken, preparedModelCallback);
ASSERT_TRUE(prepareLaunchStatus.isOk());
if (static_cast<ErrorStatus>(prepareLaunchStatus) != ErrorStatus::NONE) {
diff --git a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
index 8a7ed24..4f9b6f9 100644
--- a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
@@ -29,6 +29,7 @@
#include <android/hardware/neuralnetworks/1.2/IPreparedModelCallback.h>
#include <android/hardware/neuralnetworks/1.2/types.h>
#include <android/hardware/neuralnetworks/1.3/IDevice.h>
+#include <android/hardware/neuralnetworks/1.3/IPreparedModelCallback.h>
#include <android/hardware/neuralnetworks/1.3/types.h>
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMemory.h>
@@ -42,6 +43,7 @@
#include "1.0/Utils.h"
#include "1.2/Callbacks.h"
+#include "1.3/Callbacks.h"
#include "ExecutionBurstController.h"
#include "MemoryUtils.h"
#include "TestHarness.h"
@@ -52,6 +54,7 @@
using namespace test_helper;
using hidl::memory::V1_0::IMemory;
+using implementation::PreparedModelCallback;
using V1_0::DataLocation;
using V1_0::ErrorStatus;
using V1_0::OperandLifeTime;
@@ -65,7 +68,6 @@
using V1_2::SymmPerChannelQuantParams;
using V1_2::Timing;
using V1_2::implementation::ExecutionCallback;
-using V1_2::implementation::PreparedModelCallback;
using HidlToken = hidl_array<uint8_t, static_cast<uint32_t>(Constant::BYTE_SIZE_OF_CACHE_TOKEN)>;
enum class OutputType { FULLY_SPECIFIED, UNSPECIFIED, INSUFFICIENT };
diff --git a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
index 44b32a9..bdda790 100644
--- a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
@@ -17,12 +17,13 @@
#define LOG_TAG "neuralnetworks_hidl_hal_test"
#include "1.0/Utils.h"
-#include "1.2/Callbacks.h"
+#include "1.3/Callbacks.h"
#include "GeneratedTestHarness.h"
#include "VtsHalNeuralnetworks.h"
namespace android::hardware::neuralnetworks::V1_3::vts::functional {
+using implementation::PreparedModelCallback;
using V1_0::ErrorStatus;
using V1_0::OperandLifeTime;
using V1_1::ExecutionPreference;
@@ -30,7 +31,6 @@
using V1_2::OperationType;
using V1_2::OperationTypeRange;
using V1_2::SymmPerChannelQuantParams;
-using V1_2::implementation::PreparedModelCallback;
using HidlToken =
hidl_array<uint8_t, static_cast<uint32_t>(V1_2::Constant::BYTE_SIZE_OF_CACHE_TOKEN)>;
diff --git a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
index 4f0e150..da5d95b 100644
--- a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
@@ -21,8 +21,8 @@
#include <hidl/ServiceManagement.h>
#include <string>
#include <utility>
-#include "1.0/Callbacks.h"
#include "1.0/Utils.h"
+#include "1.3/Callbacks.h"
#include "GeneratedTestHarness.h"
#include "TestHarness.h"
@@ -30,11 +30,11 @@
using HidlToken =
hidl_array<uint8_t, static_cast<uint32_t>(V1_2::Constant::BYTE_SIZE_OF_CACHE_TOKEN)>;
+using implementation::PreparedModelCallback;
using V1_0::ErrorStatus;
using V1_0::Request;
using V1_1::ExecutionPreference;
using V1_2::IPreparedModel;
-using V1_2::implementation::PreparedModelCallback;
// internal helper function
void createPreparedModel(const sp<IDevice>& device, const Model& model,
diff --git a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.h b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.h
index fc654ce..9ccc911 100644
--- a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.h
+++ b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.h
@@ -22,7 +22,7 @@
#include <android/hardware/neuralnetworks/1.3/types.h>
#include <gtest/gtest.h>
#include "1.0/Utils.h"
-#include "1.2/Callbacks.h"
+#include "1.3/Callbacks.h"
namespace android::hardware::neuralnetworks::V1_3::vts::functional {
@@ -51,7 +51,7 @@
// Utility function to get PreparedModel from callback and downcast to V1_2.
sp<V1_2::IPreparedModel> getPreparedModel_1_2(
- const sp<V1_2::implementation::PreparedModelCallback>& callback);
+ const sp<implementation::PreparedModelCallback>& callback);
} // namespace android::hardware::neuralnetworks::V1_3::vts::functional
diff --git a/neuralnetworks/1.3/vts/functional/include/1.3/Callbacks.h b/neuralnetworks/1.3/vts/functional/include/1.3/Callbacks.h
new file mode 100644
index 0000000..9376a92
--- /dev/null
+++ b/neuralnetworks/1.3/vts/functional/include/1.3/Callbacks.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_NEURALNETWORKS_V1_3_CALLBACKS_H
+#define ANDROID_HARDWARE_NEURALNETWORKS_V1_3_CALLBACKS_H
+
+#include <android-base/thread_annotations.h>
+#include <android/hardware/neuralnetworks/1.0/IPreparedModelCallback.h>
+#include <android/hardware/neuralnetworks/1.2/IPreparedModelCallback.h>
+#include <android/hardware/neuralnetworks/1.3/IPreparedModelCallback.h>
+#include <hidl/Status.h>
+#include <condition_variable>
+#include <mutex>
+
+/*
+ * The Callback classes are used internally by the NeuralNetworks runtime to
+ * synchronize between different threads. An asynchronous task is launched
+ * paired with a callback object. When a client thread requires the output being
+ * generated by the asynchronous task, the client thread can wait for the result
+ * and be blocked until it has completed. Any wait may safely be called
+ * concurrently, even on the same callback object. When the asynchronous task
+ * has finished its workload, it must immediately call "notify*". If the
+ * asynchronous task has failed to launch, the function that tried to launch the
+ * asynchronous task must immediately call "notify*". This "notify*" call
+ * awakens any client threads waiting on the callback object.
+ *
+ * These classes exist to enable synchronization across HIDL. When
+ * synchronization is only required in the same process, consider using
+ * std::future, std::mutex, std::condition_variable, or std::experimental::latch
+ * instead.
+ */
+
+namespace android::hardware::neuralnetworks::V1_3::implementation {
+
+/**
+ * The PreparedModelCallback class is used to receive the error status of
+ * preparing a model as well as the prepared model from a task executing
+ * asynchronously with respect to the runtime. If a calling thread calls wait
+ * or get* on a PreparedModelCallback object and the corresponding asynchronous
+ * task has not finished preparing the model, the calling thread will block
+ * until the asynchronous task has called notify*.
+ *
+ * If the callback object is notified more than once, only the results of the
+ * first call to notify* are used, and the results from subsequent calls are
+ * discarded.
+ *
+ * This callback object is passed as an argument to IDevice::prepareModel*.
+ */
+class PreparedModelCallback : public IPreparedModelCallback {
+ public:
+ /**
+ * IPreparedModelCallback::notify marks the callback object with the return
+ * status of the asynchronous model preparation along with the prepared
+ * model, and allows all prior and future wait calls on the
+ * PreparedModelCallback object to proceed.
+ *
+ * One of IPreparedModelCallback::notify, IPreparedModelCallback::notify_1_2,
+ * or IPreparedModelCallback::notify_1_3 must be called on a given
+ * PreparedModelCallback object.
+ *
+ * If the callback object is notified more than once, only the results of
+ * the first call to notify* are used, and the results from subsequent calls
+ * are discarded.
+ *
+ * @param status Error status returned from asynchronously preparing the
+ * model; will be:
+ * - NONE if the asynchronous preparation was successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if there is an unspecified error
+ * - INVALID_ARGUMENT if the input model is invalid
+ * @param preparedModel Returned model that has been prepared for execution,
+ * nullptr if the model was unable to be prepared.
+ */
+ Return<void> notify(V1_0::ErrorStatus status,
+ const sp<V1_0::IPreparedModel>& preparedModel) override;
+
+ /**
+ * IPreparedModelCallback::notify_1_2 marks the callback object with the
+ * return status of the asynchronous model preparation along with the
+ * prepared model, and allows all prior and future wait calls on the
+ * PreparedModelCallback object to proceed.
+ *
+ * One of IPreparedModelCallback::notify, IPreparedModelCallback::notify_1_2,
+ * or IPreparedModelCallback::notify_1_3 must be called on a given
+ * PreparedModelCallback object.
+ *
+ * If the callback object is notified more than once, only the results of
+ * the first call to notify* are used, and the results from subsequent calls
+ * are discarded.
+ *
+ * @param status Error status returned from asynchronously preparing the
+ * model; will be:
+ * - NONE if the asynchronous preparation was successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if there is an unspecified error
+ * - INVALID_ARGUMENT if the input model is invalid
+ * @param preparedModel Returned model that has been prepared for execution,
+ * nullptr if the model was unable to be prepared.
+ */
+ Return<void> notify_1_2(V1_0::ErrorStatus status,
+ const sp<V1_2::IPreparedModel>& preparedModel) override;
+
+ /**
+ * IPreparedModelCallback::notify_1_3 marks the callback object with the
+ * return status of the asynchronous model preparation along with the
+ * prepared model, and allows all prior and future wait calls on the
+ * PreparedModelCallback object to proceed.
+ *
+ * One of IPreparedModelCallback::notify, IPreparedModelCallback::notify_1_2,
+ * or IPreparedModelCallback::notify_1_3 must be called on a given
+ * PreparedModelCallback object.
+ *
+ * If the callback object is notified more than once, only the results of
+ * the first call to notify* are used, and the results from subsequent calls
+ * are discarded.
+ *
+ * @param status Error status returned from asynchronously preparing the
+ * model; will be:
+ * - NONE if the asynchronous preparation was successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if there is an unspecified error
+ * - INVALID_ARGUMENT if the input model is invalid
+ * @param preparedModel Returned model that has been prepared for execution,
+ * nullptr if the model was unable to be prepared.
+ */
+ Return<void> notify_1_3(V1_0::ErrorStatus status,
+ const sp<V1_2::IPreparedModel>& preparedModel) override;
+
+ /**
+ * PreparedModelCallback::wait blocks until notify* has been called on the
+ * callback object.
+ */
+ void wait() const;
+
+ /**
+ * Retrieves the error status returned from the asynchronous task launched
+ * by IDevice::prepareModel*. If IDevice::prepareModel* has not finished
+ * asynchronously preparing the model, this call will block until the
+ * asynchronous task notifies the object.
+ *
+ * @return status Error status returned from asynchronously preparing the
+ * model; will be:
+ * - NONE if the asynchronous preparation was successful
+ * - DEVICE_UNAVAILABLE if driver is offline or busy
+ * - GENERAL_FAILURE if there is an unspecified error
+ * - INVALID_ARGUMENT if the input model is invalid
+ */
+ V1_0::ErrorStatus getStatus() const;
+
+ /**
+ * Retrieves the model that has been prepared for execution from the
+ * asynchronous task launched by IDevice::prepareModel*. If
+ * IDevice::prepareModel* has not finished asynchronously preparing the
+ * model, this call will block until the asynchronous task notifies the
+ * object.
+ *
+ * @return preparedModel Returned model that has been prepared for
+ * execution, nullptr if the model was unable to be prepared.
+ */
+ sp<V1_0::IPreparedModel> getPreparedModel() const;
+
+ private:
+ mutable std::mutex mMutex;
+ mutable std::condition_variable mCondition;
+ bool mNotified GUARDED_BY(mMutex) = false;
+ V1_0::ErrorStatus mErrorStatus = V1_0::ErrorStatus::GENERAL_FAILURE;
+ sp<V1_0::IPreparedModel> mPreparedModel;
+};
+
+} // namespace android::hardware::neuralnetworks::V1_3::implementation
+
+#endif // ANDROID_HARDWARE_NEURALNETWORKS_V1_3_CALLBACKS_H
diff --git a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
index aeb9b70..b6aa9e2 100644
--- a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
+++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
@@ -46,13 +46,13 @@
EffectStrength::STRONG};
const std::vector<Effect> kInvalidEffects = {
- static_cast<Effect>(static_cast<int32_t>(*kEffects.begin()) - 1),
- static_cast<Effect>(static_cast<int32_t>(*kEffects.end()) + 1),
+ static_cast<Effect>(static_cast<int32_t>(kEffects.front()) - 1),
+ static_cast<Effect>(static_cast<int32_t>(kEffects.back()) + 1),
};
const std::vector<EffectStrength> kInvalidEffectStrengths = {
- static_cast<EffectStrength>(static_cast<int8_t>(*kEffectStrengths.begin()) - 1),
- static_cast<EffectStrength>(static_cast<int8_t>(*kEffectStrengths.end()) + 1),
+ static_cast<EffectStrength>(static_cast<int8_t>(kEffectStrengths.front()) - 1),
+ static_cast<EffectStrength>(static_cast<int8_t>(kEffectStrengths.back()) + 1),
};
class CompletionCallback : public BnVibratorCallback {
@@ -119,10 +119,13 @@
Status status = vibrator->perform(effect, strength, nullptr /*callback*/, &lengthMs);
if (isEffectSupported) {
- EXPECT_TRUE(status.isOk());
+ EXPECT_TRUE(status.isOk())
+ << static_cast<int>(effect) << " " << static_cast<int>(strength);
EXPECT_GT(lengthMs, 0);
+ usleep(lengthMs * 1000);
} else {
- EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION);
+ EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION)
+ << static_cast<int>(effect) << " " << static_cast<int>(strength);
EXPECT_EQ(lengthMs, 0);
}
}
@@ -179,10 +182,19 @@
TEST_P(VibratorAidl, InvalidEffectsUnsupported) {
for (Effect effect : kInvalidEffects) {
+ for (EffectStrength strength : kEffectStrengths) {
+ int32_t lengthMs;
+ Status status = vibrator->perform(effect, strength, nullptr /*callback*/, &lengthMs);
+ EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION)
+ << static_cast<int>(effect) << " " << static_cast<int>(strength);
+ }
+ }
+ for (Effect effect : kEffects) {
for (EffectStrength strength : kInvalidEffectStrengths) {
int32_t lengthMs;
Status status = vibrator->perform(effect, strength, nullptr /*callback*/, &lengthMs);
- EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION);
+ EXPECT_EQ(status.exceptionCode(), Status::EX_UNSUPPORTED_OPERATION)
+ << static_cast<int>(effect) << " " << static_cast<int>(strength);
}
}
}
@@ -247,7 +259,7 @@
}
}
-INSTANTIATE_TEST_SUITE_P(, VibratorAidl,
+INSTANTIATE_TEST_SUITE_P(Vibrator, VibratorAidl,
testing::ValuesIn(android::getAidlHalInstanceNames(IVibrator::descriptor)),
android::PrintInstanceNameToString);
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
index 97a371b..f89f7b4 100644
--- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
+++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <android/log.h>
+
#include <VtsHalHidlTargetTestBase.h>
#include "wifi_hidl_call_util.h"
@@ -87,14 +89,21 @@
}
} // namespace
-sp<IWifi> getWifi() {
- sp<IWifi> wifi = ::testing::VtsHalHidlTargetTestBase::getService<IWifi>(
- gEnv->getServiceName<IWifi>());
- return wifi;
+sp<IWifi> getWifi(const std::string& instance_name) {
+ if ((!gEnv && instance_name.empty()) || (gEnv && !instance_name.empty())) {
+ ALOGE("instance_name and gEnv must have one and only one set.");
+ return nullptr;
+ }
+ if (gEnv) {
+ return ::testing::VtsHalHidlTargetTestBase::getService<IWifi>(
+ gEnv->getServiceName<IWifi>());
+ } else {
+ return IWifi::getService(instance_name);
+ }
}
-sp<IWifiChip> getWifiChip() {
- sp<IWifi> wifi = getWifi();
+sp<IWifiChip> getWifiChip(const std::string& instance_name) {
+ sp<IWifi> wifi = getWifi(instance_name);
if (!wifi.get()) {
return nullptr;
}
@@ -122,8 +131,8 @@
return status_and_chip.second;
}
-sp<IWifiApIface> getWifiApIface() {
- sp<IWifiChip> wifi_chip = getWifiChip();
+sp<IWifiApIface> getWifiApIface(const std::string& instance_name) {
+ sp<IWifiChip> wifi_chip = getWifiChip(instance_name);
if (!wifi_chip.get()) {
return nullptr;
}
@@ -137,8 +146,8 @@
return status_and_iface.second;
}
-sp<IWifiNanIface> getWifiNanIface() {
- sp<IWifiChip> wifi_chip = getWifiChip();
+sp<IWifiNanIface> getWifiNanIface(const std::string& instance_name) {
+ sp<IWifiChip> wifi_chip = getWifiChip(instance_name);
if (!wifi_chip.get()) {
return nullptr;
}
@@ -152,8 +161,8 @@
return status_and_iface.second;
}
-sp<IWifiP2pIface> getWifiP2pIface() {
- sp<IWifiChip> wifi_chip = getWifiChip();
+sp<IWifiP2pIface> getWifiP2pIface(const std::string& instance_name) {
+ sp<IWifiChip> wifi_chip = getWifiChip(instance_name);
if (!wifi_chip.get()) {
return nullptr;
}
@@ -167,8 +176,8 @@
return status_and_iface.second;
}
-sp<IWifiStaIface> getWifiStaIface() {
- sp<IWifiChip> wifi_chip = getWifiChip();
+sp<IWifiStaIface> getWifiStaIface(const std::string& instance_name) {
+ sp<IWifiChip> wifi_chip = getWifiChip(instance_name);
if (!wifi_chip.get()) {
return nullptr;
}
@@ -182,8 +191,8 @@
return status_and_iface.second;
}
-sp<IWifiRttController> getWifiRttController() {
- sp<IWifiChip> wifi_chip = getWifiChip();
+sp<IWifiRttController> getWifiRttController(const std::string& instance_name) {
+ sp<IWifiChip> wifi_chip = getWifiChip(instance_name);
if (!wifi_chip.get()) {
return nullptr;
}
@@ -206,8 +215,8 @@
configured_mode_id);
}
-void stopWifi() {
- sp<IWifi> wifi = getWifi();
+void stopWifi(const std::string& instance_name) {
+ sp<IWifi> wifi = getWifi(instance_name);
ASSERT_NE(wifi, nullptr);
HIDL_INVOKE(wifi, stop);
}
diff --git a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
index 7dacaf1..bdee2ec 100644
--- a/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
+++ b/wifi/1.0/vts/functional/wifi_hidl_test_utils.h
@@ -31,14 +31,21 @@
// Note: We only have a single instance of each of these objects currently.
// These helper functions should be modified to return vectors if we support
// multiple instances.
-android::sp<android::hardware::wifi::V1_0::IWifi> getWifi();
-android::sp<android::hardware::wifi::V1_0::IWifiChip> getWifiChip();
-android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface();
-android::sp<android::hardware::wifi::V1_0::IWifiNanIface> getWifiNanIface();
-android::sp<android::hardware::wifi::V1_0::IWifiP2pIface> getWifiP2pIface();
-android::sp<android::hardware::wifi::V1_0::IWifiStaIface> getWifiStaIface();
+// TODO(b/143892896): Remove the default value as part of the cleanup.
+android::sp<android::hardware::wifi::V1_0::IWifi> getWifi(
+ const std::string& instance_name = "");
+android::sp<android::hardware::wifi::V1_0::IWifiChip> getWifiChip(
+ const std::string& instance_name = "");
+android::sp<android::hardware::wifi::V1_0::IWifiApIface> getWifiApIface(
+ const std::string& instance_name = "");
+android::sp<android::hardware::wifi::V1_0::IWifiNanIface> getWifiNanIface(
+ const std::string& instance_name = "");
+android::sp<android::hardware::wifi::V1_0::IWifiP2pIface> getWifiP2pIface(
+ const std::string& instance_name = "");
+android::sp<android::hardware::wifi::V1_0::IWifiStaIface> getWifiStaIface(
+ const std::string& instance_name = "");
android::sp<android::hardware::wifi::V1_0::IWifiRttController>
-getWifiRttController();
+getWifiRttController(const std::string& instance_name = "");
// Configure the chip in a mode to support the creation of the provided
// iface type.
bool configureChipToSupportIfaceType(
@@ -46,7 +53,7 @@
android::hardware::wifi::V1_0::IfaceType type,
android::hardware::wifi::V1_0::ChipModeId* configured_mode_id);
// Used to trigger IWifi.stop() at the end of every test.
-void stopWifi();
+void stopWifi(const std::string& instance_name = "");
class WifiHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
protected:
diff --git a/wifi/hostapd/1.0/vts/functional/Android.bp b/wifi/hostapd/1.0/vts/functional/Android.bp
index 5645019..b53d002 100644
--- a/wifi/hostapd/1.0/vts/functional/Android.bp
+++ b/wifi/hostapd/1.0/vts/functional/Android.bp
@@ -49,5 +49,5 @@
"libwifi-system",
"libwifi-system-iface",
],
- test_suites: ["general-tests"],
+ test_suites: ["general-tests", "vts-core"],
}
diff --git a/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp b/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp
index 0303b20..4b62b15 100644
--- a/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp
+++ b/wifi/hostapd/1.0/vts/functional/VtsHalWifiHostapdV1_0TargetTest.cpp
@@ -14,36 +14,8 @@
* limitations under the License.
*/
-#include <android-base/logging.h>
-#include <android/hardware/wifi/1.0/IWifi.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
-#include "hostapd_hidl_test_utils.h"
-
-class WifiHostapdHidlEnvironment_1_0 : public WifiHostapdHidlEnvironment {
- public:
- // get the test environment singleton
- static WifiHostapdHidlEnvironment_1_0* Instance() {
- static WifiHostapdHidlEnvironment_1_0* instance =
- new WifiHostapdHidlEnvironment_1_0;
- return instance;
- }
-
- virtual void registerTestServices() override {
- registerTestService<::android::hardware::wifi::V1_0::IWifi>();
- registerTestService<android::hardware::wifi::hostapd::V1_0::IHostapd>();
- }
-
- private:
- WifiHostapdHidlEnvironment_1_0() {}
-};
-
-WifiHostapdHidlEnvironment* gEnv = WifiHostapdHidlEnvironment_1_0::Instance();
-
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(gEnv);
- ::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
-}
+// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
+// updated.
+::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
index 8ee71fb..5a978ca 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
@@ -17,18 +17,22 @@
#include <android-base/logging.h>
#include <cutils/properties.h>
-#include <VtsHalHidlTargetTestBase.h>
-
+#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/hostapd/1.0/IHostapd.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+
#include "hostapd_hidl_call_util.h"
#include "hostapd_hidl_test_utils.h"
using ::android::sp;
using ::android::hardware::hidl_vec;
-using ::android::hardware::wifi::hostapd::V1_0::IHostapd;
using ::android::hardware::wifi::hostapd::V1_0::HostapdStatus;
using ::android::hardware::wifi::hostapd::V1_0::HostapdStatusCode;
+using ::android::hardware::wifi::hostapd::V1_0::IHostapd;
+using ::android::hardware::wifi::V1_0::IWifi;
namespace {
constexpr unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1',
@@ -38,16 +42,20 @@
constexpr int kIfaceInvalidChannel = 567;
} // namespace
-class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+class HostapdHidlTest
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
public:
virtual void SetUp() override {
- stopSupplicantIfNeeded();
- startHostapdAndWaitForHidlService();
- hostapd_ = getHostapd();
+ wifi_instance_name_ = std::get<0>(GetParam());
+ hostapd_instance_name_ = std::get<1>(GetParam());
+ stopSupplicantIfNeeded(wifi_instance_name_);
+ startHostapdAndWaitForHidlService(wifi_instance_name_,
+ hostapd_instance_name_);
+ hostapd_ = IHostapd::getService(hostapd_instance_name_);
ASSERT_NE(hostapd_.get(), nullptr);
}
- virtual void TearDown() override { stopHostapd(); }
+ virtual void TearDown() override { stopHostapd(wifi_instance_name_); }
protected:
std::string getPrimaryWlanIfaceName() {
@@ -121,6 +129,8 @@
}
// IHostapd object used for all tests in this fixture.
sp<IHostapd> hostapd_;
+ std::string wifi_instance_name_;
+ std::string hostapd_instance_name_;
};
/*
@@ -128,17 +138,19 @@
* Ensures that an instance of the IHostapd proxy object is
* successfully created.
*/
-TEST(HostapdHidlTestNoFixture, Create) {
- startHostapdAndWaitForHidlService();
- EXPECT_NE(nullptr, getHostapd().get());
- stopHostapd();
+TEST_P(HostapdHidlTest, Create) {
+ stopHostapd(wifi_instance_name_);
+ startHostapdAndWaitForHidlService(wifi_instance_name_,
+ hostapd_instance_name_);
+ sp<IHostapd> hostapd = IHostapd::getService(hostapd_instance_name_);
+ EXPECT_NE(nullptr, hostapd.get());
}
/**
* Adds an access point with PSK network config & ACS enabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithAcs) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
if (!is_1_1(hostapd_)) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
getIfaceParamsWithAcs(), getPskNwParams());
@@ -151,7 +163,7 @@
* Adds an access point with Open network config & ACS enabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddOpenAccessPointWithAcs) {
+TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
if (!is_1_1(hostapd_)) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
getIfaceParamsWithAcs(), getOpenNwParams());
@@ -164,7 +176,7 @@
* Adds an access point with PSK network config & ACS disabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
if (!is_1_1(hostapd_)) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
getIfaceParamsWithoutAcs(), getPskNwParams());
@@ -176,7 +188,7 @@
* Adds an access point with Open network config & ACS disabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
if (!is_1_1(hostapd_)) {
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
@@ -189,7 +201,7 @@
* Adds & then removes an access point with PSK network config & ACS enabled.
* Access point creation & removal should pass.
*/
-TEST_F(HostapdHidlTest, RemoveAccessPointWithAcs) {
+TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
if (!is_1_1(hostapd_)) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
getIfaceParamsWithAcs(), getPskNwParams());
@@ -207,7 +219,7 @@
* Adds & then removes an access point with PSK network config & ACS disabled.
* Access point creation & removal should pass.
*/
-TEST_F(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
if (!is_1_1(hostapd_)) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
getIfaceParamsWithoutAcs(), getPskNwParams());
@@ -222,7 +234,7 @@
* Adds an access point with invalid channel.
* Access point creation should fail.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
if (!is_1_1(hostapd_)) {
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint,
@@ -235,7 +247,7 @@
* Adds an access point with invalid PSK network config.
* Access point creation should fail.
*/
-TEST_F(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
if (!is_1_1(hostapd_)) {
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
@@ -248,6 +260,13 @@
* Terminate
* This terminates the service.
*/
-TEST_F(HostapdHidlTest, Terminate) {
- hostapd_->terminate();
-}
+TEST_P(HostapdHidlTest, Terminate) { hostapd_->terminate(); }
+
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, HostapdHidlTest,
+ testing::Combine(
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IHostapd::descriptor))),
+ android::hardware::PrintInstanceTupleNameToString<>);
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
index cdbf1ab..6058fd2 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
@@ -44,13 +44,11 @@
using ::android::wifi_system::HostapdManager;
using ::android::wifi_system::SupplicantManager;
-extern WifiHostapdHidlEnvironment* gEnv;
-
namespace {
// Helper function to initialize the driver and firmware to AP mode
// using the vendor HAL HIDL interface.
-void initilializeDriverAndFirmware() {
- sp<IWifiChip> wifi_chip = getWifiChip();
+void initilializeDriverAndFirmware(const std::string& wifi_instance_name) {
+ sp<IWifiChip> wifi_chip = getWifiChip(wifi_instance_name);
ChipModeId mode_id;
EXPECT_TRUE(configureChipToSupportIfaceType(
wifi_chip, ::android::hardware::wifi::V1_0::IfaceType::AP, &mode_id));
@@ -58,7 +56,9 @@
// Helper function to deinitialize the driver and firmware
// using the vendor HAL HIDL interface.
-void deInitilializeDriverAndFirmware() { stopWifi(); }
+void deInitilializeDriverAndFirmware(const std::string& wifi_instance_name) {
+ stopWifi(wifi_instance_name);
+}
} // namespace
// Utility class to wait for wpa_hostapd's HIDL service registration.
@@ -110,45 +110,42 @@
std::condition_variable condition_;
};
-void stopSupplicantIfNeeded() {
+void stopSupplicantIfNeeded(const std::string& instance_name) {
SupplicantManager supplicant_manager;
if (supplicant_manager.IsSupplicantRunning()) {
LOG(INFO) << "Supplicant is running, stop supplicant first.";
ASSERT_TRUE(supplicant_manager.StopSupplicant());
- deInitilializeDriverAndFirmware();
+ deInitilializeDriverAndFirmware(instance_name);
ASSERT_FALSE(supplicant_manager.IsSupplicantRunning());
}
}
-void stopHostapd() {
+void stopHostapd(const std::string& instance_name) {
HostapdManager hostapd_manager;
ASSERT_TRUE(hostapd_manager.StopHostapd());
- deInitilializeDriverAndFirmware();
+ deInitilializeDriverAndFirmware(instance_name);
}
-void startHostapdAndWaitForHidlService() {
- initilializeDriverAndFirmware();
+void startHostapdAndWaitForHidlService(
+ const std::string& wifi_instance_name,
+ const std::string& hostapd_instance_name) {
+ initilializeDriverAndFirmware(wifi_instance_name);
android::sp<ServiceNotificationListener> notification_listener =
new ServiceNotificationListener();
- string service_name = gEnv->getServiceName<IHostapd>();
ASSERT_TRUE(notification_listener->registerForHidlServiceNotifications(
- service_name));
+ hostapd_instance_name));
HostapdManager hostapd_manager;
ASSERT_TRUE(hostapd_manager.StartHostapd());
- ASSERT_TRUE(notification_listener->waitForHidlService(500, service_name));
+ ASSERT_TRUE(
+ notification_listener->waitForHidlService(500, hostapd_instance_name));
}
bool is_1_1(const sp<IHostapd>& hostapd) {
sp<::android::hardware::wifi::hostapd::V1_1::IHostapd> hostapd_1_1 =
::android::hardware::wifi::hostapd::V1_1::IHostapd::castFrom(hostapd);
return hostapd_1_1.get() != nullptr;
-}
-
-sp<IHostapd> getHostapd() {
- return ::testing::VtsHalHidlTargetTestBase::getService<IHostapd>(
- gEnv->getServiceName<IHostapd>());
-}
+}
\ No newline at end of file
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
index 9b3df42..5cb4f01 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
@@ -20,32 +20,18 @@
#include <android/hardware/wifi/hostapd/1.0/IHostapd.h>
#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
-
// Used to stop the android wifi framework before every test.
-void stopWifiFramework();
-void startWifiFramework();
-void stopSupplicantIfNeeded();
-void stopHostapd();
+void stopWifiFramework(const std::string& instance_name);
+void startWifiFramework(const std::string& instance_name);
+void stopSupplicantIfNeeded(const std::string& instance_name);
+void stopHostapd(const std::string& instance_name);
// Used to configure the chip, driver and start wpa_hostapd before every
// test.
-void startHostapdAndWaitForHidlService();
+void startHostapdAndWaitForHidlService(
+ const std::string& wifi_instance_name,
+ const std::string& hostapd_instance_name);
-// Helper functions to obtain references to the various HIDL interface objects.
-// Note: We only have a single instance of each of these objects currently.
-// These helper functions should be modified to return vectors if we support
-// multiple instances.
-android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd> getHostapd();
bool is_1_1(const android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd>&
hostapd);
-class WifiHostapdHidlEnvironment
- : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- virtual void HidlSetUp() override { stopHostapd(); }
- virtual void HidlTearDown() override {
- startHostapdAndWaitForHidlService();
- }
-};
-
#endif /* HOSTAPD_HIDL_TEST_UTILS_H */
diff --git a/wifi/hostapd/1.1/vts/functional/Android.bp b/wifi/hostapd/1.1/vts/functional/Android.bp
index 02ec2e6..c963fe3 100644
--- a/wifi/hostapd/1.1/vts/functional/Android.bp
+++ b/wifi/hostapd/1.1/vts/functional/Android.bp
@@ -14,25 +14,6 @@
// limitations under the License.
//
-cc_library_static {
- name: "VtsHalWifiHostapdV1_1TargetTestUtil",
- defaults: ["VtsHalTargetTestDefaults"],
- srcs: ["hostapd_hidl_test_utils_1_1.cpp"],
- export_include_dirs: [
- "."
- ],
- static_libs: [
- "VtsHalWifiV1_0TargetTestUtil",
- "VtsHalWifiHostapdV1_0TargetTestUtil",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "libgmock",
- "libwifi-system",
- "libwifi-system-iface",
- ],
-}
-
cc_test {
name: "VtsHalWifiHostapdV1_1TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
@@ -43,7 +24,6 @@
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",
"VtsHalWifiHostapdV1_0TargetTestUtil",
- "VtsHalWifiHostapdV1_1TargetTestUtil",
"[email protected]",
"[email protected]",
"[email protected]",
@@ -51,6 +31,6 @@
"libwifi-system",
"libwifi-system-iface",
],
- test_suites: ["general-tests"],
+ test_suites: ["general-tests", "vts-core"],
}
diff --git a/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
index 6916db2..7e0f3cd 100644
--- a/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
+++ b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
@@ -14,38 +14,8 @@
* limitations under the License.
*/
-#include <android-base/logging.h>
-#include <android/hardware/wifi/1.0/IWifi.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
-#include "hostapd_hidl_test_utils.h"
-#include "hostapd_hidl_test_utils_1_1.h"
-
-class WifiHostapdHidlEnvironment_1_1 : public WifiHostapdHidlEnvironment {
- public:
- // get the test environment singleton
- static WifiHostapdHidlEnvironment_1_1* Instance() {
- static WifiHostapdHidlEnvironment_1_1* instance =
- new WifiHostapdHidlEnvironment_1_1;
- return instance;
- }
-
- virtual void registerTestServices() override {
- registerTestService<::android::hardware::wifi::V1_0::IWifi>();
- registerTestService<android::hardware::wifi::hostapd::V1_0::IHostapd>();
- registerTestService<android::hardware::wifi::hostapd::V1_1::IHostapd>();
- }
-
- private:
- WifiHostapdHidlEnvironment_1_1() {}
-};
-
-WifiHostapdHidlEnvironment* gEnv = WifiHostapdHidlEnvironment_1_1::Instance();
-
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(gEnv);
- ::testing::InitGoogleTest(&argc, argv);
- gEnv->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
-}
+// TODO(b/143892896): Remove this file after wifi_hidl_test_utils.cpp is
+// updated.
+::testing::VtsHalHidlTargetTestEnvBase* gEnv = nullptr;
\ No newline at end of file
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
index b053549..1804d8c 100644
--- a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
@@ -17,13 +17,15 @@
#include <android-base/logging.h>
#include <cutils/properties.h>
-#include <VtsHalHidlTargetTestBase.h>
+#include <gtest/gtest.h>
+#include <hidl/GtestPrinter.h>
+#include <hidl/ServiceManagement.h>
+#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
#include "hostapd_hidl_call_util.h"
#include "hostapd_hidl_test_utils.h"
-#include "hostapd_hidl_test_utils_1_1.h"
using ::android::sp;
using ::android::hardware::hidl_string;
@@ -33,6 +35,7 @@
using ::android::hardware::wifi::hostapd::V1_0::HostapdStatusCode;
using ::android::hardware::wifi::hostapd::V1_1::IHostapd;
using ::android::hardware::wifi::hostapd::V1_1::IHostapdCallback;
+using ::android::hardware::wifi::V1_0::IWifi;
namespace {
constexpr unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1',
@@ -42,16 +45,20 @@
constexpr int kIfaceInvalidChannel = 567;
} // namespace
-class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+class HostapdHidlTest
+ : public ::testing::TestWithParam<std::tuple<std::string, std::string>> {
public:
virtual void SetUp() override {
- stopSupplicantIfNeeded();
- startHostapdAndWaitForHidlService();
- hostapd_ = getHostapd_1_1();
+ wifi_instance_name_ = std::get<0>(GetParam());
+ hostapd_instance_name_ = std::get<1>(GetParam());
+ stopSupplicantIfNeeded(wifi_instance_name_);
+ startHostapdAndWaitForHidlService(wifi_instance_name_,
+ hostapd_instance_name_);
+ hostapd_ = IHostapd::getService(hostapd_instance_name_);
ASSERT_NE(hostapd_.get(), nullptr);
}
- virtual void TearDown() override { stopHostapd(); }
+ virtual void TearDown() override { stopHostapd(wifi_instance_name_); }
protected:
std::string getPrimaryWlanIfaceName() {
@@ -152,6 +159,8 @@
// IHostapd object used for all tests in this fixture.
sp<IHostapd> hostapd_;
+ std::string wifi_instance_name_;
+ std::string hostapd_instance_name_;
};
class IfaceCallback : public IHostapdCallback {
@@ -164,7 +173,7 @@
/*
* RegisterCallback
*/
-TEST_F(HostapdHidlTest, registerCallback) {
+TEST_P(HostapdHidlTest, registerCallback) {
hostapd_->registerCallback(
new IfaceCallback(), [](const HostapdStatus& status) {
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -175,7 +184,7 @@
* Adds an access point with PSK network config & ACS enabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithAcs) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithAcs(), getPskNwParams());
// TODO: b/140172237, fix this in R.
@@ -186,7 +195,7 @@
* Adds an access point with PSK network config, ACS enabled & channel Range.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithAcsAndChannelRange) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndChannelRange) {
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithAcsAndChannelRange(), getPskNwParams());
@@ -198,7 +207,7 @@
* Adds an access point with invalid channel range.
* Access point creation should fail.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidChannelRange) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidChannelRange) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithAcsAndInvalidChannelRange(),
getPskNwParams());
@@ -210,7 +219,7 @@
* Adds an access point with Open network config & ACS enabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddOpenAccessPointWithAcs) {
+TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithAcs(), getOpenNwParams());
// TODO: b/140172237, fix this in R
@@ -221,7 +230,7 @@
* Adds an access point with PSK network config & ACS disabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithoutAcs(), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -231,7 +240,7 @@
* Adds an access point with Open network config & ACS disabled.
* Access point creation should pass.
*/
-TEST_F(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithoutAcs(), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -241,7 +250,7 @@
* Adds & then removes an access point with PSK network config & ACS enabled.
* Access point creation & removal should pass.
*/
-TEST_F(HostapdHidlTest, RemoveAccessPointWithAcs) {
+TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithAcs(), getPskNwParams());
// TODO: b/140172237, fix this in R
@@ -257,7 +266,7 @@
* Adds & then removes an access point with PSK network config & ACS disabled.
* Access point creation & removal should pass.
*/
-TEST_F(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithoutAcs(), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
@@ -270,7 +279,7 @@
* Adds an access point with invalid channel.
* Access point creation should fail.
*/
-TEST_F(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
+TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithInvalidChannel(), getPskNwParams());
@@ -281,9 +290,18 @@
* Adds an access point with invalid PSK network config.
* Access point creation should fail.
*/
-TEST_F(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
+TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_1, getIfaceParamsWithoutAcs(),
getInvalidPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
+
+INSTANTIATE_TEST_CASE_P(
+ PerInstance, HostapdHidlTest,
+ testing::Combine(
+ testing::ValuesIn(
+ android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
+ testing::ValuesIn(android::hardware::getAllHalInstanceNames(
+ android::hardware::wifi::hostapd::V1_1::IHostapd::descriptor))),
+ android::hardware::PrintInstanceTupleNameToString<>);
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp
deleted file mode 100644
index 8bb72a1..0000000
--- a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <VtsHalHidlTargetTestBase.h>
-#include <android-base/logging.h>
-
-#include "hostapd_hidl_test_utils.h"
-#include "hostapd_hidl_test_utils_1_1.h"
-
-using ::android::sp;
-using ::android::hardware::wifi::hostapd::V1_1::IHostapd;
-
-sp<IHostapd> getHostapd_1_1() { return IHostapd::castFrom(getHostapd()); }
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h
deleted file mode 100644
index c43ddfa..0000000
--- a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef HOSTAPD_HIDL_TEST_UTILS_1_1_H
-#define HOSTAPD_HIDL_TEST_UTILS_1_1_H
-
-#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
-
-#include <VtsHalHidlTargetTestEnvBase.h>
-
-// Helper functions to obtain references to the various HIDL interface objects.
-// Note: We only have a single instance of each of these objects currently.
-// These helper functions should be modified to return vectors if we support
-// multiple instances.
-android::sp<android::hardware::wifi::hostapd::V1_1::IHostapd> getHostapd_1_1();
-
-#endif /* HOSTAPD_HIDL_TEST_UTILS_1_1_H */
diff --git a/wifi/supplicant/1.3/ISupplicantStaIface.hal b/wifi/supplicant/1.3/ISupplicantStaIface.hal
index cb207d8..bfd8946 100644
--- a/wifi/supplicant/1.3/ISupplicantStaIface.hal
+++ b/wifi/supplicant/1.3/ISupplicantStaIface.hal
@@ -54,4 +54,26 @@
*/
getConnectionCapabilities()
generates (SupplicantStatus status, ConnectionCapabilities capabilities);
+
+ /**
+ * Get wpa driver capabilities.
+ *
+ * @return status Status of the operation, and a bitmap of wpa driver features.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ */
+ getWpaDriverCapabilities() generates (SupplicantStatus status,
+ bitfield<WpaDriverCapabilitiesMask> driverCapabilitiesMask);
+
+ /**
+ * Set MBO cellular data status.
+ *
+ * @param available true means cellular data available, false otherwise.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|
+ */
+ setMboCellularDataStatus(bool available) generates (SupplicantStatus status);
};
diff --git a/wifi/supplicant/1.3/types.hal b/wifi/supplicant/1.3/types.hal
index 7874399..4e01ab1 100644
--- a/wifi/supplicant/1.3/types.hal
+++ b/wifi/supplicant/1.3/types.hal
@@ -58,3 +58,17 @@
*/
WifiTechnology technology;
};
+
+/**
+ * WPA Driver capability.
+ */
+enum WpaDriverCapabilitiesMask : uint32_t {
+ /**
+ * Multi Band Operation.
+ */
+ MBO = 1 << 0,
+ /**
+ * Optimized Connectivity Experience.
+ */
+ OCE = 1 << 1,
+};
diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
index 62f3228..2cf5881 100644
--- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -41,6 +41,7 @@
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaIfaceCallback;
using ::android::hardware::wifi::supplicant::V1_3::ISupplicantStaNetwork;
+using ::android::hardware::wifi::supplicant::V1_3::WpaDriverCapabilitiesMask;
class SupplicantStaIfaceHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
@@ -191,3 +192,38 @@
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
}
+
+/*
+ * GetWpaDriverCapabilities
+ */
+TEST_F(SupplicantStaIfaceHidlTest, GetWpaDriverCapabilities) {
+ sta_iface_->getWpaDriverCapabilities(
+ [&](const SupplicantStatus& status, uint32_t) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+ });
+}
+
+/*
+ * SetMboCellularDataStatus
+ */
+TEST_F(SupplicantStaIfaceHidlTest, SetMboCellularDataStatus) {
+ uint32_t driverCapMask = 0;
+
+ // Get MBO support from the device.
+ sta_iface_->getWpaDriverCapabilities(
+ [&](const SupplicantStatus& status, uint32_t driverCapMaskInternal) {
+ EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
+
+ driverCapMask = driverCapMaskInternal;
+ });
+
+ SupplicantStatusCode expectedStatusCode =
+ (driverCapMask & WpaDriverCapabilitiesMask::MBO)
+ ? SupplicantStatusCode::SUCCESS
+ : SupplicantStatusCode::FAILURE_UNKNOWN;
+
+ sta_iface_->setMboCellularDataStatus(
+ true, [expectedStatusCode](const SupplicantStatus& status) {
+ EXPECT_EQ(expectedStatusCode, status.code);
+ });
+}