Remove unneeded custom shadow of PowerManager

Bug: 319052511

Test: atest
Change-Id: I6150ce86c909abf3cb33cdbedba102e53db0d4d4
This commit is contained in:
Fan Wu
2024-01-17 15:13:16 +08:00
parent c225153922
commit 65e9804dbb
2 changed files with 3 additions and 43 deletions

View File

@@ -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<String> preferenceScreenKeys = XmlTestUtils.getKeysFromPreferenceXml(context,
fragment.getPreferenceScreenResId());

View File

@@ -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;
}
}