骚扰号码存放的URI

BlockedNumberContract.BlockedNumbers.CONTENT_URI

 

存放号码的列

BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER

 

ContentResolver contentResolver = getContext().getContentResolver();

ContentValues newValues = newContentValues();

newValues.put(BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER,

                        mNumber);

contentResolver.insert(BlockedNumberContract.BlockedNumbers.CONTENT_URI,

                        newValues);

 

号码是否存在

BlockedNumberContract.isBlocked(getContext(),mNumber)

 

 

 

https://developer.android.com/reference/android/provider/BlockedNumberContract.html

 

 

拦截原理

Telcomm(packages/services/Telecomm)

CallsManager  onSuccessfulIncomingCall

   @Override

   public void onSuccessfulIncomingCall(Call incomingCall) {

       Log.d(this, "onSuccessfulIncomingCall");

       List filters = newArrayList<>();

       filters.add(new DirectToVoicemailCallFilter(mCallerInfoLookupHelper));

       filters.add(new AsyncBlockCheckFilter(mContext,new BlockCheckerAdapter()));

       filters.add(new CallScreeningServiceFilter(mContext, this,mPhoneAccountRegistrar,

                mDefaultDialerManagerAdapter,

                newParcelableCallUtils.Converter(), mLock));

       new IncomingCallFilter(mContext, this,incomingCall, mLock,

                mTimeoutsAdapter,filters).performFiltering();

    }

 

 

 

public void performFiltering() {

       Log.event(mCall, Log.Events.FILTERING_INITIATED);

       Log.d(this, "[performFiltering], timeout = "

                +mTimeoutsAdapter.getCallScreeningTimeoutMillis(mContext.getContentResolver()));

       for (CallFilter filter : mFilters) {

            filter.startFilterLookup(mCall,this);

       }

       mHandler.postDelayed(new Runnable("ICF.pFTO") { //performFiltering time-out

           @Override

           public void loggedRun() {

                // synchronized to prevent arace on mResult and to enter into Telecom.

                synchronized (mTelecomLock) {

                    if (mIsPending) {

                       Log.i(IncomingCallFilter.this, "Call filtering has timed out.");

                        Log.event(mCall,Log.Events.FILTERING_TIMED_OUT);

                       mListener.onCallFilteringComplete(mCall, mResult);

                        mIsPending = false;

                    }

                }

           }

        }.prepare(),mTimeoutsAdapter.getCallScreeningTimeoutMillis(mContext.getContentResolver()));

    }

 

 

AsyncBlockCheckFilter

   protected void onPostExecute(Boolean isBlocked) {

       CallFilteringResult result;

       if (isBlocked) {

           result = new CallFilteringResult(

                    false, // shouldAllowCall

                    true, //shouldReject

                    false, //shouldAddToCallLog

                    false //shouldShowNotification

           );

       } else {

            result = new CallFilteringResult(

                    true, // shouldAllowCall

                    false, // shouldReject

                    true, // shouldAddToCallLog

                    true //shouldShowNotification

           );

       }

更多相关文章

  1. Android(安卓)手机号码格式验证
  2. android 读取通讯录
  3. Android(安卓)获取MIEI ISMI Sim卡串号等等信息
  4. android使用Intent操作拨打号码发送短信
  5. [置顶] Android——4.2.2 源码目录结构分析
  6. Android实现发送短信功能实例详解
  7. android开发一 开发环境安装
  8. android home按键拦截
  9. Android中短信的读取与拦截

随机推荐

  1. 概率分布生成和蒙特卡洛模拟的实战示例
  2. 面板数据计量方法全局脉络和程序使用指南
  3. 事件研究法什么鬼? 从这里着手看"疫苗之
  4. Working paper前100强系列,不读就不要跟
  5. 空间计量百科全书式的使用指南, 只此一份
  6. 独孤求败的金融学期刊JOF自成立以来引用
  7. Prometheus 之 所有业务容器指标的监控
  8. 合成控制法什么鬼? 因果推断的前沿方法指
  9. 1961年以来每年最牛的经济学家名单,学术
  10. 对昂贵的知网Say再见, iData和ncpssd专治