diff options
author | Santos Cordon <santoscordon@google.com> | 2014-11-07 16:05:09 -0800 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-11-10 19:19:35 +0000 |
commit | 6c912b7d056c67b41fd46f31de168795e97c2336 (patch) | |
tree | 182a16d973f9edb039694f3c8cf2c6208d68663d /telecomm/java/android/telecom | |
parent | a0ecc714c3aeaaa05649e0ab1f054cc8efbb126f (diff) | |
download | frameworks_base-6c912b7d056c67b41fd46f31de168795e97c2336.zip frameworks_base-6c912b7d056c67b41fd46f31de168795e97c2336.tar.gz frameworks_base-6c912b7d056c67b41fd46f31de168795e97c2336.tar.bz2 |
Make add-call a global property of telecom. (1/4)
ADD_CALL didn't make sense as a property of Connection or Call.
This changes it to be a global property instead.
Bug: 18285352
Change-Id: I658e7a6977a848600272cde2914612c8691bb801
Diffstat (limited to 'telecomm/java/android/telecom')
-rw-r--r-- | telecomm/java/android/telecom/InCallService.java | 10 | ||||
-rw-r--r-- | telecomm/java/android/telecom/Phone.java | 35 | ||||
-rw-r--r-- | telecomm/java/android/telecom/PhoneCapabilities.java | 11 |
3 files changed, 50 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"); } |