Search in sources :

Example 51 with Entry

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

the class PhoneStatusBar method handleGroupSummaryRemoved.

/**
     * Ensures that the group children are cancelled immediately when the group summary is cancelled
     * instead of waiting for the notification manager to send all cancels. Otherwise this could
     * lead to flickers.
     *
     * This also ensures that the animation looks nice and only consists of a single disappear
     * animation instead of multiple.
     *
     * @param key the key of the notification was removed
     * @param ranking the current ranking
     */
private void handleGroupSummaryRemoved(String key, RankingMap ranking) {
    Entry entry = mNotificationData.get(key);
    if (entry != null && entry.row != null && entry.row.isSummaryWithChildren()) {
        if (entry.notification.getOverrideGroupKey() != null && !entry.row.isDismissed()) {
            // always cancelled. We only remove them if they were dismissed by the user.
            return;
        }
        List<ExpandableNotificationRow> notificationChildren = entry.row.getNotificationChildren();
        ArrayList<ExpandableNotificationRow> toRemove = new ArrayList<>();
        for (int i = 0; i < notificationChildren.size(); i++) {
            ExpandableNotificationRow row = notificationChildren.get(i);
            if ((row.getStatusBarNotification().getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0) {
                // the child is a forground service notification which we can't remove!
                continue;
            }
            toRemove.add(row);
            toRemove.get(i).setKeepInParent(true);
            // we need to set this state earlier as otherwise we might generate some weird
            // animations
            toRemove.get(i).setRemoved();
        }
        for (int i = 0; i < toRemove.size(); i++) {
            removeNotification(toRemove.get(i).getStatusBarNotification().getKey(), ranking);
            // we need to ensure that the view is actually properly removed from the viewstate
            // as this won't happen anymore when kept in the parent.
            mStackScroller.removeViewStateForView(toRemove.get(i));
        }
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) ArrayList(java.util.ArrayList) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow)

Example 52 with Entry

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

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) {
        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 (mNotificationData.getImportance(notification.getKey()) < 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 53 with Entry

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

the class PhoneStatusBar method resetUserExpandedStates.

public void resetUserExpandedStates() {
    ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
    final int notificationCount = activeNotifications.size();
    for (int i = 0; i < notificationCount; i++) {
        NotificationData.Entry entry = activeNotifications.get(i);
        if (entry.row != null) {
            entry.row.resetUserExpansion();
        }
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) Entry(com.android.systemui.statusbar.NotificationData.Entry) Point(android.graphics.Point) NotificationData(com.android.systemui.statusbar.NotificationData)

Example 54 with Entry

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

the class PhoneStatusBar method tickTrackInfo.

private void tickTrackInfo() {
    ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
    int N = activeNotifications.size();
    if (PlaybackState.STATE_PLAYING == getMediaControllerPlaybackState(mMediaController) || PlaybackState.STATE_BUFFERING == getMediaControllerPlaybackState(mMediaController)) {
        final String pkg = mMediaController.getPackageName();
        for (int i = 0; i < N; i++) {
            final Entry entry = activeNotifications.get(i);
            if (entry.notification.getPackageName().equals(pkg)) {
                tick(entry.notification, true, true, mMediaMetadata);
                break;
            }
        }
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) StatusBarManager.windowStateToString(android.app.StatusBarManager.windowStateToString) Point(android.graphics.Point)

Example 55 with Entry

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

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)

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