diff options
author | Sanket Padawe <sanketpadawe@google.com> | 2015-05-05 20:10:46 -0700 |
---|---|---|
committer | Sanket Padawe <sanketpadawe@google.com> | 2015-05-05 20:10:46 -0700 |
commit | 56cfbfb0319dfed65b6307b1baf73cb9b92db9b9 (patch) | |
tree | 9198de5b227e8ebe45eddbb149e9a6fa51eb7d1b /packages | |
parent | 5ba44affe6747d2995030005bd99471d621d6e79 (diff) | |
download | frameworks_base-56cfbfb0319dfed65b6307b1baf73cb9b92db9b9.zip frameworks_base-56cfbfb0319dfed65b6307b1baf73cb9b92db9b9.tar.gz frameworks_base-56cfbfb0319dfed65b6307b1baf73cb9b92db9b9.tar.bz2 |
Saved network summary string fixes in Wifi Settings
Bug: 20667217
Change-Id: Ife1b1e7da3270020ef405693252a9e8a1ea5a6ca
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsLib/res/values/strings.xml | 6 | ||||
-rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java | 32 |
2 files changed, 33 insertions, 5 deletions
diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml index 6876222..7797313 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> <!-- Bluetooth settings. Message when a device is disconnected --> <string name="bluetooth_disconnected">Disconnected</string> diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java index 2fde4f9..2cc2db5 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java @@ -29,6 +29,12 @@ import android.os.Bundle; import android.text.TextUtils; 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; @@ -282,12 +288,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() { |