Also update the test to ensure mFactory.hasInterface is mocked to match
mFactory.getInterfaceState: previously it would be called by the factory
in the mocked getInterfaceState, but the new code calls it directly.
Bug: 171872016
Test: atest EthernetManagerTest
Change-Id: I9ac959f181c88a7992991923b98a836f2833fa88
The test cannot pass in branches that use an old prebuilt tethering
module.
Bug: 234099453
Test: atest NetworkStatsServiceTest
Merged-In: Ib1d180cc799dde94ada642ce752623b4b65f1e31
Merged-In: I44dda14cae265e600010c6f8efe1471ac481c6ea
Merged-In: I702a75e91be0bb582f9cbd7b4a23e1286f8252cf
Change-Id: I7ce44dac1b5d730f84f882ba8ae1b741a633e765
In current design, the interface will be removed from the list if
the network disconnected which will cause getUidStatsForTransport()
returns unexpected snapshot to caller since the list is empty.
This change also remove interface name from all entries before
the method returns the result.
Ignore-AOSP-First: non-AOSP CL is included in the same topic
Bug: 231514741
Test: FrameworksNetTests
manual test
Change-Id: Ie60829a65d0d9b5b63ad353695a820c0586e3665
- Make the file descriptor clean up better when an error happens.
- Remove unused TODO for iptables because it has been
implemented by another approach. See b/218407445.
Test: atest com.android.server.connectivity.ClatCoordinatorTest
Change-Id: Ib8bfa8875ae774769ab7e416fa7e5fde140f58da
The unit tests cannot pass before a newer prebuilt of Tethering is used,
as bootclasspath classes that it tests would be outdated.
This change is not merged in downstreams that build from source (changes
in the merged-in tags are not related changes, however).
Bug: 234099453
Test: atest
Merged-In: Ib1d180cc799dde94ada642ce752623b4b65f1e31
Merged-In: I44dda14cae265e600010c6f8efe1471ac481c6ea
Merged-In: I702a75e91be0bb582f9cbd7b4a23e1286f8252cf
Change-Id: I5b0cb131fcb5feb6b3cfd70e95ba7c5e54fa2294
Used to increase mainline test code coverage for startClat()
which has bunches of code for unwinding the native method failure.
For now, code coverage for startClat(): 51.89% (55/106 lines)
Test: atest com.android.server.connectivity.ClatCoordinatorTest
Change-Id: I398d5863359ff329b06966488053edd9006f17aa
Used for verifying the dump content and increasing test coverage.
The test coverage for now:
dump: 0% (0/7 lines)
dumpBpfEgress: 0% (0/13 lines)
dumpBpfIngress: 0% (0/13 lines)
Test: atest com.android.server.connectivity.ClatCoordinatorTest
Change-Id: I5e444e95d50f7ca266555139b3639723773fd83d
Add new testcase in IpConfigStoreTest to cover the readIpConfiguration
usage, improve the code coverage for connectivity module.
To reduce the flakyness of test, this cl refactors DelayedDiskWriter
constructors by allowing to pass in a Dependencies instance, then
waitForIdle can be used to check if the delayed write operation
associated with the passed-in HandlerThread has completed in tests.
Bug: 234315786
Test: atest com.android.server.net.IpConfigStoreTest
Change-Id: I57c8bd02a771f1cca815252ba502cda0210d1385
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
(cherry picked from commit 1a8ee102d3)
Merged-In: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a
* 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.
In internalGetSummaryForNetwork, the history object will not
include the latest bucket because of the logic in
NetworkStatsHistory#recordHistory would only include buckets
that atomically occur in the inclusive time range.
This makes querySummaryForDevice callers who are also sensitive
to the latest bucket fails.
This CL revert the behavior back to S, in T this is temporarily
changed after aosp/1937268.
Also, for test purpose, this CL change System.currentTimeMillis to
use mClock when querying.
Ignore-AOSP-First: Urgent fix
Test: NetworkStatsServiceTest#testGetLatestSummary
Bug: 233733267
Change-Id: I55e2a5d953622b68da36a9b8d3e57c88d57543b0
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
This CL adds unit test to test onThresholdReached event
would unregister and re-register usage callback.
Ignore-AOSP-First: Urgent fix
Test: MultipathPolicyTrackerTest#testOnThresholdReached
Bug: 233733267
Change-Id: I6e43ae93055009d91b0795a4466f2c02f4403c0a
When unregistering, if the caller process is dead. The system
can unregsiter for the caller. But the request decrement should
be counted onto the caller uid instead of system uid.
Test: NetworkStatsObserversTest#testUnregister_knownRequest_invalidUid_doesNotUnregister
Bug: 233580307
Change-Id: I85aee8f395739929bc7086883ace81ac1ecd0730
Merged-In: I85aee8f395739929bc7086883ace81ac1ecd0730
(pure cherry-picked from ag/18579047)
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
* changes:
Temporarily ignore ethernet tests until prebuilts are updated
Add CTS tests for EthernetNetworkProvider changes
Move EthernetNetworkFactory to using the NetworkProvider API
Add NetworkOfferCallback to NetworkInterfaceState
Change NetworkInterfaceState to hold NetworkProvider instance
Improve waiting for interface added or removed
Always wait for interface to be up in EthernetManagerTest
Assume all Ethernet interfaces have an MTU of 1500.
Using Merged-In line of commit that adds the CTS tests to prevent this
change from going anywhere it should not.
Unfortunately, the test runner does not properly parse tests ignored at
the class level.
Test: TH
Bug: 233824546
Ignore-AOSP-First: only needed on tm-dev
Change-Id: Ia911cdfc39614ccda5f2cf8bfd1d913cf80a60ae
Merged-In: I8e806b3b884f2e0b6c1a1d2fffdb9a99c5dd60e8
This CL makes EthernetNetworkFactory inherit from NetworkProvider rather
than NetworkFactory. The name of the class is purposefully unchanged to
make the code review easier (it will be changed to
EthernetNetworkProvider in a follow up).
As part of the conversion, NetworkInterfaceState now registers a
NetworkOffer when the link comes up and unregisters it when the link
goes down. It updates the existing offer when capabilities change (by
calling registerNetworkOffer with an already registered
NetworkOfferCallback).
This change should fix existing refCount issues. When a NetworkOffer is
first registered, it receives callbacks for all existing requests. This
is the main problem with the NetworkFactory implementation where only
one NetworkOffer is registered when the factory is first created; so
when interfaces come up, they do not receive callbacks for existing
requests.
Test: atest EthernetNetworkTest
Bug: 197548738
Change-Id: I5e8e4673d2ed04bc1a0c8d232a8772edfff65b5d
Merged-In: I5e8e4673d2ed04bc1a0c8d232a8772edfff65b5d
When unregistering, if the caller process is dead. The system
can unregsiter for the caller. But the request decrement should
be counted onto the caller uid instead of system uid.
Ignore-AOSP-First: Urgent fix
Test: NetworkStatsObserversTest#testUnregister_knownRequest_invalidUid_doesNotUnregister
Bug: 233580307
Change-Id: I85aee8f395739929bc7086883ace81ac1ecd0730
Lockdown filtering rule and interface filtering rule with null interface
were introduced to T+ devices.
So, skip related tests in pre-T devices.
Bug: 232902954
Test: atest ConnectivityServiceTest
Change-Id: I9ee76096c1bd04c9333bc561ffc8064a14780ce5
Allow calling enable/disableInterface on non-automotive devices. Also,
fixing the naming of these functions to be consistent with the API.
Test: atest EthernetManagerTest
Bug: 171872016
Bug: 225317990
Change-Id: Ic20185a855d0e639582132bf1103e0183f6f78c3