1 package android.telecom.cts; 2 3 import android.content.BroadcastReceiver; 4 import android.content.Context; 5 import android.content.Intent; 6 import android.net.Uri; 7 8 /** 9 * Broadcast receiver for {@link Intent#ACTION_NEW_OUTGOING_CALL}. 10 */ 11 public class NewOutgoingCallBroadcastReceiver extends BroadcastReceiver { 12 private static boolean sIsNewOutgoingCallBroadcastReceived = false; 13 private static Uri sReceivedPhoneNumber = null; 14 15 @Override onReceive(Context context, Intent intent)16 public void onReceive(Context context, Intent intent) { 17 if (Intent.ACTION_NEW_OUTGOING_CALL.equals(intent.getAction())) { 18 sIsNewOutgoingCallBroadcastReceived = true; 19 sReceivedPhoneNumber = intent.getData(); 20 } 21 } 22 isNewOutgoingCallBroadcastReceived()23 public static boolean isNewOutgoingCallBroadcastReceived() { 24 return sIsNewOutgoingCallBroadcastReceived; 25 } 26 getReceivedNumber()27 public static Uri getReceivedNumber() { 28 return sReceivedPhoneNumber; 29 } 30 reset()31 public static void reset() { 32 sIsNewOutgoingCallBroadcastReceived = false; 33 sReceivedPhoneNumber = null; 34 } 35 } 36