Skip to content
Snippets Groups Projects
Commit a49e8e0b authored by Ken Chen's avatar Ken Chen
Browse files

Catch UnsupportedOperationException on calling mdns

MDNS native support from Netd is stopped in V.

Bug: 298594687
Bug: 312092770
Test: run CtsNetTestCasesMaxTargetSdk30 on V, no fatal exception.
Change-Id: I3774288cdf5b82e6aeeee7ee2d030fdc524e1aa8
parent 4a013c47
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ public class MDnsManager {
public void startDaemon() {
try {
mMdns.startDaemon();
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Start mdns failed.", e);
}
}
......@@ -62,7 +62,7 @@ public class MDnsManager {
public void stopDaemon() {
try {
mMdns.stopDaemon();
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Stop mdns failed.", e);
}
}
......@@ -85,7 +85,7 @@ public class MDnsManager {
registrationType, port, txtRecord, interfaceIdx);
try {
mMdns.registerService(info);
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Register service failed.", e);
return false;
}
......@@ -105,7 +105,7 @@ public class MDnsManager {
registrationType, "" /* domainName */, interfaceIdx, NETID_UNSET);
try {
mMdns.discover(info);
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Discover service failed.", e);
return false;
}
......@@ -129,7 +129,7 @@ public class MDnsManager {
new byte[0] /* txtRecord */, interfaceIdx);
try {
mMdns.resolve(info);
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Resolve service failed.", e);
return false;
}
......@@ -149,7 +149,7 @@ public class MDnsManager {
"" /* address */, interfaceIdx, NETID_UNSET);
try {
mMdns.getServiceAddress(info);
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Get service address failed.", e);
return false;
}
......@@ -165,7 +165,7 @@ public class MDnsManager {
public boolean stopOperation(int id) {
try {
mMdns.stopOperation(id);
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Stop operation failed.", e);
return false;
}
......@@ -180,7 +180,7 @@ public class MDnsManager {
public void registerEventListener(@NonNull IMDnsEventListener listener) {
try {
mMdns.registerEventListener(listener);
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Register listener failed.", e);
}
}
......@@ -193,7 +193,7 @@ public class MDnsManager {
public void unregisterEventListener(@NonNull IMDnsEventListener listener) {
try {
mMdns.unregisterEventListener(listener);
} catch (RemoteException | ServiceSpecificException e) {
} catch (RemoteException | ServiceSpecificException | UnsupportedOperationException e) {
Log.e(TAG, "Unregister listener failed.", e);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment