Commit Graph

43090 Commits

Author SHA1 Message Date
Lucas Lin
af97e30d9f Merge changes Ib2d54e53,Ieb606d2b am: c5e61cc540
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1829936

Change-Id: Idce97c0d4ca8082b8ddafec726a2c3dc07ea4fc6
2021-10-26 06:09:45 +00:00
Aaron Huang
386e1702a5 Merge "Update callers to use buildTemplateMobileWithRatType with metered" am: c5655055a3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1807404

Change-Id: Ic6dbad40d6227a7891b5889c07471d75beea3bcc
2021-10-26 06:09:37 +00:00
Lucas Lin
c5e61cc540 Merge changes Ib2d54e53,Ieb606d2b
* changes:
  Test if underlying networks are the same as what VpnService sets
  Convert VpnTest to JUnit4
2021-10-26 06:07:19 +00:00
Aaron Huang
c5655055a3 Merge "Update callers to use buildTemplateMobileWithRatType with metered" 2021-10-26 05:54:05 +00:00
lucaslin
cacd5b0d2a Test if underlying networks are the same as what VpnService sets
If VpnService set null as the underlying networks, then the
underlying networks will be set as system defeult network.
If VpnService set an empty array as the underlying networks, then
the underlying networks of VPN will not be set to any networks.
If VpnService set a network which is not null or an empty array,
then the underlying networks of VPN should be the same as this
one.

Bug: 191918368
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: Ib2d54e53960e5f899cb8d4cfaa6705ca676354ca
2021-10-26 10:55:41 +08:00
lucaslin
d2de904def Convert VpnTest to JUnit4
This is to fix the error in errorprone target, the error message
is: [JUnit4ClassUsedInJUnit3] Assume cannot be used inside a
JUnit3 class. Convert your class to JUnit4 style.
The error method is: assumeTrue()

Bug: 191918368
Test: atest CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: Ieb606d2ba31cc19510425114c76fd77417227f2c
2021-10-26 10:55:25 +08:00
Chalard Jean
8a867d17a0 Merge "No-op cleanup" am: e88bfbc015
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1868845

Change-Id: I958ba36bc904a5785d5cb071bde0b56613d58dbb
2021-10-26 02:54:57 +00:00
Chalard Jean
e88bfbc015 Merge "No-op cleanup" 2021-10-26 02:39:47 +00:00
Aaron Huang
6359ebd099 Update callers to use buildTemplateMobileWithRatType with metered
The method buildTemplateMobileWithRatType is updated to take
metered as a parameter so the callers should be updated to
the new version.

Bug: 183776809
Test: atest FrameworksNetTest
Change-Id: I859514b93705f9ee4f9ae4b0bcddcb61005a78ff
Merged-In: I859514b93705f9ee4f9ae4b0bcddcb61005a78ff
2021-10-25 15:22:59 +00:00
Chalard Jean
a3578a5465 No-op cleanup
Binders from the system server don't help, because if the process
dies there is nobody to listen to its binder deaths.

Test: ConnectivityServiceTest
Change-Id: I993cb9481edfaeb652b875be7f90166db16d0e1d
2021-10-25 19:24:48 +09:00
Anton Hansson
9b5b9409d9 Merge "Qualify references to WifiNetworkSuggestions" am: 7ea2767864
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1863714

Change-Id: Ic9f2c305dddaeaac846bc4b03a4b75d551b01202
2021-10-21 12:08:41 +00:00
Anton Hansson
7ea2767864 Merge "Qualify references to WifiNetworkSuggestions" 2021-10-21 11:53:06 +00:00
Lucas Lin
58f526a27b Merge "Wait for network to be validated when setting a valid private DNS" am: acd3e2be33
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1801947

Change-Id: Id05b103459a8f922c54d46161d1d729d8d980748
2021-10-21 11:48:40 +00:00
Lucas Lin
acd3e2be33 Merge "Wait for network to be validated when setting a valid private DNS" 2021-10-21 11:34:35 +00:00
Lucas Lin
6f824bad06 Merge "Add underlying networks into NetworkAgentInfo if any" am: 9c9850b944
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1829935

Change-Id: Idae6559eea61b5e8f75e5b79f8404430b10ad72f
2021-10-21 08:54:49 +00:00
lucaslin
4d441a9b8d Wait for network to be validated when setting a valid private DNS
The previous design just set a valid private DNS and checked
whether onCapabilitiesChanged() has received and
NetworkCapabilities#isPrivateDnsBroken is false. It cannot ensure
that the private DNS is working until the network is validated.
So change the design to waiting the network to be validated after
setting a valid private DNS.

