Rename ENFORCE_UID to ENFORCE_SYSTEM_OR_ROOT

A little bit more self-explanatory name that explicitly says that root
is also allowed.

Test: builds
Change-Id: Ice20ffcba2a0994c599dbebace252138ffd827de
Merged-In: Ice20ffcba2a0994c599dbebace252138ffd827de
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 0afbab9..f17f59f 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -92,7 +92,7 @@
     }
 }
 
-binder::Status checkUid(uid_t expectedUid) {
+binder::Status checkUidOrRoot(uid_t expectedUid) {
     uid_t uid = IPCThreadState::self()->getCallingUid();
     if (uid == expectedUid || uid == AID_ROOT) {
         return ok();
@@ -147,12 +147,12 @@
     return ok();
 }
 
-#define ENFORCE_UID(uid)                         \
-    {                                            \
-        binder::Status status = checkUid((uid)); \
-        if (!status.isOk()) {                    \
-            return status;                       \
-        }                                        \
+#define ENFORCE_SYSTEM_OR_ROOT                              \
+    {                                                       \
+        binder::Status status = checkUidOrRoot(AID_SYSTEM); \
+        if (!status.isOk()) {                               \
+            return status;                                  \
+        }                                                   \
     }
 
 #define CHECK_ARGUMENT_ID(id)                          \
@@ -217,7 +217,7 @@
 
 binder::Status VoldNativeService::setListener(
     const android::sp<android::os::IVoldListener>& listener) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     VolumeManager::Instance()->setListener(listener);
@@ -225,7 +225,7 @@
 }
 
 binder::Status VoldNativeService::monitor() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
 
     // Simply acquire/release each lock for watchdog
     { ACQUIRE_LOCK; }
@@ -235,42 +235,42 @@
 }
 
 binder::Status VoldNativeService::reset() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->reset());
 }
 
 binder::Status VoldNativeService::shutdown() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->shutdown());
 }
 
 binder::Status VoldNativeService::onUserAdded(int32_t userId, int32_t userSerial) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->onUserAdded(userId, userSerial));
 }
 
 binder::Status VoldNativeService::onUserRemoved(int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->onUserRemoved(userId));
 }
 
 binder::Status VoldNativeService::onUserStarted(int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->onUserStarted(userId));
 }
 
 binder::Status VoldNativeService::onUserStopped(int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->onUserStopped(userId));
@@ -287,7 +287,7 @@
 }
 
 binder::Status VoldNativeService::onSecureKeyguardStateChanged(bool isShowing) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->onSecureKeyguardStateChanged(isShowing));
@@ -295,7 +295,7 @@
 
 binder::Status VoldNativeService::partition(const std::string& diskId, int32_t partitionType,
                                             int32_t ratio) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(diskId);
     ACQUIRE_LOCK;
 
@@ -317,7 +317,7 @@
 
 binder::Status VoldNativeService::forgetPartition(const std::string& partGuid,
                                                   const std::string& fsUuid) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_HEX(partGuid);
     CHECK_ARGUMENT_HEX(fsUuid);
     ACQUIRE_LOCK;
@@ -327,7 +327,7 @@
 
 binder::Status VoldNativeService::mount(const std::string& volId, int32_t mountFlags,
                                         int32_t mountUserId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(volId);
     ACQUIRE_LOCK;
 
@@ -353,7 +353,7 @@
 }
 
 binder::Status VoldNativeService::unmount(const std::string& volId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(volId);
     ACQUIRE_LOCK;
 
@@ -365,7 +365,7 @@
 }
 
 binder::Status VoldNativeService::format(const std::string& volId, const std::string& fsType) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(volId);
     ACQUIRE_LOCK;
 
@@ -400,7 +400,7 @@
 
 binder::Status VoldNativeService::benchmark(
     const std::string& volId, const android::sp<android::os::IVoldTaskListener>& listener) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(volId);
     ACQUIRE_LOCK;
 
@@ -413,7 +413,7 @@
 }
 
 binder::Status VoldNativeService::checkEncryption(const std::string& volId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(volId);
     ACQUIRE_LOCK;
 
@@ -426,7 +426,7 @@
 binder::Status VoldNativeService::moveStorage(
     const std::string& fromVolId, const std::string& toVolId,
     const android::sp<android::os::IVoldTaskListener>& listener) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(fromVolId);
     CHECK_ARGUMENT_ID(toVolId);
     ACQUIRE_LOCK;
@@ -444,14 +444,14 @@
 }
 
 binder::Status VoldNativeService::remountUid(int32_t uid, int32_t remountMode) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->remountUid(uid, remountMode));
 }
 
 binder::Status VoldNativeService::mkdirs(const std::string& path) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_PATH(path);
     ACQUIRE_LOCK;
 
