Commit Graph

4740 Commits

Author SHA1 Message Date
Chalard Jean
67036aacbc Merge "DO NOT MERGE : fix useless import" 2018-02-18 23:14:42 +00:00
Nathan Harold
0990bc8b57 Fix ConnectivityServiceTest for NATT Keepalive
Fix test breakages I caused when adding cell
support for NATT keepalives.

-Make the minimum keepalive interval a constant in
 ConnectivityManager and use it in tests.
-Re-Disallow IPv6 Keepalives

Bug: 73327535
Test: 'runtest -x ConnectivityServiceTest' now passes
Change-Id: I5ec4367d250ee371014e65c897c3897a25a05e2d
2018-02-16 16:34:50 -08:00
Jeff Sharkey
6be9ee13d9 Merge "Better handling of NTP-based clocks." 2018-02-16 22:13:01 +00:00
Jeff Sharkey
af8f5f5ebc Better handling of NTP-based clocks.
Now that we have a nice Clock abstraction, we can use it to represent
a clock backed by an NTP fix.  (This makes testing logic much easier
to write.)

We now rely completely on NetworkTimeUpdateService to keep our NTP
fix up to date, instead of trying to refresh in the middle of
critical paths which could trigger random ANRs.

Add internal FallbackClock to make it easier to handle missing NTP
fixes.  Add internal SimpleClock to let implementers focus on single
millis() method.

Test: bit FrameworksNetTests:com.android.server.net.NetworkStatsServiceTest
Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest
Bug: 69714690, 72320957
Change-Id: Ic32cdcbe093d08b73b0e4b23d6910b23ea8e1968
Exempt-From-Owner-Approval: approved in previous PS
2018-02-16 22:11:35 +00:00
Benedict Wong
614a50d5d7 Merge "Correct bug in IpSecTransformTest" am: b05d401748 am: 4a52c1438a
am: fb006fa020

Change-Id: Ic29f13053365f3de8d01f9c38f8460d92748a41d
2018-02-16 20:51:37 +00:00
Benedict Wong
fb006fa020 Merge "Correct bug in IpSecTransformTest" am: b05d401748
am: 4a52c1438a

Change-Id: I990729e8592e70898867fe72a3d628fd7f9fdaf0
2018-02-16 20:43:12 +00:00
Benedict Wong
4a52c1438a Merge "Correct bug in IpSecTransformTest"
am: b05d401748

Change-Id: If99a991052a821f43b8238a47d0d2c7e00362bc3
2018-02-16 20:28:18 +00:00
Benedict Wong
b05d401748 Merge "Correct bug in IpSecTransformTest" 2018-02-16 18:32:05 +00:00
Chalard Jean
a7c93b0b5b [LT1] Add a test for release request while lingering
Test: runtest framework-net
Change-Id: Ic635f97bf3dad8b695b3b8cc32c1a8b891166f9f
2018-02-16 18:09:42 +09:00
Chalard Jean
b0bf117861 Don't refcount TRACK_DEFAULT requests.
This has no concrete impact on the behavior of ConnectivityService,
but in principle TRACK_DEFAULT requests should not be counted toward
requests that make a network foreground. It does not have an impact
because only VPNs could be affected by this, and VPNs are always in
the foreground by definition.

Test: runtest frameworks-net
Test: cts
Change-Id: Id2ae6b5c9d542fe168e64ed713b6ec0a04062c82
2018-02-16 17:59:29 +09:00
Chalard Jean
31cbef1cbc DO NOT MERGE : fix useless import
This was added to avoid a merge conflict at a sensitive time.
It can (and should) go.

Test: no code change
Change-Id: I11d73e2d988ae61a168aa0f1cc7c2c506f509d30
2018-02-16 17:21:39 +09:00
Hugo Benichi
299e793837 Merge "Add missing'}' in javadoc of public API method" am: 8f22a42cf7 am: e7b8b95aa8
am: 8d2c7aa52b

Change-Id: I2cfda60077c57d151fb8599845cd202bbc4e625d
2018-02-16 07:58:57 +00:00
Hugo Benichi
8d2c7aa52b Merge "Add missing'}' in javadoc of public API method" am: 8f22a42cf7
am: e7b8b95aa8

