summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tobias Thierer <tobiast@google.com> 2017-04-05 20:53:46 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-04-05 20:53:47 +0000
commit183c93f6a09a879fbb0e079cb4cb351aa0fa9846 (patch)
treedaaba329f562a99784dbb7730a9f76f19efded20
parenteb7c287c716e1bfff67e9ab72cc1dfc47380c905 (diff)
parent0ad48dc8aab4b1475a73e61fcd202f418ae13561 (diff)
Merge "Document the fact that StatFs.restat() and ctor can throw."
-rw-r--r--core/java/android/database/sqlite/SQLiteGlobal.java2
-rw-r--r--core/java/android/os/StatFs.java7
-rw-r--r--services/core/java/com/android/server/storage/DeviceStorageMonitorService.java3
3 files changed, 11 insertions, 1 deletions
diff --git a/core/java/android/database/sqlite/SQLiteGlobal.java b/core/java/android/database/sqlite/SQLiteGlobal.java
index 5ff199a75257..922d11b6ae65 100644
--- a/core/java/android/database/sqlite/SQLiteGlobal.java
+++ b/core/java/android/database/sqlite/SQLiteGlobal.java
@@ -61,6 +61,8 @@ public final class SQLiteGlobal {
public static int getDefaultPageSize() {
synchronized (sLock) {
if (sDefaultPageSize == 0) {
+ // If there is an issue accessing /data, something is so seriously
+ // wrong that we just let the IllegalArgumentException propagate.
sDefaultPageSize = new StatFs("/data").getBlockSize();
}
return SystemProperties.getInt("debug.sqlite.pagesize", sDefaultPageSize);
diff --git a/core/java/android/os/StatFs.java b/core/java/android/os/StatFs.java
index 13e9a15eedb6..aeffdc784762 100644
--- a/core/java/android/os/StatFs.java
+++ b/core/java/android/os/StatFs.java
@@ -34,11 +34,16 @@ public class StatFs {
* class.
*
* @param path path in the desired file system to stat.
+ *
+ * @throws IllegalArgumentException if the file system access fails
*/
public StatFs(String path) {
mStat = doStat(path);
}
+ /**
+ * @throws IllegalArgumentException if the file system access fails
+ */
private static StructStatVfs doStat(String path) {
try {
return Os.statvfs(path);
@@ -51,6 +56,8 @@ public class StatFs {
* Perform a restat of the file system referenced by this object. This is
* the same as re-constructing the object with the same file system path,
* and the new stat values are available upon return.
+ *
+ * @throws IllegalArgumentException if the file system access fails
*/
public void restat(String path) {
mStat = doStat(path);
diff --git a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
index 90c711a47941..35732a34ed25 100644
--- a/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
+++ b/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
@@ -330,7 +330,8 @@ public class DeviceStorageMonitorService extends SystemService {
mLastReportedFreeMemTime = 0;
mResolver = context.getContentResolver();
mIsBootImageOnDisk = isBootImageOnDisk();
- //create StatFs object
+ // If these constructors throw IllegalArgumentException, something
+ // is so seriously wrong that we just let the Exception propagate.
mDataFileStats = new StatFs(DATA_PATH.getAbsolutePath());
mSystemFileStats = new StatFs(SYSTEM_PATH.getAbsolutePath());
mCacheFileStats = new StatFs(CACHE_PATH.getAbsolutePath());