From 34fcf971037f33605e8009946d3acc686819dd6d Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Thu, 18 Feb 2010 07:45:17 -0500 Subject: Don't crash the system process when apps give us a bad foreground service notification. --- services/java/com/android/server/am/ServiceRecord.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java index 89761a8860de..2f2cc32a9e0d 100644 --- a/services/java/com/android/server/am/ServiceRecord.java +++ b/services/java/com/android/server/am/ServiceRecord.java @@ -29,6 +29,7 @@ import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; +import android.util.Log; import java.io.PrintWriter; import java.util.ArrayList; @@ -267,6 +268,9 @@ class ServiceRecord extends Binder { int[] outId = new int[1]; inm.enqueueNotification(localPackageName, localForegroundId, localForegroundNoti, outId); + } catch (RuntimeException e) { + Log.w(ActivityManagerService.TAG, "Error showing notification for service", + e); } catch (RemoteException e) { } } @@ -288,6 +292,9 @@ class ServiceRecord extends Binder { } try { inm.cancelNotification(localPackageName, localForegroundId); + } catch (RuntimeException e) { + Log.w(ActivityManagerService.TAG, "Error canceling notification for" + + " service", e); } catch (RemoteException e) { } } -- cgit v1.2.3-59-g8ed1b