Search in sources :

Example 41 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by DirtyUnicorns.

the class BaseStatusBar method createNotificationViews.

protected NotificationData.Entry createNotificationViews(StatusBarNotification sbn) {
    if (DEBUG) {
        Log.d(TAG, "createNotificationViews(notification=" + sbn);
    }
    final StatusBarIconView iconView = createIcon(sbn);
    if (iconView == null) {
        return null;
    }
    // Construct the expanded view.
    NotificationData.Entry entry = new NotificationData.Entry(sbn, iconView);
    if (!inflateViews(entry, mStackScroller)) {
        handleNotificationError(sbn, "Couldn't expand RemoteViews for: " + sbn);
        return null;
    }
    return entry;
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) Entry(com.android.systemui.statusbar.NotificationData.Entry)

Example 42 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by crdroidandroid.

the class PhoneStatusBar method addNotification.

@Override
public void addNotification(StatusBarNotification notification, RankingMap ranking, Entry oldEntry) {
    if (DEBUG)
        Log.d(TAG, "addNotification key=" + notification.getKey());
    mNotificationData.updateRanking(ranking);
    Entry shadeEntry = createNotificationViews(notification);
    if (shadeEntry == null) {
        return;
    }
    boolean isHeadsUped = shouldPeek(shadeEntry);
    if (isHeadsUped) {
        // filter out alarms if required
        if (notification.getNotification().category != null && notification.getNotification().category.equals(Notification.CATEGORY_ALARM)) {
            boolean fullscreenAlarm = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.SHOW_ALARM_FULLSCREEN, 0, mCurrentUserId) == 1;
            if (fullscreenAlarm) {
                if (DEBUG)
                    Log.d(TAG, "launching alarm notification in fullscreen mode");
                isHeadsUped = false;
            }
        }
        if (isHeadsUped) {
            mHeadsUpManager.showNotification(shadeEntry);
            // Mark as seen immediately
            setNotificationShown(notification);
        }
    }
    if (!isHeadsUped && notification.getNotification().fullScreenIntent != null) {
        if (shouldSuppressFullScreenIntent(notification.getKey())) {
            if (DEBUG) {
                Log.d(TAG, "No Fullscreen intent: suppressed by DND: " + notification.getKey());
            }
        } else if (importanceToLevel(mNotificationData.getImportance(notification.getKey())) < importanceToLevel(NotificationListenerService.Ranking.IMPORTANCE_MAX)) {
            if (DEBUG) {
                Log.d(TAG, "No Fullscreen intent: not important enough: " + notification.getKey());
            }
        } else {
            // Stop screensaver if the notification has a full-screen intent.
            // (like an incoming phone call)
            awakenDreams();
            // not immersive & a full-screen alert should be shown
            if (DEBUG)
                Log.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
            try {
                EventLog.writeEvent(EventLogTags.SYSUI_FULLSCREEN_NOTIFICATION, notification.getKey());
                notification.getNotification().fullScreenIntent.send();
                shadeEntry.notifyFullScreenIntentLaunched();
                MetricsLogger.count(mContext, "note_fullscreen", 1);
            } catch (PendingIntent.CanceledException e) {
            }
        }
    } else {
        tick(notification, true, false, null);
    }
    addNotificationViews(shadeEntry, ranking);
    // Recalculate the position of the sliding windows and the titles.
    setAreThereNotifications();
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry)

Example 43 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by ParanoidAndroid.

the class PhoneStatusBar method copyNotifications.

private static void copyNotifications(ArrayList<Pair<IBinder, StatusBarNotification>> dest, NotificationData source) {
    int N = source.size();
    for (int i = 0; i < N; i++) {
        NotificationData.Entry entry = source.get(i);
        dest.add(Pair.create(entry.key, entry.notification));
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) Point(android.graphics.Point) NotificationData(com.android.systemui.statusbar.NotificationData)

Example 44 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by ParanoidAndroid.

the class TabletStatusBar method copyNotifications.

private static void copyNotifications(ArrayList<Pair<IBinder, StatusBarNotification>> dest, NotificationData source) {
    int N = source.size();
    for (int i = 0; i < N; i++) {
        NotificationData.Entry entry = source.get(i);
        dest.add(Pair.create(entry.key, entry.notification));
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) Point(android.graphics.Point) NotificationData(com.android.systemui.statusbar.NotificationData)

Example 45 with Entry

use of com.android.systemui.statusbar.NotificationData.Entry in project android_frameworks_base by ParanoidAndroid.

the class TabletStatusBar method loadNotificationPanel.

private void loadNotificationPanel() {
    int N = mNotificationData.size();
    ArrayList<View> toShow = new ArrayList<View>();
    final boolean provisioned = isDeviceProvisioned();
    // If the device hasn't been through Setup, we only show system notifications
    for (int i = 0; i < N; i++) {
        Entry ent = mNotificationData.get(N - i - 1);
        if (provisioned || showNotificationEvenIfUnprovisioned(ent.notification) && !notificationIsForCurrentUser(ent.notification)) {
            toShow.add(ent.row);
        }
    }
    ArrayList<View> toRemove = new ArrayList<View>();
    for (int i = 0; i < mPile.getChildCount(); i++) {
        View child = mPile.getChildAt(i);
        if (!toShow.contains(child)) {
            toRemove.add(child);
        }
    }
    for (View remove : toRemove) {
        mPile.removeView(remove);
    }
    for (int i = 0; i < toShow.size(); i++) {
        View v = toShow.get(i);
        if (v.getParent() == null) {
            // the notification panel has the most important things at the bottom
            mPile.addView(v, Math.min(toShow.size() - 1 - i, mPile.getChildCount()));
        }
    }
    mNotificationPanel.setNotificationCount(toShow.size());
    mNotificationPanel.setSettingsEnabled(isDeviceProvisioned());
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) QuickSettingsContainerView(com.android.systemui.statusbar.phone.QuickSettingsContainerView) View(android.view.View) TextView(android.widget.TextView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) ScrollView(android.widget.ScrollView) Point(android.graphics.Point)

Aggregations

Entry (com.android.systemui.statusbar.NotificationData.Entry)81 Point (android.graphics.Point)39 ArrayList (java.util.ArrayList)14 View (android.view.View)13 ImageView (android.widget.ImageView)13 TextView (android.widget.TextView)13 Notification (android.app.Notification)11 StatusBarNotification (android.service.notification.StatusBarNotification)11 ExpandableNotificationRow (com.android.systemui.statusbar.ExpandableNotificationRow)10 SignalClusterView (com.android.systemui.statusbar.SignalClusterView)9 StatusBarManager.windowStateToString (android.app.StatusBarManager.windowStateToString)8 NotificationData (com.android.systemui.statusbar.NotificationData)8 MediaExpandableNotificationRow (com.android.systemui.statusbar.MediaExpandableNotificationRow)6 KeyButtonView (com.android.systemui.statusbar.policy.KeyButtonView)6 MediaController (android.media.session.MediaController)5 MediaSession (android.media.session.MediaSession)5 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)5 BatteryMeterView (com.android.systemui.BatteryMeterView)5 KeyguardViewMediator (com.android.systemui.keyguard.KeyguardViewMediator)5 ActivatableNotificationView (com.android.systemui.statusbar.ActivatableNotificationView)5