Merge "API cleanup: NotificationListener" into jb-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a7b6cbf1a3
@@ -21228,8 +21228,8 @@ package android.service.notification {
|
||||
|
||||
public abstract class NotificationListenerService extends android.app.Service {
|
||||
ctor public NotificationListenerService();
|
||||
method public final void clearAllNotifications();
|
||||
method public final void clearNotification(java.lang.String, java.lang.String, int);
|
||||
method public final void cancelAllNotifications();
|
||||
method public final void cancelNotification(java.lang.String, java.lang.String, int);
|
||||
method public android.service.notification.StatusBarNotification[] getActiveNotifications();
|
||||
method public android.os.IBinder onBind(android.content.Intent);
|
||||
method public abstract void onNotificationPosted(android.service.notification.StatusBarNotification);
|
||||
@@ -21242,17 +21242,16 @@ package android.service.notification {
|
||||
ctor public StatusBarNotification(android.os.Parcel);
|
||||
method public android.service.notification.StatusBarNotification clone();
|
||||
method public int describeContents();
|
||||
method public int getId();
|
||||
method public android.app.Notification getNotification();
|
||||
method public java.lang.String getPkg();
|
||||
method public long getPostTime();
|
||||
method public java.lang.String getTag();
|
||||
method public int getUserId();
|
||||
method public boolean isClearable();
|
||||
method public boolean isOngoing();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator CREATOR;
|
||||
field public final int id;
|
||||
field public final android.app.Notification notification;
|
||||
field public final java.lang.String pkg;
|
||||
field public final long postTime;
|
||||
field public final java.lang.String tag;
|
||||
field public final android.os.UserHandle user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ interface INotificationManager
|
||||
void registerListener(in INotificationListener listener, in ComponentName component, int userid);
|
||||
void unregisterListener(in INotificationListener listener, int userid);
|
||||
|
||||
void clearNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
|
||||
void clearAllNotificationsFromListener(in INotificationListener token);
|
||||
void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
|
||||
void cancelAllNotificationsFromListener(in INotificationListener token);
|
||||
|
||||
StatusBarNotification[] getActiveNotificationsFromListener(in INotificationListener token);
|
||||
}
|
||||
@@ -97,9 +97,9 @@ public abstract class NotificationListenerService extends Service {
|
||||
* @param id ID of the notification as specified by the notifying app in
|
||||
* {@link android.app.NotificationManager#notify(String, int, android.app.Notification)}.
|
||||
*/
|
||||
public final void clearNotification(String pkg, String tag, int id) {
|
||||
public final void cancelNotification(String pkg, String tag, int id) {
|
||||
try {
|
||||
getNotificationInterface().clearNotificationFromListener(mWrapper, pkg, tag, id);
|
||||
getNotificationInterface().cancelNotificationFromListener(mWrapper, pkg, tag, id);
|
||||
} catch (android.os.RemoteException ex) {
|
||||
Log.v(TAG, "Unable to contact notification manager", ex);
|
||||
}
|
||||
@@ -114,11 +114,11 @@ public abstract class NotificationListenerService extends Service {
|
||||
* upon being informed, the notification manager will actually remove all active notifications
|
||||
* and you will get multiple {@link #onNotificationRemoved(StatusBarNotification)} callbacks.
|
||||
*
|
||||
* {@see #clearNotification(String, String, int)}
|
||||
* {@see #cancelNotification(String, String, int)}
|
||||
*/
|
||||
public final void clearAllNotifications() {
|
||||
public final void cancelAllNotifications() {
|
||||
try {
|
||||
getNotificationInterface().clearAllNotificationsFromListener(mWrapper);
|
||||
getNotificationInterface().cancelAllNotificationsFromListener(mWrapper);
|
||||
} catch (android.os.RemoteException ex) {
|
||||
Log.v(TAG, "Unable to contact notification manager", ex);
|
||||
}
|
||||
|
||||
@@ -26,35 +26,21 @@ import android.os.UserHandle;
|
||||
* the status bar and any {@link android.service.notification.NotificationListenerService}s.
|
||||
*/
|
||||
public class StatusBarNotification implements Parcelable {
|
||||
/** The package of the app that posted the notification. */
|
||||
public final String pkg;
|
||||
/** The id supplied to {@link android.app.NotificationManager#notify}. */
|
||||
public final int id;
|
||||
/** The tag supplied to {@link android.app.NotificationManager#notify}, or null if no tag
|
||||
* was specified. */
|
||||
public final String tag;
|
||||
private final String pkg;
|
||||
private final int id;
|
||||
private final String tag;
|
||||
|
||||
/** The notifying app's calling uid. @hide */
|
||||
public final int uid;
|
||||
/** The notifying app's base package. @hide */
|
||||
public final String basePkg;
|
||||
/** @hide */
|
||||
public final int initialPid;
|
||||
private final int uid;
|
||||
private final String basePkg;
|
||||
private final int initialPid;
|
||||
// TODO: make this field private and move callers to an accessor that
|
||||
// ensures sourceUser is applied.
|
||||
|
||||
/** The {@link android.app.Notification} supplied to
|
||||
* {@link android.app.NotificationManager#notify}. */
|
||||
public final Notification notification;
|
||||
/** The {@link android.os.UserHandle} for whom this notification is intended. */
|
||||
public final UserHandle user;
|
||||
/** The time (in {@link System#currentTimeMillis} time) the notification was posted,
|
||||
* which may be different than {@link android.app.Notification#when}.
|
||||
*/
|
||||
public final long postTime;
|
||||
private final Notification notification;
|
||||
private final UserHandle user;
|
||||
private final long postTime;
|
||||
|
||||
/** @hide */
|
||||
public final int score;
|
||||
private final int score;
|
||||
|
||||
/** This is temporarily needed for the JB MR1 PDK.
|
||||
* @hide */
|
||||
@@ -198,4 +184,61 @@ public class StatusBarNotification implements Parcelable {
|
||||
public int getUserId() {
|
||||
return this.user.getIdentifier();
|
||||
}
|
||||
|
||||
/** The package of the app that posted the notification. */
|
||||
public String getPkg() {
|
||||
return pkg;
|
||||
}
|
||||
|
||||
/** The id supplied to {@link android.app.NotificationManager#notify}. */
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/** The tag supplied to {@link android.app.NotificationManager#notify}, or null if no tag
|
||||
* was specified. */
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/** The notifying app's calling uid. @hide */
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
/** The notifying app's base package. @hide */
|
||||
public String getBasePkg() {
|
||||
return basePkg;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getInitialPid() {
|
||||
return initialPid;
|
||||
}
|
||||
|
||||
/** The {@link android.app.Notification} supplied to
|
||||
* {@link android.app.NotificationManager#notify}. */
|
||||
public Notification getNotification() {
|
||||
return notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link android.os.UserHandle} for whom this notification is intended.
|
||||
* @hide
|
||||
*/
|
||||
public UserHandle getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
/** The time (in {@link System#currentTimeMillis} time) the notification was posted,
|
||||
* which may be different than {@link android.app.Notification#when}.
|
||||
*/
|
||||
public long getPostTime() {
|
||||
return postTime;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
packages/SystemUI/ic_sysbar_internal.psd
Normal file
BIN
packages/SystemUI/ic_sysbar_internal.psd
Normal file
Binary file not shown.
@@ -315,9 +315,9 @@ 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.pkg;
|
||||
final String _tag = n.tag;
|
||||
final int _id = n.id;
|
||||
final String _pkg = n.getPkg();
|
||||
final String _tag = n.getTag();
|
||||
final int _id = n.getId();
|
||||
vetoButton.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
// Accessibility feedback
|
||||
@@ -341,14 +341,14 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
|
||||
|
||||
protected void applyLegacyRowBackground(StatusBarNotification sbn, View content) {
|
||||
if (sbn.notification.contentView.getLayoutId() !=
|
||||
if (sbn.getNotification().contentView.getLayoutId() !=
|
||||
com.android.internal.R.layout.notification_template_base) {
|
||||
int version = 0;
|
||||
try {
|
||||
ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.pkg, 0);
|
||||
ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(sbn.getPkg(), 0);
|
||||
version = info.targetSdkVersion;
|
||||
} catch (NameNotFoundException ex) {
|
||||
Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.pkg, ex);
|
||||
Slog.e(TAG, "Failed looking up ApplicationInfo for " + sbn.getPkg(), ex);
|
||||
}
|
||||
if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
|
||||
content.setBackgroundResource(R.drawable.notification_row_legacy_bg);
|
||||
@@ -729,8 +729,8 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
int maxHeight =
|
||||
mContext.getResources().getDimensionPixelSize(R.dimen.notification_max_height);
|
||||
StatusBarNotification sbn = entry.notification;
|
||||
RemoteViews oneU = sbn.notification.contentView;
|
||||
RemoteViews large = sbn.notification.bigContentView;
|
||||
RemoteViews oneU = sbn.getNotification().contentView;
|
||||
RemoteViews large = sbn.getNotification().bigContentView;
|
||||
if (oneU == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -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.pkg);
|
||||
row.setTag(sbn.getPkg());
|
||||
|
||||
workAroundBadLayerDrawableOpacity(row);
|
||||
View vetoButton = updateNotificationVetoButton(row, sbn);
|
||||
@@ -756,10 +756,10 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
|
||||
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
|
||||
|
||||
PendingIntent contentIntent = sbn.notification.contentIntent;
|
||||
PendingIntent contentIntent = sbn.getNotification().contentIntent;
|
||||
if (contentIntent != null) {
|
||||
final View.OnClickListener listener = new NotificationClicker(contentIntent,
|
||||
sbn.pkg, sbn.tag, sbn.id);
|
||||
sbn.getPkg(), 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.pkg + "/0x" + Integer.toHexString(sbn.id);
|
||||
final String ident = sbn.getPkg() + "/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.pkg, n.tag, n.id, n.uid, n.initialPid, message);
|
||||
mBarService.onNotificationError(n.getPkg(), n.getTag(), n.getId(), n.getUid(), n.getInitialPid(), message);
|
||||
} catch (RemoteException ex) {
|
||||
// The end is nigh.
|
||||
}
|
||||
@@ -932,16 +932,16 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
}
|
||||
// Construct the icon.
|
||||
final StatusBarIconView iconView = new StatusBarIconView(mContext,
|
||||
notification.pkg + "/0x" + Integer.toHexString(notification.id),
|
||||
notification.notification);
|
||||
notification.getPkg() + "/0x" + Integer.toHexString(notification.getId()),
|
||||
notification.getNotification());
|
||||
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
|
||||
final StatusBarIcon ic = new StatusBarIcon(notification.pkg,
|
||||
notification.user,
|
||||
notification.notification.icon,
|
||||
notification.notification.iconLevel,
|
||||
notification.notification.number,
|
||||
notification.notification.tickerText);
|
||||
final StatusBarIcon ic = new StatusBarIcon(notification.getPkg(),
|
||||
notification.getUser(),
|
||||
notification.getNotification().icon,
|
||||
notification.getNotification().iconLevel,
|
||||
notification.getNotification().number,
|
||||
notification.getNotification().tickerText);
|
||||
if (!iconView.set(ic)) {
|
||||
handleNotificationError(key, notification, "Couldn't create icon: " + ic);
|
||||
return null;
|
||||
@@ -1026,19 +1026,19 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
final StatusBarNotification oldNotification = oldEntry.notification;
|
||||
|
||||
// XXX: modify when we do something more intelligent with the two content views
|
||||
final RemoteViews oldContentView = oldNotification.notification.contentView;
|
||||
final RemoteViews contentView = notification.notification.contentView;
|
||||
final RemoteViews oldBigContentView = oldNotification.notification.bigContentView;
|
||||
final RemoteViews bigContentView = notification.notification.bigContentView;
|
||||
final RemoteViews oldContentView = oldNotification.getNotification().contentView;
|
||||
final RemoteViews contentView = notification.getNotification().contentView;
|
||||
final RemoteViews oldBigContentView = oldNotification.getNotification().bigContentView;
|
||||
final RemoteViews bigContentView = notification.getNotification().bigContentView;
|
||||
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "old notification: when=" + oldNotification.notification.when
|
||||
Slog.d(TAG, "old notification: when=" + oldNotification.getNotification().when
|
||||
+ " ongoing=" + oldNotification.isOngoing()
|
||||
+ " expanded=" + oldEntry.expanded
|
||||
+ " contentView=" + oldContentView
|
||||
+ " bigContentView=" + oldBigContentView
|
||||
+ " rowParent=" + oldEntry.row.getParent());
|
||||
Slog.d(TAG, "new notification: when=" + notification.notification.when
|
||||
Slog.d(TAG, "new notification: when=" + notification.getNotification().when
|
||||
+ " ongoing=" + oldNotification.isOngoing()
|
||||
+ " contentView=" + contentView
|
||||
+ " bigContentView=" + bigContentView);
|
||||
@@ -1062,13 +1062,13 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
&& oldBigContentView.getPackage().equals(bigContentView.getPackage())
|
||||
&& oldBigContentView.getLayoutId() == bigContentView.getLayoutId());
|
||||
ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent();
|
||||
boolean orderUnchanged = notification.notification.when==oldNotification.notification.when
|
||||
&& notification.score == oldNotification.score;
|
||||
boolean orderUnchanged = notification.getNotification().when== oldNotification.getNotification().when
|
||||
&& notification.getScore() == oldNotification.getScore();
|
||||
// score now encompasses/supersedes isOngoing()
|
||||
|
||||
boolean updateTicker = notification.notification.tickerText != null
|
||||
&& !TextUtils.equals(notification.notification.tickerText,
|
||||
oldEntry.notification.notification.tickerText);
|
||||
boolean updateTicker = notification.getNotification().tickerText != null
|
||||
&& !TextUtils.equals(notification.getNotification().tickerText,
|
||||
oldEntry.notification.getNotification().tickerText);
|
||||
boolean isTopAnyway = isTopNotification(rowParent, oldEntry);
|
||||
if (contentsUnchanged && bigContentsUnchanged && (orderUnchanged || isTopAnyway)) {
|
||||
if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key);
|
||||
@@ -1080,20 +1080,20 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
bigContentView.reapply(mContext, oldEntry.getLargeView(), mOnClickHandler);
|
||||
}
|
||||
// update the contentIntent
|
||||
final PendingIntent contentIntent = notification.notification.contentIntent;
|
||||
final PendingIntent contentIntent = notification.getNotification().contentIntent;
|
||||
if (contentIntent != null) {
|
||||
final View.OnClickListener listener = makeClicker(contentIntent,
|
||||
notification.pkg, notification.tag, notification.id);
|
||||
notification.getPkg(), notification.getTag(), notification.getId());
|
||||
oldEntry.content.setOnClickListener(listener);
|
||||
} else {
|
||||
oldEntry.content.setOnClickListener(null);
|
||||
}
|
||||
// Update the icon.
|
||||
final StatusBarIcon ic = new StatusBarIcon(notification.pkg,
|
||||
notification.user,
|
||||
notification.notification.icon, notification.notification.iconLevel,
|
||||
notification.notification.number,
|
||||
notification.notification.tickerText);
|
||||
final StatusBarIcon ic = new StatusBarIcon(notification.getPkg(),
|
||||
notification.getUser(),
|
||||
notification.getNotification().icon, notification.getNotification().iconLevel,
|
||||
notification.getNotification().number,
|
||||
notification.getNotification().tickerText);
|
||||
if (!oldEntry.icon.set(ic)) {
|
||||
handleNotificationError(key, notification, "Couldn't update icon: " + ic);
|
||||
return;
|
||||
@@ -1144,7 +1144,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
if (DEBUG) Slog.d(TAG, "updating the current intruder:" + notification);
|
||||
// XXX: this is a hack for Alarms. The real implementation will need to *update*
|
||||
// the intruder.
|
||||
if (notification.notification.fullScreenIntent == null) { // TODO(dsandler): consistent logic with add()
|
||||
if (notification.getNotification().fullScreenIntent == null) { // TODO(dsandler): consistent logic with add()
|
||||
if (DEBUG) Slog.d(TAG, "no longer intrudes!");
|
||||
mHandler.sendEmptyMessage(MSG_HIDE_INTRUDER);
|
||||
}
|
||||
@@ -1155,9 +1155,9 @@ 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.pkg)) {
|
||||
if (sbn.notification.kind != null) {
|
||||
for (String aKind : sbn.notification.kind) {
|
||||
if ("android".equals(sbn.getPkg())) {
|
||||
if (sbn.getNotification().kind != null) {
|
||||
for (String aKind : sbn.getNotification().kind) {
|
||||
// IME switcher, created by InputMethodManagerService
|
||||
if ("android.system.imeswitcher".equals(aKind)) return true;
|
||||
// OTA availability & errors, created by SystemUpdateService
|
||||
|
||||
@@ -89,10 +89,10 @@ public class NotificationData {
|
||||
public int compare(Entry a, Entry b) {
|
||||
final StatusBarNotification na = a.notification;
|
||||
final StatusBarNotification nb = b.notification;
|
||||
int d = na.score - nb.score;
|
||||
int d = na.getScore() - nb.getScore();
|
||||
return (d != 0)
|
||||
? d
|
||||
: (int)(na.notification.when - nb.notification.when);
|
||||
: (int)(na.getNotification().when - nb.getNotification().when);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -863,7 +863,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
}
|
||||
|
||||
public void addNotification(IBinder key, StatusBarNotification notification) {
|
||||
if (DEBUG) Slog.d(TAG, "addNotification score=" + notification.score);
|
||||
if (DEBUG) Slog.d(TAG, "addNotification score=" + notification.getScore());
|
||||
StatusBarIconView iconView = addNotificationViews(key, notification);
|
||||
if (iconView == null) return;
|
||||
|
||||
@@ -912,7 +912,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
} else
|
||||
*/
|
||||
|
||||
if (notification.notification.fullScreenIntent != null) {
|
||||
if (notification.getNotification().fullScreenIntent != null) {
|
||||
// Stop screensaver if the notification has a full-screen intent.
|
||||
// (like an incoming phone call)
|
||||
awakenDreams();
|
||||
@@ -920,7 +920,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
// not immersive & a full-screen alert should be shown
|
||||
if (DEBUG) Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
|
||||
try {
|
||||
notification.notification.fullScreenIntent.send();
|
||||
notification.getNotification().fullScreenIntent.send();
|
||||
} catch (PendingIntent.CanceledException e) {
|
||||
}
|
||||
} else {
|
||||
@@ -1053,7 +1053,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
// 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 && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
|
||||
if (!((provisioned && ent.notification.getScore() >= HIDE_ICONS_BELOW_SCORE)
|
||||
|| showNotificationEvenIfUnprovisioned(ent.notification))) continue;
|
||||
if (!notificationIsForCurrentUser(ent.notification)) continue;
|
||||
toShow.add(ent.icon);
|
||||
@@ -1961,7 +1961,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
// until status bar window is attached to the window manager,
|
||||
// because... well, what's the point otherwise? And trying to
|
||||
// run a ticker without being attached will crash!
|
||||
if (n.notification.tickerText != null && mStatusBarWindow.getWindowToken() != null) {
|
||||
if (n.getNotification().tickerText != null && mStatusBarWindow.getWindowToken() != null) {
|
||||
if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
|
||||
| StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
|
||||
mTicker.addEntry(n);
|
||||
@@ -2066,9 +2066,9 @@ 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.pkg + " id=" + n.id + " score=" + n.score);
|
||||
pw.println(" notification=" + n.notification);
|
||||
pw.println(" tickerText=\"" + n.notification.tickerText + "\"");
|
||||
pw.println(" pkg=" + n.getPkg() + " id=" + n.getId() + " score=" + n.getScore());
|
||||
pw.println(" notification=" + n.getNotification());
|
||||
pw.println(" tickerText=\"" + n.getNotification().tickerText + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2369,9 +2369,9 @@ public class PhoneStatusBar extends BaseStatusBar {
|
||||
|
||||
try {
|
||||
mBarService.onNotificationClear(
|
||||
mCurrentlyIntrudingNotification.pkg,
|
||||
mCurrentlyIntrudingNotification.tag,
|
||||
mCurrentlyIntrudingNotification.id);
|
||||
mCurrentlyIntrudingNotification.getPkg(),
|
||||
mCurrentlyIntrudingNotification.getTag(),
|
||||
mCurrentlyIntrudingNotification.getId());
|
||||
} catch (android.os.RemoteException ex) {
|
||||
// oh well
|
||||
}
|
||||
|
||||
@@ -189,25 +189,25 @@ public abstract class Ticker {
|
||||
// a notification storm).
|
||||
if (initialCount > 0) {
|
||||
final Segment seg = mSegments.get(0);
|
||||
if (n.pkg.equals(seg.notification.pkg)
|
||||
&& n.notification.icon == seg.notification.notification.icon
|
||||
&& n.notification.iconLevel == seg.notification.notification.iconLevel
|
||||
&& CharSequences.equals(seg.notification.notification.tickerText,
|
||||
n.notification.tickerText)) {
|
||||
if (n.getPkg().equals(seg.notification.getPkg())
|
||||
&& n.getNotification().icon == seg.notification.getNotification().icon
|
||||
&& n.getNotification().iconLevel == seg.notification.getNotification().iconLevel
|
||||
&& CharSequences.equals(seg.notification.getNotification().tickerText,
|
||||
n.getNotification().tickerText)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final Drawable icon = StatusBarIconView.getIcon(mContext,
|
||||
new StatusBarIcon(n.pkg, n.user, n.notification.icon, n.notification.iconLevel, 0,
|
||||
n.notification.tickerText));
|
||||
final CharSequence text = n.notification.tickerText;
|
||||
new StatusBarIcon(n.getPkg(), 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.id == seg.notification.id && n.pkg.equals(seg.notification.pkg)) {
|
||||
if (n.getId() == seg.notification.getId() && n.getPkg().equals(seg.notification.getPkg())) {
|
||||
// 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.id == seg.notification.id && n.pkg.equals(seg.notification.pkg)) {
|
||||
if (n.getId() == seg.notification.getId() && n.getPkg().equals(seg.notification.getPkg())) {
|
||||
mSegments.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,12 +859,12 @@ public class TabletStatusBar extends BaseStatusBar implements
|
||||
final boolean immersive = isImmersive();
|
||||
if (false && immersive) {
|
||||
// TODO: immersive mode popups for tablet
|
||||
} else if (notification.notification.fullScreenIntent != null) {
|
||||
} else if (notification.getNotification().fullScreenIntent != null) {
|
||||
// not immersive & a full-screen alert should be shown
|
||||
Slog.w(TAG, "Notification has fullScreenIntent and activity is not immersive;"
|
||||
+ " sending fullScreenIntent");
|
||||
try {
|
||||
notification.notification.fullScreenIntent.send();
|
||||
notification.getNotification().fullScreenIntent.send();
|
||||
} catch (PendingIntent.CanceledException e) {
|
||||
}
|
||||
} else {
|
||||
@@ -971,14 +971,14 @@ public class TabletStatusBar extends BaseStatusBar implements
|
||||
}
|
||||
// If they asked for FLAG_ONLY_ALERT_ONCE, then only show this notification
|
||||
// if it's a new notification.
|
||||
if (!firstTime && (n.notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0) {
|
||||
if (!firstTime && (n.getNotification().flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0) {
|
||||
return;
|
||||
}
|
||||
// Show the ticker if one is requested. Also don't do this
|
||||
// until status bar window is attached to the window manager,
|
||||
// because... well, what's the point otherwise? And trying to
|
||||
// run a ticker without being attached will crash!
|
||||
if (hasTicker(n.notification) && mStatusBarView.getWindowToken() != null) {
|
||||
if (hasTicker(n.getNotification()) && mStatusBarView.getWindowToken() != null) {
|
||||
if (0 == (mDisabled & (StatusBarManager.DISABLE_NOTIFICATION_ICONS
|
||||
| StatusBarManager.DISABLE_NOTIFICATION_TICKER))) {
|
||||
mTicker.add(key, n);
|
||||
@@ -1410,7 +1410,7 @@ public class TabletStatusBar extends BaseStatusBar implements
|
||||
for (int i=0; toShow.size()< maxNotificationIconsCount; i++) {
|
||||
if (i >= N) break;
|
||||
Entry ent = mNotificationData.get(N-i-1);
|
||||
if ((provisioned && ent.notification.score >= HIDE_ICONS_BELOW_SCORE)
|
||||
if ((provisioned && ent.notification.getScore() >= HIDE_ICONS_BELOW_SCORE)
|
||||
|| showNotificationEvenIfUnprovisioned(ent.notification)) {
|
||||
toShow.add(ent.icon);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ public class TabletTicker
|
||||
}
|
||||
|
||||
private View makeTickerView(StatusBarNotification notification) {
|
||||
final Notification n = notification.notification;
|
||||
final Notification n = notification.getNotification();
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
@@ -274,8 +274,8 @@ public class TabletTicker
|
||||
exception = e;
|
||||
}
|
||||
if (expanded == null) {
|
||||
final String ident = notification.pkg
|
||||
+ "/0x" + Integer.toHexString(notification.id);
|
||||
final String ident = notification.getPkg()
|
||||
+ "/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.pkg, notification.user, n.icon, n.iconLevel, 0,
|
||||
new StatusBarIcon(notification.getPkg(), notification.getUser(), n.icon, n.iconLevel, 0,
|
||||
n.tickerText));
|
||||
ImageView iv = (ImageView)group.findViewById(iconId);
|
||||
iv.setImageDrawable(icon);
|
||||
@@ -313,12 +313,12 @@ public class TabletTicker
|
||||
}
|
||||
|
||||
if (CLICKABLE_TICKER) {
|
||||
PendingIntent contentIntent = notification.notification.contentIntent;
|
||||
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.pkg, notification.tag, notification.id);
|
||||
notification.getPkg(), notification.getTag(), notification.getId());
|
||||
group.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
halt();
|
||||
|
||||
@@ -49,7 +49,6 @@ import android.media.IAudioService;
|
||||
import android.media.IRingtonePlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
@@ -285,7 +284,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
|
||||
public void record(StatusBarNotification nr) {
|
||||
// Nuke heavy parts of notification before storing in archive
|
||||
nr.notification.lightenPayload();
|
||||
nr.getNotification().lightenPayload();
|
||||
|
||||
if (mBuffer.size() == BUFFER_SIZE) {
|
||||
mBuffer.removeFirst();
|
||||
@@ -312,7 +311,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
private StatusBarNotification findNext() {
|
||||
while (iter.hasNext()) {
|
||||
StatusBarNotification nr = iter.next();
|
||||
if ((pkg == null || nr.pkg == pkg)
|
||||
if ((pkg == null || nr.getPkg() == pkg)
|
||||
&& (userId == UserHandle.USER_ALL || nr.getUserId() == userId)) {
|
||||
return nr;
|
||||
}
|
||||
@@ -786,7 +785,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
*
|
||||
* @param token The binder for the listener, to check that the caller is allowed
|
||||
*/
|
||||
public void clearAllNotificationsFromListener(INotificationListener token) {
|
||||
public void cancelAllNotificationsFromListener(INotificationListener token) {
|
||||
NotificationListenerInfo info = checkListenerToken(token);
|
||||
long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -803,7 +802,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
*
|
||||
* @param token The binder for the listener, to check that the caller is allowed
|
||||
*/
|
||||
public void clearNotificationFromListener(INotificationListener token, String pkg, String tag, int id) {
|
||||
public void cancelNotificationFromListener(INotificationListener token, String pkg, String tag, int id) {
|
||||
NotificationListenerInfo info = checkListenerToken(token);
|
||||
long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
@@ -852,17 +851,17 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
this.sbn = sbn;
|
||||
}
|
||||
|
||||
public Notification getNotification() { return sbn.notification; }
|
||||
public int getFlags() { return sbn.notification.flags; }
|
||||
public Notification getNotification() { return sbn.getNotification(); }
|
||||
public int getFlags() { return sbn.getNotification().flags; }
|
||||
public int getUserId() { return sbn.getUserId(); }
|
||||
|
||||
void dump(PrintWriter pw, String prefix, Context baseContext) {
|
||||
final Notification notification = sbn.notification;
|
||||
final Notification notification = sbn.getNotification();
|
||||
pw.println(prefix + this);
|
||||
pw.println(prefix + " uid=" + sbn.uid + " userId=" + sbn.getUserId());
|
||||
pw.println(prefix + " uid=" + sbn.getUid() + " userId=" + sbn.getUserId());
|
||||
pw.println(prefix + " icon=0x" + Integer.toHexString(notification.icon)
|
||||
+ " / " + idDebugString(baseContext, sbn.pkg, notification.icon));
|
||||
pw.println(prefix + " pri=" + notification.priority + " score=" + sbn.score);
|
||||
+ " / " + idDebugString(baseContext, sbn.getPkg(), notification.icon));
|
||||
pw.println(prefix + " pri=" + notification.priority + " score=" + sbn.getScore());
|
||||
pw.println(prefix + " contentIntent=" + notification.contentIntent);
|
||||
pw.println(prefix + " deleteIntent=" + notification.deleteIntent);
|
||||
pw.println(prefix + " tickerText=" + notification.tickerText);
|
||||
@@ -921,8 +920,8 @@ 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.pkg, this.sbn.user, this.sbn.id, this.sbn.tag,
|
||||
this.sbn.score, this.sbn.notification);
|
||||
this.sbn.getPkg(), this.sbn.getUser(), this.sbn.getId(), this.sbn.getTag(),
|
||||
this.sbn.getScore(), this.sbn.getNotification());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1541,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.pkg.equals(pkg) && r.sbn.getUserId() == userId) {
|
||||
if (r.sbn.getPkg().equals(pkg) && r.sbn.getUserId() == userId) {
|
||||
count++;
|
||||
if (count >= MAX_PACKAGE_NOTIFICATIONS) {
|
||||
Slog.e(TAG, "Package has already posted " + count
|
||||
@@ -1658,7 +1657,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
r.statusBarKey = mStatusBar.addNotification(n);
|
||||
if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0
|
||||
if ((n.getNotification().flags & Notification.FLAG_SHOW_LIGHTS) != 0
|
||||
&& canInterrupt) {
|
||||
mAttentionLight.pulse();
|
||||
}
|
||||
@@ -1774,7 +1773,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
// does not have the VIBRATE permission.
|
||||
long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mVibrator.vibrate(r.sbn.uid, r.sbn.basePkg,
|
||||
mVibrator.vibrate(r.sbn.getUid(), r.sbn.getBasePkg(),
|
||||
useDefaultVibrate ? mDefaultVibrationPattern
|
||||
: mFallbackVibrationPattern,
|
||||
((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
|
||||
@@ -1783,7 +1782,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
}
|
||||
} else if (notification.vibrate.length > 1) {
|
||||
// If you want your own vibration pattern, you need the VIBRATE permission
|
||||
mVibrator.vibrate(r.sbn.uid, r.sbn.basePkg, notification.vibrate,
|
||||
mVibrator.vibrate(r.sbn.getUid(), r.sbn.getBasePkg(), notification.vibrate,
|
||||
((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
|
||||
}
|
||||
}
|
||||
@@ -1840,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.pkg, ex);
|
||||
Slog.w(TAG, "canceled PendingIntent for " + r.sbn.getPkg(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1965,7 +1964,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
if ((r.getFlags() & mustNotHaveFlags) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (pkg != null && !r.sbn.pkg.equals(pkg)) {
|
||||
if (pkg != null && !r.sbn.getPkg().equals(pkg)) {
|
||||
continue;
|
||||
}
|
||||
canceledSomething = true;
|
||||
@@ -2065,7 +2064,7 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
if (mLedNotification == null || mInCall || mScreenOn) {
|
||||
mNotificationLight.turnOff();
|
||||
} else {
|
||||
final Notification ledno = mLedNotification.sbn.notification;
|
||||
final Notification ledno = mLedNotification.sbn.getNotification();
|
||||
int ledARGB = ledno.ledARGB;
|
||||
int ledOnMS = ledno.ledOnMS;
|
||||
int ledOffMS = ledno.ledOffMS;
|
||||
@@ -2089,19 +2088,19 @@ public class NotificationManagerService extends INotificationManager.Stub
|
||||
final int len = list.size();
|
||||
for (int i=0; i<len; i++) {
|
||||
NotificationRecord r = list.get(i);
|
||||
if (!notificationMatchesUserId(r, userId) || r.sbn.id != id) {
|
||||
if (!notificationMatchesUserId(r, userId) || r.sbn.getId() != id) {
|
||||
continue;
|
||||
}
|
||||
if (tag == null) {
|
||||
if (r.sbn.tag != null) {
|
||||
if (r.sbn.getTag() != null) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (!tag.equals(r.sbn.tag)) {
|
||||
if (!tag.equals(r.sbn.getTag())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (r.sbn.pkg.equals(pkg)) {
|
||||
if (r.sbn.getPkg().equals(pkg)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user