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

Commit bd8dd47f authored by Roshan Pius's avatar Roshan Pius Committed by Android (Google) Code Review
Browse files

Merge changes from topics "ap_shutdown_timeout_flag", "scan_always_available_API"

* changes:
  WifiOemMigrationHook: Migrate Settings global values
  WifiManager: Add API for scan always available toggle
  SoftApConfiguration: Add shutdown enabled method
parents b4358fdf 6d4cb9cd
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -40585,13 +40585,13 @@ package android.provider {
    field public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
    field public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
    field public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms";
    field public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms";
    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on";
    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on";
    field public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay";
    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay";
    field public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
    field @Deprecated public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
    field public static final String WIFI_ON = "wifi_on";
    field public static final String WIFI_ON = "wifi_on";
    field public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
    field @Deprecated public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
    field public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0
    field @Deprecated public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0
    field public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2
    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2
    field public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1
    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1
    field public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
    field public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
    field public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
    field public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
  }
  }
+31 −9
Original line number Original line Diff line number Diff line
@@ -7536,6 +7536,7 @@ package android.net.wifi {
    method public int getChannel();
    method public int getChannel();
    method public int getMaxNumberOfClients();
    method public int getMaxNumberOfClients();
    method public int getShutdownTimeoutMillis();
    method public int getShutdownTimeoutMillis();
    method public boolean isAutoShutdownEnabled();
    method public boolean isClientControlByUserEnabled();
    method public boolean isClientControlByUserEnabled();
    method @Nullable public android.net.wifi.WifiConfiguration toWifiConfiguration();
    method @Nullable public android.net.wifi.WifiConfiguration toWifiConfiguration();
    field public static final int BAND_2GHZ = 1; // 0x1
    field public static final int BAND_2GHZ = 1; // 0x1
@@ -7549,14 +7550,15 @@ package android.net.wifi {
    ctor public SoftApConfiguration.Builder(@NonNull android.net.wifi.SoftApConfiguration);
    ctor public SoftApConfiguration.Builder(@NonNull android.net.wifi.SoftApConfiguration);
    method @NonNull public android.net.wifi.SoftApConfiguration build();
    method @NonNull public android.net.wifi.SoftApConfiguration build();
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder enableClientControlByUser(boolean);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder enableClientControlByUser(boolean);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setAutoShutdownEnabled(boolean);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBand(int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBand(int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBssid(@Nullable android.net.MacAddress);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBssid(@Nullable android.net.MacAddress);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setChannel(int, int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setChannel(int, int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setClientList(@NonNull java.util.List<android.net.MacAddress>, @NonNull java.util.List<android.net.MacAddress>);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setClientList(@NonNull java.util.List<android.net.MacAddress>, @NonNull java.util.List<android.net.MacAddress>);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setHiddenSsid(boolean);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setHiddenSsid(boolean);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setMaxNumberOfClients(int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setMaxNumberOfClients(@IntRange(from=0) int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setPassphrase(@Nullable String, int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setPassphrase(@Nullable String, int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setShutdownTimeoutMillis(int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setShutdownTimeoutMillis(@IntRange(from=0) int);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setSsid(@Nullable String);
    method @NonNull public android.net.wifi.SoftApConfiguration.Builder setSsid(@Nullable String);
  }
  }
@@ -7750,6 +7752,7 @@ package android.net.wifi {
    method @RequiresPermission(android.Manifest.permission.WIFI_SET_DEVICE_MOBILITY_STATE) public void setDeviceMobilityState(int);
    method @RequiresPermission(android.Manifest.permission.WIFI_SET_DEVICE_MOBILITY_STATE) public void setDeviceMobilityState(int);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMacRandomizationSettingPasspointEnabled(@NonNull String, boolean);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMacRandomizationSettingPasspointEnabled(@NonNull String, boolean);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMeteredOverridePasspoint(@NonNull String, int);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMeteredOverridePasspoint(@NonNull String, int);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setScanAlwaysAvailable(boolean);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setScanThrottleEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setScanThrottleEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean setSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean setSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setVerboseLoggingEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setVerboseLoggingEnabled(boolean);
@@ -7897,6 +7900,7 @@ package android.net.wifi {
  public final class WifiOemMigrationHook {
  public final class WifiOemMigrationHook {
    method @Nullable public static android.net.wifi.WifiOemMigrationHook.ConfigStoreMigrationData loadFromConfigStore();
    method @Nullable public static android.net.wifi.WifiOemMigrationHook.ConfigStoreMigrationData loadFromConfigStore();
    method @NonNull public static android.net.wifi.WifiOemMigrationHook.SettingsMigrationData loadFromSettings(@NonNull android.content.Context);
  }
  }
  public static final class WifiOemMigrationHook.ConfigStoreMigrationData implements android.os.Parcelable {
  public static final class WifiOemMigrationHook.ConfigStoreMigrationData implements android.os.Parcelable {
@@ -7914,6 +7918,31 @@ package android.net.wifi {
    method @NonNull public android.net.wifi.WifiOemMigrationHook.ConfigStoreMigrationData.Builder setUserSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
    method @NonNull public android.net.wifi.WifiOemMigrationHook.ConfigStoreMigrationData.Builder setUserSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
  }
  }
  public static final class WifiOemMigrationHook.SettingsMigrationData implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public String getP2pDeviceName();
    method public boolean isP2pFactoryResetPending();
    method public boolean isScanAlwaysAvailable();
    method public boolean isScanThrottleEnabled();
    method public boolean isSoftApTimeoutEnabled();
    method public boolean isVerboseLoggingEnabled();
    method public boolean isWakeUpEnabled();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiOemMigrationHook.SettingsMigrationData> CREATOR;
  }
  public static final class WifiOemMigrationHook.SettingsMigrationData.Builder {
    ctor public WifiOemMigrationHook.SettingsMigrationData.Builder();
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData build();
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setP2pDeviceName(@Nullable String);
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setP2pFactoryResetPending(boolean);
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setScanAlwaysAvailable(boolean);
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setScanThrottleEnabled(boolean);
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setSoftApTimeoutEnabled(boolean);
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setVerboseLoggingEnabled(boolean);
    method @NonNull public android.net.wifi.WifiOemMigrationHook.SettingsMigrationData.Builder setWakeUpEnabled(boolean);
  }
  public class WifiScanner {
  public class WifiScanner {
    method @Deprecated public void configureWifiChange(int, int, int, int, int, android.net.wifi.WifiScanner.BssidInfo[]);
    method @Deprecated public void configureWifiChange(int, int, int, int, int, android.net.wifi.WifiScanner.BssidInfo[]);
    method @Deprecated public void configureWifiChange(android.net.wifi.WifiScanner.WifiChangeSettings);
    method @Deprecated public void configureWifiChange(android.net.wifi.WifiScanner.WifiChangeSettings);
@@ -9720,18 +9749,11 @@ package android.provider {
    field public static final String INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS = "install_carrier_app_notification_sleep_millis";
    field public static final String INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS = "install_carrier_app_notification_sleep_millis";
    field public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
    field public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
    field public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
    field public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
    field public static final String SOFT_AP_TIMEOUT_ENABLED = "soft_ap_timeout_enabled";
    field public static final String TETHER_OFFLOAD_DISABLED = "tether_offload_disabled";
    field public static final String TETHER_OFFLOAD_DISABLED = "tether_offload_disabled";
    field public static final String TETHER_SUPPORTED = "tether_supported";
    field public static final String TETHER_SUPPORTED = "tether_supported";
    field public static final String THEATER_MODE_ON = "theater_mode_on";
    field public static final String THEATER_MODE_ON = "theater_mode_on";
    field public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
    field public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
    field public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
    field public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
    field public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
    field public static final String WIFI_P2P_PENDING_FACTORY_RESET = "wifi_p2p_pending_factory_reset";
    field public static final String WIFI_SCAN_ALWAYS_AVAILABLE = "wifi_scan_always_enabled";
    field public static final String WIFI_SCAN_THROTTLE_ENABLED = "wifi_scan_throttle_enabled";
    field public static final String WIFI_SCORE_PARAMS = "wifi_score_params";
    field public static final String WIFI_VERBOSE_LOGGING_ENABLED = "wifi_verbose_logging_enabled";
    field @Deprecated public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
    field @Deprecated public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
  }
  }
+20 −9
Original line number Original line Diff line number Diff line
@@ -9093,26 +9093,34 @@ public final class Settings {
         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
         * {@link #WIFI_SLEEP_POLICY_NEVER}.
         * {@link #WIFI_SLEEP_POLICY_NEVER}.
         * @deprecated This is no longer used or set by the platform.
         */
         */
        @Deprecated
        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
        /**
        /**
         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
         * policy, which is to sleep shortly after the turning off
         * policy, which is to sleep shortly after the turning off
         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
         * @deprecated This is no longer used by the platform.
         */
         */
        @Deprecated
        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
        /**
        /**
         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
         * the device is on battery, and never go to sleep when the device is
         * the device is on battery, and never go to sleep when the device is
         * plugged in.
         * plugged in.
         * @deprecated This is no longer used by the platform.
         */
         */
        @Deprecated
        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
        /**
        /**
         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
         * @deprecated This is no longer used by the platform.
         */
         */
        @Deprecated
        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
        /**
        /**
@@ -10206,7 +10214,9 @@ public final class Settings {
       /**
       /**
        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
        * Connecting to a network will reset the timer.
        * Connecting to a network will reset the timer.
        * @deprecated This is no longer used or set by the platform.
        */
        */
       @Deprecated
       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
               "wifi_networks_available_repeat_delay";
               "wifi_networks_available_repeat_delay";
@@ -10236,7 +10246,9 @@ public final class Settings {
       /**
       /**
        * When the number of open networks exceeds this number, the
        * When the number of open networks exceeds this number, the
        * least-recently-used excess networks will be removed.
        * least-recently-used excess networks will be removed.
        * @deprecated This is no longer used or set by the platform.
        */
        */
       @Deprecated
       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
       /**
       /**
@@ -10247,8 +10259,8 @@ public final class Settings {
       /**
       /**
        * Setting to allow scans to be enabled even wifi is turned off for connectivity.
        * Setting to allow scans to be enabled even wifi is turned off for connectivity.
        * @hide
        * @hide
        * @deprecated To be removed.
        */
        */
       @SystemApi
       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
                "wifi_scan_always_enabled";
                "wifi_scan_always_enabled";
@@ -10257,8 +10269,8 @@ public final class Settings {
         *
         *
         * Type: int (0 for false, 1 for true)
         * Type: int (0 for false, 1 for true)
         * @hide
         * @hide
         * @deprecated To be removed.
         */
         */
        @SystemApi
        public static final String WIFI_P2P_PENDING_FACTORY_RESET =
        public static final String WIFI_P2P_PENDING_FACTORY_RESET =
                "wifi_p2p_pending_factory_reset";
                "wifi_p2p_pending_factory_reset";
@@ -10267,8 +10279,8 @@ public final class Settings {
         *
         *
         * Type: int (0 for false, 1 for true)
         * Type: int (0 for false, 1 for true)
         * @hide
         * @hide
         * @deprecated To be removed.
         */
         */
        @SystemApi
        public static final String SOFT_AP_TIMEOUT_ENABLED = "soft_ap_timeout_enabled";
        public static final String SOFT_AP_TIMEOUT_ENABLED = "soft_ap_timeout_enabled";
        /**
        /**
@@ -10313,6 +10325,7 @@ public final class Settings {
         * Most readers of this setting should simply check if value == 1 to determined the
         * Most readers of this setting should simply check if value == 1 to determined the
         * enabled state.
         * enabled state.
         * @hide
         * @hide
         * @deprecated To be removed.
         */
         */
        public static final String NETWORK_RECOMMENDATIONS_ENABLED =
        public static final String NETWORK_RECOMMENDATIONS_ENABLED =
                "network_recommendations_enabled";
                "network_recommendations_enabled";
@@ -10352,13 +10365,11 @@ public final class Settings {
        /**
        /**
         * Whether wifi scan throttle is enabled or not.
         * Whether wifi scan throttle is enabled or not.
         * This is intended to be used via adb commands or a menu in developer option to turn off
         * the default wifi scan throttling mechanism for apps.
         *
         *
         * Type: int (0 for false, 1 for true)
         * Type: int (0 for false, 1 for true)
         * @hide
         * @hide
         * @deprecated To be removed.
         */
         */
        @SystemApi
        public static final String WIFI_SCAN_THROTTLE_ENABLED = "wifi_scan_throttle_enabled";
        public static final String WIFI_SCAN_THROTTLE_ENABLED = "wifi_scan_throttle_enabled";
        /**
        /**
@@ -10460,8 +10471,8 @@ public final class Settings {
        * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
        * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
        * will enable it. In the future, additional values may be supported.
        * will enable it. In the future, additional values may be supported.
        * @hide
        * @hide
        * @deprecated To be removed.
        */
        */
       @SystemApi
       public static final String WIFI_VERBOSE_LOGGING_ENABLED =
       public static final String WIFI_VERBOSE_LOGGING_ENABLED =
               "wifi_verbose_logging_enabled";
               "wifi_verbose_logging_enabled";
@@ -10486,8 +10497,8 @@ public final class Settings {
         * Default values are provided by code or device configurations.
         * Default values are provided by code or device configurations.
         * Errors in the parameters will cause the entire setting to be ignored.
         * Errors in the parameters will cause the entire setting to be ignored.
         * @hide
         * @hide
         * @deprecated This is no longer used or set by the platform.
         */
         */
        @SystemApi
        public static final String WIFI_SCORE_PARAMS =
        public static final String WIFI_SCORE_PARAMS =
                "wifi_score_params";
                "wifi_score_params";
@@ -10529,8 +10540,8 @@ public final class Settings {
       /**
       /**
        * The Wi-Fi peer-to-peer device name
        * The Wi-Fi peer-to-peer device name
        * @hide
        * @hide
        * @deprecated To be removed.
        */
        */
       @SystemApi
       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
       /**
       /**
+2 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,8 @@ interface IWifiManager


    DhcpInfo getDhcpInfo();
    DhcpInfo getDhcpInfo();


    void setScanAlwaysAvailable(boolean isAvailable);

    boolean isScanAlwaysAvailable();
    boolean isScanAlwaysAvailable();


    boolean acquireWifiLock(IBinder lock, int lockType, String tag, in WorkSource ws);
    boolean acquireWifiLock(IBinder lock, int lockType, String tag, in WorkSource ws);
+59 −12
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.net.wifi;
package android.net.wifi;


import android.annotation.IntDef;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
@@ -201,6 +202,11 @@ public final class SoftApConfiguration implements Parcelable {
     */
     */
    private final List<MacAddress> mAllowedClientList;
    private final List<MacAddress> mAllowedClientList;


    /**
     * Whether auto shutdown of soft AP is enabled or not.
     */
    private final boolean mAutoShutdownEnabled;

    /**
    /**
     * Delay in milliseconds before shutting down soft AP when
     * Delay in milliseconds before shutting down soft AP when
     * there are no connected devices.
     * there are no connected devices.
@@ -240,9 +246,9 @@ public final class SoftApConfiguration implements Parcelable {
    /** Private constructor for Builder and Parcelable implementation. */
    /** Private constructor for Builder and Parcelable implementation. */
    private SoftApConfiguration(@Nullable String ssid, @Nullable MacAddress bssid,
    private SoftApConfiguration(@Nullable String ssid, @Nullable MacAddress bssid,
            @Nullable String passphrase, boolean hiddenSsid, @BandType int band, int channel,
            @Nullable String passphrase, boolean hiddenSsid, @BandType int band, int channel,
            @SecurityType int securityType, int maxNumberOfClients, int shutdownTimeoutMillis,
            @SecurityType int securityType, int maxNumberOfClients, boolean shutdownTimeoutEnabled,
            boolean clientControlByUser, @NonNull List<MacAddress> blockedList,
            int shutdownTimeoutMillis, boolean clientControlByUser,
            @NonNull List<MacAddress> allowedList) {
            @NonNull List<MacAddress> blockedList, @NonNull List<MacAddress> allowedList) {
        mSsid = ssid;
        mSsid = ssid;
        mBssid = bssid;
        mBssid = bssid;
        mPassphrase = passphrase;
        mPassphrase = passphrase;
@@ -251,6 +257,7 @@ public final class SoftApConfiguration implements Parcelable {
        mChannel = channel;
        mChannel = channel;
        mSecurityType = securityType;
        mSecurityType = securityType;
        mMaxNumberOfClients = maxNumberOfClients;
        mMaxNumberOfClients = maxNumberOfClients;
        mAutoShutdownEnabled = shutdownTimeoutEnabled;
        mShutdownTimeoutMillis = shutdownTimeoutMillis;
        mShutdownTimeoutMillis = shutdownTimeoutMillis;
        mClientControlByUser = clientControlByUser;
        mClientControlByUser = clientControlByUser;
        mBlockedClientList = new ArrayList<>(blockedList);
        mBlockedClientList = new ArrayList<>(blockedList);
@@ -274,6 +281,7 @@ public final class SoftApConfiguration implements Parcelable {
                && mChannel == other.mChannel
                && mChannel == other.mChannel
                && mSecurityType == other.mSecurityType
                && mSecurityType == other.mSecurityType
                && mMaxNumberOfClients == other.mMaxNumberOfClients
                && mMaxNumberOfClients == other.mMaxNumberOfClients
                && mAutoShutdownEnabled == other.mAutoShutdownEnabled
                && mShutdownTimeoutMillis == other.mShutdownTimeoutMillis
                && mShutdownTimeoutMillis == other.mShutdownTimeoutMillis
                && mClientControlByUser == other.mClientControlByUser
                && mClientControlByUser == other.mClientControlByUser
                && Objects.equals(mBlockedClientList, other.mBlockedClientList)
                && Objects.equals(mBlockedClientList, other.mBlockedClientList)
@@ -283,8 +291,9 @@ public final class SoftApConfiguration implements Parcelable {
    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(mSsid, mBssid, mPassphrase, mHiddenSsid,
        return Objects.hash(mSsid, mBssid, mPassphrase, mHiddenSsid,
                mBand, mChannel, mSecurityType, mMaxNumberOfClients, mShutdownTimeoutMillis,
                mBand, mChannel, mSecurityType, mMaxNumberOfClients, mAutoShutdownEnabled,
                mClientControlByUser, mBlockedClientList, mAllowedClientList);
                mShutdownTimeoutMillis, mClientControlByUser, mBlockedClientList,
                mAllowedClientList);
    }
    }


    @Override
    @Override
@@ -299,6 +308,7 @@ public final class SoftApConfiguration implements Parcelable {
        sbuf.append(" \n Channel =").append(mChannel);
        sbuf.append(" \n Channel =").append(mChannel);
        sbuf.append(" \n SecurityType=").append(getSecurityType());
        sbuf.append(" \n SecurityType=").append(getSecurityType());
        sbuf.append(" \n MaxClient=").append(mMaxNumberOfClients);
        sbuf.append(" \n MaxClient=").append(mMaxNumberOfClients);
        sbuf.append(" \n AutoShutdownEnabled=").append(mAutoShutdownEnabled);
        sbuf.append(" \n ShutdownTimeoutMillis=").append(mShutdownTimeoutMillis);
        sbuf.append(" \n ShutdownTimeoutMillis=").append(mShutdownTimeoutMillis);
        sbuf.append(" \n ClientControlByUser=").append(mClientControlByUser);
        sbuf.append(" \n ClientControlByUser=").append(mClientControlByUser);
        sbuf.append(" \n BlockedClientList=").append(mBlockedClientList);
        sbuf.append(" \n BlockedClientList=").append(mBlockedClientList);
@@ -316,6 +326,7 @@ public final class SoftApConfiguration implements Parcelable {
        dest.writeInt(mChannel);
        dest.writeInt(mChannel);
        dest.writeInt(mSecurityType);
        dest.writeInt(mSecurityType);
        dest.writeInt(mMaxNumberOfClients);
        dest.writeInt(mMaxNumberOfClients);
        dest.writeBoolean(mAutoShutdownEnabled);
        dest.writeInt(mShutdownTimeoutMillis);
        dest.writeInt(mShutdownTimeoutMillis);
        dest.writeBoolean(mClientControlByUser);
        dest.writeBoolean(mClientControlByUser);
        dest.writeTypedList(mBlockedClientList);
        dest.writeTypedList(mBlockedClientList);
@@ -335,7 +346,7 @@ public final class SoftApConfiguration implements Parcelable {
                    in.readString(),
                    in.readString(),
                    in.readParcelable(MacAddress.class.getClassLoader()),
                    in.readParcelable(MacAddress.class.getClassLoader()),
                    in.readString(), in.readBoolean(), in.readInt(), in.readInt(), in.readInt(),
                    in.readString(), in.readBoolean(), in.readInt(), in.readInt(), in.readInt(),
                    in.readInt(), in.readInt(), in.readBoolean(),
                    in.readInt(), in.readBoolean(), in.readInt(), in.readBoolean(),
                    in.createTypedArrayList(MacAddress.CREATOR),
                    in.createTypedArrayList(MacAddress.CREATOR),
                    in.createTypedArrayList(MacAddress.CREATOR));
                    in.createTypedArrayList(MacAddress.CREATOR));
        }
        }
@@ -428,6 +439,18 @@ public final class SoftApConfiguration implements Parcelable {
        return mMaxNumberOfClients;
        return mMaxNumberOfClients;
    }
    }


    /**
     * Returns whether auto shutdown is enabled or not.
     * The Soft AP will shutdown when there are no devices associated to it for
     * the timeout duration. See {@link Builder#setAutoShutdownEnabled(boolean)}.
     *
     * @hide
     */
    @SystemApi
    public boolean isAutoShutdownEnabled() {
        return mAutoShutdownEnabled;
    }

    /**
    /**
     * Returns the shutdown timeout in milliseconds.
     * Returns the shutdown timeout in milliseconds.
     * The Soft AP will shutdown when there are no devices associated to it for
     * The Soft AP will shutdown when there are no devices associated to it for
@@ -551,6 +574,7 @@ public final class SoftApConfiguration implements Parcelable {
        private int mChannel;
        private int mChannel;
        private int mMaxNumberOfClients;
        private int mMaxNumberOfClients;
        private int mSecurityType;
        private int mSecurityType;
        private boolean mAutoShutdownEnabled;
        private int mShutdownTimeoutMillis;
        private int mShutdownTimeoutMillis;
        private boolean mClientControlByUser;
        private boolean mClientControlByUser;
        private List<MacAddress> mBlockedClientList;
        private List<MacAddress> mBlockedClientList;
@@ -568,6 +592,7 @@ public final class SoftApConfiguration implements Parcelable {
            mChannel = 0;
            mChannel = 0;
            mMaxNumberOfClients = 0;
            mMaxNumberOfClients = 0;
            mSecurityType = SECURITY_TYPE_OPEN;
            mSecurityType = SECURITY_TYPE_OPEN;
            mAutoShutdownEnabled = true; // enabled by default.
            mShutdownTimeoutMillis = 0;
            mShutdownTimeoutMillis = 0;
            mClientControlByUser = false;
            mClientControlByUser = false;
            mBlockedClientList = new ArrayList<>();
            mBlockedClientList = new ArrayList<>();
@@ -588,6 +613,7 @@ public final class SoftApConfiguration implements Parcelable {
            mChannel = other.mChannel;
            mChannel = other.mChannel;
            mMaxNumberOfClients = other.mMaxNumberOfClients;
            mMaxNumberOfClients = other.mMaxNumberOfClients;
            mSecurityType = other.mSecurityType;
            mSecurityType = other.mSecurityType;
            mAutoShutdownEnabled = other.mAutoShutdownEnabled;
            mShutdownTimeoutMillis = other.mShutdownTimeoutMillis;
            mShutdownTimeoutMillis = other.mShutdownTimeoutMillis;
            mClientControlByUser = other.mClientControlByUser;
            mClientControlByUser = other.mClientControlByUser;
            mBlockedClientList = new ArrayList<>(other.mBlockedClientList);
            mBlockedClientList = new ArrayList<>(other.mBlockedClientList);
@@ -603,8 +629,8 @@ public final class SoftApConfiguration implements Parcelable {
        public SoftApConfiguration build() {
        public SoftApConfiguration build() {
            return new SoftApConfiguration(mSsid, mBssid, mPassphrase,
            return new SoftApConfiguration(mSsid, mBssid, mPassphrase,
                    mHiddenSsid, mBand, mChannel, mSecurityType, mMaxNumberOfClients,
                    mHiddenSsid, mBand, mChannel, mSecurityType, mMaxNumberOfClients,
                    mShutdownTimeoutMillis, mClientControlByUser, mBlockedClientList,
                    mAutoShutdownEnabled, mShutdownTimeoutMillis, mClientControlByUser,
                    mAllowedClientList);
                    mBlockedClientList, mAllowedClientList);
        }
        }


        /**
        /**
@@ -789,7 +815,7 @@ public final class SoftApConfiguration implements Parcelable {
         * @return Builder for chaining.
         * @return Builder for chaining.
         */
         */
        @NonNull
        @NonNull
        public Builder setMaxNumberOfClients(int maxNumberOfClients) {
        public Builder setMaxNumberOfClients(@IntRange(from = 0) int maxNumberOfClients) {
            if (maxNumberOfClients < 0) {
            if (maxNumberOfClients < 0) {
                throw new IllegalArgumentException("maxNumberOfClients should be not negative");
                throw new IllegalArgumentException("maxNumberOfClients should be not negative");
            }
            }
@@ -797,6 +823,25 @@ public final class SoftApConfiguration implements Parcelable {
            return this;
            return this;
        }
        }


        /**
         * Specifies whether auto shutdown is enabled or not.
         * The Soft AP will shut down when there are no devices connected to it for
         * the timeout duration.
         *
         * <p>
         * <li>If not set, defaults to true</li>
         *
         * @param enable true to enable, false to disable.
         * @return Builder for chaining.
         *
         * @see #setShutdownTimeoutMillis(int)
         */
        @NonNull
        public Builder setAutoShutdownEnabled(boolean enable) {
            mAutoShutdownEnabled = enable;
            return this;
        }

        /**
        /**
         * Specifies the shutdown timeout in milliseconds.
         * Specifies the shutdown timeout in milliseconds.
         * The Soft AP will shut down when there are no devices connected to it for
         * The Soft AP will shut down when there are no devices connected to it for
@@ -807,14 +852,16 @@ public final class SoftApConfiguration implements Parcelable {
         *
         *
         * <p>
         * <p>
         * <li>If not set, defaults to 0</li>
         * <li>If not set, defaults to 0</li>
         * <li>The shut down timout will apply when
         * <li>The shut down timeout will apply when {@link #setAutoShutdownEnabled(boolean)} is
         * {@link Settings.Global.SOFT_AP_TIMEOUT_ENABLED} is true</li>
         * set to true</li>
         *
         *
         * @param timeoutMillis milliseconds of the timeout delay.
         * @param timeoutMillis milliseconds of the timeout delay.
         * @return Builder for chaining.
         * @return Builder for chaining.
         *
         * @see #setAutoShutdownEnabled(boolean)
         */
         */
        @NonNull
        @NonNull
        public Builder setShutdownTimeoutMillis(int timeoutMillis) {
        public Builder setShutdownTimeoutMillis(@IntRange(from = 0) int timeoutMillis) {
            if (timeoutMillis < 0) {
            if (timeoutMillis < 0) {
                throw new IllegalArgumentException("Invalid timeout value");
                throw new IllegalArgumentException("Invalid timeout value");
            }
            }
Loading