diff options
author | Irfan Sheriff <isheriff@google.com> | 2012-11-30 14:07:44 -0800 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2012-11-30 15:58:46 -0800 |
commit | f0afe4144d09aa9b980cffd444911ab118fa9cbe (patch) | |
tree | 4525238af4b88750a89b8b330aab28baac2d5d31 /wifi | |
parent | ef8da9fe0b70fdbbb54bb0645ac66f75f58f31b8 (diff) | |
download | frameworks_base-f0afe4144d09aa9b980cffd444911ab118fa9cbe.zip frameworks_base-f0afe4144d09aa9b980cffd444911ab118fa9cbe.tar.gz frameworks_base-f0afe4144d09aa9b980cffd444911ab118fa9cbe.tar.bz2 |
Cleanup logging
Change-Id: Ieea19853c069266b55cad80cce3743b5ba91218a
Diffstat (limited to 'wifi')
5 files changed, 67 insertions, 71 deletions
diff --git a/wifi/java/android/net/wifi/SupplicantStateTracker.java b/wifi/java/android/net/wifi/SupplicantStateTracker.java index d1e9b67..f7fc795 100644 --- a/wifi/java/android/net/wifi/SupplicantStateTracker.java +++ b/wifi/java/android/net/wifi/SupplicantStateTracker.java @@ -28,6 +28,9 @@ import android.os.Parcelable; import android.os.UserHandle; import android.util.Log; +import java.io.FileDescriptor; +import java.io.PrintWriter; + /** * Tracks the state changes in supplicant and provides functionality * that is based on these state changes: @@ -80,7 +83,8 @@ class SupplicantStateTracker extends StateMachine { addState(mDormantState, mDefaultState); setInitialState(mUninitializedState); - + setLogRecSize(50); + setLogOnlyTransitions(true); //start the state machine start(); } @@ -327,4 +331,13 @@ class SupplicantStateTracker extends StateMachine { if (DBG) Log.d(TAG, getName() + "\n"); } } + + @Override + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + super.dump(fd, pw, args); + pw.println("mAuthenticationFailuresCount " + mAuthenticationFailuresCount); + pw.println("mAuthFailureInSupplicantBroadcast " + mAuthFailureInSupplicantBroadcast); + pw.println("mNetworksDisabledDuringConnect " + mNetworksDisabledDuringConnect); + pw.println(); + } } diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java index c3278a9..135446f 100644 --- a/wifi/java/android/net/wifi/WifiConfigStore.java +++ b/wifi/java/android/net/wifi/WifiConfigStore.java @@ -44,9 +44,11 @@ import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; +import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.io.PrintWriter; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; @@ -1544,15 +1546,14 @@ class WifiConfigStore { return key.hashCode(); } - String dump() { - StringBuffer sb = new StringBuffer(); - String LS = System.getProperty("line.separator"); - sb.append("mLastPriority ").append(mLastPriority).append(LS); - sb.append("Configured networks ").append(LS); + void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println("WifiConfigStore"); + pw.println("mLastPriority " + mLastPriority); + pw.println("Configured networks"); for (WifiConfiguration conf : getConfiguredNetworks()) { - sb.append(conf).append(LS); + pw.println(conf); } - return sb.toString(); + pw.println(); } public String getConfigFile() { diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 459b54f..5ed3acb 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -70,7 +70,6 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.os.WorkSource; import android.provider.Settings; -import android.util.EventLog; import android.util.Log; import android.util.LruCache; @@ -81,6 +80,8 @@ import com.android.internal.util.Protocol; import com.android.internal.util.State; import com.android.internal.util.StateMachine; +import java.io.FileDescriptor; +import java.io.PrintWriter; import java.net.InetAddress; import java.util.ArrayList; import java.util.List; @@ -221,11 +222,6 @@ public class WifiStateMachine extends StateMachine { private AsyncChannel mWifiP2pChannel = new AsyncChannel(); private AsyncChannel mWifiApConfigChannel = new AsyncChannel(); - // Event log tags (must be in sync with event-log-tags) - private static final int EVENTLOG_WIFI_STATE_CHANGED = 50021; - private static final int EVENTLOG_WIFI_EVENT_HANDLED = 50022; - private static final int EVENTLOG_SUPPLICANT_STATE_CHANGED = 50023; - /* The base for wifi message types */ static final int BASE = Protocol.BASE_WIFI; /* Load the driver */ @@ -1164,26 +1160,23 @@ public class WifiStateMachine extends StateMachine { } @Override - public String toString() { - StringBuffer sb = new StringBuffer(); - String LS = System.getProperty("line.separator"); - sb.append("current HSM state: ").append(getCurrentState().getName()).append(LS); - sb.append("mLinkProperties ").append(mLinkProperties).append(LS); - sb.append("mWifiInfo ").append(mWifiInfo).append(LS); - sb.append("mDhcpResults ").append(mDhcpResults).append(LS); - sb.append("mNetworkInfo ").append(mNetworkInfo).append(LS); - sb.append("mLastSignalLevel ").append(mLastSignalLevel).append(LS); - sb.append("mLastBssid ").append(mLastBssid).append(LS); - sb.append("mLastNetworkId ").append(mLastNetworkId).append(LS); - sb.append("mReconnectCount ").append(mReconnectCount).append(LS); - sb.append("mIsScanMode ").append(mIsScanMode).append(LS); - sb.append("mUserWantsSuspendOpt ").append(mUserWantsSuspendOpt).append(LS); - sb.append("mSuspendOptNeedsDisabled ").append(mSuspendOptNeedsDisabled).append(LS); - sb.append("Supplicant status").append(LS) - .append(mWifiNative.status()).append(LS).append(LS); - - sb.append(mWifiConfigStore.dump()); - return sb.toString(); + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + super.dump(fd, pw, args); + mSupplicantStateTracker.dump(fd, pw, args); + pw.println("mLinkProperties " + mLinkProperties); + pw.println("mWifiInfo " + mWifiInfo); + pw.println("mDhcpResults " + mDhcpResults); + pw.println("mNetworkInfo " + mNetworkInfo); + pw.println("mLastSignalLevel " + mLastSignalLevel); + pw.println("mLastBssid " + mLastBssid); + pw.println("mLastNetworkId " + mLastNetworkId); + pw.println("mReconnectCount " + mReconnectCount); + pw.println("mIsScanMode " + mIsScanMode); + pw.println("mUserWantsSuspendOpt " + mUserWantsSuspendOpt); + pw.println("mSuspendOptNeedsDisabled " + mSuspendOptNeedsDisabled); + pw.println("Supplicant status " + mWifiNative.status()); + pw.println(); + mWifiConfigStore.dump(fd, pw, args); } /********************************************************* @@ -1663,7 +1656,6 @@ public class WifiStateMachine extends StateMachine { // [31-13] Reserved for future use // [8 - 0] Supplicant state (as defined in SupplicantState.java) // 50023 supplicant_state_changed (custom|1|5) - EventLog.writeEvent(EVENTLOG_SUPPLICANT_STATE_CHANGED, state.ordinal()); mWifiInfo.setSupplicantState(state); // Network id is only valid when we start connecting if (SupplicantState.isConnecting(state)) { @@ -2023,11 +2015,6 @@ public class WifiStateMachine extends StateMachine { //TODO: could move logging into a common class public void enter() { if (DBG) log(getName() + "\n"); - // [31-8] Reserved for future use - // [7 - 0] HSM state change - // 50021 wifi_state_changed (custom|1|5) - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); - if (mWifiNative.isDriverLoaded()) { transitionTo(mDriverLoadedState); } @@ -2061,8 +2048,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); - final Message message = new Message(); message.copyFrom(getCurrentMessage()); /* TODO: add a timeout to fail when driver load is hung. @@ -2138,7 +2123,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -2197,7 +2181,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); final Message message = new Message(); message.copyFrom(getCurrentMessage()); @@ -2276,7 +2259,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -2296,7 +2278,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { loge(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -2310,7 +2291,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } private void initializeWpsDetails() { @@ -2407,7 +2387,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); /* Initialize for connect mode operation at start */ mIsScanMode = false; /* Wifi is available as long as we have a connection to supplicant */ @@ -2556,7 +2535,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); /* Send any reset commands to supplicant before shutting it down */ handleNetworkDisconnect(); @@ -2630,7 +2608,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); mTries = 1; /* Send ourselves a delayed message to start driver a second time */ @@ -2698,7 +2675,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); mIsRunning = true; mInDelayedStop = false; @@ -2900,7 +2876,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); switch (getCurrentMessage().what) { case WifiMonitor.SUP_DISCONNECTION_EVENT: mTransitionToState = mDriverLoadedState; @@ -2957,7 +2932,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -2994,7 +2968,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -3026,7 +2999,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -3062,7 +3034,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -3205,7 +3176,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); mRssiPollToken++; if (mEnableRssiPolling) { sendMessage(obtainMessage(CMD_RSSI_POLL, mRssiPollToken, 0)); @@ -3340,7 +3310,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); if (!mWifiConfigStore.isUsingStaticIp(mLastNetworkId)) { //start DHCP @@ -3408,7 +3377,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); setNetworkDetailedState(DetailedState.VERIFYING_POOR_LINK); mWifiConfigStore.updateStatus(mLastNetworkId, DetailedState.VERIFYING_POOR_LINK); sendNetworkStateChangeBroadcast(mLastBssid); @@ -3463,7 +3431,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -3502,7 +3469,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -3555,7 +3521,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); // We dont scan frequently if this is a temporary disconnect // due to p2p @@ -3706,7 +3671,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); mSourceMessage = Message.obtain(getCurrentMessage()); } @Override @@ -3796,7 +3760,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); final Message message = getCurrentMessage(); if (message.what == CMD_START_AP) { @@ -3861,7 +3824,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -3904,7 +3866,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); /* Send ourselves a delayed message to shut down if tethering fails to notify */ sendMessageDelayed(obtainMessage(CMD_TETHER_NOTIFICATION_TIMED_OUT, @@ -3953,7 +3914,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } @Override public boolean processMessage(Message message) { @@ -3983,7 +3943,6 @@ public class WifiStateMachine extends StateMachine { @Override public void enter() { if (DBG) log(getName() + "\n"); - EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); /* Send ourselves a delayed message to shut down if tethering fails to notify */ sendMessageDelayed(obtainMessage(CMD_TETHER_NOTIFICATION_TIMED_OUT, diff --git a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java index c8f0712..423558f 100644 --- a/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java +++ b/wifi/java/android/net/wifi/WifiWatchdogStateMachine.java @@ -39,6 +39,7 @@ import com.android.internal.util.Protocol; import com.android.internal.util.State; import com.android.internal.util.StateMachine; +import java.io.FileDescriptor; import java.io.PrintWriter; import java.text.DecimalFormat; @@ -332,6 +333,8 @@ public class WifiWatchdogStateMachine extends StateMachine { } else { setInitialState(mWatchdogDisabledState); } + setLogRecSize(25); + setLogOnlyTransitions(true); updateSettings(); } @@ -417,9 +420,8 @@ public class WifiWatchdogStateMachine extends StateMachine { false, contentObserver); } - public void dump(PrintWriter pw) { - pw.print("WatchdogStatus: "); - pw.print("State: " + getCurrentState()); + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + super.dump(fd, pw, args); pw.println("mWifiInfo: [" + mWifiInfo + "]"); pw.println("mLinkProperties: [" + mLinkProperties + "]"); pw.println("mCurrentSignalLevel: [" + mCurrentSignalLevel + "]"); diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index fdb21ad..40aa71d 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -354,6 +354,14 @@ public class WifiP2pService extends IWifiP2pManager.Stub { + ", uid=" + Binder.getCallingUid()); return; } + mP2pStateMachine.dump(fd, pw, args); + pw.println("mAutonomousGroup " + mAutonomousGroup); + pw.println("mJoinExistingGroup " + mJoinExistingGroup); + pw.println("mDiscoveryStarted " + mDiscoveryStarted); + pw.println("mNetworkInfo " + mNetworkInfo); + pw.println("mTempoarilyDisconnectedWifi " + mTempoarilyDisconnectedWifi); + pw.println("mServiceDiscReqId " + mServiceDiscReqId); + pw.println(); } @@ -440,6 +448,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub { } else { setInitialState(mP2pNotSupportedState); } + setLogRecSize(50); + setLogOnlyTransitions(true); } class DefaultState extends State { @@ -1771,6 +1781,17 @@ public class WifiP2pService extends IWifiP2pManager.Stub { } } + @Override + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + super.dump(fd, pw, args); + pw.println("mWifiP2pInfo " + mWifiP2pInfo); + pw.println("mGroup " + mGroup); + pw.println("mSavedPeerConfig " + mSavedPeerConfig); + pw.println("mSavedP2pGroup " + mSavedP2pGroup); + pw.println("mSavedProvDiscDevice " + mSavedProvDiscDevice); + pw.println(); + } + private void sendP2pStateChangedBroadcast(boolean enabled) { final Intent intent = new Intent(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); |