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     })
61     @Retention(RetentionPolicy.SOURCE)
62     public @interface Bandwidth {}
63 
64     @IntDef(prefix = { "CHANNEL_WIDTH_" }, value = {
65             ScanResult.CHANNEL_WIDTH_20MHZ,
66             ScanResult.CHANNEL_WIDTH_40MHZ,
67             ScanResult.CHANNEL_WIDTH_80MHZ,
68             ScanResult.CHANNEL_WIDTH_160MHZ,
69             ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ,
70     })
71     @Retention(RetentionPolicy.SOURCE)
72     public @interface ChannelWidth{}
73 
74     @IntDef(prefix = { "WIFI_STANDARD_" }, value = {
75             ScanResult.WIFI_STANDARD_UNKNOWN,
76             ScanResult.WIFI_STANDARD_LEGACY,
77             ScanResult.WIFI_STANDARD_11N,
78             ScanResult.WIFI_STANDARD_11AC,
79             ScanResult.WIFI_STANDARD_11AX,
80     })
81     @Retention(RetentionPolicy.SOURCE)
82     public @interface WifiStandard{}
83 
84     @IntDef(prefix = { "PROTOCOL_" }, value = {
85             ScanResult.PROTOCOL_NONE,
86             ScanResult.PROTOCOL_WPA,
87             ScanResult.PROTOCOL_RSN,
88             ScanResult.PROTOCOL_OSEN,
89             ScanResult.PROTOCOL_WAPI
90     })
91     @Retention(RetentionPolicy.SOURCE)
92     public @interface Protocol {}
93 
94     @IntDef(prefix = { "KEY_MGMT_" }, value = {
95         ScanResult.KEY_MGMT_NONE,
96         ScanResult.KEY_MGMT_PSK,
97         ScanResult.KEY_MGMT_EAP,
98         ScanResult.KEY_MGMT_FT_PSK,
99         ScanResult.KEY_MGMT_FT_EAP,
100         ScanResult.KEY_MGMT_PSK_SHA256,
101         ScanResult.KEY_MGMT_EAP_SHA256,
102         ScanResult.KEY_MGMT_OSEN,
103         ScanResult.KEY_MGMT_SAE,
104         ScanResult.KEY_MGMT_OWE,
105         ScanResult.KEY_MGMT_EAP_SUITE_B_192,
106         ScanResult.KEY_MGMT_FT_SAE,
107         ScanResult.KEY_MGMT_OWE_TRANSITION,
108         ScanResult.KEY_MGMT_WAPI_PSK,
109         ScanResult.KEY_MGMT_WAPI_CERT
110     })
111     @Retention(RetentionPolicy.SOURCE)
112     public @interface KeyMgmt {}
113 
114     @IntDef(prefix = { "CIPHER_" }, value = {
115         ScanResult.CIPHER_NONE,
116         ScanResult.CIPHER_NO_GROUP_ADDRESSED,
117         ScanResult.CIPHER_TKIP,
118         ScanResult.CIPHER_CCMP,
119         ScanResult.CIPHER_GCMP_256,
120         ScanResult.CIPHER_SMS4
121     })
122     @Retention(RetentionPolicy.SOURCE)
123     public @interface Cipher {}
124 }
125