diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 50019a3..5826154 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -439,21 +439,36 @@
         List<Header> accountHeaders = new ArrayList<Header>(accountTypes.length);
         for (String accountType : accountTypes) {
             CharSequence label = mAuthenticatorHelper.getLabelForType(this, accountType);
+            Account[] accounts = AccountManager.get(this).getAccountsByType(accountType);
+            boolean skipToAccount = accounts.length == 1
+                    && !mAuthenticatorHelper.hasAccountPreferences(accountType);
             Header accHeader = new Header();
             accHeader.title = label;
             if (accHeader.extras == null) {
                 accHeader.extras = new Bundle();
             }
-            accHeader.extras.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE, accountType);
-            accHeader.breadCrumbTitle = label;
-            accHeader.breadCrumbShortTitle = label;
-            accHeader.fragment = ManageAccountsSettings.class.getName();
-            accHeader.fragmentArguments = new Bundle();
-            accHeader.fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE,
-                    accountType);
-            if (!isMultiPane()) {
-                accHeader.fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_LABEL,
-                        label.toString());
+            if (skipToAccount) {
+                accHeader.breadCrumbTitleRes = R.string.account_sync_settings_title;
+                accHeader.breadCrumbShortTitleRes = R.string.account_sync_settings_title;
+                accHeader.fragment = AccountSyncSettings.class.getName();
+                accHeader.fragmentArguments = new Bundle();
+                // Need this for the icon
+                accHeader.extras.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE, accountType);
+                accHeader.extras.putParcelable(AccountSyncSettings.ACCOUNT_KEY, accounts[0]);
+                accHeader.fragmentArguments.putParcelable(AccountSyncSettings.ACCOUNT_KEY,
+                        accounts[0]);
+            } else {
+                accHeader.breadCrumbTitle = label;
+                accHeader.breadCrumbShortTitle = label;
+                accHeader.fragment = ManageAccountsSettings.class.getName();
+                accHeader.fragmentArguments = new Bundle();
+                accHeader.extras.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE, accountType);
+                accHeader.fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE,
+                        accountType);
+                if (!isMultiPane()) {
+                    accHeader.fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_LABEL,
+                            label.toString());
+                }
             }
             accountHeaders.add(accHeader);
         }
@@ -642,8 +657,8 @@
 
                     //$FALL-THROUGH$
                 case HEADER_TYPE_NORMAL:
-                    if (header.extras != null && header.extras.containsKey(
-                            ManageAccountsSettings.KEY_ACCOUNT_TYPE)) {
+                    if (header.extras != null
+                            && header.extras.containsKey(ManageAccountsSettings.KEY_ACCOUNT_TYPE)) {
                         String accType = header.extras.getString(
                                 ManageAccountsSettings.KEY_ACCOUNT_TYPE);
                         ViewGroup.LayoutParams lp = holder.icon.getLayoutParams();
diff --git a/src/com/android/settings/accounts/AuthenticatorHelper.java b/src/com/android/settings/accounts/AuthenticatorHelper.java
index 9c17a36..ab2fe74 100644
--- a/src/com/android/settings/accounts/AuthenticatorHelper.java
+++ b/src/com/android/settings/accounts/AuthenticatorHelper.java
@@ -124,4 +124,14 @@
     public AuthenticatorDescription getAccountTypeDescription(String accountType) {
         return mTypeToAuthDescription.get(accountType);
     }
+
+    public boolean hasAccountPreferences(final String accountType) {
+        if (containsAccountType(accountType)) {
+            AuthenticatorDescription desc = getAccountTypeDescription(accountType);
+            if (desc != null && desc.accountPreferencesId != 0) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
