Example usage for android.telecom TelecomManager from

List of usage examples for android.telecom TelecomManager from

Introduction

In this page you can find the example usage for android.telecom TelecomManager from.

Prototype

@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static TelecomManager from(Context context) 

Source Link

Usage

From source file:com.android.server.telecom.testapps.CallNotificationReceiver.java

/**
 * Creates and sends the intent to add an incoming call through Telecom.
 *
 * @param context The current context./*from ww w  .java 2  s  .c  o m*/
 * @param isVideoCall {@code True} if this is a video call.
 */
public static void sendIncomingCallIntent(Context context, Uri handle, boolean isVideoCall) {
    PhoneAccountHandle phoneAccount = new PhoneAccountHandle(
            new ComponentName(context, TestConnectionService.class), CallServiceNotifier.SIM_SUBSCRIPTION_ID);

    // 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.EXTRA_IS_VIDEO_CALL, isVideoCall);
    if (handle != null) {
        extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle);
    }

    TelecomManager.from(context).addNewIncomingCall(phoneAccount, extras);
}

From source file:com.android.server.telecom.testapps.CallNotificationReceiver.java

public static void addNewUnknownCall(Context context, Uri handle, Bundle extras) {
    Log.i(TAG, "Adding new unknown call with handle " + handle);
    PhoneAccountHandle phoneAccount = new PhoneAccountHandle(
            new ComponentName(context, TestConnectionService.class), CallServiceNotifier.SIM_SUBSCRIPTION_ID);

    if (extras == null) {
        extras = new Bundle();
    }/*from   ww  w  .ja v  a 2 s  .com*/

    if (handle != null) {
        extras.putParcelable(TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE, handle);
        extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle);
    }

    TelecomManager.from(context).addNewUnknownCall(phoneAccount, extras);
}