//packages/modules/Wifi/service/java/com/android/server/wifi/WifiConnectivityManager.java
private void handleScanResults(@NonNull List<ScanDetail> scanDetails,
@NonNull String listenerName,
boolean isFullScan,
@NonNull HandleScanResultsListener handleScanResultsListener) {
//....
List<WifiCandidates.Candidate> candidates = mNetworkSelector.getCandidatesFromScan(
scanDetails, bssidBlocklist, cmmStates, mUntrustedConnectionAllowed,
mOemPaidConnectionAllowed, mOemPrivateConnectionAllowed);
mLatestCandidates = candidates;
mLatestCandidatesTimestampMs = mClock.getElapsedSinceBootMillis();
//...
if ((mOemPaidConnectionAllowed || mOemPrivateConnectionAllowed)
&& mActiveModeWarden.isStaStaConcurrencySupportedForRestrictedConnections()) {
// Split the candidates based on whether they are oem paid/oem private or not.
Map<Boolean, List<WifiCandidates.Candidate>> candidatesPartitioned =
candidates.stream()
.collect(Collectors.groupingBy(c -> c.isOemPaid() || c.isOemPrivate()));
List<WifiCandidates.Candidate> primaryCmmCandidates =
candidatesPartitioned.getOrDefault(false, Collections.emptyList());
List<WifiCandidates.Candidate> secondaryCmmCandidates =
candidatesPartitioned.getOrDefault(true, Collections.emptyList());
List<WifiCandidates.Candidate> secondaryCmmCandidates_filtered =
getSecondaryCandidatesFiltered(secondaryCmmCandidates);
// Some oem paid/private suggestions found, use secondary cmm flow.
if (!secondaryCmmCandidates.isEmpty()) {
handleCandidatesFromScanResultsUsingSecondaryCmmIfAvailable(
listenerName, primaryCmmCandidates, secondaryCmmCandidates_filtered,
handleScanResultsListener);
return;
}
// intentional fallthrough: No oem paid/private suggestions, fallback to legacy flow.
}
handleCandidatesFromScanResultsForPrimaryCmmUsingMbbIfAvailable(
listenerName, candidates, handleScanResultsListener);
}
扫描结果可连接,回调 handleScanResults。handleScanResult 中首先进行一下细节