Merge "Show connect dialog when selecting secure QS wifi" into lmp-mr1-dev

This commit is contained in:
Jason Monk
2015-01-22 14:11:52 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ import com.android.systemui.qs.QSDetailItems.Item;
import com.android.systemui.qs.QSTile; import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.QSTileView; import com.android.systemui.qs.QSTileView;
import com.android.systemui.qs.SignalTileView; 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;
import com.android.systemui.statusbar.policy.NetworkController.AccessPointController; import com.android.systemui.statusbar.policy.NetworkController.AccessPointController;
import com.android.systemui.statusbar.policy.NetworkController.AccessPointController.AccessPoint; import com.android.systemui.statusbar.policy.NetworkController.AccessPointController.AccessPoint;
@@ -289,6 +290,11 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
} }
} }
@Override
public void onSettingsActivityTriggered(Intent settingsIntent) {
mHost.startSettingsActivity(settingsIntent);
}
@Override @Override
public void onDetailItemClick(Item item) { public void onDetailItemClick(Item item) {
if (item == null || item.tag == null) return; if (item == null || item.tag == null) return;

View File

@@ -125,7 +125,7 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC
Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
intent.putExtra(EXTRA_START_CONNECT_SSID, ap.ssid); intent.putExtra(EXTRA_START_CONNECT_SSID, ap.ssid);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivityAsUser(intent, new UserHandle(mCurrentUser)); fireSettingsIntentCallback(intent);
return true; return true;
} else { } else {
WifiConfiguration config = new WifiConfiguration(); WifiConfiguration config = new WifiConfiguration();
@@ -139,7 +139,13 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC
return false; 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) { for (AccessPointCallback callback : mCallbacks) {
callback.onAccessPointsChanged(aps); callback.onAccessPointsChanged(aps);
} }
@@ -208,7 +214,7 @@ public class AccessPointControllerImpl implements NetworkController.AccessPointC
aps.add(ap); aps.add(ap);
} }
Collections.sort(aps, mByStrength); Collections.sort(aps, mByStrength);
fireCallback(aps.toArray(new AccessPoint[aps.size()])); fireAcccessPointsCallback(aps.toArray(new AccessPoint[aps.size()]));
} }
private final ActionListener mConnectListener = new ActionListener() { private final ActionListener mConnectListener = new ActionListener() {

View File

@@ -16,6 +16,8 @@
package com.android.systemui.statusbar.policy; package com.android.systemui.statusbar.policy;
import android.content.Intent;
public interface NetworkController { public interface NetworkController {
boolean hasMobileDataFeature(); boolean hasMobileDataFeature();
@@ -53,6 +55,7 @@ public interface NetworkController {
public interface AccessPointCallback { public interface AccessPointCallback {
void onAccessPointsChanged(AccessPoint[] accessPoints); void onAccessPointsChanged(AccessPoint[] accessPoints);
void onSettingsActivityTriggered(Intent settingsIntent);
} }
public static class AccessPoint { public static class AccessPoint {