commit | f009585ceabd87461c79a7b5439cdfe8d73b9945 | [log] [tgz] |
---|---|---|
author | Tommy Webb <tommy@calyxinstitute.org> | Tue May 23 15:24:03 2023 -0400 |
committer | Michael Bestas <mkbestas@lineageos.org> | Fri Jun 09 16:42:57 2023 +0200 |
tree | 8900991001876019390d567fc6d84fa10d74727a | |
parent | 41b4ed345a91da1dd46c00ee11a151c2b5ff4f43 [diff] |
Hide private DNS settings UI unless admin Previously, Private DNS settings were hidden from guests. This change hides them from all users except admins. This prevents secondary users from changing these settings, since they have a device-wide impact. Bug: 284003108 Change-Id: I563c5f7ee3091f2d3ed91fe0cc6451ad2fe2b413
diff --git a/src/com/android/settings/network/PrivateDnsPreferenceController.java b/src/com/android/settings/network/PrivateDnsPreferenceController.java index b64ce06..ca6a434 100644 --- a/src/com/android/settings/network/PrivateDnsPreferenceController.java +++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
@@ -92,7 +92,7 @@ return UNSUPPORTED_ON_DEVICE; } final UserManager userManager = mContext.getSystemService(UserManager.class); - if (userManager.isGuestUser()) return DISABLED_FOR_USER; + if (!userManager.isAdminUser()) return DISABLED_FOR_USER; return AVAILABLE; }
diff --git a/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java index 057b6cb..285c102 100644 --- a/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/network/PrivateDnsPreferenceControllerTest.java
@@ -179,8 +179,8 @@ } @Test - public void getAvailabilityStatus_disabledForGuestUser() { - doReturn(true).when(mUserManager).isGuestUser(); + public void getAvailabilityStatus_disabledForNonAdminUser() { + doReturn(false).when(mUserManager).isAdminUser(); assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_FOR_USER); }