Merge "Make callers of RoutingCoordinatorService pass in RouteInfoParcel" into main
This commit is contained in:
commit
a4f34a8836
5 changed files with 24 additions and 66 deletions
|
|
@ -362,6 +362,7 @@ import com.android.net.module.util.LinkPropertiesUtils;
|
|||
import com.android.net.module.util.LinkPropertiesUtils.CompareOrUpdateResult;
|
||||
import com.android.net.module.util.LinkPropertiesUtils.CompareResult;
|
||||
import com.android.net.module.util.LocationPermissionChecker;
|
||||
import com.android.net.module.util.NetdUtils;
|
||||
import com.android.net.module.util.PerUidCounter;
|
||||
import com.android.net.module.util.PermissionUtils;
|
||||
import com.android.net.module.util.RoutingCoordinatorService;
|
||||
|
|
@ -10583,7 +10584,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
if (route.hasGateway()) continue;
|
||||
if (VDBG || DDBG) log("Adding Route [" + route + "] to network " + netId);
|
||||
try {
|
||||
mRoutingCoordinatorService.addRoute(netId, route);
|
||||
mRoutingCoordinatorService.addRouteParcel(netId,
|
||||
NetdUtils.toRouteInfoParcel(route));
|
||||
} catch (Exception e) {
|
||||
if ((route.getDestination().getAddress() instanceof Inet4Address) || VDBG) {
|
||||
loge("Exception in addRoute for non-gateway: " + e);
|
||||
|
|
@ -10594,7 +10596,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
if (!route.hasGateway()) continue;
|
||||
if (VDBG || DDBG) log("Adding Route [" + route + "] to network " + netId);
|
||||
try {
|
||||
mRoutingCoordinatorService.addRoute(netId, route);
|
||||
mRoutingCoordinatorService.addRouteParcel(netId,
|
||||
NetdUtils.toRouteInfoParcel(route));
|
||||
} catch (Exception e) {
|
||||
if ((route.getGateway() instanceof Inet4Address) || VDBG) {
|
||||
loge("Exception in addRoute for gateway: " + e);
|
||||
|
|
@ -10605,7 +10608,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
for (RouteInfo route : routeDiff.removed) {
|
||||
if (VDBG || DDBG) log("Removing Route [" + route + "] from network " + netId);
|
||||
try {
|
||||
mRoutingCoordinatorService.removeRoute(netId, route);
|
||||
mRoutingCoordinatorService.removeRouteParcel(netId,
|
||||
NetdUtils.toRouteInfoParcel(route));
|
||||
} catch (Exception e) {
|
||||
loge("Exception in removeRoute: " + e);
|
||||
}
|
||||
|
|
@ -10614,7 +10618,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
for (RouteInfo route : routeDiff.updated) {
|
||||
if (VDBG || DDBG) log("Updating Route [" + route + "] from network " + netId);
|
||||
try {
|
||||
mRoutingCoordinatorService.updateRoute(netId, route);
|
||||
mRoutingCoordinatorService.updateRouteParcel(netId,
|
||||
NetdUtils.toRouteInfoParcel(route));
|
||||
} catch (Exception e) {
|
||||
loge("Exception in updateRoute: " + e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -618,6 +618,9 @@ aidl_interface {
|
|||
visibility: [
|
||||
"//system/tools/aidl/build",
|
||||
],
|
||||
imports: [
|
||||
"netd_aidl_interface-V17", // For RouteInfoParcel.
|
||||
],
|
||||
}
|
||||
|
||||
// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import android.net.LinkProperties;
|
|||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.RouteInfo;
|
||||
import android.net.RouteInfoParcel;
|
||||
|
||||
import com.android.net.module.util.IIpv4PrefixRequest;
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ import com.android.net.module.util.IIpv4PrefixRequest;
|
|||
// invocation to an incorrect interface" when calling the IPC.
|
||||
@Descriptor("value=no.jarjar.com.android.net.module.util.IRoutingCoordinator")
|
||||
interface IRoutingCoordinator {
|
||||
|
||||
/**
|
||||
* Add a route for specific network
|
||||
*
|
||||
|
|
@ -38,7 +40,7 @@ interface IRoutingCoordinator {
|
|||
* @throws ServiceSpecificException in case of failure, with an error code indicating the
|
||||
* cause of the failure.
|
||||
*/
|
||||
void addRoute(int netId, in RouteInfo route);
|
||||
void addRouteParcel(int netId, in RouteInfoParcel route);
|
||||
|
||||
/**
|
||||
* Remove a route for specific network
|
||||
|
|
@ -48,7 +50,7 @@ interface IRoutingCoordinator {
|
|||
* @throws ServiceSpecificException in case of failure, with an error code indicating the
|
||||
* cause of the failure.
|
||||
*/
|
||||
void removeRoute(int netId, in RouteInfo route);
|
||||
void removeRouteParcel(int netId, in RouteInfoParcel route);
|
||||
|
||||
/**
|
||||
* Update a route for specific network
|
||||
|
|
@ -58,7 +60,7 @@ interface IRoutingCoordinator {
|
|||
* @throws ServiceSpecificException in case of failure, with an error code indicating the
|
||||
* cause of the failure.
|
||||
*/
|
||||
void updateRoute(int netId, in RouteInfo route);
|
||||
void updateRouteParcel(int netId, in RouteInfoParcel route);
|
||||
|
||||
/**
|
||||
* Adds an interface to a network. The interface must not be assigned to any network, including
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import android.net.LinkAddress;
|
|||
import android.net.LinkProperties;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.RouteInfo;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
|
||||
|
|
@ -50,54 +49,6 @@ public class RoutingCoordinatorManager {
|
|||
mService = IRoutingCoordinator.Stub.asInterface(binder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a route for specific network
|
||||
*
|
||||
* @param netId the network to add the route to
|
||||
* @param route the route to add
|
||||
* @throws ServiceSpecificException in case of failure, with an error code indicating the
|
||||
* cause of the failure.
|
||||
*/
|
||||
public void addRoute(final int netId, final RouteInfo route) {
|
||||
try {
|
||||
mService.addRoute(netId, route);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a route for specific network
|
||||
*
|
||||
* @param netId the network to remove the route from
|
||||
* @param route the route to remove
|
||||
* @throws ServiceSpecificException in case of failure, with an error code indicating the
|
||||
* cause of the failure.
|
||||
*/
|
||||
public void removeRoute(final int netId, final RouteInfo route) {
|
||||
try {
|
||||
mService.removeRoute(netId, route);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a route for specific network
|
||||
*
|
||||
* @param netId the network to update the route for
|
||||
* @param route parcelable with route information
|
||||
* @throws ServiceSpecificException in case of failure, with an error code indicating the
|
||||
* cause of the failure.
|
||||
*/
|
||||
public void updateRoute(final int netId, final RouteInfo route) {
|
||||
try {
|
||||
mService.updateRoute(netId, route);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an interface to a network. The interface must not be assigned to any network, including
|
||||
* the specified network.
|
||||
|
|
|
|||
|
|
@ -16,17 +16,14 @@
|
|||
|
||||
package com.android.net.module.util;
|
||||
|
||||
import static com.android.net.module.util.NetdUtils.toRouteInfoParcel;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.net.INetd;
|
||||
|
||||
import android.net.LinkAddress;
|
||||
import android.net.LinkProperties;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.RouteInfo;
|
||||
import android.net.RouteInfoParcel;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceSpecificException;
|
||||
import android.util.ArraySet;
|
||||
|
|
@ -84,9 +81,9 @@ public class RoutingCoordinatorService extends IRoutingCoordinator.Stub {
|
|||
* cause of the failure.
|
||||
*/
|
||||
@Override
|
||||
public void addRoute(final int netId, final RouteInfo route)
|
||||
public void addRouteParcel(int netId, RouteInfoParcel route)
|
||||
throws ServiceSpecificException, RemoteException {
|
||||
mNetd.networkAddRouteParcel(netId, toRouteInfoParcel(route));
|
||||
mNetd.networkAddRouteParcel(netId, route);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -98,9 +95,9 @@ public class RoutingCoordinatorService extends IRoutingCoordinator.Stub {
|
|||
* cause of the failure.
|
||||
*/
|
||||
@Override
|
||||
public void removeRoute(final int netId, final RouteInfo route)
|
||||
public void removeRouteParcel(int netId, RouteInfoParcel route)
|
||||
throws ServiceSpecificException, RemoteException {
|
||||
mNetd.networkRemoveRouteParcel(netId, toRouteInfoParcel(route));
|
||||
mNetd.networkRemoveRouteParcel(netId, route);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -112,9 +109,9 @@ public class RoutingCoordinatorService extends IRoutingCoordinator.Stub {
|
|||
* cause of the failure.
|
||||
*/
|
||||
@Override
|
||||
public void updateRoute(final int netId, final RouteInfo route)
|
||||
public void updateRouteParcel(int netId, RouteInfoParcel route)
|
||||
throws ServiceSpecificException, RemoteException {
|
||||
mNetd.networkUpdateRouteParcel(netId, toRouteInfoParcel(route));
|
||||
mNetd.networkUpdateRouteParcel(netId, route);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue