Commit Graph

23298 Commits

Author SHA1 Message Date
paulhu
4428044569 Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting
Now, PermissionMonitor reigster observer to listen the change
from all users, but "uids allowed on restricted networks" should
affect to all users instead of per each user. Thus, move the
setting from Settings.Secure to Settings.Global.

Bug: 189705071
Test: atest FrameworksNetTests
Merged-In: Ibea354d8dda1f02652a193820f3f9eb573b9a956

Change-Id: Ibea354d8dda1f02652a193820f3f9eb573b9a956
2021-06-07 08:55:16 +00:00
paulhu
eb43848207 Address leftover comments
- Add comment to highestPermissionForUid()
- Add testAppsAllowedOnRestrictedNetworksChangedMultipleUsers
- Add synchronized to guard mUidsAllowedOnRestrictedNetworks
  access.

Bug: 189705071
Test: atest FrameworksNetTests
Merged-In: I9056758db15e8a21b84ef244d4cacf24c3b79894

Change-Id: I9056758db15e8a21b84ef244d4cacf24c3b79894
2021-06-07 08:54:12 +00:00
Junyu Lai
9756b5d4f9 Merge changes Ia930b3d3,If614da81,I975a9439
* changes:
  [NS04.8] Address comments from NS04 and NS04.5
  [NS04.7] Reinstate a necessary change
  [NS04.5] Have NetworkOffer embark a provider ID
2021-06-04 20:52:38 +00:00
Paul Hu
c30c57c210 Merge "Update allowed on restricted networks getter/setter" 2021-06-04 10:31:50 +00:00
Frank Li
ae5bd10a09 Merge "Add CTS test for NetworkRequest.getCapabilities API" 2021-06-04 09:29:04 +00:00
Remi NGUYEN VAN
1e2ad80467 Merge "Add OsCompat" 2021-06-04 08:20:30 +00:00
Remi NGUYEN VAN
062fda1fb3 Merge "Remove NetdService, NetworkStackClient dependency" 2021-06-04 07:28:20 +00:00
Chiachang Wang
0a0a3118fc Merge "Remove ConnectivityService hidden annotations" 2021-06-04 07:04:29 +00:00
Remi NGUYEN VAN
448406a3aa Merge "Remove ConnectivityService hidden annotations" 2021-06-04 07:02:37 +00:00
Remi NGUYEN VAN
91c4df62bf Merge "Remove hidden Icon.createWithResource API usage" 2021-06-04 07:02:15 +00:00
Remi NGUYEN VAN
84061f6102 Merge "Build connectivity JNI against libc++_static" 2021-06-04 07:01:47 +00:00
Remi NGUYEN VAN
5d3005cc98 Merge "Remove dependency on libnetd_client" 2021-06-04 07:01:11 +00:00
Chalard Jean
a88fd95294 [NS04.8] Address comments from NS04 and NS04.5
Bug: 167544279
Test: ConnectivityServiceTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: Ia930b3d3e723075cb47e267d589c576ee2d4490f
Change-Id: Ia930b3d3e723075cb47e267d589c576ee2d4490f
  (cherry-picked from ag/13982288)
2021-06-04 02:37:53 +00:00
Chalard Jean
dd35f2dab0 [NS04.7] Reinstate a necessary change
NS04.5 removed a security that it shouldn't have. Reinstate it.

Bug: 167544279
Test: ConnectivityServiceTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: If614da813a96d1b50a16fa4be5659e1647d9469d
Change-Id: If614da813a96d1b50a16fa4be5659e1647d9469d
  (cherry-picked from ag/13975118)
2021-06-04 02:37:40 +00:00
Chalard Jean
30689b8fd7 [NS04.5] Have NetworkOffer embark a provider ID
...instead of a Messenger.
This will be useful later to compare whether a given offer is
offered by the same provider satisfying a request.

Bug: 167544279
Test: ConnectivityServiceTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I975a9439021c7fa511c50ac982819b6dd146291e
Change-Id: I975a9439021c7fa511c50ac982819b6dd146291e
  (cherry-picked from 148dcce559)
