Commit Graph

262 Commits

Author SHA1 Message Date
Lorenzo Colitti
6fb426f10a [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 e81f99d532 is in history

Change-Id: I3adadae13ef96c50e4083b8d826730e0fb4990fd
2020-03-20 00:44:57 +00:00
Lorenzo Colitti
876e5e16a9 Support setting the default interface to null again.
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
Merged-In: I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d
(cherry picked from commit cc156c2f7793731b2699e194d4b164138ee4cf62)
2020-03-19 15:53:13 +00:00
Lorenzo Colitti
3449a34474 Send tethered interface callbacks based on interface existence. am: 165b456d92 am: cad2e49acb
Change-Id: I4b24ea24ede2856d8c33df3e2331efe9d5825ca6
2020-03-19 15:52:09 +00:00
Lorenzo Colitti
4b10eea44f Support setting the default interface to null again. am: e81f99d532 am: e19d6a8764
Change-Id: I373f51835b48bdb9c7a678c4779f1a9079c7a181
2020-03-19 15:52:03 +00:00
Lorenzo Colitti
523093a1ff [automerger skipped] Make Ethernet interfaces more testable. am: fb336e9296 -s ours
am skip reason: Change-Id I86eef7a93267f800dbfc8eafd307effa76a344ca with SHA-1 841195a103 is in history

Change-Id: I31d44b8c1a538f7c4573cf6fa476529326a9c0bf
2020-03-19 14:44:23 +00:00
Lorenzo Colitti
165b456d92 Send tethered interface callbacks based on interface existence.
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
2020-03-19 22:12:32 +09:00
Lorenzo Colitti
e81f99d532 Support setting the default interface to null again.
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
2020-03-19 22:04:23 +09:00
Lorenzo Colitti
fb336e9296 Make Ethernet interfaces more testable.
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
Merged-In: I86eef7a93267f800dbfc8eafd307effa76a344ca
(cherry picked from commit 4978dbd5fb6592fc4e7be08d02783752245da634)
2020-03-19 12:29:35 +00:00
Lorenzo Colitti
ee43f745bd Make Ethernet interfaces more testable. am: 841195a103 am: 6d590906f5
Change-Id: Icd319cc53f17fc76d1a93bdb9741fc6db77c1ce9
2020-03-19 11:46:55 +00:00
Lorenzo Colitti
841195a103 Make Ethernet interfaces more testable.
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
2020-03-19 18:06:59 +09:00
Automerger Merge Worker
bab750adfe Revert part of 79eb7ba87b am: fd99009c52
Change-Id: Idcdfbe614f49183d38801ce4d1dd4b16de1d73b8
2020-03-02 23:33:04 +00:00
Chalard Jean
fd99009c52 Revert part of 79eb7ba87b
This reverts the parts of the above commit that have to do
with NetworkScore. The parts that convert the factory to the
new NetworkAgent API are conserved.

Bug: 113554781
Test: FrameworksNetTests
Change-Id: If2c368e084e29f9f358f43dcd547d42e8c7c4846
2020-02-28 06:26:20 +00:00
Automerger Merge Worker
6da0ed9d03 Set Ethernet default mode as CLIENT am: f85c0b301c am: dceced7bca am: 97b0e8d67c
Change-Id: Icba5166843dd4741493f2b22b519fbd1ed26489e
2020-02-01 16:17:11 +00:00
Automerger Merge Worker
dceced7bca Set Ethernet default mode as CLIENT am: f85c0b301c
Change-Id: Ib3e9b501c8a9bbc8862fc97f1bcddd2a92bbe46d
2020-02-01 16:00:23 +00:00
Milim Lee
f85c0b301c Set Ethernet default mode as CLIENT
Bug: 130840861
Test: build, boot
      atest EthernetTrackerTest
      manual test (using Ethernet)

Change-Id: I935ea2e5f214aced67fb60f4aec2744077177545
2020-02-01 05:48:53 +09:00
Chalard Jean
05c71a36c9 Merge "Make NetworkScore system API" 2020-01-31 03:06:15 +00:00
Chalard Jean
79eb7ba87b Make NetworkScore system API
Bug: 146583853
Test: FrameworksNetTests
Change-Id: Ie7b70750ef0e17141080f4266dea6155c3601569
2020-01-30 15:14:56 +09:00
Automerger Merge Worker
b1a5c68cee [automerger skipped] Support one Ethernet interface in server mode. am: 32327808e1 am: c5d03c8ca4 am: 8695bd42d3 -s ours
am skip reason: Change-Id I78f85bc36aaceb62ce274003a75ea99d0b6bc8b7 with SHA-1 c750566a77 is in history

Change-Id: I54f24efc6379337a48c54e8ef551117974d6ac04
2020-01-28 09:17:08 +00:00
Lorenzo Colitti
c5d03c8ca4 Support one Ethernet interface in server mode.
am: 32327808e1

Change-Id: I49dd9ef3d199508782e77e3b362ad3135ba82fa0
2020-01-28 00:37:36 -08:00
Lorenzo Colitti
32327808e1 Support one Ethernet interface in server mode.
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)
2020-01-28 16:22:46 +09:00
Lorenzo Colitti
c750566a77 Support one Ethernet interface in server mode.
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
Change-Id: I78f85bc36aaceb62ce274003a75ea99d0b6bc8b7
2020-01-27 19:07:56 +09:00
Automerger Merge Worker
6a38d3aa4b Merge "Avoid creating IpClient if ethernet cable is unplugged." am: 918f68fce9 am: 35cc5e821e am: 91a297efc6
Change-Id: I6037008fa8c864a3f006bccf969ba2c1d7aad654
2020-01-09 05:53:55 +00:00
Automerger Merge Worker
91a297efc6 Merge "Avoid creating IpClient if ethernet cable is unplugged." am: 918f68fce9 am: 35cc5e821e
Change-Id: I8c8310da8935ffbdc3b18d7b05db55b81919c774
2020-01-09 05:37:15 +00:00
Lorenzo Colitti
35cc5e821e Merge "Avoid creating IpClient if ethernet cable is unplugged."
am: 918f68fce9

