Merge "Rename game driver to updatable driver." into rvc-dev-plus-aosp am: 60e33309b2
am: e87f0d9fa2
am: ef7b3433a9
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/12374931 Change-Id: I1ae5cd31a99659d6240c756cc88601185c40b25b
This commit is contained in:
@@ -11323,23 +11323,23 @@
|
|||||||
<string name="graphics_driver_app_preference_title">Select Graphics Driver</string>
|
<string name="graphics_driver_app_preference_title">Select Graphics Driver</string>
|
||||||
<!-- The default value of graphics driver preference for app [CHAR LIMIT=50] -->
|
<!-- The default value of graphics driver preference for app [CHAR LIMIT=50] -->
|
||||||
<string name="graphics_driver_app_preference_default">Default</string>
|
<string name="graphics_driver_app_preference_default">Default</string>
|
||||||
<!-- The game driver value for Game Driver app preference [CHAR LIMIT=50] -->
|
<!-- The value for updatable production driver app preference [CHAR LIMIT=50] -->
|
||||||
<string name="graphics_driver_app_preference_game_driver">Game Driver</string>
|
<string name="graphics_driver_app_preference_production_driver">Game Driver</string>
|
||||||
<!-- The prerelase driver value for Developer Driver app preference [CHAR LIMIT=50] -->
|
<!-- The value for updatable developer driver app preference [CHAR LIMIT=50] -->
|
||||||
<string name="graphics_driver_app_preference_prerelease_driver">Developer Driver</string>
|
<string name="graphics_driver_app_preference_prerelease_driver">Developer Driver</string>
|
||||||
<!-- The system driver value for system graphics driver app preference [CHAR LIMIT=50] -->
|
<!-- The system driver value for system graphics driver app preference [CHAR LIMIT=50] -->
|
||||||
<string name="graphics_driver_app_preference_system">System Graphics Driver</string>
|
<string name="graphics_driver_app_preference_system">System Graphics Driver</string>
|
||||||
<!-- All the graphics driver preference values for all apps globally [CHAR LIMIT=50] -->
|
<!-- All the graphics driver preference values for all apps globally [CHAR LIMIT=50] -->
|
||||||
<string-array name="graphics_driver_all_apps_preference_values">
|
<string-array name="graphics_driver_all_apps_preference_values">
|
||||||
<item>@string/graphics_driver_app_preference_default</item>
|
<item>@string/graphics_driver_app_preference_default</item>
|
||||||
<item>@string/graphics_driver_app_preference_game_driver</item>
|
<item>@string/graphics_driver_app_preference_production_driver</item>
|
||||||
<item>@string/graphics_driver_app_preference_prerelease_driver</item>
|
<item>@string/graphics_driver_app_preference_prerelease_driver</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<!-- All the values of graphics driver for app preference [CHAR LIMIT=50] -->
|
<!-- All the values of graphics driver for app preference [CHAR LIMIT=50] -->
|
||||||
<string-array name="graphics_driver_app_preference_values">
|
<string-array name="graphics_driver_app_preference_values">
|
||||||
<item>@string/graphics_driver_app_preference_default</item>
|
<item>@string/graphics_driver_app_preference_default</item>
|
||||||
<item>@string/graphics_driver_app_preference_prerelease_driver</item>
|
<item>@string/graphics_driver_app_preference_prerelease_driver</item>
|
||||||
<item>@string/graphics_driver_app_preference_game_driver</item>
|
<item>@string/graphics_driver_app_preference_production_driver</item>
|
||||||
<item>@string/graphics_driver_app_preference_system</item>
|
<item>@string/graphics_driver_app_preference_system</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.development.graphicsdriver;
|
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.UPDATABLE_DRIVER_DEFAULT;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -62,7 +62,7 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
|||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
private final String mPreferenceTitle;
|
private final String mPreferenceTitle;
|
||||||
private final String mPreferenceDefault;
|
private final String mPreferenceDefault;
|
||||||
private final String mPreferenceGameDriver;
|
private final String mPreferenceProductionDriver;
|
||||||
private final String mPreferencePrereleaseDriver;
|
private final String mPreferencePrereleaseDriver;
|
||||||
private final String mPreferenceSystem;
|
private final String mPreferenceSystem;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -88,8 +88,8 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
|||||||
final Resources resources = context.getResources();
|
final Resources resources = context.getResources();
|
||||||
mPreferenceTitle = resources.getString(R.string.graphics_driver_app_preference_title);
|
mPreferenceTitle = resources.getString(R.string.graphics_driver_app_preference_title);
|
||||||
mPreferenceDefault = resources.getString(R.string.graphics_driver_app_preference_default);
|
mPreferenceDefault = resources.getString(R.string.graphics_driver_app_preference_default);
|
||||||
mPreferenceGameDriver =
|
mPreferenceProductionDriver =
|
||||||
resources.getString(R.string.graphics_driver_app_preference_game_driver);
|
resources.getString(R.string.graphics_driver_app_preference_production_driver);
|
||||||
mPreferencePrereleaseDriver =
|
mPreferencePrereleaseDriver =
|
||||||
resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
|
resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
|
||||||
mPreferenceSystem = resources.getString(R.string.graphics_driver_app_preference_system);
|
mPreferenceSystem = resources.getString(R.string.graphics_driver_app_preference_system);
|
||||||
@@ -101,19 +101,21 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
|||||||
mAppInfos = getAppInfos(context);
|
mAppInfos = getAppInfos(context);
|
||||||
|
|
||||||
mDevOptInApps =
|
mDevOptInApps =
|
||||||
getGlobalSettingsString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS);
|
getGlobalSettingsString(mContentResolver,
|
||||||
|
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS);
|
||||||
mDevPrereleaseOptInApps = getGlobalSettingsString(
|
mDevPrereleaseOptInApps = getGlobalSettingsString(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS);
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS);
|
||||||
mDevOptOutApps =
|
mDevOptOutApps =
|
||||||
getGlobalSettingsString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS);
|
getGlobalSettingsString(mContentResolver,
|
||||||
|
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)
|
return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)
|
||||||
&& (Settings.Global.getInt(mContentResolver,
|
&& (Settings.Global.getInt(mContentResolver,
|
||||||
Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT)
|
Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT)
|
||||||
!= GAME_DRIVER_OFF)
|
!= UPDATABLE_DRIVER_OFF)
|
||||||
? AVAILABLE
|
? AVAILABLE
|
||||||
: CONDITIONALLY_UNAVAILABLE;
|
: CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -157,7 +159,7 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
|||||||
mDevOptInApps.remove(packageName);
|
mDevOptInApps.remove(packageName);
|
||||||
mDevPrereleaseOptInApps.remove(packageName);
|
mDevPrereleaseOptInApps.remove(packageName);
|
||||||
mDevOptOutApps.add(packageName);
|
mDevOptOutApps.add(packageName);
|
||||||
} else if (value.equals(mPreferenceGameDriver)) {
|
} else if (value.equals(mPreferenceProductionDriver)) {
|
||||||
mDevOptInApps.add(packageName);
|
mDevOptInApps.add(packageName);
|
||||||
mDevPrereleaseOptInApps.remove(packageName);
|
mDevPrereleaseOptInApps.remove(packageName);
|
||||||
mDevOptOutApps.remove(packageName);
|
mDevOptOutApps.remove(packageName);
|
||||||
@@ -174,13 +176,15 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
|||||||
listPref.setSummary(value);
|
listPref.setSummary(value);
|
||||||
|
|
||||||
// Push the updated Sets for stable/prerelease opt-in and opt-out apps to
|
// Push the updated Sets for stable/prerelease opt-in and opt-out apps to
|
||||||
// corresponding Settings.Global.GAME_DRIVER(_PRERELEASE)?_OPT_(IN|OUT)_APPS
|
// corresponding Settings.Global.UPDATABLE_DRIVER_[PRODUCTION|PRERELEASE]_OPT_(IN|OUT)_APPS
|
||||||
Settings.Global.putString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS,
|
Settings.Global.putString(mContentResolver,
|
||||||
|
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS,
|
||||||
String.join(",", mDevOptInApps));
|
String.join(",", mDevOptInApps));
|
||||||
Settings.Global.putString(mContentResolver,
|
Settings.Global.putString(mContentResolver,
|
||||||
Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS,
|
Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
|
||||||
String.join(",", mDevPrereleaseOptInApps));
|
String.join(",", mDevPrereleaseOptInApps));
|
||||||
Settings.Global.putString(mContentResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS,
|
Settings.Global.putString(mContentResolver,
|
||||||
|
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS,
|
||||||
String.join(",", mDevOptOutApps));
|
String.join(",", mDevOptOutApps));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -251,7 +255,7 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
|||||||
listPreference.setEntryValues(mEntryList);
|
listPreference.setEntryValues(mEntryList);
|
||||||
|
|
||||||
// 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.GAME_DRIVER(_PRERELEASE)?_OPT_(IN|OUT)_APPS
|
// from Settings.Global.UPDATABLE_DRIVER_[PRODUCTION|PRERELEASE]_OPT_[IN|OUT]_APPS
|
||||||
if (mDevOptOutApps.contains(packageName)) {
|
if (mDevOptOutApps.contains(packageName)) {
|
||||||
listPreference.setValue(mPreferenceSystem);
|
listPreference.setValue(mPreferenceSystem);
|
||||||
listPreference.setSummary(mPreferenceSystem);
|
listPreference.setSummary(mPreferenceSystem);
|
||||||
@@ -259,8 +263,8 @@ public class GraphicsDriverAppPreferenceController extends BasePreferenceControl
|
|||||||
listPreference.setValue(mPreferencePrereleaseDriver);
|
listPreference.setValue(mPreferencePrereleaseDriver);
|
||||||
listPreference.setSummary(mPreferencePrereleaseDriver);
|
listPreference.setSummary(mPreferencePrereleaseDriver);
|
||||||
} else if (mDevOptInApps.contains(packageName)) {
|
} else if (mDevOptInApps.contains(packageName)) {
|
||||||
listPreference.setValue(mPreferenceGameDriver);
|
listPreference.setValue(mPreferenceProductionDriver);
|
||||||
listPreference.setSummary(mPreferenceGameDriver);
|
listPreference.setSummary(mPreferenceProductionDriver);
|
||||||
} else {
|
} else {
|
||||||
listPreference.setValue(mPreferenceDefault);
|
listPreference.setValue(mPreferenceDefault);
|
||||||
listPreference.setSummary(mPreferenceDefault);
|
listPreference.setSummary(mPreferenceDefault);
|
||||||
|
@@ -52,7 +52,7 @@ public class GraphicsDriverContentObserver extends ContentObserver {
|
|||||||
*/
|
*/
|
||||||
public void register(ContentResolver contentResolver) {
|
public void register(ContentResolver contentResolver) {
|
||||||
contentResolver.registerContentObserver(
|
contentResolver.registerContentObserver(
|
||||||
Settings.Global.getUriFor(Settings.Global.GAME_DRIVER_ALL_APPS), false, this);
|
Settings.Global.getUriFor(Settings.Global.UPDATABLE_DRIVER_ALL_APPS), false, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -30,7 +30,7 @@ import com.android.settingslib.development.DevelopmentSettingsEnabler;
|
|||||||
import com.android.settingslib.search.SearchIndexable;
|
import com.android.settingslib.search.SearchIndexable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dashboard for Game Driver preferences.
|
* Dashboard for Graphics Driver preferences.
|
||||||
*/
|
*/
|
||||||
@SearchIndexable
|
@SearchIndexable
|
||||||
public class GraphicsDriverDashboard extends DashboardFragment {
|
public class GraphicsDriverDashboard extends DashboardFragment {
|
||||||
@@ -39,7 +39,7 @@ public class GraphicsDriverDashboard extends DashboardFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.SETTINGS_GAME_DRIVER_DASHBOARD;
|
return SettingsEnums.SETTINGS_GRAPHICS_DRIVER_DASHBOARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -46,24 +46,24 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller of global switch to enable Game Driver for all Apps.
|
* Controller of global switch to enable updatable driver for all Apps.
|
||||||
*/
|
*/
|
||||||
public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePreferenceController
|
public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePreferenceController
|
||||||
implements Preference.OnPreferenceChangeListener,
|
implements Preference.OnPreferenceChangeListener,
|
||||||
GraphicsDriverContentObserver.OnGraphicsDriverContentChangedListener,
|
GraphicsDriverContentObserver.OnGraphicsDriverContentChangedListener,
|
||||||
LifecycleObserver, OnStart, OnStop {
|
LifecycleObserver, OnStart, OnStop {
|
||||||
|
|
||||||
public static final int GAME_DRIVER_DEFAULT = 0;
|
public static final int UPDATABLE_DRIVER_DEFAULT = 0;
|
||||||
public static final int GAME_DRIVER_ALL_APPS = 1;
|
public static final int UPDATABLE_DRIVER_PRODUCTION_ALL_APPS = 1;
|
||||||
public static final int GAME_DRIVER_PRERELEASE_ALL_APPS = 2;
|
public static final int UPDATABLE_DRIVER_PRERELEASE_ALL_APPS = 2;
|
||||||
public static final int GAME_DRIVER_OFF = 3;
|
public static final int UPDATABLE_DRIVER_OFF = 3;
|
||||||
public static final String PROPERTY_GFX_DRIVER_GAME = "ro.gfx.driver.0";
|
public static final String PROPERTY_GFX_DRIVER_PRODUCTION = "ro.gfx.driver.0";
|
||||||
public static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1";
|
public static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1";
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
private final String mPreferenceDefault;
|
private final String mPreferenceDefault;
|
||||||
private final String mPreferenceGameDriver;
|
private final String mPreferenceProductionDriver;
|
||||||
private final String mPreferencePrereleaseDriver;
|
private final String mPreferencePrereleaseDriver;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
CharSequence[] mEntryList;
|
CharSequence[] mEntryList;
|
||||||
@@ -79,8 +79,8 @@ public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePref
|
|||||||
|
|
||||||
final Resources resources = context.getResources();
|
final Resources resources = context.getResources();
|
||||||
mPreferenceDefault = resources.getString(R.string.graphics_driver_app_preference_default);
|
mPreferenceDefault = resources.getString(R.string.graphics_driver_app_preference_default);
|
||||||
mPreferenceGameDriver =
|
mPreferenceProductionDriver =
|
||||||
resources.getString(R.string.graphics_driver_app_preference_game_driver);
|
resources.getString(R.string.graphics_driver_app_preference_production_driver);
|
||||||
mPreferencePrereleaseDriver =
|
mPreferencePrereleaseDriver =
|
||||||
resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
|
resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
|
||||||
mEntryList = constructEntryList(mContext, false);
|
mEntryList = constructEntryList(mContext, false);
|
||||||
@@ -92,8 +92,9 @@ public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePref
|
|||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)
|
return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)
|
||||||
&& (Settings.Global.getInt(mContentResolver,
|
&& (Settings.Global.getInt(mContentResolver,
|
||||||
Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT)
|
Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
!= GAME_DRIVER_OFF)
|
UPDATABLE_DRIVER_DEFAULT)
|
||||||
|
!= UPDATABLE_DRIVER_OFF)
|
||||||
? AVAILABLE
|
? AVAILABLE
|
||||||
: CONDITIONALLY_UNAVAILABLE;
|
: CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -122,11 +123,12 @@ public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePref
|
|||||||
final ListPreference listPref = (ListPreference) preference;
|
final ListPreference listPref = (ListPreference) preference;
|
||||||
listPref.setVisible(isAvailable());
|
listPref.setVisible(isAvailable());
|
||||||
final int currentChoice = Settings.Global.getInt(
|
final int currentChoice = Settings.Global.getInt(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
if (currentChoice == GAME_DRIVER_ALL_APPS) {
|
UPDATABLE_DRIVER_DEFAULT);
|
||||||
listPref.setValue(mPreferenceGameDriver);
|
if (currentChoice == UPDATABLE_DRIVER_PRODUCTION_ALL_APPS) {
|
||||||
listPref.setSummary(mPreferenceGameDriver);
|
listPref.setValue(mPreferenceProductionDriver);
|
||||||
} else if (currentChoice == GAME_DRIVER_PRERELEASE_ALL_APPS) {
|
listPref.setSummary(mPreferenceProductionDriver);
|
||||||
|
} else if (currentChoice == UPDATABLE_DRIVER_PRERELEASE_ALL_APPS) {
|
||||||
listPref.setValue(mPreferencePrereleaseDriver);
|
listPref.setValue(mPreferencePrereleaseDriver);
|
||||||
listPref.setSummary(mPreferencePrereleaseDriver);
|
listPref.setSummary(mPreferencePrereleaseDriver);
|
||||||
} else {
|
} else {
|
||||||
@@ -140,21 +142,22 @@ public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePref
|
|||||||
final ListPreference listPref = (ListPreference) preference;
|
final ListPreference listPref = (ListPreference) preference;
|
||||||
final String value = newValue.toString();
|
final String value = newValue.toString();
|
||||||
final int currentChoice = Settings.Global.getInt(
|
final int currentChoice = Settings.Global.getInt(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
|
UPDATABLE_DRIVER_DEFAULT);
|
||||||
final int userChoice;
|
final int userChoice;
|
||||||
if (value.equals(mPreferenceGameDriver)) {
|
if (value.equals(mPreferenceProductionDriver)) {
|
||||||
userChoice = GAME_DRIVER_ALL_APPS;
|
userChoice = UPDATABLE_DRIVER_PRODUCTION_ALL_APPS;
|
||||||
} else if (value.equals(mPreferencePrereleaseDriver)) {
|
} else if (value.equals(mPreferencePrereleaseDriver)) {
|
||||||
userChoice = GAME_DRIVER_PRERELEASE_ALL_APPS;
|
userChoice = UPDATABLE_DRIVER_PRERELEASE_ALL_APPS;
|
||||||
} else {
|
} else {
|
||||||
userChoice = GAME_DRIVER_DEFAULT;
|
userChoice = UPDATABLE_DRIVER_DEFAULT;
|
||||||
}
|
}
|
||||||
listPref.setValue(value);
|
listPref.setValue(value);
|
||||||
listPref.setSummary(value);
|
listPref.setSummary(value);
|
||||||
|
|
||||||
if (userChoice != currentChoice) {
|
if (userChoice != currentChoice) {
|
||||||
Settings.Global.putInt(
|
Settings.Global.putInt(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, userChoice);
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, userChoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -172,7 +175,8 @@ public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePref
|
|||||||
final Resources resources = context.getResources();
|
final Resources resources = context.getResources();
|
||||||
final String prereleaseDriverPackageName =
|
final String prereleaseDriverPackageName =
|
||||||
SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE);
|
SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE);
|
||||||
final String gameDriverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER_GAME);
|
final String productionDriverPackageName =
|
||||||
|
SystemProperties.get(PROPERTY_GFX_DRIVER_PRODUCTION);
|
||||||
|
|
||||||
List<CharSequence> entryList = new ArrayList<>();
|
List<CharSequence> entryList = new ArrayList<>();
|
||||||
entryList.add(resources.getString(R.string.graphics_driver_app_preference_default));
|
entryList.add(resources.getString(R.string.graphics_driver_app_preference_default));
|
||||||
@@ -182,9 +186,10 @@ public class GraphicsDriverEnableForAllAppsPreferenceController extends BasePref
|
|||||||
entryList.add(resources.getString(
|
entryList.add(resources.getString(
|
||||||
R.string.graphics_driver_app_preference_prerelease_driver));
|
R.string.graphics_driver_app_preference_prerelease_driver));
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(gameDriverPackageName)
|
if (!TextUtils.isEmpty(productionDriverPackageName)
|
||||||
&& hasDriverPackage(pm, gameDriverPackageName)) {
|
&& hasDriverPackage(pm, productionDriverPackageName)) {
|
||||||
entryList.add(resources.getString(R.string.graphics_driver_app_preference_game_driver));
|
entryList.add(resources.getString(
|
||||||
|
R.string.graphics_driver_app_preference_production_driver));
|
||||||
}
|
}
|
||||||
if (withSystem) {
|
if (withSystem) {
|
||||||
entryList.add(resources.getString(R.string.graphics_driver_app_preference_system));
|
entryList.add(resources.getString(R.string.graphics_driver_app_preference_system));
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.development.graphicsdriver;
|
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.UPDATABLE_DRIVER_DEFAULT;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -58,8 +58,9 @@ public class GraphicsDriverFooterPreferenceController extends BasePreferenceCont
|
|||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
return Settings.Global.getInt(
|
return Settings.Global.getInt(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT)
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
== GAME_DRIVER_OFF
|
UPDATABLE_DRIVER_DEFAULT)
|
||||||
|
== UPDATABLE_DRIVER_OFF
|
||||||
? AVAILABLE_UNSEARCHABLE
|
? AVAILABLE_UNSEARCHABLE
|
||||||
: CONDITIONALLY_UNAVAILABLE;
|
: CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package com.android.settings.development.graphicsdriver;
|
package com.android.settings.development.graphicsdriver;
|
||||||
|
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_DEFAULT;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_PRERELEASE_ALL_APPS;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_PRERELEASE_ALL_APPS;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_PRODUCTION_ALL_APPS;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -36,7 +36,7 @@ import com.android.settingslib.core.lifecycle.events.OnStop;
|
|||||||
import com.android.settingslib.development.DevelopmentSettingsEnabler;
|
import com.android.settingslib.development.DevelopmentSettingsEnabler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller of global switch bar used to fully turn off Game Driver.
|
* Controller of global switch bar used to fully turn off updatable driver.
|
||||||
*/
|
*/
|
||||||
public class GraphicsDriverGlobalSwitchBarController
|
public class GraphicsDriverGlobalSwitchBarController
|
||||||
implements SwitchWidgetController.OnSwitchChangeListener,
|
implements SwitchWidgetController.OnSwitchChangeListener,
|
||||||
@@ -61,8 +61,9 @@ public class GraphicsDriverGlobalSwitchBarController
|
|||||||
DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context));
|
DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context));
|
||||||
mSwitchWidgetController.setChecked(
|
mSwitchWidgetController.setChecked(
|
||||||
Settings.Global.getInt(
|
Settings.Global.getInt(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT)
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
!= GAME_DRIVER_OFF);
|
UPDATABLE_DRIVER_DEFAULT)
|
||||||
|
!= UPDATABLE_DRIVER_OFF);
|
||||||
mSwitchWidgetController.setListener(this);
|
mSwitchWidgetController.setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,21 +82,22 @@ public class GraphicsDriverGlobalSwitchBarController
|
|||||||
@Override
|
@Override
|
||||||
public boolean onSwitchToggled(boolean isChecked) {
|
public boolean onSwitchToggled(boolean isChecked) {
|
||||||
final int graphicsDriverGlobalOption = Settings.Global.getInt(
|
final int graphicsDriverGlobalOption = Settings.Global.getInt(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
|
UPDATABLE_DRIVER_DEFAULT);
|
||||||
|
|
||||||
if (isChecked
|
if (isChecked
|
||||||
&& (graphicsDriverGlobalOption == GAME_DRIVER_DEFAULT
|
&& (graphicsDriverGlobalOption == UPDATABLE_DRIVER_DEFAULT
|
||||||
|| graphicsDriverGlobalOption == GAME_DRIVER_ALL_APPS
|
|| graphicsDriverGlobalOption == UPDATABLE_DRIVER_PRODUCTION_ALL_APPS
|
||||||
|| graphicsDriverGlobalOption == GAME_DRIVER_PRERELEASE_ALL_APPS)) {
|
|| graphicsDriverGlobalOption == UPDATABLE_DRIVER_PRERELEASE_ALL_APPS)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isChecked && graphicsDriverGlobalOption == GAME_DRIVER_OFF) {
|
if (!isChecked && graphicsDriverGlobalOption == UPDATABLE_DRIVER_OFF) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.Global.putInt(mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS,
|
Settings.Global.putInt(mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
isChecked ? GAME_DRIVER_DEFAULT : GAME_DRIVER_OFF);
|
isChecked ? UPDATABLE_DRIVER_DEFAULT : UPDATABLE_DRIVER_OFF);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -104,7 +106,8 @@ public class GraphicsDriverGlobalSwitchBarController
|
|||||||
public void onGraphicsDriverContentChanged() {
|
public void onGraphicsDriverContentChanged() {
|
||||||
mSwitchWidgetController.setChecked(
|
mSwitchWidgetController.setChecked(
|
||||||
Settings.Global.getInt(
|
Settings.Global.getInt(
|
||||||
mContentResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT)
|
mContentResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
!= GAME_DRIVER_OFF);
|
UPDATABLE_DRIVER_DEFAULT)
|
||||||
|
!= UPDATABLE_DRIVER_OFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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.AVAILABLE;
|
||||||
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
|
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.UPDATABLE_DRIVER_DEFAULT;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
|
||||||
import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
|
import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
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 DEFAULT = 0;
|
||||||
private static final int PRERELEASE_DRIVER = 1;
|
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 int SYSTEM = 3;
|
||||||
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";
|
||||||
@@ -99,11 +99,11 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailability_developmentSettingsEnabledAndGameDriverOn_available() {
|
public void getAvailability_developmentSettingsEnabledAndProductionDriverOn_available() {
|
||||||
loadDefaultConfig();
|
loadDefaultConfig();
|
||||||
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
||||||
Settings.Global.putInt(
|
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);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,8 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getAvailability_graphicsDriverOff_conditionallyUnavailable() {
|
public void getAvailability_graphicsDriverOff_conditionallyUnavailable() {
|
||||||
loadDefaultConfig();
|
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);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
@@ -157,7 +158,7 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
public void updateState_available_visible() {
|
public void updateState_available_visible() {
|
||||||
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
||||||
Settings.Global.putInt(
|
Settings.Global.putInt(
|
||||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT);
|
||||||
loadDefaultConfig();
|
loadDefaultConfig();
|
||||||
|
|
||||||
assertThat(mGroup.isVisible()).isTrue();
|
assertThat(mGroup.isVisible()).isTrue();
|
||||||
@@ -165,7 +166,8 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_graphicsDriverOff_notVisible() {
|
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();
|
loadDefaultConfig();
|
||||||
|
|
||||||
assertThat(mGroup.isVisible()).isFalse();
|
assertThat(mGroup.isVisible()).isFalse();
|
||||||
@@ -188,7 +190,7 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createPreference_configGAME_DRIVER_shouldSetGameDriverAttributes() {
|
public void createPreference_configProduction_DRIVER_shouldSetProductionDriverAttributes() {
|
||||||
loadConfig(TEST_PKG_NAME, "", "");
|
loadConfig(TEST_PKG_NAME, "", "");
|
||||||
final ListPreference preference =
|
final ListPreference preference =
|
||||||
mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
|
mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
|
||||||
@@ -198,9 +200,9 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
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[GAME_DRIVER]);
|
assertThat(preference.getEntry()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
|
||||||
assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
|
assertThat(preference.getValue()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
|
||||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
|
assertThat(preference.getSummary()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -245,9 +247,11 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
assertThat(preference.getEntry()).isEqualTo(mValueList[DEFAULT]);
|
assertThat(preference.getEntry()).isEqualTo(mValueList[DEFAULT]);
|
||||||
assertThat(preference.getValue()).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.GAME_DRIVER_OPT_IN_APPS))
|
assertThat(Settings.Global.getString(mResolver,
|
||||||
|
Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS))
|
||||||
.isEqualTo("");
|
.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("");
|
.isEqualTo("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,25 +266,28 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
assertThat(preference.getValue()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
|
assertThat(preference.getValue()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
|
||||||
assertThat(preference.getSummary()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
|
assertThat(preference.getSummary()).isEqualTo(mValueList[PRERELEASE_DRIVER]);
|
||||||
assertThat(Settings.Global.getString(mResolver,
|
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);
|
.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("");
|
.isEqualTo("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_selectGAME_DRIVER_shouldUpdateAttributesAndSettingsGlobal() {
|
public void onPreferenceChange_selectPRODUCTION_DRIVER_shouldUpdateAttrAndSettingsGlobal() {
|
||||||
loadDefaultConfig();
|
loadDefaultConfig();
|
||||||
final ListPreference preference =
|
final ListPreference preference =
|
||||||
mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
|
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.getEntry()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
|
||||||
assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
|
assertThat(preference.getValue()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
|
||||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
|
assertThat(preference.getSummary()).isEqualTo(mValueList[PRODUCTION_DRIVER]);
|
||||||
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(TEST_PKG_NAME);
|
.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("");
|
.isEqualTo("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,9 +301,11 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
|
assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
|
||||||
assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
|
assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
|
||||||
assertThat(preference.getSummary()).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("");
|
.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);
|
.isEqualTo(TEST_PKG_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,10 +329,13 @@ public class GraphicsDriverAppPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfig(String optIn, String prereleaseOptIn, String optOut) {
|
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(
|
Settings.Global.putString(
|
||||||
mResolver, Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, prereleaseOptIn);
|
mResolver, Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
|
||||||
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS, optOut);
|
prereleaseOptIn);
|
||||||
|
Settings.Global.putString(
|
||||||
|
mResolver, Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS, optOut);
|
||||||
|
|
||||||
mController = new GraphicsDriverAppPreferenceController(mContext, "testKey");
|
mController = new GraphicsDriverAppPreferenceController(mContext, "testKey");
|
||||||
mController.mEntryList = mContext.getResources().getStringArray(
|
mController.mEntryList = mContext.getResources().getStringArray(
|
||||||
|
@@ -58,7 +58,7 @@ public class GraphicsDriverContentObserverTest {
|
|||||||
mGraphicsDriverContentObserver.register(mResolver);
|
mGraphicsDriverContentObserver.register(mResolver);
|
||||||
|
|
||||||
verify(mResolver).registerContentObserver(
|
verify(mResolver).registerContentObserver(
|
||||||
Settings.Global.getUriFor(Settings.Global.GAME_DRIVER_ALL_APPS), false,
|
Settings.Global.getUriFor(Settings.Global.UPDATABLE_DRIVER_ALL_APPS), false,
|
||||||
mGraphicsDriverContentObserver);
|
mGraphicsDriverContentObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ public class GraphicsDriverDashboardTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getMetricesCategory_shouldReturnGraphicsDriverDashboard() {
|
public void getMetricesCategory_shouldReturnGraphicsDriverDashboard() {
|
||||||
assertThat(mDashboard.getMetricsCategory())
|
assertThat(mDashboard.getMetricsCategory())
|
||||||
.isEqualTo(SettingsEnums.SETTINGS_GAME_DRIVER_DASHBOARD);
|
.isEqualTo(SettingsEnums.SETTINGS_GRAPHICS_DRIVER_DASHBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -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.AVAILABLE;
|
||||||
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
|
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.UPDATABLE_DRIVER_DEFAULT;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_PRERELEASE_ALL_APPS;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_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;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
private ContentResolver mResolver;
|
private ContentResolver mResolver;
|
||||||
private GraphicsDriverEnableForAllAppsPreferenceController mController;
|
private GraphicsDriverEnableForAllAppsPreferenceController mController;
|
||||||
private String mPreferenceDefault;
|
private String mPreferenceDefault;
|
||||||
private String mPreferenceGameDriver;
|
private String mPreferenceProductionDriver;
|
||||||
private String mPreferencePrereleaseDriver;
|
private String mPreferencePrereleaseDriver;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -72,14 +72,14 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
|
|
||||||
final Resources resources = mContext.getResources();
|
final Resources resources = mContext.getResources();
|
||||||
mPreferenceDefault = resources.getString(R.string.graphics_driver_app_preference_default);
|
mPreferenceDefault = resources.getString(R.string.graphics_driver_app_preference_default);
|
||||||
mPreferenceGameDriver =
|
mPreferenceProductionDriver =
|
||||||
resources.getString(R.string.graphics_driver_app_preference_game_driver);
|
resources.getString(R.string.graphics_driver_app_preference_production_driver);
|
||||||
mPreferencePrereleaseDriver =
|
mPreferencePrereleaseDriver =
|
||||||
resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
|
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.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
||||||
Settings.Global.putInt(
|
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 = new GraphicsDriverEnableForAllAppsPreferenceController(mContext, "testKey");
|
||||||
mController.mEntryList = mContext.getResources().getStringArray(
|
mController.mEntryList = mContext.getResources().getStringArray(
|
||||||
@@ -89,9 +89,9 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailability_developmentSettingsEnabledAndGameDriverSettingsOn_available() {
|
public void getAvailability_developmentSettingsEnabledAndUpdatableDriverSettingsOn_available() {
|
||||||
Settings.Global.putInt(
|
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);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||||
}
|
}
|
||||||
@@ -104,8 +104,9 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailability_gameDriverOff_conditionallyUnavailable() {
|
public void getAvailability_updatableDriverOff_conditionallyUnavailable() {
|
||||||
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);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
@@ -113,7 +114,7 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void displayPreference_shouldAddListPreference() {
|
public void displayPreference_shouldAddListPreference() {
|
||||||
Settings.Global.putInt(
|
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);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
verify(mPreference).setValue(mPreferenceDefault);
|
verify(mPreference).setValue(mPreferenceDefault);
|
||||||
@@ -139,7 +140,7 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void updateState_availableAndDefault_visibleAndDefault() {
|
public void updateState_availableAndDefault_visibleAndDefault() {
|
||||||
Settings.Global.putInt(
|
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);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
verify(mPreference, atLeastOnce()).setVisible(true);
|
verify(mPreference, atLeastOnce()).setVisible(true);
|
||||||
@@ -148,20 +149,22 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_availableAndGameDriver_visibleAndGameDriver() {
|
public void updateState_availableAndProductionDriver_visibleAndProductionDriver() {
|
||||||
Settings.Global.putInt(
|
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);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
verify(mPreference, atLeastOnce()).setVisible(true);
|
verify(mPreference, atLeastOnce()).setVisible(true);
|
||||||
verify(mPreference).setValue(mPreferenceGameDriver);
|
verify(mPreference).setValue(mPreferenceProductionDriver);
|
||||||
verify(mPreference).setSummary(mPreferenceGameDriver);
|
verify(mPreference).setSummary(mPreferenceProductionDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_availableAndPrereleaseDriver_visibleAndPrereleaseDriver() {
|
public void updateState_availableAndPrereleaseDriver_visibleAndPrereleaseDriver() {
|
||||||
Settings.Global.putInt(
|
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);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
verify(mPreference, atLeastOnce()).setVisible(true);
|
verify(mPreference, atLeastOnce()).setVisible(true);
|
||||||
@@ -170,8 +173,9 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_gameDriverOff_notVisibleAndSystemDriver() {
|
public void updateState_updatableDriverOff_notVisibleAndSystemDriver() {
|
||||||
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);
|
||||||
mController.updateState(mPreference);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
verify(mPreference).setVisible(false);
|
verify(mPreference).setVisible(false);
|
||||||
@@ -182,33 +186,35 @@ public class GraphicsDriverEnableForAllAppsPreferenceControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_default_shouldUpdateSettingsGlobal() {
|
public void onPreferenceChange_default_shouldUpdateSettingsGlobal() {
|
||||||
Settings.Global.putInt(
|
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);
|
mController.onPreferenceChange(mPreference, mPreferenceDefault);
|
||||||
|
|
||||||
assertThat(Settings.Global.getInt(
|
assertThat(Settings.Global.getInt(
|
||||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
.isEqualTo(GAME_DRIVER_DEFAULT);
|
UPDATABLE_DRIVER_DEFAULT))
|
||||||
|
.isEqualTo(UPDATABLE_DRIVER_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_gameDriver_shouldUpdateSettingsGlobal() {
|
public void onPreferenceChange_updatableDriver_shouldUpdateSettingsGlobal() {
|
||||||
Settings.Global.putInt(
|
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, mPreferenceGameDriver);
|
mController.onPreferenceChange(mPreference, mPreferenceProductionDriver);
|
||||||
|
|
||||||
assertThat(Settings.Global.getInt(
|
assertThat(Settings.Global.getInt(
|
||||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT))
|
||||||
.isEqualTo(GAME_DRIVER_ALL_APPS);
|
.isEqualTo(UPDATABLE_DRIVER_PRODUCTION_ALL_APPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_prereleaseDriver_shouldUpdateSettingsGlobal() {
|
public void onPreferenceChange_prereleaseDriver_shouldUpdateSettingsGlobal() {
|
||||||
Settings.Global.putInt(
|
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);
|
mController.onPreferenceChange(mPreference, mPreferencePrereleaseDriver);
|
||||||
|
|
||||||
assertThat(Settings.Global.getInt(
|
assertThat(Settings.Global.getInt(
|
||||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS, UPDATABLE_DRIVER_DEFAULT))
|
||||||
.isEqualTo(GAME_DRIVER_PRERELEASE_ALL_APPS);
|
.isEqualTo(UPDATABLE_DRIVER_PRERELEASE_ALL_APPS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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.AVAILABLE_UNSEARCHABLE;
|
||||||
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
|
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.UPDATABLE_DRIVER_DEFAULT;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_PRODUCTION_ALL_APPS;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -68,24 +68,26 @@ public class GraphicsDriverFooterPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailabilityStatus_gameDriverOff_availableUnsearchable() {
|
public void getAvailabilityStatus_updatableDriverOff_availableUnsearchable() {
|
||||||
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(AVAILABLE_UNSEARCHABLE);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailabilityStatus_gameDriverDefault_conditionallyUnavailable() {
|
public void getAvailabilityStatus_updatableDriverDefault_conditionallyUnavailable() {
|
||||||
Settings.Global.putInt(
|
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);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAvailabilityStatus_gameDriverAllApps_conditionallyUnavailable() {
|
public void getAvailabilityStatus_updatableProductionDriverAllApps_conditionallyUnavailable() {
|
||||||
Settings.Global.putInt(
|
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);
|
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.development.graphicsdriver;
|
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.UPDATABLE_DRIVER_DEFAULT;
|
||||||
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
import static com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController.UPDATABLE_DRIVER_OFF;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -61,9 +61,9 @@ public class GraphicsDriverGlobalSwitchBarControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void constructor_gameDriverOn_shouldCheckSwitchBar() {
|
public void constructor_updatableDriverOn_shouldCheckSwitchBar() {
|
||||||
Settings.Global.putInt(
|
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(
|
mController = new GraphicsDriverGlobalSwitchBarController(
|
||||||
mContext, new SwitchBarController(mSwitchBar));
|
mContext, new SwitchBarController(mSwitchBar));
|
||||||
|
|
||||||
@@ -71,8 +71,9 @@ public class GraphicsDriverGlobalSwitchBarControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void constructor_gameDriverOff_shouldUncheckSwitchBar() {
|
public void constructor_updatableDriverOff_shouldUncheckSwitchBar() {
|
||||||
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);
|
||||||
mController = new GraphicsDriverGlobalSwitchBarController(
|
mController = new GraphicsDriverGlobalSwitchBarController(
|
||||||
mContext, new SwitchBarController(mSwitchBar));
|
mContext, new SwitchBarController(mSwitchBar));
|
||||||
|
|
||||||
@@ -122,27 +123,30 @@ public class GraphicsDriverGlobalSwitchBarControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSwitchToggled_checked_shouldTurnOnGameDriver() {
|
public void onSwitchToggled_checked_shouldTurnOnUpdatableDriver() {
|
||||||
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);
|
||||||
mController = new GraphicsDriverGlobalSwitchBarController(
|
mController = new GraphicsDriverGlobalSwitchBarController(
|
||||||
mContext, new SwitchBarController(mSwitchBar));
|
mContext, new SwitchBarController(mSwitchBar));
|
||||||
mController.onSwitchToggled(true);
|
mController.onSwitchToggled(true);
|
||||||
|
|
||||||
assertThat(Settings.Global.getInt(
|
assertThat(Settings.Global.getInt(
|
||||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
.isEqualTo(GAME_DRIVER_DEFAULT);
|
UPDATABLE_DRIVER_DEFAULT))
|
||||||
|
.isEqualTo(UPDATABLE_DRIVER_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSwitchToggled_unchecked_shouldTurnOffGameDriver() {
|
public void onSwitchToggled_unchecked_shouldTurnOffUpdatableDriver() {
|
||||||
Settings.Global.putInt(
|
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(
|
mController = new GraphicsDriverGlobalSwitchBarController(
|
||||||
mContext, new SwitchBarController(mSwitchBar));
|
mContext, new SwitchBarController(mSwitchBar));
|
||||||
mController.onSwitchToggled(false);
|
mController.onSwitchToggled(false);
|
||||||
|
|
||||||
assertThat(Settings.Global.getInt(
|
assertThat(Settings.Global.getInt(
|
||||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
mResolver, Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
|
||||||
.isEqualTo(GAME_DRIVER_OFF);
|
UPDATABLE_DRIVER_DEFAULT))
|
||||||
|
.isEqualTo(UPDATABLE_DRIVER_OFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user