Merge changes from topics "vpnmove-getconnectionowneruid", "vpnmove-systemdefaultcallback", "vpnmove-vpntransportinfo" am: 43b96c711b

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibe397a58700e8ad1077a011a9a98f7478f0dc60e
This commit is contained in:
Lorenzo Colitti
2021-02-10 06:55:58 +00:00
committed by Automerger Merge Worker

View File

@@ -829,8 +829,11 @@ public class VpnTest extends InstrumentationTestCase {
InetSocketAddress rem = new InetSocketAddress(s.getInetAddress(), s.getPort());
try {
int uid = mCM.getConnectionOwnerUid(OsConstants.IPPROTO_TCP, loc, rem);
fail("Only an active VPN app may call this API.");
} catch (SecurityException expected) {
assertEquals("Only an active VPN app should see connection information",
INVALID_UID, uid);
} catch (SecurityException acceptable) {
// R and below throw SecurityException if a non-active VPN calls this method.
// As long as we can't actually get socket information, either behaviour is fine.
return;
}
}