summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-02-18 21:23:06 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-02-18 21:23:06 +0000
commitc6ee3609c3c935f21e4bc83d88e42cc6fe30c3d4 (patch)
tree422c361b6a978de6a572c414c3d6c64cc6a1d00e
parent40e7078c06a0b1439279b6a1cabc7b0b4b07f66e (diff)
parent5b5adbf68176342fef5a2351e5159fa6e649cd9c (diff)
Merge "Add AParcel_getAllowFds()" am: ed2364a85d am: 8ab1fe5e40 am: 5b5adbf681
Change-Id: Ibbd0871d3b2f82253671224fd36eb9b72cd6c67c
-rw-r--r--libs/binder/ndk/include_platform/android/binder_parcel_platform.h32
-rw-r--r--libs/binder/ndk/libbinder_ndk.map.txt5
-rw-r--r--libs/binder/ndk/parcel.cpp5
3 files changed, 42 insertions, 0 deletions
diff --git a/libs/binder/ndk/include_platform/android/binder_parcel_platform.h b/libs/binder/ndk/include_platform/android/binder_parcel_platform.h
new file mode 100644
index 0000000000..ac46cb80f4
--- /dev/null
+++ b/libs/binder/ndk/include_platform/android/binder_parcel_platform.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+#include <android/binder_parcel.h>
+
+__BEGIN_DECLS
+
+/**
+ * Gets whether or not FDs are allowed by this AParcel
+ *
+ * \return true if FDs are allowed, false if they are not. That is
+ * if this returns false then AParcel_writeParcelFileDescriptor will
+ * return STATUS_FDS_NOT_ALLOWED.
+ */
+bool AParcel_getAllowFds(const AParcel*);
+
+__END_DECLS \ No newline at end of file
diff --git a/libs/binder/ndk/libbinder_ndk.map.txt b/libs/binder/ndk/libbinder_ndk.map.txt
index 7e72f22d64..a9eba47380 100644
--- a/libs/binder/ndk/libbinder_ndk.map.txt
+++ b/libs/binder/ndk/libbinder_ndk.map.txt
@@ -114,3 +114,8 @@ LIBBINDER_NDK30 { # introduced=30
local:
*;
};
+
+LIBBINDER_NDK_PLATFORM {
+ global:
+ AParcel_getAllowFds;
+};
diff --git a/libs/binder/ndk/parcel.cpp b/libs/binder/ndk/parcel.cpp
index f0ea237ee8..703ceaed54 100644
--- a/libs/binder/ndk/parcel.cpp
+++ b/libs/binder/ndk/parcel.cpp
@@ -15,6 +15,7 @@
*/
#include <android/binder_parcel.h>
+#include <android/binder_parcel_platform.h>
#include "parcel_internal.h"
#include "ibinder_internal.h"
@@ -645,4 +646,8 @@ binder_status_t AParcel_readByteArray(const AParcel* parcel, void* arrayData,
return ReadArray<int8_t>(parcel, arrayData, allocator);
}
+bool AParcel_getAllowFds(const AParcel* parcel) {
+ return parcel->get()->allowFds();
+}
+
// @END