Merge "Remove the DisabledState from NsdService" am: d65740346e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2110094 Change-Id: I2762dcef06e9d0e54546f2d522febe9d17d5b4a6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -175,6 +175,7 @@ public final class NsdManager {
|
|||||||
*
|
*
|
||||||
* @see #ACTION_NSD_STATE_CHANGED
|
* @see #ACTION_NSD_STATE_CHANGED
|
||||||
*/
|
*/
|
||||||
|
// TODO: Deprecate this since NSD service is never disabled.
|
||||||
public static final int NSD_STATE_DISABLED = 1;
|
public static final int NSD_STATE_DISABLED = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -230,17 +231,12 @@ public final class NsdManager {
|
|||||||
public static final int DAEMON_STARTUP = 19;
|
public static final int DAEMON_STARTUP = 19;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int ENABLE = 20;
|
public static final int MDNS_SERVICE_EVENT = 20;
|
||||||
/** @hide */
|
|
||||||
public static final int DISABLE = 21;
|
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int MDNS_SERVICE_EVENT = 22;
|
public static final int REGISTER_CLIENT = 21;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int REGISTER_CLIENT = 23;
|
public static final int UNREGISTER_CLIENT = 22;
|
||||||
/** @hide */
|
|
||||||
public static final int UNREGISTER_CLIENT = 24;
|
|
||||||
|
|
||||||
/** Dns based service discovery protocol */
|
/** Dns based service discovery protocol */
|
||||||
public static final int PROTOCOL_DNS_SD = 0x0001;
|
public static final int PROTOCOL_DNS_SD = 0x0001;
|
||||||
@@ -266,8 +262,6 @@ public final class NsdManager {
|
|||||||
EVENT_NAMES.put(RESOLVE_SERVICE_SUCCEEDED, "RESOLVE_SERVICE_SUCCEEDED");
|
EVENT_NAMES.put(RESOLVE_SERVICE_SUCCEEDED, "RESOLVE_SERVICE_SUCCEEDED");
|
||||||
EVENT_NAMES.put(DAEMON_CLEANUP, "DAEMON_CLEANUP");
|
EVENT_NAMES.put(DAEMON_CLEANUP, "DAEMON_CLEANUP");
|
||||||
EVENT_NAMES.put(DAEMON_STARTUP, "DAEMON_STARTUP");
|
EVENT_NAMES.put(DAEMON_STARTUP, "DAEMON_STARTUP");
|
||||||
EVENT_NAMES.put(ENABLE, "ENABLE");
|
|
||||||
EVENT_NAMES.put(DISABLE, "DISABLE");
|
|
||||||
EVENT_NAMES.put(MDNS_SERVICE_EVENT, "MDNS_SERVICE_EVENT");
|
EVENT_NAMES.put(MDNS_SERVICE_EVENT, "MDNS_SERVICE_EVENT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ public class NsdService extends INsdManager.Stub {
|
|||||||
private class NsdStateMachine extends StateMachine {
|
private class NsdStateMachine extends StateMachine {
|
||||||
|
|
||||||
private final DefaultState mDefaultState = new DefaultState();
|
private final DefaultState mDefaultState = new DefaultState();
|
||||||
private final DisabledState mDisabledState = new DisabledState();
|
|
||||||
private final EnabledState mEnabledState = new EnabledState();
|
private final EnabledState mEnabledState = new EnabledState();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -152,7 +151,6 @@ public class NsdService extends INsdManager.Stub {
|
|||||||
NsdStateMachine(String name, Handler handler) {
|
NsdStateMachine(String name, Handler handler) {
|
||||||
super(name, handler);
|
super(name, handler);
|
||||||
addState(mDefaultState);
|
addState(mDefaultState);
|
||||||
addState(mDisabledState, mDefaultState);
|
|
||||||
addState(mEnabledState, mDefaultState);
|
addState(mEnabledState, mDefaultState);
|
||||||
State initialState = mEnabledState;
|
State initialState = mEnabledState;
|
||||||
setInitialState(initialState);
|
setInitialState(initialState);
|
||||||
@@ -250,25 +248,6 @@ public class NsdService extends INsdManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DisabledState extends State {
|
|
||||||
@Override
|
|
||||||
public void enter() {
|
|
||||||
sendNsdStateChangeBroadcast(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean processMessage(Message msg) {
|
|
||||||
switch (msg.what) {
|
|
||||||
case NsdManager.ENABLE:
|
|
||||||
transitionTo(mEnabledState);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return NOT_HANDLED;
|
|
||||||
}
|
|
||||||
return HANDLED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class EnabledState extends State {
|
class EnabledState extends State {
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
@@ -312,10 +291,6 @@ public class NsdService extends INsdManager.Stub {
|
|||||||
final int clientId = msg.arg2;
|
final int clientId = msg.arg2;
|
||||||
final ListenerArgs args;
|
final ListenerArgs args;
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case NsdManager.DISABLE:
|
|
||||||
//TODO: cleanup clients
|
|
||||||
transitionTo(mDisabledState);
|
|
||||||
break;
|
|
||||||
case NsdManager.DISCOVER_SERVICES:
|
case NsdManager.DISCOVER_SERVICES:
|
||||||
if (DBG) Log.d(TAG, "Discover services");
|
if (DBG) Log.d(TAG, "Discover services");
|
||||||
args = (ListenerArgs) msg.obj;
|
args = (ListenerArgs) msg.obj;
|
||||||
|
|||||||
Reference in New Issue
Block a user