1 /** 2 * Copyright (c) 2018, 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 perNmissions and 14 * limitations under the License. 15 */ 16 package android.net; 17 18 import android.net.LinkProperties; 19 import android.net.NetworkCapabilities; 20 import android.net.PrivateDnsConfigParcel; 21 import android.net.networkstack.aidl.NetworkMonitorParameters; 22 23 /** @hide */ 24 oneway interface INetworkMonitor { 25 // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED. 26 // The network should be used as a default internet connection. It was found to be: 27 // 1. a functioning network providing internet access, or 28 // 2. a captive portal and the user decided to use it as is. 29 const int NETWORK_TEST_RESULT_VALID = 0; 30 31 // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED. 32 // The network should not be used as a default internet connection. It was found to be: 33 // 1. a captive portal and the user is prompted to sign-in, or 34 // 2. a captive portal and the user did not want to use it, or 35 // 3. a broken network (e.g. DNS failed, connect failed, HTTP request failed). 36 const int NETWORK_TEST_RESULT_INVALID = 1; 37 38 // After a network has been tested, this result can be sent with EVENT_NETWORK_TESTED. 39 // The network may be used as a default internet connection, but it was found to be a partial 40 // connectivity network which can get the pass result for http probe but get the failed result 41 // for https probe. 42 const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2; 43 44 // Network validation flags indicate probe result and types. If no NETWORK_VALIDATION_RESULT_* 45 // are set, then it's equal to NETWORK_TEST_RESULT_INVALID. If NETWORK_VALIDATION_RESULT_VALID 46 // is set, then the network validates and equal to NETWORK_TEST_RESULT_VALID. If 47 // NETWORK_VALIDATION_RESULT_PARTIAL is set, then the network has partial connectivity which 48 // is equal to NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY. Networks receiving validation that both 49 // do not require validation and are not validated will have NETWORK_VALIDATION_RESULT_SKIPPED 50 // set. NETWORK_VALIDATION_PROBE_* is set when the specific probe result of the network is 51 // resolved. 52 const int NETWORK_VALIDATION_RESULT_VALID = 0x01; 53 const int NETWORK_VALIDATION_RESULT_PARTIAL = 0x02; 54 const int NETWORK_VALIDATION_RESULT_SKIPPED = 0x04; 55 56 // NETWORK_VALIDATION_RESULT_* and NETWORK_VALIDATION_PROBE_* are independent values sent in 57 // different ints. 58 const int NETWORK_VALIDATION_PROBE_DNS = 0x04; 59 const int NETWORK_VALIDATION_PROBE_HTTP = 0x08; 60 const int NETWORK_VALIDATION_PROBE_HTTPS = 0x10; 61 const int NETWORK_VALIDATION_PROBE_FALLBACK = 0x20; 62 const int NETWORK_VALIDATION_PROBE_PRIVDNS = 0x40; 63 start()64 void start(); launchCaptivePortalApp()65 void launchCaptivePortalApp(); notifyCaptivePortalAppFinished(int response)66 void notifyCaptivePortalAppFinished(int response); setAcceptPartialConnectivity()67 void setAcceptPartialConnectivity(); forceReevaluation(int uid)68 void forceReevaluation(int uid); notifyPrivateDnsChanged(in PrivateDnsConfigParcel config)69 void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config); notifyDnsResponse(int returnCode)70 void notifyDnsResponse(int returnCode); 71 /** 72 * Notify NetworkMonitor that this network connected. 73 * @Deprecated use notifyNetworkConnectedParcel. 74 */ notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc)75 void notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc); notifyNetworkDisconnected()76 void notifyNetworkDisconnected(); notifyLinkPropertiesChanged(in LinkProperties lp)77 void notifyLinkPropertiesChanged(in LinkProperties lp); notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc)78 void notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc); 79 /** 80 * Notify NetworkMonitor that this network connected, version 2 81 */ notifyNetworkConnectedParcel(in NetworkMonitorParameters params)82 void notifyNetworkConnectedParcel(in NetworkMonitorParameters params); 83 } 84