Loading src/com/android/settings/notification/history/NotificationHistoryActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.settings.R; import com.android.settings.notification.NotificationBackend; import com.android.settings.widget.SwitchBar; import java.util.ArrayList; import java.util.Arrays; public class NotificationHistoryActivity extends Activity { Loading Loading @@ -252,7 +253,7 @@ public class NotificationHistoryActivity extends Activity { rv.setNestedScrollingEnabled(false); ((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete( Arrays.asList(snoozed)); new ArrayList<>(Arrays.asList(snoozed))); } try { Loading @@ -268,7 +269,7 @@ public class NotificationHistoryActivity extends Activity { rv.setNestedScrollingEnabled(false); ((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete( Arrays.asList(dismissed)); new ArrayList<>(Arrays.asList(dismissed))); mDismissView.setVisibility(View.VISIBLE); } catch (Exception e) { Slog.e(TAG, "Cannot load recently dismissed", e); Loading src/com/android/settings/notification/history/NotificationSbnAdapter.java +16 −5 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.settings.notification.history; import static android.content.pm.PackageManager.*; import static android.os.UserHandle.USER_ALL; import static android.os.UserHandle.USER_CURRENT; import android.app.Notification; import android.content.Context; Loading Loading @@ -77,12 +79,13 @@ public class NotificationSbnAdapter extends holder.setTitle(getTitleString(sbn.getNotification())); holder.setSummary(getTextString(mContext, sbn.getNotification())); holder.setPostedTime(sbn.getPostTime()); if (!mUserBadgeCache.containsKey(sbn.getUserId())) { int userId = normalizeUserId(sbn); if (!mUserBadgeCache.containsKey(userId)) { Drawable profile = mContext.getPackageManager().getUserBadgeForDensity( UserHandle.of(sbn.getUserId()), -1); mUserBadgeCache.put(sbn.getUserId(), profile); UserHandle.of(userId), -1); mUserBadgeCache.put(userId, profile); } holder.setProfileBadge(mUserBadgeCache.get(sbn.getUserId())); holder.setProfileBadge(mUserBadgeCache.get(userId)); } else { Slog.w(TAG, "null entry in list at position " + position); } Loading Loading @@ -153,7 +156,7 @@ public class NotificationSbnAdapter extends private Drawable loadIcon(StatusBarNotification sbn) { Drawable draw = sbn.getNotification().getSmallIcon().loadDrawableAsUser( sbn.getPackageContext(mContext), sbn.getUserId()); sbn.getPackageContext(mContext), normalizeUserId(sbn)); if (draw == null) { return null; } Loading @@ -161,4 +164,12 @@ public class NotificationSbnAdapter extends draw.setColorFilter(sbn.getNotification().color, PorterDuff.Mode.SRC_ATOP); return draw; } private int normalizeUserId(StatusBarNotification sbn) { int userId = sbn.getUserId(); if (userId == USER_ALL) { userId = USER_CURRENT; } return userId; } } Loading
src/com/android/settings/notification/history/NotificationHistoryActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import com.android.settings.R; import com.android.settings.notification.NotificationBackend; import com.android.settings.widget.SwitchBar; import java.util.ArrayList; import java.util.Arrays; public class NotificationHistoryActivity extends Activity { Loading Loading @@ -252,7 +253,7 @@ public class NotificationHistoryActivity extends Activity { rv.setNestedScrollingEnabled(false); ((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete( Arrays.asList(snoozed)); new ArrayList<>(Arrays.asList(snoozed))); } try { Loading @@ -268,7 +269,7 @@ public class NotificationHistoryActivity extends Activity { rv.setNestedScrollingEnabled(false); ((NotificationSbnAdapter) rv.getAdapter()).onRebuildComplete( Arrays.asList(dismissed)); new ArrayList<>(Arrays.asList(dismissed))); mDismissView.setVisibility(View.VISIBLE); } catch (Exception e) { Slog.e(TAG, "Cannot load recently dismissed", e); Loading
src/com/android/settings/notification/history/NotificationSbnAdapter.java +16 −5 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.settings.notification.history; import static android.content.pm.PackageManager.*; import static android.os.UserHandle.USER_ALL; import static android.os.UserHandle.USER_CURRENT; import android.app.Notification; import android.content.Context; Loading Loading @@ -77,12 +79,13 @@ public class NotificationSbnAdapter extends holder.setTitle(getTitleString(sbn.getNotification())); holder.setSummary(getTextString(mContext, sbn.getNotification())); holder.setPostedTime(sbn.getPostTime()); if (!mUserBadgeCache.containsKey(sbn.getUserId())) { int userId = normalizeUserId(sbn); if (!mUserBadgeCache.containsKey(userId)) { Drawable profile = mContext.getPackageManager().getUserBadgeForDensity( UserHandle.of(sbn.getUserId()), -1); mUserBadgeCache.put(sbn.getUserId(), profile); UserHandle.of(userId), -1); mUserBadgeCache.put(userId, profile); } holder.setProfileBadge(mUserBadgeCache.get(sbn.getUserId())); holder.setProfileBadge(mUserBadgeCache.get(userId)); } else { Slog.w(TAG, "null entry in list at position " + position); } Loading Loading @@ -153,7 +156,7 @@ public class NotificationSbnAdapter extends private Drawable loadIcon(StatusBarNotification sbn) { Drawable draw = sbn.getNotification().getSmallIcon().loadDrawableAsUser( sbn.getPackageContext(mContext), sbn.getUserId()); sbn.getPackageContext(mContext), normalizeUserId(sbn)); if (draw == null) { return null; } Loading @@ -161,4 +164,12 @@ public class NotificationSbnAdapter extends draw.setColorFilter(sbn.getNotification().color, PorterDuff.Mode.SRC_ATOP); return draw; } private int normalizeUserId(StatusBarNotification sbn) { int userId = sbn.getUserId(); if (userId == USER_ALL) { userId = USER_CURRENT; } return userId; } }