2021-06-04 02:36:58 +00:00
Remi NGUYEN VAN
ae471dd3f2 Merge "Add NDK API for getprocnetwork" 2021-06-03 08:07:23 +00:00
lifr
50d8cd23d9 Add CTS test for NetworkRequest.getCapabilities API
Bug: 189162033
Test: atest android.net.cts.NetworkRequestTest
      atest CtsNetTestCasesLatestSdk:NetworkRequestTest
Change-Id: I8504caa586bdb567d42047a96029dedc67968793
2021-06-03 10:25:57 +08:00
vichang
952eed1278 Merge "Use updated NetworkEventDispatcher API" 2021-06-02 17:00:58 +00:00
Chiachang Wang
02eea987c0 Merge changes I5d3e448e,Id69ac1d3
* changes:
  Add test for ConnectivityManager.factoryReset
  Correct the logic for CtsTetheringUtils.isWifiTetheringSupported
2021-06-02 01:24:10 +00:00
Treehugger Robot
c4d26414f8 Merge "Test tethered callback with TetheringInterface" 2021-06-01 14:35:48 +00:00
Treehugger Robot
414edc4ac9 Merge "Add the tethering type to TetheringEventCallback methods" 2021-06-01 14:33:51 +00:00
Remi NGUYEN VAN
5ba3925037 Remove ConnectivityService hidden annotations
BoolRes and VpnType are hidden annotations that should not be used in a
module class.

Test: m
Bug: 171540887
Merged-In: I84690c868ecc62a546ec97bcae2e017a283dc07e
Change-Id: I84690c868ecc62a546ec97bcae2e017a283dc07e
2021-06-01 20:31:54 +08:00
Aaron Huang
87f051bfa6 Merge "Add required permission to Tethering" 2021-06-01 10:13:34 +00:00
Remi NGUYEN VAN
829bfbe77c Add OsCompat
Although the InetAddress symbols used by Connectivity are stable core
platform API, and should be usable, the core_current stubs are not yet
part of the module_current API.
Until that is fixed, add an InetAddressCompat utility that calls the
three static methods by reflection.

Original change (project moved):
I8d1a4811a1cc7dbc62f4033c2b320246d1d72b28

Test: atest FrameworksNetTests CtsNetTestCases
Bug: 183097033
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I70f14edaa2848f78d3b0f1f5b55e0cca4f80ae99
2021-06-01 18:42:19 +09:00
Remi NGUYEN VAN
8ae54f7a3e Remove NetdService, NetworkStackClient dependency
Netd should be obtained via getSystemService, and
ModuleNetworkStackClient must be used instead of NetworkStackClient for
modules.

Original change (project moved):
Ibe703ac56dd70673115cd8b95b44b856a7fc01f3

Bug: 171540887
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I6c8593712c0e86da139d425ef6240c5004e392e2
2021-06-01 18:41:33 +09:00
Remi NGUYEN VAN
06830749cc Remove ConnectivityService hidden annotations
BoolRes and VpnType are hidden annotations that should not be used in a
module class.

Original change (project moved):
I84690c868ecc62a546ec97bcae2e017a283dc07e

Test: m
Bug: 171540887
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie02cff68cf9adf82fc39bde4d2ba2be3255fb3d5
2021-06-01 18:41:05 +09:00
Remi NGUYEN VAN
8f72bd6401 Remove hidden Icon.createWithResource API usage
Icon.createWithResource(Context, int) is public, but
Icon.createWithResource(Resources, int) is a hidden API.

Replace the former by the latter in NetworkNotificationManager, so that
it builds against stable APIs.

Original change (project moved):
Ied29d3c7fb517d0c82f40662a1e0e87186c3a89e

Bug: 182125649
Test: atest FrameworksNetTests
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I6b18aab62fbb66bdd43cdb7add30e0c215687c3c
2021-06-01 18:40:43 +09:00
Remi NGUYEN VAN
4be92df27b Build connectivity JNI against libc++_static
Instead of including the whole libc++ library by linking it dynamically,
use the static version so that unused symbols can be stripped.

This allows reducing the APEX size by 1MB (3.7MB -> 2.7MB), as otherwise
libc++ is included twice for 32 and 64 bit variants.

Original change (project moved):
Ia66d795cf23d6f45997278300c103976433f7c5c

