Commit graph android_packages_modules_Co.../tests/unit/java/com/android/server
Message SHA1
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

paulhu   commited 2021-06-07 08:55:16 +00:00
4428044569
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

paulhu   commited 2021-06-07 08:54:12 +00:00
eb43848207
Merge "Update allowed on restricted networks getter/setter"
Paul Hu   authored and   Gerrit Code Review   commited 2021-06-04 10:31:50 +00:00
c30c57c210
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

Remi NGUYEN VAN   commited 2021-06-01 18:41:33 +09:00
8ae54f7a3e
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

paulhu   commited 2021-05-27 16:24:50 +08:00
91e7806938
Merge "Check location permission for ConnDiags last."
Cody Kesting   authored and   Gerrit Code Review   commited 2021-05-20 21:27:46 +00:00
7f092f1f90
Merge "Check location permission for ConnDiags last."
Cody Kesting   authored and   Gerrit Code Review   commited 2021-05-20 21:27:46 +00:00
c5f9939bf3
Merge "Move IoUtils#deleteContents from CorePlatformApi set to framework"
Nikita Iashchenko   authored and   Gerrit Code Review   commited 2021-05-18 22:13:56 +00:00
1ae284330f
Merge "Move IoUtils#deleteContents from CorePlatformApi set to framework"
Nikita Iashchenko   authored and   Gerrit Code Review   commited 2021-05-18 22:13:56 +00:00
fc41cdfd4c
Merge "Support to query TYPE_WIFI usage with subscriberId"
Les Lee   authored and   Gerrit Code Review   commited 2021-05-18 13:02:07 +00:00
c0e15c5db2
Merge "Support to query TYPE_WIFI usage with subscriberId"
Les Lee   authored and   Gerrit Code Review   commited 2021-05-18 13:02:07 +00:00
ad9e8eeabd
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

Cody Kesting   commited 2021-05-17 19:36:47 -07:00
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

Cody Kesting   commited 2021-05-17 19:36:47 -07:00
8533f883c2
Merge "Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 06:45:52 +00:00
ca98d3d814
Merge "Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 06:45:52 +00:00
43864e564b
Merge "Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 03:04:59 +00:00
0576511565
Merge "Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 03:04:59 +00:00
8665f56ca1
Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer
PermissionMonitor register APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting observer to listen setting changed callback. Then update
or revoke permission for those apps.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I4b6a21bd3f47b7bcaac36fcabf1202a5a84a4520

paulhu   authored and   Paul Hu   commited 2021-05-16 15:52:36 +00:00
85b4bec5b3
Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer
PermissionMonitor register APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting observer to listen setting changed callback. Then update
or revoke permission for those apps.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I4b6a21bd3f47b7bcaac36fcabf1202a5a84a4520

paulhu   authored and   Paul Hu   commited 2021-05-16 15:52:36 +00:00
f11da7e205
Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor
Let PermissionMonitor read APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting and grant netd system permission to uids whose package
name is listed in setting.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I856b545c0339a262abbe9d432cfda125bc82dc12

paulhu   commited 2021-05-16 23:48:55 +08:00
4f18561e9c
Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor
Let PermissionMonitor read APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting and grant netd system permission to uids whose package
name is listed in setting.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I856b545c0339a262abbe9d432cfda125bc82dc12

paulhu   commited 2021-05-16 23:48:55 +08:00
a7b9535fde
Support to query TYPE_WIFI usage with subscriberId
Previous the API ignores subscriberId when network type is WIFI.
Allow caller to call querySummaryXXXX with TYPE: WIFI
+ subscriberId: IMSI to get carrier merged wifi usage which matches the wifi
network with the given IMSI.

Bug: 176396812
Test: atest -c NetworkStatsServiceTest
Change-Id: Ia033521a24e2bb56182d74a41bb2b39710571782

lesl   authored and   Les Lee   commited 2021-05-16 22:18:32 +08:00
c22e8b8413
Support to query TYPE_WIFI usage with subscriberId
Previous the API ignores subscriberId when network type is WIFI.
Allow caller to call querySummaryXXXX with TYPE: WIFI
+ subscriberId: IMSI to get carrier merged wifi usage which matches the wifi
network with the given IMSI.

Bug: 176396812
Test: atest -c NetworkStatsServiceTest
Change-Id: Ia033521a24e2bb56182d74a41bb2b39710571782

