Commit Graph

73838 Commits

Author SHA1 Message Date
Anton Hansson
5072d9305b Merge "Use new soong support to install privapp xml" 2023-05-30 07:44:55 +00:00
Aaron Huang
40b524448c Add tests for PAC proxies.
Test: this is a change that adds a test
Bug: 138810051
Bug: 140610528
Change-Id: I6e7b77320f6baf32ac2f98634fa2e3231d1bf12f
2023-05-30 15:53:11 +09:00
Jean Chalard
5cc9676d4c Merge "Instrument SDK level and change IDs to help testing" 2023-05-30 02:10:05 +00:00
Anton Hansson
1397a101ac Use new soong support to install privapp xml
This allows better overriding of it in the variants of this apex
that have a different package name.

Bug: 242509786
Test: build google tethering, diff before & after
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:91442c93fb8d7f67bf90faab0552428ff07f0452)
Merged-In: I84c53458686f70408ec759df854f5fcdee9cdaed
Change-Id: I84c53458686f70408ec759df854f5fcdee9cdaed
2023-05-29 17:15:52 +00:00
Anton Hansson
92c28d43a1 Merge "Stop Tethering requiring NetworkStack" 2023-05-29 13:24:39 +00:00
Anton Hansson
1525118302 Stop Tethering requiring NetworkStack
It leads to complexity when Tethering is overridden, because the
required attribute must be duplicated for all the variants.

Require NetworkStack be explicitly installed instead.

Bug: 242509786
Test: m
Change-Id: Ideaecf88418901e2c86271166be24f6b7e498a20
2023-05-29 10:08:08 +00:00
Chalard Jean
df29a85ee7 Instrument SDK level and change IDs to help testing
This patch mocks the SDK level and/or change IDs to help
developing functionality that depends on these without
having to flash a new device every time.

Test: TH
Change-Id: I1011193c99e123a0e5501ed313c9cecbceebdae6
2023-05-29 18:42:31 +09:00
Yuyang Huang
79a245e16f Update the SDK version to 34 in ConnectivityTestsLatestSdkDefaults
NsdManagerTest need to be updated because the older check was incorrect,
the new behavior should be observed on T when the compat flag is enabled
as well.

Test: m
Change-Id: I5d2e87b1ab5a114005a223e7ccd865540c0fdb78
2023-05-29 15:31:45 +09:00
Remi NGUYEN VAN
f4cf2707e7 Merge "Do not process null network packets on all clients" 2023-05-29 03:56:26 +00:00
Remi NGUYEN VAN
5a1c614e42 Merge "Only send to downstream ifaces for null network" 2023-05-29 03:56:20 +00:00
Remi NGUYEN VAN
401ab44c36 Merge "Use the ServiceTypeClient network for queries" 2023-05-29 03:56:12 +00:00
Patrick Rohr
a2175bd595 Merge changes from topic "cronet-114.0.5715.0"
* changes:
  cronet import: do not jarjar J.cronet_tests_N
  cronet tests: remove most of NetHttpTestsLibPreJarJar
2023-05-26 15:05:58 +00:00
Patrick Rohr
311feaff8b cronet import: do not jarjar J.cronet_tests_N
Cronet tests do not use a jarjar prefix, so do not jarjar their J/N
implementation.

Test: atest NetHttpTests
Bug: 278639767
Change-Id: Ie4b8bfa13ecbbca014e22d653fa0d39a5554c10e
2023-05-25 23:36:26 -07:00
Patrick Rohr
cc2e2dcb44 cronet tests: remove most of NetHttpTestsLibPreJarJar
Since cronet_java_tests (previously cronet_aml_javatests_sources) is now
an android_library directly in external/cronet (to support "mm" in that
folder), the dependencies can be removed.

A form of android_library is still required to wrap cronet_java_tests,
so the AndroidManifest (in this folder) is forwarded properly to the
common coverage test target.

Test: TH
Bug: 278639767
Change-Id: I25c6371c64e6cfcbb48e9e3f2976d47279791f21
2023-05-25 23:36:26 -07:00
Treehugger Robot
c8fee363bb Merge "[Cronet] Make CtsNetHttpTestCases installable on older devices" 2023-05-25 18:24:47 +00:00
Mark Chien
3045fe697b Merge changes I46a4b3ee,I01b0a6ab
* changes:
  Support SAP and LOHS enabled at the same time
  Allow SAP and LOHS wifi clients exist at the same time
