Merge "Add HAL entry to allow querying device impl version."
This commit is contained in:
commit
7b52ab5bf1
2 changed files with 38 additions and 0 deletions
|
@ -25,6 +25,36 @@ import @1.1::IDevice;
|
|||
* This interface represents a device driver.
|
||||
*/
|
||||
interface IDevice extends @1.1::IDevice {
|
||||
/**
|
||||
* Get the version string of the driver implementation.
|
||||
*
|
||||
* The version string must be a unique token among the set of version strings of
|
||||
* drivers of a specific device. The token identifies the device driver's
|
||||
* implementation. The token must not be confused with the feature level which is solely
|
||||
* defined by the interface version. This API is opaque to the Android framework, but the
|
||||
* Android framework may use the information for debugging or to pass on to NNAPI applications.
|
||||
*
|
||||
* Application developers sometimes have specific requirements to ensure good user experiences,
|
||||
* and they need more information to make intelligent decisions when the Android framework cannot.
|
||||
* For example, combined with the device name and other information, the token can help
|
||||
* NNAPI applications filter devices based on their needs:
|
||||
* - An application demands a certain level of performance, but a specific version of
|
||||
* the driver cannot meet that requirement because of a performance regression.
|
||||
* The application can blacklist the driver based on the version provided.
|
||||
* - An application has a minimum precision requirement, but certain versions of
|
||||
* the driver cannot meet that requirement because of bugs or certain optimizations.
|
||||
* The application can filter out versions of these drivers.
|
||||
*
|
||||
* @return status Error status returned from querying the version string. Must be:
|
||||
* - NONE if the query was successful
|
||||
* - DEVICE_UNAVAILABLE if driver is offline or busy
|
||||
* - GENERAL_FAILURE if the query resulted in an
|
||||
* unspecified error
|
||||
* @return version The version string of the device implementation.
|
||||
* Must have nonzero length
|
||||
*/
|
||||
getVersionString() generates (ErrorStatus status, string version);
|
||||
|
||||
/**
|
||||
* Gets the supported operations in a model.
|
||||
*
|
||||
|
|
|
@ -37,6 +37,14 @@ TEST_F(NeuralnetworksHidlTest, StatusTest) {
|
|||
EXPECT_EQ(DeviceStatus::AVAILABLE, static_cast<DeviceStatus>(status));
|
||||
}
|
||||
|
||||
// device version test
|
||||
TEST_F(NeuralnetworksHidlTest, GetDeviceVersionStringTest) {
|
||||
Return<void> ret = device->getVersionString([](ErrorStatus status, const hidl_string& version) {
|
||||
EXPECT_EQ(ErrorStatus::NONE, status);
|
||||
EXPECT_LT(0, version.size());
|
||||
});
|
||||
EXPECT_TRUE(ret.isOk());
|
||||
}
|
||||
} // namespace functional
|
||||
} // namespace vts
|
||||
} // namespace V1_2
|
||||
|
|
Loading…
Reference in a new issue