Fix an issue in NPMS blockedReasons computation logic.
If an app does not have the permission to access network in Restricted mode, we should be removing ALLOWED_REASON_RESTRICTED_MODE_PERMISSIONS from the uid's allowedReasons but right now, we end up removing all the allowedReasons except ALLOWED_REASON_RESTRICTED_MODE_PERMISSIONS and this could result in sending wrong network state to apps. Bug: 202213533 Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java Change-Id: Ibcae147bf4ba84ff91ef7038ffef8c33082b82ca
This commit is contained in:
@@ -4053,7 +4053,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
if (hasRestrictedModeAccess(uid)) {
|
||||
uidBlockedState.allowedReasons |= ALLOWED_REASON_RESTRICTED_MODE_PERMISSIONS;
|
||||
} else {
|
||||
uidBlockedState.allowedReasons &= ALLOWED_REASON_RESTRICTED_MODE_PERMISSIONS;
|
||||
uidBlockedState.allowedReasons &= ~ALLOWED_REASON_RESTRICTED_MODE_PERMISSIONS;
|
||||
}
|
||||
uidBlockedState.updateEffectiveBlockedReasons();
|
||||
if (oldEffectiveBlockedReasons != uidBlockedState.effectiveBlockedReasons) {
|
||||
|
||||
Reference in New Issue
Block a user