Ensure that security notification is posted if not active

Bug: 7007658

Change-Id: Ia422c30c47b044279471e549541ac6279735828c
This commit is contained in:
Marc Blank 2012-08-17 11:22:19 -07:00
parent 49e6099840
commit bc53491b95
2 changed files with 11 additions and 1 deletions

View File

@ -1742,7 +1742,11 @@ public abstract class SyncManager extends Service implements Runnable {
if (policy == null) {
policy = Policy.restorePolicyWithId(INSTANCE, policyKey);
account.mPolicy = policy;
if (!PolicyServiceProxy.isActive(ssm, policy)) return false;
if (!PolicyServiceProxy.isActive(ssm, policy)) {
PolicyServiceProxy.setAccountHoldFlag(ssm, account, true);
log("canAutoSync; policies not active, set hold flag");
return false;
}
}
if (policy != null && policy.mRequireManualSyncWhenRoaming && networkInfo.isRoaming()) {
return false;

View File

@ -452,6 +452,10 @@ public class SecurityPolicy {
Account account = Account.restoreAccountWithId(context, accountId);
if (account != null) {
setAccountHoldFlag(context, account, newState);
if (newState) {
// Make sure there's a notification up
NotificationController.getInstance(context).showSecurityNeededNotification(account);
}
}
}
@ -593,6 +597,8 @@ public class SecurityPolicy {
// Notify that policies changed
NotificationController.getInstance(mContext).showSecurityChangedNotification(
account);
} else {
Log.d(Logging.LOG_TAG, "Policy is active and unchanged; do not notify.");
}
} else {
setHold = true;