Merge "Add a boolean flag to show or hide Private DNS in Network & internet."
This commit is contained in:
committed by
Android (Google) Code Review
commit
fa44a94aa9
@@ -60,6 +60,9 @@
|
||||
<!-- Whether toggle_airplane is available or not. -->
|
||||
<bool name="config_show_toggle_airplane">true</bool>
|
||||
|
||||
<!-- Whether private_dns_settings is available or not. -->
|
||||
<bool name="config_show_private_dns_settings">true</bool>
|
||||
|
||||
<!-- Whether memory from app_info_settings is available or not. -->
|
||||
<bool name="config_show_app_info_settings_memory">false</bool>
|
||||
|
||||
|
@@ -80,7 +80,9 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return AVAILABLE;
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_private_dns_settings)
|
||||
? AVAILABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -23,6 +23,7 @@
|
||||
<bool name="config_additional_system_update_setting_enable">true</bool>
|
||||
<bool name="config_show_wifi_settings">false</bool>
|
||||
<bool name="config_show_toggle_airplane">false</bool>
|
||||
<bool name="config_show_private_dns_settings">false</bool>
|
||||
<bool name="config_show_app_info_settings_memory">true</bool>
|
||||
<bool name="config_show_app_info_settings_battery">false</bool>
|
||||
<bool name="config_show_high_power_apps">false</bool>
|
||||
|
@@ -24,6 +24,8 @@ import static android.provider.Settings.Global.PRIVATE_DNS_MODE;
|
||||
import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
@@ -57,6 +59,7 @@ import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.shadow.api.Shadow;
|
||||
import org.robolectric.shadows.ShadowContentResolver;
|
||||
@@ -143,6 +146,17 @@ public class PrivateDnsPreferenceControllerTest {
|
||||
nc.onLinkPropertiesChanged(mNetwork, lp);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailibilityStatus_availableByDefault() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "mcc999")
|
||||
public void getAvailabilityStatus_unsupportedWhenSet() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void goThroughLifecycle_shouldRegisterUnregisterSettingsObserver() {
|
||||
mLifecycle.handleLifecycleEvent(ON_START);
|
||||
|
Reference in New Issue
Block a user