Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,10 @@ public class NotificationEntryManager implements * WARNING: this will call back into us. Don't hold any locks. */ @Override public void handleInflationException(NotificationEntry n, Exception e) { handleInflationException(n.getSbn(), e); } public void handleInflationException(StatusBarNotification n, Exception e) { removeNotificationInternal( n.getKey(), null, null, true /* forceRemove */, false /* removedByUser */, Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifInflaterImpl.java +7 −4 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ import javax.inject.Singleton; /** * Handles notification inflating, rebinding, and inflation aborting. * * Currently a wrapper for NotificationRowBinderImpl which requires some TLC. * Currently a wrapper for NotificationRowBinderImpl. */ @Singleton public class NotifInflaterImpl implements NotifInflater { Loading @@ -58,7 +58,7 @@ public class NotifInflaterImpl implements NotifInflater { */ public void setRowBinder(NotificationRowBinderImpl rowBinder) { mNotificationRowBinder = rowBinder; requireBinder().setInflationCallback(mInflationCallback); mNotificationRowBinder.setInflationCallback(mInflationCallback); } @Override Loading @@ -78,9 +78,10 @@ public class NotifInflaterImpl implements NotifInflater { @Override public void inflateViews(NotificationEntry entry) { try { entry.setHasInflationError(false); requireBinder().inflateViews(entry, getDismissCallback(entry)); } catch (InflationException e) { // logged in the inflation callback // logged in mInflationCallback.handleInflationException } } Loading Loading @@ -126,9 +127,11 @@ public class NotifInflaterImpl implements NotifInflater { new NotificationContentInflater.InflationCallback() { @Override public void handleInflationException( StatusBarNotification sbn, NotificationEntry entry, Exception e) { entry.setHasInflationError(true); try { final StatusBarNotification sbn = entry.getSbn(); // report notification inflation errors back up // to notification delegates mStatusBarService.onNotificationError( Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +15 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,9 @@ public final class NotificationEntry extends ListEntry { /** If this was a group child that was promoted to the top level, then who did the promoting. */ @Nullable NotifPromoter mNotifPromoter; /** If this notification had an issue with inflating. Only used with the NewNotifPipeline **/ private boolean mHasInflationError; /* * Old members Loading Loading @@ -576,6 +579,18 @@ public final class NotificationEntry extends ListEntry { remoteInputTextWhenReset = null; } void setHasInflationError(boolean hasError) { mHasInflationError = hasError; } /** * Whether this notification had an error when attempting to inflate. This is only used in * the NewNotifPipeline */ public boolean hasInflationError() { return mHasInflationError; } public void setHasSentReply() { hasSentReply = true; } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinator.java +22 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ public class PreparationCoordinator implements Coordinator { @Override public void attach(NotifCollection notifCollection, NotifListBuilder notifListBuilder) { notifCollection.addCollectionListener(mNotifCollectionListener); notifListBuilder.addPreRenderFilter(mNotifFilter); notifListBuilder.addPreRenderFilter(mNotifInflationErrorFilter); notifListBuilder.addPreRenderFilter(mNotifInflatingFilter); } private final NotifCollectionListener mNotifCollectionListener = new NotifCollectionListener() { Loading @@ -77,7 +78,25 @@ public class PreparationCoordinator implements Coordinator { } }; private final NotifFilter mNotifFilter = new NotifFilter(TAG) { private final NotifFilter mNotifInflationErrorFilter = new NotifFilter( TAG + "InflationError") { /** * Filters out notifications that threw an error when attempting to inflate. */ @Override public boolean shouldFilterOut(NotificationEntry entry, long now) { if (entry.hasInflationError()) { mPendingNotifications.remove(entry); return true; } return false; } }; private final NotifFilter mNotifInflatingFilter = new NotifFilter(TAG + "Inflating") { /** * Filters out notifications that haven't been inflated yet */ @Override public boolean shouldFilterOut(NotificationEntry entry, long now) { return mPendingNotifications.contains(entry); Loading @@ -90,7 +109,7 @@ public class PreparationCoordinator implements Coordinator { public void onInflationFinished(NotificationEntry entry) { mNotifLog.log(NotifEvent.INFLATED, entry); mPendingNotifications.remove(entry); mNotifFilter.invalidateList(); mNotifInflatingFilter.invalidateList(); } }; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +5 −5 Original line number Diff line number Diff line Loading @@ -397,7 +397,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder existingWrapper.onReinflated(); } } catch (Exception e) { handleInflationError(runningInflations, e, row.getEntry().getSbn(), callback); handleInflationError(runningInflations, e, row.getEntry(), callback); // Add a running inflation to make sure we don't trigger callbacks. // Safe to do because only happens in tests. runningInflations.put(inflationId, new CancellationSignal()); Loading Loading @@ -448,7 +448,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder onViewApplied(newView); } catch (Exception anotherException) { runningInflations.remove(inflationId); handleInflationError(runningInflations, e, row.getEntry().getSbn(), handleInflationError(runningInflations, e, row.getEntry(), callback); } } Loading @@ -474,7 +474,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder private static void handleInflationError( HashMap<Integer, CancellationSignal> runningInflations, Exception e, StatusBarNotification notification, @Nullable InflationCallback callback) { NotificationEntry notification, @Nullable InflationCallback callback) { Assert.isMainThread(); runningInflations.values().forEach(CancellationSignal::cancel); if (callback != null) { Loading Loading @@ -707,7 +707,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder + Integer.toHexString(sbn.getId()); Log.e(StatusBar.TAG, "couldn't inflate view for notification " + ident, e); if (mCallback != null) { mCallback.handleInflationException(sbn, mCallback.handleInflationException(mRow.getEntry(), new InflationException("Couldn't inflate contentViews" + e)); } } Loading @@ -729,7 +729,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder } @Override public void handleInflationException(StatusBarNotification notification, Exception e) { public void handleInflationException(NotificationEntry entry, Exception e) { handleError(e); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,10 @@ public class NotificationEntryManager implements * WARNING: this will call back into us. Don't hold any locks. */ @Override public void handleInflationException(NotificationEntry n, Exception e) { handleInflationException(n.getSbn(), e); } public void handleInflationException(StatusBarNotification n, Exception e) { removeNotificationInternal( n.getKey(), null, null, true /* forceRemove */, false /* removedByUser */, Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotifInflaterImpl.java +7 −4 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ import javax.inject.Singleton; /** * Handles notification inflating, rebinding, and inflation aborting. * * Currently a wrapper for NotificationRowBinderImpl which requires some TLC. * Currently a wrapper for NotificationRowBinderImpl. */ @Singleton public class NotifInflaterImpl implements NotifInflater { Loading @@ -58,7 +58,7 @@ public class NotifInflaterImpl implements NotifInflater { */ public void setRowBinder(NotificationRowBinderImpl rowBinder) { mNotificationRowBinder = rowBinder; requireBinder().setInflationCallback(mInflationCallback); mNotificationRowBinder.setInflationCallback(mInflationCallback); } @Override Loading @@ -78,9 +78,10 @@ public class NotifInflaterImpl implements NotifInflater { @Override public void inflateViews(NotificationEntry entry) { try { entry.setHasInflationError(false); requireBinder().inflateViews(entry, getDismissCallback(entry)); } catch (InflationException e) { // logged in the inflation callback // logged in mInflationCallback.handleInflationException } } Loading Loading @@ -126,9 +127,11 @@ public class NotifInflaterImpl implements NotifInflater { new NotificationContentInflater.InflationCallback() { @Override public void handleInflationException( StatusBarNotification sbn, NotificationEntry entry, Exception e) { entry.setHasInflationError(true); try { final StatusBarNotification sbn = entry.getSbn(); // report notification inflation errors back up // to notification delegates mStatusBarService.onNotificationError( Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +15 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,9 @@ public final class NotificationEntry extends ListEntry { /** If this was a group child that was promoted to the top level, then who did the promoting. */ @Nullable NotifPromoter mNotifPromoter; /** If this notification had an issue with inflating. Only used with the NewNotifPipeline **/ private boolean mHasInflationError; /* * Old members Loading Loading @@ -576,6 +579,18 @@ public final class NotificationEntry extends ListEntry { remoteInputTextWhenReset = null; } void setHasInflationError(boolean hasError) { mHasInflationError = hasError; } /** * Whether this notification had an error when attempting to inflate. This is only used in * the NewNotifPipeline */ public boolean hasInflationError() { return mHasInflationError; } public void setHasSentReply() { hasSentReply = true; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinator.java +22 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ public class PreparationCoordinator implements Coordinator { @Override public void attach(NotifCollection notifCollection, NotifListBuilder notifListBuilder) { notifCollection.addCollectionListener(mNotifCollectionListener); notifListBuilder.addPreRenderFilter(mNotifFilter); notifListBuilder.addPreRenderFilter(mNotifInflationErrorFilter); notifListBuilder.addPreRenderFilter(mNotifInflatingFilter); } private final NotifCollectionListener mNotifCollectionListener = new NotifCollectionListener() { Loading @@ -77,7 +78,25 @@ public class PreparationCoordinator implements Coordinator { } }; private final NotifFilter mNotifFilter = new NotifFilter(TAG) { private final NotifFilter mNotifInflationErrorFilter = new NotifFilter( TAG + "InflationError") { /** * Filters out notifications that threw an error when attempting to inflate. */ @Override public boolean shouldFilterOut(NotificationEntry entry, long now) { if (entry.hasInflationError()) { mPendingNotifications.remove(entry); return true; } return false; } }; private final NotifFilter mNotifInflatingFilter = new NotifFilter(TAG + "Inflating") { /** * Filters out notifications that haven't been inflated yet */ @Override public boolean shouldFilterOut(NotificationEntry entry, long now) { return mPendingNotifications.contains(entry); Loading @@ -90,7 +109,7 @@ public class PreparationCoordinator implements Coordinator { public void onInflationFinished(NotificationEntry entry) { mNotifLog.log(NotifEvent.INFLATED, entry); mPendingNotifications.remove(entry); mNotifFilter.invalidateList(); mNotifInflatingFilter.invalidateList(); } }; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java +5 −5 Original line number Diff line number Diff line Loading @@ -397,7 +397,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder existingWrapper.onReinflated(); } } catch (Exception e) { handleInflationError(runningInflations, e, row.getEntry().getSbn(), callback); handleInflationError(runningInflations, e, row.getEntry(), callback); // Add a running inflation to make sure we don't trigger callbacks. // Safe to do because only happens in tests. runningInflations.put(inflationId, new CancellationSignal()); Loading Loading @@ -448,7 +448,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder onViewApplied(newView); } catch (Exception anotherException) { runningInflations.remove(inflationId); handleInflationError(runningInflations, e, row.getEntry().getSbn(), handleInflationError(runningInflations, e, row.getEntry(), callback); } } Loading @@ -474,7 +474,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder private static void handleInflationError( HashMap<Integer, CancellationSignal> runningInflations, Exception e, StatusBarNotification notification, @Nullable InflationCallback callback) { NotificationEntry notification, @Nullable InflationCallback callback) { Assert.isMainThread(); runningInflations.values().forEach(CancellationSignal::cancel); if (callback != null) { Loading Loading @@ -707,7 +707,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder + Integer.toHexString(sbn.getId()); Log.e(StatusBar.TAG, "couldn't inflate view for notification " + ident, e); if (mCallback != null) { mCallback.handleInflationException(sbn, mCallback.handleInflationException(mRow.getEntry(), new InflationException("Couldn't inflate contentViews" + e)); } } Loading @@ -729,7 +729,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder } @Override public void handleInflationException(StatusBarNotification notification, Exception e) { public void handleInflationException(NotificationEntry entry, Exception e) { handleError(e); } Loading