Commit Graph

3136 Commits

Author SHA1 Message Date
Hugo Benichi
a7f7972f59 DO NOT MERGE: ConnectivityThread: use lazy holder idiom am: e5ef0ce33c -s ours am: f6cb43ae32 -s ours am: cc374542ca
am: fdc2f1e075  -s ours

Change-Id: Iafa9ac6e49566a7165c2c586128c8e663e6a1b9a
2016-12-09 10:58:23 +00:00
Hugo Benichi
60c01a83d3 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper am: 94e0d04479 -s ours am: 7337239702 -s ours am: 5617d4ef19
am: 2744db6456  -s ours

Change-Id: I649b6bcd026ad86055fa6cbe59cb85e0141d22b8
2016-12-09 10:57:34 +00:00
Hugo Benichi
c040e6743f DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler am: 515e786cfd -s ours am: ef148edaa2 -s ours am: b6574912aa
am: 46ed74c3d3  -s ours

Change-Id: I07908e3f1734503e58bbf62586dbfc3a6c1f887a
2016-12-09 10:56:27 +00:00
Jeremy Klein
b2d0c99f50 DO NOT MERGE: Add a null check for the OnStartTetheringCallback. am: d0542adb0b -s ours am: 3cd1ae2261 -s ours am: 7a9bc9c4a3
am: 4ce8d89299  -s ours

Change-Id: I9d5983d4f197d7cedb841081f48291288359988a
2016-12-09 10:53:51 +00:00
Hugo Benichi
fdc2f1e075 DO NOT MERGE: ConnectivityThread: use lazy holder idiom am: e5ef0ce33c -s ours am: f6cb43ae32 -s ours
am: cc374542ca

Change-Id: I121ad24bed0fa12b80110b1058ad4279ec9c0107
2016-12-09 10:24:20 +00:00
Hugo Benichi
2744db6456 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper am: 94e0d04479 -s ours am: 7337239702 -s ours
am: 5617d4ef19

Change-Id: If52ab02bd501d4b071f24ddf8abdfe344e7358eb
2016-12-09 10:23:28 +00:00
Hugo Benichi
46ed74c3d3 DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler am: 515e786cfd -s ours am: ef148edaa2 -s ours
am: b6574912aa

Change-Id: I7c177123057676622e1aa43c68676ee06ed60ee6
2016-12-09 10:22:25 +00:00
Jeremy Klein
4ce8d89299 DO NOT MERGE: Add a null check for the OnStartTetheringCallback. am: d0542adb0b -s ours am: 3cd1ae2261 -s ours
am: 7a9bc9c4a3

Change-Id: I897f28d2b002e1a2aa6be8ec423a1c9b1d5b761b
2016-12-09 10:20:04 +00:00
Hugo Benichi
cc374542ca DO NOT MERGE: ConnectivityThread: use lazy holder idiom am: e5ef0ce33c -s ours
am: f6cb43ae32  -s ours

Change-Id: I08a03dd249d30bc474a5d16472883737d12fec37
2016-12-09 09:53:16 +00:00
Hugo Benichi
5617d4ef19 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper am: 94e0d04479 -s ours
am: 7337239702  -s ours

Change-Id: Ida0d76b540e800db215569717a1c5d26e0f583b0
2016-12-09 09:52:26 +00:00
Hugo Benichi
b6574912aa DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler am: 515e786cfd -s ours
am: ef148edaa2  -s ours

Change-Id: Ie8ebf41835e62b64ceb22e552208c77482d96c73
2016-12-09 09:50:57 +00:00
Jeremy Klein
7a9bc9c4a3 DO NOT MERGE: Add a null check for the OnStartTetheringCallback. am: d0542adb0b -s ours
am: 3cd1ae2261  -s ours

Change-Id: I3c471a8971c21cdbf1ebf7e1302524b038b20375
2016-12-09 09:48:50 +00:00
Hugo Benichi
e5ef0ce33c DO NOT MERGE: ConnectivityThread: use lazy holder idiom
This patch changes the way that the ConnectivityThread is lazily
instantiated by using the "lazy initialization holder class idiom".

The first code point that tries to obtain a reference to the unique
ConnectivityThread instance will trigger the creation of the Singleton
class, which will guarantee a thread-safe initialization of the static
INSTANCE field inside Singleton according to the language specs.

This is the Item #71 of Effective Java.

