Commit Graph

40 Commits

Author SHA1 Message Date
Bonian Chen
db6c47756d [Settings] Convert to getSystemService(Class<T>)
Change to getSystemService(Class<T>) to align the capability with framework
part.

Bug: 179640862
Test: local
Change-Id: I1b4812044fc4876bec6645570049a60f9470dbbd
2021-03-22 06:20:19 +00:00
Lorenzo Colitti
1434c08600 Stop using ConnectivityManager for VPNs.
These methods have all moved to VpnManager.

Bug: 173331190
Test: atest SettingsRoboTests
Change-Id: I1dd57fa2213b1785a94ec9d6ab4cce3a5d2684ff
Merged-In: I1dd57fa2213b1785a94ec9d6ab4cce3a5d2684ff
2021-02-18 23:50:59 +09:00
Lorenzo Colitti
04d34ced59 Switch Settings from IConnectivityManager to VpnManager.
The VPN code is moving out of ConnectivityService to a new
VpnManagerService. Update Settings to call into the VpnManager
class instead of using the AIDL interface directly. This way,
the VPN code can be moved without touching Settings.

Bug: 173331190
Test: builds, boots
Test: manually verified VPN settings page
Change-Id: Id2731a166b5d6783acb1c711a54604b69aa8c0d7
2021-02-08 16:50:25 +09:00
Rubin Xu
b3ca3c5fb6 Disable Settings toggle if admin has set always-on VPN
If the admin has turned on always-on VPN, do not allow the user
to modify it.

Bug: 137938969
Test: manually set always-on VPN and check Settings is disabled
Change-Id: Id2541e120f043ce24e52c3189d3a6fb1d85b432b
2020-02-18 17:56:54 +00:00
Benedict Wong
bcd6b8cbca Add Platform VPNs to VPN list
This change allows the Settings VPN pages to pull the apps providing a
new Platform VPN.

Bug: 144246835
Test: Compiles, manual testing
Change-Id: Ibb7e79ccde754724c9fc00c88da98e975f325ba7
2020-01-30 01:46:19 -08:00
Pavel Grafov
e1dd64ef2e Merge "Update to use new ConnectivityManager API." am: 70b1830e7e am: 7c47743851
am: 3184142cbe

Change-Id: I6bc7277d0f1db1576b369443719c449fc8eeed75
2019-01-28 22:14:17 -08:00
Pavel Grafov
6a0a7be9a2 Update to use new ConnectivityManager API.
Bug: 77468593
Test: builds
Change-Id: I1fa542e015add2dd8b0e8620f2021c1a5c1c9f1a
2019-01-25 18:58:17 +00:00
Dan Albert
5d381ac653 Merge "Revert "Update to use new ConnectivityManager API."" am: 9c7ddce334 am: 2105dc52dd
am: 11247ebb53

Change-Id: Id9a817cb440ce1ae538b7f6fd3f5c81a95efb346
2019-01-24 15:16:38 -08:00
Dan Albert
6e91f68ae4 Revert "Update to use new ConnectivityManager API."
This reverts commit 9a9f6f313b.

Reason for revert: broke pi-dev-plus-aosp

Change-Id: Ia0ff7cdf77b4edf3bdf5e4c54376b730df48373e
2019-01-24 21:06:02 +00:00
Pavel Grafov
9a9f6f313b Update to use new ConnectivityManager API.
Bug: 77468593
Test: builds
Change-Id: I614c20b9a1c6748614163766866bb59b15d794f1
Merged-In: I614c20b9a1c6748614163766866bb59b15d794f1
2019-01-23 19:53:01 +00:00
Pavel Grafov
ab871a00c7 Update to use new ConnectivityManager API.
Bug: 77468593
Test: builds
Change-Id: I614c20b9a1c6748614163766866bb59b15d794f1
2019-01-23 19:52:45 +00: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
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
tmfang
41ab6b4bf8 Migrate all AlertDialogs to AndroidX version
This CL only changed AlertDialog imports.
So, reviewer can review it easily.

Change-Id: I097bc44394195b14287f4f920c570ac8653f356a
Fixes: 111413092
Test: This CL can't pass Robo test.
2018-07-20 11:32:13 +08:00
Fan Zhang
176ccd0c35 Clean up: fix incorrect @VisibleForTesting imports
Test: rebuild and robotests
Change-Id: I33d7ee1c0622c01f592920baaf01d44ad19d9a13
2018-07-13 13:08:53 -07:00
tmfang
99cc23d0da Settings Fragment Migration (Change imports)
This commit *only* changes imports and optimize imports.
We don't do anything else.

This patch can't compile pass and run test case.
We will update other patches to fix these problem.

Change list.

