Change incoming call intent to a TelecommManager method. (3/3)
Also moves a few constants from TelecommConstants to TelecommManager.
Bug:16416927
Change-Id: I8e74feb228523ed1c186b2f06784d04cb9141f86
diff --git a/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java b/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
index d99c97b..b891a6d 100644
--- a/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
+++ b/sip/src/com/android/services/telephony/sip/SipBroadcastReceiver.java
@@ -34,7 +34,7 @@
*/
public class SipBroadcastReceiver extends BroadcastReceiver {
private static final String PREFIX = "[SipBroadcastReceiver] ";
- private static final boolean VERBOSE = true; /* STOP SHIP if true */
+ private static final boolean VERBOSE = false; /* STOP SHIP if true */
@Override
public void onReceive(Context context, final Intent intent) {
@@ -60,13 +60,8 @@
Bundle extras = new Bundle();
extras.putParcelable(SipUtil.EXTRA_INCOMING_CALL_INTENT, intent);
- Intent telecommIntent = new Intent(TelecommManager.ACTION_INCOMING_CALL);
- telecommIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- telecommIntent.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE,
- SipConnectionService.getPhoneAccountHandle(context));
- telecommIntent.putExtra(TelecommManager.EXTRA_INCOMING_CALL_EXTRAS, extras);
-
- context.startActivityAsUser(telecommIntent, UserHandle.CURRENT);
+ TelecommManager.from(context).addNewIncomingCall(
+ SipConnectionService.getPhoneAccountHandle(context), extras);
}
private void registerAllProfiles(final Context context) {
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index 958d0a4..edf1b2b 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -25,8 +25,8 @@
import android.os.Handler;
import android.os.Message;
import android.os.UserHandle;
-
import android.telecomm.TelecommManager;
+
import com.android.internal.telephony.Call;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.Phone;
@@ -152,14 +152,7 @@
* Sends the incoming call intent to telecomm.
*/
private void sendIncomingCallIntent(Connection connection) {
- Context context = mPhoneProxy.getContext();
-
- Intent intent = new Intent(TelecommManager.ACTION_INCOMING_CALL);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(TelecommManager.EXTRA_PHONE_ACCOUNT_HANDLE,
- TelecommAccountRegistry.makePstnPhoneAccountHandle(mPhoneProxy));
-
- Log.d(this, "Sending incoming call intent: %s", intent);
- context.startActivityAsUser(intent, UserHandle.CURRENT);
+ TelecommManager.from(mPhoneProxy.getContext()).addNewIncomingCall(
+ TelecommAccountRegistry.makePstnPhoneAccountHandle(mPhoneProxy), null);
}
}