Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a3034c3 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "libbinder_ndk: separate libbinder plat headers" am: b40b64d0

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1490135

Change-Id: I10b2c32aeee13b9ff587ed9d3f140d0356e01a47
parents c680ef27 b40b64d0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -14,9 +14,9 @@
 * limitations under the License.
 */

#include <android/binder_context.h>
#include <android/binder_ibinder.h>
#include <android/binder_ibinder_platform.h>
#include <android/binder_libbinder.h>
#include "ibinder_internal.h"

#include <android/binder_stability.h>
+18 −25
Original line number Diff line number Diff line
@@ -16,39 +16,32 @@

#pragma once

// binder_context.h used to be part of this header and is included for backwards
// compatibility.
#include <android/binder_context.h>

#if !defined(__ANDROID_APEX__) && !defined(__ANDROID_VNDK__)

#include <android/binder_ibinder.h>
#include <binder/IBinder.h>

__BEGIN_DECLS

/**
 * Get libbinder version of binder from AIBinder.
 *
 * WARNING: function calls to a local object on the other side of this function
 * will parcel. When converting between binders, keep in mind it is not as
 * efficient as a direct function call.
 * Makes calls to AIBinder_getCallingSid work if the kernel supports it. This
 * must be called on a local binder server before it is sent out to any othe
 * process. If this is a remote binder, it will abort. If the kernel doesn't
 * support this feature, you'll always get null from AIBinder_getCallingSid.
 *
 * \param binder binder with ownership retained by the client
 * \return platform binder object
 * \param binder local server binder to request security contexts on
 */
android::sp<android::IBinder> AIBinder_toPlatformBinder(AIBinder* binder);
__attribute__((weak)) void AIBinder_setRequestingSid(AIBinder* binder, bool requestingSid)
        __INTRODUCED_IN(31);

/**
 * Get libbinder_ndk version of binder from platform binder.
 * Returns the selinux context of the callee.
 *
 * WARNING: function calls to a local object on the other side of this function
 * will parcel. When converting between binders, keep in mind it is not as
 * efficient as a direct function call.
 * In order for this to work, the following conditions must be met:
 * - The kernel must be new enough to support this feature.
 * - The server must have called AIBinder_setRequestingSid.
 * - The callee must be a remote process.
 *
 * \param binder platform binder which may be from anywhere (doesn't have to be
 * created with libbinder_ndK)
 * \return binder with one reference count of ownership given to the client. See
 * AIBinder_decStrong
 * \return security context or null if unavailable. The lifetime of this context
 * is the lifetime of the transaction.
 */
AIBinder* AIBinder_fromPlatformBinder(const android::sp<android::IBinder>& binder);
__attribute__((weak, warn_unused_result)) const char* AIBinder_getCallingSid() __INTRODUCED_IN(31);

#endif
__END_DECLS
+50 −0
Original line number Diff line number Diff line
@@ -16,32 +16,35 @@

#pragma once

#include <android/binder_ibinder.h>
#if !defined(__ANDROID_APEX__) && !defined(__ANDROID_VNDK__)

__BEGIN_DECLS
#include <android/binder_ibinder.h>
#include <binder/IBinder.h>

/**
 * Makes calls to AIBinder_getCallingSid work if the kernel supports it. This
 * must be called on a local binder server before it is sent out to any othe
 * process. If this is a remote binder, it will abort. If the kernel doesn't
 * support this feature, you'll always get null from AIBinder_getCallingSid.
 * Get libbinder version of binder from AIBinder.
 *
 * WARNING: function calls to a local object on the other side of this function
 * will parcel. When converting between binders, keep in mind it is not as
 * efficient as a direct function call.
 *
 * \param binder local server binder to request security contexts on
 * \param binder binder with ownership retained by the client
 * \return platform binder object
 */
__attribute__((weak)) void AIBinder_setRequestingSid(AIBinder* binder, bool requestingSid)
        __INTRODUCED_IN(31);
android::sp<android::IBinder> AIBinder_toPlatformBinder(AIBinder* binder);

/**
 * Returns the selinux context of the callee.
 * Get libbinder_ndk version of binder from platform binder.
 *
 * In order for this to work, the following conditions must be met:
 * - The kernel must be new enough to support this feature.
 * - The server must have called AIBinder_setRequestingSid.
 * - The callee must be a remote process.
 * WARNING: function calls to a local object on the other side of this function
 * will parcel. When converting between binders, keep in mind it is not as
 * efficient as a direct function call.
 *
 * \return security context or null if unavailable. The lifetime of this context
 * is the lifetime of the transaction.
 * \param binder platform binder which may be from anywhere (doesn't have to be
 * created with libbinder_ndK)
 * \return binder with one reference count of ownership given to the client. See
 * AIBinder_decStrong
 */
__attribute__((weak, warn_unused_result)) const char* AIBinder_getCallingSid() __INTRODUCED_IN(31);
AIBinder* AIBinder_fromPlatformBinder(const android::sp<android::IBinder>& binder);

__END_DECLS
#endif
+1 −1
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@
#include <aidl/BnBinderNdkUnitTest.h>
#include <aidl/BnEmpty.h>
#include <android-base/logging.h>
#include <android/binder_context.h>
#include <android/binder_ibinder_jni.h>
#include <android/binder_ibinder_platform.h>
#include <android/binder_libbinder.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <gtest/gtest.h>
+1 −1
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@
 * limitations under the License.
 */

#include <android/binder_context.h>
#include <android/binder_ibinder.h>
#include <android/binder_ibinder_platform.h>
#include <android/binder_manager.h>
#include <android/binder_parcel.h>
#include <android/binder_process.h>
Loading