* changes:
Add CTS tests for EthernetNetworkProvider changes
Move EthernetNetworkFactory to using the NetworkProvider API
Improve waiting for interface added or removed
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
This CL also stop from incresing "successes" counter if the
importer finishes with fallback.
Ignore-AOSP-First: in a topic with internal-only changes
Test: manual
Bug: 230289468
Change-Id: I88fce1b2d0dea3772a8b31df8f8fa93bf13bffad
Improve the setUnderlyingNetwork method by throwing IAE
when Network's LinkProperties is null. Also update the
API doc to give caller more guidance in using this API
Bug: 232309601
Test: UT: IpSecServiceParameterizedTest, IpSecServiceTest,
IpSecServiceRefcountedResourceTest, IpSecManagerTest, VpnTest
Test: CTS: IpSecManagerTest, IpSecManagerTunnelTest, Ikev2VpnTest
Test: make doc-comment-check-docs
Change-Id: Idab4706b0db42ed2222fb48b168589ed005d2f2f
In order to support rollbacks, the ethernet ipconfig file needs to be
written to the data apex's data directory. We still need to support
reading from the legacy location to be backwards compatible.
If the apex file path already exists, then read the IP configuration
from there directly, otherwise, check if the legacy file path exists,
if yes, read the legacy IP configuration and copy it to the new apex
file path.
Support for default IpConfiguration is also being removed in this CL.
The default IpConfiguration (configuration entry for interface "0")
was a way to transition from supporting a single interface to
supporting multiple interfaces and was introduced in P. Every device
that has used such a configuration and has connected to an ethernet
network since upgrading to P+ has already removed the "0" config and
has assigned it to the first interface (probably "eth0"). There has
never been an API to set this, but if someone wanted to install a
default IpConfiguration, they could just configure "eth0" instead.
Bug: 224919694
Test: atest EthernetConfigStoreTest --iterations
Test: manually test
- adb push <fake ipconfig.txt> /data/misc/ethernet/
- adb reboot
- read the IP config from legacy path and the same config
file is created in the apex file path
- adb reboot
- read the IP config from the apex file path directly
Change-Id: Ifb82a5d7fa13d17ea8fd3a42a19cd020cb95e26a
(cherry picked from commit 47641d75d9)
Merged-In: Ifb82a5d7fa13d17ea8fd3a42a19cd020cb95e26a
In order to support rollbacks, the ethernet ipconfig file needs to be
written to the data apex's data directory. We still need to support
reading from the legacy location to be backwards compatible.
If the apex file path already exists, then read the IP configuration
from there directly, otherwise, check if the legacy file path exists,
if yes, read the legacy IP configuration and copy it to the new apex
file path.
Support for default IpConfiguration is also being removed in this CL.
The default IpConfiguration (configuration entry for interface "0")
was a way to transition from supporting a single interface to
supporting multiple interfaces and was introduced in P. Every device
that has used such a configuration and has connected to an ethernet
network since upgrading to P+ has already removed the "0" config and
has assigned it to the first interface (probably "eth0"). There has
never been an API to set this, but if someone wanted to install a
default IpConfiguration, they could just configure "eth0" instead.
Bug: 224919694
Test: atest EthernetConfigStoreTest --iterations
Test: manually test
- adb push <fake ipconfig.txt> /data/misc/ethernet/
- adb reboot
- read the IP config from legacy path and the same config
file is created in the apex file path
- adb reboot
- read the IP config from the apex file path directly
Change-Id: Ifb82a5d7fa13d17ea8fd3a42a19cd020cb95e26a
Updating the automotive allowed UIDs check to only work if the
capabilities have a single transport equal to ethernet.
CP of https://r.android.com/2101472
Bug: 229419469
Test: atest FrameworksNetTests
Change-Id: I91e987d6b943a3c5986ab88553a6eef0d479b079
Merged-In: I91e987d6b943a3c5986ab88553a6eef0d479b079
* 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.
Allow ethernet factories on automotive devices to set the allowed UIDs
on NetworkCapabilities.
CP of https://r.android.com/2072767
Bug: 229419469
Test: atest FrameworksNetTests
Change-Id: I03e7cda75f1c530e0d0e4a756330bc9847a96668
Merged-In: I03e7cda75f1c530e0d0e4a756330bc9847a96668
This class is only used in the service runs on T+ devices.
Thus run this test on S- device does not make senses.
Ignore-AOSP-First: in a topic with internal-only changes
Bug: 230289468
Test: atest ConnectivityCoverageTests:PersistentIntTest
on S device
Change-Id: I97a29df17ef9ee9ab373655f045cdb5c820e06ef
Updating the automotive allowed UIDs check to only work if the
capabilities have a single transport equal to ethernet.
Bug: 229419469
Test: atest FrameworksNetTests
Change-Id: I91e987d6b943a3c5986ab88553a6eef0d479b079
After turning off the ethernet settings via api, the ethernet service
can still be started when plugging-in the cable. Improve the api by
ignoring the upcoming interface unsolicited event listener callbacks
and register new interface observer once the ethernet setting is enabled
again.
Bug: 231933028
Test: atest testListenEthernetStateChange_unsolicitedEventListener
Change-Id: I1b1cb7d157f023fca82d75592168bd360a6fa6e1
(cherry picked from commit 94a00dfc64)
Merged-In: I1b1cb7d157f023fca82d75592168bd360a6fa6e1
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.
Ignore-AOSP-First: in a topic with internal-only changes
Bug: 230289468
Test: manually verified this unbreaks the importer
Change-Id: Ic8647ff28fca78d579d5f759f96a864877f8158b
Read migration snapshot both from the platform API and the legacy
method, and Log.wtf if they are different. Use the legacy method data if
they are.
This ensures that using the migration API is a no-op, and that errors
are reported (through Log.wtf) if it would not have been if used as-is.
Ignore-AOSP-First: in a topic with internal-only changes
Test: NetworkStatsServiceTest
Bug: 230289468
Change-Id: I857ad18183d63d1aa16e89f89eb24009648720a2
This includes:
1. Provide NetworkStatsRecorder#importCollectionLocked to
allow caller to write a NetworkStatsCollection object to
a standalone file.
2. Do not clear the collection in NetworkStatsRecorder#
CombiningRewriter, this is safe since pending set will
still be cleared during forcePersistLocked.
3. Implement the migration process, including recovery and
safety measures.
Test: NetworkStatsServiceTest NetworkStatsCollectionTest
Test: manual test with
adb shell device_config put tethering \
netstats_store_files_in_apexdata true
adb shell device_config put tethering \
netstats_import_legacy_target_attempts 1
Ignore-AOSP-First: in a topic with internal-only changes
Bug: 230289468
Change-Id: Ic2002cbfd5a6b3c2226fa8dab22481f8ce656574
This implements a simple integer written to disk backed by
AtomicFile.
Bug: 230289468
Test: new unit test
Ignore-AOSP-First: in a topic with internal-only changes
Change-Id: I1c73c8ac2429f92153cfba3b006b4374e75e65df
After turning off the ethernet settings via api, the ethernet service
can still be started when plugging-in the cable. Improve the api by
ignoring the upcoming interface unsolicited event listener callbacks
and register new interface observer once the ethernet setting is enabled
again.
Bug: 231933028
Test: atest testListenEthernetStateChange_unsolicitedEventListener
Change-Id: I1b1cb7d157f023fca82d75592168bd360a6fa6e1
Allow ethernet factories on automotive devices to set the allowed UIDs
on NetworkCapabilities.
Bug: 229419469
Test: atest FrameworksNetTests
Change-Id: I03e7cda75f1c530e0d0e4a756330bc9847a96668
Currently, even when VPN Lockdown mode is enabled, incoming packets are
not dropped if VPN is not connected.
This commit fixed this issue.
After this commit, If VPN Lockdown mode is enabled, incoming packets
are dropped regardless of the VPN connectivity.
Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest PermissionMonitorTest
Change-Id: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d
(cherry picked from commit b08654ca04)
Merged-In: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d
Currently, even when VPN Lockdown mode is enabled, incoming packets are
not dropped if VPN is not connected.
This commit fixed this issue.
After this commit, If VPN Lockdown mode is enabled, incoming packets
are dropped regardless of the VPN connectivity.
Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest PermissionMonitorTest
Change-Id: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d
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
(cherry picked from commit 306a00316c)
Merged-In: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c
Currently, there is no limtation for an app to request
data usage callback, which is dangerous if the app fire
hundreds of thousands requests and potientially this might
cause OOM if the apps don't free them.
Test: atest NetworkStatsObserversTest#testRegister_limit
Bug: 229103088
Change-Id: I8299f46fd47a82ec9b25ba2e0d3c95db5512c331
(cherry picked from commit f3c946278c)
Merged-In: I8299f46fd47a82ec9b25ba2e0d3c95db5512c331
This is a follow-up commit from aosp/2076483. Mainly to update:
1. Update the hex string to human understandable code instead of
byte code.
2. Use IgnoreUpTo() to do the SDK check
3. Avoid relying on the code being tested
Bug: 192078259
Test: atest FrameworksNetTests
Change-Id: I8973d248a1d30fdcb597677dbf051e146041f905
(cherry picked from commit a023f88193)
Merged-In: I8973d248a1d30fdcb597677dbf051e146041f905