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

Commit 0e46cc88 authored by Nate(Qiang) Jiang's avatar Nate(Qiang) Jiang
Browse files

Make autojoin consistent

Bug: 148780003
Test: atest android.net.wifi
Change-Id: I6aef43fa9df6787a61f0c150be7910cabef47d31
parent eb765283
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -31426,7 +31426,7 @@ package android.net.wifi {
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsInitialAutoJoinEnabled(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsInitialAutojoinEnabled(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired(boolean);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPasspointConfig(@NonNull android.net.wifi.hotspot2.PasspointConfiguration);
    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPasspointConfig(@NonNull android.net.wifi.hotspot2.PasspointConfiguration);
+1 −1
Original line number Original line Diff line number Diff line
@@ -8052,7 +8052,7 @@ package android.net.wifi.hotspot2 {
  public final class PasspointConfiguration implements android.os.Parcelable {
  public final class PasspointConfiguration implements android.os.Parcelable {
    method public int getMeteredOverride();
    method public int getMeteredOverride();
    method public boolean isAutoJoinEnabled();
    method public boolean isAutojoinEnabled();
    method public boolean isMacRandomizationEnabled();
    method public boolean isMacRandomizationEnabled();
  }
  }
+11 −11
Original line number Original line Diff line number Diff line
@@ -4308,16 +4308,16 @@ public class WifiManager {
    }
    }


    /**
    /**
     * Allows the OEM to enable/disable auto-join globally.
     * Enable/disable auto-join globally.
     *
     *
     * @param choice true to allow autojoin, false to disallow autojoin
     * @param allowAutojoin true to allow auto-join, false to disallow auto-join
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    public void allowAutojoinGlobal(boolean choice) {
    public void allowAutojoinGlobal(boolean allowAutojoin) {
        try {
        try {
            mService.allowAutojoinGlobal(choice);
            mService.allowAutojoinGlobal(allowAutojoin);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -4329,15 +4329,15 @@ public class WifiManager {
     * The updated choice will be made available through the updated config supplied by the
     * The updated choice will be made available through the updated config supplied by the
     * CONFIGURED_NETWORKS_CHANGED broadcast.
     * CONFIGURED_NETWORKS_CHANGED broadcast.
     *
     *
     * @param netId the id of the network to allow/disallow autojoin for.
     * @param netId the id of the network to allow/disallow auto-join for.
     * @param choice true to allow autojoin, false to disallow autojoin
     * @param allowAutojoin true to allow auto-join, false to disallow auto-join
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    public void allowAutojoin(int netId, boolean choice) {
    public void allowAutojoin(int netId, boolean allowAutojoin) {
        try {
        try {
            mService.allowAutojoin(netId, choice);
            mService.allowAutojoin(netId, allowAutojoin);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -4347,14 +4347,14 @@ public class WifiManager {
     * Configure auto-join settings for a Passpoint profile.
     * Configure auto-join settings for a Passpoint profile.
     *
     *
     * @param fqdn the FQDN (fully qualified domain name) of the passpoint profile.
     * @param fqdn the FQDN (fully qualified domain name) of the passpoint profile.
     * @param enableAutoJoin true to enable autojoin, false to disable autojoin.
     * @param allowAutojoin true to enable auto-join, false to disable auto-join.
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    public void allowAutojoinPasspoint(@NonNull String fqdn, boolean enableAutoJoin) {
    public void allowAutojoinPasspoint(@NonNull String fqdn, boolean allowAutojoin) {
        try {
        try {
            mService.allowAutojoinPasspoint(fqdn, enableAutoJoin);
            mService.allowAutojoinPasspoint(fqdn, allowAutojoin);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
+9 −9
Original line number Original line Diff line number Diff line
@@ -126,7 +126,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
        /**
        /**
         * Whether this network is initialized with auto-join enabled (the default) or not.
         * Whether this network is initialized with auto-join enabled (the default) or not.
         */
         */
        private boolean mIsInitialAutoJoinEnabled;
        private boolean mIsInitialAutojoinEnabled;


        /**
        /**
         * Pre-shared key for use with WAPI-PSK networks.
         * Pre-shared key for use with WAPI-PSK networks.
@@ -159,7 +159,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
            mIsMetered = false;
            mIsMetered = false;
            mIsSharedWithUser = true;
            mIsSharedWithUser = true;
            mIsSharedWithUserSet = false;
            mIsSharedWithUserSet = false;
            mIsInitialAutoJoinEnabled = true;
            mIsInitialAutojoinEnabled = true;
            mPriority = UNASSIGNED_PRIORITY;
            mPriority = UNASSIGNED_PRIORITY;
            mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
            mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
            mWapiPskPassphrase = null;
            mWapiPskPassphrase = null;
@@ -467,10 +467,10 @@ public final class WifiNetworkSuggestion implements Parcelable {
         *
         *
         * @param enabled true for initializing with auto-join enabled (the default), false to
         * @param enabled true for initializing with auto-join enabled (the default), false to
         *                initializing with auto-join disabled.
         *                initializing with auto-join disabled.
         * @return Instance of (@link {@link Builder} to enable chaining of the builder method.
         * @return Instance of {@link Builder} to enable chaining of the builder method.
         */
         */
        public @NonNull Builder setIsInitialAutoJoinEnabled(boolean enabled) {
        public @NonNull Builder setIsInitialAutojoinEnabled(boolean enabled) {
            mIsInitialAutoJoinEnabled = enabled;
            mIsInitialAutojoinEnabled = enabled;
            return this;
            return this;
        }
        }


@@ -664,10 +664,10 @@ public final class WifiNetworkSuggestion implements Parcelable {
                    mIsSharedWithUser = false;
                    mIsSharedWithUser = false;
                }
                }
            }
            }
            if (!mIsSharedWithUser && !mIsInitialAutoJoinEnabled) {
            if (!mIsSharedWithUser && !mIsInitialAutojoinEnabled) {
                throw new IllegalStateException("Should have not a network with both "
                throw new IllegalStateException("Should have not a network with both "
                        + "setCredentialSharedWithUser and "
                        + "setCredentialSharedWithUser and "
                        + "setIsAutoJoinEnabled set to false");
                        + "setIsAutojoinEnabled set to false");
            }
            }
            if (mIsNetworkUntrusted) {
            if (mIsNetworkUntrusted) {
                if (mIsSharedWithUserSet && mIsSharedWithUser) {
                if (mIsSharedWithUserSet && mIsSharedWithUser) {
@@ -683,7 +683,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
                    mIsAppInteractionRequired,
                    mIsAppInteractionRequired,
                    mIsUserInteractionRequired,
                    mIsUserInteractionRequired,
                    mIsSharedWithUser,
                    mIsSharedWithUser,
                    mIsInitialAutoJoinEnabled,
                    mIsInitialAutojoinEnabled,
                    mIsNetworkUntrusted);
                    mIsNetworkUntrusted);
        }
        }
    }
    }
