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

am: 375a306fe3

Change-Id: I9974992fea4dc46283ffe1bb8ff8ec9533832648
This commit is contained in:
Sundeep Ghuman
2017-05-04 19:34:20 +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));
}