2023-05-25 15:50:38 +00:00
Chidera Olibie
5924d6ed0f [Cronet] Make CtsNetHttpTestCases installable on older devices
This fixes a pre-existing failure on APCT.

Bug: 283927908
Test: atest CtsNetHttpTestCases
Change-Id: If341c11dd3e18be10f6c5e9984d1da304e655d23
2023-05-25 09:46:03 +00:00
Mark
49649c9aea Support SAP and LOHS enabled at the same time
Use type + scope as key to build cached address map so that
SAP (key: TETHERING_WIFI + INTERNET) and LOHS
(key: TETHERING_WIFI + LOCAL) can use different address.

Bug: 233175023
Test: atest TetheringTests
Change-Id: I46a4b3ee919628092b7540202a43d79f407b09b6
2023-05-25 08:31:33 +00:00
Mark
ae3abdfa4b Allow SAP and LOHS wifi clients exist at the same time
This change store localOnly wifi clients in its own field so that
tethered and localOnly hotspot clients can exist at the same time.

Currently, there are no tethered and localOnly hotspot clients at
the same time because PrivateAddressCoordinator does not support
SAP + LOHS. A follow-up change will be made to allow this.

When both SAP and LOHS are enabled, the SAP and LOHS clients from
TetheringEventCallback#onClientsChanged are all TETHERING_WIFI.
Currently, there is no way for the listeners to distinguish between
SAP and LOHS clients.

Bug: 233175023
Test: atest TetheringTests
Change-Id: I01b0a6abb084f7135f7825e0c5303e49c16a4c39
2023-05-25 08:31:06 +00:00
Treehugger Robot
22df1c47ec Merge "Revert "Suppress lint for methods using APIs promoted from system to public"" 2023-05-25 08:21:39 +00:00
Mark
3ec851ef03 Add mDesiredServingState field in BaseServingState
As the suggestion from:
https://android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/2489359/9/Tethering/src/android/net/ip/IpServer.java#b1176

Make BaseServingState an abstract class to prevent it from being used
directly. Additionally, move the handleNewPrefixRequest method into
BaseServingState because it is the only class that uses it.
To avoid TetheredState and LocalHotspotState from having to implement
their own enter function, add the mDesiredInterfaceState field to
BaseServingState.

Bug: 233175023
Test: atest TetheringTests
Change-Id: I03269c37e666345efb0c61039a2bb213f223a5a2
2023-05-24 17:00:41 +00:00
Remi NGUYEN VAN
0ba206cbd1 Do not process null network packets on all clients
Packets received from the "null" networks are packets received from
tethering downstream interfaces. They should not be processed by all
MdnsServiceTypeClients; instead they should be processed by
the MdnsServiceTypeClient for the null network.

Bug: 283708537
Test: atest
Change-Id: Ifef59eca7a24bdfe3650067445d2565869dfa852
2023-05-24 16:37:13 +09:00
Remi NGUYEN VAN
87c374a37a Only send to downstream ifaces for null network
When sendMulticastPacket or sendUnicastPacket is called with the null
network, only send the packets to interfaces indexed with null, instead
of all interfaces.

When using MdnsMultinetworkSocketClient sending packets on the null
network means sending on tethered downstream interfaces. When
MdnsSocketClient is used (not used in the Android tree), sending on the
null network sends on all interfaces as MdnsSocketClient does not
support specific networks. This is clarified by explicitly throwing
when a non-null Network is attempted to be used with MdnsSocketClient
(but MdnsSocketClient is only used for tests in the Android tree).

Bug: 283708537
Test: atest
Change-Id: Ia0186bf8aa2e0fc5878d6071fd23599df8488616
2023-05-24 14:30:14 +09:00
Chiachang Wang
3fabc1b0e0 Merge "Cleanup VpnTest for unused methods/annotations" 2023-05-24 01:41:01 +00:00
Chiachang Wang
b1f3dd9dd1 Merge "Test for not logging meaningless caps changes" 2023-05-24 01:40:34 +00:00
Chalard Jean
74732ba43d Cleanup VpnTest for unused methods/annotations
• Remove unused private methods
• Build files have this test in FrameworksNetTests, which
  by TEST_MAPPING is not run on T and below. It is not in
  the targets that do run on T and below like
  ConnectivityCoverageTest.

