Commit Graph

15 Commits

Author SHA1 Message Date
James Mattis
b6b6a4335a Correctly get uids for per-app network preferences
Per-app network functionality assumed all apps were installed for user 0
which is not always the case. This fix will address that by checking for
the existance of an app for all users and adding it to the per-app
network preference as was originally intended. Prior, no apps were
included if they were not installed for user 0 even if they were
available for another user such as user 10 in automotive.

Bug: 189838408
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCases

Change-Id: I7d75cdb02041e7a202254be2eaeca6c2b02d7c29
2021-06-06 23:51:05 -07:00
paulhu
51f77dcc49 Implement mobile data preferred uids feature
- Read MOBILE_DATA_PREFERRED_UIDS setting when system ready
- Register MOBILE_DATA_PREFERRED_UIDS setting observer
- Send uid ranges to netd when update mobile data preferred uids

Bug: 171872461
Test: atest FrameworksNetTests
Merged-In: I5153c770650594e05dfa8cf230d7381d790f4a55
(cherry-pick with minor conflicts)

Change-Id: I5153c770650594e05dfa8cf230d7381d790f4a55
2021-06-07 02:55:25 +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
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
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
Treehugger Robot
8d8404ef8f Merge "Use CS identity to update setting while performing factory reset" 2021-05-21 01:26:05 +00:00
Cody Kesting
7f092f1f90 Merge "Check location permission for ConnDiags last." 2021-05-20 21:27:46 +00:00
Chiachang Wang
fe28d9b0ad Use CS identity to update setting while performing factory reset
When apps try to call factoryReset to do networking reset, it
will result in updating the setting in SettingsProvider.
ContentProvider will verify if the package name of the caller
that initiated the request being processed on the current thread.
The package should belong to the calling UID. The setting update
started from the ConnectivityService context, so the package will
be android but the calling UID will be the calling app. It will
cause a SecurityException. The behavior is fine previously as its
known caller(Settings) shares system UID. But it will be a
problem for other callers, such as CTS. Thus, clear the identity
since the necessary permission check should be examined at the
top of the method. The following actions should be fine to be
proceed from the system itself. Also replace the user restriction
check via hasUserRestrictionForUser with the UserHandle created
from the calling uid to ensure it's verified with correct user.

Bug: 186061922
Test: Factory reset from Settings
Change-Id: If2dd69f702a1eafff331f9e71f6b92aeadfb715d
2021-05-20 10:01:50 +08:00
Cody Kesting
160ef3936a Check location permission for ConnDiags last.
This CL updates ConnectivityService to check location permissions for
ConnectivityDiagnostics callbacks last in the permission check process.
This minimizes misattribution of location access for networks that an
app is not administering.

This CL also updates ConnectivityDiagnosticsManager documentation to
clearly state that location permissions are required in order to receive
callbacks.

Bug: 187310575
Test: atest ConnectivityDiagnosticsManagerTest
Test: atest ConnectivityServiceTest
Change-Id: I2dbeddac6273e2392ccaeae51a1c7776d6d3da75
2021-05-17 19:36:47 -07:00
Chiachang Wang
05fbb45936 Dump only NORMAL priority information if no priority assigned
The legacy design of "dumpsys connectivity" will only dump
information with NORMAL priority. It was updated to provide
both NORMAL and HIGH priority information in order to support
dump in bugreport. However, it will also affect the result
using dumpsys connectivity.

Update design to dump NORMAL priority only to align with legacy
design.

Bug: 188387185
Test: adb shell dumpsys connectivity
Test: adb bugreport and check the result in bugreport
Change-Id: I6825c5038e48e3060c0c3ad1512bd584ef6d10a7
2021-05-17 17:31:07 +08:00
junyulai
69114dacb2 [FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: I3ba50cbd8a7f60779c69ba85e10dc3cc8a52f8b1
2021-05-14 19:48:17 +08:00
Ken Chen
75c6d334c1 Reference unreachable netId from INetd
Bug: 181579204
Test: m; atest FrameworksNetTests
Change-Id: Id0d30363abe583459a8022e7400aab1dd4f72939
2021-05-14 14:30:43 +08:00
Remi NGUYEN VAN
4febb21cb6 Move connectivity sources to packages/Connectivity
The service-connectivity sources should be in
packages/modules/Connectivity. Move them to
frameworks/base/packages/Connectivity, so that the whole directory can
be moved to the dedicated packages/modules/Connectivity git project.

Bug: 186628461
Test: m
Merged-In: I26d1a274058fa38763ad4f605549d880865b4d76
Change-Id: Ie0562db92ebee269b901926d763ae907bde61b98
2021-05-13 18:18:42 +00:00