Commit Graph

309172 Commits

Author SHA1 Message Date
Hugo Benichi
9c58a11f98 ConnectivityManager: a simpler CallbackHandler
This patch simplifies CallbackHandler in the following way:
  - CallbackHandler directly uses the static references to
    sNetworkCallback and sCallbackRefCount. This allows to remove
    instance fields in CallbackHandler.
  - CallbackHandler does not have a reference to ConnectivityManager
    anymore
  - CallbackHandler.getObject() is now generic in a type-safe way.

Test: ConnectivityServiceTest passes
Bug: 28537383
Bug: 32130437

(cherry picked from commit d42650faaa)

Change-Id: I1b5fe2a361b5f623a8310ae698497c83d72f3034
2017-01-26 18:51:43 +09:00
Philip P. Moltmann
092feb5b1c Indicate the NsdServiceInfo attributes are only filled in for a resolved service.
Fixes: 28530428

(cherry picked from commit 7d5da4b044)

Change-Id: If2bfc06589adb361f11b89cd5923cb5c255cb680
2017-01-26 18:51:39 +09:00
Jeremy Klein
a17dabedde Add a null check for the OnStartTetheringCallback.
This avoids a NullPointerException when trying to call the callback
and gives a more readable error message.

(cherry picked from commit 5f277e1667)

Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
2017-01-26 18:51:36 +09:00
Hugo Benichi
4bee7e4edb TokenBucket for rate-limiting and throttling
This patch adds a TokenBucket class that can accumulate and distribute
tokens over time.

Test: comes with unit tests.
Bug: 32198637

(cherry picked from commit 998493f0ee)

Change-Id: I4012ae6d02f7004bceee9a2ba03914f2a2506031
2017-01-26 18:51:33 +09:00
Hugo Benichi
728842ad47 IpConnectivityMetrics reads buffer size in settings
Test: IpConnectivityMetricsTest passes. Also manually changed the new
setting and verified the buffer size is as expected after flushing the
buffer.
Bug: 32198637

(cherry picked from commit 05686dbb6b)

Change-Id: Iefbeac3a688b260fb3f92dfe0bfd9db28e26749d
2017-01-26 18:51:30 +09:00
Lorenzo Colitti
26a2dc5284 CaptivePortalLogin: set mixed content policy to compatibility.
This makes the policy for mixed HTTP/HTTPS content match Chrome.
This allows us to display login pages where unimportant
subresources are HTTP.

Bug: 32171569

(cherry picked from commit 625166377b)

Change-Id: Ia82958192d978280715442e182c34f9da5c88c66
2017-01-26 18:51:27 +09:00
Hugo Benichi
7e52973f2c Add IP conn metrics to dumpsys and bug reports
Test: manually created a bug report and inspected content.

(cherry picked from commit 51d14cb607)

Change-Id: I9649cc2f9bb7a1975e60baaae55fcdb2a48c3b93
2017-01-26 18:51:22 +09:00
Hugo Benichi
d19752c3d0 IpConnectivity metrics: add version number
This patch adds a version field to ipconnectivity.proto and populates it
to 2, which is the logical version number for NYC-MR2.

Test: IpConnectivity{EventBuilder,Metrics}Test pass
Bug: 32127906

(cherry picked from commit d680d4c856)

Change-Id: If8f167c0dc4c1abe0e235e2adfd131168a4ddc52
2017-01-26 18:51:18 +09:00
Etan Cohen
1256590348 [CS] Remove timeout event after first available
Guarantees that timeouts are only delivered if a network never
becomes available. Once a network is available the timeout is
canceled.

Bug: 31402633
Test: all timeout related unit tests pass (new one added)

(cherry picked from commit 681fcda589)

Change-Id: I7cd3086544c881915fc6dbf14b87a24ab0cd8748
2017-01-26 18:51:15 +09:00
Hugo Benichi
f488ffd3be ApfTest: tag tests with @SmallTest or @MediumTest
Test methods not tagged with @{Small,Medium,Large}Test will not appear
in the Android Platform Continuous Testing dashboard.

Test methods tagged with @LargeTest will not be run in the Android
Platform Continuous Testing dashboard.

