diff options
author | Kevin F. Haggerty <haggertk@lineageos.org> | 2021-10-05 06:50:48 -0600 |
---|---|---|
committer | Kevin F. Haggerty <haggertk@lineageos.org> | 2021-10-05 06:50:48 -0600 |
commit | 7f7fc2562a95be630dbe609e8fb70383dcfada4f (patch) | |
tree | 7cdcb3da27e7100c9139b66e6099aec2252634ef /tests/net/java/com/android/server/ConnectivityServiceTest.java | |
parent | cf0606c2f73d42e8fd9081f7b635e10b575a0b0c (diff) | |
parent | 49d8b986dddd441df741698541788c5f3a9c465f (diff) |
Merge tag 'android-11.0.0_r46' into staging/lineage-18.1_merge-android-11.0.0_r46
Android 11.0.0 Release 46 (RQ3A.211001.001)
* tag 'android-11.0.0_r46':
Make sure that only the owner can call stopVpnProfile()
DO NOT MERGE Apply a maximum char count to the load label api
Send targeted broadcasts to prevent other apps from receiving them.
Guard DISABLE_PLUGIN with PLUGIN permission.
Fix a potential thread safety issue in VectorDrawable
Fix background bypass via notifications
Change ownership of the account request notification.
Change-Id: I30615811a1c2ee4d670c643d892d1a9f275e2a9c
Diffstat (limited to 'tests/net/java/com/android/server/ConnectivityServiceTest.java')
-rw-r--r-- | tests/net/java/com/android/server/ConnectivityServiceTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java index a5554c740e7f..e9301d1dea9d 100644 --- a/tests/net/java/com/android/server/ConnectivityServiceTest.java +++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java @@ -1224,6 +1224,9 @@ public class ConnectivityServiceTest { Arrays.asList(new UserInfo[] { new UserInfo(VPN_USER, "", 0), })); + final int userId = UserHandle.getCallingUserId(); + final UserInfo primaryUser = new UserInfo(userId, "", UserInfo.FLAG_PRIMARY); + doReturn(primaryUser).when(mUserManager).getUserInfo(eq(userId)); final ApplicationInfo applicationInfo = new ApplicationInfo(); applicationInfo.targetSdkVersion = Build.VERSION_CODES.Q; when(mPackageManager.getApplicationInfoAsUser(anyString(), anyInt(), any())) @@ -1368,6 +1371,9 @@ public class ConnectivityServiceTest { buildPackageInfo(/* SYSTEM */ false, APP2_UID), buildPackageInfo(/* SYSTEM */ false, VPN_UID) })); + final int userId = UserHandle.getCallingUserId(); + when(mPackageManager.getPackageUidAsUser(TEST_PACKAGE_NAME, userId)) + .thenReturn(Process.myUid()); } private void verifyActiveNetwork(int transport) { @@ -7069,6 +7075,18 @@ public class ConnectivityServiceTest { } @Test + public void testStartVpnProfileFromDiffPackage() throws Exception { + final String notMyVpnPkg = "com.not.my.vpn"; + assertThrows(SecurityException.class, () -> mService.startVpnProfile(notMyVpnPkg)); + } + + @Test + public void testStopVpnProfileFromDiffPackage() throws Exception { + final String notMyVpnPkg = "com.not.my.vpn"; + assertThrows(SecurityException.class, () -> mService.stopVpnProfile(notMyVpnPkg)); + } + + @Test public void testUidUpdateChangesInterfaceFilteringRule() throws Exception { LinkProperties lp = new LinkProperties(); lp.setInterfaceName("tun0"); |