From 133299a9b8b1fe1c1d26bc8c33b36eb2bf3b7734 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 28 Jun 2022 06:38:00 +0000 Subject: [PATCH] Tethering: remove dead code changeInterfaceState only used in enableIpServing which always pass STATE_TETHERED or STATE_LOCAL_ONLY state. Move it into enableIpServing directly and remove unused code. Test: m Change-Id: I2d91115e588a153ddcb9d61f8e2bc09a09c52d48 --- .../networkstack/tethering/Tethering.java | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/Tethering/src/com/android/networkstack/tethering/Tethering.java b/Tethering/src/com/android/networkstack/tethering/Tethering.java index af017f325a..f613b73676 100644 --- a/Tethering/src/com/android/networkstack/tethering/Tethering.java +++ b/Tethering/src/com/android/networkstack/tethering/Tethering.java @@ -1406,7 +1406,9 @@ public class Tethering { private void enableIpServing(int tetheringType, String ifname, int ipServingMode, boolean isNcm) { ensureIpServerStarted(ifname, tetheringType, isNcm); - changeInterfaceState(ifname, ipServingMode); + if (tether(ifname, ipServingMode) != TETHER_ERROR_NO_ERROR) { + Log.e(TAG, "unable start tethering on iface " + ifname); + } } private void disableWifiIpServingCommon(int tetheringType, String ifname) { @@ -1551,27 +1553,6 @@ public class Tethering { } } - private void changeInterfaceState(String ifname, int requestedState) { - final int result; - switch (requestedState) { - case IpServer.STATE_UNAVAILABLE: - case IpServer.STATE_AVAILABLE: - result = untether(ifname); - break; - case IpServer.STATE_TETHERED: - case IpServer.STATE_LOCAL_ONLY: - result = tether(ifname, requestedState); - break; - default: - Log.wtf(TAG, "Unknown interface state: " + requestedState); - return; - } - if (result != TETHER_ERROR_NO_ERROR) { - Log.e(TAG, "unable start or stop tethering on iface " + ifname); - return; - } - } - TetheringConfiguration getTetheringConfiguration() { return mConfig; }