Merge "Rename game driver to updatable driver." into rvc-dev-plus-aosp am: 60e33309b2

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/12374931

Change-Id: I13794e6cf89c14ea1ebd5a2751e4590f4b7f4c01
This commit is contained in:
TreeHugger Robot
2020-08-17 20:25:53 +00:00
committed by Automerger Merge Worker
13 changed files with 194 additions and 157 deletions

View File

@@ -18,8 +18,8 @@ package com.android.settings.development.graphicsdriver;
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
import static com.google.common.truth.Truth.assertThat;
@@ -57,7 +57,7 @@ public class GraphicsDriverAppPreferenceControllerTest {
private static final int DEFAULT = 0;
private static final int PRERELEASE_DRIVER = 1;
private static final int GAME_DRIVER = 2;
private static final int PRODUCTION_DRIVER = 2;
private static final int SYSTEM = 3;
private static final String TEST_APP_NAME = "testApp";
private static final String TEST_PKG_NAME = "testPkg";
@@ -99,11 +99,11 @@ public class GraphicsDriverAppPreferenceControllerTest {
}
@Test
public void getAvailability_developmentSettingsEnabledAndGameDriverOn_available() {
public void getAvailability_developmentSettingsEnabledAndProductionDriverOn_available() {
loadDefaultConfig();
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
@@ -119,7 +119,8 @@ public class GraphicsDriverAppPreferenceControllerTest {
@Test
public void getAvailability_graphicsDriverOff_conditionallyUnavailable() {
loadDefaultConfig();
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
}
@@ -157,7 +158,7 @@ public class GraphicsDriverAppPreferenceControllerTest {
public void updateState_available_visible() {
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
loadDefaultConfig();
assertThat(mGroup.isVisible()).isTrue();
@@ -165,7 +166,8 @@ public class GraphicsDriverAppPreferenceControllerTest {
@Test
public void updateState_graphicsDriverOff_notVisible() {
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
loadDefaultConfig();
assertThat(mGroup.isVisible()).isFalse();
@@ -188,7 +190,7 @@ public class GraphicsDriverAppPreferenceControllerTest {
}
@Test
public void createPreference_configGAME_DRIVER_shouldSetGameDriverAttributes() {
public void createPreference_configProduction_DRIVER_shouldSetProductionDriverAttributes() {
loadConfig(TEST_PKG_NAME, "", "");
final ListPreference preference =
mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
@@ -198,9 +200,9 @@ public class GraphicsDriverAppPreferenceControllerTest {
assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
assertThat(preference.getEntries()).isEqualTo(mValueList);
assertThat(preference.getEntryValues()).isEqualTo(mValueList);
assertThat(preference.getEntry()).isEqualTo(mValueList[GAME_DRIVER]);
assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
assertThat(preference.getEntry()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
assertThat(preference.getValue()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
assertThat(preference.getSummary()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
}
@Test
@@ -245,9 +247,11 @@ public class GraphicsDriverAppPreferenceControllerTest {
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.GAME_DRIVER_OPT_IN_APPS))
assertThat(Settings.Global.getString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS))
.isEqualTo("");
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS))
assertThat(Settings.Global.getString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS))
.isEqualTo("");
}
@@ -262,25 +266,28 @@ public class GraphicsDriverAppPreferenceControllerTest {
assertThat(preference.getValue()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
assertThat(preference.getSummary()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
assertThat(Settings.Global.getString(mResolver,
Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS))
Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS))
.isEqualTo(TEST_PKG_NAME);
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS))
assertThat(Settings.Global.getString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS))
.isEqualTo("");
}
@Test
public void onPreferenceChange_selectGAME_DRIVER_shouldUpdateAttributesAndSettingsGlobal() {
public void onPreferenceChange_selectPRODUCTION_DRIVER_shouldUpdateAttrAndSettingsGlobal() {
loadDefaultConfig();
final ListPreference preference =
mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
mController.onPreferenceChange(preference, mValueList[GAME_DRIVER]);
mController.onPreferenceChange(preference, mValueList[PRODUCTION_DRIVER]);
assertThat(preference.getEntry()).isEqualTo(mValueList[GAME_DRIVER]);
assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS))
assertThat(preference.getEntry()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
assertThat(preference.getValue()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
assertThat(preference.getSummary()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
assertThat(Settings.Global.getString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS))
.isEqualTo(TEST_PKG_NAME);
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS))
assertThat(Settings.Global.getString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS))
.isEqualTo("");
}
@@ -294,9 +301,11 @@ public class GraphicsDriverAppPreferenceControllerTest {
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.GAME_DRIVER_OPT_IN_APPS))
assertThat(Settings.Global.getString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS))
.isEqualTo("");
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS))
assertThat(Settings.Global.getString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS))
.isEqualTo(TEST_PKG_NAME);
}
@@ -320,10 +329,13 @@ public class GraphicsDriverAppPreferenceControllerTest {
}
private void loadConfig(String optIn, String prereleaseOptIn, String optOut) {
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS, optIn);
Settings.Global.putString(mResolver,
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS, optIn);
Settings.Global.putString(
mResolver, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, prereleaseOptIn);
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS, optOut);
mResolver, Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
prereleaseOptIn);
Settings.Global.putString(
mResolver, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS, optOut);
mController = new GraphicsDriverAppPreferenceController(mContext, "testKey");
mController.mEntryList = mContext.getResources().getStringArray(

View File

@@ -58,7 +58,7 @@ public class GraphicsDriverContentObserverTest {
mGraphicsDriverContentObserver.register(mResolver);
verify(mResolver).registerContentObserver(
Settings.Global.getUriFor(Settings.Global.GAME_DRIVER_ALL_APPS), false,
Settings.Global.getUriFor(Settings.Global.UPDATABLE_DRIVER_ALL_APPS), false,
mGraphicsDriverContentObserver);
}

View File

@@ -45,7 +45,7 @@ public class GraphicsDriverDashboardTest {
@Test
public void getMetricesCategory_shouldReturnGraphicsDriverDashboard() {
assertThat(mDashboard.getMetricsCategory())
.isEqualTo(SettingsEnums.SETTINGS_GAME_DRIVER_DASHBOARD);
.isEqualTo(SettingsEnums.SETTINGS_GRAPHICS_DRIVER_DASHBOARD);
}
@Test

View File

@@ -18,10 +18,10 @@ package com.android.settings.development.graphicsdriver;
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_PRERELEASE_ALL_APPS;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_PRERELEASE_ALL_APPS;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_PRODUCTION_ALL_APPS;
import static com.google.common.truth.Truth.assertThat;
@@ -61,7 +61,7 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
private ContentResolver mResolver;
private GraphicsDriverEnableForAllAppsPreferenceController mController;
private String mPreferenceDefault;
private String mPreferenceGameDriver;
private String mPreferenceProductionDriver;
private String mPreferencePrereleaseDriver;
@Before
@@ -72,14 +72,14 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
final Resources resources = mContext.getResources();
mPreferenceDefault = resources.getString(R.string.graphics_driver_app_preference_default);
mPreferenceGameDriver =
resources.getString(R.string.graphics_driver_app_preference_game_driver);
mPreferenceProductionDriver =
resources.getString(R.string.graphics_driver_app_preference_production_driver);
mPreferencePrereleaseDriver =
resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController = new GraphicsDriverEnableForAllAppsPreferenceController(mContext, "testKey");
mController.mEntryList = mContext.getResources().getStringArray(
@@ -89,9 +89,9 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
}
@Test
public void getAvailability_developmentSettingsEnabledAndGameDriverSettingsOn_available() {
public void getAvailability_developmentSettingsEnabledAndUpdatableDriverSettingsOn_available() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
@@ -104,8 +104,9 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
}
@Test
public void getAvailability_gameDriverOff_conditionallyUnavailable() {
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
public void getAvailability_updatableDriverOff_conditionallyUnavailable() {
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
}
@@ -113,7 +114,7 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
@Test
public void displayPreference_shouldAddListPreference() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController.updateState(mPreference);
verify(mPreference).setValue(mPreferenceDefault);
@@ -139,7 +140,7 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
@Test
public void updateState_availableAndDefault_visibleAndDefault() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController.updateState(mPreference);
verify(mPreference, atLeastOnce()).setVisible(true);
@@ -148,20 +149,22 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
}
@Test
public void updateState_availableAndGameDriver_visibleAndGameDriver() {
public void updateState_availableAndProductionDriver_visibleAndProductionDriver() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_PRODUCTION_ALL_APPS);
mController.updateState(mPreference);
verify(mPreference, atLeastOnce()).setVisible(true);
verify(mPreference).setValue(mPreferenceGameDriver);
verify(mPreference).setSummary(mPreferenceGameDriver);
verify(mPreference).setValue(mPreferenceProductionDriver);
verify(mPreference).setSummary(mPreferenceProductionDriver);
}
@Test
public void updateState_availableAndPrereleaseDriver_visibleAndPrereleaseDriver() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_PRERELEASE_ALL_APPS);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_PRERELEASE_ALL_APPS);
mController.updateState(mPreference);
verify(mPreference, atLeastOnce()).setVisible(true);
@@ -170,8 +173,9 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
}
@Test
public void updateState_gameDriverOff_notVisibleAndSystemDriver() {
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
public void updateState_updatableDriverOff_notVisibleAndSystemDriver() {
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
mController.updateState(mPreference);
verify(mPreference).setVisible(false);
@@ -182,33 +186,35 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
@Test
public void onPreferenceChange_default_shouldUpdateSettingsGlobal() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_PRODUCTION_ALL_APPS);
mController.onPreferenceChange(mPreference, mPreferenceDefault);
assertThat(Settings.Global.getInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
.isEqualTo(GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_DEFAULT))
.isEqualTo(UPDATABLE_DRIVER_DEFAULT);
}
@Test
public void onPreferenceChange_gameDriver_shouldUpdateSettingsGlobal() {
public void onPreferenceChange_updatableDriver_shouldUpdateSettingsGlobal() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mController.onPreferenceChange(mPreference, mPreferenceGameDriver);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController.onPreferenceChange(mPreference, mPreferenceProductionDriver);
assertThat(Settings.Global.getInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
.isEqualTo(GAME_DRIVER_ALL_APPS);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT))
.isEqualTo(UPDATABLE_DRIVER_PRODUCTION_ALL_APPS);
}
@Test
public void onPreferenceChange_prereleaseDriver_shouldUpdateSettingsGlobal() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController.onPreferenceChange(mPreference, mPreferencePrereleaseDriver);
assertThat(Settings.Global.getInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
.isEqualTo(GAME_DRIVER_PRERELEASE_ALL_APPS);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT))
.isEqualTo(UPDATABLE_DRIVER_PRERELEASE_ALL_APPS);
}
}