Change-Id: I097f2f68ea5b40997de7d312bbf6946c44e3b011
2020-01-08 21:27:48 -08:00
Lorenzo Colitti
918f68fce9 Merge "Avoid creating IpClient if ethernet cable is unplugged." 2020-01-09 05:26:34 +00:00
Automerger Merge Worker
8b65e6f8ce Fix refCount check at releaseNetworkFor am: b92d1f5513 am: 26965f92c3 am: 01e5c5a98c
Change-Id: Ib743575eb1f1c804182a50f14561ee5491f7087c
2019-12-17 12:47:48 +00:00
Automerger Merge Worker
01e5c5a98c Fix refCount check at releaseNetworkFor am: b92d1f5513 am: 26965f92c3
Change-Id: I82859813cf1e51cba5c240f86e3df4d2e1e0e2f4
2019-12-17 12:31:21 +00:00
Junaid Babu
26965f92c3 Fix refCount check at releaseNetworkFor
am: b92d1f5513

Change-Id: Ie57a05d66df6ddac7dc5919c299c1f3c2539b037
2019-12-17 04:11:07 -08:00
Junaid Babu
b92d1f5513 Fix refCount check at releaseNetworkFor
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
2019-12-17 15:09:01 +09:00
kevinwk_lee
13d5b86614 Avoid creating IpClient if ethernet cable is unplugged.
This change avoids calling start() on needNetworkFor() if ethernet
cable is unplugged. Fixed by adding isLinkUp validation.

Test: ./cts-tradefed run cts-dev -d -m CtsSecurityTestCases -t \
      android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdpPorts
      adb shell netstat -lnup

Change-Id: I2debd7367a20b665249f9c19d2d8a61737435803
2019-10-31 07:23:11 +00:00
Xin Li
e23b109683 [automerger skipped] DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master am: 39e7509859
am: ba1932f601 -s ours
am skip reason: subject contains skip directive

Change-Id: Ic5e8885bfbe7257dabe36dd11574c99bad0506c9
2019-10-30 15:37:47 -07:00
Xin Li
ba1932f601 DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master
am: 39e7509859

Change-Id: Idb13dc5c8e29cdfa6643b0686641f351a48f49eb
2019-10-30 15:14:04 -07:00
Xin Li
39e7509859 DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master
Bug: 142003500
Change-Id: I10598042b88b6509ed29dee05fe27ca9decf184e
2019-10-30 11:49:19 -07:00
Paul Hu
efc7f26d66 Merge "[Ethernet] Replace internal connectivity checks permission" am: cd73c22c96 am: 2afd43ff9f am: 63721ec401
am: 5b12a54294