Change-Id: I51ad1f6b8d42f4c791c07d41297f02d3e798ccd9
2018-02-16 07:50:57 +00:00
Hugo Benichi
e7b8b95aa8 Merge "Add missing'}' in javadoc of public API method"
am: 8f22a42cf7

Change-Id: I3afcd9a3752ff6d158d68ca3ce19272151c1908c
2018-02-16 07:43:08 +00:00
Treehugger Robot
8f22a42cf7 Merge "Add missing'}' in javadoc of public API method" 2018-02-16 03:19:35 +00:00
Benedict Wong
b7ca6bf4c1 Correct bug in IpSecTransformTest
testCreateTransformsWithSameConfigEqual used assertFalse rather than
assertTrue

Bug: 69385347
Test: Passing on walleye
Change-Id: I8caa26e184e8bfc3e8acc9061d85c22d27ebf448
2018-02-15 18:52:07 -08:00
Pavel Maltsev
d4d611954e Add OEM_PAID network capability
Bug: 68762530

Test: runtest -x frameworks/base/tests/net/

Change-Id: I51c07e0c2211d631e90b27468c26b599e7b07bc8
2018-02-15 10:46:00 -08:00
Chalard Jean
74ef4d0b1d Merge changes I3d68dbf8,I6ea524bb,I978d9119 am: 91d3912eab am: 004939fd82
am: d9663d47c5

Change-Id: Ic6d639358c3310820bd925df93d4843d7edffc57
2018-02-15 14:23:57 +00:00
Chalard Jean
d9663d47c5 Merge changes I3d68dbf8,I6ea524bb,I978d9119 am: 91d3912eab
am: 004939fd82

Change-Id: Iebc6a31b975fd7ba429bd9bae89cd9783776d1c3
2018-02-15 13:09:26 +00:00
Chalard Jean
004939fd82 Merge changes I3d68dbf8,I6ea524bb,I978d9119
am: 91d3912eab

Change-Id: I6ffc0a841d0aa8479bb5b6afba49c5130af879da
2018-02-15 12:57:16 +00:00
Chalard Jean
91d3912eab Merge changes I3d68dbf8,I6ea524bb,I978d9119
* changes:
  Deprecate CONNECTIVITY_ACTION.
  Publish FOREGROUND and add NOT_SUSPENDED capabilities.
  Send null UIDs to apps instead of single-uid lists.
2018-02-15 11:25:36 +00:00
Benedict Wong
b771edfea4 Merge "Copy IpSecConfig when IpSecTransforms are created" am: 2c8456b22e am: 978037db6c
am: cce3e4687d

Change-Id: I511e6b0cadfc24f24a492ae63c48a8b4baa89edb
2018-02-15 06:01:49 +00:00
Benedict Wong
cce3e4687d Merge "Copy IpSecConfig when IpSecTransforms are created" am: 2c8456b22e
am: 978037db6c

Change-Id: I041cd94be9cefc997b95478444661b557d95e3dc
2018-02-14 21:25:08 +00:00
Benedict Wong
978037db6c Merge "Copy IpSecConfig when IpSecTransforms are created"
am: 2c8456b22e

Change-Id: I24ac6baa0492a46bf5810bc6bc146d9aaa9eccab
2018-02-14 21:14:19 +00:00
Chalard Jean
52e239618b Deprecate CONNECTIVITY_ACTION.
That was its destiny.
Use NetworkCallbacks instead.

Test: runtest frameworks-net, but this is only doc changes
Change-Id: I3d68dbf817de92c66d899a7cc4519c5639e4c049
2018-02-14 15:14:44 +09:00
Chalard Jean
a23bc9e501 Publish FOREGROUND and add NOT_SUSPENDED capabilities.
NOT_SUSPENDED and FOREGROUND are capabilities that need to
be public so as to reach feature parity with what information
can be gotten through the use of CONNECTIVITY_ACTION and
synchronous calls to ConnectivityManager. This change makes
them public, and wires up the NOT_SUSPENDED capability.
This deprecates in effect the old onSuspended and onResumed
callbacks, but these have never been public.

This also converts the onAvailable path from a multiple
binder call design to a simpler, single binder call. This
is only for internal convenience

Test: runtest frameworks-net
Test: cts
Test: also manual testing
Change-Id: I6ea524bb361ecef0569ea2f9006c1e516378bc25
2018-02-14 15:14:41 +09:00
Chalard Jean
2550e069bc Send null UIDs to apps instead of single-uid lists.
Prior to this change ConnectivityManager used to patch in the UID
of the requesting app inside the NetworkCapabilities sent to it.
The rationale was that the app may not know what other apps may
use the network, so the view it should have of the network should
always say the network only applies to that app.

