summaryrefslogtreecommitdiffstats
path: root/telecomm/java
diff options
context:
space:
mode:
authorRavindra <c_rthat@codeaurora.org>2015-09-21 14:43:05 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:28:59 -0600
commitd13db38a856f92670566cc96f87c87846259c575 (patch)
tree99b0c6eb59cfa49932888a10cc158e4f49e64b9a /telecomm/java
parentc96a60e262093e2ae4e4f31349c1864ce83a5bfb (diff)
downloadframeworks_base-d13db38a856f92670566cc96f87c87846259c575.zip
frameworks_base-d13db38a856f92670566cc96f87c87846259c575.tar.gz
frameworks_base-d13db38a856f92670566cc96f87c87846259c575.tar.bz2
MSIM: set phone account handle changes for ECall
Add interface API between Telephony to Telecomm for updating phoneAcount. Currently on multisim, Telephony(PhoneApp) picks the best possible sub for placing emergency call, after selecting the best possible sub, Telephony uses this new interface API to update the phoneAcount handle to Telecomm which inturn helps to display the proper subId on which ECall placed. Add cause codes for EMERGENCY_TEMP_FAILURE and EMERGENCY_TEMP_FAILURE Change-Id: Ic0fdc01810ccc35479a1a9447c40e38122a155a9 CRs-Fixed: 722205,778800, 780893
Diffstat (limited to 'telecomm/java')
-rw-r--r--telecomm/java/android/telecom/Connection.java19
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java21
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapter.java10
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapterServant.java18
-rw-r--r--telecomm/java/android/telecom/RemoteConnection.java19
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java5
-rw-r--r--telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl3
7 files changed, 94 insertions, 1 deletions
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 9c2cfd5..27c92bf 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -455,6 +455,7 @@ public abstract class Connection extends Conferenceable {
public void onConferenceStarted() {}
public void onConferenceMergeFailed(Connection c) {}
public void onExtrasChanged(Connection c, Bundle extras) {}
+ public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {}
}
/**
@@ -1117,6 +1118,7 @@ public abstract class Connection extends Conferenceable {
private Conference mConference;
private ConnectionService mConnectionService;
private Bundle mExtras;
+ private PhoneAccountHandle mPhoneAccountHandle = null;
/**
* Create a new Connection.
@@ -1626,6 +1628,23 @@ public abstract class Connection extends Conferenceable {
}
/**
+ * @hide.
+ */
+ public final void setPhoneAccountHandle(PhoneAccountHandle pHandle) {
+ mPhoneAccountHandle = pHandle;
+ for (Listener l : mListeners) {
+ l.onPhoneAccountChanged(this, pHandle);
+ }
+ }
+
+ /**
+ * @hide.
+ */
+ public final PhoneAccountHandle getPhoneAccountHandle() {
+ return mPhoneAccountHandle;
+ }
+
+ /**
* @hide
*/
public final void setConnectionService(ConnectionService connectionService) {
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 13497d7..019839f 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -625,6 +625,13 @@ public abstract class ConnectionService extends Service {
mAdapter.setExtras(id, extras);
}
}
+
+ @Override
+ public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {
+ String id = mIdByConnection.get(c);
+ Log.i(this, "Adapter onPhoneAccountChanged %s, %s", c, pHandle);
+ mAdapter.setPhoneAccountHandle(id, pHandle);
+ }
};
/** {@inheritDoc} */
@@ -680,7 +687,7 @@ public abstract class ConnectionService extends Service {
callId,
request,
new ParcelableConnection(
- request.getAccountHandle(),
+ getAccountHandle(request, connection),
connection.getState(),
connection.getConnectionCapabilities(),
connection.getAddress(),
@@ -702,6 +709,18 @@ public abstract class ConnectionService extends Service {
}
}
+ /** @hide */
+ public PhoneAccountHandle getAccountHandle(
+ final ConnectionRequest request, Connection connection) {
+ PhoneAccountHandle pHandle = connection.getPhoneAccountHandle();
+ if (pHandle != null) {
+ Log.i(this, "getAccountHandle, return account handle from local, %s", pHandle);
+ return pHandle;
+ } else {
+ return request.getAccountHandle();
+ }
+ }
+
private void abort(String callId) {
Log.d(this, "abort %s", callId);
findConnectionForAction(callId, "abort").onAbort();
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index 4562514..8495f95 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -412,4 +412,14 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
}
}
+
+ void setPhoneAccountHandle(String callId, PhoneAccountHandle pHandle) {
+ Log.v(this, "setPhoneAccountHandle: %s, %s", callId, pHandle);
+ for (IConnectionServiceAdapter adapter : mAdapters) {
+ try {
+ adapter.setPhoneAccountHandle(callId, pHandle);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
index 293dc11..7162772 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
@@ -62,6 +62,7 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_ON_POST_DIAL_CHAR = 22;
private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23;
private static final int MSG_SET_EXTRAS = 24;
+ private static final int MSG_SET_PHONE_ACCOUNT = 25;
private final IConnectionServiceAdapter mDelegate;
@@ -223,6 +224,16 @@ final class ConnectionServiceAdapterServant {
}
break;
}
+ case MSG_SET_PHONE_ACCOUNT: {
+ SomeArgs args = (SomeArgs) msg.obj;
+ try {
+ mDelegate.setPhoneAccountHandle(
+ (String) args.arg1, (PhoneAccountHandle) args.arg2);
+ } finally {
+ args.recycle();
+ }
+ break;
+ }
case MSG_SET_CONFERENCE_MERGE_FAILED: {
SomeArgs args = (SomeArgs) msg.obj;
try {
@@ -419,6 +430,13 @@ final class ConnectionServiceAdapterServant {
args.arg2 = extras;
mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget();
}
+
+ public final void setPhoneAccountHandle(String connectionId, PhoneAccountHandle pHandle) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = connectionId;
+ args.arg2 = pHandle;
+ mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT, args).sendToTarget();
+ }
};
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index f960959..3cb8058 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -209,6 +209,11 @@ public final class RemoteConnection {
* @param extras The extras containing other information associated with the connection.
*/
public void onExtrasChanged(RemoteConnection connection, @Nullable Bundle extras) {}
+
+ /** @hide */
+ public void setPhoneAccountHandle(
+ RemoteConnection connection,
+ PhoneAccountHandle pHandle) {}
}
/**
@@ -1291,6 +1296,20 @@ public final class RemoteConnection {
}
}
+ /** @hide */
+ void setPhoneAccountHandle(final PhoneAccountHandle pHandle) {
+ for (CallbackRecord record : mCallbackRecords) {
+ final RemoteConnection connection = this;
+ final Callback callback = record.getCallback();
+ record.getHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ callback.setPhoneAccountHandle(connection, pHandle);
+ }
+ });
+ }
+ }
+
/**
* Create a RemoteConnection represents a failure, and which will be in
* {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index dc0de0c..c87b037 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -330,6 +330,11 @@ final class RemoteConnectionService {
.setExtras(extras);
}
}
+
+ public void setPhoneAccountHandle(String callId, PhoneAccountHandle pHandle) {
+ findConnectionForAction(callId, "setPhoneAccountHandle")
+ .setPhoneAccountHandle(pHandle);
+ }
};
private final ConnectionServiceAdapterServant mServant =
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
index 7647444..32c48b1 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
@@ -23,6 +23,7 @@ import android.telecom.ConnectionRequest;
import android.telecom.DisconnectCause;
import android.telecom.ParcelableConnection;
import android.telecom.ParcelableConference;
+import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints;
import com.android.internal.telecom.IVideoProvider;
@@ -86,4 +87,6 @@ oneway interface IConnectionServiceAdapter {
void addExistingConnection(String callId, in ParcelableConnection connection);
void setExtras(String callId, in Bundle extras);
+
+ void setPhoneAccountHandle(String callId, in PhoneAccountHandle pHandle);
}