Clean up some UnusedResources detected by lint 2

Bug: 234570979
Test: Manual with Settings App
Change-Id: I2421f1147ce8c9b09c2428355610a9089481d547
This commit is contained in:
Chaohui Wang
2022-09-10 17:25:15 +08:00
parent a396bf859a
commit 7fe7ef383e
38 changed files with 8 additions and 1194 deletions

View File

@@ -50,8 +50,8 @@
android:key="pref_key_4"
android:title="pref_title_4"
android:summary="summary_4"
android:entries="@array/app_install_location_entries"
android:entryValues="@array/app_install_location_values"
android:entries="@array/mvno_type_entries"
android:entryValues="@array/mvno_type_values"
settings:keywords="keywords1, keywords2, keywords3" />
<CheckBoxPreference
@@ -61,4 +61,4 @@
android:summaryOff="summary_off"
settings:searchable="false"
settings:keywords="keywords1, keywords2, keywords3" />
</PreferenceScreen>
</PreferenceScreen>

View File

@@ -124,7 +124,7 @@ public class PreferenceXmlParserUtilsTest {
final AttributeSet attrs = Xml.asAttributeSet(parser);
String entries = PreferenceXmlParserUtils.getDataEntries(mContext, attrs);
String[] expEntries = mContext.getResources()
.getStringArray(R.array.app_install_location_entries);
.getStringArray(R.array.mvno_type_entries);
for (String expEntry : expEntries) {
assertThat(entries).contains(expEntry);
}

View File

@@ -22,8 +22,6 @@ import android.content.Context;
import android.os.UserHandle;
import android.provider.Settings;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,24 +31,17 @@ import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class OneHandedSettingsUtilsTest {
private static final int TIMEOUT_INDEX_NEVER = 0;
private static final int TIMEOUT_INDEX_SHORT = 1;
private static final int TIMEOUT_INDEX_MEDIUM = 2;
private static final int TIMEOUT_INDEX_LONG = 3;
private static final int OFF = 0;
private static final int ON = 1;
private Context mContext;
private String[] mConfigTimeout;
private int mCurrentUserId;
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mCurrentUserId = UserHandle.myUserId();
mConfigTimeout = mContext.getResources().getStringArray(R.array.one_handed_timeout_values);
OneHandedSettingsUtils.setUserId(mCurrentUserId);
}
@@ -94,7 +85,7 @@ public class OneHandedSettingsUtilsTest {
assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.ONE_HANDED_MODE_TIMEOUT,
OneHandedSettingsUtils.OneHandedTimeout.NEVER.getValue(), mCurrentUserId))
.isEqualTo(Integer.parseInt(mConfigTimeout[TIMEOUT_INDEX_NEVER]));
.isEqualTo(0);
}
@Test
@@ -105,7 +96,7 @@ public class OneHandedSettingsUtilsTest {
assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.ONE_HANDED_MODE_TIMEOUT,
OneHandedSettingsUtils.OneHandedTimeout.SHORT.getValue(), mCurrentUserId))
.isEqualTo(Integer.parseInt(mConfigTimeout[TIMEOUT_INDEX_SHORT]));
.isEqualTo(4);
}
@Test
@@ -116,7 +107,7 @@ public class OneHandedSettingsUtilsTest {
assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.ONE_HANDED_MODE_TIMEOUT,
OneHandedSettingsUtils.OneHandedTimeout.MEDIUM.getValue(), mCurrentUserId))
.isEqualTo(Integer.parseInt(mConfigTimeout[TIMEOUT_INDEX_MEDIUM]));
.isEqualTo(8);
}
@Test
@@ -127,6 +118,6 @@ public class OneHandedSettingsUtilsTest {
assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.ONE_HANDED_MODE_TIMEOUT,
OneHandedSettingsUtils.OneHandedTimeout.LONG.getValue(), mCurrentUserId))
.isEqualTo(Integer.parseInt(mConfigTimeout[TIMEOUT_INDEX_LONG]));
.isEqualTo(12);
}
}