Commit Graph

2660 Commits

Author SHA1 Message Date
Elliott Hughes
b89fe38222 resolve merge conflicts of bc90502 to nyc-dev-plus-aosp am: ddd7dd8e7f
am: 13d5a1d648

* commit '13d5a1d648bd71e92347dd30629648c90326fccf':
  Make android_net_NetUtils include what it actually uses.

Change-Id: I775c03ba7fd3895c6525d3986b564b228d34063b
2016-05-13 16:08:58 +00:00
Elliott Hughes
13d5a1d648 resolve merge conflicts of bc90502 to nyc-dev-plus-aosp
am: ddd7dd8e7f

* commit 'ddd7dd8e7f7d661e4a411f2c9f14f69a86e172a4':
  Make android_net_NetUtils include what it actually uses.

Change-Id: I84a143e1922c7180a0a1926d2cfd87b59bca137d
2016-05-13 16:06:35 +00:00
Elliott Hughes
ddd7dd8e7f resolve merge conflicts of bc90502 to nyc-dev-plus-aosp
Change-Id: Ic78042d45085718b2220107e9a84767df316440a
2016-05-13 08:57:40 -07:00
Paul Jensen
60612f8096 Merge "Merge "ApfFilter unit test" into nyc-dev am: cf12d6140b am: 771d9fe0b6" into nyc-mr1-dev-plus-aosp
am: f97396b8ad

* commit 'f97396b8ad5f57fd25f12e1661257323dad18ae4':

Change-Id: Ibef62387f6c05632432408c5e011377dd8498d6a
2016-05-13 14:47:57 +00:00
Paul Jensen
30c3ad8d61 Merge "ApfFilter unit test" into nyc-dev am: cf12d6140b am: 83e6bff540
am: 6f62c8df0f

* commit '6f62c8df0f0771cc6301c1b40c7757f3c8b6e5f8':
  ApfFilter unit test

Change-Id: Ide959b34cd6bd97620b2c14812bd362d203fd85f
2016-05-13 14:43:06 +00:00
Android Build Merger (Role)
f97396b8ad Merge "Merge "ApfFilter unit test" into nyc-dev am: cf12d6140b am: 771d9fe0b6" into nyc-mr1-dev-plus-aosp 2016-05-13 14:41:03 +00:00
Paul Jensen
e1fbe074e5 Merge "ApfFilter unit test" into nyc-dev am: cf12d6140b
am: 771d9fe0b6

* commit '771d9fe0b607a953f2efbb64745c1e68f4fced01':
  ApfFilter unit test

Change-Id: I00a8b46efdd8e52d2756723f2e11b48e3231eff6
2016-05-13 14:40:42 +00:00
Paul Jensen
6f62c8df0f Merge "ApfFilter unit test" into nyc-dev am: cf12d6140b
am: 83e6bff540

* commit '83e6bff54056e75314762e8d50fc71b912ab5fe1':
  ApfFilter unit test

Change-Id: I17ddf9d4823588dd2cad0d5662ec434ae2d027f6
2016-05-13 14:40:39 +00:00
Paul Jensen
83e6bff540 Merge "ApfFilter unit test" into nyc-dev
am: cf12d6140b

* commit 'cf12d6140b923c3049f26b4e57bd64003c5885c9':
  ApfFilter unit test

Change-Id: I97bdf703c24c8c3008113c09f5f441cd1d74bc81
2016-05-13 14:38:13 +00:00
Paul Jensen
cf12d6140b Merge "ApfFilter unit test" into nyc-dev 2016-05-13 14:33:25 +00:00
Elliott Hughes
ee04c535f0 Make android_net_NetUtils include what it actually uses.
Bug: http://b/28519060
Change-Id: I49dcd358d3fc8e0ba5c5e0b50a0f5dcc63281d22
2016-05-11 15:18:13 -07:00
Antonio Cansado
44a88e29e5 Merge "Merge "Addressing API council comments on NetworkStatsManager." into nyc-dev am: dc5f558640 am: de224ba451" into nyc-mr1-dev-plus-aosp
am: 5062e21feb

* commit '5062e21febf47d96392a306959e533707f5540f3':

