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

Commit 334ddaa5 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Define DeviceConfig for storage features."

parents 40f2c989 5d0c55c0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -5667,6 +5667,11 @@ package android.provider {
    method public void onPropertyChanged(String, String, String);
  }
  public static interface DeviceConfig.Storage {
    field public static final String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
    field public static final String NAMESPACE = "storage";
  }
  public static interface DeviceConfig.Telephony {
    field public static final String NAMESPACE = "telephony";
    field public static final String PROPERTY_ENABLE_RAMPING_RINGER = "enable_ramping_ringer";
+17 −0
Original line number Diff line number Diff line
@@ -181,6 +181,23 @@ public final class DeviceConfig {
        String KEY_MAX_CACHED_PROCESSES = "max_cached_processes";
    }

    /**
     * Namespace for storage-related features.
     *
     * @hide
     */
    @SystemApi
    public interface Storage {
        String NAMESPACE = "storage";

        /**
         * If {@code 1}, enables the isolated storage feature. If {@code -1},
         * disables the isolated storage feature. If {@code 0}, uses the default
         * value from the build system.
         */
        String ISOLATED_STORAGE_ENABLED = "isolated_storage_enabled";
    }

    private static final Object sLock = new Object();
    @GuardedBy("sLock")
    private static Map<OnPropertyChangedListener, Pair<String, Executor>> sListeners =
+12 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ import android.os.storage.StorageManagerInternal;
import android.os.storage.StorageVolume;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
import android.provider.DeviceConfig;
import android.provider.MediaStore;
import android.provider.Settings;
import android.sysprop.VoldProperties;
@@ -463,6 +464,7 @@ class StorageManagerService extends IStorageManager.Stub
        = { "password", "default", "pattern", "pin" };

    private final Context mContext;
    private final ContentResolver mResolver;

    private volatile IVold mVold;
    private volatile IStoraged mStoraged;
@@ -797,6 +799,14 @@ class StorageManagerService extends IStorageManager.Stub
                    refreshIsolatedStorageSettings();
                }
            });
        // For now, simply clone property when it changes
        DeviceConfig.addOnPropertyChangedListener(DeviceConfig.Storage.NAMESPACE,
                mContext.getMainExecutor(), (namespace, name, value) -> {
                    if (DeviceConfig.Storage.ISOLATED_STORAGE_ENABLED.equals(name)) {
                        Settings.Global.putString(mResolver,
                                Settings.Global.ISOLATED_STORAGE_REMOTE, value);
                    }
                });
        refreshIsolatedStorageSettings();
    }

@@ -1523,6 +1533,8 @@ class StorageManagerService extends IStorageManager.Stub
                SystemProperties.getBoolean(StorageManager.PROP_ISOLATED_STORAGE, false)));

        mContext = context;
        mResolver = mContext.getContentResolver();

        mCallbacks = new Callbacks(FgThread.get().getLooper());
        mLockPatternUtils = new LockPatternUtils(mContext);