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

Commit 08b5b5d4 authored by Vinit Deshpande's avatar Vinit Deshpande
Browse files

Implement 'Available via Passpoint' feature

This also fixes the issues related to explicit connection
to passpoint AP, and fixes occassional mention of
'connected via Wi-Fi Assistent'

Change-Id: I152cebafa6259194f1d09a6972a3508156335cb6
parent 40e0f243
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -36,11 +36,14 @@ public class AccessPointPreference extends Preference {

    private TextView mSummaryView;
    private boolean showSummary = true;
    private boolean mForSavedNetworks = false;
    private AccessPoint mAccessPoint;

    public AccessPointPreference(AccessPoint accessPoint, Context context) {
    public AccessPointPreference(AccessPoint accessPoint, Context context,
                                 boolean forSavedNetworks) {
        super(context);
        mAccessPoint = accessPoint;
        mForSavedNetworks = forSavedNetworks;
        mAccessPoint.setTag(this);
        refresh();
    }
@@ -104,6 +107,9 @@ public class AccessPointPreference extends Preference {
     * Updates the title and summary; may indirectly call notifyChanged().
     */
    public void refresh() {
        if (mForSavedNetworks)
            setTitle(mAccessPoint.getConfigName());
        else
            setTitle(mAccessPoint.getSsid());

        final Context context = getContext();
@@ -112,7 +118,9 @@ public class AccessPointPreference extends Preference {
        // Force new summary
        setSummary(null);

        String summary = mAccessPoint.getSummary();
        String summary = mForSavedNetworks ? mAccessPoint.getSavedNetworkSummary()
                : mAccessPoint.getSettingsSummary();

        if (summary.length() > 0) {
            setSummary(summary);
            setShowSummary(true);
+3 −3
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
        final Context context = getActivity();

        final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context, true,
                false);
                false, true);

        preferenceScreen.removeAll();

@@ -106,7 +106,7 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
        final int accessPointsSize = accessPoints.size();
        for (int i = 0; i < accessPointsSize; ++i){
            AccessPointPreference preference = new AccessPointPreference(accessPoints.get(i),
                    context);
                    context, true);
            WifiConfiguration config = accessPoints.get(i).getConfig();
            if (config != null) {
                int userId = UserHandle.getUserId(config.creatorUid);
@@ -217,7 +217,7 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment

                // Add available Wi-Fi access points
                final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context,
                        true, false);
                        true, false, true);

                final int accessPointsSize = accessPoints.size();
                for (int i = 0; i < accessPointsSize; ++i){
+9 −2
Original line number Diff line number Diff line
@@ -250,8 +250,15 @@ public class WifiConfigController implements TextWatcher,
                    mConfigUi.setSubmitButton(res.getString(R.string.wifi_connect));
                } else {
                    if (state != null) {
                        addRow(group, R.string.wifi_status, AccessPoint.getSummary(
                                mConfigUi.getContext(), state, !mAccessPoint.isSaved()));
                        WifiConfiguration config = mAccessPoint.getConfig();
                        boolean isEphimeral = mAccessPoint.isSaved() == false;
                        String providerFriendlyName = null;
                        if (config != null && config.isPasspoint()) {
                            providerFriendlyName = config.providerFriendlyName;
                        }
                        String summary = AccessPoint.getSummary(
                                mConfigUi.getContext(), state, isEphimeral, providerFriendlyName);
                        addRow(group, R.string.wifi_status, summary);
                    }

                    if (signalLevel != null) {
+3 −3
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ public class WifiSettings extends RestrictedSettingsFragment
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        mWifiTracker = new WifiTracker(getActivity(), this, true, true);
        mWifiTracker = new WifiTracker(getActivity(), this, true, true, false);
        mWifiManager = mWifiTracker.getManager();

        mConnectListener = new WifiManager.ActionListener() {
@@ -567,7 +567,7 @@ public class WifiSettings extends RestrictedSettingsFragment
                    // Ignore access points that are out of range.
                    if (accessPoint.getLevel() != -1) {
                        AccessPointPreference preference = new AccessPointPreference(accessPoint,
                                getActivity());
                                getActivity(), false);

                        getPreferenceScreen().addPreference(preference);
                        accessPoint.setListener(this);
@@ -814,7 +814,7 @@ public class WifiSettings extends RestrictedSettingsFragment

                // Add saved Wi-Fi access points
                final Collection<AccessPoint> accessPoints =
                        WifiTracker.getCurrentAccessPoints(context, true, false);
                        WifiTracker.getCurrentAccessPoints(context, true, false, false);
                for (AccessPoint accessPoint : accessPoints) {
                    data = new SearchIndexableRaw(context);
                    data.title = accessPoint.getSsid();
+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ public class WifiStatusTest extends Activity {
            WifiInfo info = mWifiManager.getConnectionInfo();
            String summary = AccessPoint.getSummary(this, info.getSSID(),
                    networkInfo.getDetailedState(),
                    info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID);
                    info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID, null);
            mNetworkState.setText(summary);
        }
    }