Hide accounts of users that should not be shown

Bug: 318825347
Change-Id: If0f5cae8648e70c0e9c039d9b73cdc5be72b09d3
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index cdaba20..dd8c69a 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -42,6 +42,7 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
+import android.content.pm.UserProperties;
 import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
@@ -336,6 +337,10 @@
             }
             return;
         }
+        if (mUm.getUserProperties(userInfo.getUserHandle()).getShowInSettings()
+                == UserProperties.SHOW_IN_SETTINGS_NO) {
+            return;
+        }
         final Context context = mContext;
         final ProfileData profileData = new ProfileData();
         profileData.userInfo = userInfo;