diff options
| author | Griff Hazen <griff@google.com> | 2014-06-18 03:18:24 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-18 03:18:24 +0000 |
| commit | a2d30107c401f66dacec3853bc9efdbaca7558e8 (patch) | |
| tree | e6fce4fe2ec8f0e181c49f69052da17d6ce913ef /core/java | |
| parent | d664830ce43c7eb6be6b4d11f9740542172cabec (diff) | |
| parent | f546eeb1ede3c33ca3ec7fff6b8deb9d4e5cbc3e (diff) | |
| download | frameworks_base-a2d30107c401f66dacec3853bc9efdbaca7558e8.zip frameworks_base-a2d30107c401f66dacec3853bc9efdbaca7558e8.tar.gz frameworks_base-a2d30107c401f66dacec3853bc9efdbaca7558e8.tar.bz2 | |
am f546eeb1: Merge "DO NOT MERGE Reduce chance of notification listener dropped messages." into klp-modular-dev
* commit 'f546eeb1ede3c33ca3ec7fff6b8deb9d4e5cbc3e':
DO NOT MERGE Reduce chance of notification listener dropped messages.
Diffstat (limited to 'core/java')
3 files changed, 44 insertions, 4 deletions
diff --git a/core/java/android/service/notification/INotificationListener.aidl b/core/java/android/service/notification/INotificationListener.aidl index d4b29d8..57ab9b9 100644 --- a/core/java/android/service/notification/INotificationListener.aidl +++ b/core/java/android/service/notification/INotificationListener.aidl @@ -16,12 +16,13 @@ package android.service.notification; +import android.service.notification.IStatusBarNotificationHolder; import android.service.notification.StatusBarNotification; /** @hide */ oneway interface INotificationListener { void onListenerConnected(in String[] notificationKeys); - void onNotificationPosted(in StatusBarNotification notification); - void onNotificationRemoved(in StatusBarNotification notification); + void onNotificationPosted(in IStatusBarNotificationHolder notificationHolder); + void onNotificationRemoved(in IStatusBarNotificationHolder notificationHolder); }
\ No newline at end of file diff --git a/core/java/android/service/notification/IStatusBarNotificationHolder.aidl b/core/java/android/service/notification/IStatusBarNotificationHolder.aidl new file mode 100644 index 0000000..fd6b59e --- /dev/null +++ b/core/java/android/service/notification/IStatusBarNotificationHolder.aidl @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2014, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.service.notification; + +import android.service.notification.StatusBarNotification; + +/** @hide */ +interface IStatusBarNotificationHolder { + StatusBarNotification get(); +} diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index eb2de2c..98d36e0 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -22,6 +22,7 @@ import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.IBinder; +import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; @@ -213,7 +214,14 @@ public abstract class NotificationListenerService extends Service { private class INotificationListenerWrapper extends INotificationListener.Stub { @Override - public void onNotificationPosted(StatusBarNotification sbn) { + public void onNotificationPosted(IStatusBarNotificationHolder sbnHolder) { + StatusBarNotification sbn; + try { + sbn = sbnHolder.get(); + } catch (RemoteException e) { + Log.w(TAG, "onNotificationPosted: Error receiving StatusBarNotification", e); + return; + } try { NotificationListenerService.this.onNotificationPosted(sbn); } catch (Throwable t) { @@ -221,7 +229,14 @@ public abstract class NotificationListenerService extends Service { } } @Override - public void onNotificationRemoved(StatusBarNotification sbn) { + public void onNotificationRemoved(IStatusBarNotificationHolder sbnHolder) { + StatusBarNotification sbn; + try { + sbn = sbnHolder.get(); + } catch (RemoteException e) { + Log.w(TAG, "onNotificationRemoved: Error receiving StatusBarNotification", e); + return; + } try { NotificationListenerService.this.onNotificationRemoved(sbn); } catch (Throwable t) { |
