diff options
Diffstat (limited to 'service')
6 files changed, 106 insertions, 119 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java index 00bbe4239..63d72085f 100644 --- a/service/java/com/android/server/wifi/WifiInjector.java +++ b/service/java/com/android/server/wifi/WifiInjector.java @@ -31,7 +31,6 @@ import android.os.IBinder; import android.os.INetworkManagementService; import android.os.ServiceManager; import android.os.SystemProperties; -import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.security.KeyStore; @@ -103,6 +102,7 @@ public class WifiInjector { private final WifiPermissionsUtil mWifiPermissionsUtil; private final PasspointManager mPasspointManager; private final SIMAccessor mSimAccessor; + private HandlerThread mWifiAwareHandlerThread; private final boolean mUseRealLogger; @@ -399,4 +399,17 @@ public class WifiInjector { public WifiPermissionsWrapper getWifiPermissionsWrapper() { return mWifiPermissionsWrapper; } + + /** + * Returns a singleton instance of a HandlerThread for injection. Uses lazy initialization. + * + * TODO: share worker thread with other Wi-Fi handlers (b/27924886) + */ + public HandlerThread getmWifiAwareHandlerThread() { + if (mWifiAwareHandlerThread == null) { // lazy initialization + mWifiAwareHandlerThread = new HandlerThread("wifiAwareService"); + mWifiAwareHandlerThread.start(); + } + return mWifiAwareHandlerThread; + } } diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java index 124e67065..97df1f05d 100644 --- a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java +++ b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java @@ -39,6 +39,7 @@ public class WifiAwareDiscoverySessionState { private static final boolean DBG = false; private static final boolean VDBG = false; // STOPSHIP if true + private final WifiAwareNative mWifiAwareNative; private int mSessionId; private int mPubSubId; private IWifiAwareDiscoverySessionCallback mCallback; @@ -46,8 +47,9 @@ public class WifiAwareDiscoverySessionState { private final SparseArray<String> mMacByRequestorInstanceId = new SparseArray<>(); - public WifiAwareDiscoverySessionState(int sessionId, int pubSubId, - IWifiAwareDiscoverySessionCallback callback, boolean isPublishSession) { + public WifiAwareDiscoverySessionState(WifiAwareNative wifiAwareNative, int sessionId, + int pubSubId, IWifiAwareDiscoverySessionCallback callback, boolean isPublishSession) { + mWifiAwareNative = wifiAwareNative; mSessionId = sessionId; mPubSubId = pubSubId; mCallback = callback; @@ -91,9 +93,9 @@ public class WifiAwareDiscoverySessionState { mCallback = null; if (mIsPublishSession) { - WifiAwareNative.getInstance().stopPublish((short) 0, mPubSubId); + mWifiAwareNative.stopPublish((short) 0, mPubSubId); } else { - WifiAwareNative.getInstance().stopSubscribe((short) 0, mPubSubId); + mWifiAwareNative.stopSubscribe((short) 0, mPubSubId); } } @@ -126,7 +128,7 @@ public class WifiAwareDiscoverySessionState { return false; } - return WifiAwareNative.getInstance().publish(transactionId, mPubSubId, config); + return mWifiAwareNative.publish(transactionId, mPubSubId, config); } /** @@ -147,7 +149,7 @@ public class WifiAwareDiscoverySessionState { return false; } - return WifiAwareNative.getInstance().subscribe(transactionId, mPubSubId, config); + return mWifiAwareNative.subscribe(transactionId, mPubSubId, config); } /** @@ -175,8 +177,8 @@ public class WifiAwareDiscoverySessionState { } byte[] peerMac = HexEncoding.decode(peerMacStr.toCharArray(), false); - return WifiAwareNative.getInstance().sendMessage(transactionId, mPubSubId, peerId, peerMac, - message, messageId); + return mWifiAwareNative.sendMessage(transactionId, mPubSubId, peerId, peerMac, message, + messageId); } /** diff --git a/service/java/com/android/server/wifi/aware/WifiAwareNative.java b/service/java/com/android/server/wifi/aware/WifiAwareNative.java index 63da45827..ac4190aa4 100644 --- a/service/java/com/android/server/wifi/aware/WifiAwareNative.java +++ b/service/java/com/android/server/wifi/aware/WifiAwareNative.java @@ -42,37 +42,12 @@ public class WifiAwareNative { private static final int WIFI_SUCCESS = 0; - private static WifiAwareNative sWifiAwareNativeSingleton; - + private static WifiAwareStateManager sWifiAwareStateManager; private boolean mNativeHandlersIsInitialized = false; private static native int registerAwareNatives(); /** - * Returns the singleton WifiAwareNative used to manage the actual Aware HAL - * interface. - * - * @return Singleton object. - */ - public static WifiAwareNative getInstance() { - // dummy reference - used to make sure that WifiNative is loaded before - // us since it is the one to load the shared library and starts its - // initialization. - WifiNative dummy = WifiNative.getWlanNativeInterface(); - if (dummy == null) { - Log.w(TAG, "can't get access to WifiNative"); - return null; - } - - if (sWifiAwareNativeSingleton == null) { - sWifiAwareNativeSingleton = new WifiAwareNative(); - registerAwareNatives(); - } - - return sWifiAwareNativeSingleton; - } - - /** * A container class for Aware (vendor) implementation capabilities (or * limitations). Filled-in by the firmware. */ @@ -151,8 +126,14 @@ public class WifiAwareNative { mNativeHandlersIsInitialized = false; } - private WifiAwareNative() { - // do nothing + public WifiAwareNative(boolean doRegistration) { + if (doRegistration) { + registerAwareNatives(); + } + } + + public void setStateManager(WifiAwareStateManager awareStateManager) { + sWifiAwareStateManager = awareStateManager; } private static native int getCapabilitiesNative(short transactionId, Class<WifiNative> cls, @@ -659,16 +640,15 @@ public class WifiAwareNative { "onAwareNotifyResponse: transactionId=" + transactionId + ", responseType=" + responseType + ", status=" + status + ", nanError=" + nanError); } - WifiAwareStateManager stateMgr = WifiAwareStateManager.getInstance(); switch (responseType) { case AWARE_RESPONSE_ENABLED: /* fall through */ case AWARE_RESPONSE_CONFIG: if (status == AWARE_STATUS_SUCCESS) { - stateMgr.onConfigSuccessResponse(transactionId); + sWifiAwareStateManager.onConfigSuccessResponse(transactionId); } else { - stateMgr.onConfigFailedResponse(transactionId, status); + sWifiAwareStateManager.onConfigFailedResponse(transactionId, status); } break; case AWARE_RESPONSE_PUBLISH_CANCEL: @@ -680,9 +660,9 @@ public class WifiAwareNative { break; case AWARE_RESPONSE_TRANSMIT_FOLLOWUP: if (status == AWARE_STATUS_SUCCESS) { - stateMgr.onMessageSendQueuedSuccessResponse(transactionId); + sWifiAwareStateManager.onMessageSendQueuedSuccessResponse(transactionId); } else { - stateMgr.onMessageSendQueuedFailResponse(transactionId, status); + sWifiAwareStateManager.onMessageSendQueuedFailResponse(transactionId, status); } break; case AWARE_RESPONSE_SUBSCRIBE_CANCEL: @@ -699,7 +679,7 @@ public class WifiAwareNative { + "status=" + status + ", nanError=" + nanError); } - stateMgr.onCreateDataPathInterfaceResponse(transactionId, + sWifiAwareStateManager.onCreateDataPathInterfaceResponse(transactionId, status == AWARE_STATUS_SUCCESS, status); break; case AWARE_RESPONSE_DP_INTERFACE_DELETE: @@ -709,7 +689,7 @@ public class WifiAwareNative { + "status=" + status + ", nanError=" + nanError); } - stateMgr.onDeleteDataPathInterfaceResponse(transactionId, + sWifiAwareStateManager.onDeleteDataPathInterfaceResponse(transactionId, status == AWARE_STATUS_SUCCESS, status); break; case AWARE_RESPONSE_DP_RESPONDER_RESPONSE: @@ -718,7 +698,7 @@ public class WifiAwareNative { "onAwareNotifyResponse: AWARE_RESPONSE_DP_RESPONDER_RESPONSE error - " + "status=" + status + ", nanError=" + nanError); } - stateMgr.onRespondToDataPathSetupRequestResponse(transactionId, + sWifiAwareStateManager.onRespondToDataPathSetupRequestResponse(transactionId, status == AWARE_STATUS_SUCCESS, status); break; case AWARE_RESPONSE_DP_END: @@ -726,8 +706,8 @@ public class WifiAwareNative { Log.e(TAG, "onAwareNotifyResponse: AWARE_RESPONSE_DP_END error - status=" + status + ", nanError=" + nanError); } - stateMgr.onEndDataPathResponse(transactionId, status == AWARE_STATUS_SUCCESS, - status); + sWifiAwareStateManager.onEndDataPathResponse(transactionId, + status == AWARE_STATUS_SUCCESS, status); break; default: Log.e(TAG, "onAwareNotifyResponse: unclassified responseType=" + responseType); @@ -747,20 +727,19 @@ public class WifiAwareNative { switch (responseType) { case AWARE_RESPONSE_PUBLISH: if (status == AWARE_STATUS_SUCCESS) { - WifiAwareStateManager.getInstance().onSessionConfigSuccessResponse( - transactionId, true, pubSubId); + sWifiAwareStateManager.onSessionConfigSuccessResponse(transactionId, true, + pubSubId); } else { - WifiAwareStateManager.getInstance().onSessionConfigFailResponse(transactionId, - true, status); + sWifiAwareStateManager.onSessionConfigFailResponse(transactionId, true, status); } break; case AWARE_RESPONSE_SUBSCRIBE: if (status == AWARE_STATUS_SUCCESS) { - WifiAwareStateManager.getInstance().onSessionConfigSuccessResponse( - transactionId, false, pubSubId); + sWifiAwareStateManager.onSessionConfigSuccessResponse(transactionId, false, + pubSubId); } else { - WifiAwareStateManager.getInstance().onSessionConfigFailResponse(transactionId, - false, status); + sWifiAwareStateManager.onSessionConfigFailResponse(transactionId, false, + status); } break; default: @@ -779,8 +758,7 @@ public class WifiAwareNative { } if (status == AWARE_STATUS_SUCCESS) { - WifiAwareStateManager.getInstance().onCapabilitiesUpdateResponse(transactionId, - capabilities); + sWifiAwareStateManager.onCapabilitiesUpdateResponse(transactionId, capabilities); } else { Log.e(TAG, "onAwareNotifyResponseCapabilities: error status=" + status + ", nanError=" + nanError); @@ -795,11 +773,9 @@ public class WifiAwareNative { + ", status=" + status + ", nanError=" + nanError + ", ndpId=" + ndpId); } if (status == AWARE_STATUS_SUCCESS) { - WifiAwareStateManager.getInstance().onInitiateDataPathResponseSuccess(transactionId, - ndpId); + sWifiAwareStateManager.onInitiateDataPathResponseSuccess(transactionId, ndpId); } else { - WifiAwareStateManager.getInstance().onInitiateDataPathResponseFail(transactionId, - status); + sWifiAwareStateManager.onInitiateDataPathResponseFail(transactionId, status); } } @@ -815,12 +791,12 @@ public class WifiAwareNative { } if (eventType == AWARE_EVENT_ID_DISC_MAC_ADDR) { - WifiAwareStateManager.getInstance().onInterfaceAddressChangeNotification(mac); + sWifiAwareStateManager.onInterfaceAddressChangeNotification(mac); } else if (eventType == AWARE_EVENT_ID_STARTED_CLUSTER) { - WifiAwareStateManager.getInstance().onClusterChangeNotification( + sWifiAwareStateManager.onClusterChangeNotification( WifiAwareClientState.CLUSTER_CHANGE_EVENT_STARTED, mac); } else if (eventType == AWARE_EVENT_ID_JOINED_CLUSTER) { - WifiAwareStateManager.getInstance().onClusterChangeNotification( + sWifiAwareStateManager.onClusterChangeNotification( WifiAwareClientState.CLUSTER_CHANGE_EVENT_JOINED, mac); } else { Log.w(TAG, "onDiscoveryEngineEvent: invalid eventType=" + eventType); @@ -837,7 +813,7 @@ public class WifiAwareNative { + ", matchFilter=" + Arrays.toString(matchFilter)); } - WifiAwareStateManager.getInstance().onMatchNotification(pubSubId, requestorInstanceId, mac, + sWifiAwareStateManager.onMatchNotification(pubSubId, requestorInstanceId, mac, serviceSpecificInfo, matchFilter); } @@ -845,7 +821,7 @@ public class WifiAwareNative { private static void onPublishTerminated(int publishId, int status) { if (VDBG) Log.v(TAG, "onPublishTerminated: publishId=" + publishId + ", status=" + status); - WifiAwareStateManager.getInstance().onSessionTerminatedNotification(publishId, + sWifiAwareStateManager.onSessionTerminatedNotification(publishId, status == AWARE_STATUS_SUCCESS ? WifiAwareDiscoverySessionCallback.TERMINATE_REASON_DONE : WifiAwareDiscoverySessionCallback.TERMINATE_REASON_FAIL, true); @@ -857,7 +833,7 @@ public class WifiAwareNative { Log.v(TAG, "onSubscribeTerminated: subscribeId=" + subscribeId + ", status=" + status); } - WifiAwareStateManager.getInstance().onSessionTerminatedNotification(subscribeId, + sWifiAwareStateManager.onSessionTerminatedNotification(subscribeId, status == AWARE_STATUS_SUCCESS ? WifiAwareDiscoverySessionCallback.TERMINATE_REASON_DONE : WifiAwareDiscoverySessionCallback.TERMINATE_REASON_FAIL, false); @@ -871,15 +847,15 @@ public class WifiAwareNative { + requestorInstanceId + ", mac=" + String.valueOf(HexEncoding.encode(mac))); } - WifiAwareStateManager.getInstance().onMessageReceivedNotification(pubSubId, - requestorInstanceId, mac, message); + sWifiAwareStateManager.onMessageReceivedNotification(pubSubId, requestorInstanceId, mac, + message); } // callback from native private static void onDisabledEvent(int status) { if (VDBG) Log.v(TAG, "onDisabledEvent: status=" + status); - WifiAwareStateManager.getInstance().onAwareDownNotification(status); + sWifiAwareStateManager.onAwareDownNotification(status); } // callback from native @@ -890,10 +866,9 @@ public class WifiAwareNative { } if (reason == AWARE_STATUS_SUCCESS) { - WifiAwareStateManager.getInstance().onMessageSendSuccessNotification(transactionId); + sWifiAwareStateManager.onMessageSendSuccessNotification(transactionId); } else { - WifiAwareStateManager.getInstance().onMessageSendFailNotification(transactionId, - reason); + sWifiAwareStateManager.onMessageSendFailNotification(transactionId, reason); } } @@ -903,8 +878,7 @@ public class WifiAwareNative { HexEncoding.encode(mac)) + ", ndpId=" + ndpId); } - WifiAwareStateManager.getInstance() - .onDataPathRequestNotification(pubSubId, mac, ndpId, message); + sWifiAwareStateManager.onDataPathRequestNotification(pubSubId, mac, ndpId, message); } private static void onDataPathConfirm(int ndpId, byte[] mac, boolean accept, int reason, @@ -914,8 +888,7 @@ public class WifiAwareNative { .encode(mac)) + ", accept=" + accept + ", reason=" + reason); } - WifiAwareStateManager.getInstance() - .onDataPathConfirmNotification(ndpId, mac, accept, reason, message); + sWifiAwareStateManager.onDataPathConfirmNotification(ndpId, mac, accept, reason, message); } private static void onDataPathEnd(int ndpId) { @@ -923,6 +896,6 @@ public class WifiAwareNative { Log.v(TAG, "onDataPathEndNotification: ndpId=" + ndpId); } - WifiAwareStateManager.getInstance().onDataPathEndNotification(ndpId); + sWifiAwareStateManager.onDataPathEndNotification(ndpId); } } diff --git a/service/java/com/android/server/wifi/aware/WifiAwareService.java b/service/java/com/android/server/wifi/aware/WifiAwareService.java index afccfb66a..dde3f162a 100644 --- a/service/java/com/android/server/wifi/aware/WifiAwareService.java +++ b/service/java/com/android/server/wifi/aware/WifiAwareService.java @@ -17,9 +17,11 @@ package com.android.server.wifi.aware; import android.content.Context; +import android.os.HandlerThread; import android.util.Log; import com.android.server.SystemService; +import com.android.server.wifi.WifiInjector; /** * Service implementing Wi-Fi Aware functionality. Delegates actual interface @@ -43,7 +45,19 @@ public final class WifiAwareService extends SystemService { @Override public void onBootPhase(int phase) { if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { - mImpl.start(); + WifiInjector wifiInjector = WifiInjector.getInstance(); + if (wifiInjector == null) { + Log.e(TAG, "onBootPhase(PHASE_SYSTEM_SERVICES_READY): NULL injector!"); + return; + } + + HandlerThread awareHandlerThread = wifiInjector.getmWifiAwareHandlerThread(); + WifiAwareStateManager awareStateManager = new WifiAwareStateManager(); + WifiAwareNative awareNative = new WifiAwareNative(true); + awareStateManager.setNative(awareNative); + awareNative.setStateManager(awareStateManager); + + mImpl.start(awareHandlerThread, awareStateManager); } else if (phase == SystemService.PHASE_BOOT_COMPLETED) { mImpl.startLate(); } diff --git a/service/java/com/android/server/wifi/aware/WifiAwareServiceImpl.java b/service/java/com/android/server/wifi/aware/WifiAwareServiceImpl.java index 4c66e0070..d67f10320 100644 --- a/service/java/com/android/server/wifi/aware/WifiAwareServiceImpl.java +++ b/service/java/com/android/server/wifi/aware/WifiAwareServiceImpl.java @@ -62,7 +62,6 @@ public class WifiAwareServiceImpl extends IWifiAwareManager.Stub { public WifiAwareServiceImpl(Context context) { mContext = context.getApplicationContext(); - mStateManager = WifiAwareStateManager.getInstance(); } /** @@ -77,14 +76,11 @@ public class WifiAwareServiceImpl extends IWifiAwareManager.Stub { * Start the service: allocate a new thread (for now), start the handlers of * the components of the service. */ - public void start() { + public void start(HandlerThread handlerThread, WifiAwareStateManager awareStateManager) { Log.i(TAG, "Starting Wi-Fi Aware service"); - // TODO: share worker thread with other Wi-Fi handlers (b/27924886) - HandlerThread wifiAwareThread = new HandlerThread("wifiAwareService"); - wifiAwareThread.start(); - - mStateManager.start(mContext, wifiAwareThread.getLooper()); + mStateManager = awareStateManager; + mStateManager.start(mContext, handlerThread.getLooper()); } /** diff --git a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java index f43f44a91..1d85ca12d 100644 --- a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java +++ b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java @@ -70,8 +70,6 @@ public class WifiAwareStateManager { public static final String HAL_DATA_PATH_CONFIRM_TIMEOUT_TAG = TAG + " HAL Data Path Confirm Timeout"; - private static WifiAwareStateManager sAwareStateManagerSingleton; - /* * State machine message types. There are sub-types for the messages (except for TIMEOUTs). * Format: @@ -170,6 +168,8 @@ public class WifiAwareStateManager { private static final String MESSAGE_BUNDLE_KEY_MESSAGE_ARRIVAL_SEQ = "message_arrival_seq"; private static final String MESSAGE_BUNDLE_KEY_NOTIFY_IDENTITY_CHANGE = "notify_identity_chg"; + private WifiAwareNative mWifiAwareNative; + /* * Asynchronous access with no lock */ @@ -192,22 +192,12 @@ public class WifiAwareStateManager { private static final byte[] ALL_ZERO_MAC = new byte[] {0, 0, 0, 0, 0, 0}; private byte[] mCurrentDiscoveryInterfaceMac = ALL_ZERO_MAC; - private WifiAwareStateManager() { - // EMPTY: singleton pattern + public WifiAwareStateManager() { + // empty } - /** - * Access the singleton Aware state manager. Use a singleton since need to be - * accessed (for now) from several other child classes. - * - * @return The state manager singleton. - */ - public static WifiAwareStateManager getInstance() { - if (sAwareStateManagerSingleton == null) { - sAwareStateManagerSingleton = new WifiAwareStateManager(); - } - - return sAwareStateManagerSingleton; + public void setNative(WifiAwareNative awareNative) { + mWifiAwareNative = awareNative; } /** @@ -1340,8 +1330,7 @@ public class WifiAwareStateManager { } case COMMAND_TYPE_GET_CAPABILITIES: if (mCapabilities == null) { - waitForResponse = WifiAwareNative.getInstance().getCapabilities( - mCurrentTransactionId); + waitForResponse = mWifiAwareNative.getCapabilities(mCurrentTransactionId); } else { if (VDBG) { Log.v(TAG, "COMMAND_TYPE_GET_CAPABILITIES: already have capabilities - " @@ -1359,11 +1348,11 @@ public class WifiAwareStateManager { waitForResponse = false; break; case COMMAND_TYPE_CREATE_DATA_PATH_INTERFACE: - waitForResponse = WifiAwareNative.getInstance().createAwareNetworkInterface( + waitForResponse = mWifiAwareNative.createAwareNetworkInterface( mCurrentTransactionId, (String) msg.obj); break; case COMMAND_TYPE_DELETE_DATA_PATH_INTERFACE: - waitForResponse = WifiAwareNative.getInstance().deleteAwareNetworkInterface( + waitForResponse = mWifiAwareNative.deleteAwareNetworkInterface( mCurrentTransactionId, (String) msg.obj); break; case COMMAND_TYPE_INITIATE_DATA_PATH_SETUP: { @@ -1800,7 +1789,7 @@ public class WifiAwareStateManager { return false; } - return WifiAwareNative.getInstance().enableAndConfigure(transactionId, merged, + return mWifiAwareNative.enableAndConfigure(transactionId, merged, mCurrentAwareConfiguration == null); } @@ -1820,7 +1809,7 @@ public class WifiAwareStateManager { if (mClients.size() == 0) { mCurrentAwareConfiguration = null; - WifiAwareNative.getInstance().disable((short) 0); + mWifiAwareNative.disable((short) 0); return false; } @@ -1829,7 +1818,7 @@ public class WifiAwareStateManager { return false; } - return WifiAwareNative.getInstance().enableAndConfigure(transactionId, merged, false); + return mWifiAwareNative.enableAndConfigure(transactionId, merged, false); } private void terminateSessionLocal(int clientId, int sessionId) { @@ -1860,7 +1849,7 @@ public class WifiAwareStateManager { return false; } - return WifiAwareNative.getInstance().publish(transactionId, 0, publishConfig); + return mWifiAwareNative.publish(transactionId, 0, publishConfig); } private boolean updatePublishLocal(short transactionId, int clientId, int sessionId, @@ -1899,7 +1888,7 @@ public class WifiAwareStateManager { return false; } - return WifiAwareNative.getInstance().subscribe(transactionId, 0, subscribeConfig); + return mWifiAwareNative.subscribe(transactionId, 0, subscribeConfig); } private boolean updateSubscribeLocal(short transactionId, int clientId, int sessionId, @@ -1959,7 +1948,7 @@ public class WifiAwareStateManager { return; } - WifiAwareNative.getInstance().deInitAware(); // force a re-init of Aware HAL + mWifiAwareNative.deInitAware(); // force a re-init of Aware HAL mUsageEnabled = true; queryCapabilities(); @@ -1978,8 +1967,8 @@ public class WifiAwareStateManager { deleteAllDataPathInterfaces(); mUsageEnabled = false; - WifiAwareNative.getInstance().disable((short) 0); - WifiAwareNative.getInstance().deInitAware(); + mWifiAwareNative.disable((short) 0); + mWifiAwareNative.deInitAware(); sendAwareStateChangedBroadcast(false); } @@ -2034,7 +2023,7 @@ public class WifiAwareStateManager { + ", interfaceName=" + interfaceName + ", token=" + token); } - return WifiAwareNative.getInstance().initiateDataPath(transactionId, peerId, + return mWifiAwareNative.initiateDataPath(transactionId, peerId, channelRequestType, channel, peer, interfaceName, token); } @@ -2049,7 +2038,7 @@ public class WifiAwareStateManager { byte[] tokenBytes = token.getBytes(); - return WifiAwareNative.getInstance().respondToDataPathRequest(transactionId, accept, ndpId, + return mWifiAwareNative.respondToDataPathRequest(transactionId, accept, ndpId, interfaceName, tokenBytes); } @@ -2059,7 +2048,7 @@ public class WifiAwareStateManager { "endDataPathLocal: transactionId=" + transactionId + ", ndpId=" + ndpId); } - return WifiAwareNative.getInstance().endDataPath(transactionId, ndpId); + return mWifiAwareNative.endDataPath(transactionId, ndpId); } /* @@ -2161,8 +2150,8 @@ public class WifiAwareStateManager { return; } - WifiAwareDiscoverySessionState session = new WifiAwareDiscoverySessionState(sessionId, - pubSubId, callback, isPublish); + WifiAwareDiscoverySessionState session = new WifiAwareDiscoverySessionState( + mWifiAwareNative, sessionId, pubSubId, callback, isPublish); client.addSession(session); } else if (completedCommand.arg1 == COMMAND_TYPE_UPDATE_PUBLISH || completedCommand.arg1 == COMMAND_TYPE_UPDATE_SUBSCRIBE) { |