summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorEvan Charlton <evanc@google.com>2014-05-14 12:04:33 -0700
committerEvan Charlton <evanc@google.com>2014-05-14 12:04:33 -0700
commit63c7d7678ff56b7366e4508a39a2d79f8b28c917 (patch)
treee0f853260736369915c1bfb7bd0d405e157b3153 /InCallUI
parentb2e10feeaf6ce8ac912bea36af28d0f060b43872 (diff)
parentd11c7a03578697637f97e26758ac5bd96c85e967 (diff)
resolved conflicts for merge of af680f72 to master
Change-Id: I47c720391182aac0ce214b0c5c913c01f4b535e0
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/DialpadFragment.java17
-rw-r--r--InCallUI/src/com/android/incallui/DialpadPresenter.java50
-rw-r--r--InCallUI/src/com/android/incallui/InCallServiceImpl.java40
3 files changed, 71 insertions, 36 deletions
diff --git a/InCallUI/src/com/android/incallui/DialpadFragment.java b/InCallUI/src/com/android/incallui/DialpadFragment.java
index 671968d71..1f2bf903b 100644
--- a/InCallUI/src/com/android/incallui/DialpadFragment.java
+++ b/InCallUI/src/com/android/incallui/DialpadFragment.java
@@ -42,7 +42,7 @@ import java.util.HashMap;
*/
public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPresenter.DialpadUi>
implements DialpadPresenter.DialpadUi, View.OnTouchListener, View.OnKeyListener,
- View.OnHoverListener, View.OnClickListener {
+ View.OnHoverListener {
private static final float DIALPAD_SLIDE_FRACTION = 1.0f;
@@ -317,21 +317,6 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
}
@Override
- public void onClick(View v) {
- final AccessibilityManager accessibilityManager = (AccessibilityManager)
- v.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
- // When accessibility is on, simulate press and release to preserve the
- // semantic meaning of performClick(). Required for Braille support.
- if (accessibilityManager.isEnabled()) {
- final int id = v.getId();
- // Checking the press state prevents double activation.
- if (!v.isPressed() && mDisplayMap.containsKey(id)) {
- getPresenter().processDtmf(mDisplayMap.get(id), true /* timedShortTone */);
- }
- }
- }
-
- @Override
public boolean onHover(View v, MotionEvent event) {
// When touch exploration is turned on, lifting a finger while inside
// the button's hover target bounds should perform a click action.
diff --git a/InCallUI/src/com/android/incallui/DialpadPresenter.java b/InCallUI/src/com/android/incallui/DialpadPresenter.java
index 8640f8acc..e426a6a18 100644
--- a/InCallUI/src/com/android/incallui/DialpadPresenter.java
+++ b/InCallUI/src/com/android/incallui/DialpadPresenter.java
@@ -16,14 +16,19 @@
package com.android.incallui;
+import android.telecomm.InCallAdapter;
import android.telephony.PhoneNumberUtils;
+import com.android.services.telephony.common.Call;
+
/**
* Logic for call buttons.
*/
public class DialpadPresenter extends Presenter<DialpadPresenter.DialpadUi>
implements InCallPresenter.InCallStateListener {
+ private Call mCall;
+
@Override
public void onUiReady(DialpadUi ui) {
super.onUiReady(ui);
@@ -31,7 +36,8 @@ public class DialpadPresenter extends Presenter<DialpadPresenter.DialpadUi>
@Override
public void onStateChange(InCallPresenter.InCallState state, CallList callList) {
-
+ mCall = callList.getActiveCall();
+ Log.d(this, "DialpadPresenter mCall = " + mCall);
}
/**
@@ -39,27 +45,22 @@ public class DialpadPresenter extends Presenter<DialpadPresenter.DialpadUi>
* appropriate DTMF tone, and appending the digit to the EditText
* field that displays the DTMF digits sent so far.
*
- * @see #processDtmf(char, boolean)
*/
public final void processDtmf(char c) {
- processDtmf(c, false);
- }
-
- /**
- * Processes the specified digit as a DTMF key, by playing the appropriate
- * DTMF tone (or short tone if requested), and appending the digit to the
- * EditText field that displays the DTMF digits sent so far.
- */
- public final void processDtmf(char c, boolean timedShortTone) {
Log.d(this, "Processing dtmf key " + c);
// if it is a valid key, then update the display and send the dtmf tone.
- if (PhoneNumberUtils.is12Key(c)) {
- Log.d(this, "updating display and sending dtmf tone for '" + c + "'");
-
- // Append this key to the "digits" widget.
- getUi().appendDigitsToField(c);
- // Plays the tone through CallCommandService
- CallCommandClient.getInstance().playDtmfTone(c, timedShortTone);
+ if (PhoneNumberUtils.is12Key(c) && mCall != null) {
+ // Plays the tone through Telecomm
+ InCallAdapter telecommAdapter = InCallPresenter.getInstance().getTelecommAdapter();
+ if (telecommAdapter != null) {
+ String callId = CallInfoTranslator.getTelecommCallId(mCall);
+ if (callId != null) {
+ Log.d(this, "updating display and sending dtmf tone for '" + c + "'");
+ // Append this key to the "digits" widget.
+ getUi().appendDigitsToField(c);
+ telecommAdapter.playDtmfTone(callId, c);
+ }
+ }
} else {
Log.d(this, "ignoring dtmf request for '" + c + "'");
}
@@ -69,8 +70,17 @@ public class DialpadPresenter extends Presenter<DialpadPresenter.DialpadUi>
* Stops the local tone based on the phone type.
*/
public void stopTone() {
- Log.d(this, "stopping remote tone");
- CallCommandClient.getInstance().stopDtmfTone();
+ if (mCall != null) {
+ Log.d(this, "stopping remote tone");
+ InCallAdapter telecommAdapter = InCallPresenter.getInstance().getTelecommAdapter();
+ if (telecommAdapter != null) {
+ String callId = CallInfoTranslator.getTelecommCallId(mCall);
+ if (callId != null) {
+ Log.d(this, "stopping remote tone: " + callId);
+ telecommAdapter.stopDtmfTone(callId);
+ }
+ }
+ }
}
public interface DialpadUi extends Ui {
diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java
index 7bfeab90e..ca04993e0 100644
--- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java
+++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java
@@ -80,6 +80,46 @@ public class InCallServiceImpl extends android.telecomm.InCallService {
}
/** {@inheritDoc} */
+ @Override protected void setDialing(String callId) {
+ Call call = CallInfoTranslator.getCall(callId);
+ if (null != call) {
+ call.setState(Call.State.DIALING);
+ CallList.getInstance().onUpdate(call);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void setRinging(String callId) {
+ Call call = CallInfoTranslator.getCall(callId);
+ if (null != call) {
+ call.setState(Call.State.RINGING);
+ CallList.getInstance().onUpdate(call);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void setPostDial(String callId, String remaining) {
+ Call call = CallInfoTranslator.getCall(callId);
+ if (null != call) {
+ // TODO(ihab): Add post-dial state to user interface
+ // TODO(ihab: Do the equivalent in the new framework:
+ // call.setState(Call.State.POST_DIAL);
+ CallList.getInstance().onUpdate(call);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void setPostDialWait(String callId, String remaining) {
+ Call call = CallInfoTranslator.getCall(callId);
+ if (null != call) {
+ // TODO(ihab): Add post-dial state to user interface
+ // TODO(ihab): Do the equivalent in the new framework:
+ // call.setState(Call.State.POST_DIAL_WAIT);
+ CallList.getInstance().onUpdate(call);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override protected void setDisconnected(String callId, int disconnectCause) {
Call call = CallInfoTranslator.getCall(callId);
if (null != call) {