Home | History | Annotate | Download | only in 1.0
      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 package android.frameworks.bufferhub@1.0;
     17 
     18 interface IBufferClient {
     19     /**
     20      * Creates a token that could be used for IBufferHub::import function later.
     21      *
     22      * @return token A per-boot-unique token in handle format. The content of
     23      *     token is opaque and implementation defined. Could be used for create
     24      *     another IBufferClient via IBufferHub::import function.
     25      * @return status The result of this operation. NO_ERROR on success,
     26      *     error codes on failure.
     27      */
     28     duplicate() generates (handle token, BufferHubStatus status);
     29 
     30     /**
     31      * Closes this client.
     32      *
     33      * All further function calls must return CLIENT_CLOSED. All the unused
     34      * tokens generated by this client via IBufferClient::duplicate must become
     35      * invalid, and try to use them for import will return INVALID_TOKEN.
     36      *
     37      * Calling close must immediately free the underlying buffers if they are
     38      * only used by this client, but the client must also be freed after
     39      * calling this method.
     40      *
     41      * User may manually call this function to avoid race condition caused by
     42      * asynchronous destructors.
     43      *
     44      * @return status The result of this operation. NO_ERROR on success,
     45      *     error codes on failure.
     46      */
     47     close() generates (BufferHubStatus status);
     48 };