Merge "Correctly handle when the user has no explicit time_12_24 setting"
diff --git a/Android.mk b/Android.mk
index 53d4b3e..db5dd01 100644
--- a/Android.mk
+++ b/Android.mk
@@ -452,9 +452,9 @@
telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
wifi/java/android/net/wifi/IWifiManager.aidl \
- wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl \
- wifi/java/android/net/wifi/nan/IWifiNanManager.aidl \
- wifi/java/android/net/wifi/nan/IWifiNanDiscoverySessionCallback.aidl \
+ wifi/java/android/net/wifi/aware/IWifiAwareEventCallback.aidl \
+ wifi/java/android/net/wifi/aware/IWifiAwareManager.aidl \
+ wifi/java/android/net/wifi/aware/IWifiAwareDiscoverySessionCallback.aidl \
wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \
wifi/java/android/net/wifi/IWifiScanner.aidl \
wifi/java/android/net/wifi/IRttManager.aidl \
@@ -537,9 +537,9 @@
frameworks/base/media/java/android/media/tv/TvTrackInfo.aidl \
frameworks/base/media/java/android/media/browse/MediaBrowser.aidl \
frameworks/base/wifi/java/android/net/wifi/ScanSettings.aidl \
- frameworks/base/wifi/java/android/net/wifi/nan/ConfigRequest.aidl \
- frameworks/base/wifi/java/android/net/wifi/nan/PublishConfig.aidl \
- frameworks/base/wifi/java/android/net/wifi/nan/SubscribeConfig.aidl \
+ frameworks/base/wifi/java/android/net/wifi/aware/ConfigRequest.aidl \
+ frameworks/base/wifi/java/android/net/wifi/aware/PublishConfig.aidl \
+ frameworks/base/wifi/java/android/net/wifi/aware/SubscribeConfig.aidl \
frameworks/base/wifi/java/android/net/wifi/p2p/WifiP2pInfo.aidl \
frameworks/base/wifi/java/android/net/wifi/p2p/WifiP2pDeviceList.aidl \
frameworks/base/wifi/java/android/net/wifi/p2p/WifiP2pConfig.aidl \
diff --git a/api/current.txt b/api/current.txt
index 9cfbbc7..21fe3e2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -36363,6 +36363,7 @@
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
+ field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
field public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE = 256; // 0x100
field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
@@ -36864,8 +36865,12 @@
method public int describeContents();
method public boolean equals(java.lang.Object);
method public int getAsuLevel();
+ method public int getCqi();
method public int getDbm();
method public int getLevel();
+ method public int getRsrp();
+ method public int getRsrq();
+ method public int getRssnr();
method public int getTimingAdvance();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
@@ -37211,6 +37216,7 @@
public class TelephonyManager {
method public boolean canChangeDtmfToneLength();
+ method public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
method public android.telephony.TelephonyManager createForSubscriptionId(int);
method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState();
@@ -37233,6 +37239,7 @@
method public int getNetworkType();
method public int getPhoneCount();
method public int getPhoneType();
+ method public android.telephony.ServiceState getServiceState();
method public java.lang.String getSimCountryIso();
method public java.lang.String getSimOperator();
method public java.lang.String getSimOperatorName();
diff --git a/api/system-current.txt b/api/system-current.txt
index fab5e00..974db45 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -39267,6 +39267,7 @@
field public static final int CAPABILITY_MULTI_USER = 32; // 0x20
field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
+ field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
field public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE = 256; // 0x100
field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
@@ -39799,8 +39800,12 @@
method public int describeContents();
method public boolean equals(java.lang.Object);
method public int getAsuLevel();
+ method public int getCqi();
method public int getDbm();
method public int getLevel();
+ method public int getRsrp();
+ method public int getRsrq();
+ method public int getRssnr();
method public int getTimingAdvance();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
@@ -40150,6 +40155,7 @@
method public boolean canChangeDtmfToneLength();
method public int checkCarrierPrivilegesForPackage(java.lang.String);
method public int checkCarrierPrivilegesForPackageAnyPhone(java.lang.String);
+ method public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
method public android.telephony.TelephonyManager createForSubscriptionId(int);
method public void dial(java.lang.String);
method public boolean disableDataConnectivity();
@@ -40187,6 +40193,7 @@
method public int getNetworkType();
method public int getPhoneCount();
method public int getPhoneType();
+ method public android.telephony.ServiceState getServiceState();
method public java.lang.String getSimCountryIso();
method public java.lang.String getSimOperator();
method public java.lang.String getSimOperatorName();
diff --git a/api/test-current.txt b/api/test-current.txt
index 7a58e1e..29de7a5 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -36440,6 +36440,7 @@
field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
+ field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
field public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE = 256; // 0x100
field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
@@ -36941,8 +36942,12 @@
method public int describeContents();
method public boolean equals(java.lang.Object);
method public int getAsuLevel();
+ method public int getCqi();
method public int getDbm();
method public int getLevel();
+ method public int getRsrp();
+ method public int getRsrq();
+ method public int getRssnr();
method public int getTimingAdvance();
method public int hashCode();
method public void writeToParcel(android.os.Parcel, int);
@@ -37288,6 +37293,7 @@
public class TelephonyManager {
method public boolean canChangeDtmfToneLength();
+ method public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
method public android.telephony.TelephonyManager createForSubscriptionId(int);
method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState();
@@ -37310,6 +37316,7 @@
method public int getNetworkType();
method public int getPhoneCount();
method public int getPhoneType();
+ method public android.telephony.ServiceState getServiceState();
method public java.lang.String getSimCountryIso();
method public java.lang.String getSimOperator();
method public java.lang.String getSimOperatorName();
diff --git a/cmds/svc/src/com/android/commands/svc/WifiCommand.java b/cmds/svc/src/com/android/commands/svc/WifiCommand.java
index 94214ff..633dd97 100644
--- a/cmds/svc/src/com/android/commands/svc/WifiCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/WifiCommand.java
@@ -52,7 +52,7 @@
IWifiManager wifiMgr
= IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
try {
- wifiMgr.setWifiEnabled(flag);
+ wifiMgr.setWifiEnabled("com.android.shell", flag);
}
catch (RemoteException e) {
System.err.println("Wi-Fi operation failed: " + e);
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java
index c4673a3..744bd30 100644
--- a/core/java/android/app/ResourcesManager.java
+++ b/core/java/android/app/ResourcesManager.java
@@ -793,7 +793,8 @@
for (int i = mResourceImpls.size() - 1; i >= 0; i--) {
ResourcesKey key = mResourceImpls.keyAt(i);
- ResourcesImpl r = mResourceImpls.valueAt(i).get();
+ WeakReference<ResourcesImpl> weakImplRef = mResourceImpls.valueAt(i);
+ ResourcesImpl r = weakImplRef != null ? weakImplRef.get() : null;
if (r != null) {
if (DEBUG || DEBUG_CONFIGURATION) Slog.v(TAG, "Changing resources "
+ r + " config to: " + config);
@@ -854,8 +855,9 @@
final int implCount = mResourceImpls.size();
for (int i = 0; i < implCount; i++) {
- final ResourcesImpl impl = mResourceImpls.valueAt(i).get();
final ResourcesKey key = mResourceImpls.keyAt(i);
+ final WeakReference<ResourcesImpl> weakImplRef = mResourceImpls.valueAt(i);
+ final ResourcesImpl impl = weakImplRef != null ? weakImplRef.get() : null;
if (impl != null && key.mResDir.equals(assetPath)) {
if (!ArrayUtils.contains(key.mLibDirs, libAsset)) {
final int newLibAssetCount = 1 +
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 42ddf10..4c5fb13 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -84,8 +84,8 @@
import android.net.wifi.RttManager;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiScanner;
-import android.net.wifi.nan.IWifiNanManager;
-import android.net.wifi.nan.WifiNanManager;
+import android.net.wifi.aware.IWifiAwareManager;
+import android.net.wifi.aware.WifiAwareManager;
import android.net.wifi.p2p.IWifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager;
import android.nfc.NfcManager;
@@ -514,16 +514,16 @@
return new WifiP2pManager(service);
}});
- registerService(Context.WIFI_NAN_SERVICE, WifiNanManager.class,
- new CachedServiceFetcher<WifiNanManager>() {
+ registerService(Context.WIFI_AWARE_SERVICE, WifiAwareManager.class,
+ new CachedServiceFetcher<WifiAwareManager>() {
@Override
- public WifiNanManager createService(ContextImpl ctx) {
- IBinder b = ServiceManager.getService(Context.WIFI_NAN_SERVICE);
- IWifiNanManager service = IWifiNanManager.Stub.asInterface(b);
+ public WifiAwareManager createService(ContextImpl ctx) {
+ IBinder b = ServiceManager.getService(Context.WIFI_AWARE_SERVICE);
+ IWifiAwareManager service = IWifiAwareManager.Stub.asInterface(b);
if (service == null) {
return null;
}
- return new WifiNanManager(ctx.getOuterContext(), service);
+ return new WifiAwareManager(ctx.getOuterContext(), service);
}});
registerService(Context.WIFI_SCANNING_SERVICE, WifiScanner.class,
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 11c2735..4271e3f 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -601,10 +601,6 @@
*/
public BluetoothLeAdvertiser getBluetoothLeAdvertiser() {
if (!getLeAccess()) return null;
- if (!isMultipleAdvertisementSupported() && !isPeripheralModeSupported()) {
- Log.e(TAG, "Bluetooth LE advertising not supported");
- return null;
- }
synchronized(mLock) {
if (sBluetoothLeAdvertiser == null) {
sBluetoothLeAdvertiser = new BluetoothLeAdvertiser(mManagerService);
@@ -1354,24 +1350,6 @@
}
/**
- * Returns whether peripheral mode is supported.
- *
- * @hide
- */
- public boolean isPeripheralModeSupported() {
- if (getState() != STATE_ON) return false;
- try {
- mServiceLock.readLock().lock();
- if (mService != null) return mService.isPeripheralModeSupported();
- } catch (RemoteException e) {
- Log.e(TAG, "failed to get peripheral mode capability: ", e);
- } finally {
- mServiceLock.readLock().unlock();
- }
- return false;
- }
-
- /**
* Return true if offloaded filters are supported
*
* @return true if chipset supports on-chip filtering
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index 96a1ae8..7c5458b 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -100,7 +100,6 @@
boolean factoryReset();
boolean isMultiAdvertisementSupported();
- boolean isPeripheralModeSupported();
boolean isOffloadedFilteringSupported();
boolean isOffloadedScanBatchingSupported();
boolean isActivityAndEnergyReportingSupported();
diff --git a/core/java/android/bluetooth/OobData.java b/core/java/android/bluetooth/OobData.java
index f53ca94..9e87230 100644
--- a/core/java/android/bluetooth/OobData.java
+++ b/core/java/android/bluetooth/OobData.java
@@ -30,10 +30,24 @@
* @hide
*/
public class OobData implements Parcelable {
+ private byte[] leBluetoothDeviceAddress;
private byte[] securityManagerTk;
private byte[] leSecureConnectionsConfirmation;
private byte[] leSecureConnectionsRandom;
+ public byte[] getLeBluetoothDeviceAddress() {
+ return leBluetoothDeviceAddress;
+ }
+
+ /**
+ * Sets the LE Bluetooth Device Address value to be used during LE pairing.
+ * The value shall be 7 bytes. Please see Bluetooth CSSv6, Part A 1.16 for
+ * a detailed description.
+ */
+ public void setLeBluetoothDeviceAddress(byte[] leBluetoothDeviceAddress) {
+ this.leBluetoothDeviceAddress = leBluetoothDeviceAddress;
+ }
+
public byte[] getSecurityManagerTk() {
return securityManagerTk;
}
@@ -66,6 +80,7 @@
public OobData() { }
private OobData(Parcel in) {
+ leBluetoothDeviceAddress = in.createByteArray();
securityManagerTk = in.createByteArray();
leSecureConnectionsConfirmation = in.createByteArray();
leSecureConnectionsRandom = in.createByteArray();
@@ -77,6 +92,7 @@
@Override
public void writeToParcel(Parcel out, int flags) {
+ out.writeByteArray(leBluetoothDeviceAddress);
out.writeByteArray(securityManagerTk);
out.writeByteArray(leSecureConnectionsConfirmation);
out.writeByteArray(leSecureConnectionsRandom);
diff --git a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
index 26f2dea..5d27662 100644
--- a/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
+++ b/core/java/android/bluetooth/le/BluetoothLeAdvertiser.java
@@ -111,12 +111,6 @@
if (callback == null) {
throw new IllegalArgumentException("callback cannot be null");
}
- if (!mBluetoothAdapter.isMultipleAdvertisementSupported() &&
- !mBluetoothAdapter.isPeripheralModeSupported()) {
- postStartFailure(callback,
- AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED);
- return;
- }
boolean isConnectable = settings.isConnectable();
if (totalBytes(advertiseData, isConnectable) > MAX_ADVERTISING_DATA_BYTES ||
totalBytes(scanResponse, false) > MAX_ADVERTISING_DATA_BYTES) {
@@ -236,9 +230,9 @@
private final AdvertiseSettings mSettings;
private final IBluetoothGatt mBluetoothGatt;
- // mAdvertiserId 0: not registered
- // -1: advertise stopped or registration timeout
- // >0: registered and advertising started
+ // mAdvertiserId -1: not registered
+ // -2: advertise stopped or registration timeout
+ // >=0: registered and advertising started
private int mAdvertiserId;
private boolean mIsAdvertising = false;
@@ -251,12 +245,12 @@
mScanResponse = scanResponse;
mSettings = settings;
mBluetoothGatt = bluetoothGatt;
- mAdvertiserId = 0;
+ mAdvertiserId = -1;
}
public void startRegisteration() {
synchronized (this) {
- if (mAdvertiserId == -1) return;
+ if (mAdvertiserId == -2) return;
try {
mBluetoothGatt.registerAdvertiser(this);
@@ -264,13 +258,13 @@
} catch (InterruptedException | RemoteException e) {
Log.e(TAG, "Failed to start registeration", e);
}
- if (mAdvertiserId > 0 && mIsAdvertising) {
+ if (mAdvertiserId >= 0 && mIsAdvertising) {
mLeAdvertisers.put(mAdvertiseCallback, this);
- } else if (mAdvertiserId <= 0) {
+ } else if (mAdvertiserId < 0) {
// Registration timeout, reset mClientIf to -1 so no subsequent operations can
// proceed.
- if (mAdvertiserId == 0) mAdvertiserId = -1;
+ if (mAdvertiserId == 0) mAdvertiserId = -2;
// Post internal error if registration failed.
postStartFailure(mAdvertiseCallback,
AdvertiseCallback.ADVERTISE_FAILED_INTERNAL_ERROR);
@@ -278,7 +272,7 @@
// Unregister application if it's already registered but advertise failed.
try {
mBluetoothGatt.unregisterAdvertiser(mAdvertiserId);
- mAdvertiserId = -1;
+ mAdvertiserId = -2;
} catch (RemoteException e) {
Log.e(TAG, "remote exception when unregistering", e);
}
@@ -312,7 +306,7 @@
synchronized (this) {
if (status == BluetoothGatt.GATT_SUCCESS) {
try {
- if (mAdvertiserId == -1) {
+ if (mAdvertiserId == -2) {
// Registration succeeds after timeout, unregister advertiser.
mBluetoothGatt.unregisterAdvertiser(advertiserId);
} else {
@@ -326,7 +320,7 @@
}
}
// Registration failed.
- mAdvertiserId = -1;
+ mAdvertiserId = -2;
notifyAll();
}
}
@@ -348,7 +342,7 @@
// unregister advertiser for stop.
try {
mBluetoothGatt.unregisterAdvertiser(mAdvertiserId);
- mAdvertiserId = -1;
+ mAdvertiserId = -2;
mIsAdvertising = false;
mLeAdvertisers.remove(mAdvertiseCallback);
} catch (RemoteException e) {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index fee927c..b79c72e 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2664,7 +2664,7 @@
NETWORK_STATS_SERVICE,
//@hide: NETWORK_POLICY_SERVICE,
WIFI_SERVICE,
- WIFI_NAN_SERVICE,
+ WIFI_AWARE_SERVICE,
WIFI_P2P_SERVICE,
WIFI_SCANNING_SERVICE,
//@hide: WIFI_RTT_SERVICE,
@@ -3134,14 +3134,14 @@
/**
* Use with {@link #getSystemService} to retrieve a
- * {@link android.net.wifi.nan.WifiNanManager} for handling management of
- * Wi-Fi NAN.
+ * {@link android.net.wifi.aware.WifiAwareManager} for handling management of
+ * Wi-Fi Aware.
*
* @see #getSystemService
- * @see android.net.wifi.nan.WifiNanManager
- * @hide PROPOSED_NAN_API
+ * @see android.net.wifi.aware.WifiAwareManager
+ * @hide PROPOSED_AWARE_API
*/
- public static final String WIFI_NAN_SERVICE = "wifinan";
+ public static final String WIFI_AWARE_SERVICE = "wifiaware";
/**
* Use with {@link #getSystemService} to retrieve a {@link
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 089a420..8122940 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2028,12 +2028,12 @@
/**
* Feature for {@link #getSystemAvailableFeatures} and
- * {@link #hasSystemFeature}: The device supports Wi-Fi NAN.
+ * {@link #hasSystemFeature}: The device supports Wi-Fi Aware.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
@SdkConstant(SdkConstantType.FEATURE)
- public static final String FEATURE_WIFI_NAN = "android.hardware.wifi.nan";
+ public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
/**
* Feature for {@link #getSystemAvailableFeatures} and
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index ebb9601..cbb6dfe 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -406,14 +406,14 @@
public static final int TRANSPORT_VPN = 4;
/**
- * Indicates this network uses a Wi-Fi NAN transport.
+ * Indicates this network uses a Wi-Fi Aware transport.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
- public static final int TRANSPORT_WIFI_NAN = 5;
+ public static final int TRANSPORT_WIFI_AWARE = 5;
private static final int MIN_TRANSPORT = TRANSPORT_CELLULAR;
- private static final int MAX_TRANSPORT = TRANSPORT_WIFI_NAN;
+ private static final int MAX_TRANSPORT = TRANSPORT_WIFI_AWARE;
/**
* Adds the given transport type to this {@code NetworkCapability} instance.
@@ -869,7 +869,7 @@
case TRANSPORT_BLUETOOTH: transports += "BLUETOOTH"; break;
case TRANSPORT_ETHERNET: transports += "ETHERNET"; break;
case TRANSPORT_VPN: transports += "VPN"; break;
- case TRANSPORT_WIFI_NAN: transports += "WIFI_NAN"; break;
+ case TRANSPORT_WIFI_AWARE: transports += "WIFI_AWARE"; break;
}
if (++i < types.length) transports += "|";
}
diff --git a/core/java/android/os/HwBinder.java b/core/java/android/os/HwBinder.java
index 0e7da63..481b2dc 100644
--- a/core/java/android/os/HwBinder.java
+++ b/core/java/android/os/HwBinder.java
@@ -16,6 +16,7 @@
package android.os;
+import java.util.ArrayList;
import libcore.util.NativeAllocationRegistry;
/** @hide */
@@ -39,10 +40,12 @@
int code, HwParcel request, HwParcel reply, int flags);
public native final void registerService(
- String serviceName, int versionMajor, int versionMinor);
+ ArrayList<String> interfaceChain,
+ String serviceName);
public static native final IHwBinder getService(
- String serviceName, int versionMajor, int versionMinor);
+ String iface,
+ String serviceName);
// Returns address of the "freeFunction".
private static native final long native_init();
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index bb55610..143cc2e 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -250,6 +250,7 @@
libicuuc \
libicui18n \
libmedia \
+ libaudioclient \
libjpeg \
libusbhost \
libharfbuzz_ng \
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
index 1a33d91..10090a1 100644
--- a/core/jni/android_os_HwBinder.cpp
+++ b/core/jni/android_os_HwBinder.cpp
@@ -34,6 +34,8 @@
#include "core_jni_helpers.h"
using android::AndroidRuntime;
+using android::hardware::hidl_vec;
+using android::hardware::hidl_string;
#define PACKAGE_PATH "android/os"
#define CLASS_NAME "HwBinder"
@@ -41,10 +43,15 @@
namespace android {
+static jclass gArrayListClass;
+static struct {
+ jmethodID size;
+ jmethodID get;
+} gArrayListMethods;
+
static struct fields_t {
jfieldID contextID;
jmethodID onTransactID;
-
} gFields;
// static
@@ -199,45 +206,46 @@
static void JHwBinder_native_registerService(
JNIEnv *env,
jobject thiz,
- jstring serviceNameObj,
- jint versionMajor,
- jint versionMinor) {
+ jobject interfaceChainArrayList,
+ jstring serviceNameObj) {
if (serviceNameObj == NULL) {
jniThrowException(env, "java/lang/NullPointerException", NULL);
return;
}
- if (versionMajor < 0
- || versionMajor > 65535
- || versionMinor < 0
- || versionMinor > 65535) {
- jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
- return;
- }
-
- const jchar *serviceName = env->GetStringCritical(serviceNameObj, NULL);
-
+ const char *serviceName = env->GetStringUTFChars(serviceNameObj, NULL);
if (serviceName == NULL) {
return; // XXX exception already pending?
}
- using android::hidl::manager::V1_0::IServiceManager;
+ jint numInterfaces = env->CallIntMethod(interfaceChainArrayList,
+ gArrayListMethods.size);
+ hidl_string *strings = new hidl_string[numInterfaces];
- const IServiceManager::Version kVersion {
- .major = static_cast<uint16_t>(versionMajor),
- .minor = static_cast<uint16_t>(versionMinor),
- };
+ for (jint i = 0; i < numInterfaces; i++) {
+ jstring strObj = static_cast<jstring>(
+ env->CallObjectMethod(interfaceChainArrayList,
+ gArrayListMethods.get,
+ i)
+ );
+ const char * str = env->GetStringUTFChars(strObj, nullptr);
+ strings[i] = hidl_string(str);
+ env->ReleaseStringUTFChars(strObj, str);
+ }
+
+ hidl_vec<hidl_string> interfaceChain;
+ interfaceChain.setToExternal(strings, numInterfaces, true /* shouldOwn */);
+
+ using android::hidl::manager::V1_0::IServiceManager;
sp<hardware::IBinder> binder = JHwBinder::GetNativeContext(env, thiz);
bool ok = hardware::defaultServiceManager()->add(
- String8(String16(
- reinterpret_cast<const char16_t *>(serviceName),
- env->GetStringLength(serviceNameObj))).string(),
- binder,
- kVersion);
+ interfaceChain,
+ serviceName,
+ binder);
- env->ReleaseStringCritical(serviceNameObj, serviceName);
+ env->ReleaseStringUTFChars(serviceNameObj, serviceName);
serviceName = NULL;
if (ok) {
@@ -251,52 +259,43 @@
static jobject JHwBinder_native_getService(
JNIEnv *env,
jclass /* clazzObj */,
- jstring serviceNameObj,
- jint versionMajor,
- jint versionMinor) {
+ jstring ifaceNameObj,
+ jstring serviceNameObj) {
+
+ if (ifaceNameObj == NULL) {
+ jniThrowException(env, "java/lang/NullPointerException", NULL);
+ return NULL;
+ }
if (serviceNameObj == NULL) {
jniThrowException(env, "java/lang/NullPointerException", NULL);
return NULL;
}
- if (versionMajor < 0
- || versionMajor > 65535
- || versionMinor < 0
- || versionMinor > 65535) {
- jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
- return NULL;
+ const char *ifaceName = env->GetStringUTFChars(ifaceNameObj, NULL);
+ if (ifaceName == NULL) {
+ return NULL; // XXX exception already pending?
}
-
- const jchar *serviceName = env->GetStringCritical(serviceNameObj, NULL);
-
+ const char *serviceName = env->GetStringUTFChars(serviceNameObj, NULL);
if (serviceName == NULL) {
- return NULL; // XXX exception already pending?
+ env->ReleaseStringUTFChars(ifaceNameObj, ifaceName);
+ return NULL; // XXX exception already pending?
}
- using android::hidl::manager::V1_0::IServiceManager;
-
- const IServiceManager::Version kVersion {
- .major = static_cast<uint16_t>(versionMajor),
- .minor = static_cast<uint16_t>(versionMinor),
- };
-
LOG(INFO) << "looking for service '"
- << String8(String16(
- reinterpret_cast<const char16_t *>(serviceName),
- env->GetStringLength(serviceNameObj))).string()
+ << serviceName
<< "'";
sp<hardware::IBinder> service;
hardware::defaultServiceManager()->get(
- String8(String16(
- reinterpret_cast<const char16_t *>(serviceName),
- env->GetStringLength(serviceNameObj))).string(),
- kVersion,
+ ifaceName,
+ serviceName,
[&service](sp<hardware::IBinder> out) {
service = out;
});
- env->ReleaseStringCritical(serviceNameObj, serviceName);
+ env->ReleaseStringUTFChars(ifaceNameObj, ifaceName);
+ ifaceName = NULL;
+ env->ReleaseStringUTFChars(serviceNameObj, serviceName);
serviceName = NULL;
if (service == NULL) {
@@ -318,16 +317,21 @@
"(IL" PACKAGE_PATH "/HwParcel;L" PACKAGE_PATH "/HwParcel;I)V",
(void *)JHwBinder_native_transact },
- { "registerService", "(Ljava/lang/String;II)V",
+ { "registerService", "(Ljava/util/ArrayList;Ljava/lang/String;)V",
(void *)JHwBinder_native_registerService },
- { "getService", "(Ljava/lang/String;II)L" PACKAGE_PATH "/IHwBinder;",
+ { "getService", "(Ljava/lang/String;Ljava/lang/String;)L" PACKAGE_PATH "/IHwBinder;",
(void *)JHwBinder_native_getService },
};
namespace android {
int register_android_os_HwBinder(JNIEnv *env) {
+ jclass arrayListClass = FindClassOrDie(env, "java/util/ArrayList");
+ gArrayListClass = MakeGlobalRefOrDie(env, arrayListClass);
+ gArrayListMethods.size = GetMethodIDOrDie(env, arrayListClass, "size", "()I");
+ gArrayListMethods.get = GetMethodIDOrDie(env, arrayListClass, "get", "(I)Ljava/lang/Object;");
+
return RegisterMethodsOrDie(env, CLASS_PATH, gMethods, NELEM(gMethods));
}
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
index 7387b29..1a67cee 100644
--- a/core/jni/android_os_HwParcel.cpp
+++ b/core/jni/android_os_HwParcel.cpp
@@ -267,17 +267,17 @@
const jchar *interfaceName = env->GetStringCritical(interfaceNameObj, NULL);
if (interfaceName) {
- hardware::Parcel *parcel =
- JHwParcel::GetNativeContext(env, thiz)->getParcel();
-
- status_t err = parcel->writeInterfaceToken(
- String16(
- reinterpret_cast<const char16_t *>(interfaceName),
- env->GetStringLength(interfaceNameObj)));
+ String8 nameCopy = String8(String16(
+ reinterpret_cast<const char16_t *>(interfaceName),
+ env->GetStringLength(interfaceNameObj)));
env->ReleaseStringCritical(interfaceNameObj, interfaceName);
interfaceName = NULL;
+ hardware::Parcel *parcel =
+ JHwParcel::GetNativeContext(env, thiz)->getParcel();
+
+ status_t err = parcel->writeInterfaceToken(nameCopy.string());
signalExceptionForError(env, err);
}
}
@@ -294,17 +294,18 @@
const jchar *interfaceName = env->GetStringCritical(interfaceNameObj, NULL);
if (interfaceName) {
- hardware::Parcel *parcel =
- JHwParcel::GetNativeContext(env, thiz)->getParcel();
-
- bool valid = parcel->enforceInterface(
- String16(
- reinterpret_cast<const char16_t *>(interfaceName),
- env->GetStringLength(interfaceNameObj)));
+ String8 interfaceNameCopy = String8(String16(
+ reinterpret_cast<const char16_t *>(interfaceName),
+ env->GetStringLength(interfaceNameObj)));
env->ReleaseStringCritical(interfaceNameObj, interfaceName);
interfaceName = NULL;
+ hardware::Parcel *parcel =
+ JHwParcel::GetNativeContext(env, thiz)->getParcel();
+
+ bool valid = parcel->enforceInterface(interfaceNameCopy.string());
+
if (!valid) {
jniThrowException(
env,
@@ -424,8 +425,8 @@
status_t err = parcel->writeBuffer(s, sizeof(*s), &parentHandle);
if (err == OK) {
- err = s->writeEmbeddedToParcel(
- parcel, parentHandle, 0 /* parentOffset */);
+ err = ::android::hardware::writeEmbeddedToParcel(
+ *s, parcel, parentHandle, 0 /* parentOffset */);
}
signalExceptionForError(env, err);
@@ -452,7 +453,8 @@
if (err == OK) { \
size_t childHandle; \
\
- err = vec->writeEmbeddedToParcel( \
+ err = ::android::hardware::writeEmbeddedToParcel( \
+ *vec, \
parcel, \
parentHandle, \
0 /* parentOffset */, \
@@ -507,7 +509,8 @@
if (err == OK) {
size_t childHandle;
- err = vec->writeEmbeddedToParcel(
+ err = ::android::hardware::writeEmbeddedToParcel(
+ *vec,
parcel,
parentHandle,
0 /* parentOffset */,
@@ -567,7 +570,8 @@
return NULL;
}
- status_t err = const_cast<hidl_string *>(s)->readEmbeddedFromParcel(
+ status_t err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<hidl_string *>(s),
*parcel, parentHandle, 0 /* parentOffset */);
if (err != OK) {
@@ -596,8 +600,8 @@
\
size_t childHandle; \
\
- status_t err = const_cast<hidl_vec<Type> *>(vec) \
- ->readEmbeddedFromParcel( \
+ status_t err = ::android::hardware::readEmbeddedFromParcel( \
+ const_cast<hidl_vec<Type> *>(vec), \
*parcel, \
parentHandle, \
0 /* parentOffset */, \
@@ -638,8 +642,8 @@
size_t childHandle;
- status_t err = const_cast<hidl_vec<bool> *>(vec)
- ->readEmbeddedFromParcel(
+ status_t err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<hidl_vec<bool> *>(vec),
*parcel,
parentHandle,
0 /* parentOffset */,
@@ -700,12 +704,13 @@
}
size_t childHandle;
- status_t err = const_cast<string_vec *>(vec)->readEmbeddedFromParcel(
+ status_t err = ::android::hardware::readEmbeddedFromParcel(
+ const_cast<string_vec *>(vec),
*parcel, parentHandle, 0 /* parentOffset */, &childHandle);
for (size_t i = 0; (err == OK) && (i < vec->size()); ++i) {
- err = const_cast<hidl_vec<hidl_string> *>(vec)
- ->readEmbeddedFromParcel(
+ err = android::hardware::readEmbeddedFromParcel(
+ const_cast<hidl_vec<hidl_string> *>(vec),
*parcel,
childHandle,
i * sizeof(hidl_string),
@@ -759,14 +764,16 @@
if (err == OK) {
size_t childHandle;
- err = vec->writeEmbeddedToParcel(
+ err = ::android::hardware::writeEmbeddedToParcel(
+ *vec,
parcel,
parentHandle,
0 /* parentOffset */,
&childHandle);
for (size_t i = 0; (err == OK) && (i < vec->size()); ++i) {
- err = (*vec)[i].writeEmbeddedToParcel(
+ err = ::android::hardware::writeEmbeddedToParcel(
+ (*vec)[i],
parcel,
childHandle,
i * sizeof(hidl_string));
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 5202a98..ca09708 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -297,12 +297,6 @@
bool force_mount_namespace) {
// See storage config details at http://source.android.com/tech/storage/
- // Create a second private mount namespace for our process
- if (unshare(CLONE_NEWNS) == -1) {
- ALOGW("Failed to unshare(): %s", strerror(errno));
- return false;
- }
-
String8 storageSource;
if (mount_mode == MOUNT_EXTERNAL_DEFAULT) {
storageSource = "/mnt/runtime/default";
@@ -310,10 +304,17 @@
storageSource = "/mnt/runtime/read";
} else if (mount_mode == MOUNT_EXTERNAL_WRITE) {
storageSource = "/mnt/runtime/write";
- } else {
+ } else if (!force_mount_namespace) {
// Sane default of no storage visible
return true;
}
+
+ // Create a second private mount namespace for our process
+ if (unshare(CLONE_NEWNS) == -1) {
+ ALOGW("Failed to unshare(): %s", strerror(errno));
+ return false;
+ }
+
if (TEMP_FAILURE_RETRY(mount(storageSource.string(), "/storage",
NULL, MS_BIND | MS_REC | MS_SLAVE, NULL)) == -1) {
ALOGW("Failed to mount %s to /storage: %s", storageSource.string(), strerror(errno));
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index c816502..33ba886 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -291,7 +291,7 @@
<protected-broadcast android:name="android.net.wifi.WIFI_AP_STATE_CHANGED" />
<protected-broadcast android:name="android.net.wifi.WIFI_CREDENTIAL_CHANGED" />
<protected-broadcast android:name="android.net.wifi.WIFI_SCAN_AVAILABLE" />
- <protected-broadcast android:name="android.net.wifi.nan.action.WIFI_NAN_STATE_CHANGED" />
+ <protected-broadcast android:name="android.net.wifi.aware.action.WIFI_AWARE_STATE_CHANGED" />
<protected-broadcast android:name="android.net.wifi.SCAN_RESULTS" />
<protected-broadcast android:name="android.net.wifi.RSSI_CHANGED" />
<protected-broadcast android:name="android.net.wifi.STATE_CHANGE" />
@@ -299,7 +299,6 @@
<protected-broadcast android:name="android.net.wifi.CONFIGURED_NETWORKS_CHANGE" />
<protected-broadcast android:name="android.net.wifi.supplicant.CONNECTION_CHANGE" />
<protected-broadcast android:name="android.net.wifi.supplicant.STATE_CHANGE" />
- <protected-broadcast android:name="android.net.wifi.nan.STATE_CHANGED" />
<protected-broadcast android:name="android.net.wifi.p2p.STATE_CHANGED" />
<protected-broadcast android:name="android.net.wifi.p2p.DISCOVERY_STATE_CHANGE" />
<protected-broadcast android:name="android.net.wifi.p2p.THIS_DEVICE_CHANGED" />
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index a8be8d3..7116007 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2165,6 +2165,9 @@
provisioning, availability etc -->
<bool name="config_carrier_wfc_ims_available">false</bool>
+ <!-- Whether to use voip audio mode for ims call -->
+ <bool name="config_use_voip_mode_for_ims">false</bool>
+
<bool name="config_networkSamplingWakesDevice">true</bool>
<string-array translatable="false" name="config_cdma_home_system" />
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 6f2822b..e376801 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2195,6 +2195,7 @@
<java-symbol type="bool" name="config_carrier_vt_available" />
<java-symbol type="bool" name="config_device_wfc_ims_available" />
<java-symbol type="bool" name="config_carrier_wfc_ims_available" />
+ <java-symbol type="bool" name="config_use_voip_mode_for_ims" />
<java-symbol type="attr" name="touchscreenBlocksFocus" />
<java-symbol type="layout" name="resolver_list_with_default" />
<java-symbol type="string" name="whichApplicationNamed" />
diff --git a/libs/androidfw/Android.mk b/libs/androidfw/Android.mk
index 6bbfcd2..76d521d 100644
--- a/libs/androidfw/Android.mk
+++ b/libs/androidfw/Android.mk
@@ -49,6 +49,8 @@
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
LOCAL_SRC_FILES:= $(hostSources)
LOCAL_C_INCLUDES := external/zlib
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -71,6 +73,8 @@
libutils \
libz
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
include $(BUILD_SHARED_LIBRARY)
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 10a0a23..fd30c25 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -3539,7 +3539,7 @@
}
if (pi != NULL) {
if (kDebugTableTheme) {
- ALOGI("Desired type index is %zd in avail %zu", t, Res_MAXTYPE + 1);
+ ALOGI("Desired type index is %u in avail %zu", t, Res_MAXTYPE + 1);
}
if (t <= Res_MAXTYPE) {
const type_info& ti = pi->types[t];
diff --git a/include/androidfw/Asset.h b/libs/androidfw/include/androidfw/Asset.h
similarity index 98%
rename from include/androidfw/Asset.h
rename to libs/androidfw/include/androidfw/Asset.h
index ee77e97..36efbe5 100644
--- a/include/androidfw/Asset.h
+++ b/libs/androidfw/include/androidfw/Asset.h
@@ -48,7 +48,7 @@
static int32_t getGlobalCount();
static String8 getAssetAllocations();
-
+
/* used when opening an asset */
typedef enum AccessMode {
ACCESS_UNKNOWN = 0,
@@ -197,7 +197,7 @@
AccessMode mAccessMode; // how the asset was opened
String8 mAssetSource; // debug string
-
+
Asset* mNext; // linked list.
Asset* mPrev;
};
@@ -260,7 +260,7 @@
FileMap* mMap; // for memory map
unsigned char* mBuf; // for read
-
+
const void* ensureAlignment(FileMap* map);
};
@@ -297,7 +297,7 @@
virtual const void* getBuffer(bool wordAligned);
virtual off64_t getLength(void) const { return mUncompressedLen; }
virtual off64_t getRemainingLength(void) const { return mUncompressedLen-mOffset; }
- virtual int openFileDescriptor(off64_t* outStart, off64_t* outLength) const { return -1; }
+ virtual int openFileDescriptor(off64_t* /* outStart */, off64_t* /* outLength */) const { return -1; }
virtual bool isAllocated(void) const { return mBuf != NULL; }
private:
diff --git a/include/androidfw/AssetDir.h b/libs/androidfw/include/androidfw/AssetDir.h
similarity index 100%
rename from include/androidfw/AssetDir.h
rename to libs/androidfw/include/androidfw/AssetDir.h
diff --git a/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h
similarity index 97%
rename from include/androidfw/AssetManager.h
rename to libs/androidfw/include/androidfw/AssetManager.h
index 914ac3d..1a59e44 100644
--- a/include/androidfw/AssetManager.h
+++ b/libs/androidfw/include/androidfw/AssetManager.h
@@ -33,17 +33,8 @@
/*
* Native-app access is via the opaque typedef struct AAssetManager in the C namespace.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
struct AAssetManager { };
-#ifdef __cplusplus
-};
-#endif
-
-
/*
* Now the proper C++ android-namespace definitions
*/
@@ -87,8 +78,8 @@
virtual ~AssetManager(void);
static int32_t getGlobalCount();
-
- /*
+
+ /*
* Add a new source for assets. This can be called multiple times to
* look in multiple places for assets. It can be either a directory (for
* finding assets as raw files on the disk) or a ZIP file. This newly
@@ -203,7 +194,7 @@
*/
FileType getFileType(const char* fileName);
- /*
+ /*
* Return the complete resource table to find things in the package.
*/
const ResTable& getResources(bool required = true) const;
@@ -302,12 +293,12 @@
ResTable* getResourceTable();
ResTable* setResourceTable(ResTable* res);
-
+
bool isUpToDate();
void addOverlay(const asset_path& ap);
bool getOverlay(size_t idx, asset_path* out) const;
-
+
protected:
~SharedZip();
@@ -359,7 +350,7 @@
void addOverlay(const String8& path, const asset_path& overlay);
bool getOverlay(const String8& path, size_t idx, asset_path* out) const;
-
+
private:
void closeZip(int idx);
diff --git a/include/androidfw/AttributeFinder.h b/libs/androidfw/include/androidfw/AttributeFinder.h
similarity index 100%
rename from include/androidfw/AttributeFinder.h
rename to libs/androidfw/include/androidfw/AttributeFinder.h
diff --git a/include/androidfw/BackupHelpers.h b/libs/androidfw/include/androidfw/BackupHelpers.h
similarity index 100%
rename from include/androidfw/BackupHelpers.h
rename to libs/androidfw/include/androidfw/BackupHelpers.h
diff --git a/include/androidfw/ByteBucketArray.h b/libs/androidfw/include/androidfw/ByteBucketArray.h
similarity index 100%
rename from include/androidfw/ByteBucketArray.h
rename to libs/androidfw/include/androidfw/ByteBucketArray.h
diff --git a/include/androidfw/CursorWindow.h b/libs/androidfw/include/androidfw/CursorWindow.h
similarity index 100%
rename from include/androidfw/CursorWindow.h
rename to libs/androidfw/include/androidfw/CursorWindow.h
diff --git a/include/androidfw/DisplayEventDispatcher.h b/libs/androidfw/include/androidfw/DisplayEventDispatcher.h
similarity index 100%
rename from include/androidfw/DisplayEventDispatcher.h
rename to libs/androidfw/include/androidfw/DisplayEventDispatcher.h
diff --git a/include/androidfw/LocaleData.h b/libs/androidfw/include/androidfw/LocaleData.h
similarity index 100%
rename from include/androidfw/LocaleData.h
rename to libs/androidfw/include/androidfw/LocaleData.h
diff --git a/include/androidfw/ObbFile.h b/libs/androidfw/include/androidfw/ObbFile.h
similarity index 96%
rename from include/androidfw/ObbFile.h
rename to libs/androidfw/include/androidfw/ObbFile.h
index 47559cd..3dbf997d 100644
--- a/include/androidfw/ObbFile.h
+++ b/libs/androidfw/include/androidfw/ObbFile.h
@@ -124,20 +124,13 @@
/* Flags for this OBB type. */
int32_t mFlags;
- /* Whether the file is salted. */
- bool mSalted;
-
/* The encryption salt. */
unsigned char mSalt[8];
const char* mFileName;
- size_t mFileSize;
-
size_t mFooterStart;
- unsigned char* mReadBuf;
-
bool parseObbFile(int fd);
};
diff --git a/include/androidfw/ResourceTypes.h b/libs/androidfw/include/androidfw/ResourceTypes.h
similarity index 100%
rename from include/androidfw/ResourceTypes.h
rename to libs/androidfw/include/androidfw/ResourceTypes.h
diff --git a/include/androidfw/StreamingZipInflater.h b/libs/androidfw/include/androidfw/StreamingZipInflater.h
similarity index 100%
rename from include/androidfw/StreamingZipInflater.h
rename to libs/androidfw/include/androidfw/StreamingZipInflater.h
diff --git a/include/androidfw/TypeWrappers.h b/libs/androidfw/include/androidfw/TypeWrappers.h
similarity index 98%
rename from include/androidfw/TypeWrappers.h
rename to libs/androidfw/include/androidfw/TypeWrappers.h
index 7bdf8af..fd84873 100644
--- a/include/androidfw/TypeWrappers.h
+++ b/libs/androidfw/include/androidfw/TypeWrappers.h
@@ -30,6 +30,7 @@
iterator& operator=(const iterator& rhs) {
mTypeVariant = rhs.mTypeVariant;
mIndex = rhs.mIndex;
+ return *this;
}
bool operator==(const iterator& rhs) const {
diff --git a/include/androidfw/ZipFileRO.h b/libs/androidfw/include/androidfw/ZipFileRO.h
similarity index 100%
rename from include/androidfw/ZipFileRO.h
rename to libs/androidfw/include/androidfw/ZipFileRO.h
diff --git a/include/androidfw/ZipUtils.h b/libs/androidfw/include/androidfw/ZipUtils.h
similarity index 100%
rename from include/androidfw/ZipUtils.h
rename to libs/androidfw/include/androidfw/ZipUtils.h
diff --git a/include/androidfw/misc.h b/libs/androidfw/include/androidfw/misc.h
similarity index 100%
rename from include/androidfw/misc.h
rename to libs/androidfw/include/androidfw/misc.h
diff --git a/libs/hwui/hwui_static_deps.mk b/libs/hwui/hwui_static_deps.mk
index 2990952..dca78b3 100644
--- a/libs/hwui/hwui_static_deps.mk
+++ b/libs/hwui/hwui_static_deps.mk
@@ -24,7 +24,8 @@
libprotobuf-cpp-lite \
libharfbuzz_ng \
libft2 \
- libminikin
+ libminikin \
+ libandroidfw
ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
LOCAL_SHARED_LIBRARIES += libRS libRScpp
diff --git a/media/java/android/media/AmrInputStream.java b/media/java/android/media/AmrInputStream.java
index f90f1e2..fb91bbb 100644
--- a/media/java/android/media/AmrInputStream.java
+++ b/media/java/android/media/AmrInputStream.java
@@ -18,45 +18,69 @@
import java.io.InputStream;
import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import android.media.MediaCodec.BufferInfo;
+import android.util.Log;
/**
* AmrInputStream
* @hide
*/
-public final class AmrInputStream extends InputStream
-{
- static {
- System.loadLibrary("media_jni");
- }
-
+public final class AmrInputStream extends InputStream {
private final static String TAG = "AmrInputStream";
// frame is 20 msec at 8.000 khz
private final static int SAMPLES_PER_FRAME = 8000 * 20 / 1000;
-
+
+ MediaCodec mCodec;
+ BufferInfo mInfo;
+ boolean mSawOutputEOS;
+ boolean mSawInputEOS;
+
// pcm input stream
private InputStream mInputStream;
-
- // native handle
- private long mGae;
-
+
// result amr stream
private final byte[] mBuf = new byte[SAMPLES_PER_FRAME * 2];
private int mBufIn = 0;
private int mBufOut = 0;
-
+
// helper for bytewise read()
private byte[] mOneByte = new byte[1];
-
+
/**
* Create a new AmrInputStream, which converts 16 bit PCM to AMR
* @param inputStream InputStream containing 16 bit PCM.
*/
public AmrInputStream(InputStream inputStream) {
mInputStream = inputStream;
- mGae = GsmAmrEncoderNew();
- GsmAmrEncoderInitialize(mGae);
+
+ MediaFormat format = new MediaFormat();
+ format.setString(MediaFormat.KEY_MIME, MediaFormat.MIMETYPE_AUDIO_AMR_NB);
+ format.setInteger(MediaFormat.KEY_SAMPLE_RATE, 8000);
+ format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 1);
+ format.setInteger(MediaFormat.KEY_BIT_RATE, 12200);
+
+ MediaCodecList mcl = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+ String name = mcl.findEncoderForFormat(format);
+ if (name != null) {
+ try {
+ mCodec = MediaCodec.createByCodecName(name);
+ mCodec.configure(format,
+ null /* surface */,
+ null /* crypto */,
+ MediaCodec.CONFIGURE_FLAG_ENCODE);
+ mCodec.start();
+ } catch (IOException e) {
+ if (mCodec != null) {
+ mCodec.release();
+ }
+ mCodec = null;
+ }
+ }
+ mInfo = new BufferInfo();
}
@Override
@@ -64,7 +88,7 @@
int rtn = read(mOneByte, 0, 1);
return rtn == 1 ? (0xff & mOneByte[0]) : -1;
}
-
+
@Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
@@ -72,67 +96,100 @@
@Override
public int read(byte[] b, int offset, int length) throws IOException {
- if (mGae == 0) throw new IllegalStateException("not open");
-
- // local buffer of amr encoded audio empty
- if (mBufOut >= mBufIn) {
- // reset the buffer
+ if (mCodec == null) {
+ throw new IllegalStateException("not open");
+ }
+
+ if (mBufOut >= mBufIn && !mSawOutputEOS) {
+ // no data left in buffer, refill it
mBufOut = 0;
mBufIn = 0;
-
- // fetch a 20 msec frame of pcm
- for (int i = 0; i < SAMPLES_PER_FRAME * 2; ) {
- int n = mInputStream.read(mBuf, i, SAMPLES_PER_FRAME * 2 - i);
- if (n == -1) return -1;
- i += n;
+
+ // first push as much data into the encoder as possible
+ while (!mSawInputEOS) {
+ int index = mCodec.dequeueInputBuffer(0);
+ if (index < 0) {
+ // no input buffer currently available
+ break;
+ } else {
+ int numRead;
+ for (numRead = 0; numRead < SAMPLES_PER_FRAME * 2; ) {
+ int n = mInputStream.read(mBuf, numRead, SAMPLES_PER_FRAME * 2 - numRead);
+ if (n == -1) {
+ mSawInputEOS = true;
+ break;
+ }
+ numRead += n;
+ }
+ ByteBuffer buf = mCodec.getInputBuffer(index);
+ buf.put(mBuf, 0, numRead);
+ mCodec.queueInputBuffer(index,
+ 0 /* offset */,
+ numRead,
+ 0 /* presentationTimeUs */,
+ mSawInputEOS ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : 0 /* flags */);
+ }
}
-
- // encode it
- mBufIn = GsmAmrEncoderEncode(mGae, mBuf, 0, mBuf, 0);
+
+ // now read encoded data from the encoder (blocking, since we just filled up the
+ // encoder's input with data it should be able to output at least one buffer)
+ while (true) {
+ int index = mCodec.dequeueOutputBuffer(mInfo, -1);
+ if (index >= 0) {
+ mBufIn = mInfo.size;
+ ByteBuffer out = mCodec.getOutputBuffer(index);
+ out.get(mBuf, 0 /* offset */, mBufIn /* length */);
+ mCodec.releaseOutputBuffer(index, false /* render */);
+ if ((mInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
+ mSawOutputEOS = true;
+ }
+ break;
+ }
+ }
}
-
- // return encoded audio to user
- if (length > mBufIn - mBufOut) length = mBufIn - mBufOut;
- System.arraycopy(mBuf, mBufOut, b, offset, length);
- mBufOut += length;
-
- return length;
+
+ if (mBufOut < mBufIn) {
+ // there is data in the buffer
+ if (length > mBufIn - mBufOut) {
+ length = mBufIn - mBufOut;
+ }
+ System.arraycopy(mBuf, mBufOut, b, offset, length);
+ mBufOut += length;
+ return length;
+ }
+
+ if (mSawInputEOS && mSawOutputEOS) {
+ // no more data available in buffer, codec or input stream
+ return -1;
+ }
+
+ // caller should try again
+ return 0;
}
@Override
public void close() throws IOException {
try {
- if (mInputStream != null) mInputStream.close();
+ if (mInputStream != null) {
+ mInputStream.close();
+ }
} finally {
mInputStream = null;
try {
- if (mGae != 0) GsmAmrEncoderCleanup(mGae);
- } finally {
- try {
- if (mGae != 0) GsmAmrEncoderDelete(mGae);
- } finally {
- mGae = 0;
+ if (mCodec != null) {
+ mCodec.release();
}
+ } finally {
+ mCodec = null;
}
}
}
@Override
protected void finalize() throws Throwable {
- if (mGae != 0) {
- close();
- throw new IllegalStateException("someone forgot to close AmrInputStream");
+ if (mCodec != null) {
+ Log.w(TAG, "AmrInputStream wasn't closed");
+ mCodec.release();
}
}
-
- //
- // AudioRecord JNI interface
- //
- private static native long GsmAmrEncoderNew();
- private static native void GsmAmrEncoderInitialize(long gae);
- private static native int GsmAmrEncoderEncode(long gae,
- byte[] pcm, int pcmOffset, byte[] amr, int amrOffset) throws IOException;
- private static native void GsmAmrEncoderCleanup(long gae);
- private static native void GsmAmrEncoderDelete(long gae);
-
}
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index 2c28a10..8640565 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -2,7 +2,6 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- android_media_AmrInputStream.cpp \
android_media_ExifInterface.cpp \
android_media_ImageWriter.cpp \
android_media_ImageReader.cpp \
@@ -46,10 +45,9 @@
libusbhost \
libexif \
libpiex \
- libstagefright_amrnb_common
+ libandroidfw
LOCAL_STATIC_LIBRARIES := \
- libstagefright_amrnbenc
LOCAL_C_INCLUDES += \
external/libexif/ \
@@ -59,9 +57,6 @@
frameworks/base/libs/hwui \
frameworks/av/media/libmedia \
frameworks/av/media/libstagefright \
- frameworks/av/media/libstagefright/codecs/amrnb/enc/src \
- frameworks/av/media/libstagefright/codecs/amrnb/common \
- frameworks/av/media/libstagefright/codecs/amrnb/common/include \
frameworks/av/media/mtp \
frameworks/native/include/media/openmax \
$(call include-path-for, libhardware)/hardware \
diff --git a/media/jni/android_media_AmrInputStream.cpp b/media/jni/android_media_AmrInputStream.cpp
deleted file mode 100644
index b56a364..0000000
--- a/media/jni/android_media_AmrInputStream.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-**
-** Copyright 2007, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#define LOG_TAG "AmrInputStream"
-#include "utils/Log.h"
-
-#include "jni.h"
-#include "JNIHelp.h"
-#include "android_runtime/AndroidRuntime.h"
-#include "gsmamr_enc.h"
-
-// ----------------------------------------------------------------------------
-
-using namespace android;
-
-// Corresponds to max bit rate of 12.2 kbps.
-static const int MAX_OUTPUT_BUFFER_SIZE = 32;
-static const int FRAME_DURATION_MS = 20;
-static const int SAMPLING_RATE_HZ = 8000;
-static const int SAMPLES_PER_FRAME = ((SAMPLING_RATE_HZ * FRAME_DURATION_MS) / 1000);
-static const int BYTES_PER_SAMPLE = 2; // Assume 16-bit PCM samples
-static const int BYTES_PER_FRAME = (SAMPLES_PER_FRAME * BYTES_PER_SAMPLE);
-
-struct GsmAmrEncoderState {
- GsmAmrEncoderState()
- : mEncState(NULL),
- mSidState(NULL),
- mLastModeUsed(0) {
- }
-
- ~GsmAmrEncoderState() {}
-
- void* mEncState;
- void* mSidState;
- int32_t mLastModeUsed;
-};
-
-static jlong android_media_AmrInputStream_GsmAmrEncoderNew
- (JNIEnv *env, jclass /* clazz */) {
- GsmAmrEncoderState* gae = new GsmAmrEncoderState();
- if (gae == NULL) {
- jniThrowRuntimeException(env, "Out of memory");
- }
- return (jlong)gae;
-}
-
-static void android_media_AmrInputStream_GsmAmrEncoderInitialize
- (JNIEnv *env, jclass /* clazz */, jlong gae) {
- GsmAmrEncoderState *state = (GsmAmrEncoderState *) gae;
- int32_t nResult = AMREncodeInit(&state->mEncState, &state->mSidState, false);
- if (nResult != OK) {
- jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
- "GsmAmrEncoder initialization failed %d", nResult);
- }
-}
-
-static jint android_media_AmrInputStream_GsmAmrEncoderEncode
- (JNIEnv *env, jclass /* clazz */,
- jlong gae, jbyteArray pcm, jint pcmOffset, jbyteArray amr, jint amrOffset) {
-
- jbyte inBuf[BYTES_PER_FRAME];
- jbyte outBuf[MAX_OUTPUT_BUFFER_SIZE];
-
- env->GetByteArrayRegion(pcm, pcmOffset, sizeof(inBuf), inBuf);
- GsmAmrEncoderState *state = (GsmAmrEncoderState *) gae;
- int32_t length = AMREncode(state->mEncState, state->mSidState,
- (Mode) MR122,
- (int16_t *) inBuf,
- (unsigned char *) outBuf,
- (Frame_Type_3GPP*) &state->mLastModeUsed,
- AMR_TX_WMF);
- if (length < 0) {
- jniThrowExceptionFmt(env, "java/io/IOException",
- "Failed to encode a frame with error code: %d", length);
- return (jint)-1;
- }
-
- // The 1st byte of PV AMR frames are WMF (Wireless Multimedia Forum)
- // bitpacked, i.e.;
- // [P(4) + FT(4)]. Q=1 for good frame, P=padding bit, 0
- // Here we are converting the header to be as specified in Section 5.3 of
- // RFC 3267 (AMR storage format) i.e.
- // [P(1) + FT(4) + Q(1) + P(2)].
- if (length > 0) {
- outBuf[0] = (outBuf[0] << 3) | 0x4;
- }
-
- env->SetByteArrayRegion(amr, amrOffset, length, outBuf);
-
- return (jint)length;
-}
-
-static void android_media_AmrInputStream_GsmAmrEncoderCleanup
- (JNIEnv* /* env */, jclass /* clazz */, jlong gae) {
- GsmAmrEncoderState *state = (GsmAmrEncoderState *) gae;
- AMREncodeExit(&state->mEncState, &state->mSidState);
- state->mEncState = NULL;
- state->mSidState = NULL;
-}
-
-static void android_media_AmrInputStream_GsmAmrEncoderDelete
- (JNIEnv* /* env */, jclass /* clazz */, jlong gae) {
- delete (GsmAmrEncoderState*)gae;
-}
-
-// ----------------------------------------------------------------------------
-
-static const JNINativeMethod gMethods[] = {
- {"GsmAmrEncoderNew", "()J", (void*)android_media_AmrInputStream_GsmAmrEncoderNew},
- {"GsmAmrEncoderInitialize", "(J)V", (void*)android_media_AmrInputStream_GsmAmrEncoderInitialize},
- {"GsmAmrEncoderEncode", "(J[BI[BI)I", (void*)android_media_AmrInputStream_GsmAmrEncoderEncode},
- {"GsmAmrEncoderCleanup", "(J)V", (void*)android_media_AmrInputStream_GsmAmrEncoderCleanup},
- {"GsmAmrEncoderDelete", "(J)V", (void*)android_media_AmrInputStream_GsmAmrEncoderDelete},
-};
-
-
-int register_android_media_AmrInputStream(JNIEnv *env)
-{
- const char* const kClassPathName = "android/media/AmrInputStream";
-
- return AndroidRuntime::registerNativeMethods(env,
- kClassPathName, gMethods, NELEM(gMethods));
-}
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 2fb1a3b..8f14b79 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -1106,7 +1106,6 @@
extern int register_android_media_MediaSync(JNIEnv *env);
extern int register_android_media_ResampleInputStream(JNIEnv *env);
extern int register_android_media_MediaProfiles(JNIEnv *env);
-extern int register_android_media_AmrInputStream(JNIEnv *env);
extern int register_android_mtp_MtpDatabase(JNIEnv *env);
extern int register_android_mtp_MtpDevice(JNIEnv *env);
extern int register_android_mtp_MtpServer(JNIEnv *env);
@@ -1152,11 +1151,6 @@
goto bail;
}
- if (register_android_media_AmrInputStream(env) < 0) {
- ALOGE("ERROR: AmrInputStream native registration failed\n");
- goto bail;
- }
-
if (register_android_media_ResampleInputStream(env) < 0) {
ALOGE("ERROR: ResampleInputStream native registration failed\n");
goto bail;
diff --git a/media/jni/audioeffect/Android.mk b/media/jni/audioeffect/Android.mk
index 5c22c9b..8bd8857 100644
--- a/media/jni/audioeffect/Android.mk
+++ b/media/jni/audioeffect/Android.mk
@@ -11,7 +11,8 @@
libutils \
libandroid_runtime \
libnativehelper \
- libmedia
+ libmedia \
+ libaudioclient \
LOCAL_C_INCLUDES := \
$(call include-path-for, audio-effects)
diff --git a/media/jni/soundpool/Android.mk b/media/jni/soundpool/Android.mk
index 2bc41b5..509a59b 100644
--- a/media/jni/soundpool/Android.mk
+++ b/media/jni/soundpool/Android.mk
@@ -12,7 +12,7 @@
libutils \
libandroid_runtime \
libnativehelper \
- libmedia \
+ libaudioclient \
libmediandk \
libbinder
diff --git a/media/tests/audiotests/Android.mk b/media/tests/audiotests/Android.mk
index 57be372..01e42bd 100644
--- a/media/tests/audiotests/Android.mk
+++ b/media/tests/audiotests/Android.mk
@@ -15,7 +15,8 @@
libutils \
libbinder \
libhardware_legacy \
- libmedia
+ libmedia \
+ libaudioclient \
LOCAL_MODULE_TAGS := tests
diff --git a/native/graphics/jni/Android.mk b/native/graphics/jni/Android.mk
index 175f730..4c8a9db 100644
--- a/native/graphics/jni/Android.mk
+++ b/native/graphics/jni/Android.mk
@@ -20,7 +20,8 @@
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
- libskia
+ libskia \
+ libandroidfw
LOCAL_C_INCLUDES += \
frameworks/base/native/include \
diff --git a/packages/Osu/src/com/android/hotspot2/WifiNetworkAdapter.java b/packages/Osu/src/com/android/hotspot2/WifiNetworkAdapter.java
index 518e64e..63b1903 100644
--- a/packages/Osu/src/com/android/hotspot2/WifiNetworkAdapter.java
+++ b/packages/Osu/src/com/android/hotspot2/WifiNetworkAdapter.java
@@ -134,8 +134,8 @@
public HomeSP addSP(MOTree instanceTree) throws IOException, SAXException {
WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
String xml = instanceTree.toXml();
- wifiManager.addPasspointManagementObject(xml);
- return MOManager.buildSP(xml);
+ // TODO(b/32883320): use the new API for adding Passpoint configuration.
+ return null;
}
public void removeSP(String fqdn) throws IOException {
diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
index 70f2fdc..7afdbcb 100644
--- a/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java
@@ -104,7 +104,9 @@
TunerService.showResetRequest(getContext(), new Runnable() {
@Override
public void run() {
- getActivity().finish();
+ if (getActivity() != null) {
+ getActivity().finish();
+ }
}
});
return true;
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 2a5b194..5b36598 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -58,6 +58,7 @@
import java.io.FileDescriptor;
import java.io.PrintWriter;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.HashMap;
import java.util.Map;
@@ -117,7 +118,6 @@
private static final int SERVICE_IBLUETOOTHGATT = 2;
private final Context mContext;
- private static int mBleAppCount = 0;
// Locks are not provided for mName and mAddress.
// They are accessed in handler or broadcast receiver, same thread context.
@@ -211,10 +211,7 @@
if (isAirplaneModeOn()) {
// Clear registered LE apps to force shut-off
- synchronized (this) {
- mBleAppCount = 0;
- mBleApps.clear();
- }
+ clearBleApps();
if (st == BluetoothAdapter.STATE_BLE_ON) {
//if state is BLE_ON make sure you trigger disableBLE part
try {
@@ -438,28 +435,28 @@
class ClientDeathRecipient implements IBinder.DeathRecipient {
public void binderDied() {
if (DBG) Slog.d(TAG, "Binder is dead - unregister Ble App");
- if (mBleAppCount > 0) --mBleAppCount;
-
- if (mBleAppCount == 0) {
- if (DBG) Slog.d(TAG, "Disabling LE only mode after application crash");
- try {
- mBluetoothLock.readLock().lock();
- if (mBluetooth != null &&
- mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) {
- mEnable = false;
- mBluetooth.onBrEdrDown();
- }
- } catch (RemoteException e) {
- Slog.e(TAG,"Unable to call onBrEdrDown", e);
- } finally {
- mBluetoothLock.readLock().unlock();
+ if (isBleAppPresent()) {
+ // Nothing to do, another app is here.
+ return;
+ }
+ if (DBG) Slog.d(TAG, "Disabling LE only mode after application crash");
+ try {
+ mBluetoothLock.readLock().lock();
+ if (mBluetooth != null &&
+ mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) {
+ mEnable = false;
+ mBluetooth.onBrEdrDown();
}
+ } catch (RemoteException e) {
+ Slog.e(TAG,"Unable to call onBrEdrDown", e);
+ } finally {
+ mBluetoothLock.readLock().unlock();
}
}
}
/** Internal death rec list */
- Map<IBinder, ClientDeathRecipient> mBleApps = new HashMap<IBinder, ClientDeathRecipient>();
+ Map<IBinder, ClientDeathRecipient> mBleApps = new ConcurrentHashMap<IBinder, ClientDeathRecipient>();
@Override
public boolean isBleScanAlwaysAvailable() {
@@ -479,17 +476,20 @@
ContentObserver contentObserver = new ContentObserver(null) {
@Override
public void onChange(boolean selfChange) {
- if (!isBleScanAlwaysAvailable()) {
- disableBleScanMode();
- clearBleApps();
- try {
- mBluetoothLock.readLock().lock();
- if (mBluetooth != null) mBluetooth.onBrEdrDown();
- } catch (RemoteException e) {
- Slog.e(TAG, "error when disabling bluetooth", e);
- } finally {
- mBluetoothLock.readLock().unlock();
- }
+ if (isBleScanAlwaysAvailable()) {
+ // Nothing to do
+ return;
+ }
+ // BLE scan is not available.
+ disableBleScanMode();
+ clearBleApps();
+ try {
+ mBluetoothLock.readLock().lock();
+ if (mBluetooth != null) mBluetooth.onBrEdrDown();
+ } catch (RemoteException e) {
+ Slog.e(TAG, "error when disabling bluetooth", e);
+ } finally {
+ mBluetoothLock.readLock().unlock();
}
}
};
@@ -525,9 +525,6 @@
throw new IllegalArgumentException("Wake lock is already dead.");
}
mBleApps.put(token, deathRec);
- synchronized (this) {
- ++mBleAppCount;
- }
if (DBG) Slog.d(TAG, "Registered for death Notification");
}
@@ -537,31 +534,26 @@
// Unregister death recipient as the app goes away.
token.unlinkToDeath(r, 0);
mBleApps.remove(token);
- synchronized (this) {
- if (mBleAppCount > 0) --mBleAppCount;
- }
if (DBG) Slog.d(TAG, "Unregistered for death Notification");
}
}
- if (DBG) Slog.d(TAG, "Updated BleAppCount" + mBleAppCount);
- if (mBleAppCount == 0 && mEnable) {
+ int appCount = mBleApps.size();
+ if (DBG) Slog.d(TAG, appCount + " registered Ble Apps");
+ if (appCount == 0 && mEnable) {
disableBleScanMode();
}
- return mBleAppCount;
+ return appCount;
}
// Clear all apps using BLE scan only mode.
private void clearBleApps() {
- synchronized (this) {
- mBleApps.clear();
- mBleAppCount = 0;
- }
+ mBleApps.clear();
}
/** @hide*/
public boolean isBleAppPresent() {
- if (DBG) Slog.d(TAG, "isBleAppPresent() count: " + mBleAppCount);
- return (mBleAppCount > 0);
+ if (DBG) Slog.d(TAG, "isBleAppPresent() count: " + mBleApps.size());
+ return mBleApps.size() > 0;
}
/**
@@ -1417,12 +1409,12 @@
if ((prevState == BluetoothAdapter.STATE_BLE_TURNING_ON) &&
(newState == BluetoothAdapter.STATE_OFF) &&
(mBluetooth != null) && mEnable) {
- recoverBluetoothServiceFromError();
+ recoverBluetoothServiceFromError(false);
}
if ((prevState == BluetoothAdapter.STATE_TURNING_ON) &&
(newState == BluetoothAdapter.STATE_BLE_ON) &&
(mBluetooth != null) && mEnable) {
- recoverBluetoothServiceFromError();
+ recoverBluetoothServiceFromError(true);
}
// If we tried to enable BT while BT was in the process of shutting down,
// wait for the BT process to fully tear down and then force a restart
@@ -1837,7 +1829,7 @@
quietMode ? 1 : 0, 0));
}
- private void recoverBluetoothServiceFromError() {
+ private void recoverBluetoothServiceFromError(boolean clearBle) {
Slog.e(TAG,"recoverBluetoothServiceFromError");
try {
mBluetoothLock.readLock().lock();
@@ -1875,6 +1867,10 @@
mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
mState = BluetoothAdapter.STATE_OFF;
+ if (clearBle) {
+ clearBleApps();
+ }
+
mEnable = false;
if (mErrorRecoveryRetryCounter++ < MAX_ERROR_RESTART_RETRIES) {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 58b71f5..18e0f3f 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -138,8 +138,8 @@
"com.android.server.midi.MidiService$Lifecycle";
private static final String WIFI_SERVICE_CLASS =
"com.android.server.wifi.WifiService";
- private static final String WIFI_NAN_SERVICE_CLASS =
- "com.android.server.wifi.nan.WifiNanService";
+ private static final String WIFI_AWARE_SERVICE_CLASS =
+ "com.android.server.wifi.aware.WifiAwareService";
private static final String WIFI_P2P_SERVICE_CLASS =
"com.android.server.wifi.p2p.WifiP2pService";
private static final String ETHERNET_SERVICE_CLASS =
@@ -820,10 +820,11 @@
}
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
- if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_NAN)) {
- mSystemServiceManager.startService(WIFI_NAN_SERVICE_CLASS);
+ if (context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WIFI_AWARE)) {
+ mSystemServiceManager.startService(WIFI_AWARE_SERVICE_CLASS);
} else {
- Slog.i(TAG, "No Wi-Fi NAN Service (NAN support Not Present)");
+ Slog.i(TAG, "No Wi-Fi Aware Service (Aware support Not Present)");
}
mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS);
mSystemServiceManager.startService(WIFI_SERVICE_CLASS);
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index dbc2b0c..615ae49 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -114,7 +114,10 @@
public static final int CAPABILITY_SIM_SUBSCRIPTION = 0x4;
/**
- * Flag indicating that this {@code PhoneAccount} is capable of placing video calls.
+ * Flag indicating that this {@code PhoneAccount} is currently able to place video calls.
+ * <p>
+ * See also {@link #CAPABILITY_SUPPORTS_VIDEO_CALLING} which indicates whether the
+ * {@code PhoneAccount} supports placing video calls.
* <p>
* See {@link #getCapabilities}
*/
@@ -179,6 +182,23 @@
public static final int CAPABILITY_EMERGENCY_VIDEO_CALLING = 0x200;
/**
+ * Flag indicating that this {@link PhoneAccount} supports video calling.
+ * This is not an indication that the {@link PhoneAccount} is currently able to make a video
+ * call, but rather that it has the ability to make video calls (but not necessarily at this
+ * time).
+ * <p>
+ * Whether a {@link PhoneAccount} can make a video call is ultimately controlled by
+ * {@link #CAPABILITY_VIDEO_CALLING}, which indicates whether the {@link PhoneAccount} is
+ * currently capable of making a video call. Consider a case where, for example, a
+ * {@link PhoneAccount} supports making video calls (e.g.
+ * {@link #CAPABILITY_SUPPORTS_VIDEO_CALLING}), but a current lack of network connectivity
+ * prevents video calls from being made (e.g. {@link #CAPABILITY_VIDEO_CALLING}).
+ * <p>
+ * See {@link #getCapabilities}
+ */
+ public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 0x400;
+
+ /**
* URI scheme for telephone number URIs.
*/
public static final String SCHEME_TEL = "tel";
@@ -716,6 +736,9 @@
*/
private String capabilitiesToString(int capabilities) {
StringBuilder sb = new StringBuilder();
+ if (hasCapabilities(CAPABILITY_SUPPORTS_VIDEO_CALLING)) {
+ sb.append("SuppVideo ");
+ }
if (hasCapabilities(CAPABILITY_VIDEO_CALLING)) {
sb.append("Video ");
}
diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java
index 3c0a8d6..434caad 100644
--- a/telephony/java/android/telephony/CellSignalStrengthLte.java
+++ b/telephony/java/android/telephony/CellSignalStrengthLte.java
@@ -168,20 +168,34 @@
}
/**
- * @hide
+ * Get reference signal received quality
*/
public int getRsrq() {
return mRsrq;
}
/**
- * @hide
+ * Get reference signal signal-to-noise ratio
*/
public int getRssnr() {
return mRssnr;
}
/**
+ * Get reference signal received power
+ */
+ public int getRsrp() {
+ return mRsrp;
+ }
+
+ /**
+ * Get channel quality indicator
+ */
+ public int getCqi() {
+ return mCqi;
+ }
+
+ /**
* Get signal strength as dBm
*/
@Override
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index bb2b447..32f487b 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -233,7 +233,7 @@
* @hide
*/
/** @hide */
- protected int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ protected Integer mSubId;
private final Handler mHandler;
@@ -242,7 +242,7 @@
* This class requires Looper.myLooper() not return null.
*/
public PhoneStateListener() {
- this(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, Looper.myLooper());
+ this(null, Looper.myLooper());
}
/**
@@ -251,7 +251,7 @@
* @hide
*/
public PhoneStateListener(Looper looper) {
- this(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, looper);
+ this(null, looper);
}
/**
@@ -260,7 +260,7 @@
* own non-null Looper use PhoneStateListener(int subId, Looper looper) below.
* @hide
*/
- public PhoneStateListener(int subId) {
+ public PhoneStateListener(Integer subId) {
this(subId, Looper.myLooper());
}
@@ -269,7 +269,7 @@
* and non-null Looper.
* @hide
*/
- public PhoneStateListener(int subId, Looper looper) {
+ public PhoneStateListener(Integer subId, Looper looper) {
if (DBG) log("ctor: subId=" + subId + " looper=" + looper);
mSubId = subId;
mHandler = new Handler(looper) {
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 79130e4..c6ed04c 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -255,6 +255,22 @@
return new TelephonyManager(mContext, subId);
}
+ /**
+ * Create a new TelephonyManager object pinned to the subscription ID associated with the given
+ * phone account.
+ *
+ * @return a TelephonyManager that uses the given phone account for all calls, or {@code null}
+ * if the phone account does not correspond to a valid subscription ID.
+ */
+ @Nullable
+ public TelephonyManager createForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
+ int subId = getSubIdForPhoneAccountHandle(phoneAccountHandle);
+ if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+ return null;
+ }
+ return new TelephonyManager(mContext, subId);
+ }
+
/** {@hide} */
public boolean isMultiSimEnabled() {
return (multiSimConfig.equals("dsds") || multiSimConfig.equals("dsda") ||
@@ -2783,6 +2799,12 @@
if (mContext == null) return;
try {
Boolean notifyNow = (getITelephony() != null);
+ // If the listener has not explicitly set the subId (for example, created with the
+ // default constructor), replace the subId so it will listen to the account the
+ // telephony manager is created with.
+ if (listener.mSubId == null) {
+ listener.mSubId = mSubId;
+ }
sRegistry.listenForSubscriber(listener.mSubId, getOpPackageName(),
listener.callback, events, notifyNow);
} catch (RemoteException ex) {
@@ -5146,6 +5168,19 @@
return retval;
}
+ private int getSubIdForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
+ int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ try {
+ ITelecomService service = getTelecomService();
+ if (service != null) {
+ retval = getSubIdForPhoneAccount(service.getPhoneAccount(phoneAccountHandle));
+ }
+ } catch (RemoteException e) {
+ }
+
+ return retval;
+ }
+
/**
* Resets telephony manager settings back to factory defaults.
*
@@ -5195,6 +5230,16 @@
}
/**
+ * Returns the current {@link ServiceState} information.
+ *
+ * <p>Requires Permission:
+ * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+ */
+ public ServiceState getServiceState() {
+ return getServiceStateForSubscriber(getSubId());
+ }
+
+ /**
* Returns the service state information on specified subscription. Callers require
* either READ_PRIVILEGED_PHONE_STATE or READ_PHONE_STATE to retrieve the information.
* @hide
diff --git a/tools/split-select/Android.mk b/tools/split-select/Android.mk
index 199fafa..4a1511e 100644
--- a/tools/split-select/Android.mk
+++ b/tools/split-select/Android.mk
@@ -73,7 +73,7 @@
LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_SRC_FILES := $(sources)
-
+LOCAL_STATIC_LIBRARIES := $(hostStaticLibs)
LOCAL_C_INCLUDES := $(cIncludes)
LOCAL_CFLAGS := $(cFlags) -D_DARWIN_UNLIMITED_STREAMS
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index a91c949..bc38284 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -16,6 +16,7 @@
package android.net.wifi;
+import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.ScanSettings;
@@ -63,6 +64,12 @@
int modifyPasspointManagementObject(String fqdn,
in List<PasspointManagementObjectDefinition> mos);
+ boolean addPasspointConfiguration(in PasspointConfiguration config);
+
+ boolean removePasspointConfiguration(in String fqdn);
+
+ List<PasspointConfiguration> getPasspointConfigurations();
+
void queryPasspointIcon(long bssid, String fileName);
int matchProviderWithCurrentNetwork(String fqdn);
@@ -89,7 +96,7 @@
WifiInfo getConnectionInfo();
- boolean setWifiEnabled(boolean enable);
+ boolean setWifiEnabled(String packageName, boolean enable);
int getWifiEnabledState();
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index 8d5efba..e48f7bdb 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -22,6 +22,7 @@
import android.net.NetworkUtils;
import android.text.TextUtils;
+import java.lang.Math;
import java.net.InetAddress;
import java.net.Inet4Address;
import java.net.UnknownHostException;
@@ -136,6 +137,15 @@
*/
public double rxSuccessRate;
+ private static final long RESET_TIME_STAMP = Long.MIN_VALUE;
+ private static final long FILTER_TIME_CONSTANT = 3000;
+ /**
+ * This factor is used to adjust the rate output under the new algorithm
+ * such that the result is comparable to the previous algorithm.
+ */
+ private static final long OUTPUT_SCALE_FACTOR = 5000;
+ private long mLastPacketCountUpdateTimeStamp;
+
/**
* @hide
*/
@@ -157,10 +167,9 @@
public int score;
/**
- * TODO: get actual timestamp and calculate true rates
* @hide
*/
- public void updatePacketRates(WifiLinkLayerStats stats) {
+ public void updatePacketRates(WifiLinkLayerStats stats, long timeStamp) {
if (stats != null) {
long txgood = stats.txmpdu_be + stats.txmpdu_bk + stats.txmpdu_vi + stats.txmpdu_vo;
long txretries = stats.retries_be + stats.retries_bk
@@ -169,18 +178,28 @@
long txbad = stats.lostmpdu_be + stats.lostmpdu_bk
+ stats.lostmpdu_vi + stats.lostmpdu_vo;
- if (txBad <= txbad
+ if (mLastPacketCountUpdateTimeStamp != RESET_TIME_STAMP
+ && mLastPacketCountUpdateTimeStamp < timeStamp
+ && txBad <= txbad
&& txSuccess <= txgood
&& rxSuccess <= rxgood
&& txRetries <= txretries) {
- txBadRate = (txBadRate * 0.5)
- + ((double) (txbad - txBad) * 0.5);
- txSuccessRate = (txSuccessRate * 0.5)
- + ((double) (txgood - txSuccess) * 0.5);
- rxSuccessRate = (rxSuccessRate * 0.5)
- + ((double) (rxgood - rxSuccess) * 0.5);
- txRetriesRate = (txRetriesRate * 0.5)
- + ((double) (txretries - txRetries) * 0.5);
+ long timeDelta = timeStamp - mLastPacketCountUpdateTimeStamp;
+ double lastSampleWeight = Math.exp(-1.0 * timeDelta / FILTER_TIME_CONSTANT);
+ double currentSampleWeight = 1.0 - lastSampleWeight;
+
+ txBadRate = txBadRate * lastSampleWeight
+ + (txbad - txBad) * OUTPUT_SCALE_FACTOR / timeDelta
+ * currentSampleWeight;
+ txSuccessRate = txSuccessRate * lastSampleWeight
+ + (txgood - txSuccess) * OUTPUT_SCALE_FACTOR / timeDelta
+ * currentSampleWeight;
+ rxSuccessRate = rxSuccessRate * lastSampleWeight
+ + (rxgood - rxSuccess) * OUTPUT_SCALE_FACTOR / timeDelta
+ * currentSampleWeight;
+ txRetriesRate = txRetriesRate * lastSampleWeight
+ + (txretries - txRetries) * OUTPUT_SCALE_FACTOR / timeDelta
+ * currentSampleWeight;
} else {
txBadRate = 0;
txSuccessRate = 0;
@@ -191,6 +210,7 @@
txSuccess = txgood;
rxSuccess = rxgood;
txRetries = txretries;
+ mLastPacketCountUpdateTimeStamp = timeStamp;
} else {
txBad = 0;
txSuccess = 0;
@@ -200,6 +220,7 @@
txSuccessRate = 0;
rxSuccessRate = 0;
txRetriesRate = 0;
+ mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP;
}
}
@@ -243,6 +264,7 @@
mRssi = INVALID_RSSI;
mLinkSpeed = -1;
mFrequency = -1;
+ mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP;
}
/** @hide */
@@ -268,6 +290,7 @@
badRssiCount = 0;
linkStuckCount = 0;
score = 0;
+ mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP;
}
/**
@@ -295,6 +318,8 @@
txRetriesRate = source.txRetriesRate;
txSuccessRate = source.txSuccessRate;
rxSuccessRate = source.rxSuccessRate;
+ mLastPacketCountUpdateTimeStamp =
+ source.mLastPacketCountUpdateTimeStamp;
score = source.score;
badRssiCount = source.badRssiCount;
lowRssiCount = source.lowRssiCount;
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index d04a60e..3520a3c 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -19,12 +19,14 @@
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
+import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.DhcpInfo;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
+import android.net.wifi.hotspot2.PasspointConfiguration;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
@@ -561,6 +563,28 @@
public static final String ACTION_PICK_WIFI_NETWORK = "android.net.wifi.PICK_WIFI_NETWORK";
/**
+ * Activity Action: Show UI to get user approval to enable WiFi.
+ * <p>Input: {@link android.content.Intent#EXTRA_PACKAGE_NAME} string extra with
+ * the name of the app requesting the action.
+ * <p>Output: Nothing.
+ *
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_REQUEST_ENABLE = "android.net.wifi.action.REQUEST_ENABLE";
+
+ /**
+ * Activity Action: Show UI to get user approval to disable WiFi.
+ * <p>Input: {@link android.content.Intent#EXTRA_PACKAGE_NAME} string extra with
+ * the name of the app requesting the action.
+ * <p>Output: Nothing.
+ *
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_REQUEST_DISABLE = "android.net.wifi.action.REQUEST_DISABLE";
+
+ /**
* Internally used Wi-Fi lock mode representing the case were no locks are held.
* @hide
*/
@@ -846,6 +870,56 @@
}
/**
+ * Add a Passpoint configuration. The configuration provides a credential
+ * for connecting to Passpoint networks that are operated by the Passpoint
+ * service provider specified in the configuration.
+ *
+ * Each configuration is uniquely identified by its FQDN (Fully Qualified Domain
+ * Name). In the case when there is an existing configuration with the same base
+ * domain, the new configuration will replace the existing configuration.
+ *
+ * @param config The Passpoint configuration to be added
+ * @return true on success or false on failure
+ * @hide
+ */
+ public boolean addPasspointConfiguration(PasspointConfiguration config) {
+ try {
+ return mService.addPasspointConfiguration(config);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Remove a Passpoint configuration identified by its FQDN (Fully Qualified Domain Name).
+ *
+ * @param fqdn The FQDN of the passpoint configuration to be removed
+ * @return true on success or false on failure
+ * @hide
+ */
+ public boolean removePasspointConfiguration(String fqdn) {
+ try {
+ return mService.removePasspointConfiguration(fqdn);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Return the list of installed Passpoint configurations.
+ *
+ * @return A list of PasspointConfiguration or null
+ * @hide
+ */
+ public List<PasspointConfiguration> getPasspointConfigurations() {
+ try {
+ return mService.getPasspointConfigurations();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Query for a Hotspot 2.0 release 2 OSU icon
* @param bssid The BSSID of the AP
* @param fileName Icon file name
@@ -1041,7 +1115,7 @@
/** @hide */
public static final int WIFI_FEATURE_SCANNER = 0x0020; // WifiScanner APIs
/** @hide */
- public static final int WIFI_FEATURE_NAN = 0x0040; // Neighbor Awareness Networking
+ public static final int WIFI_FEATURE_AWARE = 0x0040; // Wi-Fi AWare networking
/** @hide */
public static final int WIFI_FEATURE_D2D_RTT = 0x0080; // Device-to-device RTT
/** @hide */
@@ -1122,8 +1196,8 @@
* @return true if this adapter supports Neighbour Awareness Network APIs
* @hide
*/
- public boolean isNanSupported() {
- return isFeatureSupported(WIFI_FEATURE_NAN);
+ public boolean isWifiAwareSupported() {
+ return isFeatureSupported(WIFI_FEATURE_AWARE);
}
/**
@@ -1409,7 +1483,7 @@
*/
public boolean setWifiEnabled(boolean enabled) {
try {
- return mService.setWifiEnabled(enabled);
+ return mService.setWifiEnabled(mContext.getOpPackageName(), enabled);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/wifi/java/android/net/wifi/nan/ConfigRequest.aidl b/wifi/java/android/net/wifi/aware/ConfigRequest.aidl
similarity index 95%
rename from wifi/java/android/net/wifi/nan/ConfigRequest.aidl
rename to wifi/java/android/net/wifi/aware/ConfigRequest.aidl
index 38dddc2..68a7c85 100644
--- a/wifi/java/android/net/wifi/nan/ConfigRequest.aidl
+++ b/wifi/java/android/net/wifi/aware/ConfigRequest.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
parcelable ConfigRequest;
diff --git a/wifi/java/android/net/wifi/nan/ConfigRequest.java b/wifi/java/android/net/wifi/aware/ConfigRequest.java
similarity index 96%
rename from wifi/java/android/net/wifi/nan/ConfigRequest.java
rename to wifi/java/android/net/wifi/aware/ConfigRequest.java
index bcd7932..4aacbae 100644
--- a/wifi/java/android/net/wifi/nan/ConfigRequest.java
+++ b/wifi/java/android/net/wifi/aware/ConfigRequest.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.os.Parcel;
import android.os.Parcelable;
/**
- * Defines a request object to configure a Wi-Fi NAN network. Built using
+ * Defines a request object to configure a Wi-Fi Aware network. Built using
* {@link ConfigRequest.Builder}. Configuration is requested using
- * {@link WifiNanManager#attach(android.os.Handler, WifiNanAttachCallback)}.
+ * {@link WifiAwareManager#attach(android.os.Handler, WifiAwareAttachCallback)}.
* Note that the actual achieved configuration may be different from the
* requested configuration - since different applications may request different
* configurations.
@@ -221,7 +221,7 @@
}
/**
- * The Cluster ID is generated randomly for new NAN networks. Specify
+ * The Cluster ID is generated randomly for new Aware networks. Specify
* the lower range of the cluster ID. The upper range is specified using
* the {@link ConfigRequest.Builder#setClusterHigh(int)}. The permitted
* range is 0 (the default) to the value specified by
@@ -246,7 +246,7 @@
}
/**
- * The Cluster ID is generated randomly for new NAN networks. Specify
+ * The Cluster ID is generated randomly for new Aware networks. Specify
* the lower upper of the cluster ID. The lower range is specified using
* the {@link ConfigRequest.Builder#setClusterLow(int)}. The permitted
* range is the value specified by
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanDiscoverySessionCallback.aidl b/wifi/java/android/net/wifi/aware/IWifiAwareDiscoverySessionCallback.aidl
similarity index 88%
rename from wifi/java/android/net/wifi/nan/IWifiNanDiscoverySessionCallback.aidl
rename to wifi/java/android/net/wifi/aware/IWifiAwareDiscoverySessionCallback.aidl
index f2e371d..8ff3842 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanDiscoverySessionCallback.aidl
+++ b/wifi/java/android/net/wifi/aware/IWifiAwareDiscoverySessionCallback.aidl
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
/**
- * Callback interface that WifiNanManager implements
+ * Callback interface that WifiAwareManager implements
*
* {@hide}
*/
-oneway interface IWifiNanDiscoverySessionCallback
+oneway interface IWifiAwareDiscoverySessionCallback
{
void onSessionStarted(int discoverySessionId);
void onSessionConfigSuccess();
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl b/wifi/java/android/net/wifi/aware/IWifiAwareEventCallback.aidl
similarity index 85%
rename from wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl
rename to wifi/java/android/net/wifi/aware/IWifiAwareEventCallback.aidl
index 9ac7bf2..30dd64d 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl
+++ b/wifi/java/android/net/wifi/aware/IWifiAwareEventCallback.aidl
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
-import android.net.wifi.nan.ConfigRequest;
+import android.net.wifi.aware.ConfigRequest;
import android.net.wifi.RttManager;
/**
- * Callback interface that WifiNanManager implements
+ * Callback interface that WifiAwareManager implements
*
* {@hide}
*/
-oneway interface IWifiNanEventCallback
+oneway interface IWifiAwareEventCallback
{
void onConnectSuccess(int clientId);
void onConnectFail(int reason);
diff --git a/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl b/wifi/java/android/net/wifi/aware/IWifiAwareManager.aidl
similarity index 71%
rename from wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
rename to wifi/java/android/net/wifi/aware/IWifiAwareManager.aidl
index 5485824..9c92807 100644
--- a/wifi/java/android/net/wifi/nan/IWifiNanManager.aidl
+++ b/wifi/java/android/net/wifi/aware/IWifiAwareManager.aidl
@@ -14,40 +14,40 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.app.PendingIntent;
-import android.net.wifi.nan.ConfigRequest;
-import android.net.wifi.nan.IWifiNanDiscoverySessionCallback;
-import android.net.wifi.nan.IWifiNanEventCallback;
-import android.net.wifi.nan.PublishConfig;
-import android.net.wifi.nan.SubscribeConfig;
-import android.net.wifi.nan.WifiNanCharacteristics;
+import android.net.wifi.aware.ConfigRequest;
+import android.net.wifi.aware.IWifiAwareDiscoverySessionCallback;
+import android.net.wifi.aware.IWifiAwareEventCallback;
+import android.net.wifi.aware.PublishConfig;
+import android.net.wifi.aware.SubscribeConfig;
+import android.net.wifi.aware.WifiAwareCharacteristics;
import android.net.wifi.RttManager;
/**
- * Interface that WifiNanService implements
+ * Interface that WifiAwareService implements
*
* {@hide}
*/
-interface IWifiNanManager
+interface IWifiAwareManager
{
- // NAN API
+ // Aware API
void enableUsage();
void disableUsage();
boolean isUsageEnabled();
- WifiNanCharacteristics getCharacteristics();
+ WifiAwareCharacteristics getCharacteristics();
// client API
- void connect(in IBinder binder, in String callingPackage, in IWifiNanEventCallback callback,
+ void connect(in IBinder binder, in String callingPackage, in IWifiAwareEventCallback callback,
in ConfigRequest configRequest, boolean notifyOnIdentityChanged);
void disconnect(int clientId, in IBinder binder);
void publish(int clientId, in PublishConfig publishConfig,
- in IWifiNanDiscoverySessionCallback callback);
+ in IWifiAwareDiscoverySessionCallback callback);
void subscribe(int clientId, in SubscribeConfig subscribeConfig,
- in IWifiNanDiscoverySessionCallback callback);
+ in IWifiAwareDiscoverySessionCallback callback);
// session API
void updatePublish(int clientId, int discoverySessionId, in PublishConfig publishConfig);
diff --git a/wifi/java/android/net/wifi/nan/LvBufferUtils.java b/wifi/java/android/net/wifi/aware/LvBufferUtils.java
similarity index 99%
rename from wifi/java/android/net/wifi/nan/LvBufferUtils.java
rename to wifi/java/android/net/wifi/aware/LvBufferUtils.java
index eb56070..3265243 100644
--- a/wifi/java/android/net/wifi/nan/LvBufferUtils.java
+++ b/wifi/java/android/net/wifi/aware/LvBufferUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.Nullable;
@@ -28,7 +28,7 @@
* Length/Value format. The utilities accept a configuration of the size of
* the Length field.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
public class LvBufferUtils {
private LvBufferUtils() {
diff --git a/wifi/java/android/net/wifi/nan/PublishConfig.aidl b/wifi/java/android/net/wifi/aware/PublishConfig.aidl
similarity index 95%
rename from wifi/java/android/net/wifi/nan/PublishConfig.aidl
rename to wifi/java/android/net/wifi/aware/PublishConfig.aidl
index 5f66d16..2e6dd00 100644
--- a/wifi/java/android/net/wifi/nan/PublishConfig.aidl
+++ b/wifi/java/android/net/wifi/aware/PublishConfig.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
parcelable PublishConfig;
diff --git a/wifi/java/android/net/wifi/nan/PublishConfig.java b/wifi/java/android/net/wifi/aware/PublishConfig.java
similarity index 92%
rename from wifi/java/android/net/wifi/nan/PublishConfig.java
rename to wifi/java/android/net/wifi/aware/PublishConfig.java
index 30c5bc0..5d3ad058 100644
--- a/wifi/java/android/net/wifi/nan/PublishConfig.java
+++ b/wifi/java/android/net/wifi/aware/PublishConfig.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -30,13 +30,14 @@
import java.util.Arrays;
/**
- * Defines the configuration of a NAN publish session. Built using
+ * Defines the configuration of a Aware publish session. Built using
* {@link PublishConfig.Builder}. A publish session is created using
- * {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
+ * {@link WifiAwareSession#publish(android.os.Handler, PublishConfig,
+ * WifiAwareDiscoverySessionCallback)}
* or updated using
- * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)}.
+ * {@link WifiAwarePublishDiscoverySession#updatePublish(PublishConfig)}.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
public final class PublishConfig implements Parcelable {
/** @hide */
@@ -182,8 +183,9 @@
*
* @hide
*/
- public void assertValid(WifiNanCharacteristics characteristics) throws IllegalArgumentException {
- WifiNanUtils.validateServiceName(mServiceName);
+ public void assertValid(WifiAwareCharacteristics characteristics)
+ throws IllegalArgumentException {
+ WifiAwareUtils.validateServiceName(mServiceName);
if (!LvBufferUtils.isValid(mMatchFilter, 1)) {
throw new IllegalArgumentException(
@@ -320,12 +322,12 @@
* Sets the number of times an unsolicited (configured using
* {@link PublishConfig.Builder#setPublishType(int)}) publish session
* will be broadcast. When the count is reached an event will be
- * generated for {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)}
- * with {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE} [unless
+ * generated for {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)}
+ * with {@link WifiAwareDiscoverySessionCallback#TERMINATE_REASON_DONE} [unless
* {@link #setTerminateNotificationEnabled(boolean)} disables the callback].
* <p>
* Optional. 0 by default - indicating the session doesn't terminate on its own.
- * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is
+ * Session will be terminated when {@link WifiAwareDiscoveryBaseSession#destroy()} is
* called.
*
* @param publishCount Number of publish packets to broadcast.
@@ -346,12 +348,12 @@
* {@link PublishConfig.Builder#setPublishType(int)}) publish session
* will be alive - broadcasting a packet. When the TTL is reached
* an event will be generated for
- * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} with
- * {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE} [unless
+ * {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)} with
+ * {@link WifiAwareDiscoverySessionCallback#TERMINATE_REASON_DONE} [unless
* {@link #setTerminateNotificationEnabled(boolean)} disables the callback].
* <p>
* Optional. 0 by default - indicating the session doesn't terminate on its own.
- * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is
+ * Session will be terminated when {@link WifiAwareDiscoveryBaseSession#destroy()} is
* called.
*
* @param ttlSec Lifetime of a publish session in seconds.
@@ -369,7 +371,7 @@
/**
* Configure whether a publish terminate notification
- * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} is reported
+ * {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)} is reported
* back to the callback.
*
* @param enable If true the terminate callback will be called when the
diff --git a/wifi/java/android/net/wifi/nan/SubscribeConfig.aidl b/wifi/java/android/net/wifi/aware/SubscribeConfig.aidl
similarity index 95%
rename from wifi/java/android/net/wifi/nan/SubscribeConfig.aidl
rename to wifi/java/android/net/wifi/aware/SubscribeConfig.aidl
index 92344a4..bd73d5e 100644
--- a/wifi/java/android/net/wifi/nan/SubscribeConfig.aidl
+++ b/wifi/java/android/net/wifi/aware/SubscribeConfig.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
parcelable SubscribeConfig;
diff --git a/wifi/java/android/net/wifi/nan/SubscribeConfig.java b/wifi/java/android/net/wifi/aware/SubscribeConfig.java
similarity index 93%
rename from wifi/java/android/net/wifi/nan/SubscribeConfig.java
rename to wifi/java/android/net/wifi/aware/SubscribeConfig.java
index ea7b8e4..2a6cc93 100644
--- a/wifi/java/android/net/wifi/nan/SubscribeConfig.java
+++ b/wifi/java/android/net/wifi/aware/SubscribeConfig.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -30,13 +30,14 @@
import java.util.Arrays;
/**
- * Defines the configuration of a NAN subscribe session. Built using
+ * Defines the configuration of a Aware subscribe session. Built using
* {@link SubscribeConfig.Builder}. Subscribe is done using
- * {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)}
+ * {@link WifiAwareSession#subscribe(android.os.Handler, SubscribeConfig,
+ * WifiAwareDiscoverySessionCallback)}
* or
- * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
+ * {@link WifiAwareSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
public final class SubscribeConfig implements Parcelable {
/** @hide */
@@ -209,8 +210,9 @@
*
* @hide
*/
- public void assertValid(WifiNanCharacteristics characteristics) throws IllegalArgumentException {
- WifiNanUtils.validateServiceName(mServiceName);
+ public void assertValid(WifiAwareCharacteristics characteristics)
+ throws IllegalArgumentException {
+ WifiAwareUtils.validateServiceName(mServiceName);
if (!LvBufferUtils.isValid(mMatchFilter, 1)) {
throw new IllegalArgumentException(
@@ -352,11 +354,11 @@
* Sets the number of times an active (
* {@link SubscribeConfig.Builder#setSubscribeType(int)}) subscribe session
* will broadcast. When the count is reached an event will be
- * generated for {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)}
- * with {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE}.
+ * generated for {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)}
+ * with {@link WifiAwareDiscoverySessionCallback#TERMINATE_REASON_DONE}.
* <p>
* Optional. 0 by default - indicating the session doesn't terminate on its own.
- * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is
+ * Session will be terminated when {@link WifiAwareDiscoveryBaseSession#destroy()} is
* called.
*
* @param subscribeCount Number of subscribe packets to broadcast.
@@ -377,11 +379,11 @@
* {@link SubscribeConfig.Builder#setSubscribeType(int)}) subscribe session
* will be alive - i.e. broadcasting a packet. When the TTL is reached
* an event will be generated for
- * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} with
- * {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE}.
+ * {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)} with
+ * {@link WifiAwareDiscoverySessionCallback#TERMINATE_REASON_DONE}.
* <p>
* Optional. 0 by default - indicating the session doesn't terminate on its own.
- * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is
+ * Session will be terminated when {@link WifiAwareDiscoveryBaseSession#destroy()} is
* called.
*
* @param ttlSec Lifetime of a subscribe session in seconds.
@@ -401,7 +403,7 @@
* Sets the match style of the subscription - how are matches from a
* single match session (corresponding to the same publish action on the
* peer) reported to the host (using the
- * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])}
+ * {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])}
* ). The options are: only report the first match and ignore the rest
* {@link SubscribeConfig#MATCH_STYLE_FIRST_ONLY} or report every single
* match {@link SubscribeConfig#MATCH_STYLE_ALL} (the default).
@@ -421,7 +423,7 @@
/**
* Configure whether a subscribe terminate notification
- * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} is reported
+ * {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)} is reported
* back to the callback.
*
* @param enable If true the terminate callback will be called when the
diff --git a/wifi/java/android/net/wifi/nan/TlvBufferUtils.java b/wifi/java/android/net/wifi/aware/TlvBufferUtils.java
similarity index 99%
rename from wifi/java/android/net/wifi/nan/TlvBufferUtils.java
rename to wifi/java/android/net/wifi/aware/TlvBufferUtils.java
index 2c5aab4..56c9069 100644
--- a/wifi/java/android/net/wifi/nan/TlvBufferUtils.java
+++ b/wifi/java/android/net/wifi/aware/TlvBufferUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.Nullable;
@@ -32,7 +32,7 @@
* the Type field and the Length field. A Type field size of 0 is allowed -
* allowing usage for LV (no T) array formats.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
public class TlvBufferUtils {
private TlvBufferUtils() {
diff --git a/wifi/java/android/net/wifi/aware/WifiAwareAttachCallback.java b/wifi/java/android/net/wifi/aware/WifiAwareAttachCallback.java
new file mode 100644
index 0000000..2cace61
--- /dev/null
+++ b/wifi/java/android/net/wifi/aware/WifiAwareAttachCallback.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.wifi.aware;
+
+/**
+ * Base class for Aware attach callbacks. Should be extended by applications and set when calling
+ * {@link WifiAwareManager#attach(android.os.Handler, WifiAwareAttachCallback)}. These are callbacks
+ * applying to the Aware connection as a whole - not to specific publish or subscribe sessions -
+ * for that see {@link WifiAwareDiscoverySessionCallback}.
+ *
+ * @hide PROPOSED_AWARE_API
+ */
+public class WifiAwareAttachCallback {
+ /**
+ * Called when Aware attach operation
+ * {@link WifiAwareManager#attach(android.os.Handler, WifiAwareAttachCallback)}
+ * is completed and that we can now start discovery sessions or connections.
+ *
+ * @param session The Aware object on which we can execute further Aware operations - e.g.
+ * discovery, connections.
+ */
+ public void onAttached(WifiAwareSession session) {
+ /* empty */
+ }
+
+ /**
+ * Called when Aware attach operation
+ * {@link WifiAwareManager#attach(android.os.Handler, WifiAwareAttachCallback)} failed.
+ */
+ public void onAttachFailed() {
+ /* empty */
+ }
+}
diff --git a/wifi/java/android/net/wifi/nan/PublishConfig.aidl b/wifi/java/android/net/wifi/aware/WifiAwareCharacteristics.aidl
similarity index 89%
copy from wifi/java/android/net/wifi/nan/PublishConfig.aidl
copy to wifi/java/android/net/wifi/aware/WifiAwareCharacteristics.aidl
index 5f66d16..a35e71d 100644
--- a/wifi/java/android/net/wifi/nan/PublishConfig.aidl
+++ b/wifi/java/android/net/wifi/aware/WifiAwareCharacteristics.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
-parcelable PublishConfig;
+parcelable WifiAwareCharacteristics;
diff --git a/wifi/java/android/net/wifi/nan/WifiNanCharacteristics.java b/wifi/java/android/net/wifi/aware/WifiAwareCharacteristics.java
similarity index 73%
rename from wifi/java/android/net/wifi/nan/WifiNanCharacteristics.java
rename to wifi/java/android/net/wifi/aware/WifiAwareCharacteristics.java
index f43ed4d..6232c14 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanCharacteristics.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareCharacteristics.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
/**
- * The characteristics of the Wi-Fi NAN implementation.
+ * The characteristics of the Wi-Fi Aware implementation.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanCharacteristics implements Parcelable {
+public class WifiAwareCharacteristics implements Parcelable {
/** @hide */
public static final String KEY_MAX_SERVICE_NAME_LENGTH = "key_max_service_name_length";
/** @hide */
@@ -37,41 +37,41 @@
private Bundle mCharacteristics = new Bundle();
/** @hide : should not be created by apps */
- public WifiNanCharacteristics(Bundle characteristics) {
+ public WifiAwareCharacteristics(Bundle characteristics) {
mCharacteristics = characteristics;
}
/**
- * Returns the maximum string length that can be used to specify a NAN service name. Restricts
+ * Returns the maximum string length that can be used to specify a Aware service name. Restricts
* the parameters of the {@link PublishConfig.Builder#setServiceName(String)} and
* {@link SubscribeConfig.Builder#setServiceName(String)}.
*
- * @return A positive integer, maximum string length of NAN service name.
+ * @return A positive integer, maximum string length of Aware service name.
*/
public int getMaxServiceNameLength() {
return mCharacteristics.getInt(KEY_MAX_SERVICE_NAME_LENGTH);
}
/**
- * Returns the maximum length of byte array that can be used to specify a NAN service specific
- * information field: the arbitrary load used in discovery or the message length of NAN
+ * Returns the maximum length of byte array that can be used to specify a Aware service specific
+ * information field: the arbitrary load used in discovery or the message length of Aware
* message exchange. Restricts the parameters of the
* {@link PublishConfig.Builder#setServiceSpecificInfo(byte[])},
* {@link SubscribeConfig.Builder#setServiceSpecificInfo(byte[])}, and
- * {@link WifiNanDiscoveryBaseSession#sendMessage(Object, int, byte[])} variants.
+ * {@link WifiAwareDiscoveryBaseSession#sendMessage(Object, int, byte[])} variants.
*
- * @return A positive integer, maximum length of byte array for NAN messaging.
+ * @return A positive integer, maximum length of byte array for Aware messaging.
*/
public int getMaxServiceSpecificInfoLength() {
return mCharacteristics.getInt(KEY_MAX_SERVICE_SPECIFIC_INFO_LENGTH);
}
/**
- * Returns the maximum length of byte array that can be used to specify a NAN match filter.
+ * Returns the maximum length of byte array that can be used to specify a Aware match filter.
* Restricts the parameters of the {@link PublishConfig.Builder#setMatchFilter(byte[])} and
* {@link SubscribeConfig.Builder#setMatchFilter(byte[])}.
*
- * @return A positive integer, maximum legngth of byte array for NAN discovery match filter.
+ * @return A positive integer, maximum legngth of byte array for Aware discovery match filter.
*/
public int getMaxMatchFilterLength() {
return mCharacteristics.getInt(KEY_MAX_MATCH_FILTER_LENGTH);
@@ -87,17 +87,17 @@
return 0;
}
- public static final Creator<WifiNanCharacteristics> CREATOR =
- new Creator<WifiNanCharacteristics>() {
+ public static final Creator<WifiAwareCharacteristics> CREATOR =
+ new Creator<WifiAwareCharacteristics>() {
@Override
- public WifiNanCharacteristics createFromParcel(Parcel in) {
- WifiNanCharacteristics c = new WifiNanCharacteristics(in.readBundle());
+ public WifiAwareCharacteristics createFromParcel(Parcel in) {
+ WifiAwareCharacteristics c = new WifiAwareCharacteristics(in.readBundle());
return c;
}
@Override
- public WifiNanCharacteristics[] newArray(int size) {
- return new WifiNanCharacteristics[size];
+ public WifiAwareCharacteristics[] newArray(int size) {
+ return new WifiAwareCharacteristics[size];
}
};
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java b/wifi/java/android/net/wifi/aware/WifiAwareDiscoveryBaseSession.java
similarity index 70%
rename from wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java
rename to wifi/java/android/net/wifi/aware/WifiAwareDiscoveryBaseSession.java
index 17e974b..07f7523 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareDiscoveryBaseSession.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -27,30 +27,30 @@
import java.lang.ref.WeakReference;
/**
- * A class representing a single publish or subscribe NAN session. This object
+ * A class representing a single publish or subscribe Aware session. This object
* will not be created directly - only its child classes are available:
- * {@link WifiNanPublishDiscoverySession} and {@link WifiNanSubscribeDiscoverySession}. This
+ * {@link WifiAwarePublishDiscoverySession} and {@link WifiAwareSubscribeDiscoverySession}. This
* class provides functionality common to both publish and subscribe discovery sessions:
* <ul>
* <li>Sending messages: {@link #sendMessage(Object, int, byte[])} or
* {@link #sendMessage(Object, int, byte[], int)} methods.
- * <li>Creating a network-specifier when requesting a NAN connection:
+ * <li>Creating a network-specifier when requesting a Aware connection:
* {@link #createNetworkSpecifier(int, Object, byte[])}.
* </ul>
* The {@link #destroy()} method must be called to destroy discovery sessions once they are
* no longer needed.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanDiscoveryBaseSession {
- private static final String TAG = "WifiNanDiscoveryBaseSsn";
+public class WifiAwareDiscoveryBaseSession {
+ private static final String TAG = "WifiAwareDiscBaseSsn";
private static final boolean DBG = false;
private static final boolean VDBG = false; // STOPSHIP if true
private static final int MAX_SEND_RETRY_COUNT = 5;
/** @hide */
- protected WeakReference<WifiNanManager> mMgr;
+ protected WeakReference<WifiAwareManager> mMgr;
/** @hide */
protected final int mClientId;
/** @hide */
@@ -71,7 +71,7 @@
}
/** @hide */
- public WifiNanDiscoveryBaseSession(WifiNanManager manager, int clientId, int sessionId) {
+ public WifiAwareDiscoveryBaseSession(WifiAwareManager manager, int clientId, int sessionId) {
if (VDBG) {
Log.v(TAG, "New discovery session created: manager=" + manager + ", clientId="
+ clientId + ", sessionId=" + sessionId);
@@ -93,12 +93,12 @@
* This operation must be done on a session which is no longer needed. Otherwise system
* resources will continue to be utilized until the application exits. The only
* exception is a session for which we received a termination callback,
- * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)}.
+ * {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)}.
*/
public void destroy() {
- WifiNanManager mgr = mMgr.get();
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.w(TAG, "destroy: called post GC on WifiNanManager");
+ Log.w(TAG, "destroy: called post GC on WifiAwareManager");
return;
}
mgr.terminateSession(mClientId, mSessionId);
@@ -137,26 +137,26 @@
}
/**
- * Sends a message to the specified destination. NAN messages are transmitted in the context
+ * Sends a message to the specified destination. Aware messages are transmitted in the context
* of a discovery session - executed subsequent to a publish/subscribe
- * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} event.
+ * {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} event.
* <p>
- * NAN messages are not guaranteed delivery. Callbacks on
- * {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully,
- * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed
+ * Aware messages are not guaranteed delivery. Callbacks on
+ * {@link WifiAwareDiscoverySessionCallback} indicate message was transmitted successfully,
+ * {@link WifiAwareDiscoverySessionCallback#onMessageSent(int)}, or transmission failed
* (possibly after several retries) -
- * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int)}.
+ * {@link WifiAwareDiscoverySessionCallback#onMessageSendFailed(int)}.
* <p>
* The peer will get a callback indicating a message was received using
- * {@link WifiNanDiscoverySessionCallback#onMessageReceived(Object, byte[])}.
+ * {@link WifiAwareDiscoverySessionCallback#onMessageReceived(Object, byte[])}.
*
* @param peerHandle The peer's handle for the message. Must be a result of an
- * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])}
+ * {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])}
* or
- * {@link WifiNanDiscoverySessionCallback#onMessageReceived(Object, byte[])} events.
+ * {@link WifiAwareDiscoverySessionCallback#onMessageReceived(Object, byte[])} events.
* @param messageId An arbitrary integer used by the caller to identify the message. The same
* integer ID will be returned in the callbacks indicating message send success or
- * failure. The {@code messageId} is not used internally by the NAN service - it
+ * failure. The {@code messageId} is not used internally by the Aware service - it
* can be arbitrary and non-unique.
* @param message The message to be transmitted.
* @param retryCount An integer specifying how many additional service-level (as opposed to PHY
@@ -170,9 +170,9 @@
Log.w(TAG, "sendMessage: called on terminated session");
return;
} else {
- WifiNanManager mgr = mMgr.get();
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.w(TAG, "sendMessage: called post GC on WifiNanManager");
+ Log.w(TAG, "sendMessage: called post GC on WifiAwareManager");
return;
}
@@ -181,28 +181,28 @@
}
/**
- * Sends a message to the specified destination. NAN messages are transmitted in the context
+ * Sends a message to the specified destination. Aware messages are transmitted in the context
* of a discovery session - executed subsequent to a publish/subscribe
- * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} event.
+ * {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} event.
* <p>
- * NAN messages are not guaranteed delivery. Callbacks on
- * {@link WifiNanDiscoverySessionCallback} indicate message was transmitted successfully,
- * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)}, or transmission failed
+ * Aware messages are not guaranteed delivery. Callbacks on
+ * {@link WifiAwareDiscoverySessionCallback} indicate message was transmitted successfully,
+ * {@link WifiAwareDiscoverySessionCallback#onMessageSent(int)}, or transmission failed
* (possibly after several retries) -
- * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int)}.
+ * {@link WifiAwareDiscoverySessionCallback#onMessageSendFailed(int)}.
* <p>
* The peer will get a callback indicating a message was received using
- * {@link WifiNanDiscoverySessionCallback#onMessageReceived(Object, byte[])}.
+ * {@link WifiAwareDiscoverySessionCallback#onMessageReceived(Object, byte[])}.
* Equivalent to {@link #sendMessage(Object, int, byte[], int)} with a {@code retryCount} of
* 0.
*
* @param peerHandle The peer's handle for the message. Must be a result of an
- * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])}
+ * {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])}
* or
- * {@link WifiNanDiscoverySessionCallback#onMessageReceived(Object, byte[])} events.
+ * {@link WifiAwareDiscoverySessionCallback#onMessageReceived(Object, byte[])} events.
* @param messageId An arbitrary integer used by the caller to identify the message. The same
* integer ID will be returned in the callbacks indicating message send success or
- * failure. The {@code messageId} is not used internally by the NAN service - it
+ * failure. The {@code messageId} is not used internally by the Aware service - it
* can be arbitrary and non-unique.
* @param message The message to be transmitted.
*/
@@ -212,8 +212,8 @@
/**
* Start a ranging operation with the specified peers. The peer IDs are obtained from an
- * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} or
- * {@link WifiNanDiscoverySessionCallback#onMessageReceived(Object, byte[])} operation - can
+ * {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} or
+ * {@link WifiAwareDiscoverySessionCallback#onMessageReceived(Object, byte[])} operation - can
* only range devices which are part of an ongoing discovery session.
*
* @param params RTT parameters - each corresponding to a specific peer ID (the array sizes
@@ -221,16 +221,17 @@
* {@link android.net.wifi.RttManager.RttParams#bssid} member must be set to
* a peer ID - not to a MAC address.
* @param listener The listener to receive the results of the ranging session.
- * @hide PROPOSED_NAN_SYSTEM_API [TODO: b/28847998 - track RTT API & visilibity]
+ * @hide PROPOSED_AWARE_SYSTEM_API
+ * [TODO: b/28847998 - track RTT API & visilibity]
*/
public void startRanging(RttManager.RttParams[] params, RttManager.RttListener listener) {
if (mTerminated) {
Log.w(TAG, "startRanging: called on terminated session");
return;
} else {
- WifiNanManager mgr = mMgr.get();
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.w(TAG, "startRanging: called post GC on WifiNanManager");
+ Log.w(TAG, "startRanging: called post GC on WifiAwareManager");
return;
}
@@ -240,23 +241,23 @@
/**
* Create a {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(String)} for a
- * WiFi NAN connection to the specified peer. The
+ * WiFi Aware connection to the specified peer. The
* {@link android.net.NetworkRequest.Builder#addTransportType(int)} should be set to
- * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_NAN}.
+ * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE}.
* <p>
- * This method should be used when setting up a connection with a peer discovered through NAN
+ * This method should be used when setting up a connection with a peer discovered through Aware
* discovery or communication (in such scenarios the MAC address of the peer is shielded by
- * an opaque peer ID handle). If a NAN connection is needed to a peer discovered using other
+ * an opaque peer ID handle). If a Aware connection is needed to a peer discovered using other
* OOB (out-of-band) mechanism then use the alternative
- * {@link WifiNanSession#createNetworkSpecifier(int, byte[], byte[])} method - which uses the
+ * {@link WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])} method - which uses the
* peer's MAC address.
*
* @param role The role of this device:
- * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_INITIATOR} or
- * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_RESPONDER}
+ * {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_INITIATOR} or
+ * {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_RESPONDER}
* @param peerHandle The peer's handle obtained through
- * {@link WifiNanDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} or
- * {@link WifiNanDiscoverySessionCallback#onMessageReceived(Object, byte[])}. On a RESPONDER
+ * {@link WifiAwareDiscoverySessionCallback#onServiceDiscovered(Object, byte[], byte[])} or
+ * {@link WifiAwareDiscoverySessionCallback#onMessageReceived(Object, byte[])}. On a RESPONDER
* this value is used to gate the acceptance of a connection request from only
* that peer. A RESPONDER may specified a null - indicating that it will accept
* connection requests from any device.
@@ -268,18 +269,19 @@
*
* @return A string to be used to construct
* {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(String)} to pass to
- * {@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest,android.net.ConnectivityManager.NetworkCallback)}
+ * {@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest,
+ * android.net.ConnectivityManager.NetworkCallback)}
* [or other varieties of that API].
*/
- public String createNetworkSpecifier(@WifiNanManager.DataPathRole int role,
+ public String createNetworkSpecifier(@WifiAwareManager.DataPathRole int role,
@Nullable Object peerHandle, @Nullable byte[] token) {
if (mTerminated) {
Log.w(TAG, "createNetworkSpecifier: called on terminated session");
return null;
} else {
- WifiNanManager mgr = mMgr.get();
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.w(TAG, "createNetworkSpecifier: called post GC on WifiNanManager");
+ Log.w(TAG, "createNetworkSpecifier: called post GC on WifiAwareManager");
return null;
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanDiscoverySessionCallback.java b/wifi/java/android/net/wifi/aware/WifiAwareDiscoverySessionCallback.java
similarity index 66%
rename from wifi/java/android/net/wifi/nan/WifiNanDiscoverySessionCallback.java
rename to wifi/java/android/net/wifi/aware/WifiAwareDiscoverySessionCallback.java
index 271f420..9dfa24f 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanDiscoverySessionCallback.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareDiscoverySessionCallback.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -23,18 +23,20 @@
import java.lang.annotation.RetentionPolicy;
/**
- * Base class for NAN session events callbacks. Should be extended by
+ * Base class for Aware session events callbacks. Should be extended by
* applications wanting notifications. The callbacks are set when a
* publish or subscribe session is created using
- * {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
+ * {@link WifiAwareSession#publish(android.os.Handler, PublishConfig,
+ * WifiAwareDiscoverySessionCallback)}
* or
- * {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)} .
+ * {@link WifiAwareSession#subscribe(android.os.Handler, SubscribeConfig,
+ * WifiAwareDiscoverySessionCallback)} .
* <p>
* A single callback is set at session creation - it cannot be replaced.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanDiscoverySessionCallback {
+public class WifiAwareDiscoverySessionCallback {
/** @hide */
@IntDef({
TERMINATE_REASON_DONE, TERMINATE_REASON_FAIL })
@@ -46,7 +48,7 @@
* Indicates that publish or subscribe session is done - all the
* requested operations (per {@link PublishConfig} or
* {@link SubscribeConfig}) have been executed. Failure reason flag for
- * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} callback.
+ * {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)} callback.
*/
public static final int TERMINATE_REASON_DONE = 100;
@@ -54,39 +56,41 @@
* Indicates that publish or subscribe session is terminated due to a
* failure.
* Failure reason flag for
- * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} callback.
+ * {@link WifiAwareDiscoverySessionCallback#onSessionTerminated(int)} callback.
*/
public static final int TERMINATE_REASON_FAIL = 101;
/**
* Called when a publish operation is started successfully in response to a
- * {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
+ * {@link WifiAwareSession#publish(android.os.Handler, PublishConfig,
+ * WifiAwareDiscoverySessionCallback)}
* operation.
*
- * @param session The {@link WifiNanPublishDiscoverySession} used to control the
+ * @param session The {@link WifiAwarePublishDiscoverySession} used to control the
* discovery session.
*/
- public void onPublishStarted(@NonNull WifiNanPublishDiscoverySession session) {
+ public void onPublishStarted(@NonNull WifiAwarePublishDiscoverySession session) {
/* empty */
}
/**
* Called when a subscribe operation is started successfully in response to a
- * {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)}
+ * {@link WifiAwareSession#subscribe(android.os.Handler, SubscribeConfig,
+ * WifiAwareDiscoverySessionCallback)}
* operation.
*
- * @param session The {@link WifiNanSubscribeDiscoverySession} used to control the
+ * @param session The {@link WifiAwareSubscribeDiscoverySession} used to control the
* discovery session.
*/
- public void onSubscribeStarted(@NonNull WifiNanSubscribeDiscoverySession session) {
+ public void onSubscribeStarted(@NonNull WifiAwareSubscribeDiscoverySession session) {
/* empty */
}
/**
* Called when a publish or subscribe discovery session configuration update request
* succeeds. Called in response to
- * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} or
- * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
+ * {@link WifiAwarePublishDiscoverySession#updatePublish(PublishConfig)} or
+ * {@link WifiAwareSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
*/
public void onSessionConfigUpdated() {
/* empty */
@@ -94,12 +98,14 @@
/**
* Called when a publish or subscribe discovery session cannot be created:
- * {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
+ * {@link WifiAwareSession#publish(android.os.Handler, PublishConfig,
+ * WifiAwareDiscoverySessionCallback)}
* or
- * {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)},
+ * {@link WifiAwareSession#subscribe(android.os.Handler, SubscribeConfig,
+ * WifiAwareDiscoverySessionCallback)},
* or when a configuration update fails:
- * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} or
- * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
+ * {@link WifiAwarePublishDiscoverySession#updatePublish(PublishConfig)} or
+ * {@link WifiAwareSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
* <p>
* For discovery session updates failure leaves the session running with its previous
* configuration - the discovery session is not terminated.
@@ -110,12 +116,12 @@
/**
* Called when a discovery session (publish or subscribe) terminates. Termination may be due
- * to user-request (either directly through {@link WifiNanDiscoveryBaseSession#destroy()} or
+ * to user-request (either directly through {@link WifiAwareDiscoveryBaseSession#destroy()} or
* application-specified expiration, e.g. {@link PublishConfig.Builder#setPublishCount(int)}
* or {@link SubscribeConfig.Builder#setTtlSec(int)}) or due to a failure.
*
* @param reason The termination reason using
- * {@code WifiNanDiscoverySessionCallback.TERMINATE_*} codes.
+ * {@code WifiAwareDiscoverySessionCallback.TERMINATE_*} codes.
*/
public void onSessionTerminated(@SessionTerminateCodes int reason) {
/* empty */
@@ -138,12 +144,12 @@
}
/**
- * Called in response to {@link WifiNanDiscoveryBaseSession#sendMessage(Object, int, byte[])}
+ * Called in response to {@link WifiAwareDiscoveryBaseSession#sendMessage(Object, int, byte[])}
* when a message is transmitted successfully - i.e. when it was received successfully by the
* peer (corresponds to an ACK being received).
* <p>
* Note that either this callback or
- * {@link WifiNanDiscoverySessionCallback#onMessageSendFailed(int)} will be
+ * {@link WifiAwareDiscoverySessionCallback#onMessageSendFailed(int)} will be
* received - never both.
*
* @param messageId The arbitrary message ID specified when sending the message.
@@ -154,12 +160,12 @@
/**
* Called when message transmission fails - when no ACK is received from the peer.
- * Retries when ACKs are not received are done by hardware, MAC, and in the NAN stack (using
- * the {@link WifiNanDiscoveryBaseSession#sendMessage(Object, int, byte[], int)} method) - this
- * event is received after all retries are exhausted.
+ * Retries when ACKs are not received are done by hardware, MAC, and in the Aware stack (using
+ * the {@link WifiAwareDiscoveryBaseSession#sendMessage(Object, int, byte[], int)} method) -
+ * this event is received after all retries are exhausted.
* <p>
* Note that either this callback or
- * {@link WifiNanDiscoverySessionCallback#onMessageSent(int)} will be received
+ * {@link WifiAwareDiscoverySessionCallback#onMessageSent(int)} will be received
* - never both.
*
* @param messageId The arbitrary message ID specified when sending the message.
@@ -170,8 +176,8 @@
/**
* Called when a message is received from a discovery session peer - in response to the
- * peer's {@link WifiNanDiscoveryBaseSession#sendMessage(Object, int, byte[])} or
- * {@link WifiNanDiscoveryBaseSession#sendMessage(Object, int, byte[], int)}.
+ * peer's {@link WifiAwareDiscoveryBaseSession#sendMessage(Object, int, byte[])} or
+ * {@link WifiAwareDiscoveryBaseSession#sendMessage(Object, int, byte[], int)}.
*
* @param peerHandle An opaque handle to the peer matching our discovery operation.
* @param message A byte array containing the message.
diff --git a/wifi/java/android/net/wifi/nan/WifiNanIdentityChangedListener.java b/wifi/java/android/net/wifi/aware/WifiAwareIdentityChangedListener.java
similarity index 75%
rename from wifi/java/android/net/wifi/nan/WifiNanIdentityChangedListener.java
rename to wifi/java/android/net/wifi/aware/WifiAwareIdentityChangedListener.java
index 7cb928f..e8f52cd4 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanIdentityChangedListener.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareIdentityChangedListener.java
@@ -14,23 +14,23 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
/**
- * Base class for a listener which is called with the MAC address of the NAN interface whenever
+ * Base class for a listener which is called with the MAC address of the Aware interface whenever
* it is changed. Change may be due to device joining a cluster, starting a cluster, or discovery
* interface change (addresses are randomized at regular intervals). The implication is that
* peers you've been communicating with may no longer recognize you and you need to re-establish
* your identity - e.g. by starting a discovery session. This actual MAC address of the
- * interface may also be useful if the application uses alternative (non-NAN) discovery but needs
- * to set up a NAN connection. The provided NAN discovery interface MAC address can then be used
- * in {@link WifiNanSession#createNetworkSpecifier(int, byte[], byte[])}.
+ * interface may also be useful if the application uses alternative (non-Aware) discovery but needs
+ * to set up a Aware connection. The provided Aware discovery interface MAC address can then be used
+ * in {@link WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])}.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanIdentityChangedListener {
+public class WifiAwareIdentityChangedListener {
/**
- * @param mac The MAC address of the NAN discovery interface. The application must have the
+ * @param mac The MAC address of the Aware discovery interface. The application must have the
* {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} to get the actual MAC address,
* otherwise all 0's will be provided.
*/
diff --git a/wifi/java/android/net/wifi/nan/WifiNanManager.java b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
similarity index 76%
rename from wifi/java/android/net/wifi/nan/WifiNanManager.java
rename to wifi/java/android/net/wifi/aware/WifiAwareManager.java
index 002b953..10b70ab 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanManager.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareManager.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -48,80 +48,86 @@
import java.util.Arrays;
/**
- * This class provides the primary API for managing Wi-Fi NAN operations:
+ * This class provides the primary API for managing Wi-Fi Aware operations:
* discovery and peer-to-peer data connections. Get an instance of this class by calling
* {@link android.content.Context#getSystemService(String)
- * Context.getSystemService(Context.WIFI_NAN_SERVICE)}.
+ * Context.getSystemService(Context.WIFI_AWARE_SERVICE)}.
* <p>
* The class provides access to:
* <ul>
- * <li>Initialize a NAN cluster (peer-to-peer synchronization). Refer to
- * {@link #attach(Handler, WifiNanAttachCallback)}.
+ * <li>Initialize a Aware cluster (peer-to-peer synchronization). Refer to
+ * {@link #attach(Handler, WifiAwareAttachCallback)}.
* <li>Create discovery sessions (publish or subscribe sessions). Refer to
- * {@link WifiNanSession#publish(Handler, PublishConfig, WifiNanDiscoverySessionCallback)} and
- * {@link WifiNanSession#subscribe(Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)}.
- * <li>Create a NAN network specifier to be used with
+ * {@link WifiAwareSession#publish(Handler, PublishConfig, WifiAwareDiscoverySessionCallback)} and
+ * {@link WifiAwareSession#subscribe(Handler, SubscribeConfig, WifiAwareDiscoverySessionCallback)}.
+ * <li>Create a Aware network specifier to be used with
* {@link ConnectivityManager#requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback)}
- * to set-up a NAN connection with a peer. Refer to
- * {@link WifiNanDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])} and
- * {@link WifiNanSession#createNetworkSpecifier(int, byte[], byte[])}.
+ * to set-up a Aware connection with a peer. Refer to
+ * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])} and
+ * {@link WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])}.
* </ul>
* <p>
- * NAN may not be usable when Wi-Fi is disabled (and other conditions). To validate that
+ * Aware may not be usable when Wi-Fi is disabled (and other conditions). To validate that
* the functionality is available use the {@link #isAvailable()} function. To track
- * changes in NAN usability register for the {@link #ACTION_WIFI_NAN_STATE_CHANGED} broadcast.
- * Note that this broadcast is not sticky - you should register for it and then check the
- * above API to avoid a race condition.
+ * changes in Aware usability register for the {@link #ACTION_WIFI_AWARE_STATE_CHANGED}
+ * broadcast. Note that this broadcast is not sticky - you should register for it and then
+ * check the above API to avoid a race condition.
* <p>
- * An application must use {@link #attach(Handler, WifiNanAttachCallback)} to initialize a NAN
- * cluster - before making any other NAN operation. NAN cluster membership is a device-wide
- * operation - the API guarantees that the device is in a cluster or joins a NAN cluster (or
- * starts one if none can be found). Information about attach success (or failure) are
- * returned in callbacks of {@link WifiNanAttachCallback}. Proceed with NAN discovery or
- * connection setup only after receiving confirmation that NAN attach succeeded -
- * {@link WifiNanAttachCallback#onAttached(WifiNanSession)}. When an application is
- * finished using NAN it <b>must</b> use the {@link WifiNanSession#destroy()} API
- * to indicate to the NAN service that the device may detach from the NAN cluster. The
- * device will actually disable NAN once the last application detaches.
+ * An application must use {@link #attach(Handler, WifiAwareAttachCallback)} to initialize a
+ * Aware cluster - before making any other Aware operation. Aware cluster membership is a
+ * device-wide operation - the API guarantees that the device is in a cluster or joins a
+ * Aware cluster (or starts one if none can be found). Information about attach success (or
+ * failure) are returned in callbacks of {@link WifiAwareAttachCallback}. Proceed with Aware
+ * discovery or connection setup only after receiving confirmation that Aware attach
+ * succeeded - {@link WifiAwareAttachCallback#onAttached(WifiAwareSession)}. When an
+ * application is finished using Aware it <b>must</b> use the
+ * {@link WifiAwareSession#destroy()} API to indicate to the Aware service that the device
+ * may detach from the Aware cluster. The device will actually disable Aware once the last
+ * application detaches.
* <p>
- * Once a NAN attach is confirmed use the
- * {@link WifiNanSession#publish(Handler, PublishConfig, WifiNanDiscoverySessionCallback)} or
- * {@link WifiNanSession#subscribe(Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)}
- * to create publish or subscribe NAN discovery sessions. Events are called on the provided
- * callback object {@link WifiNanDiscoverySessionCallback}. Specifically, the
- * {@link WifiNanDiscoverySessionCallback#onPublishStarted(WifiNanPublishDiscoverySession)}
+ * Once a Aware attach is confirmed use the
+ * {@link WifiAwareSession#publish(Handler, PublishConfig, WifiAwareDiscoverySessionCallback)}
+ * or
+ * {@link WifiAwareSession#subscribe(Handler, SubscribeConfig,
+ * WifiAwareDiscoverySessionCallback)}
+ * to create publish or subscribe Aware discovery sessions. Events are called on the provided
+ * callback object {@link WifiAwareDiscoverySessionCallback}. Specifically, the
+ * {@link WifiAwareDiscoverySessionCallback#onPublishStarted(WifiAwarePublishDiscoverySession)}
* and
- * {@link WifiNanDiscoverySessionCallback#onSubscribeStarted(WifiNanSubscribeDiscoverySession)}
- * return {@link WifiNanPublishDiscoverySession} and {@link WifiNanSubscribeDiscoverySession}
+ * {@link WifiAwareDiscoverySessionCallback#onSubscribeStarted(
+ * WifiAwareSubscribeDiscoverySession)}
+ * return {@link WifiAwarePublishDiscoverySession} and
+ * {@link WifiAwareSubscribeDiscoverySession}
* objects respectively on which additional session operations can be performed, e.g. updating
- * the session {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)} and
- * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. Sessions can also
- * be used to send messages using the
- * {@link WifiNanDiscoveryBaseSession#sendMessage(Object, int, byte[])} APIs. When an
+ * the session {@link WifiAwarePublishDiscoverySession#updatePublish(PublishConfig)} and
+ * {@link WifiAwareSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}. Sessions can
+ * also be used to send messages using the
+ * {@link WifiAwareDiscoveryBaseSession#sendMessage(Object, int, byte[])} APIs. When an
* application is finished with a discovery session it <b>must</b> terminate it using the
- * {@link WifiNanDiscoveryBaseSession#destroy()} API.
+ * {@link WifiAwareDiscoveryBaseSession#destroy()} API.
* <p>
- * Creating connections between NAN devices is managed by the standard
- * {@link ConnectivityManager#requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback)}.
+ * Creating connections between Aware devices is managed by the standard
+ * {@link ConnectivityManager#requestNetwork(NetworkRequest,
+ * ConnectivityManager.NetworkCallback)}.
* The {@link NetworkRequest} object should be constructed with:
* <ul>
* <li>{@link NetworkRequest.Builder#addTransportType(int)} of
- * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_NAN}.
+ * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE}.
* <li>{@link NetworkRequest.Builder#setNetworkSpecifier(String)} using
- * {@link WifiNanSession#createNetworkSpecifier(int, byte[], byte[])} or
- * {@link WifiNanDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])}.
+ * {@link WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])} or
+ * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])}.
* </ul>
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanManager {
- private static final String TAG = "WifiNanManager";
+public class WifiAwareManager {
+ private static final String TAG = "WifiAwareManager";
private static final boolean DBG = false;
private static final boolean VDBG = false; // STOPSHIP if true
/**
- * Keys used to generate a Network Specifier for the NAN network request. The network specifier
- * is formatted as a JSON string.
+ * Keys used to generate a Network Specifier for the Aware network request. The network
+ * specifier is formatted as a JSON string.
*/
/**
@@ -197,44 +203,44 @@
public static final String NETWORK_SPECIFIER_KEY_TOKEN = "token";
/**
- * Broadcast intent action to indicate that the state of Wi-Fi NAN availability has changed.
+ * Broadcast intent action to indicate that the state of Wi-Fi Aware availability has changed.
* Use the {@link #isAvailable()} to query the current status.
* This broadcast is <b>not</b> sticky, use the {@link #isAvailable()} API after registering
- * the broadcast to check the current state of Wi-Fi NAN.
+ * the broadcast to check the current state of Wi-Fi Aware.
* <p>Note: The broadcast is only delivered to registered receivers - no manifest registered
* components will be launched.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
- public static final String ACTION_WIFI_NAN_STATE_CHANGED =
- "android.net.wifi.nan.action.WIFI_NAN_STATE_CHANGED";
+ public static final String ACTION_WIFI_AWARE_STATE_CHANGED =
+ "android.net.wifi.aware.action.WIFI_AWARE_STATE_CHANGED";
/** @hide */
@IntDef({
- WIFI_NAN_DATA_PATH_ROLE_INITIATOR, WIFI_NAN_DATA_PATH_ROLE_RESPONDER})
+ WIFI_AWARE_DATA_PATH_ROLE_INITIATOR, WIFI_AWARE_DATA_PATH_ROLE_RESPONDER})
@Retention(RetentionPolicy.SOURCE)
public @interface DataPathRole {
}
/**
* Connection creation role is that of INITIATOR. Used to create a network specifier string
- * when requesting a NAN network.
+ * when requesting a Aware network.
*
- * @see WifiNanDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])
- * @see WifiNanSession#createNetworkSpecifier(int, byte[], byte[])
+ * @see WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])
+ * @see WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])
*/
- public static final int WIFI_NAN_DATA_PATH_ROLE_INITIATOR = 0;
+ public static final int WIFI_AWARE_DATA_PATH_ROLE_INITIATOR = 0;
/**
* Connection creation role is that of RESPONDER. Used to create a network specifier string
- * when requesting a NAN network.
+ * when requesting a Aware network.
*
- * @see WifiNanDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])
- * @see WifiNanSession#createNetworkSpecifier(int, byte[], byte[])
+ * @see WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])
+ * @see WifiAwareSession#createNetworkSpecifier(int, byte[], byte[])
*/
- public static final int WIFI_NAN_DATA_PATH_ROLE_RESPONDER = 1;
+ public static final int WIFI_AWARE_DATA_PATH_ROLE_RESPONDER = 1;
private final Context mContext;
- private final IWifiNanManager mService;
+ private final IWifiAwareManager mService;
private final Object mLock = new Object(); // lock access to the following vars
@@ -242,14 +248,14 @@
private SparseArray<RttManager.RttListener> mRangingListeners = new SparseArray<>();
/** @hide */
- public WifiNanManager(Context context, IWifiNanManager service) {
+ public WifiAwareManager(Context context, IWifiAwareManager service) {
mContext = context;
mService = service;
}
/**
- * Enable the usage of the NAN API. Doesn't actually turn on NAN cluster formation - that
- * only happens when an attach is attempted. {@link #ACTION_WIFI_NAN_STATE_CHANGED} broadcast
+ * Enable the usage of the Aware API. Doesn't actually turn on Aware cluster formation - that
+ * only happens when an attach is attempted. {@link #ACTION_WIFI_AWARE_STATE_CHANGED} broadcast
* will be triggered.
*
* @hide
@@ -263,9 +269,9 @@
}
/**
- * Disable the usage of the NAN API. All attempts to attach() will be rejected. All open
- * connections and sessions will be terminated. {@link #ACTION_WIFI_NAN_STATE_CHANGED} broadcast
- * will be triggered.
+ * Disable the usage of the Aware API. All attempts to attach() will be rejected. All open
+ * connections and sessions will be terminated. {@link #ACTION_WIFI_AWARE_STATE_CHANGED}
+ * broadcast will be triggered.
*
* @hide
*/
@@ -278,10 +284,11 @@
}
/**
- * Returns the current status of NAN API: whether or not NAN is available. To track changes
- * in the state of NAN API register for the {@link #ACTION_WIFI_NAN_STATE_CHANGED} broadcast.
+ * Returns the current status of Aware API: whether or not Aware is available. To track
+ * changes in the state of Aware API register for the
+ * {@link #ACTION_WIFI_AWARE_STATE_CHANGED} broadcast.
*
- * @return A boolean indicating whether the app can use the NAN API at this time (true) or
+ * @return A boolean indicating whether the app can use the Aware API at this time (true) or
* not (false).
*/
public boolean isAvailable() {
@@ -293,12 +300,13 @@
}
/**
- * Returns the characteristics of the Wi-Fi NAN interface: a set of parameters which specify
+ * Returns the characteristics of the Wi-Fi Aware interface: a set of parameters which specify
* limitations on configurations, e.g. the maximum service name length.
*
- * @return An object specifying configuration limitations of NAN.
+ * @return An object specifying configuration limitations of Aware.
+ * @hide PROPOSED_AWARE_API
*/
- public WifiNanCharacteristics getCharacteristics() {
+ public WifiAwareCharacteristics getCharacteristics() {
try {
return mService.getCharacteristics();
} catch (RemoteException e) {
@@ -307,14 +315,14 @@
}
/**
- * Attach to the Wi-Fi NAN service - enabling the application to create discovery sessions or
+ * Attach to the Wi-Fi Aware service - enabling the application to create discovery sessions or
* create connections to peers. The device will attach to an existing cluster if it can find
- * one or create a new cluster (if it is the first to enable NAN in its vicinity). Results
+ * one or create a new cluster (if it is the first to enable Aware in its vicinity). Results
* (e.g. successful attach to a cluster) are provided to the {@code attachCallback} object.
- * An application <b>must</b> call {@link WifiNanSession#destroy()} when done with the
- * Wi-Fi NAN object.
+ * An application <b>must</b> call {@link WifiAwareSession#destroy()} when done with the
+ * Wi-Fi Aware object.
* <p>
- * Note: a NAN cluster is a shared resource - if the device is already attached to a cluster
+ * Note: a Aware cluster is a shared resource - if the device is already attached to a cluster
* then this function will simply indicate success immediately using the same {@code
* attachCallback}.
*
@@ -322,29 +330,29 @@
* attachCallback} object. If a null is provided then the application's main thread will be
* used.
* @param attachCallback A callback for attach events, extended from
- * {@link WifiNanAttachCallback}.
+ * {@link WifiAwareAttachCallback}.
*/
- public void attach(@Nullable Handler handler, @NonNull WifiNanAttachCallback attachCallback) {
+ public void attach(@Nullable Handler handler, @NonNull WifiAwareAttachCallback attachCallback) {
attach(handler, null, attachCallback, null);
}
/**
- * Attach to the Wi-Fi NAN service - enabling the application to create discovery sessions or
+ * Attach to the Wi-Fi Aware service - enabling the application to create discovery sessions or
* create connections to peers. The device will attach to an existing cluster if it can find
- * one or create a new cluster (if it is the first to enable NAN in its vicinity). Results
+ * one or create a new cluster (if it is the first to enable Aware in its vicinity). Results
* (e.g. successful attach to a cluster) are provided to the {@code attachCallback} object.
- * An application <b>must</b> call {@link WifiNanSession#destroy()} when done with the
- * Wi-Fi NAN object.
+ * An application <b>must</b> call {@link WifiAwareSession#destroy()} when done with the
+ * Wi-Fi Aware object.
* <p>
- * Note: a NAN cluster is a shared resource - if the device is already attached to a cluster
+ * Note: a Aware cluster is a shared resource - if the device is already attached to a cluster
* then this function will simply indicate success immediately using the same {@code
* attachCallback}.
* <p>
- * This version of the API attaches a listener to receive the MAC address of the NAN interface
+ * This version of the API attaches a listener to receive the MAC address of the Aware interface
* on startup and whenever it is updated (it is randomized at regular intervals for privacy).
* The application must have the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
* permission to execute this attach request. Otherwise, use the
- * {@link #attach(Handler, WifiNanAttachCallback)} version. Note that aside from permission
+ * {@link #attach(Handler, WifiAwareAttachCallback)} version. Note that aside from permission
* requirements this listener will wake up the host at regular intervals causing higher power
* consumption, do not use it unless the information is necessary (e.g. for OOB discovery).
*
@@ -352,19 +360,19 @@
* attachCallback} and {@code identityChangedListener} objects. If a null is provided then the
* application's main thread will be used.
* @param attachCallback A callback for attach events, extended from
- * {@link WifiNanAttachCallback}.
+ * {@link WifiAwareAttachCallback}.
* @param identityChangedListener A listener for changed identity, extended from
- * {@link WifiNanIdentityChangedListener}.
+ * {@link WifiAwareIdentityChangedListener}.
*/
- public void attach(@Nullable Handler handler, @NonNull WifiNanAttachCallback attachCallback,
- @NonNull WifiNanIdentityChangedListener identityChangedListener) {
+ public void attach(@Nullable Handler handler, @NonNull WifiAwareAttachCallback attachCallback,
+ @NonNull WifiAwareIdentityChangedListener identityChangedListener) {
attach(handler, null, attachCallback, identityChangedListener);
}
/** @hide */
public void attach(Handler handler, ConfigRequest configRequest,
- WifiNanAttachCallback attachCallback,
- WifiNanIdentityChangedListener identityChangedListener) {
+ WifiAwareAttachCallback attachCallback,
+ WifiAwareIdentityChangedListener identityChangedListener) {
if (VDBG) {
Log.v(TAG, "attach(): handler=" + handler + ", callback=" + attachCallback
+ ", configRequest=" + configRequest + ", identityChangedListener="
@@ -377,7 +385,7 @@
try {
Binder binder = new Binder();
mService.connect(binder, mContext.getOpPackageName(),
- new WifiNanEventCallbackProxy(this, looper, binder, attachCallback,
+ new WifiAwareEventCallbackProxy(this, looper, binder, attachCallback,
identityChangedListener), configRequest,
identityChangedListener != null);
} catch (RemoteException e) {
@@ -399,12 +407,12 @@
/** @hide */
public void publish(int clientId, Looper looper, PublishConfig publishConfig,
- WifiNanDiscoverySessionCallback callback) {
+ WifiAwareDiscoverySessionCallback callback) {
if (VDBG) Log.v(TAG, "publish(): clientId=" + clientId + ", config=" + publishConfig);
try {
mService.publish(clientId, publishConfig,
- new WifiNanDiscoverySessionCallbackProxy(this, looper, true, callback,
+ new WifiAwareDiscoverySessionCallbackProxy(this, looper, true, callback,
clientId));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -427,7 +435,7 @@
/** @hide */
public void subscribe(int clientId, Looper looper, SubscribeConfig subscribeConfig,
- WifiNanDiscoverySessionCallback callback) {
+ WifiAwareDiscoverySessionCallback callback) {
if (VDBG) {
if (VDBG) {
Log.v(TAG,
@@ -437,7 +445,7 @@
try {
mService.subscribe(clientId, subscribeConfig,
- new WifiNanDiscoverySessionCallbackProxy(this, looper, false, callback,
+ new WifiAwareDiscoverySessionCallbackProxy(this, looper, false, callback,
clientId));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -535,13 +543,13 @@
type = NETWORK_SPECIFIER_TYPE_1D;
}
- if (role != WIFI_NAN_DATA_PATH_ROLE_INITIATOR
- && role != WIFI_NAN_DATA_PATH_ROLE_RESPONDER) {
+ if (role != WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
+ && role != WIFI_AWARE_DATA_PATH_ROLE_RESPONDER) {
throw new IllegalArgumentException(
"createNetworkSpecifier: Invalid 'role' argument when creating a network "
+ "specifier");
}
- if (role == WIFI_NAN_DATA_PATH_ROLE_INITIATOR) {
+ if (role == WIFI_AWARE_DATA_PATH_ROLE_INITIATOR) {
if (token == null) {
throw new IllegalArgumentException(
"createNetworkSpecifier: Invalid null token - not permitted on INITIATOR");
@@ -592,13 +600,13 @@
type = NETWORK_SPECIFIER_TYPE_2D;
}
- if (role != WIFI_NAN_DATA_PATH_ROLE_INITIATOR
- && role != WIFI_NAN_DATA_PATH_ROLE_RESPONDER) {
+ if (role != WIFI_AWARE_DATA_PATH_ROLE_INITIATOR
+ && role != WIFI_AWARE_DATA_PATH_ROLE_RESPONDER) {
throw new IllegalArgumentException(
"createNetworkSpecifier: Invalid 'role' argument when creating a network "
+ "specifier");
}
- if (role == WIFI_NAN_DATA_PATH_ROLE_INITIATOR) {
+ if (role == WIFI_AWARE_DATA_PATH_ROLE_INITIATOR) {
if (peer == null || peer.length != 6) {
throw new IllegalArgumentException(
"createNetworkSpecifier: Invalid peer MAC address");
@@ -634,7 +642,7 @@
return json.toString();
}
- private static class WifiNanEventCallbackProxy extends IWifiNanEventCallback.Stub {
+ private static class WifiAwareEventCallbackProxy extends IWifiAwareEventCallback.Stub {
private static final int CALLBACK_CONNECT_SUCCESS = 0;
private static final int CALLBACK_CONNECT_FAIL = 1;
private static final int CALLBACK_IDENTITY_CHANGED = 2;
@@ -643,12 +651,12 @@
private static final int CALLBACK_RANGING_ABORTED = 5;
private final Handler mHandler;
- private final WeakReference<WifiNanManager> mNanManager;
+ private final WeakReference<WifiAwareManager> mAwareManager;
private final Binder mBinder;
private final Looper mLooper;
RttManager.RttListener getAndRemoveRangingListener(int rangingId) {
- WifiNanManager mgr = mNanManager.get();
+ WifiAwareManager mgr = mAwareManager.get();
if (mgr == null) {
Log.w(TAG, "getAndRemoveRangingListener: called post GC");
return null;
@@ -662,39 +670,40 @@
}
/**
- * Constructs a {@link WifiNanAttachCallback} using the specified looper.
+ * Constructs a {@link WifiAwareAttachCallback} using the specified looper.
* All callbacks will delivered on the thread of the specified looper.
*
* @param looper The looper on which to execute the callbacks.
*/
- WifiNanEventCallbackProxy(WifiNanManager mgr, Looper looper, Binder binder,
- final WifiNanAttachCallback attachCallback,
- final WifiNanIdentityChangedListener identityChangedListener) {
- mNanManager = new WeakReference<>(mgr);
+ WifiAwareEventCallbackProxy(WifiAwareManager mgr, Looper looper, Binder binder,
+ final WifiAwareAttachCallback attachCallback,
+ final WifiAwareIdentityChangedListener identityChangedListener) {
+ mAwareManager = new WeakReference<>(mgr);
mLooper = looper;
mBinder = binder;
- if (VDBG) Log.v(TAG, "WifiNanEventCallbackProxy ctor: looper=" + looper);
+ if (VDBG) Log.v(TAG, "WifiAwareEventCallbackProxy ctor: looper=" + looper);
mHandler = new Handler(looper) {
@Override
public void handleMessage(Message msg) {
if (DBG) {
- Log.d(TAG, "WifiNanEventCallbackProxy: What=" + msg.what + ", msg=" + msg);
+ Log.d(TAG, "WifiAwareEventCallbackProxy: What=" + msg.what + ", msg="
+ + msg);
}
- WifiNanManager mgr = mNanManager.get();
+ WifiAwareManager mgr = mAwareManager.get();
if (mgr == null) {
- Log.w(TAG, "WifiNanEventCallbackProxy: handleMessage post GC");
+ Log.w(TAG, "WifiAwareEventCallbackProxy: handleMessage post GC");
return;
}
switch (msg.what) {
case CALLBACK_CONNECT_SUCCESS:
attachCallback.onAttached(
- new WifiNanSession(mgr, mBinder, msg.arg1));
+ new WifiAwareSession(mgr, mBinder, msg.arg1));
break;
case CALLBACK_CONNECT_FAIL:
- mNanManager.clear();
+ mAwareManager.clear();
attachCallback.onAttachFailed();
break;
case CALLBACK_IDENTITY_CHANGED:
@@ -801,8 +810,8 @@
}
}
- private static class WifiNanDiscoverySessionCallbackProxy extends
- IWifiNanDiscoverySessionCallback.Stub {
+ private static class WifiAwareDiscoverySessionCallbackProxy extends
+ IWifiAwareDiscoverySessionCallback.Stub {
private static final int CALLBACK_SESSION_STARTED = 0;
private static final int CALLBACK_SESSION_CONFIG_SUCCESS = 1;
private static final int CALLBACK_SESSION_CONFIG_FAIL = 2;
@@ -815,23 +824,24 @@
private static final String MESSAGE_BUNDLE_KEY_MESSAGE = "message";
private static final String MESSAGE_BUNDLE_KEY_MESSAGE2 = "message2";
- private final WeakReference<WifiNanManager> mNanManager;
+ private final WeakReference<WifiAwareManager> mAwareManager;
private final boolean mIsPublish;
- private final WifiNanDiscoverySessionCallback mOriginalCallback;
+ private final WifiAwareDiscoverySessionCallback mOriginalCallback;
private final int mClientId;
private final Handler mHandler;
- private WifiNanDiscoveryBaseSession mSession;
+ private WifiAwareDiscoveryBaseSession mSession;
- WifiNanDiscoverySessionCallbackProxy(WifiNanManager mgr, Looper looper, boolean isPublish,
- WifiNanDiscoverySessionCallback originalCallback, int clientId) {
- mNanManager = new WeakReference<>(mgr);
+ WifiAwareDiscoverySessionCallbackProxy(WifiAwareManager mgr, Looper looper,
+ boolean isPublish, WifiAwareDiscoverySessionCallback originalCallback,
+ int clientId) {
+ mAwareManager = new WeakReference<>(mgr);
mIsPublish = isPublish;
mOriginalCallback = originalCallback;
mClientId = clientId;
if (VDBG) {
- Log.v(TAG, "WifiNanDiscoverySessionCallbackProxy ctor: isPublish=" + isPublish);
+ Log.v(TAG, "WifiAwareDiscoverySessionCallbackProxy ctor: isPublish=" + isPublish);
}
mHandler = new Handler(looper) {
@@ -839,8 +849,8 @@
public void handleMessage(Message msg) {
if (DBG) Log.d(TAG, "What=" + msg.what + ", msg=" + msg);
- if (mNanManager.get() == null) {
- Log.w(TAG, "WifiNanDiscoverySessionCallbackProxy: handleMessage post GC");
+ if (mAwareManager.get() == null) {
+ Log.w(TAG, "WifiAwareDiscoverySessionCallbackProxy: handleMessage post GC");
return;
}
@@ -858,7 +868,7 @@
* creation failed (as opposed to update
* failing)
*/
- mNanManager.clear();
+ mAwareManager.clear();
}
break;
case CALLBACK_SESSION_TERMINATED:
@@ -977,20 +987,20 @@
"onSessionStarted: sessionId=" + sessionId + ": session already created!?");
}
- WifiNanManager mgr = mNanManager.get();
+ WifiAwareManager mgr = mAwareManager.get();
if (mgr == null) {
Log.w(TAG, "onProxySessionStarted: mgr GC'd");
return;
}
if (mIsPublish) {
- WifiNanPublishDiscoverySession session = new WifiNanPublishDiscoverySession(mgr,
+ WifiAwarePublishDiscoverySession session = new WifiAwarePublishDiscoverySession(mgr,
mClientId, sessionId);
mSession = session;
mOriginalCallback.onPublishStarted(session);
} else {
- WifiNanSubscribeDiscoverySession
- session = new WifiNanSubscribeDiscoverySession(mgr, mClientId, sessionId);
+ WifiAwareSubscribeDiscoverySession
+ session = new WifiAwareSubscribeDiscoverySession(mgr, mClientId, sessionId);
mSession = session;
mOriginalCallback.onSubscribeStarted(session);
}
@@ -1004,7 +1014,7 @@
} else {
Log.w(TAG, "Proxy: onSessionTerminated called but mSession is null!?");
}
- mNanManager.clear();
+ mAwareManager.clear();
mOriginalCallback.onSessionTerminated(reason);
}
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanPublishDiscoverySession.java b/wifi/java/android/net/wifi/aware/WifiAwarePublishDiscoverySession.java
similarity index 65%
rename from wifi/java/android/net/wifi/nan/WifiNanPublishDiscoverySession.java
rename to wifi/java/android/net/wifi/aware/WifiAwarePublishDiscoverySession.java
index 75c6cb7..610a92c 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanPublishDiscoverySession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwarePublishDiscoverySession.java
@@ -14,39 +14,40 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.NonNull;
import android.util.Log;
/**
- * A class representing a NAN publish session. Created when
- * {@link WifiNanSession#publish(android.os.Handler, PublishConfig, WifiNanDiscoverySessionCallback)}
+ * A class representing a Aware publish session. Created when
+ * {@link WifiAwareSession#publish(android.os.Handler, PublishConfig,
+ * WifiAwareDiscoverySessionCallback)}
* is called and a discovery session is created and returned in
- * {@link WifiNanDiscoverySessionCallback#onPublishStarted(WifiNanPublishDiscoverySession)}. See
- * baseline functionality of all discovery sessions in {@link WifiNanDiscoveryBaseSession}. This
+ * {@link WifiAwareDiscoverySessionCallback#onPublishStarted(WifiAwarePublishDiscoverySession)}. See
+ * baseline functionality of all discovery sessions in {@link WifiAwareDiscoveryBaseSession}. This
* object allows updating an existing/running publish discovery session using
* {@link #updatePublish(PublishConfig)}.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanPublishDiscoverySession extends WifiNanDiscoveryBaseSession {
- private static final String TAG = "WifiNanPublishDiscSsn";
+public class WifiAwarePublishDiscoverySession extends WifiAwareDiscoveryBaseSession {
+ private static final String TAG = "WifiAwarePublishDiscSsn";
/** @hide */
- public WifiNanPublishDiscoverySession(WifiNanManager manager, int clientId, int sessionId) {
+ public WifiAwarePublishDiscoverySession(WifiAwareManager manager, int clientId, int sessionId) {
super(manager, clientId, sessionId);
}
/**
* Re-configure the currently active publish session. The
- * {@link WifiNanDiscoverySessionCallback} is not replaced - the same listener used
+ * {@link WifiAwareDiscoverySessionCallback} is not replaced - the same listener used
* at creation is still used. The results of the configuration are returned using
- * {@link WifiNanDiscoverySessionCallback}:
+ * {@link WifiAwareDiscoverySessionCallback}:
* <ul>
- * <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigUpdated()}: configuration
+ * <li>{@link WifiAwareDiscoverySessionCallback#onSessionConfigUpdated()}: configuration
* update succeeded.
- * <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()}: configuration
+ * <li>{@link WifiAwareDiscoverySessionCallback#onSessionConfigFailed()}: configuration
* update failed. The publish discovery session is still running using its previous
* configuration (i.e. update failure does not terminate the session).
* </ul>
@@ -58,9 +59,9 @@
Log.w(TAG, "updatePublish: called on terminated session");
return;
} else {
- WifiNanManager mgr = mMgr.get();
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.w(TAG, "updatePublish: called post GC on WifiNanManager");
+ Log.w(TAG, "updatePublish: called post GC on WifiAwareManager");
return;
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanSession.java b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
similarity index 66%
rename from wifi/java/android/net/wifi/nan/WifiNanSession.java
rename to wifi/java/android/net/wifi/aware/WifiAwareSession.java
index df5e3c1..357bd43 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanSession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareSession.java
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.net.NetworkRequest;
import android.os.Binder;
import android.os.Handler;
import android.os.Looper;
@@ -29,17 +28,17 @@
import java.lang.ref.WeakReference;
/**
- * This class represents a Wi-Fi NAN session - an attachment to the Wi-Fi NAN service through
+ * This class represents a Wi-Fi Aware session - an attachment to the Wi-Fi Aware service through
* which the app can execute discovery operations.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanSession {
- private static final String TAG = "WifiNanSession";
+public class WifiAwareSession {
+ private static final String TAG = "WifiAwareSession";
private static final boolean DBG = false;
private static final boolean VDBG = false; // STOPSHIP if true
- private final WeakReference<WifiNanManager> mMgr;
+ private final WeakReference<WifiAwareManager> mMgr;
private final Binder mBinder;
private final int mClientId;
@@ -47,7 +46,7 @@
private final CloseGuard mCloseGuard = CloseGuard.get();
/** @hide */
- public WifiNanSession(WifiNanManager manager, Binder binder, int clientId) {
+ public WifiAwareSession(WifiAwareManager manager, Binder binder, int clientId) {
if (VDBG) Log.v(TAG, "New session created: manager=" + manager + ", clientId=" + clientId);
mMgr = new WeakReference<>(manager);
@@ -59,19 +58,19 @@
}
/**
- * Destroy the Wi-Fi NAN service session and, if no other applications are attached to NAN,
- * also disable NAN. This method destroys all outstanding operations - i.e. all publish and
+ * Destroy the Wi-Fi Aware service session and, if no other applications are attached to Aware,
+ * also disable Aware. This method destroys all outstanding operations - i.e. all publish and
* subscribes are terminated, and any outstanding data-links are shut-down. However, it is
* good practice to destroy these discovery sessions and connections explicitly before a
* session-wide destroy.
* <p>
* An application may re-attach after a destroy using
- * {@link WifiNanManager#attach(Handler, WifiNanAttachCallback)} .
+ * {@link WifiAwareManager#attach(Handler, WifiAwareAttachCallback)} .
*/
public void destroy() {
- WifiNanManager mgr = mMgr.get();
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.w(TAG, "destroy: called post GC on WifiNanManager");
+ Log.w(TAG, "destroy: called post GC on WifiAwareManager");
return;
}
mgr.disconnect(mClientId, mBinder);
@@ -94,23 +93,24 @@
}
/**
- * Issue a request to the NAN service to create a new NAN publish discovery session, using
+ * Issue a request to the Aware service to create a new Aware publish discovery session, using
* the specified {@code publishConfig} configuration. The results of the publish operation
- * are routed to the callbacks of {@link WifiNanDiscoverySessionCallback}:
+ * are routed to the callbacks of {@link WifiAwareDiscoverySessionCallback}:
* <ul>
* <li>
- * {@link WifiNanDiscoverySessionCallback#onPublishStarted(WifiNanPublishDiscoverySession)}
+ * {@link WifiAwareDiscoverySessionCallback#onPublishStarted(
+ * WifiAwarePublishDiscoverySession)}
* is called when the publish session is created and provides a handle to the session.
* Further operations on the publish session can be executed on that object.
- * <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()} is called if the
+ * <li>{@link WifiAwareDiscoverySessionCallback#onSessionConfigFailed()} is called if the
* publish operation failed.
* </ul>
* <p>
* Other results of the publish session operations will also be routed to callbacks
* on the {@code callback} object. The resulting publish session can be modified using
- * {@link WifiNanPublishDiscoverySession#updatePublish(PublishConfig)}.
+ * {@link WifiAwarePublishDiscoverySession#updatePublish(PublishConfig)}.
* <p>
- * An application must use the {@link WifiNanDiscoveryBaseSession#destroy()} to
+ * An application must use the {@link WifiAwareDiscoveryBaseSession#destroy()} to
* terminate the publish discovery session once it isn't needed. This will free
* resources as well terminate any on-air transmissions.
* <p>The application must have the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
@@ -120,14 +120,14 @@
* callback} object. If a null is provided then the application's main thread will be used.
* @param publishConfig The {@link PublishConfig} specifying the
* configuration of the requested publish session.
- * @param callback A {@link WifiNanDiscoverySessionCallback} derived object to be used for
+ * @param callback A {@link WifiAwareDiscoverySessionCallback} derived object to be used for
* session event callbacks.
*/
public void publish(@Nullable Handler handler, @NonNull PublishConfig publishConfig,
- @NonNull WifiNanDiscoverySessionCallback callback) {
- WifiNanManager mgr = mMgr.get();
+ @NonNull WifiAwareDiscoverySessionCallback callback) {
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.e(TAG, "publish: called post GC on WifiNanManager");
+ Log.e(TAG, "publish: called post GC on WifiAwareManager");
return;
}
if (mTerminated) {
@@ -139,23 +139,24 @@
}
/**
- * Issue a request to the NAN service to create a new NAN subscribe discovery session, using
+ * Issue a request to the Aware service to create a new Aware subscribe discovery session, using
* the specified {@code subscribeConfig} configuration. The results of the subscribe
- * operation are routed to the callbacks of {@link WifiNanDiscoverySessionCallback}:
+ * operation are routed to the callbacks of {@link WifiAwareDiscoverySessionCallback}:
* <ul>
* <li>
- * {@link WifiNanDiscoverySessionCallback#onSubscribeStarted(WifiNanSubscribeDiscoverySession)}
+ * {@link WifiAwareDiscoverySessionCallback#onSubscribeStarted(
+ * WifiAwareSubscribeDiscoverySession)}
* is called when the subscribe session is created and provides a handle to the session.
* Further operations on the subscribe session can be executed on that object.
- * <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()} is called if the
+ * <li>{@link WifiAwareDiscoverySessionCallback#onSessionConfigFailed()} is called if the
* subscribe operation failed.
* </ul>
* <p>
* Other results of the subscribe session operations will also be routed to callbacks
* on the {@code callback} object. The resulting subscribe session can be modified using
- * {@link WifiNanSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
+ * {@link WifiAwareSubscribeDiscoverySession#updateSubscribe(SubscribeConfig)}.
* <p>
- * An application must use the {@link WifiNanDiscoveryBaseSession#destroy()} to
+ * An application must use the {@link WifiAwareDiscoveryBaseSession#destroy()} to
* terminate the subscribe discovery session once it isn't needed. This will free
* resources as well terminate any on-air transmissions.
* <p>The application must have the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
@@ -165,14 +166,14 @@
* callback} object. If a null is provided then the application's main thread will be used.
* @param subscribeConfig The {@link SubscribeConfig} specifying the
* configuration of the requested subscribe session.
- * @param callback A {@link WifiNanDiscoverySessionCallback} derived object to be used for
+ * @param callback A {@link WifiAwareDiscoverySessionCallback} derived object to be used for
* session event callbacks.
*/
public void subscribe(@Nullable Handler handler, @NonNull SubscribeConfig subscribeConfig,
- @NonNull WifiNanDiscoverySessionCallback callback) {
- WifiNanManager mgr = mMgr.get();
+ @NonNull WifiAwareDiscoverySessionCallback callback) {
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.e(TAG, "publish: called post GC on WifiNanManager");
+ Log.e(TAG, "publish: called post GC on WifiAwareManager");
return;
}
if (mTerminated) {
@@ -184,20 +185,20 @@
}
/**
- * Create a {@link NetworkRequest.Builder#setNetworkSpecifier(String)} for a
- * WiFi NAN connection to the specified peer. The
- * {@link NetworkRequest.Builder#addTransportType(int)} should be set to
- * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_NAN}.
+ * Create a {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(String)} for a
+ * WiFi Aware connection to the specified peer. The
+ * {@link android.net.NetworkRequest.Builder#addTransportType(int)} should be set to
+ * {@link android.net.NetworkCapabilities#TRANSPORT_WIFI_AWARE}.
* <p>
* This API is targeted for applications which can obtain the peer MAC address using OOB
- * (out-of-band) discovery. NAN discovery does not provide the MAC address of the peer -
- * when using NAN discovery use the alternative network specifier method -
- * {@link WifiNanDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])}.
+ * (out-of-band) discovery. Aware discovery does not provide the MAC address of the peer -
+ * when using Aware discovery use the alternative network specifier method -
+ * {@link WifiAwareDiscoveryBaseSession#createNetworkSpecifier(int, Object, byte[])}.
*
* @param role The role of this device:
- * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_INITIATOR} or
- * {@link WifiNanManager#WIFI_NAN_DATA_PATH_ROLE_RESPONDER}
- * @param peer The MAC address of the peer's NAN discovery interface. On a RESPONDER this
+ * {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_INITIATOR} or
+ * {@link WifiAwareManager#WIFI_AWARE_DATA_PATH_ROLE_RESPONDER}
+ * @param peer The MAC address of the peer's Aware discovery interface. On a RESPONDER this
* value is used to gate the acceptance of a connection request from only that
* peer. A RESPONDER may specified a null - indicating that it will accept
* connection requests from any device.
@@ -209,14 +210,15 @@
*
* @return A string to be used to construct
* {@link android.net.NetworkRequest.Builder#setNetworkSpecifier(String)} to pass to
- * {@link android.net.ConnectivityManager#requestNetwork(NetworkRequest, android.net.ConnectivityManager.NetworkCallback)}
+ * {@link android.net.ConnectivityManager#requestNetwork(NetworkRequest,
+ * android.net.ConnectivityManager.NetworkCallback)}
* [or other varieties of that API].
*/
- public String createNetworkSpecifier(@WifiNanManager.DataPathRole int role, @Nullable byte[] peer,
- @Nullable byte[] token) {
- WifiNanManager mgr = mMgr.get();
+ public String createNetworkSpecifier(@WifiAwareManager.DataPathRole int role,
+ @Nullable byte[] peer, @Nullable byte[] token) {
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.e(TAG, "createNetworkSpecifier: called post GC on WifiNanManager");
+ Log.e(TAG, "createNetworkSpecifier: called post GC on WifiAwareManager");
return "";
}
if (mTerminated) {
diff --git a/wifi/java/android/net/wifi/nan/WifiNanSubscribeDiscoverySession.java b/wifi/java/android/net/wifi/aware/WifiAwareSubscribeDiscoverySession.java
similarity index 65%
rename from wifi/java/android/net/wifi/nan/WifiNanSubscribeDiscoverySession.java
rename to wifi/java/android/net/wifi/aware/WifiAwareSubscribeDiscoverySession.java
index f5b4c0c..7c48f54 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanSubscribeDiscoverySession.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareSubscribeDiscoverySession.java
@@ -14,41 +14,43 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
import android.annotation.NonNull;
import android.util.Log;
/**
- * A class representing a NAN subscribe session. Created when
- * {@link WifiNanSession#subscribe(android.os.Handler, SubscribeConfig, WifiNanDiscoverySessionCallback)}
+ * A class representing a Aware subscribe session. Created when
+ * {@link WifiAwareSession#subscribe(android.os.Handler, SubscribeConfig,
+ * WifiAwareDiscoverySessionCallback)}
* is called and a discovery session is created and returned in
- * {@link WifiNanDiscoverySessionCallback#onSubscribeStarted(WifiNanSubscribeDiscoverySession)}.
- * See baseline functionality of all discovery sessions in {@link WifiNanDiscoveryBaseSession}.
+ * {@link WifiAwareDiscoverySessionCallback#onSubscribeStarted(WifiAwareSubscribeDiscoverySession)}.
+ * See baseline functionality of all discovery sessions in {@link WifiAwareDiscoveryBaseSession}.
* This object allows updating an existing/running subscribe discovery session using
* {@link #updateSubscribe(SubscribeConfig)}.
*
- * @hide PROPOSED_NAN_API
+ * @hide PROPOSED_AWARE_API
*/
-public class WifiNanSubscribeDiscoverySession extends WifiNanDiscoveryBaseSession {
- private static final String TAG = "WifiNanSubscribeDiscSsn";
+public class WifiAwareSubscribeDiscoverySession extends WifiAwareDiscoveryBaseSession {
+ private static final String TAG = "WifiAwareSubsDiscSsn";
/**
* {@hide}
*/
- public WifiNanSubscribeDiscoverySession(WifiNanManager manager, int clientId, int sessionId) {
+ public WifiAwareSubscribeDiscoverySession(WifiAwareManager manager, int clientId,
+ int sessionId) {
super(manager, clientId, sessionId);
}
/**
* Re-configure the currently active subscribe session. The
- * {@link WifiNanDiscoverySessionCallback} is not replaced - the same listener used
+ * {@link WifiAwareDiscoverySessionCallback} is not replaced - the same listener used
* at creation is still used. The results of the configuration are returned using
- * {@link WifiNanDiscoverySessionCallback}:
+ * {@link WifiAwareDiscoverySessionCallback}:
* <ul>
- * <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigUpdated()}: configuration
+ * <li>{@link WifiAwareDiscoverySessionCallback#onSessionConfigUpdated()}: configuration
* update succeeded.
- * <li>{@link WifiNanDiscoverySessionCallback#onSessionConfigFailed()}: configuration
+ * <li>{@link WifiAwareDiscoverySessionCallback#onSessionConfigFailed()}: configuration
* update failed. The subscribe discovery session is still running using its previous
* configuration (i.e. update failure does not terminate the session).
* </ul>
@@ -61,9 +63,9 @@
Log.w(TAG, "updateSubscribe: called on terminated session");
return;
} else {
- WifiNanManager mgr = mMgr.get();
+ WifiAwareManager mgr = mMgr.get();
if (mgr == null) {
- Log.w(TAG, "updateSubscribe: called post GC on WifiNanManager");
+ Log.w(TAG, "updateSubscribe: called post GC on WifiAwareManager");
return;
}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanUtils.java b/wifi/java/android/net/wifi/aware/WifiAwareUtils.java
similarity index 93%
rename from wifi/java/android/net/wifi/nan/WifiNanUtils.java
rename to wifi/java/android/net/wifi/aware/WifiAwareUtils.java
index c0f36b4..4083388 100644
--- a/wifi/java/android/net/wifi/nan/WifiNanUtils.java
+++ b/wifi/java/android/net/wifi/aware/WifiAwareUtils.java
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package android.net.wifi.nan;
+package android.net.wifi.aware;
/**
- * Provides utilities for the Wifi NAN manager/service.
+ * Provides utilities for the Wifi Aware manager/service.
*
* @hide
*/
-public class WifiNanUtils {
+public class WifiAwareUtils {
/**
* Per spec: The Service Name is a UTF-8 encoded string from 1 to 255 bytes in length. The
* only acceptable single-byte UTF-8 symbols for a Service Name are alphanumeric values (A-Z,
diff --git a/wifi/java/android/net/wifi/aware/package.html b/wifi/java/android/net/wifi/aware/package.html
new file mode 100644
index 0000000..1a990d8
--- /dev/null
+++ b/wifi/java/android/net/wifi/aware/package.html
@@ -0,0 +1,43 @@
+<HTML>
+<BODY>
+<p>Provides classes which allow applications to use Wi-Fi Aware to discover peers and create
+ connections to them.</p>
+<p>Using the Wi-Fi Aware APIs, applications can advertise services, discover peers which are
+ advertising services, and connect to them.
+ Wi-Fi Aware is independent of Wi-Fi infrastructure (i.e. a device may or may
+ not be associated with an AP concurrent to using Wi-Fi Aware). </p>
+<p>The primary entry point to Wi-Fi Aware capabilities is the
+ {@link android.net.wifi.aware.WifiAwareManager} class, which is acquired by calling
+ {@link android.content.Context#getSystemService(String)
+ Context.getSystemService(Context.WIFI_AWARE_SERVICE)}</p>
+
+<p>Some APIs may require the following user permissions:</p>
+<ul>
+ <li>{@link android.Manifest.permission#ACCESS_WIFI_STATE}</li>
+ <li>{@link android.Manifest.permission#CHANGE_WIFI_STATE}</li>
+ <li>{@link android.Manifest.permission#ACCESS_COARSE_LOCATION}</li>
+</ul>
+
+<p class="note"><strong>Note:</strong> Not all Android-powered devices support Wi-Fi Aware
+ functionality.
+ If your application only works with Wi-Fi Aware (i.e. it should only be installed on devices which
+ support Wi-Fi Aware), declare so with a <a
+ href="{@docRoot}guide/topics/manifest/uses-feature-element.html">
+ {@code <uses-feature>}</a>
+ element in the manifest file:</p>
+<pre>
+<manifest ...>
+ <uses-feature android:name="android.hardware.wifi.aware" />
+ ...
+</manifest>
+</pre>
+<p>Alternatively, if you application does not require Wi-Fi Aware but can take advantage of it if
+ available, you can perform
+ the check at run-time in your code using {@link
+ android.content.pm.PackageManager#hasSystemFeature(String)} with {@link
+ android.content.pm.PackageManager#FEATURE_WIFI_AWARE}:</p>
+<pre>
+ getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_AWARE)
+</pre>
+</BODY>
+</HTML>
diff --git a/wifi/java/android/net/wifi/hotspot2/ConfigBuilder.java b/wifi/java/android/net/wifi/hotspot2/ConfigBuilder.java
new file mode 100644
index 0000000..96db5d0
--- /dev/null
+++ b/wifi/java/android/net/wifi/hotspot2/ConfigBuilder.java
@@ -0,0 +1,473 @@
+/**
+ * Copyright (c) 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.wifi.hotspot2;
+
+import android.net.wifi.hotspot2.omadm.PPSMOParser;
+import android.text.TextUtils;
+import android.util.Base64;
+import android.util.Log;
+import android.util.Pair;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.PrivateKey;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Utility class for building PasspointConfiguration from an installation file.
+ *
+ * @hide
+ */
+public final class ConfigBuilder {
+ private static final String TAG = "ConfigBuilder";
+
+ // Header names.
+ private static final String CONTENT_TYPE = "Content-Type";
+ private static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
+
+ // MIME types.
+ private static final String TYPE_MULTIPART_MIXED = "multipart/mixed";
+ private static final String TYPE_WIFI_CONFIG = "application/x-wifi-config";
+ private static final String TYPE_PASSPOINT_PROFILE = "application/x-passpoint-profile";
+ private static final String TYPE_CA_CERT = "application/x-x509-ca-cert";
+ private static final String TYPE_PKCS12 = "application/x-pkcs12";
+
+ private static final String ENCODING_BASE64 = "base64";
+ private static final String BOUNDARY = "boundary=";
+
+ /**
+ * Class represent a MIME (Multipurpose Internet Mail Extension) part.
+ */
+ private static class MimePart {
+ /**
+ * Content type of the part.
+ */
+ public String type = null;
+
+ /**
+ * Decoded data.
+ */
+ public byte[] data = null;
+
+ /**
+ * Flag indicating if this is the last part (ending with --{boundary}--).
+ */
+ public boolean isLast = false;
+ }
+
+ /**
+ * Class represent the MIME (Multipurpose Internet Mail Extension) header.
+ */
+ private static class MimeHeader {
+ /**
+ * Content type.
+ */
+ public String contentType = null;
+
+ /**
+ * Boundary string (optional), only applies for the outter MIME header.
+ */
+ public String boundary = null;
+
+ /**
+ * Encoding type.
+ */
+ public String encodingType = null;
+ }
+
+
+ /**
+ * Parse the Hotspot 2.0 Release 1 configuration data into a {@link PasspointConfiguration}
+ * object. The configuration data is a base64 encoded MIME multipart data. Below is
+ * the format of the decoded message:
+ *
+ * Content-Type: multipart/mixed; boundary={boundary}
+ * Content-Transfer-Encoding: base64
+ *
+ * --{boundary}
+ * Content-Type: application/x-passpoint-profile
+ * Content-Transfer-Encoding: base64
+ *
+ * [base64 encoded Passpoint profile data]
+ * --{boundary}
+ * Content-Type: application/x-x509-ca-cert
+ * Content-Transfer-Encoding: base64
+ *
+ * [base64 encoded X509 CA certificate data]
+ * --{boundary}
+ * Content-Type: application/x-pkcs12
+ * Content-Transfer-Encoding: base64
+ *
+ * [base64 encoded PKCS#12 ASN.1 structure containing client certificate chain]
+ * --{boundary}
+ *
+ * @param mimeType MIME type of the encoded data.
+ * @param data A base64 encoded MIME multipart message containing the Passpoint profile
+ * (required), CA (Certificate Authority) certificate (optional), and client
+ * certificate chain (optional).
+ * @return {@link PasspointConfiguration}
+ */
+ public static PasspointConfiguration buildPasspointConfig(String mimeType, byte[] data) {
+ // Verify MIME type.
+ if (!TextUtils.equals(mimeType, TYPE_WIFI_CONFIG)) {
+ Log.e(TAG, "Unexpected MIME type: " + mimeType);
+ return null;
+ }
+
+ try {
+ // Decode the data.
+ byte[] decodedData = Base64.decode(new String(data, StandardCharsets.ISO_8859_1),
+ Base64.DEFAULT);
+ Map<String, byte[]> mimeParts = parseMimeMultipartMessage(new LineNumberReader(
+ new InputStreamReader(new ByteArrayInputStream(decodedData),
+ StandardCharsets.ISO_8859_1)));
+ return createPasspointConfig(mimeParts);
+ } catch (IOException | IllegalArgumentException e) {
+ Log.e(TAG, "Failed to parse installation file: " + e.getMessage());
+ return null;
+ }
+ }
+
+ /**
+ * Create a {@link PasspointConfiguration} object from list of MIME (Multipurpose Internet
+ * Mail Extension) parts.
+ *
+ * @param mimeParts Map of content type and content data.
+ * @return {@link PasspointConfiguration}
+ * @throws IOException
+ */
+ private static PasspointConfiguration createPasspointConfig(Map<String, byte[]> mimeParts)
+ throws IOException {
+ byte[] profileData = mimeParts.get(TYPE_PASSPOINT_PROFILE);
+ if (profileData == null) {
+ throw new IOException("Missing Passpoint Profile");
+ }
+
+ PasspointConfiguration config = PPSMOParser.parseMOText(new String(profileData));
+ if (config == null) {
+ throw new IOException("Failed to parse Passpoint profile");
+ }
+
+ // Credential is needed for storing the certificates and private client key.
+ if (config.credential == null) {
+ throw new IOException("Passpoint profile missing credential");
+ }
+
+ // Parse CA (Certificate Authority) certificate.
+ byte[] caCertData = mimeParts.get(TYPE_CA_CERT);
+ if (caCertData != null) {
+ try {
+ config.credential.caCertificate = parseCACert(caCertData);
+ } catch (CertificateException e) {
+ throw new IOException("Failed to parse CA Certificate");
+ }
+ }
+
+ // Parse PKCS12 data for client private key and certificate chain.
+ byte[] pkcs12Data = mimeParts.get(TYPE_PKCS12);
+ if (pkcs12Data != null) {
+ try {
+ Pair<PrivateKey, List<X509Certificate>> clientKey = parsePkcs12(pkcs12Data);
+ config.credential.clientPrivateKey = clientKey.first;
+ config.credential.clientCertificateChain =
+ clientKey.second.toArray(new X509Certificate[clientKey.second.size()]);
+ } catch(GeneralSecurityException | IOException e) {
+ throw new IOException("Failed to parse PCKS12 string");
+ }
+ }
+ return config;
+ }
+
+ /**
+ * Parse a MIME (Multipurpose Internet Mail Extension) multipart message from the given
+ * input stream.
+ *
+ * @param in The input stream for reading the message data
+ * @return A map of a content type and content data pair
+ * @throws IOException
+ */
+ private static Map<String, byte[]> parseMimeMultipartMessage(LineNumberReader in)
+ throws IOException {
+ // Parse the outer MIME header.
+ MimeHeader header = parseHeaders(in);
+ if (!TextUtils.equals(header.contentType, TYPE_MULTIPART_MIXED)) {
+ throw new IOException("Invalid content type: " + header.contentType);
+ }
+ if (TextUtils.isEmpty(header.boundary)) {
+ throw new IOException("Missing boundary string");
+ }
+ if (!TextUtils.equals(header.encodingType, ENCODING_BASE64)) {
+ throw new IOException("Unexpected encoding: " + header.encodingType);
+ }
+
+ // Read pass the first boundary string.
+ for (;;) {
+ String line = in.readLine();
+ if (line == null) {
+ throw new IOException("Unexpected EOF before first boundary @ " +
+ in.getLineNumber());
+ }
+ if (line.equals("--" + header.boundary)) {
+ break;
+ }
+ }
+
+ // Parse each MIME part.
+ Map<String, byte[]> mimeParts = new HashMap<>();
+ boolean isLast = false;
+ do {
+ MimePart mimePart = parseMimePart(in, header.boundary);
+ mimeParts.put(mimePart.type, mimePart.data);
+ isLast = mimePart.isLast;
+ } while(!isLast);
+ return mimeParts;
+ }
+
+ /**
+ * Parse a MIME (Multipurpose Internet Mail Extension) part. We expect the data to
+ * be encoded in base64.
+ *
+ * @param in Input stream to read the data from
+ * @param boundary Boundary string indicate the end of the part
+ * @return {@link MimePart}
+ * @throws IOException
+ */
+ private static MimePart parseMimePart(LineNumberReader in, String boundary)
+ throws IOException {
+ MimeHeader header = parseHeaders(in);
+ // Expect encoding type to be base64.
+ if (!TextUtils.equals(header.encodingType, ENCODING_BASE64)) {
+ throw new IOException("Unexpected encoding type: " + header.encodingType);
+ }
+
+ // Check for a valid content type.
+ if (!TextUtils.equals(header.contentType, TYPE_PASSPOINT_PROFILE) &&
+ !TextUtils.equals(header.contentType, TYPE_CA_CERT) &&
+ !TextUtils.equals(header.contentType, TYPE_PKCS12)) {
+ throw new IOException("Unexpected content type: " + header.contentType);
+ }
+
+ StringBuilder text = new StringBuilder();
+ boolean isLast = false;
+ String partBoundary = "--" + boundary;
+ String endBoundary = partBoundary + "--";
+ for (;;) {
+ String line = in.readLine();
+ if (line == null) {
+ throw new IOException("Unexpected EOF file in body @ " + in.getLineNumber());
+ }
+ // Check for boundary line.
+ if (line.startsWith(partBoundary)) {
+ if (line.equals(endBoundary)) {
+ isLast = true;
+ }
+ break;
+ }
+ text.append(line);
+ }
+
+ MimePart part = new MimePart();
+ part.type = header.contentType;
+ part.data = Base64.decode(text.toString(), Base64.DEFAULT);
+ part.isLast = isLast;
+ return part;
+ }
+
+ /**
+ * Parse a MIME (Multipurpose Internet Mail Extension) header from the input stream.
+ * @param in Input stream to read from.
+ * @return {@link MimeHeader}
+ * @throws IOException
+ */
+ private static MimeHeader parseHeaders(LineNumberReader in)
+ throws IOException {
+ MimeHeader header = new MimeHeader();
+
+ // Read the header from the input stream.
+ Map<String, String> headers = readHeaders(in);
+
+ // Parse each header.
+ for (Map.Entry<String, String> entry : headers.entrySet()) {
+ switch (entry.getKey()) {
+ case CONTENT_TYPE:
+ Pair<String, String> value = parseContentType(entry.getValue());
+ header.contentType = value.first;
+ header.boundary = value.second;
+ break;
+ case CONTENT_TRANSFER_ENCODING:
+ header.encodingType = entry.getValue();
+ break;
+ default:
+ throw new IOException("Unexpected header: " + entry.getKey());
+ }
+ }
+ return header;
+ }
+
+ /**
+ * Parse the Content-Type header value. The value will contain the content type string and
+ * an optional boundary string separated by a ";". Below are examples of valid Content-Type
+ * header value:
+ * multipart/mixed; boundary={boundary}
+ * application/x-passpoint-profile
+ *
+ * @param contentType The Content-Type value string
+ * @return A pair of content type and boundary string
+ * @throws IOException
+ */
+ private static Pair<String, String> parseContentType(String contentType) throws IOException {
+ String[] attributes = contentType.toString().split(";");
+ String type = null;
+ String boundary = null;
+
+ if (attributes.length < 1 || attributes.length > 2) {
+ throw new IOException("Invalid Content-Type: " + contentType);
+ }
+
+ type = attributes[0].trim();
+ if (attributes.length == 2) {
+ boundary = attributes[1].trim();
+ if (!boundary.startsWith(BOUNDARY)) {
+ throw new IOException("Invalid Content-Type: " + contentType);
+ }
+ boundary = boundary.substring(BOUNDARY.length());
+ // Remove the leading and trailing quote if present.
+ if (boundary.length() > 1 && boundary.startsWith("\"") && boundary.endsWith("\"")) {
+ boundary = boundary.substring(1, boundary.length()-1);
+ }
+ }
+
+ return new Pair<String, String>(type, boundary);
+ }
+
+ /**
+ * Read the headers from the given input stream. The header section is terminated by
+ * an empty line.
+ *
+ * @param in The input stream to read from
+ * @return Map of key-value pairs.
+ * @throws IOException
+ */
+ private static Map<String, String> readHeaders(LineNumberReader in)
+ throws IOException {
+ Map<String, String> headers = new HashMap<>();
+ String line;
+ String name = null;
+ StringBuilder value = null;
+ for (;;) {
+ line = in.readLine();
+ if (line == null) {
+ throw new IOException("Missing line @ " + in.getLineNumber());
+ }
+
+ // End of headers section.
+ if (line.length() == 0 || line.trim().length() == 0) {
+ // Save the previous header line.
+ if (name != null) {
+ headers.put(name, value.toString());
+ }
+ break;
+ }
+
+ int nameEnd = line.indexOf(':');
+ if (nameEnd < 0) {
+ if (value != null) {
+ // Continuation line for the header value.
+ value.append(' ').append(line.trim());
+ } else {
+ throw new IOException("Bad header line: '" + line + "' @ " +
+ in.getLineNumber());
+ }
+ } else {
+ // New header line detected, make sure it doesn't start with a whitespace.
+ if (Character.isWhitespace(line.charAt(0))) {
+ throw new IOException("Illegal blank prefix in header line '" + line +
+ "' @ " + in.getLineNumber());
+ }
+
+ if (name != null) {
+ // Save the previous header line.
+ headers.put(name, value.toString());
+ }
+
+ // Setup the current header line.
+ name = line.substring(0, nameEnd).trim();
+ value = new StringBuilder();
+ value.append(line.substring(nameEnd+1).trim());
+ }
+ }
+ return headers;
+ }
+
+ /**
+ * Parse a CA (Certificate Authority) certificate data and convert it to a
+ * X509Certificate object.
+ *
+ * @param octets Certificate data
+ * @return X509Certificate
+ * @throws CertificateException
+ */
+ private static X509Certificate parseCACert(byte[] octets) throws CertificateException {
+ CertificateFactory factory = CertificateFactory.getInstance("X.509");
+ return (X509Certificate) factory.generateCertificate(new ByteArrayInputStream(octets));
+ }
+
+ private static Pair<PrivateKey, List<X509Certificate>> parsePkcs12(byte[] octets)
+ throws GeneralSecurityException, IOException {
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ ByteArrayInputStream in = new ByteArrayInputStream(octets);
+ ks.load(in, new char[0]);
+ in.close();
+
+ // Only expects one set of key and certificate chain.
+ if (ks.size() != 1) {
+ throw new IOException("Unexpected key size: " + ks.size());
+ }
+
+ String alias = ks.aliases().nextElement();
+ if (alias == null) {
+ throw new IOException("No alias found");
+ }
+
+ PrivateKey clientKey = (PrivateKey) ks.getKey(alias, null);
+ List<X509Certificate> clientCertificateChain = null;
+ Certificate[] chain = ks.getCertificateChain(alias);
+ if (chain != null) {
+ clientCertificateChain = new ArrayList<>();
+ for (Certificate certificate : chain) {
+ if (!(certificate instanceof X509Certificate)) {
+ throw new IOException("Unexpceted certificate type: " +
+ certificate.getClass());
+ }
+ clientCertificateChain.add((X509Certificate) certificate);
+ }
+ }
+ return new Pair<PrivateKey, List<X509Certificate>>(clientKey, clientCertificateChain);
+ }
+}
\ No newline at end of file
diff --git a/wifi/java/android/net/wifi/nan/WifiNanAttachCallback.java b/wifi/java/android/net/wifi/nan/WifiNanAttachCallback.java
deleted file mode 100644
index d8c310b..0000000
--- a/wifi/java/android/net/wifi/nan/WifiNanAttachCallback.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net.wifi.nan;
-
-/**
- * Base class for NAN attach callbacks. Should be extended by applications and set when calling
- * {@link WifiNanManager#attach(android.os.Handler, WifiNanAttachCallback)}. These are callbacks
- * applying to the NAN connection as a whole - not to specific publish or subscribe sessions -
- * for that see {@link WifiNanDiscoverySessionCallback}.
- *
- * @hide PROPOSED_NAN_API
- */
-public class WifiNanAttachCallback {
- /**
- * Called when NAN attach operation
- * {@link WifiNanManager#attach(android.os.Handler, WifiNanAttachCallback)}
- * is completed and that we can now start discovery sessions or connections.
- *
- * @param session The NAN object on which we can execute further NAN operations - e.g.
- * discovery, connections.
- */
- public void onAttached(WifiNanSession session) {
- /* empty */
- }
-
- /**
- * Called when NAN attach operation
- * {@link WifiNanManager#attach(android.os.Handler, WifiNanAttachCallback)} failed.
- */
- public void onAttachFailed() {
- /* empty */
- }
-}
diff --git a/wifi/java/android/net/wifi/nan/WifiNanCharacteristics.aidl b/wifi/java/android/net/wifi/nan/WifiNanCharacteristics.aidl
deleted file mode 100644
index e562a00..0000000
--- a/wifi/java/android/net/wifi/nan/WifiNanCharacteristics.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net.wifi.nan;
-
-parcelable WifiNanCharacteristics;
diff --git a/wifi/java/android/net/wifi/nan/package.html b/wifi/java/android/net/wifi/nan/package.html
deleted file mode 100644
index ae3cf6c..0000000
--- a/wifi/java/android/net/wifi/nan/package.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<HTML>
-<BODY>
-<p>Provides classes which allow applications to use Wi-Fi NAN to discover peers and create
- connections to them.</p>
-<p>Using the Wi-Fi NAN APIs, applications can advertise services, discover peers which are
- advertising services, and connect to them.
- Wi-Fi NAN is independent of Wi-Fi infrastructure (i.e. a device may or may
- not be associated with an AP concurrent to using Wi-Fi NAN). </p>
-<p>The primary entry point to Wi-Fi NAN capabilities is the
- {@link android.net.wifi.nan.WifiNanManager} class, which is acquired by calling
- {@link android.content.Context#getSystemService(String)
- Context.getSystemService(Context.WIFI_NAN_SERVICE)}</p>
-
-<p>Some APIs may require the following user permissions:</p>
-<ul>
- <li>{@link android.Manifest.permission#ACCESS_WIFI_STATE}</li>
- <li>{@link android.Manifest.permission#CHANGE_WIFI_STATE}</li>
- <li>{@link android.Manifest.permission#ACCESS_COARSE_LOCATION}</li>
-</ul>
-
-<p class="note"><strong>Note:</strong> Not all Android-powered devices support Wi-Fi NAN
- functionality.
- If your application only works with Wi-Fi NAN (i.e. it should only be installed on devices which
- support Wi-Fi NAN), declare so with a <a
- href="{@docRoot}guide/topics/manifest/uses-feature-element.html">
- {@code <uses-feature>}</a>
- element in the manifest file:</p>
-<pre>
-<manifest ...>
- <uses-feature android:name="android.hardware.wifi.nan" />
- ...
-</manifest>
-</pre>
-<p>Alternatively, if you application does not require Wi-Fi NAN but can take advantage of it if
- available, you can perform
- the check at run-time in your code using {@link
- android.content.pm.PackageManager#hasSystemFeature(String)} with {@link
- android.content.pm.PackageManager#FEATURE_WIFI_NAN}:</p>
-<pre>
- getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_NAN)
-</pre>
-</BODY>
-</HTML>
diff --git a/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl b/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl
index ee2e895..8b1cfae 100644
--- a/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl
+++ b/wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl
@@ -28,5 +28,6 @@
Messenger getMessenger();
Messenger getP2pStateMachineMessenger();
void setMiracastMode(int mode);
+ void checkConfigureWifiDisplayPermission();
}
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
index 8d5cf63..c93ac7b 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
@@ -283,6 +283,13 @@
public static final String EXTRA_HANDOVER_MESSAGE =
"android.net.wifi.p2p.EXTRA_HANDOVER_MESSAGE";
+ /**
+ * The lookup key for a calling package returned by the WifiP2pService.
+ * @hide
+ */
+ public static final String CALLING_PACKAGE =
+ "android.net.wifi.p2p.CALLING_PACKAGE";
+
IWifiP2pManager mService;
private static final int BASE = Protocol.BASE_WIFI_P2P_MANAGER;
@@ -1271,7 +1278,10 @@
*/
public void requestPeers(Channel c, PeerListListener listener) {
checkChannel(c);
- c.mAsyncChannel.sendMessage(REQUEST_PEERS, 0, c.putListener(listener));
+ Bundle callingPackage = new Bundle();
+ callingPackage.putString(CALLING_PACKAGE, c.mContext.getOpPackageName());
+ c.mAsyncChannel.sendMessage(REQUEST_PEERS, 0, c.putListener(listener),
+ callingPackage);
}
/**
@@ -1314,6 +1324,11 @@
Channel c, WifiP2pWfdInfo wfdInfo,
ActionListener listener) {
checkChannel(c);
+ try {
+ mService.checkConfigureWifiDisplayPermission();
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
+ }
c.mAsyncChannel.sendMessage(SET_WFD_INFO, 0, c.putListener(listener), wfdInfo);
}
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.base64
new file mode 100644
index 0000000..8c1eb08
--- /dev/null
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.base64
@@ -0,0 +1,85 @@
+Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PXtib3VuZGFyeX0KQ29udGVu
+dC1Ucm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2JX
+MVdUQW94Y1VKS2JHUjRNelJUY0hkelZFRk1VVlpRWWpSb1IzZEtlbHBtY2pGUQpZM0JGVVhnMmVF
+MXVWR3c0ZUVWWFdrVXpUWE01T1hWaFZYaGlVWEZKZDFKMUNreG5RVTlyVGtOdFdUSnRPRGxXYUhw
+aFNFb3hkVlk0Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpG
+S1VDdHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNS
+a1RrNTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmts
+RFFWUkZMUzB0TFMwSwotLXtib3VuZGFyeX0tLQo=
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.conf b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.conf
new file mode 100644
index 0000000..6d86dd5
--- /dev/null
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithCACert.conf
@@ -0,0 +1,73 @@
+Content-Type: multipart/mixed; boundary={boundary}
+Content-Transfer-Encoding: base64
+
+--{boundary}
+Content-Type: application/x-passpoint-profile
+Content-Transfer-Encoding: base64
+
+PE1nbXRUcmVlIHhtbG5zPSJzeW5jbWw6ZG1kZGYxLjIiPgogIDxWZXJEVEQ+MS4yPC9WZXJEVEQ+
+CiAgPE5vZGU+CiAgICA8Tm9kZU5hbWU+UGVyUHJvdmlkZXJTdWJzY3JpcHRpb248L05vZGVOYW1l
+PgogICAgPFJUUHJvcGVydGllcz4KICAgICAgPFR5cGU+CiAgICAgICAgPERERk5hbWU+dXJuOndm
+YTptbzpob3RzcG90MmRvdDAtcGVycHJvdmlkZXJzdWJzY3JpcHRpb246MS4wPC9EREZOYW1lPgog
+ICAgICA8L1R5cGU+CiAgICA8L1JUUHJvcGVydGllcz4KICAgIDxOb2RlPgogICAgICA8Tm9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ak0w
+b0R0WCsyQ3Y2ajB3Qks3aEQ4cFB2ZjErdXkKR3pjemlnQVUvNEt3N2VacXlkZjlCKzVSdXBSK0la
+aXBYNDF4RWlJcktSd3FpNTE3V1d6WGNqYUcyY05iZjQ1MQp4cEg1UG5WM2kxdHEwNGpNR1FVekZ3
+SURBUUFCbzRHQU1INHdIUVlEVlIwT0JCWUVGSXdYNHZzOEJpQmNTY29kCjVub1pIUk04RTQraU1F
+SUdBMVVkSXdRN01EbUFGSXdYNHZzOEJpQmNTY29kNW5vWkhSTThFNCtpb1Jha0ZEQVMKTVJBd0Rn
+WURWUVFERXdkRlFWQWdRMEV4Z2drQWd1VVYzRE10VzZzd0RBWURWUjBUQkFVd0F3RUIvekFMQmdO
+VgpIUThFQkFNQ0FRWXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBRmZRcU9UQTdSdjdLK2x1UTdw
+bmFzNEJZd0hFCjlHRVAvdW9odjZLT3kwVEdRRmJyUlRqRm9MVk5COUJaMXltTURaMC9USXdJVWM3
+d2k3YTh0NW1FcVlIMTUzd1cKYVdvb2lTanlMTGh1STRzTnJOQ090aXNkQnEycjJNRlh0NmgwbUFR
+WU9QdjhSOEs3L2ZnU3hHRnF6aHlObW1WTAoxcUJKbGR4MzRTcHdzVEFMUVZQYjRoR3dKelpmcjFQ
+Y3BFUXg2eE1uVGw4eEVXWkUzTXM5OXVhVXhiUXFJd1J1CkxnQU9rTkNtWTJtODlWaHphSEoxdVY4
+NUFkTS90RCtZc21sbm5qdDlMUkNlamJCaXBqSUdqT1hyZzFKUCtseFYKbXVNNHZIK1AvbWxteHNQ
+UHowZDY1YitFR21KWnBvTGtPL3RkTk52Q1l6akpwVEVXcEVzTzZOTWhLWW89Ci0tLS0tRU5EIENF
+UlRJRklDQVRFLS0tLS0K
+--{boundary}--
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithInvalidContentType.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithInvalidContentType.base64
new file mode 100644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VSmFNWGx0VFVSYU1DOVVTWGRK
+VldNMwpkMmszWVRoME5XMUZjVmxJTVRVemQxY0tZVmR2YjJsVGFubE1UR2gxU1RSelRuSk9RMDkw
+YVhOa1FuRXljakpOUmxoME5tZ3diVUZSCldVOVFkamhTT0VzM0wyWm5VM2hIUm5GNmFIbE9iVzFX
+VEFveGNVSktiR1I0TXpSVGNIZHpWRUZNVVZaUVlqUm9SM2RLZWxwbWNqRlEKWTNCRlVYZzJlRTF1
+Vkd3NGVFVlhXa1V6VFhNNU9YVmhWWGhpVVhGSmQxSjFDa3huUVU5clRrTnRXVEp0T0RsV2FIcGhT
+RW94ZFZZNApOVUZrVFM5MFJDdFpjMjFzYm01cWREbE1Va05sYW1KQ2FYQnFTVWRxVDFoeVp6RktV
+Q3RzZUZZS2JYVk5OSFpJSzFBdmJXeHRlSE5RClVIb3daRFkxWWl0RlIyMUtXbkJ2VEd0UEwzUmtU
+azUyUTFsNmFrcHdWRVZYY0VWelR6Wk9UV2hMV1c4OUNpMHRMUzB0UlU1RUlFTkYKVWxSSlJrbERR
+VlJGTFMwdExTMEsKLS17Ym91bmRhcnl9LS0K
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithMissingBoundary.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithMissingBoundary.base64
new file mode 100644
index 0000000..3fa97d1
--- /dev/null
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithMissingBoundary.base64
@@ -0,0 +1,85 @@
+Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PXtib3VuZGFyeX0KQ29udGVu
+dC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBh
+cHBsaWNhdGlvbi94LXBhc3Nwb2ludC1wcm9maWxlCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6
+IGJhc2U2NAoKUEUxbmJYUlVjbVZsSUhodGJHNXpQU0p6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0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpG
+S1VDdHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNS
+a1RrNTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmts
+RFFWUkZMUzB0TFMwSwo=
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithNonBase64Part.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithNonBase64Part.base64
new file mode 100644
index 0000000..975f8e5
--- /dev/null
+++ b/wifi/tests/assets/hsr1/HSR1ProfileWithNonBase64Part.base64
@@ -0,0 +1,85 @@
+Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PXtib3VuZGFyeX0KQ29udGVu
+dC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTMyCgotLXtib3VuZGFyeX0KQ29udGVudC1UeXBlOiBh
+cHBsaWNhdGlvbi94LXBhc3Nwb2ludC1wcm9maWxlCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6
+IGJhc2U2NAoKUEUxbmJYUlVjbVZsSUhodGJHNXpQU0p6ZVc1amJXdzZaRzFrWkdZeExqSWlQZ29n
+SUR4V1pYSkVWRVErTVM0eVBDOVdaWEpFVkVRKwpDaUFnUEU1dlpHVStDaUFnSUNBOFRtOWtaVTVo
+YldVK1VHVnlVSEp2ZG1sa1pYSlRkV0p6WTNKcGNIUnBiMjQ4TDA1dlpHVk9ZVzFsClBnb2dJQ0Fn
+UEZKVVVISnZjR1Z5ZEdsbGN6NEtJQ0FnSUNBZ1BGUjVjR1UrQ2lBZ0lDQWdJQ0FnUEVSRVJrNWhi
+V1UrZFhKdU9uZG0KWVRwdGJ6cG9iM1J6Y0c5ME1tUnZkREF0Y0dWeWNISnZkbWxrWlhKemRXSnpZ
+M0pwY0hScGIyNDZNU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hMFpFUVZNS1RWSkJk
+MFJuCldVUldVVkZFUlhka1JsRldRV2RSTUVWNFoyZHJRV2QxVlZZelJFMTBWelp6ZDBSQldVUldV
+akJVUWtGVmQwRjNSVUl2ZWtGTVFtZE8KVmdwSVVUaEZRa0ZOUTBGUldYZEVVVmxLUzI5YVNXaDJZ
+MDVCVVVWTVFsRkJSR2RuUlVKQlJtWlJjVTlVUVRkU2RqZExLMngxVVRkdwpibUZ6TkVKWmQwaEZD
+amxIUlZBdmRXOW9kalpMVDNrd1ZFZFJSbUp5VWxScVJtOU1WazVDT1VKYU1YbHRUVVJhTUM5VVNY
+ZEpWV00zCmQyazNZVGgwTlcxRmNWbElNVFV6ZDFjS1lWZHZiMmxUYW5sTVRHaDFTVFJ6VG5KT1Ew
+OTBhWE5rUW5FeWNqSk5SbGgwTm1nd2JVRlIKV1U5UWRqaFNPRXMzTDJablUzaEhSbkY2YUhsT2JX
+MVdUQW94Y1VKS2JHUjRNelJUY0hkelZFRk1VVlpRWWpSb1IzZEtlbHBtY2pGUQpZM0JGVVhnMmVF
+MXVWR3c0ZUVWWFdrVXpUWE01T1hWaFZYaGlVWEZKZDFKMUNreG5RVTlyVGtOdFdUSnRPRGxXYUhw
+aFNFb3hkVlk0Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhCcVNVZHFUMWh5WnpG
+S1VDdHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIxS1duQnZUR3RQTDNS
+a1RrNTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVFSUVORgpVbFJKUmts
+RFFWUkZMUzB0TFMwSwotLXtib3VuZGFyeX0tLQo=
diff --git a/wifi/tests/assets/hsr1/HSR1ProfileWithoutProfile.base64 b/wifi/tests/assets/hsr1/HSR1ProfileWithoutProfile.base64
new file mode 100644
index 0000000..833c527
--- /dev/null
+++ b/wifi/tests/assets/hsr1/HSR1Prof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YaGlVWEZKZDFKMUNreG5RVTlyVGtO
+dFdUSnRPRGxXYUhwaFNFb3hkVlk0Ck5VRmtUUzkwUkN0WmMyMXNibTVxZERsTVVrTmxhbUpDYVhC
+cVNVZHFUMWh5WnpGS1VDdHNlRllLYlhWTk5IWklLMUF2Yld4dGVITlEKVUhvd1pEWTFZaXRGUjIx
+S1duQnZUR3RQTDNSa1RrNTJRMWw2YWtwd1ZFVlhjRVZ6VHpaT1RXaExXVzg5Q2kwdExTMHRSVTVF
+SUVORgpVbFJKUmtsRFFWUkZMUzB0TFMwSwotLXtib3VuZGFyeX0tLQo=
diff --git a/wifi/tests/assets/hsr1/README.txt b/wifi/tests/assets/hsr1/README.txt
new file mode 100644
index 0000000..d1f8384
--- /dev/null
+++ b/wifi/tests/assets/hsr1/README.txt
@@ -0,0 +1,5 @@
+HSR1ProfileWithCACert.conf - unencoded installation file that contains a Passpoint profile and a CA Certificate
+HSR1ProfileWithCACert.base64 - base64 encoded of the data contained in HSR1ProfileWithCAWith.conf
+HSR1ProfileWithNonBase64Part.base64 - base64 encoded installation file that contains a part of non-base64 encoding type
+HSR1ProfileWithMissingBoundary.base64 - base64 encoded installation file with missing end-boundary in the MIME data
+HSR1ProfileWithInvalidContentType.base64 - base64 encoded installation file with that contains a MIME part with an invalid content type.
diff --git a/wifi/tests/src/android/net/wifi/hotspot2/ConfigBuilderTest.java b/wifi/tests/src/android/net/wifi/hotspot2/ConfigBuilderTest.java
new file mode 100644
index 0000000..6095929
--- /dev/null
+++ b/wifi/tests/src/android/net/wifi/hotspot2/ConfigBuilderTest.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.net.wifi.hotspot2;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import android.net.wifi.FakeKeys;
+import android.net.wifi.hotspot2.pps.Credential;
+import android.net.wifi.hotspot2.pps.HomeSP;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+/**
+ * Unit tests for {@link android.net.wifi.hotspot2.ConfigBuilder}.
+ */
+@SmallTest
+public class ConfigBuilderTest {
+ /**
+ * Hotspot 2.0 Release 1 installation file that contains a Passpoint profile and a
+ * CA (Certificate Authority) X.509 certificate {@link FakeKeys#CA_CERT0}.
+ */
+ private static final String PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT =
+ "assets/hsr1/HSR1ProfileWithCACert.base64";
+ private static final String PASSPOINT_INSTALLATION_FILE_WITH_UNENCODED_DATA =
+ "assets/hsr1/HSR1ProfileWithCACert.conf";
+ private static final String PASSPOINT_INSTALLATION_FILE_WITH_INVALID_PART =
+ "assets/hsr1/HSR1ProfileWithNonBase64Part.base64";
+ private static final String PASSPOINT_INSTALLATION_FILE_WITH_MISSING_BOUNDARY =
+ "assets/hsr1/HSR1ProfileWithMissingBoundary.base64";
+ private static final String PASSPOINT_INSTALLATION_FILE_WITH_INVALID_CONTENT_TYPE =
+ "assets/hsr1/HSR1ProfileWithInvalidContentType.base64";
+ private static final String PASSPOINT_INSTALLATION_FILE_WITHOUT_PROFILE =
+ "assets/hsr1/HSR1ProfileWithoutProfile.base64";
+
+ /**
+ * Read the content of the given resource file into a String.
+ *
+ * @param filename String name of the file
+ * @return String
+ * @throws IOException
+ */
+ private String loadResourceFile(String filename) throws IOException {
+ InputStream in = getClass().getClassLoader().getResourceAsStream(filename);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ StringBuilder builder = new StringBuilder();
+ String line;
+ while ((line = reader.readLine()) != null) {
+ builder.append(line).append("\n");
+ }
+
+ return builder.toString();
+ }
+
+ /**
+ * Generate a {@link PasspointConfiguration} that matches the configuration specified in the
+ * XML file {@link #PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT}.
+ *
+ * @return {@link PasspointConfiguration}
+ */
+ private PasspointConfiguration generateConfigurationFromProfile() {
+ PasspointConfiguration config = new PasspointConfiguration();
+
+ // HomeSP configuration.
+ config.homeSp = new HomeSP();
+ config.homeSp.friendlyName = "Century House";
+ config.homeSp.fqdn = "mi6.co.uk";
+ config.homeSp.roamingConsortiumOIs = new long[] {0x112233L, 0x445566L};
+
+ // Credential configuration.
+ config.credential = new Credential();
+ config.credential.realm = "shaken.stirred.com";
+ config.credential.userCredential = new Credential.UserCredential();
+ config.credential.userCredential.username = "james";
+ config.credential.userCredential.password = "Ym9uZDAwNw==";
+ config.credential.userCredential.eapType = 21;
+ config.credential.userCredential.nonEapInnerMethod = "MS-CHAP-V2";
+ config.credential.certCredential = new Credential.CertificateCredential();
+ config.credential.certCredential.certType = "x509v3";
+ config.credential.certCredential.certSha256FingerPrint = new byte[32];
+ Arrays.fill(config.credential.certCredential.certSha256FingerPrint, (byte)0x1f);
+ config.credential.simCredential = new Credential.SimCredential();
+ config.credential.simCredential.imsi = "imsi";
+ config.credential.simCredential.eapType = 24;
+ config.credential.caCertificate = FakeKeys.CA_CERT0;
+ return config;
+ }
+
+ /**
+ * Verify a valid installation file is parsed successfully with the matching contents.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFile() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
+ PasspointConfiguration expectedConfig = generateConfigurationFromProfile();
+ PasspointConfiguration actualConfig =
+ ConfigBuilder.buildPasspointConfig(
+ "application/x-wifi-config", configStr.getBytes());
+ assertTrue(actualConfig.equals(expectedConfig));
+ }
+
+ /**
+ * Verify that parsing an installation file with invalid MIME type will fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFileWithInvalidMimeType() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
+ assertNull(ConfigBuilder.buildPasspointConfig(
+ "application/wifi-config", configStr.getBytes()));
+ }
+
+ /**
+ * Verify that parsing an un-encoded installation file will fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFileWithUnencodedData() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_UNENCODED_DATA);
+ assertNull(ConfigBuilder.buildPasspointConfig(
+ "application/x-wifi-config", configStr.getBytes()));
+ }
+
+ /**
+ * Verify that parsing an installation file that contains a non-base64 part will fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFileWithInvalidPart() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_PART);
+ assertNull(ConfigBuilder.buildPasspointConfig(
+ "application/x-wifi-config", configStr.getBytes()));
+ }
+
+ /**
+ * Verify that parsing an installation file that contains a missing boundary string will fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFileWithMissingBoundary() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_MISSING_BOUNDARY);
+ assertNull(ConfigBuilder.buildPasspointConfig(
+ "application/x-wifi-config", configStr.getBytes()));
+ }
+
+ /**
+ * Verify that parsing an installation file that contains a MIME part with an invalid content
+ * type will fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFileWithInvalidContentType() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_CONTENT_TYPE);
+ assertNull(ConfigBuilder.buildPasspointConfig(
+ "application/x-wifi-config", configStr.getBytes()));
+ }
+
+ /**
+ * Verify that parsing an installation file that doesn't contain a Passpoint profile will fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void parseConfigFileWithoutPasspointProfile() throws Exception {
+ String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITHOUT_PROFILE);
+ assertNull(ConfigBuilder.buildPasspointConfig(
+ "application/x-wifi-config", configStr.getBytes()));
+ }
+}
\ No newline at end of file