diff options
author | Yorke Lee <yorkelee@google.com> | 2015-11-10 14:26:05 -0800 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-11-10 16:39:24 -0800 |
commit | e9fc88c10940cae380d2dc6075685e60e08aa29a (patch) | |
tree | 28dbabbc8d7c6892840d9852e74d7ff2a99e0c62 | |
parent | 7754515a43ccd8246c3ff79360090e6b03acb5cf (diff) |
Fix potential ANR in CallLogNotificationsService
Lazily initialize instance of VoicemailQueryHandler,
to avoid blocking the main thread in onCreate
Bug: 25627946
Change-Id: I35efb459897251f0157accac129c0abe5f5a8df7
-rw-r--r-- | src/com/android/dialer/calllog/CallLogNotificationsService.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/com/android/dialer/calllog/CallLogNotificationsService.java b/src/com/android/dialer/calllog/CallLogNotificationsService.java index 9a67b61b6..d2a494d9a 100644 --- a/src/com/android/dialer/calllog/CallLogNotificationsService.java +++ b/src/com/android/dialer/calllog/CallLogNotificationsService.java @@ -67,12 +67,6 @@ public class CallLogNotificationsService extends IntentService { } @Override - public void onCreate() { - super.onCreate(); - mVoicemailQueryHandler = new VoicemailQueryHandler(this, getContentResolver()); - } - - @Override protected void onHandleIntent(Intent intent) { if (intent == null) { Log.d(TAG, "onHandleIntent: could not handle null intent"); @@ -84,6 +78,9 @@ public class CallLogNotificationsService extends IntentService { } if (ACTION_MARK_NEW_VOICEMAILS_AS_OLD.equals(intent.getAction())) { + if (mVoicemailQueryHandler == null) { + mVoicemailQueryHandler = new VoicemailQueryHandler(this, getContentResolver()); + } mVoicemailQueryHandler.markNewVoicemailsAsOld(); } else if (ACTION_UPDATE_NOTIFICATIONS.equals(intent.getAction())) { Uri voicemailUri = (Uri) intent.getParcelableExtra(EXTRA_NEW_VOICEMAIL_URI); |