Fix references to resources for Settings

Bug: 293810334
Test: m Settings
Change-Id: Ie140278f492ef7e1c062ec1ecae2866c521a86aa
This commit is contained in:
Chaohui Wang
2023-07-31 15:56:42 +08:00
parent ed505c25fa
commit 2541381259
247 changed files with 859 additions and 721 deletions

View File

@@ -16,10 +16,8 @@
package com.android.settings.development;
import static com.android.settings.development.AnimatorDurationScalePreferenceController
.ANIMATOR_DURATION_SCALE_SELECTOR;
import static com.android.settings.development.AnimatorDurationScalePreferenceController
.DEFAULT_VALUE;
import static com.android.settings.development.AnimatorDurationScalePreferenceController.ANIMATOR_DURATION_SCALE_SELECTOR;
import static com.android.settings.development.AnimatorDurationScalePreferenceController.DEFAULT_VALUE;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -31,8 +29,6 @@ import android.view.IWindowManager;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -71,9 +67,9 @@ public class AnimatorDurationScalePreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mListValues = mContext.getResources()
.getStringArray(R.array.animator_duration_scale_values);
.getStringArray(com.android.settingslib.R.array.animator_duration_scale_values);
mListSummaries = mContext.getResources()
.getStringArray(R.array.animator_duration_scale_entries);
.getStringArray(com.android.settingslib.R.array.animator_duration_scale_entries);
mController = new AnimatorDurationScalePreferenceController(mContext);
ReflectionHelpers.setField(mController, "mWindowManager", mWindowManager);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);

View File

@@ -28,8 +28,6 @@ import android.os.RemoteException;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -65,8 +63,10 @@ public class BackgroundProcessLimitPreferenceControllerTest {
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mListValues = mContext.getResources().getStringArray(R.array.app_process_limit_values);
mListSummaries = mContext.getResources().getStringArray(R.array.app_process_limit_entries);
mListValues = mContext.getResources()
.getStringArray(com.android.settingslib.R.array.app_process_limit_values);
mListSummaries = mContext.getResources()
.getStringArray(com.android.settingslib.R.array.app_process_limit_entries);
mController = spy(new BackgroundProcessLimitPreferenceController(mContext));
doReturn(mActivityManager).when(mController).getActivityManagerService();
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);

View File

@@ -16,8 +16,7 @@
package com.android.settings.development;
import static com.android.settings.development.BluetoothAvrcpVersionPreferenceController
.BLUETOOTH_AVRCP_VERSION_PROPERTY;
import static com.android.settings.development.BluetoothAvrcpVersionPreferenceController.BLUETOOTH_AVRCP_VERSION_PROPERTY;
import static com.google.common.truth.Truth.assertThat;
@@ -31,8 +30,6 @@ import android.os.SystemProperties;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -66,8 +63,10 @@ public class BluetoothAvrcpVersionPreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
final Resources resources = mContext.getResources();
mListValues = resources.getStringArray(R.array.bluetooth_avrcp_version_values);
mListSummaries = resources.getStringArray(R.array.bluetooth_avrcp_versions);
mListValues = resources.getStringArray(
com.android.settingslib.R.array.bluetooth_avrcp_version_values);
mListSummaries = resources.getStringArray(
com.android.settingslib.R.array.bluetooth_avrcp_versions);
mController = new BluetoothAvrcpVersionPreferenceController(mContext);
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
.thenReturn(mPreference);

View File

@@ -14,8 +14,8 @@
* limitations under the License.
*/
package com.android.settings.development;
import static com.android.settings.development.BluetoothMapVersionPreferenceController
.BLUETOOTH_MAP_VERSION_PROPERTY;
import static com.android.settings.development.BluetoothMapVersionPreferenceController.BLUETOOTH_MAP_VERSION_PROPERTY;
import static com.google.common.truth.Truth.assertThat;
@@ -29,8 +29,6 @@ import android.os.SystemProperties;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -59,8 +57,10 @@ public class BluetoothMapVersionPreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
final Resources resources = mContext.getResources();
mListValues = resources.getStringArray(R.array.bluetooth_map_version_values);
mListSummaries = resources.getStringArray(R.array.bluetooth_map_versions);
mListValues = resources.getStringArray(
com.android.settingslib.R.array.bluetooth_map_version_values);
mListSummaries = resources.getStringArray(
com.android.settingslib.R.array.bluetooth_map_versions);
mController = new BluetoothMapVersionPreferenceController(mContext);
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
.thenReturn(mPreference);

