summaryrefslogtreecommitdiffstats
path: root/service/java/com/android/server/wifi/WifiNetworkFactory.java
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-03-14 08:49:01 -0700
committerRoshan Pius <rpius@google.com>2019-03-14 09:15:33 -0700
commitfae5d23665d0ecd43553e681697f2489ef84e57a (patch)
tree068807b5787eb69676ae9e528f70ec228a1fed63 /service/java/com/android/server/wifi/WifiNetworkFactory.java
parent5ddc5d5e0a480f06cb4a3a8754630258d2eab5f0 (diff)
downloadandroid_frameworks_opt_net_wifi-fae5d23665d0ecd43553e681697f2489ef84e57a.tar.gz
android_frameworks_opt_net_wifi-fae5d23665d0ecd43553e681697f2489ef84e57a.tar.bz2
android_frameworks_opt_net_wifi-fae5d23665d0ecd43553e681697f2489ef84e57a.zip
WifiNetworkFactory: Send flag for singe network request
Send a new boolean flag to let the UI know that the app's request can only match a single network. This lets the UI trigger a different user flow for single network requests from apps. Bug: 128563203 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I2b92b5b015dbdffb628aeae0b88351ed79ad42e8
Diffstat (limited to 'service/java/com/android/server/wifi/WifiNetworkFactory.java')
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkFactory.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java
index 98f72c2e2..174379e33 100644
--- a/service/java/com/android/server/wifi/WifiNetworkFactory.java
+++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java
@@ -92,6 +92,9 @@ public class WifiNetworkFactory extends NetworkFactory {
@VisibleForTesting
public static final String UI_START_INTENT_EXTRA_APP_NAME =
"com.android.settings.wifi.extra.APP_NAME";
+ @VisibleForTesting
+ public static final String UI_START_INTENT_EXTRA_REQUEST_IS_FOR_SINGLE_NETWORK =
+ "com.android.settings.wifi.extra.REQUEST_IS_FOR_SINGLE_NETWORK";
private final Context mContext;
private final ActivityManager mActivityManager;
@@ -1123,6 +1126,8 @@ public class WifiNetworkFactory extends NetworkFactory {
intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(UI_START_INTENT_EXTRA_APP_NAME,
getAppName(mActiveSpecificNetworkRequestSpecifier.requestorPackageName));
+ intent.putExtra(UI_START_INTENT_EXTRA_REQUEST_IS_FOR_SINGLE_NETWORK,
+ isActiveRequestForSingleNetwork());
mContext.startActivityAsUser(intent, UserHandle.getUserHandleForUid(
mActiveSpecificNetworkRequestSpecifier.requestorUid));
}
@@ -1144,6 +1149,23 @@ public class WifiNetworkFactory extends NetworkFactory {
return true;
}
+ // Helper method to determine if the specifier does not contain any patterns and matches
+ // a single network.
+ private boolean isActiveRequestForSingleNetwork() {
+ if (mActiveSpecificNetworkRequestSpecifier == null) return false;
+
+ if (mActiveSpecificNetworkRequestSpecifier.ssidPatternMatcher.getType()
+ == PatternMatcher.PATTERN_LITERAL) {
+ return true;
+ }
+ if (Objects.equals(
+ mActiveSpecificNetworkRequestSpecifier.bssidPatternMatcher.second,
+ MacAddress.BROADCAST_ADDRESS)) {
+ return true;
+ }
+ return false;
+ }
+
private @Nullable ScanResult
findUserApprovedAccessPointForActiveRequestFromActiveMatchedScanResults() {
if (mActiveSpecificNetworkRequestSpecifier == null