summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/InCallService.java10
-rw-r--r--telecomm/java/android/telecom/Phone.java35
-rw-r--r--telecomm/java/android/telecom/PhoneCapabilities.java11
-rw-r--r--telecomm/java/com/android/internal/telecom/IInCallService.aidl2
4 files changed, 52 insertions, 6 deletions
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index 11da0f2..a85e84d 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -54,6 +54,7 @@ public abstract class InCallService extends Service {
private static final int MSG_SET_POST_DIAL_WAIT = 4;
private static final int MSG_ON_AUDIO_STATE_CHANGED = 5;
private static final int MSG_BRING_TO_FOREGROUND = 6;
+ private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7;
/** Default Handler used to consolidate binder method calls onto a single thread. */
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -91,6 +92,9 @@ public abstract class InCallService extends Service {
case MSG_BRING_TO_FOREGROUND:
mPhone.internalBringToForeground(msg.arg1 == 1);
break;
+ case MSG_ON_CAN_ADD_CALL_CHANGED:
+ mPhone.internalSetCanAddCall(msg.arg1 == 1);
+ break;
default:
break;
}
@@ -136,6 +140,12 @@ public abstract class InCallService extends Service {
public void bringToForeground(boolean showDialpad) {
mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget();
}
+
+ @Override
+ public void onCanAddCallChanged(boolean canAddCall) {
+ mHandler.obtainMessage(MSG_ON_CAN_ADD_CALL_CHANGED, canAddCall ? 1 : 0, 0)
+ .sendToTarget();
+ }
}
private Phone mPhone;
diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java
index 5131790..6344181 100644
--- a/telecomm/java/android/telecom/Phone.java
+++ b/telecomm/java/android/telecom/Phone.java
@@ -74,6 +74,16 @@ public final class Phone {
* @param call A newly removed {@code Call}.
*/
public void onCallRemoved(Phone phone, Call call) { }
+
+ /**
+ * Called when the {@code Phone} ability to add more calls changes. If the phone cannot
+ * support more calls then {@code canAddCall} is set to {@code false}. If it can, then it
+ * is set to {@code true}.
+ *
+ * @param phone The {@code Phone} calling this method.
+ * @param canAddCall Indicates whether an additional call can be added.
+ */
+ public void onCanAddCallChanged(Phone phone, boolean canAddCall) { }
}
// A Map allows us to track each Call by its Telecom-specified call ID
@@ -92,6 +102,8 @@ public final class Phone {
private final List<Listener> mListeners = new CopyOnWriteArrayList<>();
+ private boolean mCanAddCall = true;
+
/** {@hide} */
Phone(InCallAdapter adapter) {
mInCallAdapter = adapter;
@@ -149,6 +161,14 @@ public final class Phone {
fireBringToForeground(showDialpad);
}
+ /** {@hide} */
+ final void internalSetCanAddCall(boolean canAddCall) {
+ if (mCanAddCall != canAddCall) {
+ mCanAddCall = canAddCall;
+ fireCanAddCallChanged(canAddCall);
+ }
+ }
+
/**
* Called to destroy the phone and cleanup any lingering calls.
* @hide
@@ -191,6 +211,15 @@ public final class Phone {
}
/**
+ * Returns if the {@code Phone} can support additional calls.
+ *
+ * @return Whether the phone supports adding more calls.
+ */
+ public final boolean canAddCall() {
+ return mCanAddCall;
+ }
+
+ /**
* Sets the microphone mute state. When this request is honored, there will be change to
* the {@link #getAudioState()}.
*
@@ -266,6 +295,12 @@ public final class Phone {
}
}
+ private void fireCanAddCallChanged(boolean canAddCall) {
+ for (Listener listener : mListeners) {
+ listener.onCanAddCallChanged(this, canAddCall);
+ }
+ }
+
private void checkCallTree(ParcelableCall parcelableCall) {
if (parcelableCall.getParentCallId() != null &&
!mCallByTelecomCallId.containsKey(parcelableCall.getParentCallId())) {
diff --git a/telecomm/java/android/telecom/PhoneCapabilities.java b/telecomm/java/android/telecom/PhoneCapabilities.java
index 3d3c6bd..f61d39c 100644
--- a/telecomm/java/android/telecom/PhoneCapabilities.java
+++ b/telecomm/java/android/telecom/PhoneCapabilities.java
@@ -46,8 +46,10 @@ public final class PhoneCapabilities {
*/
public static final int SWAP_CONFERENCE = 0x00000008;
- /** Call currently supports adding another call to this one. */
- public static final int ADD_CALL = 0x00000010;
+ /**
+ * @hide
+ */
+ public static final int UNUSED = 0x00000010;
/** Call supports responding via text option. */
public static final int RESPOND_VIA_TEXT = 0x00000020;
@@ -96,7 +98,7 @@ public final class PhoneCapabilities {
public static final int DISCONNECT_FROM_CONFERENCE = 0x00002000;
public static final int ALL = HOLD | SUPPORT_HOLD | MERGE_CONFERENCE | SWAP_CONFERENCE
- | ADD_CALL | RESPOND_VIA_TEXT | MUTE | MANAGE_CONFERENCE | SEPARATE_FROM_CONFERENCE
+ | RESPOND_VIA_TEXT | MUTE | MANAGE_CONFERENCE | SEPARATE_FROM_CONFERENCE
| DISCONNECT_FROM_CONFERENCE;
/**
@@ -136,9 +138,6 @@ public final class PhoneCapabilities {
if (can(capabilities, SWAP_CONFERENCE)) {
builder.append(" SWAP_CONFERENCE");
}
- if (can(capabilities, ADD_CALL)) {
- builder.append(" ADD_CALL");
- }
if (can(capabilities, RESPOND_VIA_TEXT)) {
builder.append(" RESPOND_VIA_TEXT");
}
diff --git a/telecomm/java/com/android/internal/telecom/IInCallService.aidl b/telecomm/java/com/android/internal/telecom/IInCallService.aidl
index 35f6f65..d26f6cb 100644
--- a/telecomm/java/com/android/internal/telecom/IInCallService.aidl
+++ b/telecomm/java/com/android/internal/telecom/IInCallService.aidl
@@ -43,4 +43,6 @@ oneway interface IInCallService {
void onAudioStateChanged(in AudioState audioState);
void bringToForeground(boolean showDialpad);
+
+ void onCanAddCallChanged(boolean canAddCall);
}