diff options
author | Mitchell Wills <mwills@google.com> | 2015-08-28 06:24:30 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-28 06:24:30 +0000 |
commit | 85d1a896c94123727d70fcb309ca5355ee73c74e (patch) | |
tree | 164844049c0a07e8f1108d75b93db4a9c7e091e5 /service | |
parent | f2ccc594030d9a36947973e9b66b269dedf37734 (diff) | |
parent | 0553024a5d7ca6593f61335ead1bade23d3d2e40 (diff) | |
download | android_frameworks_opt_net_wifi-85d1a896c94123727d70fcb309ca5355ee73c74e.tar.gz android_frameworks_opt_net_wifi-85d1a896c94123727d70fcb309ca5355ee73c74e.tar.bz2 android_frameworks_opt_net_wifi-85d1a896c94123727d70fcb309ca5355ee73c74e.zip |
am 0553024a: Merge "Revert "Add wake lock that is acquired during full wifi scans"" into mnc-dev
* commit '0553024a5d7ca6593f61335ead1bade23d3d2e40':
Revert "Add wake lock that is acquired during full wifi scans"
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiScanningServiceImpl.java | 40 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 15 |
2 files changed, 4 insertions, 51 deletions
diff --git a/service/java/com/android/server/wifi/WifiScanningServiceImpl.java b/service/java/com/android/server/wifi/WifiScanningServiceImpl.java index bfe73020d..e7d3d3ac7 100644 --- a/service/java/com/android/server/wifi/WifiScanningServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiScanningServiceImpl.java @@ -38,7 +38,6 @@ import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.os.Messenger; -import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; import android.os.WorkSource; @@ -71,11 +70,6 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { private static final int MIN_PERIOD_PER_CHANNEL_MS = 200; // DFS needs 120 ms private static final int UNKNOWN_PID = -1; - /** - * Timeout for acquired wake lock while a scan is running - */ - private static final int SCAN_WAKE_LOCK_TIME_OUT_MSECS = 5 * 1000; - private static final LocalLog mLocalLog = new LocalLog(1024); private static void localLog(String message) { @@ -221,7 +215,6 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { private WifiScanningStateMachine mStateMachine; private ClientHandler mClientHandler; private IBatteryStats mBatteryStats; - private PowerManager mPowerManager; private final WifiNative.ScanCapabilities mScanCapabilities = new WifiNative.ScanCapabilities(); WifiScanningServiceImpl() { } @@ -232,15 +225,14 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { public void startService(Context context) { mContext = context; - mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); - mBatteryStats = BatteryStatsService.getService(); HandlerThread thread = new HandlerThread("WifiScanningService"); thread.start(); mClientHandler = new ClientHandler(thread.getLooper()); mStateMachine = new WifiScanningStateMachine(thread.getLooper()); - mWifiChangeStateMachine = new WifiChangeStateMachine(thread.getLooper(), mPowerManager); + mWifiChangeStateMachine = new WifiChangeStateMachine(thread.getLooper()); + mBatteryStats = BatteryStatsService.getService(); mContext.registerReceiver( new BroadcastReceiver() { @@ -560,19 +552,13 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { private final Messenger mMessenger; private final int mUid; private final WorkSource mWorkSource; - private final PowerManager.WakeLock mFullScanWakeLock; private boolean mScanWorkReported = false; - private boolean mFullScanRequested = false; ClientInfo(int uid, AsyncChannel c, Messenger m) { mChannel = c; mMessenger = m; mUid = uid; mWorkSource = new WorkSource(uid, TAG); - mFullScanWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, - "WifiScan"); - mFullScanWakeLock.setReferenceCounted(false); - mFullScanWakeLock.setWorkSource(mWorkSource); if (DBG) localLog("New client, channel: " + c + " messenger: " + m); } @@ -621,21 +607,10 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { if (mScanWorkReported) { reportBatchedScanStop(); mScanWorkReported = false; - mFullScanRequested = false; } if (mScanSettings.isEmpty() == false) { reportBatchedScanStart(); mScanWorkReported = true; - - for (ScanSettings settings : getScanSettings()) { - if (settings.reportEvents == WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT) { - mFullScanRequested = true; - } - } - // make sure to charge first full scan even if there are no results - if (mFullScanRequested) { - mFullScanWakeLock.acquire(SCAN_WAKE_LOCK_TIME_OUT_MSECS); - } } } @@ -757,7 +732,6 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { /* this is a single shot scan; stop the scan now */ mStateMachine.sendMessage(CMD_STOP_SCAN_INTERNAL, 0, handler, this); } - mFullScanWakeLock.release(); } void deliverScanResults(int handler, ScanData results[]) { @@ -768,7 +742,6 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { void reportFullScanResult(ScanResult result) { Iterator<Integer> it = mScanSettings.keySet().iterator(); - boolean reportedFullScanResult = false; while (it.hasNext()) { int handler = it.next(); ScanSettings settings = mScanSettings.get(handler); @@ -784,13 +757,9 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { newResult.informationElements = result.informationElements.clone(); mChannel.sendMessage( WifiScanner.CMD_FULL_SCAN_RESULT, 0, handler, newResult); - reportedFullScanResult = true; } } } - if (mFullScanRequested && reportedFullScanResult) { - mFullScanWakeLock.acquire(SCAN_WAKE_LOCK_TIME_OUT_MSECS); - } } void reportPeriodChanged(int handler, ScanSettings settings, int newPeriodInMs) { @@ -1441,10 +1410,9 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { PendingIntent mTimeoutIntent; ScanResult mCurrentBssids[]; - WifiChangeStateMachine(Looper looper, PowerManager powerManager) { + WifiChangeStateMachine(Looper looper) { super("SignificantChangeStateMachine", looper); - mClientInfo = new ClientInfoLocal(); mClients.put(null, mClientInfo); addState(mDefaultState); @@ -1780,7 +1748,7 @@ public class WifiScanningServiceImpl extends IWifiScanner.Stub { sendMessage(WIFI_CHANGE_CMD_CHANGE_DETECTED, 0, 0, results); } - ClientInfo mClientInfo; + ClientInfo mClientInfo = new ClientInfoLocal(); private static final int SCAN_COMMAND_ID = 1; void addScanRequest(ScanSettings settings) { diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index b633f0ccc..49750635a 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -375,11 +375,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno private int mSupplicantStopFailureToken = 0; /** - * Timeout for acquired wake lock while a scan is running - */ - private static final int SCAN_WAKE_LOCK_TIME_OUT_MSECS = 5 * 1000; - - /** * Tether state change notification time out */ private static final int TETHER_NOTIFICATION_TIME_OUT_MSECS = 5000; @@ -413,9 +408,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno // Wakelock held during wifi start/stop and driver load/unload private PowerManager.WakeLock mWakeLock; - // Wakelock held during wifi scan - private PowerManager.WakeLock mScanWakeLock; - private Context mContext; private final Object mDhcpResultsLock = new Object(); @@ -1278,9 +1270,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, getName()); - mScanWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WifiScan"); - mScanWakeLock.setReferenceCounted(false); - mSuspendWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WifiSuspend"); mSuspendWakeLock.setReferenceCounted(false); @@ -1886,8 +1875,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno batteryWorkSource = new WorkSource(Process.WIFI_UID); } - mScanWakeLock.setWorkSource(batteryWorkSource); - mScanWakeLock.acquire(SCAN_WAKE_LOCK_TIME_OUT_MSECS); try { mBatteryStats.noteWifiScanStartedFromSource(batteryWorkSource); } catch (RemoteException e) { @@ -1918,8 +1905,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno log(e.toString()); } finally { mScanWorkSource = null; - mScanWakeLock.release(); - mScanWakeLock.setWorkSource(null); } } } |