Change-Id: I7a1644a097b8edbaa0da0b80c0e2b6f374f99cf1
2016-05-10 21:14:17 +00:00
Antonio Cansado
39485fcdfc Merge "Addressing API council comments on NetworkStatsManager." into nyc-dev am: dc5f558640 am: 860924860a
am: 1f186ce13b

* commit '1f186ce13bf383be39bd4b610bcb3e69f2882899':
  Addressing API council comments on NetworkStatsManager.

Change-Id: Ie6455799758f0bdb67440f72c266effaf412e22f
2016-05-10 21:14:09 +00:00
Android Build Merger (Role)
5062e21feb Merge "Merge "Addressing API council comments on NetworkStatsManager." into nyc-dev am: dc5f558640 am: de224ba451" into nyc-mr1-dev-plus-aosp 2016-05-10 21:08:59 +00:00
Antonio Cansado
c24a9e3baa Merge "Addressing API council comments on NetworkStatsManager." into nyc-dev am: dc5f558640
am: de224ba451

* commit 'de224ba451547fcc139ec6c565243e0f450ece46':
  Addressing API council comments on NetworkStatsManager.

Change-Id: I1383b3c11653daaa3a0ca34600dbc7e28af24641
2016-05-10 21:08:28 +00:00
Antonio Cansado
1f186ce13b Merge "Addressing API council comments on NetworkStatsManager." into nyc-dev am: dc5f558640
am: 860924860a

* commit '860924860a5a27f609210079076e907640e229da':
  Addressing API council comments on NetworkStatsManager.

Change-Id: Ia886e1ce98520c1618ba501097a2c979a628bbb4
2016-05-10 21:08:25 +00:00
Antonio Cansado
860924860a Merge "Addressing API council comments on NetworkStatsManager." into nyc-dev
am: dc5f558640

* commit 'dc5f558640da8785fabc274167ec37a0fda30cd6':
  Addressing API council comments on NetworkStatsManager.

Change-Id: I952e69e7cfbd8cebcbac7c3b19ede300e26777e8
2016-05-10 21:05:17 +00:00
Antonio Cansado
3bbf833ff4 Addressing API council comments on NetworkStatsManager.
Callbacks
 - DataUsageCallback renamed to UsageCallback
 - DataUsagePolicy removed; passing in params directly to register method
 - making it an abstract class
 - passing in (networkType, subscriberId) that reached its threshold
 - renaming onLimitReached to onThresholdReached to match existing naming
 - only monitor single network,subscriberId
 - no monitoring of specific uids; using device or user wide instead

Tags
 - only owner uid can read its tags
 - exposing only TAG_NONE to match service side

BUG: 27530098

Change-Id: I2b2664da71806868a1e937d2bf4d1f234637509b
2016-05-10 13:24:16 -07:00
Paul Jensen
97d1682d07 ApfFilter unit test
Bug: 26238573

Change-Id: I5171038228782bd54e91f5bcc663cc529d2c1150
2016-05-10 11:54:42 -04:00
Felipe Leme
2e6c791d53 Merge "Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140 am: f39d22efcf" into nyc-mr1-dev-plus-aosp
am: 597409049c

* commit '597409049c43a8db383c3560294d36c2c1243f3f':

Change-Id: I84bb94fff82e9a7965147b0bb1736ab5529b6c8d
2016-05-06 23:48:57 +00:00
Felipe Leme
78c6cc4f44 Merge "Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140 am: f39d22efcf" into nyc-mr1-dev-plus-aosp
am: 67ff40fadd

* commit '67ff40fadd7cb5ac7ad474b1364a52e1705a7cad':

Change-Id: I681d58e763bec7b22b2962c98661576f534d6669
2016-05-06 23:48:54 +00:00
Felipe Leme
6fca287f50 Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140 am: 87d20317bf
am: d9c0f5c6a1

* commit 'd9c0f5c6a1e2c16b61ed0d87b5533aed295273c9':
  Fixed connectivity state in some restricted network scenarios.

Change-Id: I1bc51c4a06dad9245ce0ed884707855b2c04edf1
2016-05-06 23:48:47 +00:00
Android Build Merger (Role)
597409049c Merge "Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140 am: f39d22efcf" into nyc-mr1-dev-plus-aosp 2016-05-06 23:47:02 +00:00
Felipe Leme
bac2fa1d05 Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140
am: f39d22efcf

