Commit Graph

7676 Commits

Author SHA1 Message Date
Chalard Jean
dc98e9be4c Merge "Fix a doc" 2019-12-12 14:15:28 +00:00
Chalard Jean
c0f993bb04 Merge "Make getNetworkSpecifier() public API."
am: ad60ef88e0

Change-Id: I92d0b7cb179e1c0f5cb789c2c668254732fbf30a
2019-12-12 04:04:32 -08:00
Chalard Jean
2e3154435f Fix a doc
Test: FrameworksNetTests
Change-Id: I5c9aeb627d9f22aa84bc134b6c7d3c15f237a775
2019-12-12 13:56:13 +09:00
Chalard Jean
dbb4dff52e [NS A27] Remove useless logs and a useless var
These logs haven't found a bug in a long time and we now have
some structural guarantees that the conditions they check for
can't happen (like the checks that everything is happening on
the same thread).
Maybe we'll reinstate similar checks later, but for now they
are in the way and removing them is a small sacrifice for the
intended benefit.

The local was simply not used any more.

Test: FrameworksNetTests
Change-Id: I4b793e86039c204a038c1b0fecbf8a4927eef48d
2019-12-12 13:55:32 +09:00
Chalard Jean
be083a195f [NS A26] Move available callbacks out of the rematch computation
Bug: 113554781
Test: ConnectivityServiceTest
Change-Id: I6f86add0ccde221c22436ac1995ef6064b3ca69e
2019-12-12 13:55:32 +09:00
Chalard Jean
b56e56916f [NS A25] Send all listen callbacks after all rematches
Bug: 113554781
Test: ConnectivityServiceTests NetworkStackTests
Change-Id: I2db9535b1d72edd46b968b1bae66b148aa815235
2019-12-12 13:55:31 +09:00
Chalard Jean
c375dccad3 [NS A24] Add an object to represent changes in assignment
Test: ConnectivityServiceTest
Change-Id: I703db6d3f039bd67a90fad0eadffc6cfed9a50ee
2019-12-12 13:21:43 +09:00
Chalard Jean
294ebbbad8 Make getNetworkSpecifier() public API.
The builder lets clients set it, and this may be useful for
unit tests of apps. It should be public.
The need arises from uses of this in WiFi and Telephony
network factories.

Test: build
Bug: 135998869
Change-Id: I57279cac139c28e8654d2066ba0c60edd1e6cd98
2019-12-12 13:10:55 +09:00
Chalard Jean
8d934b3aac Merge changes Ibebdae14,I0c097e77,I6c889b15,I4771f2e9,I2a52f7f4
am: b24e34c19b

Change-Id: I8162ce9e5b1cb813d2b50325cc3a986d6a846a65
2019-12-10 20:13:20 -08:00
Chalard Jean
05cbe97f28 [NS A23.1] Minor cleanup
The argument is always true.

Test: ConnectivityServiceTest
Change-Id: Ibebdae14e63e6baf74db054038ee575ec462f6d5
2019-12-10 14:15:15 +09:00
Chalard Jean
05edd05f53 [NS A23] Move a synchronized block in a central place
As the calls to this apparently need to be synchronized, let's
do it all in the same place instead of in all callers

Test: FrameworksNetTests
Change-Id: I0c097e7756fc155ba0243834b84626e86c68340e
2019-12-10 14:15:14 +09:00
Chalard Jean
cd397a2042 [NS A22] Small refactoring
The point of this is to be able to move parts of processListenRequests
independently.

Test: FrameworksNetTests
Change-Id: I6c889b15696123c1120221977b0f36fa3d91de56
2019-12-10 14:15:14 +09:00
Chalard Jean
1123f5d067 [NS A21] More cleanup
Test: FrameworksNetTests NetworkStackTests
Change-Id: I4771f2e9151ff16a7045d9c3025ac686f244b22d
2019-12-10 14:15:14 +09:00
Chalard Jean
5c4bddb8cd [NS A20] Cleanup
A lot of this code can't be triggered at all.
• newNetwork.created in l.6488 is implied by newNetwork.everConnected
  in l.6357
