Merge "Add LOCATION_HARDWARE permission to Rtt API." into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
90658fab43
@@ -1,5 +1,6 @@
|
|||||||
package android.net.wifi;
|
package android.net.wifi;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
@@ -313,6 +314,7 @@ public class RttManager {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermission(Manifest.permission.LOCATION_HARDWARE)
|
||||||
public RttCapabilities getRttCapabilities() {
|
public RttCapabilities getRttCapabilities() {
|
||||||
synchronized (mCapabilitiesLock) {
|
synchronized (mCapabilitiesLock) {
|
||||||
if (mRttCapabilities == null) {
|
if (mRttCapabilities == null) {
|
||||||
@@ -925,6 +927,51 @@ public class RttManager {
|
|||||||
public void onAborted();
|
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) {
|
private boolean rttParamSanity(RttParams params, int index) {
|
||||||
if (mRttCapabilities == null) {
|
if (mRttCapabilities == null) {
|
||||||
if(getRttCapabilities() == null) {
|
if(getRttCapabilities() == null) {
|
||||||
@@ -1236,7 +1283,8 @@ public class RttManager {
|
|||||||
mAsyncChannel.connectSync(mContext, handler, messenger);
|
mAsyncChannel.connectSync(mContext, handler, messenger);
|
||||||
// We cannot use fullyConnectSync because it sends the FULL_CONNECTION message
|
// We cannot use fullyConnectSync because it sends the FULL_CONNECTION message
|
||||||
// synchronously, which causes RttService to receive the wrong replyTo value.
|
// 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]);
|
mAsyncChannel.sendMessage(CMD_OP_REG_BINDER, key[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user