Test: ApfTest passes ($runtest frameworks-net)
Bug: 31479480

(cherry picked from commit 4195c28347)

Change-Id: Ia215fc8e2ccc61f6223c24fdf390e1e759de302f
2017-01-26 18:51:12 +09:00
Lorenzo Colitti
f537c5eb74 Unbreak TetherInterfaceStateMachineTest.
This was broken by the implementation of IPv6 tethering, which
relies on various private classes which end up calling unmockable
final classes like NetworkInterface.

Making everything public like this is almost certainly not the
best way of fixing this test, but on the other hand there is
value to the test continuing to pass.

Test: runtest frameworks-net  # Everything passes.
Test: IPv6 tethering continues to work.

(cherry picked from commit 7e0eeca8ba)

Change-Id: I8a3cf466871c026f4ae0f5cfa73071338cdf5b7e
2017-01-26 18:51:09 +09:00
Lorenzo Colitti
47a44ba2b1 Move the connectivity tests to frameworks/base/tests/net.
This will give us a good place to put all the networking tests.

Fix: 31479480
Test: adb  shell am instrument -w -e notClass com.android.server.connectivity.tethering.TetherInterfaceStateMachineTest 'com.android.frameworks.tests.net/android.support.test.runner.AndroidJUnitRunner'  # PASS

(cherry picked from commit ecc986d430)

Change-Id: I993eeaa5dec001c39389023f355f506129b356e7
2017-01-26 18:50:59 +09:00
Lorenzo Colitti
adaa652337 De-guava BroadcastInterceptingContext and move it to testutils.
Removing the static dependency on guava reduces test compile time
by about 20 seconds on a Z840, thus substantially speeding up the
compile/test cycle.

Make FutureIntent public instead of package-private because it is
used directly by NetworkPolicyManagementServiceTest, which as of
this CL is now in a different package.

(cherry picked from commit 281a17c958)

Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.NetworkPolicyManagerServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.net.NetworkStatsServiceTest  # PASS
Test: runtest frameworks-services -c com.android.server.NetworkManagementServiceTest  # Already failing.
Bug: 31479480
Change-Id: Ifab32c9214e9caab71dbf93b3d3ca88df6f49636
2017-01-26 18:50:52 +09:00
Lorenzo Colitti
c869089383 Move FakeSettingsProvider to a common location.
(cherry picked from commit 7df1a82802)

Test: runtest frameworks-util -c com.android.internal.util.test.FakeSettingsProviderTest
Test: runtest frameworks-services -c com.android.server.ConnectivityServiceTest
Test: runtest frameworks-services -c com.android.server.retaildemo.PreloadAppsInstallerTest
Test: runtest frameworks-services -c com.android.server.retaildemo.RetailDemoModeServiceTest
Bug: 31479480
Change-Id: I8d4d4de2937012dd33924f53e68f96241a9b2b4f
2017-01-26 18:50:48 +09:00
Hugo Benichi
a5605c3ede ConnectivityServiceTest: mark flaky test as such
This patch extracts into its own independent test a test sub-block looking
for a race condition when not waiting on handlers to become idle:
there is no way to prevent the race from not happening when looking for
it this way. This makes the test flakky.

This new independent test is tagged with @FlakkyTest(tolerance = 3).

Test: ConnectivityServiceTest passes, with higher probability.
Bug: 31479480

(cherry picked from commit c8c1027762)

Change-Id: I3c702bd981ed80ed606be0fb52d61eb3d7195a6f
2017-01-26 18:50:45 +09:00
Calvin On
d2bd69aec0 Add option to skip and avoid captive portals.
Test: ConnectivityServiceTest updated with test cases.
Test: Manually tested against att-wifi in B42.
Bug: 30222699

(cherry picked from commit be96da11cc)

Change-Id: I90c0f97fe0e41de4059bceae7b56ab3a70145696
2017-01-26 18:50:42 +09:00
Hugo Benichi
02bab164b7 ApfFilter: use elapsedRealTime for RA lifetime
This patch replaces System.currentTimeMillis() with
SystemClock.elapsedRealTime() to make RA lifetime computation more
resilient to various external events inducing jumps in
currentTimeMillis().

