use of com.android.dialer.blocking.FilteredNumberAsyncQueryHandler in project android_packages_apps_Dialer by LineageOS.
the class CallLogFragment method setupData.
protected void setupData() {
int activityType = mIsCallLogActivity ? CallLogAdapter.ACTIVITY_TYPE_CALL_LOG : CallLogAdapter.ACTIVITY_TYPE_DIALTACTS;
String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity());
mContactInfoCache = new ContactInfoCache(ExpirableCacheHeadlessFragment.attach((AppCompatActivity) getActivity()).getRetainedCache(), new ContactInfoHelper(getActivity(), currentCountryIso), mOnContactInfoChangedListener);
mAdapter = Bindings.getLegacy(getActivity()).newCallLogAdapter(getActivity(), mRecyclerView, this, this, activityType == CallLogAdapter.ACTIVITY_TYPE_DIALTACTS ? (CallLogAdapter.OnActionModeStateChangedListener) getActivity() : null, new CallLogCache(getActivity()), mContactInfoCache, getVoicemailPlaybackPresenter(), new FilteredNumberAsyncQueryHandler(getActivity()), activityType);
mRecyclerView.setAdapter(mAdapter);
fetchCalls();
}
use of com.android.dialer.blocking.FilteredNumberAsyncQueryHandler in project android_packages_apps_Dialer by LineageOS.
the class CallList method onCallAdded.
public void onCallAdded(final Context context, final android.telecom.Call telecomCall, LatencyReport latencyReport) {
Trace.beginSection("onCallAdded");
final DialerCall call = new DialerCall(context, this, telecomCall, latencyReport, true);
logSecondIncomingCall(context, call);
EnrichedCallManager manager = EnrichedCallComponent.get(context).getEnrichedCallManager();
manager.registerCapabilitiesListener(call);
manager.registerStateChangedListener(call);
final DialerCallListenerImpl dialerCallListener = new DialerCallListenerImpl(call);
call.addListener(dialerCallListener);
LogUtil.d("CallList.onCallAdded", "callState=" + call.getState());
if (Spam.get(context).isSpamEnabled()) {
String number = TelecomCallUtil.getNumber(telecomCall);
Spam.get(context).checkSpamStatus(number, null, new SpamBindings.Listener() {
@Override
public void onComplete(boolean isSpam) {
boolean isIncomingCall = call.getState() == DialerCall.State.INCOMING || call.getState() == DialerCall.State.CALL_WAITING;
if (isSpam) {
if (!isIncomingCall) {
LogUtil.i("CallList.onCallAdded", "marking spam call as not spam because it's not an incoming call");
isSpam = false;
} else if (isPotentialEmergencyCallback(context, call)) {
LogUtil.i("CallList.onCallAdded", "marking spam call as not spam because an emergency call was made on this" + " device recently");
isSpam = false;
}
}
if (isIncomingCall) {
Logger.get(context).logCallImpression(isSpam ? DialerImpression.Type.INCOMING_SPAM_CALL : DialerImpression.Type.INCOMING_NON_SPAM_CALL, call.getUniqueCallId(), call.getTimeAddedMs());
}
call.setSpam(isSpam);
dialerCallListener.onDialerCallUpdate();
}
});
updateUserMarkedSpamStatus(call, context, number, dialerCallListener);
}
FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(context);
filteredNumberAsyncQueryHandler.isBlockedNumber(new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() {
@Override
public void onCheckComplete(Integer id) {
if (id != null && id != FilteredNumberAsyncQueryHandler.INVALID_ID) {
call.setBlockedStatus(true);
dialerCallListener.onDialerCallUpdate();
}
}
}, call.getNumber(), GeoUtil.getCurrentCountryIso(context));
if (call.getState() == DialerCall.State.INCOMING || call.getState() == DialerCall.State.CALL_WAITING) {
onIncoming(call);
} else {
dialerCallListener.onDialerCallUpdate();
}
if (call.getState() != State.INCOMING) {
// Only report outgoing calls
ShortcutUsageReporter.onOutgoingCallAdded(context, call.getNumber());
}
Trace.endSection();
}
use of com.android.dialer.blocking.FilteredNumberAsyncQueryHandler in project android_packages_apps_Dialer by LineageOS.
the class InCallServiceImpl method onBind.
@Override
public IBinder onBind(Intent intent) {
final Context context = getApplicationContext();
final ContactInfoCache contactInfoCache = ContactInfoCache.getInstance(context);
InCallPresenter.getInstance().setUp(context, CallList.getInstance(), new ExternalCallList(), new StatusBarNotifier(context, contactInfoCache), new ExternalCallNotifier(context, contactInfoCache), contactInfoCache, new ProximitySensor(context, AudioModeProvider.getInstance(), new AccelerometerListener(context)), new FilteredNumberAsyncQueryHandler(context));
InCallPresenter.getInstance().onServiceBind();
InCallPresenter.getInstance().maybeStartRevealAnimation(intent);
TelecomAdapter.getInstance().setInCallService(this);
if (ReturnToCallController.isEnabled(this)) {
returnToCallController = new ReturnToCallController(this);
}
return super.onBind(intent);
}
use of com.android.dialer.blocking.FilteredNumberAsyncQueryHandler in project android_packages_apps_Dialer by LineageOS.
the class SpamNotificationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
LogUtil.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
setFinishOnTouchOutside(true);
filteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(this);
cancelNotification();
}
use of com.android.dialer.blocking.FilteredNumberAsyncQueryHandler in project android_packages_apps_Dialer by LineageOS.
the class SpamNotificationService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
LogUtil.d(TAG, "onStartCommand");
if (intent == null) {
LogUtil.d(TAG, "Null intent");
stopSelf();
// Return {@link #START_NOT_STICKY} so service is not restarted.
return START_NOT_STICKY;
}
String number = intent.getStringExtra(EXTRA_PHONE_NUMBER);
int notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, 1);
String countryIso = GeoUtil.getCurrentCountryIso(this);
ContactLookupResult.Type contactLookupResultType = ContactLookupResult.Type.forNumber(intent.getIntExtra(EXTRA_CONTACT_LOOKUP_RESULT_TYPE, 0));
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).cancel(number, notificationId);
switch(intent.getAction()) {
case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_SPAM:
logCallImpression(intent, DialerImpression.Type.SPAM_NOTIFICATION_SERVICE_ACTION_MARK_NUMBER_AS_SPAM);
Spam.get(this).reportSpamFromAfterCallNotification(number, countryIso, CallLog.Calls.INCOMING_TYPE, ReportingLocation.Type.FEEDBACK_PROMPT, contactLookupResultType);
new FilteredNumberAsyncQueryHandler(this).blockNumber(null, number, countryIso);
break;
case SpamNotificationActivity.ACTION_MARK_NUMBER_AS_NOT_SPAM:
logCallImpression(intent, DialerImpression.Type.SPAM_NOTIFICATION_SERVICE_ACTION_MARK_NUMBER_AS_NOT_SPAM);
Spam.get(this).reportNotSpamFromAfterCallNotification(number, countryIso, CallLog.Calls.INCOMING_TYPE, ReportingLocation.Type.FEEDBACK_PROMPT, contactLookupResultType);
break;
// fall out
default:
}
// TODO: call stopSelf() after async tasks complete (b/28441936)
stopSelf();
return START_NOT_STICKY;
}
Aggregations