Merge "Add LOCATION_HARDWARE permission to Rtt API." into oc-mr1-dev am: 90658fab43
am: aed54f78bc
Change-Id: I540d53bb47b6b7ccc677fc3a9b80438b833dcb4d
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package android.net.wifi;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -313,6 +314,7 @@ public class RttManager {
|
||||
};
|
||||
}
|
||||
|
||||
@RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
|
||||
public RttCapabilities getRttCapabilities() {
|
||||
synchronized (mCapabilitiesLock) {
|
||||
if (mRttCapabilities == null) {
|
||||
@@ -925,6 +927,51 @@ public class RttManager {
|
||||
public void onAborted();
|
||||
}
|
||||
|
||||
/**
|
||||
* A parcelable that contains rtt client information.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static class RttClient implements Parcelable {
|
||||
// Package name of RttClient.
|
||||
private final String mPackageName;
|
||||
|
||||
public RttClient(String packageName) {
|
||||
mPackageName = packageName;
|
||||
}
|
||||
|
||||
protected RttClient(Parcel in) {
|
||||
mPackageName = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<RttManager.RttClient> CREATOR =
|
||||
new Creator<RttManager.RttClient>() {
|
||||
@Override
|
||||
public RttManager.RttClient createFromParcel(Parcel in) {
|
||||
return new RttManager.RttClient(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RttManager.RttClient[] newArray(int size) {
|
||||
return new RttManager.RttClient[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(mPackageName);
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return mPackageName;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean rttParamSanity(RttParams params, int index) {
|
||||
if (mRttCapabilities == null) {
|
||||
if(getRttCapabilities() == null) {
|
||||
@@ -1236,7 +1283,8 @@ public class RttManager {
|
||||
mAsyncChannel.connectSync(mContext, handler, messenger);
|
||||
// We cannot use fullyConnectSync because it sends the FULL_CONNECTION message
|
||||
// synchronously, which causes RttService to receive the wrong replyTo value.
|
||||
mAsyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION);
|
||||
mAsyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION,
|
||||
new RttClient(context.getPackageName()));
|
||||
mAsyncChannel.sendMessage(CMD_OP_REG_BINDER, key[0]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user