From f0a425e86fa8c234c962718b33682ecd8367ea25 Mon Sep 17 00:00:00 2001 From: uabdullah Date: Mon, 7 May 2018 16:50:44 -0700 Subject: Always fetch status onResume and add logging for voicemail status in OldMainPeer and Always fetch the voicemail status when resuming OldMainPeerActivity. There is no reason why this should not happen. TEST=N/A Bug: 79365547 Test: N/A PiperOrigin-RevId: 195744525 Change-Id: Ie31551bfecd5056b0b3b559946e9cd2c8f6ef23f --- java/com/android/dialer/database/CallLogQueryHandler.java | 5 +++++ .../com/android/dialer/main/impl/OldMainActivityPeer.java | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'java') diff --git a/java/com/android/dialer/database/CallLogQueryHandler.java b/java/com/android/dialer/database/CallLogQueryHandler.java index e974cc48f..a18023c4b 100644 --- a/java/com/android/dialer/database/CallLogQueryHandler.java +++ b/java/com/android/dialer/database/CallLogQueryHandler.java @@ -112,6 +112,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { .appendOmtpVoicemailStatusSelectionClause(context, where, selectionArgs); if (TelecomUtil.hasReadWriteVoicemailPermissions(context)) { + LogUtil.i("CallLogQueryHandler.fetchVoicemailStatus", "fetching voicemail status"); startQuery( QUERY_VOICEMAIL_STATUS_TOKEN, null, @@ -120,6 +121,10 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { where.toString(), selectionArgs.toArray(new String[selectionArgs.size()]), null); + } else { + LogUtil.i( + "CallLogQueryHandler.fetchVoicemailStatus", + "fetching voicemail status failed due to permissions"); } } diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index 2f54b1051..e426ed215 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -460,6 +460,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @SuppressLint("MissingPermission") @Override public void onActivityResume() { + LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onActivityResume"); callLogFragmentListener.onActivityResume(); // Start the thread that updates the smart dial database if the activity is recreated with a // language change. @@ -866,6 +867,10 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen new ContentObserver(new Handler()) { @Override public void onChange(boolean selfChange) { + LogUtil.i( + "MainCallLogFragmentListener", + "voicemailStatusObserver.onChange selfChange:%b", + selfChange); super.onChange(selfChange); callLogQueryHandler.fetchVoicemailStatus(); } @@ -885,9 +890,10 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen } private void registerVoicemailStatusContentObserver(Context context) { - + LogUtil.enterBlock("MainCallLogFragmentListener.registerVoicemailStatusContentObserver"); if (PermissionsUtil.hasReadVoicemailPermissions(context) && PermissionsUtil.hasAddVoicemailPermissions(context)) { + LogUtil.i("MainCallLogFragmentListener.registerVoicemailStatusContentObserver", "register"); context .getContentResolver() .registerContentObserver( @@ -1013,11 +1019,12 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen } public void onActivityResume() { + LogUtil.enterBlock("MainCallLogFragmentListener.onActivityResume"); activityIsAlive = true; registerVoicemailStatusContentObserver(context); - if (!bottomNavTabListener.newVoicemailFragmentActive()) { - callLogQueryHandler.fetchVoicemailStatus(); - } + // TODO(a bug): Don't use callLogQueryHandler + callLogQueryHandler.fetchVoicemailStatus(); + if (!bottomNavTabListener.newCallLogFragmentActive()) { callLogQueryHandler.fetchMissedCallsUnreadCount(); } -- cgit v1.2.3