summaryrefslogtreecommitdiffstats
path: root/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-01-18 10:49:22 -0800
committerRoshan Pius <rpius@google.com>2019-01-18 13:29:03 -0800
commit0e54d461c786d17bf337926e67bcffdb28cac71a (patch)
tree63ccd4a89a390f51ceb0ab4a9a882003e92b4867 /tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
parentbdcff8d990d33c15feb53dc5069e7f10456349e3 (diff)
downloadandroid_frameworks_opt_net_wifi-0e54d461c786d17bf337926e67bcffdb28cac71a.tar.gz
android_frameworks_opt_net_wifi-0e54d461c786d17bf337926e67bcffdb28cac71a.tar.bz2
android_frameworks_opt_net_wifi-0e54d461c786d17bf337926e67bcffdb28cac71a.zip
WifiNetworkSuggestion/WifiNetworkSpecifier: Pass package name
Use the package name from WifiNetworkSpecifier/WifiNetworkSuggestion instead of using PackageManager.getNameForUid() which cannot differentiate apps sharing UID. Functional changes (only in WifiNetworkFactory): a) Verify the uid/package name passed in the request using app-ops manager. b) Use the package name in the request everywhere instead of getNameForUid. WifiNetworkSuggestionsManager already uses the package name of the app passed in via addNetworkSuggestionsManager. So, no changes necessary there. Rest of the changes are mostly in unit tests to add the new packageName param in the constructor of these objects. Bug: 123078593 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: act.py -c wifi_manager.config -tb dut-name -tc WifiNetworkRequestTest Test: act.py -c wifi_manager.config -tb dut-name -tc WifiNetworkSuggestionTest Test: New CtsVerifier tests for network request. Change-Id: Id7c9a954606f97dbba935cb259dd488ac19d7c62
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
index 11dff8565..4056272ae 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
@@ -48,6 +48,7 @@ public class WifiConfigurationUtilTest {
static final int CURRENT_USER_MANAGED_PROFILE_USER_ID = 10;
static final int OTHER_USER_ID = 11;
static final int TEST_UID = 10000;
+ static final String TEST_PACKAGE = "com.test";
static final String TEST_SSID = "test_ssid";
static final String TEST_SSID_1 = "test_ssid_1";
static final String TEST_BSSID = "aa:aa:11:22:cc:dd";
@@ -505,7 +506,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL),
Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS),
WifiConfigurationTestUtil.createOpenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertTrue(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}
@@ -519,7 +520,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher(".*", PatternMatcher.PATTERN_SIMPLE_GLOB),
Pair.create(MacAddress.fromString(TEST_BSSID), MacAddress.BROADCAST_ADDRESS),
WifiConfigurationTestUtil.createOpenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertTrue(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}
@@ -533,7 +534,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL),
Pair.create(MacAddress.fromString(TEST_BSSID), MacAddress.BROADCAST_ADDRESS),
WifiConfigurationTestUtil.createOpenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertTrue(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}
@@ -547,7 +548,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher(".*", PatternMatcher.PATTERN_SIMPLE_GLOB),
Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS),
WifiConfigurationTestUtil.createOpenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}
@@ -561,7 +562,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher("", PatternMatcher.PATTERN_LITERAL),
Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS),
WifiConfigurationTestUtil.createOpenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}
@@ -575,7 +576,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL),
Pair.create(MacAddress.BROADCAST_ADDRESS, MacAddress.BROADCAST_ADDRESS),
WifiConfigurationTestUtil.createOpenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}
@@ -589,7 +590,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL),
Pair.create(MacAddress.fromString(TEST_BSSID), MacAddress.ALL_ZEROS_ADDRESS),
WifiConfigurationTestUtil.createOpenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}
@@ -603,7 +604,7 @@ public class WifiConfigurationUtilTest {
new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_PREFIX),
Pair.create(MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS),
WifiConfigurationTestUtil.createOpenHiddenNetwork(),
- TEST_UID);
+ TEST_UID, TEST_PACKAGE);
assertFalse(WifiConfigurationUtil.validateNetworkSpecifier(specifier));
}