Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed2673ad authored by Shafik Nassar's avatar Shafik Nassar Committed by Android (Google) Code Review
Browse files

Merge "Configure persist.sys.fuse flag using DeviceConfig"

parents 58095f12 b2992b61
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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.