title: Restoring extra user data with used permission android.permission.MANAGE_ACCOUNTS
body: <p>i'm facing a problem when i'm trying to add an account explicitly in the <code>AccountManager</code>.</p>
  
  <p><strong>The problem</strong></p>
  
  <p>The bundle with user data is being saved in <code>/data/system/users/0/accounts.db</code>, but isn't being <del>saved</del> restored.</p>
  
  <p>Code</p>
  
  <pre><code>// 1st step) Adding account with extra user data
  String email = "betorcs@mail.com";
  
  final Account a = new Account(email, getString(R.string.accountType));
  final Bundle userData = new Bundle();
  userData.putString("firstName", "Roberto");
  
  final AccountManager am = AccountManager.get(context);
  boolean saved = am.addAccountExplicitly(a, null, userData); // It's always returning true
  
  // 2nd step) Restoring account and extra user data
  Account[] as = am.getAccountsByType(getString(R.string.accountType)); // Assuming as.length == 1
  String firstName = am.getUserData(as[0], "firstName"); // It's always null
  </code></pre>
  
  <p>Permissions</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /&gt;
  </code></pre>
  
  <p><strong>BUT</strong></p>
  
  <p>If i remove the permission <code>android.permission.MANAGE_ACCOUNTS</code> from manifest, everything works fine.</p>
  
  <p>Does someone can see what it's wrong? Or why this behavior?</p>
  
  <p>Thanks</p>