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

Commit 2a96126e authored by David Su's avatar David Su
Browse files

Expose WifiNetworkSuggestion.getWifi/PasspointConfiguration()

These @SystemApis are needed by Settings.

Also modified no-arg constructor for
WifiNetworkSuggestion to conform to the
@NonNull guarantees of getWifiConfiguration().

Bug: 138801922
Test: atest FrameworksWifiApiTests
Change-Id: I5ce60ba376e6976bdcb5a651c991c44579bfef3f
parent 0e186edf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6430,6 +6430,11 @@ package android.net.wifi {
    method public boolean satisfiedBy(android.net.NetworkSpecifier);
  }
  public final class WifiNetworkSuggestion implements android.os.Parcelable {
    method @Nullable public android.net.wifi.hotspot2.PasspointConfiguration getPasspointConfiguration();
    method @NonNull public android.net.wifi.WifiConfiguration getWifiConfiguration();
  }
  public static final class WifiNetworkSuggestion.Builder {
    method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_CARRIER_PROVISIONING) public android.net.wifi.WifiNetworkSuggestion.Builder setCarrierId(int);
  }
+24 −1
Original line number Diff line number Diff line
@@ -657,12 +657,14 @@ public final class WifiNetworkSuggestion implements Parcelable {
     * Network configuration for the provided network.
     * @hide
     */
    @NonNull
    public final WifiConfiguration wifiConfiguration;

    /**
     * Passpoint configuration for the provided network.
     * @hide
     */
    @Nullable
    public final PasspointConfiguration passpointConfiguration;

    /**
@@ -692,7 +694,7 @@ public final class WifiNetworkSuggestion implements Parcelable {

    /** @hide */
    public WifiNetworkSuggestion() {
        this.wifiConfiguration = null;
        this.wifiConfiguration = new WifiConfiguration();
        this.passpointConfiguration = null;
        this.isAppInteractionRequired = false;
        this.isUserInteractionRequired = false;
@@ -794,4 +796,25 @@ public final class WifiNetworkSuggestion implements Parcelable {
                .append(" ]");
        return sb.toString();
    }

    /**
     * Get the {@link WifiConfiguration} associated with this Suggestion.
     * @hide
     */
    @SystemApi
    @NonNull
    public WifiConfiguration getWifiConfiguration() {
        return wifiConfiguration;
    }

    /**
     * Get the {@link PasspointConfiguration} associated with this Suggestion, or null if this
     * Suggestion is not for a Passpoint network.
     * @hide
     */
    @SystemApi
    @Nullable
    public PasspointConfiguration getPasspointConfiguration() {
        return passpointConfiguration;
    }
}