diff --git a/tests/robotests/src/com/android/settings/DisplaySettingsTest.java b/tests/robotests/src/com/android/settings/DisplaySettingsTest.java index e251669e7bb..1259821edff 100644 --- a/tests/robotests/src/com/android/settings/DisplaySettingsTest.java +++ b/tests/robotests/src/com/android/settings/DisplaySettingsTest.java @@ -4,15 +4,14 @@ import static com.google.common.truth.Truth.assertThat; import android.content.Context; +import androidx.test.core.app.ApplicationProvider; + import com.android.settings.testutils.XmlTestUtils; -import com.android.settings.testutils.shadow.ShadowPowerManager; import com.android.settingslib.core.AbstractPreferenceController; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import java.util.ArrayList; import java.util.List; @@ -21,9 +20,8 @@ import java.util.List; public class DisplaySettingsTest { @Test - @Config(shadows = ShadowPowerManager.class) public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() { - final Context context = RuntimeEnvironment.application; + final Context context = ApplicationProvider.getApplicationContext(); final DisplaySettings fragment = new DisplaySettings(); final List preferenceScreenKeys = XmlTestUtils.getKeysFromPreferenceXml(context, fragment.getPreferenceScreenResId()); diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPowerManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPowerManager.java deleted file mode 100644 index 9a4993ea676..00000000000 --- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowPowerManager.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package com.android.settings.testutils.shadow; - -import android.os.PowerManager; - -import org.robolectric.annotation.Implementation; -import org.robolectric.annotation.Implements; - -@Implements(PowerManager.class) -public class ShadowPowerManager { - - @Implementation - protected int getMinimumScreenBrightnessSetting() { - return 0; - } - - @Implementation - protected int getMaximumScreenBrightnessSetting() { - return 0; - } - -}