summaryrefslogtreecommitdiff
path: root/wifi/java
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2020-12-10 20:42:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-12-10 20:42:35 +0000
commit0c525378800b75c1baa3a10fa95fd3dc535bbaf6 (patch)
treed46ed8e616fb1265f4046e4532c72d3ec84ca74a /wifi/java
parentcf45363705534d9f932a55c532b94bd34fe49e8a (diff)
parentac1a7a3e1f86127f6033c503cad09d372bc40b9c (diff)
Merge "[WIFI] Trigger WiFi recovery mode"
Diffstat (limited to 'wifi/java')
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl2
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java31
2 files changed, 33 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 866e913800fd..e7b8475405ad 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -300,4 +300,6 @@ interface IWifiManager
void setCarrierNetworkOffloadEnabled(int subscriptionId, boolean merged, boolean enabled);
boolean isCarrierNetworkOffloadEnabled(int subscriptionId, boolean merged);
+
+ void restartWifiSubsystem(String reason);
}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 2b931a380f43..9fd70cbf6bc0 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -3041,6 +3041,37 @@ public class WifiManager {
}
/**
+ * Restart the Wi-Fi subsystem.
+ *
+ * Restarts the Wi-Fi subsystem - effectively disabling it and re-enabling it. All existing
+ * Access Point (AP) associations are torn down, all Soft APs are disabled, Wi-Fi Direct and
+ * Wi-Fi Aware are disabled.
+ *
+ * The state of the system after restart is not guaranteed to match its state before the API is
+ * called - for instance the device may associate to a different Access Point (AP), and tethered
+ * hotspots may or may not be restored.
+ *
+ * @param reason If non-null, requests a bug report and attaches the reason string to it. A bug
+ * report may still not be generated based on framework criteria - for instance,
+ * build type or throttling. The WiFi subsystem is restarted whether or not a bug
+ * report is requested or generated.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.NETWORK_AIRPLANE_MODE)
+ public void restartWifiSubsystem(@Nullable String reason) {
+ if (!SdkLevel.isAtLeastS()) {
+ throw new UnsupportedOperationException();
+ }
+ try {
+ mService.restartWifiSubsystem(reason);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Gets the Wi-Fi enabled state.
* @return One of {@link #WIFI_STATE_DISABLED},
* {@link #WIFI_STATE_DISABLING}, {@link #WIFI_STATE_ENABLED},