* commit 'f39d22efcf7db6043e13fbc093de2799c3ccf531':

Change-Id: Ic58995d889136c62d397bb8323ed8b66be90e3cf
2016-05-06 23:46:37 +00:00
Android Build Merger (Role)
67ff40fadd Merge "Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140 am: f39d22efcf" into nyc-mr1-dev-plus-aosp 2016-05-06 23:44:23 +00:00
Felipe Leme
d9c0f5c6a1 Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140
am: 87d20317bf

* commit '87d20317bf26e87ef58798d3c5aafb81aa163788':
  Fixed connectivity state in some restricted network scenarios.

Change-Id: Ifeb332fbf00c554b78d0ad724b34e3a8ebfc9894
2016-05-06 23:43:55 +00:00
Felipe Leme
bb507dda10 Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev am: 638a6e8140
am: f39d22efcf

* commit 'f39d22efcf7db6043e13fbc093de2799c3ccf531':
  Fixed connectivity state in some restricted network scenarios.

Change-Id: I76e419d0d010652699b9081418f5f654763887d1
2016-05-06 23:43:52 +00:00
Felipe Leme
f39d22efcf Merge "Fixed connectivity state in some restricted network scenarios." into nyc-dev
am: 638a6e8140

* commit '638a6e8140a22a0ddb5d5dacb02173795073bd1a':
  Fixed connectivity state in some restricted network scenarios.

Change-Id: I0fd66b16c83680940f294ea8e117443ffd8a50cd
2016-05-06 23:38:59 +00:00
Felipe Leme
5f28bfd3b2 Merge "Merge "Refactored NetworkPolicyManagerService mUidRules." into nyc-dev am: de66540fd3 am: 0da215640f" into nyc-mr1-dev-plus-aosp
am: de65e700d1

* commit 'de65e700d11f8190e7d1cee8f2812fe4ddff82eb':

Change-Id: I4f87fca12c9b4d8c3e54a5fbb3cf8b991e0d2007
2016-05-06 22:03:23 +00:00
Felipe Leme
f280431d39 Merge "Refactored NetworkPolicyManagerService mUidRules." into nyc-dev am: de66540fd3 am: de4c468267
am: 877112035d

* commit '877112035dedb3aa66ec10023d93ca76afd35dfb':
  Refactored NetworkPolicyManagerService mUidRules.

Change-Id: I0b348dc47666d563d368d82aa9633dcfe56992a0
2016-05-06 22:03:18 +00:00
Android Build Merger (Role)
de65e700d1 Merge "Merge "Refactored NetworkPolicyManagerService mUidRules." into nyc-dev am: de66540fd3 am: 0da215640f" into nyc-mr1-dev-plus-aosp 2016-05-06 21:58:55 +00:00
Felipe Leme
a3ada5e487 Merge "Refactored NetworkPolicyManagerService mUidRules." into nyc-dev am: de66540fd3
am: 0da215640f

* commit '0da215640fa1aa90e7f3063cfa23df629f268ff2':
  Refactored NetworkPolicyManagerService mUidRules.

Change-Id: I58c29071b21ffdd9285b33964bfc2c5b254dd298
2016-05-06 21:58:26 +00:00
Felipe Leme
877112035d Merge "Refactored NetworkPolicyManagerService mUidRules." into nyc-dev am: de66540fd3
am: de4c468267

* commit 'de4c468267e163a7085f4afd4352f0a182331d13':
  Refactored NetworkPolicyManagerService mUidRules.

Change-Id: Ie81707e54ebf15e5b01a533bda433551d0a3b73e
2016-05-06 21:58:18 +00:00
Felipe Leme
b414e6f2a3 Fixed connectivity state in some restricted network scenarios.
NetworkPolicyManagerService (NMPS) keeps an internal list of uid
rules (mUidRules) for network restrictions, and when these rules
changes it needs to notify external listeners (such as
ConnectivityService / CS).