Bug: 171540887
Test: Device boots and has connectivity, size reduced

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie1c5b2ea274238a226ad2d827148439fd5758bb5
2021-06-01 18:40:25 +09:00
Remi NGUYEN VAN
8d1a96d9ea Remove dependency on libnetd_client
NetworkUtils can just use the NDK to achieve the same.

Also make sure network handles can have the local nameservers flag, for
the JNI API, and create/parse them accordingly in Network.

Original change (project moved):
I2e7b78263f7ca0cab9458854858a7423f6bd2854

Bug: 171540887
Test: atest CtsNetTestCases (in particular MultinetworkApiTest,
          DnsResolverTest, NetworkTest)
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I7a523aac93094beef6ff40d50678c12fe8840940
2021-06-01 18:40:06 +09:00
Remi NGUYEN VAN
a5e1148a4b Add NDK API for getprocnetwork
The API is the getter couterpart for setprocnetwork.
Use it in NetworkUtils so that the NDK API can be the source of truth
for the process network.

Original change (project moved):
Ie8f68cf1fa57deddb63324c1abf3d6fd5b0ef500

Bug: 171540887
Test: atest CtsNetTestCases
      Tests in change I311b58585033c2ca50ce5477ea9cd94b6f127507
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Iaf255f4aa29fd2ae02770baea5548ee8d5d407f2
2021-06-01 18:38:53 +09:00
Chiachang Wang
6391e22faf Add test for ConnectivityManager.factoryReset
Bug: 186061922
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCasesLatestSdk on R and S device
Change-Id: I5d3e448ed00b9baeb64a08036ecac1f9c8206cc7
2021-06-01 15:09:06 +08:00
Chiachang Wang
4f5c4c4323 Correct the logic for CtsTetheringUtils.isWifiTetheringSupported
The existing isWifiTetheringSupported only check if tethering side
supports wifi tethering or not but not wifi side. A expected
behavior should include both of them, so add the wifi side check
into the helper function. Also update in the existing caller side
due to a new parameter added.

Bug: 186061922
Test: atest MtsTetheringTestLatestSdk
Change-Id: Id69ac1d30ab2bbf23e870193335b139f54672636
2021-06-01 15:08:48 +08:00
markchien
3a23d2e2a6 Test tethered callback with TetheringInterface
The old callback only report interface list, new callback could provide
the mapping of interface and type. Replace old callback usage in cts
with new callback and check whether old callback could get the correct
interface list by comparing the result between old and new callback.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S
      atest CtsTetheringTestLatestSdk on R
      atest MtsTetheringTestLatestSdk on S and R
Merged-In: I2a0b8c43fb340c3eaed7f0f90464199222a24280
Change-Id: I2a0b8c43fb340c3eaed7f0f90464199222a24280
2021-06-01 14:36:09 +08:00
markchien
35ad54b25e Add the tethering type to TetheringEventCallback methods
Before this change, tethering always report a list of tethered
interfaces and the caller need to use each tethering type's interface
regex to matching tethered list to manual implement the mapping of
tethering type and interface. This change allow caller to get rid of
tethering interface regex.

Bug: 162920185
Bug: 152203943
Test: atest CtsTetheringTest on S

Merged-In: I91bcccd676d109c1b974497ac29bd366a41b8899
Change-Id: I91bcccd676d109c1b974497ac29bd366a41b8899
2021-06-01 14:35:39 +08:00
Remi NGUYEN VAN
43740568b6 Merge "Revert "Add owners block for migration"" 2021-06-01 00:05:06 +00:00
Remi NGUYEN VAN
b22e9ad95d Revert "Add owners block for migration"
The migration is now done.
Modification in revert: kept tests/OWNERS deleted.

