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

Commit eae6e2ba authored by David Su's avatar David Su Committed by Android (Google) Code Review
Browse files

Merge "WifiConfig: Hide RecentFailures and expose int failure code"

parents fcab444a 8149f80b
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -7514,6 +7514,7 @@ package android.net.wifi {
    method @Deprecated @NonNull public android.net.wifi.WifiConfiguration.NetworkSelectionStatus getNetworkSelectionStatus();
    method @Deprecated @NonNull public String getPrintableSsid();
    method @Deprecated @NonNull public android.net.IpConfiguration.ProxySettings getProxySettings();
    method @Deprecated public int getRecentFailureReason();
    method @Deprecated @Nullable public android.net.StaticIpConfiguration getStaticIpConfiguration();
    method @Deprecated public boolean hasNoInternetAccess();
    method @Deprecated public boolean isEphemeral();
@@ -7531,6 +7532,8 @@ package android.net.wifi {
    field @Deprecated public static final int METERED_OVERRIDE_NOT_METERED = 2; // 0x2
    field @Deprecated public static final int RANDOMIZATION_NONE = 0; // 0x0
    field @Deprecated public static final int RANDOMIZATION_PERSISTENT = 1; // 0x1
    field @Deprecated public static final int RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA = 17; // 0x11
    field @Deprecated public static final int RECENT_FAILURE_NONE = 0; // 0x0
    field @Deprecated public boolean allowAutojoin;
    field @Deprecated public int apBand;
    field @Deprecated public int carrierId;
@@ -7546,7 +7549,6 @@ package android.net.wifi {
    field @Deprecated public int numAssociation;
    field @Deprecated public int numScorerOverride;
    field @Deprecated public int numScorerOverrideAndSwitchedNetwork;
    field @Deprecated @NonNull public final android.net.wifi.WifiConfiguration.RecentFailure recentFailure;
    field @Deprecated public boolean requirePMF;
    field @Deprecated @Nullable public String saePasswordId;
    field @Deprecated public boolean shared;
@@ -7592,12 +7594,6 @@ package android.net.wifi {
    method @Deprecated @NonNull public android.net.wifi.WifiConfiguration.NetworkSelectionStatus.Builder setNetworkSelectionStatus(int);
  }
  @Deprecated public static class WifiConfiguration.RecentFailure {
    method @Deprecated public int getAssociationStatus();
    field @Deprecated public static final int NONE = 0; // 0x0
    field @Deprecated public static final int STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17; // 0x11
  }
  public class WifiEnterpriseConfig implements android.os.Parcelable {
    method @Nullable public String[] getCaCertificateAliases();
    method @NonNull public String getCaPath();
+2 −2
Original line number Diff line number Diff line
@@ -1170,8 +1170,8 @@ public class AccessPoint implements Comparable<AccessPoint> {
            } else { // In range, not disabled.
                if (mConfig != null) { // Is saved network
                    // Last attempt to connect to this failed. Show reason why
                    switch (mConfig.recentFailure.getAssociationStatus()) {
                        case WifiConfiguration.RecentFailure.STATUS_AP_UNABLE_TO_HANDLE_NEW_STA:
                    switch (mConfig.getRecentFailureReason()) {
                        case WifiConfiguration.RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA:
                            summary.append(mContext.getString(
                                    R.string.wifi_ap_unable_to_handle_new_sta));
                            break;
+47 −26
Original line number Diff line number Diff line
@@ -1930,54 +1930,38 @@ public class WifiConfiguration implements Parcelable {
    private NetworkSelectionStatus mNetworkSelectionStatus = new NetworkSelectionStatus();

    /**
     * @hide
     * This class is intended to store extra failure reason information for the most recent
     * connection attempt, so that it may be surfaced to the settings UI
     * @hide
     */
    @SystemApi
    // TODO(b/148626966): called by SUW via reflection, remove once SUW is updated
    public static class RecentFailure {

        private RecentFailure() {}

        /** @hide */
        @Retention(RetentionPolicy.SOURCE)
        @IntDef(value = {NONE, STATUS_AP_UNABLE_TO_HANDLE_NEW_STA})
        public @interface AssociationStatus {}

        /**
         * No recent failure, or no specific reason given for the recent connection failure
         */
        public static final int NONE = 0;
        /**
         * Connection to this network recently failed due to Association Rejection Status 17
         * (AP is full)
         */
        public static final int STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17;
        /**
         * Association Rejection Status code (NONE for success/non-association-rejection-fail)
         */
        @AssociationStatus
        private int mAssociationStatus = NONE;
        @RecentFailureReason
        private int mAssociationStatus = RECENT_FAILURE_NONE;

        /**
         * @param status the association status code for the recent failure
         * @hide
         */
        public void setAssociationStatus(@AssociationStatus int status) {
        public void setAssociationStatus(@RecentFailureReason int status) {
            mAssociationStatus = status;
        }
        /**
         * Sets the RecentFailure to NONE
         * @hide
         */
        public void clear() {
            mAssociationStatus = NONE;
            mAssociationStatus = RECENT_FAILURE_NONE;
        }
        /**
         * Get the recent failure code. One of {@link #NONE} or
         * {@link #STATUS_AP_UNABLE_TO_HANDLE_NEW_STA}.
         * Get the recent failure code. One of {@link #RECENT_FAILURE_NONE} or
         * {@link #RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA}.
         */
        @AssociationStatus
        @RecentFailureReason
        public int getAssociationStatus() {
            return mAssociationStatus;
        }
@@ -1987,10 +1971,47 @@ public class WifiConfiguration implements Parcelable {
     * RecentFailure member
     * @hide
     */
    // TODO(b/148626966): called by SUW via reflection, once SUW is updated, make private and
    //  rename to mRecentFailure
    @NonNull
    @SystemApi
    public final RecentFailure recentFailure = new RecentFailure();

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = "RECENT_FAILURE_", value = {
            RECENT_FAILURE_NONE,
            RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA})
    public @interface RecentFailureReason {}

    /**
     * No recent failure, or no specific reason given for the recent connection failure
     * @hide
     */
    @SystemApi
    public static final int RECENT_FAILURE_NONE = 0;
    /**
     * Connection to this network recently failed due to Association Rejection Status 17
     * (AP is full)
     * @hide
     */
    @SystemApi
    public static final int RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA = 17;

    /**
     * Get the failure reason for the most recent connection attempt, or
     * {@link #RECENT_FAILURE_NONE} if there was no failure.
     *
     * Failure reasons include:
     * {@link #RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA}
     *
     * @hide
     */
    @RecentFailureReason
    @SystemApi
    public int getRecentFailureReason() {
        return recentFailure.getAssociationStatus();
    }

    /**
     * Get the network selection status.
     * @hide