diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-07-22 11:11:46 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2015-07-22 11:11:50 -0700 |
commit | 85ced632680642fce680d141ddd10299ff849233 (patch) | |
tree | 31f3658bafa45232a76cb99d520a6fbccf6e04d1 /core/java/android/os | |
parent | 54d42be6eb149b3e43115e810e4a1b92e9865d05 (diff) | |
download | frameworks_base-85ced632680642fce680d141ddd10299ff849233.zip frameworks_base-85ced632680642fce680d141ddd10299ff849233.tar.gz frameworks_base-85ced632680642fce680d141ddd10299ff849233.tar.bz2 |
More info to support CTS, fix reconcile bug.
Surface more details and commands for storage volumes to support
CTS testing. Fix user reconciliation bug that skipped user setup on
empty volumes.
Bug: 22658804, 22633097
Change-Id: I4221312d1cce24d1f5a2c108095cf3cf471598ed
Diffstat (limited to 'core/java/android/os')
-rw-r--r-- | core/java/android/os/FileUtils.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java index 864225a..af4c2bc 100644 --- a/core/java/android/os/FileUtils.java +++ b/core/java/android/os/FileUtils.java @@ -16,6 +16,7 @@ package android.os; +import android.annotation.NonNull; import android.provider.DocumentsContract.Document; import android.system.ErrnoException; import android.system.Os; @@ -69,6 +70,8 @@ public class FileUtils { /** Regular expression for safe filenames: no spaces or metacharacters */ private static final Pattern SAFE_FILENAME_PATTERN = Pattern.compile("[\\w%+,./=_-]+"); + private static final File[] EMPTY = new File[0]; + /** * Set owner and mode of of given {@link File}. * @@ -634,4 +637,13 @@ public class FileUtils { return new File(parent, name + "." + ext); } } + + public static @NonNull File[] listFilesOrEmpty(File dir) { + File[] res = dir.listFiles(); + if (res != null) { + return res; + } else { + return EMPTY; + } + } } |