Bug: 196769780
Test: atest CtsNetTestCases:ConnectivityManagerTest
Change-Id: I9c173a70e2b81788efa2ecbf928acda0379846da
2021-10-21 16:47:26 +08:00
Lucas Lin
9c9850b944 Merge "Add underlying networks into NetworkAgentInfo if any" 2021-10-21 08:33:29 +00:00
Treehugger Robot
43f2693271 Merge "Dependency update for StateMachine" am: 5dc1edd9a8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1800993

Change-Id: Ie9cac9d14275e96affd06335c1236a855f8c7d69
2021-10-20 14:01:45 +00:00
Treehugger Robot
5dc1edd9a8 Merge "Dependency update for StateMachine" 2021-10-20 13:43:58 +00:00
Chalard Jean
9a492016d9 Merge "Cleanup shims usage in Tethering" am: 7949b8c557
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1864041

Change-Id: I84e1892270207230f2dfa5bb6725ad395988ef57
2021-10-20 13:17:29 +00:00
Chalard Jean
7949b8c557 Merge "Cleanup shims usage in Tethering" 2021-10-20 13:06:24 +00:00
Chalard Jean
732ebcbc7f Cleanup shims usage in Tethering
Now that S has gone to AOSP, this dependency is no longer
needed. It is, on the contrary, harmful as it prevents us
from adding shims that depend on T APIs in AOSP.

Test: builds
Change-Id: I64f0f394e826e58a9b7e772043bb6008428892e6
2021-10-20 19:44:09 +09:00
Anton Hansson
df40109271 Qualify references to WifiNetworkSuggestions
Connectivity's metalava invocation does not depend on framework-wifi,
so these references fail to resolve, and as a result metalava currently
removes the import.

Fully qualify the references instead, to avoid both metalava trying
to resolve the dependency, and having to depend on framework-wifi just
for javadoc.

Bug: 186197911
Test: build the sdk (with connectivity module stubs as input)
Change-Id: I7129821b9a0d08d06f8e977a3c17fa5f5f6f9cee
2021-10-20 11:34:48 +01:00
Treehugger Robot
c472eed19a Merge "Unregister the tethering internal callback in finalize" am: f8d1f3d1cd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1838543

Change-Id: I3523da57b7d0feac11b2cdf62f254e694d5b7269
2021-10-20 08:57:57 +00:00
Treehugger Robot
f8d1f3d1cd Merge "Unregister the tethering internal callback in finalize" 2021-10-20 08:40:08 +00:00
Treehugger Robot
695b4c170e Merge "Test TetheringManager could be GC after getting connector" am: 9d0c5419c9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1838542

Change-Id: I3a11200db5de2143bada839d7b4268dc393afab9
2021-10-20 08:01:33 +00:00
Treehugger Robot
9d0c5419c9 Merge "Test TetheringManager could be GC after getting connector" 2021-10-20 07:48:10 +00:00
Paul Hu
ad329392a7 Merge "Crash bad callers earlier" am: 7a30d04659
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1862335

Change-Id: Id32847468921b060b2a7607f598ff801d84fa2f7
2021-10-20 07:05:11 +00:00
markchien
819e19ea2a Unregister the tethering internal callback in finalize
Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Ie7f9535b923db5073a59329ead22546a54e6ef47
2021-10-20 06:57:58 +00:00
Paul Hu
7a30d04659 Merge "Crash bad callers earlier" 2021-10-20 06:53:39 +00:00
markchien
e7b4a505aa Test TetheringManager could be GC after getting connector
There is pollingConnector thread which start polling connector if
TetheringManager is created earlier than TetheringService started(during
device boot up). TetheringManager won't be GCed if pollingConnector
thread do not finish its task yet.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Id8c7d10c5172e1d5de460c5311ff9c20261facef
2021-10-20 06:06:04 +00:00
Paul Hu
17c492e08f Merge "Specify which callback is unexpected in testMobileDataPreferredUids" am: c4898b85ce
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1817916

Change-Id: I7210fea1f79ccb5d0e1e7db6d724759b4c686824
2021-10-20 05:52:41 +00:00
Paul Hu
c4898b85ce Merge "Specify which callback is unexpected in testMobileDataPreferredUids" 2021-10-20 05:39:19 +00:00
Treehugger Robot
059afb99bb Merge "Fix TetheringManager memory leak" am: d7d41a73e7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1744513

Change-Id: I0cd6e631a1340d144ff052ec9b6ff6d449dc47c9
2021-10-20 04:12:42 +00:00
Treehugger Robot
d7d41a73e7 Merge "Fix TetheringManager memory leak" 2021-10-20 03:59:59 +00:00
Treehugger Robot
69da276bc4 Merge "Exclude testGetMultipathPreference on no Wi-Fi devices" am: 9755b43575
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1848993

