Merge "Update account sync settings title." into oc-dev am: a031636725
am: c669438450

Change-Id: I5a163d5e3902c04f1006a15e4a330f55f6af0ef9
diff --git a/src/com/android/settings/accounts/AccountPreferenceBase.java b/src/com/android/settings/accounts/AccountPreferenceBase.java
index 2ad21d9..7c3b54c 100644
--- a/src/com/android/settings/accounts/AccountPreferenceBase.java
+++ b/src/com/android/settings/accounts/AccountPreferenceBase.java
@@ -17,14 +17,10 @@
 
 package com.android.settings.accounts;
 
-import android.accounts.AuthenticatorDescription;
 import android.app.Activity;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.SyncStatusObserver;
-import android.content.pm.PackageManager;
-import android.content.res.Resources;
-import android.content.res.Resources.Theme;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Handler;
@@ -32,12 +28,10 @@
 import android.os.UserManager;
 import android.support.v7.preference.PreferenceScreen;
 import android.text.format.DateFormat;
-import android.text.format.DateUtils;
 import android.util.Log;
 
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.Utils;
-import com.android.settings.utils.LocalClassLoaderContextThemeWrapper;
 import com.android.settingslib.accounts.AuthenticatorHelper;
 
 import java.util.ArrayList;
diff --git a/src/com/android/settings/accounts/AccountSyncPreferenceController.java b/src/com/android/settings/accounts/AccountSyncPreferenceController.java
index 57d317b..0b095f7 100644
--- a/src/com/android/settings/accounts/AccountSyncPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountSyncPreferenceController.java
@@ -25,6 +25,7 @@
 import android.support.v7.preference.Preference;
 
 import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.core.PreferenceController;
 
@@ -53,8 +54,9 @@
         final Bundle args = new Bundle();
         args.putParcelable(AccountSyncSettings.ACCOUNT_KEY, mAccount);
         args.putParcelable(EXTRA_USER, mUserHandle);
-        Utils.startWithFragment(mContext, AccountSyncSettings.class.getName(), args, null, 0, -1,
-            mAccount.name, MetricsProto.MetricsEvent.ACCOUNT);
+        Utils.startWithFragment(mContext, AccountSyncSettings.class.getName(), args, null, 0,
+                R.string.account_sync_title, null, MetricsProto.MetricsEvent.ACCOUNT);
+
         return true;
     }
 
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java
index 26c640d..c159a24 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountSyncPreferenceControllerTest.java
@@ -15,11 +15,16 @@
  */
 package com.android.settings.accounts;
 
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.mock;
+
 import android.accounts.Account;
 import android.content.Context;
+import android.content.Intent;
 import android.os.UserHandle;
 import android.support.v7.preference.Preference;
 
+import com.android.settings.R;
 import com.android.settings.SettingsActivity;
 import com.android.settings.SettingsRobolectricTestRunner;
 import com.android.settings.TestConfig;
@@ -29,9 +34,6 @@
 import org.robolectric.annotation.Config;
 import org.robolectric.shadows.ShadowApplication;
 
-import static org.mockito.Mockito.mock;
-import static com.google.common.truth.Truth.assertThat;
-
 @RunWith(SettingsRobolectricTestRunner.class)
 @Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
 public class AccountSyncPreferenceControllerTest {
@@ -42,13 +44,18 @@
         final Context context = application.getApplicationContext();
         final Preference preference = new Preference(context);
         preference.setKey("account_sync");
-        AccountSyncPreferenceController controller = new AccountSyncPreferenceController(context);
-        controller.init(new Account("acct1", "type1"), mock(UserHandle.class));
 
+        final AccountSyncPreferenceController controller =
+                new AccountSyncPreferenceController(context);
+        controller.init(new Account("acct1", "type1"), mock(UserHandle.class));
         controller.handlePreferenceTreeClick(preference);
 
-        assertThat(application.getNextStartedActivity().getStringExtra(
-            SettingsActivity.EXTRA_SHOW_FRAGMENT)).isEqualTo(AccountSyncSettings.class.getName());
+        final Intent nextActivity = application.getNextStartedActivity();
+
+        assertThat(nextActivity.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
+                .isEqualTo(AccountSyncSettings.class.getName());
+        assertThat(nextActivity.getIntExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, 0))
+                .isEqualTo(R.string.account_sync_title);
     }
 
 }