lesl   authored and   Les Lee   commited 2021-05-16 22:18:32 +08:00
614551c3b6
[FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a

junyulai   commited 2021-05-14 19:48:17 +08:00
1df306006e
[FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a

junyulai   commited 2021-05-14 19:48:17 +08:00
07f3432fab
[FUI26] Address comments on aosp/1560408
Test: TH
Bug: 174123988
Change-Id: I949eeb8903e903d8ede90521442b1f917d5cdfeb

junyulai   commited 2021-05-14 15:57:44 +08:00
369be87265
[FUI26] Address comments on aosp/1560408
Test: TH
Bug: 174123988
Change-Id: I949eeb8903e903d8ede90521442b1f917d5cdfeb

junyulai   commited 2021-05-14 15:57:44 +08:00
c6422b78ea
Rename *Iface* APIs to *Interface*
Address API review feedback, other APIs have been refering to
these as "interface" instead of "iface" so migrate the APIs named
*Iface* to *Interface*.

(cherry-picked from ag/14326779)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: I38b476e762fb57fa88c4a789092d0af6f5330d80
Change-Id: I38b476e762fb57fa88c4a789092d0af6f5330d80

Aaron Huang   commited 2021-05-14 11:05:22 +08:00
3c4e669929
Rename *Iface* APIs to *Interface*
Address API review feedback, other APIs have been refering to
these as "interface" instead of "iface" so migrate the APIs named
*Iface* to *Interface*.

(cherry-picked from ag/14326779)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: I38b476e762fb57fa88c4a789092d0af6f5330d80
Change-Id: I38b476e762fb57fa88c4a789092d0af6f5330d80

Aaron Huang   commited 2021-05-14 11:05:22 +08:00
9ff12842da
Move IoUtils#deleteContents from CorePlatformApi set to framework
As a part of internal core libraries cleanup move usages of
IoUtils#deleteContents from CorePlatformApi set to framework.

Bug: 154796679
Test: m update-api
Change-Id: If7037029026b6753ab64be09aa52c40e04d5c7b1

Nikita Iashchenko   commited 2021-05-13 14:23:54 +01:00
bac20e3a23
Move IoUtils#deleteContents from CorePlatformApi set to framework
As a part of internal core libraries cleanup move usages of
IoUtils#deleteContents from CorePlatformApi set to framework.

Bug: 154796679
Test: m update-api
Change-Id: If7037029026b6753ab64be09aa52c40e04d5c7b1

Nikita Iashchenko   commited 2021-05-13 14:23:54 +01:00
0312c4593d
Do not automatically redact TransportInfo objects.
Currently, NetworkCapabilities always redacts the TransportInfo
objects it contains whenever a defensive copy is made. This makes
it impossible to make a defensive copy on a TransportInfo
parcelled from another process without redacting it.

Stop redacting by default; instead rely on ConnectivityService
explicitly calling NetworkCapabilities' redacting constructor
when it returns a NetworkCapabilities object to an app via a
callback or synchronous call. This is currently done by
- createWithLocationInfoSanitizedIfNecessaryWhenParceled, which
  is called from callCallbackForRequest, getNetworkCapabilities,
  and getDefaultNetworkCapabilitiesForUser.
- getNetworkCapabilitiesWithoutUids, which is used when sending
  ConnectivityDiagnosticsManager callbacks. In this method,
  unconditionally redact all information, which is what the code
  did previously due to the default redaction setting for empty
  NetworkCapabilities objects being REDACT_ALL.

Bug: 183938194
Test: atest NetworkCapabilitiesTest
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82

Lorenzo Colitti   commited 2021-05-13 20:24:19 +09:00
a869887d4f
Do not automatically redact TransportInfo objects.
Currently, NetworkCapabilities always redacts the TransportInfo
objects it contains whenever a defensive copy is made. This makes
it impossible to make a defensive copy on a TransportInfo
parcelled from another process without redacting it.

Stop redacting by default; instead rely on ConnectivityService
explicitly calling NetworkCapabilities' redacting constructor
when it returns a NetworkCapabilities object to an app via a
callback or synchronous call. This is currently done by
- createWithLocationInfoSanitizedIfNecessaryWhenParceled, which
  is called from callCallbackForRequest, getNetworkCapabilities,
  and getDefaultNetworkCapabilitiesForUser.
- getNetworkCapabilitiesWithoutUids, which is used when sending
  ConnectivityDiagnosticsManager callbacks. In this method,
  unconditionally redact all information, which is what the code
  did previously due to the default redaction setting for empty
  NetworkCapabilities objects being REDACT_ALL.

Bug: 183938194
Test: atest NetworkCapabilitiesTest
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82

Lorenzo Colitti   commited 2021-05-13 20:24:19 +09:00
6424cf294f
Move net unit tests to packages/Connectivity
Move the tests together with packages/Connectivity code, so both can be
moved to packages/modules/Connectivity together.

Also reorganize unit tests in a unit/ directory, as other tests
(integration/, common/ etc.) have been added in tests/net since they
were created. This makes the directory structure consistent.

Test: atest FrameworksNetTests
Bug: 187814163
Merged-In: I254ffd1c08ec058d594b4ea55cbae5505f8497cc

Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc

Remi NGUYEN VAN   commited 2021-05-13 08:30:33 +00:00
5ed250d90a
Move net unit tests to packages/Connectivity
Move the tests together with packages/Connectivity code, so both can be
moved to packages/modules/Connectivity together.

Also reorganize unit tests in a unit/ directory, as other tests
(integration/, common/ etc.) have been added in tests/net since they
were created. This makes the directory structure consistent.

Test: atest FrameworksNetTests
Bug: 187814163
Merged-In: I254ffd1c08ec058d594b4ea55cbae5505f8497cc

Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc

Remi NGUYEN VAN   commited 2021-05-13 08:30:33 +00:00
31022d6cda