List of usage examples for android.telecom PhoneAccountHandle PhoneAccountHandle
public PhoneAccountHandle(@NonNull ComponentName componentName, @NonNull String id)
From source file:Main.java
/** * Compose PhoneAccount object from component name and account id. *///from w ww.j av a 2 s. co m public static PhoneAccountHandle getAccount(String componentString, String accountId) { if (TextUtils.isEmpty(componentString) || TextUtils.isEmpty(accountId)) { return null; } final ComponentName componentName = ComponentName.unflattenFromString(componentString); return new PhoneAccountHandle(componentName, accountId); }
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 w w w . j a v a 2s. 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 w w w . j a v a 2 s . c om*/ if (handle != null) { extras.putParcelable(TelecomManager.EXTRA_UNKNOWN_CALL_HANDLE, handle); extras.putParcelable(TestConnectionService.EXTRA_HANDLE, handle); } TelecomManager.from(context).addNewUnknownCall(phoneAccount, extras); }
From source file:com.android.dialer.calllog.DefaultVoicemailNotifier.java
/** * Determines which ringtone Uri and Notification defaults to use when updating the notification * for the given call./*from w w w. jav a2s . c o m*/ */ private Pair<Uri, Integer> getNotificationInfo(@Nullable NewCall callToNotify) { Log.v(TAG, "getNotificationInfo"); if (callToNotify == null) { Log.i(TAG, "callToNotify == null"); return new Pair<>(null, 0); } PhoneAccountHandle accountHandle = null; if (callToNotify.accountComponentName == null || callToNotify.accountId == null) { Log.v(TAG, "accountComponentName == null || callToNotify.accountId == null"); accountHandle = TelecomUtil.getDefaultOutgoingPhoneAccount(mContext, PhoneAccount.SCHEME_TEL); if (accountHandle == null) { Log.i(TAG, "No default phone account found, using default notification ringtone"); return new Pair<>(null, Notification.DEFAULT_ALL); } } else { accountHandle = new PhoneAccountHandle( ComponentName.unflattenFromString(callToNotify.accountComponentName), callToNotify.accountId); } if (accountHandle.getComponentName() != null) { Log.v(TAG, "PhoneAccountHandle.ComponentInfo:" + accountHandle.getComponentName()); } else { Log.i(TAG, "PhoneAccountHandle.ComponentInfo: null"); } return new Pair<>(TelephonyManagerCompat.getVoicemailRingtoneUri(getTelephonyManager(), accountHandle), getNotificationDefaults(accountHandle)); }