summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChiao Cheng <chiaocheng@google.com>2013-09-06 23:20:19 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-06 23:20:19 -0700
commit08709077400767a02d936c1f8f6c57e4d85bfb8e (patch)
tree745104db67ab32d5771828997ffde99940327dd3
parent6b8ca36b1c3d4e34fd9b4c3b120b13ff93afeaa5 (diff)
parent4fac03c7a1d4b7fd04cf653e2f0994b8a4ba2772 (diff)
am 987603b5: am 2fa6baa2: Port dtmf post dial wait feature.
* commit '987603b5cccc9ac4f9893373e6d6a556118a27ff': Port dtmf post dial wait feature.
-rw-r--r--InCallUI/src/com/android/incallui/CallCommandClient.java27
-rw-r--r--InCallUI/src/com/android/incallui/CallHandlerService.java12
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java5
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/PostCharDialogFragment.java76
5 files changed, 123 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCommandClient.java b/InCallUI/src/com/android/incallui/CallCommandClient.java
index b59788b2c..cb49dca8e 100644
--- a/InCallUI/src/com/android/incallui/CallCommandClient.java
+++ b/InCallUI/src/com/android/incallui/CallCommandClient.java
@@ -200,4 +200,31 @@ public class CallCommandClient {
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 b73135590..94c2a11af 100644
--- a/InCallUI/src/com/android/incallui/CallHandlerService.java
+++ b/InCallUI/src/com/android/incallui/CallHandlerService.java
@@ -45,8 +45,9 @@ public class CallHandlerService extends Service {
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 class CallHandlerService extends Service {
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 @@ public class CallHandlerService extends Service {
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 6cae6b05e..4c1d04089 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -350,4 +350,9 @@ public class InCallActivity extends Activity {
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 cc4cee277..cc04dc5b4 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -264,6 +264,10 @@ public class InCallPresenter implements CallList.Listener {
}
}
+ 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 000000000..41940ff34
--- /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);
+ }
+}