diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-08-30 14:39:15 -0700 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2013-08-30 14:39:15 -0700 |
commit | 9b90e88defb095391e3c5c517565f1ede211aebf (patch) | |
tree | 3ab1745c8bb2ef78206ad8f27915947f354d3685 | |
parent | ced3c18be61394a658a05d80b54a3853430572a8 (diff) |
Clean up listeners when view is destroyed.
When the answer screen is shown and destroyed with a back button and then
re-shown via notifications, a new AnswerPresenter is created. But the old
presenter has not been removed as a listener.
Bug: 10566547
Change-Id: I68c621fee81017fa5d0e3e9dde56fabedc3b1d8d
-rw-r--r-- | InCallUI/src/com/android/incallui/AnswerPresenter.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 76a7b563e..40b2a3684 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -46,6 +46,18 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> } @Override + public void onUiUnready(AnswerUi ui) { + super.onUiUnready(ui); + CallList.getInstance().removeListener(this); + + // This is necessary because the activity can be destroyed while an incoming call exists. + // This happens when back button is pressed while incoming call is still being shown. + if (mCallId != Call.INVALID_CALL_ID) { + CallList.getInstance().removeCallUpdateListener(mCallId, this); + } + } + + @Override public void onCallListChange(CallList callList) { // no-op } |