Add ability to send video upgrade requests using TestVideoProvider
Bug: 20090411 Change-Id: I5db96fd41efc3baee0d80c73988cc0d6fba23b37
This commit is contained in:
parent
2a6985f675
commit
817090c6c6
|
@ -70,6 +70,11 @@
|
|||
<action android:name="android.telecom.testapps.ACTION_HANGUP_CALLS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.telecom.testapps.ACTION_SEND_UPGRADE_REQUEST" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:scheme="int" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:name="com.android.server.telecom.testapps.CallNotificationReceiver"
|
||||
|
|
|
@ -112,4 +112,11 @@ public class CallNotificationReceiver extends BroadcastReceiver {
|
|||
LocalBroadcastManager.getInstance(context).sendBroadcast(
|
||||
new Intent(TestCallActivity.ACTION_HANGUP_CALLS));
|
||||
}
|
||||
|
||||
public static void sendUpgradeRequest(Context context, Uri data) {
|
||||
Log.i(TAG, "Sending upgrade request of type: " + data);
|
||||
final Intent intent = new Intent(TestCallActivity.ACTION_SEND_UPGRADE_REQUEST);
|
||||
intent.setData(data);
|
||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,9 @@ public class TestCallActivity extends Activity {
|
|||
public static final String ACTION_HANGUP_CALLS =
|
||||
"android.telecom.testapps.ACTION_HANGUP_CALLS";
|
||||
|
||||
public static final String ACTION_SEND_UPGRADE_REQUEST =
|
||||
"android.telecom.testapps.ACTION_SEND_UPGRADE_REQUEST";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
@ -60,6 +63,8 @@ public class TestCallActivity extends Activity {
|
|||
CallNotificationReceiver.addNewUnknownCall(this, data, intent.getExtras());
|
||||
} else if (ACTION_HANGUP_CALLS.equals(action)) {
|
||||
CallNotificationReceiver.hangupCalls(this);
|
||||
} else if (ACTION_SEND_UPGRADE_REQUEST.equals(action)) {
|
||||
CallNotificationReceiver.sendUpgradeRequest(this, data);
|
||||
} else {
|
||||
CallServiceNotifier.getInstance().updateNotification(this);
|
||||
}
|
||||
|
|
|
@ -144,6 +144,15 @@ public class TestConnectionService extends ConnectionService {
|
|||
}
|
||||
};
|
||||
|
||||
private BroadcastReceiver mUpgradeRequestReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final int request = Integer.parseInt(intent.getData().getSchemeSpecificPart());
|
||||
final VideoProfile videoProfile = new VideoProfile(request);
|
||||
mTestVideoCallProvider.receiveSessionModifyRequest(videoProfile);
|
||||
}
|
||||
};
|
||||
|
||||
TestConnection(boolean isIncoming) {
|
||||
mIsIncoming = isIncoming;
|
||||
// Assume all calls are video capable.
|
||||
|
@ -158,6 +167,11 @@ public class TestConnectionService extends ConnectionService {
|
|||
|
||||
LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(
|
||||
mHangupReceiver, new IntentFilter(TestCallActivity.ACTION_HANGUP_CALLS));
|
||||
final IntentFilter filter =
|
||||
new IntentFilter(TestCallActivity.ACTION_SEND_UPGRADE_REQUEST);
|
||||
filter.addDataScheme("int");
|
||||
LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(
|
||||
mUpgradeRequestReceiver, filter);
|
||||
}
|
||||
|
||||
void startOutgoing() {
|
||||
|
@ -238,6 +252,8 @@ public class TestConnectionService extends ConnectionService {
|
|||
public void cleanup() {
|
||||
LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(
|
||||
mHangupReceiver);
|
||||
LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(
|
||||
mUpgradeRequestReceiver);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue