summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2019-11-18 21:03:40 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-11-18 21:03:40 +0000
commit7d7cef004ff998ec0012be266876b7361b609f22 (patch)
tree482cea4624cbd4b08133e66c3b4681f360d1fb75
parent8632ce63c665ab3537133631bdd169a5b2cb16a8 (diff)
parent2b87aae063e78d05c56809280820096a6a83e697 (diff)
Merge "WifiManager/Scanner API cleanup: Wifi service fixes"
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java2
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java2
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java15
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java5
5 files changed, 15 insertions, 11 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java
index bfa61b3df..781dcbafb 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/BaseWifiTracker.java
@@ -75,7 +75,7 @@ public abstract class BaseWifiTracker implements LifecycleObserver {
/**
* TODO (b/70983952): Add the rest of the broadcast handling.
* WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION);
- * WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
+ * WifiManager.ACTION_LINK_CONFIGURATION_CHANGED);
* WifiManager.NETWORK_STATE_CHANGED_ACTION);
* WifiManager.RSSI_CHANGED_ACTION);
*/
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 868865134..aeb345ef1 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -2407,7 +2407,7 @@ public class ClientModeImpl extends StateMachine {
}
private void sendLinkConfigurationChangedBroadcast() {
- Intent intent = new Intent(WifiManager.LINK_CONFIGURATION_CHANGED_ACTION);
+ Intent intent = new Intent(WifiManager.ACTION_LINK_CONFIGURATION_CHANGED);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
intent.putExtra(WifiManager.EXTRA_LINK_PROPERTIES, new LinkProperties(mLinkProperties));
mContext.sendBroadcastAsUser(intent, UserHandle.ALL);
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 6b2729788..b4e749ca7 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -3017,8 +3017,8 @@ public class WifiServiceImpl extends BaseWifiService {
}
/**
- * see {@link android.net.wifi.WifiManager#registerTrafficStateCallback(
- * WifiManager.TrafficStateCallback, Handler)}
+ * See
+ * {@link WifiManager#registerTrafficStateCallback(Executor, WifiManager.TrafficStateCallback)}
*
* @param binder IBinder instance to allow cleanup if the app dies
* @param callback Traffic State callback to register
@@ -3086,8 +3086,9 @@ public class WifiServiceImpl extends BaseWifiService {
}
/**
- * see {@link android.net.wifi.WifiManager#registerNetworkRequestMatchCallback(
- * WifiManager.NetworkRequestMatchCallback, Handler)} (
+ * See
+ * {@link WifiManager#registerNetworkRequestMatchCallback(
+ * Executor, WifiManager.NetworkRequestMatchCallback)}
*
* @param binder IBinder instance to allow cleanup if the app dies
* @param callback Network Request Match callback to register
@@ -3216,7 +3217,7 @@ public class WifiServiceImpl extends BaseWifiService {
/**
* Gets the factory Wi-Fi MAC addresses.
* @throws SecurityException if the caller does not have permission.
- * @return Array of String representing Wi-Fi MAC addresses, or null if failed.
+ * @return Array of String representing Wi-Fi MAC addresses, or empty array if failed.
*/
@Override
public String[] getFactoryMacAddresses() {
@@ -3226,11 +3227,11 @@ public class WifiServiceImpl extends BaseWifiService {
+ "(uid = " + uid + ")");
}
String result = mWifiThreadRunner.call(mClientModeImpl::getFactoryMacAddress, null);
- // result can be null if either: WifiThreadRunner.call() timed out, or
+ // result can be empty array if either: WifiThreadRunner.call() timed out, or
// ClientModeImpl.getFactoryMacAddress() returned null.
// In this particular instance, we don't differentiate the two types of nulls.
if (result == null) {
- return null;
+ return new String[0];
}
return new String[]{result};
}
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java b/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java
index 137d9fa19..a01117fae 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java
@@ -74,6 +74,8 @@ public class PasspointProvisioner {
// TLS version to be used for HTTPS connection with OSU server
private static final String TLS_VERSION = "TLSv1";
+
+ // TODO(143967693): create an overlay for this instead of hardcoding
private static final String OSU_APP_PACKAGE = "com.android.hotspot2";
private final Context mContext;
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index 2f5415ab9..782a8db57 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -38,6 +38,7 @@ import static com.android.server.wifi.LocalOnlyHotspotRequestInfo.HOTSPOT_NO_ERR
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -3981,7 +3982,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(true);
mLooper.startAutoDispatch();
- assertNull(mWifiServiceImpl.getFactoryMacAddresses());
+ assertArrayEquals(new String[0], mWifiServiceImpl.getFactoryMacAddresses());
mLooper.stopAutoDispatchAndIgnoreExceptions();
verify(mClientModeImpl, never()).getFactoryMacAddress();
}
@@ -3994,7 +3995,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
when(mClientModeImpl.getFactoryMacAddress()).thenReturn(null);
when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(true);
mLooper.startAutoDispatch();
- assertNull(mWifiServiceImpl.getFactoryMacAddresses());
+ assertArrayEquals(new String[0], mWifiServiceImpl.getFactoryMacAddresses());
mLooper.stopAutoDispatchAndIgnoreExceptions();
verify(mClientModeImpl).getFactoryMacAddress();
}