• !newNetwork.isVPN() in l.6488 is implied by the fact that VPNs are
  always foreground, so oldPermission can't != newPermission in l.6488
• updateUids in l.6502 is useless because uids can't change during a
  rematch (because there is no code doing that). Metered state and
  roaming state similarly can't change during a rematch, so
  meteredChanged and roamingChanged are always false
• updateAllVpnCapabilities in l.6537 is useless because VPN do not
  inherit the foreground state of their underlying networks, which
  would be the only reason to call that in l.6537
• Object.equals() in l.6480 is necessary false because at this line
  it is known that the foreground state has changed, which must have
  caused the NET_CAPABILITY_FOREGROUND to be different, so the objects
  can't be equal

Test: FrameworksNetTests NetworkStackTest
Change-Id: I2a52f7f4a085f3eea22a1dd170af8f04671250ff
2019-12-10 14:14:57 +09:00
lucaslin
26468789ea Merge "Remove incorrect annotation - @TransportType"
am: ac81b72e22

Change-Id: I99b74e5e67f5ff6f8d35f627e2c40ef4ca001c0c
2019-12-05 20:57:08 -08:00
Treehugger Robot
ac81b72e22 Merge "Remove incorrect annotation - @TransportType" 2019-12-06 04:50:27 +00:00
lucaslin
387ce1a837 Remove incorrect annotation - @TransportType
This annotation is mis-adding by aosp/929879, and now it also
makes compilation failure for Telephony Mainline.

Bug: 145755373
Test: atest FrameworksNetTests
Change-Id: Ic22ce6bf17c4300b8cd52217976bfb215a123f68
2019-12-06 11:17:25 +08:00
markchien
4127bbc6bf Merge "Expose netId to SystemApi"
am: ed2644bf65

Change-Id: I930b421d373ac67ec5987b9440a45e6dbc536074
2019-12-04 18:35:41 -08:00
Treehugger Robot
ed2644bf65 Merge "Expose netId to SystemApi" 2019-12-05 02:29:41 +00:00
markchien
d2751e09d2 Expose netId to SystemApi
Tethering will be build as unblundled APP. It can't use @hide
API anymore. Expose netId for tethering because it need to set
proxy dns server with netId.

Bug: 144758139
Test: build
Change-Id: Ifefa791940874617bb479f5c23488d14be87f45e
2019-12-04 14:33:51 +08:00
Paul Hu
e43ab9369b Merge "Replace the permission of internal connectivity checks"
am: 032c3c3e30

Change-Id: I5bb6a6074a2ac08f04147d415fb1d2bfbd411850
2019-12-03 22:04:50 -08:00
Paul Hu
032c3c3e30 Merge "Replace the permission of internal connectivity checks" 2019-12-04 05:59:59 +00:00
paulhu
8e96a75543 Replace the permission of internal connectivity checks
A number of connectivity checks that protect system-only methods
check for CONNECTIVITY_INTERNAL, but CONNECTIVITY_INTERNAL is a
signature|privileged permission. We should audit the permission
checks, and convert checks that protect code that should not be
called outside the system to a signature permission. So replace
all CONNECTIVITY_INTERNAL to other proper permissions.

Bug: 32963470
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Change-Id: I8f2dd1cd0609056494eaf612d39820e273ae093f
Merged-In: I8f2dd1cd0609056494eaf612d39820e273ae093f
2019-12-04 11:44:45 +08:00
Chalard Jean
0c0bf65507 Merge changes Ie756b9aa,I38110f3a
am: e38a525a05

Change-Id: I69e6c9234f0a983a56ee19d4d4dfe97618dc8f56
2019-12-03 18:18:53 -08:00
Treehugger Robot
e38a525a05 Merge changes Ie756b9aa,I38110f3a
* changes:
  [NS A19] Inline updateCapabilities in rematch.
  [NS A18] Reverse listens and request-availables
2019-12-04 02:07:45 +00:00
Xin Li
40e8826773 Merge "Merge Android10 QPR1 into AOSP master"
am: 20a8c06313

