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

Commit 19bae88c authored by Quang Luong's avatar Quang Luong
Browse files

Removed Passpoint Credential AP unconnected summary case

The summary for Passpoint Credential APs should have the same behavior
as regular APs while unconnected, displaying "Saved".

Tracking bug for adding robolectric tests: b/122849296

Bug: 118705403
Test: manual, build and visual check
Change-Id: I629319aa7d154af87fdcee43592c278fe7ddc51b
parent 9051dfdd
Loading
Loading
Loading
Loading
+63 −61
Original line number Diff line number Diff line
@@ -874,40 +874,37 @@ public class AccessPoint implements Comparable<AccessPoint> {
    }

    public String getSummary() {
        return getSettingsSummary(mConfig);
        return getSettingsSummary();
    }

    public String getSettingsSummary() {
        return getSettingsSummary(mConfig);
    }

    private String getSettingsSummary(WifiConfiguration config) {
        // Update to new summary
        StringBuilder summary = new StringBuilder();

        if (isActive() && config != null && config.isPasspoint()) {
        if (isActive()) {
            if (isPasspoint()) {
                // This is the active connection on passpoint
                summary.append(getSummary(mContext, getDetailedState(),
                    false, config.providerFriendlyName));
        } else if (isActive() && config != null && getDetailedState() == DetailedState.CONNECTED
                        false, mConfig.providerFriendlyName));
            } else if (mConfig != null && getDetailedState() == DetailedState.CONNECTED
                    && mIsCarrierAp) {
            summary.append(String.format(mContext.getString(R.string.connected_via_carrier), mCarrierName));
        } else if (isActive()) {
                // This is the active connection on a carrier AP
                summary.append(String.format(mContext.getString(R.string.connected_via_carrier),
                        mCarrierName));
            } else {
                // This is the active connection on non-passpoint network
                summary.append(getSummary(mContext, getDetailedState(),
                        mInfo != null && mInfo.isEphemeral()));
        } else if (config != null && config.isPasspoint()
                && config.getNetworkSelectionStatus().isNetworkEnabled()) {
            String format = mContext.getString(R.string.available_via_passpoint);
            summary.append(String.format(format, config.providerFriendlyName));
        } else if (config != null && config.hasNoInternetAccess()) {
            int messageID = config.getNetworkSelectionStatus().isNetworkPermanentlyDisabled()
            }
        } else { // not active
            if (mConfig != null && mConfig.hasNoInternetAccess()) {
                int messageID = mConfig.getNetworkSelectionStatus().isNetworkPermanentlyDisabled()
                        ? R.string.wifi_no_internet_no_reconnect
                        : R.string.wifi_no_internet;
                summary.append(mContext.getString(messageID));
        } else if (config != null && !config.getNetworkSelectionStatus().isNetworkEnabled()) {
            } else if (mConfig != null && !mConfig.getNetworkSelectionStatus().isNetworkEnabled()) {
                WifiConfiguration.NetworkSelectionStatus networkStatus =
                    config.getNetworkSelectionStatus();
                        mConfig.getNetworkSelectionStatus();
                switch (networkStatus.getNetworkSelectionDisableReason()) {
                    case WifiConfiguration.NetworkSelectionStatus.DISABLED_AUTHENTICATION_FAILURE:
                        summary.append(mContext.getString(R.string.wifi_disabled_password_failure));
@@ -923,16 +920,18 @@ public class AccessPoint implements Comparable<AccessPoint> {
                        summary.append(mContext.getString(R.string.wifi_disabled_generic));
                        break;
                }
        } else if (config != null && config.getNetworkSelectionStatus().isNotRecommended()) {
            summary.append(mContext.getString(R.string.wifi_disabled_by_recommendation_provider));
            } else if (mConfig != null && mConfig.getNetworkSelectionStatus().isNotRecommended()) {
                summary.append(mContext.getString(
                        R.string.wifi_disabled_by_recommendation_provider));
            } else if (mIsCarrierAp) {
            summary.append(String.format(mContext.getString(R.string.available_via_carrier), mCarrierName));
                summary.append(String.format(mContext.getString(
                        R.string.available_via_carrier), mCarrierName));
            } else if (!isReachable()) { // Wifi out of range
                summary.append(mContext.getString(R.string.wifi_not_in_range));
            } else { // In range, not disabled.
            if (config != null) { // Is saved network
                if (mConfig != null) { // Is saved network
                    // Last attempt to connect to this failed. Show reason why
                switch (config.recentFailure.getAssociationStatus()) {
                    switch (mConfig.recentFailure.getAssociationStatus()) {
                        case WifiConfiguration.RecentFailure.STATUS_AP_UNABLE_TO_HANDLE_NEW_STA:
                            summary.append(mContext.getString(
                                    R.string.wifi_ap_unable_to_handle_new_sta));
@@ -944,15 +943,18 @@ public class AccessPoint implements Comparable<AccessPoint> {
                    }
                }
            }
        }



        if (isVerboseLoggingEnabled()) {
            summary.append(WifiUtils.buildLoggingSummary(this, config));
            summary.append(WifiUtils.buildLoggingSummary(this, mConfig));
        }

        if (config != null && (WifiUtils.isMeteredOverridden(config) || config.meteredHint)) {
        if (mConfig != null && (WifiUtils.isMeteredOverridden(mConfig) || mConfig.meteredHint)) {
            return mContext.getResources().getString(
                    R.string.preference_summary_default_combination,
                    WifiUtils.getMeteredLabel(mContext, config),
                    WifiUtils.getMeteredLabel(mContext, mConfig),
                    summary.toString());
        }