Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 681570ac authored by Hugo Benichi's avatar Hugo Benichi
Browse files

NsdService: minor cleanups

Minor cleanups in switches of processMessage and handleNativeEvent.

Test: no functional changes
Bug: 33074219

(cherry picked from commit 23dba85f)

Merged-In: I9ad4ce812c0d2c02a671a7a871ad427e4ce29b4a
Change-Id: Ic029cc9fa007d8c485f64f4afcbd4dc10da1ae29
parent fb320cbd
Loading
Loading
Loading
Loading
+10 −18
Original line number Diff line number Diff line
@@ -253,7 +253,6 @@ public class NsdService extends INsdManager.Stub {
            public boolean processMessage(Message msg) {
                ClientInfo clientInfo;
                NsdServiceInfo servInfo;
                boolean result = HANDLED;
                int id;
                switch (msg.what) {
                    case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED:
@@ -262,11 +261,9 @@ public class NsdService extends INsdManager.Stub {
                                mClients.size() == 0) {
                            startMDnsDaemon();
                        }
                        result = NOT_HANDLED;
                        break;
                        return NOT_HANDLED;
                    case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
                        result = NOT_HANDLED;
                        break;
                        return NOT_HANDLED;
                    case NsdManager.DISABLE:
                        //TODO: cleanup clients
                        transitionTo(mDisabledState);
@@ -377,26 +374,23 @@ public class NsdService extends INsdManager.Stub {
                    case NsdManager.NATIVE_DAEMON_EVENT:
                        NativeEvent event = (NativeEvent) msg.obj;
                        if (!handleNativeEvent(event.code, event.raw, event.cooked)) {
                            result = NOT_HANDLED;
                            return NOT_HANDLED;
                        }
                        break;
                    default:
                        result = NOT_HANDLED;
                        break;
                        return NOT_HANDLED;
                }
                return result;
                return HANDLED;
            }

            private boolean handleNativeEvent(int code, String raw, String[] cooked) {
                boolean handled = true;
                NsdServiceInfo servInfo;
                int id = Integer.parseInt(cooked[1]);
                ClientInfo clientInfo = mIdToClientInfoMap.get(id);
                if (clientInfo == null) {
                    String name = NativeResponseCode.nameOf(code);
                    Slog.e(TAG, String.format("id %d for %s has no client mapping", id, name));
                    handled = false;
                    return handled;
                    return false;
                }

                /* This goes in response as msg.arg2 */
@@ -409,8 +403,7 @@ public class NsdService extends INsdManager.Stub {
                    Slog.d(TAG, String.format(
                            "Notification %s for listener id %d that is no longer active",
                            name, id));
                    handled = false;
                    return handled;
                    return false;
                }
                if (DBG) {
                    String name = NativeResponseCode.nameOf(code);
@@ -518,10 +511,9 @@ public class NsdService extends INsdManager.Stub {
                        clientInfo.mResolvedService = null;
                        break;
                    default:
                        handled = false;
                        break;
                        return false;
                }
                return handled;
                return true;
            }
       }
    }