Commit Graph

24 Commits

Author SHA1 Message Date
Edgar Wang
b1a48df4f7 Remove restricted icon
Bug: 195401182
Test: robotest
Change-Id: I6b22b3b9b62812eb08f10492bd2d7908cce89d39
2022-02-08 03:09:50 +00:00
Treehugger Robot
ca3051403f Merge "Settings: remove Bluetooth related text from DNS-dialog" 2021-05-17 03:19:59 +00:00
Timi Rautamäki
a84987564b Settings: remove Bluetooth related text from DNS-dialog
* String ´bluetooth_select_a2dp_codec_type_help_info´
   is set on the ´preference_widget_dialog_summary´-dialog
   by default.

Test: make Settings, visual observation
Signed-off-by: Timi Rautamäki <timi.rautamaki@gmail.com>
Change-Id: I6d403f231797bcf5b10bf726cca4e128f4c517ea
2021-05-16 21:08:36 +02:00
lucaslin
1fbe34fbc7 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
Merged-In: I47706efe9c53a00438fdec97fda244638cecb3dc
    (Cherry-picked from ag/14230401)
2021-05-05 03:26:58 +00:00
lucaslin
11e738c3a0 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
Merged-In: I6c06460b67f81112db311f0739457d5f1e2e4554
2021-03-16 09:36:12 +00:00
lucaslin
f2e03475b3 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
Merged-In: I024c3ddfb85f4c3d177e2e99294c998d81d4e08d
2021-03-08 08:19:28 +00:00
Remi NGUYEN VAN
f40f71ccf1 Replace isWeaklyValidatedHostname with guava
The guava implementation is more accurate than the basic NetworkUtils
implementation.
NetworkUtils is being moved to its own JAR and will not be available
from Settings.

Bug: 174436414
Test: m
      Wrote test for isWeaklyValidatedHostname, verified it passes with
      guava
Change-Id: I1d01f2beba36009e17f651652e2d7f57be5aa398
2020-12-08 14:02:17 +09:00
timhypeng
456285ca5b Refactor common layout
- reuse preference_widget_dialog_radiobutton

Bug: 144746899
Test: manual
Change-Id: Icfba629eb05b9db1dc6802e26c087b30f0fe88ed
2019-11-21 10:42:26 +08:00
Colin Cross
807e861105 Use if instead of switch for resources
Converting to Soong will move some code from directly compiled
into the app to compiled into an Android library and then
shared between the app and the tests.  This will cause resource
IDs in the library to become non-final, which means they can
no longer be used in case statements.  Convert affect case
statements to if blocks.

Test: m RunSettingsRoboTests
Change-Id: I25742a374f06d3fa4decbfc0d223a350acc50881
2019-05-13 13:42:01 -07: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
7ba739ba14 Private DNS: Extract host verification code
Since Private DNS host may now be set by the admin via the
DevicePolicyManager, extract the verification code to the
ConnectivityManager so it can be used both from Settings and framework
code.

Bug: 112982691
Test: See cts tests.
Change-Id: Ic091e4714f8d3f9f28042bc825cf57c991504f27
2018-10-15 11:53:38 +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
Fan Zhang
420f385a18 Fix a incorrect type cast for alert dialog
Change-Id: I2265c4510785f88ef7950cd29779848eb2e58dc4
Fixes: 111488148
Test: manual
2018-07-16 12:23:57 -07:00
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -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
Lei Yu
7c580997be Merge "Add cancel button for private dns dialog" into pi-dev am: 7fe599f542
am: ea1d9d17d1

Change-Id: I55cab617105d21ff42ed911e6b457ec662349811
2018-05-14 15:11:36 -07:00
Lei Yu
231fe615cc Add cancel button for private dns dialog
Also update the onclick method.

Change-Id: I69e92584e056a4d0a686153315b8df002d91e204
Fixes: 79479021
Test: RunSettingsRoboTests
2018-05-14 13:12:00 -07: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
Erik Kline
6c2ad0d62d Expressly forbid IP string literals as Private DNS hostnames
For obvious bootstrapping reasons, DNS settings have always used
IP address string literals in input fields.

However, since we can use the network-assigned nameservers to bootstrap
our way to multiple IP addresses of multiple families (!), hostnames
provide a clear simplicity and future-proofing advantage.

Permitting IP address literals means not only making sure that we can
validate X.509v3 certificates for IP addresses, but coping with the
inevitable broken configurations where users may have configured IPv4
addresses but no IPv6 addresses.  This will unnecessarily complicate
life on IPv6-only networks.

=)

Test: as follows
    - built
    - flashed
    - booted
    - tried to enter IP string literals
    - make -j50 RunSettingsRoboTests ROBOTEST_FILTER=PrivateDnsModeDialogPreferenceTest
Bug: 34953048
Bug: 64133961
Bug: 73641539

Change-Id: I7a58e86ed640ff5600906fb3d8cb9a2c75598831
2018-04-04 00:42:19 -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