From 2946076de20c9a6bf101eb2f453c4ef952280ff2 Mon Sep 17 00:00:00 2001 From: Ningyuan Wang Date: Thu, 17 Aug 2017 15:14:11 -0700 Subject: Remove wificond related code from RttService Bug: 64809697 Test: compile, unit tests Change-Id: I2af9e0d6e2ad6870a3a842088f9cf1cc31efdc27 --- .../java/com/android/server/wifi/RttService.java | 70 ---------------------- 1 file changed, 70 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/RttService.java b/service/java/com/android/server/wifi/RttService.java index 89de870bb..ffb000451 100644 --- a/service/java/com/android/server/wifi/RttService.java +++ b/service/java/com/android/server/wifi/RttService.java @@ -6,11 +6,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; -import android.net.wifi.IApInterface; -import android.net.wifi.IClientInterface; -import android.net.wifi.IInterfaceEventCallback; import android.net.wifi.IRttManager; -import android.net.wifi.IWificond; import android.net.wifi.RttManager; import android.net.wifi.RttManager.ResponderConfig; import android.net.wifi.WifiManager; @@ -41,14 +37,12 @@ import java.io.PrintWriter; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; -import java.util.List; import java.util.Queue; import java.util.Set; public final class RttService extends SystemService { public static final boolean DBG = true; - private static final String WIFICOND_SERVICE_NAME = "wificond"; static class RttServiceImpl extends IRttManager.Stub { private int mCurrentKey = 100; // increment on each usage @@ -353,37 +347,11 @@ public final class RttService extends SystemService { private static final int CMD_DRIVER_UNLOADED = BASE + 1; private static final int CMD_ISSUE_NEXT_REQUEST = BASE + 2; private static final int CMD_RTT_RESPONSE = BASE + 3; - private static final int CMD_CLIENT_INTERFACE_READY = BASE + 4; - private static final int CMD_CLIENT_INTERFACE_DOWN = BASE + 5; // Maximum duration for responder role. private static final int MAX_RESPONDER_DURATION_SECONDS = 60 * 10; - private static class InterfaceEventHandler extends IInterfaceEventCallback.Stub { - InterfaceEventHandler(RttStateMachine rttStateMachine) { - mRttStateMachine = rttStateMachine; - } - @Override - public void OnClientTorndownEvent(IClientInterface networkInterface) { - mRttStateMachine.sendMessage(CMD_CLIENT_INTERFACE_DOWN, networkInterface); - } - @Override - public void OnClientInterfaceReady(IClientInterface networkInterface) { - mRttStateMachine.sendMessage(CMD_CLIENT_INTERFACE_READY, networkInterface); - } - @Override - public void OnApTorndownEvent(IApInterface networkInterface) { } - @Override - public void OnApInterfaceReady(IApInterface networkInterface) { } - - private RttStateMachine mRttStateMachine; - } - class RttStateMachine extends StateMachine { - private IWificond mWificond; - private InterfaceEventHandler mInterfaceEventHandler; - private IClientInterface mClientInterface; - DefaultState mDefaultState = new DefaultState(); EnabledState mEnabledState = new EnabledState(); InitiatorEnabledState mInitiatorEnabledState = new InitiatorEnabledState(); @@ -445,39 +413,9 @@ public final class RttService extends SystemService { class EnabledState extends State { @Override public void enter() { - // This allows us to tolerate wificond restarts. - // When wificond restarts WifiStateMachine is supposed to go - // back to initial state and restart. - // 1) RttService watches for WIFI_STATE_ENABLED broadcasts - // 2) WifiStateMachine sends these broadcasts in the SupplicantStarted state - // 3) Since WSM will only be in SupplicantStarted for as long as wificond is - // alive, we refresh our wificond handler here and we don't subscribe to - // wificond's death explicitly. - mWificond = mWifiInjector.makeWificond(); - if (mWificond == null) { - Log.w(TAG, "Failed to get wificond binder handler"); - transitionTo(mDefaultState); - } - mInterfaceEventHandler = new InterfaceEventHandler(mStateMachine); - try { - mWificond.RegisterCallback(mInterfaceEventHandler); - // Get the current client interface, assuming there is at most - // one client interface for now. - List interfaces = mWificond.GetClientInterfaces(); - if (interfaces.size() > 0) { - mStateMachine.sendMessage( - CMD_CLIENT_INTERFACE_READY, - IClientInterface.Stub.asInterface(interfaces.get(0))); - } - } catch (RemoteException e1) { } - } @Override public void exit() { - try { - mWificond.UnregisterCallback(mInterfaceEventHandler); - } catch (RemoteException e1) { } - mInterfaceEventHandler = null; } @Override public boolean processMessage(Message msg) { @@ -541,14 +479,6 @@ public final class RttService extends SystemService { break; case RttManager.CMD_OP_DISABLE_RESPONDER: break; - case CMD_CLIENT_INTERFACE_DOWN: - if (mClientInterface == (IClientInterface) msg.obj) { - mClientInterface = null; - } - break; - case CMD_CLIENT_INTERFACE_READY: - mClientInterface = (IClientInterface) msg.obj; - break; default: return NOT_HANDLED; } -- cgit v1.2.3