Changes in response to NNAPI QoS API Review This CL makes the following changes: * Remove #ifdef around enum constants (e.g. PriorityCode). * Clarifies that *_setTimeout calls must be completed or aborted within the timeout duration * Adds a way to restore timeout duration to the default value (i.e., infinite) As part of removing #ifdef around enum constants, DurationCode was moved up in NeuralNetworks.h to be next to the other enums. Bug: 148954238 Bug: 146082566 Test: mma Test: CtsNNAPITestCases Test: NeuralNetworksTest_static Change-Id: I9fe1c7a25aa20603dea77603f5a7fccbabca1f6b Merged-In: I9fe1c7a25aa20603dea77603f5a7fccbabca1f6b (cherry picked from commit c16015f506777d2377d6ee1a4c814a3b1236397b)
diff --git a/runtime/ExecutionBuilder.cpp b/runtime/ExecutionBuilder.cpp index caede71..f263991 100644 --- a/runtime/ExecutionBuilder.cpp +++ b/runtime/ExecutionBuilder.cpp
@@ -325,7 +325,11 @@ LOG(ERROR) << "ANeuralNetworksExecution_setTimeout called after the execution has started."; return ANEURALNETWORKS_BAD_STATE; } - mTimeoutDuration = duration; + if (duration > 0) { + mTimeoutDuration = duration; + } else { + mTimeoutDuration.reset(); + } return ANEURALNETWORKS_NO_ERROR; }