summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java7
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java5
-rw-r--r--service/java/com/android/server/wifi/WifiWakeupController.java93
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiWakeupControllerTest.java86
4 files changed, 0 insertions, 191 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index c4207cd74..b08404bc8 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -72,7 +72,6 @@ public class WifiInjector {
private final WifiStateMachine mWifiStateMachine;
private final WifiSettingsStore mSettingsStore;
private final WifiCertManager mCertManager;
- private final WifiWakeupController mWifiWakeupController;
private final WifiLockManager mLockManager;
private final WifiController mWifiController;
private final Clock mClock = new Clock();
@@ -173,8 +172,6 @@ public class WifiInjector {
this, mBackupManagerProxy, mCountryCode, mWifiNative);
mSettingsStore = new WifiSettingsStore(mContext);
mCertManager = new WifiCertManager(mContext);
- mWifiWakeupController = new WifiWakeupController(mContext,
- mWifiServiceHandlerThread.getLooper(), mFrameworkFacade);
mLockManager = new WifiLockManager(mContext, BatteryStatsService.getService());
mWifiController = new WifiController(mContext, mWifiStateMachine, mSettingsStore,
mLockManager, mWifiServiceHandlerThread.getLooper(), mFrameworkFacade);
@@ -247,10 +244,6 @@ public class WifiInjector {
return mCertManager;
}
- public WifiWakeupController getWifiWakeupController() {
- return mWifiWakeupController;
- }
-
public WifiLockManager getWifiLockManager() {
return mLockManager;
}
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 0d07514fb..27605e9bb 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -136,7 +136,6 @@ public class WifiServiceImpl extends IWifiManager.Stub {
// Debug counter tracking scan requests sent by WifiManager
private int scanRequestCounter = 0;
- private WifiWakeupController mWifiWakeupController;
/* Polls traffic stats and notifies clients */
private WifiTrafficPoller mTrafficPoller;
/* Tracks the persisted states for wi-fi & airplane mode */
@@ -327,9 +326,6 @@ public class WifiServiceImpl extends IWifiManager.Stub {
mPowerManager = mContext.getSystemService(PowerManager.class);
mAppOps = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
mCertManager = mWifiInjector.getWifiCertManager();
-
- mWifiWakeupController = mWifiInjector.getWifiWakeupController();
-
mWifiLockManager = mWifiInjector.getWifiLockManager();
mWifiMulticastLockManager = mWifiInjector.getWifiMulticastLockManager();
HandlerThread wifiServiceHandlerThread = mWifiInjector.getWifiServiceHandlerThread();
@@ -1475,7 +1471,6 @@ public class WifiServiceImpl extends IWifiManager.Stub {
pw.println("mScanPending " + mScanPending);
mWifiController.dump(fd, pw, args);
mSettingsStore.dump(fd, pw, args);
- mWifiWakeupController.dump(fd, pw, args);
mTrafficPoller.dump(fd, pw, args);
pw.println();
pw.println("Locks held:");
diff --git a/service/java/com/android/server/wifi/WifiWakeupController.java b/service/java/com/android/server/wifi/WifiWakeupController.java
deleted file mode 100644
index 14f57fdc2..000000000
--- a/service/java/com/android/server/wifi/WifiWakeupController.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2013 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;
-
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.database.ContentObserver;
-import android.net.wifi.WifiManager;
-import android.os.Handler;
-import android.os.Looper;
-import android.provider.Settings;
-
-import com.android.internal.annotations.VisibleForTesting;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-
-/**
- * Handles enabling Wi-Fi for the Wi-Fi Wakeup feature.
- * @hide
- */
-public class WifiWakeupController {
-
- private Context mContext;
- private final FrameworkFacade mFrameworkFacade;
- private final Handler mHandler;
- @VisibleForTesting
- final ContentObserver mContentObserver;
- @VisibleForTesting
- boolean mWifiWakeupEnabled;
-
- WifiWakeupController(Context context, Looper looper, FrameworkFacade frameworkFacade) {
- mContext = context;
- mFrameworkFacade = frameworkFacade;
-
- IntentFilter filter = new IntentFilter();
- filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
- filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
-
- mHandler = new Handler(looper);
-
- mContext.registerReceiver(mBroadcastReceiver, filter, null, mHandler);
- mContentObserver = new ContentObserver(mHandler) {
- @Override
- public void onChange(boolean selfChange) {
- mWifiWakeupEnabled = getWifiWakeupEnabledSetting();
- }
- };
- ContentResolver cr = mContext.getContentResolver();
- cr.registerContentObserver(Settings.Global.getUriFor(
- Settings.Global.WIFI_WAKEUP_ENABLED), true, mContentObserver);
- mWifiWakeupEnabled = getWifiWakeupEnabledSetting();
- }
-
- private boolean getWifiWakeupEnabledSetting() {
- return mFrameworkFacade.getIntegerSetting(mContext,
- Settings.Global.WIFI_WAKEUP_ENABLED, 0) == 1;
- }
-
- private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
- handleWifiStateChanged(intent);
- } else if (intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
- handleScanResultsAvailable(intent);
- }
- }
- };
-
- private void handleWifiStateChanged(Intent intent) {};
- private void handleScanResultsAvailable(Intent intent) {};
-
- void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- pw.println("mWifiWakeupEnabled " + mWifiWakeupEnabled);
- }
-}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiWakeupControllerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiWakeupControllerTest.java
deleted file mode 100644
index c714d8225..000000000
--- a/tests/wifitests/src/com/android/server/wifi/WifiWakeupControllerTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-import android.app.NotificationManager;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.net.wifi.WifiScanner;
-import android.os.test.TestLooper;
-import android.provider.Settings;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-/**
- * Unit tests for {@link com.android.server.wifi.WifiWakeupController}.
- */
-public class WifiWakeupControllerTest {
- public static final String TAG = "WifiScanningServiceTest";
-
- @Mock private Context mContext;
- @Mock private WifiStateMachine mWifiStateMachine;
- @Mock private FrameworkFacade mFrameworkFacade;
- @Mock private NotificationManager mNotificationManager;
- @Mock private WifiScanner mWifiScanner;
- @Mock private ContentResolver mContentResolver;
- private WifiWakeupController mWifiWakeupController;
-
-
- /** Initialize objects before each test run. */
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
- when(mContext.getContentResolver()).thenReturn(mContentResolver);
- when(mFrameworkFacade.getIntegerSetting(mContext,
- Settings.Global.WIFI_WAKEUP_ENABLED, 0)).thenReturn(1);
- TestLooper testLooper = new TestLooper();
- mWifiWakeupController = new WifiWakeupController(
- mContext, testLooper.getLooper(), mFrameworkFacade);
- }
-
- /** Test WifiWakeupEnabledSettingObserver enables feature correctly. */
- @Test
- public void testEnableWifiWakeup() {
- assertTrue(mWifiWakeupController.mWifiWakeupEnabled);
-
- when(mFrameworkFacade.getIntegerSetting(mContext,
- Settings.Global.WIFI_WAKEUP_ENABLED, 0)).thenReturn(0);
- mWifiWakeupController.mContentObserver.onChange(true);
- assertFalse(mWifiWakeupController.mWifiWakeupEnabled);
- }
-
- /** Test dump() does not crash. */
- @Test
- public void testDump() {
- StringWriter stringWriter = new StringWriter();
- mWifiWakeupController.dump(
- new FileDescriptor(), new PrintWriter(stringWriter), new String[0]);
- }
-
-}