381 Commits

Author SHA1 Message Date
Hugo Benichi
287f1ca31d Merge "Fix NetworkStatsObserversTest" am: 0dc35fa969 am: 25282c3e38 am: 814351c843
am: ef55f6c6cf

Change-Id: Ib63c7411e28e48201217c4a164c41d4d3223ca51
2017-05-23 14:27:13 +00:00
Hugo Benichi
ef55f6c6cf Merge "Fix NetworkStatsObserversTest" am: 0dc35fa969 am: 25282c3e38
am: 814351c843

Change-Id: Ice4bb8de4267cba7a15a60838e165fab5ebade72
2017-05-23 14:18:30 +00:00
Hugo Benichi
25282c3e38 Merge "Fix NetworkStatsObserversTest"
am: 0dc35fa969

Change-Id: I9b4e83b4e437089ea500d82990e59558ff55e02a
2017-05-23 11:37:37 +00:00
Hugo Benichi
415731ddb4 Merge "Fix NetworkStatsAccessTest" am: ec1f25a4ba am: cdb75d321b am: 85afabc4ec
am: e6f44606ef

Change-Id: I838ae489f7d7a287291a1fc14d9e2f816cc29d14
2017-05-23 07:09:25 +00:00
Hugo Benichi
e6f44606ef Merge "Fix NetworkStatsAccessTest" am: ec1f25a4ba am: cdb75d321b
am: 85afabc4ec

Change-Id: I60f9d8867655a6aa24ee192c772d4c26a96c9bcd
2017-05-23 07:02:54 +00:00
Hugo Benichi
cdb75d321b Merge "Fix NetworkStatsAccessTest"
am: ec1f25a4ba

Change-Id: If949493d9967fa723667947979262bf4f90841c2
2017-05-23 06:51:15 +00:00
Hugo Benichi
835a61c846 Merge "NsdService: test coverage for client requests." 2017-05-23 05:54:07 +00:00
Hugo Benichi
1812cf35f7 Merge "ConnectivityServiceTest: fix flakyness" am: a82cac1452 am: 004f36d5bc am: eb9d0f16aa
am: 4076528b69

Change-Id: I4225fabd1b9af92a7c688e2cfbab3b20e58c53dd
2017-05-23 05:03:12 +00:00
Hugo Benichi
4076528b69 Merge "ConnectivityServiceTest: fix flakyness" am: a82cac1452 am: 004f36d5bc
am: eb9d0f16aa

Change-Id: Ic792060aafb5aa8b485054be18c3dba82bb15a3b
2017-05-23 04:56:41 +00:00
Hugo Benichi
004f36d5bc Merge "ConnectivityServiceTest: fix flakyness"
am: a82cac1452

Change-Id: I241192b2d9565c41f47bbe6227b50049898da679
2017-05-23 04:42:40 +00:00
Hugo Benichi
6bb59fc82d NsdService: test coverage for client requests.
Adding coverage for:
  - NsdManager client disconnection
  - in-flight request GC

Test: new test passes
Bug: 37013369, 33298084
Bug: 38503832

(cherry picked from commit ab5bdbf84e89d48ad9daa015cae436a9d27cfdd3)

Change-Id: I02aca772d88306acae09db739ced7a2b1119b72b
2017-05-23 12:53:55 +09:00
Hugo Benichi
1cebba7173 Fix NetworkStatsObserversTest
This patch fixes several spurious unit tests in
NetworkStatsObserversTest by using the updated waitForIdleHandler of
ConnectivityServiceTest. More specifically this fixes the following
tests:
  - testUnregister_knownRequest_releasesCaller
  - testUpdateStats_deviceAccess_notifies
  - testUpdateStats_userAccess_usageSameUser_notifies
  - testUpdateStats_defaultAccess_notifiesSameUid

This patch also removes the dummy message with type -1 sent at the end
of tests in NetworkStatsObserversTest and the associated assert, because
nothing is exercised or asserted immediately after.

This patch also updates NetworkStatsObserversTest to not depend on the
deprecated junit.framework.TestCase.

Bug: 32561414
Test: runtest -x frameworks/base/tests/../NetworkStatsObserversTest.java
Change-Id: I4fc909ee9bacc964c859fa7a3db34f9dc86b89cf
2017-05-23 10:18:41 +09:00
Hugo Benichi
b6f77c87c7 Fix NetworkStatsAccessTest
This patch fixes NetworkStatsAccessTest by taking into account
DEVICESUMMARY which was added in commit
3a8b343ce5220086c4f71e63f5d42f2d28434c4b.

Doing $ git revert 3a8b343ce5220086c4f71e63f5d42f2d28434c4b shows that
the existing assertions of NetworkStatsAccessTest passed before that
commit.

