1 /* 2 * Copyright (C) 2023 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 android.net.wifi.sharedconnectivity.app; 18 19 import android.annotation.NonNull; 20 import android.annotation.SystemApi; 21 import android.net.wifi.sharedconnectivity.service.SharedConnectivityService; 22 23 import java.util.List; 24 25 /** 26 * Interface for clients of {@link SharedConnectivityManager} to register for changes in network 27 * status. 28 * 29 * @hide 30 */ 31 @SystemApi 32 public interface SharedConnectivityClientCallback { 33 /** 34 * This method is being called by {@link SharedConnectivityService} to notify of a change in the 35 * list of available Hotspot Networks. 36 * 37 * @param networks Updated Hotspot Network list. 38 */ onHotspotNetworksUpdated(@onNull List<HotspotNetwork> networks)39 void onHotspotNetworksUpdated(@NonNull List<HotspotNetwork> networks); 40 41 /** 42 * This method is being called by {@link SharedConnectivityService} to notify of a change in the 43 * list of available Known Networks. 44 * 45 * @param networks Updated Known Network list. 46 */ onKnownNetworksUpdated(@onNull List<KnownNetwork> networks)47 void onKnownNetworksUpdated(@NonNull List<KnownNetwork> networks); 48 49 /** 50 * This method is being called by {@link SharedConnectivityService} to notify of a change in the 51 * state of share connectivity settings. 52 * 53 * @param state The new state. 54 */ onSharedConnectivitySettingsChanged(@onNull SharedConnectivitySettingsState state)55 void onSharedConnectivitySettingsChanged(@NonNull SharedConnectivitySettingsState state); 56 57 /** 58 * This method is being called by {@link SharedConnectivityService} to notify of a change in the 59 * status of the current hotspot network connection. 60 * 61 * @param status The new status. 62 */ onHotspotNetworkConnectionStatusChanged(@onNull HotspotNetworkConnectionStatus status)63 void onHotspotNetworkConnectionStatusChanged(@NonNull HotspotNetworkConnectionStatus status); 64 65 /** 66 * This method is being called by {@link SharedConnectivityService} to notify of a change in the 67 * status of the current known network connection. 68 * 69 * @param status The new status. 70 */ onKnownNetworkConnectionStatusChanged(@onNull KnownNetworkConnectionStatus status)71 void onKnownNetworkConnectionStatusChanged(@NonNull KnownNetworkConnectionStatus status); 72 73 /** 74 * This method is being called when the service is ready to be used. 75 */ onServiceConnected()76 void onServiceConnected(); 77 78 /** 79 * This method is being called when the service is no longer available. 80 */ onServiceDisconnected()81 void onServiceDisconnected(); 82 83 /** 84 * This method is called when the registration of the callback with the shared connectivity 85 * service failed. 86 * 87 * @param exception The exception received from the system when trying to connect to the 88 * service. 89 */ onRegisterCallbackFailed(@onNull Exception exception)90 void onRegisterCallbackFailed(@NonNull Exception exception); 91 } 92 93