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

Commit b6f262f5 authored by Etan Cohen's avatar Etan Cohen
Browse files

Add auto-join API for Passpoint configurations

Add API to enable/disable the auto-join configurations for
Passpoint profiles.

Bug: 139199957
Test: atest android.net.wifi
Change-Id: I08729b1c31b9fdf10d513dd04d35ead18f2eaa62
parent 8560ba6d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -5813,6 +5813,7 @@ package android.net.wifi {
  public class WifiManager {
    method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void addOnWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void allowAutojoin(int, boolean);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void allowAutojoinPasspoint(@NonNull String, boolean);
    method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void connect(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
    method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void connect(int, @Nullable android.net.wifi.WifiManager.ActionListener);
    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
@@ -6169,6 +6170,10 @@ package android.net.wifi.hotspot2 {
    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.OsuProvider> CREATOR;
  }
  public final class PasspointConfiguration implements android.os.Parcelable {
    method public boolean isAutoJoinEnabled();
  }
  public abstract class ProvisioningCallback {
    ctor public ProvisioningCallback();
    method public abstract void onProvisioningComplete();
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,8 @@ interface IWifiManager

    void allowAutojoin(int netId, boolean choice);

    void allowAutojoinPasspoint(String fqdn, boolean enableAutoJoin);

    boolean startScan(String packageName, String featureId);

    List<ScanResult> getScanResults(String callingPackage, String callingFeatureId);
+17 −0
Original line number Diff line number Diff line
@@ -4102,6 +4102,23 @@ public class WifiManager {
        }
    }

    /**
     * Configure auto-join settings for a Passpoint profile.
     *
     * @param fqdn the FQDN (fully qualified domain name) of the passpoint profile.
     * @param enableAutoJoin true to enable autojoin, false to disable autojoin.
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    public void allowAutojoinPasspoint(@NonNull String fqdn, boolean enableAutoJoin) {
        try {
            mService.allowAutojoinPasspoint(fqdn, enableAutoJoin);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Disable an ephemeral network.
     *
+42 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.net.wifi.hotspot2;

import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.wifi.hotspot2.pps.Credential;
import android.net.wifi.hotspot2.pps.HomeSp;
import android.net.wifi.hotspot2.pps.Policy;
@@ -422,6 +423,41 @@ public final class PasspointConfiguration implements Parcelable {
        return mCarrierId;
    }

    /**
     * The auto-join configuration specifies whether or not the Passpoint Configuration is
     * 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.
     */
    private boolean mIsAutoJoinEnabled = true;

    /**
     * Configures the auto-association status of this Passpoint configuration. A value of true
     * indicates that the configuration will be considered for auto-connection, a value of false
     * indicates that only manual connection will work - the framework will not auto-associate to
     * this Passpoint network.
     *
     * @param autoJoinEnabled true to be considered for framework auto-connection, false otherwise.
     * @hide
     */
    public void setAutoJoinEnabled(boolean autoJoinEnabled) {
        mIsAutoJoinEnabled = autoJoinEnabled;
    }

    /**
     * Indicates whether the Passpoint configuration may be auto-connected to by the framework. A
     * value of true indicates that auto-connection can happen, a value of false indicates that it
     * cannot. However, even when auto-connection is not possible manual connection by the user is
     * possible.
     *
     * @return the auto-join configuration: true for auto-connection (or join) enabled, false
     * otherwise.
     * @hide
     */
    @SystemApi
    public boolean isAutoJoinEnabled() {
        return mIsAutoJoinEnabled;
    }

    /**
     * Constructor for creating PasspointConfiguration with default values.
     */
@@ -464,6 +500,7 @@ public final class PasspointConfiguration implements Parcelable {
        mServiceFriendlyNames = source.mServiceFriendlyNames;
        mAaaServerTrustedNames = source.mAaaServerTrustedNames;
        mCarrierId = source.mCarrierId;
        mIsAutoJoinEnabled = source.mIsAutoJoinEnabled;
    }

    @Override
@@ -493,6 +530,7 @@ public final class PasspointConfiguration implements Parcelable {
                (HashMap<String, String>) mServiceFriendlyNames);
        dest.writeBundle(bundle);
        dest.writeInt(mCarrierId);
        dest.writeBoolean(mIsAutoJoinEnabled);
    }

    @Override
@@ -523,6 +561,7 @@ public final class PasspointConfiguration implements Parcelable {
                && mUsageLimitDataLimit == that.mUsageLimitDataLimit
                && mUsageLimitTimeLimitInMinutes == that.mUsageLimitTimeLimitInMinutes
                && mCarrierId == that.mCarrierId
                && mIsAutoJoinEnabled == that.mIsAutoJoinEnabled
                && (mServiceFriendlyNames == null ? that.mServiceFriendlyNames == null
                : mServiceFriendlyNames.equals(that.mServiceFriendlyNames));
    }
@@ -533,7 +572,7 @@ public final class PasspointConfiguration implements Parcelable {
                mUpdateIdentifier, mCredentialPriority, mSubscriptionCreationTimeInMillis,
                mSubscriptionExpirationTimeInMillis, mUsageLimitUsageTimePeriodInMinutes,
                mUsageLimitStartTimeInMillis, mUsageLimitDataLimit, mUsageLimitTimeLimitInMinutes,
                mServiceFriendlyNames, mCarrierId);
                mServiceFriendlyNames, mCarrierId, mIsAutoJoinEnabled);
    }

    @Override
@@ -587,6 +626,7 @@ public final class PasspointConfiguration implements Parcelable {
            builder.append("ServiceFriendlyNames: ").append(mServiceFriendlyNames);
        }
        builder.append("CarrierId:" + mCarrierId);
        builder.append("IsAutoJoinEnabled:" + mIsAutoJoinEnabled);
        return builder.toString();
    }

@@ -692,6 +732,7 @@ public final class PasspointConfiguration implements Parcelable {
                        "serviceFriendlyNames");
                config.setServiceFriendlyNames(friendlyNamesMap);
                config.mCarrierId = in.readInt();
                config.mIsAutoJoinEnabled = in.readBoolean();
                return config;
            }

+5 −0
Original line number Diff line number Diff line
@@ -181,6 +181,11 @@ public class BaseWifiService extends IWifiManager.Stub {
        throw new UnsupportedOperationException();
    }

    @Override
    public void allowAutojoinPasspoint(String fqdn, boolean enableAutoJoin) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean startScan(String packageName, String featureId) {
        throw new UnsupportedOperationException();
Loading