Merge "GUP: Fixed some typos and update some values"
This commit is contained in:
@@ -10063,23 +10063,23 @@
|
||||
<!-- 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>
|
||||
|
||||
<!-- Title for Game Update Packages dashboard where developers can configure apps to use GUP or not [CHAR LIMIT=50] -->
|
||||
<string name="gup_dashboard_title">Game Update Packages Preferences</string>
|
||||
<!-- Summary for Game Update Packages dashboard [CHAR LIMIT=50] -->
|
||||
<string name="gup_dashboard_summary">Modify Game Update Packages settings</string>
|
||||
<!-- Title for Game Update Packages preference [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 Package Preferences</string>
|
||||
<!-- Summary for Game Update Package dashboard [CHAR LIMIT=50] -->
|
||||
<string name="gup_dashboard_summary">Modify Game Update Package settings</string>
|
||||
<!-- Title for Game Update Package preference [CHAR LIMIT=50] -->
|
||||
<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>
|
||||
<!-- The gup value for Game Update Packages preference [CHAR LIMIT=50] -->
|
||||
<string name="gup_app_preference_gup">Game Update Packages</string>
|
||||
<!-- The native value for Game Update Packages preference [CHAR LIMIT=50] -->
|
||||
<string name="gup_app_preference_native">Native Graphics Driver</string>
|
||||
<!-- All the values 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 Package</string>
|
||||
<!-- The system value for Game Update Package preference [CHAR LIMIT=50] -->
|
||||
<string name="gup_app_preference_system">System Graphics Driver</string>
|
||||
<!-- All the values for Game Update Package preference [CHAR LIMIT=50] -->
|
||||
<string-array name="gup_app_preference_values">
|
||||
<item>@string/gup_app_preference_default</item>
|
||||
<item>@string/gup_app_preference_gup</item>
|
||||
<item>@string/gup_app_preference_native</item>
|
||||
<item>@string/gup_app_preference_system</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Slices Strings -->
|
||||
|
@@ -48,7 +48,7 @@ public class GupPreferenceController
|
||||
private final String mPreferenceTitle;
|
||||
private final String mPreferenceDefault;
|
||||
private final String mPreferenceGup;
|
||||
private final String mPreferenceNative;
|
||||
private final String mPreferenceSystem;
|
||||
|
||||
private final List<AppInfo> mAppInfos;
|
||||
private final Set<String> mDevOptInApps;
|
||||
@@ -62,7 +62,7 @@ public class GupPreferenceController
|
||||
mPreferenceTitle = resources.getString(R.string.gup_app_preference_title);
|
||||
mPreferenceDefault = resources.getString(R.string.gup_app_preference_default);
|
||||
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.
|
||||
// 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
|
||||
// opt-in and opt-out apps. Then set the new summary text.
|
||||
if (value.equals(mPreferenceNative)) {
|
||||
if (value.equals(mPreferenceSystem)) {
|
||||
mDevOptInApps.remove(packageName);
|
||||
mDevOptOutApps.add(packageName);
|
||||
listPref.setSummary(mPreferenceNative);
|
||||
} else if (value.equals(mPreferenceGup)) {
|
||||
mDevOptInApps.add(packageName);
|
||||
mDevOptOutApps.remove(packageName);
|
||||
listPref.setSummary(mPreferenceGup);
|
||||
} else {
|
||||
mDevOptInApps.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
|
||||
// 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
|
||||
// from Settings.Global.GUP_DEV_OPT_(IN|OUT)_APPS
|
||||
if (mDevOptOutApps.contains(packageName)) {
|
||||
listPreference.setValue(mPreferenceNative);
|
||||
listPreference.setSummary(mPreferenceNative);
|
||||
listPreference.setValue(mPreferenceSystem);
|
||||
listPreference.setSummary(mPreferenceSystem);
|
||||
} else if (mDevOptInApps.contains(packageName)) {
|
||||
listPreference.setValue(mPreferenceGup);
|
||||
listPreference.setSummary(mPreferenceGup);
|
||||
|
@@ -52,7 +52,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
public class GupPreferenceControllerTest {
|
||||
private static final int DEFAULT = 0;
|
||||
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_PKG_NAME = "testPkg";
|
||||
|
||||
@@ -143,7 +143,7 @@ public class GupPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createPreference_configNative_shouldSetNativeAttributes() {
|
||||
public void createPreference_configSystem_shouldSetSystemAttributes() {
|
||||
loadConfig("", TEST_PKG_NAME);
|
||||
final ListPreference preference =
|
||||
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
||||
@@ -153,9 +153,9 @@ public class GupPreferenceControllerTest {
|
||||
assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
|
||||
assertThat(preference.getEntries()).isEqualTo(mValueList);
|
||||
assertThat(preference.getEntryValues()).isEqualTo(mValueList);
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[NATIVE]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[NATIVE]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[NATIVE]);
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[SYSTEM]);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -165,6 +165,8 @@ public class GupPreferenceControllerTest {
|
||||
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
||||
mController.onPreferenceChange(preference, mValueList[DEFAULT]);
|
||||
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[DEFAULT]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[DEFAULT]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[DEFAULT]);
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||
.isEqualTo("");
|
||||
@@ -179,6 +181,8 @@ public class GupPreferenceControllerTest {
|
||||
mController.createListPreference(TEST_PKG_NAME, TEST_APP_NAME);
|
||||
mController.onPreferenceChange(preference, mValueList[GUP]);
|
||||
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||
.isEqualTo(TEST_PKG_NAME);
|
||||
@@ -187,13 +191,15 @@ public class GupPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_selectNative_shouldUpdateAttributesAndSettingsGlobal() {
|
||||
public void onPreferenceChange_selectSystem_shouldUpdateAttributesAndSettingsGlobal() {
|
||||
loadDefaultConfig();
|
||||
final ListPreference preference =
|
||||
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))
|
||||
.isEqualTo("");
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
|
||||
|
Reference in New Issue
Block a user