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);
     }