View File

@@ -26,8 +26,6 @@ import android.sysprop.BluetoothProperties;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -59,8 +57,10 @@ public class BluetoothSnoopLogFilterProfileMapPreferenceControllerTest {
// Get XML values without mock
// Setup test list preference using XML values
mPreference = new ListPreference(mSpyContext);
mPreference.setEntries(R.array.bt_hci_snoop_log_profile_filter_entries);
mPreference.setEntryValues(R.array.bt_hci_snoop_log_profile_filter_values);
mPreference.setEntries(
com.android.settingslib.R.array.bt_hci_snoop_log_profile_filter_entries);
mPreference.setEntryValues(
com.android.settingslib.R.array.bt_hci_snoop_log_profile_filter_values);
// Init the actual controller
mController = new BluetoothSnoopLogFilterProfileMapPreferenceController(mSpyContext);
// Construct preference in the controller via a mocked preference screen object

View File

@@ -26,8 +26,6 @@ import android.sysprop.BluetoothProperties;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -59,8 +57,10 @@ public class BluetoothSnoopLogFilterProfilePbapPreferenceControllerTest {
// Get XML values without mock
// Setup test list preference using XML values
mPreference = new ListPreference(mSpyContext);
mPreference.setEntries(R.array.bt_hci_snoop_log_profile_filter_entries);
mPreference.setEntryValues(R.array.bt_hci_snoop_log_profile_filter_values);
mPreference.setEntries(
com.android.settingslib.R.array.bt_hci_snoop_log_profile_filter_entries);
mPreference.setEntryValues(
com.android.settingslib.R.array.bt_hci_snoop_log_profile_filter_values);
// Init the actual controller
mController = new BluetoothSnoopLogFilterProfilePbapPreferenceController(mSpyContext);
// Construct preference in the controller via a mocked preference screen object

View File

@@ -28,8 +28,6 @@ import android.os.SystemProperties;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -59,8 +57,8 @@ public class BluetoothSnoopLogPreferenceControllerTest {
// Get XML values without mock
// Setup test list preference using XML values
mPreference = new ListPreference(mSpyContext);
mPreference.setEntries(R.array.bt_hci_snoop_log_entries);
mPreference.setEntryValues(R.array.bt_hci_snoop_log_values);
mPreference.setEntries(com.android.settingslib.R.array.bt_hci_snoop_log_entries);
mPreference.setEntryValues(com.android.settingslib.R.array.bt_hci_snoop_log_values);
// Init the actual controller
mController = new BluetoothSnoopLogPreferenceController(mSpyContext, null);
// Construct preference in the controller via a mocked preference screen object

View File

@@ -28,8 +28,6 @@ import android.view.ThreadedRenderer;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -60,9 +58,10 @@ public class DebugGpuOverdrawPreferenceControllerTest {
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mListValues = mContext.getResources().getStringArray(R.array.debug_hw_overdraw_values);
mListValues = mContext.getResources().getStringArray(
com.android.settingslib.R.array.debug_hw_overdraw_values);
mListSummaries = mContext.getResources().getStringArray(
R.array.debug_hw_overdraw_entries);
com.android.settingslib.R.array.debug_hw_overdraw_entries);
mController = new DebugGpuOverdrawPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);

View File

@@ -28,8 +28,6 @@ import android.view.ThreadedRenderer;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -60,8 +58,10 @@ public class DebugNonRectClipOperationsPreferenceControllerTest {
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mListValues = mContext.getResources().getStringArray(R.array.show_non_rect_clip_values);
mListSummaries = mContext.getResources().getStringArray(R.array.show_non_rect_clip_entries);
mListValues = mContext.getResources().getStringArray(
com.android.settingslib.R.array.show_non_rect_clip_values);
mListSummaries = mContext.getResources().getStringArray(
com.android.settingslib.R.array.show_non_rect_clip_entries);
mController = new DebugNonRectClipOperationsPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);

View File

@@ -34,8 +34,6 @@ import android.os.SystemProperties;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -63,8 +61,10 @@ public class GrammaticalGenderPreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
final Resources resources = mContext.getResources();
mListValues = resources.getStringArray(R.array.grammatical_gender_values);
mListSummaries = resources.getStringArray(R.array.grammatical_gender_entries);
mListValues = resources.getStringArray(
com.android.settingslib.R.array.grammatical_gender_values);
mListSummaries = resources.getStringArray(
com.android.settingslib.R.array.grammatical_gender_entries);
mConfiguration = new Configuration();
mController = new GrammaticalGenderPreferenceController(mContext, mActivityManager);
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))

