use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class ConferenceManagerPresenter method onStateChange.
@Override
public void onStateChange(InCallState oldState, InCallState newState, CallList callList) {
if (getUi().isFragmentVisible()) {
Log.v(this, "onStateChange" + newState);
if (newState == InCallState.INCALL) {
final DialerCall call = callList.getActiveOrBackgroundCall();
if (call != null && call.isConferenceCall()) {
Log.v(this, "Number of existing calls is " + String.valueOf(call.getChildCallIds().size()));
update(callList);
} else {
InCallPresenter.getInstance().showConferenceCallManager(false);
}
} else {
InCallPresenter.getInstance().showConferenceCallManager(false);
}
}
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class ConferenceParticipantListAdapter method updateParticipantInfo.
/**
* Updates the participant info list which is bound to the ListView. Stores the call and contact
* info for all entries. The list is sorted alphabetically by participant name.
*
* @param conferenceParticipants The calls which make up the conference participants.
*/
private void updateParticipantInfo(List<DialerCall> conferenceParticipants) {
final ContactInfoCache cache = ContactInfoCache.getInstance(getContext());
boolean newParticipantAdded = false;
Set<String> newCallIds = new ArraySet<>(conferenceParticipants.size());
// Update or add conference participant info.
for (DialerCall call : conferenceParticipants) {
String callId = call.getId();
newCallIds.add(callId);
ContactCacheEntry contactCache = cache.getInfo(callId);
if (contactCache == null) {
contactCache = ContactInfoCache.buildCacheEntryFromCall(getContext(), call, call.getState() == DialerCall.State.INCOMING);
}
if (mParticipantsByCallId.containsKey(callId)) {
ParticipantInfo participantInfo = mParticipantsByCallId.get(callId);
participantInfo.setCall(call);
participantInfo.setContactCacheEntry(contactCache);
} else {
newParticipantAdded = true;
ParticipantInfo participantInfo = new ParticipantInfo(call, contactCache);
mConferenceParticipants.add(participantInfo);
mParticipantsByCallId.put(call.getId(), participantInfo);
}
}
// Remove any participants that no longer exist.
Iterator<Map.Entry<String, ParticipantInfo>> it = mParticipantsByCallId.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, ParticipantInfo> entry = it.next();
String existingCallId = entry.getKey();
if (!newCallIds.contains(existingCallId)) {
ParticipantInfo existingInfo = entry.getValue();
mConferenceParticipants.remove(existingInfo);
it.remove();
}
}
if (newParticipantAdded) {
// Sort the list of participants by contact name.
sortParticipantList();
}
notifyDataSetChanged();
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class ConferenceParticipantListAdapter method getView.
/**
* Creates or populates an existing conference participant row.
*
* @param position The position of the item within the adapter's data set of the item whose view
* we want.
* @param convertView The old view to reuse, if possible.
* @param parent The parent that this view will eventually be attached to
* @return The populated view.
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Make sure we have a valid convertView to start with
final View result = convertView == null ? LayoutInflater.from(parent.getContext()).inflate(R.layout.caller_in_conference, parent, false) : convertView;
ParticipantInfo participantInfo = mConferenceParticipants.get(position);
DialerCall call = participantInfo.getCall();
ContactCacheEntry contactCache = participantInfo.getContactCacheEntry();
final ContactInfoCache cache = ContactInfoCache.getInstance(getContext());
// photo, do it now.
if (!participantInfo.isCacheLookupComplete()) {
cache.findInfo(participantInfo.getCall(), participantInfo.getCall().getState() == DialerCall.State.INCOMING, new ContactLookupCallback(this));
}
boolean thisRowCanSeparate = mParentCanSeparate && call.can(android.telecom.Call.Details.CAPABILITY_SEPARATE_FROM_CONFERENCE);
boolean thisRowCanDisconnect = call.can(android.telecom.Call.Details.CAPABILITY_DISCONNECT_FROM_CONFERENCE);
String name = ContactDisplayUtils.getPreferredDisplayName(contactCache.namePrimary, contactCache.nameAlternative, mContactsPreferences);
setCallerInfoForRow(result, contactCache.namePrimary, call.updateNameIfRestricted(name), contactCache.number, contactCache.label, contactCache.lookupKey, contactCache.displayPhotoUri, thisRowCanSeparate, thisRowCanDisconnect);
// Tag the row in the conference participant list with the call id to make it easier to
// find calls when contact cache information is loaded.
result.setTag(call.getId());
return result;
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class AnswerScreenPresenter method onAnswerAndReleaseCall.
@Override
public void onAnswerAndReleaseCall() {
LogUtil.enterBlock("AnswerScreenPresenter.onAnswerAndReleaseCall");
DialerCall activeCall = CallList.getInstance().getActiveCall();
if (activeCall == null) {
LogUtil.i("AnswerScreenPresenter.onAnswerAndReleaseCall", "activeCall == null");
onAnswer(false);
} else {
activeCall.setReleasedByAnsweringSecondCall(true);
activeCall.addListener(new AnswerOnDisconnected(activeCall));
activeCall.disconnect();
}
addTimeoutCheck();
}
use of com.android.incallui.call.DialerCall in project android_packages_apps_Dialer by LineageOS.
the class CallCardPresenter method onInCallScreenDelegateInit.
@Override
public void onInCallScreenDelegateInit(InCallScreen inCallScreen) {
Assert.isNotNull(inCallScreen);
mInCallScreen = inCallScreen;
mContactsPreferences = ContactsPreferencesFactory.newContactsPreferences(mContext);
// Call may be null if disconnect happened already.
DialerCall call = CallList.getInstance().getFirstCall();
if (call != null) {
mPrimary = call;
if (shouldShowNoteSentToast(mPrimary)) {
mInCallScreen.showNoteSentToast();
}
call.addListener(this);
// start processing lookups right away.
if (!call.isConferenceCall()) {
startContactInfoSearch(call, true, call.getState() == DialerCall.State.INCOMING);
} else {
updateContactEntry(null, true);
}
}
onStateChange(null, InCallPresenter.getInstance().getInCallState(), CallList.getInstance());
}
Aggregations