• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 
17 #pragma once
18 
19 #if !defined(__ANDROID_APEX__) && !defined(__ANDROID_VNDK__)
20 
21 #include <android/binder_ibinder.h>
22 #include <binder/IBinder.h>
23 
24 /**
25  * Get libbinder version of binder from AIBinder.
26  *
27  * WARNING: function calls to a local object on the other side of this function
28  * will parcel. When converting between binders, keep in mind it is not as
29  * efficient as a direct function call.
30  *
31  * \param binder binder with ownership retained by the client
32  * \return platform binder object
33  */
34 android::sp<android::IBinder> AIBinder_toPlatformBinder(AIBinder* binder);
35 
36 /**
37  * Get libbinder_ndk version of binder from platform binder.
38  *
39  * WARNING: function calls to a local object on the other side of this function
40  * will parcel. When converting between binders, keep in mind it is not as
41  * efficient as a direct function call.
42  *
43  * \param binder platform binder which may be from anywhere (doesn't have to be
44  * created with libbinder_ndK)
45  * \return binder with one reference count of ownership given to the client. See
46  * AIBinder_decStrong
47  */
48 AIBinder* AIBinder_fromPlatformBinder(const android::sp<android::IBinder>& binder);
49 
50 #endif
51