Search in sources :

Example 81 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ParanoidAndroid.

the class PhoneStatusBar method dump.

public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    synchronized (mQueueLock) {
        pw.println("Current Status Bar state:");
        pw.println("  mExpandedVisible=" + mExpandedVisible + ", mTrackingPosition=" + mTrackingPosition);
        pw.println("  mTicking=" + mTicking);
        pw.println("  mTracking=" + mTracking);
        pw.println("  mDisplayMetrics=" + mDisplayMetrics);
        pw.println("  mPile: " + viewInfo(mPile));
        pw.println("  mTickerView: " + viewInfo(mTickerView));
        pw.println("  mScrollView: " + viewInfo(mScrollView) + " scroll " + mScrollView.getScrollX() + "," + mScrollView.getScrollY());
    }
    pw.print("  mNavigationBarView=");
    if (mNavigationBarView == null) {
        pw.println("null");
    } else {
        mNavigationBarView.dump(fd, pw, args);
    }
    pw.println("  Panels: ");
    if (mNotificationPanel != null) {
        pw.println("    mNotificationPanel=" + mNotificationPanel + " params=" + mNotificationPanel.getLayoutParams().debug(""));
        pw.print("      ");
        mNotificationPanel.dump(fd, pw, args);
    }
    if (mSettingsPanel != null) {
        pw.println("    mSettingsPanel=" + mSettingsPanel + " params=" + mSettingsPanel.getLayoutParams().debug(""));
        pw.print("      ");
        mSettingsPanel.dump(fd, pw, args);
    }
    if (DUMPTRUCK) {
        synchronized (mNotificationData) {
            int N = mNotificationData.size();
            pw.println("  notification icons: " + N);
            for (int i = 0; i < N; i++) {
                NotificationData.Entry e = mNotificationData.get(i);
                pw.println("    [" + i + "] key=" + e.key + " icon=" + e.icon);
                StatusBarNotification n = e.notification;
                pw.println("         pkg=" + n.getPackageName() + " id=" + n.getId() + " score=" + n.getScore());
                pw.println("         notification=" + n.getNotification());
                pw.println("         tickerText=\"" + n.getNotification().tickerText + "\"");
            }
        }
        int N = mStatusIcons.getChildCount();
        pw.println("  system icons: " + N);
        for (int i = 0; i < N; i++) {
            StatusBarIconView ic = (StatusBarIconView) mStatusIcons.getChildAt(i);
            pw.println("    [" + i + "] icon=" + ic);
        }
        if (false) {
            pw.println("see the logcat for a dump of the views we have created.");
            // must happen on ui thread
            mHandler.post(new Runnable() {

                public void run() {
                    mStatusBarView.getLocationOnScreen(mAbsPos);
                    Slog.d(TAG, "mStatusBarView: ----- (" + mAbsPos[0] + "," + mAbsPos[1] + ") " + mStatusBarView.getWidth() + "x" + getStatusBarHeight());
                    mStatusBarView.debug();
                }
            });
        }
    }
    if (DEBUG_GESTURES) {
        pw.print("  status bar gestures: ");
        mGestureRec.dump(fd, pw, args);
    }
    mNetworkController.dump(fd, pw, args);
}
Also used : Entry(com.android.systemui.statusbar.NotificationData.Entry) StatusBarNotification(android.service.notification.StatusBarNotification) Point(android.graphics.Point) NotificationData(com.android.systemui.statusbar.NotificationData) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 82 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ParanoidAndroid.

the class TabletStatusBar method recreateStatusBar.

private void recreateStatusBar() {
    mRecreating = true;
    mStatusBarContainer.removeAllViews();
    // extract notifications.
    int nNotifs = mNotificationData.size();
    ArrayList<Pair<IBinder, StatusBarNotification>> notifications = new ArrayList<Pair<IBinder, StatusBarNotification>>(nNotifs);
    copyNotifications(notifications, mNotificationData);
    mNotificationData.clear();
    mStatusBarContainer.addView(makeStatusBarView());
    addPanelWindows();
    // recreate notifications.
    for (int i = 0; i < nNotifs; i++) {
        Pair<IBinder, StatusBarNotification> notifData = notifications.get(i);
        addNotificationViews(notifData.first, notifData.second);
    }
    setAreThereNotifications();
    mRecreating = false;
}
Also used : IBinder(android.os.IBinder) StatusBarNotification(android.service.notification.StatusBarNotification) ArrayList(java.util.ArrayList) Point(android.graphics.Point) Pair(android.util.Pair)

