Commit Graph

2184 Commits

Author SHA1 Message Date
Lorenzo Colitti
ae747eb76f Add a NET_CAPABILITY_FOREGROUND capability. am: f0e9a33435 am: aaec66110d
am: 9ba472d619

Change-Id: I08ca73666668ddc6c9bfe002844a9d2e0ecb28e4
2016-09-14 19:22:54 +00:00
Lorenzo Colitti
786a4b8300 Add a background NetworkRequest type for mobile data always on. am: 3d4a10617c am: 9396da4e10
am: 4c698d3eed

Change-Id: I9e11b75fe0af8a116593394b151c7fb4d1e167f8
2016-09-14 05:02:12 +00:00
Lorenzo Colitti
9ba472d619 Add a NET_CAPABILITY_FOREGROUND capability. am: f0e9a33435
am: aaec66110d

Change-Id: I78d6aa21f8e4c6bbd9cefb4a36f1b77f4bbe4104
2016-09-13 16:23:10 +00:00
Lorenzo Colitti
f0e9a33435 Add a NET_CAPABILITY_FOREGROUND capability.
Bug: 23113288
Change-Id: I90cb9ffb5751f0d9ec822933f37680c401e49966
2016-09-13 12:02:13 +09:00
Lorenzo Colitti
4c698d3eed Add a background NetworkRequest type for mobile data always on. am: 3d4a10617c
am: 9396da4e10

Change-Id: I4b0e05e8bb87e37bf2564fd255b8be7a2b20118a
2016-09-12 13:48:53 +00:00
Lorenzo Colitti
3d4a10617c Add a background NetworkRequest type for mobile data always on.
Like a normal (foreground) request, a background request is only
satisfied by one network and will keep that network up. Unlike a
foreground request, when a network only has background requests,
it will linger, and after lingering is complete, it will become
a background network.

Future CLs will cause the system to treat background networks
differently, e.g., by requiring different permissions.

Bug: 23113288
Change-Id: I40f735269dad1042eb04fea15e64584fc903ccb3
2016-09-09 18:49:24 +09:00
Felipe Leme
0ecfcd1e3a Refactored INetworkPolicyListener callbacks.
Methods onRestrictBackgroundWhitelistChanged() and
onRestrictBackgroundBlacklistChanged() were replaced by a more generic
onUidPoliciesChanged().

Test: m javac-check RUN_ERROR_PRONE=true
Test: m -j32 FrameworksServicesTests && adb install -r -g ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk && adb shell am instrument -e class "com.android.server.NetworkPolicyManagerServiceTest" -w "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"

BUG: 28791717
Change-Id: I18b2ee4af06802e0d23822b153d1be9b429d5811
2016-09-06 12:49:48 -07:00
Felipe Leme
57e3d31091 Removed deprecated methods from INetworkPolicyManager.
Removed the following methods:

- addRestrictBackgroundWhitelistedUid(int uid)
- removeRestrictBackgroundWhitelistedUid(int uid);
- getRestrictBackgroundWhitelistedUids();

They've been replaced by getUidsWithPolicy() and setUidPolicy().

Test: m -j32 FrameworksServicesTests && adb install -r -g ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk && adb shell am instrument -e class "com.android.server.NetworkPolicyManagerServiceTest" -w "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"

BUG: 28791717

Change-Id: I8f6a569cef84c2be60e3277756283026c0fb5b29
2016-09-02 16:26:35 -07:00
Neil Fuller
4e4f9a24e0 Merge "Fix receive timeout on LocalSocket" am: 7a9c0cd854 am: 680ec020a1 am: ef1fb4889a
am: 0aa7d4bb3f

Change-Id: I35b4ff81c9263a3a2d3052602fe43bc37377c733
2016-09-01 01:18:32 +00:00
Neil Fuller
8d5ec8d7db Fix receive timeout on LocalSocket
The receive timeout stopped being set incorrect due to commit
c80af6d8. There is an associated CTS regression test in cts/.

Test: Ran CTS test android.net.cts.LocalSocketTest
Bug: 31205169
(cherry picked from commit a8280a5d34)

Change-Id: I28924df45abb687bcca6f4b731ed8b6f741e96da
2016-08-31 18:15:52 +01:00
Neil Fuller
0aa7d4bb3f Merge "Fix receive timeout on LocalSocket" am: 7a9c0cd854 am: 680ec020a1
am: ef1fb4889a

