Additional operation check when enabling read logs. am: 605a44fe93

Change-Id: Ie068daae873a7796873e4170cd18617d8161916f
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 8dcc6e5..9269432 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -53,7 +53,6 @@
 namespace {
 
 constexpr const char* kDump = "android.permission.DUMP";
-constexpr const char* kDataUsageStats = "android.permission.LOADER_USAGE_STATS";
 
 static binder::Status error(const std::string& msg) {
     PLOG(ERROR) << msg;
@@ -920,11 +919,9 @@
 binder::Status VoldNativeService::setIncFsMountOptions(
         const ::android::os::incremental::IncrementalFileSystemControlParcel& control,
         bool enableReadLogs) {
-    auto status = CheckPermission(kDataUsageStats);
-    if (!status.isOk()) {
-        return status;
-    }
+    ENFORCE_SYSTEM_OR_ROOT;
 
+    auto status = Ok();
     auto incfsControl = IncFs_CreateControl(dup(control.cmd.get()), dup(control.pendingReads.get()),
                                             dup(control.log.get()));
     if (auto error = IncFs_SetOptions(
diff --git a/VoldNativeServiceValidation.cpp b/VoldNativeServiceValidation.cpp
index 2e21ace..ee1e65a 100644
--- a/VoldNativeServiceValidation.cpp
+++ b/VoldNativeServiceValidation.cpp
@@ -39,11 +39,10 @@
 }
 
 binder::Status CheckPermission(const char* permission) {
-    pid_t pid;
-    uid_t uid;
+    int32_t pid;
+    int32_t uid;
 
-    if (checkCallingPermission(String16(permission), reinterpret_cast<int32_t*>(&pid),
-                               reinterpret_cast<int32_t*>(&uid))) {
+    if (checkCallingPermission(String16(permission), &pid, &uid)) {
         return Ok();
     } else {
         return Exception(binder::Status::EX_SECURITY,