WifiManager: add updateInterfaceIpState

Add a call to WifiManager that allows ConnectivityService to
provide interface mode change updates.  Mode variables are also
added in this CL.

A corresponding CL will be added to WifiServiceImpl.

Fixed two checkstyle errors on imports.

Bug: 31466854
Test: make
Change-Id: Iccccd2643515a09fadb29f7b7e82697aaf994189
This commit is contained in:
Rebecca Silberstein
2017-04-21 11:20:56 -07:00
parent 3a8ad81ab4
commit 2f409424cc
2 changed files with 52 additions and 2 deletions

View File

@@ -125,6 +125,8 @@ interface IWifiManager
void setWifiApEnabled(in WifiConfiguration wifiConfig, boolean enable);
void updateInterfaceIpState(String ifaceName, int mode);
boolean startSoftAp(in WifiConfiguration wifiConfig);
boolean stopSoftAp();

View File

@@ -20,7 +20,6 @@ import android.annotation.Nullable;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.pm.ParceledListSlice;
import android.net.ConnectivityManager;
@@ -46,9 +45,9 @@ import com.android.internal.util.Protocol;
import com.android.server.net.NetworkPinner;
import java.net.InetAddress;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.Collections;
/**
* This class provides the primary API for managing all aspects of Wi-Fi
@@ -446,6 +445,35 @@ public class WifiManager {
* @hide
*/
public static final int SAP_START_FAILURE_NO_CHANNEL = 1;
/**
* Interface IP mode for configuration error.
*
* @see updateInterfaceIpState(String, int)
*
* @hide
*/
public static final int IFACE_IP_MODE_CONFIGURATION_ERROR = 0;
/**
* Interface IP mode for tethering.
*
* @see updateInterfaceIpState(String, int)
*
* @hide
*/
public static final int IFACE_IP_MODE_TETHERED = 1;
/**
* Interface IP mode for Local Only Hotspot.
*
* @see updateInterfaceIpState(String, int)
*
* @hide
*/
public static final int IFACE_IP_MODE_LOCAL_ONLY = 2;
/**
* Broadcast intent action indicating that a connection to the supplicant has
* been established (and it is now possible
@@ -1717,6 +1745,26 @@ public class WifiManager {
}
}
/**
* Call allowing ConnectivityService to update WifiService with interface mode changes.
*
* The possible modes include: {@link IFACE_IP_MODE_TETHERED},
* {@link IFACE_IP_MODE_LOCAL_ONLY},
* {@link IFACE_IP_MODE_CONFIGURATION_ERROR}
*
* @param ifaceName String name of the updated interface
* @param mode int representing the new mode
*
* @hide
*/
public void updateInterfaceIpState(String ifaceName, int mode) {
try {
mService.updateInterfaceIpState(ifaceName, mode);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Start SoftAp mode with the specified configuration.
* Note that starting in access point mode disables station