Merge "Use new DeviceConfig.SYNC_DISABLED_MODE_* constants" into udc-dev am: a31862ea01
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21956368 Change-Id: I335a48a42c25e0ca1549abdeb195744677c3a327 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -18632,7 +18632,7 @@ public final class Settings {
|
|||||||
* The modes that can be used when disabling syncs to the 'config' settings.
|
* The modes that can be used when disabling syncs to the 'config' settings.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@IntDef(prefix = "DISABLE_SYNC_MODE_",
|
@IntDef(prefix = "SYNC_DISABLED_MODE_",
|
||||||
value = { SYNC_DISABLED_MODE_NONE, SYNC_DISABLED_MODE_PERSISTENT,
|
value = { SYNC_DISABLED_MODE_NONE, SYNC_DISABLED_MODE_PERSISTENT,
|
||||||
SYNC_DISABLED_MODE_UNTIL_REBOOT })
|
SYNC_DISABLED_MODE_UNTIL_REBOOT })
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@@ -18642,23 +18642,36 @@ public final class Settings {
|
|||||||
/**
|
/**
|
||||||
* Sync is not disabled.
|
* Sync is not disabled.
|
||||||
*
|
*
|
||||||
|
* @deprecated use the constant in DeviceConfig
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int SYNC_DISABLED_MODE_NONE = 0;
|
@Deprecated
|
||||||
|
public static final int SYNC_DISABLED_MODE_NONE = DeviceConfig.SYNC_DISABLED_MODE_NONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disabling of Config bulk update / syncing is persistent, i.e. it survives a device
|
* Disabling of Config bulk update / syncing is persistent, i.e. it survives a device
|
||||||
* reboot.
|
* reboot.
|
||||||
|
*
|
||||||
|
* @deprecated use the constant in DeviceConfig
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int SYNC_DISABLED_MODE_PERSISTENT = 1;
|
@Deprecated
|
||||||
|
public static final int SYNC_DISABLED_MODE_PERSISTENT =
|
||||||
|
DeviceConfig.SYNC_DISABLED_MODE_PERSISTENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disabling of Config bulk update / syncing is not persistent, i.e. it will not survive a
|
* Disabling of Config bulk update / syncing is not persistent, i.e. it will not survive a
|
||||||
* device reboot.
|
* device reboot.
|
||||||
|
*
|
||||||
|
* @deprecated use the constant in DeviceConfig
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int SYNC_DISABLED_MODE_UNTIL_REBOOT = 2;
|
@Deprecated
|
||||||
|
public static final int SYNC_DISABLED_MODE_UNTIL_REBOOT =
|
||||||
|
DeviceConfig.SYNC_DISABLED_MODE_UNTIL_REBOOT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The content:// style URL for the config table.
|
* The content:// style URL for the config table.
|
||||||
|
|||||||
@@ -803,51 +803,51 @@ public class DeviceConfigTest {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Ensure the device starts in a known state.
|
// Ensure the device starts in a known state.
|
||||||
DeviceConfig.setSyncDisabledMode(Settings.Config.SYNC_DISABLED_MODE_NONE);
|
DeviceConfig.setSyncDisabledMode(DeviceConfig.SYNC_DISABLED_MODE_NONE);
|
||||||
|
|
||||||
// Assert starting state.
|
// Assert starting state.
|
||||||
assertThat(DeviceConfig.getSyncDisabledMode())
|
assertThat(DeviceConfig.getSyncDisabledMode())
|
||||||
.isEqualTo(Settings.Config.SYNC_DISABLED_MODE_NONE);
|
.isEqualTo(DeviceConfig.SYNC_DISABLED_MODE_NONE);
|
||||||
assertThat(DeviceConfig.setProperties(properties1)).isTrue();
|
assertThat(DeviceConfig.setProperties(properties1)).isTrue();
|
||||||
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
||||||
.isEqualTo(VALUE);
|
.isEqualTo(VALUE);
|
||||||
|
|
||||||
// Test disabled (persistent). Persistence is not actually tested, that would require
|
// Test disabled (persistent). Persistence is not actually tested, that would require
|
||||||
// a host test.
|
// a host test.
|
||||||
DeviceConfig.setSyncDisabledMode(Settings.Config.SYNC_DISABLED_MODE_PERSISTENT);
|
DeviceConfig.setSyncDisabledMode(DeviceConfig.SYNC_DISABLED_MODE_PERSISTENT);
|
||||||
assertThat(DeviceConfig.getSyncDisabledMode())
|
assertThat(DeviceConfig.getSyncDisabledMode())
|
||||||
.isEqualTo(Settings.Config.SYNC_DISABLED_MODE_PERSISTENT);
|
.isEqualTo(DeviceConfig.SYNC_DISABLED_MODE_PERSISTENT);
|
||||||
assertThat(DeviceConfig.setProperties(properties2)).isFalse();
|
assertThat(DeviceConfig.setProperties(properties2)).isFalse();
|
||||||
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
||||||
.isEqualTo(VALUE);
|
.isEqualTo(VALUE);
|
||||||
|
|
||||||
// Return to not disabled.
|
// Return to not disabled.
|
||||||
DeviceConfig.setSyncDisabledMode(Settings.Config.SYNC_DISABLED_MODE_NONE);
|
DeviceConfig.setSyncDisabledMode(DeviceConfig.SYNC_DISABLED_MODE_NONE);
|
||||||
assertThat(DeviceConfig.getSyncDisabledMode())
|
assertThat(DeviceConfig.getSyncDisabledMode())
|
||||||
.isEqualTo(Settings.Config.SYNC_DISABLED_MODE_NONE);
|
.isEqualTo(DeviceConfig.SYNC_DISABLED_MODE_NONE);
|
||||||
assertThat(DeviceConfig.setProperties(properties2)).isTrue();
|
assertThat(DeviceConfig.setProperties(properties2)).isTrue();
|
||||||
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
||||||
.isEqualTo(VALUE2);
|
.isEqualTo(VALUE2);
|
||||||
|
|
||||||
// Test disabled (persistent). Absence of persistence is not actually tested, that would
|
// Test disabled (persistent). Absence of persistence is not actually tested, that would
|
||||||
// require a host test.
|
// require a host test.
|
||||||
DeviceConfig.setSyncDisabledMode(Settings.Config.SYNC_DISABLED_MODE_UNTIL_REBOOT);
|
DeviceConfig.setSyncDisabledMode(DeviceConfig.SYNC_DISABLED_MODE_UNTIL_REBOOT);
|
||||||
assertThat(DeviceConfig.getSyncDisabledMode())
|
assertThat(DeviceConfig.getSyncDisabledMode())
|
||||||
.isEqualTo(Settings.Config.SYNC_DISABLED_MODE_UNTIL_REBOOT);
|
.isEqualTo(DeviceConfig.SYNC_DISABLED_MODE_UNTIL_REBOOT);
|
||||||
assertThat(DeviceConfig.setProperties(properties1)).isFalse();
|
assertThat(DeviceConfig.setProperties(properties1)).isFalse();
|
||||||
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
||||||
.isEqualTo(VALUE2);
|
.isEqualTo(VALUE2);
|
||||||
|
|
||||||
// Return to not disabled.
|
// Return to not disabled.
|
||||||
DeviceConfig.setSyncDisabledMode(Settings.Config.SYNC_DISABLED_MODE_NONE);
|
DeviceConfig.setSyncDisabledMode(DeviceConfig.SYNC_DISABLED_MODE_NONE);
|
||||||
assertThat(DeviceConfig.getSyncDisabledMode())
|
assertThat(DeviceConfig.getSyncDisabledMode())
|
||||||
.isEqualTo(Settings.Config.SYNC_DISABLED_MODE_NONE);
|
.isEqualTo(DeviceConfig.SYNC_DISABLED_MODE_NONE);
|
||||||
assertThat(DeviceConfig.setProperties(properties1)).isTrue();
|
assertThat(DeviceConfig.setProperties(properties1)).isTrue();
|
||||||
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
assertThat(DeviceConfig.getProperties(NAMESPACE, KEY).getString(KEY, DEFAULT_VALUE))
|
||||||
.isEqualTo(VALUE);
|
.isEqualTo(VALUE);
|
||||||
} finally {
|
} finally {
|
||||||
// Try to return to the default sync disabled state in case of failure.
|
// Try to return to the default sync disabled state in case of failure.
|
||||||
DeviceConfig.setSyncDisabledMode(Settings.Config.SYNC_DISABLED_MODE_NONE);
|
DeviceConfig.setSyncDisabledMode(DeviceConfig.SYNC_DISABLED_MODE_NONE);
|
||||||
|
|
||||||
// NAMESPACE will be cleared by cleanUp()
|
// NAMESPACE will be cleared by cleanUp()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ package com.android.providers.settings;
|
|||||||
import static android.os.Process.ROOT_UID;
|
import static android.os.Process.ROOT_UID;
|
||||||
import static android.os.Process.SHELL_UID;
|
import static android.os.Process.SHELL_UID;
|
||||||
import static android.os.Process.SYSTEM_UID;
|
import static android.os.Process.SYSTEM_UID;
|
||||||
import static android.provider.Settings.Config.SYNC_DISABLED_MODE_NONE;
|
import static android.provider.DeviceConfig.SYNC_DISABLED_MODE_NONE;
|
||||||
import static android.provider.Settings.Config.SYNC_DISABLED_MODE_PERSISTENT;
|
import static android.provider.DeviceConfig.SYNC_DISABLED_MODE_PERSISTENT;
|
||||||
import static android.provider.Settings.Config.SYNC_DISABLED_MODE_UNTIL_REBOOT;
|
import static android.provider.DeviceConfig.SYNC_DISABLED_MODE_UNTIL_REBOOT;
|
||||||
import static android.provider.Settings.SET_ALL_RESULT_DISABLED;
|
import static android.provider.Settings.SET_ALL_RESULT_DISABLED;
|
||||||
import static android.provider.Settings.SET_ALL_RESULT_FAILURE;
|
import static android.provider.Settings.SET_ALL_RESULT_FAILURE;
|
||||||
import static android.provider.Settings.SET_ALL_RESULT_SUCCESS;
|
import static android.provider.Settings.SET_ALL_RESULT_SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user