Merge "b/17193866. Update policies when we reconcile." into ub-gmail-ur14-dev
automerge: 355e9df
* commit '355e9dffc35fa9b3084a7f49ff985427fda2ea06':
b/17193866. Update policies when we reconcile.
This commit is contained in:
commit
982394da32
@ -31,6 +31,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import com.android.email.NotificationController;
|
import com.android.email.NotificationController;
|
||||||
import com.android.email.R;
|
import com.android.email.R;
|
||||||
|
import com.android.email.SecurityPolicy;
|
||||||
import com.android.email.service.EmailServiceUtils;
|
import com.android.email.service.EmailServiceUtils;
|
||||||
import com.android.email.service.EmailServiceUtils.EmailServiceInfo;
|
import com.android.email.service.EmailServiceUtils.EmailServiceInfo;
|
||||||
import com.android.emailcommon.Logging;
|
import com.android.emailcommon.Logging;
|
||||||
@ -40,7 +41,6 @@ import com.android.mail.utils.LogUtils;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -212,6 +212,7 @@ public class AccountReconciler {
|
|||||||
}
|
}
|
||||||
// Now, look through AccountManager accounts to make sure we have a corresponding cached EAS
|
// Now, look through AccountManager accounts to make sure we have a corresponding cached EAS
|
||||||
// account from EmailProvider
|
// account from EmailProvider
|
||||||
|
boolean needsPolicyUpdate = false;
|
||||||
for (final android.accounts.Account accountManagerAccount : accountManagerAccounts) {
|
for (final android.accounts.Account accountManagerAccount : accountManagerAccounts) {
|
||||||
final String accountManagerAccountName = accountManagerAccount.name;
|
final String accountManagerAccountName = accountManagerAccount.name;
|
||||||
if (!hasEpAccount(emailProviderAccounts, accountManagerAccountName)) {
|
if (!hasEpAccount(emailProviderAccounts, accountManagerAccountName)) {
|
||||||
@ -236,6 +237,9 @@ public class AccountReconciler {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogUtils.w(Logging.LOG_TAG, e.toString());
|
LogUtils.w(Logging.LOG_TAG, e.toString());
|
||||||
}
|
}
|
||||||
|
// Just set a flag that our policies need to be updated with device
|
||||||
|
// So we can do the update, one time, at a later point in time.
|
||||||
|
needsPolicyUpdate = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fix up the Calendar and Contacts syncing. It used to be possible for IMAP and
|
// Fix up the Calendar and Contacts syncing. It used to be possible for IMAP and
|
||||||
@ -256,6 +260,12 @@ public class AccountReconciler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needsPolicyUpdate) {
|
||||||
|
// We have removed accounts from the AccountManager, let's make sure that
|
||||||
|
// our policies are up to date.
|
||||||
|
SecurityPolicy.getInstance(context).policiesUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
final String composeActivityName =
|
final String composeActivityName =
|
||||||
context.getString(R.string.reconciliation_compose_activity_name);
|
context.getString(R.string.reconciliation_compose_activity_name);
|
||||||
if (!TextUtils.isEmpty(composeActivityName)) {
|
if (!TextUtils.isEmpty(composeActivityName)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user