Commit Graph

8018 Commits

Author SHA1 Message Date
Lorenzo Colitti
08707366d0 Shorten the output of NetworkAgentInfo#toString().
Currently, printing a NetworkAgentInfo results in a very long
string. Make it a bit shorter by:

- Not printing a number of fields in NetworkInfo that are no
  longer used.
- Instead of printing flags regardless of whether they are true
  false, only print ones that are true. For example, this changes
    everCaptivePortalDetected{true} lastCaptivePortalDetected{false} captivePortalValidationPending{false}
  to:
    everCaptivePortalDetected
- Only printing clat information if clatd is started.

Also, put the long and variable-length fields lp and nc at the
end of the output.

Test: manual
Change-Id: I3312286be307ef1762890cbc6b717f12ce5b2b92
2020-03-17 22:29:37 +09:00
Lorenzo Colitti
2c74e66034 Ensure that NetworkFactory objects cannot be reused.
NetworkFactory is turning into a one-time object that cannot be
re-used. Check for this in ConnectivityService.

Bug: 148635501
Test: test continues to pass
Change-Id: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80
Merged-In: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80
2020-03-17 01:39:23 +09:00
Cody Kesting
ed459f5f1a Merge "Protect ConnectivityService from SecurityException in permission check." 2020-03-16 14:33:25 +00:00
junyulai
cc38304ad8 [SP24] Rename functions that add Entry unconditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record unconditionally,
name them insertEntry.
  setIfaceValues -> insertEntry
  addEntry -> insertEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Test: m doc-comment-check-docs
Bug: 148895143
Change-Id: I801ddc49e283a254b9586700c9b597c0adb0d459
2020-03-16 14:27:45 +08:00
Junyu Lai
24ab7411ba Merge "[SP21] Address comments for API council review about aosp/1172143" 2020-03-16 02:41:19 +00:00
Chalard Jean
16cad96e9f Merge "Resolve ambiguous argument." 2020-03-14 03:38:01 +00:00
Cody Kesting
0b6dd36a52 Merge "Update Javadoc comments for ConnectivityDiagnostics constants." 2020-03-13 19:09:18 +00:00
Chalard Jean
a7cc6d8eee Resolve ambiguous argument.
CTS tests don't have access to TestNetworkAgent and therefore
require overloading this method, which means 'null' is ambiguous.

Bug: 139268426
Test: FrameworksNetTests
Change-Id: I9279718bde30bd98eff901921fb3411d22da72e5
2020-03-13 21:17:33 +09:00
Treehugger Robot
62b8d6f24d Merge "Remove redundant connected notification" 2020-03-13 07:10:13 +00:00
Aaron Huang
d4db72dbfc Merge "Add test for NetworkAgentConfig" 2020-03-13 04:13:04 +00:00
junyulai
0c88795cb5 [SP21] Address comments for API council review about aosp/1172143
Test: atest FrameworksNetTests ImsPhoneCallTrackerTest
Test: atest TetheringTests NetworkStackTests
Test: m doc-comment-check-docs
Fix: 148552904

Change-Id: I141393f229e772d2eb9f7c156849e379bd71b845
2020-03-12 21:34:17 +08:00
Mark Chien
08679046fe Merge "Add javadoc for Network#netId" 2020-03-12 09:55:18 +00:00
markchien
43321d2e00 Add javadoc for Network#netId
Bug: 151156820
Test: m doc-comment-check-docs
Change-Id: Iea34a5c58a8b77c83258a39a8a44601e21a482f5
2020-03-12 09:54:44 +00:00
Paul Hu
da284dc189 Merge "Add CTS for SocketUtils.makePacketSocketAddress(int, int, byte[])" 2020-03-11 09:50:26 +00:00
paulhu
4c48b0a060 Add CTS for SocketUtils.makePacketSocketAddress(int, int, byte[])
Bug: 149426063
Bug: 150640362
Test: atest CtsNetTestCasesLatestSdk:android.net.util.SocketUtilsTest
      on both Q and R devices
Change-Id: I4b5a3dfb78b404d414b7dc358e6f16c3414a8b33
2020-03-11 15:20:26 +08:00
Aaron Huang
73808bd4cf Merge "Remove framework code that has moved to frameworks/libs/net" 2020-03-11 04:22:09 +00:00
Aaron Huang
97ae1a81fa Add test for NetworkAgentConfig
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
Change-Id: If9158d086bacb0ade94d59898ac223e4c8f4f73a
2020-03-10 21:01:14 +08:00
Chiachang Wang
3e3abc9ec4 Merge "Skip Route tests that are R-specific on Q" 2020-03-10 10:24:48 +00:00
Chiachang Wang
1d74bab6e7 Skip Route tests that are R-specific on Q
MTU was added in R so test for it should be run on Q. Also
revise test to adopt rule.

Test: atest CtsNetTestCasesLatestSdk:android.net.LinkAddressTest
      on both devices
