Merge "Remove reference of getActiveLinkproperties" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-03-19 15:35:08 +00:00
committed by Android (Google) Code Review

View File

@@ -352,7 +352,10 @@ public class VpnManagerService extends IVpnManager.Stub {
@Override
public void startLegacyVpn(VpnProfile profile) {
int user = UserHandle.getUserId(mDeps.getCallingUid());
final LinkProperties egress = mCm.getActiveLinkProperties();
// Note that if the caller is not system (uid >= Process.FIRST_APPLICATION_UID),
// the code might not work well since getActiveNetwork might return null if the uid is
// blocked by NetworkPolicyManagerService.
final LinkProperties egress = mCm.getLinkProperties(mCm.getActiveNetwork());
if (egress == null) {
throw new IllegalStateException("Missing active network connection");
}