Loading tests/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,11 @@ <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.telecomm.testapps.ACTION_START_INCOMING_CALL" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="tel" /> </intent-filter> </activity> <receiver android:name="com.android.telecomm.testapps.CallNotificationReceiver" Loading tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java +9 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.telecomm.PhoneAccountHandle; import android.telecomm.TelecommManager; Loading Loading @@ -55,19 +56,19 @@ public class CallNotificationReceiver extends BroadcastReceiver { } else if (ACTION_SHOW_ALL_PHONE_ACCOUNTS.equals(action)) { CallServiceNotifier.getInstance().showAllPhoneAccounts(context); } else if (ACTION_VIDEO_CALL.equals(action)) { sendIncomingCallIntent(context, true); sendIncomingCallIntent(context, null, true); } else if (ACTION_AUDIO_CALL.equals(action)) { sendIncomingCallIntent(context, false); sendIncomingCallIntent(context, null, false); } } /** * Creates the intent to add an incoming call through Telecomm. * Creates and sends the intent to add an incoming call through Telecomm. * * @param context The current context. * @param isVideoCall {@code True} if this is a video call. */ private void sendIncomingCallIntent(Context context, boolean isVideoCall) { public static void sendIncomingCallIntent(Context context, Uri handle, boolean isVideoCall) { PhoneAccountHandle phoneAccount = new PhoneAccountHandle( new ComponentName(context, TestConnectionService.class), CallServiceNotifier.SIM_SUBSCRIPTION_ID); Loading @@ -75,7 +76,10 @@ public class CallNotificationReceiver extends BroadcastReceiver { // For the purposes of testing, indicate whether the incoming call is a video call by // stashing an indicator in the EXTRA_INCOMING_CALL_EXTRAS. Bundle extras = new Bundle(); extras.putBoolean(TestConnectionService.IS_VIDEO_CALL, isVideoCall); extras.putBoolean(TestConnectionService.EXTRA_IS_VIDEO_CALL, isVideoCall); if (handle != null) { extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle); } TelecommManager.from(context).addNewIncomingCall(phoneAccount, extras); } Loading tests/src/com/android/telecomm/testapps/TestCallActivity.java +21 −1 Original line number Diff line number Diff line Loading @@ -17,21 +17,41 @@ package com.android.telecomm.testapps; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; /** * This activity exists in order to add an icon to the launcher. This activity has no UI of its own * and instead starts the notification for {@link TestConnectionService} via * {@link CallServiceNotifier}. After triggering a notification update, this activity immediately * finishes. * * To directly trigger a new incoming call, use the following adb command: * * adb shell am start -a android.telecomm.testapps.ACTION_START_INCOMING_CALL -d "tel:123456789" */ public class TestCallActivity extends Activity { public static final String ACTION_NEW_INCOMING_CALL = "android.telecomm.testapps.ACTION_START_INCOMING_CALL"; @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); final Intent intent = getIntent(); if (intent != null && intent.getData() != null) { startIncomingCallBroadcast(intent.getData()); } CallServiceNotifier.getInstance().updateNotification(this); finish(); } /** * Bypass the notification and start the test incoming call directly. */ private void startIncomingCallBroadcast(Uri handle) { CallNotificationReceiver.sendIncomingCallIntent(this, handle, false); } } tests/src/com/android/telecomm/testapps/TestConnectionService.java +425 −1 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
tests/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,11 @@ <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.telecomm.testapps.ACTION_START_INCOMING_CALL" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="tel" /> </intent-filter> </activity> <receiver android:name="com.android.telecomm.testapps.CallNotificationReceiver" Loading
tests/src/com/android/telecomm/testapps/CallNotificationReceiver.java +9 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.telecomm.PhoneAccountHandle; import android.telecomm.TelecommManager; Loading Loading @@ -55,19 +56,19 @@ public class CallNotificationReceiver extends BroadcastReceiver { } else if (ACTION_SHOW_ALL_PHONE_ACCOUNTS.equals(action)) { CallServiceNotifier.getInstance().showAllPhoneAccounts(context); } else if (ACTION_VIDEO_CALL.equals(action)) { sendIncomingCallIntent(context, true); sendIncomingCallIntent(context, null, true); } else if (ACTION_AUDIO_CALL.equals(action)) { sendIncomingCallIntent(context, false); sendIncomingCallIntent(context, null, false); } } /** * Creates the intent to add an incoming call through Telecomm. * Creates and sends the intent to add an incoming call through Telecomm. * * @param context The current context. * @param isVideoCall {@code True} if this is a video call. */ private void sendIncomingCallIntent(Context context, boolean isVideoCall) { public static void sendIncomingCallIntent(Context context, Uri handle, boolean isVideoCall) { PhoneAccountHandle phoneAccount = new PhoneAccountHandle( new ComponentName(context, TestConnectionService.class), CallServiceNotifier.SIM_SUBSCRIPTION_ID); Loading @@ -75,7 +76,10 @@ public class CallNotificationReceiver extends BroadcastReceiver { // For the purposes of testing, indicate whether the incoming call is a video call by // stashing an indicator in the EXTRA_INCOMING_CALL_EXTRAS. Bundle extras = new Bundle(); extras.putBoolean(TestConnectionService.IS_VIDEO_CALL, isVideoCall); extras.putBoolean(TestConnectionService.EXTRA_IS_VIDEO_CALL, isVideoCall); if (handle != null) { extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle); } TelecommManager.from(context).addNewIncomingCall(phoneAccount, extras); } Loading
tests/src/com/android/telecomm/testapps/TestCallActivity.java +21 −1 Original line number Diff line number Diff line Loading @@ -17,21 +17,41 @@ package com.android.telecomm.testapps; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; /** * This activity exists in order to add an icon to the launcher. This activity has no UI of its own * and instead starts the notification for {@link TestConnectionService} via * {@link CallServiceNotifier}. After triggering a notification update, this activity immediately * finishes. * * To directly trigger a new incoming call, use the following adb command: * * adb shell am start -a android.telecomm.testapps.ACTION_START_INCOMING_CALL -d "tel:123456789" */ public class TestCallActivity extends Activity { public static final String ACTION_NEW_INCOMING_CALL = "android.telecomm.testapps.ACTION_START_INCOMING_CALL"; @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); final Intent intent = getIntent(); if (intent != null && intent.getData() != null) { startIncomingCallBroadcast(intent.getData()); } CallServiceNotifier.getInstance().updateNotification(this); finish(); } /** * Bypass the notification and start the test incoming call directly. */ private void startIncomingCallBroadcast(Uri handle) { CallNotificationReceiver.sendIncomingCallIntent(this, handle, false); } }
tests/src/com/android/telecomm/testapps/TestConnectionService.java +425 −1 File changed.Preview size limit exceeded, changes collapsed. Show changes