Commit Graph

2409 Commits

Author SHA1 Message Date
Felipe Leme
e4cff08ce6 Merge "Created new public API so applications can customize its metered network usage while running in background." 2016-01-22 19:26:06 +00:00
Lorenzo Colitti
592da45e75 Merge "Debug logging for when getActiveNetworkInfo returns BLOCKED." into mnc-dr1.5-dev am: a6855a1faa am: d841d71593
am: 228c56e200

* commit '228c56e200a6600b3288c89a697a5d5511540bad':
  Debug logging for when getActiveNetworkInfo returns BLOCKED.
2016-01-22 18:50:49 +00:00
Felipe Leme
d16384b560 Created new public API so applications can customize its metered network
usage while running in background.

The new API is 'int getRestrictBackgroundStatus()' and returns the
following values:

 - RESTRICT_BACKGROUND_STATUS_DISABLED: no restrictions
 - RESTRICT_BACKGROUND_STATUS_WHITELISTED: restriction but app is
   whitelisted
 - RESTRICT_BACKGROUND_STATUS_ENABLED: full restriction

The proper way to interprete these values for using metered networks
while running on background is:

 - When disabled, there is no restriction and the application could use the
   metered networks freely.

 - When whitelisted, the application can use the metered network, but should try
   to minimize the usage.

 - When enabled, the application should not try to use metered networks at
   all, since the usage will be denied.

BUG: 26451391
Change-Id: If07d42bb88e4c02802df0234861f38aef2cfead7
2016-01-22 10:50:11 -08:00
Lorenzo Colitti
228c56e200 Merge "Debug logging for when getActiveNetworkInfo returns BLOCKED." into mnc-dr1.5-dev am: a6855a1faa
am: d841d71593

* commit 'd841d71593c0c4a7c5beaf5196a22d9158c2d697':
  Debug logging for when getActiveNetworkInfo returns BLOCKED.
2016-01-22 00:14:27 +00:00
Lorenzo Colitti
600e9a2d68 Debug logging for when getActiveNetworkInfo returns BLOCKED.
Bug: 26488100
Change-Id: I991581732d35aed18392bed2f3d69ca8fb231f5e
2016-01-22 05:21:34 +09:00
Jeff Davidson
8d16e2c29a Merge "Implement roaming tracking in NetworkStats summary queries." 2016-01-20 01:43:02 +00:00
Jeff Davidson
5210fa503f Implement roaming tracking in NetworkStats summary queries.
Whether a network is deemed roaming or not was already being tracked
as part of the NetworkIdentitySet, so the underlying data store
already tracks roaming and native data separately. However, this data
was being aggregated together in NetworkStatsCollection#getSummary,
since the NetworkIdentitySet is converted to an iface name for the
purposes of matching, and the iface name will be identical whether or
not the iface is considered roaming. Now it is separated.

Also fixes a long-standing bug in NetworkIdentitySet where an identity
read from a saved file would always be considered roaming == false,
even if it wasn't at the time it was written.

