summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Arthur Eubanks <aeubanks@google.com> 2017-11-01 02:52:24 +0000
committer android-build-merger <android-build-merger@google.com> 2017-11-01 02:52:24 +0000
commit53c1004bf0b585a5a0953729e2d5ffb5a1111212 (patch)
treec7074a1dc96b167fd91de3d1d830b62eefdfc573
parentc1a3a735620135efbef0e2407a2baf36db0ddd49 (diff)
parentc7cbe12cfdc9ce55fd1583b35def385f1866e060 (diff)
Merge changes I06bea24c,I8e2e24af
am: c7cbe12cfd Change-Id: I4d69c8516ca5f63480fb9a1d04dfe5f795af2b75
-rw-r--r--cmds/installd/InstalldNativeService.cpp5
-rw-r--r--cmds/installd/tests/Android.bp16
-rw-r--r--cmds/installd/tests/installd_cache_test.cpp2
-rw-r--r--cmds/installd/utils.cpp2
-rw-r--r--cmds/installd/utils.h2
5 files changed, 17 insertions, 10 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index c087713b15..4a93b1fd3d 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -311,6 +311,7 @@ static int prepare_app_quota(const std::unique_ptr<std::string>& uuid, const std
return -1;
}
+#if APPLY_HARD_QUOTAS
if ((dq.dqb_bhardlimit == 0) || (dq.dqb_ihardlimit == 0)) {
auto path = create_data_path(uuid ? uuid->c_str() : nullptr);
struct statvfs stat;
@@ -335,6 +336,10 @@ static int prepare_app_quota(const std::unique_ptr<std::string>& uuid, const std
// Hard quota already set; assume it's reasonable
return 0;
}
+#else
+ // Hard quotas disabled
+ return 0;
+#endif
}
binder::Status InstalldNativeService::createAppData(const std::unique_ptr<std::string>& uuid,
diff --git a/cmds/installd/tests/Android.bp b/cmds/installd/tests/Android.bp
index c6ebb249d0..89c11aa160 100644
--- a/cmds/installd/tests/Android.bp
+++ b/cmds/installd/tests/Android.bp
@@ -6,13 +6,13 @@ cc_test {
cflags: ["-Wall", "-Werror"],
shared_libs: [
"libbase",
- "liblog",
"libutils",
"libcutils",
],
static_libs: [
- "libinstalld",
"libdiskusage",
+ "libinstalld",
+ "liblog",
],
}
@@ -25,14 +25,14 @@ cc_test {
"libbase",
"libbinder",
"libcutils",
- "liblog",
- "liblogwrap",
"libselinux",
"libutils",
],
static_libs: [
- "libinstalld",
"libdiskusage",
+ "libinstalld",
+ "liblog",
+ "liblogwrap",
],
}
@@ -45,13 +45,13 @@ cc_test {
"libbase",
"libbinder",
"libcutils",
- "liblog",
- "liblogwrap",
"libselinux",
"libutils",
],
static_libs: [
- "libinstalld",
"libdiskusage",
+ "libinstalld",
+ "liblog",
+ "liblogwrap",
],
}
diff --git a/cmds/installd/tests/installd_cache_test.cpp b/cmds/installd/tests/installd_cache_test.cpp
index aed068c390..2d58515b11 100644
--- a/cmds/installd/tests/installd_cache_test.cpp
+++ b/cmds/installd/tests/installd_cache_test.cpp
@@ -99,7 +99,7 @@ static int64_t size(const char* path) {
static int64_t free() {
struct statvfs buf;
if (!statvfs("/data/local/tmp", &buf)) {
- return buf.f_bavail * buf.f_frsize;
+ return static_cast<int64_t>(buf.f_bavail) * buf.f_frsize;
} else {
PLOG(ERROR) << "Failed to statvfs";
return -1;
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index 7fa356f762..462d004325 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -656,7 +656,7 @@ int copy_dir_files(const char *srcname,
int64_t data_disk_free(const std::string& data_path) {
struct statvfs sfs;
if (statvfs(data_path.c_str(), &sfs) == 0) {
- return sfs.f_bavail * sfs.f_frsize;
+ return static_cast<int64_t>(sfs.f_bavail) * sfs.f_frsize;
} else {
PLOG(ERROR) << "Couldn't statvfs " << data_path;
return -1;
diff --git a/cmds/installd/utils.h b/cmds/installd/utils.h
index ac6a48808b..2a760d4623 100644
--- a/cmds/installd/utils.h
+++ b/cmds/installd/utils.h
@@ -36,6 +36,8 @@
#define BYPASS_QUOTA 0
#define BYPASS_SDCARDFS 0
+#define APPLY_HARD_QUOTAS 1
+
namespace android {
namespace installd {