View File

@@ -16,8 +16,7 @@
package com.android.settings.development;
import static com.android.settings.development.HdcpCheckingPreferenceController
.HDCP_CHECKING_PROPERTY;
import static com.android.settings.development.HdcpCheckingPreferenceController.HDCP_CHECKING_PROPERTY;
import static com.google.common.truth.Truth.assertThat;
@@ -32,8 +31,6 @@ import android.os.SystemProperties;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -69,8 +66,10 @@ public class HdcpCheckingPreferenceControllerTest {
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mValues = mContext.getResources().getStringArray(R.array.hdcp_checking_values);
mSummaries = mContext.getResources().getStringArray(R.array.hdcp_checking_summaries);
mValues = mContext.getResources().getStringArray(
com.android.settingslib.R.array.hdcp_checking_values);
mSummaries = mContext.getResources().getStringArray(
com.android.settingslib.R.array.hdcp_checking_summaries);
mController = new HdcpCheckingPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);

View File

@@ -15,8 +15,6 @@ import android.os.UserManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -60,7 +58,8 @@ public class LocalBackupPasswordPreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setSummary(R.string.local_backup_password_summary_change);
verify(mPreference).setSummary(
com.android.settingslib.R.string.local_backup_password_summary_change);
}
@Test
@@ -73,7 +72,8 @@ public class LocalBackupPasswordPreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setSummary(R.string.local_backup_password_summary_none);
verify(mPreference).setSummary(
com.android.settingslib.R.string.local_backup_password_summary_none);
}
@Test

View File

@@ -23,8 +23,6 @@ import android.content.pm.PackageManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -79,7 +77,8 @@ public class MockLocationAppPreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setSummary(mContext.getString(R.string.mock_location_app_set, appName));
verify(mPreference).setSummary(mContext.getString(
com.android.settingslib.R.string.mock_location_app_set, appName));
}
@Test
@@ -89,7 +88,8 @@ public class MockLocationAppPreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setSummary(mContext.getString(R.string.mock_location_app_not_set));
verify(mPreference).setSummary(mContext.getString(
com.android.settingslib.R.string.mock_location_app_not_set));
}
@Test

View File

@@ -32,7 +32,6 @@ import android.content.res.Resources;
import androidx.lifecycle.LifecycleOwner;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
@@ -67,7 +66,8 @@ public class PictureColorModePreferenceControllerTest {
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
.thenReturn(mPreference);
when(mContext.getResources()).thenReturn(mResources);
when(mResources.getIntArray(R.array.color_mode_ids)).thenReturn(new int[0]);
when(mResources.getIntArray(com.android.settingslib.R.array.color_mode_ids))
.thenReturn(new int[0]);
mController.displayPreference(mPreferenceScreen);
}

View File

@@ -28,8 +28,6 @@ import android.view.ThreadedRenderer;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -60,8 +58,10 @@ public class ProfileGpuRenderingPreferenceControllerTest {
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mListValues = mContext.getResources().getStringArray(R.array.track_frame_time_values);
mListSummaries = mContext.getResources().getStringArray(R.array.track_frame_time_entries);
mListValues = mContext.getResources().getStringArray(
com.android.settingslib.R.array.track_frame_time_values);
mListSummaries = mContext.getResources().getStringArray(
com.android.settingslib.R.array.track_frame_time_entries);
mController = new ProfileGpuRenderingPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);

View File

@@ -28,8 +28,6 @@ import android.provider.Settings;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -70,8 +68,10 @@ public class SecondaryDisplayPreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
final Resources resources = mContext.getResources();
mListValues = resources.getStringArray(R.array.overlay_display_devices_values);
mListSummaries = resources.getStringArray(R.array.overlay_display_devices_entries);
mListValues = resources.getStringArray(
com.android.settingslib.R.array.overlay_display_devices_values);
mListSummaries = resources.getStringArray(
com.android.settingslib.R.array.overlay_display_devices_entries);
mController = new SecondaryDisplayPreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);

