Commit Graph

22 Commits

Author SHA1 Message Date
lucaslin
b38110f853 Hide private DNS settings UI in Guest mode am: 52e863b5a2 am: 2c1c76cd35 am: 14e88ca2f9 am: 652527b496
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17129063

Change-Id: I7dfbfc73a887027bb55712e2ea05fd01e65bcf96
2022-03-09 07:20:30 +00:00
lucaslin
14e88ca2f9 Hide private DNS settings UI in Guest mode am: 52e863b5a2 am: 2c1c76cd35
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17129063

Change-Id: I417c9687ae22749f428a902a01612c50cbf0e52c
2022-03-09 06:32:20 +00:00
lucaslin
52e863b5a2 Hide private DNS settings UI in Guest mode
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
2022-03-09 02:54:12 +00:00
lucaslin
188d66a709 Use [set|get]PrivateDnsMode directly
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
2021-04-22 01:46:05 +08:00
lucaslin
8ffc3908ff Change the parameter type from ContentResolver to Context
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
2021-03-16 17:41:37 +08:00
lucaslin
b07054ca9c Use getPrivateDnsMode() to get the value of private DNS
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
2021-03-08 08:19:50 +00:00
Lucas Lin
903e8dac6c Merge "Create a string for private DNS "On""
am: a64f8d9521

Change-Id: I154269dc91acbefdce3cb6f76513d6b4f08f568b
2019-07-23 20:45:49 -07:00
lucaslin
be8701bca5 Create a string for private DNS "On"
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
2019-07-23 19:40:09 +08:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -08:00
Eran Messeri
203856e444 Private DNS: Add policy transparency
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
2018-11-09 13:33:16 +00:00
Eran Messeri
717194c87c Consider Private DNS user restriction
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
2018-10-15 21:34:47 +01:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
Aurimas Liutikas
b1af85d155 Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
Merged-In: I941dea40562170649bf056e675cc32e5163c0e39
(cherry picked from commit a290b873d0)
2018-08-28 11:48:56 -07:00
Ben Lin
bc4b584446 Add a boolean flag to show or hide Private DNS in Network & internet.
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
2018-07-26 12:12:25 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Erik Kline
e1a5ac804d Merge "Factor in PRIVATE_DNS_MODE_DEFAULTSETTING value" into pi-dev am: 5a0a7ef4bb
am: cf83539e1e

Change-Id: Ia06f5bef6d4103cf65a2c07d8dadecfa815080f7
2018-05-23 15:59:09 -07:00
Erik Kline
aee4396874 Factor in PRIVATE_DNS_MODE_DEFAULTSETTING value
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
2018-05-22 10:52:55 +09:00
Chalard Jean
0e8e89f576 Show the status of private DNS. am: f249555f97
am: 43a42e4592

Change-Id: I7ba6ec19ab4f373d6d78609f5a8a6bd76749ead7
2018-05-02 22:13:37 -07:00
Chalard Jean
f249555f97 Show the status of private DNS.
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
2018-05-03 05:04:47 +00:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Erik Kline
85c34077d3 Display Private DNS status in preference summary
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
2018-04-08 15:50:58 -07:00
Chalard Jean
42405603c7 Move the Private DNS dialog back to the top level.
Bug: 64133961
Fixes: 74844869
Test: visual test and interaction
      also updated tests and checked they pass
Change-Id: I7c8d50e5941c2a7dd46014932bdace14dc222c80
2018-04-02 09:58:12 +00:00