title: why onCallStateChanged() on Android is invoked more than one time in a single call？
body: <p>I wanted to implement an app that prevents calls like a firewall. When I debug my app, I found that when there is a call in, the <strong>onCallStateChanged()</strong> function in interface <strong>PhoneStateListener</strong> is invoked three times. As a result, preventing one call can result in three logs. I'm so confused!!</p>
  
  <p>my code:</p>
  
  <pre><code>    @Override
      public void onCallStateChanged(int state, String incomingNumber) {
          try {
              if (state == TelephonyManager.CALL_STATE_RINGING &amp;&amp; 
                  PhoneUtil.getITelephony(tpm).isRinging()) {
                  String flag = isBlockCall(myContext, myHelper, myTypes, incomingNumber);
                  if (flag.length() &gt; 0) {
                      blockCall();
                      myHelper.insertLog(new String[] { flag, incomingNumber, String.valueOf(System.currentTimeMillis()), null });
                      showNotification(myContext, incomingNumber, System.currentTimeMillis());
                  }
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          super.onCallStateChanged(state, incomingNumber);
      }
  }, PhoneStateListener.LISTEN_CALL_STATE);
  </code></pre>