This patch also changes NetworkStatsAccessTest to use up-to-date testing
style and not depend on the deprecated junit.framework.TestCase.

Bug: 32561414
Test: runtest -x frameworks/base/../NetworkStatsAccessTest.java
Change-Id: Ib78f137578cf35e1c766b377b7f812a09173c49e
2017-05-23 10:18:41 +09:00
Hugo Benichi
bb91c57ec5 ConnectivityServiceTest: fix flakyness
This patch attempts to fix the remaining spurious failures in
ConnectivityServiceTest, which have two causes:
 - waitForIdle() does not take into account the NetworkAgents handlers.
 - the deadlines in testRequestBenchmark are sometimes exceeded.

To fix the first issue, waitForIdle() is moved to a test level instance
method and also calls waitForIdleHandler on any non null
MockNetworkAgent. This is expected to fix spurious errors for the
following tests:
  - testMobildeDataAlwaysOn
  - testLingering
  - testPacketKeepAlive
  - testMMSonWiFi

To fix the second issue, the deadlines for testRequestBenchmark are
extended by 10ms. Also, the failure message is made more actionable by
providing the total time it took for the operation, instead of printing
the number of dispatches that were achieved before the deadline.

Bug: 32561414
Test: tests pass many times in a row (~500).
Change-Id: Id33c6ac1edfb0b89634fa7789dccb2da237e2709
2017-05-23 10:18:41 +09:00
Lorenzo Colitti
98adb6db58 Merge "Add test coverage for explicitlySelected networks." am: 1bc1936ae9 am: 3d55c5539c am: b7535c86a0
am: 00af3be22f

Change-Id: Ie104d3b939e99f67dd3267e16f6c27c403162453
2017-05-19 02:43:31 +00:00
Hugo Benichi
f238a96172 Merge "Add a method to start the captive portal login app."
am: 30f2544f0c

Change-Id: I7bc42e7f9cbc3635684257b920ea4a1ba7b55740
2017-05-19 02:39:29 +00:00
Lorenzo Colitti
00af3be22f Merge "Add test coverage for explicitlySelected networks." am: 1bc1936ae9 am: 3d55c5539c
am: b7535c86a0

Change-Id: I4caf9f55edeb51365293558db9d7d028b61c501c
2017-05-19 02:34:58 +00:00
Hugo Benichi
30f2544f0c Merge "Add a method to start the captive portal login app." 2017-05-19 02:29:21 +00:00
Lorenzo Colitti
3d55c5539c Merge "Add test coverage for explicitlySelected networks."
am: 1bc1936ae9

Change-Id: I42ce887005325eee9fb1a60762cee375cff176a6
2017-05-19 02:15:53 +00:00
Lorenzo Colitti
1bc1936ae9 Merge "Add test coverage for explicitlySelected networks." 2017-05-19 02:05:55 +00:00
Lorenzo Colitti
2965d33afc Add a method to start the captive portal login app.
Bug: 36203355
Bug: 36656914
Test: ConnectivityServiceTest (including new test) passes
Change-Id: Ide82858af67024623560ab79beea27c201b63447
Merged-In: I82a9a9a8da47870ba3f1bbef5941b37e970c844f

(cherry picked from commit 4734cdbbc38752765376aedb0d5208463674535e)
2017-05-19 00:58:41 +00:00
Erik Kline
7e94574ef0 Merge "Expand logging capabilities of Tethering subsystem" am: 0373340b07 am: 96f9371a66 am: 945ff184c2
am: 308ed7f467

Change-Id: I2644f518304a03da469fb9c2aa01a6d8f1a97901
2017-05-18 04:04:57 +00:00
Erik Kline
308ed7f467 Merge "Expand logging capabilities of Tethering subsystem" am: 0373340b07 am: 96f9371a66
am: 945ff184c2

Change-Id: Ia9d15f0dcc49ce070f8684eb8c8481310859faa5
2017-05-18 03:54:30 +00:00
Erik Kline
96f9371a66 Merge "Expand logging capabilities of Tethering subsystem"
am: 0373340b07

Change-Id: I1381b8457781dcfafe52371a5dc7628282cb8efc
2017-05-18 03:38:43 +00:00
Hugo Benichi
13f0d10115 Merge "Fix NetworkNotificationManagerTest"
am: c13a80deee

Change-Id: I8f02be13da5790d0fd60f04886e87de04c96de08
2017-05-18 03:29:50 +00:00
Treehugger Robot
0373340b07 Merge "Expand logging capabilities of Tethering subsystem" 2017-05-18 03:25:30 +00:00
Hugo Benichi
9fdc903af7 Merge "Move NetworkNotificationManagerTest to tests/net"
am: c01fbf0f0c

