Commit Graph

3152 Commits

Author SHA1 Message Date
Felipe Leme
9f69ae3ba6 DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock. am: 6670ab4480 -s ours am: fbbaf25665 -s ours am: 2672fd0196
am: 94a8f25fc6  -s ours

Change-Id: Ic3005458ec91655ce105c70569877cf5dd8a920b
2016-12-09 11:02:22 +00:00
Felipe Leme
c039eb6818 DO NOT MERGE: Use @Ignore to explicitly disable a @Test method. am: b8a440f538 -s ours am: b296948b3b -s ours am: 38dd9dec90
am: 26ca4d4d4b  -s ours

Change-Id: I39e12c63872d13d0b8581d7385ee4c971283da9a
2016-12-09 11:01:32 +00:00
Felipe Leme
b504546bb4 DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4. am: 00a6e6c111 -s ours am: 82393f7b98 -s ours am: 0866b93abf
am: 2418431e4a  -s ours

Change-Id: I9979e5411c032f500995efe7c83df31d40fda0f5
2016-12-09 11:00:02 +00:00
Jeremy Joslin
40af2d67f5 DO NOT MERGE: VPN network stat accounting changes. am: 8c7be6114c -s ours am: 12bb3f057b -s ours am: 652c3e59e9
am: 826d4ea141  -s ours

Change-Id: I356877d99b1304777d3d9103e9e0d421b1bb112b
2016-12-09 10:59:11 +00:00
Hugo Benichi
7cf79c1b99 DO NOT MERGE: ConnectivityThread: use lazy holder idiom am: 8f201294fe -s ours am: f6cb43ae32 -s ours am: fde28b4f2b
am: 8e2798c72d  -s ours

Change-Id: Iafa9ac6e49566a7165c2c586128c8e663e6a1b9a
2016-12-09 10:58:23 +00:00
Hugo Benichi
9614021975 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper am: 301b09738a -s ours am: 7337239702 -s ours am: 8358a5fbdf
am: 4a9ef15314  -s ours

Change-Id: I649b6bcd026ad86055fa6cbe59cb85e0141d22b8
2016-12-09 10:57:34 +00:00
Hugo Benichi
a093394482 DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler am: 56260ed9cb -s ours am: ef148edaa2 -s ours am: 7135d5e6f2
am: d886103e29  -s ours

Change-Id: I07908e3f1734503e58bbf62586dbfc3a6c1f887a
2016-12-09 10:56:27 +00:00
Jeremy Klein
f78d3f1804 DO NOT MERGE: Add a null check for the OnStartTetheringCallback. am: fb63d5a4ef -s ours am: 3cd1ae2261 -s ours am: aa7506310c
am: 14667351d8  -s ours

Change-Id: I9d5983d4f197d7cedb841081f48291288359988a
2016-12-09 10:53:51 +00:00
Felipe Leme
94a8f25fc6 DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock. am: 6670ab4480 -s ours am: fbbaf25665 -s ours
am: 2672fd0196

Change-Id: I4aa888c55824eba58b7e0af78b510a144608e704
2016-12-09 10:28:28 +00:00
Felipe Leme
26ca4d4d4b DO NOT MERGE: Use @Ignore to explicitly disable a @Test method. am: b8a440f538 -s ours am: b296948b3b -s ours
am: 38dd9dec90

Change-Id: Icaa4e18775b6e810738fb9d180ea20f7ce5c4506
2016-12-09 10:27:35 +00:00
Felipe Leme
2418431e4a DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4. am: 00a6e6c111 -s ours am: 82393f7b98 -s ours
am: 0866b93abf

Change-Id: I4acc3df60493e5ac388772f8c0e22ac92bc3ce4c
2016-12-09 10:26:08 +00:00
Jeremy Joslin
826d4ea141 DO NOT MERGE: VPN network stat accounting changes. am: 8c7be6114c -s ours am: 12bb3f057b -s ours
am: 652c3e59e9

Change-Id: Ie33371e7e4e47071aa9f74fef93ddf2cff2ec57a
2016-12-09 10:25:17 +00:00
Hugo Benichi
8e2798c72d DO NOT MERGE: ConnectivityThread: use lazy holder idiom am: 8f201294fe -s ours am: f6cb43ae32 -s ours
am: fde28b4f2b

Change-Id: I121ad24bed0fa12b80110b1058ad4279ec9c0107
2016-12-09 10:24:20 +00:00
Hugo Benichi
4a9ef15314 DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper am: 301b09738a -s ours am: 7337239702 -s ours
am: 8358a5fbdf