The unique static instance of ConnectivityThread is not stored directly
inside ConnectivityThread class but is stored in a static nested class.
This is to avoid triggering the creation of that unique instance when
Zygote does class preloading at phone startup. Otherwise this would lead
to Zygote creating a new OS thread during preloading, which is a fatal
error.

Test: frameworks-wifi tests pass
Bug: 26749700
Bug: 28537383
Bug: 32130437

(cherry picked from commit f8ddba2cbd)

Change-Id: If13b363889a8e9396273a90c3d9f9421a48aecbc
2016-12-09 13:42:26 +09:00
Hugo Benichi
94e0d04479 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper
This patch removes the static singleton looper used by
ConnectivityManager and instead uses the common ConnectivityThread.

This allows to removes the static atomic counter used to track
the number of registered NetworkCallback in ConnectivityManager, because
the looper is not turned off anymore when no callbacks are registered.

Also an overloaded version of sendRequestForNetwork is added taking as a
new parameter a Handler. This will allow to overload various callback
and request related API calls with user provided Handlers.

Test: ConnectivityServiceTest passes
Bug: 26749700
Bug: 28537383
Bug: 32130437

(cherry picked from commit 3a54555e85)

Change-Id: If956addbf8e7b11b36a4b966de7fca00e8f362c1
2016-12-09 13:42:24 +09:00
Hugo Benichi
515e786cfd DO NOT MERGE: 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 fe3325f2a5)

Change-Id: I1b5fe2a361b5f623a8310ae698497c83d72f3034
2016-12-09 13:42:20 +09:00
Jeremy Klein
d0542adb0b DO NOT MERGE: 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 49a5795ef0)

Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
2016-12-09 13:42:02 +09:00
Hugo Benichi
de51eb4a99 Merge changes from topic 'framework-net-aosp' am: 9c8e68726d am: 5910f412bd am: cc331b6dea
am: f7de47d524

Change-Id: Ia03edd1d0a972dfc546a32fcf06784a00d6ab8cd
2016-12-09 04:17:08 +00:00
Hugo Benichi
b2bbc4645f DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents am: f2de19cb5c -s ours am: 6765bc08d0 -s ours am: 4686a077f6
am: ea10952568  -s ours

Change-Id: Ia453e3c806be8f58ff96e4b760de1c6a41cc8757
2016-12-09 04:16:09 +00:00
Hugo Benichi
502b338ee8 DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings am: d8cee631fa -s ours am: f3b4c26453 -s ours am: 4c02563e0d
am: 0d0a5a1f5b  -s ours

Change-Id: Ic511ed8370c3a388bdc77f064cbe25bc434d927d
2016-12-09 04:14:15 +00:00
Hugo Benichi
99b362bd90 DO NOT MERGE: IpConnectivity metrics: add version number am: 8c938f0957 -s ours am: 0e67ef7d3f -s ours am: c09378320a
am: cf43c0310a  -s ours

Change-Id: I859f9b7ebdf93c06841a631e616a88270a8aebae
2016-12-09 04:10:50 +00:00
Hugo Benichi
f7de47d524 Merge changes from topic 'framework-net-aosp' am: 9c8e68726d am: 5910f412bd
am: cc331b6dea

Change-Id: I8cd4afc5e1381f5b69e4b6dd598c9fee76dc785e
2016-12-09 04:02:17 +00:00
Hugo Benichi
ea10952568 DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents am: f2de19cb5c -s ours am: 6765bc08d0 -s ours
am: 4686a077f6

Change-Id: Ia32470ecf8c0dd918994f9d0bccb20248c3b02d1
2016-12-09 04:01:20 +00:00
Hugo Benichi
0d0a5a1f5b DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings am: d8cee631fa -s ours am: f3b4c26453 -s ours
am: 4c02563e0d

Change-Id: Ib8045e9d97c0928baa0c0a4a752f544aaa1fe790
2016-12-09 03:59:36 +00:00
Hugo Benichi
cf43c0310a DO NOT MERGE: IpConnectivity metrics: add version number am: 8c938f0957 -s ours am: 0e67ef7d3f -s ours
am: c09378320a

Change-Id: I5b970302c258569638890a49b3455e43614ec63a
2016-12-09 03:56:29 +00:00
Hugo Benichi
cc331b6dea Merge changes from topic 'framework-net-aosp' am: 9c8e68726d
am: 5910f412bd

