From 26bc3d1abaa7c61e921f50d0a3894b89b7e0db68 Mon Sep 17 00:00:00 2001 From: Ken Chen Date: Mon, 30 Jan 2023 18:01:56 +0800 Subject: Code Health: Reduce nesting A follow-up commit of aosp/2389516. Bug: 265503240 Bug: 263219497 Test: atest Change-Id: I3e646f646508f1f6077d2b20d49f2c40887fca2d --- server/NetworkController.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp index 3e38d48e..e61ee306 100644 --- a/server/NetworkController.cpp +++ b/server/NetworkController.cpp @@ -827,11 +827,10 @@ bool NetworkController::isUidAllowed(unsigned netId, uid_t uid) const { Network* network = getNetworkLocked(netId); // Exempt when no netId is specified and there is no default network, so that apps or tests can // do DNS lookups for hostnames in etc/hosts. - if ((network && network->isUidAllowed(uid)) || - (netId == NETID_UNSET && mDefaultNetId == NETID_UNSET)) { + if (netId == NETID_UNSET && mDefaultNetId == NETID_UNSET) { return true; } - return false; + return network && network->isUidAllowed(uid); } bool NetworkController::isValidNetworkLocked(unsigned netId) const { -- cgit v1.2.3