Commit Graph

564 Commits

Author SHA1 Message Date
Lorenzo Colitti
6123533817 Don't call maybeTrackInterface on the wrong thread.
Bug: 150644681
Test: atest TetheringIntegrationTests:EthernetTetheringTest --rerun-until-failure 100
Merged-In: Ia2cb265f8d4de96210f1462339c10ad2947eec65
Change-Id: Ia2cb265f8d4de96210f1462339c10ad2947eec65
2020-04-22 06:42:46 +00:00
Chalard Jean
0077fa39d1 [automerger skipped] Address further API council comments. am: 4b9a7dd13d am: 7608da3e3a -s ours am: 7f49fa7dad -s ours am: b3f4c82c61 -s ours am: 1f0fb907a8 -s ours
am skip reason: Change-Id I7c27f76c54a76abeae46dcdcddaeb3ca48afa358 with SHA-1 dff893b275 is in history

Change-Id: If715e6280254128351451a2b8a3249827b1cc5a0
2020-04-02 18:58:22 +00:00
Chalard Jean
1f0fb907a8 [automerger skipped] Address further API council comments. am: 4b9a7dd13d am: 7608da3e3a -s ours am: 7f49fa7dad -s ours am: b3f4c82c61 -s ours
am skip reason: Change-Id I7c27f76c54a76abeae46dcdcddaeb3ca48afa358 with SHA-1 dff893b275 is in history

Change-Id: I95d17a5fcbf4205c9efcbd0d22f045e2b08d33ce
2020-04-02 07:19:03 +00:00
Chalard Jean
b3f4c82c61 [automerger skipped] Address further API council comments. am: 4b9a7dd13d am: 7608da3e3a -s ours am: 7f49fa7dad -s ours
am skip reason: Change-Id I7c27f76c54a76abeae46dcdcddaeb3ca48afa358 with SHA-1 dff893b275 is in history

Change-Id: Icb83b93cb122f70861d2617ebf2ea7c46b13818d
2020-04-02 07:00:10 +00:00
Chalard Jean
7f49fa7dad [automerger skipped] Address further API council comments. am: 4b9a7dd13d am: 7608da3e3a -s ours
am skip reason: Change-Id I7c27f76c54a76abeae46dcdcddaeb3ca48afa358 with SHA-1 dff893b275 is in history

Change-Id: I73c243ccc7e14b895fdf0ab67493ba471b696f50
2020-04-02 06:37:15 +00:00
Chalard Jean
10be7a6488 [automerger skipped] Convert the Ethernet factory to the new network agent am: 86aac0daec am: 7f511738e0 -s ours am: 9abd9e2504 -s ours am: c86bfb7117 -s ours am: 618525c2e6 -s ours
am skip reason: Change-Id Ie7b70750ef0e17141080f4266dea6155c3601569 with SHA-1 79eb7ba87b is in history

Change-Id: Iadc107fbc28354ad2cf5f210df3de426bee20649
2020-04-01 12:05:31 +00:00
Chalard Jean
618525c2e6 [automerger skipped] Convert the Ethernet factory to the new network agent am: 86aac0daec am: 7f511738e0 -s ours am: 9abd9e2504 -s ours am: c86bfb7117 -s ours
am skip reason: Change-Id Ie7b70750ef0e17141080f4266dea6155c3601569 with SHA-1 79eb7ba87b is in history

Change-Id: I44fcf8f2fc9ffcf5b21ce0e3462019d6478584e3
2020-04-01 11:50:39 +00:00
Chalard Jean
c86bfb7117 [automerger skipped] Convert the Ethernet factory to the new network agent am: 86aac0daec am: 7f511738e0 -s ours am: 9abd9e2504 -s ours
am skip reason: Change-Id Ie7b70750ef0e17141080f4266dea6155c3601569 with SHA-1 79eb7ba87b is in history

Change-Id: Iba771d95f044ae505cdedf6c2a94ac057c0d05a2
2020-04-01 11:39:41 +00:00
Chalard Jean
9abd9e2504 [automerger skipped] Convert the Ethernet factory to the new network agent am: 86aac0daec am: 7f511738e0 -s ours
am skip reason: Change-Id Ie7b70750ef0e17141080f4266dea6155c3601569 with SHA-1 79eb7ba87b is in history

