Commit Graph

2199 Commits

Author SHA1 Message Date
Michal Karpinski
a2d5860a5f Rename DnsEventListenerServiceTest to NetdEventListenerServiceTest
Change-Id: I67e645306444938a4675e91a9db5d716c0bd4881
(cherry picked from commit d82fccd368)
2016-09-21 14:33:56 +00:00
Christopher Wiley
6cb1c65efd Merge "Allow WiFi components to manage interface up state" am: dfa6e6f186 am: b666aa899d am: c185893e9c
am: f6547e9afa

Change-Id: If2b5214b7ba65976ba5e3db0ecf0e85d471b5cf9
2016-09-21 06:58:02 +00:00
Lorenzo Colitti
f700a6e87f Support "don't ask again" in the avoid bad wifi dialog. am: 165c51c0eb am: aab02df195 am: 63275aba54
am: 3f67cbec46

Change-Id: I60ebe27ec892658c5a051457b13506e59ba33824
2016-09-21 06:04:15 +00:00
Christopher Wiley
f6547e9afa Merge "Allow WiFi components to manage interface up state" am: dfa6e6f186 am: b666aa899d
am: c185893e9c

Change-Id: Ic864a64414f47a9058e4cffaf477a76ab09d9dba
2016-09-20 22:05:41 +00:00
Lorenzo Colitti
3f67cbec46 Support "don't ask again" in the avoid bad wifi dialog. am: 165c51c0eb am: aab02df195
am: 63275aba54

Change-Id: I7d8d9f91208bcbe3ff625acf20d943b13f813d8e
2016-09-20 17:39:19 +00:00
Lorenzo Colitti
aab02df195 Support "don't ask again" in the avoid bad wifi dialog.
am: 165c51c0eb

Change-Id: Ic6a1917a83e2d847bd673790e2c36f7316ca7acd
2016-09-20 17:14:50 +00:00
Lorenzo Colitti
165c51c0eb Support "don't ask again" in the avoid bad wifi dialog.
This contains the following changes:

1. Make NETWORK_AVOID_BAD_WIFI a tristate: 0 means never avoid
   bad wifi, unset means prompt the user, 1 means always avoid.
2. Look at NETWORK_AVOID_BAD_WIFI only if the carrier restricts
   avoiding bad wifi (previously, we relied on the setting being
   null and defaulting to the value of the config variable).
3. Add an avoidUnvalidated bit to NetworkAgentInfo to track
   whether the user has requested switching away from this
   unvalidated network even though avoiding bad wifi is generally
   disabled. This is set to true when the user selects "switch"
   in the dialog without setting the "Don't ask again" checkbox.
4. Add a hidden setAvoidUnvalidated API to ConnectivityManager to
   set the avoidUnvalidated bit.
5. Additional unit test coverage.

Bug: 31075769
Change-Id: I1be60c3016c8095df3c4752330149ce638bd0ce1
2016-09-20 16:03:53 +09:00
Christopher Wiley
ce5d913387 Allow WiFi components to manage interface up state
Setting the WiFi network interface up or down is racy because it
is not synchronized with the WiFi components managing the interface.

This causes a problem for hostapd when the interface is marked down
before hostapd starts because it causes the driver to enter the
de-initialization process.  hostapd does not know how to react to this
change of events.

Bug: 31205821
Test: bug no longer reproduces on upcoming devices, unit tests pass

Change-Id: I96938e2aef89b400593d42ce1b0a6ccc2d2e5754
2016-09-19 14:12:38 -07:00
Etan Cohen
51a6ca483f reolve merge conflicts of 4e3d827 to nyc-mr1-dev-plus-aosp
Change-Id: Idb6cca34536fdbb94876d5cde0b2309462840da1
2016-09-16 12:40:03 -07:00
Etan Cohen
305ea28a43 [NAN] Add transport type for NAN.
Add TRANSPORT_WIFI_NAN - specifies a peer-to-peer Wi-Fi NAN data
connectivity request.

While NAN uses Wi-Fi L1 PHY and part of the MAC - it is a different
protocol and constitutes a different transport.

(cherry-pick of commit 7b84987a6a)
(cherry-pick of commit bd9fdbe022)

Bug: 26564277
Change-Id: I975ebc72d8f97a592d18038b3d6465b7a40efa75
2016-09-16 10:21:51 -07:00
Lorenzo Colitti
8d4d235a06 resolve merge conflicts of b97129e to master
Change-Id: Ib09134090aa135d88bb807034b262a23c8b40e5f
2016-09-16 01:45:15 +09:00
Lorenzo Colitti
81493a9fef Support displaying a dialog when wifi becomes unvalidated. am: 9be58c5580 am: d660913b0b
am: 56e32083b5

Change-Id: Id908683dce15ffbafc042d506a38ec26d5e9a6ee
2016-09-15 16:18:42 +00:00
Lorenzo Colitti
d660913b0b Support displaying a dialog when wifi becomes unvalidated.
am: 9be58c5580

Change-Id: I8b8e2b652510ca75407a9ad3c29ed111367941e0
2016-09-15 16:04:03 +00:00
Lorenzo Colitti
9be58c5580 Support displaying a dialog when wifi becomes unvalidated.
Bug: 31075769
Change-Id: I7a6e7580769365bea930f638bd44edcaa28df134
2016-09-15 23:33:34 +09:00
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
Etan Cohen
bd9fdbe022 [NAN] Add transport type for NAN. [DO NOT MERGE]
Add TRANSPORT_WIFI_NAN - specifies a peer-to-peer Wi-Fi NAN data
connectivity request.

While NAN uses Wi-Fi L1 PHY and part of the MAC - it is a different
protocol and constitutes a different transport.

(cherry-pick of commit 7b84987a6a)

Bug: 26564277
Change-Id: I975ebc72d8f97a592d18038b3d6465b7a40efa75
2016-09-06 15:54:10 -07: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