Commit Graph

7376 Commits

Author SHA1 Message Date
Chalard Jean
9ce1e28788 Refactor TestNetworkCallback out of ConnectivityServiceTest.
TestableNetworkCallback will become a standard tool. This patch
and its companion in packages/modules/NetworkStack mostly move
it out of ConnectivityServiceTest, but also applies a few
cleanups like reordering arguments for standard order, renaming
...Like to ...That to match Mockito namings, and introduces
stonger static typing on some callbacks, which allows to remove
some unchecked casts.

Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I808a95ac33ec0c81a8829cad36a6917524297574
2019-07-04 16:12:40 +09:00
Paul Hu
9126f84578 Merge "Correct FrameworksNetTests-jni-defaults lib" am: fa71b4f4a0 am: 8bb71707e0
am: fb7a5f06b7

Change-Id: Iadd6609db0ff4f86194a9ee323cd2facaace9fa9
2019-07-02 16:20:50 -07:00
Paul Hu
8bb71707e0 Merge "Correct FrameworksNetTests-jni-defaults lib"
am: fa71b4f4a0

Change-Id: I53ca8c198b9d4bb0e743ee5010469a7375dc3cc4
2019-07-02 10:23:03 -07:00
paulhu
a1dbf5b964 Correct FrameworksNetTests-jni-defaults lib
FrameworksNetTests-jni-defaults lib should only contain jni
dependencies. Remove static_libs/libs from it and update
FrameworksNetTests/FrameworksNetSmokeTests libs as well.

Bug: NA
Test: atest FrameworksNetSmokeTests FrameworksNetTests
Change-Id: I705e949e4c00035c9734b6a240529d1c2216eb6b
2019-07-01 09:29:13 +00:00
Lorenzo Colitti
5ec2bdf97c Merge "Unit tests for new explicitlySelected behaviour." am: d1379a4a80 am: 10c1a704c0
am: c3bb7285f4

Change-Id: I3b7588360b9e302a6032ae6242d937f4e68eb88d
2019-06-29 02:16:43 -07:00
Lorenzo Colitti
c3bb7285f4 Merge "Unit tests for new explicitlySelected behaviour." am: d1379a4a80
am: 10c1a704c0

Change-Id: Id77a5d6a58e7ab4fdaa0b7c15b824270863b83fd
2019-06-29 02:01:55 -07:00
Chalard Jean
bee0aa1c32 Merge "Simplify Exception expressions in CSTest" am: 763d449493 am: cb5aa75dd9
am: 111dc6853a

Change-Id: I91ffbbb031d9ff6f36c51bc567ac6ce22386d07c
2019-06-28 09:06:33 -07:00
Chalard Jean
111dc6853a Merge "Simplify Exception expressions in CSTest" am: 763d449493
am: cb5aa75dd9

Change-Id: Iae16e8d68e2b1b9a1e5aa86170177c68b22cd7b5
2019-06-28 08:57:18 -07:00
Lorenzo Colitti
f255e047b7 Unit tests for new explicitlySelected behaviour.
ag/7905088 added the ability to pass in acceptUnvalidated without
passing in explicitlySelected. Add unit tests for that code.

While I'm at it, convert a couple of "== 1"s to toBool(), and
update the comments in NetworkAgent.

Bug: 130766237
Test: atest FrameworksNetTests
Change-Id: I6b550bd621e3596975f83464c7b4b8a14269120b
2019-06-28 23:57:22 +09:00
Chalard Jean
763d449493 Merge "Simplify Exception expressions in CSTest" 2019-06-28 07:19:20 +00:00
Chalard Jean
484c4219d9 Simplify Exception expressions in CSTest
Test: CSTest
Change-Id: Ie9b9fc334b85836bf156bda71e54e8d30885b82a
2019-06-28 14:22:30 +09:00
Lorenzo Colitti
d4ed795ad3 Merge "Remove all static members from NetworkStatsFactory." am: 63f94f411b am: 5409264cee
am: 21ea4bcc96

Change-Id: I7f787d14b7c7dee7a77dbed84266f8192c21c446
2019-06-27 19:56:01 -07:00
Lorenzo Colitti
21ea4bcc96 Merge "Remove all static members from NetworkStatsFactory." am: 63f94f411b
am: 5409264cee

Change-Id: Iada14a1fea74197014e75a1112c7a5b35d6b1a1d
2019-06-27 19:40:01 -07:00
Chalard Jean
e6ab740f9e Merge "Revert "Simplify Exception expressions in CSTest"" am: 0fd0e96a40 am: 60422b8e88
am: e2eb03b140

