1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.connectivity.mdns;
18 
19 import android.net.Network;
20 
21 /** Interface for monitoring connectivity changes. */
22 public interface ConnectivityMonitor {
23     /**
24      * Starts monitoring changes of connectivity of this device, which may indicate that the list of
25      * network interfaces available for multi-cast messaging has changed.
26      */
startWatchingConnectivityChanges()27     void startWatchingConnectivityChanges();
28 
29     /** Stops monitoring changes of connectivity. */
stopWatchingConnectivityChanges()30     void stopWatchingConnectivityChanges();
31 
notifyConnectivityChange()32     void notifyConnectivityChange();
33 
34     /** Get available network which is received from connectivity change. */
getAvailableNetwork()35     Network getAvailableNetwork();
36 
37     /** Listener interface for receiving connectivity changes. */
38     interface Listener {
onConnectivityChanged()39         void onConnectivityChanged();
40     }
41 }