Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NsdService error due to subtypes on Android 14 #30830

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,13 @@ public void publish(
serviceInfo.setServiceName(serviceName);

/**
* Note, subtypes registration is using an undocumented feature of android dns-sd
* service/mDNSResponder which MAY STOP WORKING in future Android versions. Here, set type =
* "${type},${subtypes1},${subtypes2},...", then subtypes1, subtypes2 etc are all registered to
* this dns-sd server, we can usd `dns-sd -B ${type},${subtypes}` or avahi-browse
* ${subtypes}._sub.${type} -r to browser it
* TODO: Add subtypes registration when the Android NsdManager provides a documented mechanism
* to publish them. See https://issuetracker.google.com/u/3/issues/314256875
*/
StringBuilder sb = new StringBuilder(type);
for (String subType : subTypes) {
sb.append(",").append(subType);
}
serviceInfo.setServiceType(sb.toString());
serviceInfo.setServiceType(type);
sharadb-amazon marked this conversation as resolved.
Show resolved Hide resolved

serviceInfo.setPort(port);
Log.i(TAG, "publish serviceName=" + serviceName + " type=" + sb.toString() + " port=" + port);
Log.i(TAG, "publish serviceName=" + serviceName + " type=" + type + " port=" + port);
int cnt = Math.min(textEntriesDatas.length, textEntriesKeys.length);
for (int i = 0; i < cnt; i++) {
String value = new String(textEntriesDatas[i]);
Expand Down
Loading