Listen for the current user's notifications only.
Bug: 8328357 Change-Id: I4fe21ed5c49a1eafee7ede1d4e5e9cb8f34d5120
This commit is contained in:
@@ -52,8 +52,10 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
private static final String TAG = NotificationStation.class.getSimpleName();
|
private static final String TAG = NotificationStation.class.getSimpleName();
|
||||||
static final boolean DEBUG = true;
|
static final boolean DEBUG = true;
|
||||||
private static final String PACKAGE_SCHEME = "package";
|
private static final String PACKAGE_SCHEME = "package";
|
||||||
|
private static final boolean SHOW_HISTORICAL_NOTIFICATIONS = true;
|
||||||
|
|
||||||
private final PackageReceiver mPackageReceiver = new PackageReceiver();
|
private final PackageReceiver mPackageReceiver = new PackageReceiver();
|
||||||
|
|
||||||
private INotificationManager mNoMan;
|
private INotificationManager mNoMan;
|
||||||
private INotificationListener.Stub mListener = new INotificationListener.Stub() {
|
private INotificationListener.Stub mListener = new INotificationListener.Stub() {
|
||||||
@Override
|
@Override
|
||||||
@@ -64,7 +66,8 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNotificationRemoved(StatusBarNotification notification) throws RemoteException {
|
public void onNotificationRemoved(StatusBarNotification notification) throws RemoteException {
|
||||||
// no-op; we're just showing new notifications
|
Log.v(TAG, "onNotificationRemoved: " + notification);
|
||||||
|
getListView().post(new Runnable() { public void run() { refreshList(); }});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,7 +82,7 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
mNoMan = INotificationManager.Stub.asInterface(
|
mNoMan = INotificationManager.Stub.asInterface(
|
||||||
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
||||||
try {
|
try {
|
||||||
mNoMan.registerListener(mListener, UserHandle.USER_ALL);
|
mNoMan.registerListener(mListener, ActivityManager.getCurrentUser());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// well, that didn't work out
|
// well, that didn't work out
|
||||||
}
|
}
|
||||||
@@ -162,8 +165,11 @@ public class NotificationStation extends SettingsPreferenceFragment {
|
|||||||
private List<HistoricalNotificationInfo> loadNotifications() {
|
private List<HistoricalNotificationInfo> loadNotifications() {
|
||||||
final int currentUserId = ActivityManager.getCurrentUser();
|
final int currentUserId = ActivityManager.getCurrentUser();
|
||||||
try {
|
try {
|
||||||
StatusBarNotification[] nions = mNoMan.getHistoricalNotifications(
|
StatusBarNotification[] nions;
|
||||||
mContext.getPackageName(), 50);
|
nions = SHOW_HISTORICAL_NOTIFICATIONS
|
||||||
|
? mNoMan.getHistoricalNotifications(mContext.getPackageName(), 50)
|
||||||
|
: mNoMan.getActiveNotifications(mContext.getPackageName());
|
||||||
|
|
||||||
List<HistoricalNotificationInfo> list
|
List<HistoricalNotificationInfo> list
|
||||||
= new ArrayList<HistoricalNotificationInfo>(nions.length);
|
= new ArrayList<HistoricalNotificationInfo>(nions.length);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user