Allow timeouts to be configurable

Read the various timeouts from Settings so that they can be configured
and tuned at runtime (instead of baking them into the source code).

Bug: 13329970

Change-Id: I0113d171b5f5098305dff89e86eee8ad11939c27
diff --git a/src/com/android/telecomm/Switchboard.java b/src/com/android/telecomm/Switchboard.java
index a9889c5..bb40ef6 100644
--- a/src/com/android/telecomm/Switchboard.java
+++ b/src/com/android/telecomm/Switchboard.java
@@ -41,17 +41,6 @@
 final class Switchboard {
 
     private final static String TAG = Switchboard.class.getSimpleName();
-    /**
-     * The frequency of invoking tick in milliseconds.
-     * TODO(gilad): May require tuning.
-     */
-    private final static int TICK_FREQUENCY_MS = 250;
-
-    /**
-     * The timeout beyond which to drop ongoing attempts to place/receive calls.
-     * TODO(gilad): May require tuning.
-     */
-    private final static int NEW_CALL_TIMEOUT_MS = 5000;
 
     private final CallsManager mCallsManager;
 
@@ -276,7 +265,7 @@
      * Schedules the next tick invocation.
      */
     private void scheduleNextTick() {
-         mHandler.postDelayed(mTicker, TICK_FREQUENCY_MS);
+         mHandler.postDelayed(mTicker, Timeouts.getTickMs());
     }
 
     /**
@@ -346,10 +335,11 @@
             return;
         }
 
+        final long newCallTimeoutMs = Timeouts.getNewOutgoingCallMs();
         Iterator<Call> iterator = calls.iterator();
         while (iterator.hasNext()) {
             Call call = iterator.next();
-            if (call.getAgeInMilliseconds() >= NEW_CALL_TIMEOUT_MS) {
+            if (call.getAgeInMilliseconds() >= newCallTimeoutMs) {
                 mOutgoingCallsManager.abort(call);
                 calls.remove(call);