diff options
author | Sohani Rao <sohanirao@google.com> | 2017-03-27 22:01:51 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-03-27 22:01:52 +0000 |
commit | cb86d10809667ce2803485382223a7bc19726495 (patch) | |
tree | 30f7ec7efa5ab67b10701902e49de3d158fb2d6a /service | |
parent | 1ad9ac3a128506722a55ad784fb8c699d2e4b4ec (diff) | |
parent | 99f90f5cb7637ece0358003d3d3355036e6d68f7 (diff) |
Merge "Unit tests for SupplicantStateTracker"
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/FrameworkFacade.java | 12 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/SupplicantStateTracker.java | 8 |
2 files changed, 16 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/FrameworkFacade.java b/service/java/com/android/server/wifi/FrameworkFacade.java index c1b5e8d1e..42f0161e9 100644 --- a/service/java/com/android/server/wifi/FrameworkFacade.java +++ b/service/java/com/android/server/wifi/FrameworkFacade.java @@ -24,6 +24,7 @@ import android.database.ContentObserver; import android.net.TrafficStats; import android.net.Uri; import android.net.ip.IpManager; +import android.os.BatteryStats; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; @@ -31,6 +32,7 @@ import android.os.ServiceManager; import android.provider.Settings; import android.telephony.CarrierConfigManager; +import com.android.internal.app.IBatteryStats; import com.android.server.wifi.util.WifiAsyncChannel; /** @@ -78,13 +80,21 @@ public class FrameworkFacade { return ServiceManager.getService(serviceName); } + /** + * Returns the battery stats interface + * @return IBatteryStats BatteryStats service interface + */ + public IBatteryStats getBatteryService() { + return IBatteryStats.Stub.asInterface(getService(BatteryStats.SERVICE_NAME)); + } + public PendingIntent getBroadcast(Context context, int requestCode, Intent intent, int flags) { return PendingIntent.getBroadcast(context, requestCode, intent, flags); } public SupplicantStateTracker makeSupplicantStateTracker(Context context, WifiConfigManager configManager, Handler handler) { - return new SupplicantStateTracker(context, configManager, handler); + return new SupplicantStateTracker(context, configManager, this, handler); } public boolean getConfigWiFiDisableInECBM(Context context) { diff --git a/service/java/com/android/server/wifi/SupplicantStateTracker.java b/service/java/com/android/server/wifi/SupplicantStateTracker.java index ea5d9ebd5..9ba64b9bc 100644 --- a/service/java/com/android/server/wifi/SupplicantStateTracker.java +++ b/service/java/com/android/server/wifi/SupplicantStateTracker.java @@ -26,7 +26,6 @@ import android.os.Handler; import android.os.Message; import android.os.Parcelable; import android.os.RemoteException; -import android.os.ServiceManager; import android.os.UserHandle; import android.util.Log; import android.util.Slog; @@ -49,6 +48,7 @@ public class SupplicantStateTracker extends StateMachine { private static final String TAG = "SupplicantStateTracker"; private static boolean DBG = false; private final WifiConfigManager mWifiConfigManager; + private FrameworkFacade mFacade; private final IBatteryStats mBatteryStats; /* Indicates authentication failure in supplicant broadcast. * TODO: enhance auth failure reporting to include notification @@ -88,12 +88,14 @@ public class SupplicantStateTracker extends StateMachine { return getCurrentState().getName(); } - public SupplicantStateTracker(Context c, WifiConfigManager wcs, Handler t) { + public SupplicantStateTracker(Context c, WifiConfigManager wcs, + FrameworkFacade facade, Handler t) { super(TAG, t.getLooper()); mContext = c; mWifiConfigManager = wcs; - mBatteryStats = (IBatteryStats)ServiceManager.getService(BatteryStats.SERVICE_NAME); + mFacade = facade; + mBatteryStats = mFacade.getBatteryService(); // CHECKSTYLE:OFF IndentationCheck addState(mDefaultState); addState(mUninitializedState, mDefaultState); |