1. import android.app.Fragment; ->
   import androidx.fragment.app.Fragment;
2. import android.app.DialogFragment; ->
   import androidx.fragment.app.DialogFragment;
3. import android.app.ListFragment; ->
   import androidx.fragment.app.ListFragment;
4. import android.app.LoaderManager; ->
   import androidx.loader.app.LoaderManager;
5. import android.content.AsyncTaskLoader; ->
   import androidx.loader.content.AsyncTaskLoader;
6. import android.content.Loader; ->
   import androidx.loader.content.Loader;
7. import android.app.FragmentTransaction; ->
   import androidx.fragment.app.FragmentTransaction;
8. import android.app.FragmentManager; ->
   import androidx.fragment.app.FragmentManager;
9. import android.app.LoaderManager.LoaderCallbacks; ->
    import androidx.loader.app.LoaderManager.LoaderCallbacks;

Bug: 110259478
Test: Can't test it.
Change-Id: I0a3f98fff34a3494a839c3c42aeabcec3df2c8b3
2018-07-11 18:23:51 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
hjchangliao
e86eec0c07 Rename SubSettingLauncher.setTitle, add java doc
For make this method usage more clear,
setTitle(charSequence) rename as setTitleText,
add java doc: it is only for user generated string
setTitle(int) rename as setTitleRes.

Change-Id: I972cb6a8ff90873dfdc25c23f6dc3d68103c8e4e
Fixes: 78347436
Test: make RunSettingsRoboTests
2018-05-09 10:00:05 +08:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Fan Zhang
615563db0c Migrate more subsetting launching to SubSettingLauncher
Bug: 73250851
Test: robotests
Change-Id: Ic0bf23f6ac6f717bdd3d477fdb84af68badae8e6
2018-02-15 15:39:56 -08:00
Charles He
fc1ce57b13 Disable always-on VPN options if an app has opted out.
The user can turn on / off always-on for individual VPN apps in
Settings > Network > VPN. Now that we're providing an opt-out of the
always-on feature for VPN apps, we should disabled the toggles if the
VPN app has an explicit opt-out.

Related unit tests are also removed as the check is now performed in the
frameworks, not in Settings.

Bug: 36650087
Test: CTS Verifier

Change-Id: I486fec14a1f8b86e7120dbdbfed3885801ab4dd7
2017-06-27 14:14:31 +01:00
Robin Lee
b8b310df17 VPN: uncheck lockdown if always-on is off
Change-Id: I00933e0c8567997d800f9f31f78c7b19922a52b8
Fix: 36713605
Test: make RunSettingsRoboTests -j30
2017-03-30 16:01:02 +00:00
Charles He
cce4e61260 VPN settings: update strings for always-on VPN
To conform with UX guidelines and conventions, the following changes are
made to the UI of app VPN's PreferenceFragment:
(1. Always-on toggle title stays the same)
2. Always-on toggle subtext changes from "active"/"inactive" to an
explanation of the feature
3. Lockdown toggle title is shortened
4. Lockdown toggle subtext is removed completely

And the following changes are made to the legacy VPN's ConfigDialog:
5. Error message that is displayed below the "Always-on VPN" checkbox
6. Replacing \u2019 with \'

Bug: 36382729
Test: manually navigate through VPN settings
Test: make SettingsRoboTests
Change-Id: If1b4faec8743dfbf6e3f8062b53190ad63700d25
2017-03-24 16:02:57 +00:00
Fan Zhang
c6ca314c0b Log source with visibility change
- Add a method in VisibilityLoggerMixin to log visible event using
  LogMaker, which allows logging additional FIELD_CONTEXT field.
- In Utils.startFragment, add current page's metricsCategory as an extra
  to next page.
- In next page's onResume(), extract the previous page's metricsCategory
  and send it to VisibilityLoggerMixin.visible()
- Update all caller with additional paramters

Change-Id: I8e1f2597fa465b7d3aa16fa1d21c052a3219694a
Fix: 35359289
Test: RunSettingsRoboTests
2017-02-15 17:17:19 -08:00
Robin Lee
e7347dd8c0 Implement always-on VPN separate lockdown setting
Allows Settings to control whether always-on VPN is required for the
connection to complete, or if it is offered on a best-efforts basis.

Change-Id: I5eb273a99e7559adc66b05e647c9130a819f99d4
Test: runtest -x tests/app/src/com/android/settings/vpn2/VpnTests.java
Fix: 32420810
2016-12-20 15:20:43 +00:00
Tamas Berghammer
265d3c2a0c Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:17 +00:00
Robin Lee
b6f787c4df Show a disclaimer about enabling vpn lockdown
Lockdown is now the default option, not best-effort mode. It's easier
to shoot oneself in the foot now so we'll show a warning to explain that
before switching it on.

