summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Roshan Pius <rpius@google.com> 2020-08-03 10:52:53 -0700
committer Roshan Pius <rpius@google.com> 2020-08-04 07:54:27 -0700
commiteff8f5c18ddba7bb756c6fdfd071bca2a021157d (patch)
tree1fa05cabb6d4d7fbe30dc87036eefae13c325e3a
parent81c782dd7957ca1f3c41eb31c6e408b56b2e6c2a (diff)
WifiServiceImpl: Pass in package name for all toggle API's
Needed for iface concurrency priority decisions in HalDeviceManager. Bug: 162344695 Test: atest android.net.wifi Change-Id: Ic368665a41b118bb7553d704d1e3a7debe189e16
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl6
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java6
-rw-r--r--wifi/tests/src/android/net/wifi/WifiManagerTest.java20
3 files changed, 17 insertions, 15 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 3cdfb00d288c..e4937892e2f7 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -122,7 +122,7 @@ interface IWifiManager
DhcpInfo getDhcpInfo();
- void setScanAlwaysAvailable(boolean isAvailable);
+ void setScanAlwaysAvailable(boolean isAvailable, String packageName);
boolean isScanAlwaysAvailable();
@@ -142,9 +142,9 @@ interface IWifiManager
void updateInterfaceIpState(String ifaceName, int mode);
- boolean startSoftAp(in WifiConfiguration wifiConfig);
+ boolean startSoftAp(in WifiConfiguration wifiConfig, String packageName);
- boolean startTetheredHotspot(in SoftApConfiguration softApConfig);
+ boolean startTetheredHotspot(in SoftApConfiguration softApConfig, String packageName);
boolean stopSoftAp();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index ae834f929691..b28b902910bf 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -2802,7 +2802,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public void setScanAlwaysAvailable(boolean isAvailable) {
try {
- mService.setScanAlwaysAvailable(isAvailable);
+ mService.setScanAlwaysAvailable(isAvailable, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3035,7 +3035,7 @@ public class WifiManager {
})
public boolean startSoftAp(@Nullable WifiConfiguration wifiConfig) {
try {
- return mService.startSoftAp(wifiConfig);
+ return mService.startSoftAp(wifiConfig, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3059,7 +3059,7 @@ public class WifiManager {
})
public boolean startTetheredHotspot(@Nullable SoftApConfiguration softApConfig) {
try {
- return mService.startTetheredHotspot(softApConfig);
+ return mService.startTetheredHotspot(softApConfig, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
index cba1690ac635..e7f1916c9e82 100644
--- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
@@ -218,10 +218,10 @@ public class WifiManagerTest {
*/
@Test
public void testStartSoftApCallsServiceWithWifiConfig() throws Exception {
- when(mWifiService.startSoftAp(eq(mApConfig))).thenReturn(true);
+ when(mWifiService.startSoftAp(mApConfig, TEST_PACKAGE_NAME)).thenReturn(true);
assertTrue(mWifiManager.startSoftAp(mApConfig));
- when(mWifiService.startSoftAp(eq(mApConfig))).thenReturn(false);
+ when(mWifiService.startSoftAp(mApConfig, TEST_PACKAGE_NAME)).thenReturn(false);
assertFalse(mWifiManager.startSoftAp(mApConfig));
}
@@ -231,10 +231,10 @@ public class WifiManagerTest {
*/
@Test
public void testStartSoftApCallsServiceWithNullConfig() throws Exception {
- when(mWifiService.startSoftAp(eq(null))).thenReturn(true);
+ when(mWifiService.startSoftAp(null, TEST_PACKAGE_NAME)).thenReturn(true);
assertTrue(mWifiManager.startSoftAp(null));
- when(mWifiService.startSoftAp(eq(null))).thenReturn(false);
+ when(mWifiService.startSoftAp(null, TEST_PACKAGE_NAME)).thenReturn(false);
assertFalse(mWifiManager.startSoftAp(null));
}
@@ -257,10 +257,12 @@ public class WifiManagerTest {
@Test
public void testStartTetheredHotspotCallsServiceWithSoftApConfig() throws Exception {
SoftApConfiguration softApConfig = generatorTestSoftApConfig();
- when(mWifiService.startTetheredHotspot(eq(softApConfig))).thenReturn(true);
+ when(mWifiService.startTetheredHotspot(softApConfig, TEST_PACKAGE_NAME))
+ .thenReturn(true);
assertTrue(mWifiManager.startTetheredHotspot(softApConfig));
- when(mWifiService.startTetheredHotspot(eq(softApConfig))).thenReturn(false);
+ when(mWifiService.startTetheredHotspot(softApConfig, TEST_PACKAGE_NAME))
+ .thenReturn(false);
assertFalse(mWifiManager.startTetheredHotspot(softApConfig));
}
@@ -270,10 +272,10 @@ public class WifiManagerTest {
*/
@Test
public void testStartTetheredHotspotCallsServiceWithNullConfig() throws Exception {
- when(mWifiService.startTetheredHotspot(eq(null))).thenReturn(true);
+ when(mWifiService.startTetheredHotspot(null, TEST_PACKAGE_NAME)).thenReturn(true);
assertTrue(mWifiManager.startTetheredHotspot(null));
- when(mWifiService.startTetheredHotspot(eq(null))).thenReturn(false);
+ when(mWifiService.startTetheredHotspot(null, TEST_PACKAGE_NAME)).thenReturn(false);
assertFalse(mWifiManager.startTetheredHotspot(null));
}
@@ -2375,7 +2377,7 @@ public class WifiManagerTest {
@Test
public void testScanAvailable() throws Exception {
mWifiManager.setScanAlwaysAvailable(true);
- verify(mWifiService).setScanAlwaysAvailable(true);
+ verify(mWifiService).setScanAlwaysAvailable(true, TEST_PACKAGE_NAME);
when(mWifiService.isScanAlwaysAvailable()).thenReturn(false);
assertFalse(mWifiManager.isScanAlwaysAvailable());