Bug: 189375701
Change-Id: Ie105882fc61f7395f2e37711d4849c63e1f7199d
2021-05-31 10:34:04 +00:00
Remi NGUYEN VAN
b2f2271ef1 Merge fixed history of Connectivity
BUG: 189375701
TEST: TH
Merged-In: I37e52cf7d59b6dbcd77879725385c7940318b835
Merged-In: Ie3a058b904cb2e3704c3a0725c8f720f81bb235e
Change-Id: I5e5190b50aee85cc238d927f6499cee2e61f5d60
2021-05-31 03:44:47 +00:00
Anton Hansson
f827199767 Merge "Include sdk versioning proto in tethering apex" 2021-05-27 10:05:22 +00:00
paulhu
91e7806938 Update allowed on restricted networks getter/setter
As API review feedback, setting allowed on restricted networks
should be by uid instead of package name for security reason.
Thus, update the getter/setter to return/accept set of uids.

Bug: 188085693
Test: atest FrameworksNetTests
Merged-In: I979bf98075e6c9c0ed7e891582843fddb62643cb

Change-Id: I979bf98075e6c9c0ed7e891582843fddb62643cb
2021-05-27 16:24:50 +08:00
Anton Hansson
db3b06959f Include sdk versioning proto in tethering apex
Allows SdkExtensions to inspect its version to decide what the extension
sdk version is on-device.

Bug: 188787081
Test: m com.android.tethering and inspect
Merged-In: If2d28b02be871594fed1fbb40b7aad284b553afb
Change-Id: If2d28b02be871594fed1fbb40b7aad284b553afb
2021-05-27 07:35:31 +00:00
Remi NGUYEN VAN
2b579353e3 Merge "Add owners block for migration" 2021-05-27 03:38:59 +00:00
Remi NGUYEN VAN
b69f2c0622 Merge "Set the SDK version to 29 for networking native tests included in MTS" 2021-05-27 02:19:34 +00:00
Remi NGUYEN VAN
89bd526eba Add owners block for migration
The migration will merge history in downstream branches,
so changes should not be submitted in the meantime.

Bug: 189375701
Change-Id: I32d4c6a2d7344b1baf92eeac27b3cbbecd549c2d
Test: TH
2021-05-27 01:13:44 +00:00
Orion Hodson
1cb94175ea Use updated NetworkEventDispatcher API
(cherry picked from commit 1f4fa9ffd5)

Bug: 185153775
Test: m

Merged-In: Iae3cec4f751e1f74ccd26db6f22f55cf21dfc04a
Change-Id: I3259d8f23eebca7cb3e8ac507bb8c5b8774e85f1
2021-05-26 16:44:18 +01:00
Aaron Huang
3f69f1c418 Add required permission to Tethering
The permission of Tethering is moved to a separate xml file,
add the xml module to the required field of tethering app.

Bug: 151213404
Test: TetheringTests
Merged-In: I40b45a0f1b44fba0b68e94811d14725a59ed4e59
Change-Id: I40b45a0f1b44fba0b68e94811d14725a59ed4e59
2021-05-26 23:29:55 +08:00
Nikita Ioffe
d2d0d82a1d Merge "Mark tethering apex as compressible" 2021-05-26 10:29:16 +00:00
Maciej Żenczykowski
fc592e8bc0 Merge "Fix memory access violation in NetworkStack" 2021-05-24 23:56:06 +00:00
Remi NGUYEN VAN
e107f26c5d Merge "Merge history of packages/Connectivity" 2021-05-24 23:32:43 +00:00
Luke Huang
b243be34f7 Set the SDK version to 29 for networking native tests included in MTS
Here comes a new relocations scheme that isn't compatible with Q
devices after aosp/1673945.
In order to avoid our tests are built with the new scheme, set SDK
version to 29.

Bug: 187905499
Test: forrest, atest
Change-Id: I31f13e2b95bacdca4c1897742cada2da169a89fd
2021-05-24 19:33:48 +00:00
Ye Jiao
86f56a135a Fix memory access violation in NetworkStack
Fix memory access violation in com_android_networkstack_tethering_BpfUtils.cpp
caused by invalid format string in com_android_networkstack_tethering_BpfUtils_isEthernet.
If rv is not valid, jniThrowException will format a string using
"Unknown hardware address type %s on interface %s". However, rv is an int but here
"%s" is used in fmt string, thus causing access violation of memory.

Use "%d" instead of "%s" for int.

Bug: 188757793
Change-Id: I9d8ec0708efd747e24b3b3ffed5336434d4f64a7
2021-05-24 06:12:56 +00:00