Test: ApfTest passes.

(cherry picked from commit 305af8e98a)

Change-Id: If19011fc0c905948f2e42b975cfcc5f8672a95fb
2017-01-26 18:50:37 +09:00
Hugo Benichi
eaa786958f Do not synchronize boolean reads/writes
This patch removes the synchronization around the private variable
mRunning inside of IpReachabilityMonitor and instead qualifeis the field
as volatile.

Synchronization is not needed for reads/writes on native fields or
object references because they are already guaranteed to be atomic.

Synchronization here was used for enforcing memory visibility across
concurrent threads indirectly through monitor acquire/release.
The volatile keyword achieves this in a more explicit way.

Also, this patch changes the way that probeAll() copies the
IpReachabilityMonitor's mIpWatchList by temporary holding mIpWatchList
keys into an ArrayList instead of a more expensive HashSet. Since Java
HashSet are just degenerated HashMaps, and that key iteration order is
based on key hash, the iteration order over this temporary collection
will be consistent for the same mIpWatchList.

Test: refactoring CL. Existing unit tests still pass.

(cherry picked from commit b0f1186c03)

Change-Id: I48d2b4d837a459150cd431b400ec01b87b48c014
2017-01-26 18:50:34 +09:00
Hugo Benichi
3098e4cc95 ApfFilter: systematically use u8, u16, u32 getters
This patch adds a getUint8 getter for ByteBuffers and changes ApfFilter
to make uses of getUint8/16/32 everywhere.

The return types of getUint16 is also changed from long to int, which
will expand gracefully to long as an unsigned int as it is guaranteed to
be positive after getUint16.

Test: ApfTest passes

(cherry picked from commit 995dd94673)

Change-Id: I606ebc5aedfcacde400d27cc6bc37145769b122c
2017-01-26 18:50:30 +09:00
Hugo Benichi
5cd994ee9c Add fuzzing tests to ApfFilter RA processing
Test: added new unit tests

(cherry picked from commit 8acea76a2b)

Change-Id: I847d7e4895766042043c0bba1c9b9a698a705d87
2017-01-26 18:50:27 +09:00
Erik Kline
95be623a27 Support timeouts for requestNetwork() invocations.
(cherry-pick of 06c3ef1367)
(cherry picked from commit 57faba9ec7)

Bug: 21414325
Change-Id: I1a58823a372154589f972b98c4c428eab0e0523e
2017-01-26 18:50:23 +09:00
Pierre Imai
ccb0045f93 Silence the obnoxious MTU 0 error message that occur when no MTU is
specified for a given network.

Bug: 10705136

(cherry picked from commit 54f0d9edbf)

Change-Id: I89e2fdfbbfa981d435a2974422d9d9c009872d76
2017-01-26 18:50:18 +09:00
ltrochtova
c0118ac10e Merge "Don't offer the BT sharing option to the user if BT is disallowed."
am: 2c1e396382

Change-Id: I132bdd6aee36e32ddbcfdc8f38aed1e88424297e
2017-01-26 09:48:23 +00:00
ltrochtova
2c1e396382 Merge "Don't offer the BT sharing option to the user if BT is disallowed." 2017-01-26 09:41:52 +00:00
TreeHugger Robot
a8affd9e83 Merge "Clear the calling ID in dump()." 2017-01-26 08:31:37 +00:00
TreeHugger Robot
10dcfd3688 Merge "Add an intent that asks the launcher to make a channel browsable." 2017-01-26 08:30:12 +00:00
TreeHugger Robot
60d820b050 Merge "media: Add new MediaMuxer constructor that takes FileDescriptor." 2017-01-26 08:22:01 +00:00
Dmitry Dementyev
7b5bbb5509 Merge "Implement Account Discovery API." 2017-01-26 07:53:59 +00:00
TreeHugger Robot
35089c466e Merge "Revert "Revert "Remove View.setTooltip/getTooltip""" 2017-01-26 07:39:51 +00:00
TreeHugger Robot
bcf3b70371 Merge "Adding an api for apps to check whether they can install apps" 2017-01-26 07:35:33 +00:00
TreeHugger Robot
0e4bddb896 Merge "Relax permission for shared storage UUID." 2017-01-26 07:33:31 +00:00
Android Build Merger (Role)
74e6cb3fe7 Merge "Merge "Import translations. DO NOT MERGE" into nyc-mr2-dev am: 36f8170bbc -s ours am: 4ad5263a52 -s ours" 2017-01-26 07:22:54 +00:00
TreeHugger Robot
eb30016ad4 Merge "Implement pointer capture API" 2017-01-26 07:22:24 +00:00
Bill Yi
16f4804a4d Merge "Import translations. DO NOT MERGE" into nyc-mr2-dev am: 36f8170bbc -s ours
am: 4ad5263a52  -s ours

