Merge "Fix an NPE that can result from a race condition." into oc-dev

am: d8aa2acea3

Change-Id: I41bfd05eb74502a034cf1289032ce6a8c50bcbd5
This commit is contained in:
Sundeep Ghuman
2017-05-04 19:25:38 +00:00
committed by android-build-merger
2 changed files with 4 additions and 3 deletions

View File

@@ -998,7 +998,8 @@ public class AccessPoint implements Comparable<AccessPoint> {
if (mRssi != info.getRssi()) {
mRssi = info.getRssi();
updated = true;
} else if (mNetworkInfo.getDetailedState() != networkInfo.getDetailedState()) {
} else if (mNetworkInfo != null && networkInfo != null
&& mNetworkInfo.getDetailedState() != networkInfo.getDetailedState()) {
updated = true;
}
mInfo = info;

View File

@@ -465,9 +465,9 @@ public class WifiTrackerTest {
private void updateScoresAndWaitForAccessPointsChangedCallback() throws InterruptedException {
// Updating scores can happen together or one after the other, so the latch countdown is set
// to 2.
mAccessPointsChangedLatch = new CountDownLatch(3);
mAccessPointsChangedLatch = new CountDownLatch(2);
updateScores();
assertTrue("onAccessPointChanged was not called three times",
assertTrue("onAccessPointChanged was not called twice",
mAccessPointsChangedLatch.await(LATCH_TIMEOUT, TimeUnit.MILLISECONDS));
}