diff options
author | alk3pInjection <webmaster@raspii.tech> | 2021-10-12 16:30:00 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2021-10-12 16:30:00 +0800 |
commit | 1ba1f89e6edc78f03d649d09b58b25c7c8d935fe (patch) | |
tree | 31fc1df791156dc27089111790c1d0ad81ad820c /tests/net/java/com/android/server/ConnectivityServiceTest.java | |
parent | d2469b4fe8cf9d428606b1bec1acd8e93e9df085 (diff) | |
parent | 7f7fc2562a95be630dbe609e8fb70383dcfada4f (diff) |
Merge remote-tracking branch 'upstream/lineage-18.1' into lineage-18.1
* upstream/lineage-18.1:
[1/2] Add battery info to tvsettings device info
(-) SystemUI: fix volume dialog position on TV
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.
Conflicts:
packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
Change-Id: Ic64698088ee30b059623adf0f262d4f33a4e40df
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"); |