Move Wifi/P2p service components under services
Some methods need to be public, since frameworks/base complies before frameworks/base/services; and services takes build dependency on base. Similar issue exists with WifiEnterpriseConfig constants. Bug: 9907308 Change-Id: Ied0e3dee0b25c939067dbc66867a9814b3b3b68e
This commit is contained in:
@@ -167,7 +167,7 @@ static JNINativeMethod gWifiMethods[] = {
|
||||
|
||||
int register_android_net_wifi_WifiNative(JNIEnv* env) {
|
||||
return AndroidRuntime::registerNativeMethods(env,
|
||||
"android/net/wifi/WifiNative", gWifiMethods, NELEM(gWifiMethods));
|
||||
"com/android/server/wifi/WifiNative", gWifiMethods, NELEM(gWifiMethods));
|
||||
}
|
||||
|
||||
}; // namespace android
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.AudioService;
|
||||
import android.net.wifi.p2p.WifiP2pService;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
@@ -73,6 +72,7 @@ import com.android.server.search.SearchManagerService;
|
||||
import com.android.server.usb.UsbService;
|
||||
import com.android.server.wallpaper.WallpaperManagerService;
|
||||
import com.android.server.wifi.WifiService;
|
||||
import com.android.server.wifi.p2p.WifiP2pService;
|
||||
import com.android.server.wm.WindowManagerService;
|
||||
|
||||
import dalvik.system.VMRuntime;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import static android.net.wifi.WifiConfiguration.INVALID_NETWORK_ID;
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import android.net.wifi.SupplicantState;
|
||||
import android.net.wifi.WifiSsid;
|
||||
|
||||
/**
|
||||
* Stores supplicant state change information passed from WifiMonitor to
|
||||
@@ -14,14 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import com.android.internal.util.State;
|
||||
import com.android.internal.util.StateMachine;
|
||||
|
||||
import android.net.wifi.StateChangeResult;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.wifi.SupplicantState;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Parcelable;
|
||||
@@ -14,9 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiConfiguration.KeyMgmt;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -24,13 +24,18 @@ import android.net.NetworkUtils;
|
||||
import android.net.NetworkInfo.DetailedState;
|
||||
import android.net.ProxyProperties;
|
||||
import android.net.RouteInfo;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiConfiguration.IpAssignment;
|
||||
import android.net.wifi.WifiConfiguration.KeyMgmt;
|
||||
import android.net.wifi.WifiConfiguration.ProxySettings;
|
||||
import android.net.wifi.WifiConfiguration.Status;
|
||||
import android.net.wifi.NetworkUpdateResult;
|
||||
import static android.net.wifi.WifiConfiguration.INVALID_NETWORK_ID;
|
||||
|
||||
import android.net.wifi.WifiEnterpriseConfig;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wifi.WifiSsid;
|
||||
import android.net.wifi.WpsInfo;
|
||||
import android.net.wifi.WpsResult;
|
||||
import android.os.Environment;
|
||||
import android.os.FileObserver;
|
||||
import android.os.Handler;
|
||||
@@ -113,7 +118,7 @@ import java.util.List;
|
||||
* - Maintain a list of configured networks for quick access
|
||||
*
|
||||
*/
|
||||
class WifiConfigStore {
|
||||
public class WifiConfigStore {
|
||||
|
||||
private Context mContext;
|
||||
private static final String TAG = "WifiConfigStore";
|
||||
@@ -167,50 +172,19 @@ class WifiConfigStore {
|
||||
*/
|
||||
public static final String OLD_PRIVATE_KEY_NAME = "private_key";
|
||||
|
||||
/**
|
||||
* String representing the keystore OpenSSL ENGINE's ID.
|
||||
*/
|
||||
public static final String ENGINE_ID_KEYSTORE = "keystore";
|
||||
|
||||
/**
|
||||
* String representing the keystore URI used for wpa_supplicant.
|
||||
*/
|
||||
public static final String KEYSTORE_URI = "keystore://";
|
||||
|
||||
/**
|
||||
* String to set the engine value to when it should be enabled.
|
||||
*/
|
||||
public static final String ENGINE_ENABLE = "1";
|
||||
|
||||
/**
|
||||
* String to set the engine value to when it should be disabled.
|
||||
*/
|
||||
public static final String ENGINE_DISABLE = "0";
|
||||
|
||||
public static final String CA_CERT_PREFIX = KEYSTORE_URI + Credentials.CA_CERTIFICATE;
|
||||
public static final String CLIENT_CERT_PREFIX = KEYSTORE_URI + Credentials.USER_CERTIFICATE;
|
||||
public static final String EAP_KEY = "eap";
|
||||
public static final String PHASE2_KEY = "phase2";
|
||||
public static final String IDENTITY_KEY = "identity";
|
||||
public static final String ANON_IDENTITY_KEY = "anonymous_identity";
|
||||
public static final String PASSWORD_KEY = "password";
|
||||
public static final String CLIENT_CERT_KEY = "client_cert";
|
||||
public static final String CA_CERT_KEY = "ca_cert";
|
||||
public static final String SUBJECT_MATCH_KEY = "subject_match";
|
||||
public static final String ENGINE_KEY = "engine";
|
||||
public static final String ENGINE_ID_KEY = "engine_id";
|
||||
public static final String PRIVATE_KEY_ID_KEY = "key_id";
|
||||
public static final String OPP_KEY_CACHING = "proactive_key_caching";
|
||||
|
||||
/** This represents an empty value of an enterprise field.
|
||||
* NULL is used at wpa_supplicant to indicate an empty value
|
||||
*/
|
||||
static final String EMPTY_VALUE = "NULL";
|
||||
|
||||
/** Internal use only */
|
||||
private static final String[] ENTERPRISE_CONFIG_SUPPLICANT_KEYS = new String[] { EAP_KEY,
|
||||
PHASE2_KEY, IDENTITY_KEY, ANON_IDENTITY_KEY, PASSWORD_KEY, CLIENT_CERT_KEY,
|
||||
CA_CERT_KEY, SUBJECT_MATCH_KEY, ENGINE_KEY, ENGINE_ID_KEY, PRIVATE_KEY_ID_KEY };
|
||||
private static final String[] ENTERPRISE_CONFIG_SUPPLICANT_KEYS = new String[] {
|
||||
WifiEnterpriseConfig.EAP_KEY, WifiEnterpriseConfig.PHASE2_KEY,
|
||||
WifiEnterpriseConfig.IDENTITY_KEY, WifiEnterpriseConfig.ANON_IDENTITY_KEY,
|
||||
WifiEnterpriseConfig.PASSWORD_KEY, WifiEnterpriseConfig.CLIENT_CERT_KEY,
|
||||
WifiEnterpriseConfig.CA_CERT_KEY, WifiEnterpriseConfig.SUBJECT_MATCH_KEY,
|
||||
WifiEnterpriseConfig.ENGINE_KEY, WifiEnterpriseConfig.ENGINE_ID_KEY,
|
||||
WifiEnterpriseConfig.PRIVATE_KEY_ID_KEY };
|
||||
|
||||
private final LocalLog mLocalLog;
|
||||
private final WpaConfigFileObserver mFileObserver;
|
||||
@@ -1663,7 +1637,7 @@ class WifiConfigStore {
|
||||
// initializeSoftwareKeystoreFlag(config.enterpriseConfig, mKeyStore);
|
||||
}
|
||||
|
||||
private String removeDoubleQuotes(String string) {
|
||||
private static String removeDoubleQuotes(String string) {
|
||||
int length = string.length();
|
||||
if ((length > 1) && (string.charAt(0) == '"')
|
||||
&& (string.charAt(length - 1) == '"')) {
|
||||
@@ -1672,11 +1646,11 @@ class WifiConfigStore {
|
||||
return string;
|
||||
}
|
||||
|
||||
private String convertToQuotedString(String string) {
|
||||
private static String convertToQuotedString(String string) {
|
||||
return "\"" + string + "\"";
|
||||
}
|
||||
|
||||
private String makeString(BitSet set, String[] strings) {
|
||||
private static String makeString(BitSet set, String[] strings) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
int nextSetBit = -1;
|
||||
|
||||
@@ -1782,8 +1756,8 @@ class WifiConfigStore {
|
||||
}
|
||||
}
|
||||
|
||||
// Certificate and privake key management for EnterpriseConfig
|
||||
boolean needsKeyStore(WifiEnterpriseConfig config) {
|
||||
// Certificate and private key management for EnterpriseConfig
|
||||
static boolean needsKeyStore(WifiEnterpriseConfig config) {
|
||||
// Has no keys to be installed
|
||||
if (config.getClientCertificate() == null && config.getCaCertificate() == null)
|
||||
return false;
|
||||
@@ -1798,7 +1772,7 @@ class WifiConfigStore {
|
||||
return KeyChain.isBoundKeyAlgorithm(certificate.getPublicKey().getAlgorithm());
|
||||
}
|
||||
|
||||
boolean needsSoftwareBackedKeyStore(WifiEnterpriseConfig config) {
|
||||
static boolean needsSoftwareBackedKeyStore(WifiEnterpriseConfig config) {
|
||||
String client = config.getClientCertificateAlias();
|
||||
if (!TextUtils.isEmpty(client)) {
|
||||
// a valid client certificate is configured
|
||||
@@ -1968,28 +1942,31 @@ class WifiConfigStore {
|
||||
}
|
||||
}
|
||||
|
||||
config.setFieldValue(ENGINE_KEY, ENGINE_ENABLE);
|
||||
config.setFieldValue(ENGINE_ID_KEY, ENGINE_ID_KEYSTORE);
|
||||
config.setFieldValue(WifiEnterpriseConfig.ENGINE_KEY, WifiEnterpriseConfig.ENGINE_ENABLE);
|
||||
config.setFieldValue(WifiEnterpriseConfig.ENGINE_ID_KEY,
|
||||
WifiEnterpriseConfig.ENGINE_ID_KEYSTORE);
|
||||
|
||||
/*
|
||||
* The old key started with the keystore:// URI prefix, but we don't
|
||||
* need that anymore. Trim it off if it exists.
|
||||
*/
|
||||
final String keyName;
|
||||
if (oldPrivateKey.startsWith(KEYSTORE_URI)) {
|
||||
keyName = new String(oldPrivateKey.substring(KEYSTORE_URI.length()));
|
||||
if (oldPrivateKey.startsWith(WifiEnterpriseConfig.KEYSTORE_URI)) {
|
||||
keyName = new String(
|
||||
oldPrivateKey.substring(WifiEnterpriseConfig.KEYSTORE_URI.length()));
|
||||
} else {
|
||||
keyName = oldPrivateKey;
|
||||
}
|
||||
config.setFieldValue(PRIVATE_KEY_ID_KEY, keyName);
|
||||
config.setFieldValue(WifiEnterpriseConfig.PRIVATE_KEY_ID_KEY, keyName);
|
||||
|
||||
mWifiNative.setNetworkVariable(netId, ENGINE_KEY, config.getFieldValue(ENGINE_KEY, ""));
|
||||
mWifiNative.setNetworkVariable(netId, WifiEnterpriseConfig.ENGINE_KEY,
|
||||
config.getFieldValue(WifiEnterpriseConfig.ENGINE_KEY, ""));
|
||||
|
||||
mWifiNative.setNetworkVariable(netId, ENGINE_ID_KEY,
|
||||
config.getFieldValue(ENGINE_ID_KEY, ""));
|
||||
mWifiNative.setNetworkVariable(netId, WifiEnterpriseConfig.ENGINE_ID_KEY,
|
||||
config.getFieldValue(WifiEnterpriseConfig.ENGINE_ID_KEY, ""));
|
||||
|
||||
mWifiNative.setNetworkVariable(netId, PRIVATE_KEY_ID_KEY,
|
||||
config.getFieldValue(PRIVATE_KEY_ID_KEY, ""));
|
||||
mWifiNative.setNetworkVariable(netId, WifiEnterpriseConfig.PRIVATE_KEY_ID_KEY,
|
||||
config.getFieldValue(WifiEnterpriseConfig.PRIVATE_KEY_ID_KEY, ""));
|
||||
|
||||
// Remove old private_key string so we don't run this again.
|
||||
mWifiNative.setNetworkVariable(netId, OLD_PRIVATE_KEY_NAME, EMPTY_VALUE);
|
||||
@@ -2019,4 +1996,6 @@ class WifiConfigStore {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.net.wifi.WifiManager;
|
||||
import static android.net.wifi.WifiManager.WIFI_MODE_FULL;
|
||||
import static android.net.wifi.WifiManager.WIFI_MODE_FULL_HIGH_PERF;
|
||||
import static android.net.wifi.WifiManager.WIFI_MODE_SCAN_ONLY;
|
||||
import android.net.wifi.WifiStateMachine;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
@@ -14,18 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.SupplicantState;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wifi.WifiSsid;
|
||||
import android.net.wifi.p2p.WifiP2pConfig;
|
||||
import android.net.wifi.p2p.WifiP2pDevice;
|
||||
import android.net.wifi.p2p.WifiP2pGroup;
|
||||
import android.net.wifi.p2p.WifiP2pProvDiscEvent;
|
||||
import android.net.wifi.p2p.WifiP2pService.P2pStatus;
|
||||
import android.net.wifi.p2p.nsd.WifiP2pServiceResponse;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.server.wifi.p2p.WifiP2pService.P2pStatus;
|
||||
|
||||
import com.android.internal.util.Protocol;
|
||||
import com.android.internal.util.StateMachine;
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import android.net.wifi.BatchedScanSettings;
|
||||
import android.net.wifi.WpsInfo;
|
||||
import android.net.wifi.p2p.WifiP2pConfig;
|
||||
import android.net.wifi.p2p.WifiP2pGroup;
|
||||
import android.text.TextUtils;
|
||||
@@ -28,7 +28,6 @@ import android.database.ContentObserver;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wifi.WifiStateMachine;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.UserHandle;
|
||||
|
||||
@@ -38,8 +38,6 @@ import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiConfiguration.ProxySettings;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wifi.WifiStateMachine;
|
||||
import android.net.wifi.WifiWatchdogStateMachine;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.Messenger;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import static android.net.wifi.WifiManager.WIFI_STATE_DISABLED;
|
||||
import static android.net.wifi.WifiManager.WIFI_STATE_DISABLING;
|
||||
@@ -52,9 +52,19 @@ import android.net.NetworkInfo;
|
||||
import android.net.NetworkInfo.DetailedState;
|
||||
import android.net.NetworkUtils;
|
||||
import android.net.RouteInfo;
|
||||
import android.net.wifi.BatchedScanResult;
|
||||
import android.net.wifi.BatchedScanSettings;
|
||||
import android.net.wifi.RssiPacketCountInfo;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.SupplicantState;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wifi.WifiSsid;
|
||||
import android.net.wifi.WpsInfo;
|
||||
import android.net.wifi.WpsResult;
|
||||
import android.net.wifi.WpsResult.Status;
|
||||
import android.net.wifi.p2p.WifiP2pManager;
|
||||
import android.net.wifi.p2p.WifiP2pService;
|
||||
import android.os.BatteryStats;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
@@ -80,6 +90,7 @@ import com.android.internal.util.State;
|
||||
import com.android.internal.util.StateMachine;
|
||||
|
||||
import com.android.server.net.BaseNetworkObserver;
|
||||
import com.android.server.wifi.p2p.WifiP2pService;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi;
|
||||
package com.android.server.wifi;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
@@ -26,6 +26,9 @@ import android.net.ConnectivityManager;
|
||||
import android.net.LinkProperties;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.RssiPacketCountInfo;
|
||||
import android.net.wifi.SupplicantState;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
@@ -94,8 +97,6 @@ public class WifiWatchdogStateMachine extends StateMachine {
|
||||
static final int POOR_LINK_DETECTED = BASE + 21;
|
||||
static final int GOOD_LINK_DETECTED = BASE + 22;
|
||||
|
||||
public static final boolean DEFAULT_POOR_NETWORK_AVOIDANCE_ENABLED = false;
|
||||
|
||||
/*
|
||||
* RSSI levels as used by notification icon
|
||||
* Level 4 -55 <= RSSI
|
||||
@@ -440,7 +441,7 @@ public class WifiWatchdogStateMachine extends StateMachine {
|
||||
} else {
|
||||
mPoorNetworkDetectionEnabled = getSettingsGlobalBoolean(mContentResolver,
|
||||
Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
|
||||
DEFAULT_POOR_NETWORK_AVOIDANCE_ENABLED);
|
||||
WifiManager.DEFAULT_POOR_NETWORK_AVOIDANCE_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.wifi.p2p;
|
||||
package com.android.server.wifi.p2p;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Notification;
|
||||
@@ -32,11 +32,18 @@ import android.net.InterfaceConfiguration;
|
||||
import android.net.LinkAddress;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.NetworkUtils;
|
||||
import android.net.wifi.WifiMonitor;
|
||||
import android.net.wifi.WifiNative;
|
||||
import android.net.wifi.WifiStateMachine;
|
||||
import android.net.wifi.WpsInfo;
|
||||
import android.net.wifi.p2p.IWifiP2pManager;
|
||||
import android.net.wifi.p2p.WifiP2pConfig;
|
||||
import android.net.wifi.p2p.WifiP2pDevice;
|
||||
import android.net.wifi.p2p.WifiP2pDeviceList;
|
||||
import android.net.wifi.p2p.WifiP2pGroup;
|
||||
import android.net.wifi.p2p.WifiP2pGroupList;
|
||||
import android.net.wifi.p2p.WifiP2pGroupList.GroupDeleteListener;
|
||||
import android.net.wifi.p2p.WifiP2pInfo;
|
||||
import android.net.wifi.p2p.WifiP2pManager;
|
||||
import android.net.wifi.p2p.WifiP2pProvDiscEvent;
|
||||
import android.net.wifi.p2p.WifiP2pWfdInfo;
|
||||
import android.net.wifi.p2p.nsd.WifiP2pServiceInfo;
|
||||
import android.net.wifi.p2p.nsd.WifiP2pServiceRequest;
|
||||
import android.net.wifi.p2p.nsd.WifiP2pServiceResponse;
|
||||
@@ -66,6 +73,9 @@ import com.android.internal.util.AsyncChannel;
|
||||
import com.android.internal.util.Protocol;
|
||||
import com.android.internal.util.State;
|
||||
import com.android.internal.util.StateMachine;
|
||||
import com.android.server.wifi.WifiMonitor;
|
||||
import com.android.server.wifi.WifiNative;
|
||||
import com.android.server.wifi.WifiStateMachine;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -194,7 +194,8 @@ public enum SupplicantState implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isConnecting(SupplicantState state) {
|
||||
/** @hide */
|
||||
public static boolean isConnecting(SupplicantState state) {
|
||||
switch(state) {
|
||||
case AUTHENTICATING:
|
||||
case ASSOCIATING:
|
||||
@@ -216,7 +217,8 @@ public enum SupplicantState implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isDriverActive(SupplicantState state) {
|
||||
/** @hide */
|
||||
public static boolean isDriverActive(SupplicantState state) {
|
||||
switch(state) {
|
||||
case DISCONNECTED:
|
||||
case DORMANT:
|
||||
|
||||
@@ -499,7 +499,7 @@ public class WifiConfiguration implements Parcelable {
|
||||
* @throws IllegalStateException if config is invalid for key id generation
|
||||
* @hide
|
||||
*/
|
||||
String getKeyIdForCredentials(WifiConfiguration current) {
|
||||
public String getKeyIdForCredentials(WifiConfiguration current) {
|
||||
String keyMgmt = null;
|
||||
|
||||
try {
|
||||
|
||||
@@ -33,12 +33,67 @@ import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Enterprise configuration details for Wi-Fi. Stores details about the EAP method
|
||||
* and any associated credentials.
|
||||
*/
|
||||
public class WifiEnterpriseConfig implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
public static final String EMPTY_VALUE = "NULL";
|
||||
/** @hide */
|
||||
public static final String EAP_KEY = "eap";
|
||||
/** @hide */
|
||||
public static final String PHASE2_KEY = "phase2";
|
||||
/** @hide */
|
||||
public static final String IDENTITY_KEY = "identity";
|
||||
/** @hide */
|
||||
public static final String ANON_IDENTITY_KEY = "anonymous_identity";
|
||||
/** @hide */
|
||||
public static final String PASSWORD_KEY = "password";
|
||||
/** @hide */
|
||||
public static final String SUBJECT_MATCH_KEY = "subject_match";
|
||||
/** @hide */
|
||||
public static final String OPP_KEY_CACHING = "proactive_key_caching";
|
||||
/**
|
||||
* String representing the keystore OpenSSL ENGINE's ID.
|
||||
* @hide
|
||||
*/
|
||||
public static final String ENGINE_ID_KEYSTORE = "keystore";
|
||||
|
||||
/**
|
||||
* String representing the keystore URI used for wpa_supplicant.
|
||||
* @hide
|
||||
*/
|
||||
public static final String KEYSTORE_URI = "keystore://";
|
||||
|
||||
/**
|
||||
* String to set the engine value to when it should be enabled.
|
||||
* @hide
|
||||
*/
|
||||
public static final String ENGINE_ENABLE = "1";
|
||||
|
||||
/**
|
||||
* String to set the engine value to when it should be disabled.
|
||||
* @hide
|
||||
*/
|
||||
public static final String ENGINE_DISABLE = "0";
|
||||
|
||||
/** @hide */
|
||||
public static final String CA_CERT_PREFIX = KEYSTORE_URI + Credentials.CA_CERTIFICATE;
|
||||
/** @hide */
|
||||
public static final String CLIENT_CERT_PREFIX = KEYSTORE_URI + Credentials.USER_CERTIFICATE;
|
||||
/** @hide */
|
||||
public static final String CLIENT_CERT_KEY = "client_cert";
|
||||
/** @hide */
|
||||
public static final String CA_CERT_KEY = "ca_cert";
|
||||
/** @hide */
|
||||
public static final String ENGINE_KEY = "engine";
|
||||
/** @hide */
|
||||
public static final String ENGINE_ID_KEY = "engine_id";
|
||||
/** @hide */
|
||||
public static final String PRIVATE_KEY_ID_KEY = "key_id";
|
||||
|
||||
private HashMap<String, String> mFields = new HashMap<String, String>();
|
||||
private X509Certificate mCaCert;
|
||||
private PrivateKey mClientPrivateKey;
|
||||
@@ -189,15 +244,17 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
public static final int GTC = 4;
|
||||
private static final String PREFIX = "auth=";
|
||||
/** @hide */
|
||||
public static final String[] strings = {WifiConfigStore.EMPTY_VALUE, "PAP", "MSCHAP",
|
||||
public static final String[] strings = {EMPTY_VALUE, "PAP", "MSCHAP",
|
||||
"MSCHAPV2", "GTC" };
|
||||
|
||||
/** Prevent initialization */
|
||||
private Phase2() {}
|
||||
}
|
||||
|
||||
/** Internal use only */
|
||||
HashMap<String, String> getFields() {
|
||||
/** Internal use only
|
||||
* @hide
|
||||
*/
|
||||
public HashMap<String, String> getFields() {
|
||||
return mFields;
|
||||
}
|
||||
|
||||
@@ -214,8 +271,8 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
case Eap.PWD:
|
||||
case Eap.TLS:
|
||||
case Eap.TTLS:
|
||||
mFields.put(WifiConfigStore.EAP_KEY, Eap.strings[eapMethod]);
|
||||
mFields.put(WifiConfigStore.OPP_KEY_CACHING, "1");
|
||||
mFields.put(EAP_KEY, Eap.strings[eapMethod]);
|
||||
mFields.put(OPP_KEY_CACHING, "1");
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown EAP method");
|
||||
@@ -227,7 +284,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @return eap method configured
|
||||
*/
|
||||
public int getEapMethod() {
|
||||
String eapMethod = mFields.get(WifiConfigStore.EAP_KEY);
|
||||
String eapMethod = mFields.get(EAP_KEY);
|
||||
return getStringIndex(Eap.strings, eapMethod, Eap.NONE);
|
||||
}
|
||||
|
||||
@@ -243,14 +300,14 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
public void setPhase2Method(int phase2Method) {
|
||||
switch (phase2Method) {
|
||||
case Phase2.NONE:
|
||||
mFields.put(WifiConfigStore.PHASE2_KEY, WifiConfigStore.EMPTY_VALUE);
|
||||
mFields.put(PHASE2_KEY, EMPTY_VALUE);
|
||||
break;
|
||||
/** Valid methods */
|
||||
case Phase2.PAP:
|
||||
case Phase2.MSCHAP:
|
||||
case Phase2.MSCHAPV2:
|
||||
case Phase2.GTC:
|
||||
mFields.put(WifiConfigStore.PHASE2_KEY, convertToQuotedString(
|
||||
mFields.put(PHASE2_KEY, convertToQuotedString(
|
||||
Phase2.PREFIX + Phase2.strings[phase2Method]));
|
||||
break;
|
||||
default:
|
||||
@@ -263,7 +320,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @return a phase 2 method defined at {@link Phase2}
|
||||
* */
|
||||
public int getPhase2Method() {
|
||||
String phase2Method = removeDoubleQuotes(mFields.get(WifiConfigStore.PHASE2_KEY));
|
||||
String phase2Method = removeDoubleQuotes(mFields.get(PHASE2_KEY));
|
||||
// Remove auth= prefix
|
||||
if (phase2Method.startsWith(Phase2.PREFIX)) {
|
||||
phase2Method = phase2Method.substring(Phase2.PREFIX.length());
|
||||
@@ -276,7 +333,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @param identity
|
||||
*/
|
||||
public void setIdentity(String identity) {
|
||||
setFieldValue(WifiConfigStore.IDENTITY_KEY, identity, "");
|
||||
setFieldValue(IDENTITY_KEY, identity, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,7 +341,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @return the identity
|
||||
*/
|
||||
public String getIdentity() {
|
||||
return getFieldValue(WifiConfigStore.IDENTITY_KEY, "");
|
||||
return getFieldValue(IDENTITY_KEY, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,14 +350,14 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @param anonymousIdentity the anonymous identity
|
||||
*/
|
||||
public void setAnonymousIdentity(String anonymousIdentity) {
|
||||
setFieldValue(WifiConfigStore.ANON_IDENTITY_KEY, anonymousIdentity, "");
|
||||
setFieldValue(ANON_IDENTITY_KEY, anonymousIdentity, "");
|
||||
}
|
||||
|
||||
/** Get the anonymous identity
|
||||
* @return anonymous identity
|
||||
*/
|
||||
public String getAnonymousIdentity() {
|
||||
return getFieldValue(WifiConfigStore.ANON_IDENTITY_KEY, "");
|
||||
return getFieldValue(ANON_IDENTITY_KEY, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,7 +365,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @param password the password
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
setFieldValue(WifiConfigStore.PASSWORD_KEY, password, "");
|
||||
setFieldValue(PASSWORD_KEY, password, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,7 +375,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* framework, returns "*".
|
||||
*/
|
||||
public String getPassword() {
|
||||
return getFieldValue(WifiConfigStore.PASSWORD_KEY, "");
|
||||
return getFieldValue(PASSWORD_KEY, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,7 +388,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public void setCaCertificateAlias(String alias) {
|
||||
setFieldValue(WifiConfigStore.CA_CERT_KEY, alias, WifiConfigStore.CA_CERT_PREFIX);
|
||||
setFieldValue(CA_CERT_KEY, alias, CA_CERT_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,7 +397,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public String getCaCertificateAlias() {
|
||||
return getFieldValue(WifiConfigStore.CA_CERT_KEY, WifiConfigStore.CA_CERT_PREFIX);
|
||||
return getFieldValue(CA_CERT_KEY, CA_CERT_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,8 +438,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
mCaCert = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Client certificate alias.
|
||||
/** Set Client certificate alias.
|
||||
*
|
||||
* <p> See the {@link android.security.KeyChain} for details on installing or choosing
|
||||
* a certificate
|
||||
@@ -391,16 +447,15 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public void setClientCertificateAlias(String alias) {
|
||||
setFieldValue(WifiConfigStore.CLIENT_CERT_KEY, alias, WifiConfigStore.CLIENT_CERT_PREFIX);
|
||||
setFieldValue(WifiConfigStore.PRIVATE_KEY_ID_KEY, alias, Credentials.USER_PRIVATE_KEY);
|
||||
setFieldValue(CLIENT_CERT_KEY, alias, CLIENT_CERT_PREFIX);
|
||||
setFieldValue(PRIVATE_KEY_ID_KEY, alias, Credentials.USER_PRIVATE_KEY);
|
||||
// Also, set engine parameters
|
||||
if (TextUtils.isEmpty(alias)) {
|
||||
mFields.put(WifiConfigStore.ENGINE_KEY, WifiConfigStore.ENGINE_DISABLE);
|
||||
mFields.put(WifiConfigStore.ENGINE_ID_KEY, WifiConfigStore.EMPTY_VALUE);
|
||||
mFields.put(ENGINE_KEY, ENGINE_DISABLE);
|
||||
mFields.put(ENGINE_ID_KEY, EMPTY_VALUE);
|
||||
} else {
|
||||
mFields.put(WifiConfigStore.ENGINE_KEY, WifiConfigStore.ENGINE_ENABLE);
|
||||
mFields.put(WifiConfigStore.ENGINE_ID_KEY,
|
||||
convertToQuotedString(WifiConfigStore.ENGINE_ID_KEYSTORE));
|
||||
mFields.put(ENGINE_KEY, ENGINE_ENABLE);
|
||||
mFields.put(ENGINE_ID_KEY, convertToQuotedString(ENGINE_ID_KEYSTORE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +465,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public String getClientCertificateAlias() {
|
||||
return getFieldValue(WifiConfigStore.CLIENT_CERT_KEY, WifiConfigStore.CLIENT_CERT_PREFIX);
|
||||
return getFieldValue(CLIENT_CERT_KEY, CLIENT_CERT_PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -472,7 +527,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @param subjectMatch substring to be matched
|
||||
*/
|
||||
public void setSubjectMatch(String subjectMatch) {
|
||||
setFieldValue(WifiConfigStore.SUBJECT_MATCH_KEY, subjectMatch, "");
|
||||
setFieldValue(SUBJECT_MATCH_KEY, subjectMatch, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,20 +535,20 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @return the subject match string
|
||||
*/
|
||||
public String getSubjectMatch() {
|
||||
return getFieldValue(WifiConfigStore.SUBJECT_MATCH_KEY, "");
|
||||
return getFieldValue(SUBJECT_MATCH_KEY, "");
|
||||
}
|
||||
|
||||
/** See {@link WifiConfiguration#getKeyIdForCredentials} @hide */
|
||||
String getKeyId(WifiEnterpriseConfig current) {
|
||||
String eap = mFields.get(WifiConfigStore.EAP_KEY);
|
||||
String phase2 = mFields.get(WifiConfigStore.PHASE2_KEY);
|
||||
String eap = mFields.get(EAP_KEY);
|
||||
String phase2 = mFields.get(PHASE2_KEY);
|
||||
|
||||
// If either eap or phase2 are not initialized, use current config details
|
||||
if (TextUtils.isEmpty((eap))) {
|
||||
eap = current.mFields.get(WifiConfigStore.EAP_KEY);
|
||||
eap = current.mFields.get(EAP_KEY);
|
||||
}
|
||||
if (TextUtils.isEmpty(phase2)) {
|
||||
phase2 = current.mFields.get(WifiConfigStore.PHASE2_KEY);
|
||||
phase2 = current.mFields.get(PHASE2_KEY);
|
||||
}
|
||||
return eap + "_" + phase2;
|
||||
}
|
||||
@@ -532,10 +587,10 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @return value
|
||||
* @hide
|
||||
*/
|
||||
String getFieldValue(String key, String prefix) {
|
||||
public String getFieldValue(String key, String prefix) {
|
||||
String value = mFields.get(key);
|
||||
// Uninitialized or known to be empty after reading from supplicant
|
||||
if (TextUtils.isEmpty(value) || WifiConfigStore.EMPTY_VALUE.equals(value)) return "";
|
||||
if (TextUtils.isEmpty(value) || EMPTY_VALUE.equals(value)) return "";
|
||||
|
||||
value = removeDoubleQuotes(value);
|
||||
if (value.startsWith(prefix)) {
|
||||
@@ -549,10 +604,11 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
* @param key into the hash
|
||||
* @param value to be set
|
||||
* @param prefix an optional value to be prefixed to actual value
|
||||
* @hide
|
||||
*/
|
||||
private void setFieldValue(String key, String value, String prefix) {
|
||||
public void setFieldValue(String key, String value, String prefix) {
|
||||
if (TextUtils.isEmpty(value)) {
|
||||
mFields.put(key, WifiConfigStore.EMPTY_VALUE);
|
||||
mFields.put(key, EMPTY_VALUE);
|
||||
} else {
|
||||
mFields.put(key, convertToQuotedString(prefix + value));
|
||||
}
|
||||
@@ -567,7 +623,7 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
*/
|
||||
public void setFieldValue(String key, String value) {
|
||||
if (TextUtils.isEmpty(value)) {
|
||||
mFields.put(key, WifiConfigStore.EMPTY_VALUE);
|
||||
mFields.put(key, EMPTY_VALUE);
|
||||
} else {
|
||||
mFields.put(key, convertToQuotedString(value));
|
||||
}
|
||||
|
||||
@@ -78,7 +78,8 @@ public class WifiInfo implements Parcelable {
|
||||
*/
|
||||
private boolean mMeteredHint;
|
||||
|
||||
WifiInfo() {
|
||||
/** @hide */
|
||||
public WifiInfo() {
|
||||
mWifiSsid = null;
|
||||
mBSSID = null;
|
||||
mNetworkId = -1;
|
||||
@@ -105,7 +106,8 @@ public class WifiInfo implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
void setSSID(WifiSsid wifiSsid) {
|
||||
/** @hide */
|
||||
public void setSSID(WifiSsid wifiSsid) {
|
||||
mWifiSsid = wifiSsid;
|
||||
}
|
||||
|
||||
@@ -133,7 +135,8 @@ public class WifiInfo implements Parcelable {
|
||||
return mWifiSsid;
|
||||
}
|
||||
|
||||
void setBSSID(String BSSID) {
|
||||
/** @hide */
|
||||
public void setBSSID(String BSSID) {
|
||||
mBSSID = BSSID;
|
||||
}
|
||||
|
||||
@@ -156,7 +159,8 @@ public class WifiInfo implements Parcelable {
|
||||
return mRssi;
|
||||
}
|
||||
|
||||
void setRssi(int rssi) {
|
||||
/** @hide */
|
||||
public void setRssi(int rssi) {
|
||||
mRssi = rssi;
|
||||
}
|
||||
|
||||
@@ -169,15 +173,17 @@ public class WifiInfo implements Parcelable {
|
||||
return mLinkSpeed;
|
||||
}
|
||||
|
||||
void setLinkSpeed(int linkSpeed) {
|
||||
/** @hide */
|
||||
public void setLinkSpeed(int linkSpeed) {
|
||||
this.mLinkSpeed = linkSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record the MAC address of the WLAN interface
|
||||
* @param macAddress the MAC address in {@code XX:XX:XX:XX:XX:XX} form
|
||||
* @hide
|
||||
*/
|
||||
void setMacAddress(String macAddress) {
|
||||
public void setMacAddress(String macAddress) {
|
||||
this.mMacAddress = macAddress;
|
||||
}
|
||||
|
||||
@@ -195,7 +201,8 @@ public class WifiInfo implements Parcelable {
|
||||
return mMeteredHint;
|
||||
}
|
||||
|
||||
void setNetworkId(int id) {
|
||||
/** @hide */
|
||||
public void setNetworkId(int id) {
|
||||
mNetworkId = id;
|
||||
}
|
||||
|
||||
@@ -218,11 +225,13 @@ public class WifiInfo implements Parcelable {
|
||||
return mSupplicantState;
|
||||
}
|
||||
|
||||
void setSupplicantState(SupplicantState state) {
|
||||
/** @hide */
|
||||
public void setSupplicantState(SupplicantState state) {
|
||||
mSupplicantState = state;
|
||||
}
|
||||
|
||||
void setInetAddress(InetAddress address) {
|
||||
/** @hide */
|
||||
public void setInetAddress(InetAddress address) {
|
||||
mIpAddress = address;
|
||||
}
|
||||
|
||||
|
||||
@@ -522,6 +522,9 @@ public class WifiManager {
|
||||
/** @hide */
|
||||
public static final int DATA_ACTIVITY_INOUT = 0x03;
|
||||
|
||||
/** @hide */
|
||||
public static final boolean DEFAULT_POOR_NETWORK_AVOIDANCE_ENABLED = false;
|
||||
|
||||
/* Maximum number of active locks we allow.
|
||||
* This limit was added to prevent apps from creating a ridiculous number
|
||||
* of locks and crashing the system by overflowing the global ref table.
|
||||
|
||||
@@ -60,7 +60,8 @@ public class WifiP2pConfig implements Parcelable {
|
||||
wps.setup = WpsInfo.PBC;
|
||||
}
|
||||
|
||||
void invalidate() {
|
||||
/** @hide */
|
||||
public void invalidate() {
|
||||
deviceAddress = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ public class WifiP2pDevice implements Parcelable {
|
||||
}
|
||||
|
||||
/** Updates details obtained from supplicant @hide */
|
||||
void updateSupplicantDetails(WifiP2pDevice device) {
|
||||
public void updateSupplicantDetails(WifiP2pDevice device) {
|
||||
if (device == null) {
|
||||
throw new IllegalArgumentException("device is null");
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class WifiP2pDeviceList implements Parcelable {
|
||||
}
|
||||
|
||||
/** Only updates details fetched from the supplicant @hide */
|
||||
void updateSupplicantDetails(WifiP2pDevice device) {
|
||||
public void updateSupplicantDetails(WifiP2pDevice device) {
|
||||
validateDevice(device);
|
||||
WifiP2pDevice d = mDevices.get(device.deviceAddress);
|
||||
if (d != null) {
|
||||
@@ -107,7 +107,7 @@ public class WifiP2pDeviceList implements Parcelable {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
void updateGroupCapability(String deviceAddress, int groupCapab) {
|
||||
public void updateGroupCapability(String deviceAddress, int groupCapab) {
|
||||
validateDeviceAddress(deviceAddress);
|
||||
WifiP2pDevice d = mDevices.get(deviceAddress);
|
||||
if (d != null) {
|
||||
@@ -116,7 +116,7 @@ public class WifiP2pDeviceList implements Parcelable {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
void updateStatus(String deviceAddress, int status) {
|
||||
public void updateStatus(String deviceAddress, int status) {
|
||||
validateDeviceAddress(deviceAddress);
|
||||
WifiP2pDevice d = mDevices.get(deviceAddress);
|
||||
if (d != null) {
|
||||
|
||||
@@ -42,11 +42,13 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
public void onDeleteGroup(int netId);
|
||||
}
|
||||
|
||||
WifiP2pGroupList() {
|
||||
/** @hide */
|
||||
public WifiP2pGroupList() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
WifiP2pGroupList(WifiP2pGroupList source, GroupDeleteListener listener) {
|
||||
/** @hide */
|
||||
public WifiP2pGroupList(WifiP2pGroupList source, GroupDeleteListener listener) {
|
||||
mListener = listener;
|
||||
mGroups = new LruCache<Integer, WifiP2pGroup>(CREDENTIAL_MAX_NUM) {
|
||||
@Override
|
||||
@@ -78,8 +80,9 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
* Add the specified group to this group list.
|
||||
*
|
||||
* @param group
|
||||
* @hide
|
||||
*/
|
||||
void add(WifiP2pGroup group) {
|
||||
public void add(WifiP2pGroup group) {
|
||||
mGroups.put(group.getNetworkId(), group);
|
||||
}
|
||||
|
||||
@@ -87,8 +90,9 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
* Remove the group with the specified network id from this group list.
|
||||
*
|
||||
* @param netId
|
||||
* @hide
|
||||
*/
|
||||
void remove(int netId) {
|
||||
public void remove(int netId) {
|
||||
mGroups.remove(netId);
|
||||
}
|
||||
|
||||
@@ -103,8 +107,9 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
|
||||
/**
|
||||
* Clear the group.
|
||||
* @hide
|
||||
*/
|
||||
boolean clear() {
|
||||
public boolean clear() {
|
||||
if (mGroups.size() == 0) return false;
|
||||
isClearCalled = true;
|
||||
mGroups.evictAll();
|
||||
@@ -120,8 +125,9 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
*
|
||||
* @param deviceAddress p2p device address.
|
||||
* @return the network id. if not found, return -1.
|
||||
* @hide
|
||||
*/
|
||||
int getNetworkId(String deviceAddress) {
|
||||
public int getNetworkId(String deviceAddress) {
|
||||
if (deviceAddress == null) return -1;
|
||||
|
||||
final Collection<WifiP2pGroup> groups = mGroups.snapshot().values();
|
||||
@@ -142,8 +148,9 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
* @param deviceAddress p2p device address.
|
||||
* @param ssid ssid.
|
||||
* @return the network id. if not found, return -1.
|
||||
* @hide
|
||||
*/
|
||||
int getNetworkId(String deviceAddress, String ssid) {
|
||||
public int getNetworkId(String deviceAddress, String ssid) {
|
||||
if (deviceAddress == null || ssid == null) {
|
||||
return -1;
|
||||
}
|
||||
@@ -166,8 +173,9 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
*
|
||||
* @param netId network id.
|
||||
* @return the address. if not found, return null.
|
||||
* @hide
|
||||
*/
|
||||
String getOwnerAddr(int netId) {
|
||||
public String getOwnerAddr(int netId) {
|
||||
WifiP2pGroup grp = mGroups.get(netId);
|
||||
if (grp != null) {
|
||||
return grp.getOwner().deviceAddress;
|
||||
@@ -182,8 +190,9 @@ public class WifiP2pGroupList implements Parcelable {
|
||||
*
|
||||
* @param netId network id.
|
||||
* @return true if the specified network id is present in this group list.
|
||||
* @hide
|
||||
*/
|
||||
boolean contains(int netId) {
|
||||
public boolean contains(int netId) {
|
||||
final Collection<WifiP2pGroup> groups = mGroups.snapshot().values();
|
||||
for (WifiP2pGroup grp: groups) {
|
||||
if (netId == grp.getNetworkId()) {
|
||||
|
||||
Reference in New Issue
Block a user