* commit '7e552595bda0825787820e3d9bb58b5fad32cd01': Add ability to add sim-initiated MO call to UI (2/4)
This commit is contained in:
@@ -101,12 +101,14 @@ public abstract class ConnectionService extends Service {
|
|||||||
PhoneAccountHandle connectionManagerPhoneAccount,
|
PhoneAccountHandle connectionManagerPhoneAccount,
|
||||||
String id,
|
String id,
|
||||||
ConnectionRequest request,
|
ConnectionRequest request,
|
||||||
boolean isIncoming) {
|
boolean isIncoming,
|
||||||
|
boolean isUnknown) {
|
||||||
SomeArgs args = SomeArgs.obtain();
|
SomeArgs args = SomeArgs.obtain();
|
||||||
args.arg1 = connectionManagerPhoneAccount;
|
args.arg1 = connectionManagerPhoneAccount;
|
||||||
args.arg2 = id;
|
args.arg2 = id;
|
||||||
args.arg3 = request;
|
args.arg3 = request;
|
||||||
args.argi1 = isIncoming ? 1 : 0;
|
args.argi1 = isIncoming ? 1 : 0;
|
||||||
|
args.argi2 = isUnknown ? 1 : 0;
|
||||||
mHandler.obtainMessage(MSG_CREATE_CONNECTION, args).sendToTarget();
|
mHandler.obtainMessage(MSG_CREATE_CONNECTION, args).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,6 +220,7 @@ public abstract class ConnectionService extends Service {
|
|||||||
final String id = (String) args.arg2;
|
final String id = (String) args.arg2;
|
||||||
final ConnectionRequest request = (ConnectionRequest) args.arg3;
|
final ConnectionRequest request = (ConnectionRequest) args.arg3;
|
||||||
final boolean isIncoming = args.argi1 == 1;
|
final boolean isIncoming = args.argi1 == 1;
|
||||||
|
final boolean isUnknown = args.argi2 == 1;
|
||||||
if (!mAreAccountsInitialized) {
|
if (!mAreAccountsInitialized) {
|
||||||
Log.d(this, "Enqueueing pre-init request %s", id);
|
Log.d(this, "Enqueueing pre-init request %s", id);
|
||||||
mPreInitializationConnectionRequests.add(new Runnable() {
|
mPreInitializationConnectionRequests.add(new Runnable() {
|
||||||
@@ -227,7 +230,8 @@ public abstract class ConnectionService extends Service {
|
|||||||
connectionManagerPhoneAccount,
|
connectionManagerPhoneAccount,
|
||||||
id,
|
id,
|
||||||
request,
|
request,
|
||||||
isIncoming);
|
isIncoming,
|
||||||
|
isUnknown);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -235,7 +239,8 @@ public abstract class ConnectionService extends Service {
|
|||||||
connectionManagerPhoneAccount,
|
connectionManagerPhoneAccount,
|
||||||
id,
|
id,
|
||||||
request,
|
request,
|
||||||
isIncoming);
|
isIncoming,
|
||||||
|
isUnknown);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
args.recycle();
|
args.recycle();
|
||||||
@@ -520,12 +525,14 @@ public abstract class ConnectionService extends Service {
|
|||||||
final PhoneAccountHandle callManagerAccount,
|
final PhoneAccountHandle callManagerAccount,
|
||||||
final String callId,
|
final String callId,
|
||||||
final ConnectionRequest request,
|
final ConnectionRequest request,
|
||||||
boolean isIncoming) {
|
boolean isIncoming,
|
||||||
|
boolean isUnknown) {
|
||||||
Log.d(this, "createConnection, callManagerAccount: %s, callId: %s, request: %s, " +
|
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
|
Connection connection = isUnknown ? onCreateUnknownConnection(callManagerAccount, request)
|
||||||
? onCreateIncomingConnection(callManagerAccount, request)
|
: isIncoming ? onCreateIncomingConnection(callManagerAccount, request)
|
||||||
: onCreateOutgoingConnection(callManagerAccount, request);
|
: onCreateOutgoingConnection(callManagerAccount, request);
|
||||||
Log.d(this, "createConnection, connection: %s", connection);
|
Log.d(this, "createConnection, connection: %s", connection);
|
||||||
if (connection == null) {
|
if (connection == null) {
|
||||||
@@ -869,6 +876,21 @@ public abstract class ConnectionService extends Service {
|
|||||||
return null;
|
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
|
* 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
|
* specified connections into a conference call. In response, the connection service should
|
||||||
|
|||||||
@@ -348,7 +348,8 @@ final class RemoteConnectionService {
|
|||||||
connectionManagerPhoneAccount,
|
connectionManagerPhoneAccount,
|
||||||
id,
|
id,
|
||||||
newRequest,
|
newRequest,
|
||||||
isIncoming);
|
isIncoming,
|
||||||
|
false /* isUnknownCall */);
|
||||||
connection.registerCallback(new RemoteConnection.Callback() {
|
connection.registerCallback(new RemoteConnection.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyed(RemoteConnection connection) {
|
public void onDestroyed(RemoteConnection connection) {
|
||||||
|
|||||||
@@ -50,6 +50,13 @@ public class TelecomManager {
|
|||||||
*/
|
*/
|
||||||
public static final String ACTION_INCOMING_CALL = "android.telecom.action.INCOMING_CALL";
|
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
|
* The {@link android.content.Intent} action used to configure a
|
||||||
* {@link android.telecom.ConnectionService}.
|
* {@link android.telecom.ConnectionService}.
|
||||||
@@ -121,6 +128,12 @@ public class TelecomManager {
|
|||||||
public static final String EXTRA_OUTGOING_CALL_EXTRAS =
|
public static final String EXTRA_OUTGOING_CALL_EXTRAS =
|
||||||
"android.telecom.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}
|
* Optional extra for {@link android.telephony.TelephonyManager#ACTION_PHONE_STATE_CHANGED}
|
||||||
* containing the disconnect code.
|
* containing the disconnect code.
|
||||||
@@ -801,6 +814,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.
|
* Processes the specified dial string as an MMI code.
|
||||||
* MMI codes are any sequence of characters entered into the dialpad that contain a "*" or "#".
|
* 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,
|
in PhoneAccountHandle connectionManagerPhoneAccount,
|
||||||
String callId,
|
String callId,
|
||||||
in ConnectionRequest request,
|
in ConnectionRequest request,
|
||||||
boolean isIncoming);
|
boolean isIncoming,
|
||||||
|
boolean isUnknown);
|
||||||
|
|
||||||
void abort(String callId);
|
void abort(String callId);
|
||||||
|
|
||||||
|
|||||||
@@ -177,4 +177,9 @@ interface ITelecomService {
|
|||||||
* @see TelecomServiceImpl#addNewIncomingCall
|
* @see TelecomServiceImpl#addNewIncomingCall
|
||||||
*/
|
*/
|
||||||
void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras);
|
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