Loading src/com/android/contacts/editor/ContactEditorUtils.java +11 −6 Original line number Diff line number Diff line Loading @@ -203,7 +203,8 @@ public class ContactEditorUtils { } /** * @return true if the contact editor should show the "accounts changed" notification, that is: * @return false if there is only one writable account or no requirement to return true is met. * true if the contact editor should show the "accounts changed" notification, that is: * - If it's the first launch. * - Or, if the default account has been removed. * (And some extra sanity check) Loading @@ -214,12 +215,16 @@ public class ContactEditorUtils { */ @NeededForTesting public boolean shouldShowAccountChangedNotification() { final List<AccountWithDataSet> currentWritableAccounts = getWritableAccounts(); if (currentWritableAccounts.size() == 1) { return false; } if (isFirstLaunch()) { return true; } final List<AccountWithDataSet> currentWritableAccounts = getWritableAccounts(); final AccountWithDataSet defaultAccount = getDefaultAccount(); // Does default account still exist? Loading tests/src/com/android/contacts/editor/ContactEditorUtilsTest.java +2 −4 Original line number Diff line number Diff line Loading @@ -175,7 +175,6 @@ public class ContactEditorUtilsTest extends AndroidTestCase { * 0 accounts. */ public void testShouldShowAccountChangedNotification_0Accounts() { // There's always at least one writable type... setAccountTypes(TYPE1); // First launch -- always true. Loading Loading @@ -250,8 +249,8 @@ public class ContactEditorUtilsTest extends AndroidTestCase { setAccountTypes(TYPE1, TYPE2); setAccounts(ACCOUNT_1_A); // First launch -- always true. assertTrue(mTarget.shouldShowAccountChangedNotification()); // Always returns false when 1 writable account. assertFalse(mTarget.shouldShowAccountChangedNotification()); // User saves a new contact. mTarget.saveDefaultAndAllAccounts(ACCOUNT_1_A); Loading @@ -267,7 +266,6 @@ public class ContactEditorUtilsTest extends AndroidTestCase { * 0 accounts, and the user selected "local only". */ public void testShouldShowAccountChangedNotification_0Account_localOnly() { // There's always at least one writable type... setAccountTypes(TYPE1); // First launch -- always true. Loading Loading
src/com/android/contacts/editor/ContactEditorUtils.java +11 −6 Original line number Diff line number Diff line Loading @@ -203,7 +203,8 @@ public class ContactEditorUtils { } /** * @return true if the contact editor should show the "accounts changed" notification, that is: * @return false if there is only one writable account or no requirement to return true is met. * true if the contact editor should show the "accounts changed" notification, that is: * - If it's the first launch. * - Or, if the default account has been removed. * (And some extra sanity check) Loading @@ -214,12 +215,16 @@ public class ContactEditorUtils { */ @NeededForTesting public boolean shouldShowAccountChangedNotification() { final List<AccountWithDataSet> currentWritableAccounts = getWritableAccounts(); if (currentWritableAccounts.size() == 1) { return false; } if (isFirstLaunch()) { return true; } final List<AccountWithDataSet> currentWritableAccounts = getWritableAccounts(); final AccountWithDataSet defaultAccount = getDefaultAccount(); // Does default account still exist? Loading
tests/src/com/android/contacts/editor/ContactEditorUtilsTest.java +2 −4 Original line number Diff line number Diff line Loading @@ -175,7 +175,6 @@ public class ContactEditorUtilsTest extends AndroidTestCase { * 0 accounts. */ public void testShouldShowAccountChangedNotification_0Accounts() { // There's always at least one writable type... setAccountTypes(TYPE1); // First launch -- always true. Loading Loading @@ -250,8 +249,8 @@ public class ContactEditorUtilsTest extends AndroidTestCase { setAccountTypes(TYPE1, TYPE2); setAccounts(ACCOUNT_1_A); // First launch -- always true. assertTrue(mTarget.shouldShowAccountChangedNotification()); // Always returns false when 1 writable account. assertFalse(mTarget.shouldShowAccountChangedNotification()); // User saves a new contact. mTarget.saveDefaultAndAllAccounts(ACCOUNT_1_A); Loading @@ -267,7 +266,6 @@ public class ContactEditorUtilsTest extends AndroidTestCase { * 0 accounts, and the user selected "local only". */ public void testShouldShowAccountChangedNotification_0Account_localOnly() { // There's always at least one writable type... setAccountTypes(TYPE1); // First launch -- always true. Loading