Plumb through the post-dial DTMF wait/response

Connect the CallServices with the InCallService for post-dial DTMF
call flows (and the reverse path, for the wait dialog response).

Bug: 13734588
Change-Id: I5cc06268590c3c424ea6daf216cb205b9c470dac
diff --git a/src/com/android/telecomm/CallServiceWrapper.java b/src/com/android/telecomm/CallServiceWrapper.java
index 41a80e5..945f354 100644
--- a/src/com/android/telecomm/CallServiceWrapper.java
+++ b/src/com/android/telecomm/CallServiceWrapper.java
@@ -57,6 +57,7 @@
         private static final int MSG_SET_DISCONNECTED = 7;
         private static final int MSG_SET_ON_HOLD = 8;
         private static final int MSG_SET_REQUESTING_RINGBACK = 9;
+        private static final int MSG_ON_POST_DIAL_WAIT = 10;
 
         private final Handler mHandler = new Handler() {
             @Override
@@ -153,7 +154,7 @@
                             Log.w(this, "setOnHold, unknown call id: %s", msg.obj);
                         }
                         break;
-                    case MSG_SET_REQUESTING_RINGBACK:
+                    case MSG_SET_REQUESTING_RINGBACK: {
                         SomeArgs args = (SomeArgs) msg.obj;
                         try {
                             call = mCallIdMapper.getCall(args.arg1);
@@ -167,6 +168,20 @@
                             args.recycle();
                         }
                         break;
+                    }
+                    case MSG_ON_POST_DIAL_WAIT:
+                        SomeArgs args = (SomeArgs) msg.obj;
+                        try {
+                            call = mCallIdMapper.getCall(args.arg1);
+                            if (call != null) {
+                                String remaining = (String) args.arg2;
+                                call.onPostDialWait(remaining);
+                            } else {
+                                Log.w(this, "onPostDialWait, unknown call id: %s", args.arg1);
+                            }
+                        } finally {
+                            args.recycle();
+                        }
                 }
             }
         };
@@ -267,6 +282,15 @@
         @Override
         public void setIsConferenced(String conferenceCallId, String callId, boolean isConferenced) {
         }
+
+        @Override
+        public void onPostDialWait(String callId, String remaining) throws RemoteException {
+            mCallIdMapper.checkValidCallId(callId);
+            SomeArgs args = SomeArgs.obtain();
+            args.arg1 = callId;
+            args.arg2 = remaining;
+            mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
+        }
     }
 
     private final Adapter mAdapter = new Adapter();
@@ -493,6 +517,15 @@
         mCallIdMapper.removeCall(call);
     }
 
+    void onPostDialContinue(Call call, boolean proceed) {
+        if (isServiceValid("onPostDialContinue")) {
+            try {
+                mServiceInterface.onPostDialContinue(mCallIdMapper.getCallId(call), proceed);
+            } catch (RemoteException ignored) {
+            }
+        }
+    }
+
     /** {@inheritDoc} */
     @Override
     protected void setServiceInterface(IBinder binder) {