diff options
author | Irfan Sheriff <isheriff@google.com> | 2012-04-13 12:15:41 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2012-04-15 17:09:48 -0700 |
commit | 92784670c48759c0db604ddb95c05a7b9bdebed8 (patch) | |
tree | b7cc7829b366f64e6bf9e8b200c2e6d915d6e945 /services/java/com/android/server/NsdService.java | |
parent | d4fecc2567ca54427b9c86900bccbc7103ea8fde (diff) | |
download | frameworks_base-92784670c48759c0db604ddb95c05a7b9bdebed8.zip frameworks_base-92784670c48759c0db604ddb95c05a7b9bdebed8.tar.gz frameworks_base-92784670c48759c0db604ddb95c05a7b9bdebed8.tar.bz2 |
Open network service discovery API
Add support for DNS based network service discovery API. This
allows applications to discover and resolve applications on a
local network such as Wi-Fi
Change-Id: Ie89895edd35d12b7f7a23fb5fed36cb2b2079f7a
Diffstat (limited to 'services/java/com/android/server/NsdService.java')
-rw-r--r-- | services/java/com/android/server/NsdService.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/services/java/com/android/server/NsdService.java b/services/java/com/android/server/NsdService.java index a3ac8d0..8014e27 100644 --- a/services/java/com/android/server/NsdService.java +++ b/services/java/com/android/server/NsdService.java @@ -167,6 +167,18 @@ public class NsdService extends INsdManager.Stub { NsdManager.ERROR); } break; + case NsdManager.UNREGISTER_SERVICE: + if (DBG) Slog.d(TAG, "unregister service"); + clientInfo = mClients.get(msg.replyTo); + int regId = msg.arg1; + if (clientInfo.mRegisteredIds.remove(new Integer(regId)) && + unregisterService(regId)) { + mReplyChannel.replyToMessage(msg, NsdManager.UNREGISTER_SERVICE_SUCCEEDED); + } else { + mReplyChannel.replyToMessage(msg, NsdManager.UNREGISTER_SERVICE_FAILED, + NsdManager.ERROR); + } + break; case NsdManager.UPDATE_SERVICE: if (DBG) Slog.d(TAG, "Update service"); //TODO: implement @@ -237,6 +249,8 @@ public class NsdService extends INsdManager.Stub { } public Messenger getMessenger() { + mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERNET, + "NsdService"); return new Messenger(mAsyncServiceHandler); } |