summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 67686e0c7236..3916f0d78931 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -208,6 +208,12 @@ class StorageManagerService extends IStorageManager.Stub
*/
private static final String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
+ /**
+ * If {@code 1}, enables FuseDaemon to intercept file system ops. If {@code -1},
+ * disables FuseDaemon. If {@code 0}, uses the default value from the build system.
+ */
+ private static final String FUSE_ENABLED = "fuse_enabled";
+
public static class Lifecycle extends SystemService {
private StorageManagerService mStorageManagerService;
@@ -817,8 +823,10 @@ class StorageManagerService extends IStorageManager.Stub
DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
mContext.getMainExecutor(), (properties) -> {
refreshIsolatedStorageSettings();
+ refreshFuseSettings();
});
refreshIsolatedStorageSettings();
+ refreshFuseSettings();
}
/**
@@ -882,6 +890,18 @@ class StorageManagerService extends IStorageManager.Stub
SystemProperties.set(StorageManager.PROP_ISOLATED_STORAGE, Boolean.toString(res));
}
+ private void refreshFuseSettings() {
+ int isFuseEnabled = DeviceConfig.getInt(DeviceConfig.NAMESPACE_STORAGE_NATIVE_BOOT,
+ FUSE_ENABLED, 0);
+ if (isFuseEnabled == 1) {
+ SystemProperties.set(StorageManager.PROP_FUSE, "true");
+ } else if (isFuseEnabled == -1) {
+ SystemProperties.set(StorageManager.PROP_FUSE, "false");
+ }
+ // else, keep the build config.
+ // This can be overridden be direct adjustment of persist.sys.prop
+ }
+
/**
* MediaProvider has a ton of code that makes assumptions about storage
* paths never changing, so we outright kill them to pick up new state.