TTY: Telecomm

This CL makes the following changes:
  1. Added TtyManager. This class contains code that used
     to live in PhoneGlobals to listen to preferred TTY
     mode changes. Current TTY mode is based on the
     preferred mode, wired headset state, and device TTY
     support.

  2. Moved ownership of WiredHeadsetManager to CallsManager
     so that TtyManager can listen to headset plugged events.

  3. Added plumbing to TelecommServiceImpl to impement
     isTtySupported and getCurrentTtyMode.

  4. Added tty_enabled to config.xml. This is moved over
     from Telephony.

Change-Id: I652b095af30cc2732a06829dc23492e5355660da
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 5d07176..a78d750 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -75,6 +75,8 @@
     private final Ringer mRinger;
     private final Set<CallsManagerListener> mListeners = new HashSet<>();
     private final HeadsetMediaButton mHeadsetMediaButton;
+    private final WiredHeadsetManager mWiredHeadsetManager;
+    private final TtyManager mTtyManager;
 
     /**
      * The call the user is currently interacting with. This is the call that should have audio
@@ -94,10 +96,12 @@
         TelecommApp app = TelecommApp.getInstance();
 
         StatusBarNotifier statusBarNotifier = new StatusBarNotifier(app, this);
-        mCallAudioManager = new CallAudioManager(app, statusBarNotifier);
+        mWiredHeadsetManager = new WiredHeadsetManager(app);
+        mCallAudioManager = new CallAudioManager(app, statusBarNotifier, mWiredHeadsetManager);
         InCallTonePlayer.Factory playerFactory = new InCallTonePlayer.Factory(mCallAudioManager);
         mRinger = new Ringer(mCallAudioManager, this, playerFactory, app);
         mHeadsetMediaButton = new HeadsetMediaButton(app, this);
+        mTtyManager = new TtyManager(app, mWiredHeadsetManager);
 
         mListeners.add(statusBarNotifier);
         mListeners.add(new CallLogManager(app));
@@ -231,6 +235,14 @@
         return mCallAudioManager.getAudioState();
     }
 
+    boolean isTtySupported() {
+        return mTtyManager.isTtySupported();
+    }
+
+    int getCurrentTtyMode() {
+        return mTtyManager.getCurrentTtyMode();
+    }
+
     /**
      * Starts the process to attach the call to a connection service.
      *