diff options
Diffstat (limited to 'framework/java/android/provider/DeviceConfig.java')
-rw-r--r-- | framework/java/android/provider/DeviceConfig.java | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/framework/java/android/provider/DeviceConfig.java b/framework/java/android/provider/DeviceConfig.java index 454f577..0d5ac76 100644 --- a/framework/java/android/provider/DeviceConfig.java +++ b/framework/java/android/provider/DeviceConfig.java @@ -23,6 +23,7 @@ import static android.Manifest.permission.READ_WRITE_SYNC_DISABLED_MODE_CONFIG; import android.Manifest; import android.annotation.CallbackExecutor; +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; @@ -37,6 +38,11 @@ import android.util.Pair; import com.android.internal.annotations.GuardedBy; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -925,6 +931,43 @@ public final class DeviceConfig { @SystemApi public static final String NAMESPACE_REMOTE_AUTH = "remote_auth"; + /** + * The modes that can be used when disabling syncs to the 'config' settings. + * @hide + */ + @IntDef(prefix = "SYNC_DISABLED_MODE_", + value = { SYNC_DISABLED_MODE_NONE, SYNC_DISABLED_MODE_PERSISTENT, + SYNC_DISABLED_MODE_UNTIL_REBOOT }) + @Retention(RetentionPolicy.SOURCE) + @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) + public @interface SyncDisabledMode {} + + /** + * Sync is not disabled. + * + * @hide + */ + @SystemApi + public static final int SYNC_DISABLED_MODE_NONE = 0; + + /** + * Disabling of Config bulk update / syncing is persistent, i.e. it survives a device + * reboot. + * + * @hide + */ + @SystemApi + public static final int SYNC_DISABLED_MODE_PERSISTENT = 1; + + /** + * Disabling of Config bulk update / syncing is not persistent, i.e. it will + * not survive a device reboot. + * + * @hide + */ + @SystemApi + public static final int SYNC_DISABLED_MODE_UNTIL_REBOOT = 2; + private static final Object sLock = new Object(); @GuardedBy("sLock") private static ArrayMap<OnPropertiesChangedListener, Pair<String, Executor>> sListeners = @@ -1226,16 +1269,15 @@ public final class DeviceConfig { * config values. This is intended for use during tests to prevent a sync operation clearing * config values which could influence the outcome of the tests, i.e. by changing behavior. * - * @param syncDisabledMode the mode to use, see {@link Settings.Config#SYNC_DISABLED_MODE_NONE}, - * {@link Settings.Config#SYNC_DISABLED_MODE_PERSISTENT} and {@link - * Settings.Config#SYNC_DISABLED_MODE_UNTIL_REBOOT} + * @param syncDisabledMode the mode to use, see {@link #SYNC_DISABLED_MODE_NONE}, + * {@link #SYNC_DISABLED_MODE_PERSISTENT} and {@link #SYNC_DISABLED_MODE_UNTIL_REBOOT} * * @see #getSyncDisabledMode() * @hide */ @SystemApi @RequiresPermission(anyOf = {WRITE_DEVICE_CONFIG, READ_WRITE_SYNC_DISABLED_MODE_CONFIG}) - public static void setSyncDisabledMode(int syncDisabledMode) { + public static void setSyncDisabledMode(@SyncDisabledMode int syncDisabledMode) { Settings.Config.setSyncDisabledMode(syncDisabledMode); } |