diff options
author | vandwalle <vandwalle@google.com> | 2014-05-21 15:20:59 -0700 |
---|---|---|
committer | vandwalle <vandwalle@google.com> | 2014-05-21 20:24:35 -0700 |
commit | 5fb7bf5fdb93831684b00eb637ec15b5cf0d1e2d (patch) | |
tree | 300b16d4da188974f2f0bacc93a28c59d6887278 /wifi/java/android/net | |
parent | 45f302c8724d87f06f797caf76e5b6d4cf11d204 (diff) | |
download | frameworks_base-5fb7bf5fdb93831684b00eb637ec15b5cf0d1e2d.zip frameworks_base-5fb7bf5fdb93831684b00eb637ec15b5cf0d1e2d.tar.gz frameworks_base-5fb7bf5fdb93831684b00eb637ec15b5cf0d1e2d.tar.bz2 |
make verbose logging a wifimanager hidden API
Change-Id: I325f6ea9f1a6c16dbee9aca641cad7ed3bcd7d2c
Diffstat (limited to 'wifi/java/android/net')
-rw-r--r-- | wifi/java/android/net/wifi/IWifiManager.aidl | 4 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/ScanResult.java | 2 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 68 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 26 |
4 files changed, 94 insertions, 6 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 9ccd810..00e1cd8 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -128,5 +128,9 @@ interface IWifiManager void pollBatchedScan(); String getWpsNfcConfigurationToken(int netId); + + void enableVerboseLogging(int verbose); + + int getVerboseLoggingLevel(); } diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java index cfd0a51..58b0d61 100644 --- a/wifi/java/android/net/wifi/ScanResult.java +++ b/wifi/java/android/net/wifi/ScanResult.java @@ -192,6 +192,7 @@ public class ScanResult implements Parcelable { dest.writeLong(timestamp); dest.writeInt(distanceCm); dest.writeInt(distanceSdCm); + dest.writeLong(seen); if (passpoint != null) { dest.writeInt(1); passpoint.writeToParcel(dest, flags); @@ -218,6 +219,7 @@ public class ScanResult implements Parcelable { in.readInt(), in.readInt() ); + sr.seen = in.readLong(); if (in.readInt() == 1) { sr.passpoint = WifiPasspointInfo.CREATOR.createFromParcel(in); } diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index 769d974..f5cf978 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -319,21 +319,20 @@ public class WifiConfiguration implements Parcelable { * A summary of the RSSI and Band status for that configuration * This is used as a temporary value by the auto-join controller */ - public final class Visibility - { + public final class Visibility { public int rssi5; // strongest 5GHz RSSI public int rssi24; // strongest 2.4GHz RSSI public int num5; // number of BSSIDs on 5GHz public int num24; // number of BSSIDs on 2.4GHz public long age5; // timestamp of the strongest 5GHz BSSID (last time it was seen) public long age24; // timestamp of the strongest 2.4GHz BSSID (last time it was seen) - public Visibility() - { + + public Visibility() { rssi5 = INVALID_RSSI; rssi24 = INVALID_RSSI; } - public Visibility(Visibility source) - { + + public Visibility(Visibility source) { rssi5 = source.rssi5; rssi24 = source.rssi24; age24 = source.age24; @@ -341,6 +340,27 @@ public class WifiConfiguration implements Parcelable { num24 = source.num24; num5 = source.num5; } + + @Override + public String toString() { + StringBuilder sbuf = new StringBuilder(); + sbuf.append("["); + if (rssi24 > INVALID_RSSI) { + sbuf.append(Integer.toString(rssi24)); + sbuf.append(","); + sbuf.append(Integer.toString(num24)); + } else { + sbuf.append("*"); + } + sbuf.append(" - "); + if (rssi5 > INVALID_RSSI) { + sbuf.append(Integer.toString(rssi5)); + sbuf.append(","); + sbuf.append(Integer.toString(num5)); + } + sbuf.append("]"); + return sbuf.toString(); + } } /** @hide @@ -893,6 +913,11 @@ public class WifiConfiguration implements Parcelable { } } + /** {@hide} */ + //public static final int NOTHING_TAG = 0; + /** {@hide} */ + //public static final int SCAN_CACHE_TAG = 1; + /** Implement the Parcelable interface {@hide} */ @Override public void writeToParcel(Parcel dest, int flags) { @@ -922,6 +947,17 @@ public class WifiConfiguration implements Parcelable { dest.writeString(defaultGwMacAddress); dest.writeInt(autoJoinStatus); dest.writeInt(selfAdded ? 1 : 0); + /* + TODO: should we write the cache results to the parcel? + if (scanResultCache != null) { + dest.writeInt(WifiConfiguration.SCAN_CACHE_TAG); + dest.writeInt(scanResultCache.size()); + for (ScanResult result : scanResultCache.values()) { + result.writeToParcel(dest, flags); + } + } else { + dest.writeInt(WifiConfiguration.NOTHING_TAG); + }*/ } /** Implement the Parcelable interface {@hide} */ @@ -954,6 +990,26 @@ public class WifiConfiguration implements Parcelable { config.defaultGwMacAddress = in.readString(); config.autoJoinStatus = in.readInt(); config.selfAdded = in.readInt() != 0; + /* + TODO: should we write the cache results to the parcel? + boolean done = false; + do { + int tag = in.readInt(); + switch (tag) { + case WifiConfiguration.SCAN_CACHE_TAG: + int size = in.readInt(); + config.scanResultCache = new HashMap<String, ScanResult>(); + while (size > 0) { + ScanResult result = ScanResult.CREATOR.createFromParcel(in); + config.scanResultCache.put(result.BSSID, result); + size--; + } + break; + case WifiConfiguration.NOTHING_TAG: + done = true; + break; + } + } while (!done);*/ return config; } diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index c6ce768..141a69e 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -2225,4 +2225,30 @@ public class WifiManager { super.finalize(); } } + + + /** + * Set wifi verbose log. Called from developer settings. + * @hide + */ + public void enableVerboseLogging (int verbose) { + try { + mService.enableVerboseLogging(verbose); + } catch (RemoteException e) { + + } + } + + /** + * Get the WiFi verbose logging level.This is used by settings + * to decide what to show within the picker. + * @hide + */ + public int getVerboseLoggingLevel() { + try { + return mService.getVerboseLoggingLevel(); + } catch (RemoteException e) { + return 0; + } + } } |