Example 83 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ParanoidAndroid.

the class TabletTicker method makeTickerView.

private View makeTickerView(StatusBarNotification notification) {
    final Notification n = notification.getNotification();
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ViewGroup group;
    int layoutId;
    int iconId;
    if (n.largeIcon != null) {
        iconId = R.id.right_icon;
    } else {
        iconId = R.id.left_icon;
    }
    if (n.tickerView != null) {
        group = (ViewGroup) inflater.inflate(R.layout.system_bar_ticker_panel, null, false);
        ViewGroup content = (FrameLayout) group.findViewById(R.id.ticker_expanded);
        View expanded = null;
        Exception exception = null;
        try {
            expanded = n.tickerView.apply(mContext, content);
        } catch (RuntimeException e) {
            exception = e;
        }
        if (expanded == null) {
            final String ident = notification.getPackageName() + "/0x" + Integer.toHexString(notification.getId());
            Slog.e(TAG, "couldn't inflate view for notification " + ident, exception);
            return null;
        }
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        content.addView(expanded, lp);
    } else if (n.tickerText != null) {
        group = (ViewGroup) inflater.inflate(R.layout.system_bar_ticker_compat, mWindow, false);
        final Drawable icon = StatusBarIconView.getIcon(mContext, new StatusBarIcon(notification.getPackageName(), notification.getUser(), n.icon, n.iconLevel, 0, n.tickerText));
        ImageView iv = (ImageView) group.findViewById(iconId);
        iv.setImageDrawable(icon);
        iv.setVisibility(View.VISIBLE);
        TextView tv = (TextView) group.findViewById(R.id.text);
        tv.setText(n.tickerText);
    } else {
        throw new RuntimeException("tickerView==null && tickerText==null");
    }
    ImageView largeIcon = (ImageView) group.findViewById(R.id.large_icon);
    if (n.largeIcon != null) {
        largeIcon.setImageBitmap(n.largeIcon);
        largeIcon.setVisibility(View.VISIBLE);
        final ViewGroup.LayoutParams lp = largeIcon.getLayoutParams();
        final int statusBarHeight = mBar.getStatusBarHeight();
        if (n.largeIcon.getHeight() <= statusBarHeight) {
            // for smallish largeIcons, it looks a little odd to have them floating halfway up
            // the ticker, so we vertically center them in the status bar area instead
            lp.height = statusBarHeight;
        } else {
            lp.height = mLargeIconHeight;
        }
        largeIcon.setLayoutParams(lp);
    }
    if (CLICKABLE_TICKER) {
        PendingIntent contentIntent = notification.getNotification().contentIntent;
        if (contentIntent != null) {
            // create the usual notification clicker, but chain it together with a halt() call
            // to abort the ticker too
            final View.OnClickListener clicker = mBar.makeClicker(contentIntent, notification.getPackageName(), notification.getTag(), notification.getId());
            group.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    halt();
                    clicker.onClick(v);
                }
            });
        } else {
            group.setOnClickListener(null);
        }
    }
    return group;
}
Also used : ViewGroup(android.view.ViewGroup) Drawable(android.graphics.drawable.Drawable) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification) LayoutInflater(android.view.LayoutInflater) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) ImageView(android.widget.ImageView) PendingIntent(android.app.PendingIntent)

Example 84 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ParanoidAndroid.

the class PieMenu method getNotifications.

