Hide private DNS settings UI in Guest mode to prevent guest
users modifying global private DNS settings.
Bug: 206987762
Test: 1. make RunSettingsRoboTests \
ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest
2. Switch to Guest user and check if the private DNS UI is
hidden or not.
Change-Id: Iebfb8684da3be32110decd9e8447dd07b1c40387
The value of PRIVATE_DNS_MODE_* has changed from String to int and
ConnectivityManager provides 2 new APIs to set and get private
DNS mode, the caller can use them directly and doesn't need to update
Settings by itself.
Bug: 185311744
Test: 1. make RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsModeDialogPreferenceTest
2. make RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest
Change-Id: I47706efe9c53a00438fdec97fda244638cecb3dc
Context is more useful than ContentResolver, it can provide more
information if we want to change the behavior in the future.
Bug: 172183305
Test: make RunSettingsRoboTests \
ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest
Test: make RunSettingsRoboTests \
ROBOTEST_FILTER=PrivateDnsModeDialogPreferenceTest
Change-Id: I6c06460b67f81112db311f0739457d5f1e2e4554
PRIVATE_DNS_DEFAULT_MODE_FALLBACK has removed, use
ConnectivityManager#getPrivateDnsMode() to get the value of
private DNS instead of querying settings and implementing logic
by itself.
Bug: 172183305
Test: make RunSettingsRoboTests \
ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest
Test: make RunSettingsRoboTests \
ROBOTEST_FILTER=PrivateDnsModeDialogPreferenceTest
Change-Id: I024c3ddfb85f4c3d177e2e99294c998d81d4e08d
The last private DNS settings screen landed in P after string
freeze, which led us to reuse R.string.switch_on_text for the
"on" text when private DNS is active. That string comes from
notifications. Private DNS should have its own string for this
instead.
Bug: 79122154
Test: 1. Build pass
2. make -j44 RunSettingsRoboTests \
ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest
Change-Id: Ie013a858c8bc41e00a1b940d02efa2b605991685
When the Private DNS setting is disabled via a user restriction, show
information to the user explaining that they cannot change this setting
due to IT admin policy.
Testing steps:
* Installed & configured TestDPC on the device.
* Made sure that the Private DNS setting is usable.
* Set the user restriction via TestDPC ("User Restrictions" -> "Disallow
config Private DNS").
* Navigated to Settings -> Network & Internet -> Advanced
* Observed that Private DNS is greyed out and the Restricted icon is
showing.
* Observed that when tapping either the icon or the greyed-out text I
get a dialog with policy information.
Implementation notes:
I have not utilized the existing RestrictedPreference as the Private DNS
mode preference extends CustomDialogPreferenceCompat.
I have also not utilized the RestrictedPreferenceHelper as it modifies
the summary shown for the preference. This preference has its own
summary (showing the current state of Private DNS configuration) which I
did not want to override.
Bug: 112982691
Test: Manual, see above.
Change-Id: I9b7496b5b2cbb26012d889369f2199239cd2e00f
As a new user restriction, to disallow changing Private DNS settings, was
added, make the Private DNS mode dialog preference consider whether to
let the user modify it or not based on the presence of this restriction.
Bug: 112982691
Test: atest com.android.cts.devicepolicy.DeviceOwnerTest#testPrivateDnsPolicy
Test: m -j RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest
Test: Manual, using TestDPC
Change-Id: If815860ace3aadf6f79fd23173f0a2c80a29f0e1
Having consistent import order will reduce chance of merge
conflict between internal and external master
Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
The following boolean flag is added:
config_show_private_dns_settings
When set to false, Private DNS will not be shown in Network & internet.
Bug: 111398942
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest
Change-Id: I62911930680355b7fc109b295d8526bdb7eac0b3
This setting can be used to change the in-code default.
Test: as follows
- built, flashed, booted
- make -j50 RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsModeDialogPreferenceTest passes
- make -j50 RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest passes
Bug: 79719289
Change-Id: I27e5fb9cc66dde1df72395c22179bca3f62ef782
This works as follows :
Off → "Off"
Opportunistic, inactive → "Automatic"
Opportunistic, active → "On"
(stealing a string from notifications for this)
Strict, not resolved and/or not validated → "Couldn't connect"
Strict, resolved and validated → Set up hostname
Bug: 73641539
Test: manual, and updated tests pass
Change-Id: Id1132467288d51aa9cb81a04db65dee438ddfad9
Also: fix a bug where the actual current mode is not read correctly
from settings on initialization.
Test: as follows
- built, flashed, booted
- manual test behaves as expected
- make -j50 RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsModeDialogPreferenceTest passes
- make -j50 RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest passes
Bug: 34953048
Bug: 64133961
Change-Id: I0b845b3894a47b837abf5de273d1ada642ef5a23
Bug: 64133961
Fixes: 74844869
Test: visual test and interaction
also updated tests and checked they pass
Change-Id: I7c8d50e5941c2a7dd46014932bdace14dc222c80