1 // Copyright (C) 2017 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef _LIBS_LOG_SAFETYNET_H 16 #define _LIBS_LOG_SAFETYNET_H 17 18 #include <stdint.h> 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #ifndef _ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 25 #ifndef __ANDROID_API__ 26 #define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1 27 #elif __ANDROID_API__ > 22 /* > Lollipop */ 28 #define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1 29 #else 30 #define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 0 31 #endif 32 #endif 33 34 #if __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 35 36 #define android_errorWriteLog(tag, subTag) \ 37 __android_log_error_write(tag, subTag, -1, NULL, 0) 38 39 #define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \ 40 __android_log_error_write(tag, subTag, uid, data, dataLen) 41 42 int __android_log_error_write(int tag, const char* subTag, int32_t uid, 43 const char* data, uint32_t dataLen); 44 45 #endif /* __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE */ 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif /* _LIBS_LOG_SAFETYNET_H */ 52