Use an ArrayMap instead of HashMap to track tether interfaces

( cherry-pick of 36f6f4e394750e4989d78f38a31ab8f2f66c07f7 )

Since the number of tetherable interfaces should be small (e.g. <10),
the computational cost of a looking up objects in an ArrayMap is negligible,
and the memory required is less than a HashMap.

While here, remove some unused imports.

Change-Id: I3fb7091cfb93697d2fc6388b843d60f7e8e7e1a6
Test: Compiles.
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index 05823b5..40d17ed 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -34,8 +34,6 @@
 import android.net.ConnectivityManager;
 import android.net.ConnectivityManager.NetworkCallback;
 import android.net.INetworkStatsService;
-import android.net.InterfaceConfiguration;
-import android.net.LinkAddress;
 import android.net.LinkProperties;
 import android.net.Network;
 import android.net.NetworkCapabilities;
@@ -58,12 +56,12 @@
 import android.telephony.CarrierConfigManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
+import android.util.ArrayMap;
 import android.util.Log;
 import android.util.SparseArray;
 
 import com.android.internal.telephony.IccCardConstants;
 import com.android.internal.telephony.TelephonyIntents;
-import com.android.internal.util.IState;
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.internal.util.MessageUtils;
 import com.android.internal.util.Protocol;
@@ -83,6 +81,7 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -127,7 +126,7 @@
     private final INetworkStatsService mStatsService;
     private final Looper mLooper;
 
-    private HashMap<String, TetherInterfaceStateMachine> mIfaces; // all tethered/tetherable ifaces
+    private Map<String, TetherInterfaceStateMachine> mIfaces; // all tethered/tetherable ifaces
 
     private BroadcastReceiver mStateReceiver;
 
@@ -172,7 +171,7 @@
 
         mPublicSync = new Object();
 
-        mIfaces = new HashMap<String, TetherInterfaceStateMachine>();
+        mIfaces = new ArrayMap<String, TetherInterfaceStateMachine>();
 
         // make our own thread so we don't anr the system
         mLooper = IoThread.get().getLooper();