Commit Graph

28 Commits

Author SHA1 Message Date
Doris Ling
ce5f9c07da Fix new account not shown for work profile.
When refreshing the Accounts settings UI, we uses the cached user info
for checking user status. However, when the work profile is being
updated, the UserInfo obejct for the user might be updated even the
user id is the same. Using the cached data causes stale info to be
returned for the user and results in the latest account data not
being shown properly for the user. Update the cache to the latest user
info retrieved from user manager.

Change-Id: Ic0127842203f0288f2fdea6c6346cd11e42a8bf0
Fix: 38302246
Test: make RunSettingsRoboTests
2018-07-23 16:13:39 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
James Lemieux
22a39c2b93 Use external/robolectric-shadows/run_robotests.mk
This allows Settings to test against the latest framework changes.

Also replaced TestConfig with traditional robolectric.properties.

Bug: 73173204
Bug: 73892008
Test: make -j56 RunSettingsRoboTests
Change-Id: I3135b4fa5f095ba79b282a76f45dd9baa2584bc7
2018-03-04 03:50:08 -08:00
jeffreyhuang
cbfb099a40 Rename SDK_VERSION_O to SDK_VERSION
Test: make RunSettingsRoboTests -j40
Change-Id: I6715062d8addadda441e32809db1af55f15e3a90
2017-12-05 16:43:54 -08:00
jeffreyhuang
90f59be20b Move accounts package tests to sdk 26
Test: make RunSettingsRoboTests -j40
Change-Id: I5f5a1f87aff5e1067e9339010b988e58fcc5b704
2017-11-22 14:24:45 -08:00
Daniel Nishi
739b0eef10 Move the Robolectric shadow config up.
In my testing, this reduces the runtime of the Robolectric Settings test
suite on my Z840 workstation from 440 seconds to 402 seconds on average.
By avoiding having a method-level Robolectric shadow import, we avoid
going down a code path which needs to add more shadows later in the
Robolectric execution.

Bug: 64808827
Test: Settings robotests still pass
Change-Id: I7b40d73b30306ae3f9759281afbd7f7266579e24
2017-08-17 14:37:27 -07:00
Andrew Sapperstein
9f1e911759 Refactor test runner to use static list of resource paths
Previously everything lived in an inner class method of
SettingsRobolectricTestRunner. That method has now been turned into
a static method so that it can be called by other runners.

Bug: 62460102
Test: robotests
Change-Id: I6612b1f26404587301c534c8ba60e39d59d6c840
2017-06-09 09:21:26 -07:00
Doris Ling
7ecd696dff Remove the duplicate test case that is added by auto-merge.
Change-Id: I0f2f30eed80ab550c16c64a44407ce0199090550
Fix: 38302246
Test: make RunSettingsRoboTests
2017-05-26 13:22:13 -07:00
Doris Ling
02981294b1 Merge "Fix issue for new account not being shown in work profile." into oc-dev am: dd7912e12f
am: 65dbe820bd

Change-Id: I4ced2b59e73ea155528964e927f7a07ed9d9a63f
2017-05-26 19:46:28 +00:00
TreeHugger Robot
dd7912e12f Merge "Fix issue for new account not being shown in work profile." into oc-dev 2017-05-26 19:38:38 +00:00
Fan Zhang
bfbe45fd95 Reduce flakiess in account preference controller test.
The getDrawable method from AuthenticatorHelper randomly fails and
causes test flake. Replaced with a shadow.

Test: rerun robotests
Change-Id: I39afeb9082a35786a05c0e8e5adc337c850ad666
2017-05-25 13:17:43 -07:00
Maurice Lam
046400c2c4 Migrate settings robolectric tests to mockito 2
- Migrated ArgumentMatcher subclasses to lambdas
- Replaced any() with nullable() where tests were failing

Test: cd tests/robotests && mma
Bug: 38456058
Change-Id: Ice8c39b435c45b87f82dbbd9860e68f235314cf8
2017-05-24 15:14:31 -07:00
TreeHugger Robot
3f4056212f Merge "Fix issue for new account not being shown in work profile." 2017-05-18 18:55:27 +00:00
Fan Zhang
c754f59fb0 Fix bug where accounts are duplicated in user&account list.
This happens when user has different accounts with same account name. For
example: user@domain.com for type1 and same email for type2, etc. When
we refresh the account list during onResume(), the same account name
incorrectly causes the logic to think they are the same account and
updates the account list by mistake.

- Introduced a util method to generate unique key from Account object.
And set it as preference key.
- when updating preference on screen, use key to find preference instead
of the preference instance itself.

