diff options
-rw-r--r-- | Android.bp | 3 | ||||
-rw-r--r-- | framework-jarjar-rules.txt | 2 | ||||
-rw-r--r-- | jarjar_rules_hidl.txt | 1 | ||||
-rw-r--r-- | wifi/Android.bp | 5 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiAnnotations.java | 51 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiCondManager.java | 6 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiScanner.java | 20 |
7 files changed, 64 insertions, 24 deletions
diff --git a/Android.bp b/Android.bp index 5952ab11db2b..9ffdd1d6c8fe 100644 --- a/Android.bp +++ b/Android.bp @@ -223,6 +223,7 @@ filegroup { ":framework-telecomm-sources", ":framework-telephony-common-sources", ":framework-telephony-sources", + ":framework-wifi-annotations", ":framework-wifi-non-updatable-sources", ":PacProcessor-aidl-sources", ":ProxyHandler-aidl-sources", @@ -400,7 +401,7 @@ java_defaults { filegroup { name: "framework-jarjar-rules", - srcs: ["jarjar_rules_hidl.txt"], + srcs: ["framework-jarjar-rules.txt"], } filegroup { diff --git a/framework-jarjar-rules.txt b/framework-jarjar-rules.txt new file mode 100644 index 000000000000..d8af726ffa72 --- /dev/null +++ b/framework-jarjar-rules.txt @@ -0,0 +1,2 @@ +rule android.hidl.** android.internal.hidl.@1 +rule android.net.wifi.WifiAnnotations* android.internal.wifi.WifiAnnotations@1 diff --git a/jarjar_rules_hidl.txt b/jarjar_rules_hidl.txt deleted file mode 100644 index 4b2331db7c34..000000000000 --- a/jarjar_rules_hidl.txt +++ /dev/null @@ -1 +0,0 @@ -rule android.hidl.** android.internal.hidl.@1 diff --git a/wifi/Android.bp b/wifi/Android.bp index e0b9ff336093..26064cbc2fb1 100644 --- a/wifi/Android.bp +++ b/wifi/Android.bp @@ -38,6 +38,11 @@ filegroup { ], } +filegroup { + name: "framework-wifi-annotations", + srcs: ["java/android/net/wifi/WifiAnnotations.java"], +} + java_library { name: "framework-wifi", sdk_version: "core_platform", // TODO(b/140299412) should be core_current diff --git a/wifi/java/android/net/wifi/WifiAnnotations.java b/wifi/java/android/net/wifi/WifiAnnotations.java new file mode 100644 index 000000000000..4a7dee138971 --- /dev/null +++ b/wifi/java/android/net/wifi/WifiAnnotations.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.wifi; + +import android.annotation.IntDef; +import android.annotation.StringDef; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Wifi annotations meant to be statically linked into client modules, since they cannot be + * exposed as @SystemApi. + * + * e.g. {@link IntDef}, {@link StringDef} + * + * @hide + */ +public final class WifiAnnotations { + private WifiAnnotations() {} + + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = {"SCAN_TYPE_"}, value = { + WifiScanner.SCAN_TYPE_LOW_LATENCY, + WifiScanner.SCAN_TYPE_LOW_POWER, + WifiScanner.SCAN_TYPE_HIGH_ACCURACY}) + public @interface ScanType {} + + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = {"WIFI_BAND_"}, value = { + WifiScanner.WIFI_BAND_UNSPECIFIED, + WifiScanner.WIFI_BAND_24_GHZ, + WifiScanner.WIFI_BAND_5_GHZ, + WifiScanner.WIFI_BAND_5_GHZ_DFS_ONLY, + WifiScanner.WIFI_BAND_6_GHZ}) + public @interface WifiBandBasic {} +} diff --git a/wifi/java/android/net/wifi/WifiCondManager.java b/wifi/java/android/net/wifi/WifiCondManager.java index 9ae7e3a89706..c05ba347ab5c 100644 --- a/wifi/java/android/net/wifi/WifiCondManager.java +++ b/wifi/java/android/net/wifi/WifiCondManager.java @@ -725,7 +725,7 @@ public class WifiCondManager implements IBinder.DeathRecipient { /** * Return scan type for the parcelable {@link SingleScanSettings} */ - private static int getScanType(@WifiScanner.ScanType int scanType) { + private static int getScanType(@WifiAnnotations.ScanType int scanType) { switch (scanType) { case WifiScanner.SCAN_TYPE_LOW_LATENCY: return IWifiScannerImpl.SCAN_TYPE_LOW_SPAN; @@ -746,7 +746,7 @@ public class WifiCondManager implements IBinder.DeathRecipient { * @param hiddenNetworkSSIDs List of hidden networks to be scanned for. * @return Returns true on success. */ - public boolean scan(@NonNull String ifaceName, @WifiScanner.ScanType int scanType, + public boolean scan(@NonNull String ifaceName, @WifiAnnotations.ScanType int scanType, Set<Integer> freqs, List<byte[]> hiddenNetworkSSIDs) { IWifiScannerImpl scannerImpl = getScannerImpl(ifaceName); if (scannerImpl == null) { @@ -868,7 +868,7 @@ public class WifiCondManager implements IBinder.DeathRecipient { * @return frequencies vector of valid frequencies (MHz), or null for error. * @throws IllegalArgumentException if band is not recognized. */ - public int [] getChannelsForBand(@WifiScanner.WifiBandBasic int band) { + public int [] getChannelsForBand(@WifiAnnotations.WifiBandBasic int band) { if (mWificond == null) { Log.e(TAG, "No valid wificond scanner interface handler"); return null; diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java index 760497b727cd..8fedda48aa0d 100644 --- a/wifi/java/android/net/wifi/WifiScanner.java +++ b/wifi/java/android/net/wifi/WifiScanner.java @@ -89,16 +89,6 @@ public class WifiScanner { /** 6 GHz band */ public static final int WIFI_BAND_6_GHZ = 1 << WIFI_BAND_INDEX_6_GHZ; - /** @hide */ - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = {"WIFI_BAND_"}, value = { - WIFI_BAND_UNSPECIFIED, - WIFI_BAND_24_GHZ, - WIFI_BAND_5_GHZ, - WIFI_BAND_5_GHZ_DFS_ONLY, - WIFI_BAND_6_GHZ}) - public @interface WifiBandBasic {} - /** * Combination of bands * Note that those are only the common band combinations, @@ -249,14 +239,6 @@ public class WifiScanner { */ public static final int REPORT_EVENT_NO_BATCH = (1 << 2); - /** @hide */ - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = {"SCAN_TYPE_"}, value = { - SCAN_TYPE_LOW_LATENCY, - SCAN_TYPE_LOW_POWER, - SCAN_TYPE_HIGH_ACCURACY}) - public @interface ScanType {} - /** * Optimize the scan for lower latency. * @see ScanSettings#type @@ -354,7 +336,7 @@ public class WifiScanner { * {@link #SCAN_TYPE_HIGH_ACCURACY}. * Default value: {@link #SCAN_TYPE_LOW_LATENCY}. */ - @ScanType + @WifiAnnotations.ScanType @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public int type = SCAN_TYPE_LOW_LATENCY; /** |