Change-Id: If52ab02bd501d4b071f24ddf8abdfe344e7358eb
2016-12-09 10:23:28 +00:00
Hugo Benichi
d886103e29 DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler am: 56260ed9cb -s ours am: ef148edaa2 -s ours
am: 7135d5e6f2

Change-Id: I7c177123057676622e1aa43c68676ee06ed60ee6
2016-12-09 10:22:25 +00:00
Jeremy Klein
14667351d8 DO NOT MERGE: Add a null check for the OnStartTetheringCallback. am: fb63d5a4ef -s ours am: 3cd1ae2261 -s ours
am: aa7506310c

Change-Id: I897f28d2b002e1a2aa6be8ec423a1c9b1d5b761b
2016-12-09 10:20:04 +00:00
Felipe Leme
2672fd0196 DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock. am: 6670ab4480 -s ours
am: fbbaf25665  -s ours

Change-Id: I66000b3cd40a8494ad144610436f6ee953821a06
2016-12-09 09:57:16 +00:00
Felipe Leme
38dd9dec90 DO NOT MERGE: Use @Ignore to explicitly disable a @Test method. am: b8a440f538 -s ours
am: b296948b3b  -s ours

Change-Id: I43b77614b0ccdd573cf8b29b08ef518bad617aff
2016-12-09 09:55:47 +00:00
Felipe Leme
0866b93abf DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4. am: 00a6e6c111 -s ours
am: 82393f7b98  -s ours

Change-Id: I175601094ae486700c8a6886470abb3147b6ef4e
2016-12-09 09:54:55 +00:00
Jeremy Joslin
652c3e59e9 DO NOT MERGE: VPN network stat accounting changes. am: 8c7be6114c -s ours
am: 12bb3f057b  -s ours

Change-Id: Id9d26bf1b9512a85cd9b6a3253b86b77a6f62e77
2016-12-09 09:54:07 +00:00
Hugo Benichi
fde28b4f2b DO NOT MERGE: ConnectivityThread: use lazy holder idiom am: 8f201294fe -s ours
am: f6cb43ae32  -s ours

Change-Id: I08a03dd249d30bc474a5d16472883737d12fec37
2016-12-09 09:53:16 +00:00
Hugo Benichi
8358a5fbdf DO NOT MERGE: ConnectivityManager: use ConnectivityThread looper am: 301b09738a -s ours
am: 7337239702  -s ours

Change-Id: Ida0d76b540e800db215569717a1c5d26e0f583b0
2016-12-09 09:52:26 +00:00
Hugo Benichi
7135d5e6f2 DO NOT MERGE: ConnectivityManager: a simpler CallbackHandler am: 56260ed9cb -s ours
am: ef148edaa2  -s ours

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

Change-Id: I3c471a8971c21cdbf1ebf7e1302524b038b20375
2016-12-09 09:48:50 +00:00
Felipe Leme
6670ab4480 DO NOT MERGE: Refactored NetworkStatsServiceTest to use Mockito instead of EasyMock.
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.net.NetworkStatsServiceTest" -w "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"

BUG: 30943463

(cherry picked from commit de2a6f1b1d)

Change-Id: Ia9929295ab2396a7ebb133e65d157f98414e4dfa
2016-12-09 13:59:14 +09:00
Felipe Leme
b8a440f538 DO NOT MERGE: Use @Ignore to explicitly disable a @Test method.
BUG: 30839080
BUG: 31007021

(cherry picked from commit a4dc2a7129)

Change-Id: I35942e60493adebb22871541a34240368c691ee7
2016-12-09 13:59:10 +09:00
Felipe Leme
00a6e6c111 DO NOT MERGE: Fixed NetworkStatsServiceTest and converted it to JUnit4.
Most tests were failing because due to a null NetworkCapabilities.
Example:

1) testNetworkStatsWifi(com.android.server.net.NetworkStatsServiceTest)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkCapabilities.hasCapability(int)' on a null object reference
	at
	com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:983)

BUG: 30839080

(cherry picked from commit f96df4b298)

Change-Id: Ie09b2f43cf6ec745e404d5ec98bd0b072d211ea3
2016-12-09 13:59:04 +09:00
Jeremy Joslin
8c7be6114c DO NOT MERGE: 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

(cherry picked from commit 13dd0e99ba)

Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
2016-12-09 13:42:29 +09:00
Hugo Benichi
8f201294fe 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 3ab84b087a)

Change-Id: If13b363889a8e9396273a90c3d9f9421a48aecbc
2016-12-09 13:42:26 +09:00
Hugo Benichi
301b09738a 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 3b41f05d68)

