Loading core/java/android/net/CaptivePortalTracker.java +0 −9 Original line number Diff line number Diff line Loading @@ -370,13 +370,4 @@ public class CaptivePortalTracker extends StateMachine { } mNotificationShown = visible; } private static void log(String s) { Log.d(TAG, s); } private static void loge(String s) { Log.e(TAG, s); } } core/java/com/android/internal/util/StateMachine.java +69 −48 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ class HelloWorld extends StateMachine { class State1 extends State { @Override public boolean processMessage(Message message) { Log.d(TAG, "Hello World"); log("Hello World"); return HANDLED; } } Loading Loading @@ -232,8 +232,6 @@ state mP2 { * <p>The implementation is below and also in StateMachineTest:</p> <code> class Hsm1 extends StateMachine { private static final String TAG = "hsm1"; public static final int CMD_1 = 1; public static final int CMD_2 = 2; public static final int CMD_3 = 3; Loading @@ -241,16 +239,16 @@ class Hsm1 extends StateMachine { public static final int CMD_5 = 5; public static Hsm1 makeHsm1() { Log.d(TAG, "makeHsm1 E"); log("makeHsm1 E"); Hsm1 sm = new Hsm1("hsm1"); sm.start(); Log.d(TAG, "makeHsm1 X"); log("makeHsm1 X"); return sm; } Hsm1(String name) { super(name); Log.d(TAG, "ctor E"); log("ctor E"); // Add states, use indentation to show hierarchy addState(mP1); Loading @@ -260,16 +258,16 @@ class Hsm1 extends StateMachine { // Set the initial state setInitialState(mS1); Log.d(TAG, "ctor X"); log("ctor X"); } class P1 extends State { @Override public void enter() { Log.d(TAG, "mP1.enter"); log("mP1.enter"); } @Override public boolean processMessage(Message message) { boolean retVal; Log.d(TAG, "mP1.processMessage what=" + message.what); log("mP1.processMessage what=" + message.what); switch(message.what) { case CMD_2: // CMD_2 will arrive in mS2 before CMD_3 Loading @@ -286,16 +284,16 @@ class Hsm1 extends StateMachine { return retVal; } @Override public void exit() { Log.d(TAG, "mP1.exit"); log("mP1.exit"); } } class S1 extends State { @Override public void enter() { Log.d(TAG, "mS1.enter"); log("mS1.enter"); } @Override public boolean processMessage(Message message) { Log.d(TAG, "S1.processMessage what=" + message.what); log("S1.processMessage what=" + message.what); if (message.what == CMD_1) { // Transition to ourself to show that enter/exit is called transitionTo(mS1); Loading @@ -306,17 +304,17 @@ class Hsm1 extends StateMachine { } } @Override public void exit() { Log.d(TAG, "mS1.exit"); log("mS1.exit"); } } class S2 extends State { @Override public void enter() { Log.d(TAG, "mS2.enter"); log("mS2.enter"); } @Override public boolean processMessage(Message message) { boolean retVal; Log.d(TAG, "mS2.processMessage what=" + message.what); log("mS2.processMessage what=" + message.what); switch(message.what) { case(CMD_2): sendMessage(obtainMessage(CMD_4)); Loading @@ -334,17 +332,17 @@ class Hsm1 extends StateMachine { return retVal; } @Override public void exit() { Log.d(TAG, "mS2.exit"); log("mS2.exit"); } } class P2 extends State { @Override public void enter() { Log.d(TAG, "mP2.enter"); log("mP2.enter"); sendMessage(obtainMessage(CMD_5)); } @Override public boolean processMessage(Message message) { Log.d(TAG, "P2.processMessage what=" + message.what); log("P2.processMessage what=" + message.what); switch(message.what) { case(CMD_3): break; Loading @@ -357,13 +355,13 @@ class Hsm1 extends StateMachine { return HANDLED; } @Override public void exit() { Log.d(TAG, "mP2.exit"); log("mP2.exit"); } } @Override void onHalting() { Log.d(TAG, "halting"); log("halting"); synchronized (this) { this.notifyAll(); } Loading @@ -386,7 +384,7 @@ synchronize(hsm) { // wait for the messages to be handled hsm.wait(); } catch (InterruptedException e) { Log.e(TAG, "exception while waiting " + e.getMessage()); loge("exception while waiting " + e.getMessage()); } } </code> Loading Loading @@ -418,8 +416,7 @@ D/hsm1 ( 1999): halting </code> */ public class StateMachine { private static final String TAG = "StateMachine"; // Name of the state machine and used as logging tag private String mName; /** Message.what value when quitting */ Loading Loading @@ -772,7 +769,7 @@ public class StateMachine { */ @Override public final void handleMessage(Message msg) { if (mDbg) Log.d(TAG, "handleMessage: E msg.what=" + msg.what); if (mDbg) mSm.log("handleMessage: E msg.what=" + msg.what); /** Save the current message */ mMsg = msg; Loading @@ -793,7 +790,7 @@ public class StateMachine { } performTransitions(msgProcessedState); if (mDbg) Log.d(TAG, "handleMessage: X"); if (mDbg) mSm.log("handleMessage: X"); } /** Loading @@ -813,7 +810,7 @@ public class StateMachine { boolean recordLogMsg = mSm.recordLogRec(mMsg); while (mDestState != null) { if (mDbg) Log.d(TAG, "handleMessage: new destination call exit"); if (mDbg) mSm.log("handleMessage: new destination call exit"); /** * Save mDestState locally and set to null Loading Loading @@ -905,7 +902,7 @@ public class StateMachine { * Complete the construction of the state machine. */ private final void completeConstruction() { if (mDbg) Log.d(TAG, "completeConstruction: E"); if (mDbg) mSm.log("completeConstruction: E"); /** * Determine the maximum depth of the state hierarchy Loading @@ -921,7 +918,7 @@ public class StateMachine { maxDepth = depth; } } if (mDbg) Log.d(TAG, "completeConstruction: maxDepth=" + maxDepth); if (mDbg) mSm.log("completeConstruction: maxDepth=" + maxDepth); mStateStack = new StateInfo[maxDepth]; mTempStateStack = new StateInfo[maxDepth]; Loading @@ -930,7 +927,7 @@ public class StateMachine { /** Sending SM_INIT_CMD message to invoke enter methods asynchronously */ sendMessageAtFrontOfQueue(obtainMessage(SM_INIT_CMD, mSmHandlerObj)); if (mDbg) Log.d(TAG, "completeConstruction: X"); if (mDbg) mSm.log("completeConstruction: X"); } /** Loading @@ -942,7 +939,7 @@ public class StateMachine { private final State processMsg(Message msg) { StateInfo curStateInfo = mStateStack[mStateStackTopIndex]; if (mDbg) { Log.d(TAG, "processMsg: " + curStateInfo.state.getName()); mSm.log("processMsg: " + curStateInfo.state.getName()); } if (isQuit(msg)) { Loading @@ -961,7 +958,7 @@ public class StateMachine { break; } if (mDbg) { Log.d(TAG, "processMsg: " + curStateInfo.state.getName()); mSm.log("processMsg: " + curStateInfo.state.getName()); } } } Loading @@ -976,7 +973,7 @@ public class StateMachine { while ((mStateStackTopIndex >= 0) && (mStateStack[mStateStackTopIndex] != commonStateInfo)) { State curState = mStateStack[mStateStackTopIndex].state; if (mDbg) Log.d(TAG, "invokeExitMethods: " + curState.getName()); if (mDbg) mSm.log("invokeExitMethods: " + curState.getName()); curState.exit(); mStateStack[mStateStackTopIndex].active = false; mStateStackTopIndex -= 1; Loading @@ -988,7 +985,7 @@ public class StateMachine { */ private final void invokeEnterMethods(int stateStackEnteringIndex) { for (int i = stateStackEnteringIndex; i <= mStateStackTopIndex; i++) { if (mDbg) Log.d(TAG, "invokeEnterMethods: " + mStateStack[i].state.getName()); if (mDbg) mSm.log("invokeEnterMethods: " + mStateStack[i].state.getName()); mStateStack[i].state.enter(); mStateStack[i].active = true; } Loading @@ -1006,7 +1003,7 @@ public class StateMachine { */ for (int i = mDeferredMessages.size() - 1; i >= 0; i-- ) { Message curMsg = mDeferredMessages.get(i); if (mDbg) Log.d(TAG, "moveDeferredMessageAtFrontOfQueue; what=" + curMsg.what); if (mDbg) mSm.log("moveDeferredMessageAtFrontOfQueue; what=" + curMsg.what); sendMessageAtFrontOfQueue(curMsg); } mDeferredMessages.clear(); Loading @@ -1024,7 +1021,7 @@ public class StateMachine { int i = mTempStateStackCount - 1; int j = startingIndex; while (i >= 0) { if (mDbg) Log.d(TAG, "moveTempStackToStateStack: i=" + i + ",j=" + j); if (mDbg) mSm.log("moveTempStackToStateStack: i=" + i + ",j=" + j); mStateStack[j] = mTempStateStack[i]; j += 1; i -= 1; Loading @@ -1032,7 +1029,7 @@ public class StateMachine { mStateStackTopIndex = j - 1; if (mDbg) { Log.d(TAG, "moveTempStackToStateStack: X mStateStackTop=" mSm.log("moveTempStackToStateStack: X mStateStackTop=" + mStateStackTopIndex + ",startingIndex=" + startingIndex + ",Top=" + mStateStack[mStateStackTopIndex].state.getName()); } Loading Loading @@ -1065,7 +1062,7 @@ public class StateMachine { } while ((curStateInfo != null) && !curStateInfo.active); if (mDbg) { Log.d(TAG, "setupTempStateStackWithStatesToEnter: X mTempStateStackCount=" mSm.log("setupTempStateStackWithStatesToEnter: X mTempStateStackCount=" + mTempStateStackCount + ",curStateInfo: " + curStateInfo); } return curStateInfo; Loading @@ -1076,7 +1073,7 @@ public class StateMachine { */ private final void setupInitialStateStack() { if (mDbg) { Log.d(TAG, "setupInitialStateStack: E mInitialState=" mSm.log("setupInitialStateStack: E mInitialState=" + mInitialState.getName()); } Loading Loading @@ -1117,7 +1114,7 @@ public class StateMachine { */ private final StateInfo addState(State state, State parent) { if (mDbg) { Log.d(TAG, "addStateInternal: E state=" + state.getName() mSm.log("addStateInternal: E state=" + state.getName() + ",parent=" + ((parent == null) ? "" : parent.getName())); } StateInfo parentStateInfo = null; Loading @@ -1142,7 +1139,7 @@ public class StateMachine { stateInfo.state = state; stateInfo.parentStateInfo = parentStateInfo; stateInfo.active = false; if (mDbg) Log.d(TAG, "addStateInternal: X stateInfo: " + stateInfo); if (mDbg) mSm.log("addStateInternal: X stateInfo: " + stateInfo); return stateInfo; } Loading @@ -1162,19 +1159,19 @@ public class StateMachine { /** @see StateMachine#setInitialState(State) */ private final void setInitialState(State initialState) { if (mDbg) Log.d(TAG, "setInitialState: initialState=" + initialState.getName()); if (mDbg) mSm.log("setInitialState: initialState=" + initialState.getName()); mInitialState = initialState; } /** @see StateMachine#transitionTo(IState) */ private final void transitionTo(IState destState) { mDestState = (State) destState; if (mDbg) Log.d(TAG, "transitionTo: destState=" + mDestState.getName()); if (mDbg) mSm.log("transitionTo: destState=" + mDestState.getName()); } /** @see StateMachine#deferMessage(Message) */ private final void deferMessage(Message msg) { if (mDbg) Log.d(TAG, "deferMessage: msg=" + msg.what); if (mDbg) mSm.log("deferMessage: msg=" + msg.what); /* Copy the "msg" to "newMsg" as "msg" will be recycled */ Message newMsg = obtainMessage(); Loading @@ -1185,17 +1182,17 @@ public class StateMachine { /** @see StateMachine#quit() */ private final void quit() { if (mDbg) Log.d(TAG, "quit:"); if (mDbg) mSm.log("quit:"); sendMessage(obtainMessage(SM_QUIT_CMD, mSmHandlerObj)); } /** @see StateMachine#quitNow() */ private final void quitNow() { if (mDbg) Log.d(TAG, "abort:"); if (mDbg) mSm.log("quitNow:"); sendMessageAtFrontOfQueue(obtainMessage(SM_QUIT_CMD, mSmHandlerObj)); } /** Validate that the message was sent by quit or abort. */ /** Validate that the message was sent by quit or quitNow. */ private final boolean isQuit(Message msg) { return (msg.what == SM_QUIT_CMD) && (msg.obj == mSmHandlerObj); } Loading Loading @@ -1337,7 +1334,7 @@ public class StateMachine { * @param msg that couldn't be handled. */ protected void unhandledMessage(Message msg) { if (mSmHandler.mDbg) Log.e(TAG, mName + " - unhandledMessage: msg.what=" + msg.what); if (mSmHandler.mDbg) loge(" - unhandledMessage: msg.what=" + msg.what); } /** Loading Loading @@ -1696,4 +1693,28 @@ public class StateMachine { } pw.println("curState=" + getCurrentState().getName()); } protected void log(String s) { Log.d(mName, s); } protected void logv(String s) { Log.v(mName, s); } protected void logi(String s) { Log.i(mName, s); } protected void logd(String s) { Log.d(mName, s); } protected void logw(String s) { Log.w(mName, s); } protected void loge(String s) { Log.e(mName, s); } } wifi/java/android/net/wifi/WifiStateMachine.java +5 −14 Original line number Diff line number Diff line Loading @@ -103,7 +103,6 @@ import java.util.regex.Pattern; */ public class WifiStateMachine extends StateMachine { private static final String TAG = "WifiStateMachine"; private static final String NETWORKTYPE = "WIFI"; private static final boolean DBG = false; Loading Loading @@ -565,7 +564,7 @@ public class WifiStateMachine extends StateMachine { private final IBatteryStats mBatteryStats; public WifiStateMachine(Context context, String wlanInterface) { super(TAG); super("WifiStateMachine"); mContext = context; mInterfaceName = wlanInterface; Loading Loading @@ -678,7 +677,7 @@ public class WifiStateMachine extends StateMachine { mScanResultCache = new LruCache<String, ScanResult>(SCAN_RESULT_CACHE_SIZE); PowerManager powerManager = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getName()); mSuspendWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WifiSuspend"); mSuspendWakeLock.setReferenceCounted(false); Loading Loading @@ -3132,14 +3131,14 @@ public class WifiStateMachine extends StateMachine { break; default: result = new WpsResult(Status.FAILURE); Log.e(TAG, "Invalid setup for WPS"); loge("Invalid setup for WPS"); break; } if (result.status == Status.SUCCESS) { replyToMessage(message, WifiManager.START_WPS_SUCCEEDED, result); transitionTo(mWpsRunningState); } else { Log.e(TAG, "Failed to start WPS with config " + wpsInfo.toString()); loge("Failed to start WPS with config " + wpsInfo.toString()); replyToMessage(message, WifiManager.WPS_FAILED, WifiManager.ERROR); } break; Loading Loading @@ -3465,7 +3464,7 @@ public class WifiStateMachine extends StateMachine { public void exit() { /* Request a CS wakelock during transition to mobile */ checkAndSetConnectivityInstance(); mCm.requestNetworkTransitionWakelock(TAG); mCm.requestNetworkTransitionWakelock(getName()); } } Loading Loading @@ -4040,12 +4039,4 @@ public class WifiStateMachine extends StateMachine { msg.arg2 = srcMsg.arg2; return msg; } private void log(String s) { Log.d(TAG, s); } private void loge(String s) { Log.e(TAG, s); } } wifi/java/android/net/wifi/WifiWatchdogStateMachine.java +1 −10 Original line number Diff line number Diff line Loading @@ -77,7 +77,6 @@ public class WifiWatchdogStateMachine extends StateMachine { /* STOPSHIP: Keep this configurable for debugging until ship */ private static boolean DBG = false; private static final String TAG = "WifiWatchdogStateMachine"; private static final int BASE = Protocol.BASE_WIFI_WATCHDOG; Loading Loading @@ -306,7 +305,7 @@ public class WifiWatchdogStateMachine extends StateMachine { * (all other states) */ private WifiWatchdogStateMachine(Context context) { super(TAG); super("WifiWatchdogStateMachine"); mContext = context; mContentResolver = context.getContentResolver(); mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); Loading Loading @@ -968,14 +967,6 @@ public class WifiWatchdogStateMachine extends StateMachine { return Settings.Global.putInt(cr, name, value ? 1 : 0); } private static void logd(String s) { Log.d(TAG, s); } private static void loge(String s) { Log.e(TAG, s); } /** * Bundle of good link count parameters */ Loading wifi/java/android/net/wifi/p2p/WifiP2pService.java +4 −2 Original line number Diff line number Diff line Loading @@ -2460,11 +2460,13 @@ public class WifiP2pService extends IWifiP2pManager.Stub { return msg; } private void logd(String s) { @Override protected void logd(String s) { Slog.d(TAG, s); } private void loge(String s) { @Override protected void loge(String s) { Slog.e(TAG, s); } Loading Loading
core/java/android/net/CaptivePortalTracker.java +0 −9 Original line number Diff line number Diff line Loading @@ -370,13 +370,4 @@ public class CaptivePortalTracker extends StateMachine { } mNotificationShown = visible; } private static void log(String s) { Log.d(TAG, s); } private static void loge(String s) { Log.e(TAG, s); } }
core/java/com/android/internal/util/StateMachine.java +69 −48 Original line number Diff line number Diff line Loading @@ -148,7 +148,7 @@ class HelloWorld extends StateMachine { class State1 extends State { @Override public boolean processMessage(Message message) { Log.d(TAG, "Hello World"); log("Hello World"); return HANDLED; } } Loading Loading @@ -232,8 +232,6 @@ state mP2 { * <p>The implementation is below and also in StateMachineTest:</p> <code> class Hsm1 extends StateMachine { private static final String TAG = "hsm1"; public static final int CMD_1 = 1; public static final int CMD_2 = 2; public static final int CMD_3 = 3; Loading @@ -241,16 +239,16 @@ class Hsm1 extends StateMachine { public static final int CMD_5 = 5; public static Hsm1 makeHsm1() { Log.d(TAG, "makeHsm1 E"); log("makeHsm1 E"); Hsm1 sm = new Hsm1("hsm1"); sm.start(); Log.d(TAG, "makeHsm1 X"); log("makeHsm1 X"); return sm; } Hsm1(String name) { super(name); Log.d(TAG, "ctor E"); log("ctor E"); // Add states, use indentation to show hierarchy addState(mP1); Loading @@ -260,16 +258,16 @@ class Hsm1 extends StateMachine { // Set the initial state setInitialState(mS1); Log.d(TAG, "ctor X"); log("ctor X"); } class P1 extends State { @Override public void enter() { Log.d(TAG, "mP1.enter"); log("mP1.enter"); } @Override public boolean processMessage(Message message) { boolean retVal; Log.d(TAG, "mP1.processMessage what=" + message.what); log("mP1.processMessage what=" + message.what); switch(message.what) { case CMD_2: // CMD_2 will arrive in mS2 before CMD_3 Loading @@ -286,16 +284,16 @@ class Hsm1 extends StateMachine { return retVal; } @Override public void exit() { Log.d(TAG, "mP1.exit"); log("mP1.exit"); } } class S1 extends State { @Override public void enter() { Log.d(TAG, "mS1.enter"); log("mS1.enter"); } @Override public boolean processMessage(Message message) { Log.d(TAG, "S1.processMessage what=" + message.what); log("S1.processMessage what=" + message.what); if (message.what == CMD_1) { // Transition to ourself to show that enter/exit is called transitionTo(mS1); Loading @@ -306,17 +304,17 @@ class Hsm1 extends StateMachine { } } @Override public void exit() { Log.d(TAG, "mS1.exit"); log("mS1.exit"); } } class S2 extends State { @Override public void enter() { Log.d(TAG, "mS2.enter"); log("mS2.enter"); } @Override public boolean processMessage(Message message) { boolean retVal; Log.d(TAG, "mS2.processMessage what=" + message.what); log("mS2.processMessage what=" + message.what); switch(message.what) { case(CMD_2): sendMessage(obtainMessage(CMD_4)); Loading @@ -334,17 +332,17 @@ class Hsm1 extends StateMachine { return retVal; } @Override public void exit() { Log.d(TAG, "mS2.exit"); log("mS2.exit"); } } class P2 extends State { @Override public void enter() { Log.d(TAG, "mP2.enter"); log("mP2.enter"); sendMessage(obtainMessage(CMD_5)); } @Override public boolean processMessage(Message message) { Log.d(TAG, "P2.processMessage what=" + message.what); log("P2.processMessage what=" + message.what); switch(message.what) { case(CMD_3): break; Loading @@ -357,13 +355,13 @@ class Hsm1 extends StateMachine { return HANDLED; } @Override public void exit() { Log.d(TAG, "mP2.exit"); log("mP2.exit"); } } @Override void onHalting() { Log.d(TAG, "halting"); log("halting"); synchronized (this) { this.notifyAll(); } Loading @@ -386,7 +384,7 @@ synchronize(hsm) { // wait for the messages to be handled hsm.wait(); } catch (InterruptedException e) { Log.e(TAG, "exception while waiting " + e.getMessage()); loge("exception while waiting " + e.getMessage()); } } </code> Loading Loading @@ -418,8 +416,7 @@ D/hsm1 ( 1999): halting </code> */ public class StateMachine { private static final String TAG = "StateMachine"; // Name of the state machine and used as logging tag private String mName; /** Message.what value when quitting */ Loading Loading @@ -772,7 +769,7 @@ public class StateMachine { */ @Override public final void handleMessage(Message msg) { if (mDbg) Log.d(TAG, "handleMessage: E msg.what=" + msg.what); if (mDbg) mSm.log("handleMessage: E msg.what=" + msg.what); /** Save the current message */ mMsg = msg; Loading @@ -793,7 +790,7 @@ public class StateMachine { } performTransitions(msgProcessedState); if (mDbg) Log.d(TAG, "handleMessage: X"); if (mDbg) mSm.log("handleMessage: X"); } /** Loading @@ -813,7 +810,7 @@ public class StateMachine { boolean recordLogMsg = mSm.recordLogRec(mMsg); while (mDestState != null) { if (mDbg) Log.d(TAG, "handleMessage: new destination call exit"); if (mDbg) mSm.log("handleMessage: new destination call exit"); /** * Save mDestState locally and set to null Loading Loading @@ -905,7 +902,7 @@ public class StateMachine { * Complete the construction of the state machine. */ private final void completeConstruction() { if (mDbg) Log.d(TAG, "completeConstruction: E"); if (mDbg) mSm.log("completeConstruction: E"); /** * Determine the maximum depth of the state hierarchy Loading @@ -921,7 +918,7 @@ public class StateMachine { maxDepth = depth; } } if (mDbg) Log.d(TAG, "completeConstruction: maxDepth=" + maxDepth); if (mDbg) mSm.log("completeConstruction: maxDepth=" + maxDepth); mStateStack = new StateInfo[maxDepth]; mTempStateStack = new StateInfo[maxDepth]; Loading @@ -930,7 +927,7 @@ public class StateMachine { /** Sending SM_INIT_CMD message to invoke enter methods asynchronously */ sendMessageAtFrontOfQueue(obtainMessage(SM_INIT_CMD, mSmHandlerObj)); if (mDbg) Log.d(TAG, "completeConstruction: X"); if (mDbg) mSm.log("completeConstruction: X"); } /** Loading @@ -942,7 +939,7 @@ public class StateMachine { private final State processMsg(Message msg) { StateInfo curStateInfo = mStateStack[mStateStackTopIndex]; if (mDbg) { Log.d(TAG, "processMsg: " + curStateInfo.state.getName()); mSm.log("processMsg: " + curStateInfo.state.getName()); } if (isQuit(msg)) { Loading @@ -961,7 +958,7 @@ public class StateMachine { break; } if (mDbg) { Log.d(TAG, "processMsg: " + curStateInfo.state.getName()); mSm.log("processMsg: " + curStateInfo.state.getName()); } } } Loading @@ -976,7 +973,7 @@ public class StateMachine { while ((mStateStackTopIndex >= 0) && (mStateStack[mStateStackTopIndex] != commonStateInfo)) { State curState = mStateStack[mStateStackTopIndex].state; if (mDbg) Log.d(TAG, "invokeExitMethods: " + curState.getName()); if (mDbg) mSm.log("invokeExitMethods: " + curState.getName()); curState.exit(); mStateStack[mStateStackTopIndex].active = false; mStateStackTopIndex -= 1; Loading @@ -988,7 +985,7 @@ public class StateMachine { */ private final void invokeEnterMethods(int stateStackEnteringIndex) { for (int i = stateStackEnteringIndex; i <= mStateStackTopIndex; i++) { if (mDbg) Log.d(TAG, "invokeEnterMethods: " + mStateStack[i].state.getName()); if (mDbg) mSm.log("invokeEnterMethods: " + mStateStack[i].state.getName()); mStateStack[i].state.enter(); mStateStack[i].active = true; } Loading @@ -1006,7 +1003,7 @@ public class StateMachine { */ for (int i = mDeferredMessages.size() - 1; i >= 0; i-- ) { Message curMsg = mDeferredMessages.get(i); if (mDbg) Log.d(TAG, "moveDeferredMessageAtFrontOfQueue; what=" + curMsg.what); if (mDbg) mSm.log("moveDeferredMessageAtFrontOfQueue; what=" + curMsg.what); sendMessageAtFrontOfQueue(curMsg); } mDeferredMessages.clear(); Loading @@ -1024,7 +1021,7 @@ public class StateMachine { int i = mTempStateStackCount - 1; int j = startingIndex; while (i >= 0) { if (mDbg) Log.d(TAG, "moveTempStackToStateStack: i=" + i + ",j=" + j); if (mDbg) mSm.log("moveTempStackToStateStack: i=" + i + ",j=" + j); mStateStack[j] = mTempStateStack[i]; j += 1; i -= 1; Loading @@ -1032,7 +1029,7 @@ public class StateMachine { mStateStackTopIndex = j - 1; if (mDbg) { Log.d(TAG, "moveTempStackToStateStack: X mStateStackTop=" mSm.log("moveTempStackToStateStack: X mStateStackTop=" + mStateStackTopIndex + ",startingIndex=" + startingIndex + ",Top=" + mStateStack[mStateStackTopIndex].state.getName()); } Loading Loading @@ -1065,7 +1062,7 @@ public class StateMachine { } while ((curStateInfo != null) && !curStateInfo.active); if (mDbg) { Log.d(TAG, "setupTempStateStackWithStatesToEnter: X mTempStateStackCount=" mSm.log("setupTempStateStackWithStatesToEnter: X mTempStateStackCount=" + mTempStateStackCount + ",curStateInfo: " + curStateInfo); } return curStateInfo; Loading @@ -1076,7 +1073,7 @@ public class StateMachine { */ private final void setupInitialStateStack() { if (mDbg) { Log.d(TAG, "setupInitialStateStack: E mInitialState=" mSm.log("setupInitialStateStack: E mInitialState=" + mInitialState.getName()); } Loading Loading @@ -1117,7 +1114,7 @@ public class StateMachine { */ private final StateInfo addState(State state, State parent) { if (mDbg) { Log.d(TAG, "addStateInternal: E state=" + state.getName() mSm.log("addStateInternal: E state=" + state.getName() + ",parent=" + ((parent == null) ? "" : parent.getName())); } StateInfo parentStateInfo = null; Loading @@ -1142,7 +1139,7 @@ public class StateMachine { stateInfo.state = state; stateInfo.parentStateInfo = parentStateInfo; stateInfo.active = false; if (mDbg) Log.d(TAG, "addStateInternal: X stateInfo: " + stateInfo); if (mDbg) mSm.log("addStateInternal: X stateInfo: " + stateInfo); return stateInfo; } Loading @@ -1162,19 +1159,19 @@ public class StateMachine { /** @see StateMachine#setInitialState(State) */ private final void setInitialState(State initialState) { if (mDbg) Log.d(TAG, "setInitialState: initialState=" + initialState.getName()); if (mDbg) mSm.log("setInitialState: initialState=" + initialState.getName()); mInitialState = initialState; } /** @see StateMachine#transitionTo(IState) */ private final void transitionTo(IState destState) { mDestState = (State) destState; if (mDbg) Log.d(TAG, "transitionTo: destState=" + mDestState.getName()); if (mDbg) mSm.log("transitionTo: destState=" + mDestState.getName()); } /** @see StateMachine#deferMessage(Message) */ private final void deferMessage(Message msg) { if (mDbg) Log.d(TAG, "deferMessage: msg=" + msg.what); if (mDbg) mSm.log("deferMessage: msg=" + msg.what); /* Copy the "msg" to "newMsg" as "msg" will be recycled */ Message newMsg = obtainMessage(); Loading @@ -1185,17 +1182,17 @@ public class StateMachine { /** @see StateMachine#quit() */ private final void quit() { if (mDbg) Log.d(TAG, "quit:"); if (mDbg) mSm.log("quit:"); sendMessage(obtainMessage(SM_QUIT_CMD, mSmHandlerObj)); } /** @see StateMachine#quitNow() */ private final void quitNow() { if (mDbg) Log.d(TAG, "abort:"); if (mDbg) mSm.log("quitNow:"); sendMessageAtFrontOfQueue(obtainMessage(SM_QUIT_CMD, mSmHandlerObj)); } /** Validate that the message was sent by quit or abort. */ /** Validate that the message was sent by quit or quitNow. */ private final boolean isQuit(Message msg) { return (msg.what == SM_QUIT_CMD) && (msg.obj == mSmHandlerObj); } Loading Loading @@ -1337,7 +1334,7 @@ public class StateMachine { * @param msg that couldn't be handled. */ protected void unhandledMessage(Message msg) { if (mSmHandler.mDbg) Log.e(TAG, mName + " - unhandledMessage: msg.what=" + msg.what); if (mSmHandler.mDbg) loge(" - unhandledMessage: msg.what=" + msg.what); } /** Loading Loading @@ -1696,4 +1693,28 @@ public class StateMachine { } pw.println("curState=" + getCurrentState().getName()); } protected void log(String s) { Log.d(mName, s); } protected void logv(String s) { Log.v(mName, s); } protected void logi(String s) { Log.i(mName, s); } protected void logd(String s) { Log.d(mName, s); } protected void logw(String s) { Log.w(mName, s); } protected void loge(String s) { Log.e(mName, s); } }
wifi/java/android/net/wifi/WifiStateMachine.java +5 −14 Original line number Diff line number Diff line Loading @@ -103,7 +103,6 @@ import java.util.regex.Pattern; */ public class WifiStateMachine extends StateMachine { private static final String TAG = "WifiStateMachine"; private static final String NETWORKTYPE = "WIFI"; private static final boolean DBG = false; Loading Loading @@ -565,7 +564,7 @@ public class WifiStateMachine extends StateMachine { private final IBatteryStats mBatteryStats; public WifiStateMachine(Context context, String wlanInterface) { super(TAG); super("WifiStateMachine"); mContext = context; mInterfaceName = wlanInterface; Loading Loading @@ -678,7 +677,7 @@ public class WifiStateMachine extends StateMachine { mScanResultCache = new LruCache<String, ScanResult>(SCAN_RESULT_CACHE_SIZE); PowerManager powerManager = (PowerManager)mContext.getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getName()); mSuspendWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WifiSuspend"); mSuspendWakeLock.setReferenceCounted(false); Loading Loading @@ -3132,14 +3131,14 @@ public class WifiStateMachine extends StateMachine { break; default: result = new WpsResult(Status.FAILURE); Log.e(TAG, "Invalid setup for WPS"); loge("Invalid setup for WPS"); break; } if (result.status == Status.SUCCESS) { replyToMessage(message, WifiManager.START_WPS_SUCCEEDED, result); transitionTo(mWpsRunningState); } else { Log.e(TAG, "Failed to start WPS with config " + wpsInfo.toString()); loge("Failed to start WPS with config " + wpsInfo.toString()); replyToMessage(message, WifiManager.WPS_FAILED, WifiManager.ERROR); } break; Loading Loading @@ -3465,7 +3464,7 @@ public class WifiStateMachine extends StateMachine { public void exit() { /* Request a CS wakelock during transition to mobile */ checkAndSetConnectivityInstance(); mCm.requestNetworkTransitionWakelock(TAG); mCm.requestNetworkTransitionWakelock(getName()); } } Loading Loading @@ -4040,12 +4039,4 @@ public class WifiStateMachine extends StateMachine { msg.arg2 = srcMsg.arg2; return msg; } private void log(String s) { Log.d(TAG, s); } private void loge(String s) { Log.e(TAG, s); } }
wifi/java/android/net/wifi/WifiWatchdogStateMachine.java +1 −10 Original line number Diff line number Diff line Loading @@ -77,7 +77,6 @@ public class WifiWatchdogStateMachine extends StateMachine { /* STOPSHIP: Keep this configurable for debugging until ship */ private static boolean DBG = false; private static final String TAG = "WifiWatchdogStateMachine"; private static final int BASE = Protocol.BASE_WIFI_WATCHDOG; Loading Loading @@ -306,7 +305,7 @@ public class WifiWatchdogStateMachine extends StateMachine { * (all other states) */ private WifiWatchdogStateMachine(Context context) { super(TAG); super("WifiWatchdogStateMachine"); mContext = context; mContentResolver = context.getContentResolver(); mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); Loading Loading @@ -968,14 +967,6 @@ public class WifiWatchdogStateMachine extends StateMachine { return Settings.Global.putInt(cr, name, value ? 1 : 0); } private static void logd(String s) { Log.d(TAG, s); } private static void loge(String s) { Log.e(TAG, s); } /** * Bundle of good link count parameters */ Loading
wifi/java/android/net/wifi/p2p/WifiP2pService.java +4 −2 Original line number Diff line number Diff line Loading @@ -2460,11 +2460,13 @@ public class WifiP2pService extends IWifiP2pManager.Stub { return msg; } private void logd(String s) { @Override protected void logd(String s) { Slog.d(TAG, s); } private void loge(String s) { @Override protected void loge(String s) { Slog.e(TAG, s); } Loading