Commit graph android_packages_modules_Co.../tests/unit/java/android
Message SHA1
Merge "Revert consider TEMPORARILY_NOT_METERED as unmetered in data usage"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-12-02 11:27:27 +00:00
841b1f33d5
Revert consider TEMPORARILY_NOT_METERED as unmetered in data usage
Currently, NET_CAPABILITY_TEMPORARILY_NOT_METERED traffic is
counted as unmetered data usage, and "mobile data usage"
settings screen shows metered data usage which means it doesn't
include TEMPORARILY_NOT_METERED traffic. However, some carriers
show TEMPORARILY_NOT_METERED data usage in customer's bill which
would be confusing if the data usage in the device shows different
results. Thus, revert the change to avoid confusing.

Bug: 183776809
Test: FrameworksNetTests
Change-Id: I4ef25095462adf30b1ecf82134996739f167930d

Aaron Huang   commited 2022-12-02 16:04:55 +08:00
c5a05d1d8f
Make mMatchSubscriberIds as a NonNull variable
In current design, mMatchSubscriberIds can be null which has the
same meaning with empty set, and is not easy to maintain since it
need more checks for this variable when mSubscriberId is null.
Thus make mMatchSubscriberIds NonNull for the maintenance.

Bug: 238843364
Test: build, FrameworksNetTests
Change-Id: I6cfc529b5f4a39ded8598283ff968f2f4d1bc89f

Aaron Huang   commited 2022-11-30 16:38:24 +00:00
859884a48f
Remove unused methods from NetworkTemplate
NetworkTemplate.Builder was introduced in Android T and the callers
outside of Connectivity module should use this Builder to build a
template instead. Thus remove the buildTemplate* methods from
NetworkTemplate class. Also, deprecate the methods which are
annotated with @UnsupportedAppUsage and also use Builder to build
the template.

Bug: 238843364
Test: build, FrameworksNetTests
Change-Id: I3190325f6663e4771edf5c7a19bf5ecc7780bf12

Aaron Huang   commited 2022-11-30 16:38:19 +00:00
a8a6da0db9
Merge "Move VpnTransportInfoTest to common test"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-11-18 05:44:20 +00:00
dfea18945c
Move VpnTransportInfoTest to common test
Move VpnTransportInfoTest to common test to add the cts
coverage.

Annotate @ConnectivityModuleTest so that the test will
not fail with module that is not up-to-date, and use
assertParcelingIsLossless to prevent similar order module
in device case.

Bug: 256775913
Test: atest CtsNetTestCases:android.net.VpnTransportInfoTest
Change-Id: I1c40a4fc42468748d71c3df5c18b2ceb5b3769e1

chiachangwang   commited 2022-11-18 02:17:33 +00:00
91bac1953c
Merge "Expose vpn bypassability in VpnTransportInfo"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-11-15 05:35:08 +00:00
89d4bda742
Merge "Enhance NetworkTemplate test"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-11-14 09:38:27 +00:00
ac28a04c6e
Expose vpn bypassability in VpnTransportInfo
Bug: 256775913
Test: m framework-connectivity.stubs.source.system-update-current-api
Test: m lint-check
Test: atest FrameworksNetTests
Change-Id: I6aaad7b4372aa4f91df4bed89caea674031a6367

chiachangwang   commited 2022-11-11 08:38:17 +00:00
d12d2011cb
ipsec - use ro.vendor.api_level instead of ro.product.first_api_level
Bug: 254143771
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9f91fc250e0fa40c9dc9ee3e7a2f7bc3cf2ebc75

Maciej Żenczykowski   commited 2022-11-09 00:47:13 +00:00
5d78c63662
Enhance NetworkTemplate test
This change addresses comment from aosp/1784390 to improve test

Bug: 200454911
Test: FrameworksNetTests:NetworkTemplateTest#testMobileWildcardMatches
Change-Id: Ia0ac9e44d12e7c9e26cf46adaa26a2e2771947d0

Aaron Huang   commited 2022-11-02 10:41:08 +00:00
fc4236b945
Merge "Make constants static import"
Aaron Huang   authored and   Gerrit Code Review   commited 2022-10-17 04:25:25 +00:00
0c8d808117
Add test for NetworkStats.clearInterfaces
Test: FrameworksNetTests:NetworkStatsTest
Change-Id: Ic8ff1c3213e53a043ebbd3d7ddfeb295a198675d

Aaron Huang   commited 2022-10-12 18:57:43 +00:00
4c3159d3a7
Move MultinetworkPolicyTracker to services, where it belongs.
This is necessary so that MultinetworkPolicyTracker can see
DeviceConfig. It will also allow removing reflection from
this file to address a long-standing TODO.

Test: build
Change-Id: I968bf67e0e0189b01515242371599c02bc9e2ca2

Chalard Jean   commited 2022-09-27 14:10:41 +09:00
43aae65caf
Introduce an overlay for actively preferring bad wifi.
This correctly updates when the mcc/mnc change.

Test: MultinetworkPolicyTrackerTest
Change-Id: I11c7ea7074a15975fb68d39eb3c728778d84a516

