From 6e9ab0553d391e1ca25d27cae3780d0c2b3f676b Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Thu, 18 Feb 2021 03:37:49 +0000 Subject: [PATCH] Use RouteInfo API constructor in VpnService Instead of using the RouteInfo(destination, gateway) constructor which is private API, use the RouteInfo(destination, gateway, iface, type) constructor which is system API. This separates the VpnService better from internal implementations, and is necessary to move RouteInfo to the connectivity module. Bug: 174436414 Test: m Change-Id: Idc98b2258f3c78bdba40b5fcb97769b5ad99d016 --- core/java/android/net/VpnService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java index e43b0b6fa6358..f90fbaf1e0fb7 100644 --- a/core/java/android/net/VpnService.java +++ b/core/java/android/net/VpnService.java @@ -596,7 +596,8 @@ public class VpnService extends Service { } } } - mRoutes.add(new RouteInfo(new IpPrefix(address, prefixLength), null)); + mRoutes.add(new RouteInfo(new IpPrefix(address, prefixLength), null, null, + RouteInfo.RTN_UNICAST)); mConfig.updateAllowedFamilies(address); return this; }