Fix issue with ignoring dpm policy for first call.

Fix the fact that the first call to
userAllowsPrivateNotificationsInPublic ignores flags
set by the dpm.

Change-Id: Ib6f33edc00f822eb45d13ba2366ddb2c68179e73
This commit is contained in:
Kenny Guy
2015-02-10 16:13:11 +00:00
parent 92b2fe5d0d
commit b0d3ab2ce9

View File

@@ -1181,14 +1181,15 @@ public abstract class BaseStatusBar extends SystemUI implements
}
if (mUsersAllowingPrivateNotifications.indexOfKey(userHandle) < 0) {
final boolean allowed = 0 != Settings.Secure.getIntForUser(
final boolean allowedByUser = 0 != Settings.Secure.getIntForUser(
mContext.getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0, userHandle);
final int dpmFlags = mDevicePolicyManager.getKeyguardDisabledFeatures(null /* admin */,
userHandle);
final boolean allowedByDpm = (dpmFlags
& DevicePolicyManager.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS) == 0;
mUsersAllowingPrivateNotifications.append(userHandle, allowed && allowedByDpm);
final boolean allowed = allowedByUser && allowedByDpm;
mUsersAllowingPrivateNotifications.append(userHandle, allowed);
return allowed;
}