Search in sources :

Example 6 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ParanoidAndroid.

the class PhoneStatusBar method removeNotification.

public void removeNotification(IBinder key) {
    StatusBarNotification old = removeNotificationViews(key);
    if (SPEW)
        Slog.d(TAG, "removeNotification key=" + key + " old=" + old);
    if (old != null) {
        // Cancel the ticker if it's still running
        mTicker.removeEntry(old);
        // Recalculate the position of the sliding windows and the titles.
        updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
        if (ENABLE_INTRUDERS && old == mCurrentlyIntrudingNotification) {
            mHandler.sendEmptyMessage(MSG_HIDE_INTRUDER);
        }
        if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0) {
            animateCollapsePanels();
        }
    }
    setAreThereNotifications();
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification)

Example 7 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ParanoidAndroid.

the class PhoneStatusBar method recreateStatusBar.

private void recreateStatusBar() {
    mRecreating = true;
    mStatusBarContainer.removeAllViews();
    // extract icons from the soon-to-be recreated viewgroup.
    int nIcons = mStatusIcons.getChildCount();
    ArrayList<StatusBarIcon> icons = new ArrayList<StatusBarIcon>(nIcons);
    ArrayList<String> iconSlots = new ArrayList<String>(nIcons);
    for (int i = 0; i < nIcons; i++) {
        StatusBarIconView iconView = (StatusBarIconView) mStatusIcons.getChildAt(i);
        icons.add(iconView.getStatusBarIcon());
        iconSlots.add(iconView.getStatusBarSlot());
    }
    // extract notifications.
    int nNotifs = mNotificationData.size();
    ArrayList<Pair<IBinder, StatusBarNotification>> notifications = new ArrayList<Pair<IBinder, StatusBarNotification>>(nNotifs);
    copyNotifications(notifications, mNotificationData);
    mNotificationData.clear();
    makeStatusBarView();
    repositionNavigationBar();
    mNavigationBarView.updateResources();
    // recreate StatusBarIconViews.
    for (int i = 0; i < nIcons; i++) {
        StatusBarIcon icon = icons.get(i);
        String slot = iconSlots.get(i);
        addIcon(slot, i, i, icon);
    }
    // recreate notifications.
    for (int i = 0; i < nNotifs; i++) {
        Pair<IBinder, StatusBarNotification> notifData = notifications.get(i);
        addNotificationViews(notifData.first, notifData.second);
    }
    setAreThereNotifications();
    mStatusBarContainer.addView(mStatusBarWindow);
    updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
    mRecreating = false;
}
Also used : IBinder(android.os.IBinder) StatusBarNotification(android.service.notification.StatusBarNotification) ArrayList(java.util.ArrayList) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) Point(android.graphics.Point) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) Pair(android.util.Pair)

Example 8 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ResurrectionRemix.

the class NotificationData method filterAndSort.

// TODO: This should not be public. Instead the Environment should notify this class when
// anything changed, and this class should call back the UI so it updates itself.
public void filterAndSort() {
    mSortedAndFiltered.clear();
    synchronized (mEntries) {
        final int N = mEntries.size();
        for (int i = 0; i < N; i++) {
            Entry entry = mEntries.valueAt(i);
            StatusBarNotification sbn = entry.notification;
            if (shouldFilterOut(sbn)) {
                continue;
            }
            mSortedAndFiltered.add(entry);
        }
    }
    Collections.sort(mSortedAndFiltered, mRankingComparator);
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification)

Example 9 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ResurrectionRemix.

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)

Example 10 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ResurrectionRemix.

the class PhoneStatusBar method maybeEscalateHeadsUp.

@Override
public void maybeEscalateHeadsUp() {
    Collection<HeadsUpManager.HeadsUpEntry> entries = mHeadsUpManager.getAllEntries();
    for (HeadsUpManager.HeadsUpEntry entry : entries) {
        final StatusBarNotification sbn = entry.entry.notification;
        final Notification notification = sbn.getNotification();
        if (notification.fullScreenIntent != null) {
            if (DEBUG) {
                Log.d(TAG, "converting a heads up to fullScreen");
            }
            try {
                EventLog.writeEvent(EventLogTags.SYSUI_HEADS_UP_ESCALATION, sbn.getKey());
                notification.fullScreenIntent.send();
                entry.entry.notifyFullScreenIntentLaunched();
            } catch (PendingIntent.CanceledException e) {
            }
        }
    }
    mHeadsUpManager.releaseAllImmediately();
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) PendingIntent(android.app.PendingIntent) HeadsUpManager(com.android.systemui.statusbar.policy.HeadsUpManager) Notification(android.app.Notification) 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