Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17f3c3f4 authored by Jason Monk's avatar Jason Monk
Browse files

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
parent 21326959
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
@@ -289,6 +290,11 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
            }
        }

        @Override
        public void onSettingsActivityTriggered(Intent settingsIntent) {
            mHost.startSettingsActivity(settingsIntent);
        }

        @Override
        public void onDetailItemClick(Item item) {
            if (item == null || item.tag == null) return;
+9 −3
Original line number Diff line number Diff line
@@ -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() {
+3 −0
Original line number Diff line number Diff line
@@ -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 {