Chalard Jean   commited 2022-09-22 16:58:49 +09:00
020b93ac63
Start listening to telephony changes in #start()
Starting to listen on the handler races with the rest of
the constructor. The class already has a #start() method
meant to start listening, so implement better practices
by leveraging this method.

Test: CtsNetTestCases
      FrameworksNetIntegrationTests
      FrameworksNetTests
Change-Id: I772f761d3ca5f9711b9d988e6330b0878814f491

Chalard Jean   commited 2022-09-21 18:07:13 +09:00
f11ed8c699
Verify converting to Vpnprofile with IkeTunnelConnectionParams set
Add test to verify converting Ikev2VpnProfile to Vpnprofile with
IkeTunnelConnectionParams set. Some fields like server should
not be set since the information should contain in the assigned
IkeTunnelConnectionParams.

Bug: 243718982
Test: atest FrameworksNetTests
Change-Id: Ie019ea98932a6d079f213e3bff45f21b44d3fa4e

chiachangwang   commited 2022-09-14 02:38:26 +00:00
4e953f63dd
Make constants static import
Bug: 238843364
Test: FrameworksNetTests
Change-Id: Id88bcc175db0a599dd3205812b1bce78012e2216

Aaron Huang   commited 2022-09-12 06:51:57 +00:00
f4fbf8ed52
Merge "Add test to verify null ProxyInfo in Ikev2VpnProfile"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-09-02 12:15:09 +00:00
ebab250383
Add test to verify null ProxyInfo in Ikev2VpnProfile
Bug: 244281603
Test: atest FrameworksNetTests
Change-Id: Ice195b60a0f62ae541ede9277c6e36f9c72b2dbb

chiachangwang   commited 2022-09-02 03:51:43 +00:00
715dc5b447
[ST01] Attributes data usage of test network by specifier
Currently, data usage of all test networks are all attributed to
the same NetworkIdentity, which does not allow services to
distinguish upload & download traffic of different test networks.

Thus, this CL put specifier that comes along with
TestNetworkAgent into wifiNetworkKey field to build different
NetworkIdentity to attribute data usage to different for
individual networks. And allow querying test network usage with
wifiNetworkKeys.

Bug: 139774492
Test: atest FrameworksNetTests
      atest android.net.cts.ConnectivityManagerTest
Change-Id: I1bb38fd20781eaf3105735440a04b27bef36fcae

Junyu Lai   commited 2022-08-29 13:55:08 +08:00
c9f1ca62d9
Address comments on aosp/1781202
This also imports FunctionalUtils (ex-ExceptionUtils) with
its new name, as the companion change changes the name of
that class.

Test: ConnectivityServiceTest
Change-Id: I3fbc28835419864e536dd6727670328658a9b7cf

Chalard Jean   authored and   Jean Chalard   commited 2022-08-17 07:11:55 +00:00
9cc32051ac
Cleanup constructor of NetworkStats#Entry
Have all callers to use the same constructor and remove the
unused constructors.

Bug: 238843364
Test: FrameworksNetTests
Change-Id: Ieb1d0bc4ff8d2238c7a802189f8d91f4a9978eb8

Aaron Huang   commited 2022-08-02 22:49:16 +08:00
8b9ecdad6d
Add back compat config for NSD
Add back compat config for RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS, which was
lost when moving NsdManager to framework-connectivity-t.

This causes NsdManager to start mdnsresponder again when used by apps
with target SDK < 31.

The change also changes the compat ID used, to make sure it does not
conflict with the ID already in use in S and below, when the module is
installed on such a platform. This is the only ChangeId used by
framework-t.

Also add a CtsNetTestCasesMaxTargetSdk30 test to verify that behavior.

Bug: 235355681
Test: atest CtsNetTestCasesMaxTargetSdk30
Change-Id: I7ca6051d0a4ba5aff3e44bece2cbac22eb1be32d

Remi NGUYEN VAN   commited 2022-07-27 19:53:25 +09:00
348bbb0231
Replace buildTemplate* with NetworkTemplate.Builder
Use Builder API which was provided in Android T to
build a template.

Bug: 238843364
Test: build, FrameworksNetTests:NetworkStatsManagerTest
Change-Id: Ibf1ac16541d6f3ddaf9b241e2f47ae04acbedf93

Aaron Huang   commited 2022-07-18 17:16:49 +08:00
a4fcb8b4cf
Add wipeOnError flag to NetworkStatsRecorder
If reading data happens exception while doing data migration,
the file will be deleted by legacy recorders. This would cause
legacy persistent data being lost and cannot be retrieved by
any method. To avoid the files being deleted, add a wipeOnError
flag to recorder which indicates this recorder will wipe on
error or not . If the flag is set to true then deletes all files
when it throws, otherwise keeps all files.

(cherry-picked from ag/18910973)
Bug: 233828210
Test: FrameworksNetTests:NetworkStatsRecorderTest

Change-Id: Id7a3d8bebf8a00d814f9e84bf4c10d927e6ff749
Merged-In: Id7a3d8bebf8a00d814f9e84bf4c10d927e6ff749

Aaron Huang   commited 2022-06-22 17:37:51 +08:00
80767e64ef
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