Bug: 150918852
Change-Id: Ibab9cfae0d35b26c6e4ca0defbb89769b04201d4
2020-03-10 10:24:38 +00:00
Aaron Huang
0e1759bdfa Remove framework code that has moved to frameworks/libs/net
Add srcs to framework and change import path.
Remove the codes which are moved to frameworks/libs/net.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Bug: 143925787
Test: atest FrameworksNetTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Ia5692aade490fbc8a037186fcdfc453e0dd8045b
Merged-In: Ibf2f370c97a602f186e37ea9ffbe177dd2ee0f1c
2020-03-10 06:45:16 +00:00
Chiachang Wang
c5d2170b64 Merge "Add test for getDeprecationTime and getExpirationTime" 2020-03-10 03:40:55 +00:00
Cody Kesting
a830439b37 Protect ConnectivityService from SecurityException in permission check.
ConnectivityService currently calls
LocationPermissionChecker#checkLocationPermission. This method call
throws a SecurityException if the given package name and UID do not
match. This permission check is made from the ConnectivityService
Thread, so any Exception being thrown will crash the SystemServer. This
is not acceptable, so surround the permission check in a try-catch in
case any SecurityExceptions are thrown.

Bug: 149119324
Test: atest ConnectivityServiceTest
Change-Id: Ibe2874f2a5249432270aa1b9eb7d004bbba35ac2
2020-03-09 11:27:00 -07:00
Cody Kesting
42fbfe8826 Merge "Clear UIDs when sharing NetworkCapabilties for ConnectivityDiagnostics." 2020-03-09 15:12:51 +00:00
Chiachang Wang
ac98e787d3 Add test for getDeprecationTime and getExpirationTime
Add for cts coverage for system API

Bug: 139268426
Bug: 135998869
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk:android.net.LinkAddressTest
Change-Id: I64cd2c914f2da71383af7cdef2cf64c60a7d268c
2020-03-09 06:59:50 +00:00
Remi NGUYEN VAN
b6871630d7 Merge "Ignore NetworkAgentConfigTest on Q" 2020-03-09 05:03:20 +00:00
Remi NGUYEN VAN
b2f8f992ba Merge "Skip LinkAddress tests that are R-specific on Q" 2020-03-09 05:00:33 +00:00
Remi NGUYEN VAN
48f2c29253 Merge "Ignore testReevaluateNetwork until Q" 2020-03-09 05:00:12 +00:00
Remi NGUYEN VAN
186adbf536 Ignore NetworkAgentConfigTest on Q
NetworkAgentConfig did not exist on Q.

Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
          on Q and R devices
Bug: 150918852
Change-Id: I5414d7767c39327ff41673ff13ccd34982e10742
2020-03-09 12:04:39 +09:00
Remi NGUYEN VAN
1306f533e6 Skip LinkAddress tests that are R-specific on Q
Address lifetime was added in R so tests for it should not be run on Q.

Test: CtsNetTestCasesLatestSdk:android.net.LinkAddressTest on both
          devices
Bug: 150918852
Change-Id: I98b14727eabcf569829eee8df34afc057eba6f93
2020-03-09 10:42:53 +09:00
Treehugger Robot
d88d10a100 Merge "Remove the NetworkScore class." 2020-03-08 04:52:26 +00:00
Cody Kesting
83bc447911 Update Javadoc comments for ConnectivityDiagnostics constants.
API Council feedback requested adding documentation for detection method
constants used in DataStallReport to indicate how the Data Stall was
detected.

Bug: 150598997
Test: n/a
Change-Id: Ib08f05562dd4b17973eeee97452d9f56d37e80fe
2020-03-06 08:05:06 -08:00
Remi NGUYEN VAN
df86d7b416 Ignore testReevaluateNetwork until Q
The method did not exist until Q, so the test is not relevant on such
devices.

Test: atest CtsNetTestCasesLatestSdk:android.net.CaptivePortalTest on Q
          and R devices
Bug: 150918852
Change-Id: I913b6eaa61bfd4f1964b324dcb4dd272aa8cc583
2020-03-06 18:21:45 +09:00
Chalard Jean
8cdee3a431 Remove the NetworkScore class.
This class is useless at this point and introduces overhead.

Bug: 113554781
Test: FrameworksNetTests
Change-Id: Ib6da6c1c7f2a0b97c847d2e64e5ce16dd821e1e7
2020-03-06 11:57:53 +09:00
Amos Bianchi
d43d33333c Merge "Remove polling of TetheringManager in ConnectivityManager." 2020-03-05 18:34:59 +00:00
Amos Bianchi
a9b415a49d Remove polling of TetheringManager in ConnectivityManager.
Test: manual

Bug: 144742179

