1/* 2 * Copyright (C) 2018 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.2; 18 19import @1.0::ErrorStatus; 20import @1.0::IPreparedModelCallback; 21import IPreparedModel; 22 23/** 24 * IPreparedModelCallback must be used to return a prepared model produced by an 25 * asynchronous task launched from IDevice::prepareModel. 26 */ 27interface IPreparedModelCallback extends @1.0::IPreparedModelCallback { 28 29 /** 30 * Either notify_1_2 or notify must be invoked immediately after the asynchronous 31 * task holding this callback has finished preparing the model. If the model was 32 * successfully prepared, either notify_1_2 or notify must be invoked with 33 * ErrorStatus::NONE and the prepared model. If the model was not able to be 34 * successfully prepared, either notify_1_2 or notify must be invoked with the 35 * appropriate ErrorStatus and nullptr as the IPreparedModel. If the asynchronous 36 * task holding this callback fails to launch or if the model provided to 37 * IDevice::prepareModel is invalid, either notify_1_2 or notify must be invoked 38 * with the appropriate error as well as nullptr for the IPreparedModel. 39 * 40 * @param status Error status returned from the asynchronous model 41 * preparation task; must be: 42 * - NONE if the asynchronous task successfully prepared the 43 * model 44 * - DEVICE_UNAVAILABLE if driver is offline or busy 45 * - GENERAL_FAILURE if the asynchronous task resulted in an 46 * unspecified error 47 * - INVALID_ARGUMENT if one of the input arguments to 48 * prepareModel is invalid 49 * @param preparedModel A model that has been asynchronously prepared for 50 * execution. If the model was unable to be prepared 51 * due to an error, nullptr must be passed in place of 52 * the IPreparedModel object. 53 */ 54 oneway notify_1_2(ErrorStatus status, IPreparedModel preparedModel); 55}; 56