Merge "Settings: Optimize the selected WFD route preference summary"
diff --git a/src/com/android/settings/wfd/WifiDisplayPreferenceController.java b/src/com/android/settings/wfd/WifiDisplayPreferenceController.java
index a83a56b..b15396b 100644
--- a/src/com/android/settings/wfd/WifiDisplayPreferenceController.java
+++ b/src/com/android/settings/wfd/WifiDisplayPreferenceController.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.media.MediaRouter;
import android.media.MediaRouter.RouteInfo;
+import android.text.TextUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
@@ -87,7 +88,12 @@
final MediaRouter.RouteInfo route = mRouter.getRouteAt(i);
if (route.matchesTypes(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY)
&& route.isSelected() && !route.isConnecting()) {
- summary = mContext.getString(R.string.wifi_display_status_connected);
+ CharSequence status = route.getStatus();
+ if (!TextUtils.isEmpty(status)) {
+ summary = status;
+ } else {
+ summary = mContext.getString(R.string.wifi_display_status_connected);
+ }
break;
}
}
diff --git a/src/com/android/settings/wfd/WifiDisplaySettings.java b/src/com/android/settings/wfd/WifiDisplaySettings.java
index 19b6c54..8562e5f 100755
--- a/src/com/android/settings/wfd/WifiDisplaySettings.java
+++ b/src/com/android/settings/wfd/WifiDisplaySettings.java
@@ -38,6 +38,7 @@
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
+import android.text.TextUtils;
import android.util.Slog;
import android.util.TypedValue;
import android.view.Menu;
@@ -678,7 +679,12 @@
if (route.isConnecting()) {
setSummary(R.string.wifi_display_status_connecting);
} else {
- setSummary(R.string.wifi_display_status_connected);
+ CharSequence status = route.getStatus();
+ if (!TextUtils.isEmpty(status)) {
+ setSummary(status);
+ } else {
+ setSummary(R.string.wifi_display_status_connected);
+ }
}
} else {
if (isEnabled()) {