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 
22 /** @hide */
23 oneway interface INetworkMonitor {
24     // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED.
25     // The network should be used as a default internet connection.  It was found to be:
26     // 1. a functioning network providing internet access, or
27     // 2. a captive portal and the user decided to use it as is.
28     const int NETWORK_TEST_RESULT_VALID = 0;
29 
30     // After a network has been tested this result can be sent with EVENT_NETWORK_TESTED.
31     // The network should not be used as a default internet connection.  It was found to be:
32     // 1. a captive portal and the user is prompted to sign-in, or
33     // 2. a captive portal and the user did not want to use it, or
34     // 3. a broken network (e.g. DNS failed, connect failed, HTTP request failed).
35     const int NETWORK_TEST_RESULT_INVALID = 1;
36 
37     // After a network has been tested, this result can be sent with EVENT_NETWORK_TESTED.
38     // The network may be used as a default internet connection, but it was found to be a partial
39     // connectivity network which can get the pass result for http probe but get the failed result
40     // for https probe.
41     const int NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY = 2;
42 
43     // Network validation flags indicate probe result and types. If no NETWORK_VALIDATION_RESULT_*
44     // are set, then it's equal to NETWORK_TEST_RESULT_INVALID. If NETWORK_VALIDATION_RESULT_VALID
45     // is set, then the network validates and equal to NETWORK_TEST_RESULT_VALID. If
46     // NETWORK_VALIDATION_RESULT_PARTIAL is set, then the network has partial connectivity which
47     // is equal to NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY. NETWORK_VALIDATION_PROBE_* is set
48     // when the specific probe result of the network is resolved.
49     const int NETWORK_VALIDATION_RESULT_VALID = 0x01;
50     const int NETWORK_VALIDATION_RESULT_PARTIAL = 0x02;
51     const int NETWORK_VALIDATION_PROBE_DNS = 0x04;
52     const int NETWORK_VALIDATION_PROBE_HTTP = 0x08;
53     const int NETWORK_VALIDATION_PROBE_HTTPS = 0x10;
54     const int NETWORK_VALIDATION_PROBE_FALLBACK = 0x20;
55     const int NETWORK_VALIDATION_PROBE_PRIVDNS = 0x40;
56 
start()57     void start();
launchCaptivePortalApp()58     void launchCaptivePortalApp();
notifyCaptivePortalAppFinished(int response)59     void notifyCaptivePortalAppFinished(int response);
setAcceptPartialConnectivity()60     void setAcceptPartialConnectivity();
forceReevaluation(int uid)61     void forceReevaluation(int uid);
notifyPrivateDnsChanged(in PrivateDnsConfigParcel config)62     void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config);
notifyDnsResponse(int returnCode)63     void notifyDnsResponse(int returnCode);
notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc)64     void notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc);
notifyNetworkDisconnected()65     void notifyNetworkDisconnected();
notifyLinkPropertiesChanged(in LinkProperties lp)66     void notifyLinkPropertiesChanged(in LinkProperties lp);
notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc)67     void notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc);
68 }
69