View File

@@ -16,8 +16,7 @@
package com.android.settings.development;
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes
.REQUEST_CODE_DEBUG_APP;
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_DEBUG_APP;
import static com.google.common.truth.Truth.assertThat;
@@ -36,8 +35,6 @@ import android.provider.Settings;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -92,7 +89,8 @@ public class SelectDebugAppPreferenceControllerTest {
Settings.Global.putString(contentResolver, Settings.Global.DEBUG_APP, debugApp);
mController.updateState(mPreference);
verify(mPreference).setSummary(mContext.getString(R.string.debug_app_set, debugApp));
verify(mPreference).setSummary(
mContext.getString(com.android.settingslib.R.string.debug_app_set, debugApp));
}
@Test
@@ -102,7 +100,8 @@ public class SelectDebugAppPreferenceControllerTest {
Settings.Global.putString(contentResolver, Settings.Global.DEBUG_APP, debugApp);
mController.updateState(mPreference);
verify(mPreference).setSummary(mContext.getString(R.string.debug_app_not_set));
verify(mPreference).setSummary(
mContext.getString(com.android.settingslib.R.string.debug_app_not_set));
}
@Test
@@ -114,7 +113,8 @@ public class SelectDebugAppPreferenceControllerTest {
.onActivityResult(REQUEST_CODE_DEBUG_APP, Activity.RESULT_OK, activityResultIntent);
assertThat(result).isTrue();
verify(mPreference).setSummary(mContext.getString(R.string.debug_app_set, appLabel));
verify(mPreference).setSummary(
mContext.getString(com.android.settingslib.R.string.debug_app_set, appLabel));
}
@Test
@@ -128,6 +128,7 @@ public class SelectDebugAppPreferenceControllerTest {
mController.onDeveloperOptionsSwitchDisabled();
verify(mPreference).setEnabled(false);
verify(mPreference).setSummary(mContext.getString(R.string.debug_app_not_set));
verify(mPreference).setSummary(
mContext.getString(com.android.settingslib.R.string.debug_app_not_set));
}
}

View File

@@ -16,10 +16,8 @@
package com.android.settings.development;
import static com.android.settings.development.SimulateColorSpacePreferenceController
.SETTING_VALUE_OFF;
import static com.android.settings.development.SimulateColorSpacePreferenceController
.SETTING_VALUE_ON;
import static com.android.settings.development.SimulateColorSpacePreferenceController.SETTING_VALUE_OFF;
import static com.android.settings.development.SimulateColorSpacePreferenceController.SETTING_VALUE_ON;
import static com.google.common.truth.Truth.assertThat;
@@ -34,8 +32,6 @@ import android.provider.Settings;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -67,7 +63,8 @@ public class SimulateColorSpacePreferenceControllerTest {
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mListValues = mContext.getResources().getStringArray(R.array.simulate_color_space_values);
mListValues = mContext.getResources().getStringArray(
com.android.settingslib.R.array.simulate_color_space_values);
mController = new SimulateColorSpacePreferenceController(mContext);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);
@@ -130,8 +127,10 @@ public class SimulateColorSpacePreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setSummary(res.getString(R.string.daltonizer_type_overridden,
res.getString(R.string.accessibility_display_daltonizer_preference_title)));
verify(mPreference).setSummary(
res.getString(com.android.settingslib.R.string.daltonizer_type_overridden,
res.getString(com.android.settingslib.R
.string.accessibility_display_daltonizer_preference_title)));
}
@Test

View File

@@ -16,10 +16,8 @@
package com.android.settings.development;
import static com.android.settings.development.TransitionAnimationScalePreferenceController
.DEFAULT_VALUE;
import static com.android.settings.development.TransitionAnimationScalePreferenceController
.TRANSITION_ANIMATION_SCALE_SELECTOR;
import static com.android.settings.development.TransitionAnimationScalePreferenceController.DEFAULT_VALUE;
import static com.android.settings.development.TransitionAnimationScalePreferenceController.TRANSITION_ANIMATION_SCALE_SELECTOR;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -32,8 +30,6 @@ import android.view.IWindowManager;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -72,8 +68,10 @@ public class TransitionAnimationScalePreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
final Resources resources = mContext.getResources();
mListValues = resources.getStringArray(R.array.transition_animation_scale_values);
mListSummaries = resources.getStringArray(R.array.transition_animation_scale_entries);
mListValues = resources.getStringArray(
com.android.settingslib.R.array.transition_animation_scale_values);
mListSummaries = resources.getStringArray(
com.android.settingslib.R.array.transition_animation_scale_entries);
mController = new TransitionAnimationScalePreferenceController(mContext);
ReflectionHelpers.setField(mController, "mWindowManager", mWindowManager);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);

