summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-06-30 14:53:33 -0700
committerEric Erfanian <erfanian@google.com>2017-07-10 10:41:18 -0700
commit61de7a383e67619b1c5fab26f81aef451438c9b8 (patch)
tree695fc5d972ef225cca57031b7852f64122cfa0ab /java/com/android/dialer/app
parent69674662dbcf4b88fc4f2b290bd3ab925ae411c8 (diff)
Move voicemail notification dismissing to VisualVoicemailCallLogFragment
The original code is somehow triggering when the VVM tab is not selected. Bug: 62517716 Test: VisualVoicemailCallLogFragment is utterly untestable PiperOrigin-RevId: 160692310 Change-Id: Ia9da8e5aa7dd28f22c46d87dd25ebf6097918a9a
Diffstat (limited to 'java/com/android/dialer/app')
-rw-r--r--java/com/android/dialer/app/calllog/CallLogFragment.java27
-rw-r--r--java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java10
2 files changed, 9 insertions, 28 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java
index aa765d90e..369fbbc91 100644
--- a/java/com/android/dialer/app/calllog/CallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/CallLogFragment.java
@@ -20,7 +20,6 @@ import static android.Manifest.permission.READ_CALL_LOG;
import android.app.Activity;
import android.app.Fragment;
-import android.app.KeyguardManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -114,7 +113,6 @@ public class CallLogFragment extends Fragment
private CallLogQueryHandler mCallLogQueryHandler;
private boolean mScrollToTop;
private EmptyContentView mEmptyListView;
- private KeyguardManager mKeyguardManager;
private ContactInfoCache mContactInfoCache;
private final OnContactInfoChangedListener mOnContactInfoChangedListener =
new OnContactInfoChangedListener() {
@@ -219,7 +217,6 @@ public class CallLogFragment extends Fragment
final Activity activity = getActivity();
final ContentResolver resolver = activity.getContentResolver();
mCallLogQueryHandler = new CallLogQueryHandler(activity, resolver, this, mLogLimit);
- mKeyguardManager = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE);
if (PermissionsUtil.hasCallLogReadPermissions(getContext())) {
resolver.registerContentObserver(CallLog.CONTENT_URI, true, mCallLogObserver);
@@ -432,8 +429,6 @@ public class CallLogFragment extends Fragment
@Override
public void onStop() {
- updateOnTransition();
-
super.onStop();
mAdapter.onStop();
mContactInfoCache.stop();
@@ -516,9 +511,7 @@ public class CallLogFragment extends Fragment
super.setMenuVisibility(menuVisible);
if (mMenuVisible != menuVisible) {
mMenuVisible = menuVisible;
- if (!menuVisible) {
- updateOnTransition();
- } else if (isResumed()) {
+ if (menuVisible && isResumed()) {
refreshData();
}
}
@@ -536,7 +529,6 @@ public class CallLogFragment extends Fragment
fetchCalls();
mCallLogQueryHandler.fetchVoicemailStatus();
mCallLogQueryHandler.fetchMissedCallsUnreadCount();
- updateOnTransition();
mRefreshDataRequired = false;
} else {
// Refresh the display of the existing data to update the timestamp text descriptions.
@@ -544,23 +536,6 @@ public class CallLogFragment extends Fragment
}
}
- /**
- * Updates the voicemail notification state.
- *
- * <p>TODO: Move to CallLogActivity
- */
- private void updateOnTransition() {
- // We don't want to update any call data when keyguard is on because the user has likely not
- // seen the new calls yet.
- // This might be called before onCreate() and thus we need to check null explicitly.
- if (mKeyguardManager != null
- && !mKeyguardManager.inKeyguardRestrictedInputMode()
- && mCallTypeFilter == Calls.VOICEMAIL_TYPE) {
- LogUtil.i("CallLogFragment.updateOnTransition", "clearing all new voicemails");
- CallLogNotificationsService.markAllNewVoicemailsAsOld(getActivity());
- }
- }
-
@Override
public void onEmptyViewActionButtonClicked() {
final Activity activity = getActivity();
diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
index 893d6bed9..17018b38d 100644
--- a/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
+++ b/java/com/android/dialer/app/calllog/VisualVoicemailCallLogFragment.java
@@ -16,6 +16,7 @@
package com.android.dialer.app.calllog;
+import android.app.KeyguardManager;
import android.content.Intent;
import android.database.ContentObserver;
import android.media.AudioManager;
@@ -132,7 +133,7 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
@Override
public void onVisible() {
- LogUtil.enterBlock("VisualVoicemailCallLogFragment.onPageSelected");
+ LogUtil.enterBlock("VisualVoicemailCallLogFragment.onVisible");
super.onVisible();
if (getActivity() != null) {
Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL);
@@ -145,10 +146,15 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
@Override
public void onNotVisible() {
- LogUtil.enterBlock("VisualVoicemailCallLogFragment.onPageUnselected");
+ LogUtil.enterBlock("VisualVoicemailCallLogFragment.onNotVisible");
super.onNotVisible();
if (getActivity() != null) {
getActivity().setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
+ // onNotVisible will be called in the lock screen when the call ends
+ if (!getActivity().getSystemService(KeyguardManager.class).inKeyguardRestrictedInputMode()) {
+ LogUtil.i("VisualVoicemailCallLogFragment.onNotVisible", "clearing all new voicemails");
+ CallLogNotificationsService.markAllNewVoicemailsAsOld(getActivity());
+ }
}
}
}