Search in sources :

Example 31 with StatusBarNotification

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();
}
Also used : RemoteViews(android.widget.RemoteViews) TextView(android.widget.TextView) NotificationPanelView(com.android.systemui.statusbar.phone.NotificationPanelView) View(android.view.View) HybridNotificationView(com.android.systemui.statusbar.notification.HybridNotificationView) NotificationHeaderView(android.view.NotificationHeaderView) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 32 with StatusBarNotification

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);
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) Builder(android.app.Notification.Builder) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 33 with StatusBarNotification

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));
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) UserHandle(android.os.UserHandle) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 34 with StatusBarNotification

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);
        }
    }
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) HashSet(java.util.HashSet) NotificationData(com.android.systemui.statusbar.NotificationData)

Example 35 with StatusBarNotification

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);
    }
}
Also used : NotificationManager(android.app.NotificationManager) StatusBarNotification(android.service.notification.StatusBarNotification)

Aggregations

StatusBarNotification (android.service.notification.StatusBarNotification)188 Notification (android.app.Notification)86 View (android.view.View)24 PendingIntent (android.app.PendingIntent)23 TextView (android.widget.TextView)23 ApplicationInfo (android.content.pm.ApplicationInfo)21 ImageView (android.widget.ImageView)21 NotificationManager (android.app.NotificationManager)20 ArrayList (java.util.ArrayList)18 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)17 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)16 ITransientNotification (android.app.ITransientNotification)15 RemoteException (android.os.RemoteException)15 NotificationData (com.android.systemui.statusbar.NotificationData)14 Point (android.graphics.Point)13 RemoteViews (android.widget.RemoteViews)12 Entry (com.android.systemui.statusbar.NotificationData.Entry)12 PackageManager (android.content.pm.PackageManager)11 UserHandle (android.os.UserHandle)10 NavigationBarView (com.android.systemui.statusbar.phone.NavigationBarView)10