1 /*
2  * Copyright (C) 2019 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;
18 
19 import android.annotation.IntDef;
20 import android.annotation.StringDef;
21 
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy;
24 
25 /**
26  * Wifi annotations meant to be statically linked into client modules, since they cannot be
27  * exposed as @SystemApi.
28  *
29  * e.g. {@link IntDef}, {@link StringDef}
30  *
31  * @hide
32  */
33 public final class WifiAnnotations {
WifiAnnotations()34     private WifiAnnotations() {}
35 
36     @Retention(RetentionPolicy.SOURCE)
37     @IntDef(prefix = {"SCAN_TYPE_"}, value = {
38             WifiScanner.SCAN_TYPE_LOW_LATENCY,
39             WifiScanner.SCAN_TYPE_LOW_POWER,
40             WifiScanner.SCAN_TYPE_HIGH_ACCURACY})
41     public @interface ScanType {}
42 
43     @Retention(RetentionPolicy.SOURCE)
44     @IntDef(prefix = {"WIFI_BAND_"}, value = {
45             WifiScanner.WIFI_BAND_UNSPECIFIED,
46             WifiScanner.WIFI_BAND_24_GHZ,
47             WifiScanner.WIFI_BAND_5_GHZ,
48             WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY,
49             WifiScanner.WIFI_BAND_6_GHZ})
50     public @interface WifiBandBasic {}
51 
52     @IntDef(prefix = { "CHANNEL_WIDTH_" }, value = {
53             SoftApInfo.CHANNEL_WIDTH_INVALID,
54             SoftApInfo.CHANNEL_WIDTH_20MHZ_NOHT,
55             SoftApInfo.CHANNEL_WIDTH_20MHZ,
56             SoftApInfo.CHANNEL_WIDTH_40MHZ,
57             SoftApInfo.CHANNEL_WIDTH_80MHZ,
58             SoftApInfo.CHANNEL_WIDTH_80MHZ_PLUS_MHZ,
59             SoftApInfo.CHANNEL_WIDTH_160MHZ,
60             SoftApInfo.CHANNEL_WIDTH_320MHZ,
61             SoftApInfo.CHANNEL_WIDTH_2160MHZ,
62             SoftApInfo.CHANNEL_WIDTH_4320MHZ,
63             SoftApInfo.CHANNEL_WIDTH_6480MHZ,
64             SoftApInfo.CHANNEL_WIDTH_8640MHZ,
65     })
66     @Retention(RetentionPolicy.SOURCE)
67     public @interface Bandwidth {}
68 
69     @IntDef(prefix = { "CHANNEL_WIDTH_" }, value = {
70             ScanResult.CHANNEL_WIDTH_20MHZ,
71             ScanResult.CHANNEL_WIDTH_40MHZ,
72             ScanResult.CHANNEL_WIDTH_80MHZ,
73             ScanResult.CHANNEL_WIDTH_160MHZ,
74             ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ,
75             ScanResult.CHANNEL_WIDTH_320MHZ,
76     })
77     @Retention(RetentionPolicy.SOURCE)
78     public @interface ChannelWidth{}
79 
80     @IntDef(prefix = { "PREAMBLE_" }, value = {
81             ScanResult.PREAMBLE_LEGACY,
82             ScanResult.PREAMBLE_HT,
83             ScanResult.PREAMBLE_VHT,
84             ScanResult.PREAMBLE_HE,
85             ScanResult.PREAMBLE_EHT,
86     })
87     @Retention(RetentionPolicy.SOURCE)
88     public @interface PreambleType {}
89 
90     @IntDef(prefix = { "WIFI_STANDARD_" }, value = {
91             ScanResult.WIFI_STANDARD_UNKNOWN,
92             ScanResult.WIFI_STANDARD_LEGACY,
93             ScanResult.WIFI_STANDARD_11N,
94             ScanResult.WIFI_STANDARD_11AC,
95             ScanResult.WIFI_STANDARD_11AX,
96             ScanResult.WIFI_STANDARD_11AD,
97             ScanResult.WIFI_STANDARD_11BE,
98     })
99     @Retention(RetentionPolicy.SOURCE)
100     public @interface WifiStandard{}
101 
102     @IntDef(prefix = { "PROTOCOL_" }, value = {
103             ScanResult.PROTOCOL_NONE,
104             ScanResult.PROTOCOL_WPA,
105             ScanResult.PROTOCOL_RSN,
106             ScanResult.PROTOCOL_OSEN,
107             ScanResult.PROTOCOL_WAPI
108     })
109     @Retention(RetentionPolicy.SOURCE)
110     public @interface Protocol {}
111 
112     @IntDef(prefix = { "KEY_MGMT_" }, value = {
113         ScanResult.KEY_MGMT_NONE,
114         ScanResult.KEY_MGMT_PSK,
115         ScanResult.KEY_MGMT_EAP,
116         ScanResult.KEY_MGMT_FT_PSK,
117         ScanResult.KEY_MGMT_FT_EAP,
118         ScanResult.KEY_MGMT_PSK_SHA256,
119         ScanResult.KEY_MGMT_EAP_SHA256,
120         ScanResult.KEY_MGMT_OSEN,
121         ScanResult.KEY_MGMT_SAE,
122         ScanResult.KEY_MGMT_OWE,
123         ScanResult.KEY_MGMT_EAP_SUITE_B_192,
124         ScanResult.KEY_MGMT_FT_SAE,
125         ScanResult.KEY_MGMT_OWE_TRANSITION,
126         ScanResult.KEY_MGMT_WAPI_PSK,
127         ScanResult.KEY_MGMT_WAPI_CERT
128     })
129     @Retention(RetentionPolicy.SOURCE)
130     public @interface KeyMgmt {}
131 
132     @IntDef(prefix = { "CIPHER_" }, value = {
133         ScanResult.CIPHER_NONE,
134         ScanResult.CIPHER_NO_GROUP_ADDRESSED,
135         ScanResult.CIPHER_TKIP,
136         ScanResult.CIPHER_CCMP,
137         ScanResult.CIPHER_GCMP_256,
138         ScanResult.CIPHER_SMS4,
139         ScanResult.CIPHER_GCMP_128,
140         ScanResult.CIPHER_BIP_GMAC_128,
141         ScanResult.CIPHER_BIP_GMAC_256,
142         ScanResult.CIPHER_BIP_CMAC_256,
143     })
144     @Retention(RetentionPolicy.SOURCE)
145     public @interface Cipher {}
146 
147     /**
148      * Security type of current connection.
149      * @hide
150      */
151     @Retention(RetentionPolicy.SOURCE)
152     @IntDef(prefix = { "SECURITY_TYPE_" }, value = {
153             WifiInfo.SECURITY_TYPE_UNKNOWN,
154             WifiInfo.SECURITY_TYPE_OPEN,
155             WifiInfo.SECURITY_TYPE_WEP,
156             WifiInfo.SECURITY_TYPE_PSK,
157             WifiInfo.SECURITY_TYPE_EAP,
158             WifiInfo.SECURITY_TYPE_SAE,
159             WifiInfo.SECURITY_TYPE_OWE,
160             WifiInfo.SECURITY_TYPE_WAPI_PSK,
161             WifiInfo.SECURITY_TYPE_WAPI_CERT,
162             WifiInfo.SECURITY_TYPE_EAP_WPA3_ENTERPRISE,
163             WifiInfo.SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT,
164             WifiInfo.SECURITY_TYPE_PASSPOINT_R1_R2,
165             WifiInfo.SECURITY_TYPE_PASSPOINT_R3,
166             WifiInfo.SECURITY_TYPE_DPP,
167     })
168     public @interface SecurityType {}
169 
170     /**
171      * The type of wifi uri scheme.
172      */
173     @Retention(RetentionPolicy.SOURCE)
174     @IntDef(prefix = {"URI_SCHEME_"}, value = {
175             UriParserResults.URI_SCHEME_ZXING_WIFI_NETWORK_CONFIG,
176             UriParserResults.URI_SCHEME_DPP,
177     })
178     public @interface UriScheme {}
179 }
180