diff options
author | Etan Cohen <etancohen@google.com> | 2018-10-25 21:27:30 -0700 |
---|---|---|
committer | Etan Cohen <etancohen@google.com> | 2018-10-31 12:08:28 -0700 |
commit | 1ce443488506186656621ad28dbc5da21d2873d8 (patch) | |
tree | 0bf1dd10ed525aafc44eae2db4329ef911a5495c | |
parent | f68286f2d979a3631050b09d33da84aad4644730 (diff) |
Add dumpsys and log messages to help debug Carrier Wi-Fi
Zero functional change: only dumpsys + some verbose logic
logging.
Bug: 112536285
Test: build, run, observe logs with specific carrier config
Merged-In: I204882f29ff2dbf0d2fc274b2aa9f821602712a2
Change-Id: I204882f29ff2dbf0d2fc274b2aa9f821602712a2
4 files changed, 37 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/CarrierNetworkConfig.java b/service/java/com/android/server/wifi/CarrierNetworkConfig.java index 91e22afe1..78dbe3a0d 100644 --- a/service/java/com/android/server/wifi/CarrierNetworkConfig.java +++ b/service/java/com/android/server/wifi/CarrierNetworkConfig.java @@ -36,6 +36,9 @@ import android.telephony.TelephonyManager; import android.util.Base64; import android.util.Log; +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,9 +55,18 @@ public class CarrierNetworkConfig { private static final int CONFIG_ELEMENT_SIZE = 2; private static final Uri CONTENT_URI = Uri.parse("content://carrier_information/carrier"); + private boolean mDbg = false; + private final Map<String, NetworkInfo> mCarrierNetworkMap; private boolean mIsCarrierImsiEncryptionInfoAvailable = false; + /** + * Enable/disable verbose logging. + */ + public void enableVerboseLogging(int verbose) { + mDbg = verbose > 0; + } + public CarrierNetworkConfig(@NonNull Context context, @NonNull Looper looper, @NonNull FrameworkFacade framework) { mCarrierNetworkMap = new HashMap<>(); @@ -149,6 +161,12 @@ public class CarrierNetworkConfig { mEapType = eapType; mCarrierName = carrierName; } + + @Override + public String toString() { + return new StringBuffer("NetworkInfo: eap=").append(mEapType).append( + ", carrier=").append(mCarrierName).toString(); + } } /** @@ -203,6 +221,10 @@ public class CarrierNetworkConfig { } String[] networkConfigs = carrierConfig.getStringArray( CarrierConfigManager.KEY_CARRIER_WIFI_STRING_ARRAY); + if (mDbg) { + Log.v(TAG, "processNetworkConfig: networkConfigs=" + + Arrays.deepToString(networkConfigs)); + } if (networkConfigs == null) { return; } @@ -224,9 +246,11 @@ public class CarrierNetworkConfig { } mCarrierNetworkMap.put(ssid, new NetworkInfo(eapType, carrierName)); } catch (NumberFormatException e) { - Log.e(TAG, "Failed to parse EAP type: " + e.getMessage()); + Log.e(TAG, "Failed to parse EAP type: '" + configArr[EAP_TYPE_INDEX] + "' " + + e.getMessage()); } catch (IllegalArgumentException e) { - Log.e(TAG, "Failed to decode SSID: " + e.getMessage()); + Log.e(TAG, "Failed to decode SSID: '" + configArr[ENCODED_SSID_INDEX] + "' " + + e.getMessage()); } } } @@ -249,4 +273,12 @@ public class CarrierNetworkConfig { } return -1; } + + /** Dump state. */ + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println(TAG + ": "); + pw.println("mCarrierNetworkMap=" + mCarrierNetworkMap); + pw.println("mIsCarrierImsiEncryptionInfoAvailable=" + + mIsCarrierImsiEncryptionInfoAvailable); + } } diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index d10d80013..216c27cbb 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -1435,5 +1435,6 @@ public class WifiConnectivityManager { pw.println("WifiConnectivityManager - Log End ----"); mOpenNetworkNotifier.dump(fd, pw, args); mCarrierNetworkNotifier.dump(fd, pw, args); + mCarrierNetworkConfig.dump(fd, pw, args); } } diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java index dbf730a73..89a7f45b4 100644 --- a/service/java/com/android/server/wifi/WifiInjector.java +++ b/service/java/com/android/server/wifi/WifiInjector.java @@ -326,6 +326,7 @@ public class WifiInjector { mHalDeviceManager.enableVerboseLogging(verbose); mScanRequestProxy.enableVerboseLogging(verbose); mWakeupController.enableVerboseLogging(verbose); + mCarrierNetworkConfig.enableVerboseLogging(verbose); LogcatLog.enableVerboseLogging(verbose); } diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 901059dbf..744b6a157 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -4039,6 +4039,7 @@ public class WifiStateMachine extends StateMachine { Pair<String, String> identityPair = TelephonyUtil.getSimIdentity(getTelephonyManager(), new TelephonyUtil(), targetWificonfiguration); + Log.i(TAG, "SUP_REQUEST_IDENTITY: identityPair=" + identityPair); if (identityPair != null && identityPair.first != null) { mWifiNative.simIdentityResponse(mInterfaceName, netId, identityPair.first, identityPair.second); |