summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--InCallUI/src/com/android/incallui/AnswerFragment.java47
-rw-r--r--InCallUI/src/com/android/incallui/AnswerPresenter.java2
-rw-r--r--InCallUI/src/com/android/incallui/Call.java12
-rw-r--r--InCallUI/src/com/android/incallui/CallList.java4
-rw-r--r--InCallUI/src/com/android/incallui/InCallServiceImpl.java6
-rw-r--r--InCallUI/src/com/android/incallui/TelecommAdapter.java3
6 files changed, 44 insertions, 30 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java
index 2630303be..dfc902dc8 100644
--- a/InCallUI/src/com/android/incallui/AnswerFragment.java
+++ b/InCallUI/src/com/android/incallui/AnswerFragment.java
@@ -58,7 +58,9 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
*/
private AlertDialog mCustomMessagePopup = null;
- private ArrayAdapter<String> mTextResponsesAdapter = null;
+ private ArrayAdapter<String> mSmsResponsesAdapter;
+
+ private final List<String> mSmsResponses = new ArrayList<>();
private GlowPadWrapper mGlowpad;
@@ -139,24 +141,26 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
@Override
public void showMessageDialog() {
- final ListView lv = new ListView(getActivity());
+ final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- Preconditions.checkNotNull(mTextResponsesAdapter);
- lv.setAdapter(mTextResponsesAdapter);
+ mSmsResponsesAdapter = new ArrayAdapter<>(builder.getContext(),
+ android.R.layout.simple_list_item_1, android.R.id.text1, mSmsResponses);
+
+ final ListView lv = new ListView(getActivity());
+ lv.setAdapter(mSmsResponsesAdapter);
lv.setOnItemClickListener(new RespondViaSmsItemClickListener());
- final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setCancelable(
- true).setView(lv);
- builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialogInterface) {
- if (mGlowpad != null) {
- mGlowpad.startPing();
- }
- dismissCannedResponsePopup();
- getPresenter().onDismissDialog();
- }
- });
+ builder.setCancelable(true).setView(lv).setOnCancelListener(
+ new DialogInterface.OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialogInterface) {
+ if (mGlowpad != null) {
+ mGlowpad.startPing();
+ }
+ dismissCannedResponsePopup();
+ getPresenter().onDismissDialog();
+ }
+ });
mCannedResponsePopup = builder.create();
mCannedResponsePopup.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
mCannedResponsePopup.show();
@@ -274,12 +278,13 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
@Override
public void configureMessageDialog(List<String> textResponses) {
- final List<String> textResponsesForDisplay = Lists.newArrayList(textResponses);
-
- textResponsesForDisplay.add(getResources().getString(
+ mSmsResponses.clear();
+ mSmsResponses.addAll(textResponses);
+ mSmsResponses.add(getResources().getString(
R.string.respond_via_sms_custom_message));
- mTextResponsesAdapter = new ArrayAdapter<String>(getActivity(),
- android.R.layout.simple_list_item_1, android.R.id.text1, textResponsesForDisplay);
+ if (mSmsResponsesAdapter != null) {
+ mSmsResponsesAdapter.notifyDataSetChanged();
+ }
}
@Override
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java
index 1488d6a4c..78aa64b23 100644
--- a/InCallUI/src/com/android/incallui/AnswerPresenter.java
+++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java
@@ -103,7 +103,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
@Override
- public void onCallStateChanged(Call call) {
+ public void onCallChanged(Call call) {
Log.d(this, "onCallStateChange() " + call + " " + this);
if (call.getState() != Call.State.INCOMING && call.getState() != Call.State.CALL_WAITING) {
// Stop listening for updates.
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index bb079b5ea..fccf608fa 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -26,6 +26,7 @@ import android.telephony.DisconnectCause;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.primitives.Ints;
+import java.util.Collections;
import java.util.List;
import java.util.Locale;
@@ -100,6 +101,7 @@ public final class Call {
private String mCallId;
private int mState = State.INVALID;
private int mDisconnectCause = DisconnectCause.NOT_VALID;
+ private List<String> mCannedSmsResponses = Collections.EMPTY_LIST;
private int mCapabilities;
private long mConnectTimeMillis = 0;
private Uri mHandle;
@@ -170,6 +172,16 @@ public final class Call {
mDisconnectCause = cause;
}
+ /** Sets the possible text message responses. */
+ public void setCannedSmsResponses(List<String> cannedSmsResponses) {
+ mCannedSmsResponses = cannedSmsResponses;
+ }
+
+ /** Returns the possible text message responses. */
+ public List<String> getCannedSmsResponses() {
+ return mCannedSmsResponses;
+ }
+
/** Sets a bit mask of capabilities unique to this call. */
public void setCapabilities(int capabilities) {
mCapabilities = (CallCapabilities.ALL & capabilities);
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java
index df993f544..022281224 100644
--- a/InCallUI/src/com/android/incallui/CallList.java
+++ b/InCallUI/src/com/android/incallui/CallList.java
@@ -123,7 +123,7 @@ public class CallList {
final List<CallUpdateListener> listeners = mCallUpdateListenerMap.get(call.getCallId());
if (listeners != null) {
for (CallUpdateListener listener : listeners) {
- listener.onCallStateChanged(call);
+ listener.onCallChanged(call);
}
}
}
@@ -474,6 +474,6 @@ public class CallList {
public interface CallUpdateListener {
// TODO: refactor and limit arg to be call state. Caller info is not needed.
- public void onCallStateChanged(Call call);
+ public void onCallChanged(Call call);
}
}
diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java
index f98d7f1df..1a629bd44 100644
--- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java
+++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java
@@ -17,13 +17,10 @@
package com.android.incallui;
import android.telecomm.CallAudioState;
-import android.telecomm.CallCapabilities;
import android.telecomm.CallState;
-import android.telecomm.GatewayInfo;
import android.telecomm.InCallAdapter;
import android.telecomm.InCallCall;
import android.telecomm.InCallService;
-import android.telephony.DisconnectCause;
import com.google.common.collect.ImmutableList;
@@ -68,7 +65,7 @@ public class InCallServiceImpl extends InCallService {
Log.i(this, "addCall: " + call);
if (call.getState() == Call.State.INCOMING) {
- CallList.getInstance().onIncoming(call, EMPTY_RESPONSE_TEXTS);
+ CallList.getInstance().onIncoming(call, call.getCannedSmsResponses());
} else {
CallList.getInstance().onUpdate(call);
}
@@ -122,6 +119,7 @@ public class InCallServiceImpl extends InCallService {
private void updateCall(Call call, InCallCall telecommCall) {
call.setHandle(telecommCall.getHandle());
call.setDisconnectCause(telecommCall.getDisconnectCauseCode());
+ call.setCannedSmsResponses(telecommCall.getCannedSmsResponses());
call.setCapabilities(telecommCall.getCapabilities());
call.setConnectTimeMillis(telecommCall.getConnectTimeMillis());
call.setGatewayInfo(telecommCall.getGatewayInfo());
diff --git a/InCallUI/src/com/android/incallui/TelecommAdapter.java b/InCallUI/src/com/android/incallui/TelecommAdapter.java
index 4b0aff3cb..1b50c034f 100644
--- a/InCallUI/src/com/android/incallui/TelecommAdapter.java
+++ b/InCallUI/src/com/android/incallui/TelecommAdapter.java
@@ -61,8 +61,7 @@ final class TelecommAdapter {
void rejectCall(String callId, boolean rejectWithMessage, String message) {
if (mAdapter != null) {
- // TODO(sail): Add support for reject with message.
- mAdapter.rejectCall(callId);
+ mAdapter.rejectCall(callId, rejectWithMessage, message);
} else {
Log.e(this, "error rejectCall, mAdapter is null");
}