Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c63ebbb authored by Chalard Jean's avatar Chalard Jean Committed by Automerger Merge Worker
Browse files

Merge "Fix a bug where the wrong profile is queried" am: f83190c2 am: 92d3c13e am: a776c7ca

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1662362

Change-Id: I5498b7eb2b1b3e4e195ac47d8d3b471496b779b6
parents 1b5c3c49 a776c7ca
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -9525,14 +9525,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
            throw new IllegalArgumentException("Must explicitly specify a user handle ("
                    + "UserHandle.CURRENT not supported)");
        }
        final UserManager um;
        try {
            um = mContext.createContextAsUser(profile, 0 /* flags */)
                    .getSystemService(UserManager.class);
        } catch (IllegalStateException e) {
            throw new IllegalArgumentException("Profile does not exist");
        }
        if (!um.isManagedProfile()) {
        final UserManager um = mContext.getSystemService(UserManager.class);
        if (!um.isManagedProfile(profile.getIdentifier())) {
            throw new IllegalArgumentException("Profile must be a managed profile");
        }
        // Strictly speaking, mOemNetworkPreferences should only be touched on the
+1 −0
Original line number Diff line number Diff line
@@ -578,6 +578,7 @@ public class ConnectivityServiceTest {
            final UserManager umMock = createContextAsUser(userHandle, 0 /* flags */)
                    .getSystemService(UserManager.class);
            doReturn(value).when(umMock).isManagedProfile();
            doReturn(value).when(mUserManager).isManagedProfile(eq(userHandle.getIdentifier()));
        }
        @Override