Change-Id: I6c73a4ef1c7111e1dccc993dd0018315e49697a6
2017-01-26 07:22:18 +00:00
Bill Yi
d640737329 Import translations. DO NOT MERGE am: 30b5edfd23 -s ours
am: 4b6ec5fc6a  -s ours

Change-Id: Ic842d3d523fe0d30d7eea7f389862a60fd18a062
2017-01-26 07:21:24 +00:00
Bill Yi
c76c3eeaf6 Merge "Import translations. DO NOT MERGE" into nyc-mr2-dev am: 6201ee5c68 -s ours
am: 5aa8230eb4  -s ours

Change-Id: I9f0c210dc6dfeb8bc60f924309199e50a5e99838
2017-01-26 07:20:29 +00:00
Bill Yi
7f765b0bac Import translations. DO NOT MERGE am: 9c0c94c1b5 -s ours
am: 530f10fb47  -s ours

Change-Id: I9966efeaa61f54af7c3cac10d388c9e4c56e555d
2017-01-26 07:19:34 +00:00
Bill Yi
4ad5263a52 Merge "Import translations. DO NOT MERGE" into nyc-mr2-dev
am: 36f8170bbc  -s ours

Change-Id: If96f86dd128b899982a82f27a54b3682c86123b0
2017-01-26 07:16:06 +00:00
Bill Yi
4b6ec5fc6a Import translations. DO NOT MERGE
am: 30b5edfd23  -s ours

Change-Id: I8e401e5b1cdfa7506384c1aeab219697360bcf79
2017-01-26 07:16:01 +00:00
Bill Yi
5aa8230eb4 Merge "Import translations. DO NOT MERGE" into nyc-mr2-dev
am: 6201ee5c68  -s ours

Change-Id: I02412d6d4a77f847f3eef6e822664cc10dd6768e
2017-01-26 07:14:41 +00:00
Bill Yi
530f10fb47 Import translations. DO NOT MERGE
am: 9c0c94c1b5  -s ours

Change-Id: I8c629cb66f2c962598e4ec221432c6d0c1ab6a85
2017-01-26 07:14:36 +00:00
TreeHugger Robot
e0d805b532 Merge "Import translations. DO NOT MERGE" 2017-01-26 07:11:11 +00:00
TreeHugger Robot
36f8170bbc Merge "Import translations. DO NOT MERGE" into nyc-mr2-dev 2017-01-26 07:10:25 +00:00
TreeHugger Robot
5d5480d0e2 Merge "Import translations. DO NOT MERGE" 2017-01-26 07:08:13 +00:00
TreeHugger Robot
6201ee5c68 Merge "Import translations. DO NOT MERGE" into nyc-mr2-dev 2017-01-26 07:07:38 +00:00
TreeHugger Robot
f8d859d868 Merge "Import translations. DO NOT MERGE" 2017-01-26 07:04:45 +00:00
TreeHugger Robot
b4c86b6f29 Merge "Notification Channels come to SystemUI's own notifications." 2017-01-26 06:57:17 +00:00
TreeHugger Robot
6cc3e76ad9 Merge "Do not remove file_cache when exiting demo mode" 2017-01-26 06:43:14 +00:00
Doris Liu
d5bb985188 Merge "Refine the comparator for the animation event sorting" 2017-01-26 06:38:33 +00:00
Selim Cinek
21c9a41a52 Merge "Adapt the paddings of colored notifications" 2017-01-26 06:13:17 +00:00