Change-Id: I919fd8d8075c89aa9eb42b505017c075f61824ff
2016-12-09 03:47:48 +00:00
Hugo Benichi
4686a077f6 DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents am: f2de19cb5c -s ours
am: 6765bc08d0  -s ours

Change-Id: I9e3ca112a654018d9d0b72ba1b0963e7fb678cf0
2016-12-09 03:46:50 +00:00
Hugo Benichi
4c02563e0d DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings am: d8cee631fa -s ours
am: f3b4c26453  -s ours

Change-Id: I7f2eee043702be1a8878851793b9b17bdb89766b
2016-12-09 03:45:08 +00:00
Hugo Benichi
c09378320a DO NOT MERGE: IpConnectivity metrics: add version number am: 8c938f0957 -s ours
am: 0e67ef7d3f  -s ours

Change-Id: I05ffe76ca4f266bd341fc298cbc03da62991e4bb
2016-12-09 03:41:57 +00:00
Treehugger Robot
9c8e68726d Merge changes from topic 'framework-net-aosp'
* changes:
  DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents
  DO NOT MERGE: TokenBucket for rate-limiting and throttling
  DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings
  DO NOT MERGE: CaptivePortalLogin: set mixed content policy to compatibility.
  DO NOT MERGE: Add IP conn metrics to dumpsys and bug reports
  DO NOT MERGE: IpConnectivity metrics: add version number
2016-12-09 03:19:13 +00:00
Hugo Benichi
f2de19cb5c DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents
This patch uses the previously introduced TokenBucket to rate limit
ApfProgramEvents, still allowing for burst of ApfProgramEvents when a
new interface is set up (due to ipv4 provisioning, multicast lock, ipv6 RAs
triggering new APF program events in short amounts of time).

Test: new test in IpConnectivityMetricsTest
Bug: 1550402

(cherry picked from commit 811c4cec75)

Change-Id: Idb640dec13ba64180985544b9709a586af66eb6e
2016-12-09 11:21:31 +09:00
Hugo Benichi
d8cee631fa DO NOT MERGE: 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 d5f78a08b4)

Change-Id: Iefbeac3a688b260fb3f92dfe0bfd9db28e26749d
2016-12-09 11:21:26 +09:00
Hugo Benichi
8c938f0957 DO NOT MERGE: 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 79a739cbf3)

Change-Id: If8f167c0dc4c1abe0e235e2adfd131168a4ddc52
2016-12-09 11:21:11 +09:00
Etan Cohen
b305f612b2 DO NOT MERGE: [CS] Remove timeout event after first available am: 69e6a108a5 -s ours am: a8b73b23d6 -s ours am: 734e6ff49e
am: f694f1b07b  -s ours

Change-Id: I1919ee28071c2281896a2f7fbb3d6aadf4f47cae
2016-12-08 17:53:04 +00:00
Lorenzo Colitti
b93d57b7c4 DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net. am: c97a4587c3 -s ours am: d1e22a3f07 -s ours am: 905198e0b1
am: d1c44982f0  -s ours

Change-Id: I3613a50627a6722e3c337caaa2880d96f1b39beb
2016-12-08 17:49:56 +00:00
Lorenzo Colitti
4b9f1a4b45 DO NOT MERGE: De-guava BroadcastInterceptingContext and move it to testutils. am: 9d6921c144 -s ours am: bcb7e32954 -s ours am: 4552680f94
am: 0acd24ffa2  -s ours

Change-Id: I07d5fdbb7285da095676aa1612df232d77d41b48
2016-12-08 17:49:10 +00:00
Lorenzo Colitti
bc3fd9ed5a DO NOT MERGE: Move FakeSettingsProvider to a common location. am: 91f851c6ea -s ours am: a84ede299c -s ours am: 9cd69e7aad
am: 86b4aea33d  -s ours

Change-Id: I53d3ceb607580cc0a04d414cef11f69d6877be21
2016-12-08 17:48:25 +00:00
Hugo Benichi
3a95bb4a29 DO NOT MERGE: ConnectivityServiceTest: mark flaky test as such am: 89b3c8e11c -s ours am: e47b0886ad -s ours am: 29fc948aa7
am: 3282cca84e  -s ours

Change-Id: Ia5e678bc4297f8d6531d7b8fb6cc1085d2877947
2016-12-08 17:47:03 +00:00
Calvin On
75229c75a0 DO NOT MERGE: Add option to skip and avoid captive portals. am: 488c84ca1f -s ours am: 8006bd5c66 -s ours am: c5585a4fec
am: b0e87a6774  -s ours