Change-Id: I10ce85211ac0305e8d05ca02b58b819297f59bbf
2017-05-18 02:23:12 +00:00
Hugo Benichi
e6181b0c47 Fix NetworkNotificationManagerTest
The testNotificationsShownAndCleared test was not doing anything
because the list of notification to show was always empty.

This patch fixes this issue and actually makes the test loop on
non-empty collections, and also fixes another ordering issue in
assertions themselves, hidden until now by the first issue.

Bug: 32561414
Test: runtest -x frameworks/base/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java
Merged-In: I4837b1175d7c9133e9156e33acaa1e7e3341cc62
Change-Id: Ia30587bd68a87b83b62f57eeeb28fef7d95dbf81

(cherry picked from commit f8b804be5aeb5d0a36ff88649d7c5ecdc47c3ad1)
2017-05-18 11:08:31 +09:00
Hugo Benichi
c01fbf0f0c Merge "Move NetworkNotificationManagerTest to tests/net" 2017-05-18 02:01:40 +00:00
Hugo Benichi
6437443d36 Merge "Finish moving NetworkStats tests to tests/net" am: 1ae1b6b960 am: cd821b231a am: 544bcbe78e
am: c3367ebcf7

Change-Id: I663f5ae4f1e15bd39e8ed927ac71958818452967
2017-05-18 00:57:00 +00:00
Hugo Benichi
c3367ebcf7 Merge "Finish moving NetworkStats tests to tests/net" am: 1ae1b6b960 am: cd821b231a
am: 544bcbe78e

Change-Id: I5d9a01a5804a7cc6289253db09078ede00fc0dc5
2017-05-18 00:48:14 +00:00
Erik Kline
7747fd4ce0 Expand logging capabilities of Tethering subsystem
Introduce a SharedLog that can be shared among all Tethering
components.  All log entries go to the same log, and each includes
its subsystem name.  Additionally, all entries emitted to the
system log shared the same tag, so can easily be watched.

More subsystems can inherit a SharedLog, but to minimize cherry-pick
conflicts we limit ourselves to these changes only.

Test: as follows
    - built
    - flashed
    - booted
    - log output observed via dumpsys
    - runtest frameworks-net passes
Bug: 32163131
Bug: 36988090
Bug: 38218697
Change-Id: I1229d4c55987402d84b0d4a2c8a595e0c829aa3e
2017-05-18 09:46:45 +09:00
Hugo Benichi
cd821b231a Merge "Finish moving NetworkStats tests to tests/net"
am: 1ae1b6b960

Change-Id: If85e483d5b44872c10e42ef55ddaf209601c7cfa
2017-05-18 00:27:06 +00:00
Hugo Benichi
1ae1b6b960 Merge "Finish moving NetworkStats tests to tests/net" 2017-05-18 00:09:54 +00:00
Lorenzo Colitti
02cc839411 Add test coverage for explicitlySelected networks.
Also, make all tests start with mobile data always on disabled.

This is because some tests only pass when mobile data always on
is disabled. This doesn't cause any problems when running all
the tests in the file, because these tests are always run after
one or more calls to tearDown, which disables mobile data always
on. However, it does cause issues when those tests are run alone.

Test: new test passes 50 times in a row
Test: ConnectivityServiceTest passes
Change-Id: I1eef5d7f5ec5464e0f9a1d7f1130d9ba6dea4557
2017-05-18 00:46:14 +09:00
Hugo Benichi
d8ddab6ba5 Move NetworkNotificationManagerTest to tests/net
Bug: 32561414
Test: no functional change
Change-Id: Iad17e3336a4a589da5cf88fd6359323e34b747e1
2017-05-17 22:24:05 +09:00
Hugo Benichi
e7e10303f3 Finish moving NetworkStats tests to tests/net
Follow-up of commit c86013be936f36c61fa0cdfad95141f6de3c6ef7.

Also add @SmallTest annotation to classes moved to tests/net.

Test: no functional change
Bug: 32561414
Change-Id: I0a0e8865d37ba7bae06ce352d3fc385989adc300
2017-05-17 22:24:05 +09:00
Erik Kline
f421d60824 Merge "Add tethering offload HAL call via JNI"
am: 8f65e470b0

Change-Id: Ib8403f685371b44f0fdad6d15ae372787d457d13
2017-05-17 07:18:51 +00:00
Erik Kline
5a7c8a0b24 Add tethering offload HAL call via JNI
Additionally, try to locate java Control interface.

Test: as follows
    - built
    - flashed
    - booted
    - OffloadController log messages observed, but only ever
      "not enabled" messages (needs a supporting implementation)
Bug: 29337859
Bug: 32163131
Bug: 34361337
Merged-In: I5251d05f2d2fd732a33a8955a6c346b3a2401e46
Change-Id: I5251d05f2d2fd732a33a8955a6c346b3a2401e46
(cherry picked from commit 58ed1b051bdffd239d92919170a0bb41a4cc197c)
2017-05-17 13:44:25 +09:00
Erik Kline
47222fc935 Add tethering offload HAL call via JNI
Additionally, try to locate java Control interface.