View File

@@ -16,10 +16,8 @@
package com.android.settings.development;
import static com.android.settings.development.WindowAnimationScalePreferenceController
.DEFAULT_VALUE;
import static com.android.settings.development.WindowAnimationScalePreferenceController
.WINDOW_ANIMATION_SCALE_SELECTOR;
import static com.android.settings.development.WindowAnimationScalePreferenceController.DEFAULT_VALUE;
import static com.android.settings.development.WindowAnimationScalePreferenceController.WINDOW_ANIMATION_SCALE_SELECTOR;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -32,8 +30,6 @@ import android.view.IWindowManager;
import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -72,8 +68,10 @@ public class WindowAnimationScalePreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
final Resources resources = mContext.getResources();
mListValues = resources.getStringArray(R.array.window_animation_scale_values);
mListSummaries = resources.getStringArray(R.array.window_animation_scale_entries);
mListValues = resources.getStringArray(
com.android.settingslib.R.array.window_animation_scale_values);
mListSummaries = resources.getStringArray(
com.android.settingslib.R.array.window_animation_scale_entries);
mController = new WindowAnimationScalePreferenceController(mContext);
ReflectionHelpers.setField(mController, "mWindowManager", mWindowManager);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);

View File

@@ -170,8 +170,9 @@ public class BaseBluetoothDialogPreferenceTest {
@Test
public void generateSummary_checkString() {
final String summary = String.format(mContext.getResources().getString(
R.string.bluetooth_select_a2dp_codec_streaming_label), SUMMARY2);
String label = mContext.getResources().getString(
com.android.settingslib.R.string.bluetooth_select_a2dp_codec_streaming_label);
final String summary = String.format(label, SUMMARY2);
assertThat(mPreference.generateSummary(1)).isEqualTo(summary);
}

View File

@@ -18,8 +18,6 @@ package com.android.settings.development.snooplogger;
import android.content.Context;
import com.android.settings.R;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -39,9 +37,11 @@ public class SnoopLoggerFiltersPreferenceTest {
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
sKEY = mContext.getResources().getStringArray(R.array.bt_hci_snoop_log_filters_values)[0];
sKEY = mContext.getResources().getStringArray(
com.android.settingslib.R.array.bt_hci_snoop_log_filters_values)[0];
sENTRY =
mContext.getResources().getStringArray(R.array.bt_hci_snoop_log_filters_entries)[0];
mContext.getResources().getStringArray(
com.android.settingslib.R.array.bt_hci_snoop_log_filters_entries)[0];
mPreference = new SnoopLoggerFiltersPreference(mContext, sKEY, sENTRY);
}

View File

@@ -31,8 +31,6 @@ import android.os.UserHandle;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -78,8 +76,8 @@ public class SharedDataPreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setEnabled(true);
assertThat(mPreference.getSummary())
.isEqualTo(mContext.getString(R.string.shared_data_summary));
assertThat(mPreference.getSummary()).isEqualTo(
mContext.getString(com.android.settingslib.R.string.shared_data_summary));
}
@Test
@@ -88,8 +86,8 @@ public class SharedDataPreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setEnabled(false);
assertThat(mPreference.getSummary())
.isEqualTo(mContext.getString(R.string.shared_data_no_blobs_text));
assertThat(mPreference.getSummary()).isEqualTo(
mContext.getString(com.android.settingslib.R.string.shared_data_no_blobs_text));
}
@Test
@@ -98,8 +96,8 @@ public class SharedDataPreferenceControllerTest {
mController.updateState(mPreference);
verify(mPreference).setEnabled(false);
assertThat(mPreference.getSummary())
.isEqualTo(mContext.getString(R.string.shared_data_no_blobs_text));
assertThat(mPreference.getSummary()).isEqualTo(
mContext.getString(com.android.settingslib.R.string.shared_data_no_blobs_text));
}
private List<BlobInfo> generateBlobList() {