android7.0来电拦截

Z:\wangdh\ALPS-MP-N0.MP1-V1.0.2_AEON6737M_65_D_N\alps\packages\services\Telephony\src\com\android\services\telephony\PstnIncomingCallNotifier.java


    /**
     * Used to listen to events from {@link #mPhone}.
     */
    private final Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            /// M: CC: OP01 Plugin to block MT call from black number @{
            if (ExtensionManager.getIncomingCallExt().handlePhoneEvent(msg, mPhone)) {
                return;
            }
            /// @}
            
			boolean intercept = false;//是否要拦截
			Log.d(this, "wdh--------00000000----1------");
		
			
			
            switch(msg.what) {
                case EVENT_NEW_RINGING_CONNECTION:
					//DaMi_wdh add
					Log.d(this, "wdh--------1----------EVENT_NEW_RINGING_CONNECTION");
					AsyncResult asyncResult = (AsyncResult) msg.obj;
					Connection connection = (Connection) asyncResult.result;
					String callerId = connection.getAddress();//获取来电号码
					Log.d(this, "wdh--------00000000----------"+connection.getAddress());
					intercept = callerId.equals("176********");//要拦截的号码
				
					if(intercept){
						new Thread(new Runnable() {
							@Override
							public void run() {
								Log.d(this, "wdh--------2----------EVENT_NEW_RINGING_CONNECTION");
								PhoneInterfaceManager.sInstance.endCall();
							}
						}).start();
						}else{
							Log.d(this, "wdh--------3----------EVENT_NEW_RINGING_CONNECTION");
							 handleNewRingingConnection((AsyncResult) msg.obj);
					}	
                    break;
                case EVENT_CDMA_CALL_WAITING:
					if(intercept){
						Log.d(this, "wdh--------4----22------EVENT_NEW_RINGING_CONNECTION");
						}else{
							Log.d(this, "wdh--------4---11-------EVENT_NEW_RINGING_CONNECTION");
							handleCdmaCallWaiting((AsyncResult) msg.obj);
						}
                    break;
                case EVENT_UNKNOWN_CONNECTION:
				Log.d(this, "wdh--------5----------EVENT_NEW_RINGING_CONNECTION");
                    handleNewUnknownConnection((AsyncResult) msg.obj);
                    break;
                /// M: CC: Proprietary incoming call handling @{
                case EVENT_VOICE_CALL_INCOMING_INDICATION:
                    Log.i(this, "EVENT_VOICE_CALL_INCOMING_INDICATION");
					Log.d(this, "wdh--------6----------EVENT_NEW_RINGING_CONNECTION");
                    TelephonyConnectionServiceUtil.getInstance()
                    .setIncomingCallIndicationResponse(
                            (GsmCdmaPhone) ((AsyncResult) msg.obj).result);	
                    break;
                /// @}
                default:
                    break;
            }
        }
    };


android7.0来电拦截_第1张图片

你可能感兴趣的:(android7.0来电拦截)