use of com.android.incallui.ContactInfoCache.ContactInfoCacheCallback in project android_packages_apps_Dialer by MoKee.
the class StatusBarNotifier method showNotification.
private void showNotification(final Call call) {
final boolean isGeocoderLocationNeeded = (call.getState() == Call.State.INCOMING || call.getState() == Call.State.CALL_WAITING || call.getState() == Call.State.DIALING || call.getState() == Call.State.CONNECTING || call.getState() == Call.State.SELECT_PHONE_ACCOUNT);
Log.d(this, "showNotification isGeocoderLocationNeeded = " + isGeocoderLocationNeeded);
if (!TextUtils.isEmpty(mCallId)) {
CallList.getInstance().removeCallUpdateListener(mCallId, this);
}
mCallId = call.getId();
CallList.getInstance().addCallUpdateListener(call.getId(), this);
// we make a call to the contact info cache to query for supplemental data to what the
// call provides. This includes the contact name and photo.
// This callback will always get called immediately and synchronously with whatever data
// it has available, and may make a subsequent call later (same thread) if it had to
// call into the contacts provider for more data.
mContactInfoCache.findInfo(call, isGeocoderLocationNeeded, new ContactInfoCacheCallback() {
@Override
public void onContactInfoComplete(String callId, ContactCacheEntry entry) {
Call call = CallList.getInstance().getCallById(callId);
if (call != null) {
call.getLogState().contactLookupResult = entry.contactLookupResult;
buildAndSendNotification(call, entry);
}
}
@Override
public void onImageLoadComplete(String callId, ContactCacheEntry entry) {
Call call = CallList.getInstance().getCallById(callId);
if (call != null) {
buildAndSendNotification(call, entry);
}
}
@Override
public void onContactInteractionsInfoComplete(String callId, ContactCacheEntry entry) {
}
});
}
use of com.android.incallui.ContactInfoCache.ContactInfoCacheCallback in project android_packages_apps_Dialer by LineageOS.
the class StatusBarNotifier method showNotification.
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
private void showNotification(final CallList callList, final DialerCall call) {
final boolean isIncoming = (call.getState() == DialerCall.State.INCOMING || call.getState() == DialerCall.State.CALL_WAITING);
setStatusBarCallListener(new StatusBarCallListener(call));
// we make a call to the contact info cache to query for supplemental data to what the
// call provides. This includes the contact name and photo.
// This callback will always get called immediately and synchronously with whatever data
// it has available, and may make a subsequent call later (same thread) if it had to
// call into the contacts provider for more data.
mContactInfoCache.findInfo(call, isIncoming, new ContactInfoCacheCallback() {
@Override
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
public void onContactInfoComplete(String callId, ContactCacheEntry entry) {
DialerCall call = callList.getCallById(callId);
if (call != null) {
call.getLogState().contactLookupResult = entry.contactLookupResult;
buildAndSendNotification(callList, call, entry);
}
}
@Override
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
public void onImageLoadComplete(String callId, ContactCacheEntry entry) {
DialerCall call = callList.getCallById(callId);
if (call != null) {
buildAndSendNotification(callList, call, entry);
}
}
});
}
Aggregations