Merge "HAL changes for 1.5 setLinkCapacityReportingCriteria"
diff --git a/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp b/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp
index 278d1f4..fb01ad0 100644
--- a/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp
+++ b/confirmationui/1.0/vts/functional/VtsHalConfirmationUIV1_0TargetTest.cpp
@@ -336,7 +336,7 @@
ASSERT_EQ(0U, result.args->formattedMessage_.size());
}
-// Simulates the framework candelling an ongoing prompt
+// Simulates the framework cancelling an ongoing prompt
TEST_F(ConfirmationUIHidlTest, AbortTest) {
static constexpr char test_prompt[] = "Me first, gimme gimme!";
static constexpr uint8_t test_extra[] = {0x1, 0x2, 0x3};
@@ -354,6 +354,92 @@
ASSERT_EQ(0U, result.args->formattedMessage_.size());
}
+// Tests if the confirmation dialog can successfully render 100 'W' characters as required by
+// the design guidelines.
+TEST_F(ConfirmationUIHidlTest, PortableMessageTest1) {
+ static constexpr char test_prompt[] =
+ "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
+ "WWWWWWWWWWWWWW";
+ static constexpr uint8_t test_extra[] = {0x1, 0x2, 0x3};
+ sp<ConfirmationTestCallback> conf_cb = new ConfirmationTestCallback;
+ hidl_string prompt_text(test_prompt);
+ hidl_vec<uint8_t> extra(test_extra, test_extra + 3);
+ ASSERT_HAL_CALL(ResponseCode::OK,
+ confirmator().promptUserConfirmation(conf_cb, prompt_text, extra, "en", {}));
+
+ confirmator().abort();
+
+ auto result = conf_cb->WaitForCallback();
+ ASSERT_EQ(ResponseCode::Aborted, result.args->error_);
+ ASSERT_EQ(0U, result.args->confirmationToken_.size());
+ ASSERT_EQ(0U, result.args->formattedMessage_.size());
+}
+
+// Tests if the confirmation dialog can successfully render 100 'W' characters as required by
+// the design guidelines in magnified mode.
+TEST_F(ConfirmationUIHidlTest, PortableMessageTest1Magnified) {
+ static constexpr char test_prompt[] =
+ "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
+ "WWWWWWWWWWWWWW";
+ static constexpr uint8_t test_extra[] = {0x1, 0x2, 0x3};
+ sp<ConfirmationTestCallback> conf_cb = new ConfirmationTestCallback;
+ hidl_string prompt_text(test_prompt);
+ hidl_vec<uint8_t> extra(test_extra, test_extra + 3);
+ ASSERT_HAL_CALL(ResponseCode::OK,
+ confirmator().promptUserConfirmation(conf_cb, prompt_text, extra, "en",
+ {UIOption::AccessibilityMagnified}));
+
+ confirmator().abort();
+
+ auto result = conf_cb->WaitForCallback();
+ ASSERT_EQ(ResponseCode::Aborted, result.args->error_);
+ ASSERT_EQ(0U, result.args->confirmationToken_.size());
+ ASSERT_EQ(0U, result.args->formattedMessage_.size());
+}
+
+// Tests if the confirmation dialog can successfully render 8 groups of 12 'W' characters as
+// required by the design guidelines.
+TEST_F(ConfirmationUIHidlTest, PortableMessageTest2) {
+ static constexpr char test_prompt[] =
+ "WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW "
+ "WWWWWWWWWWWW WWWWWWWWWWWW";
+ static constexpr uint8_t test_extra[] = {0x1, 0x2, 0x3};
+ sp<ConfirmationTestCallback> conf_cb = new ConfirmationTestCallback;
+ hidl_string prompt_text(test_prompt);
+ hidl_vec<uint8_t> extra(test_extra, test_extra + 3);
+ ASSERT_HAL_CALL(ResponseCode::OK,
+ confirmator().promptUserConfirmation(conf_cb, prompt_text, extra, "en", {}));
+
+ confirmator().abort();
+
+ auto result = conf_cb->WaitForCallback();
+ ASSERT_EQ(ResponseCode::Aborted, result.args->error_);
+ ASSERT_EQ(0U, result.args->confirmationToken_.size());
+ ASSERT_EQ(0U, result.args->formattedMessage_.size());
+}
+
+// Tests if the confirmation dialog can successfully render 8 groups of 12 'W' characters as
+// required by the design guidelines in magnified mode.
+TEST_F(ConfirmationUIHidlTest, PortableMessageTest2Magnified) {
+ static constexpr char test_prompt[] =
+ "WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW "
+ "WWWWWWWWWWWW WWWWWWWWWWWW";
+ static constexpr uint8_t test_extra[] = {0x1, 0x2, 0x3};
+ sp<ConfirmationTestCallback> conf_cb = new ConfirmationTestCallback;
+ hidl_string prompt_text(test_prompt);
+ hidl_vec<uint8_t> extra(test_extra, test_extra + 3);
+ ASSERT_HAL_CALL(ResponseCode::OK,
+ confirmator().promptUserConfirmation(conf_cb, prompt_text, extra, "en",
+ {UIOption::AccessibilityMagnified}));
+
+ confirmator().abort();
+
+ auto result = conf_cb->WaitForCallback();
+ ASSERT_EQ(ResponseCode::Aborted, result.args->error_);
+ ASSERT_EQ(0U, result.args->confirmationToken_.size());
+ ASSERT_EQ(0U, result.args->formattedMessage_.size());
+}
+
// Passing malformed UTF-8 to the confirmation UI
// This test passes a string that ends in the middle of a multibyte character
TEST_F(ConfirmationUIHidlTest, MalformedUTF8Test1) {
diff --git a/current.txt b/current.txt
index a045deb..c27d5e0 100644
--- a/current.txt
+++ b/current.txt
@@ -613,7 +613,7 @@
07d0a252b2d8fa35887908a996ba395cf392968395fc30afab791f46e0c22a52 android.hardware.boot@1.1::IBootControl
74049a402be913963edfdd80828a53736570e9d8124a1bf18166b6ed46a6b0ab android.hardware.boot@1.1::types
d9df99be0f59d8f33a9699fe316c67bfd11818aa69440bb1123ba43e717cea85 android.hardware.dumpstate@1.1::types
-f284ffde7cadf5a1364b75ab313baf22401eeca289bdde2a2dc7a27ea4ab98d7 android.hardware.dumpstate@1.1::IDumpstateDevice
+186bc152ae189ab48f3a761a44ddf5edd0d483073c5b6ca1f802f8b50488b754 android.hardware.dumpstate@1.1::IDumpstateDevice
ce8dbe76eb9ee94b46ef98f725be992e760a5751073d4f4912484026541371f3 android.hardware.health@2.1::IHealth
26f04510a0b57aba5167c5c0a7c2f077c2acbb98b81902a072517829fd9fd67f android.hardware.health@2.1::IHealthInfoCallback
e2f8bc1868fd4a3fd587c172773ea5a8c2f5a3deaf7958394102ca455252b255 android.hardware.health@2.1::types
@@ -630,7 +630,7 @@
2fa3679ad7c94b5e88724adcd560c561041068a4ca565c63830e68101988746a android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
237b23b126a66f3432658020fed78cdd06ba6297459436fe6bae0ba753370833 android.hardware.neuralnetworks@1.3::IPreparedModel
0439a1fbbec7f16e5e4c653d85ac685d51bfafbae15b8f8cca530acdd7d6a8ce android.hardware.neuralnetworks@1.3::IPreparedModelCallback
-abbc4e1a969881c9f8ab587add5b5e75b08df834c9c969c013ae38cb4bb16f6a android.hardware.neuralnetworks@1.3::types
+2fabd246f985d94a0172dacefb0d6cf19e2aeb2d5f17752653988ef39570a52d android.hardware.neuralnetworks@1.3::types
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
44445b8a03d7b9e68b2fbd954672c18a8fce9e32851b0692f4f4ab3407f86ecb android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
diff --git a/dumpstate/1.1/IDumpstateDevice.hal b/dumpstate/1.1/IDumpstateDevice.hal
index 502c460..183404d 100644
--- a/dumpstate/1.1/IDumpstateDevice.hal
+++ b/dumpstate/1.1/IDumpstateDevice.hal
@@ -29,8 +29,9 @@
* The 1.0 version of #dumpstateBoard(handle) should just delegate to this new method and pass
* DumpstateMode::DEFAULT and a timeout of 30,000ms (30 seconds).
*
- * This method may still be called by the dumpstate routine even if getDeviceLoggingEnabled
- * returns false. In this case, it must return DumpstateStatus::DEVICE_LOGGING_NOT_ENABLED.
+ * This method may still be called by the dumpstate routine even if getVerboseLoggingEnabled
+ * returns false. In this case, it may include essential information but must not include
+ * information that identifies the user.
*
* @param h A native handle with one or two valid file descriptors. The first FD is for text
* output, the second (if present) is for binary output.
@@ -44,7 +45,7 @@
generates (DumpstateStatus status);
/**
- * Turns device vendor logging on or off.
+ * Turns verbose device vendor logging on or off.
*
* The setting should be persistent across reboots. Underlying implementations may need to start
* vendor logging daemons, set system properties, or change logging masks, for example. Given
@@ -52,20 +53,21 @@
* memory/storage/battery impacts, calling this method on a user build should only be done after
* user consent has been obtained, e.g. from a toggle in developer settings.
*
- * Even if device logging has been disabled, dumpstateBoard may still be called by the dumpstate
- * routine. In this case, it must return DumpstateStatus::DEVICE_LOGGING_NOT_ENABLED.
+ * Even if verbose logging has been disabled, dumpstateBoard may still be called by the
+ * dumpstate routine, and essential information that does not identify the user may be included.
*
- * @param enable Whether to enable or disable device vendor logging.
+ * @param enable Whether to enable or disable verbose vendor logging.
*/
- setDeviceLoggingEnabled(bool enable);
+ setVerboseLoggingEnabled(bool enable);
/**
- * Queries the current state of device logging. Primarily for UI and informative purposes.
+ * Queries the current state of verbose device logging. Primarily for UI and informative
+ * purposes.
*
- * Even if device logging has been disabled, dumpstateBoard may still be called by the dumpstate
- * routine. In this case, it must return DumpstateStatus::DEVICE_LOGGING_NOT_ENABLED.
+ * Even if verbose logging has been disabled, dumpstateBoard may still be called by the
+ * dumpstate routine, and essential information that does not identify the user may be included.
*
- * @return enabled Whether or not vendor logging is currently enabled.
+ * @return enabled Whether or not verbose vendor logging is currently enabled.
*/
- getDeviceLoggingEnabled() generates (bool enabled);
+ getVerboseLoggingEnabled() generates (bool enabled);
};
diff --git a/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp b/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp
index 1811b73..1bef663 100644
--- a/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp
+++ b/dumpstate/1.1/vts/functional/VtsHalDumpstateV1_1TargetTest.cpp
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <functional>
+#include <tuple>
#include <vector>
#include <android/hardware/dumpstate/1.1/IDumpstateDevice.h>
@@ -27,6 +28,7 @@
#include <cutils/native_handle.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
+#include <hidl/HidlSupport.h>
#include <hidl/ServiceManagement.h>
#include <log/log.h>
@@ -39,17 +41,22 @@
using ::android::hardware::dumpstate::V1_1::IDumpstateDevice;
using ::android::hardware::dumpstate::V1_1::toString;
-class DumpstateHidl1_1Test : public ::testing::TestWithParam<std::string> {
+// Base class common to all dumpstate HAL v1.1 tests.
+template <typename T>
+class DumpstateHidl1_1TestBase : public ::testing::TestWithParam<T> {
protected:
virtual void SetUp() override { GetService(); }
+ virtual std::string GetInstanceName() = 0;
+
void GetService() {
- dumpstate = IDumpstateDevice::getService(GetParam());
- ASSERT_NE(dumpstate, nullptr) << "Could not get HIDL instance";
+ const std::string instance_name = GetInstanceName();
+ dumpstate = IDumpstateDevice::getService(instance_name);
+ ASSERT_NE(dumpstate, nullptr) << "Could not get HIDL instance " << instance_name;
}
- void ToggleDeviceLogging(bool enable) {
- Return<void> status = dumpstate->setDeviceLoggingEnabled(enable);
+ void ToggleVerboseLogging(bool enable) {
+ Return<void> status = dumpstate->setVerboseLoggingEnabled(enable);
ASSERT_TRUE(status.isOk()) << "Status should be ok: " << status.description();
if (!dumpstate->ping().isOk()) {
@@ -58,11 +65,11 @@
GetService();
}
- Return<bool> logging_enabled = dumpstate->getDeviceLoggingEnabled();
+ Return<bool> logging_enabled = dumpstate->getVerboseLoggingEnabled();
ASSERT_TRUE(logging_enabled.isOk())
<< "Status should be ok: " << logging_enabled.description();
ASSERT_EQ(logging_enabled, enable)
- << "Device logging should now be " << (enable ? "enabled" : "disabled");
+ << "Verbose logging should now be " << (enable ? "enabled" : "disabled");
if (!dumpstate->ping().isOk()) {
ALOGW("IDumpstateDevice service appears to have exited lazily, attempting to get "
@@ -71,85 +78,84 @@
}
}
- void EnableDeviceLogging() { ToggleDeviceLogging(true); }
+ void EnableVerboseLogging() { ToggleVerboseLogging(true); }
- void DisableDeviceLogging() { ToggleDeviceLogging(false); }
+ void DisableVerboseLogging() { ToggleVerboseLogging(false); }
sp<IDumpstateDevice> dumpstate;
};
-#define TEST_FOR_DUMPSTATE_MODE(name, body, mode) \
- TEST_P(DumpstateHidl1_1Test, name##_##mode) { body(DumpstateMode::mode); }
+// Tests that don't need to iterate every single DumpstateMode value for dumpstateBoard_1_1.
+class DumpstateHidl1_1GeneralTest : public DumpstateHidl1_1TestBase<std::string> {
+ protected:
+ virtual std::string GetInstanceName() override { return GetParam(); }
+};
-// We use a macro to define individual test cases instead of hidl_enum_range<> because some HAL
-// implementations are lazy and may call exit() at the end of dumpstateBoard(), which would cause
-// DEAD_OBJECT errors after the first iteration. Separate cases re-get the service each time as part
-// of SetUp(), and also provide better separation of concerns when specific modes are problematic.
-#define TEST_FOR_ALL_DUMPSTATE_MODES(name, body) \
- TEST_FOR_DUMPSTATE_MODE(name, body, FULL); \
- TEST_FOR_DUMPSTATE_MODE(name, body, INTERACTIVE); \
- TEST_FOR_DUMPSTATE_MODE(name, body, REMOTE); \
- TEST_FOR_DUMPSTATE_MODE(name, body, WEAR); \
- TEST_FOR_DUMPSTATE_MODE(name, body, CONNECTIVITY); \
- TEST_FOR_DUMPSTATE_MODE(name, body, WIFI); \
- TEST_FOR_DUMPSTATE_MODE(name, body, DEFAULT); \
- TEST_FOR_DUMPSTATE_MODE(name, body, PROTO);
+// Tests that iterate every single DumpstateMode value for dumpstateBoard_1_1.
+class DumpstateHidl1_1PerModeTest
+ : public DumpstateHidl1_1TestBase<std::tuple<std::string, DumpstateMode>> {
+ protected:
+ virtual std::string GetInstanceName() override { return std::get<0>(GetParam()); }
+
+ DumpstateMode GetMode() { return std::get<1>(GetParam()); }
+
+ // Will only execute additional_assertions when status == expected.
+ void AssertStatusForMode(const Return<DumpstateStatus>& status, const DumpstateStatus expected,
+ std::function<void()> additional_assertions = nullptr) {
+ ASSERT_TRUE(status.isOk())
+ << "Status should be ok and return a more specific DumpstateStatus: "
+ << status.description();
+ if (GetMode() == DumpstateMode::DEFAULT) {
+ ASSERT_EQ(expected, status)
+ << "Required mode (DumpstateMode::" << toString(GetMode())
+ << "): status should be DumpstateStatus::" << toString(expected)
+ << ", but got DumpstateStatus::" << toString(status);
+ } else {
+ // The rest of the modes are optional to support, but they MUST return either the
+ // expected value or UNSUPPORTED_MODE.
+ ASSERT_TRUE(status == expected || status == DumpstateStatus::UNSUPPORTED_MODE)
+ << "Optional mode (DumpstateMode::" << toString(GetMode())
+ << "): status should be DumpstateStatus::" << toString(expected)
+ << " or DumpstateStatus::UNSUPPORTED_MODE, but got DumpstateStatus::"
+ << toString(status);
+ }
+ if (status == expected && additional_assertions != nullptr) {
+ additional_assertions();
+ }
+ }
+};
constexpr uint64_t kDefaultTimeoutMillis = 30 * 1000; // 30 seconds
-// Will only execute additional_assertions when status == expected.
-void AssertStatusForMode(const DumpstateMode mode, const Return<DumpstateStatus>& status,
- const DumpstateStatus expected,
- std::function<void()> additional_assertions = nullptr) {
- ASSERT_TRUE(status.isOk()) << "Status should be ok and return a more specific DumpstateStatus: "
- << status.description();
- if (mode == DumpstateMode::DEFAULT) {
- ASSERT_EQ(expected, status) << "Required mode (DumpstateMode::" << toString(mode)
- << "): status should be DumpstateStatus::" << toString(expected)
- << ", but got DumpstateStatus::" << toString(status);
- } else {
- // The rest of the modes are optional to support, but they MUST return either the expected
- // value or UNSUPPORTED_MODE.
- ASSERT_TRUE(status == expected || status == DumpstateStatus::UNSUPPORTED_MODE)
- << "Optional mode (DumpstateMode::" << toString(mode)
- << "): status should be DumpstateStatus::" << toString(expected)
- << " or DumpstateStatus::UNSUPPORTED_MODE, but got DumpstateStatus::"
- << toString(status);
- }
- if (status == expected && additional_assertions != nullptr) {
- additional_assertions();
- }
-}
-
// Negative test: make sure dumpstateBoard() doesn't crash when passed a null pointer.
-TEST_FOR_ALL_DUMPSTATE_MODES(TestNullHandle, [this](DumpstateMode mode) {
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1PerModeTest, TestNullHandle) {
+ EnableVerboseLogging();
Return<DumpstateStatus> status =
- dumpstate->dumpstateBoard_1_1(nullptr, mode, kDefaultTimeoutMillis);
+ dumpstate->dumpstateBoard_1_1(nullptr, GetMode(), kDefaultTimeoutMillis);
- AssertStatusForMode(mode, status, DumpstateStatus::ILLEGAL_ARGUMENT);
-});
+ AssertStatusForMode(status, DumpstateStatus::ILLEGAL_ARGUMENT);
+}
// Negative test: make sure dumpstateBoard() ignores a handle with no FD.
-TEST_FOR_ALL_DUMPSTATE_MODES(TestHandleWithNoFd, [this](DumpstateMode mode) {
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1PerModeTest, TestHandleWithNoFd) {
+ EnableVerboseLogging();
native_handle_t* handle = native_handle_create(0, 0);
ASSERT_NE(handle, nullptr) << "Could not create native_handle";
Return<DumpstateStatus> status =
- dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis);
+ dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis);
- AssertStatusForMode(mode, status, DumpstateStatus::ILLEGAL_ARGUMENT);
+ AssertStatusForMode(status, DumpstateStatus::ILLEGAL_ARGUMENT);
native_handle_close(handle);
native_handle_delete(handle);
-});
+}
// Positive test: make sure dumpstateBoard() writes something to the FD.
-TEST_FOR_ALL_DUMPSTATE_MODES(TestOk, [this](DumpstateMode mode) {
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1PerModeTest, TestOk) {
+ EnableVerboseLogging();
// Index 0 corresponds to the read end of the pipe; 1 to the write end.
int fds[2];
@@ -160,9 +166,9 @@
handle->data[0] = fds[1];
Return<DumpstateStatus> status =
- dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis);
+ dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis);
- AssertStatusForMode(mode, status, DumpstateStatus::OK, [&fds]() {
+ AssertStatusForMode(status, DumpstateStatus::OK, [&fds]() {
// Check that at least one byte was written.
char buff;
ASSERT_EQ(1, read(fds[0], &buff, 1)) << "Dumped nothing";
@@ -170,11 +176,11 @@
native_handle_close(handle);
native_handle_delete(handle);
-});
+}
// Positive test: make sure dumpstateBoard() doesn't crash with two FDs.
-TEST_FOR_ALL_DUMPSTATE_MODES(TestHandleWithTwoFds, [this](DumpstateMode mode) {
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1PerModeTest, TestHandleWithTwoFds) {
+ EnableVerboseLogging();
int fds1[2];
int fds2[2];
@@ -187,9 +193,9 @@
handle->data[1] = fds2[1];
Return<DumpstateStatus> status =
- dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis);
+ dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis);
- AssertStatusForMode(mode, status, DumpstateStatus::OK, [&fds1, &fds2]() {
+ AssertStatusForMode(status, DumpstateStatus::OK, [&fds1, &fds2]() {
// Check that at least one byte was written to one of the FDs.
char buff;
size_t read1 = read(fds1[0], &buff, 1);
@@ -200,11 +206,11 @@
native_handle_close(handle);
native_handle_delete(handle);
-});
+}
// Make sure dumpstateBoard_1_1 actually validates its arguments.
-TEST_P(DumpstateHidl1_1Test, TestInvalidModeArgument_Negative) {
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1GeneralTest, TestInvalidModeArgument_Negative) {
+ EnableVerboseLogging();
int fds[2];
ASSERT_EQ(0, pipe2(fds, O_NONBLOCK)) << errno;
@@ -225,8 +231,8 @@
native_handle_delete(handle);
}
-TEST_P(DumpstateHidl1_1Test, TestInvalidModeArgument_Undefined) {
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1GeneralTest, TestInvalidModeArgument_Undefined) {
+ EnableVerboseLogging();
int fds[2];
ASSERT_EQ(0, pipe2(fds, O_NONBLOCK)) << errno;
@@ -248,8 +254,8 @@
}
// Positive test: make sure dumpstateBoard() from 1.0 doesn't fail.
-TEST_P(DumpstateHidl1_1Test, Test1_0MethodOk) {
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1GeneralTest, Test1_0MethodOk) {
+ EnableVerboseLogging();
int fds[2];
ASSERT_EQ(0, pipe2(fds, O_NONBLOCK)) << errno;
@@ -270,9 +276,10 @@
native_handle_delete(handle);
}
-// Make sure disabling device logging behaves correctly.
-TEST_FOR_ALL_DUMPSTATE_MODES(TestDeviceLoggingDisabled, [this](DumpstateMode mode) {
- DisableDeviceLogging();
+// Make sure disabling verbose logging behaves correctly. Some info is still allowed to be emitted,
+// but it can't have privacy/storage/battery impacts.
+TEST_P(DumpstateHidl1_1PerModeTest, TestDeviceLoggingDisabled) {
+ DisableVerboseLogging();
// Index 0 corresponds to the read end of the pipe; 1 to the write end.
int fds[2];
@@ -283,41 +290,55 @@
handle->data[0] = fds[1];
Return<DumpstateStatus> status =
- dumpstate->dumpstateBoard_1_1(handle, mode, kDefaultTimeoutMillis);
+ dumpstate->dumpstateBoard_1_1(handle, GetMode(), kDefaultTimeoutMillis);
- AssertStatusForMode(mode, status, DumpstateStatus::DEVICE_LOGGING_NOT_ENABLED, [&fds]() {
- // Check that nothing was written. Could return 0 or -1.
- char buff;
- ASSERT_NE(1, read(fds[0], &buff, 1)) << "Dumped something when device logging is disabled";
- });
+ // We don't include additional assertions here about the file passed in. If verbose logging is
+ // disabled, the OEM may choose to include nothing at all, but it is allowed to include some
+ // essential information based on the mode as long as it isn't private user information.
+ AssertStatusForMode(status, DumpstateStatus::OK);
native_handle_close(handle);
native_handle_delete(handle);
-});
+}
// Double-enable is perfectly valid, but the second call shouldn't do anything.
-TEST_P(DumpstateHidl1_1Test, TestRepeatedEnable) {
- EnableDeviceLogging();
- EnableDeviceLogging();
+TEST_P(DumpstateHidl1_1GeneralTest, TestRepeatedEnable) {
+ EnableVerboseLogging();
+ EnableVerboseLogging();
}
// Double-disable is perfectly valid, but the second call shouldn't do anything.
-TEST_P(DumpstateHidl1_1Test, TestRepeatedDisable) {
- DisableDeviceLogging();
- DisableDeviceLogging();
+TEST_P(DumpstateHidl1_1GeneralTest, TestRepeatedDisable) {
+ DisableVerboseLogging();
+ DisableVerboseLogging();
}
// Toggling in short order is perfectly valid.
-TEST_P(DumpstateHidl1_1Test, TestRepeatedToggle) {
- EnableDeviceLogging();
- DisableDeviceLogging();
- EnableDeviceLogging();
- DisableDeviceLogging();
+TEST_P(DumpstateHidl1_1GeneralTest, TestRepeatedToggle) {
+ EnableVerboseLogging();
+ DisableVerboseLogging();
+ EnableVerboseLogging();
+ DisableVerboseLogging();
}
INSTANTIATE_TEST_SUITE_P(
- PerInstance, DumpstateHidl1_1Test,
+ PerInstance, DumpstateHidl1_1GeneralTest,
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IDumpstateDevice::descriptor)),
android::hardware::PrintInstanceNameToString);
+// Includes the mode's name as part of the description string.
+static inline std::string PrintInstanceNameToStringWithMode(
+ const testing::TestParamInfo<std::tuple<std::string, DumpstateMode>>& info) {
+ return android::hardware::PrintInstanceNameToString(
+ testing::TestParamInfo(std::get<0>(info.param), info.index)) +
+ "_" + toString(std::get<1>(info.param));
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ PerInstanceAndMode, DumpstateHidl1_1PerModeTest,
+ testing::Combine(testing::ValuesIn(android::hardware::getAllHalInstanceNames(
+ IDumpstateDevice::descriptor)),
+ testing::ValuesIn(android::hardware::hidl_enum_range<DumpstateMode>())),
+ PrintInstanceNameToStringWithMode);
+
} // namespace
diff --git a/neuralnetworks/1.3/types.hal b/neuralnetworks/1.3/types.hal
index c5dc08c..530f984 100644
--- a/neuralnetworks/1.3/types.hal
+++ b/neuralnetworks/1.3/types.hal
@@ -2556,6 +2556,30 @@
* A 3-D tensor of shape:
* If time-major: [max_time, batch_size, bw_output_size]
* If batch-major: [batch_size, max_time, bw_output_size]
+ * * 2: The forward activation state output.
+ * A 2-D tensor of shape [batch_size, fw_output_size] containing an
+ * activation state from the last time step in the sequence. This
+ * output is optional and can be omitted. If this output is present
+ * then outputs 3-5 must be present as well.
+ * Available since HAL version 1.3.
+ * * 3: The forward cell state output.
+ * A tensor of shape [batch_size, fw_cell_size] containing a cell state
+ * from the last time step in the sequence. This output is optional
+ * and can be omitted. If this output is present
+ * then outputs 2, 4, 5 must be present as well.
+ * Available since HAL version 1.3.
+ * * 4: The backward activation state output.
+ * A 2-D tensor of shape [batch_size, bw_output_size] containing an
+ * activation state from the last time step in the sequence. This
+ * output is optional and can be omitted. If this output is present
+ * then outputs 2, 3, 5 must be present as well.
+ * Available since HAL version 1.3.
+ * * 5: The backward cell state output.
+ * A tensor of shape [batch_size, bw_cell_size] containing a cell state
+ * from the last time step in the sequence. This output is optional
+ * and can be omitted. If this output is present
+ * then outputs 2-4 must be present as well.
+ * Available since HAL version 1.3.
*/
BIDIRECTIONAL_SEQUENCE_LSTM = @1.2::OperationType:BIDIRECTIONAL_SEQUENCE_LSTM,
@@ -2673,6 +2697,18 @@
* (timeMajor). If it is set to true, then the shape is set to
* [maxTime, batchSize, bwNumUnits], otherwise the shape is set to
* [batchSize, maxTime, bwNumUnits].
+ * * 2: The forward hidden state output.
+ * A 2-D tensor of shape [batchSize, fwNumUnits] containing a hidden
+ * state from the last time step in the sequence. This output is
+ * optional and can be omitted. If this output is present then output
+ * 3 must be present as well.
+ * Available since HAL version 1.3.
+ * * 3: The backward hidden state output.
+ * A 2-D tensor of shape [batchSize, bwNumUnits] containing a hidden
+ * state from the last time step in the sequence. This output is
+ * optional and can be omitted. If this output is present then output
+ * 2 must be present as well.
+ * Available since HAL version 1.3.
*/
BIDIRECTIONAL_SEQUENCE_RNN = @1.2::OperationType:BIDIRECTIONAL_SEQUENCE_RNN,
@@ -4656,6 +4692,15 @@
* A 3-D tensor of shape:
* If time-major: [max_time, batch_size, output_size]
* If batch-major: [batch_size, max_time, output_size]
+ * * 1: A tensor of shape [batch_size, output_size] containing a hidden
+ * state from the last time step in the sequence. This output is
+ * optional and can be omitted. If this output is present then
+ * output #2 must be present as well.
+ * Available since HAL version 1.3.
+ * * 2: A tensor of shape [batch_size, cell_size] containing a cell state
+ * from the last time step in the sequence. This output is optional
+ * and can be omitted.
+ * Available since HAL version 1.3.
*/
UNIDIRECTIONAL_SEQUENCE_LSTM = @1.2::OperationType:UNIDIRECTIONAL_SEQUENCE_LSTM,
@@ -4711,6 +4756,10 @@
* it is set to 1, then the output has a shape [maxTime, batchSize,
* numUnits], otherwise the output has a shape [batchSize, maxTime,
* numUnits].
+ * * 1: A tensor of shape [batchSize, numUnits] containing hidden state
+ * from the last time step in the sequence. This output is optional
+ * and can be omitted.
+ * Available since HAL version 1.3.
*/
UNIDIRECTIONAL_SEQUENCE_RNN = @1.2::OperationType:UNIDIRECTIONAL_SEQUENCE_RNN,
diff --git a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
index 0a35e2d..b9ea430 100644
--- a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
@@ -527,9 +527,15 @@
}
}
}
- // BIDIRECTIONAL_SEQUENCE_LSTM and BIDIRECTIONAL_SEQUENCE_RNN can have either one or two
- // outputs depending on their mergeOutputs parameter.
- if (operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_LSTM ||
+ // BIDIRECTIONAL_SEQUENCE_LSTM and BIDIRECTIONAL_SEQUENCE_RNN can have
+ // either one, two, three or four outputs depending on their
+ // mergeOutputs parameter and if state outputs are provided.
+ // UNIDIRECTIONAL_SEQUENCE_LSTM and UNIDIRECTIONAL_SEQUENCE_RNN can have
+ // either one or three outputs depending on whether state outputs are
+ // provided.
+ if (operation.type == OperationType::UNIDIRECTIONAL_SEQUENCE_LSTM ||
+ operation.type == OperationType::UNIDIRECTIONAL_SEQUENCE_RNN ||
+ operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_LSTM ||
operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_RNN) {
for (const size_t outOprand : operation.outputs) {
if (operand == outOprand) {