diff options
| author | 2016-05-20 14:53:16 -0400 | |
|---|---|---|
| committer | 2016-05-20 14:53:16 -0400 | |
| commit | cf548bfad62b06fd9ad1cf2f1a67bd57a8471c28 (patch) | |
| tree | 63f0d2ed797dfb3cba4f18931ffb7bb2b65a9ff6 | |
| parent | 5a68af384037f2980215dd45b91c5165c779d4e8 (diff) | |
Don't throw RemoteException from new NLS APIs
Bug: 28820058
Change-Id: If4a290ab7549aa999cee348bf0db85b70cb57553
| -rw-r--r-- | api/current.txt | 4 | ||||
| -rw-r--r-- | api/system-current.txt | 4 | ||||
| -rw-r--r-- | api/test-current.txt | 4 | ||||
| -rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 21 |
4 files changed, 20 insertions, 13 deletions
diff --git a/api/current.txt b/api/current.txt index c13c435bc30c..b85c12e23c41 100644 --- a/api/current.txt +++ b/api/current.txt @@ -34619,8 +34619,8 @@ package android.service.notification { method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap); method public final void requestInterruptionFilter(int); method public final void requestListenerHints(int); - method public static void requestRebind(android.content.ComponentName) throws android.os.RemoteException; - method public final void requestUnbind() throws android.os.RemoteException; + method public static void requestRebind(android.content.ComponentName); + method public final void requestUnbind(); method public final void setNotificationsShown(java.lang.String[]); field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4 field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1 diff --git a/api/system-current.txt b/api/system-current.txt index 61cd00a702be..42f6d857fb04 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -37341,8 +37341,8 @@ package android.service.notification { method public void registerAsSystemService(android.content.Context, android.content.ComponentName, int) throws android.os.RemoteException; method public final void requestInterruptionFilter(int); method public final void requestListenerHints(int); - method public static void requestRebind(android.content.ComponentName) throws android.os.RemoteException; - method public final void requestUnbind() throws android.os.RemoteException; + method public static void requestRebind(android.content.ComponentName); + method public final void requestUnbind(); method public final void setNotificationsShown(java.lang.String[]); method public final void setOnNotificationPostedTrim(int); method public void unregisterAsSystemService() throws android.os.RemoteException; diff --git a/api/test-current.txt b/api/test-current.txt index 9165cb0018bb..e0ad0e83ec71 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -34695,8 +34695,8 @@ package android.service.notification { method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap); method public final void requestInterruptionFilter(int); method public final void requestListenerHints(int); - method public static void requestRebind(android.content.ComponentName) throws android.os.RemoteException; - method public final void requestUnbind() throws android.os.RemoteException; + method public static void requestRebind(android.content.ComponentName); + method public final void requestUnbind(); method public final void setNotificationsShown(java.lang.String[]); field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4 field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1 diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 25fe4ffaa471..1557a2718b55 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -790,11 +790,14 @@ public abstract class NotificationListenerService extends Service { * <p>This method will fail for listeners that have * not been granted the permission by the user. */ - public static void requestRebind(ComponentName componentName) - throws RemoteException { + public static void requestRebind(ComponentName componentName) { INotificationManager noMan = INotificationManager.Stub.asInterface( ServiceManager.getService(Context.NOTIFICATION_SERVICE)); - noMan.requestBindListener(componentName); + try { + noMan.requestBindListener(componentName); + } catch (RemoteException ex) { + throw ex.rethrowFromSystemServer(); + } } /** @@ -807,12 +810,16 @@ public abstract class NotificationListenerService extends Service { * <p>The service should wait for the {@link #onListenerConnected()} event * before performing this operation. I know it's tempting, but you must wait. */ - public final void requestUnbind() throws RemoteException { + public final void requestUnbind() { if (mWrapper != null) { INotificationManager noMan = getNotificationInterface(); - noMan.requestUnbindListener(mWrapper); - // Disable future messages. - isConnected = false; + try { + noMan.requestUnbindListener(mWrapper); + // Disable future messages. + isConnected = false; + } catch (RemoteException ex) { + throw ex.rethrowFromSystemServer(); + } } } |