diff options
-rw-r--r-- | libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java | 24 | ||||
-rw-r--r-- | libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java | 8 |
2 files changed, 26 insertions, 6 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java index 5f8d44ddd..a6c322656 100644 --- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java +++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java @@ -22,14 +22,17 @@ import static androidx.core.util.Preconditions.checkNotNull; import static com.android.wifitrackerlib.Utils.getAppLabel; import static com.android.wifitrackerlib.Utils.getAppLabelForSavedNetwork; +import static com.android.wifitrackerlib.Utils.getAppLabelForWifiConfiguration; import static com.android.wifitrackerlib.Utils.getAutoConnectDescription; import static com.android.wifitrackerlib.Utils.getBestScanResultByLevel; +import static com.android.wifitrackerlib.Utils.getCarrierNameForSubId; import static com.android.wifitrackerlib.Utils.getCurrentNetworkCapabilitiesInformation; import static com.android.wifitrackerlib.Utils.getDisconnectedStateDescription; import static com.android.wifitrackerlib.Utils.getMeteredDescription; import static com.android.wifitrackerlib.Utils.getNetworkDetailedState; import static com.android.wifitrackerlib.Utils.getSecurityTypeFromWifiConfiguration; import static com.android.wifitrackerlib.Utils.getSpeedDescription; +import static com.android.wifitrackerlib.Utils.getSubIdForConfig; import static com.android.wifitrackerlib.Utils.getVerboseLoggingDescription; import android.content.Context; @@ -194,8 +197,17 @@ public class StandardWifiEntry extends WifiEntry { if (TextUtils.isEmpty(disconnectDescription)) { if (concise) { sj.add(mContext.getString(R.string.wifi_disconnected)); - } else if (!mForSavedNetworksPage && isSaved()) { - sj.add(mContext.getString(R.string.wifi_remembered)); + } else if (!mForSavedNetworksPage) { + // Summary for unconnected suggested network + if (mWifiConfig != null && mWifiConfig.fromWifiNetworkSuggestion) { + String carrierName = getCarrierNameForSubId(mContext, + getSubIdForConfig(mContext, mWifiConfig)); + sj.add(mContext.getString(R.string.available_via_app, carrierName != null + ? carrierName + : getAppLabelForWifiConfiguration(mContext, mWifiConfig))); + } else if (isSaved()) { + sj.add(mContext.getString(R.string.wifi_remembered)); + } } } else { sj.add(disconnectDescription); @@ -242,8 +254,12 @@ public class StandardWifiEntry extends WifiEntry { final String suggestionOrSpecifierPackageName = mWifiInfo != null ? mWifiInfo.getRequestingPackageName() : null; if (!TextUtils.isEmpty(suggestionOrSpecifierPackageName)) { - return mContext.getString(R.string.connected_via_app, - getAppLabel(mContext, suggestionOrSpecifierPackageName)); + String carrierName = mWifiConfig != null + ? getCarrierNameForSubId(mContext, getSubIdForConfig(mContext, mWifiConfig)) + : null; + return mContext.getString(R.string.connected_via_app, carrierName != null + ? carrierName + : getAppLabel(mContext, suggestionOrSpecifierPackageName)); } String networkCapabilitiesinformation = diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java index 47fc9ed57..382fe02c4 100644 --- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java +++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/Utils.java @@ -307,8 +307,12 @@ class Utils { static CharSequence getAppLabelForSavedNetwork(@NonNull Context context, @NonNull WifiEntry wifiEntry) { - final WifiConfiguration config = wifiEntry.getWifiConfiguration(); - if (context == null || wifiEntry == null || config == null) { + return getAppLabelForWifiConfiguration(context, wifiEntry.getWifiConfiguration()); + } + + static CharSequence getAppLabelForWifiConfiguration(@NonNull Context context, + @NonNull WifiConfiguration config) { + if (context == null || config == null) { return ""; } |