Change-Id: I3b2912dffdd5be501077c9983bb922ee7a3767d1
2019-12-03 16:09:13 -08:00
Treehugger Robot
20a8c06313 Merge "Merge Android10 QPR1 into AOSP master" 2019-12-03 23:15:02 +00:00
Chalard Jean
54546f8429 Merge "Disable a flaky test"
am: 932dda858a

Change-Id: I8a6fc40976c6ab234cabd4af37dc4a530e2b47a1
2019-12-03 08:30:03 -08:00
Chalard Jean
54ef9299c7 Disable a flaky test
Bug: 145513323
Test: FrameworkNetTests
Change-Id: I66e02fdaab2969b77db4a0f0e6fb8b1a981d9350
2019-12-03 16:13:22 +09:00
Xin Li
4b20d94557 Merge Android10 QPR1 into AOSP master
Bug: 145570283
Change-Id: I557701733b49b0f231c89165239ba07c0fa288d2
2019-12-02 21:25:07 -08:00
Aaron Huang
8d6ae5d59f Add LinkProperties methods to system APIs
The exposed methods are used by telephony, wifi
and tethering. For mainline support, making the
methods @SystemApi.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest FrameworksNetTests
      atest NetworkStackTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
      atest android.net.cts
      atest android.net.wifi.cts
      atest android.telephony.cts

Change-Id: Ib16a838cf9f748e1c5b045d6c2f17678f16af28c
2019-12-02 19:29:18 +08:00
Chalard Jean
f3402da572 Merge changes I720a1feb,I9539b8cc,Ib79b777b
am: adb58138bd

Change-Id: Ieaa1371f6e52074b76e3353ea9a2653c783ff04e
2019-12-02 01:51:07 -08:00
Chalard Jean
959c7cd889 [NS A19] Inline updateCapabilities in rematch.
This is ugly, but it's a necessary step to improve the code.
Followups will clean this up. Importantly this kind of inlining
will let us break the very confusing apparent loop between
updateCapabilities and rematch.

Test: FrameworksNetTests
Change-Id: Ie756b9aa8066984264717f0b1e1f31606432f1a4
2019-12-02 18:44:11 +09:00
Chalard Jean
9127f03a5c [NS A18] Reverse listens and request-availables
This is a long standing bug that happens to now be trivial
to fix, and also be beneficial for refactoring

Test: FrameworksNetTests NetworkStackTests
Change-Id: I38110f3a4a75936ea755788e7f9fee67863e14be
2019-12-02 18:44:10 +09:00
Chalard Jean
adb58138bd Merge changes I720a1feb,I9539b8cc,Ib79b777b
* changes:
  [NS A17] Update linger state after rematching.
  [NS A16] Cleanup
  [NS A15] Move legacy default broadcasts out of the loop
2019-12-02 09:40:44 +00:00
Chalard Jean
0d6211b065 Merge changes I0613c23f,Ibeab8d0a,I8bd668ad,I7d3a16be
am: a1a975e149

Change-Id: Ibe34e78e53a15e987042703fdd27d6393e4e7d59
2019-12-01 21:26:44 -08:00
Chalard Jean
a1a975e149 Merge changes I0613c23f,Ibeab8d0a,I8bd668ad,I7d3a16be
* changes:
  [NS A14] Move code notifying battery stats in its right place
  [NS A13] Move legacy broadcast handling after rematch.
  [NS A12] Move some legacy type tracker handling to a function
  Add tests for ConnectivityService → BatteryStats messages
2019-12-02 05:17:39 +00:00
Chalard Jean
7807fa2b7f [NS A17] Update linger state after rematching.
Test: FrameworksNetTests NetworkStackTests
Change-Id: I720a1feb89088aa123201ef5867de444234343e8
2019-12-02 13:02:41 +09:00
Chalard Jean
f034453cce [NS A16] Cleanup
Move LegacyTypeTracker work into a function for readability.

