summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot2018-03-27 02:26:03 -0500
committerandroid-build-team Robot2018-03-27 02:26:03 -0500
commitdd290657949086dbc0118c86c7c27f6a86660798 (patch)
treebfadf1c6bc1da1a8188acf7b36fb8f43265659f5
parentd7ec11bf064d1f0255ac62ae01e33cf8f9d6c150 (diff)
parent6483c7cbc90bf4b25b262ff0ffd9ecfbcff13a57 (diff)
downloadplatform-hardware-interfaces-dd290657949086dbc0118c86c7c27f6a86660798.tar.gz
platform-hardware-interfaces-dd290657949086dbc0118c86c7c27f6a86660798.tar.xz
platform-hardware-interfaces-dd290657949086dbc0118c86c7c27f6a86660798.zip
Snap for 4680594 from 6483c7cbc90bf4b25b262ff0ffd9ecfbcff13a57 to pi-release
Change-Id: I72f601b3da515888f9eb242d7204f0933a8bf427
-rw-r--r--automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h2
-rw-r--r--automotive/vehicle/2.0/types.hal2
-rw-r--r--confirmationui/support/include/android/hardware/confirmationui/support/msg_formatting.h4
-rw-r--r--current.txt2
-rw-r--r--neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworksV1_1BasicTest.cpp163
5 files changed, 170 insertions, 3 deletions
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index c1c511f5..e54de007 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -429,7 +429,7 @@ const ConfigDeclaration kVehicleProperties[]{
429 429
430 {.config = {.prop = toInt(VehicleProperty::AP_POWER_BOOTUP_REASON), 430 {.config = {.prop = toInt(VehicleProperty::AP_POWER_BOOTUP_REASON),
431 .access = VehiclePropertyAccess::READ, 431 .access = VehiclePropertyAccess::READ,
432 .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, 432 .changeMode = VehiclePropertyChangeMode::STATIC},
433 .initialValue = {.int32Values = {toInt(VehicleApPowerBootupReason::USER_POWER_ON)}}}, 433 .initialValue = {.int32Values = {toInt(VehicleApPowerBootupReason::USER_POWER_ON)}}},
434 434
435 { 435 {
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 3001213f..87daedc9 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -510,6 +510,7 @@ enum VehicleProperty: int32_t {
510 * 510 *
511 * @change_mode VehiclePropertyChangeMode:ON_CHANGE 511 * @change_mode VehiclePropertyChangeMode:ON_CHANGE
512 * @access VehiclePropertyAccess:READ 512 * @access VehiclePropertyAccess:READ
513 * @data_enum VehicleTurnSignal
513 */ 514 */
514 TURN_SIGNAL_STATE = ( 515 TURN_SIGNAL_STATE = (
515 0x0408 516 0x0408
@@ -522,6 +523,7 @@ enum VehicleProperty: int32_t {
522 * 523 *
523 * @change_mode VehiclePropertyChangeMode:ON_CHANGE 524 * @change_mode VehiclePropertyChangeMode:ON_CHANGE
524 * @access VehiclePropertyAccess:READ 525 * @access VehiclePropertyAccess:READ
526 * @data_enum VehicleIgnitionState
525 */ 527 */
526 IGNITION_STATE = ( 528 IGNITION_STATE = (
527 0x0409 529 0x0409
diff --git a/confirmationui/support/include/android/hardware/confirmationui/support/msg_formatting.h b/confirmationui/support/include/android/hardware/confirmationui/support/msg_formatting.h
index 0d035917..6558799b 100644
--- a/confirmationui/support/include/android/hardware/confirmationui/support/msg_formatting.h
+++ b/confirmationui/support/include/android/hardware/confirmationui/support/msg_formatting.h
@@ -105,6 +105,7 @@ enum class Command : uint32_t {
105 PromptUserConfirmation, 105 PromptUserConfirmation,
106 DeliverSecureInputEvent, 106 DeliverSecureInputEvent,
107 Abort, 107 Abort,
108 Vendor,
108}; 109};
109 110
110template <Command cmd> 111template <Command cmd>
@@ -115,6 +116,7 @@ struct Cmd {};
115DECLARE_COMMAND(PromptUserConfirmation); 116DECLARE_COMMAND(PromptUserConfirmation);
116DECLARE_COMMAND(DeliverSecureInputEvent); 117DECLARE_COMMAND(DeliverSecureInputEvent);
117DECLARE_COMMAND(Abort); 118DECLARE_COMMAND(Abort);
119DECLARE_COMMAND(Vendor);
118 120
119using PromptUserConfirmationMsg = Message<PromptUserConfirmation_t, hidl_string, hidl_vec<uint8_t>, 121using PromptUserConfirmationMsg = Message<PromptUserConfirmation_t, hidl_string, hidl_vec<uint8_t>,
120 hidl_string, hidl_vec<UIOption>>; 122 hidl_string, hidl_vec<UIOption>>;
@@ -166,7 +168,7 @@ inline void zero(volatile uint8_t* begin, const volatile uint8_t* end) {
166} 168}
167inline void zero(const volatile uint8_t*, const volatile uint8_t*) {} 169inline void zero(const volatile uint8_t*, const volatile uint8_t*) {}
168// This odd alignment function aligns the stream position to a 4byte and never 8byte boundary 170// This odd alignment function aligns the stream position to a 4byte and never 8byte boundary
169// It is to accommodate the 4 byte size field which is then followed by 8byte alligned data. 171// It is to accommodate the 4 byte size field which is then followed by 8byte aligned data.
170template <typename T> 172template <typename T>
171StreamState<T> unalign(StreamState<T> s) { 173StreamState<T> unalign(StreamState<T> s) {
172 uint8_t unalignment = uintptr_t(s.pos_) & 0x3; 174 uint8_t unalignment = uintptr_t(s.pos_) & 0x3;
diff --git a/current.txt b/current.txt
index fdf17bea..c35fa924 100644
--- a/current.txt
+++ b/current.txt
@@ -294,7 +294,7 @@ f2904a4c108ad1b93eb2fa4e43b82bd01ce1ff26156316e49d1d9fc80dfecaad android.hardwar
2943b17c1fdfc389e0abe626c37054954b07201127d890c2bc05d47613ec1f4de4f android.hardware.automotive.evs@1.0::types 2943b17c1fdfc389e0abe626c37054954b07201127d890c2bc05d47613ec1f4de4f android.hardware.automotive.evs@1.0::types
295b3caf524c46a47d67e6453a34419e1881942d059e146cda740502670e9a752c3 android.hardware.automotive.vehicle@2.0::IVehicle 295b3caf524c46a47d67e6453a34419e1881942d059e146cda740502670e9a752c3 android.hardware.automotive.vehicle@2.0::IVehicle
29680fb4156fa91ce86e49bd2cabe215078f6b69591d416a09e914532eae6712052 android.hardware.automotive.vehicle@2.0::IVehicleCallback 29680fb4156fa91ce86e49bd2cabe215078f6b69591d416a09e914532eae6712052 android.hardware.automotive.vehicle@2.0::IVehicleCallback
297442de3a3d3819ff8b8bfe9ec710592ca8af7c16bfdb5eb8911b898b8f12b2bb0 android.hardware.automotive.vehicle@2.0::types 2974ff0dcfb938a5df283eef47de33b4e1284fab73f584cfc0c94e97317bdb7bf26 android.hardware.automotive.vehicle@2.0::types
29832cc50cc2a7658ec613c0c2dd2accbf6a05113b749852879e818b8b7b438db19 android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioHost 29832cc50cc2a7658ec613c0c2dd2accbf6a05113b749852879e818b8b7b438db19 android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioHost
299ff4be64d7992f8bec97dff37f35450e79b3430c61f85f54322ce45bef229dc3b android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioOffload 299ff4be64d7992f8bec97dff37f35450e79b3430c61f85f54322ce45bef229dc3b android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioOffload
30027f22d2e873e6201f9620cf4d8e2facb25bd0dd30a2b911e441b4600d560fa62 android.hardware.bluetooth.a2dp@1.0::types 30027f22d2e873e6201f9620cf4d8e2facb25bd0dd30a2b911e441b4600d560fa62 android.hardware.bluetooth.a2dp@1.0::types
diff --git a/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworksV1_1BasicTest.cpp b/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworksV1_1BasicTest.cpp
index 17f6744c..10591dcb 100644
--- a/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworksV1_1BasicTest.cpp
+++ b/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworksV1_1BasicTest.cpp
@@ -286,6 +286,169 @@ TEST_F(NeuralnetworksHidlTest, SimpleExecuteGraphNegativeTest2) {
286 EXPECT_EQ(ErrorStatus::INVALID_ARGUMENT, executionReturnStatus); 286 EXPECT_EQ(ErrorStatus::INVALID_ARGUMENT, executionReturnStatus);
287} 287}
288 288
289class NeuralnetworksInputsOutputsTest
290 : public NeuralnetworksHidlTest,
291 public ::testing::WithParamInterface<std::tuple<bool, bool>> {
292 protected:
293 virtual void SetUp() { NeuralnetworksHidlTest::SetUp(); }
294 virtual void TearDown() { NeuralnetworksHidlTest::TearDown(); }
295 V1_1::Model createModel(const std::vector<uint32_t>& inputs,
296 const std::vector<uint32_t>& outputs) {
297 // We set up the operands as floating-point with no designated
298 // model inputs and outputs, and then patch type and lifetime
299 // later on in this function.
300
301 std::vector<Operand> operands = {
302 {
303 .type = OperandType::TENSOR_FLOAT32,
304 .dimensions = {1},
305 .numberOfConsumers = 1,
306 .scale = 0.0f,
307 .zeroPoint = 0,
308 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
309 .location = {.poolIndex = 0, .offset = 0, .length = 0},
310 },
311 {
312 .type = OperandType::TENSOR_FLOAT32,
313 .dimensions = {1},
314 .numberOfConsumers = 1,
315 .scale = 0.0f,
316 .zeroPoint = 0,
317 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
318 .location = {.poolIndex = 0, .offset = 0, .length = 0},
319 },
320 {
321 .type = OperandType::INT32,
322 .dimensions = {},
323 .numberOfConsumers = 1,
324 .scale = 0.0f,
325 .zeroPoint = 0,
326 .lifetime = OperandLifeTime::CONSTANT_COPY,
327 .location = {.poolIndex = 0, .offset = 0, .length = sizeof(int32_t)},
328 },
329 {
330 .type = OperandType::TENSOR_FLOAT32,
331 .dimensions = {1},
332 .numberOfConsumers = 0,
333 .scale = 0.0f,
334 .zeroPoint = 0,
335 .lifetime = OperandLifeTime::TEMPORARY_VARIABLE,
336 .location = {.poolIndex = 0, .offset = 0, .length = 0},
337 },
338 };
339
340 const std::vector<Operation> operations = {{
341 .type = OperationType::ADD, .inputs = {0, 1, 2}, .outputs = {3},
342 }};
343
344 std::vector<uint8_t> operandValues;
345 int32_t activation[1] = {static_cast<int32_t>(FusedActivationFunc::NONE)};
346 operandValues.insert(operandValues.end(), reinterpret_cast<const uint8_t*>(&activation[0]),
347 reinterpret_cast<const uint8_t*>(&activation[1]));
348
349 if (kQuantized) {
350 for (auto& operand : operands) {
351 if (operand.type == OperandType::TENSOR_FLOAT32) {
352 operand.type = OperandType::TENSOR_QUANT8_ASYMM;
353 operand.scale = 1.0f;
354 operand.zeroPoint = 0;
355 }
356 }
357 }
358
359 auto patchLifetime = [&operands](const std::vector<uint32_t>& operandIndexes,
360 OperandLifeTime lifetime) {
361 for (uint32_t index : operandIndexes) {
362 operands[index].lifetime = lifetime;
363 }
364 };
365 if (kInputHasPrecedence) {
366 patchLifetime(outputs, OperandLifeTime::MODEL_OUTPUT);
367 patchLifetime(inputs, OperandLifeTime::MODEL_INPUT);
368 } else {
369 patchLifetime(inputs, OperandLifeTime::MODEL_INPUT);
370 patchLifetime(outputs, OperandLifeTime::MODEL_OUTPUT);
371 }
372
373 return {
374 .operands = operands,
375 .operations = operations,
376 .inputIndexes = inputs,
377 .outputIndexes = outputs,
378 .operandValues = operandValues,
379 .pools = {},
380 };
381 }
382 void check(const std::string& name,
383 bool expectation, // true = success
384 const std::vector<uint32_t>& inputs, const std::vector<uint32_t>& outputs) {
385 SCOPED_TRACE(name + " (HAL calls should " + (expectation ? "succeed" : "fail") + ", " +
386 (kInputHasPrecedence ? "input" : "output") + " precedence, " +
387 (kQuantized ? "quantized" : "float"));
388
389 V1_1::Model model = createModel(inputs, outputs);
390
391 // ensure that getSupportedOperations_1_1() checks model validity
392 ErrorStatus supportedOpsErrorStatus = ErrorStatus::GENERAL_FAILURE;
393 Return<void> supportedOpsReturn = device->getSupportedOperations_1_1(
394 model, [&model, &supportedOpsErrorStatus](ErrorStatus status,
395 const hidl_vec<bool>& supported) {
396 supportedOpsErrorStatus = status;
397 if (status == ErrorStatus::NONE) {
398 ASSERT_EQ(supported.size(), model.operations.size());
399 }
400 });
401 ASSERT_TRUE(supportedOpsReturn.isOk());
402 ASSERT_EQ(supportedOpsErrorStatus,
403 (expectation ? ErrorStatus::NONE : ErrorStatus::INVALID_ARGUMENT));
404
405 // ensure that prepareModel_1_1() checks model validity
406 sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback;
407 ASSERT_NE(preparedModelCallback.get(), nullptr);
408 Return<ErrorStatus> prepareLaunchReturn =
409 device->prepareModel_1_1(model, preparedModelCallback);
410 ASSERT_TRUE(prepareLaunchReturn.isOk());
411 ASSERT_TRUE(prepareLaunchReturn == ErrorStatus::NONE ||
412 prepareLaunchReturn == ErrorStatus::INVALID_ARGUMENT);
413 bool preparationOk = (prepareLaunchReturn == ErrorStatus::NONE);
414 if (preparationOk) {
415 preparedModelCallback->wait();
416 preparationOk = (preparedModelCallback->getStatus() == ErrorStatus::NONE);
417 }
418
419 if (preparationOk) {
420 ASSERT_TRUE(expectation);
421 } else {
422 // Preparation can fail for reasons other than an invalid model --
423 // for example, perhaps not all operations are supported, or perhaps
424 // the device hit some kind of capacity limit.
425 bool invalid = prepareLaunchReturn == ErrorStatus::INVALID_ARGUMENT ||
426 preparedModelCallback->getStatus() == ErrorStatus::INVALID_ARGUMENT;
427 ASSERT_NE(expectation, invalid);
428 }
429 }
430
431 // Indicates whether an operand that appears in both the inputs
432 // and outputs vector should have lifetime appropriate for input
433 // rather than for output.
434 const bool kInputHasPrecedence = std::get<0>(GetParam());
435
436 // Indicates whether we should test TENSOR_QUANT8_ASYMM rather
437 // than TENSOR_FLOAT32.
438 const bool kQuantized = std::get<1>(GetParam());
439};
440
441TEST_P(NeuralnetworksInputsOutputsTest, Validate) {
442 check("Ok", true, {0, 1}, {3});
443 check("InputIsOutput", false, {0, 1}, {3, 0});
444 check("OutputIsInput", false, {0, 1, 3}, {3});
445 check("DuplicateInputs", false, {0, 1, 0}, {3});
446 check("DuplicateOutputs", false, {0, 1}, {3, 3});
447}
448
449INSTANTIATE_TEST_CASE_P(Flavor, NeuralnetworksInputsOutputsTest,
450 ::testing::Combine(::testing::Bool(), ::testing::Bool()));
451
289} // namespace functional 452} // namespace functional
290} // namespace vts 453} // namespace vts
291} // namespace V1_1 454} // namespace V1_1