Handle errors inflating notifications (and their icons).

On an inflation error, the StatusBarService cleans up, removes / doesn't add
the views, and calls into the StatusBarManagerService, which tells the
NotificationManagerService to remove the notification.

That then calls all the way back into the StatusBarService, but I think being
extra careful is okay.  Throughout the status bar, it's all keyed off of the
IBinder key, so if the app comes in with a good notification while we're
cleaning up, we won't lose the new notification or anything like that.

Change-Id: Iea78a637495a8b67810c214b951d5ddb93becacb
This commit is contained in:
Joe Onorato
2010-06-04 16:08:02 -04:00
parent d956ae8b81
commit 005847b03b
6 changed files with 113 additions and 56 deletions

View File

@@ -87,6 +87,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
void onClearAll();
void onNotificationClick(String pkg, String tag, int id);
void onPanelRevealed();
void onNotificationError(String pkg, String tag, int id, String message);
}
/**
@@ -279,6 +280,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub
mNotificationCallbacks.onNotificationClick(pkg, tag, id);
}
public void onNotificationError(String pkg, String tag, int id, String message) {
Slog.d(TAG, "onNotificationError message=" + message);
// WARNING: this will call back into us to do the remove. Don't hold any locks.
mNotificationCallbacks.onNotificationError(pkg, tag, id, message);
}
public void onClearAllNotifications() {
mNotificationCallbacks.onClearAll();
}