Change-Id: I6af06157789b0eed11588d697e42776cdaafdb11
2016-12-08 17:46:08 +00:00
Erik Kline
c1eab1cb01 DO NOT MERGE: Support timeouts for requestNetwork() invocations. am: 950bfc31f9 -s ours am: eb6be2c826 -s ours am: 87dba2f72c
am: eda9d9aa6c  -s ours

Change-Id: I380a34e414f13ff1e55eb872090d2ebc1b81ba7a
2016-12-08 17:41:23 +00:00
Pierre Imai
9bf9711f7a DO NOT MERGE: Silence the obnoxious MTU 0 error message that occur when no MTU is specified for a given network. am: 68902bc1df -s ours am: 8a73b2896d -s ours am: 72ecfb8166
am: 8867178a65  -s ours

Change-Id: I35db4c3ff6b38ba0813f35158a65f519b1b40468
2016-12-08 17:40:19 +00:00
Etan Cohen
f694f1b07b DO NOT MERGE: [CS] Remove timeout event after first available am: 69e6a108a5 -s ours am: a8b73b23d6 -s ours
am: 734e6ff49e

Change-Id: If94bc1b3dd0ed5ad697656303ca434152b4a5b18
2016-12-08 11:34:09 +00:00
Lorenzo Colitti
d1c44982f0 DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net. am: c97a4587c3 -s ours am: d1e22a3f07 -s ours
am: 905198e0b1

Change-Id: I6b52a0383884ad41b1601bdd9cf976f58c0dcefd
2016-12-08 11:31:13 +00:00
Lorenzo Colitti
0acd24ffa2 DO NOT MERGE: De-guava BroadcastInterceptingContext and move it to testutils. am: 9d6921c144 -s ours am: bcb7e32954 -s ours
am: 4552680f94

Change-Id: I261c10f930d32c6d69d0ced4d0d7d81f3357cf63
2016-12-08 11:30:17 +00:00
Lorenzo Colitti
86b4aea33d DO NOT MERGE: Move FakeSettingsProvider to a common location. am: 91f851c6ea -s ours am: a84ede299c -s ours
am: 9cd69e7aad

Change-Id: I3e877a603c1c19af15e5f38d4e0301dfddfc6f39
2016-12-08 11:29:28 +00:00
Hugo Benichi
3282cca84e DO NOT MERGE: ConnectivityServiceTest: mark flaky test as such am: 89b3c8e11c -s ours am: e47b0886ad -s ours
am: 29fc948aa7

Change-Id: If5133073f09b59b0458c1784b9d288f9a176c568
2016-12-08 11:28:34 +00:00
Calvin On
b0e87a6774 DO NOT MERGE: Add option to skip and avoid captive portals. am: 488c84ca1f -s ours am: 8006bd5c66 -s ours
am: c5585a4fec

Change-Id: I7e7f6fa8d643bbd83c9b73614f80d202e3f28f20
2016-12-08 11:27:11 +00:00
Erik Kline
eda9d9aa6c DO NOT MERGE: Support timeouts for requestNetwork() invocations. am: 950bfc31f9 -s ours am: eb6be2c826 -s ours
am: 87dba2f72c

Change-Id: I3cba7c98328a4237105243502fe148ed6a35ef48
2016-12-08 11:22:25 +00:00
Pierre Imai
8867178a65 DO NOT MERGE: Silence the obnoxious MTU 0 error message that occur when no MTU is specified for a given network. am: 68902bc1df -s ours am: 8a73b2896d -s ours
am: 72ecfb8166

Change-Id: I20016d9056888897515e6a4b4296e3ea76f11b61
2016-12-08 11:21:31 +00:00
Etan Cohen
734e6ff49e DO NOT MERGE: [CS] Remove timeout event after first available am: 69e6a108a5 -s ours
am: a8b73b23d6  -s ours

Change-Id: I61fbbf03bc011ae0b6b0e011bfb69dea33195c79
2016-12-08 11:07:46 +00:00
Lorenzo Colitti
905198e0b1 DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net. am: c97a4587c3 -s ours
am: d1e22a3f07  -s ours

Change-Id: I92f0f18ed7ee196f1cdb1369393ff7c4e2c800fc
2016-12-08 11:04:38 +00:00