Commit graph android_packages_modules_Co.../tests/unit/java/android
Message SHA1
Merge "[MS59.2] Add unit test for NetworkStatsDataMigrationUtils"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-01-27 09:20:10 +00:00
bfdd0f3c3c
[MS59.2] Add unit test for NetworkStatsDataMigrationUtils
Test: atest NetworkStatsDataMigrationUtilsTest
Bug: 204830222
Change-Id: Ia6e8aec9a828072a2a1e63bec600c2e20d3699b3

junyulai   authored and   Junyu Lai   commited 2022-01-26 16:53:06 +00:00
a1bb3a36cd
Change NETWORK_TYPE_5G_NSA reference package
NETWORK_TYPE_5G_NSA is moved to NetworkStatsManager

Bug: 210073043
Test: builds, FrameworksNetTests
Change-Id: I9226119ee4f67688a1b4ffdab7e5a86ec0b8e974

Aaron Huang   commited 2022-01-26 23:41:17 +08:00
b4ce0fa9b1
[MS78.2] Fix NetworkIdentity#Builder crashing on 5G NSA networks
Test: atest NetworkIdentityTest
Fix: 216193400
Change-Id: I00abc97a98dfdf17d5f0c2e6b45d28be9899c5c3

Junyu Lai   commited 2022-01-26 07:53:57 +00:00
30f06afda3
[DU09-1]Adding the NetworkStatsCollection Builder
The purpose is provide NetworkStatsCollection.Builder as
public API for adding the stats {@link NetworkStatsHistory}

Bug: 215862801
Test: atest NetworkStatsCollectionTest
Change-Id: Id83c6fa67880ba361b8e0e15c4d86b90e44ac879

Frank   commited 2022-01-25 19:43:23 +08:00
c8856596c5
[MS56.2] Add unit test for NetworkStatsHistory#Builder
Test: atest NetworkStatsHistoryTest#testBuilder
Bug: 204830222
Change-Id: Id876340bcab7290d5e191dbdfcce7fb4d8ecf96c

Junyu Lai   authored and   junyulai   commited 2022-01-23 20:52:31 +08:00
6d95db48d0
[MS65.4] Address comments at aosp/1954383
Test: atest NetworkIdentityTest#testBuilder
Bug: 204830222
Change-Id: I3d0f8175ee782c76839cbbdb5eb8a1219a61d874

Junyu Lai   authored and   junyulai   commited 2022-01-23 20:52:31 +08:00
84413a92c3
wifi data usage: Update calling API name
Bug: 213387087
Test: atest -c NetworkTemplateTest
Test: atest -c NetworkStatsServiceTest
Test: atest -c FrameworksWifiApiTests
Test: atest -c NetworkPolicyManagerServiceTest
Change-Id: I6f65af5e2ff121a2fe5b2429d3eead01e434f8be
Merged-In: I6f65af5e2ff121a2fe5b2429d3eead01e434f8be

Les Lee   commited 2022-01-23 00:07:02 +08:00
c71f2d7425
Merge "[MS65.2] Add unit test of NetworkIdentity#Builder"
Junyu Lai   authored and   Gerrit Code Review   commited 2022-01-21 09:36:08 +00:00
7f3f9c1be0
Merge "Update the SDK for the tests with intended target in T+"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-01-21 06:34:29 +00:00
b04664d7a6
[MS65.2] Add unit test of NetworkIdentity#Builder
Test: atest NetworkIdentityTest#testBuilder
Bug: 204830222
Change-Id: Ie0d56821608c881c3bffe224cfe240fa900c6f39

Junyu Lai   commited 2022-01-20 15:58:30 +00:00
e9c4988632
[MS57.2] Prepare APIs for data migration utility
Test: atest NetworkStatsHistoryTest#testBuilder
Bug: 204830222
Change-Id: I938c3ed50eea0f2349ea92c3824c637eaa77d328

Junyu Lai   commited 2022-01-20 15:06:50 +00:00
56f4a9c3d1
[MS41.2] Add unit test for query history APIs
Test: atest NetworkStatsServiceTest NetworkStatsManagerTest
Bug: 204830222
Bug: 200768422
Change-Id: I1dce7d671c5524496e0451665f62447ef6e454ae

Junyu Lai   commited 2022-01-20 15:06:50 +00:00
7372824eca
Update the SDK for the tests with intended target in T+
Correct the SDK for those tests are expected running in T+
device. Check @IgnoreUpTo(S) may be incorrect after receiving
patches before T release.

Refer to temporary constant definition in DevSdkIgnoreRule until
the SDK constant being pushed into AOSP and synced with branch
used for mainline.

BUg: 215294242
Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk
Change-Id: Ide6a241f7944dd1e75bc33b21aa29471a5df94c6

