Fixing a memory leak with notifications

Test: observe code
Change-Id: I79ae5b883a743aee96f25fef2756df31cee351d8
Fixes: 79179221
This commit is contained in:
Selim Cinek
2018-05-04 13:13:09 -07:00
parent 150bafd217
commit 75f30cd323

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) {