/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.frameworks.bufferhub@1.0; interface IBufferClient { /** * Creates a token that could be used for IBufferHub::import function later. * * @return token A per-boot-unique token in handle format. The content of * token is opaque and implementation defined. Could be used for create * another IBufferClient via IBufferHub::import function. * @return status The result of this operation. NO_ERROR on success, * error codes on failure. */ duplicate() generates (handle token, BufferHubStatus status); /** * Closes this client. * * All further function calls must return CLIENT_CLOSED. All the unused * tokens generated by this client via IBufferClient::duplicate must become * invalid, and try to use them for import will return INVALID_TOKEN. * * Calling close must immediately free the underlying buffers if they are * only used by this client, but the client must also be freed after * calling this method. * * User may manually call this function to avoid race condition caused by * asynchronous destructors. * * @return status The result of this operation. NO_ERROR on success, * error codes on failure. */ close() generates (BufferHubStatus status); };