summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/SettingsLib/res/values/strings.xml6
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java32
2 files changed, 33 insertions, 5 deletions
diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml
index 4082bf5..b702e35 100644
--- a/packages/SettingsLib/res/values/strings.xml
+++ b/packages/SettingsLib/res/values/strings.xml
@@ -64,6 +64,8 @@
<string name="wifi_not_in_range">Not in range</string>
<!-- Summary for the remembered network but no internet connection was detected. -->
<string name="wifi_no_internet">No Internet Access Detected, won\'t automatically reconnect.</string>
+ <!-- Summary for saved networks -->
+ <string name="saved_network">Saved by <xliff:g id="name">%1$s</xliff:g></string>
<!-- Status message of Wi-Fi when it is connected by a Wi-Fi assistant application. [CHAR LIMIT=NONE] -->
<string name="connected_via_wfa">Connected via Wi\u2011Fi assistant</string>
@@ -71,6 +73,10 @@
<string name="connected_via_passpoint">Connected via %1$s</string>
<!-- Status message of Wi-Fi when network has matching passpoint credentials. [CHAR LIMIT=NONE] -->
<string name="available_via_passpoint">Available via %1$s</string>
+ <!-- Package name for Settings app-->
+ <string name="settings_package" translatable="false">com.android.settings</string>
+ <!-- Package name for Certinstaller app-->
+ <string name="certinstaller_package" translatable="false">com.android.certinstaller</string>
<!-- Summary for Connected wifi network without internet -->
<string name="wifi_connected_no_internet">Connected, no Internet</string>
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 53e69e3..7eaa728 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -35,6 +35,12 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;
import android.util.LruCache;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
+import android.os.UserHandle;
+import android.os.RemoteException;
+import android.app.AppGlobals;
import com.android.settingslib.R;
@@ -288,12 +294,28 @@ public class AccessPoint implements Comparable<AccessPoint> {
}
public String getSavedNetworkSummary() {
- // Update to new summary
- if (mConfig != null && mConfig.isPasspoint()) {
- return "";
- } else {
- return getSettingsSummary();
+ if (mConfig != null) {
+ PackageManager pm = mContext.getPackageManager();
+ String systemName = pm.getNameForUid(android.os.Process.SYSTEM_UID);
+ int userId = UserHandle.getUserId(mConfig.creatorUid);
+ ApplicationInfo appInfo = null;
+ if (mConfig.creatorName != null && mConfig.creatorName.equals(systemName)) {
+ appInfo = mContext.getApplicationInfo();
+ } else {
+ try {
+ IPackageManager ipm = AppGlobals.getPackageManager();
+ appInfo = ipm.getApplicationInfo(mConfig.creatorName, 0 /* flags */, userId);
+ } catch (RemoteException rex) {
+ }
+ }
+ if (appInfo != null &&
+ !appInfo.packageName.equals(mContext.getString(R.string.settings_package)) &&
+ !appInfo.packageName.equals(
+ mContext.getString(R.string.certinstaller_package))) {
+ return mContext.getString(R.string.saved_network, appInfo.loadLabel(pm));
+ }
}
+ return "";
}
public String getSummary() {