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
This commit is contained in:
Doris Ling
2016-11-10 15:12:52 -08:00
parent 8a2e2fa2a7
commit bfac31b517
12 changed files with 1174 additions and 635 deletions

View File

@@ -26,6 +26,8 @@ import com.android.settingslib.drawer.CategoryKey;
import java.util.ArrayList;
import java.util.List;
import static android.provider.Settings.EXTRA_AUTHORITIES;
public class UserAndAccountDashboardFragment extends DashboardFragment {
private static final String TAG = "UserAndAccountDashboard";
@@ -61,6 +63,11 @@ public class UserAndAccountDashboardFragment extends DashboardFragment {
controllers.add(new AutoSyncDataPreferenceController(context, this));
controllers.add(new AutoSyncPersonalDataPreferenceController(context, this));
controllers.add(new AutoSyncWorkDataPreferenceController(context, this));
String[] authorities = getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
final AccountPreferenceController accountPrefController =
new AccountPreferenceController(context, this, authorities);
getLifecycle().addObserver(accountPrefController);
controllers.add(accountPrefController);
return controllers;
}