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
This commit is contained in:
junyulai
2021-05-14 18:04:29 +08:00
parent 65a0e0d0e5
commit 7968fba7ad

View File

@@ -2210,7 +2210,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
@NonNull
public List<NetworkStateSnapshot> getAllNetworkStateSnapshots() {
// This contains IMSI details, so make sure the caller is privileged.
PermissionUtils.enforceNetworkStackPermission(mContext);
enforceNetworkStackOrSettingsPermission();
final ArrayList<NetworkStateSnapshot> result = new ArrayList<>();
for (Network network : getAllNetworks()) {