Loading src/com/android/settings/supervision/SupervisionSafeSearchDataStore.kt +4 −3 Original line number Diff line number Diff line Loading @@ -35,10 +35,11 @@ class SupervisionSafeSearchDataStore( key == SupervisionSearchFilterOffPreference.KEY override fun <T : Any> getValue(key: String, valueType: Class<T>): T? { val settingValue = (settingsStore.getBoolean(SEARCH_CONTENT_FILTERS_ENABLED) == true) val settingValue = settingsStore.getInt(SEARCH_CONTENT_FILTERS_ENABLED) val isFilterOff: Boolean = settingValue == null || settingValue <= 0 return when (key) { SupervisionSearchFilterOffPreference.KEY -> !settingValue SupervisionSearchFilterOnPreference.KEY -> settingValue SupervisionSearchFilterOffPreference.KEY -> isFilterOff SupervisionSearchFilterOnPreference.KEY -> !isFilterOff else -> null } as T? Loading src/com/android/settings/supervision/SupervisionSafeSitesDataStore.kt +4 −3 Original line number Diff line number Diff line Loading @@ -36,11 +36,12 @@ class SupervisionSafeSitesDataStore( key == SupervisionAllowAllSitesPreference.KEY override fun <T : Any> getValue(key: String, valueType: Class<T>): T? { val settingValue = (settingsStore.getBoolean(BROWSER_CONTENT_FILTERS_ENABLED) == true) val settingValue = settingsStore.getInt(BROWSER_CONTENT_FILTERS_ENABLED) val isFilterOff: Boolean = settingValue == null || settingValue <= 0 return when (key) { SupervisionAllowAllSitesPreference.KEY -> !settingValue SupervisionAllowAllSitesPreference.KEY -> isFilterOff SupervisionBlockExplicitSitesPreference.KEY -> settingValue SupervisionBlockExplicitSitesPreference.KEY -> !isFilterOff else -> null } Loading src/com/android/settings/supervision/SupervisionWebContentFiltersScreen.kt +3 −3 Original line number Diff line number Diff line Loading @@ -43,13 +43,13 @@ class SupervisionWebContentFiltersScreen : PreferenceScreenCreator, PreferenceSu override fun getSummary(context: Context): CharSequence? { val dataStore = SettingsSecureStore.get(context) return if (dataStore.getBoolean(BROWSER_CONTENT_FILTERS_ENABLED) == true) { if (dataStore.getBoolean(SEARCH_CONTENT_FILTERS_ENABLED) == true) { return if (dataStore.getInt(BROWSER_CONTENT_FILTERS_ENABLED) == 1) { if (dataStore.getInt(SEARCH_CONTENT_FILTERS_ENABLED) == 1) { context.getString(R.string.supervision_web_content_filters_summary_both_on) } else { context.getString(R.string.supervision_web_content_filters_summary_chrome_on) } } else if (dataStore.getBoolean(SEARCH_CONTENT_FILTERS_ENABLED) == true) { } else if (dataStore.getInt(SEARCH_CONTENT_FILTERS_ENABLED) == 1) { context.getString(R.string.supervision_web_content_filters_summary_search_on) } else { context.getString(R.string.supervision_web_content_filters_summary_both_off) Loading tests/robotests/src/com/android/settings/supervision/SupervisionSafeSearchPreferenceTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ class SupervisionSafeSearchPreferenceTest { @Test fun clickFilterOn_enablesFilter() { Settings.Secure.putInt(context.getContentResolver(), SEARCH_CONTENT_FILTERS_ENABLED, 0) Settings.Secure.putInt(context.getContentResolver(), SEARCH_CONTENT_FILTERS_ENABLED, -1) val filterOnWidget = getFilterOnWidget() assertThat(filterOnWidget.isChecked).isFalse() Loading tests/robotests/src/com/android/settings/supervision/SupervisionSafeSitesPreferenceTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ class SupervisionSafeSitesPreferenceTest { @Test fun clickBlockExplicitSites_enablesFilter() { Settings.Secure.putInt(context.getContentResolver(), BROWSER_CONTENT_FILTERS_ENABLED, 0) Settings.Secure.putInt(context.getContentResolver(), BROWSER_CONTENT_FILTERS_ENABLED, -1) val blockExplicitSitesWidget = getBlockExplicitSitesWidget() assertThat(blockExplicitSitesWidget.isChecked).isFalse() Loading Loading
src/com/android/settings/supervision/SupervisionSafeSearchDataStore.kt +4 −3 Original line number Diff line number Diff line Loading @@ -35,10 +35,11 @@ class SupervisionSafeSearchDataStore( key == SupervisionSearchFilterOffPreference.KEY override fun <T : Any> getValue(key: String, valueType: Class<T>): T? { val settingValue = (settingsStore.getBoolean(SEARCH_CONTENT_FILTERS_ENABLED) == true) val settingValue = settingsStore.getInt(SEARCH_CONTENT_FILTERS_ENABLED) val isFilterOff: Boolean = settingValue == null || settingValue <= 0 return when (key) { SupervisionSearchFilterOffPreference.KEY -> !settingValue SupervisionSearchFilterOnPreference.KEY -> settingValue SupervisionSearchFilterOffPreference.KEY -> isFilterOff SupervisionSearchFilterOnPreference.KEY -> !isFilterOff else -> null } as T? Loading
src/com/android/settings/supervision/SupervisionSafeSitesDataStore.kt +4 −3 Original line number Diff line number Diff line Loading @@ -36,11 +36,12 @@ class SupervisionSafeSitesDataStore( key == SupervisionAllowAllSitesPreference.KEY override fun <T : Any> getValue(key: String, valueType: Class<T>): T? { val settingValue = (settingsStore.getBoolean(BROWSER_CONTENT_FILTERS_ENABLED) == true) val settingValue = settingsStore.getInt(BROWSER_CONTENT_FILTERS_ENABLED) val isFilterOff: Boolean = settingValue == null || settingValue <= 0 return when (key) { SupervisionAllowAllSitesPreference.KEY -> !settingValue SupervisionAllowAllSitesPreference.KEY -> isFilterOff SupervisionBlockExplicitSitesPreference.KEY -> settingValue SupervisionBlockExplicitSitesPreference.KEY -> !isFilterOff else -> null } Loading
src/com/android/settings/supervision/SupervisionWebContentFiltersScreen.kt +3 −3 Original line number Diff line number Diff line Loading @@ -43,13 +43,13 @@ class SupervisionWebContentFiltersScreen : PreferenceScreenCreator, PreferenceSu override fun getSummary(context: Context): CharSequence? { val dataStore = SettingsSecureStore.get(context) return if (dataStore.getBoolean(BROWSER_CONTENT_FILTERS_ENABLED) == true) { if (dataStore.getBoolean(SEARCH_CONTENT_FILTERS_ENABLED) == true) { return if (dataStore.getInt(BROWSER_CONTENT_FILTERS_ENABLED) == 1) { if (dataStore.getInt(SEARCH_CONTENT_FILTERS_ENABLED) == 1) { context.getString(R.string.supervision_web_content_filters_summary_both_on) } else { context.getString(R.string.supervision_web_content_filters_summary_chrome_on) } } else if (dataStore.getBoolean(SEARCH_CONTENT_FILTERS_ENABLED) == true) { } else if (dataStore.getInt(SEARCH_CONTENT_FILTERS_ENABLED) == 1) { context.getString(R.string.supervision_web_content_filters_summary_search_on) } else { context.getString(R.string.supervision_web_content_filters_summary_both_off) Loading
tests/robotests/src/com/android/settings/supervision/SupervisionSafeSearchPreferenceTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ class SupervisionSafeSearchPreferenceTest { @Test fun clickFilterOn_enablesFilter() { Settings.Secure.putInt(context.getContentResolver(), SEARCH_CONTENT_FILTERS_ENABLED, 0) Settings.Secure.putInt(context.getContentResolver(), SEARCH_CONTENT_FILTERS_ENABLED, -1) val filterOnWidget = getFilterOnWidget() assertThat(filterOnWidget.isChecked).isFalse() Loading
tests/robotests/src/com/android/settings/supervision/SupervisionSafeSitesPreferenceTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ class SupervisionSafeSitesPreferenceTest { @Test fun clickBlockExplicitSites_enablesFilter() { Settings.Secure.putInt(context.getContentResolver(), BROWSER_CONTENT_FILTERS_ENABLED, 0) Settings.Secure.putInt(context.getContentResolver(), BROWSER_CONTENT_FILTERS_ENABLED, -1) val blockExplicitSitesWidget = getBlockExplicitSitesWidget() assertThat(blockExplicitSitesWidget.isChecked).isFalse() Loading