Add a CompatChange flag to enable platform backend
Apps targeting sdk < U are considered to use a legacy native daemon as NsdManager backend, but other apps use a platform-integration mDNS implementation as backend. So add a CompatChange flag to enable platform backend for non-legacy apps. Bug: 270306772 Test: atest FrameworksNetTests CtsNetTestCases Change-Id: I7ba58f8a5186fb49ad5f8aeacc8b8234bef1eabe
This commit is contained in:
@@ -26,5 +26,5 @@ import android.os.Messenger;
|
||||
* {@hide}
|
||||
*/
|
||||
interface INsdManager {
|
||||
INsdServiceConnector connect(INsdManagerCallback cb);
|
||||
INsdServiceConnector connect(INsdManagerCallback cb, boolean useJavaBackend);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.net.nsd;
|
||||
|
||||
import static android.net.connectivity.ConnectivityCompatChanges.ENABLE_PLATFORM_MDNS_BACKEND;
|
||||
import static android.net.connectivity.ConnectivityCompatChanges.RUN_NATIVE_NSD_ONLY_IF_LEGACY_APPS_T_AND_LATER;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
@@ -510,7 +511,8 @@ public final class NsdManager {
|
||||
mHandler = new ServiceHandler(t.getLooper());
|
||||
|
||||
try {
|
||||
mService = service.connect(new NsdCallbackImpl(mHandler));
|
||||
mService = service.connect(new NsdCallbackImpl(mHandler), CompatChanges.isChangeEnabled(
|
||||
ENABLE_PLATFORM_MDNS_BACKEND));
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException("Failed to connect to NsdService");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user