start/stop in-call UI on demand

This change severs the connection to the in-call UI whenever there is no
active call.  When we get a new call, we attempt to the bind to the
UI service.  Whenever we lose/disconnect a call, we see if there are any calls
left and if not, unbind from the UI service.

Changes:
- Add explicit component name to config.xml and use them when binding to
  the UI service.
- onUpdate and onIncomingCall in CAllHandlerServiceProxy now make a call
  to maybeBindToService() in case the service requires binding.
- onDisconnect calls maybeUnbind() after a disconnect.
- add cleanup of current binding to onServiceDisconnect().  Also attempt
  to rebind if there are still active calls.

bug: 10363682
Change-Id: I7ddbb33fde7e3b03c1f1ea759d174cb03baabc76
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 1591ac8..89dcb21 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -151,6 +151,26 @@
         return null;
     }
 
+    public boolean hasLiveCall() {
+        return hasLiveCallInternal(mCallMap) ||
+            hasLiveCallInternal(mConfCallMap);
+    }
+
+    private boolean hasLiveCallInternal(HashMap<Connection, Call> map) {
+        for (Call call : map.values()) {
+            final int state = call.getState();
+            if (state == Call.State.ACTIVE ||
+                    state == Call.State.CALL_WAITING ||
+                    state == Call.State.CONFERENCED ||
+                    state == Call.State.DIALING ||
+                    state == Call.State.INCOMING ||
+                    state == Call.State.ONHOLD) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public boolean hasOutstandingActiveCall() {
         return hasOutstandingActiveCallInternal(mCallMap) ||
                 hasOutstandingActiveCallInternal(mConfCallMap);