Search in sources :

Example 46 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 47 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 48 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)

Example 49 with Entry

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

the class BaseStatusBar method removeNotificationViews.

protected StatusBarNotification removeNotificationViews(String key, RankingMap ranking) {
    NotificationData.Entry entry = mNotificationData.remove(key, ranking);
    if (entry == null) {
        Log.w(TAG, "removeNotification for unknown key: " + key);
        return null;
    }
    updateNotifications();
    return entry.notification;
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry)

Example 50 with Entry

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

the class PhoneStatusBar method findAndUpdateMediaNotifications.

public void findAndUpdateMediaNotifications() {
    boolean metaDataChanged = false;
    synchronized (mNotificationData) {
        ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
        final int N = activeNotifications.size();
        // Promote the media notification with a controller in 'playing' state, if any.
        Entry mediaNotification = null;
        MediaController controller = null;
        for (int i = 0; i < N; i++) {
            final Entry entry = activeNotifications.get(i);
            if (isMediaNotification(entry)) {
                final MediaSession.Token token = entry.notification.getNotification().extras.getParcelable(Notification.EXTRA_MEDIA_SESSION);
                if (token != null) {
                    MediaController aController = new MediaController(mContext, token);
                    if (PlaybackState.STATE_PLAYING == getMediaControllerPlaybackState(aController)) {
                        if (DEBUG_MEDIA) {
                            Log.v(TAG, "DEBUG_MEDIA: found mediastyle controller matching " + entry.notification.getKey());
                        }
                        mediaNotification = entry;
                        controller = aController;
                        break;
                    }
                }
            }
        }
        if (mediaNotification == null) {
            if (mMediaSessionManager != null) {
                final List<MediaController> sessions = mMediaSessionManager.getActiveSessionsForUser(null, UserHandle.USER_ALL);
                for (MediaController aController : sessions) {
                    if (PlaybackState.STATE_PLAYING == getMediaControllerPlaybackState(aController)) {
                        // now to see if we have one like this
                        final String pkg = aController.getPackageName();
                        for (int i = 0; i < N; i++) {
                            final Entry entry = activeNotifications.get(i);
                            if (entry.notification.getPackageName().equals(pkg)) {
                                if (DEBUG_MEDIA) {
                                    Log.v(TAG, "DEBUG_MEDIA: found controller matching " + entry.notification.getKey());
                                }
                                controller = aController;
                                mediaNotification = entry;
                                break;
                            }
                        }
                    }
                }
            }
        }
        if (controller != null && !sameSessions(mMediaController, controller)) {
            // We have a new media session
            clearCurrentMediaNotification();
            mMediaController = controller;
            mMediaController.registerCallback(mMediaListener);
            mMediaMetadata = mMediaController.getMetadata();
            if (DEBUG_MEDIA) {
                Log.v(TAG, "DEBUG_MEDIA: insert listener, receive metadata: " + mMediaMetadata);
            }
            if (mediaNotification != null) {
                mMediaNotificationKey = mediaNotification.notification.getKey();
                if (DEBUG_MEDIA) {
                    Log.v(TAG, "DEBUG_MEDIA: Found new media notification: key=" + mMediaNotificationKey + " controller=" + mMediaController);
                }
            }
            metaDataChanged = true;
        }
    }
    if (metaDataChanged) {
        updateNotifications();
    }
    updateMediaMetaData(metaDataChanged, true);
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) MediaController(android.media.session.MediaController) MediaSession(android.media.session.MediaSession) StatusBarManager.windowStateToString(android.app.StatusBarManager.windowStateToString) 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