* commit '2ace3d4803fff437387d36f27dab05f1c159b710': Make add-call a global property of telecom. (1/4)
This commit is contained in:
@@ -28314,8 +28314,7 @@ package android.telecom {
|
|||||||
|
|
||||||
public final class PhoneCapabilities {
|
public final class PhoneCapabilities {
|
||||||
method public static java.lang.String toString(int);
|
method public static java.lang.String toString(int);
|
||||||
field public static final int ADD_CALL = 16; // 0x10
|
field public static final int ALL = 12527; // 0x30ef
|
||||||
field public static final int ALL = 12543; // 0x30ff
|
|
||||||
field public static final int DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
|
field public static final int DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
|
||||||
field public static final int HOLD = 1; // 0x1
|
field public static final int HOLD = 1; // 0x1
|
||||||
field public static final int MANAGE_CONFERENCE = 128; // 0x80
|
field public static final int MANAGE_CONFERENCE = 128; // 0x80
|
||||||
|
|||||||
@@ -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_SET_POST_DIAL_WAIT = 4;
|
||||||
private static final int MSG_ON_AUDIO_STATE_CHANGED = 5;
|
private static final int MSG_ON_AUDIO_STATE_CHANGED = 5;
|
||||||
private static final int MSG_BRING_TO_FOREGROUND = 6;
|
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. */
|
/** Default Handler used to consolidate binder method calls onto a single thread. */
|
||||||
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||||
@@ -91,6 +92,9 @@ public abstract class InCallService extends Service {
|
|||||||
case MSG_BRING_TO_FOREGROUND:
|
case MSG_BRING_TO_FOREGROUND:
|
||||||
mPhone.internalBringToForeground(msg.arg1 == 1);
|
mPhone.internalBringToForeground(msg.arg1 == 1);
|
||||||
break;
|
break;
|
||||||
|
case MSG_ON_CAN_ADD_CALL_CHANGED:
|
||||||
|
mPhone.internalSetCanAddCall(msg.arg1 == 1);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -136,6 +140,12 @@ public abstract class InCallService extends Service {
|
|||||||
public void bringToForeground(boolean showDialpad) {
|
public void bringToForeground(boolean showDialpad) {
|
||||||
mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget();
|
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;
|
private Phone mPhone;
|
||||||
|
|||||||
@@ -74,6 +74,16 @@ public final class Phone {
|
|||||||
* @param call A newly removed {@code Call}.
|
* @param call A newly removed {@code Call}.
|
||||||
*/
|
*/
|
||||||
public void onCallRemoved(Phone phone, Call 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
|
// 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 final List<Listener> mListeners = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
|
private boolean mCanAddCall = true;
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
Phone(InCallAdapter adapter) {
|
Phone(InCallAdapter adapter) {
|
||||||
mInCallAdapter = adapter;
|
mInCallAdapter = adapter;
|
||||||
@@ -149,6 +161,14 @@ public final class Phone {
|
|||||||
fireBringToForeground(showDialpad);
|
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.
|
* Called to destroy the phone and cleanup any lingering calls.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -190,6 +210,15 @@ public final class Phone {
|
|||||||
return mUnmodifiableCalls;
|
return mUnmodifiableCalls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Sets the microphone mute state. When this request is honored, there will be change to
|
||||||
* the {@link #getAudioState()}.
|
* 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) {
|
private void checkCallTree(ParcelableCall parcelableCall) {
|
||||||
if (parcelableCall.getParentCallId() != null &&
|
if (parcelableCall.getParentCallId() != null &&
|
||||||
!mCallByTelecomCallId.containsKey(parcelableCall.getParentCallId())) {
|
!mCallByTelecomCallId.containsKey(parcelableCall.getParentCallId())) {
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ public final class PhoneCapabilities {
|
|||||||
*/
|
*/
|
||||||
public static final int SWAP_CONFERENCE = 0x00000008;
|
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. */
|
/** Call supports responding via text option. */
|
||||||
public static final int RESPOND_VIA_TEXT = 0x00000020;
|
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 DISCONNECT_FROM_CONFERENCE = 0x00002000;
|
||||||
|
|
||||||
public static final int ALL = HOLD | SUPPORT_HOLD | MERGE_CONFERENCE | SWAP_CONFERENCE
|
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;
|
| DISCONNECT_FROM_CONFERENCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,9 +138,6 @@ public final class PhoneCapabilities {
|
|||||||
if (can(capabilities, SWAP_CONFERENCE)) {
|
if (can(capabilities, SWAP_CONFERENCE)) {
|
||||||
builder.append(" SWAP_CONFERENCE");
|
builder.append(" SWAP_CONFERENCE");
|
||||||
}
|
}
|
||||||
if (can(capabilities, ADD_CALL)) {
|
|
||||||
builder.append(" ADD_CALL");
|
|
||||||
}
|
|
||||||
if (can(capabilities, RESPOND_VIA_TEXT)) {
|
if (can(capabilities, RESPOND_VIA_TEXT)) {
|
||||||
builder.append(" RESPOND_VIA_TEXT");
|
builder.append(" RESPOND_VIA_TEXT");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,4 +43,6 @@ oneway interface IInCallService {
|
|||||||
void onAudioStateChanged(in AudioState audioState);
|
void onAudioStateChanged(in AudioState audioState);
|
||||||
|
|
||||||
void bringToForeground(boolean showDialpad);
|
void bringToForeground(boolean showDialpad);
|
||||||
|
|
||||||
|
void onCanAddCallChanged(boolean canAddCall);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user