summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/notification/NotificationStation.java
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2014-05-14 15:29:11 -0400
committerChris Wren <cwren@android.com>2014-05-16 15:57:28 +0000
commit5001834d0360ae0f50194f4d8437cae4de4543b3 (patch)
tree37209275af20bda08ea3f60821583ee3530d235f /src/com/android/settings/notification/NotificationStation.java
parent3f7e0571d3baaa9dd2ad887067fb8d86f597f71b (diff)
downloadpackages_apps_Settings-5001834d0360ae0f50194f4d8437cae4de4543b3.zip
packages_apps_Settings-5001834d0360ae0f50194f4d8437cae4de4543b3.tar.gz
packages_apps_Settings-5001834d0360ae0f50194f4d8437cae4de4543b3.tar.bz2
Use NotificationListenerService instead of raw INotificationListener.
Bug: 14846846 Depends-On: Ic308b2f78c86393304d446c57fd677294e01717c Change-Id: If1d38d6d82466c4a69249dc7d76a9cb215c81e8f
Diffstat (limited to 'src/com/android/settings/notification/NotificationStation.java')
-rw-r--r--src/com/android/settings/notification/NotificationStation.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/com/android/settings/notification/NotificationStation.java b/src/com/android/settings/notification/NotificationStation.java
index 69a7a89..3f37f6d 100644
--- a/src/com/android/settings/notification/NotificationStation.java
+++ b/src/com/android/settings/notification/NotificationStation.java
@@ -35,8 +35,7 @@ import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.service.notification.INotificationListener;
-import android.service.notification.NotificationOrderUpdate;
+import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.view.LayoutInflater;
@@ -73,14 +72,13 @@ public class NotificationStation extends SettingsPreferenceFragment {
}
};
- private INotificationListener.Stub mListener = new INotificationListener.Stub() {
+ private NotificationListenerService mListener = new NotificationListenerService() {
@Override
- public void onListenerConnected(NotificationOrderUpdate update) throws RemoteException {
+ public void onListenerConnected(String[] notificationKeys) {
// noop
}
@Override
- public void onNotificationPosted(StatusBarNotification notification,
- NotificationOrderUpdate update) throws RemoteException {
+ public void onNotificationPosted(StatusBarNotification notification) {
Log.v(TAG, "onNotificationPosted: " + notification);
final Handler h = getListView().getHandler();
h.removeCallbacks(mRefreshListRunnable);
@@ -88,17 +86,11 @@ public class NotificationStation extends SettingsPreferenceFragment {
}
@Override
- public void onNotificationRemoved(StatusBarNotification notification,
- NotificationOrderUpdate update) throws RemoteException {
+ public void onNotificationRemoved(StatusBarNotification notification) {
final Handler h = getListView().getHandler();
h.removeCallbacks(mRefreshListRunnable);
h.postDelayed(mRefreshListRunnable, 100);
}
-
- @Override
- public void onNotificationOrderUpdate(NotificationOrderUpdate update)
- throws RemoteException {
- }
};
private NotificationHistoryAdapter mAdapter;
@@ -122,13 +114,21 @@ public class NotificationStation extends SettingsPreferenceFragment {
mNoMan = INotificationManager.Stub.asInterface(
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
try {
- mNoMan.registerListener(mListener,
- new ComponentName(mContext.getPackageName(),
- this.getClass().getCanonicalName()),
- ActivityManager.getCurrentUser());
+ mListener.registerAsSystemService(new ComponentName(mContext.getPackageName(),
+ this.getClass().getCanonicalName()), ActivityManager.getCurrentUser());
+ } catch (RemoteException e) {
+ // well, that didn't work out
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ try {
+ mListener.unregisterAsSystemService();
} catch (RemoteException e) {
// well, that didn't work out
}
+ super.onDetach();
}
@Override