From bfd1d6ed49579edca1494eb690dfa552c56b58b2 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Tue, 23 Aug 2016 16:09:36 -0700 Subject: Do not print misleading debug messages in some scenarios. When the mobile network is not active, querying the network information might trigger the misleading debug messages. Added some condition checks to prevent this. bug: 30850733 Change-Id: Ice6d548a56f98bac7fe2ca6a06148350b505533d --- core/java/android/net/NetworkIdentity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/java/android/net/NetworkIdentity.java b/core/java/android/net/NetworkIdentity.java index 9cd563e87c4a..d570e66a2435 100644 --- a/core/java/android/net/NetworkIdentity.java +++ b/core/java/android/net/NetworkIdentity.java @@ -175,7 +175,11 @@ public class NetworkIdentity implements Comparable { if (isNetworkTypeMobile(type)) { if (state.subscriberId == null) { - Slog.w(TAG, "Active mobile network without subscriber!"); + if (state.networkInfo.getState() != NetworkInfo.State.DISCONNECTED && + state.networkInfo.getState() != NetworkInfo.State.UNKNOWN) { + Slog.w(TAG, "Active mobile network without subscriber! ni = " + + state.networkInfo); + } } subscriberId = state.subscriberId; -- cgit v1.2.3-59-g8ed1b