Search in sources :

Example 11 with Entry

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

the class BaseStatusBar method updateRowStates.

/**
     * Updates expanded, dimmed and locked states of notification rows.
     */
protected void updateRowStates() {
    mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
    ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
    final int N = activeNotifications.size();
    int visibleNotifications = 0;
    boolean onKeyguard = mState == StatusBarState.KEYGUARD;
    int maxNotifications = 0;
    if (onKeyguard) {
        maxNotifications = getMaxKeyguardNotifications(true);
    }
    for (int i = 0; i < N; i++) {
        NotificationData.Entry entry = activeNotifications.get(i);
        boolean childNotification = mGroupManager.isChildInGroupWithSummary(entry.notification);
        if (onKeyguard) {
            entry.row.setOnKeyguard(true);
        } else {
            entry.row.setOnKeyguard(false);
            entry.row.setSystemExpanded(visibleNotifications == 0 && !childNotification);
        }
        boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(entry.notification) && !entry.row.isRemoved();
        boolean childWithVisibleSummary = childNotification && mGroupManager.getGroupSummary(entry.notification).getVisibility() == View.VISIBLE;
        boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
        if (suppressedSummary || (isLockscreenPublicMode() && !mShowLockscreenNotifications) || (onKeyguard && !childWithVisibleSummary && (visibleNotifications >= maxNotifications || !showOnKeyguard))) {
            entry.row.setVisibility(View.GONE);
            if (onKeyguard && showOnKeyguard && !childNotification && !suppressedSummary) {
                mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
            }
        } else {
            boolean wasGone = entry.row.getVisibility() == View.GONE;
            entry.row.setVisibility(View.VISIBLE);
            if (!childNotification && !entry.row.isRemoved()) {
                if (wasGone) {
                    // notify the scroller of a child addition
                    mStackScroller.generateAddAnimation(entry.row, !showOnKeyguard);
                }
                visibleNotifications++;
            }
        }
    }
    mStackScroller.updateOverflowContainerVisibility(onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0);
    mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 1);
    mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - 2);
    mStackScroller.changeViewPosition(mKeyguardIconOverflowContainer, mStackScroller.getChildCount() - 3);
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) Entry(com.android.systemui.statusbar.NotificationData.Entry)

Example 12 with Entry

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

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

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

the class PhoneStatusBar method removeRemoteInputEntriesKeptUntilCollapsed.

private void removeRemoteInputEntriesKeptUntilCollapsed() {
    for (int i = 0; i < mRemoteInputEntriesToRemoveOnCollapse.size(); i++) {
        Entry entry = mRemoteInputEntriesToRemoveOnCollapse.valueAt(i);
        mRemoteInputController.removeRemoteInput(entry, null);
        removeNotification(entry.key, mLatestRankingMap);
    }
    mRemoteInputEntriesToRemoveOnCollapse.clear();
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) Point(android.graphics.Point)

Example 14 with Entry

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

the class PhoneStatusBar method removeNotification.

@Override
public void removeNotification(String key, RankingMap ranking) {
    boolean deferRemoval = false;
    if (mHeadsUpManager.isHeadsUp(key)) {
        // A cancel() in repsonse to a remote input shouldn't be delayed, as it makes the
        // sending look longer than it takes.
        // Also we should not defer the removal if reordering isn't allowed since otherwise
        // some notifications can't disappear before the panel is closed.
        boolean ignoreEarliestRemovalTime = mRemoteInputController.isSpinning(key) && !FORCE_REMOTE_INPUT_HISTORY || !mVisualStabilityManager.isReorderingAllowed();
        deferRemoval = !mHeadsUpManager.removeNotification(key, ignoreEarliestRemovalTime);
    }
    if (key.equals(mMediaNotificationKey)) {
        clearCurrentMediaNotification();
        updateMediaMetaData(true, true);
    }
    if (FORCE_REMOTE_INPUT_HISTORY && mRemoteInputController.isSpinning(key)) {
        Entry entry = mNotificationData.get(key);
        StatusBarNotification sbn = entry.notification;
        Notification.Builder b = Notification.Builder.recoverBuilder(mContext, sbn.getNotification().clone());
        CharSequence[] oldHistory = sbn.getNotification().extras.getCharSequenceArray(Notification.EXTRA_REMOTE_INPUT_HISTORY);
        CharSequence[] newHistory;
        if (oldHistory == null) {
            newHistory = new CharSequence[1];
        } else {
            newHistory = new CharSequence[oldHistory.length + 1];
            for (int i = 0; i < oldHistory.length; i++) {
                newHistory[i + 1] = oldHistory[i];
            }
        }
        newHistory[0] = String.valueOf(entry.remoteInputText);
        b.setRemoteInputHistory(newHistory);
        Notification newNotification = b.build();
        // Undo any compatibility view inflation
        newNotification.contentView = sbn.getNotification().contentView;
        newNotification.bigContentView = sbn.getNotification().bigContentView;
        newNotification.headsUpContentView = sbn.getNotification().headsUpContentView;
        StatusBarNotification newSbn = new StatusBarNotification(sbn.getPackageName(), sbn.getOpPkg(), sbn.getId(), sbn.getTag(), sbn.getUid(), sbn.getInitialPid(), 0, newNotification, sbn.getUser(), sbn.getPostTime());
        updateNotification(newSbn, null);
        mKeysKeptForRemoteInput.add(entry.key);
        return;
    }
    if (deferRemoval) {
        mLatestRankingMap = ranking;
        mHeadsUpEntriesToRemoveOnSwitch.add(mHeadsUpManager.getEntry(key));
        return;
    }
    Entry entry = mNotificationData.get(key);
    if (entry != null && mRemoteInputController.isRemoteInputActive(entry) && (entry.row != null && !entry.row.isDismissed())) {
        mLatestRankingMap = ranking;
        mRemoteInputEntriesToRemoveOnCollapse.add(entry);
        return;
    }
    if (entry != null && entry.row != null) {
        entry.row.setRemoved();
    }
    // Let's remove the children if this was a summary
    handleGroupSummaryRemoved(key, ranking);
    StatusBarNotification old = removeNotificationViews(key, ranking);
    if (SPEW)
        Log.d(TAG, "removeNotification key=" + key + " old=" + old);
    if (old != null) {
        // Cancel the ticker if it's still running
        if (mTickerEnabled != 0) {
            mTicker.removeEntry(old);
        }
        if (CLOSE_PANEL_WHEN_EMPTIED && !hasActiveNotifications() && !mNotificationPanel.isTracking() && !mNotificationPanel.isQsExpanded()) {
            if (mState == StatusBarState.SHADE) {
                animateCollapsePanels();
            } else if (mState == StatusBarState.SHADE_LOCKED && !isCollapsing()) {
                goToKeyguard();
            }
        }
    }
    setAreThereNotifications();
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) StatusBarNotification(android.service.notification.StatusBarNotification) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification) Point(android.graphics.Point)

Example 15 with Entry

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

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