use of android.service.notification.StatusBarNotification in project platform_frameworks_base by android.
the class NotificationChildrenContainer method recreateNotificationHeader.
public void recreateNotificationHeader(OnClickListener listener, StatusBarNotification notification) {
final Notification.Builder builder = Notification.Builder.recoverBuilder(getContext(), mNotificationParent.getStatusBarNotification().getNotification());
final RemoteViews header = builder.makeNotificationHeader();
if (mNotificationHeader == null) {
mNotificationHeader = (NotificationHeaderView) header.apply(getContext(), this);
final View expandButton = mNotificationHeader.findViewById(com.android.internal.R.id.expand_button);
expandButton.setVisibility(VISIBLE);
mNotificationHeader.setOnClickListener(listener);
mNotificationHeaderWrapper = NotificationViewWrapper.wrap(getContext(), mNotificationHeader, mNotificationParent);
addView(mNotificationHeader, 0);
invalidate();
} else {
header.reapply(getContext(), mNotificationHeader);
mNotificationHeaderWrapper.notifyContentUpdated(notification);
}
updateChildrenHeaderAppearance();
}
use of android.service.notification.StatusBarNotification in project platform_frameworks_base by android.
the class BuzzBeepBlinkTest method getNotificationRecord.
private NotificationRecord getNotificationRecord(int id, boolean insistent, boolean once, boolean noisy, boolean buzzy) {
final Builder builder = new Builder(getContext()).setContentTitle("foo").setSmallIcon(android.R.drawable.sym_def_app_icon).setPriority(Notification.PRIORITY_HIGH).setOnlyAlertOnce(once);
int defaults = 0;
if (noisy) {
defaults |= Notification.DEFAULT_SOUND;
}
if (buzzy) {
defaults |= Notification.DEFAULT_VIBRATE;
}
builder.setDefaults(defaults);
Notification n = builder.build();
if (insistent) {
n.flags |= Notification.FLAG_INSISTENT;
}
StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, id, mTag, mUid, mPid, mScore, n, mUser, System.currentTimeMillis());
return new NotificationRecord(getContext(), sbn);
}
use of android.service.notification.StatusBarNotification in project platform_frameworks_base by android.
the class RankingHelperTest method setUp.
@Override
public void setUp() {
MockitoAnnotations.initMocks(this);
UserHandle user = UserHandle.ALL;
mHelper = new RankingHelper(getContext(), handler, mUsageStats, new String[] { ImportanceExtractor.class.getName() });
mNotiGroupGSortA = new Notification.Builder(getContext()).setContentTitle("A").setGroup("G").setSortKey("A").setWhen(1205).build();
mRecordGroupGSortA = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiGroupGSortA, user));
mNotiGroupGSortB = new Notification.Builder(getContext()).setContentTitle("B").setGroup("G").setSortKey("B").setWhen(1200).build();
mRecordGroupGSortB = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiGroupGSortB, user));
mNotiNoGroup = new Notification.Builder(getContext()).setContentTitle("C").setWhen(1201).build();
mRecordNoGroup = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiNoGroup, user));
mNotiNoGroup2 = new Notification.Builder(getContext()).setContentTitle("D").setWhen(1202).build();
mRecordNoGroup2 = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiNoGroup2, user));
mNotiNoGroupSortA = new Notification.Builder(getContext()).setContentTitle("E").setWhen(1201).setSortKey("A").build();
mRecordNoGroupSortA = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiNoGroupSortA, user));
}
use of android.service.notification.StatusBarNotification in project platform_frameworks_base by android.
the class NotificationGroupManager method onEntryAdded.
public void onEntryAdded(final NotificationData.Entry added) {
final StatusBarNotification sbn = added.notification;
boolean isGroupChild = isGroupChild(sbn);
String groupKey = getGroupKey(sbn);
NotificationGroup group = mGroupMap.get(groupKey);
if (group == null) {
group = new NotificationGroup();
mGroupMap.put(groupKey, group);
}
if (isGroupChild) {
group.children.add(added);
updateSuppression(group);
} else {
group.summary = added;
group.expanded = added.row.areChildrenExpanded();
updateSuppression(group);
if (!group.children.isEmpty()) {
HashSet<NotificationData.Entry> childrenCopy = (HashSet<NotificationData.Entry>) group.children.clone();
for (NotificationData.Entry child : childrenCopy) {
onEntryBecomingChild(child);
}
mListener.onGroupCreatedFromChildren(group);
}
}
}
use of android.service.notification.StatusBarNotification in project platform_frameworks_base by android.
the class BugreportReceiverTest method cancelExistingNotifications.
private void cancelExistingNotifications() {
NotificationManager nm = NotificationManager.from(mContext);
for (StatusBarNotification notification : nm.getActiveNotifications()) {
int id = notification.getId();
Log.i(TAG, "Canceling existing notification (id=" + id + ")");
nm.cancel(id);
}
}
Aggregations