summaryrefslogtreecommitdiffstats
path: root/services/tests
Commit message (Collapse)AuthorAgeFilesLines
* Support DHCP replies with multiple default gateways.Lorenzo Colitti2015-10-081-0/+34
| | | | | | | Just use the first one for compatibility with the legacy client. Bug: 23975855 Change-Id: Id6a0b0de32e8947c12c02eb9a3be417e2f82c99a
* Accept DHCP responses from non-67 server source portsErik Kline2015-10-081-0/+36
| | | | | Bug: 24687559 Change-Id: I5f03b8b2780c558281d8a50d0893fd64f2812add
* Improve logging of DHCP parse errors using exceptions.Erik Kline2015-10-081-6/+14
| | | | | Bug: 23975855 Change-Id: I62464b92f0bb568e57bf5e1a63bc75f22c75aac1
* am 4f7d0bc7: Merge "Add get_accounts app op" into mnc-devSvetoslav Ganov2015-09-091-3/+3
|\ | | | | | | | | * commit '4f7d0bc7af5fbb65796d24b130b7e9e63107bc5d': Add get_accounts app op
| * Add get_accounts app opSvetoslav2015-09-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each runtime permission we have an app op to toggle the permission for legacy apps as they cannot handle permission revocations. We were lacking an app op for get_accounts which prevented the user from controlling access to accounts regardelss that they change the state of the permission toggle in the UI. Even worse the permission UI is written with the assumption that every runtime permission has an app op and as a result revoking the contacts group (if the app requests the get_accounts permission) is reset back to allowed in the UI. bug:23854618 Change-Id: I9e3f9bfeb320bed561d718db99ee285915d5701b
* | Add tests for the PacketKeepalive API.Lorenzo Colitti2015-09-092-0/+249
| | | | | | | | | | | | | | | | | | This currently fails in many different ways, but it tells us what to fix. Bug: 22606153 Bug: 23884210 Change-Id: If2e5ee0a8d7b26cad67d3d566ed5b1383e0db096
* | Use a CountDownLatch instead of sleep() in NetworkFactory tests.Lorenzo Colitti2015-09-081-23/+99
| | | | | | | | | | | | | | This makes testNetworkFactoryRequests 2-3 times faster. Bug: 22606153 Change-Id: I9657b6929e77f23ec811d0ab57b2ba974f0b6a69
* | Get rid of shortSleep() in ConnectivityServiceTest.Lorenzo Colitti2015-09-081-39/+118
| | | | | | | | | | | | | | Instead, use IdleHandler to wait for things to become idle. Bug: 22606153 Change-Id: Ic6ab93ad4d336b40962f9be1096629a44b63ee2f
* | Make ConnectivityServiceTest a bit more readable.Lorenzo Colitti2015-09-071-218/+45
| | | | | | | | | | | | | | | | | | | | | | | | 1. Make TestNetworkCallback a bit smarter and rename it to SingleUseNetworkCallback. This allows us to get rid of all the calls to TestNetworkCallback#getConditionVariable. 2. Delete the commented out code that used to test a ConnectivityService model that has not been used since KK. 3. Remove unused imports, etc. Bug: 22606153 Change-Id: I81a2d0b970d19e5f4515490d8c2f88d416445fa1
* | am 0a76afb9: Merge "Don\'t crash on (invalid) hardware address lengths > ↵Ian Pedowitz2015-09-031-0/+70
|\ \ | |/ | | | | | | | | | | 127." into mnc-dev * commit '0a76afb93e6f303921ab84e2f26747c3ebf19b62': Don't crash on (invalid) hardware address lengths > 127.
| * Don't crash on (invalid) hardware address lengths > 127.Lorenzo Colitti2015-09-031-0/+70
| | | | | | | | | | | | | | | | | | | | | | These would cause us to crash with a NegativeArraySizeException when trying to create the clientMac array. Instead, if the length is > 16 (invalid, because the field is only 16 bytes long), fudge it to 6 (Ethernet / wifi). This is a bit less liberal than the legacy client, which doesn't check the length at all. Bug: 23725795 Change-Id: I83f47bfc400ffa8ce85dd9d1b8eb96be5afe51a5
* | am 11e84bde: Merge "Don\'t mark NetworkRequests restricted when they don\'t ↵Lorenzo Colitti2015-08-191-2/+1
|\ \ | |/ | | | | | | | | | | have restricted caps" into mnc-dev * commit '11e84bde9e98cb4b777a67208989d259883e9375': Don't mark NetworkRequests restricted when they don't have restricted caps
| * Don't mark NetworkRequests restricted when they don't have restricted capsPaul Jensen2015-08-191-2/+1
| | | | | | | | | | | | | | | | | | | | Requests without NET_CAPABILITIES_INTERNET and just the default network capabilities should not be marked restricted. Without this fix apps can hit permissions exceptions if they inadvertently make requests without NET_CAPABILITIES_INTERNET. Bug:23164917 Change-Id: I4c7136821315bcb05dfc42ffbc505a5d4f6109e6
* | resolved conflicts for merge of dbc4edcc to mnc-dr-devPaul Jensen2015-08-051-0/+13
|\ \ | |/ | | | | Change-Id: I3a8624b2b375e0d174983d7690082e0e6932c4de
| * Merge "Fix NOT_RESTRICTED network capability and enforce it." into mnc-devPaul Jensen2015-08-051-0/+13
| |\
| | * Fix NOT_RESTRICTED network capability and enforce it.Paul Jensen2015-08-041-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change: 1. NOT_RESTRICTED should be removed from NetworkRequests that bring up special restricted carrier networks (e.g. IMS, FOTA). 2. NetworkRequests without NOT_RESTRICTED require CONNECTIVITY_INTERNAL permission to register 3. Binding sockets to networks without NOT_RESTRICTED requires CONNECTIVITY_INTERNAL permission Bug:21637535 Change-Id: I5991d39facaa6b690e969fe15dcbeec52e918321
* | | am 496a9d26: Merge "Stop supporting legacy ConnectivityManager routing ↵Lorenzo Colitti2015-07-311-1/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | methods in M." into mnc-dev * commit '496a9d269b0778ffa1965f3b11d768fe70fd7719': Stop supporting legacy ConnectivityManager routing methods in M.
| * | Stop supporting legacy ConnectivityManager routing methods in M.Lorenzo Colitti2015-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The methods startUsingNetworkFeature, stopUsingNetworkFeature and requestRouteToHost were @removed in all the M preview builds, but internal and external developers have noted that this imposes additional burden for applications that need to work across multiple platform versions because it causes compile-time errors. We switched from @removed back to @deprecated to avoid these problems. In order to effectively deprecate these methods, which are error-prone and insecure, make them throw UnsupportedOperationException if the app's target SDK is M or above. Because there are still one or two places in system code that use these APIs, exempt Process.SYSTEM_UID and the OMA-DM client from the check for now. Bug: 22728205 Change-Id: I790bd32f3aa8067cbb625962a209bb9232f4b58c
* | | am a991c66c: Merge "Fix missing onLost NetworkCallbacks when network loses ↵Paul Jensen2015-07-301-41/+139
|\ \ \ | |/ / | | | | | | | | | | | | | | | capability" into mnc-dev * commit 'a991c66c12da30d0240ac6c98736edee93d95977': Fix missing onLost NetworkCallbacks when network loses capability
| * | Merge "Fix missing onLost NetworkCallbacks when network loses capability" ↵Paul Jensen2015-07-301-41/+139
| |\ \ | | | | | | | | | | | | into mnc-dev
| | * | Fix missing onLost NetworkCallbacks when network loses capabilityPaul Jensen2015-07-281-41/+139
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a network no longer satisfies a NetworkRequest, send the onLost NetworkCallback. If it was a real request (not listen) then update the NetworkFactories. To test this change I created a little infrastructure to fake different Internet connectivity probe results during tests. This allowed me to rewrite some of ConnectivityServiceTest's logic for validating networks. This brought to light a couple issues that I had to address to keep tests passing: 1. testUnlingeringDoesNotValidate was relying on a bad side-effect of my old method of ConnectivityServiceTest's logic for validating networks, so I rewrote the test. 2. ConnectivityService was not sending out NetworkCallbacks for WiFi when Cellular was validated. I'm including a fix for this in this CL also. Bug:22220234 Change-Id: I29314f38189817f8b2561a213c4f9e8522696663
* | | am e288b3af: Merge changes I5c994de5,I6cb0dd84 into mnc-devLorenzo Colitti2015-07-281-1/+67
|\ \ \ | |/ / | | | | | | | | | | | | * commit 'e288b3af14421731d8f477b97e8d77588f20498b': Add a test for public bugs 2111 and 2136. Always check off-link connectivity in NetworkDiagnostics.
| * | Add a test for public bugs 2111 and 2136.Lorenzo Colitti2015-07-271-1/+67
| |/ | | | | | | | | | | Bug: 22602137 Bug: 22104401 Change-Id: I5c994de53b5906416767a8a1abe38fe59afb7cc0
* | ConnectivityManager API for for packet keepalives.Lorenzo Colitti2015-07-181-0/+162
|/ | | | | Bug: 21405946 Change-Id: Ie1f8f8bee684fe2bb1092a9f1bc9f5dc29b1defc
* Added sendBroadcastMultiplePermissions methodFyodor Kupolov2015-07-141-0/+5
| | | | | | | | | Added Context.sendBroadcastMultiplePermissions(Intent intent, String[] receiverPermissions) method, which allows an array of required permissions to be enforced. Bug: 21852542 Change-Id: I27c9130e8f004b428452501ebc8a36aabde1f343
* Revert "Allow array of required permissions in sendBroadcast"Fyodor Kupolov2015-07-141-5/+0
| | | | | | This reverts commit b4e7283c9afd9fb15ebd63f6ce9b75c9c1af658b. Change-Id: Ie8390964bda5bdfa869cee8f46584043d8e7c664
* Allow array of required permissions in sendBroadcastFyodor Kupolov2015-07-141-0/+5
| | | | | | | | Added Context.sendBroadcast(Intent intent, String[] receiverPermissions) method, which allows an array of required permissions to be enforced. Bug: 21852542 Change-Id: I3b8ff258fa9f3249c344bb8093b820b24eef00c0
* Merge "Fallback to Cellular if WiFi fails to validate" into mnc-devPaul Jensen2015-07-101-4/+207
|\
| * Fallback to Cellular if WiFi fails to validatePaul Jensen2015-07-091-4/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, once a network validated, for the purposes of comparing networks to select the default network, we always considered it validated. With this change if a network later fails to validate, we'll take this latest validation result into account. This means if WiFi and cellular are up (e.g. if we recently switched from cellular->WiFi, and cellular is now lingering) and both are validated, but for some reason WiFi fails a validation, cellular will become the default network connection. Bug:20896761 Change-Id: I858aa10c1aaec5cd9032067f960963409107bdb1
* | Merge "Prepare some ConnectivityService logic for fallback to Cellular ↵Paul Jensen2015-07-101-27/+81
|\ \ | |/ | | | | change" into mnc-dev
| * Prepare some ConnectivityService logic for fallback to Cellular changePaul Jensen2015-07-091-27/+81
| | | | | | | | | | | | | | | | | | | | | | Reduce the duplication of some logic so when falling back to Cellular when WiFi fails to validate is enabled, there's less chance for bugs and failures: 1. De-duplicate several Network vs NetworkRequest matching functions 2. Remove the very tricky nascent logic by adding a simple "lingering" bit. Bug:20896761 Change-Id: I21da9e827eec9cfd6835fcaa650192b9186ed053
* | Fix two parsing bugs in new DHCP client.Lorenzo Colitti2015-07-061-9/+141
|/ | | | | | | | | | | | | | | 1. We don't parse PAD options properly, leading in failure to parse packets sent by DHCP servers that put the end of options marker after pad options and at an odd offset. 2. We get the DhcpResults vendorInfo from the wrong option type (60 instead of 43). Fix these and add unit tests for the offer packets sent by a few different DHCP servers. Bug: 21955617 Bug: 22281295 Change-Id: I5d13f1a6a3ff0b53112f18f3db8792fa32ad2da3
* Disallow requesting networks with mutable NetworkCapabilities.Paul Jensen2015-06-231-0/+25
| | | | | | | | | | | | | | | | | It's not clear what it means to request a network with a mutable NetworkCapability like NET_CAPABILITY_VALIDATED or NET_CAPABILITY_CAPTIVE_PORTAL. Presently requesting such a network would fail in a number of different ways: 1. The NetworkFactories would fail to match the request against their filter which doesn't include stateful NetworkCapabilities. 2. If the NetworkFactories did match, they'd bring up networks to try and satisfy the requests, but the networks would not have any mutable NetworkCapabilities initially so they'd be reaped. Because of these problems it's safest to simply disallow these requests. Bug: 21343774 Change-Id: I56303242b81d39b370b8d5d1e32059bfcfc25949
* Merge "Don't send spurious onAvailable NetworkCallbacks when rematching" ↵Paul Jensen2015-06-201-33/+238
|\ | | | | | | into mnc-dev
| * Don't send spurious onAvailable NetworkCallbacks when rematchingPaul Jensen2015-06-191-33/+238
| | | | | | | | | | Bug:21762680 Change-Id: Ia701045dffc666fe75fba0e1771872147e37179a
* | Merge "high-frequency notification stats." into mnc-devChris Wren2015-06-171-1/+6
|\ \
| * | high-frequency notification stats.Chris Wren2015-06-171-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Aggregate and then periodically report stats that are high-frequency because they are driven by app behavior, not user behavior. Reuse the NotificationUsageStats facility. Remove redundant stats. Lessen memory foot print. Enable in-memeory aggregates with small, bounded memory footprint. Bug: 20258744 Change-Id: I87e391419c53917fa13c68a56f8cdb40a7c8e548
* | | Make keysetmgrservice gurantees explicit.dcashman2015-06-151-40/+40
| |/ |/| | | | | | | | | | | | | | | Add exceptions/checks for keysetmgrservice interractions which *should* never happen, but would result in NPE or invalid metadata. Also handle mismatches between package and keyset metadata in packages.xml. Bug: 20128916 Change-Id: Ia0f63f78d232d9d8d9fbe4cd8e6cc3406e5192a7
* | Remove most sleep() calls from ConnectivityServiceTestPaul Jensen2015-06-121-19/+67
|/ | | | Change-Id: I90d2f6811ed1cb84614101200ac377e920bd864a
* Merge "Remove network requests properly." into mnc-devRobert Greenwalt2015-06-111-0/+93
|\
| * Remove network requests properly.Robert Greenwalt2015-06-101-0/+93
| | | | | | | | | | | | | | | | | | | | We used to only remove requests that we'd acted on but that's just wrong. Also adds test case which exposed the problem but passes with the fix. bug:20731384 Change-Id: I581a005560cc71167b857abf2452769399a9e1b7
* | Avoid overlapping NetIDs in ConnectivityServiceTest with real NetIDsPaul Jensen2015-06-101-0/+21
|/ | | | | | | | | Overlapping the NetIDs can cause the ConnectivityService instance under test to inadvertently use real networks, for example when NetworkMonitor attempts to validate a network. This fixes test hangs when run on devices with active internet connections. Change-Id: I5e1898953f0117b9f75beccac4a52ae2db173567
* Merge "Revive ConnectivityServiceTest and add some tests." into mnc-devPaul Jensen2015-06-042-72/+359
|\
| * Revive ConnectivityServiceTest and add some tests.Paul Jensen2015-06-042-72/+359
| | | | | | | | Change-Id: I44740a7b21cff18ac2a67d09c4d0e597add19ee0
* | Actually fall back from yiaddr to ciaddr.Lorenzo Colitti2015-06-041-3/+66
|/ | | | | | | | | | | | | | | The initial implementation of toDhcpResults attempted to get the leased IP address from ciaddr if yiaddr was 0.0.0.0, but it never actually did so because a) it used == instead of equals(), and b) the parsing code never populated mClientIp for a DhcpOfferPacket or DhcpAckPacket. Fix this and add a test for it.. Technically DHCP does not use ciaddr (only bootp uses it), but in 5.0 we would use ciaddr if yiaddr was 0.0.0.0 and a bit more compatibility shouldn't hurt. Bug: 19704592 Change-Id: I1f58555f0c10b9c576995a6edb759a83d8938ea0
* Fix DHCP lease time parsing.Lorenzo Colitti2015-06-021-4/+65
| | | | | | | | | | | Currently we treat a lease time larger than 2**31-1 as a negative value, which causes DhcpClient to attempt to renew its IP address constantly. Fix this by properly handling large and infinite lifetimes, and while we're at it, impose a minimum lease time of 60 seconds. Bug: 21352084 Change-Id: If62c9efeffad6222e2fe0c110f77d0e4c70de96d
* Fix PackageManagerSettingsTests and add KeySet info.dcashman2015-04-283-149/+327
| | | | | | | | | Add unit tests for the keyset portion of packages.xml. Also fix previously broken test by adding UserManagerService reference. Bug: 19530911 Bug: 19530120 Change-Id: I251fc3e9dc983f1d63f9e84905d3ed0e64843def
* Add KeySetManagerService unit tests.dcashman2015-04-272-0/+988
| | | | | Bug: 19530120 Change-Id: Ie5601f7cafd4b853c6436941cfed48622549d928
* Merge commit '4cb5d80' into merge2Etan Cohen2015-04-241-1/+2
|\
| * Merge "Set the secs field in the BOOTP header." into m-wireless-devLorenzo Colitti2015-04-211-1/+2
| |\