diff options
author | Mitchell Wills <mwills@google.com> | 2016-04-06 17:47:10 -0700 |
---|---|---|
committer | Mitchell Wills <mwills@google.com> | 2016-04-14 15:25:40 -0700 |
commit | 5ccc0a429dfea8ef452f8f63454b013983eb87fe (patch) | |
tree | f291beddbb2acfb9a7b7988f166326a4fb7f68f2 /service | |
parent | 46216839c58e6aa6933eae304da750cd46148837 (diff) |
Run WifiScanner on WifiStateMachine thread
Fixes: 27695292
Change-Id: I34f05fc532c48c7c3eaa735bc6ec95e7da2794aa
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/FrameworkFacade.java | 22 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/FrameworkFacade.java b/service/java/com/android/server/wifi/FrameworkFacade.java index e60732651..55741ffdf 100644 --- a/service/java/com/android/server/wifi/FrameworkFacade.java +++ b/service/java/com/android/server/wifi/FrameworkFacade.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.android.server.wifi; @@ -8,6 +23,8 @@ import android.content.Intent; import android.net.ConnectivityManager; import android.net.TrafficStats; import android.net.ip.IpManager; +import android.net.wifi.IWifiScanner; +import android.net.wifi.WifiScanner; import android.os.Handler; import android.os.IBinder; import android.os.INetworkManagementService; @@ -54,6 +71,11 @@ public class FrameworkFacade { return ServiceManager.getService(serviceName); } + public WifiScanner makeWifiScanner(Context context, Looper looper) { + return new WifiScanner(context, IWifiScanner.Stub.asInterface( + getService(Context.WIFI_SCANNING_SERVICE)), looper); + } + public PendingIntent getBroadcast(Context context, int requestCode, Intent intent, int flags) { return PendingIntent.getBroadcast(context, requestCode, intent, flags); } diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 529774333..c4da19ae4 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -4667,8 +4667,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss // We can't do this in the constructor because WifiStateMachine is created before the // wifi scanning service is initialized if (mWifiScanner == null) { - mWifiScanner = - (WifiScanner) mContext.getSystemService(Context.WIFI_SCANNING_SERVICE); + mWifiScanner = mFacade.makeWifiScanner(mContext, getHandler().getLooper()); + mWifiConnectivityManager = new WifiConnectivityManager(mContext, WifiStateMachine.this, mWifiScanner, mWifiConfigManager, mWifiInfo, mWifiQualifiedNetworkSelector); |