Change-Id: Ie4befe516f369d903a61f22aab15e40ac09193a3
2016-08-31 16:47:33 +00:00
Neil Fuller
a8280a5d34 Fix receive timeout on LocalSocket
The receive timeout stopped being set incorrect due to commit
c80af6d8. There is an associated CTS regression test in cts/.

Test: Ran CTS test android.net.cts.LocalSocketTest
Bug: 31205169
Change-Id: I99808478946f8eae502c49d2cb83465648b9c904
2016-08-31 11:32:17 +01:00
Felipe Leme
bd1a93a721 Fixed statuses on Battery Saver column.
BUG: 30139400

Change-Id: I1798607af13c9be5e1f21212fd7078f7152562bd
(cherry picked from commit 9e325706f4)
2016-08-29 11:27:16 -07:00
Jack Yu
b5b4c359f1 Do not print misleading debug messages in some scenarios. am: bfd1d6ed49 am: d330f0ccc4
am: cc2b91697f

Change-Id: I18d2899cf7ac747a1789e17a2b9786aa9c49c002
2016-08-26 18:55:06 +00:00
Jack Yu
cc2b91697f Do not print misleading debug messages in some scenarios. am: bfd1d6ed49
am: d330f0ccc4

Change-Id: Ia264715fe843b1b272da6ca909edc3be6fd57b28
2016-08-24 20:54:08 +00:00
Jack Yu
bfd1d6ed49 Do not print misleading debug messages in some scenarios.
When the mobile network is not active, querying the network
information might trigger the misleading debug messages. Added
some condition checks to prevent this.

bug: 30850733
Change-Id: Ice6d548a56f98bac7fe2ca6a06148350b505533d
2016-08-23 16:09:36 -07:00
Felipe Leme
46b451fa7d Refactored whitelist restrict background uids.
On Android N, the list of UIDs whitelisted was kept in a separate array
and XML tag, while in reality it should be a new UID
policy (POLICY_ALLOW_METERED_BACKGROUND).

This change refactors NetworkPolicyManagerService to use the new UID
policy, although without removing any of its existing methods (but
marking them as deprecated).

Test: m -j32 FrameworksServicesTests && adb install -r -g ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk && adb shell am instrument -e class "com.android.server.NetworkPolicyManagerServiceTest" -w "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"

Test: cts-tradefed run commandAndExit cts --skip-device-info --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker --skip-preconditions -m CtsHostsideNetworkTests --abi armeabi-v7a -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

BUG: 28791717

Change-Id: I39869efda554ca0b736dd2380e439474f91dfbe6
2016-08-23 12:34:37 -07:00
Felipe Leme
8546a44480 Removed the POLICY_ALLOW_BACKGROUND_BATTERY_SAVE constant.
That constant was created back in 2014 in the intial Battery Saver
implementation, but it's not used anymore (since the power saving
whitelist is fetched from DeviceIdleController).

Test: m -j32 FrameworksCoreTests &&  adb install -r -g
${ANDROID_PRODUCT_OUT}/data/app/FrameworksCoreTests/FrameworksCoreTests.apk
&& adb shell am instrument -e class
"android.net.NetworkPolicyManagerTest" -w
"com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner"

BUG: 28791717

Change-Id: Ic2c0bcb9736ce8b40e04fd644953e68241d06a69
2016-08-23 12:28:06 -07:00
Felipe Leme
b146f7678f Added a uidPoliciesToString() method.
BUG: 28791717
Change-Id: Ib26e08332d011ca5414406810cec4b4936841068
2016-08-19 09:52:16 -07:00
Etan Cohen
fb5b680514 Merge "Support timeouts for requestNetwork() invocations." 2016-08-17 17:15:46 +00:00
Jeremy Joslin
8b436d865c VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871
Change-Id: I62a75a0c0c0111e052b7903baa9f5d6d94ef57fd
2016-08-16 15:53:57 -07:00
Erik Kline
57faba9ec7 Support timeouts for requestNetwork() invocations.
(cherry-pick of 06c3ef1367)

Bug: 21414325
Change-Id: I08118be8e8cf92fc406d431e99a6c9191a863ff3
2016-08-15 10:19:45 -07:00
Jeff Sharkey
49ca529a85 Avoid caching services with missing binders.
When fetching system services early during boot, if the underlying
binder interface hasn't been published yet, we end up caching a
manager class that is broken for the remainder of the process
lifetime, and innocent downstream callers end up using the broken
cached manager.

Fix this by using an explicit exception to quickly abort manager
creation when the underlying binder is missing.  The exception is
only used to skip the remainder of the manager creation, and it
doesn't actually crash the process.

Bug: 28634953
Change-Id: I0cb62261e6d6833660704b93a11185aa11a2ac97
2016-08-11 09:44:30 -06:00
Jack Yu
ac4ec090bb Added todo items for a potential metrics issue am: dc5a63bdd1 am: 94f2fe22b4
am: c92cb8b816

Change-Id: Iad996bf83a9d1766f4b5dcb90d71f20488491aac
2016-07-31 03:48:25 +00:00
Hugo Benichi
4d29c8f83f Merge \\\"IpConnectivityMetrics: no metrics upload in tests\\\" into nyc-mr1-dev am: 1b4bd22f41 am: 6b104bdabf
am: 9ecb72151b

Change-Id: Iaa83e8914614fa874a88beb8821bb83e0dce5c09
2016-07-31 02:12:51 +00:00
Jack Yu
c92cb8b816 Added todo items for a potential metrics issue am: dc5a63bdd1
am: 94f2fe22b4

Change-Id: Id3a4f8985536f312c35718a1c992ecb505dbbebf
2016-07-30 23:34:10 +00:00
Jack Yu
94f2fe22b4 Added todo items for a potential metrics issue
am: dc5a63bdd1

Change-Id: Ibf846f026d137db2c10fd076a408f2702cab5eaf
2016-07-30 06:41:29 +00:00
Jack Yu
a4e616e0dc Merge "Added todo items for a potential metrics issue" into nyc-mr1-dev 2016-07-30 02:07:53 +00:00
Jack Yu
dc5a63bdd1 Added todo items for a potential metrics issue
bug: 29390529
Change-Id: I15826d5f513748a423eb4cc103f1b010ddad2126
2016-07-29 15:01:18 -07:00
Hugo Benichi
9ecb72151b Fix missing IpConnectivity metrics am: 90cbc5b444
am: 384818b99d

Change-Id: I62f174cc615f40e450ba72f8c6f86d46ed5fc096
2016-07-29 09:47:21 +00:00
Hugo Benichi
90cbc5b444 Fix missing IpConnectivity metrics
The IpConnectivityLog class looks up MetricsLoggerService once only
at creation. If a IpConnectivityLog user instantiates this class too
early during the boot process, the MetricsLoggerService is not found
and no event can be recorded.

This patch makes IpConnectivityLog attempt to look up
MetricsLoggerService as long as it hasn't found it yet.

This allows IpManager and ConnectivityService to upload
android.net.metrics events.

Bug: 30490301
Change-Id: I97102b95a775ea9e90351b9887ae4661fddc2af9
2016-07-29 17:07:38 +09:00
Lorenzo Colitti
ef3ec0dd34 Merge \"Merge \\"Add an isListen method to NetworkRequests.\\" into nyc-mr1-dev am: b5239329b1\" into nyc-mr1-dev-plus-aosp
am: 17450e41b3

Change-Id: Ic71a5722ee877de73e7ffd340a5ffb84a2d4910d
2016-07-18 15:15:33 +00:00
Lorenzo Colitti
5dd90b15fb Merge \"Add an isListen method to NetworkRequests.\" into nyc-mr1-dev
am: b5239329b1

Change-Id: Ib712c3c7b44d3a623d5f5facf0c7f6844c3ebb82
2016-07-18 15:08:54 +00:00
TreeHugger Robot
b5239329b1 Merge "Add an isListen method to NetworkRequests." into nyc-mr1-dev 2016-07-18 15:00:21 +00:00
Lorenzo Colitti
f4a45f4c33 Add an isListen method to NetworkRequests.
This allows simplification of the ConnectivityService code.

Bug: 23113288
Change-Id: I124544b99c5a920124e9a3d31cda8c6d2abc21fd
2016-07-18 18:42:26 +09:00
Felipe Leme
c2d218caaf Merge \"Merge \\\"Fixed statuses on Battery Saver column.\\\" into nyc-dev am: 24b2e7bbee am: 28318faf16\" into nyc-mr1-dev-plus-aosp
am: 4a9c54610e

