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

Commit 839cc043 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add more logging to the Tethering SharedLog"

parents 87e893a4 b4df3f45
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -1077,11 +1077,8 @@ public class Tethering extends BaseNetworkObserver {
        return list.toArray(new String[list.size()]);
    }

    private void maybeLogMessage(State state, int what) {
        if (DBG) {
            Log.d(TAG, state.getName() + " got " +
                    sMagicDecoderRing.get(what, Integer.toString(what)));
        }
    private void logMessage(State state, int what) {
        mLog.log(state.getName() + " got " + sMagicDecoderRing.get(what, Integer.toString(what)));
    }

    private boolean upstreamWanted() {
@@ -1205,7 +1202,7 @@ public class Tethering extends BaseNetworkObserver {
        class InitialState extends State {
            @Override
            public boolean processMessage(Message message) {
                maybeLogMessage(this, message.what);
                logMessage(this, message.what);
                switch (message.what) {
                    case EVENT_IFACE_SERVING_STATE_ACTIVE:
                        TetherInterfaceStateMachine who = (TetherInterfaceStateMachine)message.obj;
@@ -1297,21 +1294,21 @@ public class Tethering extends BaseNetworkObserver {
                // Find the interface with the default IPv4 route. It may be the
                // interface described by linkProperties, or one of the interfaces
                // stacked on top of it.
                Log.i(TAG, "Finding IPv4 upstream interface on: " + ns.linkProperties);
                mLog.i("Finding IPv4 upstream interface on: " + ns.linkProperties);
                RouteInfo ipv4Default = RouteInfo.selectBestRoute(
                    ns.linkProperties.getAllRoutes(), Inet4Address.ANY);
                if (ipv4Default != null) {
                    iface = ipv4Default.getInterface();
                    Log.i(TAG, "Found interface " + ipv4Default.getInterface());
                    mLog.i("Found interface " + ipv4Default.getInterface());
                } else {
                    Log.i(TAG, "No IPv4 upstream interface, giving up.");
                    mLog.i("No IPv4 upstream interface, giving up.");
                }
            }

            if (iface != null) {
                setDnsForwarders(ns.network, ns.linkProperties);
            }
            notifyTetheredOfNewUpstreamIface(iface);
            notifyDownstreamsOfNewUpstreamIface(iface);
            if (ns != null && pertainsToCurrentUpstream(ns)) {
                // If we already have NetworkState for this network examine
                // it immediately, because there likely will be no second
@@ -1346,8 +1343,8 @@ public class Tethering extends BaseNetworkObserver {
            }
        }

        protected void notifyTetheredOfNewUpstreamIface(String ifaceName) {
            if (DBG) Log.d(TAG, "Notifying tethered with upstream=" + ifaceName);
        protected void notifyDownstreamsOfNewUpstreamIface(String ifaceName) {
            mLog.log("Notifying downstreams of upstream=" + ifaceName);
            mCurrentUpstreamIface = ifaceName;
            for (TetherInterfaceStateMachine sm : mNotifyList) {
                sm.sendMessage(TetherInterfaceStateMachine.CMD_TETHER_CONNECTION_CHANGED,
@@ -1489,7 +1486,7 @@ public class Tethering extends BaseNetworkObserver {
                mOffloadController.stop();
                mUpstreamNetworkMonitor.stop();
                mSimChange.stopListening();
                notifyTetheredOfNewUpstreamIface(null);
                notifyDownstreamsOfNewUpstreamIface(null);
                handleNewUpstreamNetworkState(null);
            }

@@ -1508,7 +1505,7 @@ public class Tethering extends BaseNetworkObserver {

            @Override
            public boolean processMessage(Message message) {
                maybeLogMessage(this, message.what);
                logMessage(this, message.what);
                boolean retValue = true;
                switch (message.what) {
                    case EVENT_IFACE_SERVING_STATE_ACTIVE: {
+6 −10
Original line number Diff line number Diff line
@@ -441,12 +441,8 @@ public class TetherInterfaceStateMachine extends StateMachine {
        mLastRaParams = newParams;
    }

    private void maybeLogMessage(State state, int what) {
        if (DBG) {
            Log.d(TAG, state.getName() + " got " +
                    sMagicDecoderRing.get(what, Integer.toString(what)) + ", Iface = " +
                    mIfaceName);
        }
    private void logMessage(State state, int what) {
        mLog.log(state.getName() + " got " + sMagicDecoderRing.get(what, Integer.toString(what)));
    }

    private void sendInterfaceState(int newInterfaceState) {
@@ -473,7 +469,7 @@ public class TetherInterfaceStateMachine extends StateMachine {

        @Override
        public boolean processMessage(Message message) {
            maybeLogMessage(this, message.what);
            logMessage(this, message.what);
            switch (message.what) {
                case CMD_TETHER_REQUESTED:
                    mLastError = ConnectivityManager.TETHER_ERROR_NO_ERROR;
@@ -545,7 +541,7 @@ public class TetherInterfaceStateMachine extends StateMachine {

        @Override
        public boolean processMessage(Message message) {
            maybeLogMessage(this, message.what);
            logMessage(this, message.what);
            switch (message.what) {
                case CMD_TETHER_UNREQUESTED:
                    transitionTo(mInitialState);
@@ -595,7 +591,7 @@ public class TetherInterfaceStateMachine extends StateMachine {
        public boolean processMessage(Message message) {
            if (super.processMessage(message)) return true;

            maybeLogMessage(this, message.what);
            logMessage(this, message.what);
            switch (message.what) {
                case CMD_TETHER_REQUESTED:
                    mLog.e("CMD_TETHER_REQUESTED while in local-only hotspot mode.");
@@ -667,7 +663,7 @@ public class TetherInterfaceStateMachine extends StateMachine {
        public boolean processMessage(Message message) {
            if (super.processMessage(message)) return true;

            maybeLogMessage(this, message.what);
            logMessage(this, message.what);
            switch (message.what) {
                case CMD_TETHER_REQUESTED:
                    mLog.e("CMD_TETHER_REQUESTED while already tethering.");