summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Chen <jimmycmchen@google.com>2020-02-13 14:54:15 +0800
committerJimmy Chen <jimmycmchen@google.com>2020-02-13 17:46:04 +0800
commit892a6cb03480487b70f123801dcd9d5726e5e4ee (patch)
tree46038669c2c9cb7d30f42750260bdcdaf76c4695
parente1fc25ba4dfe6cef42d6f46cd102057b048be650 (diff)
wifi: revise ad-hoc reply message to common pattern
Bug: 36661185 Test: atest FrameworksWifiTests inject debug log to ensure the message is still sent and received. Change-Id: I34374303778790dfe4e7cf5a55a6fa746ca28cd5
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java1
-rw-r--r--service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java26
2 files changed, 4 insertions, 23 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 85702caa4..895b59beb 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -2697,7 +2697,6 @@ public class ClientModeImpl extends StateMachine {
msg.what = WifiP2pServiceImpl.BLOCK_DISCOVERY;
msg.arg1 = WifiP2pServiceImpl.ENABLED;
msg.arg2 = CMD_PRE_DHCP_ACTION_COMPLETE;
- msg.obj = ClientModeImpl.this;
mWifiP2pChannel.sendMessage(msg);
} else {
// If the p2p service is not running, we can proceed directly.
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
index 1e1b72d3a..270fb4d7f 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
@@ -963,17 +963,8 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
// always reset this - we went to a state that doesn't support discovery so
// it would have stopped regardless
mDiscoveryPostponed = false;
- if (mDiscoveryBlocked) {
- if (message.obj == null) {
- Log.e(TAG, "Illegal argument(s)");
- break;
- }
- StateMachine m = (StateMachine) message.obj;
- try {
- m.sendMessage(message.arg2);
- } catch (Exception e) {
- loge("unable to send BLOCK_DISCOVERY response: " + e);
- }
+ if (mDiscoveryBlocked && mWifiChannel != null) {
+ mWifiChannel.replyToMessage(message, message.arg2);
}
break;
case WifiP2pManager.DISCOVER_PEERS:
@@ -1525,17 +1516,8 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
mDiscoveryPostponed = false;
mWifiNative.p2pFind(DISCOVER_TIMEOUT_S);
}
- if (blocked) {
- if (message.obj == null) {
- Log.e(TAG, "Illegal argument(s)");
- break;
- }
- StateMachine m = (StateMachine) message.obj;
- try {
- m.sendMessage(message.arg2);
- } catch (Exception e) {
- loge("unable to send BLOCK_DISCOVERY response: " + e);
- }
+ if (blocked && mWifiChannel != null) {
+ mWifiChannel.replyToMessage(message, message.arg2);
}
break;
case WifiP2pManager.DISCOVER_PEERS: