getAvailableInterfaces() will return available ethernet
interfaces which are the information about networks. So it should
enforce ACCESS_NETWORK_STATE permission check to ensure the
applications are allowed to access the information.
Bug: 174573778
Test: TetheringTests
Test: CtsTetheringTest
Change-Id: I7aaa5225d56f2feecc51ba263489ed0ce02fd651
- Use public API of StaticIpConfiguration.Builder to set
ipaddress, domains, gateway and dnsServers.
- Use public constructor to create an instance of IpConfiguration
and set IpAssignment, ProxySettings, StaticIpConfiguration and
HttpProxy by public API.
Bug: 182963415
Test: m ethernet-service
Change-Id: Idce8bfe7afc31baa644c816afa1f8004987e8c6e
Merged-In: Idce8bfe7afc31baa644c816afa1f8004987e8c6e
- Use public API of StaticIpConfiguration.Builder to set
ipaddress, domains, gateway and dnsServers.
- Use public constructor to create an instance of IpConfiguration
and set IpAssignment, ProxySettings, StaticIpConfiguration and
HttpProxy by public API.
Bug: 182963415
Test: m ethernet-service
Change-Id: Idce8bfe7afc31baa644c816afa1f8004987e8c6e
Replaced by request.canBesatisfiedBy() to avoid direct reference
of hidden member.
Bug: 182963415
Test: m ethernet-service
Test: atest EthernetServiceTests
Change-Id: I2a27410a6148c525e17a11cb1ba3570f04e60b5d
NetworkCapabilities#clearAll() is a hidden API, use clearAll()
of NetworkCapabilities.Builder instead.
Bug: 182963415
Test: m ethernet-service
Test: atest EthernetServiceTests
Change-Id: I87745b5f7a5817f95cdbc623b2313c181ff48f19
The connection service will become the mainline module.
So, need to remove the hidden API usage of NetworkRequest.
The NetworkRequest.type(TRACK_DEFAULT) is no longer sent
to the factories. So, remove the (TRACK_DEFAULT) check to
avoid using hidden API.
Bug: 170598012
Test: atest EthernetServiceTests
Change-Id: I5b5fed864318e9ac7e190c40d4f52076ab0eece8
The new specifier represents ethernet interfaces more
specifically and is part of the public API.
Bug: 179329291
Test: atest CtsNetTestCases
Merged-In: I6cba1709b3007a22d95849a1281237c77e1464a4
Change-Id: I6cba1709b3007a22d95849a1281237c77e1464a4
The connection service will become the mainline module. The mutable
NetworkCapabilities is deprecated, and the NetworkCapabilities should
be built through their Builder instead.
Bug: 170598012
Test: atest EthernetServiceTests
Change-Id: I09661ddda24d652ed791a7c6b093541e20a15e77
The connection service will become the mainline module. The mutable
NetworkCapabilities is deprecated, and the NetworkCapabilities should
be built through their Builder instead.
Bug: 170598012
Test: atest EthernetServiceTests
Change-Id: I31f12a39a924302beca980b8d920e3c5c18816d4
Follow-up from aosp/1549897, the capability will not be in
default capabilities, but will be in most of the NetworkRequests
which requires internet. Thus, add the capabilities into all
NetworkAgent implementations by default to provide
backward compatibility.
Test: TH
Bug: 175662146
Change-Id: Ib6e203571946e3094e4ce534b108f796cc3b8fb7
Since NetdUtils has the same method(setInterfaceUp) as
NetworkManagementService, replace the usage of NMS with NetdUtils.
Bug: 170598012
Test: atest EthernetServiceTests
Change-Id: Id0f8e17e9d6237fa8ab157c96dd982c47007a453
Because they operate on test interfaces, ethernet interfaces included
with setIncludeTestInterfaces should have TRANSPORT_TEST.
Bug: 156319532
Test: atest CaptivePortalApiTest
Change-Id: Ife3eab06432cabf3ee626de49abc31c8349b4316
There is a stopgap hack in ConnectivityService doing
this automatically, but individual agents should be doing
this themselves.
Test: FrameworksNetTests NetworkStackTests
Bug: 150570873
Change-Id: I6f75e2b26eb9f554243bc418142a4dc18839aa79
This is a combination of ag/10147368 and ag/10438581.
ag/10147368 implemented this conversion together with
using the planned NetworkScore API, while ag/10438581
reverted the parts that had to do with NetworkScore.
This is just a squash of these two patches and it
brings the factory in line with the code in rvc-dev.
Test: FrameworksNetTests NetworkStackTests EthernetTetheringTest
Change-Id: Ib214fbbd042f2c0ebd01cf5b0ec33d922629677e
Merged-In: Ie7b70750ef0e17141080f4266dea6155c3601569
Both EthernetManager#getAvailableInterfaces() and the no-arg
version of EthernetManager#isAvailable() end up calling
EthernetServiceImpl#getAvailableInterfaces. This method attempts
to filter out restricted interfaces if the caller does not have
the CONNECTIVITY_USE_RESTRICTED_NETWORKS permission.
Unfortunately EthernetNetworkFactory's notion of a restricted
interface is the opposite of what it should be. This means that
while privileged callers can see all interfaces, unprivileged
callers can only see restricted interfaces which they cannot use.
Fix this by correcting NetworkInterfaceState#isRestricted(), so
that unprivileged callers can see only unrestricted interfaces.
Privileged callers are unaffected.
This bug probably went unnoticed because restricted Ethernet
interfaces are rare (likely used only on auto devices) and
because the callers that care about those restricted interfaces
are generally privileged.
Bug: 148824036
Test: atest android.net.EthernetTetheringTest#testPhysicalEthernet
Change-Id: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25
Currently, callbacks for tethered interface availability are sent
based on interface link state. This is incorrect:
- It is acceptable and expected to be able to enable tethering on
an interface that does not yet have link up.
- It doesn't seem useful to disable Ethernet tethering if link
temporarily goes down.
Instead, only base the callbacks on whether an interface exists
or not.
Bug: 150644681
Test: WIP tests in aosp/1260100 pass
Change-Id: I015219cbd03626c38fb5156d0cb2991ba7d7def7
Currently, the default interface can only ever go from null to
non-null. This is correct for fixed interfaces (because they
don't get unplugged) and it's generally correct for USB
interfaces that use ethX as their device name (because when
they are unplugged and plugged in again, the device name won't
change). But it is not correct if, for example, the default
interface is a test interface. So, allow mDefaultInterface to go
back to null.
This CL also fixes a crash if a tethered interface request is
added and removed when there is no default interface.
Also, make dump() report tethered interface requests.
Also remove an unused variable that I missed in the previous CL.
Bug: 150644681
Test: tested by EthernetTetheringTest in same topic
Change-Id: I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d
This CL adds a setIncludeTestInterfaces method to EthernetManager
that, when called, causes the Ethernet service to recognize and
manage test interfaces created by TestNetworkManager.
Bug: 150644681
Test: Tested by EthernetTetheringTest in same topic
Change-Id: I86eef7a93267f800dbfc8eafd307effa76a344ca
Currently, Ethernet only supports interfaces in client mode
(e.g., to connect to the Internet). Add minimal support to
Ethernet to support interfaces in server mode. This simple
implementation only works on the default interface, which is the
first interface that is detected on boot (even if the interface
is later removed).
This also provides (but does not yet unhide) a simple API for
Tethering to request that the next-plugged-in interface to be
placed into server mode.
Test: Enabling tethering with change on top
Bug: 130840861
Merged-In: I78f85bc36aaceb62ce274003a75ea99d0b6bc8b7
Change-Id: I78f85bc36aaceb62ce274003a75ea99d0b6bc8b7
(clean cherry-pick from internal branch)
When releaseNetworkFor is called, refCount should be equal to 1 for
network.stop() to be called. This is the same logic that is followed by
WifiNetworkFactory also.
In the current code, when refCount is 2 and releaseNetworkFor() is called,
network.stop() will be executed and will stop Ethernet
Bug: 146089778
Test: build and boot OK
Change-Id: Ib7d1b488a2943364a8ba4a89eec5de4c33cf1d5a
A number of connectivity checks that protect system-only methods
check for CONNECTIVITY_INTERNAL, but CONNECTIVITY_INTERNAL is a
signature|privileged permission. We should audit the permissions
checks, and convert checks that protect code that should not be
called outside the system to a signature permission. So replace
the permission to NETWORK_STACK.
Bug: 32963470
Test: atest EthernetServiceTests
Change-Id: I2a88d04bbdcd7e7e624b9065372a6603d2bb45a2
When this.mIpConfig is not initialized, it will cause a
java.lang.NullPointerException and put the device in a boot
loop with the following error:
FATAL EXCEPTION IN SYSTEM PROCESS: EthernetServiceThread
Test: passed pre-submit boot test.
Change-Id: I47df68071b4c07a4136c0abcbe69ee7ada7090e0
Bug: 119085164
Test: manual, test with AndroidTV device
Partner gerrit review CL:
https://partner-android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1215654
[Analysis]
APP called EthernetManager.setConfiguration API for switch DHCP to
Static,
setConfiguration’s flow just only update IpConfig finally but have not
trigger EthernetNetworkFactory.start().
So Static IP Setting just only take effect when unplug/plug Ethernet
Cable or AC Off&On.
[Repeat Steps]
1. Connect Ethernet with DHCP and Network access is normal
2. Change IP settings from DHCP to Static and set Static IP.
3. After setting, you can not automatically obtain Static IP.
[Recovery Method]
Unplug the Ethernet and insert it or AC OFF / ON
Change-Id: Idbb6a24ccfa360582f48e4f9369def7fc729fb9f
Bug: 112171349
Bug: b/112588045
Test: atest EthernetServiceTests --verbose
Test: kitchensink, dumpsys ethernet, with RPi devices and USB to
ethernet adapters.
Change-Id: Iaa260aabbbd7aa4b7864eba32ecff7e3f84123c3
Bug: b/112588045
Test: atest EthernetServiceTests --verbose
Test: kitchensink with RPi devices connected by USB -> Ethernet
adapters. Edit config.xml to try different tranport
overrides manually. Use dumpsys ethernet to show final
final network scores.
Change-Id: I482e78a76d06c9c090aa6816db14bb346eb6528b
These should not affect network refcount and thus should not be
passed to the network transport.
Bug: 116034205
Test: successfully established a VPN when connected to USB ethernet
Change-Id: I66517d86f35b8cfc1e211cb189127187d2744b60
In addition to IP address, OEMs should be able to set gateway, DNS and
domains.
Bug: 80090920
Test: runtest -x frameworks/opt/net/ethernet/tests
Change-Id: I4e3d51a6955d7bfe5ca4e8079936ea10c28832e4
EthernetConfigStore should return 'null' for default interface if the
default interface hasn't been configured otherwise it would be hard to
distinguish not-configured vs configured with default values.
Bug: 79415136
Test: verified w/o .xml overlay Ethernet continues to work
Test: verified that ip config from overlay is not getting overriden
Change-Id: I4eb914923f3664b12b6af0ae05f45b60c5312b02
Handle the case when IpClient wasn't created for network interface which
may happen for virtual device
Bug: 78482534
Test: dumpsys ethernet
Change-Id: I3405dd4f72d4a6444448f0d6ec0497aead07bade
This makes sure that we never accidentally have two IpClients vying
for control of the same interface.
Test: as follows
- built
- flashed
- booted
Bug: 62476366
Change-Id: Iab4ca7c2445e70b6f8beaf5dc6921cb0c6cd56ed