Merge changes I5d17fc87,If1cc6b9a

* changes:
  Cgroup APIs are guarded
  Remove __ANDROID_API__ guards
This commit is contained in:
Treehugger Robot 2021-01-18 09:21:00 +00:00 committed by Gerrit Code Review
commit 9d78718441
3 changed files with 2 additions and 14 deletions

View File

@ -71,7 +71,7 @@ bool CgroupController::IsUsable() {
if (!HasValue()) return false; if (!HasValue()) return false;
if (state_ == UNKNOWN) { if (state_ == UNKNOWN) {
if (ACgroupController_getFlags != nullptr) { if (__builtin_available(android 30, *)) {
uint32_t flags = ACgroupController_getFlags(controller_); uint32_t flags = ACgroupController_getFlags(controller_);
state_ = (flags & CGROUPRC_CONTROLLER_FLAG_MOUNTED) != 0 ? USABLE : MISSING; state_ = (flags & CGROUPRC_CONTROLLER_FLAG_MOUNTED) != 0 ? USABLE : MISSING;
} else { } else {
@ -172,7 +172,7 @@ void CgroupMap::Print() const {
auto controller_count = ACgroupFile_getControllerCount(); auto controller_count = ACgroupFile_getControllerCount();
for (uint32_t i = 0; i < controller_count; ++i) { for (uint32_t i = 0; i < controller_count; ++i) {
const ACgroupController* controller = ACgroupFile_getController(i); const ACgroupController* controller = ACgroupFile_getController(i);
if (ACgroupController_getFlags != nullptr) { if (__builtin_available(android 30, *)) {
LOG(INFO) << "\t" << ACgroupController_getName(controller) << " ver " LOG(INFO) << "\t" << ACgroupController_getName(controller) << " ver "
<< ACgroupController_getVersion(controller) << " path " << ACgroupController_getVersion(controller) << " path "
<< ACgroupController_getPath(controller) << " flags " << ACgroupController_getPath(controller) << " flags "

View File

@ -28,8 +28,6 @@ __BEGIN_DECLS
struct ACgroupController; struct ACgroupController;
typedef struct ACgroupController ACgroupController; typedef struct ACgroupController ACgroupController;
#if __ANDROID_API__ >= __ANDROID_API_Q__
// ACgroupFile // ACgroupFile
/** /**
@ -71,8 +69,6 @@ __attribute__((warn_unused_result)) uint32_t ACgroupController_getVersion(const
#define CGROUPRC_CONTROLLER_FLAG_MOUNTED 0x1 #define CGROUPRC_CONTROLLER_FLAG_MOUNTED 0x1
#define CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION 0x2 #define CGROUPRC_CONTROLLER_FLAG_NEEDS_ACTIVATION 0x2
#if __ANDROID_API__ >= __ANDROID_API_R__
/** /**
* Returns the flags bitmask of the given controller. * Returns the flags bitmask of the given controller.
* If the given controller is null, return 0. * If the given controller is null, return 0.
@ -80,8 +76,6 @@ __attribute__((warn_unused_result)) uint32_t ACgroupController_getVersion(const
__attribute__((warn_unused_result, weak)) uint32_t ACgroupController_getFlags( __attribute__((warn_unused_result, weak)) uint32_t ACgroupController_getFlags(
const ACgroupController*) __INTRODUCED_IN(30); const ACgroupController*) __INTRODUCED_IN(30);
#endif
/** /**
* Returns the name of the given controller. * Returns the name of the given controller.
* If the given controller is null, return nullptr. * If the given controller is null, return nullptr.
@ -97,5 +91,3 @@ __attribute__((warn_unused_result)) const char* ACgroupController_getPath(const
__INTRODUCED_IN(29); __INTRODUCED_IN(29);
__END_DECLS __END_DECLS
#endif

View File

@ -33,8 +33,6 @@
__BEGIN_DECLS __BEGIN_DECLS
#if __ANDROID_API__ >= 26
/* Fences indicate the status of an asynchronous task. They are initially /* Fences indicate the status of an asynchronous task. They are initially
* in unsignaled state (0), and make a one-time transition to either signaled * in unsignaled state (0), and make a one-time transition to either signaled
* (1) or error (< 0) state. A sync file is a collection of one or more fences; * (1) or error (< 0) state. A sync file is a collection of one or more fences;
@ -101,8 +99,6 @@ static inline struct sync_fence_info* sync_get_fence_info(const struct sync_file
*/ */
void sync_file_info_free(struct sync_file_info* info) __INTRODUCED_IN(26); void sync_file_info_free(struct sync_file_info* info) __INTRODUCED_IN(26);
#endif /* __ANDROID_API__ >= 26 */
__END_DECLS __END_DECLS
#endif /* ANDROID_SYNC_H */ #endif /* ANDROID_SYNC_H */