summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep Kunta <skunta@codeaurora.org>2014-09-01 17:21:05 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:28:18 -0600
commit2f7270f2add532423ba4afe14518a24fdc32d7a0 (patch)
treec7a8365f5eb6f3a042581cce50a7dc90f2867be7
parent551189e78d24402f2f4739b1e258d028c05351f4 (diff)
downloadframeworks_base-2f7270f2add532423ba4afe14518a24fdc32d7a0.zip
frameworks_base-2f7270f2add532423ba4afe14518a24fdc32d7a0.tar.gz
frameworks_base-2f7270f2add532423ba4afe14518a24fdc32d7a0.tar.bz2
MSIM: Add support for DSDA.
1. Interface changes to inform local call hold and setActiveSubscription to telephony service from telecomm service. 2. Interface in Telecomm manager to query active subscription and switch to other subscription. 3. Add support in PhoneAccount to maintain LCH & active subscription information. 4. Interface changes to inform sub switch between inCallUI and Telecomm service. Change-Id: I942122eab45a19ea30abc92c90228d9115c1df78
-rw-r--r--media/java/android/media/ToneGenerator.java13
-rw-r--r--telecomm/java/android/telecom/Call.java32
-rw-r--r--telecomm/java/android/telecom/Connection.java6
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java25
-rw-r--r--telecomm/java/android/telecom/InCallAdapter.java13
-rw-r--r--telecomm/java/android/telecom/InCallService.java12
-rw-r--r--telecomm/java/android/telecom/ParcelableCall.java17
-rw-r--r--telecomm/java/android/telecom/Phone.java12
-rw-r--r--telecomm/java/android/telecom/PhoneAccount.java38
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java32
-rw-r--r--telecomm/java/com/android/internal/telecom/IConnectionService.aidl2
-rw-r--r--telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl2
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl10
13 files changed, 207 insertions, 7 deletions
diff --git a/media/java/android/media/ToneGenerator.java b/media/java/android/media/ToneGenerator.java
index 4661226..05e4471 100644
--- a/media/java/android/media/ToneGenerator.java
+++ b/media/java/android/media/ToneGenerator.java
@@ -728,13 +728,24 @@ public class ToneGenerator
* @see #ToneGenerator(int, int)
*/
public static final int TONE_CDMA_SIGNAL_OFF = 98;
+ /**
+ * SUPERVISORY_CH - 440Hz
+ *
+ * @hide #ToneGenerator(int, int)
+ */
+ public static final int TONE_SUPERVISORY_CH = 100;
+ /**
+ * HOLD_RECALL - 440Hz
+ *
+ * @hide #ToneGenerator(int, int)
+ */
+ public static final int TONE_HOLD_RECALL = 101;
/** Maximum volume, for use with {@link #ToneGenerator(int,int)} */
public static final int MAX_VOLUME = 100;
/** Minimum volume setting, for use with {@link #ToneGenerator(int,int)} */
public static final int MIN_VOLUME = 0;
-
/**
* ToneGenerator class contructor specifying output stream type and volume.
*
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 8e2af98..b2fccb4 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -691,6 +691,28 @@ public final class Call {
private Details mDetails;
/**
+ * when mIsActiveSub True indicates this call belongs to active subscription
+ * Calls belonging to active subscription are shown to user.
+ */
+ private boolean mIsActiveSub = false;
+
+ /**
+ * Set this call object as active subscription.
+ * @hide
+ */
+ public void setActive() {
+ mIsActiveSub = true;
+ }
+
+ /**
+ * return if this call object belongs to active subscription.
+ * @hide
+ */
+ public boolean isActive() {
+ return mIsActiveSub;
+ }
+
+ /**
* Obtains the post-dial sequence remaining to be emitted by this {@code Call}, if any.
*
* @return The remaining post-dial sequence, or {@code null} if there is no post-dial sequence
@@ -980,19 +1002,22 @@ public final class Call {
}
/** {@hide} */
- Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter) {
+ Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter, boolean isActiveSub) {
mPhone = phone;
mTelecomCallId = telecomCallId;
mInCallAdapter = inCallAdapter;
mState = STATE_NEW;
+ mIsActiveSub = isActiveSub;
}
/** {@hide} */
- Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter, int state) {
+ Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter, int state,
+ boolean isActiveSub) {
mPhone = phone;
mTelecomCallId = telecomCallId;
mInCallAdapter = inCallAdapter;
mState = state;
+ mIsActiveSub = isActiveSub;
}
/** {@hide} */
@@ -1037,9 +1062,10 @@ public final class Call {
}
int state = parcelableCall.getState();
- boolean stateChanged = mState != state;
+ boolean stateChanged = (mState != state) || (mIsActiveSub != parcelableCall.isActive());
if (stateChanged) {
mState = state;
+ mIsActiveSub = parcelableCall.isActive();
}
String parentId = parcelableCall.getParentCallId();
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index a52ea3f..dce47c9 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -1719,6 +1719,12 @@ public abstract class Connection extends Conferenceable {
public void onStopDtmfTone() {}
/**
+ * Notifies this to set local call hold.
+ * {@hide}
+ */
+ public void setLocalCallHold(boolean lchState) {}
+
+ /**
* Notifies this Connection of a request to disconnect.
*/
public void onDisconnect() {}
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 383e45b..fe399b4 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -101,6 +101,7 @@ public abstract class ConnectionService extends Service {
private static final int MSG_ANSWER_VIDEO = 17;
private static final int MSG_MERGE_CONFERENCE = 18;
private static final int MSG_SWAP_CONFERENCE = 19;
+ private static final int MSG_SET_LOCAL_HOLD = 20;
private static Connection sNullConnection;
@@ -199,6 +200,14 @@ public abstract class ConnectionService extends Service {
}
@Override
+ public void setLocalCallHold(String callId, boolean lchState) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = callId;
+ args.argi1 = lchState ? 1 : 0;
+ mHandler.obtainMessage(MSG_SET_LOCAL_HOLD, args).sendToTarget();
+ }
+
+ @Override
public void conference(String callId1, String callId2) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId1;
@@ -322,6 +331,17 @@ public abstract class ConnectionService extends Service {
case MSG_STOP_DTMF_TONE:
stopDtmfTone((String) msg.obj);
break;
+ case MSG_SET_LOCAL_HOLD: {
+ SomeArgs args = (SomeArgs) msg.obj;
+ try {
+ String callId = (String) args.arg1;
+ boolean lchStatus = (args.argi1 == 1);
+ setLocalCallHold(callId, lchStatus);
+ } finally {
+ args.recycle();
+ }
+ break;
+ }
case MSG_CONFERENCE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
@@ -737,6 +757,11 @@ public abstract class ConnectionService extends Service {
}
}
+ private void setLocalCallHold(String callId, boolean lchStatus) {
+ Log.d(this, "setLocalCallHold %s", callId);
+ findConnectionForAction(callId, "setLocalCallHold").setLocalCallHold(lchStatus);
+ }
+
private void conference(String callId1, String callId2) {
Log.d(this, "conference %s, %s", callId1, callId2);
diff --git a/telecomm/java/android/telecom/InCallAdapter.java b/telecomm/java/android/telecom/InCallAdapter.java
index 0cf7212..7d0f5a7 100644
--- a/telecomm/java/android/telecom/InCallAdapter.java
+++ b/telecomm/java/android/telecom/InCallAdapter.java
@@ -273,4 +273,17 @@ public final class InCallAdapter {
} catch (RemoteException ignored) {
}
}
+
+ /**
+ * Instructs Telecomm to switch to other active subscripion
+ *
+ * @param subid switch to subscription denoted by subId
+ * {@hide}
+ */
+ public void switchToOtherActiveSub(String subId) {
+ try {
+ mAdapter.switchToOtherActiveSub(subId);
+ } catch (RemoteException e) {
+ }
+ }
}
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index 19c613d..b89490e 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -301,6 +301,18 @@ public abstract class InCallService extends Service {
}
/**
+ * Instructs Telecomm to switch to other active subscripion
+ *
+ * @param subId switch to this subscription
+ * @hide
+ */
+ public void switchToOtherActiveSub(String subId) {
+ if (mPhone != null) {
+ mPhone.switchToOtherActiveSub(subId);
+ }
+ }
+
+ /**
* Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will
* be change to the {@link #getCallAudioState()}.
*
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index 8cf4aeb..20a4455 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -56,6 +56,7 @@ public final class ParcelableCall implements Parcelable {
private final List<String> mConferenceableCallIds;
private final Bundle mIntentExtras;
private final Bundle mExtras;
+ private final boolean mIsActiveSub;
public ParcelableCall(
String id,
@@ -79,7 +80,8 @@ public final class ParcelableCall implements Parcelable {
int videoState,
List<String> conferenceableCallIds,
Bundle intentExtras,
- Bundle extras) {
+ Bundle extras,
+ boolean isActiveSub) {
mId = id;
mState = state;
mDisconnectCause = disconnectCause;
@@ -102,6 +104,7 @@ public final class ParcelableCall implements Parcelable {
mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
mIntentExtras = intentExtras;
mExtras = extras;
+ mIsActiveSub = isActiveSub;
}
/** The unique ID of the call. */
@@ -259,6 +262,13 @@ public final class ParcelableCall implements Parcelable {
return mIsVideoCallProviderChanged;
}
+ /**
+ * return if this call object belongs to active subscription.
+ */
+ public boolean isActive() {
+ return mIsActiveSub;
+ }
+
/** Responsible for creating ParcelableCall objects for deserialized Parcels. */
public static final Parcelable.Creator<ParcelableCall> CREATOR =
new Parcelable.Creator<ParcelableCall> () {
@@ -291,6 +301,7 @@ public final class ParcelableCall implements Parcelable {
source.readList(conferenceableCallIds, classLoader);
Bundle intentExtras = source.readBundle(classLoader);
Bundle extras = source.readBundle(classLoader);
+ boolean isActiveSub = (source.readInt() == 1) ? true : false;
return new ParcelableCall(
id,
state,
@@ -313,7 +324,8 @@ public final class ParcelableCall implements Parcelable {
videoState,
conferenceableCallIds,
intentExtras,
- extras);
+ extras,
+ isActiveSub);
}
@Override
@@ -354,6 +366,7 @@ public final class ParcelableCall implements Parcelable {
destination.writeList(mConferenceableCallIds);
destination.writeBundle(mIntentExtras);
destination.writeBundle(mExtras);
+ destination.writeInt(mIsActiveSub ? 1 : 0);
}
@Override
diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java
index 47154da..2ec6c91 100644
--- a/telecomm/java/android/telecom/Phone.java
+++ b/telecomm/java/android/telecom/Phone.java
@@ -123,7 +123,7 @@ public final class Phone {
final void internalAddCall(ParcelableCall parcelableCall) {
Call call = new Call(this, parcelableCall.getId(), mInCallAdapter,
- parcelableCall.getState());
+ parcelableCall.getState(), parcelableCall.isActive());
mCallByTelecomCallId.put(parcelableCall.getId(), call);
mCalls.add(call);
checkCallTree(parcelableCall);
@@ -280,6 +280,16 @@ public final class Phone {
}
/**
+ * Instructs Telecomm to switch to other active subscripion
+ *
+ * @param subId switch to this subscription
+ * {@hide}
+ */
+ public void switchToOtherActiveSub(String subId) {
+ mInCallAdapter.switchToOtherActiveSub(subId);
+ }
+
+ /**
* Obtains the current phone call audio state of the {@code Phone}.
*
* @return An object encapsulating the audio state.
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index cdb0bf2..f890f4d 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -34,6 +34,7 @@ import android.text.TextUtils;
import java.lang.String;
import java.util.ArrayList;
+import java.util.BitSet;
import java.util.Collections;
import java.util.List;
import java.util.MissingResourceException;
@@ -366,6 +367,43 @@ public final class PhoneAccount implements Parcelable {
}
/**
+ * Contains information related to
+ * LCH and ACTIVE.
+ */
+ private BitSet callsStatus = new BitSet();
+
+ /**
+ * {@hide}
+ */
+ public static final int LCH = 1;
+
+ /**
+ * {@hide}
+ */
+ public static final int ACTIVE = 2;
+
+ /**
+ * {@hide}
+ */
+ public void setBit(int bit) {
+ callsStatus.set(bit);
+ }
+
+ /**
+ * {@hide}
+ */
+ public void unSetBit(int bit) {
+ callsStatus.set(bit, false);
+ }
+
+ /**
+ * {@hide}
+ */
+ public boolean isSet(int bit) {
+ return callsStatus.get(bit);
+ }
+
+ /**
* Returns a builder initialized with the current {@link PhoneAccount} instance.
*
* @return The builder.
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 067e734..673adb2 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -22,6 +22,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -1039,6 +1040,37 @@ public class TelecomManager {
}
/**
+ * Returns current active subscription.
+ * Active subscription is the one from which calls are displayed to user when there are actve
+ * calls on both subscriptions.
+ * @hide
+ */
+ public int getActiveSubscription() {
+ try {
+ if (isServiceConnected()) {
+ return getTelecomService().getActiveSubscription();
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException attempting to get the active subsription.", e);
+ }
+ return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ }
+
+ /**
+ * switches to other active subscription.
+ * @hide
+ */
+ public void switchToOtherActiveSub(int subId) {
+ try {
+ if (isServiceConnected()) {
+ getTelecomService().switchToOtherActiveSub(subId);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException attempting to switchToOtherActiveSub.", e);
+ }
+ }
+
+ /**
* Registers a new incoming call. A {@link ConnectionService} should invoke this method when it
* has an incoming call. The specified {@link PhoneAccountHandle} must have been registered
* with {@link #registerPhoneAccount}. Once invoked, this method will cause the system to bind
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
index c2e8530..7dc062af 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl
@@ -71,4 +71,6 @@ oneway interface IConnectionService {
void swapConference(String conferenceCallId);
void onPostDialContinue(String callId, boolean proceed);
+
+ void setLocalCallHold(String callId, boolean lchState);
}
diff --git a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
index 863fff2..ee51efa 100644
--- a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl
@@ -60,4 +60,6 @@ oneway interface IInCallAdapter {
void turnOnProximitySensor();
void turnOffProximitySensor(boolean screenOnImmediately);
+
+ void switchToOtherActiveSub(String subId);
}
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index 2e07759..cad8c5d 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -232,4 +232,14 @@ interface ITelecomService {
* @see TelecomServiceImpl#setDefaultDialer
*/
boolean setDefaultDialer(in String packageName);
+
+ /**
+ * @see TelecommManager#getActiveSubscription
+ */
+ int getActiveSubscription();
+
+ /**
+ * @see TelecommManager#switchToOtherActiveSub
+ */
+ void switchToOtherActiveSub(int subId);
}