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

Commit 476f5525 authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Small fix to 5008973 fix.

Removed redundent log.
Cleaned some logic.
Will try to modify route even if recursive operation had an error.

bug: 5008973
Change-Id: Ie2ca51cc39cfac027a8a2e2eaddcb7d6c378c4da
parent 0a46db5d
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -966,12 +966,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
        if (r.isHostRoute() == false) {
            RouteInfo bestRoute = RouteInfo.selectBestRoute(lp.getRoutes(), r.getGateway());
            if (bestRoute != null) {
                if (bestRoute.getGateway().equals(r.getGateway()) == false) {
                    bestRoute = RouteInfo.makeHostRoute(r.getGateway(), bestRoute.getGateway());
                } else {
                if (bestRoute.getGateway().equals(r.getGateway())) {
                    // if there is no better route, add the implied hostroute for our gateway
                    bestRoute = RouteInfo.makeHostRoute(r.getGateway());
                } else {
                    // if we will connect to our gateway through another route, add a direct
                    // route to it's gateway
                    bestRoute = RouteInfo.makeHostRoute(r.getGateway(), bestRoute.getGateway());
                }
                if (!modifyRoute(ifaceName, lp, bestRoute, cycleCount+1, doAdd)) return false;
                modifyRoute(ifaceName, lp, bestRoute, cycleCount+1, doAdd);
            }
        }
        if (doAdd) {
@@ -1050,9 +1053,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
    public void setDataDependency(int networkType, boolean met) {
        enforceConnectivityInternalPermission();

        if (DBG) {
            log("setDataDependency(" + networkType + ", " + met + ")");
        }
        mHandler.sendMessage(mHandler.obtainMessage(EVENT_SET_DEPENDENCY_MET,
                (met ? ENABLED : DISABLED), networkType));
    }