summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android/telecom
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java/android/telecom')
-rw-r--r--telecomm/java/android/telecom/Call.java9
-rw-r--r--telecomm/java/android/telecom/CallState.java12
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java38
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java5
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java36
5 files changed, 91 insertions, 9 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index a71161a..f934963 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -81,6 +81,13 @@ public final class Call {
public static final int STATE_CONNECTING = 9;
/**
+ * The state of a {@code Call} when the user has initiated a disconnection of the call, but the
+ * call has not yet been disconnected by the underlying {@code ConnectionService}. The next
+ * state of the call is (potentially) {@link #STATE_DISCONNECTED}.
+ */
+ public static final int STATE_DISCONNECTING = 10;
+
+ /**
* The key to retrieve the optional {@code PhoneAccount}s Telecom can bundle with its Call
* extras. Used to pass the phone accounts to display on the front end to the user in order to
* select phone accounts to (for example) place a call.
@@ -828,6 +835,8 @@ public final class Call {
return STATE_DISCONNECTED;
case CallState.ABORTED:
return STATE_DISCONNECTED;
+ case CallState.DISCONNECTING:
+ return STATE_DISCONNECTING;
default:
Log.wtf(this, "Unrecognized CallState %s", parcelableCallState);
return STATE_NEW;
diff --git a/telecomm/java/android/telecom/CallState.java b/telecomm/java/android/telecom/CallState.java
index 7690847..bd9223a 100644
--- a/telecomm/java/android/telecom/CallState.java
+++ b/telecomm/java/android/telecom/CallState.java
@@ -100,6 +100,16 @@ public final class CallState {
*/
public static final int ABORTED = 8;
+ /**
+ * Indicates that the call is in the process of being disconnected and will transition next
+ * to a {@link #DISCONNECTED} state.
+ * <p>
+ * This state is not expected to be communicated from the Telephony layer, but will be reported
+ * to the InCall UI for calls where disconnection has been initiated by the user but the
+ * ConnectionService has confirmed the call as disconnected.
+ */
+ public static final int DISCONNECTING = 9;
+
public static String toString(int callState) {
switch (callState) {
case NEW:
@@ -120,6 +130,8 @@ public final class CallState {
return "DISCONNECTED";
case ABORTED:
return "ABORTED";
+ case DISCONNECTING:
+ return "DISCONNECTING";
default:
return "UNKNOWN";
}
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index efd311e..6eee99d 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -104,12 +104,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();
}
@@ -221,6 +223,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() {
@@ -230,7 +233,8 @@ public abstract class ConnectionService extends Service {
connectionManagerPhoneAccount,
id,
request,
- isIncoming);
+ isIncoming,
+ isUnknown);
}
});
} else {
@@ -238,7 +242,8 @@ public abstract class ConnectionService extends Service {
connectionManagerPhoneAccount,
id,
request,
- isIncoming);
+ isIncoming,
+ isUnknown);
}
} finally {
args.recycle();
@@ -523,12 +528,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) {
@@ -873,6 +880,23 @@ 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
+ *
+ * @hide
+ */
+ 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..af4ee22 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) {
@@ -364,7 +365,7 @@ final class RemoteConnectionService {
}
private boolean hasConnection(String callId) {
- return mConferenceById.containsKey(callId);
+ return mConnectionById.containsKey(callId);
}
private RemoteConnection findConnectionForAction(
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index da95af3..0d37f09 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}.
* @hide
@@ -125,6 +132,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.
*/
@@ -859,6 +872,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.