Search in sources :

Example 36 with Entry

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

the class BaseStatusBar method updatePreferences.

public static void updatePreferences() {
    if (mNotificationData == null)
        return;
    for (Entry entry : mNotificationData.getActiveNotifications()) {
        NotificationBackgroundView mBackgroundNormal = (NotificationBackgroundView) getObjectField(entry.row, "mBackgroundNormal");
        NotificationBackgroundView mBackgroundDimmed = (NotificationBackgroundView) getObjectField(entry.row, "mBackgroundDimmed");
        mBackgroundNormal.postInvalidate();
        mBackgroundDimmed.postInvalidate();
    }
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry)

Example 37 with Entry

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

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) MediaExpandableNotificationRow(com.android.systemui.statusbar.MediaExpandableNotificationRow)

Example 38 with Entry

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

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 39 with Entry

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

the class PhoneStatusBar method updateNotificationShade.

private void updateNotificationShade() {
    if (mStackScroller == null)
        return;
    // Do not modify the notifications during collapse.
    if (isCollapsing()) {
        addPostCollapseAction(new Runnable() {

            @Override
            public void run() {
                updateNotificationShade();
            }
        });
        return;
    }
    ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
    ArrayList<ExpandableNotificationRow> toShow = new ArrayList<>(activeNotifications.size());
    final int N = activeNotifications.size();
    for (int i = 0; i < N; i++) {
        Entry ent = activeNotifications.get(i);
        if (ent.row.isDismissed() || ent.row.isRemoved()) {
            // temporarily become children if they were isolated before.
            continue;
        }
        int vis = ent.notification.getNotification().visibility;
        // Display public version of the notification if we need to redact.
        final boolean hideSensitive = !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId());
        boolean sensitiveNote = vis == Notification.VISIBILITY_PRIVATE;
        boolean sensitivePackage = packageHasVisibilityOverride(ent.notification.getKey());
        boolean sensitive = (sensitiveNote && hideSensitive) || sensitivePackage;
        boolean showingPublic = sensitive && isLockscreenPublicMode();
        if (showingPublic) {
            updatePublicContentView(ent, ent.notification);
        }
        ent.row.setSensitive(sensitive, hideSensitive);
        if (ent.autoRedacted && ent.legacy) {
            // for legacy auto redacted notifications.
            if (showingPublic) {
                ent.row.setShowingLegacyBackground(false);
            } else {
                ent.row.setShowingLegacyBackground(true);
            }
        }
        if (mGroupManager.isChildInGroupWithSummary(ent.row.getStatusBarNotification())) {
            ExpandableNotificationRow summary = mGroupManager.getGroupSummary(ent.row.getStatusBarNotification());
            List<ExpandableNotificationRow> orderedChildren = mTmpChildOrderMap.get(summary);
            if (orderedChildren == null) {
                orderedChildren = new ArrayList<>();
                mTmpChildOrderMap.put(summary, orderedChildren);
            }
            orderedChildren.add(ent.row);
        } else {
            toShow.add(ent.row);
        }
    }
    ArrayList<ExpandableNotificationRow> toRemove = new ArrayList<>();
    for (int i = 0; i < mStackScroller.getChildCount(); i++) {
        View child = mStackScroller.getChildAt(i);
        if (!toShow.contains(child) && child instanceof ExpandableNotificationRow) {
            toRemove.add((ExpandableNotificationRow) child);
        }
    }
    for (ExpandableNotificationRow remove : toRemove) {
        if (mGroupManager.isChildInGroupWithSummary(remove.getStatusBarNotification())) {
            // we are only transfering this notification to its parent, don't generate an animation
            mStackScroller.setChildTransferInProgress(true);
        }
        if (remove.isSummaryWithChildren()) {
            remove.removeAllChildren();
        }
        mStackScroller.removeView(remove);
        mStackScroller.setChildTransferInProgress(false);
    }
    removeNotificationChildren();
    for (int i = 0; i < toShow.size(); i++) {
        View v = toShow.get(i);
        if (v.getParent() == null) {
            mVisualStabilityManager.notifyViewAddition(v);
            mStackScroller.addView(v);
        }
    }
    addNotificationChildrenAndSort();
    // So after all this work notifications still aren't sorted correctly.
    // Let's do that now by advancing through toShow and mStackScroller in
    // lock-step, making sure mStackScroller matches what we see in toShow.
    int j = 0;
    for (int i = 0; i < mStackScroller.getChildCount(); i++) {
        View child = mStackScroller.getChildAt(i);
        if (!(child instanceof ExpandableNotificationRow)) {
            // We don't care about non-notification views.
            continue;
        }
        ExpandableNotificationRow targetChild = toShow.get(j);
        if (child != targetChild) {
            // here and advance both lists.
            if (mVisualStabilityManager.canReorderNotification(targetChild)) {
                mStackScroller.changeViewPosition(targetChild, i);
            } else {
                mVisualStabilityManager.addReorderingAllowedCallback(this);
            }
        }
        j++;
    }
    mVisualStabilityManager.onReorderingFinished();
    // clear the map again for the next usage
    mTmpChildOrderMap.clear();
    updateRowStates();
    updateSpeedbump();
    updateClearAll();
    updateEmptyShadeView();
    updateQsExpansionEnabled();
    mShadeUpdates.check();
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) ArrayList(java.util.ArrayList) ActivatableNotificationView(com.android.systemui.statusbar.ActivatableNotificationView) BatteryMeterView(com.android.systemui.BatteryMeterView) DismissView(com.android.systemui.statusbar.DismissView) NotificationBackgroundView(com.android.systemui.statusbar.NotificationBackgroundView) VisualizerView(com.android.systemui.statusbar.VisualizerView) SignalClusterView(com.android.systemui.statusbar.SignalClusterView) ImageView(android.widget.ImageView) BatteryLevelTextView(com.android.systemui.BatteryLevelTextView) BackDropView(com.android.systemui.statusbar.BackDropView) KeyButtonView(com.android.systemui.statusbar.policy.KeyButtonView) EmptyShadeView(com.android.systemui.statusbar.EmptyShadeView) View(android.view.View) TextView(android.widget.TextView) ScrimView(com.android.systemui.statusbar.ScrimView) Point(android.graphics.Point) ExpandableNotificationRow(com.android.systemui.statusbar.ExpandableNotificationRow) MediaExpandableNotificationRow(com.android.systemui.statusbar.MediaExpandableNotificationRow)

Example 40 with Entry

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

the class PhoneStatusBar method performRemoveNotification.

@Override
protected void performRemoveNotification(StatusBarNotification n) {
    Entry entry = mNotificationData.get(n.getKey());
    if (mRemoteInputController.isRemoteInputActive(entry)) {
        mRemoteInputController.removeRemoteInput(entry, null);
    }
    super.performRemoveNotification(n);
}
Also used : 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