Change-Id: If0a6e45f1aee111de0f0f9eee8ed310c2ef47225
2019-06-27 10:04:04 -07:00
Lorenzo Colitti
56a50e0bb5 Merge "Transfer ownership of NetworkStatsFactory to NetworkStatsService." am: c657dd301f am: 92292f556b
am: fbac9eefb8

Change-Id: Ibe2fcacb3779b3c6bc484fe6f398475bf5b6383b
2019-06-27 09:26:02 -07:00
Chalard Jean
29e549bf23 Merge "Simplify Exception expressions in CSTest" am: afbf997ad5 am: 8e3bf0f8e3
am: c421078227

Change-Id: Id2bf1ddd6785057292678a1a915a3bf35a7515f7
2019-06-27 09:23:14 -07:00
Chalard Jean
b78f61ed35 Merge "Unify assertThrows" am: 0272942bca am: 3f21f94616
am: 546cdc06f8

Change-Id: I47dd5930dcf10edd22a4964f2fcc979ad901d723
2019-06-27 09:22:21 -07:00
Chalard Jean
e2eb03b140 Merge "Revert "Simplify Exception expressions in CSTest"" am: 0fd0e96a40
am: 60422b8e88

Change-Id: I80d94fa746d533a83e3ce01377dabd2aab0c3229
2019-06-27 02:53:23 -07:00
Lorenzo Colitti
c75633460e Remove all static members from NetworkStatsFactory.
NetworkStatsFactory is owned by NetworkStatsService, and any
accesses to NSF data should go through NSS.

Test: atest FrameworksNetTests
Change-Id: Idbd0dbbaeb11313f63474e7ec0e01f974349fc89
2019-06-27 17:39:05 +09:00
Lorenzo Colitti
fbac9eefb8 Merge "Transfer ownership of NetworkStatsFactory to NetworkStatsService." am: c657dd301f
am: 92292f556b

Change-Id: If897c9c95fc8571949183c45a99a5c28cb032ebb
2019-06-27 01:31:46 -07:00
Chalard Jean
0fd0e96a40 Merge "Revert "Simplify Exception expressions in CSTest"" 2019-06-27 08:30:57 +00:00
Chalard Jean
de6bb3e852 Revert "Simplify Exception expressions in CSTest"
This reverts commit d209586554.

Reason for revert: Breaks the build because it removes an unused method that was used by a change intervening in the mean time

Bug: 136143444
Change-Id: Id3a17e0b16ec03276609ca96fb7b582188ed1077
2019-06-27 08:30:05 +00:00
Chalard Jean
c421078227 Merge "Simplify Exception expressions in CSTest" am: afbf997ad5
am: 8e3bf0f8e3

Change-Id: I32182775bf36918438868c5b77d8d1aa995c788a
2019-06-27 01:11:02 -07:00
Chalard Jean
546cdc06f8 Merge "Unify assertThrows" am: 0272942bca
am: 3f21f94616

Change-Id: If349f647b34a71bc4eb1ba25ca18d543437eb969
2019-06-27 01:05:16 -07:00
Lorenzo Colitti
c657dd301f Merge "Transfer ownership of NetworkStatsFactory to NetworkStatsService." 2019-06-27 07:53:30 +00:00
Chalard Jean
afbf997ad5 Merge "Simplify Exception expressions in CSTest" 2019-06-27 07:09:36 +00:00
Chalard Jean
0272942bca Merge "Unify assertThrows" 2019-06-27 07:08:59 +00:00
Lorenzo Colitti
f5af7fcf16 Transfer ownership of NetworkStatsFactory to NetworkStatsService.
NetworkStatsService is the only consumer of the data coming from
NetworkStatsFactory, but the factory itself is instantiated and
owned by NetworkManagementService.

Move it into NetworkStatsService instead.

Test: atest FrameworksNetTests
Change-Id: I52df1e545c646927952579da22845a12d1d7563b
2019-06-26 19:29:51 +09:00
Remi NGUYEN VAN
e820c3bd36 [automerger skipped] Merge "Only show "Connected" note after opening portal" into qt-dev am: 09a8de5530 -s ours
am: 203bde59b4 -s ours
am skip reason: change_id I99be7d312d020d242081971c7e522023bbbab072 with SHA1 844ea18005 is in history