@@ -461,7 +461,7 @@
 binder::Status VoldNativeService::createObb(const std::string& sourcePath,
                                             const std::string& sourceKey, int32_t ownerGid,
                                             std::string* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_PATH(sourcePath);
     CHECK_ARGUMENT_HEX(sourceKey);
     ACQUIRE_LOCK;
@@ -471,7 +471,7 @@
 }
 
 binder::Status VoldNativeService::destroyObb(const std::string& volId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(volId);
     ACQUIRE_LOCK;
 
@@ -481,7 +481,7 @@
 binder::Status VoldNativeService::createStubVolume(
     const std::string& sourcePath, const std::string& mountPath, const std::string& fsType,
     const std::string& fsUuid, const std::string& fsLabel, std::string* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_PATH(sourcePath);
     CHECK_ARGUMENT_PATH(mountPath);
     CHECK_ARGUMENT_HEX(fsUuid);
@@ -494,7 +494,7 @@
 }
 
 binder::Status VoldNativeService::destroyStubVolume(const std::string& volId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_ID(volId);
     ACQUIRE_LOCK;
 
@@ -503,7 +503,7 @@
 
 binder::Status VoldNativeService::fstrim(
     int32_t fstrimFlags, const android::sp<android::os::IVoldTaskListener>& listener) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     std::thread([=]() { android::vold::Trim(listener); }).detach();
@@ -512,7 +512,7 @@
 
 binder::Status VoldNativeService::runIdleMaint(
     const android::sp<android::os::IVoldTaskListener>& listener) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     std::thread([=]() { android::vold::RunIdleMaint(listener); }).detach();
@@ -521,7 +521,7 @@
 
 binder::Status VoldNativeService::abortIdleMaint(
     const android::sp<android::os::IVoldTaskListener>& listener) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     std::thread([=]() { android::vold::AbortIdleMaint(listener); }).detach();
@@ -530,14 +530,14 @@
 
 binder::Status VoldNativeService::mountAppFuse(int32_t uid, int32_t mountId,
                                                android::base::unique_fd* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->mountAppFuse(uid, mountId, _aidl_return));
 }
 
 binder::Status VoldNativeService::unmountAppFuse(int32_t uid, int32_t mountId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translate(VolumeManager::Instance()->unmountAppFuse(uid, mountId));
@@ -546,7 +546,7 @@
 binder::Status VoldNativeService::openAppFuseFile(int32_t uid, int32_t mountId, int32_t fileId,
                                                   int32_t flags,
                                                   android::base::unique_fd* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     int fd = VolumeManager::Instance()->openAppFuseFile(uid, mountId, fileId, flags);
@@ -561,14 +561,14 @@
 }
 
 binder::Status VoldNativeService::fdeCheckPassword(const std::string& password) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translate(cryptfs_check_passwd(password.c_str()));
 }
 
 binder::Status VoldNativeService::fdeRestart() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     // Spawn as thread so init can issue commands back to vold without
@@ -578,7 +578,7 @@
 }
 
 binder::Status VoldNativeService::fdeComplete(int32_t* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     *_aidl_return = cryptfs_crypto_complete();
@@ -609,7 +609,7 @@
 
 binder::Status VoldNativeService::fdeEnable(int32_t passwordType, const std::string& password,
                                             int32_t encryptionFlags) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     LOG(DEBUG) << "fdeEnable(" << passwordType << ", *, " << encryptionFlags << ")";
@@ -627,21 +627,21 @@
 
 binder::Status VoldNativeService::fdeChangePassword(int32_t passwordType,
                                                     const std::string& password) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translate(cryptfs_changepw(passwordType, password.c_str()));
 }
 
 binder::Status VoldNativeService::fdeVerifyPassword(const std::string& password) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translate(cryptfs_verify_passwd(password.c_str()));
 }
 
 binder::Status VoldNativeService::fdeGetField(const std::string& key, std::string* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     char buf[PROPERTY_VALUE_MAX];
@@ -654,14 +654,14 @@
 }
 
 binder::Status VoldNativeService::fdeSetField(const std::string& key, const std::string& value) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translate(cryptfs_setfield(key.c_str(), value.c_str()));
 }
 
 binder::Status VoldNativeService::fdeGetPasswordType(int32_t* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     *_aidl_return = cryptfs_get_password_type();
@@ -669,7 +669,7 @@
 }
 
 binder::Status VoldNativeService::fdeGetPassword(std::string* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     const char* res = cryptfs_get_password();
@@ -680,7 +680,7 @@
 }
 
 binder::Status VoldNativeService::fdeClearPassword() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     cryptfs_clear_password();
