Loading src/com/android/settings/notification/NotificationStation.java +204 −178 Original line number Diff line number Diff line Loading @@ -72,6 +72,8 @@ public class NotificationStation extends SettingsPreferenceFragment { private Handler mHandler; private static class HistoricalNotificationInfo { public String key; public String channel; public String pkg; public Drawable pkgicon; public CharSequence pkgname; Loading Loading @@ -271,8 +273,6 @@ public class NotificationStation extends SettingsPreferenceFragment { List<HistoricalNotificationInfo> list = new ArrayList<HistoricalNotificationInfo>(active.length + dismissed.length); final Ranking rank = new Ranking(); for (StatusBarNotification[] resultset : new StatusBarNotification[][] { active, dismissed }) { for (StatusBarNotification sbn : resultset) { Loading @@ -293,9 +293,30 @@ public class NotificationStation extends SettingsPreferenceFragment { } info.timestamp = sbn.getPostTime(); info.priority = n.priority; info.channel = n.getChannelId(); info.key = sbn.getKey(); info.active = (resultset == active); info.extra = generateExtraText(sbn, info); logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); list.add(info); } } return list; } catch (RemoteException e) { Log.e(TAG, "Cannot load Notifications: ", e); } return null; } private CharSequence generateExtraText(StatusBarNotification sbn, HistoricalNotificationInfo info) { final Ranking rank = new Ranking(); final Notification n = sbn.getNotification(); final SpannableStringBuilder sb = new SpannableStringBuilder(); final String delim = getString(R.string.notification_log_details_delimiter); sb.append(bold(getString(R.string.notification_log_details_package))) Loading @@ -308,12 +329,26 @@ public class NotificationStation extends SettingsPreferenceFragment { sb.append("\n") .append(bold(getString(R.string.notification_log_details_icon))) .append(delim) .append(n.getSmallIcon().toString()); .append(String.valueOf(n.getSmallIcon())); sb.append("\n") .append(bold("channelId")) .append(delim) .append(String.valueOf(n.getChannelId())); sb.append("\n") .append(bold("postTime")) .append(delim) .append(String.valueOf(sbn.getPostTime())); if (n.getTimeoutAfter() != 0) { sb.append("\n") .append(bold("timeoutAfter")) .append(delim) .append(String.valueOf(n.getTimeoutAfter())); } if (sbn.isGroup()) { sb.append("\n") .append(bold(getString(R.string.notification_log_details_group))) .append(delim) .append(sbn.getGroupKey()); .append(String.valueOf(sbn.getGroupKey())); if (n.isGroupSummary()) { sb.append(bold( getString(R.string.notification_log_details_group_summary))); Loading Loading @@ -357,7 +392,7 @@ public class NotificationStation extends SettingsPreferenceFragment { .append(bold(getString(R.string.notification_log_details_priority))) .append(delim) .append(Notification.priorityToString(n.priority)); if (resultset == active) { if (info.active) { // mRanking only applies to active notifications if (mRanking != null && mRanking.getRanking(sbn.getKey(), rank)) { sb.append("\n") Loading Loading @@ -469,19 +504,7 @@ public class NotificationStation extends SettingsPreferenceFragment { .append(String.valueOf(p.getBlobAshmemSize())) .append("\n"); } info.extra = sb; logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); list.add(info); } } return list; } catch (RemoteException e) { Log.e(TAG, "Cannot load Notifications: ", e); } return null; return sb; } private Resources getResourcesForUserPackage(String pkg, int userId) { Loading Loading @@ -545,6 +568,7 @@ public class NotificationStation extends SettingsPreferenceFragment { private static class HistoricalNotificationPreference extends Preference { private final HistoricalNotificationInfo mInfo; private static long sLastExpandedTimestamp; // quick hack to keep things from collapsing public HistoricalNotificationPreference(Context context, HistoricalNotificationInfo info) { super(context); Loading @@ -569,7 +593,8 @@ public class NotificationStation extends SettingsPreferenceFragment { final TextView extra = (TextView) row.findViewById(R.id.extra); extra.setText(mInfo.extra); extra.setVisibility(View.GONE); extra.setVisibility(mInfo.timestamp == sLastExpandedTimestamp ? View.VISIBLE : View.GONE); row.itemView.setOnClickListener( new View.OnClickListener() { Loading @@ -577,6 +602,7 @@ public class NotificationStation extends SettingsPreferenceFragment { public void onClick(View view) { extra.setVisibility(extra.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); sLastExpandedTimestamp = mInfo.timestamp; } }); Loading Loading
src/com/android/settings/notification/NotificationStation.java +204 −178 Original line number Diff line number Diff line Loading @@ -72,6 +72,8 @@ public class NotificationStation extends SettingsPreferenceFragment { private Handler mHandler; private static class HistoricalNotificationInfo { public String key; public String channel; public String pkg; public Drawable pkgicon; public CharSequence pkgname; Loading Loading @@ -271,8 +273,6 @@ public class NotificationStation extends SettingsPreferenceFragment { List<HistoricalNotificationInfo> list = new ArrayList<HistoricalNotificationInfo>(active.length + dismissed.length); final Ranking rank = new Ranking(); for (StatusBarNotification[] resultset : new StatusBarNotification[][] { active, dismissed }) { for (StatusBarNotification sbn : resultset) { Loading @@ -293,9 +293,30 @@ public class NotificationStation extends SettingsPreferenceFragment { } info.timestamp = sbn.getPostTime(); info.priority = n.priority; info.channel = n.getChannelId(); info.key = sbn.getKey(); info.active = (resultset == active); info.extra = generateExtraText(sbn, info); logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); list.add(info); } } return list; } catch (RemoteException e) { Log.e(TAG, "Cannot load Notifications: ", e); } return null; } private CharSequence generateExtraText(StatusBarNotification sbn, HistoricalNotificationInfo info) { final Ranking rank = new Ranking(); final Notification n = sbn.getNotification(); final SpannableStringBuilder sb = new SpannableStringBuilder(); final String delim = getString(R.string.notification_log_details_delimiter); sb.append(bold(getString(R.string.notification_log_details_package))) Loading @@ -308,12 +329,26 @@ public class NotificationStation extends SettingsPreferenceFragment { sb.append("\n") .append(bold(getString(R.string.notification_log_details_icon))) .append(delim) .append(n.getSmallIcon().toString()); .append(String.valueOf(n.getSmallIcon())); sb.append("\n") .append(bold("channelId")) .append(delim) .append(String.valueOf(n.getChannelId())); sb.append("\n") .append(bold("postTime")) .append(delim) .append(String.valueOf(sbn.getPostTime())); if (n.getTimeoutAfter() != 0) { sb.append("\n") .append(bold("timeoutAfter")) .append(delim) .append(String.valueOf(n.getTimeoutAfter())); } if (sbn.isGroup()) { sb.append("\n") .append(bold(getString(R.string.notification_log_details_group))) .append(delim) .append(sbn.getGroupKey()); .append(String.valueOf(sbn.getGroupKey())); if (n.isGroupSummary()) { sb.append(bold( getString(R.string.notification_log_details_group_summary))); Loading Loading @@ -357,7 +392,7 @@ public class NotificationStation extends SettingsPreferenceFragment { .append(bold(getString(R.string.notification_log_details_priority))) .append(delim) .append(Notification.priorityToString(n.priority)); if (resultset == active) { if (info.active) { // mRanking only applies to active notifications if (mRanking != null && mRanking.getRanking(sbn.getKey(), rank)) { sb.append("\n") Loading Loading @@ -469,19 +504,7 @@ public class NotificationStation extends SettingsPreferenceFragment { .append(String.valueOf(p.getBlobAshmemSize())) .append("\n"); } info.extra = sb; logd(" [%d] %s: %s", info.timestamp, info.pkg, info.title); list.add(info); } } return list; } catch (RemoteException e) { Log.e(TAG, "Cannot load Notifications: ", e); } return null; return sb; } private Resources getResourcesForUserPackage(String pkg, int userId) { Loading Loading @@ -545,6 +568,7 @@ public class NotificationStation extends SettingsPreferenceFragment { private static class HistoricalNotificationPreference extends Preference { private final HistoricalNotificationInfo mInfo; private static long sLastExpandedTimestamp; // quick hack to keep things from collapsing public HistoricalNotificationPreference(Context context, HistoricalNotificationInfo info) { super(context); Loading @@ -569,7 +593,8 @@ public class NotificationStation extends SettingsPreferenceFragment { final TextView extra = (TextView) row.findViewById(R.id.extra); extra.setText(mInfo.extra); extra.setVisibility(View.GONE); extra.setVisibility(mInfo.timestamp == sLastExpandedTimestamp ? View.VISIBLE : View.GONE); row.itemView.setOnClickListener( new View.OnClickListener() { Loading @@ -577,6 +602,7 @@ public class NotificationStation extends SettingsPreferenceFragment { public void onClick(View view) { extra.setVisibility(extra.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); sLastExpandedTimestamp = mInfo.timestamp; } }); Loading