Android - Get list of users and profile name
<p>We can create several users and profiles on an Android devices, for example, there is a Main User, and I also set a Work Profile with name "Work Profile".</p>

<p>Using the following adb command:</p>

<pre><code>adb shell pm list users
</code></pre>

<p>I'm getting this result:</p>

<blockquote>
  <p>UserInfo{0:My User:13} running
      UserInfo{10:Work Profile:30} running</p>
</blockquote>

<p>Good, I can see my User Info with the name Work Profile on it.
Now, I want to get this list from my application.</p>

<p>I tried to use this code:</p>

<pre><code>for(Account account: AccountManager.get(this).getAccounts()) {
        DebugLog.e("COUCOU " + account.name + " " + account.toString());
    }
</code></pre>

<p>But the Work Profile account is not appearing in the list. Only the main user...
Any idea how I could get the same list as the ADB shell command??</p>