Prior to Android N, both Data Saver mode (the feature previously known
as "Restrict Baground Data") and Battery Save mode used the same set of
firewall rules to implement their restrictions: when Battery Saver mode
NPMS would mark all networks as metered and set the proper firewall
rules externally.

Recently, these 2 modes were split in 2 distinct firewall rules and
NMPS.updateRuleForRestrictBackgroundLocked() was changed to update
the mUidRules logic based on the Data Saver firewall (since the Battery
Saver firewall changes are handled externally, on
updateRuleForRestrictPowerLocked()). As such, CS was not notified when
the power-related changes were made, which would cause apps to get a
state of CONNECTED / CONNECTED when querying its active connection.

Another scenario that is not properly handled is when a UID whitelisted
for Data Saver is brought back to foreground: although the proper
firewall rules are set, CS is not notified, and the apps state would be
DISCONNECTED / BLOCKED.

This CL introduces many changes that fix this issue:

- Fixed updateRuleForRestrictBackgroundLocked() to invoke
  onUidRulesChanged() when the Battery Saver status changed.
- Fixed updateRuleForRestrictBackgroundLocked() to invoke
  onUidRulesChanged() when an app whitelisted for Data Saver is brought
  back to the foreground.
- Added a new API (onRestrictPowerChanged() and getRestrictPower())
  to notify external services about Battery Saver mode changes.
- Fixed CS logic to properly handle the Battery Saver changes.

Externally to this change, the CTS tests were also improved to verify
the apps get the proper connection state; they can be verified running:

cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests \
    -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

BUG: 28521946

Change-Id: I8eaccd39968eb4b8c6b34f462fbc541e5daf55f1
2016-05-06 14:53:50 -07:00
Felipe Leme
de4c468267 Merge "Refactored NetworkPolicyManagerService mUidRules." into nyc-dev
am: de66540fd3

* commit 'de66540fd3f73937c3cfbe1d50e575aa69acc474':
  Refactored NetworkPolicyManagerService mUidRules.

Change-Id: I25d2520eafcf8c45b80b94908a3b5bfa04315f76
2016-05-06 21:53:39 +00:00
Felipe Leme
b30ef31381 Refactored NetworkPolicyManagerService mUidRules.
NetworkPolicyManagerService (NMPS) keeps an internal list of uid
rules (mUidRules) for network restrictions, and when these rules
changes it needs to notify external listeners (such as
ConnectivityService / CS).

Prior to Android N, both Data Saver mode (the feature previously known
as "Restrict Baground Data") and Battery Save mode used the same set of
firewall rules to implement their restrictions: when Battery Saver mode
NPMS would mark all networks as metered and set the proper firewall
rules externally.

Recently, these 2 modes were split in 2 distinct firewall rules and
NMPS.updateRuleForRestrictBackgroundLocked() was changed to update
the mUidRules logic based on the Data Saver firewall (since the Battery
Saver firewall changes are handled externally, on
updateRuleForRestrictPowerLocked()). As such, CS was not notified when
the power-related changes were made, which would cause apps to get a
state of CONNECTED / CONNECTED when querying its active connection.

This change refactores the mUidRules to use bitmasks, in preparation for
another change that will fix the issue.

It also fixes a minor bug that was preventing removed packages to be
removed from the whitelist.

BUG: 28521946
Change-Id: I9f0e1509a6192cad403f740c1cd76a6b7dab7d26
2016-05-06 17:58:40 +00:00
Robin Lee
8002e84b54 Merge "Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev am: 4c2242b254 am: 7f13b648df" into nyc-mr1-dev-plus-aosp
am: fb450bf661

* commit 'fb450bf6611339ac524ca7414f8dd0ec3377e56b':

Change-Id: I18549dd882c1dd6f2a8e39a170c1defccfc59890
2016-05-04 22:10:41 +00:00
Robin Lee
fd5ac1ac7c Merge "Merge changes I31d5260d,Ied92f558 into nyc-dev am: 9677633814 am: adab05fdfc" into nyc-mr1-dev-plus-aosp
am: 21d0fa8c49

* commit '21d0fa8c49e86acaaf7268d014b61ba356e613a0':

