Hold network hand-off wakelock only when connected
Change-Id: I31132cb2966cfc1eb205e070116b4c784d292f46
This commit is contained in:
@@ -924,7 +924,9 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: doc
|
||||
* Request a wakelock with connectivity service to
|
||||
* keep the device awake until we hand-off from wifi
|
||||
* to an alternate network
|
||||
*/
|
||||
public void requestCmWakeLock() {
|
||||
sendMessage(CMD_REQUEST_CM_WAKELOCK);
|
||||
@@ -2153,13 +2155,6 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
||||
transitionTo(mDriverStoppingState);
|
||||
mWakeLock.release();
|
||||
break;
|
||||
case CMD_REQUEST_CM_WAKELOCK:
|
||||
if (mCm == null) {
|
||||
mCm = (ConnectivityManager)mContext.getSystemService(
|
||||
Context.CONNECTIVITY_SERVICE);
|
||||
}
|
||||
mCm.requestNetworkTransitionWakelock(TAG);
|
||||
break;
|
||||
case CMD_START_PACKET_FILTERING:
|
||||
WifiNative.startPacketFiltering();
|
||||
break;
|
||||
@@ -2637,6 +2632,13 @@ public class WifiStateMachine extends HierarchicalStateMachine {
|
||||
sendMessage(CMD_DISCONNECT);
|
||||
deferMessage(message);
|
||||
break;
|
||||
case CMD_REQUEST_CM_WAKELOCK:
|
||||
if (mCm == null) {
|
||||
mCm = (ConnectivityManager)mContext.getSystemService(
|
||||
Context.CONNECTIVITY_SERVICE);
|
||||
}
|
||||
mCm.requestNetworkTransitionWakelock(TAG);
|
||||
break;
|
||||
case CMD_SET_SCAN_MODE:
|
||||
if (message.arg1 == SCAN_ONLY_MODE) {
|
||||
sendMessage(CMD_DISCONNECT);
|
||||
|
||||
Reference in New Issue
Block a user