Merge "API: getPkg() -> getPackageName()" into jb-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
027f84c310
@@ -186,7 +186,7 @@ public class StatusBarNotification implements Parcelable {
|
||||
}
|
||||
|
||||
/** The package of the app that posted the notification. */
|
||||
public String getPkg() {
|
||||
public String getPackageName() {
|
||||
return pkg;
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
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() {
|
||||
@@ -345,10 +345,10 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
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);
|
||||
@@ -741,7 +741,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
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);
|
||||
@@ -759,7 +759,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
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);
|
||||
@@ -775,7 +775,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -904,7 +904,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
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.
|
||||
}
|
||||
@@ -932,11 +932,11 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
}
|
||||
// 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,
|
||||
@@ -1083,13 +1083,13 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
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,
|
||||
@@ -1155,7 +1155,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
// 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
|
||||
|
||||
@@ -2066,7 +2066,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
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 + "\"");
|
||||
}
|
||||
@@ -2369,7 +2369,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
|
||||
try {
|
||||
mBarService.onNotificationClear(
|
||||
mCurrentlyIntrudingNotification.getPkg(),
|
||||
mCurrentlyIntrudingNotification.getPackageName(),
|
||||
mCurrentlyIntrudingNotification.getTag(),
|
||||
mCurrentlyIntrudingNotification.getId());
|
||||
} catch (android.os.RemoteException ex) {
|
||||
|
||||
@@ -189,7 +189,7 @@ public abstract class Ticker {
|
||||
// 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,
|
||||
@@ -199,7 +199,7 @@ public abstract class Ticker {
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -207,7 +207,7 @@ public abstract class Ticker {
|
||||
// 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
|
||||
}
|
||||
@@ -235,7 +235,7 @@ public abstract class Ticker {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ public class TabletTicker
|
||||
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;
|
||||
@@ -286,7 +286,7 @@ public class TabletTicker
|
||||
} 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);
|
||||
@@ -318,7 +318,7 @@ public class TabletTicker
|
||||
// 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();
|
||||
|
||||
@@ -311,7 +311,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
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;
|
||||
}
|
||||
@@ -860,7 +860,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
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);
|
||||
@@ -920,7 +920,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -1540,7 +1540,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
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
|
||||
@@ -1839,7 +1839,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1964,7 +1964,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
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;
|
||||
@@ -2100,7 +2100,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (r.sbn.getPkg().equals(pkg)) {
|
||||
if (r.sbn.getPackageName().equals(pkg)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user