Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce554e81 authored by Chiachang Wang's avatar Chiachang Wang
Browse files

Remove RouteInfo hidden depdendency in NMS

Update legecy route is replaced by calling INetd directly.
addLegacyRouteForNetId() is no longer needed. This method also
have dependency with the hidden method in RouteInfo which will
be a part of incoming connectivity module. Thus, remove the
addLegacyRouteForNetId() to resolve the dependency.

Bug: 172183305
Test: m ; atest FrameworksNetTests
Change-Id: Ifc561b6dfb45bc51dee244ae114029ae520d8556
parent 7c7ca858
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -295,8 +295,6 @@ interface INetworkManagementService
    void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
    void setFirewallUidRules(int chain, in int[] uids, in int[] rules);
    void setFirewallChainEnabled(int chain, boolean enable);
    void setFirewallChainEnabled(int chain, boolean enable);


    void addLegacyRouteForNetId(int netId, in RouteInfo routeInfo, int uid);

    /**
    /**
     * Allow UID to call protect().
     * Allow UID to call protect().
     */
     */
+0 −21
Original line number Original line Diff line number Diff line
@@ -1759,27 +1759,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
        }
        }
    }
    }


    @Override
    public void addLegacyRouteForNetId(int netId, RouteInfo routeInfo, int uid) {
        NetworkStack.checkNetworkStackPermission(mContext);

        final LinkAddress la = routeInfo.getDestinationLinkAddress();
        final String ifName = routeInfo.getInterface();
        final String dst = la.toString();
        final String nextHop;

        if (routeInfo.hasGateway()) {
            nextHop = routeInfo.getGateway().getHostAddress();
        } else {
            nextHop = "";
        }
        try {
            mNetdService.networkAddLegacyRoute(netId, ifName, dst, nextHop, uid);
        } catch (RemoteException | ServiceSpecificException e) {
            throw new IllegalStateException(e);
        }
    }

    @Override
    @Override
    public void allowProtect(int uid) {
    public void allowProtect(int uid) {
        NetworkStack.checkNetworkStackPermission(mContext);
        NetworkStack.checkNetworkStackPermission(mContext);