Change-Id: Id346251c47c7d313eb652b809d088ffb82904d0e
2016-07-14 20:07:08 +00:00
Felipe Leme
6806690f8d Merge \\"Fixed statuses on Battery Saver column.\\" into nyc-dev am: 24b2e7bbee
am: 28318faf16

Change-Id: Id23c8c2af5ce170f00cf1d3968c56a59d5f168fb
2016-07-14 18:30:34 +00:00
Felipe Leme
28318faf16 Merge \"Fixed statuses on Battery Saver column.\" into nyc-dev
am: 24b2e7bbee

Change-Id: I6b871cebf05f0fe18b054df456aabd80b10336aa
2016-07-14 18:23:12 +00:00
Felipe Leme
9e325706f4 Fixed statuses on Battery Saver column.
BUG: 30139400

Change-Id: I1798607af13c9be5e1f21212fd7078f7152562bd
2016-07-14 11:04:49 -07:00
Erik Kline
170a58bd49 Add IPv6 tethering coordinator am: 1eb8c69bed
am: 5b429166fc

Change-Id: I9a5bd7d72ec6a4b63922fc5704d15cb5eafc1e8d
2016-07-13 05:02:13 +00:00
Erik Kline
5b429166fc Add IPv6 tethering coordinator
am: 1eb8c69bed

Change-Id: Icf8034276d4edc7167ad03ff8860ac8e3d05c464
2016-07-13 04:57:17 +00:00
Erik Kline
1eb8c69bed Add IPv6 tethering coordinator
Add an IPv6TetheringCoordinator to TetheringMaster StateMachine, which
receives and processes NetworkState updates and passes the necessary IPv6
information to the revelant TetherInterfaceStateMachine.

Add an IPv6TetheringInterfaceServices to TetherInterfaceStateMachine, which
is responsible for adding local network routes and managing an IPv6
RouterAdvertisementDaemon.

Bug: 9580643
Change-Id: I3eaae460b80752e2115359d7bde873a1e9ea515a
2016-07-13 12:08:06 +09:00
Etan Cohen
207cd8534b resolve merge conflicts of 7b84987 to master
Change-Id: Ib300a32277a4bb21ed9f5a024118370d361aa1c1
2016-07-12 10:09:16 -07:00
Erik Kline
177c82be79 Support requesting async LinkProperties/NetworkCapabilities updates am: acdd639513
am: 915d09b5d4

Change-Id: If177966a19c830a106ce689c7e07a7835bb2c1a1
2016-07-12 01:46:09 +00:00
Erik Kline
e357e238c9 Basic IPv6 Router Advertisement daemon am: a3ca6bd3e0
am: 461e4fff31

Change-Id: I30627432d5736a17248aa90b225d08244a4dee5d
2016-07-12 01:46:01 +00:00
Erik Kline
915d09b5d4 Support requesting async LinkProperties/NetworkCapabilities updates
am: acdd639513

Change-Id: Icc048323debbbe641941c5c0d993f4c9782c5d3e
2016-07-11 11:01:42 +00:00
Erik Kline
461e4fff31 Basic IPv6 Router Advertisement daemon
am: a3ca6bd3e0

Change-Id: I242eb8e932581a537a47f31e3f16c7e776da91cf
2016-07-11 10:38:49 +00:00
Erik Kline
acdd639513 Support requesting async LinkProperties/NetworkCapabilities updates
Bug: 9580643
Change-Id: I1d7ba7645c20d7d53f6eef777dfce43727940f13
2016-07-11 19:17:41 +09:00
Erik Kline
a3ca6bd3e0 Basic IPv6 Router Advertisement daemon
Bug: 9580643
Change-Id: Iebd4d1f694699ffd4daf7d71e9b9d8f49e9b632f
2016-07-11 18:37:25 +09:00
Hugo Benichi
219d9ba4fa Merge \\"IpConn metrics: distinguish NUD_FAILED answers\\" into nyc-mr1-dev am: 42e608527a
am: 99b36c8b4f

Change-Id: Iade155a1941674edf642e99bd506d1676b67ab42
2016-07-07 13:17:27 +00:00