Bug: 29052115
Bug: 29076208
Test: com.android.settings.vpn2.AppSettingsTest
Change-Id: Ia6845e6a7d57baa5476b8a021fb1255fd74aabea
2016-10-07 16:27:27 +01:00
Fan Zhang
1e516287bd Add visibility metrics to dialogs.
Bug: 30681529
Test: adb logcat -b events | egrep "(sysui_|notification_)"
Change-Id: I199d2e1b2cb8588a562b46bb8128d8ece24952f0
2016-09-19 17:34:12 -07:00
Fan Zhang
6507613ebc Log visibility change for all fragments.
Bug: 30681771
Test: SettingsUnitTests

Refactor visibility logging from InstrumentedFragment into a mixin. And
apply mixin in remaining fragments.

Change-Id: Ibbb59904336254a3e4bb9e8c7d0b36e5a6bc2622
2016-08-18 14:04:13 -07:00
Robin Lee
490849b391 VpnSettings stub unit tests
For:
 - enforcing minimum target SDK
 - enforcing that only actual vpn apps are shown

Bug: 30355704
Change-Id: I4fcbea8ce0d0417c089a637d999ea83299cea5d0
2016-07-28 12:45:03 +00:00
Victor Chang
fcb0d74a3c Fix always-on is not turned off when user forgets vpn
Change-Id: Iad285ff06abde71ef040cbb29f740bcf20c3bbb7
Fix: 29991174
2016-07-06 18:27:55 +01:00
Victor Chang
52247f69a5 Add explanatory text displayed when 'Always-on' switch is greyed-out for VPN apps w/targetSdk<24
Bug: 28413917
Change-Id: I3e7c079b4f91c02e5d0c0e8fda4ac6775dd0247b
2016-06-27 18:07:35 +01:00
Robin Lee
cfc0fb02c1 Restrict Settings always-on to NYC+
Bug: 28413917
Change-Id: I1c40bdc94bb05d21daf589840adbbf04abe6c10f
2016-06-06 17:04:36 +00:00
Robin Lee
52541536d0 Disable restricted VPN actions onResume
Otherwise it's pretty easy to circumvent any future restrictions by
keeping VPN settings for a particular app open and continuing to use
it even after DISALLOW_CONFIG_VPN is applied.

Two checks:
 1) in onResume (catches almost every case)
 2) in setAlwaysOn (catches every remaining case)

Bug: 28733079
Change-Id: I1c67bb14891ef620df5ed65fbd32678e417b4a65
2016-06-01 11:32:32 +01:00
Robin Lee
cdebe28c15 Add lockdownEnabled parameter to always-on VPN API
Allows callers to opt-out of blockading network traffic during boot and
on VPN app failure.

Bug: 26694104
Change-Id: Ic2c25b79d8a17917025eb37be7de929fe156e2a3
2016-05-03 13:27:05 +01:00
Robin Lee
2821067709 Change VPN failure notification to dialog
It's pointless, verging on antipattern, to pop up a notification that
points to the screen we're already on, especially when that notification
is telling us something really high-priority ("your connection failed").

Change-Id: Idf0c219adcefd64b235960f3239a70b059213f7d
Fix: 27374485
2016-04-22 15:04:43 +01:00
Robin Lee
c9bf2ac95e Update "you're already connected to VPN" strings
Change-Id: I0e64a612b47655a0d74880bc45987c8cd2272ea8
Fix: 28303500
(cherry picked from commit 3e293cb63f)
2016-04-22 13:59:44 +00:00
Victor Chang
1b8855b211 Show notification when failing to turn on always-on vpn
- Notification icon is Settings icon
- VpnName is obtained as the same way as AppPreference
- Post notification as the current user with PendingIntent to VpnSettings to parent user
- Auto-cancel when user taps on the notification
- This implementation posts notification only when the failure happens sychronously
  (Assume ConnectivityService only unset always-on package immediately after calling setAlwaysOnVpnPackageForUser)

Bug:27374485
Change-Id: I0aee38498c8cc300dd8eb9687adcae5f9dc4f8af
2016-03-31 16:40:22 +01:00
Victor Chang
16da2aa450 Vpn settings per vpn
This CL adds a setting for each VPN
- When no_config_vpn user restriction is applied, user can't change anything in the page
- Launch the subsetting activity in the corresponding user to unlock keystore and force work challenge
- Show dialog when user replace always-on-VPN package
- When forget VPN, unset always-on-vpn

TODO: show per-VPN status in VPN list

Change-Id: Ica360ea44117db6a4ecfaed1eec6c188189c246c
2016-03-21 12:36:23 +00:00