blob: c0d34164396c081e37e8d3d3246c0454bafa8395 [file] [log] [blame]
Xusong Wang68c32342019-10-23 10:35:07 -07001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.neuralnetworks@1.3;
18
Xusong Wang68c32342019-10-23 10:35:07 -070019import @1.2::IPreparedModelCallback;
Xusong Wang62a760c2019-10-25 12:07:17 -070020import IPreparedModel;
Xusong Wang68c32342019-10-23 10:35:07 -070021
22/**
23 * IPreparedModelCallback must be used to return a prepared model produced by an
24 * asynchronous task launched from IDevice::prepareModel.
25 */
26interface IPreparedModelCallback extends @1.2::IPreparedModelCallback {
27
28 /**
29 * There are three notify methods declared for the IPreparedModelCallback
30 * interface: notify_1_3, notify_1_2, and notify. One of the three
31 * notify methods must be invoked immediately after the asynchronous
32 * task holding this callback has finished preparing the model. If the model was
33 * successfully prepared, one of the notify methods must be invoked with
34 * ErrorStatus::NONE and the prepared model. If the model was not able to be
35 * successfully prepared, one of the notify methods must be invoked with the
36 * appropriate ErrorStatus and nullptr as the IPreparedModel. If the asynchronous
37 * task holding this callback fails to launch or if the model provided to
38 * IDevice::prepareModel is invalid, one of the notify methods must be invoked
39 * with the appropriate error as well as nullptr for the IPreparedModel.
40 *
41 * @param status Error status returned from the asynchronous model
42 * preparation task; must be:
43 * - NONE if the asynchronous task successfully prepared the
44 * model
45 * - DEVICE_UNAVAILABLE if driver is offline or busy
46 * - GENERAL_FAILURE if the asynchronous task resulted in an
47 * unspecified error
48 * - INVALID_ARGUMENT if one of the input arguments to
49 * prepareModel is invalid
Michael Butler9b9a8042020-02-13 16:37:22 -080050 * - MISSED_DEADLINE_* if the preparation is aborted because
51 * the model cannot be prepared by the deadline
Michael Butlerc2499ec2019-12-11 18:31:12 -080052 * - RESOURCE_EXHAUSTED_* if the task was aborted by the
53 * driver
Xusong Wang68c32342019-10-23 10:35:07 -070054 * @param preparedModel A model that has been asynchronously prepared for
55 * execution. If the model was unable to be prepared
56 * due to an error, nullptr must be passed in place of
57 * the IPreparedModel object.
58 */
59 oneway notify_1_3(ErrorStatus status, IPreparedModel preparedModel);
60};