Search in sources :

Example 21 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class NotificationBroadcastReceiver method declineUpgradeRequest.

private void declineUpgradeRequest(Context context) {
    CallList callList = InCallPresenter.getInstance().getCallList();
    if (callList == null) {
        StatusBarNotifier.clearAllCallNotifications(context);
        LogUtil.e("NotificationBroadcastReceiver.declineUpgradeRequest", "call list is empty");
    } else {
        DialerCall call = callList.getVideoUpgradeRequestCall();
        if (call != null) {
            call.getVideoTech().declineVideoRequest();
        }
    }
}
Also used : CallList(com.android.incallui.call.CallList) DialerCall(com.android.incallui.call.DialerCall)

Example 22 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class NotificationBroadcastReceiver method hangUpOngoingCall.

private void hangUpOngoingCall(Context context) {
    CallList callList = InCallPresenter.getInstance().getCallList();
    if (callList == null) {
        StatusBarNotifier.clearAllCallNotifications(context);
        LogUtil.e("NotificationBroadcastReceiver.hangUpOngoingCall", "call list is empty");
    } else {
        DialerCall call = callList.getOutgoingCall();
        if (call == null) {
            call = callList.getActiveOrBackgroundCall();
        }
        LogUtil.i("NotificationBroadcastReceiver.hangUpOngoingCall", "disconnecting call, call: " + call);
        if (call != null) {
            call.disconnect();
        }
    }
}
Also used : CallList(com.android.incallui.call.CallList) DialerCall(com.android.incallui.call.DialerCall)

Example 23 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class NotificationBroadcastReceiver method acceptUpgradeRequest.

private void acceptUpgradeRequest(Context context) {
    CallList callList = InCallPresenter.getInstance().getCallList();
    if (callList == null) {
        StatusBarNotifier.clearAllCallNotifications(context);
        LogUtil.e("NotificationBroadcastReceiver.acceptUpgradeRequest", "call list is empty");
    } else {
        DialerCall call = callList.getVideoUpgradeRequestCall();
        if (call != null) {
            call.getVideoTech().acceptVideoRequest();
        }
    }
}
Also used : CallList(com.android.incallui.call.CallList) DialerCall(com.android.incallui.call.DialerCall)

Example 24 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class CallCardPresenter method getCallToDisplay.

/**
 * Get the highest priority call to display. Goes through the calls and chooses which to return
 * based on priority of which type of call to display to the user. Callers can use the "ignore"
 * feature to get the second best call by passing a previously found primary call as ignore.
 *
 * @param ignore A call to ignore if found.
 */
private DialerCall getCallToDisplay(CallList callList, DialerCall ignore, boolean skipDisconnected) {
    // Active calls come second.  An active call always gets precedent.
    DialerCall retval = callList.getActiveCall();
    if (retval != null && retval != ignore) {
        return retval;
    }
    // Sometimes there is intemediate state that two calls are in active even one is about
    // to be on hold.
    retval = callList.getSecondActiveCall();
    if (retval != null && retval != ignore) {
        return retval;
    }
    // calls are very short lived.
    if (!skipDisconnected) {
        retval = callList.getDisconnectingCall();
        if (retval != null && retval != ignore) {
            return retval;
        }
        retval = callList.getDisconnectedCall();
        if (retval != null && retval != ignore) {
            return retval;
        }
    }
    // Then we go to background call (calls on hold)
    retval = callList.getBackgroundCall();
    if (retval != null && retval != ignore) {
        return retval;
    }
    // Lastly, we go to a second background call.
    retval = callList.getSecondBackgroundCall();
    return retval;
}
Also used : DialerCall(com.android.incallui.call.DialerCall)

Example 25 with DialerCall

use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.

the class CallCardPresenter method onContactInfoComplete.

private void onContactInfoComplete(String callId, ContactCacheEntry entry, boolean isPrimary) {
    final boolean entryMatchesExistingCall = (isPrimary && mPrimary != null && TextUtils.equals(callId, mPrimary.getId())) || (!isPrimary && mSecondary != null && TextUtils.equals(callId, mSecondary.getId()));
    if (entryMatchesExistingCall) {
        updateContactEntry(entry, isPrimary);
    } else {
        LogUtil.e("CallCardPresenter.onContactInfoComplete", "dropping stale contact lookup info for " + callId);
    }
    final DialerCall call = CallList.getInstance().getCallById(callId);
    if (call != null) {
        call.getLogState().contactLookupResult = entry.contactLookupResult;
    }
    if (entry.contactUri != null) {
        CallerInfoUtils.sendViewNotification(mContext, entry.contactUri);
    }
}
Also used : DialerCall(com.android.incallui.call.DialerCall)

Aggregations

DialerCall (com.android.incallui.call.DialerCall)35 CallList (com.android.incallui.call.CallList)6 RequiresPermission (android.support.annotation.RequiresPermission)3 ContactCacheEntry (com.android.incallui.ContactInfoCache.ContactCacheEntry)3 PhoneAccountHandle (android.telecom.PhoneAccountHandle)2 SpannableString (android.text.SpannableString)2 ActivityManager (android.app.ActivityManager)1 AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1 Notification (android.app.Notification)1 Context (android.content.Context)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Point (android.graphics.Point)1 AudioAttributes (android.media.AudioAttributes)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 ArrayMap (android.support.v4.util.ArrayMap)1 CallAudioState (android.telecom.CallAudioState)1