summaryrefslogtreecommitdiffstats
path: root/sdcard
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2016-04-07 18:05:28 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-04-07 18:05:28 +0000
commit0762e99064fca14fdc1ca4e43815acf07e270161 (patch)
tree2fcb9346c715c11e09ba3e24c1a740721f4919b1 /sdcard
parente60b407d43b63fc92ece0de32266e2c6650003cc (diff)
parent20ca9836b9a780c41a22850f478a29f29677553e (diff)
downloadcore-0762e99064fca14fdc1ca4e43815acf07e270161.tar.gz
core-0762e99064fca14fdc1ca4e43815acf07e270161.tar.bz2
core-0762e99064fca14fdc1ca4e43815acf07e270161.zip
Give users and devices control over sdcardfs.
am: 20ca983 * commit '20ca9836b9a780c41a22850f478a29f29677553e': Give users and devices control over sdcardfs. Change-Id: I0144b346157952f79fdde5100f0fdc01daa58d9b
Diffstat (limited to 'sdcard')
-rw-r--r--sdcard/sdcard.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index d8fda676f..befe38c9e 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -43,6 +43,7 @@
#include <cutils/hashmap.h>
#include <cutils/log.h>
#include <cutils/multiuser.h>
+#include <cutils/properties.h>
#include <packagelistparser/packagelistparser.h>
#include <private/android_filesystem_config.h>
@@ -89,6 +90,9 @@
#define ERROR(x...) ALOGE(x)
+#define PROP_SDCARDFS_DEVICE "ro.sys.sdcardfs"
+#define PROP_SDCARDFS_USER "persist.sys.sdcardfs"
+
#define FUSE_UNKNOWN_INO 0xffffffff
/* Maximum number of bytes to write in one request. */
@@ -1993,6 +1997,29 @@ static bool supports_sdcardfs(void) {
return false;
}
+static bool should_use_sdcardfs(void) {
+ char property[PROPERTY_VALUE_MAX];
+
+ // Allow user to have a strong opinion about state
+ property_get(PROP_SDCARDFS_USER, property, "");
+ if (!strcmp(property, "force_on")) {
+ ALOGW("User explicitly enabled sdcardfs");
+ return supports_sdcardfs();
+ } else if (!strcmp(property, "force_off")) {
+ ALOGW("User explicitly disabled sdcardfs");
+ return false;
+ }
+
+ // Fall back to device opinion about state
+ if (property_get_bool(PROP_SDCARDFS_DEVICE, false)) {
+ ALOGW("Device explicitly enabled sdcardfs");
+ return supports_sdcardfs();
+ } else {
+ ALOGW("Device explicitly disabled sdcardfs");
+ return false;
+ }
+}
+
int main(int argc, char **argv) {
const char *source_path = NULL;
const char *label = NULL;
@@ -2065,7 +2092,7 @@ int main(int argc, char **argv) {
sleep(1);
}
- if (supports_sdcardfs()) {
+ if (should_use_sdcardfs()) {
run_sdcardfs(source_path, label, uid, gid, userid, multi_user, full_write);
} else {
run(source_path, label, uid, gid, userid, multi_user, full_write);