Merge "Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting" into sc-dev am: 48fc715694

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14772857

Change-Id: I45b1bc2e2930454d8a7fb662153d46e762da62b4
This commit is contained in:
Paul Hu
2021-06-07 09:48:36 +00:00
committed by Automerger Merge Worker
3 changed files with 6 additions and 6 deletions

View File

@@ -1070,7 +1070,7 @@ public class ConnectivitySettingsManager {
*/ */
@NonNull @NonNull
public static Set<Integer> getUidsAllowedOnRestrictedNetworks(@NonNull Context context) { public static Set<Integer> getUidsAllowedOnRestrictedNetworks(@NonNull Context context) {
final String uidList = Settings.Secure.getString( final String uidList = Settings.Global.getString(
context.getContentResolver(), UIDS_ALLOWED_ON_RESTRICTED_NETWORKS); context.getContentResolver(), UIDS_ALLOWED_ON_RESTRICTED_NETWORKS);
return getUidSetFromString(uidList); return getUidSetFromString(uidList);
} }
@@ -1084,7 +1084,7 @@ public class ConnectivitySettingsManager {
public static void setUidsAllowedOnRestrictedNetworks(@NonNull Context context, public static void setUidsAllowedOnRestrictedNetworks(@NonNull Context context,
@NonNull Set<Integer> uidList) { @NonNull Set<Integer> uidList) {
final String uids = getUidStringFromSet(uidList); final String uids = getUidStringFromSet(uidList);
Settings.Secure.putString(context.getContentResolver(), UIDS_ALLOWED_ON_RESTRICTED_NETWORKS, Settings.Global.putString(context.getContentResolver(), UIDS_ALLOWED_ON_RESTRICTED_NETWORKS,
uids); uids);
} }
} }

View File

@@ -197,7 +197,7 @@ public class PermissionMonitor {
// Register UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer // Register UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer
mDeps.registerContentObserver( mDeps.registerContentObserver(
userAllContext, userAllContext,
Settings.Secure.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS), Settings.Global.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS),
false /* notifyForDescendants */, false /* notifyForDescendants */,
new ContentObserver(null) { new ContentObserver(null) {
@Override @Override

View File

@@ -920,7 +920,7 @@ public class PermissionMonitorTest {
public void testUidsAllowedOnRestrictedNetworksChanged() throws Exception { public void testUidsAllowedOnRestrictedNetworksChanged() throws Exception {
final NetdMonitor netdMonitor = new NetdMonitor(mNetdService); final NetdMonitor netdMonitor = new NetdMonitor(mNetdService);
final ContentObserver contentObserver = expectRegisterContentObserver( final ContentObserver contentObserver = expectRegisterContentObserver(
Settings.Secure.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS)); Settings.Global.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS));
mPermissionMonitor.onUserAdded(MOCK_USER1); mPermissionMonitor.onUserAdded(MOCK_USER1);
// Prepare PackageInfo for MOCK_PACKAGE1 and MOCK_PACKAGE2 // Prepare PackageInfo for MOCK_PACKAGE1 and MOCK_PACKAGE2
@@ -954,7 +954,7 @@ public class PermissionMonitorTest {
public void testUidsAllowedOnRestrictedNetworksChangedWithSharedUid() throws Exception { public void testUidsAllowedOnRestrictedNetworksChangedWithSharedUid() throws Exception {
final NetdMonitor netdMonitor = new NetdMonitor(mNetdService); final NetdMonitor netdMonitor = new NetdMonitor(mNetdService);
final ContentObserver contentObserver = expectRegisterContentObserver( final ContentObserver contentObserver = expectRegisterContentObserver(
Settings.Secure.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS)); Settings.Global.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS));
mPermissionMonitor.onUserAdded(MOCK_USER1); mPermissionMonitor.onUserAdded(MOCK_USER1);
buildAndMockPackageInfoWithPermissions(MOCK_PACKAGE1, MOCK_UID1, CHANGE_NETWORK_STATE); buildAndMockPackageInfoWithPermissions(MOCK_PACKAGE1, MOCK_UID1, CHANGE_NETWORK_STATE);
@@ -988,7 +988,7 @@ public class PermissionMonitorTest {
public void testUidsAllowedOnRestrictedNetworksChangedWithMultipleUsers() throws Exception { public void testUidsAllowedOnRestrictedNetworksChangedWithMultipleUsers() throws Exception {
final NetdMonitor netdMonitor = new NetdMonitor(mNetdService); final NetdMonitor netdMonitor = new NetdMonitor(mNetdService);
final ContentObserver contentObserver = expectRegisterContentObserver( final ContentObserver contentObserver = expectRegisterContentObserver(
Settings.Secure.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS)); Settings.Global.getUriFor(UIDS_ALLOWED_ON_RESTRICTED_NETWORKS));
// One user MOCK_USER1 // One user MOCK_USER1
mPermissionMonitor.onUserAdded(MOCK_USER1); mPermissionMonitor.onUserAdded(MOCK_USER1);