[Aware] Add support utility for PeerHandle to MAC translation

Add a support API to be used between system services only: added
in support of RTT service which is provided with a PeerHandle but
needs the corresponding MAC address.

Bug: 65015034
Test: unit tests on service, integration tests with RTT
Change-Id: I6848acda9bfef306b8feaae6987ff18f7bc2e6ec
This commit is contained in:
Etan Cohen
2017-09-27 13:57:02 -07:00
parent 80fc4df017
commit 3d33d7495f
4 changed files with 54 additions and 2 deletions

View File

@@ -548,9 +548,10 @@ LOCAL_SRC_FILES += \
telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl \
wifi/java/android/net/wifi/IWifiManager.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/aware/IWifiAwareEventCallback.aidl \
wifi/java/android/net/wifi/aware/IWifiAwareMacAddressProvider.aidl \
wifi/java/android/net/wifi/aware/IWifiAwareManager.aidl \
wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \
wifi/java/android/net/wifi/rtt/IRttCallback.aidl \
wifi/java/android/net/wifi/rtt/IWifiRttManager.aidl \

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2017 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;
/**
* Callback for IWifiAwareManager.getMacAddressFromPeerHandle
*
* @hide
*/
oneway interface IWifiAwareMacAddressProvider
{
void macAddress(in Map peerIdToMacMap);
}

View File

@@ -21,6 +21,7 @@ import android.app.PendingIntent;
import android.net.wifi.aware.ConfigRequest;
import android.net.wifi.aware.IWifiAwareDiscoverySessionCallback;
import android.net.wifi.aware.IWifiAwareEventCallback;
import android.net.wifi.aware.IWifiAwareMacAddressProvider;
import android.net.wifi.aware.PublishConfig;
import android.net.wifi.aware.SubscribeConfig;
import android.net.wifi.aware.Characteristics;
@@ -52,4 +53,7 @@ interface IWifiAwareManager
void sendMessage(int clientId, int discoverySessionId, int peerId, in byte[] message,
int messageId, int retryCount);
void terminateSession(int clientId, int discoverySessionId);
// internal APIs: intended to be used between System Services (restricted permissions)
void requestMacAddresses(int uid, in List peerIds, in IWifiAwareMacAddressProvider callback);
}

View File

@@ -32,4 +32,24 @@ public class PeerHandle {
/** @hide */
public int peerId;
/** @hide RTT_API */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PeerHandle)) {
return false;
}
return peerId == ((PeerHandle) o).peerId;
}
/** @hide RTT_API */
@Override
public int hashCode() {
return peerId;
}
}