title: adb shell dumpsys window windows output describing
body: <p>I'm using <a href="http://appium.io/" rel="nofollow noreferrer">appium</a> for interaction between my Android device and java code. And I faced with problem that on some kind of devices(including emulators) after pressing on Home button, appium return incorrect current activity (it returns previous activity which is currently must be minimized). I found that appium used <a href="https://github.com/appium/appium-adb/blob/01c77966d846e8ce79582d767ac4d17120c32957/lib/tools/apk-utils.js#L89" rel="nofollow noreferrer"><code>dumpsys window windows</code></a>  with grabbing <code>mFocusedApp</code> value for getting current app. I read <a href="https://stackoverflow.com/questions/13193592/adb-android-getting-the-name-of-the-current-activity">another answers</a> about getting Android current activities, and mostly it recommend to use:</p>
  <pre><code>adb shell &quot;dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'&quot;
  </code></pre>
  <p>That was the source of the problem, because after pressing Home button <code>mCurrentFocus</code> and <code>mFocusedApp</code> linked to different activities. But I can't find any explanation the difference between these fields. And why appium uses only <code>mFocusedApp</code> for it?</p>