}
/** The package of the app that posted the notification. */
- public String getPkg() {
+ public String getPackageName() {
return pkg;
}
protected View updateNotificationVetoButton(View row, StatusBarNotification n) {
View vetoButton = row.findViewById(R.id.veto);
if (n.isClearable()) {
- final String _pkg = n.getPkg();
+ final String _pkg = n.getPackageName();
final String _tag = n.getTag();
final int _id = n.getId();
vetoButton.setOnClickListener(new View.OnClickListener() {
com.android.internal.R.layout.notification_template_base) {
int version = 0;
try {
- ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPkg(), 0);
+ ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPackageName(), 0);
version = info.targetSdkVersion;
} catch (NameNotFoundException ex) {
- Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPkg(), ex);
+ Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPackageName(), ex);
}
if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false);
// for blaming (see SwipeHelper.setLongPressListener)
- row.setTag(sbn.getPkg());
+ row.setTag(sbn.getPackageName());
workAroundBadLayerDrawableOpacity(row);
View vetoButton = updateNotificationVetoButton(row, sbn);
PendingIntent contentIntent = sbn.getNotification().contentIntent;
if (contentIntent != null) {
final View.OnClickListener listener = new NotificationClicker(contentIntent,
- sbn.getPkg(), sbn.getTag(), sbn.getId());
+ sbn.getPackageName(), sbn.getTag(), sbn.getId());
content.setOnClickListener(listener);
} else {
content.setOnClickListener(null);
}
}
catch (RuntimeException e) {
- final String ident = sbn.getPkg() + "/0x" + Integer.toHexString(sbn.getId());
+ final String ident = sbn.getPackageName() + "/0x" + Integer.toHexString(sbn.getId());
Slog.e(TAG, "couldn't inflate view for notification " + ident, e);
return false;
}
void handleNotificationError(IBinder key, StatusBarNotification n, String message) {
removeNotification(key);
try {
- mBarService.onNotificationError(n.getPkg(), n.getTag(), n.getId(), n.getUid(), n.getInitialPid(), message);
+ mBarService.onNotificationError(n.getPackageName(), n.getTag(), n.getId(), n.getUid(), n.getInitialPid(), message);
} catch (RemoteException ex) {
// The end is nigh.
}
}
// Construct the icon.
final StatusBarIconView iconView = new StatusBarIconView(mContext,
- notification.getPkg() + "/0x" + Integer.toHexString(notification.getId()),
+ notification.getPackageName() + "/0x" + Integer.toHexString(notification.getId()),
notification.getNotification());
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
- final StatusBarIcon ic = new StatusBarIcon(notification.getPkg(),
+ final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(),
notification.getUser(),
notification.getNotification().icon,
notification.getNotification().iconLevel,
final PendingIntent contentIntent = notification.getNotification().contentIntent;
if (contentIntent != null) {
final View.OnClickListener listener = makeClicker(contentIntent,
- notification.getPkg(), notification.getTag(), notification.getId());
+ notification.getPackageName(), notification.getTag(), notification.getId());
oldEntry.content.setOnClickListener(listener);
} else {
oldEntry.content.setOnClickListener(null);
}
// Update the icon.
- final StatusBarIcon ic = new StatusBarIcon(notification.getPkg(),
+ final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(),
notification.getUser(),
notification.getNotification().icon, notification.getNotification().iconLevel,
notification.getNotification().number,
// A: Almost none! Only things coming from the system (package is "android") that also
// have special "kind" tags marking them as relevant for setup (see below).
protected boolean showNotificationEvenIfUnprovisioned(StatusBarNotification sbn) {
- if ("android".equals(sbn.getPkg())) {
+ if ("android".equals(sbn.getPackageName())) {
if (sbn.getNotification().kind != null) {
for (String aKind : sbn.getNotification().kind) {
// IME switcher, created by InputMethodManagerService
NotificationData.Entry e = mNotificationData.get(i);
pw.println(" [" + i + "] key=" + e.key + " icon=" + e.icon);
StatusBarNotification n = e.notification;
- pw.println(" pkg=" + n.getPkg() + " id=" + n.getId() + " score=" + n.getScore());
+ pw.println(" pkg=" + n.getPackageName() + " id=" + n.getId() + " score=" + n.getScore());
pw.println(" notification=" + n.getNotification());
pw.println(" tickerText=\"" + n.getNotification().tickerText + "\"");
}
try {
mBarService.onNotificationClear(
- mCurrentlyIntrudingNotification.getPkg(),
+ mCurrentlyIntrudingNotification.getPackageName(),
mCurrentlyIntrudingNotification.getTag(),
mCurrentlyIntrudingNotification.getId());
} catch (android.os.RemoteException ex) {
// a notification storm).
if (initialCount > 0) {
final Segment seg = mSegments.get(0);
- if (n.getPkg().equals(seg.notification.getPkg())
+ if (n.getPackageName().equals(seg.notification.getPackageName())
&& n.getNotification().icon == seg.notification.getNotification().icon
&& n.getNotification().iconLevel == seg.notification.getNotification().iconLevel
&& CharSequences.equals(seg.notification.getNotification().tickerText,
}
final Drawable icon = StatusBarIconView.getIcon(mContext,
- new StatusBarIcon(n.getPkg(), n.getUser(), n.getNotification().icon, n.getNotification().iconLevel, 0,
+ new StatusBarIcon(n.getPackageName(), n.getUser(), n.getNotification().icon, n.getNotification().iconLevel, 0,
n.getNotification().tickerText));
final CharSequence text = n.getNotification().tickerText;
final Segment newSegment = new Segment(n, icon, text);
// If there's already a notification schedule for this package and id, remove it.
for (int i=0; i<mSegments.size(); i++) {
Segment seg = mSegments.get(i);
- if (n.getId() == seg.notification.getId() && n.getPkg().equals(seg.notification.getPkg())) {
+ if (n.getId() == seg.notification.getId() && n.getPackageName().equals(seg.notification.getPackageName())) {
// just update that one to use this new data instead
mSegments.remove(i--); // restart iteration here
}
public void removeEntry(StatusBarNotification n) {
for (int i=mSegments.size()-1; i>=0; i--) {
Segment seg = mSegments.get(i);
- if (n.getId() == seg.notification.getId() && n.getPkg().equals(seg.notification.getPkg())) {
+ if (n.getId() == seg.notification.getId() && n.getPackageName().equals(seg.notification.getPackageName())) {
mSegments.remove(i);
}
}
exception = e;
}
if (expanded == null) {
- final String ident = notification.getPkg()
+ final String ident = notification.getPackageName()
+ "/0x" + Integer.toHexString(notification.getId());
Slog.e(TAG, "couldn't inflate view for notification " + ident, exception);
return null;
} 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.getPkg(), notification.getUser(), n.icon, n.iconLevel, 0,
+ new StatusBarIcon(notification.getPackageName(), notification.getUser(), n.icon, n.iconLevel, 0,
n.tickerText));
ImageView iv = (ImageView)group.findViewById(iconId);
iv.setImageDrawable(icon);
// 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.getPkg(), notification.getTag(), notification.getId());
+ notification.getPackageName(), notification.getTag(), notification.getId());
group.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
halt();
private StatusBarNotification findNext() {
while (iter.hasNext()) {
StatusBarNotification nr = iter.next();
- if ((pkg == null || nr.getPkg() == pkg)
+ if ((pkg == null || nr.getPackageName() == pkg)
&& (userId == UserHandle.USER_ALL || nr.getUserId() == userId)) {
return nr;
}
pw.println(prefix + this);
pw.println(prefix + " uid=" + sbn.getUid() + " userId=" + sbn.getUserId());
pw.println(prefix + " icon=0x" + Integer.toHexString(notification.icon)
- + " / " + idDebugString(baseContext, sbn.getPkg(), notification.icon));
+ + " / " + idDebugString(baseContext, sbn.getPackageName(), notification.icon));
pw.println(prefix + " pri=" + notification.priority + " score=" + sbn.getScore());
pw.println(prefix + " contentIntent=" + notification.contentIntent);
pw.println(prefix + " deleteIntent=" + notification.deleteIntent);
return String.format(
"NotificationRecord(0x%08x: pkg=%s user=%s id=%d tag=%s score=%d: %s)",
System.identityHashCode(this),
- this.sbn.getPkg(), this.sbn.getUser(), this.sbn.getId(), this.sbn.getTag(),
+ this.sbn.getPackageName(), this.sbn.getUser(), this.sbn.getId(), this.sbn.getTag(),
this.sbn.getScore(), this.sbn.getNotification());
}
}
final int N = mNotificationList.size();
for (int i=0; i<N; i++) {
final NotificationRecord r = mNotificationList.get(i);
- if (r.sbn.getPkg().equals(pkg) && r.sbn.getUserId() == userId) {
+ if (r.sbn.getPackageName().equals(pkg) && r.sbn.getUserId() == userId) {
count++;
if (count >= MAX_PACKAGE_NOTIFICATIONS) {
Slog.e(TAG, "Package has already posted " + count
} catch (PendingIntent.CanceledException ex) {
// do nothing - there's no relevant way to recover, and
// no reason to let this propagate
- Slog.w(TAG, "canceled PendingIntent for " + r.sbn.getPkg(), ex);
+ Slog.w(TAG, "canceled PendingIntent for " + r.sbn.getPackageName(), ex);
}
}
}
if ((r.getFlags() & mustNotHaveFlags) != 0) {
continue;
}
- if (pkg != null && !r.sbn.getPkg().equals(pkg)) {
+ if (pkg != null && !r.sbn.getPackageName().equals(pkg)) {
continue;
}
canceledSomething = true;
continue;
}
}
- if (r.sbn.getPkg().equals(pkg)) {
+ if (r.sbn.getPackageName().equals(pkg)) {
return i;
}
}