title: How to know if the calling intent is running in background or foreground?
body: <p>I am using calling phone intent in Android as follows:</p>
  
  <pre><code>Intent callIntent = new Intent(Intent.ACTION_CALL);
  callIntent.setData(Uri.parse("tel:"+Uri.encode(phone_num.trim())));
  callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  startActivity(callIntent);
  </code></pre>
  
  <p>The package name is <code>com.android.incallui</code>. I want to know if the calling GUI is running in background or foreground. Hence, I make a function <code>checkcallingGUI</code>, it will return true if the calling GUI is running in the foreground, and false if the calling phone is running in the background. Is it possible to check it? Thank all </p>