Change-Id: I8ec96985154e8fedc64f6f9233930f2d1a9ee581
2019-06-26 01:15:05 -07:00
Remi NGUYEN VAN
f611aeefd4 [automerger skipped] Merge "Only show "Connected" note after opening portal" into qt-dev am: 09a8de5530
am: ce3b7eadad -s ours
am skip reason: change_id I99be7d312d020d242081971c7e522023bbbab072 with SHA1 844ea18005 is in history

Change-Id: I087da26c8b643e8dad055955388c1b032a73f558
2019-06-26 01:07:44 -07:00
Remi NGUYEN VAN
ce3b7eadad Merge "Only show "Connected" note after opening portal" into qt-dev
am: 09a8de5530

Change-Id: I0113a80675f93cb95b3dccaba9777bfc31715130
2019-06-26 00:59:48 -07:00
Remi NGUYEN VAN
203bde59b4 [automerger skipped] Merge "Only show "Connected" note after opening portal" into qt-dev
am: 09a8de5530 -s ours
am skip reason: change_id I99be7d312d020d242081971c7e522023bbbab072 with SHA1 844ea18005 is in history

Change-Id: I50b62b92261b7386d7a15ab0e876661e8c4b0bac
2019-06-26 00:59:40 -07:00
Remi NGUYEN VAN
13a87dccd1 Only show "Connected" note after opening portal
The "Connected" notification would be shown every time a network
validates after being identified as a captive portal. This causes issues
on networks that have auto-login mechanisms, as a high priority
notification would be shown even though the user was not interacting
with the phone.

The "Connected" notification is intended to confirm to the user that
they successfuly logged in (manually), so only show it after the user
opens the portal on the network.

Bug: 134124044
Test: Flashed, connected to portal: notification shown
      Opened portal from command line + revalidate: no notification
      Tests passing with change, failing without
Merged-In: I99be7d312d020d242081971c7e522023bbbab072
Merged-In: I7dc1b3a313b255fe89313efb9117bb160efdb533
(cherry picked from commit 0b5a4d862190320d285413b1feb921144fee8420)

Change-Id: I67c124cc34f09c2f186706b5cec839f60d00a90a
2019-06-26 01:55:51 +00:00
Remi NGUYEN VAN
2d705bf92b Merge "Only show "Connected" note after opening portal" am: 5c28780629 am: bad4d1c6e9
am: 844ea18005

Change-Id: I2eaa815beba4240a8258202fc5fcaac1547cd1bc
2019-06-25 09:58:44 -07:00
Remi NGUYEN VAN
844ea18005 Merge "Only show "Connected" note after opening portal" am: 5c28780629
am: bad4d1c6e9

Change-Id: I99be7d312d020d242081971c7e522023bbbab072
2019-06-25 09:40:54 -07:00
Remi NGUYEN VAN
5c28780629 Merge "Only show "Connected" note after opening portal" 2019-06-25 15:20:33 +00:00
Chalard Jean
d209586554 Simplify Exception expressions in CSTest
Test: CSTest
Change-Id: I2c7d9e3092497526ab7d87b40a508f2d4bc3d7a2
2019-06-25 20:40:41 +09:00
Chalard Jean
045d5fca24 Unify assertThrows
Test: atest FrameworksTestsNet NetworkStackTests
Change-Id: Ib6d5d2577a5b95f90857d8d146b00af516e9944d
2019-06-25 20:40:39 +09:00
Remi NGUYEN VAN
705b46b900 Only show "Connected" note after opening portal
The "Connected" notification would be shown every time a network
validates after being identified as a captive portal. This causes issues
on networks that have auto-login mechanisms, as a high priority
notification would be shown even though the user was not interacting
with the phone.

The "Connected" notification is intended to confirm to the user that
they successfuly logged in (manually), so only show it after the user
opens the portal on the network.

Bug: 134124044
Test: Flashed, connected to portal: notification shown
      Opened portal from command line + revalidate: no notification
      Tests passing with change, failing without

Change-Id: I89e7a7f49019bd7e4686712c56e00bd786eb3ef3
2019-06-25 19:18:16 +09:00
Lorenzo Colitti
dbd530777c Merge "NetworkStats: Fix race condition causing system server crashes" am: f7d14dba58 am: f37da9a879
am: ff811eea7e

Change-Id: Ieb9f17b6e3eed82c450a5b90dd67a00e4ede8b3f
2019-06-25 02:21:15 -07:00
Lorenzo Colitti
ff811eea7e Merge "NetworkStats: Fix race condition causing system server crashes" am: f7d14dba58
am: f37da9a879