But this has an unfortunate side effect : apps can't match the
received network against a default NetworkCapabilities. Ostensibly
this only applies to the system because all involved calls are
@hide, but still : system code would get some NetworkCapabilities,
for example using networkCapabilitiesForType, and then try to
match the capabilities of an available network using
satisfiedByNetworkCapabilities. Because the passed network is
declared to only apply to one's own UID and the UIDs of the
NetworkCapabilities are set to null meaning "I need this network
to apply to all UIDs", the answer will be "false".

While this is WAI in a sense, it is very counter-intuitive that
code trying to match a network would be required to patch in its
own UIDs.
There are three ways of fixing this :
1. Require all apps to do the above. It's correct, but it's
   cumbersome and counterintuitive. Multiple places in existing
   code needs to be fixed, Tethering is an example.
2. Write the UIDs of the caller in any NetworkCapabilities object
   that is created. This is not very practical, because it imposes
   the converse requirement on all NetworkAgents, which would then
   have to clear the UIDs before they send the capabilities to
   ConnectivityService. All NetworkAgents need to be fixed.
3. Instead of sending an object with a list of one UID to apps,
   send a null list. The drawback is that the networks nominally
   look to apps like they apply to all apps. I argue this does
   not matter ; what matters is that the UID lists do not leak.
   Clients just see a null list of UIDs (and third party can't
   even access them without using reflection). No other changes
   are required besides this two-line patch.

This patch implements 3. I believe it is the saner approach, with
both the most intuitive behavior and the best backward compatibility
characteristics, as well as the easiest change.

This does not encroach on the future plans to make the actual
UID list available to apps with NETWORK_SETTINGS.

Test: runtest frameworks-net
Change-Id: I978d91197668119e051c24e1d04aafe1644a41cf
2018-02-14 12:47:15 +09:00
Benedict Wong
159abb6cff Copy IpSecConfig when IpSecTransforms are created
This change prevents IpSecTransforms from being inadvertently modified
by changes to the IpSecConfig. Specifically, once the transform is
created, it takes a copy of the config, rather than a reference.

Bug: 69385347
Test: New tests added, and all test passing
Change-Id: I89b8660c175ca20aa70352dcda893434ff7fd42b
2018-02-13 23:23:13 +00:00
Eric Enslen
1961fb7435 fix isActiveNetworkMetered with VPNs am: 97f679b04f
am: 8fa2e19e73

Change-Id: I177eff1237dd59514ccf91397a3d307148bc37b1
2018-02-09 21:40:42 +00:00
Eric Enslen
8fa2e19e73 fix isActiveNetworkMetered with VPNs
am: 97f679b04f

Change-Id: I8d59bc23e9153c54e64af59816d11301b490c9eb
2018-02-09 21:26:09 +00:00
Eric Enslen
97f679b04f fix isActiveNetworkMetered with VPNs
Bug: 72871435
Test: flashed and verified, also ran runtest framework-net

Change-Id: I69319a7db269489053426bb2d41574180be2d43d
2018-02-08 17:53:13 +00:00
Hugo Benichi
cbfbb3755a Add missing'}' in javadoc of public API method
Bug: 73052508
Test: pure documentation change
Change-Id: I92514629da1b000dd3d1165acd8efcdec75b49b9
2018-02-07 21:17:43 +09:00
Jong Wook Kim
622cda4338 Merge "MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator" am: 028e2a048e am: c7ec0f6fc3
am: 83939e37af

Change-Id: I5f2d395705841b7da03b1552b16507466e47ef84
2018-02-07 09:26:56 +00:00
Jong Wook Kim
83939e37af Merge "MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator" am: 028e2a048e
am: c7ec0f6fc3

Change-Id: I6dba4e244c660d29f107e471250d39e9caafb17e
2018-02-07 05:32:01 +00:00
Jong Wook Kim
c7ec0f6fc3 Merge "MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator"
am: 028e2a048e