Change-Id: If956addbf8e7b11b36a4b966de7fca00e8f362c1
2016-12-09 13:42:24 +09:00
Hugo Benichi
56260ed9cb 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 0b42baf68a)

Change-Id: I1b5fe2a361b5f623a8310ae698497c83d72f3034
2016-12-09 13:42:20 +09:00
Jeremy Klein
fb63d5a4ef 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 35e99ea8ef)

Change-Id: Ia419ff68ef10f308f9e44be47420e27099ee6070
2016-12-09 13:42:02 +09:00
Hugo Benichi
048c50c491 Merge changes from topic 'framework-net-aosp' am: 6b0570513e am: 5910f412bd am: 72f8bb8b7f
am: 03f5610b19

Change-Id: Ia03edd1d0a972dfc546a32fcf06784a00d6ab8cd
2016-12-09 04:17:08 +00:00
Hugo Benichi
3d108c9f1b DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents am: 6d442d82d0 -s ours am: 6765bc08d0 -s ours am: c19960bf85
am: c32fc5fdb2  -s ours

Change-Id: Ia453e3c806be8f58ff96e4b760de1c6a41cc8757
2016-12-09 04:16:09 +00:00
Hugo Benichi
6a359dc5c0 DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings am: 834405cbe4 -s ours am: f3b4c26453 -s ours am: 7e64d17a53
am: fae429c07f  -s ours

Change-Id: Ic511ed8370c3a388bdc77f064cbe25bc434d927d
2016-12-09 04:14:15 +00:00
Hugo Benichi
b39d49a517 DO NOT MERGE: IpConnectivity metrics: add version number am: 8ce412614a -s ours am: 0e67ef7d3f -s ours am: 6a77e74a49
am: f5d42f527f  -s ours

Change-Id: I859f9b7ebdf93c06841a631e616a88270a8aebae
2016-12-09 04:10:50 +00:00
Hugo Benichi
03f5610b19 Merge changes from topic 'framework-net-aosp' am: 6b0570513e am: 5910f412bd
am: 72f8bb8b7f

Change-Id: I8cd4afc5e1381f5b69e4b6dd598c9fee76dc785e
2016-12-09 04:02:17 +00:00
Hugo Benichi
c32fc5fdb2 DO NOT MERGE: IpConnectivityMetrics: rate limit ApfProgramEvents am: 6d442d82d0 -s ours am: 6765bc08d0 -s ours
am: c19960bf85

Change-Id: Ia32470ecf8c0dd918994f9d0bccb20248c3b02d1
2016-12-09 04:01:20 +00:00
Hugo Benichi
fae429c07f DO NOT MERGE: IpConnectivityMetrics reads buffer size in settings am: 834405cbe4 -s ours am: f3b4c26453 -s ours
am: 7e64d17a53

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

Change-Id: I5b970302c258569638890a49b3455e43614ec63a
2016-12-09 03:56:29 +00:00
Hugo Benichi
72f8bb8b7f Merge changes from topic 'framework-net-aosp' am: 6b0570513e
am: 5910f412bd

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

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

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

Change-Id: I05ffe76ca4f266bd341fc298cbc03da62991e4bb
2016-12-09 03:41:57 +00:00
Treehugger Robot
6b0570513e 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
6d442d82d0 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 e3f7299ce2)

Change-Id: Idb640dec13ba64180985544b9709a586af66eb6e
2016-12-09 11:21:31 +09:00
Hugo Benichi
834405cbe4 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 6d8c1dfe4b)

Change-Id: Iefbeac3a688b260fb3f92dfe0bfd9db28e26749d
2016-12-09 11:21:26 +09:00
Hugo Benichi
8ce412614a 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 f04b01f0a0)

Change-Id: If8f167c0dc4c1abe0e235e2adfd131168a4ddc52
2016-12-09 11:21:11 +09:00
Etan Cohen
b2410a4a90 DO NOT MERGE: [CS] Remove timeout event after first available am: 3fb372fe9f -s ours am: a8b73b23d6 -s ours am: 98c799e134
am: 98b4132580  -s ours

Change-Id: I1919ee28071c2281896a2f7fbb3d6aadf4f47cae
2016-12-08 17:53:04 +00:00
Lorenzo Colitti
0cceef0e00 DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net. am: cf8c8d55f8 -s ours am: d1e22a3f07 -s ours am: 60584ca47e
am: 449590b993  -s ours

Change-Id: I3613a50627a6722e3c337caaa2880d96f1b39beb
2016-12-08 17:49:56 +00:00