Bug: 25813438
Change-Id: I11ab5b51182ed8da7af8fde468df065f9fdc3dad
2016-01-19 16:57:51 -08:00
Robin Lee
4908ef3e42 [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
5c1c2fa073 Merge "Always-on app VPNs" 2016-01-14 11:37:18 +00:00
Robin Lee
33c73e2424 Always-on app VPNs
Bug: 22547950
Change-Id: I46b204170bfac58d944f39b22f815b080de71a58
2016-01-12 19:54:54 +00:00
Udam Saini
77c04b683b Merge "Makes captive portal server calculation in one place." 2016-01-12 18:40:45 +00:00
Udam Saini
53b71ee34b 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
0486333736 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
cd858e2dbd Use "merge -s ours origin/mirror-partner-mm-wireless-dev" as described in b/26154276 2015-12-23 14:48:52 -08:00
Jeff Davidson
e993bb4c8e Merge "Relax permissions around NetworkStatsManager APIs." 2015-12-15 19:04:25 +00:00
Jeff Davidson
7b376e8c8e Merge "Fix bit-rotted NetworkStatsServiceTest." 2015-12-15 17:48:46 +00:00
Lorenzo Colitti
50461077fe Merge "Remove defunct EVENT_SEND_STICKY_BROADCAST_INTENT." 2015-12-15 13:24:52 +00:00
Jeff Davidson
1046856083 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
86bc22e37f 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
7f18ef2523 empty commit to trigger build
Change-Id: I3ec926126a0d9ee7d64ffc70ca7aa7c6c9e2a9c6
2015-12-13 18:01:17 +00:00
Tyler Gunn
6c194d9014 Merge commit 'da131290ae5e476691e05e5eb4ac6d507012a0ac' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 20:05:46 -08:00
Tyler Gunn
5ab5b554ab Merge commit '70da83381f77e0ee9ada47eafaae395038ff77ad' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 20:04:17 -08:00
Tyler Gunn
92d8863f70 Merge commit '98bd72181e176cdc5536b9709127a71cca082bbf' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 19:59:27 -08:00
Christopher Tate
75fb864e80 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 b481a892d2
Bug 20157436

Change-Id: I2eb030a24efdd466a2eee1666c5231201b43684b
2015-12-10 16:06:50 -08:00
Jan Nordqvist
5dbd59feb2 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 0f3b4449b0
Change-Id: Idbb2d4751c575ba07a56942771e2b2955b624635
2015-12-10 16:06:50 -08:00
Dianne Hackborn
6782e22930 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
048896e466 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
18d1c7d77a Merge commit 'da131290ae5e476691e05e5eb4ac6d507012a0ac' into tgunn-mncvtdev-to-master-2015-12-04 2015-12-04 21:05:15 -08:00
Tyler Gunn
83223f9090 Merge commit '70da83381f77e0ee9ada47eafaae395038ff77ad' into tgunn-mncvtdev-to-master-2015-12-04 2015-12-04 21:04:44 -08:00
Tyler Gunn
a603141563 Merge commit '98bd72181e176cdc5536b9709127a71cca082bbf' into tgunn-mncvtdev-to-master-2015-12-04 2015-12-04 21:00:51 -08:00
Lorenzo Colitti
5cce267ba3 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
eb3e2c47a3 Fix one of the breakages of ConnectivityServiceTest in master.
Change-Id: I31c7a019383fa589beb1572486700e54edfb97e8
2015-11-27 11:46:18 +09:00
Lorenzo Colitti
bbb3607bec Merge "Fix javadoc for the NetworkRequest version of requestNetwork." 2015-11-26 08:16:51 +00:00
Lorenzo Colitti
4c9cc847f7 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
716c073e63 Make the new NetworkRequest flavour consistent with the others.
Change-Id: I491eb0b6d2fa0f1c472c97ef403488407e71803e
2015-11-25 15:47:14 +09:00
Lorenzo Colitti
508689c5e2 Merge "Temporarily add a requestNetwork flavour that takes a legacy type" 2015-11-25 06:37:25 +00:00
Lorenzo Colitti
873f7bb0b7 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
0844e31d96 Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790 am: 934b45022a am: 8b05ea51ad am: 4d2ed63c65 am: 6d983179a0 am: 5d41bd8d1a am: c1552f0caf am: 38a3b2154c
am: d6832351c9

* commit 'd6832351c9516926d021045417750c175c5cf4c5':
  Don't use framework permission strings for netd permissions.
2015-11-20 03:52:20 +00:00
Sreeram Ramachandran
d6832351c9 Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790 am: 934b45022a am: 8b05ea51ad am: 4d2ed63c65 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
84376d950f Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790 am: 934b45022a am: 8b05ea51ad am: 4d2ed63c65 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
4d2ed63c65 Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790 am: 934b45022a
am: 8b05ea51ad

* commit '8b05ea51adab2a057ed0367472d194c2dc29a0bc':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:50:11 +00:00
Sreeram Ramachandran
8b05ea51ad Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581 am: d3b6e2d790
am: 934b45022a

* commit '934b45022aaaee96a43768ac1c498c6a49f7b2cd':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:40:35 +00:00
Sreeram Ramachandran
934b45022a Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0 am: a40a3e6bf4 am: e55b156581
am: d3b6e2d790

* commit 'd3b6e2d790f95f2fb3d85f0993b90bb8708a6114':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:30:59 +00:00
Sreeram Ramachandran
e55b156581 Don\'t use framework permission strings for netd permissions. am: 2c4e4c95e0
am: a40a3e6bf4

* commit 'a40a3e6bf4c3de9119812d854bf53923a68131ed':
  Don't use framework permission strings for netd permissions.
2015-11-19 16:10:19 +00:00
Sreeram Ramachandran
a40a3e6bf4 Don\'t use framework permission strings for netd permissions.
am: 2c4e4c95e0

* commit '2c4e4c95e011bc4dd54c71c341b1f7ff83a53842':
  Don't use framework permission strings for netd permissions.
2015-11-19 15:59:42 +00:00
Sreeram Ramachandran
2c4e4c95e0 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 e46a802.

Bug: 21900139
Bug: 18194858
Change-Id: Ib3ec377ab26ce904d3d4678f04edec6cb1260517
(cherry picked from commit d84f7f863c)
2015-11-18 17:04:18 +00:00
Christopher Tate
b481a892d2 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
bb2024b595 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
93a2f99192 Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a am: bb8f652372
am: c41cfe3335

* commit 'c41cfe3335d4f82952e056d6a961e7b9fb91bd95':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:33:09 +00:00
Lorenzo Colitti
c41cfe3335 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