Commit graph android_packages_modules_Co.../tests/unit/java/android
Message SHA1
Merge "Fix service resolve on tethering downstreams"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-06-01 05:31:14 +00:00
5eaefa21bf
Merge changes from topic "stats-migration"
* changes:
  Skip PersistentIntTest on S- device
  Don't clobber existing history entries.
  Ensure NetworkStats migrated snapshot is identical
  [MS82.1] Support network stats data migration process
  Add a PersistentInt class.

Natasha Lee   authored and   Gerrit Code Review   commited 2022-06-01 03:03:02 +00:00
bcdb3c12ee
Fix service resolve on tethering downstreams
Tethering downstreams do not have NetworkAgents, and although they have
a netid of 99, Networks with netId 99 are not usable by apps for most
connectivity APIs.

Recent refactoring in NsdService adds the Network of a found service
into its NsdServiceInfo, and uses that network to resolve the service.
In that case the Network has netId 99 and resolving the service fails.

Avoid that problem by:
 - Keeping the Network field null when a service is found on a tethering
   downstream; this avoids giving apps a confusing and unusable Network
   with netId 99
 - Using the interface index found during discovery to resolve the
   service, if the app uses the NsdServiceInfo that was obtained from
   discovery to resolve. If not, all interfaces will be used to resolve,
   as per legacy APIs.

Bug: 233979892
Test: atest NsdServiceTest
      Also manual test with 2 devices connected via hotspot
Change-Id: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a

Remi NGUYEN VAN   commited 2022-05-31 13:06:22 +09:00
1a8ee102d3
Add some non-connectivity-module-test back to ConnectivityCoverageTests
In S, the tests are listed in the non-connectivity-module-test
where their testing files are not in the connectivity module.
But some files move into the connectivity module in T. So some
tests can be removed from non-connectivity-module-test and will
be running on ConnectivityCoverageTests to count their code
coverage.

Also update some tests to make them compatible with
mockito-extended and ignore some tests which need to test with
T apis.

Bug: 234000451
Test: atest FrameworksNetTests ConnectivityCoverageTests
Change-Id: I47fb59334d00ae7fee91c5694548b3cf89b09b2d

Paul Hu   commited 2022-05-27 07:16:46 +00:00
516d5dc0ea
Don't clobber existing history entries.
Currently, adding a history to a NetworkStatsCollection.Builder
will overwrite any history that was previously passed in with the
same key. This breaks the importer (which is the primary/only
caller of this code), because the importer re-uses the same
NetworkStatsCollection object to import multiple files.

Instead, simply add any passed-in entries after the ones that
were already there. Require the caller to pass in entries in
order, because NetworkStatsHistory internally assumes that
entris are always sorted.

Bug: 230289468
Test: manually verified this unbreaks the importer
Change-Id: Ic8647ff28fca78d579d5f759f96a864877f8158b
Merged-In: Ic8647ff28fca78d579d5f759f96a864877f8158b
  (pure cherry-picked from ag/18453213)

Lorenzo Colitti   authored and   Junyu Lai   commited 2022-05-24 11:37:42 +08:00
ec2fbb7159
[MS81] Support remove history before cutoff timestamp
This is needed to ensure corrupted data can be clean up if
the data migration process dones't go well.

Test: NetworkStatsCollectionTest
Bug: 197717846
Change-Id: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c

Junyu Lai   commited 2022-05-12 16:31:39 +08:00
306a00316c
Merge "Support QosCallback with UDP socket. UnitTest"
Sewook Seo   authored and   Gerrit Code Review   commited 2022-05-06 20:47:05 +00:00
baabe211be
Support QosCallback with UDP socket. UnitTest
Adding unit tests to QosSocketFilterTest

Bug: 203146631
Test: atest & verified on LTE test equipment
Change-Id: I0cd82dde0067d754dfab01ed0406370d7debb937

sewookseo   authored and   Sewook Seo   commited 2022-05-05 08:45:00 +00:00
04ced836b8
Merge "Add NetworkTemplateTest to common test for cts coverage"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-05-03 07:01:55 +00:00
132df4ed06
Merge "Fix ConnectivityManager memory leak"
Mark Chien   authored and   Gerrit Code Review   commited 2022-05-03 02:46:05 +00:00
8e3b96b61f
Merge "Add a test to identify memory leak in ConnectivityManager"
Mark Chien   authored and   Gerrit Code Review   commited 2022-05-03 02:43:24 +00:00
15b83ab323
Merge "[MS83] Add Cts for NetworkStatsCollection/History builders"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-05-02 02:26:55 +00:00
6a957c70c0
Fix ConnectivityManager memory leak
ConnectivityManager have a self reference static instance. This
causes a leak if context is refernce from a static variable. Using
the applicationContext, which will never be freed for the life of the
application, for the sInstance static instance.

Bug: 202978965
Test: atest ConnectivityManagerTest
Change-Id: I87206e1bfbb1f877b5a10f5fdbc25e2f9f11bef4

markchien   authored and   Mark Chien   commited 2022-04-29 08:01:23 +00:00
d201566169
Add a test to identify memory leak in ConnectivityManager
The sInstance static instance which self reference to
ConnectivityManager which holds a reference to a ConnectivityManager
instance causes the Context referenced by that instance to never be
GCed.

