I know how to retrieve information about the foreground app:
public ActivityManager.RunningTaskInfo getForegroundTask() { ActivityManager am = (ActivityManag
You can try to combine your code snippet to determine the package name of the foreground process with a call to PackageManager to get information about the HOME activity, as described here, and compare the results.
PackageManager