Skip to content

Commit 9d031f2

Browse files
author
Fan Zhang
committed
Don't remove wifi preferences when updating AP to avoid GC.
Bug: 30870531 Removing wifi preferences every time will force update create a new set of preferences, which leads to higher chance of GC. Change-Id: Ifea2f63a3b54fa0d5861fb34a348d81e99bcab68
1 parent 5a3d1c1 commit 9d031f2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/com/android/settings/wifi/WifiSettings.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import android.support.v7.preference.Preference;
4343
import android.support.v7.preference.PreferenceViewHolder;
4444
import android.text.Spannable;
45+
import android.text.TextUtils;
4546
import android.text.style.TextAppearanceSpan;
4647
import android.util.Log;
4748
import android.view.ContextMenu;
@@ -54,6 +55,7 @@
5455
import android.widget.TextView;
5556
import android.widget.TextView.BufferType;
5657
import android.widget.Toast;
58+
5759
import com.android.internal.logging.MetricsLogger;
5860
import com.android.internal.logging.MetricsProto.MetricsEvent;
5961
import com.android.settings.LinkifyUtils;
@@ -612,7 +614,6 @@ public void onAccessPointsChanged() {
612614
// AccessPoints are automatically sorted with TreeSet.
613615
final Collection<AccessPoint> accessPoints =
614616
mWifiTracker.getAccessPoints();
615-
getPreferenceScreen().removeAll();
616617

617618
boolean hasAvailableAccessPoints = false;
618619
int index = 0;
@@ -621,6 +622,9 @@ public void onAccessPointsChanged() {
621622
// Ignore access points that are out of range.
622623
if (accessPoint.getLevel() != -1) {
623624
String key = accessPoint.getBssid();
625+
if (TextUtils.isEmpty(key)) {
626+
key = accessPoint.getSsidStr();
627+
}
624628
hasAvailableAccessPoints = true;
625629
LongPressAccessPointPreference pref = (LongPressAccessPointPreference)
626630
getCachedPreference(key);

0 commit comments

Comments
 (0)