Test: VpnTest
Change-Id: I198e5b3571e34e41611f71d351501d3f98f78caa
2023-05-23 18:30:05 +09:00
Chalard Jean
16e41d130c Test for not logging meaningless caps changes
Test: this
Change-Id: Ife6500daae58b7f85a7f4c76cd89ce91def5e78c
2023-05-23 18:30:04 +09:00
Treehugger Robot
8a401c79dc Merge "use java/lang/IllegalArgumentException for pid <= 0" 2023-05-23 08:35:17 +00:00
Treehugger Robot
ae6302156d Merge "Skip all of NetworkAgentTest in instant mode." 2023-05-23 08:18:45 +00:00
Jean Chalard
cf83d376bc Revert "Suppress lint for methods using APIs promoted from system to public"
This reverts commit 73f6948915.

Reason for revert: The bug that necessitated this workaround has been addressed.

Change-Id: Idac3903df029e841bde6c57c9d453b56760d2553
Test: TH
2023-05-23 07:47:35 +00:00
Chiachang Wang
95336cf4fc Merge "DO not throw exception for ERROR_NO_SUCH_SLOT error" 2023-05-23 07:13:52 +00:00
Maciej Żenczykowski
d50e816e0f use java/lang/IllegalArgumentException for pid <= 0
per Lorenzo's request on

https://android-review.git.corp.google.com/c/platform/packages/modules/Connectivity/+/2563471

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2b3e28073bcfd7341bb3ad29471b69c830f81d95
2023-05-23 07:10:49 +00:00
Lorenzo Colitti
f1a61ad83d Skip all of NetworkAgentTest in instant mode.
Recently, new test methods were added to NetworkAgentTest which
fail in instant mode because they are not marked @AppModeFull.

Because instant apps can't use NetworkAgent (it's a system API,
and it needs the NETWORK_FACTORY permission which is signature
only), just mark the whole test @AppModeFull so this cannot
happen again.

Bug: 283897713
Test: test is skipped in instant mode
Change-Id: Ib6ff07d9fdc329d3421a077532b8a434323053f8
2023-05-23 16:01:42 +09:00
Treehugger Robot
7be7f06fc4 Merge "Use "don't actively prefer" timeout when avoiding bad wifi" 2023-05-23 06:47:18 +00:00
chiachangwang
75673ba502 DO not throw exception for ERROR_NO_SUCH_SLOT error
There are multiple independent reasons a keepalive can stop. Some
are software (e.g. the app stops the keepalive) and some are hardware
(e.g. the SIM card gets removed). Therefore, there is a very low
probability that both of these happen at the same time, which would
result in the first stop attempt returning SUCCESS and the second
stop attempt returning NO_SUCH_SLOT. Such a race condition can be
ignored with a log, not to crash the system. Change to wtf log so
that the issue could still be visible since this implies possible
bugs in the system.

Also update the javadoc for SocketKeepalive.ERROR_NO_SUCH_SLOT.

Bug: 281484381
Test: atest FrameworksNetTests
Change-Id: I316a2193fc7302b04e074ff0b03dc43946fe5ce6
2023-05-23 05:08:45 +00:00
Chalard Jean
6f6c353baf Use "don't actively prefer" timeout when avoiding bad wifi
Test: ConnectivityServiceTest
Change-Id: I6e99aff77c55805630d878e472f466bd31bba360
2023-05-23 13:47:15 +09:00
Treehugger Robot
b92d8ccd39 Merge "Improve doc for CSM#setGlobalProxy" 2023-05-23 04:04:45 +00:00
Remi NGUYEN VAN
bf7a24833f Merge "Add test for subtype discovery/advertising" 2023-05-23 02:36:07 +00:00
Maciej Żenczykowski
bc37a4b004 Merge "deflake android.net.cts.NetworkStatsManagerTest#testUidTagStateDetails" 2023-05-22 17:46:26 +00:00
Maciej Żenczykowski
b41a94db3c deflake android.net.cts.NetworkStatsManagerTest#testUidTagStateDetails
Observed failure in manual run on aosp/master cuttlefish:

