Loading libs/binder/ndk/include_cpp/android/binder_auto_utils.h +1 −8 Original line number Original line Diff line number Diff line Loading @@ -27,19 +27,12 @@ #pragma once #pragma once #include <android/binder_ibinder.h> #include <android/binder_ibinder.h> #include <android/binder_internal_logging.h> #include <android/binder_parcel.h> #include <android/binder_parcel.h> #include <android/binder_status.h> #include <android/binder_status.h> #include <assert.h> #include <assert.h> // defined differently by liblog #pragma push_macro("LOG_PRI") #ifdef LOG_PRI #undef LOG_PRI #endif #include <syslog.h> #pragma pop_macro("LOG_PRI") #include <unistd.h> #include <unistd.h> #include <cstddef> #include <cstddef> #include <string> #include <string> Loading libs/binder/ndk/include_cpp/android/binder_internal_logging.h 0 → 100644 +38 −0 Original line number Original line Diff line number Diff line /* * 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. */ /** * @addtogroup NdkBinder * @{ */ /** * @file binder_internal_logging.h * @brief This provides the ability to use syslog from binder headers, since * other logging functionality might be inaccessable. */ #pragma once // defined differently by liblog #pragma push_macro("LOG_PRI") #ifdef LOG_PRI #undef LOG_PRI #endif #include <syslog.h> #pragma pop_macro("LOG_PRI") /** @} */ libs/binder/ndk/include_cpp/android/binder_parcel_utils.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ #pragma once #pragma once #include <android/binder_auto_utils.h> #include <android/binder_auto_utils.h> #include <android/binder_internal_logging.h> #include <android/binder_parcel.h> #include <android/binder_parcel.h> #include <optional> #include <optional> Loading Loading @@ -179,6 +180,7 @@ static inline binder_status_t AParcel_readNullableStrongBinder(const AParcel* pa static inline binder_status_t AParcel_writeRequiredStrongBinder(AParcel* parcel, static inline binder_status_t AParcel_writeRequiredStrongBinder(AParcel* parcel, const SpAIBinder& binder) { const SpAIBinder& binder) { if (binder.get() == nullptr) { if (binder.get() == nullptr) { syslog(LOG_ERR, "Passing null binder object as non-@nullable AIDL IBinder"); return STATUS_UNEXPECTED_NULL; return STATUS_UNEXPECTED_NULL; } } return AParcel_writeStrongBinder(parcel, binder.get()); return AParcel_writeStrongBinder(parcel, binder.get()); Loading Loading @@ -228,6 +230,7 @@ static inline binder_status_t AParcel_readNullableParcelFileDescriptor(const APa static inline binder_status_t AParcel_writeRequiredParcelFileDescriptor( static inline binder_status_t AParcel_writeRequiredParcelFileDescriptor( AParcel* parcel, const ScopedFileDescriptor& fd) { AParcel* parcel, const ScopedFileDescriptor& fd) { if (fd.get() < 0) { if (fd.get() < 0) { syslog(LOG_ERR, "Passing -1 file descriptor as non-@nullable AIDL ParcelFileDescriptor"); return STATUS_UNEXPECTED_NULL; return STATUS_UNEXPECTED_NULL; } } return AParcel_writeParcelFileDescriptor(parcel, fd.get()); return AParcel_writeParcelFileDescriptor(parcel, fd.get()); Loading Loading
libs/binder/ndk/include_cpp/android/binder_auto_utils.h +1 −8 Original line number Original line Diff line number Diff line Loading @@ -27,19 +27,12 @@ #pragma once #pragma once #include <android/binder_ibinder.h> #include <android/binder_ibinder.h> #include <android/binder_internal_logging.h> #include <android/binder_parcel.h> #include <android/binder_parcel.h> #include <android/binder_status.h> #include <android/binder_status.h> #include <assert.h> #include <assert.h> // defined differently by liblog #pragma push_macro("LOG_PRI") #ifdef LOG_PRI #undef LOG_PRI #endif #include <syslog.h> #pragma pop_macro("LOG_PRI") #include <unistd.h> #include <unistd.h> #include <cstddef> #include <cstddef> #include <string> #include <string> Loading
libs/binder/ndk/include_cpp/android/binder_internal_logging.h 0 → 100644 +38 −0 Original line number Original line Diff line number Diff line /* * 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. */ /** * @addtogroup NdkBinder * @{ */ /** * @file binder_internal_logging.h * @brief This provides the ability to use syslog from binder headers, since * other logging functionality might be inaccessable. */ #pragma once // defined differently by liblog #pragma push_macro("LOG_PRI") #ifdef LOG_PRI #undef LOG_PRI #endif #include <syslog.h> #pragma pop_macro("LOG_PRI") /** @} */
libs/binder/ndk/include_cpp/android/binder_parcel_utils.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,7 @@ #pragma once #pragma once #include <android/binder_auto_utils.h> #include <android/binder_auto_utils.h> #include <android/binder_internal_logging.h> #include <android/binder_parcel.h> #include <android/binder_parcel.h> #include <optional> #include <optional> Loading Loading @@ -179,6 +180,7 @@ static inline binder_status_t AParcel_readNullableStrongBinder(const AParcel* pa static inline binder_status_t AParcel_writeRequiredStrongBinder(AParcel* parcel, static inline binder_status_t AParcel_writeRequiredStrongBinder(AParcel* parcel, const SpAIBinder& binder) { const SpAIBinder& binder) { if (binder.get() == nullptr) { if (binder.get() == nullptr) { syslog(LOG_ERR, "Passing null binder object as non-@nullable AIDL IBinder"); return STATUS_UNEXPECTED_NULL; return STATUS_UNEXPECTED_NULL; } } return AParcel_writeStrongBinder(parcel, binder.get()); return AParcel_writeStrongBinder(parcel, binder.get()); Loading Loading @@ -228,6 +230,7 @@ static inline binder_status_t AParcel_readNullableParcelFileDescriptor(const APa static inline binder_status_t AParcel_writeRequiredParcelFileDescriptor( static inline binder_status_t AParcel_writeRequiredParcelFileDescriptor( AParcel* parcel, const ScopedFileDescriptor& fd) { AParcel* parcel, const ScopedFileDescriptor& fd) { if (fd.get() < 0) { if (fd.get() < 0) { syslog(LOG_ERR, "Passing -1 file descriptor as non-@nullable AIDL ParcelFileDescriptor"); return STATUS_UNEXPECTED_NULL; return STATUS_UNEXPECTED_NULL; } } return AParcel_writeParcelFileDescriptor(parcel, fd.get()); return AParcel_writeParcelFileDescriptor(parcel, fd.get()); Loading