164328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland/*
264328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland**
364328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland** Copyright 2017, The Android Open Source Project
464328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland**
564328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland** This file is dual licensed.  It may be redistributed and/or modified
664328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland** under the terms of the Apache 2.0 License OR version 2 of the GNU
764328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland** General Public License.
864328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland*/
964328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
1064328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#ifndef _LIBS_LOG_SAFETYNET_H
1164328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#define _LIBS_LOG_SAFETYNET_H
1264328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
1364328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#ifdef __cplusplus
1464328403b596acc86c216763a1cb9b7f7f7965edSteven Morelandextern "C" {
1564328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#endif
1664328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
1764328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#ifndef _ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE
1864328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#ifndef __ANDROID_API__
1964328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1
2064328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#elif __ANDROID_API__ > 22 /* > Lollipop */
2164328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 1
2264328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#else
2364328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#define __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE 0
2464328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#endif
2564328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#endif
2664328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
2764328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#if __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE
2864328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
2964328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#define android_errorWriteLog(tag, subTag) \
3064328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland  __android_log_error_write(tag, subTag, -1, NULL, 0)
3164328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
3264328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \
3364328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland  __android_log_error_write(tag, subTag, uid, data, dataLen)
3464328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
3564328403b596acc86c216763a1cb9b7f7f7965edSteven Morelandint __android_log_error_write(int tag, const char* subTag, int32_t uid,
3664328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland                              const char* data, uint32_t dataLen);
3764328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
3864328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#endif /* __ANDROID_USE_LIBLOG_SAFETYNET_INTERFACE */
3964328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
4064328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#ifdef __cplusplus
4164328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland}
4264328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#endif
4364328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland
4464328403b596acc86c216763a1cb9b7f7f7965edSteven Moreland#endif /* _LIBS_LOG_SAFETYNET_H */
45