Change-Id: If71bb13a2871cb577a9b39cf0db9eca0c880d79c
2016-05-04 22:10:33 +00:00
Robin Lee
865deed1df Merge "Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev am: 4c2242b254 am: 78d0888e8c" into nyc-mr1-dev-plus-aosp
am: 062a28b6a4

* commit '062a28b6a403a48d6f5f88e109a899c9c60581c1':
  Add lockdownEnabled parameter to always-on VPN API

Change-Id: I9ebd6221451ee10649a1f340031d62c6483832f1
2016-05-04 22:04:40 +00:00
Robin Lee
e823566924 Merge "Merge changes I31d5260d,Ied92f558 into nyc-dev am: 9677633814 am: 31b3676cce" into nyc-mr1-dev-plus-aosp
am: fbde3272fd

* commit 'fbde3272fd4e49ab269920339793bc40d0cb9628':
  Start VPN as early as possible during startup
  Split network agent created state from connected state

Change-Id: I6e1d6a1977db342f45a1a9114a56c181540e12bf
2016-05-04 22:03:54 +00:00
Android Build Merger (Role)
fb450bf661 Merge "Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev am: 4c2242b254 am: 7f13b648df" into nyc-mr1-dev-plus-aosp 2016-05-04 21:48:26 +00:00
Android Build Merger (Role)
21d0fa8c49 Merge "Merge changes I31d5260d,Ied92f558 into nyc-dev am: 9677633814 am: adab05fdfc" into nyc-mr1-dev-plus-aosp 2016-05-04 21:48:10 +00:00
Robin Lee
10dcbb6768 Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev am: 4c2242b254
am: 7f13b648df

* commit '7f13b648df95a300e117efffc015b5621c329828':
  Add lockdownEnabled parameter to always-on VPN API

Change-Id: I79cc73d918ff368534d7e269291cb6d24e6774ac
2016-05-04 21:42:55 +00:00
Robin Lee
b9a2ef1e09 Merge changes I31d5260d,Ied92f558 into nyc-dev am: 9677633814
am: adab05fdfc

* commit 'adab05fdfc7ff389b65cb949b5c66d5c96f68382':
  Start VPN as early as possible during startup
  Split network agent created state from connected state

Change-Id: Ibb02f2731536ebafaa4c24ef5cd2113f7cd43632
2016-05-04 21:42:47 +00:00
Robin Lee
7c540243de Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev am: 4c2242b254
am: 78d0888e8c

* commit '78d0888e8c9358681a6f564b30b2cc35bbe72a45':
  Add lockdownEnabled parameter to always-on VPN API

Change-Id: I7ec39775980ec839aa814cf284ea352789aa788f
2016-05-04 21:41:23 +00:00
Robin Lee
1054057e75 Merge changes I31d5260d,Ied92f558 into nyc-dev am: 9677633814
am: 31b3676cce

* commit '31b3676ccec847b1e86c23b2f5073dc1cc83abf4':
  Start VPN as early as possible during startup
  Split network agent created state from connected state

Change-Id: I6bb605a83b96a3efab36ab6a7bdb5859e1eafea8
2016-05-04 21:40:46 +00:00
Robin Lee
7f13b648df Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev
am: 4c2242b254

* commit '4c2242b254668caa96abc59e9f6c08eef7dc3784':
  Add lockdownEnabled parameter to always-on VPN API

Change-Id: Ibc69bb988ba0d1e641ee48fb5a844dc414f58e07
2016-05-04 18:55:54 +00:00
Robin Lee
adab05fdfc Merge changes I31d5260d,Ied92f558 into nyc-dev
am: 9677633814

* commit '9677633814868394f11097c549cea65155f80c29':
  Start VPN as early as possible during startup
  Split network agent created state from connected state

Change-Id: I55167ad8f3cde11407a2d35b0f859c263c0fbbec
2016-05-04 18:55:11 +00:00
Robin Lee
4c2242b254 Merge "Add lockdownEnabled parameter to always-on VPN API" into nyc-dev 2016-05-04 18:38:30 +00:00
Robin Lee
9677633814 Merge changes I31d5260d,Ied92f558 into nyc-dev
* changes:
  Start VPN as early as possible during startup
  Split network agent created state from connected state
2016-05-04 18:35:19 +00:00