Commit Graph

83 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
Janis Danisevskis
146a0dab01 Keystore 2.0: Make Legacy VPN settings ready for Keystore 2.0
Keystore 2.0 no longer stores vpn profiles. It still offers a
Legacy VPN profile store, to access existing profiles.

Test: N/A
Bug: 171305607
Bug: 171305388
Merged-In: I40dea0b9c3824b56814ae4c2fb6c7663c7d97af5
Change-Id: I40dea0b9c3824b56814ae4c2fb6c7663c7d97af5
2021-03-03 22:30:48 -08: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
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
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
Philip P. Moltmann
e3f721132a RestrictedLockUtils was split into ...Internal
This means that in some cases RestrictedLockUtils has to be used and in
some RestrictedLockUtilsInternal.

This causes a lot of trivial code changes.

I also updated the ordering of the imports in all affected files.

Bug: 110953302
Test: Built
      make -j RunSettingsRoboTests
Change-Id: I9bdf8b89134f853bae4f38c81af436715c73e924
2018-08-30 08:11:39 -07: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
176ccd0c35 Clean up: fix incorrect @VisibleForTesting imports
Test: rebuild and robotests
Change-Id: I33d7ee1c0622c01f592920baaf01d44ad19d9a13
2018-07-13 13:08:53 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -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
Fan Zhang
e0b0e9f902 Refactor help menu stuff into a controller
This is a clean up to action bar menu item pattern, we will use the same
pattern to build search icon on all pages in a later change.

Bug: 68814716
Test: robotests
Change-Id: Iedd3ec263e8ccb63ed75ec7a95b28c00878b1de4
2017-11-29 15:51:04 -08:00
Robin Lee
b26ce1e13b resolve merge conflicts of 90f009ebb5 to master
Test: make RunSettingsRoboTests
Change-Id: I7f0eece61918c29d33316fa755eca2e8f4deba46
2017-03-27 17:35:57 +01:00
liurong
2710b99d2f [VpnSettings]Crash when activity has been recycled
This is a case we found in monkey test, the main thread handles message while the activity has been recycled. It will raise a NullPointerException when we use getActivity() in following lines.
Assumpt the situation is: settings run in background and activity been recycled quickly, but handler still in the process.

Test: NA

Change-Id: I19db4f13e13294618ec8e42e4d9c54ce23504344
Signed-off-by: liurong <liurong@xiaomi.com>
2017-03-24 15:21:23 +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
Fan Zhang
62e66c9ca4 Move GearPreference to widget package.
- This is step1 of making gear preference more flexible to use.

Bug: 33579296
Test: builds
Change-Id: I30ac6c75f7ad16ec5c732fbb93170e5fab0eacb7
2017-02-08 16:09:12 -08:00
Robin Lee
d5afb5a60c resolve merge conflicts of 6446d2f to master
Change-Id: Ibf37d7fed8f8fbb32a601944f504494101c21a3e
2016-12-23 12:16:19 +00:00
insight.lee
7c4d52c570 Update VPN preference state after disallow configuring VPN policy has changed.
1. When Settings > More and change disallow configuring VPN policy
   and resume Settings, update VPN preference state.

2. When Settings > More > VPN and change disallow configuring VPN policy
   and resume VPN Settings, update its state.

Test: manual

Signed-off-by : Sungmin Lee <insight.lee@lge.com>

Change-Id: I4f3c85733ca6ba05cba46e2f4854f54a42b10c21
2016-12-22 16:14:48 +09:00
Robin Lee
9c2758f407 VpnSettings PreferenceList tests
For validating that when VPNs are added / removed, the right set of
changes are made to the PreferenceGroup in which they are supposed to
be shown.

Bug: 30998549
Bug: 29093779
Test: runtest -x packages/apps/Settings/tests/unit/src/com/android/settings/vpn2/PreferenceListTest.java
Change-Id: I9394db0e78cc984ab62e3670aa0a7942ae767a66
2016-11-28 17:42:56 +00:00
Robin Lee
393857be9c VpnSettings: show connected VPN even if deleted
So there's a way to disconnect from it, if someone deletes all the
keystore entries and the VPN doesn't actually exist any more (but
is still sitting around in memory somewhere keeping the connection
alive).