Test: as follows
    - built
    - flashed
    - booted
    - OffloadController log messages observed, but only ever
      "not enabled" messages (needs a supporting implementation)
Bug: 29337859
Bug: 32163131
Bug: 34361337
Merged-In: I5251d05f2d2fd732a33a8955a6c346b3a2401e46
Change-Id: I5251d05f2d2fd732a33a8955a6c346b3a2401e46
(cherry picked from commit 58ed1b051bdffd239d92919170a0bb41a4cc197c)
2017-05-17 13:41:30 +09:00
Erik Kline
58ed1b051b Add tethering offload HAL call via JNI
Additionally, try to locate java Control interface.

Test: as follows
    - built
    - flashed
    - booted
    - OffloadController log messages observed, but only ever
      "not enabled" messages (needs a supporting implementation)
Bug: 29337859
Bug: 32163131
Bug: 34361337
Change-Id: I5251d05f2d2fd732a33a8955a6c346b3a2401e46
2017-05-17 11:31:45 +09:00
Erik Kline
7f75a7fc6d Merge "Fix broken DUN evaluation logic" am: b0daeeb879 am: dd76dd1eea am: 5d1bcf5bca
am: 260fa1dd9e

Change-Id: I293b4cd57dcd1968c2b38f4e92e24cc0d2e135a9
2017-05-16 08:25:47 +00:00
Erik Kline
260fa1dd9e Merge "Fix broken DUN evaluation logic" am: b0daeeb879 am: dd76dd1eea
am: 5d1bcf5bca

Change-Id: Ib9a469b16a598c47b615a15fc7cce420bfe4b8b7
2017-05-16 08:19:22 +00:00
Erik Kline
dd76dd1eea Merge "Fix broken DUN evaluation logic"
am: b0daeeb879

Change-Id: Iae7450ef21485c5a13f45fab570bf658b2da8f28
2017-05-16 08:06:42 +00:00
Erik Kline
54f2f3704e Fix broken DUN evaluation logic
Test: as follows
    - built
    - booted
    - flashed
    - runtest frameworks-net passes
Bug: 32163131
Bug: 38152109
Bug: 38186915
Change-Id: Id4803504e825290d62c0b51a2b9bd664dcef30b1
2017-05-16 15:14:45 +09:00
Hugo Benichi
36af98c6ba Merge "Merge changes Ie762ce75,I611fd791 am: 21a57f263f am: cc9f695ba0 am: 164854bde2" into oc-dev-plus-aosp
am: b09b85471c

Change-Id: I8b1b20d81efa2d86345b3b15600bed4cd40bb6e8
2017-05-11 14:52:23 +00:00
Hugo Benichi
3ec835303c Merge changes Ie762ce75,I611fd791 am: 21a57f263f am: cc9f695ba0
am: 164854bde2

Change-Id: I1495249f1ced84438dbd5dd0ad6678e2ee4062cb
2017-05-11 14:28:23 +00:00
Hugo Benichi
cc9f695ba0 Merge changes Ie762ce75,I611fd791
am: 21a57f263f

Change-Id: Ibb291720f6c257a8ead2c039f584f4b3ecc69be5
2017-05-11 12:43:42 +00:00
Hugo Benichi
6e039a13cc ConnectivityManager: unit test for argument validation
Bug: 36701874, 37107940
Test: new test passes
Change-Id: Ie762ce758b3d94052b7438a67fc55bef4690cbbb
2017-05-11 14:15:20 +09:00
Hugo Benichi
cb88323dd2 ConnectivityManager: uses service error codes and exceptions
This patch introduces between ConnectivityManager and
ConnectivityService a mechanism for propagating back to clients
informative errors in the form of error codes and associated custom
runtime exceptions.

Without error code, the service can only throw a limited number of
different exceptions over Binder. Furthermore the throw site stack
traces are always loss. Although for individual instances of a throw,
the error message can be inspected, aggregations of stack traces from
app crashes sanitize error messages and only leaves the stack traces.

This makes debugging dificult for some service calls such as
requestNetwork that can have a variety of failure modes.

In this patch only one failure mode is codified. More can be added later
at a light cost by: 1) defining an error code, 2) defining an
associated exception, 3) mapping the code to the exception. This patch
can serves as a template for doing so.

Test: $ runtest frameworks-net,
      #testNetworkRequestMaximum() detects the new exception type.
Bug:  36556809, 36701874
Change-Id: I611fd7915575c9e418f7149fcdc8a879d2a3716d
2017-05-11 14:15:15 +09:00