Chiachang Wang   commited 2022-01-20 10:30:19 +08:00
7212fbee14
Add unit test for NetworkStats iterator
Bug: 210073043
Test: this
Change-Id: I2bcd80627c31e94ac040dbb4e7d38561d8f4c229

Aaron Huang   commited 2022-01-19 17:10:44 +08:00
2ae5921bc8
Add missing DevSdkIgnoreRule rule variable
DevSdkIgnoreRule.IgnoreUpTo() will not work as expected without
the rule defined.

Bug: 184750836
Test: atest android.net.Ikev2VpnProfileTest#\
      testBuildExcludeLocalRoutesSet works as expected with ignore
      rule
Change-Id: I03a5b28963cd6feebe4358d57c070d941cd114e5

Chiachang Wang   commited 2022-01-18 11:25:03 +00:00
af7c44cc4e
Merge "Use getter methods to verify the fields of Entry"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-01-17 09:31:55 +00:00
63b5da9866
[MS44.2] Add unit test for API to query tagged UID summary
Test: atest NetworkStatsManagerTest
Bug: 204830222
Change-Id: I0b712141b7c644205bba3a98ebf39803f0d05306

Junyu Lai   commited 2022-01-12 14:07:02 +00:00
7ef0a17544
Use getter methods to verify the fields of Entry
Bug: 210073043
Bug: 204830222
Test: FrameworksNetTests
Change-Id: I1ade9113e9367a85b7c200c8f52d8ff3ffc14770

Aaron Huang   commited 2022-01-11 18:16:27 +08:00
c448b73a22
Add test for setting excludeLocalRoutes
Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I4e79467ce7afcf07f4b8d7f964a605703a6d2c5e

Chiachang Wang   commited 2022-01-07 09:39:43 +08:00
b4a319bf24
Merge "[MS25.2] Remove AppOpsManager.OP_GET_USAGE_STATS dependency"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-01-03 22:41:30 +00:00
90cf8dbd92
Merge "wifi data usage: replaced Wi-Fi SSID with a Wi-Fi network key"
Les Lee   authored and   Gerrit Code Review   commited 2022-01-03 12:36:49 +00:00
719ce67677
wifi data usage: replaced Wi-Fi SSID with a Wi-Fi network key
1. Used SSID to be a wifi network identity can't separate wifi
data usage when there are two different network with same SSID.
Use a new usage key from in WifiInfo to replace wifi SSID to
solve this issue.

2. To support to query wifi usage per configured Wifi network.
Adding matchWifiNetworkKeys in NetworkTemplate to support querying
multi networkKeys wifi data usage since each configured Wifi
network configuration might be used to connect different Wifi
network.

a. Replaced wording SSID with key of the wifi network
b. Add mock to handle get wifi network key from WifiInfo
c. Add null/empty set unit test to verify matchWifiNetworkKeys

Bug: 197520752
Bug: 126299427
Test: atest -c NetworkTemplateTest
Test: atest -c NetworkStatsServiceTest
Test: atest -c NetworkPolicyManagerServiceTest
Change-Id: Id7d66f6548dd1b4e657db8d7427213293618b406

Les Lee   commited 2022-01-03 15:13:45 +08:00
c728c36ca7
[MS25.2] Remove AppOpsManager.OP_GET_USAGE_STATS dependency
Replaced by public interface.

Test: TH
Bug: 204830222
Change-Id: I1071bcaa74429885165d9dc8d1b02a1c1c48c685

Junyu Lai   commited 2021-12-28 10:00:43 +00:00
9051e66b22
[MS26.2] Remove Process.NETWORK_STACK_UID dependency
Check NetworkStack permission instead.

Test: NetworkStatsAccessTest
Bug: 20483022
Change-Id: Ie345cfa7dec8e001246efec8a27a1dc67a5c989c

Junyu Lai   commited 2021-12-28 10:00:43 +00:00
289db92ba4
Merge "[MS15.2] Move SUBSCRIBER_ID_MATCH_RULE_* constants to static lib"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-12-23 01:35:00 +00:00
78d36d7653
Merge "[DU02]Remove DevicePolicyManagerInternal from NetworkStatsAccess"
Frank Li   authored and   Gerrit Code Review   commited 2021-12-22 14:13:55 +00:00
bacbe802c1
[MS15.2] Move SUBSCRIBER_ID_MATCH_RULE_* constants to static lib
Subscriber Id Match Rules won't be exposed as system Api.
Any caller who references NetworkTemplate#SUBSCRIBER_ID_MATCH_RULE_*
should use the one in NetworkStatsUtils instead.
And remove the need of the constants as soon as possible.

Test: atest NetworkPolicyManagerServiceTest \
      FrameworksNetTests
