Add Connection.startActivityFromInCall
This CL adds a new public API to allow Connections to start an activity on top of the in-call UI. The Connection passes a PendingIntent to Telecomm which then forwards it on to InCallUI. The Connection can cancel the operation by calling PendingIntent.cancel(). This allows services like SIP and Hangouts to show dialogs to the user when making a call. Change-Id: I65119a89c925a93467d1b27304ffec9b088b172f
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.telecomm;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.net.Uri;
|
||||
import android.os.IBinder.DeathRecipient;
|
||||
@@ -63,6 +64,7 @@ final class RemoteConnectionService implements DeathRecipient {
|
||||
private static final int MSG_SET_STATUS_HINTS = 19;
|
||||
private static final int MSG_SET_HANDLE = 20;
|
||||
private static final int MSG_SET_CALLER_DISPLAY_NAME = 21;
|
||||
private static final int MSG_START_ACTIVITY_FROM_IN_CALL = 22;
|
||||
|
||||
private final IConnectionService mConnectionService;
|
||||
private final ComponentName mComponentName;
|
||||
@@ -221,8 +223,21 @@ final class RemoteConnectionService implements DeathRecipient {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_START_ACTIVITY_FROM_IN_CALL: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
try {
|
||||
if (isCurrentConnection(msg.arg1)) {
|
||||
mConnection.startActivityFromInCall((PendingIntent) args.arg2);
|
||||
}
|
||||
} finally {
|
||||
args.recycle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
private final IConnectionServiceAdapter mAdapter = new IConnectionServiceAdapter.Stub() {
|
||||
@@ -363,6 +378,14 @@ final class RemoteConnectionService implements DeathRecipient {
|
||||
args.argi1 = presentation;
|
||||
mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void startActivityFromInCall(String connectionId, PendingIntent intent) {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = connectionId;
|
||||
args.arg2 = intent;
|
||||
mHandler.obtainMessage(MSG_START_ACTIVITY_FROM_IN_CALL, args).sendToTarget();
|
||||
}
|
||||
};
|
||||
|
||||
RemoteConnectionService(ComponentName componentName, IConnectionService connectionService)
|
||||
|
||||
Reference in New Issue
Block a user