View File

@@ -18,9 +18,9 @@ package com.android.settings.development.graphicsdriver;
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_PRODUCTION_ALL_APPS;
import static com.google.common.truth.Truth.assertThat;
@@ -68,24 +68,26 @@ public class GraphicsDriverFooterPreferenceControllerTest {
}
@Test
public void getAvailabilityStatus_gameDriverOff_availableUnsearchable() {
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
public void getAvailabilityStatus_updatableDriverOff_availableUnsearchable() {
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
}
@Test
public void getAvailabilityStatus_gameDriverDefault_conditionallyUnavailable() {
public void getAvailabilityStatus_updatableDriverDefault_conditionallyUnavailable() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
}
@Test
public void getAvailabilityStatus_gameDriverAllApps_conditionallyUnavailable() {
public void getAvailabilityStatus_updatableProductionDriverAllApps_conditionallyUnavailable() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_PRODUCTION_ALL_APPS);
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
}

View File

@@ -16,8 +16,8 @@
package com.android.settings.development.graphicsdriver;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_DEFAULT;
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
import static com.google.common.truth.Truth.assertThat;
@@ -61,9 +61,9 @@ public class GraphicsDriverGlobalSwitchBarControllerTest {
}
@Test
public void constructor_gameDriverOn_shouldCheckSwitchBar() {
public void constructor_updatableDriverOn_shouldCheckSwitchBar() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController = new GraphicsDriverGlobalSwitchBarController(
mContext, new SwitchBarController(mSwitchBar));
@@ -71,8 +71,9 @@ public class GraphicsDriverGlobalSwitchBarControllerTest {
}
@Test
public void constructor_gameDriverOff_shouldUncheckSwitchBar() {
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
public void constructor_updatableDriverOff_shouldUncheckSwitchBar() {
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
mController = new GraphicsDriverGlobalSwitchBarController(
mContext, new SwitchBarController(mSwitchBar));
@@ -122,27 +123,30 @@ public class GraphicsDriverGlobalSwitchBarControllerTest {
}
@Test
public void onSwitchToggled_checked_shouldTurnOnGameDriver() {
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
public void onSwitchToggled_checked_shouldTurnOnUpdatableDriver() {
Settings.Global.putInt(mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_OFF);
mController = new GraphicsDriverGlobalSwitchBarController(
mContext, new SwitchBarController(mSwitchBar));
mController.onSwitchToggled(true);
assertThat(Settings.Global.getInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
.isEqualTo(GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_DEFAULT))
.isEqualTo(UPDATABLE_DRIVER_DEFAULT);
}
@Test
public void onSwitchToggled_unchecked_shouldTurnOffGameDriver() {
public void onSwitchToggled_unchecked_shouldTurnOffUpdatableDriver() {
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
mController = new GraphicsDriverGlobalSwitchBarController(
mContext, new SwitchBarController(mSwitchBar));
mController.onSwitchToggled(false);
assertThat(Settings.Global.getInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
.isEqualTo(GAME_DRIVER_OFF);
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
UPDATABLE_DRIVER_DEFAULT))
.isEqualTo(UPDATABLE_DRIVER_OFF);
}
}