Change-Id: I1c248170fd82697352ac0526e3dadd8cbdb7a28d
2019-09-20 00:55:40 -07:00
Paul Hu
5b12a54294 Merge "[Ethernet] Replace internal connectivity checks permission" am: cd73c22c96 am: 2afd43ff9f
am: 63721ec401

Change-Id: I3606bee0a292d70dd140b4e244b8f283e8205c96
2019-09-20 00:48:36 -07:00
Paul Hu
63721ec401 Merge "[Ethernet] Replace internal connectivity checks permission" am: cd73c22c96
am: 2afd43ff9f

Change-Id: I1ccd73bc12ceb18e4b7578454bbfd3428ce8f135
2019-09-20 00:42:42 -07:00
Paul Hu
2afd43ff9f Merge "[Ethernet] Replace internal connectivity checks permission"
am: cd73c22c96

Change-Id: Idafe2f4e829b70920ba1f423bf5273a766257cf2
2019-09-20 00:36:15 -07:00
Paul Hu
cd73c22c96 Merge "[Ethernet] Replace internal connectivity checks permission" 2019-09-20 07:23:07 +00:00
Chalard Jean
6cad7f20e1 Update Ethernet code for the NetworkFactory serial number. am: 91456a8c7a am: abb7a8c574 am: 8a5d92da6d
am: 761a9e0eea

Change-Id: Ib4a41c536d2a0b9c8914504cb5e5bffff06434b9
2019-09-18 05:32:30 -07:00
Chalard Jean
761a9e0eea Update Ethernet code for the NetworkFactory serial number. am: 91456a8c7a am: abb7a8c574
am: 8a5d92da6d

Change-Id: Ifcce756f31fc85bcba49731596a8fc270efc3c79
2019-09-18 05:27:47 -07:00
Chalard Jean
8a5d92da6d Update Ethernet code for the NetworkFactory serial number. am: 91456a8c7a
am: abb7a8c574

Change-Id: I36c6a101dc4dc67fe094a7ec6d12870f06c4cb78
2019-09-18 05:20:36 -07:00
Chalard Jean
abb7a8c574 Update Ethernet code for the NetworkFactory serial number.
am: 91456a8c7a

Change-Id: I4a0601db487d9d60d4bc7487601fb1b26ab748d8
2019-09-18 05:15:07 -07:00
Chalard Jean
91456a8c7a Update Ethernet code for the NetworkFactory serial number.
See aosp/708790

Bug: 18637384
Bug: 29030667
Test: manual
      cts
      runtest framework-net
      atest frameworks/opt/net/ethernet/tests

Change-Id: I5caa4cb89ca1441f3c84b5675ceede6ecacfd132
2019-09-09 11:03:51 +08:00
paulhu
6957e3a35a [Ethernet] Replace internal connectivity checks permission
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
2019-08-22 16:03:59 +08:00
Wally Yau
c88d7a093d Fixed fatal exception in EthernetServiceThread am: b95be5972e am: 13a87fbc0e am: 54816c5fe2
am: 946288ef22

Change-Id: I96273535af86fc63e9d63706a23af4ad16d0b4da
2019-05-30 10:36:15 -07:00
Wally Yau
946288ef22 Fixed fatal exception in EthernetServiceThread am: b95be5972e am: 13a87fbc0e
am: 54816c5fe2

Change-Id: I35c737a0493cfbbde9cba05fb010c8253c9030ae
2019-05-30 10:10:04 -07:00
Wally Yau
54816c5fe2 Fixed fatal exception in EthernetServiceThread am: b95be5972e
am: 13a87fbc0e

Change-Id: I35e91e5c2f4f04e888eceb8492a3e970f98f3789
2019-05-30 09:49:49 -07:00
Wally Yau
13a87fbc0e Fixed fatal exception in EthernetServiceThread
am: b95be5972e

Change-Id: I9ae1b1fb00552931882ce0b1eafd6696f217c96e
2019-05-30 09:40:39 -07:00
Wally Yau
b95be5972e Fixed fatal exception in EthernetServiceThread
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
2019-05-29 14:50:38 -07:00
tank.hung
9f3b27fed9 Merge "Add reconnect flow when updateIPConfiguration" am: 08998cf4d1 am: 571f7a6b67
am: aaff25b1ec

Change-Id: I612033b0dec43c1b911e00e5d42d2e34bc2d23f7
2019-05-14 10:12:35 -07:00