Commit Graph

2504 Commits

Author SHA1 Message Date
Robin Lee
9b747914f3 [VPN] start lockdown before user is unlocked
Removed the dependency on KeyStore encryption by removing that flag for
VPN profiles which don't use secure credentials when saving in Settings.

Old encrypted profiles will simply fail to load untile USER_PRESENT is
sent, as before.

Bug: 26108660
Change-Id: I2677d741d54252f15cb772c94ce1b39041f1e19c
2016-01-19 16:40:20 +00:00
Robin Lee
e7a3e95319 Merge "Always-on app VPNs" 2016-01-14 11:37:18 +00:00
Robin Lee
e5d5ed5872 Always-on app VPNs
Bug: 22547950
Change-Id: I46b204170bfac58d944f39b22f815b080de71a58
2016-01-12 19:54:54 +00:00
Udam Saini
bc61def71d Merge "Makes captive portal server calculation in one place." 2016-01-12 18:40:45 +00:00
Udam Saini
cd6454606c Makes captive portal server calculation in one place.
This also creates a hidden api for the captive portal server calculation
so that the Setup Wizard can use this as well.

bug:13246857
Change-Id: I4dfd0916df97cfce13252c7cc15f7bd05ed95f77
2016-01-08 14:38:31 -08:00
Jeremy Klein
434835af8b Add a TETHER_PRIVILEGED permission and use it where needed.
BUG: 26247383
Change-Id: I73f7227d77926faa9081e83eccb83c8ddee33e08
2016-01-07 10:11:24 -08:00
Alex Cheung
803faa182b Use "merge -s ours origin/mirror-partner-mm-wireless-dev" as described in b/26154276 2015-12-23 14:48:52 -08:00
Lorenzo Colitti
94bd38860d Reinstate CHANGE_NETWORK_STATE as a normal permission.
This is a partial revert of http://ag/738523 , but not a full
revert because M apps that have gone through the WRITE_SETTINGS
route to obtain permission to change network state should
continue to have permission to do so.

Specifically:

1. Change the protection level of CHANGE_NETWORK_STATE back from
   "signature|preinstalled|appop|pre23" to "normal". This allows
   apps that declare CHANGE_NETWORK_STATE in their manifest to
   acquire it, even if they target the M SDK or above.
2. Change the ConnectivityManager permission checks so that they
   first check CHANGE_NETWORK_STATE, and then ask Settings
   if the app has the WRITE_SETTINGS runtime permission.
3. Slightly simplify the code in the Settings provider code that
   deals specifically with the ability to change network state.
4. Make the ConnectivityService permissions checks use the
   ConnectivityManager code to avoid code duplication.
5. Update the ConnectivityManager public Javadoc to list both
   CHANGE_NETWORK_STATE and WRITE_SETTINGS.

Bug: 21588539
Bug: 23597341
Change-Id: Ic06a26517c95f9ad94183f6d126fd0de45de346e
2015-12-16 15:33:15 +09:00
Jeff Davidson
7c16024c83 Merge "Relax permissions around NetworkStatsManager APIs." 2015-12-15 19:04:25 +00:00
Jeff Davidson
761896522d Merge "Fix bit-rotted NetworkStatsServiceTest." 2015-12-15 17:48:46 +00:00
Etan Cohen
9786d92050 Allow NetworkFactories to match any network specifier on a request
Current usage of NetworkSpecifier: network factory will match a request
if the request has either a (1) empty network specifier, or (2) a
network specifier which is identical to that of the network factory.
Note: 'matching' w.r.t. network specifier - all other matching rules
are still in effect.