Bug: 29093779
Fix: 32880676
Test: runtest -x tests/app/src/com/android/settings/vpn2/VpnTests.java
Change-Id: I97671a74af746e5baaa5be0b5cff24e2b1766f53
2016-11-28 17:41:58 +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
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
7cd00a6623 Run VPN refresh on a HandlerThread
Bug: 28315317
Change-Id: I1aa4748b9454db5abf866b3ea71a9c46cceca82d
2016-07-27 18:48:18 +01:00
Robin Lee
b166ea2668 Be more aggressive caching Vpn preference attrs
As any change to the preference title will cause it to lose focus,
best not to do this too often.

Change-Id: Ibac27ee1de42fd7ca05f3e3685b84f37dac39517
Fix: 28191965
2016-04-21 18:04:42 +01:00
Robin Lee
b3c4133a71 Allow disconnecting always-on VPNs
Bug: 28072644
Change-Id: If7595f7e17747867158368d95db5addf97d3a14c
2016-04-14 15:41:41 +01:00
Victor Chang
6005aefd44 Remove VPN Overflow menu
- Move always-on option for legacy vpn into the legacy vpn config page
- This implementation doesn't show dialogue when replacing existing always-on vpn
- Continue to disable lockdown option for legacy vpn when "persist.radio.imsregrequired" is true.
  Not applying to vpn app
- Force to save account info when legacy vpn is always-on
- When legacy vpn is always-on, don't try to connect. (Otherwise, an exception is thrown)

TODO: Remove EXTRA_PICK_LOCKDOWN in LockdownVpnTracker in framework

Bug: 26950700
Change-Id: Ia80669359c0b7cdb955c84937156c020ac6e9af5
2016-03-29 17:28:36 +01:00
Victor Chang
14c2ac4dcb Per vpn setting change in VPN list
- Show admin support details when user taps on a cell and user restriction is on
- Show always-on-vpn active status in preference summary
- User can still open non-configurable per-VPN info page even when user restriction is applied
- Rename ConfigPreference to LegacyVpnPreference
- Move summary String handling into ManageablePreference
- ManageablePreference inherits GearPreference to reuse the code
- Don't show disconnect dialog when always-on is enabled

BUG=26950700

Change-Id: I37b087879cf3b674df528e7787d7bb1eead3310f
2016-03-21 12:36:44 +00: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
Robin Lee
37b179fa8c vpn: check fragment is visible before adding prefs
As VPN settings listens to network events it may get woken up again
while it's in the background.

Bug: 23596799
Change-Id: If6e07493da447d7ded324ff86b6e7d57c5c615e3
2016-03-17 10:26:51 +00:00
Robin Lee
eb034eb65e Show "no vpns added" for empty vpn screen
Removed the left-alignment on restricted empty views which was
inherited from Bluetooth settings but inconsistent with normal
settings fragments.

Bug: 22685111
Change-Id: I3a36c47d523392b8925031d4cac2ab3ef681e360
2016-03-16 20:28:52 +00:00
Sudheer Shanka
7dbbe13168 Add disabled by policy empty views to more screens.
Bug: 27214401
Change-Id: I6cd4292a63610671070bf2134105e9e348c3ab32
2016-02-19 20:18:43 +00:00
Robin Lee
cac0dddd2a Disable VPN prefs for restriction or lockdown case
Change-Id: I2fcf84876bf23b92cdcd00ce93514106914d0c29
2016-02-02 14:50:57 +00:00
Chris Wren
9d1bfd1e8d port settings over to new metrics enum
Change-Id: I0b3efd2f4db773ccbc52bfe59ee8eb0dab9584fb
2016-01-27 10:58:58 -05:00
Robin Lee
003a4b563a Show app VPNs in always-on list
Bug: 22547950
Change-Id: I1b37f3b8d2a061f9f6fba3c8b9a95f3b7edcee64
2016-01-14 17:17:52 +00:00
Robin Lee
4c85639733 [VPN] save public legacy VPN details publicly
This does not include certificates, private keys etc. which are still
saved in the KeyStore with the encryption the user requested for them.

Makes connecting to lockdown vpn before user unlock possible.