Change-Id: I0aa692cb965b7037155a746389a919cd155843da
Fix: 34035653
Test: make RunSettingsRoboTests
2017-05-17 23:50:30 +00:00
Doris Ling
71090678c0 Fix issue for new account not being shown in work profile.
When refreshing the UI, we tried to only create profile data for new
profile, and skip the initialization for existing profiles. However,
the authentication helper will not get the updated account list, since
the account update listener is being paused. Re-create the
authentication helper to get the latest list of enabled accounts.

Change-Id: Ie29699456e5b32747e8158d51382afaa2c0c5908
Fix: 38302246
Test: make RunSettingsRoboTests
2017-05-17 23:42:17 +00:00
Doris Ling
48b8440ea6 Fix issue for new account not being shown in work profile.
When refreshing the UI, we tried to only create profile data for new
profile, and skip the initialization for existing profiles. However,
the authentication helper will not get the updated account list, since
the account update listener is being paused. Re-create the
authentication helper to get the latest list of enabled accounts.

Change-Id: Ie29699456e5b32747e8158d51382afaa2c0c5908
Fix: 38302246
Test: make RunSettingsRoboTests
2017-05-16 17:48:32 -07:00
Doris Ling
633250bd78 Also update the account preferences in displayPreference().
- start creating the account preferences in displayPreference() to make
the data available earlier.
- when trying to update the UI when the page is resumed, instead of
clearing the whole list and add the latest accounts, compare the
differences between the currently shown accounts and the latest accounts
and only update the account preferences that has been changed.

Change-Id: I249eb2fe67f4adaab02bf77680c62d07756dc94a
Fix: 34035653
Test: make RunSettingsRoboTests
2017-05-10 11:59:47 -07:00
Doris Ling
f2cf2aea37 Remove code that check for dashboard feature.
- remove DashboardFeatureProvider.isEnabled() and all relating code
and tests.

Bug: 35764802
Test: make RunSettingsRoboTests
Change-Id: If7796677abc8904b7436525836d50cdef38e37a4
2017-03-07 11:15:03 -08:00
Doris Ling
f074f0f6dd Removed AccountSettings used in old IA only.
- remove AccountSettings and all related code that is used in old IA, so
that it will not show up in search.

Change-Id: I9f83112f760fd991caf89de109fde9e675b8c981
Fix: 34165913
Test: make RunSettingsRoboTests
2017-02-24 16:04:35 -08:00
Doris Ling
829d3aaa7a Update text for User & accounts page.
- Add the user name to the Account preference group title.
- Add the summary text to Emergency information.

Bug: 34976320
Test: make RunSettingsRoboTests
Change-Id: I771e355ce3b313ffa50feb5c5e7907b1f3857592
2017-02-07 10:35:47 -08:00
Fan Zhang
c7804c130b Another attempt fix for account preference screen.
Fix: 34219500
Test: RunSettingsRoboTests

Change-Id: I316e36496fc9d7eca9c718275c0f113b181d7f1e
2017-01-13 16:31:16 -08:00
Fan Zhang
81a030fdfa Fix NPE when adding account but prefManager doesn't exist
Change-Id: Ie7371ba461995bae96ed1d99e224ab7e0d7acc99
Fix: 34219500
Test: make -j40 RunSettingsRoboTests
2017-01-11 10:46:45 -08:00
Fan Zhang
424443bdb2 Fix NPE in accountPrefController
Change-Id: I83dba35604c501780fa9a99d122b9d9bc8068661
Fix: 34193417
Test: RunSettingsRoboTests
2017-01-10 11:50:42 -08:00
Esteban Talavera
e539c886fd Merge "Check new user restriction for profile removal" 2016-12-14 19:16:28 +00:00
Esteban Talavera
50e515e5ec Check new user restriction for profile removal
Test: make RunSettingsRoboTests
Bug: 31952368
Change-Id: I3c8b0820a5541201006d12f9893d5b89332334c2
2016-11-30 22:14:00 +00:00
Doris Ling
20d4b041f7 Add handling for account tiles for specific account type.
- List individual account instead of account type under User & account
  screen.

- Add handling to move account tiles with specific account type from
  top level account dashboard to inside the corresponding account
  preference.

- Rename settings.accounts.AccountPreference to
  settings.accounts.AccountTypePreference to make it less confused
  with settings.AccountPreference

Bug: 31801423
Test: make RunSettingsRoboTests
Change-Id: Iebe70a3c4230e8d979344f142a5c2a60945e552e
2016-11-29 14:18:30 -08:00
Doris Ling
bfac31b517 Add account preference controller.
- Add account preference controller and move the handling for
displaying user's accounts from AccountSettings to the
controller.

- Move AccountPreference and RemoveUserFragment from inner class to
standalone class.

- Add AccountRestrictionHelper to handle API that needs to be mocked for
testing.

Bug: 31801423
Test: make RunSettingsRoboTests
Change-Id: I3d16d0b6a8922a8abec7037c52b7a4de2d76eb0d
2016-11-17 16:33:36 -08:00