Merge "Clear missed call notification."
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index 462d382..0713e0e 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -32,6 +32,7 @@
 import com.android.internal.telephony.ITelephony;
 import com.google.common.annotations.VisibleForTesting;
 
+import android.app.KeyguardManager;
 import android.app.ListFragment;
 import android.content.Context;
 import android.content.Intent;
@@ -171,6 +172,7 @@
     private View mStatusMessageView;
     private TextView mStatusMessageText;
     private TextView mStatusMessageAction;
+    private KeyguardManager mKeyguardManager;
 
     public static final class ContactInfo {
         public long personId = -1;
@@ -871,6 +873,8 @@
         mVoiceMailNumber = ((TelephonyManager) getActivity().getSystemService(
                 Context.TELEPHONY_SERVICE)).getVoiceMailNumber();
         mCallLogQueryHandler = new CallLogQueryHandler(getActivity().getContentResolver(), this);
+        mKeyguardManager =
+                (KeyguardManager) getActivity().getSystemService(Context.KEYGUARD_SERVICE);
         setHasOptionsMenu(true);
     }
 
@@ -975,11 +979,6 @@
     public void onStop() {
         super.onStop();
         resetNewCallsFlag();
-        // Clear notifications only when window gains focus.  This activity won't
-        // immediately receive focus if the keyguard screen is above it.
-        if (getActivity().hasWindowFocus()) {
-            removeMissedCallNotifications();
-        }
     }
 
     @Override
@@ -1141,9 +1140,9 @@
         startCallsQuery();
         startVoicemailStatusQuery();
         mAdapter.mPreDrawListener = null; // Let it restart the thread after next draw
-        // Clear notifications only when window gains focus.  This activity won't
-        // immediately receive focus if the keyguard screen is above it.
-        if (getActivity().hasWindowFocus()) {
+        // We don't want to remove notification when keyguard is on because the user has likely not
+        // seen the new call yet.
+        if (!mKeyguardManager.inKeyguardRestrictedInputMode()) {
             removeMissedCallNotifications();
         }
     }