Bug: 26108660
Change-Id: I56c1672c7a41e761c2791584b99900aff51b59e4
2016-01-05 18:48:46 +00:00
Robin Lee
7bf8654a5c Refactor VPN settings refresh to reuse preferences
The old way was garbage-heavy. To add to that some changes to the way
PreferenceScreens are redrawn was leading to some artifacts with items
fading in/out every tick.

Bug: 25588385
Change-Id: Idabf7546ab519bf196ad3b8582caa2ec6bf9e084
2015-12-08 15:31:32 +00:00
Robin Lee
8edd4c1f8d Merge "VPN settings: grey out policy-restricted menus" am: ee4808d37b am: 905829393d
am: 3ed65b90d0

* commit '3ed65b90d0348b60fc57c08e96986e03fef2fd4e':
  VPN settings: grey out policy-restricted menus
2015-11-13 14:14:09 +00:00
Robin Lee
4198607ee2 VPN settings: grey out policy-restricted menus
setHasOptionsMenu seems unreliable at stopping onCreateOptoinsMenu from
being called.

Change-Id: Ie86da8e35dddb6e3a0e4678defc55bf5776f6c2f
2015-11-13 14:01:43 +00:00
Jason Monk
39b467482d Depend on support lib preferences
Bug: 24576551
Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
2015-10-13 10:12:20 -04:00
Robin Lee
290784afde Match getLegacyVpn calls to changed interface
The userId argument is now explicit. Pre-requisite for bug 21499103

Change-Id: Ib83e9615326ea484ef6d63fb1a1d9c1659999dab
2015-07-07 12:35:14 -07:00
Robin Lee
614fc178bf Fix build
Change-Id: Ibb2db14b2fd38b2c8c066c97f8cd6e396c104ce8
2015-06-25 16:01:44 -07:00
Robin Lee
dd142295da Enable VPN settings for secondary users
This is now supported.

Change-Id: I4a8eabe3042c04061f293066e84238029f18ecd8
2015-06-25 15:26:02 -07:00
Robin Lee
5f6f4cc572 Only unregister the network callback at onPause
Bug: 21592804
Change-Id: I425a8ebd350125ae48b9cf44cfef0b4c572ec25e
2015-06-17 18:44:58 -07:00
Alex Klyubin
3848407d0c Switch from KeyStore.saw to KeyStore.list.
KeyStore.saw was renamed to KeyStore.list for clarity. The
implementation of both methods is exactly the same.

Bug: 18088752
Change-Id: I2f171a4b7479683d5af898ebdf1b6f8a741536d1
2015-06-08 09:30:08 -07:00
Nicolas Prevot
a5df4779a0 Don't allow secondary users apps to start restricted Settings fragment.
On a secondary user, the fragments ApnSettings, TetherSettings and VpnSettings
should not be started.

But an app can still send an intent to start these fragments.
Prevent this by checkin the userId in these fragments.

BUG:15313261
BUG:15312781
BUG:15312494

Change-Id: I2a36bb89a8e37e4440aa28372d7a1800b33dae37
2015-06-02 16:49:20 -07:00
Robin Lee
c409605356 Clear connected legacy VPN during rescan
Change-Id: I0fec37b3f73ce5b538721d79e78e1128d7667380
2015-06-01 18:45:40 -07:00
Robin Lee
01b35bcae3 VPN: UI for forgetting disconnected VPNs
Made possible by expanded internal VPN APIs.

Bug: 20872408
Bug: 20692490
Bug: 20747154
Change-Id: Idc87084a130afa18b27c85cc9d4b5033dcedaabe
2015-05-18 22:55:15 +01:00
Robin Lee
ab6a65c03b VPN: Convert current-context IPCs to user context
These fetch info for the wrong user, which may be either wrong or worse
wholly nonexistent.

Bug: 20747154
Change-Id: Ibd5f2e5d3c5dfd252a032ebdfe204de7166fa3a5
2015-05-05 10:54:24 +00:00
Robin Lee
2bd92d5d06 vpn2: show third-party VPN services
VPN apps are shown alongside configured VPNs now. The requirement that
a password is set is now only enforced when setting up a configured
VPN as this is not necessary for apps.

Some UI redesign.

Bug: 19573824
Bug: 17474682
Bug: 19575658
Change-Id: I02bd977136929647d65b9784fb4cc5df24b45428
2015-04-21 19:42:53 +01:00