@@ -688,14 +688,14 @@
 }
 
 binder::Status VoldNativeService::fbeEnable() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_initialize_systemwide_keys());
 }
 
 binder::Status VoldNativeService::mountDefaultEncrypted() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     if (!fscrypt_is_native()) {
@@ -707,14 +707,14 @@
 }
 
 binder::Status VoldNativeService::initUser0() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_init_user0());
 }
 
 binder::Status VoldNativeService::isConvertibleToFbe(bool* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     *_aidl_return = cryptfs_isConvertibleToFBE() != 0;
@@ -723,7 +723,7 @@
 
 binder::Status VoldNativeService::mountFstab(const std::string& blkDevice,
                                              const std::string& mountPoint) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translateBool(fscrypt_mount_metadata_encrypted(blkDevice, mountPoint, false));
@@ -731,21 +731,21 @@
 
 binder::Status VoldNativeService::encryptFstab(const std::string& blkDevice,
                                                const std::string& mountPoint) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return translateBool(fscrypt_mount_metadata_encrypted(blkDevice, mountPoint, true));
 }
 
 binder::Status VoldNativeService::createUserKey(int32_t userId, int32_t userSerial, bool ephemeral) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_vold_create_user_key(userId, userSerial, ephemeral));
 }
 
 binder::Status VoldNativeService::destroyUserKey(int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_destroy_user_key(userId));
@@ -754,14 +754,14 @@
 binder::Status VoldNativeService::addUserKeyAuth(int32_t userId, int32_t userSerial,
                                                  const std::string& token,
                                                  const std::string& secret) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_add_user_key_auth(userId, userSerial, token, secret));
 }
 
 binder::Status VoldNativeService::fixateNewestUserKeyAuth(int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_fixate_newest_user_key_auth(userId));
@@ -770,14 +770,14 @@
 binder::Status VoldNativeService::unlockUserKey(int32_t userId, int32_t userSerial,
                                                 const std::string& token,
                                                 const std::string& secret) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_unlock_user_key(userId, userSerial, token, secret));
 }
 
 binder::Status VoldNativeService::lockUserKey(int32_t userId) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_CRYPT_LOCK;
 
     return translateBool(fscrypt_lock_user_key(userId));
@@ -786,7 +786,7 @@
 binder::Status VoldNativeService::prepareUserStorage(const std::unique_ptr<std::string>& uuid,
                                                      int32_t userId, int32_t userSerial,
                                                      int32_t flags) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     std::string empty_string = "";
     auto uuid_ = uuid ? *uuid : empty_string;
     CHECK_ARGUMENT_HEX(uuid_);
@@ -797,7 +797,7 @@
 
 binder::Status VoldNativeService::destroyUserStorage(const std::unique_ptr<std::string>& uuid,
                                                      int32_t userId, int32_t flags) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     std::string empty_string = "";
     auto uuid_ = uuid ? *uuid : empty_string;
     CHECK_ARGUMENT_HEX(uuid_);
@@ -819,14 +819,14 @@
 }
 
 binder::Status VoldNativeService::startCheckpoint(int32_t retry) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return cp_startCheckpoint(retry);
 }
 
 binder::Status VoldNativeService::needsRollback(bool* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     *_aidl_return = cp_needsRollback();
@@ -834,7 +834,7 @@
 }
 
 binder::Status VoldNativeService::needsCheckpoint(bool* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     *_aidl_return = cp_needsCheckpoint();
@@ -842,21 +842,21 @@
 }
 
 binder::Status VoldNativeService::commitChanges() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return cp_commitChanges();
 }
 
 binder::Status VoldNativeService::prepareCheckpoint() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return cp_prepareCheckpoint();
 }
 
 binder::Status VoldNativeService::restoreCheckpoint(const std::string& mountPoint) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_PATH(mountPoint);
     ACQUIRE_LOCK;
 
@@ -864,7 +864,7 @@
 }
 
 binder::Status VoldNativeService::restoreCheckpointPart(const std::string& mountPoint, int count) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_PATH(mountPoint);
     ACQUIRE_LOCK;
 
@@ -872,14 +872,14 @@
 }
 
 binder::Status VoldNativeService::markBootAttempt() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return cp_markBootAttempt();
 }
 
 binder::Status VoldNativeService::abortChanges(const std::string& message, bool retry) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     cp_abortChanges(message, retry);
@@ -887,28 +887,28 @@
 }
 
 binder::Status VoldNativeService::supportsCheckpoint(bool* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return cp_supportsCheckpoint(*_aidl_return);
 }
 
 binder::Status VoldNativeService::supportsBlockCheckpoint(bool* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return cp_supportsBlockCheckpoint(*_aidl_return);
 }
 
 binder::Status VoldNativeService::supportsFileCheckpoint(bool* _aidl_return) {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     return cp_supportsFileCheckpoint(*_aidl_return);
 }
 
 binder::Status VoldNativeService::resetCheckpoint() {
-    ENFORCE_UID(AID_SYSTEM);
+    ENFORCE_SYSTEM_OR_ROOT;
     ACQUIRE_LOCK;
 
     cp_resetCheckpoint();