Commit graph android_packages_modules_Co.../service/src/com/android/server/ConnectivityService.java
Message SHA1
Require location permission for ConnDiags WiFi only.
This CL updates ConnectivityDiagnostics permission checks in
ConnectivityService to only require location permission for Networks
that have TRANSPORT_WIFI. This change is consistent with the location
restrictions required for the transports themselves. Previously,
location permissions were required for all Network types.

Bug: 187310575
Test: atest ConnectivityServiceTest ConnectivityDiagnosticsManagerTest
Change-Id: I48806533e4e705d2d9be45f3b3d3931d9294b167
Merged-In: I48806533e4e705d2d9be45f3b3d3931d9294b167
(cherry picked from commit 0990af5148)

Treehugger Robot   authored and   Cody Kesting   commited 2021-06-07 22:17:05 +00:00
27b6888364
Merge "Implement mobile data preferred uids feature" into sc-dev
Paul Hu   authored and   Android (Google) Code Review   commited 2021-06-04 08:55:31 +00:00
87f2897f90
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
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I5153c770650594e05dfa8cf230d7381d790f4a55

paulhu   commited 2021-06-02 15:40:53 +08:00
71ad4f1175
Remove framework-connectivity-annotations library
This library can be removed because the annotations are no longer
used out of module.

@RestrictBackgroundStatus and @MultipathPreference are defined
in connectivity mainline module. Annotate these in non-updatable
platform is not going to be manageable long term. For example,
if the module gets updated and the annotation gets more values
then it's a problem in non-updatable platform. So, it should
not have IntDef cross module boundaries.

Ignore-AOSP-First: AOSP doesn't include this change yet
Bug: 183972925
Test: build
Change-Id: I63f1fde73c4ffdaff9fda914e33cbb5a110ba64e

Aaron Huang   commited 2021-06-01 06:47:47 +00:00
cff22949d2
Merge "Check location permission for ConnDiags last." into sc-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2021-05-22 05:01:18 +00:00
424e2ef3aa
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
Merged-In: I2dbeddac6273e2392ccaeae51a1c7776d6d3da75
(cherry picked from commit f3d0fc49db)

Cody Kesting   commited 2021-05-21 16:22:50 +00:00
0b4be0203d
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
Merged-In: If2dd69f702a1eafff331f9e71f6b92aeadfb715d
Change-Id: If2dd69f702a1eafff331f9e71f6b92aeadfb715d
(cherry picked from commit 10ba4b773b)

Treehugger Robot   authored and   Chiachang Wang   commited 2021-05-21 08:01:37 +00:00
fac2a72593
Merge "Check NETWORK_SETTINGS permission for getAllNetworkStateSnapshots" into sc-dev
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2021-05-20 03:59:55 +00:00
6f0f141cd5
Merge "Remove legacy resources fallback from Connectivity" into sc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2021-05-20 03:03:16 +00:00
4c0e93f15b
Merge changes I3ba50cbd,I970ee365 into sc-dev
* changes:
  [FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
  [FUI27] Fix internal naming of notifyNetworkStatus

Junyu Lai   authored and   Android (Google) Code Review   commited 2021-05-19 12:36:03 +00:00
458a60dab5
Remove legacy resources fallback from Connectivity
Stop reading legacy resources as fallback, and only use resources in
ServiceConnectivityResources.

Bug: 185850634
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I224f1ef9a1a8d6e636c7e9550845ab3e1394d7f3

Remi NGUYEN VAN   commited 2021-05-19 12:13:48 +09:00
1423347938
Merge "Dump only NORMAL priority information if no priority assigned" into sc-dev
Chiachang Wang   authored and   Android (Google) Code Review   commited 2021-05-18 11:57:53 +00:00
646af9c067
Allow unprivileged NetworkCallbacks to see other UIDs' networks.
Currently, unprivileged apps can call getAllNetworks() to see
all networks on the system, even networks that do not apply to
them. Allow them to do this via NetworkCallbacks as well.

This is the last piece of information that was only available
through getAllNetworks, so this CL deprecates that API.

Bug: 187921303
Test: new unit tests
Test: CTS test in other CL in topic
Change-Id: I30f1021927d3c8eae6525116c61ff4a4acecff6d

Lorenzo Colitti   commited 2021-05-18 12:24:07 +09:00
86714b1fd2
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
Merged-In: I6825c5038e48e3060c0c3ad1512bd584ef6d10a7

Chiachang Wang   commited 2021-05-18 02:13:42 +00:00
12d32a673f
Merge "Add ConnectivityAnnotations class" into sc-dev
Aaron Huang   authored and   Android (Google) Code Review   commited 2021-05-17 14:07:45 +00:00
1bbb7a7570
Check NETWORK_SETTINGS permission for getAllNetworkStateSnapshots
This is declared in the API surface, but the implementation
does not match.

Ignore-AOSP-First: Needs cherry-picks
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testGetAllNetworkStateSnapshots
Bug: 188140631
Change-Id: I97aa69651461ebe5c323ec669372f9a61b84e6a6

junyulai   commited 2021-05-17 21:53:18 +08:00
7968fba7ad
[FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
Test: atest FrameworksNetTests
Bug: 174123988
Merged-In: I3ba50cbd8a7f60779c69ba85e10dc3cc8a52f8b1
Change-Id: I3ba50cbd8a7f60779c69ba85e10dc3cc8a52f8b1
  (cherry-picked from aosp/1620859)

junyulai   commited 2021-05-17 14:07:00 +08:00
0f57022302
Merge "Reference unreachable netId from INetd" am: 01be14fd53 am: 68413f8a69 am: 3bf71e4e85
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1708326

Change-Id: Ia8db25ba86450341d4b9278eba350014fa3b880c

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-05-14 10:06:00 +00:00
5c6bb2dfdb
Reference unreachable netId from INetd
Bug: 181579204
Test: m; atest FrameworksNetTests
Change-Id: Id0d30363abe583459a8022e7400aab1dd4f72939

Ken Chen   commited 2021-05-14 14:30:43 +08:00
4f612fae1f
Add ConnectivityAnnotations class
This change is to address API review, add respective
@IntDef for network policy API.

Typedef cannot be exposed as SystemApi so add
ConnectivityAnnotations class and add an annotation library
so that it can be used in module and platform.

Bug: 183972925
Test: m, build doc target framework-doc-stubs_annotations.zip
      and check the APIs have an attribute IntDef annotation
Change-Id: Ie3ec40cf48818edd422a4550377774eae387d3b2

Aaron Huang   commited 2021-05-14 10:30:49 +08:00
6a7e6ad55c
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

Remi NGUYEN VAN   commited 2021-05-13 18:18:42 +00:00
cdb45f8e37
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
Change-Id: I26d1a274058fa38763ad4f605549d880865b4d76

Remi NGUYEN VAN   commited 2021-05-13 12:44:09 +00:00
028cb1b7a8