am 3b175a0b: Merge "Check for accounts when enabling sync features."
* commit '3b175a0b5d1355ed8f220cd39e5b74e9ee565371': Check for accounts when enabling sync features.main
commit
059c335f4e
|
@ -118,11 +118,17 @@ public final class AccountsSettingsFragment extends SubScreenFragment {
|
||||||
if (!ProductionFlags.ENABLE_USER_HISTORY_DICTIONARY_SYNC) {
|
if (!ProductionFlags.ENABLE_USER_HISTORY_DICTIONARY_SYNC) {
|
||||||
removeSyncPreferences();
|
removeSyncPreferences();
|
||||||
} else {
|
} else {
|
||||||
|
// Temporarily disable the preferences till we can
|
||||||
|
// check that we don't have a work profile.
|
||||||
disableSyncPreferences();
|
disableSyncPreferences();
|
||||||
new ManagedProfileCheckerTask(this).execute();
|
new ManagedProfileCheckerTask(this).execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task to check work profile. If found, it removes the sync prefs. If not,
|
||||||
|
* it enables them.
|
||||||
|
*/
|
||||||
private static class ManagedProfileCheckerTask extends AsyncTask<Void, Void, Void> {
|
private static class ManagedProfileCheckerTask extends AsyncTask<Void, Void, Void> {
|
||||||
private final AccountsSettingsFragment mFragment;
|
private final AccountsSettingsFragment mFragment;
|
||||||
|
|
||||||
|
@ -135,7 +141,8 @@ public final class AccountsSettingsFragment extends SubScreenFragment {
|
||||||
if (ManagedProfileUtils.getInstance().hasWorkProfile(mFragment.getActivity())) {
|
if (ManagedProfileUtils.getInstance().hasWorkProfile(mFragment.getActivity())) {
|
||||||
mFragment.removeSyncPreferences();
|
mFragment.removeSyncPreferences();
|
||||||
} else {
|
} else {
|
||||||
mFragment.enableSyncPreferences();
|
mFragment.refreshAccountAndDependentPreferences(
|
||||||
|
mFragment.getSignedInAccountName());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue