DO NOT MERGE ThirdPartyCallSendDtmfCallBack API

This API is needed to implement post dial.

Change-Id: Iefdeae81d0eae6be86e7ee1e8ab0251ae43ed079
diff --git a/Android.mk b/Android.mk
index d478a59..1868dcb 100644
--- a/Android.mk
+++ b/Android.mk
@@ -277,6 +277,7 @@
 	telephony/java/com/android/internal/telephony/ITelephony.aidl \
 	telephony/java/com/android/internal/telephony/IThirdPartyCallListener.aidl \
 	telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl \
+	telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl \
 	telephony/java/com/android/internal/telephony/IThirdPartyCallService.aidl \
 	telephony/java/com/android/internal/telephony/ISms.aidl \
 	telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
diff --git a/api/current.txt b/api/current.txt
index d5b976b..414169f 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -24582,7 +24582,12 @@
     method public void hangup();
     method public void incomingCallAccept();
     method public void mute(boolean);
-    method public void sendDtmf(char);
+    method public void sendDtmf(char, android.telephony.ThirdPartyCallSendDtmfCallback);
+  }
+
+  public class ThirdPartyCallSendDtmfCallback {
+    ctor public ThirdPartyCallSendDtmfCallback(com.android.internal.telephony.IThirdPartyCallSendDtmfCallback);
+    method public void onSendDtmfCompleted();
   }
 
   public class ThirdPartyCallService {
@@ -34081,7 +34086,11 @@
     method public abstract void hangup() throws android.os.RemoteException;
     method public abstract void incomingCallAccept() throws android.os.RemoteException;
     method public abstract void mute(boolean) throws android.os.RemoteException;
-    method public abstract void sendDtmf(char) throws android.os.RemoteException;
+    method public abstract void sendDtmf(char, com.android.internal.telephony.IThirdPartyCallSendDtmfCallback) throws android.os.RemoteException;
+  }
+
+  public abstract interface IThirdPartyCallSendDtmfCallback implements android.os.IInterface {
+    method public abstract void onSendDtmfCompleted() throws android.os.RemoteException;
   }
 
 }
diff --git a/telephony/java/android/telephony/ThirdPartyCallProvider.java b/telephony/java/android/telephony/ThirdPartyCallProvider.java
index 74b9ae3..5054380 100644
--- a/telephony/java/android/telephony/ThirdPartyCallProvider.java
+++ b/telephony/java/android/telephony/ThirdPartyCallProvider.java
@@ -20,6 +20,7 @@
 import android.os.Message;
 
 import com.android.internal.telephony.IThirdPartyCallProvider;
+import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback;
 
 /**
  * Interface sent to {@link android.telephony.ThirdPartyCallListener#onCallProviderAttached
@@ -55,7 +56,7 @@
     /**
      * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'.
      */
-    public void sendDtmf(char c) {
+    public void sendDtmf(char c, ThirdPartyCallSendDtmfCallback callback) {
         // default implementation empty
     }
 
@@ -76,8 +77,8 @@
         }
 
         @Override
-        public void sendDtmf(char c) {
-            Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0).sendToTarget();
+        public void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback) {
+            Message.obtain(mHandler, MSG_SEND_DTMF, (int) c, 0, callback).sendToTarget();
         }
     };
 
@@ -95,7 +96,9 @@
                     incomingCallAccept();
                     break;
                 case MSG_SEND_DTMF:
-                    sendDtmf((char) msg.arg1);
+                    ThirdPartyCallSendDtmfCallback callback = new ThirdPartyCallSendDtmfCallback(
+                            (IThirdPartyCallSendDtmfCallback) msg.obj);
+                    sendDtmf((char) msg.arg1, callback);
                     break;
             }
         }
diff --git a/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java b/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java
new file mode 100644
index 0000000..5a67cf7
--- /dev/null
+++ b/telephony/java/android/telephony/ThirdPartyCallSendDtmfCallback.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.os.RemoteException;
+
+import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback;
+
+/**
+ * Callback interface for when DTMF has been sent.
+ */
+public class ThirdPartyCallSendDtmfCallback {
+    private final IThirdPartyCallSendDtmfCallback mCallback;
+
+    public ThirdPartyCallSendDtmfCallback(IThirdPartyCallSendDtmfCallback callback) {
+        if (callback == null) {
+            throw new IllegalArgumentException("Invalid callback");
+        }
+        mCallback = callback;
+    }
+
+    /**
+     * Called by the service when a call provider is available to perform the outgoing or incoming
+     * call.
+     */
+    public void onSendDtmfCompleted() {
+        try {
+            mCallback.onSendDtmfCompleted();
+        } catch (RemoteException e) {
+        }
+    }
+}
diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl
index a9d67a4..9d595b0 100644
--- a/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl
+++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallProvider.aidl
@@ -17,6 +17,7 @@
 package com.android.internal.telephony;
 
 import com.android.internal.telephony.IThirdPartyCallListener;
+import com.android.internal.telephony.IThirdPartyCallSendDtmfCallback;
 
 /**
  * Interface sent to ThirdPartyCallListener.onCallProviderAttached. This is used to control an
@@ -42,5 +43,5 @@
     /**
      * Sends the given DTMF code. The code can be '0'-'9', 'A'-'D', '#', or '*'.
      */
-    void sendDtmf(char c);
+    void sendDtmf(char c, IThirdPartyCallSendDtmfCallback callback);
 }
diff --git a/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl
new file mode 100644
index 0000000..3a02b06
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/IThirdPartyCallSendDtmfCallback.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony;
+
+/**
+ * Callback interface for when DTMF has been sent.
+ */
+oneway interface IThirdPartyCallSendDtmfCallback {
+    /**
+     * Called when the DTMF code has been sent.
+     */
+    void onSendDtmfCompleted();
+}