private void getNotifications() {
    NotificationData notifData = mPanel.getBar().getNotificationData();
    if (notifData != null) {
        mNotificationText = new String[notifData.size()];
        mNotificationIcon = new Bitmap[notifData.size()];
        mNotificationPath = new Path[notifData.size()];
        for (int i = 0; i < notifData.size(); i++) {
            NotificationData.Entry entry = notifData.get(i);
            StatusBarNotification statusNotif = entry.notification;
            if (statusNotif == null)
                continue;
            boolean hide = statusNotif.getPackageName().equals("com.paranoid.halo");
            if (hide) {
                mHiddenNotification++;
                continue;
            }
            Notification notif = statusNotif.getNotification();
            if (notif == null)
                continue;
            CharSequence tickerText = notif.tickerText;
            if (tickerText == null)
                continue;
            if (entry.icon != null) {
                StatusBarIconView iconView = entry.icon;
                StatusBarIcon icon = iconView.getStatusBarIcon();
                Drawable drawable = entry.icon.getIcon(mContext, icon);
                if (!(drawable instanceof BitmapDrawable))
                    continue;
                mNotificationIcon[mNotificationCount] = ((BitmapDrawable) drawable).getBitmap();
                String text = tickerText.toString();
                if (text.length() > 100)
                    text = text.substring(0, 100) + "..";
                mNotificationText[mNotificationCount] = text;
                Path notifictionPath = new Path();
                notifictionPath.addCircle(mCenter.x, mCenter.y, mNotificationsRadius + (mNotificationsRowSize * mNotificationCount) + (mNotificationsRowSize - mNotificationTextSize), Path.Direction.CW);
                mNotificationPath[mNotificationCount] = notifictionPath;
                mNotificationCount++;
            }
        }
    }
}
Also used : Path(android.graphics.Path) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Paint(android.graphics.Paint) Point(android.graphics.Point) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification) StatusBarNotification(android.service.notification.StatusBarNotification) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) NotificationData(com.android.systemui.statusbar.NotificationData) StatusBarIconView(com.android.systemui.statusbar.StatusBarIconView)

Example 85 with StatusBarNotification

use of android.service.notification.StatusBarNotification in project android_frameworks_base by ParanoidAndroid.

the class NotificationManagerService method getActiveNotificationsFromListener.

/**
     * Allow an INotificationListener to request the list of outstanding notifications seen by
     * the current user. Useful when starting up, after which point the listener callbacks should
     * be used.
     *
     * @param token The binder for the listener, to check that the caller is allowed
     */
public StatusBarNotification[] getActiveNotificationsFromListener(INotificationListener token) {
    NotificationListenerInfo info = checkListenerToken(token);
    StatusBarNotification[] result = new StatusBarNotification[0];
    ArrayList<StatusBarNotification> list = new ArrayList<StatusBarNotification>();
    synchronized (mNotificationList) {
        final int N = mNotificationList.size();
        for (int i = 0; i < N; i++) {
            StatusBarNotification sbn = mNotificationList.get(i).sbn;
            if (info.enabledAndUserMatches(sbn)) {
                list.add(sbn);
            }
        }
    }
    return list.toArray(result);
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) ArrayList(java.util.ArrayList)

Aggregations

StatusBarNotification (android.service.notification.StatusBarNotification)144 Notification (android.app.Notification)61 View (android.view.View)24 PendingIntent (android.app.PendingIntent)23 TextView (android.widget.TextView)23 ApplicationInfo (android.content.pm.ApplicationInfo)21 ImageView (android.widget.ImageView)21 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)17 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)16 ITransientNotification (android.app.ITransientNotification)15 NotificationData (com.android.systemui.statusbar.NotificationData)14 Point (android.graphics.Point)13 RemoteViews (android.widget.RemoteViews)12 Entry (com.android.systemui.statusbar.NotificationData.Entry)12 PackageManager (android.content.pm.PackageManager)11 UserHandle (android.os.UserHandle)10 NavigationBarView (com.android.systemui.statusbar.phone.NavigationBarView)10 RemoteInputView (com.android.systemui.statusbar.policy.RemoteInputView)10 Drawable (android.graphics.drawable.Drawable)9 NotificationPanelView (com.android.systemui.statusbar.phone.NotificationPanelView)9