GUP: Fixed some typos and update some values
Bug: 119221883 Test: make RunSettingsRoboTests Change-Id: I7b1e42cd3a823a72bcd6d61b26c4954c237ff6d0
This commit is contained in:
@@ -10055,23 +10055,23 @@
|
|||||||
<!-- UI debug setting: ANGLE enabled app has been set [CHAR LIMIT=NONE] -->
|
<!-- UI debug setting: ANGLE enabled app has been set [CHAR LIMIT=NONE] -->
|
||||||
<string name="angle_enabled_app_set">ANGLE enabled application: <xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
|
<string name="angle_enabled_app_set">ANGLE enabled application: <xliff:g id="app_name" example="com.company.app">%1$s</xliff:g></string>
|
||||||
|
|
||||||
<!-- Title for Game Update Packages dashboard where developers can configure apps to use GUP or not [CHAR LIMIT=50] -->
|
<!-- Title for Game Update Package dashboard where developers can configure apps to use GUP or not [CHAR LIMIT=50] -->
|
||||||
<string name="gup_dashboard_title">Game Update Packages Preferences</string>
|
<string name="gup_dashboard_title">Game Update Package Preferences</string>
|
||||||
<!-- Summary for Game Update Packages dashboard [CHAR LIMIT=50] -->
|
<!-- Summary for Game Update Package dashboard [CHAR LIMIT=50] -->
|
||||||
<string name="gup_dashboard_summary">Modify Game Update Packages settings</string>
|
<string name="gup_dashboard_summary">Modify Game Update Package settings</string>
|
||||||
<!-- Title for Game Update Packages preference [CHAR LIMIT=50] -->
|
<!-- Title for Game Update Package preference [CHAR LIMIT=50] -->
|
||||||
<string name="gup_app_preference_title">Select Graphics Driver</string>
|
<string name="gup_app_preference_title">Select Graphics Driver</string>
|
||||||
<!-- The default value for Game Update Packages preference [CHAR LIMIT=50] -->
|
<!-- The default value for Game Update Package preference [CHAR LIMIT=50] -->
|
||||||
<string name="gup_app_preference_default">Default</string>
|
<string name="gup_app_preference_default">Default</string>
|
||||||
<!-- The gup value for Game Update Packages preference [CHAR LIMIT=50] -->
|
<!-- The gup value for Game Update Package preference [CHAR LIMIT=50] -->
|
||||||
<string name="gup_app_preference_gup">Game Update Packages</string>
|
<string name="gup_app_preference_gup">Game Update Package</string>
|
||||||
<!-- The native value for Game Update Packages preference [CHAR LIMIT=50] -->
|
<!-- The system value for Game Update Package preference [CHAR LIMIT=50] -->
|
||||||
<string name="gup_app_preference_native">Native Graphics Driver</string>
|
<string name="gup_app_preference_system">System Graphics Driver</string>
|
||||||
<!-- All the values for Game Update Packages preference [CHAR LIMIT=50] -->
|
<!-- All the values for Game Update Package preference [CHAR LIMIT=50] -->
|
||||||
<string-array name="gup_app_preference_values">
|
<string-array name="gup_app_preference_values">
|
||||||
<item>@string/gup_app_preference_default</item>
|
<item>@string/gup_app_preference_default</item>
|
||||||
<item>@string/gup_app_preference_gup</item>
|
<item>@string/gup_app_preference_gup</item>
|
||||||
<item>@string/gup_app_preference_native</item>
|
<item>@string/gup_app_preference_system</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Slices Strings -->
|
<!-- Slices Strings -->
|
||||||
|
@@ -48,7 +48,7 @@ public class GupPreferenceController
|
|||||||
private final String mPreferenceTitle;
|
private final String mPreferenceTitle;
|
||||||
private final String mPreferenceDefault;
|
private final String mPreferenceDefault;
|
||||||
private final String mPreferenceGup;
|
private final String mPreferenceGup;
|
||||||
private final String mPreferenceNative;
|
private final String mPreferenceSystem;
|
||||||
|
|
||||||
private final List<AppInfo> mAppInfos;
|
private final List<AppInfo> mAppInfos;
|
||||||
private final Set<String> mDevOptInApps;
|
private final Set<String> mDevOptInApps;
|
||||||
@@ -62,7 +62,7 @@ public class GupPreferenceController
|
|||||||
mPreferenceTitle = resources.getString(R.string.gup_app_preference_title);
|
mPreferenceTitle = resources.getString(R.string.gup_app_preference_title);
|
||||||
mPreferenceDefault = resources.getString(R.string.gup_app_preference_default);
|
mPreferenceDefault = resources.getString(R.string.gup_app_preference_default);
|
||||||
mPreferenceGup = resources.getString(R.string.gup_app_preference_gup);
|
mPreferenceGup = resources.getString(R.string.gup_app_preference_gup);
|
||||||
mPreferenceNative = resources.getString(R.string.gup_app_preference_native);
|
mPreferenceSystem = resources.getString(R.string.gup_app_preference_system);
|
||||||
|
|
||||||
// TODO: Move this task to background if there's potential ANR/Jank.
|
// TODO: Move this task to background if there's potential ANR/Jank.
|
||||||
// Update the UI when all the app infos are ready.
|
// Update the UI when all the app infos are ready.
|
||||||
@@ -105,19 +105,18 @@ public class GupPreferenceController
|
|||||||
|
|
||||||
// When user choose a new preference, update both Sets for
|
// When user choose a new preference, update both Sets for
|
||||||
// opt-in and opt-out apps. Then set the new summary text.
|
// opt-in and opt-out apps. Then set the new summary text.
|
||||||
if (value.equals(mPreferenceNative)) {
|
if (value.equals(mPreferenceSystem)) {
|
||||||
mDevOptInApps.remove(packageName);
|
mDevOptInApps.remove(packageName);
|
||||||
mDevOptOutApps.add(packageName);
|
mDevOptOutApps.add(packageName);
|
||||||
listPref.setSummary(mPreferenceNative);
|
|
||||||
} else if (value.equals(mPreferenceGup)) {
|
} else if (value.equals(mPreferenceGup)) {
|
||||||
mDevOptInApps.add(packageName);
|
mDevOptInApps.add(packageName);
|
||||||
mDevOptOutApps.remove(packageName);
|
mDevOptOutApps.remove(packageName);
|
||||||
listPref.setSummary(mPreferenceGup);
|
|
||||||
} else {
|
} else {
|
||||||
mDevOptInApps.remove(packageName);
|
mDevOptInApps.remove(packageName);
|
||||||
mDevOptOutApps.remove(packageName);
|
mDevOptOutApps.remove(packageName);
|
||||||
listPref.setSummary(mPreferenceDefault);
|
|
||||||
}
|
}
|
||||||
|
listPref.setValue(value);
|
||||||
|
listPref.setSummary(value);
|
||||||
|
|
||||||
// Push the updated Sets for opt-in and opt-out apps to
|
// Push the updated Sets for opt-in and opt-out apps to
|
||||||
// corresponding Settings.Global.GUP_DEV_OPT_(IN|OUT)_APPS
|
// corresponding Settings.Global.GUP_DEV_OPT_(IN|OUT)_APPS
|
||||||
@@ -189,8 +188,8 @@ public class GupPreferenceController
|
|||||||
// Initialize preference default and summary with the opt in/out choices
|
// Initialize preference default and summary with the opt in/out choices
|
||||||
// from Settings.Global.GUP_DEV_OPT_(IN|OUT)_APPS
|
// from Settings.Global.GUP_DEV_OPT_(IN|OUT)_APPS
|
||||||
if (mDevOptOutApps.contains(packageName)) {
|
if (mDevOptOutApps.contains(packageName)) {
|
||||||
listPreference.setValue(mPreferenceNative);
|
listPreference.setValue(mPreferenceSystem);
|
||||||
listPreference.setSummary(mPreferenceNative);
|
listPreference.setSummary(mPreferenceSystem);
|
||||||
} else if (mDevOptInApps.contains(packageName)) {
|
} else if (mDevOptInApps.contains(packageName)) {
|
||||||
listPreference.setValue(mPreferenceGup);
|
listPreference.setValue(mPreferenceGup);
|
||||||
listPreference.setSummary(mPreferenceGup);
|
listPreference.setSummary(mPreferenceGup);
|
||||||
|
@@ -52,7 +52,7 @@ import org.robolectric.RuntimeEnvironment;
|
|||||||
public class GupPreferenceControllerTest {
|
public class GupPreferenceControllerTest {
|
||||||
private static final int DEFAULT = 0;
|
private static final int DEFAULT = 0;
|
||||||
private static final int GUP = 1;
|
private static final int GUP = 1;
|
||||||
private static final int NATIVE = 2;
|
private static final int SYSTEM = 2;
|
||||||
private static final String TEST_APP_NAME = "testApp";
|
private static final String TEST_APP_NAME = "testApp";
|
||||||
private static final String TEST_PKG_NAME = "testPkg";
|
private static final String TEST_PKG_NAME = "testPkg";
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ public class GupPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createPreference_configNative_shouldSetNativeAttributes() {
|
public void createPreference_configSystem_shouldSetSystemAttributes() {
|
||||||
loadConfig("", TEST_PKG_NAME);
|
loadConfig("", TEST_PKG_NAME);
|
||||||
final ListPreference preference =
|
final ListPreference preference =
|
||||||
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
||||||
@@ -153,9 +153,9 @@ public class GupPreferenceControllerTest {
|
|||||||
assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
|
assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
|
||||||
assertThat(preference.getEntries()).isEqualTo(mValueList);
|
assertThat(preference.getEntries()).isEqualTo(mValueList);
|
||||||
assertThat(preference.getEntryValues()).isEqualTo(mValueList);
|
assertThat(preference.getEntryValues()).isEqualTo(mValueList);
|
||||||
assertThat(preference.getEntry()).isEqualTo(mValueList[NATIVE]);
|
assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
|
||||||
assertThat(preference.getValue()).isEqualTo(mValueList[NATIVE]);
|
assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
|
||||||
assertThat(preference.getSummary()).isEqualTo(mValueList[NATIVE]);
|
assertThat(preference.getSummary()).isEqualTo(mValueList[SYSTEM]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -165,6 +165,8 @@ public class GupPreferenceControllerTest {
|
|||||||
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
||||||
mController.onPreferenceChange(preference, mValueList[DEFAULT]);
|
mController.onPreferenceChange(preference, mValueList[DEFAULT]);
|
||||||
|
|
||||||
|
assertThat(preference.getEntry()).isEqualTo(mValueList[DEFAULT]);
|
||||||
|
assertThat(preference.getValue()).isEqualTo(mValueList[DEFAULT]);
|
||||||
assertThat(preference.getSummary()).isEqualTo(mValueList[DEFAULT]);
|
assertThat(preference.getSummary()).isEqualTo(mValueList[DEFAULT]);
|
||||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||||
.isEqualTo("");
|
.isEqualTo("");
|
||||||
@@ -179,6 +181,8 @@ public class GupPreferenceControllerTest {
|
|||||||
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
||||||
mController.onPreferenceChange(preference, mValueList[GUP]);
|
mController.onPreferenceChange(preference, mValueList[GUP]);
|
||||||
|
|
||||||
|
assertThat(preference.getEntry()).isEqualTo(mValueList[GUP]);
|
||||||
|
assertThat(preference.getValue()).isEqualTo(mValueList[GUP]);
|
||||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GUP]);
|
assertThat(preference.getSummary()).isEqualTo(mValueList[GUP]);
|
||||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||||
.isEqualTo(TEST_PKG_NAME);
|
.isEqualTo(TEST_PKG_NAME);
|
||||||
@@ -187,13 +191,15 @@ public class GupPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_selectNative_shouldUpdateAttributesAndSettingsGlobal() {
|
public void onPreferenceChange_selectSystem_shouldUpdateAttributesAndSettingsGlobal() {
|
||||||
loadDefaultConfig();
|
loadDefaultConfig();
|
||||||
final ListPreference preference =
|
final ListPreference preference =
|
||||||
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
||||||
mController.onPreferenceChange(preference, mValueList[NATIVE]);
|
mController.onPreferenceChange(preference, mValueList[SYSTEM]);
|
||||||
|
|
||||||
assertThat(preference.getSummary()).isEqualTo(mValueList[NATIVE]);
|
assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
|
||||||
|
assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
|
||||||
|
assertThat(preference.getSummary()).isEqualTo(mValueList[SYSTEM]);
|
||||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||||
.isEqualTo("");
|
.isEqualTo("");
|
||||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
|
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
|
||||||
|
Reference in New Issue
Block a user