use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by LineageOS.
the class VoicemailChannelUtils method createVoicemailChannelForAccount.
private static void createVoicemailChannelForAccount(@NonNull Context context, @NonNull PhoneAccountHandle handle) {
PhoneAccount phoneAccount = context.getSystemService(TelecomManager.class).getPhoneAccount(handle);
NotificationChannel channel = newChannel(context, getChannelIdForAccount(handle), phoneAccount.getLabel());
migrateVoicemailSoundSettings(context, channel, handle);
context.getSystemService(NotificationManager.class).createNotificationChannel(channel);
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by LineageOS.
the class LegacyVoicemailNotifier method getNotificationText.
@NonNull
private static String getNotificationText(@NonNull Context context, PhoneAccountHandle handle, String voicemailNumber) {
if (PhoneAccountUtils.getSubscriptionPhoneAccounts(context).size() > 1) {
TelecomManager telecomManager = context.getSystemService(TelecomManager.class);
PhoneAccount phoneAccount = telecomManager.getPhoneAccount(handle);
return phoneAccount.getShortDescription().toString();
} else {
return String.format(context.getString(R.string.notification_voicemail_text_format), PhoneNumberUtils.formatNumber(voicemailNumber));
}
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by LineageOS.
the class PhoneAccountSelectionFragment method onResume.
@Override
public void onResume() {
super.onResume();
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
PreferenceScreen screen = getPreferenceScreen();
TelecomManager telecomManager = getContext().getSystemService(TelecomManager.class);
List<PhoneAccountHandle> accountHandles = telecomManager.getCallCapablePhoneAccounts();
Context context = getActivity();
for (PhoneAccountHandle handle : accountHandles) {
PhoneAccount account = telecomManager.getPhoneAccount(handle);
if (account != null) {
final boolean isSimAccount = 0 != (account.getCapabilities() & PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION);
if (isSimAccount) {
screen.addPreference(new AccountPreference(context, handle, account));
}
}
}
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by LineageOS.
the class DialerCall method updateFromTelecomCall.
private void updateFromTelecomCall() {
LogUtil.v("DialerCall.updateFromTelecomCall", mTelecomCall.toString());
mVideoTechManager.dispatchCallStateChanged(mTelecomCall.getState());
final int translatedState = translateState(mTelecomCall.getState());
if (mState != State.BLOCKED) {
setState(translatedState);
setDisconnectCause(mTelecomCall.getDetails().getDisconnectCause());
}
mChildCallIds.clear();
final int numChildCalls = mTelecomCall.getChildren().size();
for (int i = 0; i < numChildCalls; i++) {
mChildCallIds.add(mDialerCallDelegate.getDialerCallFromTelecomCall(mTelecomCall.getChildren().get(i)).getId());
}
// The number of conferenced calls can change over the course of the call, so use the
// maximum number of conferenced child calls as the metric for conference call usage.
mLogState.conferencedCalls = Math.max(numChildCalls, mLogState.conferencedCalls);
updateFromCallExtras(mTelecomCall.getDetails().getExtras());
// If the handle of the call has changed, update state for the call determining if it is an
// emergency call.
Uri newHandle = mTelecomCall.getDetails().getHandle();
if (!Objects.equals(mHandle, newHandle)) {
mHandle = newHandle;
updateEmergencyCallState();
}
// If the phone account handle of the call is set, cache capability bit indicating whether
// the phone account supports call subjects.
PhoneAccountHandle newPhoneAccountHandle = mTelecomCall.getDetails().getAccountHandle();
if (!Objects.equals(mPhoneAccountHandle, newPhoneAccountHandle)) {
mPhoneAccountHandle = newPhoneAccountHandle;
if (mPhoneAccountHandle != null) {
PhoneAccount phoneAccount = mContext.getSystemService(TelecomManager.class).getPhoneAccount(mPhoneAccountHandle);
if (phoneAccount != null) {
mIsCallSubjectSupported = phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT);
}
}
}
}
use of android.telecom.PhoneAccount in project android_packages_apps_Dialer by LineageOS.
the class CallUtil method getVideoCallingAvailability.
/**
* Determines if video calling is available, and if so whether presence checking is available as
* well.
*
* <p>Returns a bitmask with {@link #VIDEO_CALLING_ENABLED} to indicate that video calling is
* available, and {@link #VIDEO_CALLING_PRESENCE} if presence indication is also available.
*
* @param context The context
* @return A bit-mask describing the current video capabilities.
*/
public static int getVideoCallingAvailability(Context context) {
if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE) || !CompatUtils.isVideoCompatible()) {
return VIDEO_CALLING_DISABLED;
}
TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
if (telecommMgr == null) {
return VIDEO_CALLING_DISABLED;
}
List<PhoneAccountHandle> accountHandles = telecommMgr.getCallCapablePhoneAccounts();
for (PhoneAccountHandle accountHandle : accountHandles) {
PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle);
if (account != null) {
if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING)) {
// Builds prior to N do not have presence support.
if (!CompatUtils.isVideoPresenceCompatible()) {
return VIDEO_CALLING_ENABLED;
}
int videoCapabilities = VIDEO_CALLING_ENABLED;
if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) {
videoCapabilities |= VIDEO_CALLING_PRESENCE;
}
return videoCapabilities;
}
}
}
return VIDEO_CALLING_DISABLED;
}
Aggregations