summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android/telecom/Phone.java
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java/android/telecom/Phone.java')
-rw-r--r--telecomm/java/android/telecom/Phone.java35
1 files changed, 35 insertions, 0 deletions
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())) {