am 987603b5: am 2fa6baa2: Port dtmf post dial wait feature.

* commit '987603b5cccc9ac4f9893373e6d6a556118a27ff':
  Port dtmf post dial wait feature.
diff --git a/InCallUI/src/com/android/incallui/CallCommandClient.java b/InCallUI/src/com/android/incallui/CallCommandClient.java
index b59788b..cb49dca 100644
--- a/InCallUI/src/com/android/incallui/CallCommandClient.java
+++ b/InCallUI/src/com/android/incallui/CallCommandClient.java
@@ -200,4 +200,31 @@
             Log.e(this, "Error setting speaker.", e);
         }
     }
+
+    public void postDialWaitContinue(int callId) {
+        if (mCommandService == null) {
+            Log.e(this, "Cannot postDialWaitContinue(); CallCommandService == null");
+            return;
+        }
+        try {
+            Log.v(this, "postDialWaitContinue()");
+            mCommandService.postDialWaitContinue(callId);
+        } catch (RemoteException e) {
+            Log.e(this, "Error on postDialWaitContinue().", e);
+        }
+    }
+
+    public void postDialCancel(int callId) {
+        if (mCommandService == null) {
+            Log.e(this, "Cannot postDialCancel(); CallCommandService == null");
+            return;
+        }
+        try {
+            Log.v(this, "postDialCancel()");
+            mCommandService.postDialCancel(callId);
+        } catch (RemoteException e) {
+            Log.e(this, "Error on postDialCancel().", e);
+        }
+    }
+
 }
diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java
index b731355..94c2a11 100644
--- a/InCallUI/src/com/android/incallui/CallHandlerService.java
+++ b/InCallUI/src/com/android/incallui/CallHandlerService.java
@@ -45,8 +45,9 @@
     private static final int ON_SUPPORTED_AUDIO_MODE = 5;
     private static final int ON_DISCONNECT_CALL = 6;
     private static final int ON_BRING_TO_FOREGROUND = 7;
+    private static final int ON_POST_CHAR_WAIT = 8;
 
-    private static final int LARGEST_MSG_ID = ON_BRING_TO_FOREGROUND;
+    private static final int LARGEST_MSG_ID = ON_POST_CHAR_WAIT;
 
 
     private CallList mCallList;
@@ -182,6 +183,12 @@
         public void bringToForeground() {
             mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_BRING_TO_FOREGROUND));
         }
+
+        @Override
+        public void onPostDialWait(int callId, String chars) {
+            mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_POST_CHAR_WAIT, callId, 0,
+                    chars));
+        }
     };
 
     /**
@@ -223,6 +230,9 @@
             case ON_DISCONNECT_CALL:
                 mCallList.onDisconnect((Call) msg.obj);
                 break;
+            case ON_POST_CHAR_WAIT:
+                mInCallPresenter.onPostDialCharWait(msg.arg1, (String) msg.obj);
+                break;
             case ON_AUDIO_MODE:
                 mAudioModeProvider.onAudioModeChange(msg.arg1, msg.arg2 == 1);
                 break;
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 6cae6b0..4c1d040 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -350,4 +350,9 @@
             mConferenceManagerFragment.setVisible(true);
         }
     }
+
+    public void showPostCharWaitDialog(int callId, String chars) {
+        final PostCharDialogFragment fragment = new PostCharDialogFragment(callId,  chars);
+        fragment.show(getFragmentManager(), "postCharWait");
+    }
 }
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index cc4cee2..cc04dc5 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -264,6 +264,10 @@
         }
     }
 
+    public void onPostDialCharWait(int callId, String chars) {
+        mInCallActivity.showPostCharWaitDialog(callId, chars);
+    }
+
     /**
      * When the state of in-call changes, this is the first method to get called. It determines if
      * the UI needs to be started or finished depending on the new state and does it.
diff --git a/InCallUI/src/com/android/incallui/PostCharDialogFragment.java b/InCallUI/src/com/android/incallui/PostCharDialogFragment.java
new file mode 100644
index 0000000..41940ff
--- /dev/null
+++ b/InCallUI/src/com/android/incallui/PostCharDialogFragment.java
@@ -0,0 +1,76 @@
+/*
+ * 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.incallui;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.WindowManager;
+
+/**
+ * Pop up an alert dialog with OK and Cancel buttons to allow user to Accept or Reject the WAIT
+ * inserted as part of the Dial string.
+ */
+public class PostCharDialogFragment extends DialogFragment {
+
+    private int mCallId;
+    private String mPostDialStr;
+
+    public PostCharDialogFragment(int callId, String postDialStr) {
+        mCallId = callId;
+        mPostDialStr = postDialStr;
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        super.onCreateDialog(savedInstanceState);
+
+        final StringBuilder buf = new StringBuilder();
+        buf.append(getResources().getText(R.string.wait_prompt_str));
+        buf.append(mPostDialStr);
+
+        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+        builder.setMessage(buf.toString());
+
+        builder.setPositiveButton(R.string.pause_prompt_yes, new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int whichButton) {
+                CallCommandClient.getInstance().postDialWaitContinue(mCallId);
+            }
+        });
+        builder.setNegativeButton(R.string.pause_prompt_no, new DialogInterface.OnClickListener() {
+            @Override
+            public void onClick(DialogInterface dialog, int whichButton) {
+                dialog.cancel();
+            }
+        });
+
+        final AlertDialog dialog = builder.create();
+        dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
+        return dialog;
+    }
+
+    @Override
+    public void onCancel(DialogInterface dialog) {
+        super.onCancel(dialog);
+
+        CallCommandClient.getInstance().postDialCancel(mCallId);
+    }
+}