From 8a1707e02126f9906090666ee29be79ed01ecc16 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Fri, 5 Oct 2018 13:16:50 -0400 Subject: [PATCH] Fix DozeConfigurationTest Settings.Secure.putString() was failing to remove the setting for config_dozeAlwaysOnEnabled, so the test would only pass if the default setting matched what was currently set on the device. The fix seems to be to use Settings.Secure.putStringForUser(UserHandle.USER_CURRENT), because systemui tests are now running as the system Test: atest com.android.systemui.doze.DozeConfigurationTest#alwaysOn_followsConfigByDefault Change-Id: I482e1b72b4a3567d5448ded0aa110f2e3e05c515 --- .../com/android/systemui/doze/DozeConfigurationTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java index bb67d6e03a9d4..45342d4bc3a98 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java @@ -47,10 +47,10 @@ public class DozeConfigurationTest extends SysuiTestCase { return; } - Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, - null); + Settings.Secure.putStringForUser(mContext.getContentResolver(), + Settings.Secure.DOZE_ALWAYS_ON, null, UserHandle.USER_CURRENT); boolean defaultValue = mContext.getResources() .getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled); - assertEquals(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT), defaultValue); + assertEquals(defaultValue, mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)); } }