summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorQuang Luong <qal@google.com>2020-06-10 22:06:51 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-10 22:06:51 +0000
commitc4e56247667a5920512c0eb7c2856b6ab64f6e78 (patch)
tree641e31b3796d4287da2a14f8415987cedeafb9ad /libs
parentf739c3f04375325ab5fa554f9761e0587322b779 (diff)
parent26f301289715dc01a3906c04ce867d051f0a8553 (diff)
Merge "[WifiTrackerLib] Passpoint R2 expiration handling in network details" into rvc-dev am: 26f3012897
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/net/wifi/+/11813173 Change-Id: Ie83d3cb436e9459085b162cefbe25e1eed99fae3
Diffstat (limited to 'libs')
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java3
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java44
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java2
3 files changed, 46 insertions, 3 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java
index c6cd574d0..89d780eba 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/OsuWifiEntry.java
@@ -96,7 +96,8 @@ class OsuWifiEntry extends WifiEntry {
if (mOsuStatusString != null) {
return mOsuStatusString;
} else if (isAlreadyProvisioned()) {
- return mContext.getString(R.string.tap_to_renew_subscription_and_connect);
+ return concise ? mContext.getString(R.string.wifi_passpoint_expired)
+ : mContext.getString(R.string.tap_to_renew_subscription_and_connect);
} else {
return mContext.getString(R.string.tap_to_sign_up);
}
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java
index 00c786fac..9bd2a5905 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointNetworkDetailsTracker.java
@@ -20,6 +20,7 @@ import static androidx.core.util.Preconditions.checkNotNull;
import static com.android.wifitrackerlib.PasspointWifiEntry.uniqueIdToPasspointWifiEntryKey;
import static com.android.wifitrackerlib.WifiEntry.CONNECTED_STATE_CONNECTED;
+import static com.android.wifitrackerlib.WifiEntry.WIFI_LEVEL_UNREACHABLE;
import android.content.Context;
import android.content.Intent;
@@ -31,6 +32,7 @@ import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
+import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.os.Handler;
import android.text.TextUtils;
@@ -54,6 +56,7 @@ class PasspointNetworkDetailsTracker extends NetworkDetailsTracker {
private static final String TAG = "PasspointNetworkDetailsTracker";
private final PasspointWifiEntry mChosenEntry;
+ private OsuWifiEntry mOsuWifiEntry;
PasspointNetworkDetailsTracker(@NonNull Lifecycle lifecycle,
@NonNull Context context,
@@ -187,6 +190,43 @@ class PasspointNetworkDetailsTracker extends NetworkDetailsTracker {
null /* roamingScanResults */);
}
+ @WorkerThread
+ private void updateOsuWifiEntryScans(@NonNull List<ScanResult> scanResults) {
+ checkNotNull(scanResults, "Scan Result list should not be null!");
+
+ Map<OsuProvider, List<ScanResult>> osuProviderToScans =
+ mWifiManager.getMatchingOsuProviders(scanResults);
+ Map<OsuProvider, PasspointConfiguration> osuProviderToPasspointConfig =
+ mWifiManager.getMatchingPasspointConfigsForOsuProviders(
+ osuProviderToScans.keySet());
+
+ if (mOsuWifiEntry != null) {
+ mOsuWifiEntry.updateScanResultInfo(osuProviderToScans.get(
+ mOsuWifiEntry.getOsuProvider()));
+ } else {
+ // Create a new OsuWifiEntry to link to the chosen PasspointWifiEntry
+ for (OsuProvider provider : osuProviderToScans.keySet()) {
+ PasspointConfiguration provisionedConfig =
+ osuProviderToPasspointConfig.get(provider);
+ if (provisionedConfig != null && TextUtils.equals(mChosenEntry.getKey(),
+ uniqueIdToPasspointWifiEntryKey(provisionedConfig.getUniqueId()))) {
+ mOsuWifiEntry = new OsuWifiEntry(mContext, mMainHandler, provider, mWifiManager,
+ mWifiNetworkScoreCache, false /* forSavedNetworksPage */);
+ mOsuWifiEntry.updateScanResultInfo(osuProviderToScans.get(provider));
+ mOsuWifiEntry.setAlreadyProvisioned(true);
+ mChosenEntry.setOsuWifiEntry(mOsuWifiEntry);
+ return;
+ }
+ }
+ }
+
+ // Remove mOsuWifiEntry if it is no longer reachable
+ if (mOsuWifiEntry != null && mOsuWifiEntry.getLevel() == WIFI_LEVEL_UNREACHABLE) {
+ mChosenEntry.setOsuWifiEntry(null);
+ mOsuWifiEntry = null;
+ }
+ }
+
/**
* Updates the tracked entry's scan results up to the max scan age (or more, if the last scan
* was unsuccessful). If Wifi is disabled, the tracked entry's level will be cleared.
@@ -207,7 +247,9 @@ class PasspointNetworkDetailsTracker extends NetworkDetailsTracker {
scanAgeWindow += mScanIntervalMillis;
}
- updatePasspointWifiEntryScans(mScanResultUpdater.getScanResults(scanAgeWindow));
+ List<ScanResult> currentScans = mScanResultUpdater.getScanResults(scanAgeWindow);
+ updatePasspointWifiEntryScans(currentScans);
+ updateOsuWifiEntryScans(currentScans);
}
/**
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
index 2c0134d5a..20a87e760 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
@@ -166,7 +166,7 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry
if (isExpired()) {
if (mOsuWifiEntry != null) {
- sj.add(mOsuWifiEntry.getSummary());
+ sj.add(mOsuWifiEntry.getSummary(concise));
} else {
sj.add(mContext.getString(R.string.wifi_passpoint_expired));
}