From 6abd0ff25d2823919c70c9498187c87a666a1a65 Mon Sep 17 00:00:00 2001 From: Hungming Chen Date: Wed, 20 Apr 2022 16:22:42 +0800 Subject: [PATCH] Tethering: replace argsContain with CollectionUtils.contains Bug: 227159997 Test: adb shell dumpsys tethering --short Change-Id: I6158d4cb4aecf9db4d7cc6698db898ce2cbb2c4c --- .../android/networkstack/tethering/Tethering.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Tethering/src/com/android/networkstack/tethering/Tethering.java b/Tethering/src/com/android/networkstack/tethering/Tethering.java index 491e0dcf68..4504829d56 100644 --- a/Tethering/src/com/android/networkstack/tethering/Tethering.java +++ b/Tethering/src/com/android/networkstack/tethering/Tethering.java @@ -135,6 +135,7 @@ import com.android.internal.util.State; import com.android.internal.util.StateMachine; import com.android.modules.utils.build.SdkLevel; import com.android.net.module.util.BaseNetdUnsolicitedEventListener; +import com.android.net.module.util.CollectionUtils; import com.android.networkstack.apishim.common.BluetoothPanShim; import com.android.networkstack.apishim.common.BluetoothPanShim.TetheredInterfaceCallbackShim; import com.android.networkstack.apishim.common.BluetoothPanShim.TetheredInterfaceRequestShim; @@ -2513,12 +2514,12 @@ public class Tethering { writer, " "); // Used for testing instead of human debug. - if (argsContain(args, "bpfRawMap")) { + if (CollectionUtils.contains(args, "bpfRawMap")) { mBpfCoordinator.dumpRawMap(pw, args); return; } - if (argsContain(args, "bpf")) { + if (CollectionUtils.contains(args, "bpf")) { dumpBpf(pw); return; } @@ -2584,7 +2585,7 @@ public class Tethering { pw.println("Log:"); pw.increaseIndent(); - if (argsContain(args, "--short")) { + if (CollectionUtils.contains(args, "--short")) { pw.println(""); } else { mLog.dump(fd, pw, args); @@ -2628,13 +2629,6 @@ public class Tethering { if (e != null) throw e; } - private static boolean argsContain(String[] args, String target) { - for (String arg : args) { - if (target.equals(arg)) return true; - } - return false; - } - private void updateConnectedClients(final List wifiClients) { if (mConnectedClientsTracker.updateConnectedClients(mTetherMainSM.getAllDownstreams(), wifiClients)) {