Merge "Fixing a memory leak with notifications" into pi-dev

This commit is contained in:
android-build-team Robot
2018-05-04 23:44:27 +00:00
committed by Android (Google) Code Review

View File

@@ -227,7 +227,9 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
if (mUiOffloadThread == null) {
mUiOffloadThread = Dependency.get(UiOffloadThread.class);
}
mUiOffloadThread.submit(() -> pendingIntent.registerCancelListener(listener));
if (view.isAttachedToWindow()) {
mUiOffloadThread.submit(() -> pendingIntent.registerCancelListener(listener));
}
view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {