Go to the Call log after *all* calls, even incoming calls.

As requested in Bug 2844990, as long as the screen isn't locked, we
now *always* go to the call log when a call ends, regardless of
whether it was originally incoming or outgoing.

(Previously, after an outgoing call we'd take you the Call log, and
after an incoming call we'd just return to whatever you were doing
when the call came in.)

Note we *don't* go to the Call log if the device is locked, since you
would just see the lockscreen instead of the call log anyway.  (And in
particular, if the device has a lock pattern set and a call comes in
while the screen is off, we *won't* go to the call log afterwards
since the device will be locked at that point.)

Bug: 2844990
Change-Id: I8211bea8f94b3bd4da7211cc42629dee55f57423
diff --git a/src/com/android/phone/InCallScreen.java b/src/com/android/phone/InCallScreen.java
index c68c580..75f6593 100755
--- a/src/com/android/phone/InCallScreen.java
+++ b/src/com/android/phone/InCallScreen.java
@@ -306,16 +306,6 @@
     private String mPostDialStrAfterPause;
     private boolean mPauseInProgress = false;
 
-    // Flag indicating whether or not we should bring up the Call Log when
-    // exiting the in-call UI due to the Phone becoming idle.  (This is
-    // true if the most recently disconnected Call was initiated by the
-    // user, or false if it was an incoming call.)
-    // This flag is used by delayedCleanupAfterDisconnect(), and is set by
-    // onDisconnect() (which is the only place that either posts a
-    // DELAYED_CLEANUP_AFTER_DISCONNECT event *or* calls
-    // delayedCleanupAfterDisconnect() directly.)
-    private boolean mShowCallLogAfterDisconnect;
-
     private Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
@@ -1844,10 +1834,6 @@
         // that might be triggered by a disconnect event, like playing the
         // busy/congestion tone.
 
-        // Keep track of whether this call was user-initiated or not.
-        // (This affects where we take the user next; see delayedCleanupAfterDisconnect().)
-        mShowCallLogAfterDisconnect = !c.isIncoming();
-
         // We bail out immediately (and *don't* display the "call ended"
         // state at all) in a couple of cases, including those where we
         // are waiting for the radio to finish powering up for an
@@ -2804,12 +2790,12 @@
             if (mIsForegroundActivity) {
                 if (DBG) log("- delayedCleanupAfterDisconnect: finishing InCallScreen...");
 
-                // If this is a call that was initiated by the user, and
-                // we're *not* in emergency mode, finish the call by
-                // taking the user to the Call Log.
-                // Otherwise we simply call endInCallScreenSession, which will take us
-                // back to wherever we came from.
-                if (mShowCallLogAfterDisconnect && !isPhoneStateRestricted()) {
+                // If we're not in emergency mode, i.e. if the screen isn't
+                // locked, finish the call by taking the user to the Call Log.
+                // (UI note: Up till eclair, we did this only for outgoing
+                // calls initiated on the device, but we now do it
+                // unconditionally.)
+                if (!isPhoneStateRestricted()) {
                     if (VDBG) log("- Show Call Log after disconnect...");
                     final Intent intent = PhoneApp.createCallLogIntent();
                     intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);