Change-Id: Ide421240ab056248b5464b54b6db52c7fd3c9c88
2021-10-20 02:22:04 +00:00
Treehugger Robot
9755b43575 Merge "Exclude testGetMultipathPreference on no Wi-Fi devices" 2021-10-20 02:10:47 +00:00
paulhu
c344c9fb9c Specify which callback is unexpected in testMobileDataPreferredUids
This test is flaky due to assertNoCallback(). Because this
method expects no any callback received but the wifi network
may update its capabilities during testing and trigger
onCapabilitiesChanged() to cause test failed. Thus, these
callbacks should be ignored in the tests.

Replace the assertNoCallback to assertNoCallbackThat with
callback type specified to deflake tests.

Also align the available callback verification in the test to
avoid confusion.

Fix: 198367703
Test: atest android.net.cts.ConnectivityManagerTest\
      --iterations 20
Change-Id: Ifde5e9730823c3b6f32590cc436cc4ba11d2b36e
2021-10-19 18:27:19 +08:00
Chalard Jean
4b918ab1a4 Crash bad callers earlier
Instead of crashing when parceling the NetworkInfo object,
crash at the time the bad call is made.

Bug: 145972387
Test: FrameworksNetTests
Change-Id: If8b5fd3d7b800c97211bcd16c9a8c5812708d4ab
2021-10-19 16:43:50 +08:00
lucaslin
6adf5ac19b Add underlying networks into NetworkAgentInfo if any
Now, VPN will set underlying networks into NetworkCapabilities
directly. So the declaredUnderlyingNetworks can also be set
directly when creating a NetworkAgentInfo.

Bug: 191918368
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I507072d00ae1eb0c391e5261ab93e359b9c4cb5c
2021-10-19 15:04:56 +08:00
Lucas Lin
f96e107603 Merge "Add new APIs in NetworkCapabilities to set and get underlying networks" am: 39379a40bd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1829934

Change-Id: I576812f62add322752c3991bec460b978c9fba61
2021-10-18 05:46:11 +00:00
Lucas Lin
39379a40bd Merge "Add new APIs in NetworkCapabilities to set and get underlying networks" 2021-10-18 05:27:59 +00:00
lucaslin
8b2dfa7c02 Add new APIs in NetworkCapabilities to set and get underlying networks
Previously, the caller can only know about the transport type of
the underlying network. The information might not be enough if
the device support WiFi STA+STA.
Thus, provide an API for the caller to get the correct underlying
network.

Bug: 191918368
Test: atest FrameworksNetTests:NetworkCapabilitiesTest
Change-Id: I7752b2356770f4572f6ca4cbaecaa45c09d6d72f
2021-10-15 18:07:12 +08:00
Treehugger Robot
40ea750175 Merge "Update Permission only if the network is created" am: 29f0350da3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1827912

Change-Id: Iaa41edbfe275556c009c00c48dd4a712e6eff3a7
2021-10-14 06:27:02 +00:00
Treehugger Robot
29f0350da3 Merge "Update Permission only if the network is created" 2021-10-14 06:13:54 +00:00
markchien
1110b725a0 Fix TetheringManager memory leak
TetheringCallbackInteranl is inner class which explicitly reference
TetheringManager object. This causes TetheringManager can't be GC. Using
static nested class which has its own lifecycle and weak reference
TetheringManager object.

Still have a leak inside Tethering that TetheringCallbackInternal is
never unregistered. Currently it rely on binder died to remove the
reference, which usually happen in kill process. If process keep alive,
the TetheringCallbackInternal would not be freed even TetheringManager is
gone. Will have follow CL to fix this.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: 1. lunch Settings with ON/OFF tethering, dump java heap.
      2. close Settings and restart Settings again, dump java heap.
      3. Compare java heap between step 1 and step 2.
Change-Id: I0e2a21b7988115098a033a581cd98da8bffe2791
2021-10-14 14:02:11 +08:00
Treehugger Robot
ccb213843c Merge "Ignore testRestrictedNetworkPermission on Q" am: 6b6d2eb75b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1826056

Change-Id: Ib8043933f8f3dcd029f0acb601035d96204e2ddd
2021-10-13 07:22:32 +00:00
Treehugger Robot
6b6d2eb75b Merge "Ignore testRestrictedNetworkPermission on Q" 2021-10-13 07:01:33 +00:00
Xin Li
0d63d026fb [automerger skipped] Merge Android 12 am: 301d6bdfa6 -s ours
am skip reason: Merged-In I3ae21d9b034e455ba48d9576712a102ccda0f647 with SHA-1 6e1c375f50 is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1847635

Change-Id: I00bbe32399a8a3952642c1ac1d02f2aeecfa373e
2021-10-08 01:20:24 +00:00
Chiachang Wang
1c3cdce86d Exclude testGetMultipathPreference on no Wi-Fi devices
Bug: 202228414
Test: atest CtsNetTestCases
Change-Id: I3112ffb816fd16b2fc7a87c35d8f95eef0144281
2021-10-07 13:19:32 +08:00