Bug: 204830222
Change-Id: I363a4440f85f1ca818eaf1125e45b141dd6f0e55

Junyu Lai   commited 2021-12-22 09:41:29 +00:00
07c772cf49
[DU02]Remove DevicePolicyManagerInternal from NetworkStatsAccess
NetworkStatsAccess is using DevicePolicyManagerInternal APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 207100745
Test: atest NetworkStatsAccessTest
Change-Id: I0430ed2c47e5a695206cb660e3971ddab6c467dd

lifr   commited 2021-12-21 23:45:28 +08:00
5f66ddac71
[MS12.2] Add unit test for NetworkTemplate builder
Test: atest NetworkTemplateTest
Bug: 204830222
Change-Id: Ie83cd4322418449980bece7e13d68f2cacbaf1ef

Junyu Lai   commited 2021-12-21 03:26:04 +00:00
00a8897e98
[MS10.2] Move multiplySafeByRational to NetworkStatsUtils
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.NetworkStatsUtilsTest
Bug: 204830222
Change-Id: Ib2464bd7607c7ef35fed780fccbc745b565a908c

Junyu Lai   commited 2021-12-20 09:10:50 +00:00
b3e62b8d1d
[MS07.2] Move NetworkStatsCollection/IdentitySet into frameworks
These files are needed for the data migration util system Api
interfaces. Thus, they need to be moved into frameworks folder.

This change also set the @IgnoreUpTo annotation to S, since
these tests are testing purely platform code on S- devices which
is not really necessary for MTS. Also the tests are still covered
by the unit tests, since they are always verifying HEAD.

Test: TH
Bug: 197717846
Change-Id: I93c19b4860864c724be9f9f889ee2173f4605198

Junyu Lai   commited 2021-12-09 08:43:16 +00:00
e9710f0918
Merge "Update NSD tests without AsyncChannel"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-11-22 05:58:15 +00:00
469d941752
Update NSD tests without AsyncChannel
Update the tests to use the newer NsdManager based on Binder interfaces
instead of AsyncChannel.

Bug: 190249673
Test: atest NsdManagerTest NsdServiceTest
Change-Id: I0991b598331e335a0bc211f010da7f034fb2441b

Remi NGUYEN VAN   commited 2021-11-18 18:22:45 +09:00
cd4b4ee973
Merge "Add test case to test normalize"
Les Lee   authored and   Gerrit Code Review   commited 2021-11-06 00:54:14 +00:00
b5ee639fe0
Add test case to test normalize
Bug: 194939211
Test: atest -c NetworkTemplateTest
Change-Id: I2f5790b9217357ddcf3f466cec1b2b1afbb47210

Les Lee   commited 2021-11-05 16:59:10 +08:00
5299a2b307
Move fromStableParcelable to KeepaliveController
TcpKeepaliveController is the only user of
KeepalivePacketDataUtil.fromStableParcelable. Because of
fromStableParcelable, networkstack-client needs to depend on
net-utils-framework-commonm, which pulls a lot of unnecessary classes.
This is particularly problematic considering that networkstack-client
may need to be redistributed as a prebuilt.

Move the method to TcpKeepaliveController, simplifying dependencies.
This also shows that fromStableParcelable could be removed altogether
(or moved to tests) if TcpKeepaliveController built a
TcpKeepalivePacketData class directly.

Test: atest ConnectivityCoverageTests
Change-Id: I554318f6bcd07c73d153598a0231e9fcaf912e90

Remi NGUYEN VAN   commited 2021-11-01 13:23:27 +09:00
5d99aa78f7
Add a test for NetworkIdentity.getMetered()
NetworkIdentity has adapted NET_CAPABILITY_TEMPORARILY_NOT_METERED
network capability so add a test case for it.

Ignore-AOSP-First: The parent of this change contains a CL will
conflict with internal tree so ignore AOSP first.
Bug: 183776809
Test: this
Change-Id: I2ca2a8b4db664b76a5a5ee82fcff451efd87c8ff

Aaron Huang   commited 2021-10-26 12:16:03 +00:00
eaca5b1982
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

Aaron Huang   commited 2021-10-25 15:22:59 +00:00
6359ebd099
Increase timeouts for loopers
In coverage tests this seems to randomly fail, which suggests
some delay. Have a constant for timeout and increase its value
significantly where it makes no functional difference.

Test: FrameworksNetTests
Change-Id: I035d865f01688daf3bce30c5130ce550fa84b885

Chalard Jean   commited 2021-10-04 18:02:17 +09:00
1afb2e33e2
Remove reference when active listener is unregistered
The registered listeners are added into internal ArrayMap as a
reference but are not removed when the listeners are
unregistered. The actions for registration should be done in
pairs.

