From f5c17221d4ffc0d93063913aba37eaa1ee6f37a6 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Tue, 31 Mar 2015 07:04:42 +0900 Subject: [PATCH 1/3] Don't log errors if the receive thread is stopped. Change-Id: I75ddc9b68f0a61a9a7a78026ed97a8a7c5109cc3 --- services/net/java/android/net/dhcp/DhcpClient.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/net/java/android/net/dhcp/DhcpClient.java b/services/net/java/android/net/dhcp/DhcpClient.java index 57cc251649a3f..e9203a491f3da 100644 --- a/services/net/java/android/net/dhcp/DhcpClient.java +++ b/services/net/java/android/net/dhcp/DhcpClient.java @@ -330,8 +330,10 @@ public class DhcpClient extends BaseDhcpStateMachine { maybeLog("Received packet: " + packet); sendMessage(CMD_RECEIVED_PACKET, packet); } - } catch(IOException|ErrnoException e) { - Log.e(TAG, "Read error", e); + } catch (IOException|ErrnoException e) { + if (!stopped) { + Log.e(TAG, "Read error", e); + } } } maybeLog("Stopping receive thread"); From 6f6c781cca66cabc1f06be368a6dfedceb88ed0e Mon Sep 17 00:00:00 2001 From: Vinit Deshpande Date: Fri, 27 Mar 2015 11:40:17 -0700 Subject: [PATCH 2/3] Remove scanResultCache from WifiConfiguration This is in preparation to use ScanDetail - which is a superset of ScanResult - in wifi stack. There are no external users of scanResultCache; so it can be safely removed. Also fixed a javadoc comment for getPlmn() Change-Id: I7c49532664ffe2e3e5e134bfcd42615d5999d02f --- .../android/net/wifi/WifiConfiguration.java | 185 +----------------- .../net/wifi/WifiEnterpriseConfig.java | 2 +- 2 files changed, 3 insertions(+), 184 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index 34ae386fa45e9..5baa3e881586b 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -401,13 +401,6 @@ public class WifiConfiguration implements Parcelable { */ public String autoJoinBSSID; - /** - * @hide - * BSSID list on which this configuration was seen. - * TODO: prevent this list to grow infinitely, age-out the results - */ - public HashMap scanResultCache; - /** The Below RSSI thresholds are used to configure AutoJoin * - GOOD/LOW/BAD thresholds are used so as to calculate link score * - UNWANTED_SOFT are used by the blacklisting logic so as to handle @@ -497,7 +490,7 @@ 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 static final class Visibility { public int rssi5; // strongest 5GHz RSSI public int rssi24; // strongest 2.4GHz RSSI public int num5; // number of BSSIDs on 5GHz @@ -573,47 +566,8 @@ public class WifiConfiguration implements Parcelable { * age in milliseconds: we will consider only ScanResults that are more recent, * i.e. younger. ***/ - public Visibility setVisibility(long age) { - if (scanResultCache == null) { - visibility = null; - return null; - } - - Visibility status = new Visibility(); - - long now_ms = System.currentTimeMillis(); - for(ScanResult result : scanResultCache.values()) { - if (result.seen == 0) - continue; - - if (result.is5GHz()) { - //strictly speaking: [4915, 5825] - //number of known BSSID on 5GHz band - status.num5 = status.num5 + 1; - } else if (result.is24GHz()) { - //strictly speaking: [2412, 2482] - //number of known BSSID on 2.4Ghz band - status.num24 = status.num24 + 1; - } - - if ((now_ms - result.seen) > age) continue; - - if (result.is5GHz()) { - if (result.level > status.rssi5) { - status.rssi5 = result.level; - status.age5 = result.seen; - status.BSSID5 = result.BSSID; - } - } else if (result.is24GHz()) { - if (result.level > status.rssi24) { - status.rssi24 = result.level; - status.age24 = result.seen; - status.BSSID24 = result.BSSID; - } - } - } + public void setVisibility(Visibility status) { visibility = status; - return status; } /** @hide */ @@ -970,31 +924,6 @@ public class WifiConfiguration implements Parcelable { return false; } - /** - * most recent time we have seen this configuration - * @return most recent scanResult - * @hide - */ - public ScanResult lastSeen() { - ScanResult mostRecent = null; - - if (scanResultCache == null) { - return null; - } - - for (ScanResult result : scanResultCache.values()) { - if (mostRecent == null) { - if (result.seen != 0) - mostRecent = result; - } else { - if (result.seen > mostRecent.seen) { - mostRecent = result; - } - } - } - return mostRecent; - } - /** @hide **/ public void setAutoJoinStatus(int status) { if (status < 0) status = 0; @@ -1009,75 +938,6 @@ public class WifiConfiguration implements Parcelable { } } - /** @hide - * trim the scan Result Cache - * @param: number of entries to keep in the cache - */ - public void trimScanResultsCache(int num) { - if (this.scanResultCache == null) { - return; - } - int currenSize = this.scanResultCache.size(); - if (currenSize <= num) { - return; // Nothing to trim - } - ArrayList list = new ArrayList(this.scanResultCache.values()); - if (list.size() != 0) { - // Sort by descending timestamp - Collections.sort(list, new Comparator() { - public int compare(Object o1, Object o2) { - ScanResult a = (ScanResult)o1; - ScanResult b = (ScanResult)o2; - if (a.seen > b.seen) { - return 1; - } - if (a.seen < b.seen) { - return -1; - } - return a.BSSID.compareTo(b.BSSID); - } - }); - } - for (int i = 0; i < currenSize - num ; i++) { - // Remove oldest results from scan cache - ScanResult result = list.get(i); - this.scanResultCache.remove(result.BSSID); - } - } - - /* @hide */ - private ArrayList sortScanResults() { - ArrayList list = new ArrayList(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(); @@ -1248,42 +1108,6 @@ public class WifiConfiguration implements Parcelable { } } } - if (this.scanResultCache != null) { - sbuf.append("Scan Cache: ").append('\n'); - ArrayList 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(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("} "); - } - sbuf.append('\n'); - } - } sbuf.append("triggeredLow: ").append(this.numUserTriggeredWifiDisableLowRSSI); sbuf.append(" triggeredBad: ").append(this.numUserTriggeredWifiDisableBadRSSI); sbuf.append(" triggeredNotHigh: ").append(this.numUserTriggeredWifiDisableNotHighRSSI); @@ -1577,11 +1401,6 @@ public class WifiConfiguration implements Parcelable { mIpConfiguration = new IpConfiguration(source.mIpConfiguration); - if ((source.scanResultCache != null) && (source.scanResultCache.size() > 0)) { - scanResultCache = new HashMap(); - scanResultCache.putAll(source.scanResultCache); - } - if ((source.connectChoices != null) && (source.connectChoices.size() > 0)) { connectChoices = new HashMap(); connectChoices.putAll(source.connectChoices); diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java index 440ad61eef6cf..6917971491d91 100644 --- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java +++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java @@ -601,7 +601,7 @@ public class WifiEnterpriseConfig implements Parcelable { } /** - * Set plmn for passpoint credential + * Get plmn for passpoint credential * @return the plmn */ public String getPlmn() { From 14c9121e3c8f09c31f5de0d23c577263da665f02 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Thu, 12 Mar 2015 11:51:42 -0700 Subject: [PATCH 3/3] DO NOT MERGE Do not hide any call log entries when they are added. When a call log entry is added, and it's phone account does not match a currently registered one, we set it to hidden. This code was built for the calllog restore case where call log entries would be hidden when added if the original phone account wasn't also present on the new device (where the restore is being performed). We no longer do that so we're removing the code that sets any call log entry to hidden. -- Resubmitting since this change was lost to a merge conflict -- Change-Id: I1ef094d5a35063e8f89cd1ecb1e5a0b59361781c --- core/java/android/provider/CallLog.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index 2df9dbfb467bb..dc8e76ff132cb 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -446,7 +446,6 @@ public class CallLog { long start, int duration, Long dataUsage, boolean addForAllUsers) { final ContentResolver resolver = context.getContentResolver(); int numberPresentation = PRESENTATION_ALLOWED; - boolean isHidden = false; TelecomManager tm = null; try { @@ -461,12 +460,6 @@ public class CallLog { if (address != null) { accountAddress = address.getSchemeSpecificPart(); } - } else { - // We could not find the account through telecom. For call log entries that - // are added with a phone account which is not registered, we automatically - // mark them as hidden. They are unhidden once the account is registered. - Log.i(LOG_TAG, "Marking call log entry as hidden."); - isHidden = true; } } @@ -512,7 +505,6 @@ public class CallLog { values.put(PHONE_ACCOUNT_COMPONENT_NAME, accountComponentString); values.put(PHONE_ACCOUNT_ID, accountId); values.put(PHONE_ACCOUNT_ADDRESS, accountAddress); - values.put(PHONE_ACCOUNT_HIDDEN, Integer.valueOf(isHidden ? 1 : 0)); values.put(NEW, Integer.valueOf(1)); if (callType == MISSED_TYPE) {