Bug: 202978965
Test: atest ConnectivityManagerTest
Change-Id: I0227f63dbc27688ea5f4ef9275fd0f9c247ad14c

markchien   commited 2022-04-29 16:00:50 +08:00
ed0fab0356
Merge "Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-04-25 08:44:45 +00:00
2e670756ac
Test Ikev2VpnProfile provisioned with IkeTunnelConnectionParams
Bug: 223841137
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I683f6242e4ed4a469893e3a17fe7b479a7a768e5

chiachangwang   commited 2022-04-21 14:49:41 +08:00
476e2a08bf
Fix NullPointerException happens in dumpCheckin
Currently dumpCheckin passes a null object to create
the contructor of NetworkStatsCollection.Key but the
constructor requires non-null object. Thus, it caused
the NPE in dumpCheckin. To fix this exception, create
an NetworkIdentitySet() object instead of using an
null object.

Bug: 225131008
Bug: 226539404
Test: dumpsys netstats --checkin is fine
      FrameworksNetTests
Change-Id: I7f2dadf0647b3f42e0f667d96291d2ae37e23faf

Aaron Huang   commited 2022-04-19 17:49:30 +08:00
c3a43b4063
Update test for new IkeTunnelConnectionParams field
Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: Iab55eba74b94f295a358c6e8474ebf9230c9b019

Chiachang Wang   commited 2022-03-31 14:45:59 +08:00
69aa988090
Add test for nullable IpConfiguration
Test: atest EthernetNetworkUpdateRequestTest
Change-Id: Ibf565d46cfac0d44976ee6187db7234bb082da41

Patrick Rohr   commited 2022-03-16 20:29:10 +01:00
fb82c3f702
Replace assertParcelSane with assertParcelingIsLossless
Per review comment on aosp/2012897.

Test: atest EthernetNetworkUpdateRequestTest
Change-Id: Ie2f21d821709cc82af9294d70826f153506fda4f

Patrick Rohr   commited 2022-03-16 17:20:36 +01:00
ceae88da2d
Add NetworkTemplateTest to common test for cts coverage
Test for NetworkTemplate.Builder

Bug: 215435701
Test: CtsNetTestCases
Change-Id: I3a55bc74388fa34a142abec308b67b185641c460
Merged-In: I3a55bc74388fa34a142abec308b67b185641c460

Aaron Huang   commited 2022-03-10 14:57:46 +00:00
22999fd87a
[MS83] Add Cts for NetworkStatsCollection/History builders
Test: 1. atest CtsNetTestCases:android.net.netstats.NetworkStatsHistoryTest
 2. atest CtsNetTestCases:android.net.netstats.NetworkStatsCollectionTest
 3. atest FrameworksNetTests
Bug: 218441356
  (cherry-picked from ag/16811190)
Change-Id: If3d45325623cad987aab35f89c55f84042271adf
Merged-In: If3d45325623cad987aab35f89c55f84042271adf

junyulai   commited 2022-03-09 14:14:01 +08:00
08e0130dcb
Add test for EthernetNetworkUpdateRequest
Test: atest EthernetNetworkUpdateRequest
Change-Id: I2aeacca81f07cf2d73814d20fc9e63e9f1a65843

Patrick Rohr   commited 2022-03-08 16:29:43 +01:00
30d33f4ee3
[SUBID01-1]Grow NetworkIdentity to include a new mSubId field
In the previous design of NSS and NPMS, those only had IMSI to identify
the cell network. Now the telephony has created the "subId" handle,
which is the preferred mechanism for identifying subscribers.

This commit adds NetworkStats support for subscriberId as a part of
the network identity key

Bug: 80526261
Test: atest NetworkTemplateTest NetworkStatsCollectionTest
            NetworkStatsServiceTest NetworkIdentityTest
Ignore-AOSP-First: merge conflict resolutions

(cherry-picked from ag/16826535)

Change-Id: I8549b11d0fcfc5a9426724d6b90de27b707cb77c
Merged-In: I8549b11d0fcfc5a9426724d6b90de27b707cb77c

lifr   authored and   Frank   commited 2022-03-01 16:43:28 +08:00
8ba46d804f
Refer to SDK constant defined in DevSdkIgnoreRule
Refer to the same constant definition as other tests instead of
hard coding locally, so that it won't be missed as changing to
Build.VERSION_CODES.SC_V2.

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I3c17c414d830af03e2719c5dab1a664c55f6df2a

Chiachang Wang   commited 2022-02-11 07:40:58 +00:00
137bbed860
Change naming of excludeLocalRoutes
Address API review feedback to change naming of
setExcludedLocalRoutesVpn and getter.

Bug: 217742354
Test: atest FrameworksNetTests
Change-Id: I57bbf55c7aba1c86ec8687d2431a50b37e63c6d0

Chiachang Wang   commited 2022-02-09 15:50:06 +08:00
f890874970
Add APIs for discover/resolve on specific networks
Test that NsdManager specifies the correct network when a service is
discovered, and that services can be resolved on a specified network.
Also test that service discovery can be started on a specific network.

Bug: 190249673
Test: atest NsdManagerTest

Change-Id: Ie8b551ce9e33e3adf35f75508f91bbd0df71f837

Remi NGUYEN VAN   commited 2022-02-03 16:05:02 +09:00
06bdcec9fa
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