Change-Id: Id73857a02ed1e4b3b30d5166451af59e7583cd72
2020-04-01 11:19:44 +00:00
Chalard Jean
4b9a7dd13d Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Copy from ag/10857997
Change-Id: I7c27f76c54a76abeae46dcdcddaeb3ca48afa358
Merged-In: I7c27f76c54a76abeae46dcdcddaeb3ca48afa358
2020-04-01 11:04:18 +00:00
Chalard Jean
86aac0daec Convert the Ethernet factory to the new network agent
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
2020-04-01 09:09:32 +00:00
Chalard Jean
8bcad4f67b Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: bad3318c8e am: a147521523 am: 332c9feacc am: b988a56e81
Change-Id: I7990efec889c951c4a82ca4f9c74df7c0c043731
2020-03-27 23:46:38 +00:00
Chalard Jean
a280fa7a75 Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: cc9cab6311 am: 7fc8220a53 am: ae03d47c65
Change-Id: Iea6058b1e18328cb0c80d50d3e87f1d15eef5bb7
2020-03-27 23:41:00 +00:00
Chalard Jean
12ccaa891f Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: bad3318c8e am: d02358a6cc am: 01c6bbac04
Change-Id: I92324165a42ea919c710743a7d36c17d7e47cf37
2020-03-27 23:39:24 +00:00
Chalard Jean
b988a56e81 Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: bad3318c8e am: a147521523 am: 332c9feacc
Change-Id: I216e7ee932f3cce92569a8cd57e76a60a4d67c87
2020-03-27 23:30:14 +00:00
Chalard Jean
ae03d47c65 Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: cc9cab6311 am: 7fc8220a53
Change-Id: Iab38821df1fc17922e36d9538709403799c066ec
2020-03-27 23:26:40 +00:00
Chalard Jean
01c6bbac04 Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: bad3318c8e am: d02358a6cc
Change-Id: Ia30dd603d0dfd5af75a3d8a5d287504725aa8c3c
2020-03-27 23:23:05 +00:00
Chalard Jean
332c9feacc Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: bad3318c8e am: a147521523
Change-Id: I3d188c4d061783ef7007226ebeb0e3de7e1c76c9
2020-03-27 23:15:08 +00:00
Chalard Jean
7fc8220a53 Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: cc9cab6311
Change-Id: Ib995f82ee38a7105b28b5cdccb04d73dc6f43b81
2020-03-27 23:07:02 +00:00
Chalard Jean
a147521523 Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: bad3318c8e
Change-Id: Ia564f3ff70468be198c23b47669c274cd144aaae
2020-03-27 23:04:46 +00:00
Chalard Jean
d02358a6cc Merge "Address further API council comments." into rvc-dev am: d3a0721fb5 am: bad3318c8e
Change-Id: I8cc1054a4f9c3bde0d3e47f8e1099aaec0609529
2020-03-27 23:02:26 +00:00
Chalard Jean
bad3318c8e Merge "Address further API council comments." into rvc-dev am: d3a0721fb5
Change-Id: I30c12bd1f44911306ba543cd1ad1e78cef35e0c6
2020-03-27 22:58:34 +00:00
Chalard Jean
cc9cab6311 Merge "Address further API council comments." into rvc-dev am: d3a0721fb5
Change-Id: I3baeb9a62722dfc35063dda3c1480cf627ecf237
2020-03-27 22:56:26 +00:00
Chalard Jean
d3a0721fb5 Merge "Address further API council comments." into rvc-dev 2020-03-27 22:50:42 +00:00
Lorenzo Colitti
a24a57e702 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 am: 4815281295 am: b7e4058b07 -s ours am: 5986bbdc93 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: I067edb9a6b9621ee56711380c055993a51594634
2020-03-27 15:04:54 +00:00
Lorenzo Colitti
c6e953bbbe [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 -s ours am: a33bf42216 -s ours am: 83eb974bed -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: Ieba7b5f26d5d260a771aa68adc6d836f72f36416
2020-03-27 15:04:20 +00:00
Lorenzo Colitti
5986bbdc93 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 am: 4815281295 am: b7e4058b07 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: Ied9274f2513e7c49a267d0a9884784570eadd8fb
2020-03-27 15:03:37 +00:00
Lorenzo Colitti
ac2d52bf46 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours am: 54e8d7400a -s ours am: 2ed1da60c0 -s ours am: 74d5e47013 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: I2635edf03e157c0c139e7539c72fd80d41292767
2020-03-27 15:03:18 +00:00
Lorenzo Colitti
83eb974bed [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 -s ours am: a33bf42216 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: Ia5bd44f2cd6688e39545a25e9ec243d618c9b5f8
2020-03-27 14:46:08 +00:00
Lorenzo Colitti
74d5e47013 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours am: 54e8d7400a -s ours am: 2ed1da60c0 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: Ibf33a1079bab67b51f51d68584e5236b7164361b
2020-03-27 14:45:45 +00:00
Lorenzo Colitti
b7e4058b07 Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 am: 4815281295
Change-Id: Iafb673e949d06a327327d2ff043d8929a35974fa
2020-03-27 14:45:43 +00:00
Lorenzo Colitti
a33bf42216 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: Ib0e588434a8dd04280ef0df1f8f2d3abdfeff7a3
2020-03-27 14:35:52 +00:00
Lorenzo Colitti
4815281295 Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8
Change-Id: I3004ec6456f68f9423d11009bdc7df51132cc155
2020-03-27 14:35:14 +00:00
Lorenzo Colitti
2ed1da60c0 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours am: 54e8d7400a -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: I535ef517fd18b84e1b4f1823c656ac14bc798f00
2020-03-27 14:35:09 +00:00
Lorenzo Colitti
54e8d7400a [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: I551191401ef145f60ce43992dc1130cda0d62838
2020-03-27 14:17:55 +00:00
Lorenzo Colitti
6b4862dfc8 Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f
Change-Id: I7b670de0724e00ee48fe234b2bd193501c7c783c
2020-03-27 14:17:36 +00:00
Lorenzo Colitti
bc7ff5d89f Fix querying Ethernet availability for unprivileged callers.
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
Merged-In: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25
Change-Id: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25
2020-03-27 11:38:33 +00:00
Lorenzo Colitti
d9057192f9 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da am: 6b41e255c6 am: 1ba2a5d379 am: 8114585265
Change-Id: I6482151348ef71c63babbcb42fac4c70e37df457
2020-03-27 09:54:58 +00:00
Lorenzo Colitti
8114585265 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da am: 6b41e255c6 am: 1ba2a5d379
Change-Id: If1deb6bb0050c01046aa2b3f951a0f7f518c31bc
2020-03-27 09:36:54 +00:00
Lorenzo Colitti
1ba2a5d379 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da am: 6b41e255c6
Change-Id: Ib4491ccd852bdb0fa8ad93e031239714239c1a4a
2020-03-27 09:18:12 +00:00
Lorenzo Colitti
6b41e255c6 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da
Change-Id: I125e0f6c3ed7005cba55cefc0872d55262fcd596
2020-03-27 09:06:27 +00:00
Chalard Jean
dff893b275 Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I7c27f76c54a76abeae46dcdcddaeb3ca48afa358
2020-03-27 15:05:02 +09:00
Lorenzo Colitti
dd397f58c7 Fix querying Ethernet availability for unprivileged callers.
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
2020-03-26 22:53:10 +09:00
Lorenzo Colitti
06837245b4 Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a am: b8327f43aa am: cbbac4940d am: 56355a75c2
Change-Id: I061dd55de0bd71a30bc57efa50e4bf235ab8a715
2020-03-26 10:48:22 +00:00
Lorenzo Colitti
56355a75c2 Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a am: b8327f43aa am: cbbac4940d
Change-Id: I21e3c0cc4bc64c540fc0e19590b4b143bce8215a
2020-03-26 10:35:33 +00:00
Lorenzo Colitti
cbbac4940d Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a am: b8327f43aa
Change-Id: Id4e2753b445edd6fe719441b501337ff2df8f23f
2020-03-26 10:24:20 +00:00
Lorenzo Colitti
b8327f43aa Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a
Change-Id: Ib032004882f40dcdb8f1614a2b1f0ec97dd153e4
2020-03-26 09:58:55 +00:00
Lorenzo Colitti
bd66333a24 Don't call maybeTrackInterface on the wrong thread.
Bug: 150644681
Test: atest TetheringIntegrationTests:EthernetTetheringTest --rerun-until-failure 100
Change-Id: Ia2cb265f8d4de96210f1462339c10ad2947eec65
2020-03-26 17:02:27 +09:00
Lorenzo Colitti
bd102e3b6f [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c am: 87c64dc6b3 am: c9fb72bbe0 -s ours am: d0b200b5b0 -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 0c30d949df is in history

Change-Id: Icceed0b6b2054b28d8e3ad07728fcbb53b31262d
2020-03-20 02:39:54 +00:00
Lorenzo Colitti
a7bfa6d070 [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d am: ac350dddc6 am: 4d5310692c -s ours am: b284c51425 -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 876e5e16a9 is in history

Change-Id: I2193378052b1309503b77023da14917810e48e41
2020-03-20 02:39:47 +00:00