Add the calling package name to requestRouteToHost

The calling package name will be used to check if an application is a
system application when deciding if a route should be exempt from VPN
routing rules.

Bug: 12937545
Change-Id: I2c09c875fe9bb9685871a0a801ddcbb32fc17405
This commit is contained in:
Chad Brubaker 2014-02-14 13:22:34 -08:00
commit edf0ac7298
2 changed files with 12 additions and 8 deletions

View file

@ -395,6 +395,8 @@ public class ConnectivityManager {
private final IConnectivityManager mService;
private final String mPackageName;
/**
* Tests if a given integer represents a valid network type.
* @param networkType the type to be tested
@ -802,7 +804,7 @@ public class ConnectivityManager {
public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) {
byte[] address = hostAddress.getAddress();
try {
return mService.requestRouteToHostAddress(networkType, address);
return mService.requestRouteToHostAddress(networkType, address, mPackageName);
} catch (RemoteException e) {
return false;
}
@ -898,8 +900,9 @@ public class ConnectivityManager {
/**
* {@hide}
*/
public ConnectivityManager(IConnectivityManager service) {
public ConnectivityManager(IConnectivityManager service, String packageName) {
mService = checkNotNull(service, "missing IConnectivityManager");
mPackageName = checkNotNull(packageName, "missing package name");
}
/** {@hide} */

View file

@ -71,9 +71,9 @@ interface IConnectivityManager
int stopUsingNetworkFeature(int networkType, in String feature);
boolean requestRouteToHost(int networkType, int hostAddress);
boolean requestRouteToHost(int networkType, int hostAddress, String packageName);
boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress);
boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress, String packageName);
boolean getMobileDataEnabled();
void setMobileDataEnabled(boolean enabled);