Remove callbacks and messages in onDestroy().

The Runnable is running after destroying the Cursor, which only happens in onDestroy(). So clean up before that happens.

Bug: 151283186
Test: Built, installed, and set ringtone.
Change-Id: I95c824675e6e710a1dc5d1f8faef2daff6f563e6
Merged-In: I95c824675e6e710a1dc5d1f8faef2daff6f563e6
(cherry picked from commit 2e23b5c013)
This commit is contained in:
Matthew Mintz
2020-07-21 15:42:14 +08:00
parent 269b829684
commit c8eee94e1b

View File

@@ -333,6 +333,9 @@ public final class RingtonePickerActivity extends AlertActivity implements
@Override
public void onDestroy() {
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
}
if (mCursor != null) {
mCursor.close();
mCursor = null;