Test: FrameworksNetTests NetworkStackTests
Change-Id: I9539b8cc4422b3a0cc1d3d9b3a44d59dc1905b44
2019-12-02 13:02:41 +09:00
Chalard Jean
b9d9405225 [NS A15] Move legacy default broadcasts out of the loop
Test: FrameworksNetTests NetworkStackTests
Change-Id: Ib79b777b5efda3a4c85c30055f1a6d03d5d04c25
2019-12-02 13:02:41 +09:00
Chalard Jean
9589e72241 [NS A14] Move code notifying battery stats in its right place
This should be done once every time an interface comes online.
Doing this in updateLinkProperties guarantees this happens every
time a new interface comes online, but it doesn't do it more
often than needed.

Test: FrameworksNetTests NetworkStackTests
Change-Id: I0613c23f44192944266d76107308da8d1c541d1c
2019-12-02 13:02:38 +09:00
Chalard Jean
6a96b757df Merge "Give apps access to the NAT64 prefix."
am: 3391fbb6a2

Change-Id: I673a44f3f75a2395ae3d9d436c83708f20f414e6
2019-12-01 18:20:00 -08:00
Treehugger Robot
3391fbb6a2 Merge "Give apps access to the NAT64 prefix." 2019-12-02 02:05:16 +00:00
Mark Chien
3d076f29b7 Merge changes from topic "tether_migrate"
am: 783ba3e0bd

Change-Id: I03e43b7a112f91637941e5193bd21b3e714f5dac
2019-11-30 04:26:07 -08:00
markchien
bd4a462076 [Tether07] Migrate Tethering into module
am: 5e86665079

Change-Id: I1aaa034e91eae2d6e9abcbbd70741a54a18b3ddc
2019-11-30 04:25:57 -08:00
Mark Chien
783ba3e0bd Merge changes from topic "tether_migrate"
* changes:
  [Tether10]Remove UserManagerInternal usage in Tethering
  [Tether07] Migrate Tethering into module
  [Tether07] Clean up build rule for libtetheroffloadjni
2019-11-30 12:17:47 +00:00
Chalard Jean
7aa4400722 Give apps access to the NAT64 prefix.
Apps that do their own DNS queries need to know the NAT64 prefix
to resolve v4 addresses on v6-only networks.

Test: FrameworksNetTests NetworkStackTests
Bug: 144877069
Change-Id: I5a255b7afc2038646b93a0ab893f8ad62d0fb34f
2019-11-30 10:25:02 +00:00
markchien
5e86665079 [Tether07] Migrate Tethering into module
Now tethering would be run in dedicated service.
TetheringManager is the interface used to communicate with
TetheringService. The new call flow would be: ConnectivityManager
-> ConnectivityService -> TetheringManager -> TetheringService.
Note: the return value of #tether(), #untether() and #setUsbTethering()
APIs would always be no error. Client can use #getLastTetherError()
or #getTetheredIfaces or listen tether state change to check
status of corresponding interface.

Bug: 136040414
Bug: 144742179
Test: -build, flash, boot
      -atest TetheringTests
      -atest FrameworksNetTests

Change-Id: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
Merged-In: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
2019-11-30 10:03:08 +00:00
Chalard Jean
f01b2efc13 [NS A13] Move legacy broadcast handling after rematch.
As opposed to other patches in this series, there is a logic change
here. This will send all necessary legacy broadcasts after all
matches have been done.

This should be fine because the callbacks and the broadcasts are
unordered anyway, and the broadcasts are still sent in the same
order as before ; there should not be an observable change from
apps besides some jitter.

Bug: 113554781
Test: ConnectivityServiceTest
Change-Id: Ibeab8d0a9106c5198228888ac33084238c0a4a1a
2019-11-29 16:59:31 +09:00
Chalard Jean
61c79256b1 [NS A12] Move some legacy type tracker handling to a function
It's fine to do this out of the if() clause because :
• If the network newly satisfies a request it is sure to have
  it in the list of requests it satisfies
• If it does not newly satisfy a request and there is still
  a request with a legacy type that it satisfies, then it
  is already remembered by LegacyTypeTracker

As for the VPN, the code always enters the condition anyway.

Test: ConnectivityServiceTest
Change-Id: I8bd668ad27043d6a5036b1b3c52fa5a3146abcfa
2019-11-29 16:59:31 +09:00