[759/913] android.net.cts.NetworkStatsManagerTest#testUidTagStateDetails: FAILED (710ms)

STACKTRACE:
java.lang.AssertionError: QueryResult(tag=TAG_NONE state=STATE_FOREGROUND total=256756): 256756 not within 10% of 231272
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.assertTrue(Assert.java:42)
        at android.net.cts.NetworkStatsManagerTest.assertWithinPercentage(NetworkStatsManagerTest.java:743)
        at android.net.cts.NetworkStatsManagerTest.testUidTagStateDetails(NetworkStatsManagerTest.java:802)

256756 / 231272 =~= 1.11019  -->  just over 11% deviation.

Test: TreeHugger
Bug: 283166618
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie9af706e4f84065050188b1c9b697cccd8509c32
2023-05-22 17:46:19 +00:00
Maciej Żenczykowski
9fb415a7c0 Merge "netd.c: simplify impossible code path" 2023-05-22 17:44:16 +00:00
Maciej Żenczykowski
ab35e1d453 Merge "netd.c - cleanup AID_CLAT handling" 2023-05-22 17:42:49 +00:00
Treehugger Robot
c27b04314d Merge "Delete the LinkAddress in cache when RTM_DELADDR is received" 2023-05-22 10:28:05 +00:00
Yuyang Huang
9d778c7fe7 Delete the LinkAddress in cache when RTM_DELADDR is received
The addOrUpdateInterfaceAddress() should be called when RTM_NEWADDR
message is received and the address isPreferred. The
deleteInterfaceAddress() should be called when RTM_DELADDR is called.

Bug: 282592527
Test: atest MdnsSocketProviderTest
Change-Id: I06a5940f53d01552f117309b1cc09256a2a9fae7
2023-05-22 17:17:27 +09:00
Chiachang Wang
696a2013f5 Merge "Clear caller identity in IPC methods" 2023-05-22 07:04:16 +00:00
chiachangwang
c9c3853e59 Clear caller identity in IPC methods
A utility method should not be responsible for clearing the
caller identity. Clearing caller identity should happen in
methods that process binder IPCs, not general utility methods.

Update it to clear in each method.

Bug: 279381469
Test: atest FrameworksNetTests
Change-Id: I95b520fb0d7851ec3e14fbd16044d5f877c74561
2023-05-22 07:00:58 +00:00
Remi NGUYEN VAN
eae8529fc6 Add test for subtype discovery/advertising
Check that advertised subtypes can be found by matching discoveries and
discoveries for the base type, and that discoveries for different
subtypes do not find the service.

Bug: 266167702
Test: atest
Change-Id: I0a8249cca22c1d30baad12bb4e8351a65ce87cb1
2023-05-22 15:26:40 +09:00
Remi NGUYEN VAN
404c1bf787 Use the ServiceTypeClient network for queries
Instead of the network specified in the MdnsSearchOptions, which is
often null to request searching on all networks, use the
MdnsServiceTypeClient Network to build the queries.

When MdnsSearchOptions.network is null, one MdnsServiceTypeClient is
created for each mDNS-compatible Network. Each MdnsServiceTypeClient
schedules queries with a Network selector. If the Network selector is
null, each MdnsServiceTypeClient will post its queries to all networks.
Instead, it should be the Network of the MdnsServiceTypeClient.

There is one remaining problem when a tethered interface is up: in that
case, there will be one MdnsServiceTypeClient for tethered interfaces
with a null network, which will still broadcast its queries to all
networks. This should be addressed in a follow-up by having
MdnsMultinetworkSocketClient only send queries to interfaces that have a
null network, when the network selector is null (and not all
interfaces).

Bug: 283708537
Test: atest
Change-Id: If571d7a59c5e55d809eeb1f3d1c4b58684612cdd
2023-05-22 14:49:59 +09:00
Treehugger Robot
78e158f2bb Merge "LinkProperties: use ordered comparison for P-CSCFs - only on U+" 2023-05-22 04:40:48 +00:00
Maciej Żenczykowski
83dde6b40a netd.c - cleanup AID_CLAT handling
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie2fab051f3d923b3dd2be09d82c3cf47e91f6224
2023-05-20 17:25:49 +00:00