Detect if launcher is on foreground
<p>I'm using the following code to understand the processes currently on foreground:</p>

<pre><code>ActivityManager activityManager = (ActivityManager) newContext.getSystemService( Context.ACTIVITY_SERVICE );
List&lt;RunningAppProcessInfo&gt; appProcesses = activityManager.getRunningAppProcesses();
for(RunningAppProcessInfo appProcess : appProcesses){
    if(appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND){
        Log.i("Foreground App", appProcess.processName);
          [...]
    }
}
</code></pre>

<p>But it works only if I'm using a 4.0.4 launcher like stock one, apex, nova launchrs.
If I switch to GoLauncher or Launcher Pro, they are not logged. It looks like they never go foreground (or this portion of code can't detect them).</p>
