Add PSTN incoming call support.

Change looks big but a lot of it is reshuffling and very minor deletes.
Changes:
- Removes the shouldDisableUpdates code
- Disables incoming call codepath in TeleService
  (see CallNotifier.java change)
- Moved the static call map from BaseTelephoneCallService into its own
  class: CallRegistrar.java
- Added a class between Cdma/GsmCallService and BaseTelephonyCallService
  to hold code that is shared by CDMA and GSM but not SIP. In this case,
  the incoming call flow.
- Added audio-mode switching in TelephonyCallConnection. This is there
  to make incoming calls work until AudioManager lands in Telecomm.

Incoming call changes:
PstnCallService.java
 - setIncomingCallId() - Basically, it looks for any new incoming call
   and if it finds one, it tells Telecomm, "yup, here's the incoming
   call." An incoming call is considered NEW if the call hasn't already
   been associated with a call ID...we check that before confirming with
   Telecomm.
 - answer()/reject() - In both cases, we see if the incoming call still
   exists for the call ID, and if it does, we perform the appropriate
   action via the Phone object.

Change-Id: I5c748870453ea74f8306bb467b114995eb728484
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 5258f88..3e37f29 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -95,8 +95,6 @@
     private final ArrayList<Listener> mListeners = new ArrayList<Listener>();
     private Connection mCdmaIncomingConnection;
     private Connection mCdmaOutgoingConnection;
-    // TODO(sail): Temporary flag to disable sending telephony updates when Telecomm is being used.
-    private boolean mShouldDisableUpdates;
 
     public CallModeler(CallStateMonitor callStateMonitor, CallManager callManager,
             CallGatewayManager callGatewayManager) {
@@ -107,12 +105,6 @@
         mCallStateMonitor.addListener(this);
     }
 
-    public void setShouldDisableUpdates(boolean shouldDisableUpdates) {
-        Log.i(TAG, "setShouldDisableUpdates " + mShouldDisableUpdates + " -> " +
-                shouldDisableUpdates);
-        mShouldDisableUpdates = shouldDisableUpdates;
-    }
-
     @Override
     public void handleMessage(Message msg) {
         switch(msg.what) {
@@ -279,7 +271,7 @@
                     final Call call = getCallFromMap(mCallMap, c, false);
                     if (call == null) {
                         Log.i(TAG, "Call no longer exists. Skipping onPostDialWait().");
-                    } else if (!mShouldDisableUpdates) {
+                    } else {
                         for (Listener mListener : mListeners) {
                             mListener.onPostDialAction(state, call.getCallId(),
                                     c.getRemainingPostDialString(), ch);
@@ -289,10 +281,8 @@
                 default:
                     // This is primarily to cause the DTMFTonePlayer to play local tones.
                     // Other listeners simply perform no-ops.
-                    if (!mShouldDisableUpdates) {
-                        for (Listener mListener : mListeners) {
-                            mListener.onPostDialAction(state, 0, "", ch);
-                        }
+                    for (Listener mListener : mListeners) {
+                        mListener.onPostDialAction(state, 0, "", ch);
                     }
                     break;
             }
@@ -306,10 +296,8 @@
         if (call != null) {
             updateCallFromConnection(call, conn, false);
 
-            if (!mShouldDisableUpdates) {
-                for (int i = 0; i < mListeners.size(); ++i) {
-                    mListeners.get(i).onIncoming(call);
-                }
+            for (int i = 0; i < mListeners.size(); ++i) {
+                mListeners.get(i).onIncoming(call);
             }
         }
 
@@ -326,10 +314,8 @@
 
             updateCallFromConnection(call, conn, false);
 
-            if (!mShouldDisableUpdates) {
-                for (int i = 0; i < mListeners.size(); ++i) {
-                    mListeners.get(i).onDisconnect(call);
-                }
+            for (int i = 0; i < mListeners.size(); ++i) {
+                mListeners.get(i).onDisconnect(call);
             }
 
             // If it was a conferenced call, we need to run the entire update
@@ -353,7 +339,7 @@
         final List<Call> updatedCalls = Lists.newArrayList();
         doUpdate(false, updatedCalls);
 
-        if (updatedCalls.size() > 0 && !mShouldDisableUpdates) {
+        if (updatedCalls.size() > 0) {
             for (int i = 0; i < mListeners.size(); ++i) {
                 mListeners.get(i).onUpdate(updatedCalls);
             }