summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mahesh KKV <maheshkkv@google.com> 2024-12-05 00:31:33 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-12-05 00:31:33 +0000
commitad74642fd980415a75555b74c4bd9e5c4f3a10e5 (patch)
treefeda0705fe937d97bda253726861a2b91baf1f73
parent20b9df16998530a808b0ee6894b307803a8d8a11 (diff)
parent381c696e9194ee945babde01b9a15c6b78058201 (diff)
Merge "Move APIs to check USD support to WifiManager" into main
-rw-r--r--framework/api/system-current.txt4
-rw-r--r--framework/java/android/net/wifi/IWifiManager.aidl2
-rw-r--r--framework/java/android/net/wifi/WifiManager.java46
-rw-r--r--framework/java/android/net/wifi/usd/IUsdManager.aidl2
-rw-r--r--framework/java/android/net/wifi/usd/UsdManager.java38
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java32
-rw-r--r--service/java/com/android/server/wifi/usd/UsdServiceImpl.java26
7 files changed, 82 insertions, 68 deletions
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index b481db2e02..55bd9eb3a4 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -817,6 +817,8 @@ package android.net.wifi {
method public boolean isPortableHotspotSupported();
method public boolean isStaConcurrencyForRestrictedConnectionsSupported();
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public boolean isThirdPartyAppEnablingWifiConfirmationDialogEnabled();
+ method @FlaggedApi("android.net.wifi.flags.usd") @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public boolean isUsdPublisherSupported();
+ method @FlaggedApi("android.net.wifi.flags.usd") @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public boolean isUsdSubscriberSupported();
method public boolean isVerboseLoggingEnabled();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isWifiApEnabled();
method public boolean isWifiScannerSupported();
@@ -2014,9 +2016,7 @@ package android.net.wifi.usd {
@FlaggedApi("android.net.wifi.flags.usd") public class UsdManager {
method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public android.net.wifi.usd.Characteristics getCharacteristics();
method @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public boolean isPublisherAvailable();
- method @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public boolean isPublisherSupported();
method @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public boolean isSubscriberAvailable();
- method @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public boolean isSubscriberSupported();
method @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public void publish(@NonNull android.net.wifi.usd.PublishConfig, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.usd.PublishSessionCallback);
method @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public void registerAvailabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.usd.UsdManager.AvailabilityCallback);
method @RequiresPermission(android.Manifest.permission.MANAGE_WIFI_NETWORK_SELECTION) public void subscribe(@NonNull android.net.wifi.usd.SubscribeConfig, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.usd.SubscribeSessionCallback);
diff --git a/framework/java/android/net/wifi/IWifiManager.aidl b/framework/java/android/net/wifi/IWifiManager.aidl
index 18576c894e..2382f94382 100644
--- a/framework/java/android/net/wifi/IWifiManager.aidl
+++ b/framework/java/android/net/wifi/IWifiManager.aidl
@@ -555,4 +555,6 @@ interface IWifiManager {
void storeCapturedData(int triggerType, boolean isFullCapture, long triggerStartTimeMillis,
long triggerStopTimeMillis, in IIntegerListener listener);
+ boolean isUsdSubscriberSupported();
+ boolean isUsdPublisherSupported();
}
diff --git a/framework/java/android/net/wifi/WifiManager.java b/framework/java/android/net/wifi/WifiManager.java
index ce7a3f0807..c1e6646eeb 100644
--- a/framework/java/android/net/wifi/WifiManager.java
+++ b/framework/java/android/net/wifi/WifiManager.java
@@ -13241,4 +13241,50 @@ public class WifiManager {
throw e.rethrowFromSystemServer();
}
}
+
+ /**
+ * Return whether Unsynchronized Service Discovery (USD) subscriber is supported or not.
+ * @hide
+ */
+ @android.annotation.RequiresApi(Build.VERSION_CODES.BAKLAVA)
+ @SystemApi
+ @FlaggedApi(android.net.wifi.flags.Flags.FLAG_USD)
+ @RequiresPermission(MANAGE_WIFI_NETWORK_SELECTION)
+ public boolean isUsdSubscriberSupported() {
+ if (!Environment.isSdkAtLeastB()) {
+ throw new UnsupportedOperationException();
+ }
+ try {
+ return mService.isUsdSubscriberSupported();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Return whether Unsynchronized Service Discovery (USD) publisher is supported or not.
+ * <p>
+ * The USD publisher support is controlled by an overlay config_wifiUsdPublisherSupported.
+ * By default, the feature will be disabled because the publisher operation impacts other
+ * concurrency operation such as Station. The USD publisher switches channels and dwells a
+ * longer time (500 milliseconds to 1 second) on non-home channel which disrupts other
+ * concurrency operation.
+ *
+ * @return true if publisher feature is supported, otherwise false.
+ * @hide
+ */
+ @android.annotation.RequiresApi(Build.VERSION_CODES.BAKLAVA)
+ @SystemApi
+ @FlaggedApi(android.net.wifi.flags.Flags.FLAG_USD)
+ @RequiresPermission(MANAGE_WIFI_NETWORK_SELECTION)
+ public boolean isUsdPublisherSupported() {
+ if (!Environment.isSdkAtLeastB()) {
+ throw new UnsupportedOperationException();
+ }
+ try {
+ return mService.isUsdPublisherSupported();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
}
diff --git a/framework/java/android/net/wifi/usd/IUsdManager.aidl b/framework/java/android/net/wifi/usd/IUsdManager.aidl
index f591639b0e..030b240002 100644
--- a/framework/java/android/net/wifi/usd/IUsdManager.aidl
+++ b/framework/java/android/net/wifi/usd/IUsdManager.aidl
@@ -30,8 +30,6 @@ import android.net.wifi.usd.SubscribeConfig;
* {@hide}
*/
interface IUsdManager {
- boolean isSubscriberSupported();
- boolean isPublisherSupported();
boolean isSubscriberAvailable();
boolean isPublisherAvailable();
void registerAvailabilityCallback(IAvailabilityCallback callback);
diff --git a/framework/java/android/net/wifi/usd/UsdManager.java b/framework/java/android/net/wifi/usd/UsdManager.java
index fa762f2d2f..98601ee5c8 100644
--- a/framework/java/android/net/wifi/usd/UsdManager.java
+++ b/framework/java/android/net/wifi/usd/UsdManager.java
@@ -122,44 +122,6 @@ public class UsdManager {
}
/**
- * Return whether subscriber is supported or not.
- */
- @RequiresPermission(MANAGE_WIFI_NETWORK_SELECTION)
- public boolean isSubscriberSupported() {
- if (!Environment.isSdkAtLeastB()) {
- throw new UnsupportedOperationException();
- }
- try {
- return mService.isSubscriberSupported();
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
- * Return whether publish is supported or not.
- * <p>
- * The publisher support is controlled by an overlay config_wifiUsdPublisherSupported.
- * By default, the feature will be disabled because the publisher operation impacts other
- * concurrency operation such as Station. The USD publisher switches channels and dwells a
- * longer time (500 milliseconds to 1 second) on non-home channel which disrupts other
- * concurrency operation.
- *
- * @return true if publisher feature is supported, otherwise false.
- */
- @RequiresPermission(MANAGE_WIFI_NETWORK_SELECTION)
- public boolean isPublisherSupported() {
- if (!Environment.isSdkAtLeastB()) {
- throw new UnsupportedOperationException();
- }
- try {
- return mService.isPublisherSupported();
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
* Checks if the subscriber feature is currently available or not. Due to concurrent operations
* such as Station, SoftAP, Wi-Fi Aware, Wi-Fi Direct ..etc. the subscriber functionality
* may not be available.
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 7b3c7c75e6..385beb6f28 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -9163,4 +9163,36 @@ public class WifiServiceImpl extends IWifiManager.Stub {
() -> mActiveModeWarden.getPrimaryClientModeManager().blockNetwork(option),
"disallowCurrentSuggestedNetwork");
}
+ /**
+ * See {@link WifiManager#isUsdSubscriberSupported()}
+ */
+ @Override
+ public boolean isUsdSubscriberSupported() {
+ if (!Environment.isSdkAtLeastB()) {
+ throw new UnsupportedOperationException("SDK level too old");
+ }
+ int uid = getMockableCallingUid();
+ if (!mWifiPermissionsUtil.checkManageWifiNetworkSelectionPermission(uid)) {
+ throw new SecurityException("App not allowed to use USD (uid = " + uid + ")");
+ }
+ // USDSubscriber is not supported.
+ return false;
+ }
+
+ /**
+ * See {@link WifiManager#isUsdPublisherSupported()}
+ */
+ @Override
+ public boolean isUsdPublisherSupported() {
+ if (!Environment.isSdkAtLeastB()) {
+ throw new UnsupportedOperationException("SDK level too old");
+ }
+ int uid = getMockableCallingUid();
+ if (!mWifiPermissionsUtil.checkManageWifiNetworkSelectionPermission(uid)) {
+ throw new SecurityException("App not allowed to use USD (uid = " + uid + ")");
+ }
+ // USDPublisher is not supported.
+ return false;
+ }
+
}
diff --git a/service/java/com/android/server/wifi/usd/UsdServiceImpl.java b/service/java/com/android/server/wifi/usd/UsdServiceImpl.java
index 5b4ad7b95d..f1528c9032 100644
--- a/service/java/com/android/server/wifi/usd/UsdServiceImpl.java
+++ b/service/java/com/android/server/wifi/usd/UsdServiceImpl.java
@@ -86,32 +86,6 @@ public class UsdServiceImpl extends IUsdManager.Stub {
}
/**
- * See {@link UsdManager#isSubscriberSupported()}
- */
- @Override
- public boolean isSubscriberSupported() {
- int uid = getMockableCallingUid();
- if (!mWifiPermissionsUtil.checkManageWifiNetworkSelectionPermission(uid)) {
- throw new SecurityException("App not allowed to use USD (uid = " + uid + ")");
- }
- // Subscriber is not supported.
- return false;
- }
-
- /**
- * See {@link UsdManager#isPublisherSupported()}
- */
- @Override
- public boolean isPublisherSupported() {
- int uid = getMockableCallingUid();
- if (!mWifiPermissionsUtil.checkManageWifiNetworkSelectionPermission(uid)) {
- throw new SecurityException("App not allowed to use USD (uid = " + uid + ")");
- }
- // Publisher is not supported.
- return false;
- }
-
- /**
* See {@link UsdManager#isSubscriberAvailable()}
*/
@Override