summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-10-07 01:04:30 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-07 01:04:30 +0000
commit0b27c283771e3690f47900d0c2130ae10af332a5 (patch)
tree9998c5bcc06620cfe20e896e5332a161afb1ef2e /telecomm/java/android
parentfcc059dcf0d84a77d9c2b5ef3b01c23afe25f72c (diff)
parent7e552595bda0825787820e3d9bb58b5fad32cd01 (diff)
downloadframeworks_base-0b27c283771e3690f47900d0c2130ae10af332a5.zip
frameworks_base-0b27c283771e3690f47900d0c2130ae10af332a5.tar.gz
frameworks_base-0b27c283771e3690f47900d0c2130ae10af332a5.tar.bz2
am 7e552595: am 4c334f3d: Merge "Add ability to add sim-initiated MO call to UI (2/4)" into lmp-dev
* commit '7e552595bda0825787820e3d9bb58b5fad32cd01': Add ability to add sim-initiated MO call to UI (2/4)
Diffstat (limited to 'telecomm/java/android')
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java36
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java3
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java36
3 files changed, 67 insertions, 8 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index ab9da08..5ca64cb 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -101,12 +101,14 @@ public abstract class ConnectionService extends Service {
PhoneAccountHandle connectionManagerPhoneAccount,
String id,
ConnectionRequest request,
- boolean isIncoming) {
+ boolean isIncoming,
+ boolean isUnknown) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = connectionManagerPhoneAccount;
args.arg2 = id;
args.arg3 = request;
args.argi1 = isIncoming ? 1 : 0;
+ args.argi2 = isUnknown ? 1 : 0;
mHandler.obtainMessage(MSG_CREATE_CONNECTION, args).sendToTarget();
}
@@ -218,6 +220,7 @@ public abstract class ConnectionService extends Service {
final String id = (String) args.arg2;
final ConnectionRequest request = (ConnectionRequest) args.arg3;
final boolean isIncoming = args.argi1 == 1;
+ final boolean isUnknown = args.argi2 == 1;
if (!mAreAccountsInitialized) {
Log.d(this, "Enqueueing pre-init request %s", id);
mPreInitializationConnectionRequests.add(new Runnable() {
@@ -227,7 +230,8 @@ public abstract class ConnectionService extends Service {
connectionManagerPhoneAccount,
id,
request,
- isIncoming);
+ isIncoming,
+ isUnknown);
}
});
} else {
@@ -235,7 +239,8 @@ public abstract class ConnectionService extends Service {
connectionManagerPhoneAccount,
id,
request,
- isIncoming);
+ isIncoming,
+ isUnknown);
}
} finally {
args.recycle();
@@ -520,12 +525,14 @@ public abstract class ConnectionService extends Service {
final PhoneAccountHandle callManagerAccount,
final String callId,
final ConnectionRequest request,
- boolean isIncoming) {
+ boolean isIncoming,
+ boolean isUnknown) {
Log.d(this, "createConnection, callManagerAccount: %s, callId: %s, request: %s, " +
- "isIncoming: %b", callManagerAccount, callId, request, isIncoming);
+ "isIncoming: %b, isUnknown: %b", callManagerAccount, callId, request, isIncoming,
+ isUnknown);
- Connection connection = isIncoming
- ? onCreateIncomingConnection(callManagerAccount, request)
+ Connection connection = isUnknown ? onCreateUnknownConnection(callManagerAccount, request)
+ : isIncoming ? onCreateIncomingConnection(callManagerAccount, request)
: onCreateOutgoingConnection(callManagerAccount, request);
Log.d(this, "createConnection, connection: %s", connection);
if (connection == null) {
@@ -870,6 +877,21 @@ public abstract class ConnectionService extends Service {
}
/**
+ * Create a {@code Connection} for a new unknown call. An unknown call is a call originating
+ * from the ConnectionService that was neither a user-initiated outgoing call, nor an incoming
+ * call created using
+ * {@code TelecomManager#addNewIncomingCall(PhoneAccountHandle, android.os.Bundle)}.
+ *
+ * @param connectionManagerPhoneAccount
+ * @param request
+ * @return
+ */
+ public Connection onCreateUnknownConnection(PhoneAccountHandle connectionManagerPhoneAccount,
+ ConnectionRequest request) {
+ return null;
+ }
+
+ /**
* Conference two specified connections. Invoked when the user has made a request to merge the
* specified connections into a conference call. In response, the connection service should
* create an instance of {@link Conference} and pass it into {@link #addConference}.
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index 328dc86..de1dc17 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -348,7 +348,8 @@ final class RemoteConnectionService {
connectionManagerPhoneAccount,
id,
newRequest,
- isIncoming);
+ isIncoming,
+ false /* isUnknownCall */);
connection.registerCallback(new RemoteConnection.Callback() {
@Override
public void onDestroyed(RemoteConnection connection) {
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 57b48ef..168ac41 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -51,6 +51,13 @@ public class TelecomManager {
public static final String ACTION_INCOMING_CALL = "android.telecom.action.INCOMING_CALL";
/**
+ * Similar to {@link #ACTION_INCOMING_CALL}, but is used only by Telephony to add a new
+ * sim-initiated MO call for carrier testing.
+ * @hide
+ */
+ public static final String ACTION_NEW_UNKNOWN_CALL = "android.telecom.action.NEW_UNKNOWN_CALL";
+
+ /**
* The {@link android.content.Intent} action used to configure a
* {@link android.telecom.ConnectionService}.
*/
@@ -122,6 +129,12 @@ public class TelecomManager {
"android.telecom.extra.OUTGOING_CALL_EXTRAS";
/**
+ * @hide
+ */
+ public static final String EXTRA_UNKNOWN_CALL_HANDLE =
+ "android.telecom.extra.UNKNOWN_CALL_HANDLE";
+
+ /**
* Optional extra for {@link android.telephony.TelephonyManager#ACTION_PHONE_STATE_CHANGED}
* containing the disconnect code.
*/
@@ -802,6 +815,29 @@ public class TelecomManager {
}
/**
+ * Registers a new unknown call with Telecom. This can only be called by the system Telephony
+ * service. This is invoked when Telephony detects a new unknown connection that was neither
+ * a new incoming call, nor an user-initiated outgoing call.
+ *
+ * @param phoneAccount A {@link PhoneAccountHandle} registered with
+ * {@link #registerPhoneAccount}.
+ * @param extras A bundle that will be passed through to
+ * {@link ConnectionService#onCreateIncomingConnection}.
+ * @hide
+ */
+ @SystemApi
+ public void addNewUnknownCall(PhoneAccountHandle phoneAccount, Bundle extras) {
+ try {
+ if (isServiceConnected()) {
+ getTelecomService().addNewUnknownCall(
+ phoneAccount, extras == null ? new Bundle() : extras);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException adding a new unknown call: " + phoneAccount, e);
+ }
+ }
+
+ /**
* Processes the specified dial string as an MMI code.
* MMI codes are any sequence of characters entered into the dialpad that contain a "*" or "#".
* Some of these sequences launch special behavior through handled by Telephony.