Change-Id: If35e07b78b17329a25cf78adbf3d8244af4a4f81
2018-02-07 05:20:19 +00:00
Jong Wook Kim
028e2a048e Merge "MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator" 2018-02-07 02:06:07 +00:00
Jong Wook Kim
93dd5e6964 MacAddress: Use SecureRandom and add a 46 bit randomized MAC generator
Use SecureRandom instead of Random since Random is time based and can
increase the chance of generating same MAC address across multiple
devices.

createRandomUnicastAddress should randomize all bits of the address,
except for locally assigned bit and unicast bit. The previous method
that only randomizes NIC and use Google Base OUI is renamed to
createRandomUnicastAddressWithGoogleBase.

Bug: 72450936
Test: runtest frameworks-net
Change-Id: Icda650638c2c1c9fd90d509a87e86347c0e05f2d
2018-02-07 01:28:46 +00:00
Andreas Gampe
3cdcd5d395 Merge "Frameworks: Mark tests" am: 997937820d am: 043d868185
am: 6ae05e38bd

Change-Id: I55b62b64236937c66a21ec667216f7f1d505a5b5
2018-02-06 09:29:10 +00:00
Andreas Gampe
6ae05e38bd Merge "Frameworks: Mark tests" am: 997937820d
am: 043d868185

Change-Id: I73c717b99b9660a11141b5392c6993ab9aabf85c
2018-02-06 09:14:05 +00:00
Andreas Gampe
043d868185 Merge "Frameworks: Mark tests"
am: 997937820d

Change-Id: I07af71812c623a14bd8df098e9991a331bdecbc2
2018-02-06 09:04:38 +00:00
Treehugger Robot
997937820d Merge "Frameworks: Mark tests" 2018-02-06 06:03:09 +00:00
Andreas Gampe
3fa5c22fc8 Frameworks: Mark tests
Add @Ignore and @Test to make Errorprone happy.

Bug: 72076216
Test: m javac-check RUN_ERROR_PRONE=true
Test: atest ConnectivityServiceTest
Test: atest WifiManagerTest
Change-Id: Id2423c545eccaa768203faf86e14d0a558d927cd
2018-01-31 01:04:00 +00:00
nharold
4b1ac9cb0c Merge changes from topic "cherry-pick-cell-keepalive" am: 7e8374e9fc am: 86362b4677
am: 16f3959dd0  -s ours

Change-Id: I1852cb11d6d33963b8e463729a952c4c22bc553a
2018-01-30 20:05:03 +00:00
nharold
16f3959dd0 Merge changes from topic "cherry-pick-cell-keepalive" am: 7e8374e9fc
am: 86362b4677

Change-Id: Ib4ba3f739a91ea2700611732f71afec0cc997ae4
2018-01-30 19:52:22 +00:00
nharold
86362b4677 Merge changes from topic "cherry-pick-cell-keepalive"
am: 7e8374e9fc

Change-Id: I3001cd2693b2c57643672fd7f370b5cca2890585
2018-01-30 19:41:53 +00:00
nharold
7e8374e9fc Merge changes from topic "cherry-pick-cell-keepalive"
* changes:
  Rework KeepalivePacketData for Compatibility with Cell
  Add Constants for NATT Keepalive to RILConstants
  Relocate KeepalivePacketData to frameworks/base
2018-01-30 18:39:07 +00:00
Hugo Benichi
0cfad8c7bf Merge changes I303d1102,I72c9aa43,If13a5284 am: 1aaf45bf89 am: 5001af80ff
am: bb119158f9

Change-Id: Iad1030a22f25bed92bd9d504fb1a40fc1e1cfdc5
2018-01-30 01:55:28 +00:00
Hugo Benichi
bb119158f9 Merge changes I303d1102,I72c9aa43,If13a5284 am: 1aaf45bf89
am: 5001af80ff

Change-Id: Ida5f28fc0e8e99199ac7129a6e3df0fbe864d90b
2018-01-30 01:47:07 +00:00
Hugo Benichi
5001af80ff Merge changes I303d1102,I72c9aa43,If13a5284
am: 1aaf45bf89

Change-Id: I402de7fe5fc0e9bf56dc42f4c956c511baee78ab
2018-01-30 01:41:23 +00:00
Hugo Benichi
1aaf45bf89 Merge changes I303d1102,I72c9aa43,If13a5284
* changes:
  Fix default network validation overcounting
  Prevent crash in NetworkManagementServiceTest#shutdown()
  Fix ApfTest
2018-01-30 00:26:31 +00:00