Merge "[Settings] enhancing data saver config control" into tm-qpr-dev
This commit is contained in:
@@ -59,6 +59,11 @@ public class DataSaverSummary extends SettingsPreferenceFragment
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (!isDataSaverVisible(getContext())) {
|
||||
finishFragment();
|
||||
return;
|
||||
}
|
||||
|
||||
addPreferencesFromResource(R.xml.data_saver);
|
||||
mUnrestrictedAccess = findPreference(KEY_UNRESTRICTED_ACCESS);
|
||||
mApplicationsState = ApplicationsState.getInstance(
|
||||
@@ -192,12 +197,18 @@ public class DataSaverSummary extends SettingsPreferenceFragment
|
||||
|
||||
}
|
||||
|
||||
public static boolean isDataSaverVisible(Context context) {
|
||||
return context.getResources()
|
||||
.getBoolean(R.bool.config_show_data_saver);
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.data_saver) {
|
||||
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return DataUsageUtils.hasMobileData(context)
|
||||
return isDataSaverVisible(context)
|
||||
&& DataUsageUtils.hasMobileData(context)
|
||||
&& DataUsageUtils.getDefaultSubscriptionId(context)
|
||||
!= SubscriptionManager.INVALID_SUBSCRIPTION_ID;
|
||||
}
|
||||
|
Reference in New Issue
Block a user