Change-Id: I0ab308d5215ddb174ffb115e36948685d68da3ec
2019-06-25 01:53:11 -07:00
Lorenzo Colitti
f7d14dba58 Merge "NetworkStats: Fix race condition causing system server crashes" 2019-06-25 07:54:17 +00:00
Hugo Benichi
5c8f9cf7ed NetworkStats: Fix race condition causing system server crashes
NetworkStatsService uses an internal boolean to know when it has
started for the purpose of preventing access to other internal
variables before they are initialized.

However that boolean is set to true in systemReady() non-atomically
with respect to the initialization of the other variables it guards,
which can cause the system server to crash.

This patch fixes this concurrency bug by moving setting the internal
boolean flag and the variable it guards in one atomic synchronized
block.

This patch also removes code checking if bandwidth control is enabled,
because this is now always true.

Bug: 132767673
Test: Compiled.
Change-Id: Ia089b5767ce271d669879c975508654d4dd03429
2019-06-25 10:51:51 +09:00
Lorenzo Colitti
d48d9b4e5c [automerger skipped] Merge "Don't auto-connect to networks that have no/limited connectivity." am: df2b6ea27c am: ebdd783a9b -s ours
am: 693f58c378 -s ours
am skip reason: change_id I5413393529c4bad3a707df229307542486bcff33 with SHA1 336e846779 is in history

Change-Id: I44723afb20ec488e620fe792d7268ba0bcd6de9c
2019-06-24 09:11:15 -07:00
Lorenzo Colitti
693f58c378 [automerger skipped] Merge "Don't auto-connect to networks that have no/limited connectivity." am: df2b6ea27c
am: ebdd783a9b -s ours
am skip reason: change_id I5413393529c4bad3a707df229307542486bcff33 with SHA1 336e846779 is in history

Change-Id: I116cea63ccbfd5346ca218486671abae5176c273
2019-06-24 08:50:02 -07:00
Lorenzo Colitti
faac97e8f7 [automerger skipped] Merge changes If7d41052,I66f263d7,Id45ae956,Iba752fed,I575a7e4f, ... into qt-r1-dev
am: 3547965d2a -s ours
am skip reason: change_id If2ef8d8f038f32c8cf974aa02cfc1dc7e44dbad3 with SHA1 8c9d8c5e05 is in history

Change-Id: I5b525feb1e7df2a89dea4f38b521973ccaac0746
2019-06-24 08:17:26 -07:00
Lorenzo Colitti
df2b6ea27c Merge "Don't auto-connect to networks that have no/limited connectivity." 2019-06-24 10:45:51 +00:00
Lorenzo Colitti
3547965d2a Merge changes If7d41052,I66f263d7,Id45ae956,Iba752fed,I575a7e4f, ... into qt-r1-dev
* changes:
  Inline readNetworkStatsDetailInternal, make mUseBpfStats final
  Remove VPN info arrays from NetworkStats(Observer|Recorder)
  NetworkStatsFactory: Take VPNs into account for network/battery stats
  Remove duplicate line in clat_simple test file
  Remove unused lastStats parameter
  Revert "Revert "Take all VPN underlying networks into account when migrating traffic for""
2019-06-24 03:37:23 +00:00
Lorenzo Colitti
2f2b961176 Don't auto-connect to networks that have no/limited connectivity.
Auto-reconnecting to a network with no or limited Internet
connectivity is not useful. This is because such networks cannot
be used unless the user taps the notification and interacts with
the resulting dialog. But the notification is only shown if the
user manually connects to the network, not if the system
auto-connects to it.

Bug: 130683832
Bug: 130766237
Test: atest FrameworksNetTests
Change-Id: I5413393529c4bad3a707df229307542486bcff33
Merged-In: I5413393529c4bad3a707df229307542486bcff33
2019-06-24 11:39:18 +09:00
Benedict Wong
1082dddfd3 Remove VPN info arrays from NetworkStats(Observer|Recorder)
This change removes the now-unused VPN arrays in the network stats
observer and recorder classes. These are always null values in every
call site.

Bug: 113122541
Bug: 120145746
Bug: 129264869
Bug: 134244752
Test: FrameworksNetTest passing
Test: Manual tests show data usage fixes maintained.
Merged-In: Ieb8645acc400fdaeb0df7092c5369b96f9f35af9
Change-Id: I66f263d7e12bce7668901306c0c2ecdda634abaf
(cherry picked from commit 833603caabb1a850a63a970fc285b4c8ed7401f8)
2019-06-21 01:12:34 +00:00