Change: add rule (3) or the network specifier of the network factory
is the special string (which is defined as "*" and which user-facing
network requests aren't allowed to use).

Rationale: allows on-demand network creation.

Example:
- Can specify a Wi-Fi NetworkRequest with NetworkSpecifier="ssid"
- It will match a Wi-Fi network factory specifying NetworkSpecifier="*"
- That network factory will bring up a Wi-Fi network, connecting to the
  specified SSID.
- Once the network is created it will create a NetworkAgent which will
  now have a NetworkSpecifier matching that of the request (not the
  match-all special string!)

That final step of making sure that the NetworkAgent matches the request
and not the match-all is critical to delivering any subsequent callbacks
correctly. I.e. your network will only get callbacks which match it.

Bug: 26192833
Change-Id: I49e3b492e0bb48a3f6e9a34e3f94f0e1cf89741f
2015-12-15 08:06:54 -08:00
Lorenzo Colitti
eadb751c84 Merge "Remove defunct EVENT_SEND_STICKY_BROADCAST_INTENT." 2015-12-15 13:24:52 +00:00
Jeff Davidson
aa65e9c069 Relax permissions around NetworkStatsManager APIs.
Currently, access to network usage history and statistics requires a
signature|privileged permission, an AppOps bit (associated with the
PACKAGE_USAGE_STATS permission), or device/profile ownership. Once
access is granted via one of these mechanisms, it generally applies to
any UID running in the same user as the caller.

This CL expands access as follows:

-Any app can access its own usage history with no extra requirements.
-Carrier-privileged applications can access usage history for the
entire device.
-Device owners can access per-UID breakdowns for usage. Previously
they could access the summary for the whole device, but not the
individual breakdowns.

We simplify the permission model by defining three access levels -
DEFAULT (own app only), USER (all apps in the same user), and DEVICE
(all apps on the device), and propagate these levels throughout.

Finally, this CL fixes an apparent bug in
NetworkStatsSerice#hasAppOpsPermissions - if the AppOp bit was in
MODE_DEFAULT, hasAppOpsPermission would always return false instead of
falling back to the PackageManager permission check.

Bug: 25812859
Bug: 25813856
Change-Id: Ic96e0776e2a4215a400163872acea1ededfaced9
2015-12-14 17:16:37 -08:00
Jeff Davidson
b3a88669ef Fix bit-rotted NetworkStatsServiceTest.
Breakages:

-ag/574873 - Renders testReportXtOverDev obsolete as this is no longer
             a supported mode. Test has been removed.
-ag/600223 - Tests were sending a CONNECTIVITY_ACTION bcast to trigger
             a call to updateIfaces(), but the listener was removed.
             Tests now call forceUpdateIfaces() directly.
-ag/648284 - Calls to get VPN info were not mocked.

Change-Id: I309f2b5d006549104cb1d3cb83e99363dd6dac16
2015-12-14 13:05:30 -08:00
Baligh Uddin
d64c967d37 empty commit to trigger build
Change-Id: I3ec926126a0d9ee7d64ffc70ca7aa7c6c9e2a9c6
2015-12-13 18:01:17 +00:00
Tyler Gunn
dd8e195a4a Merge commit 'da131290ae5e476691e05e5eb4ac6d507012a0ac' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 20:05:46 -08:00
Tyler Gunn
1550e91dd8 Merge commit '70da83381f77e0ee9ada47eafaae395038ff77ad' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 20:04:17 -08:00
Tyler Gunn
a4d27c4b69 Merge commit '98bd72181e176cdc5536b9709127a71cca082bbf' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 19:59:27 -08:00
Christopher Tate
98048cdb2b DO NOT MERGE Introduce direct listener API for alarm delivery
The Alarm Manager now supports a set() variant that takes a listener
callback to invoke at alarm trigger time rather than a PendingIntent.
This is much lower overhead and has guaranteed low delivery latency
from the trigger time.  The tradeoff is that the app must be running
*continuously* from the time the alarm is set to the time it is
delivered.  If the app exits for any reason before the alarm fires,
the listener becomes invalid and the alarm will be dropped.  This is
more or less equivalent to setting an alarm with a broadcast
PendingIntent that matches only a runtime-registered receiver.

The app's alarm listener can be any object that implements the new
AlarmManager.OnAlarmListener interface and implements its onAlarm()
method.  There is no data delivered at alarm trigger time: whatever
state needs to be associated with the specific alarm instance should
simply be packaged inside the OnAlarmListener instance.

An alarm using OnAlarmListener can request that the onAlarm() method
be called on an arbitrary handler.  If the program passes 'null' for
this parameter when setting the alarm, the callback occurs on the
application's main Looper thread.

Cherry-picked from a75b36178d
Bug 20157436

Change-Id: I2eb030a24efdd466a2eee1666c5231201b43684b
2015-12-10 16:06:50 -08:00
Jan Nordqvist
6e0af2ced5 DO NOT MERGE Hotspot 2.0 relase 2 first cut.
CP mods to take a URL as a parameter, and new ScanInfo object.

Cherry-picked from 032e267212
Change-Id: Idbb2d4751c575ba07a56942771e2b2955b624635
2015-12-10 16:06:50 -08:00
Dianne Hackborn
66dd0330fb Add new target SDK filtering feature to BroadcastOptions.
You can now control the range of target SDKs that receivers
will be need to have in order to receive your broadcast.

Use this for CONNECTIVITY_ACTION to not allow N+ applications
to receive these broadcasts through their manifest.

Also tweak the broadcast debug output code to now include the
disposition of each receiver in the list.  This is becoming
important as skipping receivers is becoming a more common
thing to have happen.

Change-Id: I251daf68575c07cbb447536286ab4e68b7015148
2015-12-10 12:12:00 -08:00
Lorenzo Colitti
469bbe3bf5 Remove defunct EVENT_SEND_STICKY_BROADCAST_INTENT.
http://ag/572619 , which removed the 3-second CONNECTIVITY_ACTION delay,
removed its only caller, but missed removing the message declaration
and processing code.

Bug: 20013379
Change-Id: Ice573569715ba424b8bf66d1dd08184d2b4a60f1
2015-12-10 13:08:35 +00:00
Tyler Gunn
1f73b19605 Merge commit 'da131290ae5e476691e05e5eb4ac6d507012a0ac' into tgunn-mncvtdev-to-master-2015-12-04 2015-12-04 21:05:15 -08:00
Tyler Gunn
51b0374775 Merge commit '70da83381f77e0ee9ada47eafaae395038ff77ad' into tgunn-mncvtdev-to-master-2015-12-04 2015-12-04 21:04:44 -08:00
Tyler Gunn
b074520dbb Merge commit '98bd72181e176cdc5536b9709127a71cca082bbf' into tgunn-mncvtdev-to-master-2015-12-04 2015-12-04 21:00:51 -08:00
Lorenzo Colitti
4acc378b5e Don't match network requests to legacy API requests.
Currently, we look at network requests that are created by the
current requestNetwork API to see if they look like requests
that could have been created using the legacy
startUsingNetworkFeature API.

This causes those networks to be added to LegacyTypeTracker,
and so cause CONNECTIVITY_ACTION broadcasts, be accessible
using getNetworkInfo(int type), etc. This was done in the L
timeframe so that apps could request networks using the
then-new requestNetwork APIs and still use them using legacy
APIs such as requestRouteToHost.

However, the resulting CONNECTIVITY_ACTION broadcasts are
expensive. requestRouteToHost has been deprecated since L, and
mixing the old and new APIs was never recommended, so it's time
to delete this hack.

Bug: 22513439
Bug: 23350688
Bug: 25295964
Change-Id: Id867058446e5ee44396743d126d26fa57da0c990
2015-11-27 11:46:19 +09:00
Lorenzo Colitti
35e18d0049 Fix one of the breakages of ConnectivityServiceTest in master.
Change-Id: I31c7a019383fa589beb1572486700e54edfb97e8
2015-11-27 11:46:18 +09:00
Lorenzo Colitti
3999ca3d84 Merge "Fix javadoc for the NetworkRequest version of requestNetwork." 2015-11-26 08:16:51 +00:00
Lorenzo Colitti
5a97ed19a8 Fix javadoc for the NetworkRequest version of requestNetwork.
The documentation for this method says that the request can be
released using releaseNetworkRequest, but that's not true.
releaseNetworkRequest only takes a PendingIntent, and can only be
used to release a request filed with a PendingIntent.

Fix the docs to say that the request needs to be released using
unregisterNetworkCallback.

Change-Id: If044fd2d463ab8d09874172d5d56946251057a3c
2015-11-26 17:06:20 +09:00
Lorenzo Colitti
318e8eec0e Make the new NetworkRequest flavour consistent with the others.
Change-Id: I491eb0b6d2fa0f1c472c97ef403488407e71803e
2015-11-25 15:47:14 +09:00
Lorenzo Colitti
7493d4695b Merge "Temporarily add a requestNetwork flavour that takes a legacy type" 2015-11-25 06:37:25 +00:00
Lorenzo Colitti
6653c4dc9c Temporarily add a requestNetwork flavour that takes a legacy type
This method is public @hide to support progressive refactoring of
tethering away from startUsingNetworkFeature to requestNetwork,
without getting in the way of the CONNECTIVITY_ACTION cleanup in
b/22513439 .

Bug: 9580643
Bug: 22513439
Change-Id: I9053ec746cc8f415a2d5849f044667eeb14e1b19
2015-11-25 12:00:52 +09:00
Sreeram Ramachandran
c16309fa1d Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d am: d3b6e2d790 am: c987320b4a am: 992bfeab73 am: 26b435dfe1 am: 6d983179a0 am: 5d41bd8d1a am: c1552f0caf am: 38a3b2154c
am: 017e0c060c

* commit '017e0c060c659931859d3a63436000940c7c785e':
  Don't use framework permission strings for netd permissions.
2015-11-20 03:52:20 +00:00
Sreeram Ramachandran
017e0c060c Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d am: d3b6e2d790 am: c987320b4a am: 992bfeab73 am: 26b435dfe1 am: 6d983179a0 am: 5d41bd8d1a am: c1552f0caf
am: 38a3b2154c

* commit '38a3b2154c7ee5d75b5670abaa4c154edd3c36eb':
  Don't use framework permission strings for netd permissions.
2015-11-20 01:52:25 +00:00
Sreeram Ramachandran
c1bde19a5e Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d am: d3b6e2d790 am: c987320b4a am: 992bfeab73 am: 26b435dfe1 am: 6d983179a0
am: 5d41bd8d1a

* commit '5d41bd8d1acd894cef1aff9018614194df6f95ab':
  Don't use framework permission strings for netd permissions.
2015-11-19 17:20:14 +00:00
Sreeram Ramachandran
26b435dfe1 Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d am: d3b6e2d790 am: c987320b4a
am: 992bfeab73

* commit '992bfeab73c940cda7afe10af2d669d297218af5':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:50:11 +00:00
Sreeram Ramachandran
992bfeab73 Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d am: d3b6e2d790
am: c987320b4a

* commit 'c987320b4ad1a6fea7bb948cf045e6afb768d339':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:40:35 +00:00
Sreeram Ramachandran
c987320b4a Don\'t use framework permission strings for netd permissions. am: 5c36486ea0 am: f51479864b am: e7267a355d
am: d3b6e2d790

* commit 'd3b6e2d790f95f2fb3d85f0993b90bb8708a6114':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:30:59 +00:00
Sreeram Ramachandran
e7267a355d Don\'t use framework permission strings for netd permissions. am: 5c36486ea0
am: f51479864b

* commit 'f51479864b9ef8c82e4250cc972f1adee5a142d6':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:10:19 +00:00
Sreeram Ramachandran
f51479864b Don\'t use framework permission strings for netd permissions.
am: 5c36486ea0

* commit '5c36486ea0a01f8e11ce2c365e435c7968293de7':
  Don't use framework permission strings for netd permissions.
2015-11-19 15:59:42 +00:00
Sreeram Ramachandran
5c36486ea0 Don't use framework permission strings for netd permissions.
These framework permission strings were being used as arbitrary labels
that mapped to netd permissions that have completely different meaning.
This leads to confusion, so use different strings.

This is being cherry picked from lmp-mr1-dev to lmp-dev to fix failures
when creating restricted networks due to prior back-port e203d89.

Bug: 21900139
Bug: 18194858
Change-Id: Ib3ec377ab26ce904d3d4678f04edec6cb1260517
(cherry picked from commit d9bf64ba1d)
2015-11-18 17:04:18 +00:00
Christopher Tate
a75b36178d Introduce direct listener API for alarm delivery
The Alarm Manager now supports a set() variant that takes a listener
callback to invoke at alarm trigger time rather than a PendingIntent.
This is much lower overhead and has guaranteed low delivery latency
from the trigger time.  The tradeoff is that the app must be running
*continuously* from the time the alarm is set to the time it is
delivered.  If the app exits for any reason before the alarm fires,
the listener becomes invalid and the alarm will be dropped.  This is
more or less equivalent to setting an alarm with a broadcast
PendingIntent that matches only a runtime-registered receiver.

The app's alarm listener can be any object that implements the new
AlarmManager.OnAlarmListener interface and implements its onAlarm()
method.  There is no data delivered at alarm trigger time: whatever
state needs to be associated with the specific alarm instance should
simply be packaged inside the OnAlarmListener instance.

An alarm using OnAlarmListener can request that the onAlarm() method
be called on an arbitrary handler.  If the program passes 'null' for
this parameter when setting the alarm, the callback occurs on the
application's main Looper thread.

Bug 20157436

Change-Id: I2eb030a24efdd466a2eee1666c5231201b43684b
2015-10-30 12:14:15 -07:00
Erik Kline
aa8f8f33b5 Also treat loss of IPv6 as a loss of provisioning.
Bug: 23226635
Change-Id: Icebb7d83ed5b3b796901b9f023909a02eb461941
2015-10-27 17:11:27 +09:00
Lorenzo Colitti
44e6ace9c3 Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a am: bb8f652372
am: 550cc7cfd2

* commit '550cc7cfd2e8f93c8cb6e59078ce9c16d93c912a':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:33:09 +00:00
Lorenzo Colitti
550cc7cfd2 Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a
am: bb8f652372

* commit 'bb8f652372f261edd2083103d4300a9173993706':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:28:24 +00:00
Lorenzo Colitti
86f052636f Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev
am: 809dcade99

* commit '809dcade9906001f6aa51a68aa783e20bb1d7c0d':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:18:45 +00:00
Lorenzo Colitti
0b40c87afc Reinstate CHANGE_NETWORK_STATE as a normal permission.
This is a partial revert of http://ag/738523 , but not a full
revert because M apps that have gone through the WRITE_SETTINGS
route to obtain permission to change network state should
continue to have permission to do so.

Specifically:

1. Change the protection level of CHANGE_NETWORK_STATE back from
   "signature|preinstalled|appop|pre23" to "normal". This allows
   apps that declare CHANGE_NETWORK_STATE in their manifest to
   acquire it, even if they target the M SDK or above.
2. Change the ConnectivityManager permission checks so that they
   first check CHANGE_NETWORK_STATE, and then ask Settings
   if the app has the WRITE_SETTINGS runtime permission.
3. Slightly simplify the code in the Settings provider code that
   deals specifically with the ability to change network state.
4. Make the ConnectivityService permissions checks use the
   ConnectivityManager code to avoid code duplication.
5. Update the ConnectivityManager public Javadoc to list both
   CHANGE_NETWORK_STATE and WRITE_SETTINGS.

Bug: 21588539
Bug: 23597341
Change-Id: Ic06a26517c95f9ad94183f6d126fd0de45de346e
2015-10-22 08:33:45 +09:00
Lorenzo Colitti
feb08ac5a3 Merge "Don\'t buzz when automatically connecting to captive portals" into mnc-dr-dev am: d214496319 am: 5c09f31e49 am: 18ec0b5187
am: c60969a5e5

* commit 'c60969a5e558e7e645900d3586f8564ddc82fab3':
  Don't buzz when automatically connecting to captive portals
2015-10-21 02:28:06 +00:00
Lorenzo Colitti
c60969a5e5 Merge "Don\'t buzz when automatically connecting to captive portals" into mnc-dr-dev am: d214496319 am: 5c09f31e49
am: 18ec0b5187

* commit '18ec0b518741dc5ac32c52ae9681efec3e73a23c':
  Don't buzz when automatically connecting to captive portals
2015-10-21 02:19:15 +00:00
Lorenzo Colitti
21dd113304 Merge "Don\'t buzz when automatically connecting to captive portals" into mnc-dr-dev
am: d214496319

* commit 'd214496319785311f99f8415b7c8be3189420488':
  Don't buzz when automatically connecting to captive portals
2015-10-21 01:15:27 +00:00