Merge "Make callers of RoutingCoordinatorService pass in RouteInfoParcel" into main

This commit is contained in:
Sarup Dalwani 2025-08-06 07:45:24 -07:00 • committed by Android (Google) Code Review
commit a4f34a8836
4 changed files with 24 additions and 66 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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);
}
/**