Update recently sent preferences

Test: make -j RunSettingsRoboTests
Bug: 74318867
Fixes: 73004227
Change-Id: Icecf1d4f0e3dd38c96919874a7f614ed93a001ab
This commit is contained in:
Julia Reynolds
2018-03-21 16:10:20 -04:00
parent 396e91abf0
commit 5c83f14d7e
5 changed files with 15 additions and 68 deletions

View File

@@ -81,7 +81,6 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
private PreferenceCategory mCategory;
private Preference mSeeAllPref;
private Preference mDivider;
private boolean mHasRecentApps;
static {
SKIP_SYSTEM_PACKAGES.addAll(Arrays.asList(
@@ -142,20 +141,7 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
public void updateState(Preference preference) {
super.updateState(preference);
refreshUi(mCategory.getContext());
// Show total number of installed apps as See all's summary.
new InstalledAppCounter(mContext, InstalledAppCounter.IGNORE_INSTALL_REASON,
new PackageManagerWrapper(mContext.getPackageManager())) {
@Override
protected void onCountComplete(int num) {
if (mHasRecentApps) {
mSeeAllPref.setTitle(
mContext.getString(R.string.recent_notifications_see_all_title));
} else {
mSeeAllPref.setSummary(mContext.getString(R.string.apps_summary, num));
}
}
}.execute();
mSeeAllPref.setTitle(mContext.getString(R.string.recent_notifications_see_all_title));
}
@VisibleForTesting
@@ -163,10 +149,8 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
reloadData();
final List<NotifyingApp> recentApps = getDisplayableRecentAppList();
if (recentApps != null && !recentApps.isEmpty()) {
mHasRecentApps = true;
displayRecentApps(prefContext, recentApps);
} else {
mHasRecentApps = false;
displayOnlyAllAppsLink();
}
}
@@ -228,7 +212,7 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
pref.setTitle(appEntry.label);
pref.setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info));
pref.setSummary(StringUtil.formatRelativeTime(mContext,
System.currentTimeMillis() - app.getLastNotified(), false));
System.currentTimeMillis() - app.getLastNotified(), true));
pref.setOrder(i);
Bundle args = new Bundle();
args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkgName);