Merge "adding debug information to bug report for Bug:16751877" into lmp-dev
This commit is contained in:
@ -70,6 +70,12 @@ public class ScanResult implements Parcelable {
|
||||
*/
|
||||
public long seen;
|
||||
|
||||
/**
|
||||
* If the scan result is a valid autojoin candidate
|
||||
* {@hide}
|
||||
*/
|
||||
public int isAutoJoinCandidate;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Update RSSI of the scan result
|
||||
@ -263,6 +269,7 @@ public class ScanResult implements Parcelable {
|
||||
numConnection = source.numConnection;
|
||||
numUsage = source.numUsage;
|
||||
numIpConfigFailures = source.numIpConfigFailures;
|
||||
isAutoJoinCandidate = source.isAutoJoinCandidate;
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,6 +335,7 @@ public class ScanResult implements Parcelable {
|
||||
dest.writeInt(numConnection);
|
||||
dest.writeInt(numUsage);
|
||||
dest.writeInt(numIpConfigFailures);
|
||||
dest.writeInt(isAutoJoinCandidate);
|
||||
if (informationElements != null) {
|
||||
dest.writeInt(informationElements.length);
|
||||
for (int i = 0; i < informationElements.length; i++) {
|
||||
@ -364,6 +372,7 @@ public class ScanResult implements Parcelable {
|
||||
sr.numConnection = in.readInt();
|
||||
sr.numUsage = in.readInt();
|
||||
sr.numIpConfigFailures = in.readInt();
|
||||
sr.isAutoJoinCandidate = in.readInt();
|
||||
int n = in.readInt();
|
||||
if (n != 0) {
|
||||
sr.informationElements = new InformationElement[n];
|
||||
|
@ -29,6 +29,9 @@ import android.annotation.SystemApi;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.BitSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* A class representing a configured Wi-Fi network, including the
|
||||
@ -908,6 +911,39 @@ public class WifiConfiguration implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
/* @hide */
|
||||
private ArrayList<ScanResult> sortScanResults() {
|
||||
ArrayList<ScanResult> list = new ArrayList<ScanResult>(this.scanResultCache.values());
|
||||
if (list.size() != 0) {
|
||||
Collections.sort(list, new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
ScanResult a = (ScanResult)o1;
|
||||
ScanResult b = (ScanResult)o2;
|
||||
if (a.numIpConfigFailures > b.numIpConfigFailures) {
|
||||
return 1;
|
||||
}
|
||||
if (a.numIpConfigFailures < b.numIpConfigFailures) {
|
||||
return -1;
|
||||
}
|
||||
if (a.seen > b.seen) {
|
||||
return -1;
|
||||
}
|
||||
if (a.seen < b.seen) {
|
||||
return 1;
|
||||
}
|
||||
if (a.level > b.level) {
|
||||
return -1;
|
||||
}
|
||||
if (a.level < b.level) {
|
||||
return 1;
|
||||
}
|
||||
return a.BSSID.compareTo(b.BSSID);
|
||||
}
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sbuf = new StringBuilder();
|
||||
@ -1061,21 +1097,41 @@ public class WifiConfiguration implements Parcelable {
|
||||
}
|
||||
}
|
||||
if (this.scanResultCache != null) {
|
||||
sbuf.append("Scan Cache: ");
|
||||
for(ScanResult result : this.scanResultCache.values()) {
|
||||
sbuf.append("Scan Cache: ").append('\n');
|
||||
ArrayList<ScanResult> list = sortScanResults();
|
||||
if (list.size() > 0) {
|
||||
for (ScanResult result : list) {
|
||||
long milli = now_ms - result.seen;
|
||||
long ageSec = 0;
|
||||
long ageMin = 0;
|
||||
long ageHour = 0;
|
||||
long ageMilli = 0;
|
||||
long ageDay = 0;
|
||||
if (now_ms > result.seen && result.seen > 0) {
|
||||
ageMilli = milli % 1000;
|
||||
ageSec = (milli / 1000) % 60;
|
||||
ageMin = (milli / (60*1000)) % 60;
|
||||
ageHour = (milli / (60*60*1000)) % 24;
|
||||
ageDay = (milli / (24*60*60*1000));
|
||||
}
|
||||
sbuf.append("{").append(result.BSSID).append(",").append(result.frequency);
|
||||
sbuf.append(",").append(result.level);
|
||||
sbuf.append(",").append(String.format("%3d", result.level));
|
||||
if (result.autoJoinStatus > 0) {
|
||||
sbuf.append(",st=").append(result.autoJoinStatus);
|
||||
}
|
||||
if (ageSec > 0 || ageMilli > 0) {
|
||||
sbuf.append(String.format(",%4d.%02d.%02d.%02d.%03dms", ageDay,
|
||||
ageHour, ageMin, ageSec, ageMilli));
|
||||
}
|
||||
if (result.numIpConfigFailures > 0) {
|
||||
sbuf.append(",ipfail=");
|
||||
sbuf.append(result.numIpConfigFailures);
|
||||
}
|
||||
sbuf.append(",").append(result.autoJoinStatus).append("} ");
|
||||
sbuf.append("} ");
|
||||
}
|
||||
sbuf.append('\n');
|
||||
}
|
||||
}
|
||||
sbuf.append("triggeredLow: ").append(this.numUserTriggeredWifiDisableLowRSSI);
|
||||
sbuf.append(" triggeredBad: ").append(this.numUserTriggeredWifiDisableBadRSSI);
|
||||
sbuf.append(" triggeredNotHigh: ").append(this.numUserTriggeredWifiDisableNotHighRSSI);
|
||||
|
@ -456,6 +456,7 @@ public class WifiInfo implements Parcelable {
|
||||
* SSID-specific probe request must be used for scans.
|
||||
*/
|
||||
public boolean getHiddenSSID() {
|
||||
if (mWifiSsid == null) return false;
|
||||
return mWifiSsid.isHidden();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user