Change-Id: I196b320788be96c120f771d2fcdf032a73e26b5f
2020-03-05 18:34:14 +00:00
Bill Yi
0a38409fb1 Merge "Merge stage-aosp-master to aosp-master - DO NOT MERGE" 2020-03-05 18:27:30 +00:00
lucaslin
444d43aea0 Remove redundant connected notification
Remove the old connected notification since there is a new file
- NetworkStackNotifier.java which will send the connected
notification when captive portal validated.

Bug: 149883761
Test: 1. atest FrameworksNetTests
      2. Sign-in a captive portal and see if there is a redundant
      connected notification.

Change-Id: I4ec9d26623af4bfc65156a28a96b982466aede31
Merged-In: Id11a9b99dd04772a92af8d527104906c47bf64cd
2020-03-05 06:48:48 +00:00
Cody Kesting
7febafb11c Clear UIDs when sharing NetworkCapabilties for ConnectivityDiagnostics.
ConnectivityDiagnostics shares NetworkCapabilities in
ConnectivityReports and DataStallReports. These NetworkCapabilities need
to have their UIDs scrubbed before they are shared with callbacks.

Bug: 148942124
Test: atest FrameworksNetTests
Change-Id: I5bde5a8116f7e36b8f4de49adf4cab8ec45a5aa4
2020-03-04 08:40:11 -08:00
Automerger Merge Worker
62e64ad839 Merge changes I794a24d0,Iab32b2db am: 22d91b660a
Change-Id: I03f6b9e521793b92f83a21583a2e53fb1d31fba1
2020-03-04 13:26:51 +00:00
Junyu Lai
22d91b660a Merge changes I794a24d0,Iab32b2db
* changes:
  Remove setHandler in NetworkStatsService
  Remove the need of accessing handler in NSS unit test
2020-03-04 13:07:49 +00:00
Automerger Merge Worker
3c77725b74 Merge "Accept MAINLINE_NETWORK_STACK permission on register/unregister network provider" am: 9f1fa12186
Change-Id: I1ab6d47c17992f8630d9aba892bcef29dcb66bfa
2020-03-04 10:32:09 +00:00
Paul Hu
9f1fa12186 Merge "Accept MAINLINE_NETWORK_STACK permission on register/unregister network provider" 2020-03-04 10:15:41 +00:00
junyulai
c05d1359b4 Remove setHandler in NetworkStatsService
Currently, internal handler is set by setHandler after
constructing NSS object. This was introduced in ag/866187 to
access the handler in the unit test.

However, the design put NSS in a bad situation where all classes
that need handler or executor could not be final and need to be
dynamically allocated in order to get a valid handler.

Thus, since the usage of handler is removed in previous patch,
this change eliminate setHandler by initializing the handler in
the constructor.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: I794a24d00b0ca9fdc78091e7b9ab7307e0f034b7
2020-03-04 16:01:21 +08:00
Automerger Merge Worker
d778ebc099 Merge "Add more assertions to testStackedLinkProperties." am: bb77aa9ddd
Change-Id: I6987dc9c80b8d48c8354f654f21b056d2bd896c5
2020-03-04 04:36:38 +00:00
Lorenzo Colitti
bb77aa9ddd Merge "Add more assertions to testStackedLinkProperties." 2020-03-04 04:24:34 +00:00
paulhu
b6ba8e84f4 Accept MAINLINE_NETWORK_STACK permission on register/unregister network provider
Registering/Unregistering network provider needs NETWORK_FACTORY
which is signature only permission. But mainline modules can't
grant this permission because it's not signed with platform key.
Hence, these APIs should also accept MAINLINE_NETWORK_STACK
permission that allow mainline module to register/unregister
network provider.

Bug: 150733435
Test: atest FrameworksNetTests
Change-Id: Id22113aa0db01244817b4b008f5573c5e7b317f0
2020-03-04 09:43:41 +08:00
Lorenzo Colitti
2e6a35ef5e Add more assertions to testStackedLinkProperties.
Check all routes that are added and removed instead of just some
of them. This is in preparation of an upcoming change that
switches to adding and creating routes by issuing direct calls to
netd.

Also rename the misleading ipv4Default route variable to
ipv4Subnet, which is what it actually is.

Bug: 142892223
Test: test-only change
Change-Id: I7d111382be215a926a7d7d4701bd3c3e94372b99
2020-03-03 21:48:18 +09:00
Automerger Merge Worker
f500dafbdb Merge "Update NetworkInfo public API." am: a159122013
Change-Id: I6658d79bd9bda22ed6b8acac90ba94c9ef18c488
2020-03-03 09:40:07 +00:00
Aaron Huang
a159122013 Merge "Update NetworkInfo public API." 2020-03-03 09:16:55 +00:00
junyulai
3123092fd5 Remove the need of accessing handler in NSS unit test
Currently, to wait for handler becomes idle, specific message
is used and the test would wait for condition variable to be
open when the message is processed.

However, this is already done in the HandlerUtils. Thus,
there is no need to post such message manually in the handler.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: Iab32b2dbab01634ca159dcb90fc9f929d1fed1a2
2020-03-03 16:27:03 +08:00