Merge "Add ability to add sim-initiated MO call to UI (2/4)" into lmp-dev
This commit is contained in:
@@ -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) {
|
||||
@@ -872,6 +879,21 @@ public abstract class ConnectionService extends Service {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -50,6 +50,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}.
|
||||
@@ -124,6 +131,12 @@ public class TelecomManager {
|
||||
public static final String EXTRA_OUTGOING_CALL_EXTRAS =
|
||||
"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.
|
||||
@@ -814,6 +827,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 "#".
|
||||
|
||||
@@ -39,7 +39,8 @@ oneway interface IConnectionService {
|
||||
in PhoneAccountHandle connectionManagerPhoneAccount,
|
||||
String callId,
|
||||
in ConnectionRequest request,
|
||||
boolean isIncoming);
|
||||
boolean isIncoming,
|
||||
boolean isUnknown);
|
||||
|
||||
void abort(String callId);
|
||||
|
||||
|
||||
@@ -177,4 +177,9 @@ interface ITelecomService {
|
||||
* @see TelecomServiceImpl#addNewIncomingCall
|
||||
*/
|
||||
void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras);
|
||||
|
||||
/**
|
||||
* @see TelecomServiceImpl#addNewUnknownCall
|
||||
*/
|
||||
void addNewUnknownCall(in PhoneAccountHandle phoneAccount, in Bundle extras);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user