From 17f3c3f4fb3845cf933fe82495b914112e819fb4 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Wed, 14 Jan 2015 10:13:22 -0500 Subject: Show connect dialog when selecting secure QS wifi Use startSettingsActivity (QSTileHost) to make sure we use the right flags and get the keyguard out of the way so the user always sees the connect dialog for secure networks when they are sent to settings. Bug: 18987307 Change-Id: I9027393ab8743e6dfe702221cb3bc1bb4e213708 --- .../SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java | 6 ++++++ .../systemui/statusbar/policy/AccessPointControllerImpl.java | 12 +++++++++--- .../android/systemui/statusbar/policy/NetworkController.java | 3 +++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java index a920624..e09024b 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java @@ -30,6 +30,7 @@ import com.android.systemui.qs.QSDetailItems.Item; import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTileView; import com.android.systemui.qs.SignalTileView; +import com.android.systemui.statusbar.phone.QSTileHost; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.NetworkController.AccessPointController; import com.android.systemui.statusbar.policy.NetworkController.AccessPointController.AccessPoint; @@ -290,6 +291,11 @@ public class WifiTile extends QSTile { } @Override + public void onSettingsActivityTriggered(Intent settingsIntent) { + mHost.startSettingsActivity(settingsIntent); + } + + @Override public void onDetailItemClick(Item item) { if (item == null || item.tag == null) return; final AccessPoint ap = (AccessPoint) item.tag; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java index dc6af6a..ad4c211 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/AccessPointControllerImpl.java @@ -125,7 +125,7 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); intent.putExtra(EXTRA_START_CONNECT_SSID, ap.ssid); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mContext.startActivityAsUser(intent, new UserHandle(mCurrentUser)); + fireSettingsIntentCallback(intent); return true; } else { WifiConfiguration config = new WifiConfiguration(); @@ -139,7 +139,13 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC return false; } - private void fireCallback(AccessPoint[] aps) { + private void fireSettingsIntentCallback(Intent intent) { + for (AccessPointCallback callback : mCallbacks) { + callback.onSettingsActivityTriggered(intent); + } + } + + private void fireAcccessPointsCallback(AccessPoint[] aps) { for (AccessPointCallback callback : mCallbacks) { callback.onAccessPointsChanged(aps); } @@ -208,7 +214,7 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC aps.add(ap); } Collections.sort(aps, mByStrength); - fireCallback(aps.toArray(new AccessPoint[aps.size()])); + fireAcccessPointsCallback(aps.toArray(new AccessPoint[aps.size()])); } private final ActionListener mConnectListener = new ActionListener() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index bcf08ff..3cffc85 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.policy; +import android.content.Intent; + public interface NetworkController { boolean hasMobileDataFeature(); @@ -53,6 +55,7 @@ public interface NetworkController { public interface AccessPointCallback { void onAccessPointsChanged(AccessPoint[] accessPoints); + void onSettingsActivityTriggered(Intent settingsIntent); } public static class AccessPoint { -- cgit v1.1