Test: atest FrameworksNetTests
Change-Id: Id9e674f5104d1471dd81224b6a271a8a92172e34

Chiachang Wang   commited 2021-09-30 10:30:35 +00:00
2de41686e7
Add test for CM#[add|remove]DefaultNetworkActiveListener
Bug: 199753782
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I2520f7f5feef61502479767aa023e281d1335ee4

Chiachang Wang   commited 2021-09-30 18:29:29 +08:00
859218c893
Merge "Modify Nsd{Service,Manager}Test to conform to its change"
Luke Huang   authored and   Gerrit Code Review   commited 2021-09-29 03:35:20 +00:00
38f82199ab
Test a template matches mobile and mobile wildcard
Add two test cases for matchesMobile and matchesMobileWildcard

Bug: 183776809
Test: FrameworksNetTests:NetworkTemplateTest
Change-Id: I14d31071655204fe6ad36c71f7f521640e01c96e

Aaron Huang   commited 2021-09-14 23:36:04 +08:00
cbb4d498c2
Modify Nsd{Service,Manager}Test to conform to its change
(clean cherry-pick from downstream branch)
Test: atest NsdManagerTest NsdServiceTest
Bug: 191844585
Merged-In: I3cf658498bef5755dcb01127a94fff913b6e6298

Change-Id: I3cf658498bef5755dcb01127a94fff913b6e6298

Luke Huang   authored and   Remi NGUYEN VAN   commited 2021-09-13 10:18:04 +09:00
df75378ad4
Fix IpSecAlgorithmTest on S
The test may be run on S builds older than itself, in which case the
resource ID may not match. Query the resource ID dynamically instead of
using the constant.

IpSecAlgorithm is not updatable in S, which is why it can use
hidden/unstable platform resources, so the test could also be skipped
altogether on S. But considering that keeping it around is not very
costly yet, this change fixes it for running on S.

Bug: 197489543
Test: atest IpSecAlgorithmTest
Change-Id: I533eede3a360a8db9089e65e017b9d7453b35539

Remi NGUYEN VAN   commited 2021-08-25 18:10:22 +09:00
ae7508f9b5
Merge changes from topic "sdk_int_cp"
* changes:
  Fix testSocketKeepaliveLimitTelephony on R
  Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-19 09:47:21 +00:00
800eff01d0
Fix jarjar-related failures in coverage tests
Instead of jarjaring the whole com.android.internal.util package, apply
the jarjar rules per-class. Jarjaring the whole package causes problems
in tests, as for example ConnectivityServiceTest depends on Vpn that
uses other internal utils as hidden API, and these should not be
jarjared.

Also avoid jarjaring INetdUnsolicitedEventListener which is used by
NetdEventListenerServiceTest, and ensure KeepalivePacketDataUtilTest
expects the right package name in toString.

Generally the problems appear because ConnectivityCoverageTests also
includes tests for classes that are not part of the connectivity module,
and use hidden APIs that refer to classes that should not be jarjared.
Some of the tests could be excluded from the coverage suite instead, but
keeping them is helpful for future modularization efforts.

Test: Build service-connectivity, dexdump classes and verify jarjared
      atest ConnectivityCoverageTests
Change-Id: Id6b7e6833d49fa03d9442d7c1c3e4dc16fb48dfc

Remi NGUYEN VAN   commited 2021-07-14 15:22:56 +09:00
ed8efa75b4
Add new network capabilities to support automotive head unit via USB
- Add a new transport type for USB and a new network capability
to support automotive head unit.
- In order to pass DnsManagerTest#testTransportTypesEqual, Android.bp
needs to link to dnsresolver_aidl_interface-V8-java. That test checks
whether the TRANSPORT types defined in NetworkCapabilities are the
same as IDnsResolver.aidl.

(clean cherry-pick of change in downstream branch history, original
change ID before project move:
Iec2df09a776d779108f95098e01b7ffdf6f8867a)

Bug: 181742019
Test: atest FrameworksNetTests

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie438ec68577ebdaaf990795fa27f1169b0105411

lucaslin   authored and   Remi NGUYEN VAN   commited 2021-07-08 09:44:39 +09:00
6f77442d76
Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity
Replace all FIRST_SDK_INT usage in Connectivity because it has
been renamed to DEVICE_INITIAL_SDK_INT.

Bug: 184735771
Test: m CtsNetTestCases
Merged-In: I2f155592b08cdbf259a00b035cacb37ca9847e72
(clean cherry-pick)

Change-Id: I2f155592b08cdbf259a00b035cacb37ca9847e72

paulhu   authored and   Remi NGUYEN VAN   commited 2021-07-05 14:18:26 +09:00
bee1c6d9cd