Merge "Modify text in Apps & notifications settings."

This commit is contained in:
TreeHugger Robot
2017-02-16 05:25:44 +00:00
committed by Android (Google) Code Review
5 changed files with 90 additions and 8 deletions

View File

@@ -151,6 +151,7 @@ public class InstalledAppDetails extends AppInfoBase
private static final String KEY_LAUNCH = "preferred_settings";
private static final String KEY_BATTERY = "battery";
private static final String KEY_MEMORY = "memory";
private static final String KEY_VERSION = "app_version";
private static final String NOTIFICATION_TUNER_SETTING = "show_importance_slider";
@@ -171,6 +172,7 @@ public class InstalledAppDetails extends AppInfoBase
private Preference mLaunchPreference;
private Preference mDataPreference;
private Preference mMemoryPreference;
private Preference mVersionPreference;
private boolean mDisableAfterUninstall;
@@ -416,6 +418,7 @@ public class InstalledAppDetails extends AppInfoBase
mBatteryPreference.setOnPreferenceClickListener(this);
mMemoryPreference = findPreference(KEY_MEMORY);
mMemoryPreference.setOnPreferenceClickListener(this);
mVersionPreference = findPreference(KEY_VERSION);
mLaunchPreference = findPreference(KEY_LAUNCH);
if (mAppEntry != null && mAppEntry.info != null) {
@@ -559,14 +562,23 @@ public class InstalledAppDetails extends AppInfoBase
.newAppHeaderController(this, appSnippet)
.setLabel(mAppEntry)
.setIcon(mAppEntry)
.setSummary(pkgInfo)
.setSummary(getString(getInstallationStatus(mAppEntry.info)))
.done(false /* rebindActions */);
mVersionPreference.setSummary(getString(R.string.version_text, pkgInfo.versionName));
} else {
setupAppSnippet(appSnippet, mAppEntry.label, mAppEntry.icon,
pkgInfo != null ? pkgInfo.versionName : null);
}
}
@VisibleForTesting
int getInstallationStatus(ApplicationInfo info) {
if ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
return R.string.not_installed;
}
return info.enabled ? R.string.installed : R.string.disabled;
}
private boolean signaturesMatch(String pkg1, String pkg2) {
if (pkg1 != null && pkg2 != null) {
try {