diff options
author | Tomasz Wasilczyk <twasilczyk@google.com> | 2019-06-05 14:38:14 -0700 |
---|---|---|
committer | Tomasz Wasilczyk <twasilczyk@google.com> | 2019-06-07 13:48:41 -0700 |
commit | 2e2bd6becc62f9bcf2b0f94089ff433b3a53d7d9 (patch) | |
tree | 6fa6af02f418769fdf198baa72c834bb66ac51ea /service | |
parent | 782f16649ce3e8f95fea3c701b046842bca35c18 (diff) |
Fix ClientMode initialization order
Bug: 133456191
Test: atest UidAtomTests#testWifiLockHighPerf UidAtomTests#testWifiLockLowLatency
Test: atest ClientModeImplTest
Test: atest FrameworksWifiTests
Change-Id: Iac385639857fc5359ec20b4bb3fd20d4e545856a
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 12 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiInjector.java | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index bb1230554..c0104a051 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -906,9 +906,13 @@ public class ClientModeImpl extends StateMachine { setLogRecSize(NUM_LOG_RECS_NORMAL); setLogOnlyTransitions(false); + } - //start the state machine - start(); + @Override + public void start() { + super.start(); + + PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); // Learn the initial state of whether the screen is on. // We update this field when we receive broadcasts from the system. @@ -2594,7 +2598,9 @@ public class ClientModeImpl extends StateMachine { mNetworkFactory.handleScreenStateChanged(screenOn); WifiLockManager wifiLockManager = mWifiInjector.getWifiLockManager(); - if (wifiLockManager != null) { + if (wifiLockManager == null) { + Log.w(TAG, "WifiLockManager not initialized, skipping screen state notification"); + } else { wifiLockManager.handleScreenStateChanged(screenOn); } diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java index 8e88ca559..178c98f6d 100644 --- a/service/java/com/android/server/wifi/WifiInjector.java +++ b/service/java/com/android/server/wifi/WifiInjector.java @@ -346,6 +346,7 @@ public class WifiInjector { mWifiNetworkSelector.registerNetworkEvaluator(mCarrierNetworkEvaluator); mWifiNetworkSelector.registerNetworkEvaluator(mScoredNetworkEvaluator); + mClientModeImpl.start(); } /** |