@@ -774,7 +774,7 @@ public final class WifiNetworkSuggestion implements Parcelable {
                            in.readBoolean(), // isAppInteractionRequired
                            in.readBoolean(), // isAppInteractionRequired
                            in.readBoolean(), // isUserInteractionRequired
                            in.readBoolean(), // isUserInteractionRequired
                            in.readBoolean(), // isSharedCredentialWithUser
                            in.readBoolean(), // isSharedCredentialWithUser
                            in.readBoolean(),  // isAutoJoinEnabled
                            in.readBoolean(),  // isAutojoinEnabled
                            in.readBoolean()
                            in.readBoolean()
                    );
                    );
                }
                }
+12 −12
Original line number Original line Diff line number Diff line
@@ -432,7 +432,7 @@ public final class PasspointConfiguration implements Parcelable {
     * considered for auto-connection. If true then yes, if false then it isn't considered as part
     * considered for auto-connection. If true then yes, if false then it isn't considered as part
     * of auto-connection - but can still be manually connected to.
     * of auto-connection - but can still be manually connected to.
     */
     */
    private boolean mIsAutoJoinEnabled = true;
    private boolean mIsAutojoinEnabled = true;


    /**
    /**
     * The mac randomization setting specifies whether a randomized or device MAC address will
     * The mac randomization setting specifies whether a randomized or device MAC address will
@@ -459,11 +459,11 @@ public final class PasspointConfiguration implements Parcelable {
     * indicates that only manual connection will work - the framework will not auto-associate to
     * indicates that only manual connection will work - the framework will not auto-associate to
     * this Passpoint network.
     * this Passpoint network.
     *
     *
     * @param autoJoinEnabled true to be considered for framework auto-connection, false otherwise.
     * @param autojoinEnabled true to be considered for framework auto-connection, false otherwise.
     * @hide
     * @hide
     */
     */
    public void setAutoJoinEnabled(boolean autoJoinEnabled) {
    public void setAutojoinEnabled(boolean autojoinEnabled) {
        mIsAutoJoinEnabled = autoJoinEnabled;
        mIsAutojoinEnabled = autojoinEnabled;
    }
    }


    /**
    /**
@@ -499,8 +499,8 @@ public final class PasspointConfiguration implements Parcelable {
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public boolean isAutoJoinEnabled() {
    public boolean isAutojoinEnabled() {
        return mIsAutoJoinEnabled;
        return mIsAutojoinEnabled;
    }
    }


    /**
    /**
@@ -570,7 +570,7 @@ public final class PasspointConfiguration implements Parcelable {
        mServiceFriendlyNames = source.mServiceFriendlyNames;
        mServiceFriendlyNames = source.mServiceFriendlyNames;
        mAaaServerTrustedNames = source.mAaaServerTrustedNames;
        mAaaServerTrustedNames = source.mAaaServerTrustedNames;
        mCarrierId = source.mCarrierId;
        mCarrierId = source.mCarrierId;
        mIsAutoJoinEnabled = source.mIsAutoJoinEnabled;
        mIsAutojoinEnabled = source.mIsAutojoinEnabled;
        mIsMacRandomizationEnabled = source.mIsMacRandomizationEnabled;
        mIsMacRandomizationEnabled = source.mIsMacRandomizationEnabled;
        mMeteredOverride = source.mMeteredOverride;
        mMeteredOverride = source.mMeteredOverride;
    }
    }
@@ -602,7 +602,7 @@ public final class PasspointConfiguration implements Parcelable {
                (HashMap<String, String>) mServiceFriendlyNames);
                (HashMap<String, String>) mServiceFriendlyNames);
        dest.writeBundle(bundle);
        dest.writeBundle(bundle);
        dest.writeInt(mCarrierId);
        dest.writeInt(mCarrierId);
        dest.writeBoolean(mIsAutoJoinEnabled);
        dest.writeBoolean(mIsAutojoinEnabled);
        dest.writeBoolean(mIsMacRandomizationEnabled);
        dest.writeBoolean(mIsMacRandomizationEnabled);
        dest.writeInt(mMeteredOverride);
        dest.writeInt(mMeteredOverride);
    }
    }
@@ -635,7 +635,7 @@ public final class PasspointConfiguration implements Parcelable {
                && mUsageLimitDataLimit == that.mUsageLimitDataLimit
                && mUsageLimitDataLimit == that.mUsageLimitDataLimit
                && mUsageLimitTimeLimitInMinutes == that.mUsageLimitTimeLimitInMinutes
                && mUsageLimitTimeLimitInMinutes == that.mUsageLimitTimeLimitInMinutes
                && mCarrierId == that.mCarrierId
                && mCarrierId == that.mCarrierId
                && mIsAutoJoinEnabled == that.mIsAutoJoinEnabled
                && mIsAutojoinEnabled == that.mIsAutojoinEnabled
                && mIsMacRandomizationEnabled == that.mIsMacRandomizationEnabled
                && mIsMacRandomizationEnabled == that.mIsMacRandomizationEnabled
                && mMeteredOverride == that.mMeteredOverride
                && mMeteredOverride == that.mMeteredOverride
                && (mServiceFriendlyNames == null ? that.mServiceFriendlyNames == null
                && (mServiceFriendlyNames == null ? that.mServiceFriendlyNames == null
@@ -648,7 +648,7 @@ public final class PasspointConfiguration implements Parcelable {
                mUpdateIdentifier, mCredentialPriority, mSubscriptionCreationTimeInMillis,
                mUpdateIdentifier, mCredentialPriority, mSubscriptionCreationTimeInMillis,
                mSubscriptionExpirationTimeInMillis, mUsageLimitUsageTimePeriodInMinutes,
                mSubscriptionExpirationTimeInMillis, mUsageLimitUsageTimePeriodInMinutes,
                mUsageLimitStartTimeInMillis, mUsageLimitDataLimit, mUsageLimitTimeLimitInMinutes,
                mUsageLimitStartTimeInMillis, mUsageLimitDataLimit, mUsageLimitTimeLimitInMinutes,
                mServiceFriendlyNames, mCarrierId, mIsAutoJoinEnabled, mIsMacRandomizationEnabled,
                mServiceFriendlyNames, mCarrierId, mIsAutojoinEnabled, mIsMacRandomizationEnabled,
                mMeteredOverride);
                mMeteredOverride);
    }
    }


@@ -703,7 +703,7 @@ public final class PasspointConfiguration implements Parcelable {
            builder.append("ServiceFriendlyNames: ").append(mServiceFriendlyNames);
            builder.append("ServiceFriendlyNames: ").append(mServiceFriendlyNames);
        }
        }
        builder.append("CarrierId:" + mCarrierId);
        builder.append("CarrierId:" + mCarrierId);
        builder.append("IsAutoJoinEnabled:" + mIsAutoJoinEnabled);
        builder.append("IsAutojoinEnabled:" + mIsAutojoinEnabled);
        builder.append("mIsMacRandomizationEnabled:" + mIsMacRandomizationEnabled);
        builder.append("mIsMacRandomizationEnabled:" + mIsMacRandomizationEnabled);
        builder.append("mMeteredOverride:" + mMeteredOverride);
        builder.append("mMeteredOverride:" + mMeteredOverride);
        return builder.toString();
        return builder.toString();
@@ -811,7 +811,7 @@ public final class PasspointConfiguration implements Parcelable {
                        "serviceFriendlyNames");
                        "serviceFriendlyNames");
                config.setServiceFriendlyNames(friendlyNamesMap);
                config.setServiceFriendlyNames(friendlyNamesMap);
                config.mCarrierId = in.readInt();
                config.mCarrierId = in.readInt();
                config.mIsAutoJoinEnabled = in.readBoolean();
                config.mIsAutojoinEnabled = in.readBoolean();
                config.mIsMacRandomizationEnabled = in.readBoolean();
                config.mIsMacRandomizationEnabled = in.readBoolean();
                config.mMeteredOverride = in.readInt();
                config.mMeteredOverride = in.readInt();
                return config;
                return config;
Loading