diff options
-rw-r--r-- | wifi/java/android/net/wifi/IWifiManager.aidl | 4 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 34 |
2 files changed, 38 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 65b437d36bd9..69e1029a4f51 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -125,6 +125,10 @@ interface IWifiManager void setWifiApEnabled(in WifiConfiguration wifiConfig, boolean enable); + boolean startSoftAp(in WifiConfiguration wifiConfig); + + boolean stopSoftAp(); + int getWifiApEnabledState(); WifiConfiguration getWifiApConfiguration(); diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index b79ecdd40d90..ae8a224e87be 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -16,6 +16,7 @@ package android.net.wifi; +import android.annotation.Nullable; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; @@ -1717,6 +1718,39 @@ public class WifiManager { } /** + * Start SoftAp mode with the specified configuration. + * Note that starting in access point mode disables station + * mode operation + * @param wifiConfig SSID, security and channel details as + * part of WifiConfiguration + * @return {@code true} if the operation succeeds, {@code false} otherwise + * + * @hide + */ + public boolean startSoftAp(@Nullable WifiConfiguration wifiConfig) { + try { + return mService.startSoftAp(wifiConfig); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Stop SoftAp mode. + * Note that stopping softap mode will restore the previous wifi mode. + * @return {@code true} if the operation succeeds, {@code false} otherwise + * + * @hide + */ + public boolean stopSoftAp() { + try { + return mService.stopSoftAp(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Gets the Wi-Fi enabled state. * @return One of {@link #WIFI_AP_STATE_DISABLED}, * {@link #WIFI_AP_STATE_DISABLING}, {@link #WIFI_AP_STATE_ENABLED}, |