From de99c7a9f4ae91ac3614ec8e55f41e14c18a8ee8 Mon Sep 17 00:00:00 2001 From: Aaron Huang Date: Mon, 6 Jun 2022 13:56:45 +0800 Subject: [PATCH] Remove debug log from NetworkStatsService This change reverts aosp/1777887. The exception was used to get the stack while the mMobileIfaces contains null interface, and currently mMobileIfaces is protected by making it volatile so it is fine to be removed. Also, fix style error in NetworkStatsServiceTest Test: build, FrameworksNetTests Change-Id: I8435354f8cfd05589c0231f3bb8cbaa66c0525cf --- .../server/net/NetworkStatsService.java | 10 --------- .../server/net/NetworkStatsServiceTest.java | 22 +++++++++---------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/service-t/src/com/android/server/net/NetworkStatsService.java b/service-t/src/com/android/server/net/NetworkStatsService.java index 0ae227a9a4..ff6e45d04f 100644 --- a/service-t/src/com/android/server/net/NetworkStatsService.java +++ b/service-t/src/com/android/server/net/NetworkStatsService.java @@ -1597,11 +1597,6 @@ public class NetworkStatsService extends INetworkStatsService.Stub { @Override public String[] getMobileIfaces() { - // TODO (b/192758557): Remove debug log. - if (CollectionUtils.contains(mMobileIfaces, null)) { - throw new NullPointerException( - "null element in mMobileIfaces: " + Arrays.toString(mMobileIfaces)); - } return mMobileIfaces.clone(); } @@ -2072,11 +2067,6 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } mMobileIfaces = mobileIfaces.toArray(new String[0]); - // TODO (b/192758557): Remove debug log. - if (CollectionUtils.contains(mMobileIfaces, null)) { - throw new NullPointerException( - "null element in mMobileIfaces: " + Arrays.toString(mMobileIfaces)); - } } private static int getSubIdForMobile(@NonNull NetworkStateSnapshot state) { diff --git a/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java b/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java index 3708d2e97e..4fbbc75bf1 100644 --- a/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java +++ b/tests/unit/java/com/android/server/net/NetworkStatsServiceTest.java @@ -140,6 +140,17 @@ import com.android.testutils.HandlerUtils; import com.android.testutils.TestBpfMap; import com.android.testutils.TestableNetworkStatsProviderBinder; +import libcore.testing.io.TestIoUtils; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + import java.io.File; import java.nio.file.Files; import java.nio.file.Path; @@ -153,17 +164,6 @@ import java.util.Objects; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; -import libcore.testing.io.TestIoUtils; - -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - /** * Tests for {@link NetworkStatsService}. *