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);
}
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;
}
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;
}
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++;
}
}
}
}
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);
}
Aggregations