Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 618028b8 authored by Miao Wang's avatar Miao Wang Committed by Przemyslaw Szczepaniak
Browse files

Add HAL entry to allow querying device impl version.

Bug: 111425781
Bug: 112661050
Test: mm
Test: NeuralNetworksTest_static
Change-Id: I32527fa09e45459bc9759f5b679646073cf96785
Merged-In: I32527fa09e45459bc9759f5b679646073cf96785
(cherry picked from commit 44b029b1)
parent 591171a6
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -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.
     *
+8 −0
Original line number Diff line number Diff line
@@ -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