Merge "Migrate frameworks/base/wifi & frameworks/base/packages/OsuLogin" am: e41cd2917a am: dc68043ad0

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1533852

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie2588d9be48b50d41aaf5a5440268bb377081242
This commit is contained in:
Baligh Uddin
2020-12-24 06:50:43 +00:00
committed by Automerger Merge Worker
236 changed files with 1 additions and 65236 deletions

View File

@@ -1239,6 +1239,7 @@ java_library {
visibility: [
"//frameworks/base/wifi",
"//frameworks/base/services/net",
"//packages/modules/Wifi/framework",
],
}

View File

@@ -1,18 +0,0 @@
android_app {
name: "OsuLogin",
defaults: ["wifi-module-sdk-version-defaults"],
static_libs: ["androidx.legacy_legacy-support-v4"],
resource_dirs: ["res"],
srcs: ["src/**/*.java"],
sdk_version: "system_current",
certificate: ":com.android.hotspot2.osulogin.certificate",
apex_available: [
"com.android.wifi",
"test_com.android.wifi",
],
}
android_app_certificate {
name: "com.android.hotspot2.osulogin.certificate",
certificate: "certs/com.android.hotspot2.osulogin"
}

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (C) 2018 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.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.hotspot2.osulogin">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:networkSecurityConfig="@xml/network_security_config"
android:enabled="true"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize"
android:supportsRtl="true">
<activity android:name="com.android.hotspot2.osulogin.OsuLoginActivity"
android:label="@string/action_bar_label"
android:theme="@style/AppTheme"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.net.wifi.action.PASSPOINT_LAUNCH_OSU_VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -1,2 +0,0 @@
satk@google.com
etancohen@google.com

View File

@@ -1,35 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIGDzCCA/egAwIBAgIUHzkh0UCF/H+1mZZp0ROX4nXKOUowDQYJKoZIhvcNAQEL
BQAwgZUxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQH
DA1Nb3VudGFpbiBWaWV3MRAwDgYDVQQKDAdBbmRyb2lkMRAwDgYDVQQLDAdBbmRy
b2lkMREwDwYDVQQDDAhPc3VMb2dpbjEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBh
bmRyb2lkLmNvbTAgFw0yMDAzMjUwMjQ5MTNaGA80NzU4MDIxOTAyNDkxM1owgZUx
CzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3Vu
dGFpbiBWaWV3MRAwDgYDVQQKDAdBbmRyb2lkMRAwDgYDVQQLDAdBbmRyb2lkMREw
DwYDVQQDDAhPc3VMb2dpbjEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lk
LmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMJDnjAeIZ2KUvKc
ONwxuzIhLvXr6LRm+Uz0ebjz++5IzQJLwr/COPBG9zbIm8izj2acp+l4WVEYT6I4
Es5LEp556ySCuZx8IjOd0Zd6NCdaKmYouDTjYTrELWUlZjfA7Km2L5x2M6ArnDO5
zJ1BIsQ06S3C7iR3ktAQ1cFdidg6Ha2gainS0A1JKN3kL9BL1pvHRLzWZX4gsNhB
C/6Ue3W3Sx2JRQkaaLksDdoKq0QswEk5tGfKbVr9+hHv/pztaaqEXSeV6f305cAx
Hzd6+QJ8f8AJz2Rhnv43y72UO8b02CSP3laUj8geidR8XXw+R7Kzu8NfFDL7uVIh
ktPaBxfWPNYtedp3JrGeZhkzljsushY+bVHECEzROhY2CiUZBEn+wwZLWe2W7oee
VCL1EZBYctK5CfrrV6x0wvbBUF/ViwV+2LQXQNp08xB8bJBqoBn4KZjK0tTN86Dq
qRALyoVIVh5VDU9Wbi3vrJb0/9TEQtMjuo0DS3hdtnowdRyAyhwbQHO26dqnnzBI
XtTAve4RkOwnb8QzZde56qvRgweDE9Im1jpx4E+MMGqVYs8Txurmd/t6bCjTvp1P
4i88crk/zqCoHEQEbiaNdfkULJAWg9wqxPjqPCTVNtOXoJwuHsNymQVSztIUSySz
ZQ8Trk0ApqQf8yH2mjM6HJJZoNpBAgMBAAGjUzBRMB0GA1UdDgQWBBRdpduh1P+I
BMbg5S4n1kbj5hQsOzAfBgNVHSMEGDAWgBRdpduh1P+IBMbg5S4n1kbj5hQsOzAP
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4ICAQB+FzSuoA7LCvn8l86V
sSI4lH1KLLH+wrXp20w/wYcBY+s4hYPpAJ8YbEMOT9uibK/HpEWYFqiVCqk4gKXr
Qraxvmtqq0WNSwkjeopTYlZeBzTC/If3UoOCp7KCfMdydIcxvk6LNokMWWqSCNP8
QiD872XuBvj/uQeBsbHZTqruqPnu+LZwpuHFVRp/Pyj9rT61PsvGitb7q/chW0G7
7csHOc5q2223LKlNknPsfbcR6nVEg4KfN7kPKny8iJtl2pdbfBjFDp+73nzW8qZU
5JWO5nWL7cJh4mt5sPGrzpt/Hf8/Dngg69sImRqjv/6/wCV0pEmmNjKJkXcMaZ0T
2TSs+A7K6l15NYk8exkMymTU7jk+iDud3tnQ68YHf/A9pDu15OCw6U/pTgOgu9co
rBLLhGV0Tb6XAnsWKe9tsLcumQXU5ZUn9m5VJl58wQHNhUqpT7L0fWtpiTMTStVA
/yZbndPO4SbjR5rjcAk1xge8lyIIp0WBWmwoQ/1y4DXF/yPaX733wO7uWUljgKuy
MM/zM4zklB8nFjXfPNf3j24Bzqmy7rqy4XB64enVmYQ2mVNqfwXvINoo2XOrAmj/
bhSWXiCFltJFM7fmJGOMEEHBt9QfbmCgmM4aoWMgH7P+HxGW+Vc3tGixBbsxNRC+
/VrPAINQV4x5q8zGYNQBqNFn/A==
-----END CERTIFICATE-----

View File

@@ -1,52 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDCQ54wHiGdilLy
nDjcMbsyIS716+i0ZvlM9Hm48/vuSM0CS8K/wjjwRvc2yJvIs49mnKfpeFlRGE+i
OBLOSxKeeeskgrmcfCIzndGXejQnWipmKLg042E6xC1lJWY3wOypti+cdjOgK5wz
ucydQSLENOktwu4kd5LQENXBXYnYOh2toGop0tANSSjd5C/QS9abx0S81mV+ILDY
QQv+lHt1t0sdiUUJGmi5LA3aCqtELMBJObRnym1a/foR7/6c7WmqhF0nlen99OXA
MR83evkCfH/ACc9kYZ7+N8u9lDvG9Ngkj95WlI/IHonUfF18Pkeys7vDXxQy+7lS
IZLT2gcX1jzWLXnadyaxnmYZM5Y7LrIWPm1RxAhM0ToWNgolGQRJ/sMGS1ntlu6H
nlQi9RGQWHLSuQn661esdML2wVBf1YsFfti0F0DadPMQfGyQaqAZ+CmYytLUzfOg
6qkQC8qFSFYeVQ1PVm4t76yW9P/UxELTI7qNA0t4XbZ6MHUcgMocG0Bztunap58w
SF7UwL3uEZDsJ2/EM2XXueqr0YMHgxPSJtY6ceBPjDBqlWLPE8bq5nf7emwo076d
T+IvPHK5P86gqBxEBG4mjXX5FCyQFoPcKsT46jwk1TbTl6CcLh7DcpkFUs7SFEsk
s2UPE65NAKakH/Mh9pozOhySWaDaQQIDAQABAoICAGgX7XKhIqgVD59aoIk0yLby
2wQBdf780ocu1O6LJiqnrdqWF/PCsdnmXN9pHTitJqD4Pm03BL0Uhs9ItqL9zStH
7vzwY177kSQRY9aEL+AKS3/UP+hvEpF3v09ce+pSIT5LFjYDjGQ+GgQJgh+dYHC8
XVodAphdzjhZXQCxC4TmlzKLK3ffs4X69r/3XruBd6yfWTDKvTWZdMlcCX5Pt9v6
7HAWNvzKvuTCO2Xjo6PzStGx7v5SlMhWISJtdARInv80z+m/RdPD3zxd1flXloiD
h7yyRQPn31cfNLgP7vwMBKmKwbuo/WZhHr/SKBHEGY0jC/CDSQKMqd/dh5ynTnbC
vi/qjKFIHofmhzgQ+fiHMeMsAO1c9eYs8a6bDeJjhA5qJP1HjSie9Ss9z94mp6Ww
TRkU93yVX04DU4TCCf0IcFpKdbtKp84i6iLV9lKGh9juM42hSOFUV6bhxmlJ9zvM
yl7vfhhuFHy1SypmaK/oJ+nwac4vIMaHCX9ifl6hm/z4PrGFSYJGQoJtVOz0vT15
lSwCJVdHkGAe0LI+3iFn5jJlluD7TqsLmZLxqTTmzDZ3U9WhAslmn5TcZd92mL0i
ZVTfCkjyl1wUHeif2992oTUH6CFZ1jKd8xwdWvyKkvQcjhiS9GUsm7j6jolR/QI7
VPQlocM/vCCusrMWnR7xAoIBAQDv9O8kboz6WzN6Xw5UC7MWpi2jZg1bTs/uKcfz
biAEC96iJQ33YSkYi6QzV4jSaackU99vGkHbQIdaBTkudz+FK5XqH0auImB2xxcR
Xu9G2j2fhzESchVTtOnotVgjiuv18SLZ/GQoSIccs0QxcisPiTa5Ij9pl8xVoS6J
sxfqAe15hASqLh+9Ula3+Orb1kCkqK0UwU0nM9nfUH88BKvUwQIMA7kipTA8jJog
MJOlYPQUGxkltlim8Vip//P336E7CWT6fWbfo62US6IEu6HcC6T8u8jcLjIKsmjJ
YJyqrepZqAVMPlv2Z+mNhxRR0ct6blfjJSrEZEtxBRn98kZ1AoIBAQDPQJ1z7Mfy
AOfjSO6Dlfr7V9SWmGvexosH0gu6H8KO+n1/ZPH5fHGt7ORubUDhkNI/fqZK0Hls
Q9Jwgq1QI9UwMTogF8DgmZ6L6jiXhUScIk0BFhUxOBoplugaI0jdTW350D2quFUJ
LjYo+VcRapTfXXVehHSjbUh3nmTWj0WboA+//7xq8q9KHPb1Sbiwjf7N1iYD5R8p
PaaG0DMET+l90bxI+QVX1enwjZGcFjo8VI+qXGGkpB/1zK5yWm29ZWypLw8TZreM
7rLUdBY1/m7MB54zOaJ2jSsxLQSXIVSGPI1ugkmFr6OxeuLdcCLN4yca3+HYHewa
w3GCBP3kfYMdAoIBAAxG0slhYpMYgWy8WkZQhuwcum8GtJ48TQUZXCKHOtoaJVzU
Wn+SmACqfE8oJlblkuiX5fGQPVhTV9lyNPe8oCJXFYdx7DLSjW7mRrbbzZApcEeu
KgOQlKjAs8r1JDpFTEc7/BV9BT7OXyNHxLBm7+8OjR8xsl7bplenNHNVF18glB7I
c1ilnXgZM1icQp/WuV3zR0+tiB3+WCJFwwy2DHiJG2qz8g/ktbATXXtSIOuwJyy0
Kjg0uRppdKjV8Ix5A426sFDkg5PjkujoabSmSOSyL9HCZcdmEadcc2ICMGHHHhtS
Lls1QY08ycU06QQ6oJd198cmSqbbnsR8h1TnxVUCggEBAI2zF/QSiAImLGVxj+HX
wWnneyobvGTsSlJmgi4XWOZ4zSU011xEgVTxCp2VhS6z3YwcA4ZTUzF6jX7vWZ/Z
YAE7JwqaMv1dCtGOqnKuY2J88Tk05/hm6zxUOQzl4wOr1O1gO0lmDn3gYpdRIv59
aJvvQjgFR9oU9d8TJM6t1mG45gvXxfM5Si/Z7d93MBdGflgteoBfPxbrV9gEsVzZ
ZkLoC1u5JrYPQ4t8v3mAmQB2sGNCFmCC9ncQIpV8zlsX5VsnGZ+iMwzghtRLKoRw
GUDWVIuhdDqp+kX9CY5q82d0Lx7HZY1JsRm/cy0DZkhubmYpfDhO/QavagQDdbOr
POECggEAXOliqX4yFvy6USXihHVM44s63gK+yH0+0iRppqoB3+E5tDyhvvvBMPLZ
7EBkhd7ILTDXbc0c8nSl8I/556YSlIaOB4Xbf4UQbsmD4fNGEnNWFbCzcEWYOjpQ
5QyXjIzK/k8eg22OZlC3XNjGHgb/mA5f+v2enGQNuy7WRTl1mKYZB2h/2p6xy+jV
CGhd4btB2bOu+1XR/B2KFvI5NdtPPti05LmsYgsU00yYJfQkpc7VvOSH5Jyy3eZL
L9xTAy7NWBQ3LGdIpX+V1jcn3SzVits0m6hOUCtJLT1snMXAKFweTvWAQynuGomc
VPf88ITMTOBjOH6YC8jKd/n2lVWLjw==
-----END PRIVATE KEY-----

View File

@@ -1,38 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.android.hotspot2.osulogin.OsuLoginActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="4dp">
<!-- Eliminates ProgressBar padding by boxing it into a 4dp high container -->
<ProgressBar
android:id="@+id/progress_bar"
style="@android:style/Widget.Material.Light.ProgressBar.Horizontal"
android:indeterminate="false"
android:max="100"
android:progress="0"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="false"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
</FrameLayout>

View File

@@ -1,5 +0,0 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@@ -1,8 +0,0 @@
<resources>
<!-- application name [CHAR LIMIT=32] -->
<string name="app_name">OsuLogin</string>
<!-- action bar label [CHAR LIMIT=32] -->
<string name="action_bar_label">Online Sign Up</string>
<!-- toast message [CHAR LIMIT=32] -->
<string name="sign_up_failed">Sign-up failed</string>
</resources>

View File

@@ -1,19 +0,0 @@
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.DeviceDefault.Settings">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="wfa" />
</trust-anchors>
</base-config>
</network-security-config>

View File

@@ -1,281 +0,0 @@
/*
* Copyright (C) 2018 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 com.android.hotspot2.osulogin;
import static android.net.NetworkCapabilities.NET_CAPABILITY_TRUSTED;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import java.net.MalformedURLException;
import java.net.URL;
/**
* Online Sign Up Login Web View launched during Provision Process of Hotspot 2.0 rel2.
*/
public class OsuLoginActivity extends Activity {
private static final String TAG = "OsuLogin";
private static final boolean DBG = true;
private String mUrl;
private String mHostName;
private Network mNetwork;
private ConnectivityManager mCm;
private ConnectivityManager.NetworkCallback mNetworkCallback;
private WifiManager mWifiManager;
private WebView mWebView;
private SwipeRefreshLayout mSwipeRefreshLayout;
private ProgressBar mProgressBar;
private boolean mForceDisconnect = true;
boolean mRedirectResponseReceived = false;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (DBG) {
Log.d(TAG, "onCreate: Opening OSU Web View");
}
mWifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (mWifiManager == null) {
Log.e(TAG, "Cannot get wifi service");
finishAndRemoveTask();
return;
}
if (getIntent() == null) {
Log.e(TAG, "Intent is null");
finishAndRemoveTask();
return;
}
mNetwork = getIntent().getParcelableExtra(WifiManager.EXTRA_OSU_NETWORK);
if (mNetwork == null) {
Log.e(TAG, "Cannot get the network instance for OSU from intent");
finishAndRemoveTask();
return;
}
mUrl = getIntent().getStringExtra(WifiManager.EXTRA_URL);
if (mUrl == null) {
Log.e(TAG, "Cannot get OSU server url from intent");
finishAndRemoveTask();
return;
}
mHostName = getHost(mUrl);
if (mHostName == null) {
Log.e(TAG, "Cannot get host from the url");
finishAndRemoveTask();
return;
}
mCm = (ConnectivityManager) getApplicationContext().getSystemService(
Context.CONNECTIVITY_SERVICE);
if (mCm == null) {
Log.e(TAG, "Cannot get connectivity service");
finishAndRemoveTask();
return;
}
if (!mCm.bindProcessToNetwork(mNetwork)) {
Log.e(TAG, "Network is no longer valid");
finishAndRemoveTask();
return;
}
final NetworkCapabilities networkCapabilities = mCm.getNetworkCapabilities(mNetwork);
if (networkCapabilities == null || !networkCapabilities.hasTransport(
NetworkCapabilities.TRANSPORT_WIFI)) {
Log.e(TAG, "WiFi is not supported for the Network");
finishAndRemoveTask();
return;
}
getActionBar().setDisplayShowHomeEnabled(false);
getActionBar().setElevation(0); // remove shadow
getActionBar().setTitle(getString(R.string.action_bar_label));
getActionBar().setSubtitle("");
setContentView(R.layout.osu_web_view);
// Exit this app if network disappeared.
mNetworkCallback = new ConnectivityManager.NetworkCallback() {
@Override
public void onLost(Network network) {
if (DBG) {
Log.d(TAG, "Lost for the current Network, close the browser");
}
mForceDisconnect = false; // It is already disconnected.
if (!mRedirectResponseReceived) {
showSignUpFailedToast();
}
if (mNetwork.equals(network)) {
finishAndRemoveTask();
}
}
};
mCm.registerNetworkCallback(
new NetworkRequest.Builder().addTransportType(
NetworkCapabilities.TRANSPORT_WIFI).removeCapability(
NET_CAPABILITY_TRUSTED).build(),
mNetworkCallback);
mWebView = findViewById(R.id.webview);
mWebView.clearCache(true);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
mProgressBar = findViewById(R.id.progress_bar);
mWebView.setWebViewClient(new OsuWebViewClient());
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
mProgressBar.setProgress(newProgress);
}
});
if (DBG) {
Log.d(TAG, "OSU Web View to " + mUrl);
}
mWebView.loadUrl(mUrl);
mSwipeRefreshLayout = findViewById(R.id.swipe_refresh);
mSwipeRefreshLayout.setOnRefreshListener(() -> {
mWebView.reload();
mSwipeRefreshLayout.setRefreshing(true);
});
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Check if the key event was the Back button.
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
// If there is a history to move back
if (mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onDestroy() {
if (mNetworkCallback != null) {
mCm.unregisterNetworkCallback(mNetworkCallback);
mNetworkCallback = null;
}
if (mWifiManager != null && mForceDisconnect) {
mWifiManager.disconnect();
mWifiManager = null;
}
super.onDestroy();
}
private String getHost(String url) {
try {
return new URL(url).getHost();
} catch (MalformedURLException e) {
Log.e(TAG, "Invalid URL " + url);
}
return null;
}
private String getHeaderSubtitle(String urlString) {
try {
URL url = new URL(urlString);
return url.getProtocol() + "://" + url.getHost();
} catch (MalformedURLException e) {
Log.e(TAG, "Invalid URL " + urlString);
}
return "";
}
private void showSignUpFailedToast() {
Toast.makeText(getApplicationContext(), R.string.sign_up_failed,
Toast.LENGTH_SHORT).show();
}
private class OsuWebViewClient extends WebViewClient {
boolean mPageError = false;
@Override
public void onPageStarted(WebView view, String urlString, Bitmap favicon) {
String subtitle = getHeaderSubtitle(urlString);
getActionBar().setSubtitle(subtitle);
mProgressBar.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished(WebView view, String url) {
mProgressBar.setVisibility(View.INVISIBLE);
mSwipeRefreshLayout.setRefreshing(false);
// Do not show the page error on UI.
if (mPageError) {
if (mRedirectResponseReceived) {
// Do not disconnect current connection while provisioning is in progress.
mForceDisconnect = false;
}
finishAndRemoveTask();
}
}
@Override
public void onReceivedError(WebView view, WebResourceRequest request,
WebResourceError error) {
if (request.getUrl().toString().startsWith("http://127.0.0.1")) {
mRedirectResponseReceived = true;
view.stopLoading();
}
if (request.isForMainFrame()) {
// This happens right after getting HTTP redirect response from an OSU server
// since no more Http request is allowed to send to the OSU server.
mPageError = true;
Log.e(TAG, "onReceived Error for MainFrame: " + error.getErrorCode());
}
}
}
}

View File

@@ -1,154 +0,0 @@
// 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.
java_defaults {
name: "wifi-module-sdk-version-defaults",
min_sdk_version: "30",
target_sdk_version: "30",
}
filegroup {
name: "framework-wifi-updatable-exported-aidl-sources",
srcs: ["aidl-export/**/*.aidl"],
path: "aidl-export",
visibility: ["//visibility:private"],
}
filegroup {
name: "framework-wifi-updatable-java-sources",
srcs: [
"java/**/*.java",
"java/**/*.aidl",
],
path: "java",
visibility: ["//visibility:private"],
}
filegroup {
name: "framework-wifi-updatable-sources",
srcs: [
":framework-wifi-updatable-java-sources",
":framework-wifi-updatable-exported-aidl-sources",
],
}
filegroup {
name: "framework-wifi-annotations",
srcs: ["java/android/net/wifi/WifiAnnotations.java"],
}
// list of tests that are allowed to access @hide APIs from framework-wifi
test_access_hidden_api_whitelist = [
"//frameworks/base/wifi/tests",
"//frameworks/base/wifi/non-updatable/tests",
"//frameworks/opt/net/wifi/tests/wifitests:__subpackages__",
"//packages/modules/Wifi/framework/tests",
"//packages/modules/Wifi/service/tests/wifitests:__subpackages__",
"//external/robolectric-shadows:__subpackages__",
"//frameworks/base/packages/SettingsLib/tests/integ",
"//external/sl4a:__subpackages__",
"//packages/apps/Settings/tests/robotests", // TODO(b/161767237): remove
]
// defaults shared between `framework-wifi` & `framework-wifi-pre-jarjar`
// java_sdk_library `framework-wifi` needs sources to generate stubs, so it cannot reuse
// `framework-wifi-pre-jarjar`
java_defaults {
name: "framework-wifi-defaults",
defaults: ["wifi-module-sdk-version-defaults"],
static_libs: [
"framework-wifi-util-lib",
"android.hardware.wifi-V1.0-java-constants",
"modules-utils-build",
],
libs: [
"unsupportedappusage", // for android.compat.annotation.UnsupportedAppUsage
],
srcs: [
":framework-wifi-updatable-sources",
":framework-wifi-util-lib-aidls",
],
}
// wifi-service needs pre-jarjared version of framework-wifi so it can reference copied utility
// classes before they are renamed.
java_library {
name: "framework-wifi-pre-jarjar",
defaults: ["framework-wifi-defaults"],
sdk_version: "module_current",
libs: ["framework-annotations-lib"],
// java_api_finder must accompany `srcs` (`srcs` defined in `framework-wifi-defaults`)
plugins: ["java_api_finder"],
installable: false,
visibility: [
"//frameworks/opt/net/wifi/service",
"//frameworks/opt/net/wifi/tests/wifitests",
],
}
// post-jarjar version of framework-wifi
java_sdk_library {
name: "framework-wifi",
defaults: [
"framework-module-defaults",
"framework-wifi-defaults",
],
jarjar_rules: ":wifi-jarjar-rules",
installable: true,
optimize: {
enabled: false
},
hostdex: true, // for hiddenapi check
// Restrict access to implementation library.
impl_library_visibility: [
"//frameworks/opt/net/wifi/service:__subpackages__",
] + test_access_hidden_api_whitelist,
apex_available: [
"com.android.wifi",
"test_com.android.wifi",
],
permitted_packages: [
"android.hardware.wifi",
"android.net.wifi",
// Created by jarjar rules.
"com.android.wifi.x",
],
}
// defaults for tests that need to build against framework-wifi's @hide APIs
java_defaults {
name: "framework-wifi-test-defaults",
sdk_version: "core_platform", // tests can use @CorePlatformApi's
libs: [
// order matters: classes in framework-wifi are resolved before framework, meaning
// @hide APIs in framework-wifi are resolved before @SystemApi stubs in framework
"framework-wifi.impl",
"framework",
// if sdk_version="" this gets automatically included, but here we need to add manually.
"framework-res",
],
visibility: test_access_hidden_api_whitelist,
}
filegroup {
name: "wifi-jarjar-rules",
srcs: ["jarjar-rules.txt"],
}

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2008, 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;
@JavaOnlyStableParcelable parcelable ScanResult;

View File

@@ -1,19 +0,0 @@
/**
* 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;
parcelable SoftApCapability;

View File

@@ -1,19 +0,0 @@
/*
* 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;
parcelable SoftApConfiguration;

View File

@@ -1,20 +0,0 @@
/**
* 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;
parcelable SoftApInfo;

View File

@@ -1,19 +0,0 @@
/*
* 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;
@JavaOnlyStableParcelable parcelable WifiClient;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2008, 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;
parcelable WifiConfiguration;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2013, 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;
parcelable WifiEnterpriseConfig;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2008, 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;
parcelable WifiInfo;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2014, 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;
parcelable WifiNetworkConnectionStatistics;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2018, 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;
parcelable WifiNetworkSuggestion;

View File

@@ -1,19 +0,0 @@
/*
* 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;
parcelable WifiUsabilityStatsEntry;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2011, 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;
parcelable WpsInfo;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2016 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.aware;
parcelable Characteristics;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2016 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.aware;
parcelable PublishConfig;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2016 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.aware;
parcelable SubscribeConfig;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2017 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.hotspot2;
parcelable OsuProvider;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2016, 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.hotspot2;
parcelable PasspointConfiguration;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2016, 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.hotspot2.pps;
parcelable Credential;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2016, 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.hotspot2.pps;
parcelable HomeSp;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2011, 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.p2p;
parcelable WifiP2pConfig;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2011, 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.p2p;
parcelable WifiP2pDevice;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2011, 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.p2p;
parcelable WifiP2pDeviceList;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2011, 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.p2p;
parcelable WifiP2pGroup;

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) 2011, 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.p2p;
parcelable WifiP2pInfo;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2012 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.p2p.nsd;
parcelable WifiP2pServiceInfo;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2012 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.p2p.nsd;
parcelable WifiP2pServiceRequest;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2017 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.rtt;
parcelable RangingRequest;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2017 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.rtt;
parcelable RangingResult;

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2017 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.rtt;
parcelable ResponderConfig;

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
// Baseline format: 1.0
GenericException: android.net.wifi.WifiManager.LocalOnlyHotspotReservation#finalize():
Methods must not throw generic exceptions (`java.lang.Throwable`)
GenericException: android.net.wifi.WifiManager.MulticastLock#finalize():
Methods must not throw generic exceptions (`java.lang.Throwable`)
GenericException: android.net.wifi.WifiManager.WifiLock#finalize():
Methods must not throw generic exceptions (`java.lang.Throwable`)
VisiblySynchronized: PsiThisExpression:WifiManager.this:
Internal locks must not be exposed (synchronizing on this or class is still externally observable): method android.net.wifi.WifiManager.WifiLock.finalize()
VisiblySynchronized: android.net.wifi.WifiManager.WifiLock#finalize():
Internal locks must not be exposed (synchronizing on this or class is still externally observable): method android.net.wifi.WifiManager.WifiLock.finalize()

View File

@@ -1 +0,0 @@
// Signature format: 2.0

View File

@@ -1 +0,0 @@
// Signature format: 2.0

View File

@@ -1 +0,0 @@
// Signature format: 2.0

View File

@@ -1,939 +0,0 @@
// Signature format: 2.0
package android.net.wifi {
public abstract class EasyConnectStatusCallback {
ctor public EasyConnectStatusCallback();
method public abstract void onConfiguratorSuccess(int);
method public abstract void onEnrolleeSuccess(int);
method public void onFailure(int);
method public void onFailure(int, @Nullable String, @NonNull android.util.SparseArray<int[]>, @NonNull int[]);
method public abstract void onProgress(int);
field public static final int EASY_CONNECT_EVENT_PROGRESS_AUTHENTICATION_SUCCESS = 0; // 0x0
field public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_ACCEPTED = 3; // 0x3
field public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_SENT_WAITING_RESPONSE = 2; // 0x2
field public static final int EASY_CONNECT_EVENT_PROGRESS_RESPONSE_PENDING = 1; // 0x1
field public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED = 1; // 0x1
field public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT = 0; // 0x0
}
@Deprecated public class RttManager {
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void disableResponder(android.net.wifi.RttManager.ResponderCallback);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void enableResponder(android.net.wifi.RttManager.ResponderCallback);
method @Deprecated public android.net.wifi.RttManager.Capabilities getCapabilities();
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.net.wifi.RttManager.RttCapabilities getRttCapabilities();
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void startRanging(android.net.wifi.RttManager.RttParams[], android.net.wifi.RttManager.RttListener);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void stopRanging(android.net.wifi.RttManager.RttListener);
field @Deprecated public static final int BASE = 160256; // 0x27200
field @Deprecated public static final int CMD_OP_ABORTED = 160260; // 0x27204
field @Deprecated public static final int CMD_OP_DISABLE_RESPONDER = 160262; // 0x27206
field @Deprecated public static final int CMD_OP_ENABLE_RESPONDER = 160261; // 0x27205
field @Deprecated public static final int CMD_OP_ENALBE_RESPONDER_FAILED = 160264; // 0x27208
field @Deprecated public static final int CMD_OP_ENALBE_RESPONDER_SUCCEEDED = 160263; // 0x27207
field @Deprecated public static final int CMD_OP_FAILED = 160258; // 0x27202
field @Deprecated public static final int CMD_OP_START_RANGING = 160256; // 0x27200
field @Deprecated public static final int CMD_OP_STOP_RANGING = 160257; // 0x27201
field @Deprecated public static final int CMD_OP_SUCCEEDED = 160259; // 0x27203
field @Deprecated public static final String DESCRIPTION_KEY = "android.net.wifi.RttManager.Description";
field @Deprecated public static final int PREAMBLE_HT = 2; // 0x2
field @Deprecated public static final int PREAMBLE_LEGACY = 1; // 0x1
field @Deprecated public static final int PREAMBLE_VHT = 4; // 0x4
field @Deprecated public static final int REASON_INITIATOR_NOT_ALLOWED_WHEN_RESPONDER_ON = -6; // 0xfffffffa
field @Deprecated public static final int REASON_INVALID_LISTENER = -3; // 0xfffffffd
field @Deprecated public static final int REASON_INVALID_REQUEST = -4; // 0xfffffffc
field @Deprecated public static final int REASON_NOT_AVAILABLE = -2; // 0xfffffffe
field @Deprecated public static final int REASON_PERMISSION_DENIED = -5; // 0xfffffffb
field @Deprecated public static final int REASON_UNSPECIFIED = -1; // 0xffffffff
field @Deprecated public static final int RTT_BW_10_SUPPORT = 2; // 0x2
field @Deprecated public static final int RTT_BW_160_SUPPORT = 32; // 0x20
field @Deprecated public static final int RTT_BW_20_SUPPORT = 4; // 0x4
field @Deprecated public static final int RTT_BW_40_SUPPORT = 8; // 0x8
field @Deprecated public static final int RTT_BW_5_SUPPORT = 1; // 0x1
field @Deprecated public static final int RTT_BW_80_SUPPORT = 16; // 0x10
field @Deprecated public static final int RTT_CHANNEL_WIDTH_10 = 6; // 0x6
field @Deprecated public static final int RTT_CHANNEL_WIDTH_160 = 3; // 0x3
field @Deprecated public static final int RTT_CHANNEL_WIDTH_20 = 0; // 0x0
field @Deprecated public static final int RTT_CHANNEL_WIDTH_40 = 1; // 0x1
field @Deprecated public static final int RTT_CHANNEL_WIDTH_5 = 5; // 0x5
field @Deprecated public static final int RTT_CHANNEL_WIDTH_80 = 2; // 0x2
field @Deprecated public static final int RTT_CHANNEL_WIDTH_80P80 = 4; // 0x4
field @Deprecated public static final int RTT_CHANNEL_WIDTH_UNSPECIFIED = -1; // 0xffffffff
field @Deprecated public static final int RTT_PEER_NAN = 5; // 0x5
field @Deprecated public static final int RTT_PEER_P2P_CLIENT = 4; // 0x4
field @Deprecated public static final int RTT_PEER_P2P_GO = 3; // 0x3
field @Deprecated public static final int RTT_PEER_TYPE_AP = 1; // 0x1
field @Deprecated public static final int RTT_PEER_TYPE_STA = 2; // 0x2
field @Deprecated public static final int RTT_PEER_TYPE_UNSPECIFIED = 0; // 0x0
field @Deprecated public static final int RTT_STATUS_ABORTED = 8; // 0x8
field @Deprecated public static final int RTT_STATUS_FAILURE = 1; // 0x1
field @Deprecated public static final int RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6; // 0x6
field @Deprecated public static final int RTT_STATUS_FAIL_BUSY_TRY_LATER = 12; // 0xc
field @Deprecated public static final int RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE = 15; // 0xf
field @Deprecated public static final int RTT_STATUS_FAIL_INVALID_TS = 9; // 0x9
field @Deprecated public static final int RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4; // 0x4
field @Deprecated public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7; // 0x7
field @Deprecated public static final int RTT_STATUS_FAIL_NO_RSP = 2; // 0x2
field @Deprecated public static final int RTT_STATUS_FAIL_PROTOCOL = 10; // 0xa
field @Deprecated public static final int RTT_STATUS_FAIL_REJECTED = 3; // 0x3
field @Deprecated public static final int RTT_STATUS_FAIL_SCHEDULE = 11; // 0xb
field @Deprecated public static final int RTT_STATUS_FAIL_TM_TIMEOUT = 5; // 0x5
field @Deprecated public static final int RTT_STATUS_INVALID_REQ = 13; // 0xd
field @Deprecated public static final int RTT_STATUS_NO_WIFI = 14; // 0xe
field @Deprecated public static final int RTT_STATUS_SUCCESS = 0; // 0x0
field @Deprecated public static final int RTT_TYPE_11_MC = 4; // 0x4
field @Deprecated public static final int RTT_TYPE_11_V = 2; // 0x2
field @Deprecated public static final int RTT_TYPE_ONE_SIDED = 1; // 0x1
field @Deprecated public static final int RTT_TYPE_TWO_SIDED = 2; // 0x2
field @Deprecated public static final int RTT_TYPE_UNSPECIFIED = 0; // 0x0
}
@Deprecated public class RttManager.Capabilities {
ctor @Deprecated public RttManager.Capabilities();
field @Deprecated public int supportedPeerType;
field @Deprecated public int supportedType;
}
@Deprecated public static class RttManager.ParcelableRttParams implements android.os.Parcelable {
field @Deprecated @NonNull public android.net.wifi.RttManager.RttParams[] mParams;
}
@Deprecated public static class RttManager.ParcelableRttResults implements android.os.Parcelable {
ctor @Deprecated public RttManager.ParcelableRttResults(android.net.wifi.RttManager.RttResult[]);
field @Deprecated public android.net.wifi.RttManager.RttResult[] mResults;
}
@Deprecated public abstract static class RttManager.ResponderCallback {
ctor @Deprecated public RttManager.ResponderCallback();
method @Deprecated public abstract void onResponderEnableFailure(int);
method @Deprecated public abstract void onResponderEnabled(android.net.wifi.RttManager.ResponderConfig);
}
@Deprecated public static class RttManager.ResponderConfig implements android.os.Parcelable {
ctor @Deprecated public RttManager.ResponderConfig();
method @Deprecated public int describeContents();
method @Deprecated public void writeToParcel(android.os.Parcel, int);
field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.RttManager.ResponderConfig> CREATOR;
field @Deprecated public int centerFreq0;
field @Deprecated public int centerFreq1;
field @Deprecated public int channelWidth;
field @Deprecated public int frequency;
field @Deprecated public String macAddress;
field @Deprecated public int preamble;
}
@Deprecated public static class RttManager.RttCapabilities implements android.os.Parcelable {
ctor @Deprecated public RttManager.RttCapabilities();
field @Deprecated public int bwSupported;
field @Deprecated public boolean lciSupported;
field @Deprecated public boolean lcrSupported;
field @Deprecated public int mcVersion;
field @Deprecated public boolean oneSidedRttSupported;
field @Deprecated public int preambleSupported;
field @Deprecated public boolean responderSupported;
field @Deprecated public boolean secureRttSupported;
field @Deprecated public boolean supportedPeerType;
field @Deprecated public boolean supportedType;
field @Deprecated public boolean twoSided11McRttSupported;
}
@Deprecated public static interface RttManager.RttListener {
method @Deprecated public void onAborted();
method @Deprecated public void onFailure(int, String);
method @Deprecated public void onSuccess(android.net.wifi.RttManager.RttResult[]);
}
@Deprecated public static class RttManager.RttParams {
ctor @Deprecated public RttManager.RttParams();
field @Deprecated public boolean LCIRequest;
field @Deprecated public boolean LCRRequest;
field @Deprecated public int bandwidth;
field @Deprecated public String bssid;
field @Deprecated public int burstTimeout;
field @Deprecated public int centerFreq0;
field @Deprecated public int centerFreq1;
field @Deprecated public int channelWidth;
field @Deprecated public int deviceType;
field @Deprecated public int frequency;
field @Deprecated public int interval;
field @Deprecated public int numRetriesPerFTMR;
field @Deprecated public int numRetriesPerMeasurementFrame;
field @Deprecated public int numSamplesPerBurst;
field @Deprecated public int num_retries;
field @Deprecated public int num_samples;
field @Deprecated public int numberBurst;
field @Deprecated public int preamble;
field @Deprecated public int requestType;
field @Deprecated public boolean secure;
}
@Deprecated public static class RttManager.RttResult {
ctor @Deprecated public RttManager.RttResult();
field @Deprecated public android.net.wifi.RttManager.WifiInformationElement LCI;
field @Deprecated public android.net.wifi.RttManager.WifiInformationElement LCR;
field @Deprecated public String bssid;
field @Deprecated public int burstDuration;
field @Deprecated public int burstNumber;
field @Deprecated public int distance;
field @Deprecated public int distanceSpread;
field @Deprecated public int distanceStandardDeviation;
field @Deprecated public int distance_cm;
field @Deprecated public int distance_sd_cm;
field @Deprecated public int distance_spread_cm;
field @Deprecated public int frameNumberPerBurstPeer;
field @Deprecated public int measurementFrameNumber;
field @Deprecated public int measurementType;
field @Deprecated public int negotiatedBurstNum;
field @Deprecated public int requestType;
field @Deprecated public int retryAfterDuration;
field @Deprecated public int rssi;
field @Deprecated public int rssiSpread;
field @Deprecated public int rssi_spread;
field @Deprecated public long rtt;
field @Deprecated public long rttSpread;
field @Deprecated public long rttStandardDeviation;
field @Deprecated public long rtt_ns;
field @Deprecated public long rtt_sd_ns;
field @Deprecated public long rtt_spread_ns;
field @Deprecated public int rxRate;
field @Deprecated public boolean secure;
field @Deprecated public int status;
field @Deprecated public int successMeasurementFrameNumber;
field @Deprecated public long ts;
field @Deprecated public int txRate;
field @Deprecated public int tx_rate;
}
@Deprecated public static class RttManager.WifiInformationElement {
ctor @Deprecated public RttManager.WifiInformationElement();
field @Deprecated public byte[] data;
field @Deprecated public byte id;
}
public final class ScanResult implements android.os.Parcelable {
field public static final int CIPHER_CCMP = 3; // 0x3
field public static final int CIPHER_GCMP_256 = 4; // 0x4
field public static final int CIPHER_NONE = 0; // 0x0
field public static final int CIPHER_NO_GROUP_ADDRESSED = 1; // 0x1
field public static final int CIPHER_SMS4 = 5; // 0x5
field public static final int CIPHER_TKIP = 2; // 0x2
field public static final int KEY_MGMT_EAP = 2; // 0x2
field public static final int KEY_MGMT_EAP_SHA256 = 6; // 0x6
field public static final int KEY_MGMT_EAP_SUITE_B_192 = 10; // 0xa
field public static final int KEY_MGMT_FT_EAP = 4; // 0x4
field public static final int KEY_MGMT_FT_PSK = 3; // 0x3
field public static final int KEY_MGMT_FT_SAE = 11; // 0xb
field public static final int KEY_MGMT_NONE = 0; // 0x0
field public static final int KEY_MGMT_OSEN = 7; // 0x7
field public static final int KEY_MGMT_OWE = 9; // 0x9
field public static final int KEY_MGMT_OWE_TRANSITION = 12; // 0xc
field public static final int KEY_MGMT_PSK = 1; // 0x1
field public static final int KEY_MGMT_PSK_SHA256 = 5; // 0x5
field public static final int KEY_MGMT_SAE = 8; // 0x8
field public static final int KEY_MGMT_WAPI_CERT = 14; // 0xe
field public static final int KEY_MGMT_WAPI_PSK = 13; // 0xd
field public static final int PROTOCOL_NONE = 0; // 0x0
field public static final int PROTOCOL_OSEN = 3; // 0x3
field public static final int PROTOCOL_RSN = 2; // 0x2
field public static final int PROTOCOL_WAPI = 4; // 0x4
field public static final int PROTOCOL_WPA = 1; // 0x1
}
public final class SoftApCapability implements android.os.Parcelable {
method public boolean areFeaturesSupported(long);
method public int describeContents();
method public int getMaxSupportedClients();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.SoftApCapability> CREATOR;
field public static final long SOFTAP_FEATURE_ACS_OFFLOAD = 1L; // 0x1L
field public static final long SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 2L; // 0x2L
field public static final long SOFTAP_FEATURE_WPA3_SAE = 4L; // 0x4L
}
public final class SoftApConfiguration implements android.os.Parcelable {
method @NonNull public java.util.List<android.net.MacAddress> getAllowedClientList();
method public int getBand();
method @NonNull public java.util.List<android.net.MacAddress> getBlockedClientList();
method public int getChannel();
method public int getMaxNumberOfClients();
method public long getShutdownTimeoutMillis();
method public boolean isAutoShutdownEnabled();
method public boolean isClientControlByUserEnabled();
method @Nullable public android.net.wifi.WifiConfiguration toWifiConfiguration();
field public static final int BAND_2GHZ = 1; // 0x1
field public static final int BAND_5GHZ = 2; // 0x2
field public static final int BAND_6GHZ = 4; // 0x4
field public static final int BAND_ANY = 7; // 0x7
}
public static final class SoftApConfiguration.Builder {
ctor public SoftApConfiguration.Builder();
ctor public SoftApConfiguration.Builder(@NonNull android.net.wifi.SoftApConfiguration);
method @NonNull public android.net.wifi.SoftApConfiguration build();
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setAllowedClientList(@NonNull java.util.List<android.net.MacAddress>);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setAutoShutdownEnabled(boolean);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBand(int);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBlockedClientList(@NonNull java.util.List<android.net.MacAddress>);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setBssid(@Nullable android.net.MacAddress);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setChannel(int, int);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setClientControlByUserEnabled(boolean);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setHiddenSsid(boolean);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setMaxNumberOfClients(@IntRange(from=0) int);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setPassphrase(@Nullable String, int);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setShutdownTimeoutMillis(@IntRange(from=0) long);
method @NonNull public android.net.wifi.SoftApConfiguration.Builder setSsid(@Nullable String);
}
public final class SoftApInfo implements android.os.Parcelable {
method public int describeContents();
method public int getBandwidth();
method public int getFrequency();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field public static final int CHANNEL_WIDTH_160MHZ = 6; // 0x6
field public static final int CHANNEL_WIDTH_20MHZ = 2; // 0x2
field public static final int CHANNEL_WIDTH_20MHZ_NOHT = 1; // 0x1
field public static final int CHANNEL_WIDTH_40MHZ = 3; // 0x3
field public static final int CHANNEL_WIDTH_80MHZ = 4; // 0x4
field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 5; // 0x5
field public static final int CHANNEL_WIDTH_INVALID = 0; // 0x0
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.SoftApInfo> CREATOR;
}
public final class WifiClient implements android.os.Parcelable {
method public int describeContents();
method @NonNull public android.net.MacAddress getMacAddress();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiClient> CREATOR;
}
@Deprecated public class WifiConfiguration implements android.os.Parcelable {
method @Deprecated public int getAuthType();
method @Deprecated @NonNull public android.net.IpConfiguration getIpConfiguration();
method @Deprecated @NonNull public android.net.wifi.WifiConfiguration.NetworkSelectionStatus getNetworkSelectionStatus();
method @Deprecated @NonNull public String getPrintableSsid();
method @Deprecated public int getRecentFailureReason();
method @Deprecated public boolean hasNoInternetAccess();
method @Deprecated public boolean isEphemeral();
method @Deprecated public static boolean isMetered(@Nullable android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiInfo);
method @Deprecated public boolean isNoInternetAccessExpected();
method @Deprecated public void setIpConfiguration(@Nullable android.net.IpConfiguration);
method @Deprecated public void setNetworkSelectionStatus(@NonNull android.net.wifi.WifiConfiguration.NetworkSelectionStatus);
field @Deprecated public static final int INVALID_NETWORK_ID = -1; // 0xffffffff
field @Deprecated public static final int METERED_OVERRIDE_METERED = 1; // 0x1
field @Deprecated public static final int METERED_OVERRIDE_NONE = 0; // 0x0
field @Deprecated public static final int METERED_OVERRIDE_NOT_METERED = 2; // 0x2
field @Deprecated public static final int RANDOMIZATION_NONE = 0; // 0x0
field @Deprecated public static final int RANDOMIZATION_PERSISTENT = 1; // 0x1
field @Deprecated public static final int RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA = 17; // 0x11
field @Deprecated public static final int RECENT_FAILURE_NONE = 0; // 0x0
field @Deprecated public boolean allowAutojoin;
field @Deprecated public int carrierId;
field @Deprecated public String creatorName;
field @Deprecated public int creatorUid;
field @Deprecated public boolean fromWifiNetworkSpecifier;
field @Deprecated public boolean fromWifiNetworkSuggestion;
field @Deprecated public String lastUpdateName;
field @Deprecated public int lastUpdateUid;
field @Deprecated public int macRandomizationSetting;
field @Deprecated public boolean meteredHint;
field @Deprecated public int meteredOverride;
field @Deprecated public int numAssociation;
field @Deprecated public int numScorerOverride;
field @Deprecated public int numScorerOverrideAndSwitchedNetwork;
field @Deprecated public boolean requirePmf;
field @Deprecated public boolean shared;
field @Deprecated public boolean useExternalScores;
}
@Deprecated public static class WifiConfiguration.KeyMgmt {
field @Deprecated public static final int WAPI_CERT = 14; // 0xe
field @Deprecated public static final int WAPI_PSK = 13; // 0xd
field @Deprecated public static final int WPA2_PSK = 4; // 0x4
}
@Deprecated public static class WifiConfiguration.NetworkSelectionStatus {
method @Deprecated public int getDisableReasonCounter(int);
method @Deprecated public long getDisableTime();
method @Deprecated public static int getMaxNetworkSelectionDisableReason();
method @Deprecated public int getNetworkSelectionDisableReason();
method @Deprecated @Nullable public static String getNetworkSelectionDisableReasonString(int);
method @Deprecated public int getNetworkSelectionStatus();
method @Deprecated @NonNull public String getNetworkStatusString();
method @Deprecated public boolean hasEverConnected();
field @Deprecated public static final int DISABLED_ASSOCIATION_REJECTION = 1; // 0x1
field @Deprecated public static final int DISABLED_AUTHENTICATION_FAILURE = 2; // 0x2
field @Deprecated public static final int DISABLED_AUTHENTICATION_NO_CREDENTIALS = 5; // 0x5
field @Deprecated public static final int DISABLED_AUTHENTICATION_NO_SUBSCRIPTION = 9; // 0x9
field @Deprecated public static final int DISABLED_BY_WIFI_MANAGER = 7; // 0x7
field @Deprecated public static final int DISABLED_BY_WRONG_PASSWORD = 8; // 0x8
field @Deprecated public static final int DISABLED_DHCP_FAILURE = 3; // 0x3
field @Deprecated public static final int DISABLED_NONE = 0; // 0x0
field @Deprecated public static final int DISABLED_NO_INTERNET_PERMANENT = 6; // 0x6
field @Deprecated public static final int DISABLED_NO_INTERNET_TEMPORARY = 4; // 0x4
field @Deprecated public static final int NETWORK_SELECTION_ENABLED = 0; // 0x0
field @Deprecated public static final int NETWORK_SELECTION_PERMANENTLY_DISABLED = 2; // 0x2
field @Deprecated public static final int NETWORK_SELECTION_TEMPORARY_DISABLED = 1; // 0x1
}
@Deprecated public static final class WifiConfiguration.NetworkSelectionStatus.Builder {
ctor @Deprecated public WifiConfiguration.NetworkSelectionStatus.Builder();
method @Deprecated @NonNull public android.net.wifi.WifiConfiguration.NetworkSelectionStatus build();
method @Deprecated @NonNull public android.net.wifi.WifiConfiguration.NetworkSelectionStatus.Builder setNetworkSelectionDisableReason(int);
method @Deprecated @NonNull public android.net.wifi.WifiConfiguration.NetworkSelectionStatus.Builder setNetworkSelectionStatus(int);
}
public class WifiEnterpriseConfig implements android.os.Parcelable {
method @Nullable public String[] getCaCertificateAliases();
method @NonNull public String getCaPath();
method @NonNull public String getClientCertificateAlias();
method public int getOcsp();
method @NonNull public String getWapiCertSuite();
method public void setCaCertificateAliases(@Nullable String[]);
method public void setCaPath(@NonNull String);
method public void setClientCertificateAlias(@NonNull String);
method public void setOcsp(int);
method public void setWapiCertSuite(@NonNull String);
field public static final int OCSP_NONE = 0; // 0x0
field public static final int OCSP_REQUEST_CERT_STATUS = 1; // 0x1
field public static final int OCSP_REQUIRE_ALL_NON_TRUSTED_CERTS_STATUS = 3; // 0x3
field public static final int OCSP_REQUIRE_CERT_STATUS = 2; // 0x2
}
public class WifiFrameworkInitializer {
method public static void registerServiceWrappers();
}
public class WifiInfo implements android.os.Parcelable android.net.TransportInfo {
method public double getLostTxPacketsPerSecond();
method @Nullable public String getRequestingPackageName();
method public double getRetriedTxPacketsPerSecond();
method public int getScore();
method public double getSuccessfulRxPacketsPerSecond();
method public double getSuccessfulTxPacketsPerSecond();
method public boolean isEphemeral();
method public boolean isOsuAp();
method public boolean isPasspointAp();
method @Nullable public static String sanitizeSsid(@Nullable String);
field public static final String DEFAULT_MAC_ADDRESS = "02:00:00:00:00:00";
field public static final int INVALID_RSSI = -127; // 0xffffff81
}
public class WifiManager {
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void addOnWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void allowAutojoin(int, boolean);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void allowAutojoinGlobal(boolean);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void allowAutojoinPasspoint(@NonNull String, boolean);
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void clearWifiConnectedNetworkScorer();
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void connect(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void connect(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK}) public void disableEphemeralNetwork(@NonNull String);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void factoryReset();
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void forget(int, @Nullable android.net.wifi.WifiManager.ActionListener);
method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.util.Pair<android.net.wifi.WifiConfiguration,java.util.Map<java.lang.Integer,java.util.List<android.net.wifi.ScanResult>>>> getAllMatchingWifiConfigs(@NonNull java.util.List<android.net.wifi.ScanResult>);
method @Nullable @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public String getCountryCode();
method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public android.net.Network getCurrentNetwork();
method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public String[] getFactoryMacAddresses();
method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,java.util.List<android.net.wifi.ScanResult>> getMatchingOsuProviders(@Nullable java.util.List<android.net.wifi.ScanResult>);
method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,android.net.wifi.hotspot2.PasspointConfiguration> getMatchingPasspointConfigsForOsuProviders(@NonNull java.util.Set<android.net.wifi.hotspot2.OsuProvider>);
method @NonNull @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE}) public java.util.Map<android.net.wifi.WifiNetworkSuggestion,java.util.List<android.net.wifi.ScanResult>> getMatchingScanResults(@NonNull java.util.List<android.net.wifi.WifiNetworkSuggestion>, @Nullable java.util.List<android.net.wifi.ScanResult>);
method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE, android.Manifest.permission.READ_WIFI_CREDENTIAL}) public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public android.net.wifi.SoftApConfiguration getSoftApConfiguration();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void getWifiActivityEnergyInfoAsync(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiActivityEnergyInfoListener);
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public android.net.wifi.WifiConfiguration getWifiApConfiguration();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public int getWifiApState();
method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.net.wifi.WifiConfiguration> getWifiConfigForMatchedNetworkSuggestionsSharedWithUser(@NonNull java.util.List<android.net.wifi.ScanResult>);
method public boolean isApMacRandomizationSupported();
method public boolean isConnectedMacRandomizationSupported();
method @Deprecated public boolean isDeviceToDeviceRttSupported();
method public boolean isPortableHotspotSupported();
method public boolean isVerboseLoggingEnabled();
method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isWifiApEnabled();
method public boolean isWifiScannerSupported();
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void registerNetworkRequestMatchCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.NetworkRequestMatchCallback);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void registerSoftApCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.SoftApCallback);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void registerTrafficStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.TrafficStateCallback);
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void removeOnWifiUsabilityStatsListener(@NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void restoreBackupData(@NonNull byte[]);
method @Nullable @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public android.net.wifi.SoftApConfiguration restoreSoftApBackupData(@NonNull byte[]);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void restoreSupplicantBackupData(@NonNull byte[], @NonNull byte[]);
method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public byte[] retrieveBackupData();
method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public byte[] retrieveSoftApBackupData();
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_STACK}) public void save(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setAutoWakeupEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.WIFI_SET_DEVICE_MOBILITY_STATE) public void setDeviceMobilityState(int);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setMacRandomizationSettingPasspointEnabled(@NonNull String, boolean);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setPasspointMeteredOverride(@NonNull String, int);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setScanAlwaysAvailable(boolean);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setScanThrottleEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean setSoftApConfiguration(@NonNull android.net.wifi.SoftApConfiguration);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void setVerboseLoggingEnabled(boolean);
method @Deprecated @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public boolean setWifiApConfiguration(android.net.wifi.WifiConfiguration);
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public boolean setWifiConnectedNetworkScorer(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.WifiConnectedNetworkScorer);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsConfiguratorInitiator(@NonNull String, int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsEnrolleeInitiator(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startLocalOnlyHotspot(@NonNull android.net.wifi.SoftApConfiguration, @Nullable java.util.concurrent.Executor, @Nullable android.net.wifi.WifiManager.LocalOnlyHotspotCallback);
method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public boolean startScan(android.os.WorkSource);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startSubscriptionProvisioning(@NonNull android.net.wifi.hotspot2.OsuProvider, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.hotspot2.ProvisioningCallback);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public boolean startTetheredHotspot(@Nullable android.net.wifi.SoftApConfiguration);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void stopEasyConnectSession();
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public boolean stopSoftAp();
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void unregisterNetworkRequestMatchCallback(@NonNull android.net.wifi.WifiManager.NetworkRequestMatchCallback);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void unregisterSoftApCallback(@NonNull android.net.wifi.WifiManager.SoftApCallback);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void unregisterTrafficStateCallback(@NonNull android.net.wifi.WifiManager.TrafficStateCallback);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void updateInterfaceIpState(@Nullable String, int);
method @RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE) public void updateWifiUsabilityScore(int, int, int);
field public static final String ACTION_LINK_CONFIGURATION_CHANGED = "android.net.wifi.LINK_CONFIGURATION_CHANGED";
field @RequiresPermission(android.Manifest.permission.NETWORK_CARRIER_PROVISIONING) public static final String ACTION_NETWORK_SETTINGS_RESET = "android.net.wifi.action.NETWORK_SETTINGS_RESET";
field public static final String ACTION_PASSPOINT_LAUNCH_OSU_VIEW = "android.net.wifi.action.PASSPOINT_LAUNCH_OSU_VIEW";
field public static final String ACTION_REQUEST_DISABLE = "android.net.wifi.action.REQUEST_DISABLE";
field public static final String ACTION_REQUEST_ENABLE = "android.net.wifi.action.REQUEST_ENABLE";
field public static final int CHANGE_REASON_ADDED = 0; // 0x0
field public static final int CHANGE_REASON_CONFIG_CHANGE = 2; // 0x2
field public static final int CHANGE_REASON_REMOVED = 1; // 0x1
field public static final String CONFIGURED_NETWORKS_CHANGED_ACTION = "android.net.wifi.CONFIGURED_NETWORKS_CHANGE";
field public static final int DEVICE_MOBILITY_STATE_HIGH_MVMT = 1; // 0x1
field public static final int DEVICE_MOBILITY_STATE_LOW_MVMT = 2; // 0x2
field public static final int DEVICE_MOBILITY_STATE_STATIONARY = 3; // 0x3
field public static final int DEVICE_MOBILITY_STATE_UNKNOWN = 0; // 0x0
field public static final int EASY_CONNECT_NETWORK_ROLE_AP = 1; // 0x1
field public static final int EASY_CONNECT_NETWORK_ROLE_STA = 0; // 0x0
field public static final String EXTRA_CHANGE_REASON = "changeReason";
field public static final String EXTRA_LINK_PROPERTIES = "android.net.wifi.extra.LINK_PROPERTIES";
field public static final String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
field public static final String EXTRA_OSU_NETWORK = "android.net.wifi.extra.OSU_NETWORK";
field public static final String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
field public static final String EXTRA_URL = "android.net.wifi.extra.URL";
field public static final String EXTRA_WIFI_AP_FAILURE_REASON = "android.net.wifi.extra.WIFI_AP_FAILURE_REASON";
field public static final String EXTRA_WIFI_AP_INTERFACE_NAME = "android.net.wifi.extra.WIFI_AP_INTERFACE_NAME";
field public static final String EXTRA_WIFI_AP_MODE = "android.net.wifi.extra.WIFI_AP_MODE";
field public static final String EXTRA_WIFI_AP_STATE = "wifi_state";
field public static final String EXTRA_WIFI_CONFIGURATION = "wifiConfiguration";
field public static final String EXTRA_WIFI_CREDENTIAL_EVENT_TYPE = "et";
field public static final String EXTRA_WIFI_CREDENTIAL_SSID = "ssid";
field public static final int IFACE_IP_MODE_CONFIGURATION_ERROR = 0; // 0x0
field public static final int IFACE_IP_MODE_LOCAL_ONLY = 2; // 0x2
field public static final int IFACE_IP_MODE_TETHERED = 1; // 0x1
field public static final int IFACE_IP_MODE_UNSPECIFIED = -1; // 0xffffffff
field public static final int PASSPOINT_HOME_NETWORK = 0; // 0x0
field public static final int PASSPOINT_ROAMING_NETWORK = 1; // 0x1
field public static final int SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER = 0; // 0x0
field public static final int SAP_CLIENT_BLOCK_REASON_CODE_NO_MORE_STAS = 1; // 0x1
field public static final int SAP_START_FAILURE_GENERAL = 0; // 0x0
field public static final int SAP_START_FAILURE_NO_CHANNEL = 1; // 0x1
field public static final int SAP_START_FAILURE_UNSUPPORTED_CONFIGURATION = 2; // 0x2
field public static final String WIFI_AP_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_AP_STATE_CHANGED";
field public static final int WIFI_AP_STATE_DISABLED = 11; // 0xb
field public static final int WIFI_AP_STATE_DISABLING = 10; // 0xa
field public static final int WIFI_AP_STATE_ENABLED = 13; // 0xd
field public static final int WIFI_AP_STATE_ENABLING = 12; // 0xc
field public static final int WIFI_AP_STATE_FAILED = 14; // 0xe
field public static final String WIFI_CREDENTIAL_CHANGED_ACTION = "android.net.wifi.WIFI_CREDENTIAL_CHANGED";
field public static final int WIFI_CREDENTIAL_FORGOT = 1; // 0x1
field public static final int WIFI_CREDENTIAL_SAVED = 0; // 0x0
}
public static interface WifiManager.ActionListener {
method public void onFailure(int);
method public void onSuccess();
}
public static interface WifiManager.NetworkRequestMatchCallback {
method public default void onAbort();
method public default void onMatch(@NonNull java.util.List<android.net.wifi.ScanResult>);
method public default void onUserSelectionCallbackRegistration(@NonNull android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback);
method public default void onUserSelectionConnectFailure(@NonNull android.net.wifi.WifiConfiguration);
method public default void onUserSelectionConnectSuccess(@NonNull android.net.wifi.WifiConfiguration);
}
public static interface WifiManager.NetworkRequestUserSelectionCallback {
method public default void reject();
method public default void select(@NonNull android.net.wifi.WifiConfiguration);
}
public static interface WifiManager.OnWifiActivityEnergyInfoListener {
method public void onWifiActivityEnergyInfo(@Nullable android.os.connectivity.WifiActivityEnergyInfo);
}
public static interface WifiManager.OnWifiUsabilityStatsListener {
method public void onWifiUsabilityStats(int, boolean, @NonNull android.net.wifi.WifiUsabilityStatsEntry);
}
public static interface WifiManager.ScoreUpdateObserver {
method public void notifyScoreUpdate(int, int);
method public void triggerUpdateOfWifiUsabilityStats(int);
}
public static interface WifiManager.SoftApCallback {
method public default void onBlockedClientConnecting(@NonNull android.net.wifi.WifiClient, int);
method public default void onCapabilityChanged(@NonNull android.net.wifi.SoftApCapability);
method public default void onConnectedClientsChanged(@NonNull java.util.List<android.net.wifi.WifiClient>);
method public default void onInfoChanged(@NonNull android.net.wifi.SoftApInfo);
method public default void onStateChanged(int, int);
}
public static interface WifiManager.TrafficStateCallback {
method public void onStateChanged(int);
field public static final int DATA_ACTIVITY_IN = 1; // 0x1
field public static final int DATA_ACTIVITY_INOUT = 3; // 0x3
field public static final int DATA_ACTIVITY_NONE = 0; // 0x0
field public static final int DATA_ACTIVITY_OUT = 2; // 0x2
}
public static interface WifiManager.WifiConnectedNetworkScorer {
method public void onSetScoreUpdateObserver(@NonNull android.net.wifi.WifiManager.ScoreUpdateObserver);
method public void onStart(int);
method public void onStop(int);
}
public class WifiNetworkConnectionStatistics implements android.os.Parcelable {
ctor public WifiNetworkConnectionStatistics(int, int);
ctor public WifiNetworkConnectionStatistics();
ctor public WifiNetworkConnectionStatistics(android.net.wifi.WifiNetworkConnectionStatistics);
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkConnectionStatistics> CREATOR;
field public int numConnection;
field public int numUsage;
}
public final class WifiNetworkSuggestion implements android.os.Parcelable {
method @NonNull public android.net.wifi.WifiConfiguration getWifiConfiguration();
}
public static final class WifiNetworkSuggestion.Builder {
method @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_CARRIER_PROVISIONING) public android.net.wifi.WifiNetworkSuggestion.Builder setCarrierId(int);
}
public class WifiScanner {
method @Deprecated public void configureWifiChange(int, int, int, int, int, android.net.wifi.WifiScanner.BssidInfo[]);
method @Deprecated public void configureWifiChange(android.net.wifi.WifiScanner.WifiChangeSettings);
method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public java.util.List<java.lang.Integer> getAvailableChannels(int);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public boolean getScanResults();
method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public java.util.List<android.net.wifi.ScanResult> getSingleScanResults();
method @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public void registerScanListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiScanner.ScanListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public void setScanningEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void startBackgroundScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void startBackgroundScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener, android.os.WorkSource);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void startScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void startScan(android.net.wifi.WifiScanner.ScanSettings, android.net.wifi.WifiScanner.ScanListener, android.os.WorkSource);
method @Deprecated public void startTrackingBssids(android.net.wifi.WifiScanner.BssidInfo[], int, android.net.wifi.WifiScanner.BssidListener);
method @Deprecated public void startTrackingWifiChange(android.net.wifi.WifiScanner.WifiChangeListener);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void stopBackgroundScan(android.net.wifi.WifiScanner.ScanListener);
method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public void stopScan(android.net.wifi.WifiScanner.ScanListener);
method @Deprecated public void stopTrackingBssids(android.net.wifi.WifiScanner.BssidListener);
method @Deprecated public void stopTrackingWifiChange(android.net.wifi.WifiScanner.WifiChangeListener);
method public void unregisterScanListener(@NonNull android.net.wifi.WifiScanner.ScanListener);
field public static final int MAX_SCAN_PERIOD_MS = 1024000; // 0xfa000
field public static final int MIN_SCAN_PERIOD_MS = 1000; // 0x3e8
field public static final int REASON_DUPLICATE_REQEUST = -5; // 0xfffffffb
field public static final int REASON_INVALID_LISTENER = -2; // 0xfffffffe
field public static final int REASON_INVALID_REQUEST = -3; // 0xfffffffd
field public static final int REASON_NOT_AUTHORIZED = -4; // 0xfffffffc
field public static final int REASON_SUCCEEDED = 0; // 0x0
field public static final int REASON_UNSPECIFIED = -1; // 0xffffffff
field @Deprecated public static final int REPORT_EVENT_AFTER_BUFFER_FULL = 0; // 0x0
field public static final int REPORT_EVENT_AFTER_EACH_SCAN = 1; // 0x1
field public static final int REPORT_EVENT_FULL_SCAN_RESULT = 2; // 0x2
field public static final int REPORT_EVENT_NO_BATCH = 4; // 0x4
field public static final int SCAN_TYPE_HIGH_ACCURACY = 2; // 0x2
field public static final int SCAN_TYPE_LOW_LATENCY = 0; // 0x0
field public static final int SCAN_TYPE_LOW_POWER = 1; // 0x1
field public static final int WIFI_BAND_24_5_6_GHZ = 11; // 0xb
field public static final int WIFI_BAND_24_5_WITH_DFS_6_GHZ = 15; // 0xf
field public static final int WIFI_BAND_24_GHZ = 1; // 0x1
field public static final int WIFI_BAND_5_GHZ = 2; // 0x2
field public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4; // 0x4
field public static final int WIFI_BAND_5_GHZ_WITH_DFS = 6; // 0x6
field public static final int WIFI_BAND_6_GHZ = 8; // 0x8
field public static final int WIFI_BAND_BOTH = 3; // 0x3
field public static final int WIFI_BAND_BOTH_WITH_DFS = 7; // 0x7
field public static final int WIFI_BAND_UNSPECIFIED = 0; // 0x0
}
public static interface WifiScanner.ActionListener {
method public void onFailure(int, String);
method public void onSuccess();
}
@Deprecated public static class WifiScanner.BssidInfo {
ctor @Deprecated public WifiScanner.BssidInfo();
field @Deprecated public String bssid;
field @Deprecated public int frequencyHint;
field @Deprecated public int high;
field @Deprecated public int low;
}
@Deprecated public static interface WifiScanner.BssidListener extends android.net.wifi.WifiScanner.ActionListener {
method @Deprecated public void onFound(android.net.wifi.ScanResult[]);
method @Deprecated public void onLost(android.net.wifi.ScanResult[]);
}
public static class WifiScanner.ChannelSpec {
ctor public WifiScanner.ChannelSpec(int);
field public int frequency;
}
@Deprecated public static class WifiScanner.HotlistSettings implements android.os.Parcelable {
ctor @Deprecated public WifiScanner.HotlistSettings();
field @Deprecated public int apLostThreshold;
field @Deprecated public android.net.wifi.WifiScanner.BssidInfo[] bssidInfos;
}
public static class WifiScanner.ParcelableScanData implements android.os.Parcelable {
ctor public WifiScanner.ParcelableScanData(android.net.wifi.WifiScanner.ScanData[]);
method public android.net.wifi.WifiScanner.ScanData[] getResults();
field public android.net.wifi.WifiScanner.ScanData[] mResults;
}
public static class WifiScanner.ParcelableScanResults implements android.os.Parcelable {
ctor public WifiScanner.ParcelableScanResults(android.net.wifi.ScanResult[]);
method public android.net.wifi.ScanResult[] getResults();
field public android.net.wifi.ScanResult[] mResults;
}
public static class WifiScanner.ScanData implements android.os.Parcelable {
ctor public WifiScanner.ScanData(int, int, android.net.wifi.ScanResult[]);
ctor public WifiScanner.ScanData(android.net.wifi.WifiScanner.ScanData);
method public int getFlags();
method public int getId();
method public android.net.wifi.ScanResult[] getResults();
}
public static interface WifiScanner.ScanListener extends android.net.wifi.WifiScanner.ActionListener {
method public void onFullResult(android.net.wifi.ScanResult);
method @Deprecated public void onPeriodChanged(int);
method public void onResults(android.net.wifi.WifiScanner.ScanData[]);
}
public static class WifiScanner.ScanSettings implements android.os.Parcelable {
ctor public WifiScanner.ScanSettings();
field public int band;
field public android.net.wifi.WifiScanner.ChannelSpec[] channels;
field @NonNull @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public final java.util.List<android.net.wifi.WifiScanner.ScanSettings.HiddenNetwork> hiddenNetworks;
field public boolean hideFromAppOps;
field public boolean ignoreLocationSettings;
field @Deprecated public int maxPeriodInMs;
field @Deprecated public int maxScansToCache;
field @Deprecated public int numBssidsPerScan;
field @Deprecated public int periodInMs;
field @Deprecated public int reportEvents;
field @Deprecated public int stepCount;
field @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public int type;
}
public static class WifiScanner.ScanSettings.HiddenNetwork {
ctor public WifiScanner.ScanSettings.HiddenNetwork(@NonNull String);
field @NonNull public final String ssid;
}
@Deprecated public static interface WifiScanner.WifiChangeListener extends android.net.wifi.WifiScanner.ActionListener {
method @Deprecated public void onChanging(android.net.wifi.ScanResult[]);
method @Deprecated public void onQuiescence(android.net.wifi.ScanResult[]);
}
@Deprecated public static class WifiScanner.WifiChangeSettings implements android.os.Parcelable {
ctor @Deprecated public WifiScanner.WifiChangeSettings();
field @Deprecated public android.net.wifi.WifiScanner.BssidInfo[] bssidInfos;
field @Deprecated public int lostApSampleSize;
field @Deprecated public int minApsBreachingThreshold;
field @Deprecated public int periodInMs;
field @Deprecated public int rssiSampleSize;
field @Deprecated public int unchangedSampleSize;
}
public final class WifiUsabilityStatsEntry implements android.os.Parcelable {
method public int describeContents();
method public int getCellularDataNetworkType();
method public int getCellularSignalStrengthDb();
method public int getCellularSignalStrengthDbm();
method public int getLinkSpeedMbps();
method public int getProbeElapsedTimeSinceLastUpdateMillis();
method public int getProbeMcsRateSinceLastUpdate();
method public int getProbeStatusSinceLastUpdate();
method public int getRssi();
method public int getRxLinkSpeedMbps();
method public long getTimeStampMillis();
method public long getTotalBackgroundScanTimeMillis();
method public long getTotalBeaconRx();
method public long getTotalCcaBusyFreqTimeMillis();
method public long getTotalHotspot2ScanTimeMillis();
method public long getTotalNanScanTimeMillis();
method public long getTotalPnoScanTimeMillis();
method public long getTotalRadioOnFreqTimeMillis();
method public long getTotalRadioOnTimeMillis();
method public long getTotalRadioRxTimeMillis();
method public long getTotalRadioTxTimeMillis();
method public long getTotalRoamScanTimeMillis();
method public long getTotalRxSuccess();
method public long getTotalScanTimeMillis();
method public long getTotalTxBad();
method public long getTotalTxRetries();
method public long getTotalTxSuccess();
method public boolean isSameRegisteredCell();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiUsabilityStatsEntry> CREATOR;
field public static final int PROBE_STATUS_FAILURE = 3; // 0x3
field public static final int PROBE_STATUS_NO_PROBE = 1; // 0x1
field public static final int PROBE_STATUS_SUCCESS = 2; // 0x2
field public static final int PROBE_STATUS_UNKNOWN = 0; // 0x0
}
}
package android.net.wifi.aware {
public class DiscoverySession implements java.lang.AutoCloseable {
method @Deprecated public android.net.NetworkSpecifier createNetworkSpecifierPmk(@NonNull android.net.wifi.aware.PeerHandle, @NonNull byte[]);
}
public class WifiAwareSession implements java.lang.AutoCloseable {
method public android.net.NetworkSpecifier createNetworkSpecifierPmk(int, @NonNull byte[], @NonNull byte[]);
}
}
package android.net.wifi.hotspot2 {
public final class OsuProvider implements android.os.Parcelable {
method public int describeContents();
method @Nullable public String getFriendlyName();
method @Nullable public android.net.Uri getServerUri();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.OsuProvider> CREATOR;
}
public final class PasspointConfiguration implements android.os.Parcelable {
method public int getMeteredOverride();
method public boolean isAutojoinEnabled();
method public boolean isMacRandomizationEnabled();
}
public abstract class ProvisioningCallback {
ctor public ProvisioningCallback();
method public abstract void onProvisioningComplete();
method public abstract void onProvisioningFailure(int);
method public abstract void onProvisioningStatus(int);
field public static final int OSU_FAILURE_ADD_PASSPOINT_CONFIGURATION = 22; // 0x16
field public static final int OSU_FAILURE_AP_CONNECTION = 1; // 0x1
field public static final int OSU_FAILURE_INVALID_URL_FORMAT_FOR_OSU = 8; // 0x8
field public static final int OSU_FAILURE_NO_AAA_SERVER_TRUST_ROOT_NODE = 17; // 0x11
field public static final int OSU_FAILURE_NO_AAA_TRUST_ROOT_CERTIFICATE = 21; // 0x15
field public static final int OSU_FAILURE_NO_OSU_ACTIVITY_FOUND = 14; // 0xe
field public static final int OSU_FAILURE_NO_POLICY_SERVER_TRUST_ROOT_NODE = 19; // 0x13
field public static final int OSU_FAILURE_NO_PPS_MO = 16; // 0x10
field public static final int OSU_FAILURE_NO_REMEDIATION_SERVER_TRUST_ROOT_NODE = 18; // 0x12
field public static final int OSU_FAILURE_OSU_PROVIDER_NOT_FOUND = 23; // 0x17
field public static final int OSU_FAILURE_PROVISIONING_ABORTED = 6; // 0x6
field public static final int OSU_FAILURE_PROVISIONING_NOT_AVAILABLE = 7; // 0x7
field public static final int OSU_FAILURE_RETRIEVE_TRUST_ROOT_CERTIFICATES = 20; // 0x14
field public static final int OSU_FAILURE_SERVER_CONNECTION = 3; // 0x3
field public static final int OSU_FAILURE_SERVER_URL_INVALID = 2; // 0x2
field public static final int OSU_FAILURE_SERVER_VALIDATION = 4; // 0x4
field public static final int OSU_FAILURE_SERVICE_PROVIDER_VERIFICATION = 5; // 0x5
field public static final int OSU_FAILURE_SOAP_MESSAGE_EXCHANGE = 11; // 0xb
field public static final int OSU_FAILURE_START_REDIRECT_LISTENER = 12; // 0xc
field public static final int OSU_FAILURE_TIMED_OUT_REDIRECT_LISTENER = 13; // 0xd
field public static final int OSU_FAILURE_UNEXPECTED_COMMAND_TYPE = 9; // 0x9
field public static final int OSU_FAILURE_UNEXPECTED_SOAP_MESSAGE_STATUS = 15; // 0xf
field public static final int OSU_FAILURE_UNEXPECTED_SOAP_MESSAGE_TYPE = 10; // 0xa
field public static final int OSU_STATUS_AP_CONNECTED = 2; // 0x2
field public static final int OSU_STATUS_AP_CONNECTING = 1; // 0x1
field public static final int OSU_STATUS_INIT_SOAP_EXCHANGE = 6; // 0x6
field public static final int OSU_STATUS_REDIRECT_RESPONSE_RECEIVED = 8; // 0x8
field public static final int OSU_STATUS_RETRIEVING_TRUST_ROOT_CERTS = 11; // 0xb
field public static final int OSU_STATUS_SECOND_SOAP_EXCHANGE = 9; // 0x9
field public static final int OSU_STATUS_SERVER_CONNECTED = 5; // 0x5
field public static final int OSU_STATUS_SERVER_CONNECTING = 3; // 0x3
field public static final int OSU_STATUS_SERVER_VALIDATED = 4; // 0x4
field public static final int OSU_STATUS_THIRD_SOAP_EXCHANGE = 10; // 0xa
field public static final int OSU_STATUS_WAITING_FOR_REDIRECT_RESPONSE = 7; // 0x7
}
}
package android.net.wifi.p2p {
public final class WifiP2pGroupList implements android.os.Parcelable {
method public int describeContents();
method @NonNull public java.util.List<android.net.wifi.p2p.WifiP2pGroup> getGroupList();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pGroupList> CREATOR;
}
public class WifiP2pManager {
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.OVERRIDE_WIFI_CONFIG}) public void deletePersistentGroup(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, int, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void factoryReset(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.READ_WIFI_CREDENTIAL}) public void requestPersistentGroupInfo(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @Nullable android.net.wifi.p2p.WifiP2pManager.PersistentGroupInfoListener);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.OVERRIDE_WIFI_CONFIG}) public void setDeviceName(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull String, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
method @RequiresPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY) public void setMiracastMode(int);
method @RequiresPermission(android.Manifest.permission.CONFIGURE_WIFI_DISPLAY) public void setWfdInfo(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pWfdInfo, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.OVERRIDE_WIFI_CONFIG}) public void setWifiP2pChannels(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, int, int, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void startListening(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public void stopListening(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
field public static final String ACTION_WIFI_P2P_PERSISTENT_GROUPS_CHANGED = "android.net.wifi.p2p.action.WIFI_P2P_PERSISTENT_GROUPS_CHANGED";
field public static final int MIRACAST_DISABLED = 0; // 0x0
field public static final int MIRACAST_SINK = 2; // 0x2
field public static final int MIRACAST_SOURCE = 1; // 0x1
}
public static interface WifiP2pManager.PersistentGroupInfoListener {
method public void onPersistentGroupInfoAvailable(@NonNull android.net.wifi.p2p.WifiP2pGroupList);
}
}
package android.net.wifi.rtt {
public static final class RangingRequest.Builder {
method public android.net.wifi.rtt.RangingRequest.Builder addResponder(@NonNull android.net.wifi.rtt.ResponderConfig);
}
public final class RangingResult implements android.os.Parcelable {
method @NonNull public byte[] getLci();
method @NonNull public byte[] getLcr();
}
public final class ResponderConfig implements android.os.Parcelable {
ctor public ResponderConfig(@NonNull android.net.MacAddress, int, boolean, int, int, int, int, int);
ctor public ResponderConfig(@NonNull android.net.wifi.aware.PeerHandle, int, boolean, int, int, int, int, int);
method public int describeContents();
method public static android.net.wifi.rtt.ResponderConfig fromScanResult(android.net.wifi.ScanResult);
method public static android.net.wifi.rtt.ResponderConfig fromWifiAwarePeerHandleWithDefaults(android.net.wifi.aware.PeerHandle);
method public static android.net.wifi.rtt.ResponderConfig fromWifiAwarePeerMacAddressWithDefaults(android.net.MacAddress);
method public void writeToParcel(android.os.Parcel, int);
field public static final int CHANNEL_WIDTH_160MHZ = 3; // 0x3
field public static final int CHANNEL_WIDTH_20MHZ = 0; // 0x0
field public static final int CHANNEL_WIDTH_40MHZ = 1; // 0x1
field public static final int CHANNEL_WIDTH_80MHZ = 2; // 0x2
field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; // 0x4
field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.ResponderConfig> CREATOR;
field public static final int PREAMBLE_HE = 3; // 0x3
field public static final int PREAMBLE_HT = 1; // 0x1
field public static final int PREAMBLE_LEGACY = 0; // 0x0
field public static final int PREAMBLE_VHT = 2; // 0x2
field public static final int RESPONDER_AP = 0; // 0x0
field public static final int RESPONDER_AWARE = 4; // 0x4
field public static final int RESPONDER_P2P_CLIENT = 3; // 0x3
field public static final int RESPONDER_P2P_GO = 2; // 0x2
field public static final int RESPONDER_STA = 1; // 0x1
field public final int centerFreq0;
field public final int centerFreq1;
field public final int channelWidth;
field public final int frequency;
field public final android.net.MacAddress macAddress;
field public final android.net.wifi.aware.PeerHandle peerHandle;
field public final int preamble;
field public final int responderType;
field public final boolean supports80211mc;
}
public final class ResponderLocation implements android.os.Parcelable {
method public boolean getExtraInfoOnAssociationIndication();
}
public class WifiRttManager {
method @RequiresPermission(allOf={android.Manifest.permission.LOCATION_HARDWARE}) public void cancelRanging(@Nullable android.os.WorkSource);
method @RequiresPermission(allOf={android.Manifest.permission.LOCATION_HARDWARE, android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.CHANGE_WIFI_STATE, android.Manifest.permission.ACCESS_WIFI_STATE}) public void startRanging(@Nullable android.os.WorkSource, @NonNull android.net.wifi.rtt.RangingRequest, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.rtt.RangingResultCallback);
}
}

View File

@@ -1,6 +0,0 @@
// Baseline format: 1.0
MissingGetterMatchingBuilder: android.net.wifi.rtt.RangingRequest.Builder#addResponder(android.net.wifi.rtt.ResponderConfig):
android.net.wifi.rtt.RangingRequest does not declare a `getResponders()` method matching method android.net.wifi.rtt.RangingRequest.Builder.addResponder(android.net.wifi.rtt.ResponderConfig)
MissingNullability: android.net.wifi.rtt.RangingRequest.Builder#addResponder(android.net.wifi.rtt.ResponderConfig):

View File

@@ -1,16 +0,0 @@
// Signature format: 2.0
package android.net.wifi {
@Deprecated public class BatchedScanResult implements android.os.Parcelable {
ctor public BatchedScanResult();
ctor public BatchedScanResult(android.net.wifi.BatchedScanResult);
field public final java.util.List<android.net.wifi.ScanResult> scanResults;
field public boolean truncated;
}
public final class ScanResult implements android.os.Parcelable {
field public boolean untrusted;
}
}

View File

@@ -1,123 +0,0 @@
## used by service-wifi ##
# Network Stack AIDL interface.
rule android.net.DataStallReportParcelable* com.android.wifi.x.@0
rule android.net.DhcpResultsParcelable* com.android.wifi.x.@0
rule android.net.IIpMemoryStore* com.android.wifi.x.@0
rule android.net.IIpMemoryStoreCallbacks* com.android.wifi.x.@0
rule android.net.INetd* com.android.wifi.x.@0
rule android.net.INetdUnsolicitedEventListener* com.android.wifi.x.@0
rule android.net.INetworkStackConnector* com.android.wifi.x.@0
rule android.net.InformationElementParcelable* com.android.wifi.x.@0
rule android.net.InitialConfigurationParcelable* com.android.wifi.x.@0
rule android.net.InterfaceConfigurationParcel* com.android.wifi.x.@0
rule android.net.Layer2InformationParcelable* com.android.wifi.x.@0
rule android.net.Layer2PacketParcelable* com.android.wifi.x.@0
rule android.net.MarkMaskParcel* com.android.wifi.x.@0
rule android.net.NattKeepalivePacketDataParcelable* com.android.wifi.x.@0
rule android.net.NetworkTestResultParcelable* com.android.wifi.x.@0
rule android.net.PrivateDnsConfigParcel* com.android.wifi.x.@0
rule android.net.ProvisioningConfigurationParcelable* com.android.wifi.x.@0
rule android.net.ResolverParamsParcel* com.android.wifi.x.@0
rule android.net.RouteInfoParcel* com.android.wifi.x.@0
rule android.net.ScanResultInfoParcelable* com.android.wifi.x.@0
rule android.net.TcpKeepalivePacketDataParcelable* com.android.wifi.x.@0
rule android.net.TetherConfigParcel* com.android.wifi.x.@0
rule android.net.TetherOffloadRuleParcel* com.android.wifi.x.@0
rule android.net.TetherStatsParcel* com.android.wifi.x.@0
rule android.net.UidRangeParcel* com.android.wifi.x.@0
rule android.net.dhcp.DhcpLeaseParcelable* com.android.wifi.x.@0
rule android.net.dhcp.DhcpServingParamsParcel* com.android.wifi.x.@0
rule android.net.ip.IIpClient* com.android.wifi.x.@0
rule android.net.ip.IIpClientCallbacks* com.android.wifi.x.@0
rule android.net.ipmemorystore.Blob* com.android.wifi.x.@0
rule android.net.ipmemorystore.IOnBlobRetrievedListener* com.android.wifi.x.@0
rule android.net.ipmemorystore.IOnStatusAndCountListener* com.android.wifi.x.@0
rule android.net.ipmemorystore.IOnStatusListener* com.android.wifi.x.@0
rule android.net.ipmemorystore.NetworkAttributesParcelable* com.android.wifi.x.@0
rule android.net.ipmemorystore.SameL3NetworkResponseParcelable* com.android.wifi.x.@0
rule android.net.ipmemorystore.StatusParcelable* com.android.wifi.x.@0
rule android.net.networkstack.aidl.** com.android.wifi.x.@0
# Net utils (includes Network Stack helper classes).
rule android.net.DhcpResults* com.android.wifi.x.@0
rule android.net.InterfaceConfiguration* com.android.wifi.x.@0
rule android.net.IpMemoryStore* com.android.wifi.x.@0
rule android.net.NetworkMonitorManager* com.android.wifi.x.@0
rule android.net.NetworkFactory* com.android.wifi.x.@0
rule android.net.ip.IpClientCallbacks* com.android.wifi.x.@0
rule android.net.ip.IpClientManager* com.android.wifi.x.@0
rule android.net.ip.IpClientUtil* com.android.wifi.x.@0
rule android.net.ipmemorystore.NetworkAttributes* com.android.wifi.x.@0
rule android.net.ipmemorystore.OnBlobRetrievedListener* com.android.wifi.x.@0
rule android.net.ipmemorystore.OnDeleteStatusListener* com.android.wifi.x.@0
rule android.net.ipmemorystore.OnStatusListener* com.android.wifi.x.@0
rule android.net.ipmemorystore.Status* com.android.wifi.x.@0
rule android.net.networkstack.ModuleNetworkStackClient* com.android.wifi.x.@0
rule android.net.networkstack.NetworkStackClientBase* com.android.wifi.x.@0
rule android.net.shared.InetAddressUtils* com.android.wifi.x.@0
rule android.net.shared.InitialConfiguration* com.android.wifi.x.@0
rule android.net.shared.IpConfigurationParcelableUtil* com.android.wifi.x.@0
rule android.net.shared.Layer2Information* com.android.wifi.x.@0
rule android.net.shared.LinkPropertiesParcelableUtil* com.android.wifi.x.@0
rule android.net.shared.NetdUtils* com.android.wifi.x.@0
rule android.net.shared.NetworkMonitorUtils* com.android.wifi.x.@0
rule android.net.shared.ParcelableUtil* com.android.wifi.x.@0
rule android.net.shared.PrivateDnsConfig* com.android.wifi.x.@0
rule android.net.shared.ProvisioningConfiguration* com.android.wifi.x.@0
rule android.net.shared.RouteUtils* com.android.wifi.x.@0
rule android.net.util.KeepalivePacketDataUtil* com.android.wifi.x.@0
rule android.net.util.NetworkConstants* com.android.wifi.x.@0
rule android.net.util.InterfaceParams* com.android.wifi.x.@0
rule android.net.util.SharedLog* com.android.wifi.x.@0
rule android.net.util.NetUtils* com.android.wifi.x.@0
rule androidx.annotation.** com.android.wifi.x.@0
# We don't jar-jar the entire package because, we still use some classes (like
# AsyncChannel in com.android.internal.util) from these packages which are not
# inside our jar (currently in framework.jar, but will be in wifisdk.jar in the future).
rule com.android.internal.util.FastXmlSerializer* com.android.wifi.x.@0
rule com.android.internal.util.HexDump* com.android.wifi.x.@0
rule com.android.internal.util.IState* com.android.wifi.x.@0
rule com.android.internal.util.MessageUtils* com.android.wifi.x.@0
rule com.android.internal.util.State* com.android.wifi.x.@0
rule com.android.internal.util.StateMachine* com.android.wifi.x.@0
rule com.android.internal.util.WakeupMessage* com.android.wifi.x.@0
rule android.util.BackupUtils* com.android.wifi.x.@0
rule android.util.LocalLog* com.android.wifi.x.@0
rule android.util.Rational* com.android.wifi.x.@0
# Use our statically linked bouncy castle library
rule org.bouncycastle.** com.android.wifi.x.@0
# Use our statically linked protobuf library
rule com.google.protobuf.** com.android.wifi.x.@0
# use statically linked SystemMessageProto
rule com.android.internal.messages.SystemMessageProto* com.android.wifi.x.@0
# Use our statically linked PlatformProperties library
rule android.sysprop.** com.android.wifi.x.@0
# Use our statically linked HIDL stubs
# Note: android.hardware.wifi.** is used by various wifi feature flags. This unfortunately is also the namespace
# used by vendor HAL stubs. So, this rule is intentionally weird to try and filter the vendor HAL stubs only.
rule android.hardware.wifi.V** com.android.wifi.x.@0
rule android.hardware.wifi.supplicant.** com.android.wifi.x.@0
rule android.hardware.wifi.hostapd.** com.android.wifi.x.@0
rule android.hidl.** com.android.wifi.x.@0
# Use our statically linked ksoap2
rule org.ksoap2.** com.android.wifi.x.@0
# Use our statically linked nanohttpd
rule fi.iki.elonen.** com.android.wifi.x.@0
## used by both framework-wifi and service-wifi ##
rule android.content.pm.BaseParceledListSlice* com.android.wifi.x.@0
rule android.content.pm.ParceledListSlice* com.android.wifi.x.@0
rule android.os.HandlerExecutor* com.android.wifi.x.@0
rule android.telephony.Annotation* com.android.wifi.x.@0
rule com.android.internal.util.AsyncChannel* com.android.wifi.x.@0
rule com.android.internal.util.AsyncService* com.android.wifi.x.@0
rule com.android.internal.util.Preconditions* com.android.wifi.x.@0
rule com.android.internal.util.Protocol* com.android.wifi.x.@0
rule com.android.net.module.util.** com.android.wifi.x.@0
rule com.android.modules.utils.** com.android.wifi.x.@0

View File

@@ -1,80 +0,0 @@
/*
* Copyright (C) 2016 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;
/**
* This object contains the payload of an ANQP element.
* Vendor id is the vendor ID for the element, or 0 if it is an 802.11(u) element.
* Hotspot 2.0 uses the WFA Vendor ID which is 0x506f9a
* The payload contains the bytes of the payload, starting after the length octet(s).
* @hide
*/
public class AnqpInformationElement {
public static final int HOTSPOT20_VENDOR_ID = 0x506f9a;
public static final int ANQP_QUERY_LIST = 256;
public static final int ANQP_CAPABILITY_LIST = 257;
public static final int ANQP_VENUE_NAME = 258;
public static final int ANQP_EMERGENCY_NUMBER = 259;
public static final int ANQP_NWK_AUTH_TYPE = 260;
public static final int ANQP_ROAMING_CONSORTIUM = 261;
public static final int ANQP_IP_ADDR_AVAILABILITY = 262;
public static final int ANQP_NAI_REALM = 263;
public static final int ANQP_3GPP_NETWORK = 264;
public static final int ANQP_GEO_LOC = 265;
public static final int ANQP_CIVIC_LOC = 266;
public static final int ANQP_LOC_URI = 267;
public static final int ANQP_DOM_NAME = 268;
public static final int ANQP_EMERGENCY_ALERT = 269;
public static final int ANQP_TDLS_CAP = 270;
public static final int ANQP_EMERGENCY_NAI = 271;
public static final int ANQP_NEIGHBOR_REPORT = 272;
public static final int ANQP_VENDOR_SPEC = 56797;
public static final int HS_QUERY_LIST = 1;
public static final int HS_CAPABILITY_LIST = 2;
public static final int HS_FRIENDLY_NAME = 3;
public static final int HS_WAN_METRICS = 4;
public static final int HS_CONN_CAPABILITY = 5;
public static final int HS_NAI_HOME_REALM_QUERY = 6;
public static final int HS_OPERATING_CLASS = 7;
public static final int HS_OSU_PROVIDERS = 8;
public static final int HS_ICON_REQUEST = 10;
public static final int HS_ICON_FILE = 11;
private final int mVendorId;
private final int mElementId;
private final byte[] mPayload;
public AnqpInformationElement(int vendorId, int elementId, byte[] payload) {
mVendorId = vendorId;
mElementId = elementId;
mPayload = payload;
}
public int getVendorId() {
return mVendorId;
}
public int getElementId() {
return mElementId;
}
public byte[] getPayload() {
return mPayload;
}
}

View File

@@ -1,97 +0,0 @@
/*
* Copyright (C) 2008 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.os.Parcelable;
import android.annotation.SystemApi;
import android.os.Parcel;
import java.util.ArrayList;
import java.util.List;
/**
* Describes the Results of a batched set of wifi scans where the firmware performs many
* scans and stores the timestamped results without waking the main processor each time.
* @hide
* @removed
*/
@Deprecated
@SystemApi
public class BatchedScanResult implements Parcelable {
private static final String TAG = "BatchedScanResult";
/** Inidcates this scan was interrupted and may only have partial results. */
public boolean truncated;
/** The result of this particular scan. */
public final List<ScanResult> scanResults = new ArrayList<ScanResult>();
public BatchedScanResult() {
}
public BatchedScanResult(BatchedScanResult source) {
truncated = source.truncated;
for (ScanResult s : source.scanResults) scanResults.add(new ScanResult(s));
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("BatchedScanResult: ").
append("truncated: ").append(String.valueOf(truncated)).
append("scanResults: [");
for (ScanResult s : scanResults) {
sb.append(" <").append(s.toString()).append("> ");
}
sb.append(" ]");
return sb.toString();
}
/** Implement the Parcelable interface {@hide} */
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface {@hide} */
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(truncated ? 1 : 0);
dest.writeInt(scanResults.size());
for (ScanResult s : scanResults) {
s.writeToParcel(dest, flags);
}
}
/** Implement the Parcelable interface {@hide} */
public static final @android.annotation.NonNull Creator<BatchedScanResult> CREATOR =
new Creator<BatchedScanResult>() {
public BatchedScanResult createFromParcel(Parcel in) {
BatchedScanResult result = new BatchedScanResult();
result.truncated = (in.readInt() == 1);
int count = in.readInt();
while (count-- > 0) {
result.scanResults.add(ScanResult.CREATOR.createFromParcel(in));
}
return result;
}
public BatchedScanResult[] newArray(int size) {
return new BatchedScanResult[size];
}
};
}

View File

@@ -1,57 +0,0 @@
/**
* Copyright (c) 2016, 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;
/**
* Utility class containing EAP (Extensible Authentication Protocol) Related constants.
*
* @hide
*/
public final class EAPConstants {
// Constant definition for EAP types. Refer to
// http://www.iana.org/assignments/eap-numbers/eap-numbers.xhtml for more info.
public static final int EAP_MD5 = 4;
public static final int EAP_OTP = 5;
public static final int EAP_RSA = 9;
public static final int EAP_KEA = 11;
public static final int EAP_KEA_VALIDATE = 12;
public static final int EAP_TLS = 13;
public static final int EAP_LEAP = 17;
public static final int EAP_SIM = 18;
public static final int EAP_TTLS = 21;
public static final int EAP_AKA = 23;
public static final int EAP_3Com = 24;
public static final int EAP_MSCHAPv2 = 26;
public static final int EAP_PEAP = 29;
public static final int EAP_POTP = 32;
public static final int EAP_ActiontecWireless = 35;
public static final int EAP_HTTPDigest = 38;
public static final int EAP_SPEKE = 41;
public static final int EAP_MOBAC = 42;
public static final int EAP_FAST = 43;
public static final int EAP_ZLXEAP = 44;
public static final int EAP_Link = 45;
public static final int EAP_PAX = 46;
public static final int EAP_PSK = 47;
public static final int EAP_SAKE = 48;
public static final int EAP_IKEv2 = 49;
public static final int EAP_AKA_PRIME = 50;
public static final int EAP_GPSK = 51;
public static final int EAP_PWD = 52;
public static final int EAP_EKE = 53;
public static final int EAP_TEAP = 55;
}

View File

@@ -1,267 +0,0 @@
/*
* Copyright (C) 2018 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.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.util.SparseArray;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.Executor;
/**
* Easy Connect (DPP) Status Callback. Use this callback to get status updates (success, failure,
* progress) from the Easy Connect operations.
*/
public abstract class EasyConnectStatusCallback {
/**
* Easy Connect R1 Success event: Configuration sent (Configurator mode). This is the last
* and final Easy Connect event when either the local device or remote device implement R1.
* If both devices implement R2, this event will never be received, and the
* {@link #EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED} will be received.
* @hide
*/
@SystemApi
public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT = 0;
/**
* Easy Connect R2 Success event: Configuration applied by Enrollee (Configurator mode).
* This is the last and final Easy Connect event when both the local device and remote device
* implement R2. If either the local device or remote device implement R1, this event will never
* be received, and the {@link #EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT} will be received.
* @hide
*/
@SystemApi
public static final int EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED = 1;
/** @hide */
@IntDef(prefix = {"EASY_CONNECT_EVENT_SUCCESS_"}, value = {
EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT,
EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface EasyConnectSuccessStatusCode {
}
/**
* Easy Connect Progress event: Initial authentication with peer succeeded.
* @hide
*/
@SystemApi
public static final int EASY_CONNECT_EVENT_PROGRESS_AUTHENTICATION_SUCCESS = 0;
/**
* Easy Connect Progress event: Peer requires more time to process bootstrapping.
* @hide
*/
@SystemApi
public static final int EASY_CONNECT_EVENT_PROGRESS_RESPONSE_PENDING = 1;
/**
* Easy Connect R2 Progress event: Configuration sent to Enrollee, waiting for response
* @hide
*/
@SystemApi
public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_SENT_WAITING_RESPONSE = 2;
/**
* Easy Connect R2 Progress event: Configuration accepted by Enrollee, waiting for response
* @hide
*/
@SystemApi
public static final int EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_ACCEPTED = 3;
/** @hide */
@IntDef(prefix = {"EASY_CONNECT_EVENT_PROGRESS_"}, value = {
EASY_CONNECT_EVENT_PROGRESS_AUTHENTICATION_SUCCESS,
EASY_CONNECT_EVENT_PROGRESS_RESPONSE_PENDING,
EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_SENT_WAITING_RESPONSE,
EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_ACCEPTED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface EasyConnectProgressStatusCode {
}
/**
* Easy Connect Failure event: Scanned QR code is either not a Easy Connect URI, or the Easy
* Connect URI has errors.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_URI = -1;
/**
* Easy Connect Failure event: Bootstrapping/Authentication initialization process failure.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION = -2;
/**
* Easy Connect Failure event: Both devices are implementing the same role and are incompatible.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE = -3;
/**
* Easy Connect Failure event: Configuration process has failed due to malformed message.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_CONFIGURATION = -4;
/**
* Easy Connect Failure event: Easy Connect request while in another Easy Connect exchange.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_BUSY = -5;
/**
* Easy Connect Failure event: No response from the peer.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_TIMEOUT = -6;
/**
* Easy Connect Failure event: General protocol failure.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_GENERIC = -7;
/**
* Easy Connect Failure event: Feature or option is not supported.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED = -8;
/**
* Easy Connect Failure event: Invalid network provided to Easy Connect configurator.
* Network must either be WPA3-Personal (SAE) or WPA2-Personal (PSK).
*/
public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK = -9;
/**
* Easy Connect R2 Failure event: Enrollee cannot find the network.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK = -10;
/**
* Easy Connect R2 Failure event: Enrollee failed to authenticate with the network.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION = -11;
/**
* Easy Connect R2 Failure event: Enrollee rejected the configuration.
*/
public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION = -12;
/** @hide */
@IntDef(prefix = {"EASY_CONNECT_EVENT_FAILURE_"}, value = {
EASY_CONNECT_EVENT_FAILURE_INVALID_URI,
EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION,
EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE,
EASY_CONNECT_EVENT_FAILURE_CONFIGURATION,
EASY_CONNECT_EVENT_FAILURE_BUSY,
EASY_CONNECT_EVENT_FAILURE_TIMEOUT,
EASY_CONNECT_EVENT_FAILURE_GENERIC,
EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED,
EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK,
EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK,
EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION,
EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION,
})
@Retention(RetentionPolicy.SOURCE)
public @interface EasyConnectFailureStatusCode {
}
/** @hide */
@SystemApi
public EasyConnectStatusCallback() {
// Fully-static utility classes must not have constructor
}
/**
* Called when local Easy Connect Enrollee successfully receives a new Wi-Fi configuration from
* the
* peer Easy Connect configurator. This callback marks the successful end of the Easy Connect
* current Easy Connect
* session, and no further callbacks will be called. This callback is the successful outcome
* of a Easy Connect flow starting with
* {@link WifiManager#startEasyConnectAsEnrolleeInitiator(String, Executor,
* EasyConnectStatusCallback)} .
*
* @param newNetworkId New Wi-Fi configuration with a network ID received from the configurator
* @hide
*/
@SystemApi
public abstract void onEnrolleeSuccess(int newNetworkId);
/**
* Called when a Easy Connect success event takes place, except for when configuration is
* received from an external Configurator. The callback onSuccessConfigReceived will be used in
* this case. This callback marks the successful end of the current Easy Connect session, and no
* further callbacks will be called. This callback is the successful outcome of a Easy Connect
* flow starting with {@link WifiManager#startEasyConnectAsConfiguratorInitiator(String, int,
* int, Executor,EasyConnectStatusCallback)}.
*
* @param code Easy Connect success status code.
* @hide
*/
@SystemApi
public abstract void onConfiguratorSuccess(@EasyConnectSuccessStatusCode int code);
/**
* Called when a Easy Connect Failure event takes place. This callback marks the unsuccessful
* end of the current Easy Connect session, and no further callbacks will be called.
*
* @param code Easy Connect failure status code.
* @hide
*/
@SystemApi
public void onFailure(@EasyConnectFailureStatusCode int code) {}
/**
* Called when a Easy Connect Failure event takes place. This callback marks the unsuccessful
* end of the current Easy Connect session, and no further callbacks will be called.
*
* Note: Easy Connect (DPP) R2, provides additional details for the Configurator when the
* remote Enrollee is unable to connect to a network. The ssid, channelList and bandList
* inputs are initialized only for the EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK failure
* code, and the ssid and bandList are initialized for the
* EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION failure code.
*
* @param code Easy Connect failure status code.
* @param ssid SSID of the network the Enrollee tried to connect to.
* @param channelListArray List of Global Operating classes and channel sets the Enrollee used
* to scan to find the network, see the "DPP Connection Status Object"
* section in the specification for the format, and Table E-4 in
* IEEE Std 802.11-2016 - Global operating classes for more details.
* The sparse array key is the Global Operating class, and the value
* is an integer array of Wi-Fi channels.
* @param operatingClassArray Array of bands the Enrollee supports as expressed as the Global
* Operating Class, see Table E-4 in IEEE Std 802.11-2016 - Global
* operating classes.
* @hide
*/
@SystemApi
public void onFailure(@EasyConnectFailureStatusCode int code, @Nullable String ssid,
@NonNull SparseArray<int[]> channelListArray, @NonNull int[] operatingClassArray) {
onFailure(code);
}
/**
* Called when Easy Connect events that indicate progress take place. Can be used by UI elements
* to show progress.
*
* @param code Easy Connect progress status code.
* @hide
*/
@SystemApi
public abstract void onProgress(@EasyConnectProgressStatusCode int code);
}

View File

@@ -1,27 +0,0 @@
/*
* 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;
/**
* Interface for generic wifi callbacks.
* @hide
*/
oneway interface IActionListener
{
void onSuccess();
void onFailure(int reason);
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (C) 2018 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;
/**
* Interface for DPP callback.
*
* @hide
*/
oneway interface IDppCallback
{
/**
* Called when local DPP Enrollee successfully receives a new Wi-Fi configuratrion from the
* peer DPP configurator.
*/
void onSuccessConfigReceived(int newNetworkId);
/**
* Called when DPP success events take place, except for when configuration is received from
* an external Configurator. The callback onSuccessConfigReceived will be used in this case.
*/
void onSuccess(int status);
/**
* Called when DPP Failure events take place.
*/
void onFailure(int status, String ssid, String channelList, in int[] bandArray);
/**
* Called when DPP events that indicate progress take place. Can be used by UI elements
* to show progress.
*/
void onProgress(int status);
}

View File

@@ -1,30 +0,0 @@
/**
* 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.net.wifi.SoftApConfiguration;
/**
* Communicates LOHS status back to the application process.
*
* @hide
*/
oneway interface ILocalOnlyHotspotCallback {
void onHotspotStarted(in SoftApConfiguration config);
void onHotspotStopped();
void onHotspotFailed(int reason);
}

View File

@@ -1,39 +0,0 @@
/*
* Copyright (C) 2018 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.net.wifi.INetworkRequestUserSelectionCallback;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
/**
* Interface for network request match callback.
*
* @hide
*/
oneway interface INetworkRequestMatchCallback
{
void onUserSelectionCallbackRegistration(in INetworkRequestUserSelectionCallback userSelectionCallback);
void onAbort();
void onMatch(in List<ScanResult> scanResults);
void onUserSelectionConnectSuccess(in WifiConfiguration wificonfiguration);
void onUserSelectionConnectFailure(in WifiConfiguration wificonfiguration);
}

View File

@@ -1,31 +0,0 @@
/*
* Copyright (C) 2018 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.net.wifi.WifiConfiguration;
/**
* Interface for providing user selection in response to
* network request match callback.
* @hide
*/
oneway interface INetworkRequestUserSelectionCallback
{
void select(in WifiConfiguration wificonfiguration);
void reject();
}

View File

@@ -1,33 +0,0 @@
/*
* 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.os.connectivity.WifiActivityEnergyInfo;
/**
* Interface for Wi-Fi activity energy info listener.
*
* @hide
*/
oneway interface IOnWifiActivityEnergyInfoListener
{
/**
* Service to manager callback providing current Wi-Fi activity energy info.
* @param info the Wi-Fi activity energy info
*/
void onWifiActivityEnergyInfo(in WifiActivityEnergyInfo info);
}

View File

@@ -1,41 +0,0 @@
/*
* 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.net.wifi.WifiUsabilityStatsEntry;
/**
* Interface for Wi-Fi usability stats listener.
*
* @hide
*/
oneway interface IOnWifiUsabilityStatsListener
{
/**
* Service to manager callback providing current Wi-Fi usability stats.
*
* @param seqNum The sequence number of stats, used to derive the timing of updated Wi-Fi
* usability statistics, set by framework and shall be incremented by one
* after each update.
* @param isSameBssidAndFreq The flag to indicate whether the BSSID and the frequency of
* network stays the same or not relative to the last update of
* Wi-Fi usability stats.
* @param stats The updated Wi-Fi usability statistics.
*/
void onWifiUsabilityStats(int seqNum, boolean isSameBssidAndFreq,
in WifiUsabilityStatsEntry stats);
}

View File

@@ -1,27 +0,0 @@
/*
* 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;
/**
* Interface for Wi-Fi scan result available callback.
*
* @hide
*/
oneway interface IScanResultsCallback
{
void onScanResultsAvailable();
}

View File

@@ -1,24 +0,0 @@
/*
* 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;
/** @hide */
oneway interface IScanResultsListener
{
void onScanResultsAvailable();
}

View File

@@ -1,29 +0,0 @@
/*
* Copyright (C) 2020 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;
/**
* Interface for Wi-Fi score callback.
*
* @hide
*/
oneway interface IScoreUpdateObserver
{
void notifyScoreUpdate(int sessionId, int score);
void triggerUpdateOfWifiUsabilityStats(int sessionId);
}

View File

@@ -1,71 +0,0 @@
/*
* Copyright (C) 2018 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.net.wifi.SoftApCapability;
import android.net.wifi.SoftApInfo;
import android.net.wifi.WifiClient;
/**
* Interface for Soft AP callback.
*
* @hide
*/
oneway interface ISoftApCallback
{
/**
* Service to manager callback providing current soft AP state. The possible
* parameter values listed are defined in WifiManager.java
*
* @param state new AP state. One of WIFI_AP_STATE_DISABLED,
* WIFI_AP_STATE_DISABLING, WIFI_AP_STATE_ENABLED,
* WIFI_AP_STATE_ENABLING, WIFI_AP_STATE_FAILED
* @param failureReason reason when in failed state. One of
* SAP_START_FAILURE_GENERAL, SAP_START_FAILURE_NO_CHANNEL
*/
void onStateChanged(int state, int failureReason);
/**
* Service to manager callback providing connected client's information.
*
* @param clients the currently connected clients
*/
void onConnectedClientsChanged(in List<WifiClient> clients);
/**
* Service to manager callback providing information of softap.
*
* @param softApInfo is the softap information. {@link SoftApInfo}
*/
void onInfoChanged(in SoftApInfo softApInfo);
/**
* Service to manager callback providing capability of softap.
*
* @param capability is the softap capability. {@link SoftApCapability}
*/
void onCapabilityChanged(in SoftApCapability capability);
/**
* Service to manager callback providing blocked client of softap with specific reason code.
*
* @param client the currently blocked client.
* @param blockedReason one of blocked reason from {@link WifiManager.SapClientBlockedReason}
*/
void onBlockedClientConnecting(in WifiClient client, int blockedReason);
}

View File

@@ -1,29 +0,0 @@
/*
* 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.net.wifi.WifiNetworkSuggestion;
/**
* Interface for suggestion network connection listener.
*
* @hide
*/
oneway interface ISuggestionConnectionStatusListener
{
void onConnectionStatus(in WifiNetworkSuggestion wifiNetworkSuggestion, int failureReason);
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright (C) 2018 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;
/**
* Interface for Traffic state callback.
*
* @hide
*/
oneway interface ITrafficStateCallback
{
/**
* Callback invoked to inform clients about the current traffic state.
*
* @param state One of the values: {@link #DATA_ACTIVITY_NONE}, {@link #DATA_ACTIVITY_IN},
* {@link #DATA_ACTIVITY_OUT} & {@link #DATA_ACTIVITY_INOUT}.
* @hide
*/
void onStateChanged(int state);
}

View File

@@ -1,28 +0,0 @@
/*
* 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;
/**
* Interface for tx packet counter callback.
* @deprecated no longer used, remove once removed from BaseWifiService
* @hide
*/
oneway interface ITxPacketCountListener
{
void onSuccess(int count);
void onFailure(int reason);
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2020 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.net.wifi.IScoreUpdateObserver;
/**
* Interface for Wi-Fi connected network scorer.
*
* @hide
*/
oneway interface IWifiConnectedNetworkScorer
{
void onStart(int sessionId);
void onStop(int sessionId);
void onSetScoreUpdateObserver(IScoreUpdateObserver observerImpl);
}

View File

@@ -1,278 +0,0 @@
/**
* Copyright (c) 2008, 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.content.pm.ParceledListSlice;
import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.hotspot2.IProvisioningCallback;
import android.net.DhcpInfo;
import android.net.Network;
import android.net.wifi.IActionListener;
import android.net.wifi.IDppCallback;
import android.net.wifi.ILocalOnlyHotspotCallback;
import android.net.wifi.INetworkRequestMatchCallback;
import android.net.wifi.IOnWifiActivityEnergyInfoListener;
import android.net.wifi.IOnWifiUsabilityStatsListener;
import android.net.wifi.IScanResultsCallback;
import android.net.wifi.ISoftApCallback;
import android.net.wifi.ISuggestionConnectionStatusListener;
import android.net.wifi.ITrafficStateCallback;
import android.net.wifi.IWifiConnectedNetworkScorer;
import android.net.wifi.ScanResult;
import android.net.wifi.SoftApConfiguration;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiNetworkSuggestion;
import android.os.Messenger;
import android.os.ResultReceiver;
import android.os.WorkSource;
/**
* Interface that allows controlling and querying Wi-Fi connectivity.
*
* {@hide}
*/
interface IWifiManager
{
long getSupportedFeatures();
oneway void getWifiActivityEnergyInfoAsync(in IOnWifiActivityEnergyInfoListener listener);
ParceledListSlice getConfiguredNetworks(String packageName, String featureId);
ParceledListSlice getPrivilegedConfiguredNetworks(String packageName, String featureId);
Map getAllMatchingFqdnsForScanResults(in List<ScanResult> scanResult);
Map getMatchingOsuProviders(in List<ScanResult> scanResult);
Map getMatchingPasspointConfigsForOsuProviders(in List<OsuProvider> osuProviders);
int addOrUpdateNetwork(in WifiConfiguration config, String packageName);
boolean addOrUpdatePasspointConfiguration(in PasspointConfiguration config, String packageName);
boolean removePasspointConfiguration(in String fqdn, String packageName);
List<PasspointConfiguration> getPasspointConfigurations(in String packageName);
List<WifiConfiguration> getWifiConfigsForPasspointProfiles(in List<String> fqdnList);
void queryPasspointIcon(long bssid, String fileName);
int matchProviderWithCurrentNetwork(String fqdn);
void deauthenticateNetwork(long holdoff, boolean ess);
boolean removeNetwork(int netId, String packageName);
boolean enableNetwork(int netId, boolean disableOthers, String packageName);
boolean disableNetwork(int netId, String packageName);
void allowAutojoinGlobal(boolean choice);
void allowAutojoin(int netId, boolean choice);
void allowAutojoinPasspoint(String fqdn, boolean enableAutoJoin);
void setMacRandomizationSettingPasspointEnabled(String fqdn, boolean enable);
void setPasspointMeteredOverride(String fqdn, int meteredOverride);
boolean startScan(String packageName, String featureId);
List<ScanResult> getScanResults(String callingPackage, String callingFeatureId);
boolean disconnect(String packageName);
boolean reconnect(String packageName);
boolean reassociate(String packageName);
WifiInfo getConnectionInfo(String callingPackage, String callingFeatureId);
boolean setWifiEnabled(String packageName, boolean enable);
int getWifiEnabledState();
String getCountryCode();
boolean is5GHzBandSupported();
boolean is6GHzBandSupported();
boolean isWifiStandardSupported(int standard);
DhcpInfo getDhcpInfo();
void setScanAlwaysAvailable(boolean isAvailable);
boolean isScanAlwaysAvailable();
boolean acquireWifiLock(IBinder lock, int lockType, String tag, in WorkSource ws);
void updateWifiLockWorkSource(IBinder lock, in WorkSource ws);
boolean releaseWifiLock(IBinder lock);
void initializeMulticastFiltering();
boolean isMulticastEnabled();
void acquireMulticastLock(IBinder binder, String tag);
void releaseMulticastLock(String tag);
void updateInterfaceIpState(String ifaceName, int mode);
boolean startSoftAp(in WifiConfiguration wifiConfig);
boolean startTetheredHotspot(in SoftApConfiguration softApConfig);
boolean stopSoftAp();
int startLocalOnlyHotspot(in ILocalOnlyHotspotCallback callback, String packageName,
String featureId, in SoftApConfiguration customConfig);
void stopLocalOnlyHotspot();
void startWatchLocalOnlyHotspot(in ILocalOnlyHotspotCallback callback);
void stopWatchLocalOnlyHotspot();
@UnsupportedAppUsage
int getWifiApEnabledState();
@UnsupportedAppUsage
WifiConfiguration getWifiApConfiguration();
SoftApConfiguration getSoftApConfiguration();
boolean setWifiApConfiguration(in WifiConfiguration wifiConfig, String packageName);
boolean setSoftApConfiguration(in SoftApConfiguration softApConfig, String packageName);
void notifyUserOfApBandConversion(String packageName);
void enableTdls(String remoteIPAddress, boolean enable);
void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable);
String getCurrentNetworkWpsNfcConfigurationToken();
void enableVerboseLogging(int verbose);
int getVerboseLoggingLevel();
void disableEphemeralNetwork(String SSID, String packageName);
void factoryReset(String packageName);
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
Network getCurrentNetwork();
byte[] retrieveBackupData();
void restoreBackupData(in byte[] data);
byte[] retrieveSoftApBackupData();
SoftApConfiguration restoreSoftApBackupData(in byte[] data);
void restoreSupplicantBackupData(in byte[] supplicantData, in byte[] ipConfigData);
void startSubscriptionProvisioning(in OsuProvider provider, in IProvisioningCallback callback);
void registerSoftApCallback(in IBinder binder, in ISoftApCallback callback, int callbackIdentifier);
void unregisterSoftApCallback(int callbackIdentifier);
void addOnWifiUsabilityStatsListener(in IBinder binder, in IOnWifiUsabilityStatsListener listener, int listenerIdentifier);
void removeOnWifiUsabilityStatsListener(int listenerIdentifier);
void registerTrafficStateCallback(in IBinder binder, in ITrafficStateCallback callback, int callbackIdentifier);
void unregisterTrafficStateCallback(int callbackIdentifier);
void registerNetworkRequestMatchCallback(in IBinder binder, in INetworkRequestMatchCallback callback, int callbackIdentifier);
void unregisterNetworkRequestMatchCallback(int callbackIdentifier);
int addNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName,
in String featureId);
int removeNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName);
List<WifiNetworkSuggestion> getNetworkSuggestions(in String packageName);
String[] getFactoryMacAddresses();
void setDeviceMobilityState(int state);
void startDppAsConfiguratorInitiator(in IBinder binder, in String enrolleeUri,
int selectedNetworkId, int netRole, in IDppCallback callback);
void startDppAsEnrolleeInitiator(in IBinder binder, in String configuratorUri,
in IDppCallback callback);
void stopDppSession();
void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec);
oneway void connect(in WifiConfiguration config, int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);
oneway void save(in WifiConfiguration config, in IBinder binder, in IActionListener listener, int callbackIdentifier);
oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);
void registerScanResultsCallback(in IScanResultsCallback callback);
void unregisterScanResultsCallback(in IScanResultsCallback callback);
void registerSuggestionConnectionStatusListener(in IBinder binder, in ISuggestionConnectionStatusListener listener, int listenerIdentifier, String packageName, String featureId);
void unregisterSuggestionConnectionStatusListener(int listenerIdentifier, String packageName);
int calculateSignalLevel(int rssi);
List<WifiConfiguration> getWifiConfigForMatchedNetworkSuggestionsSharedWithUser(in List<ScanResult> scanResults);
boolean setWifiConnectedNetworkScorer(in IBinder binder, in IWifiConnectedNetworkScorer scorer);
void clearWifiConnectedNetworkScorer();
/**
* Return the Map of {@link WifiNetworkSuggestion} and the list of <ScanResult>
*/
Map getMatchingScanResults(in List<WifiNetworkSuggestion> networkSuggestions, in List<ScanResult> scanResults, String callingPackage, String callingFeatureId);
void setScanThrottleEnabled(boolean enable);
boolean isScanThrottleEnabled();
Map getAllMatchingPasspointProfilesForScanResults(in List<ScanResult> scanResult);
void setAutoWakeupEnabled(boolean enable);
boolean isAutoWakeupEnabled();
}

View File

@@ -1,30 +0,0 @@
/*
* Copyright (C) 2008 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.os.Messenger;
import android.os.Bundle;
/**
* {@hide}
*/
interface IWifiScanner
{
Messenger getMessenger();
Bundle getAvailableChannels(int band, String packageName, String featureId);
}

View File

@@ -1,165 +0,0 @@
/**
* Copyright (c) 2016, 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.os.Parcel;
import java.io.ByteArrayInputStream;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
/**
* Provides utilities for writing/reading a non-Parcelable objects to/from
* a Parcel object.
*
* @hide
*/
public class ParcelUtil {
/**
* Write a PrivateKey object |key| to the specified Parcel |dest|.
*
* Below is the data format:
* |algorithm| -> String of algorithm name
* |endcodedKey| -> byte[] of key data
*
* For a null PrivateKey object, a null string will be written to |algorithm| and
* |encodedKey| will be skipped. Since a PrivateKey can only be constructed with
* a valid algorithm String.
*
* @param dest Parcel object to write to
* @param key PrivateKey object to read from.
*/
public static void writePrivateKey(Parcel dest, PrivateKey key) {
if (key == null) {
dest.writeString(null);
return;
}
dest.writeString(key.getAlgorithm());
dest.writeByteArray(key.getEncoded());
}
/**
* Read/create a PrivateKey object from a specified Parcel object |in|.
*
* Refer to the function above for the expected data format.
*
* @param in Parcel object to read from
* @return a PrivateKey object or null
*/
public static PrivateKey readPrivateKey(Parcel in) {
String algorithm = in.readString();
if (algorithm == null) {
return null;
}
byte[] userKeyBytes = in.createByteArray();
try {
KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(userKeyBytes));
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
return null;
}
}
/**
* Write a X509Certificate object |cert| to a Parcel object |dest|.
* The data being written to the Parcel is just a byte[] of the encoded certificate data.
*
* @param dest Parcel object to write to
* @param cert X509Certificate object to read from
*/
public static void writeCertificate(Parcel dest, X509Certificate cert) {
byte[] certBytes = null;
if (cert != null) {
try {
certBytes = cert.getEncoded();
} catch (CertificateEncodingException e) {
/* empty, write null. */
}
}
dest.writeByteArray(certBytes);
}
/**
* Read/create a X509Certificate object from a specified Parcel object |in|.
*
* @param in Parcel object to read from
* @return a X509Certficate object or null
*/
public static X509Certificate readCertificate(Parcel in) {
byte[] certBytes = in.createByteArray();
if (certBytes == null) {
return null;
}
try {
CertificateFactory cFactory = CertificateFactory.getInstance("X.509");
return (X509Certificate) cFactory
.generateCertificate(new ByteArrayInputStream(certBytes));
} catch (CertificateException e) {
return null;
}
}
/**
* Write an array of X509Certificate objects |certs| to a Parcel object |dest|.
* The data being written to the Parcel are consist of an integer indicating
* the size of the array and the certificates data. Certificates data will be
* skipped for a null array or size of 0 array.
*
* @param dest Parcel object to write to
* @param certs array of X509Certificate objects to read from
*/
public static void writeCertificates(Parcel dest, X509Certificate[] certs) {
if (certs == null || certs.length == 0) {
dest.writeInt(0);
return;
}
dest.writeInt(certs.length);
for (int i = 0; i < certs.length; i++) {
writeCertificate(dest, certs[i]);
}
}
/**
* Read/create an array of X509Certificate objects from a specified Parcel object |in|.
*
* @param in Parcel object to read from
* @return X509Certficate[] or null
*/
public static X509Certificate[] readCertificates(Parcel in) {
int length = in.readInt();
if (length == 0) {
return null;
}
X509Certificate[] certs = new X509Certificate[length];
for (int i = 0; i < length; i++) {
certs[i] = readCertificate(in);
}
return certs;
}
}

View File

@@ -1,21 +0,0 @@
/**
* Copyright (c) 2015, 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;
parcelable RttManager.RttCapabilities;
parcelable RttManager.ParcelableRttResults;
parcelable RttManager.ParcelableRttParams;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,186 +0,0 @@
/*
* 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.LongDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
/**
* A class representing capability of the SoftAp.
* {@see WifiManager}
*
* @hide
*/
@SystemApi
public final class SoftApCapability implements Parcelable {
/**
* Support for automatic channel selection in driver (ACS).
* Driver will auto select best channel based on interference to optimize performance.
*
* flag when {@link R.bool.config_wifi_softap_acs_supported)} is true.
*
* <p>
* Use {@link WifiManager.SoftApCallback#onInfoChanged(SoftApInfo)} and
* {@link SoftApInfo#getFrequency} and {@link SoftApInfo#getBandwidth} to get
* driver channel selection result.
*/
public static final long SOFTAP_FEATURE_ACS_OFFLOAD = 1 << 0;
/**
* Support for client force disconnect.
* flag when {@link R.bool.config_wifi_sofap_client_force_disconnect_supported)} is true
*
* <p>
* Several Soft AP client control features, e.g. specifying the maximum number of
* Soft AP clients, only work when this feature support is present.
* Check feature support before invoking
* {@link SoftApConfiguration.Builder#setMaxNumberOfClients(int)}
*/
public static final long SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 1 << 1;
/**
* Support for WPA3 Simultaneous Authentication of Equals (WPA3-SAE).
*
* flag when {@link config_wifi_softap_sae_supported)} is true.
*/
public static final long SOFTAP_FEATURE_WPA3_SAE = 1 << 2;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@LongDef(flag = true, prefix = { "SOFTAP_FEATURE_" }, value = {
SOFTAP_FEATURE_ACS_OFFLOAD,
SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT,
SOFTAP_FEATURE_WPA3_SAE,
})
public @interface HotspotFeatures {}
private @HotspotFeatures long mSupportedFeatures = 0;
private int mMaximumSupportedClientNumber;
/**
* Get the maximum supported client numbers which AP resides on.
*/
public int getMaxSupportedClients() {
return mMaximumSupportedClientNumber;
}
/**
* Set the maximum supported client numbers which AP resides on.
*
* @param maxClient maximum supported client numbers for the softap.
* @hide
*/
public void setMaxSupportedClients(int maxClient) {
mMaximumSupportedClientNumber = maxClient;
}
/**
* Returns true when all of the queried features are supported, otherwise false.
*
* @param features One or combination of the following features:
* {@link #SOFTAP_FEATURE_ACS_OFFLOAD}, {@link #SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT} or
* {@link #SOFTAP_FEATURE_WPA3_SAE}.
*/
public boolean areFeaturesSupported(@HotspotFeatures long features) {
return (mSupportedFeatures & features) == features;
}
/**
* @hide
*/
public SoftApCapability(@Nullable SoftApCapability source) {
if (source != null) {
mSupportedFeatures = source.mSupportedFeatures;
mMaximumSupportedClientNumber = source.mMaximumSupportedClientNumber;
}
}
/**
* Constructor with combination of the feature.
* Zero to no supported feature.
*
* @param features One or combination of the following features:
* {@link #SOFTAP_FEATURE_ACS_OFFLOAD}, {@link #SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT} or
* {@link #SOFTAP_FEATURE_WPA3_SAE}.
* @hide
*/
public SoftApCapability(@HotspotFeatures long features) {
mSupportedFeatures = features;
}
@Override
/** Implement the Parcelable interface. */
public int describeContents() {
return 0;
}
@Override
/** Implement the Parcelable interface */
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeLong(mSupportedFeatures);
dest.writeInt(mMaximumSupportedClientNumber);
}
@NonNull
/** Implement the Parcelable interface */
public static final Creator<SoftApCapability> CREATOR = new Creator<SoftApCapability>() {
public SoftApCapability createFromParcel(Parcel in) {
long supportedFeatures = in.readLong();
SoftApCapability capability = new SoftApCapability(supportedFeatures);
capability.mMaximumSupportedClientNumber = in.readInt();
return capability;
}
public SoftApCapability[] newArray(int size) {
return new SoftApCapability[size];
}
};
@NonNull
@Override
public String toString() {
StringBuilder sbuf = new StringBuilder();
sbuf.append("SupportedFeatures=").append(mSupportedFeatures);
sbuf.append("MaximumSupportedClientNumber=").append(mMaximumSupportedClientNumber);
return sbuf.toString();
}
@Override
public boolean equals(@NonNull Object o) {
if (this == o) return true;
if (!(o instanceof SoftApCapability)) return false;
SoftApCapability capability = (SoftApCapability) o;
return mSupportedFeatures == capability.mSupportedFeatures
&& mMaximumSupportedClientNumber == capability.mMaximumSupportedClientNumber;
}
@Override
public int hashCode() {
return Objects.hash(mSupportedFeatures, mMaximumSupportedClientNumber);
}
}

View File

@@ -1,973 +0,0 @@
/*
* 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.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.MacAddress;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Preconditions;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Configuration for a soft access point (a.k.a. Soft AP, SAP, Hotspot).
*
* This is input for the framework provided by a client app, i.e. it exposes knobs to instruct the
* framework how it should configure a hotspot.
*
* System apps can use this to configure a tethered hotspot using
* {@code WifiManager#startTetheredHotspot(SoftApConfiguration)} and
* {@code WifiManager#setSoftApConfiguration(SoftApConfiguration)}
* or local-only hotspot using
* {@code WifiManager#startLocalOnlyHotspot(SoftApConfiguration, Executor,
* WifiManager.LocalOnlyHotspotCallback)}.
*
* Instances of this class are immutable; use {@link SoftApConfiguration.Builder} and its methods to
* create a new instance.
*
*/
public final class SoftApConfiguration implements Parcelable {
private static final String TAG = "SoftApConfiguration";
@VisibleForTesting
static final int PSK_MIN_LEN = 8;
@VisibleForTesting
static final int PSK_MAX_LEN = 63;
/**
* 2GHz band.
* @hide
*/
@SystemApi
public static final int BAND_2GHZ = 1 << 0;
/**
* 5GHz band.
* @hide
*/
@SystemApi
public static final int BAND_5GHZ = 1 << 1;
/**
* 6GHz band.
* @hide
*/
@SystemApi
public static final int BAND_6GHZ = 1 << 2;
/**
* Device is allowed to choose the optimal band (2Ghz, 5Ghz, 6Ghz) based on device capability,
* operating country code and current radio conditions.
* @hide
*/
@SystemApi
public static final int BAND_ANY = BAND_2GHZ | BAND_5GHZ | BAND_6GHZ;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag = true, prefix = { "BAND_TYPE_" }, value = {
BAND_2GHZ,
BAND_5GHZ,
BAND_6GHZ,
})
public @interface BandType {}
private static boolean isBandValid(@BandType int band) {
return ((band != 0) && ((band & ~BAND_ANY) == 0));
}
private static final int MIN_CH_2G_BAND = 1;
private static final int MAX_CH_2G_BAND = 14;
private static final int MIN_CH_5G_BAND = 34;
private static final int MAX_CH_5G_BAND = 196;
private static final int MIN_CH_6G_BAND = 1;
private static final int MAX_CH_6G_BAND = 253;
private static boolean isChannelBandPairValid(int channel, @BandType int band) {
switch (band) {
case BAND_2GHZ:
if (channel < MIN_CH_2G_BAND || channel > MAX_CH_2G_BAND) {
return false;
}
break;
case BAND_5GHZ:
if (channel < MIN_CH_5G_BAND || channel > MAX_CH_5G_BAND) {
return false;
}
break;
case BAND_6GHZ:
if (channel < MIN_CH_6G_BAND || channel > MAX_CH_6G_BAND) {
return false;
}
break;
default:
return false;
}
return true;
}
/**
* SSID for the AP, or null for a framework-determined SSID.
*/
private final @Nullable String mSsid;
/**
* BSSID for the AP, or null to use a framework-determined BSSID.
*/
private final @Nullable MacAddress mBssid;
/**
* Pre-shared key for WPA2-PSK or WPA3-SAE-Transition or WPA3-SAE encryption which depends on
* the security type.
*/
private final @Nullable String mPassphrase;
/**
* This is a network that does not broadcast its SSID, so an
* SSID-specific probe request must be used for scans.
*/
private final boolean mHiddenSsid;
/**
* The operating band of the AP.
* One or combination of the following band type:
* {@link #BAND_2GHZ}, {@link #BAND_5GHZ}, {@link #BAND_6GHZ}.
*/
private final @BandType int mBand;
/**
* The operating channel of the AP.
*/
private final int mChannel;
/**
* The maximim allowed number of clients that can associate to the AP.
*/
private final int mMaxNumberOfClients;
/**
* The operating security type of the AP.
* One of the following security types:
* {@link #SECURITY_TYPE_OPEN},
* {@link #SECURITY_TYPE_WPA2_PSK},
* {@link #SECURITY_TYPE_WPA3_SAE_TRANSITION},
* {@link #SECURITY_TYPE_WPA3_SAE}
*/
private final @SecurityType int mSecurityType;
/**
* The flag to indicate client need to authorize by user
* when client is connecting to AP.
*/
private final boolean mClientControlByUser;
/**
* The list of blocked client that can't associate to the AP.
*/
private final List<MacAddress> mBlockedClientList;
/**
* The list of allowed client that can associate to the AP.
*/
private final List<MacAddress> mAllowedClientList;
/**
* Whether auto shutdown of soft AP is enabled or not.
*/
private final boolean mAutoShutdownEnabled;
/**
* Delay in milliseconds before shutting down soft AP when
* there are no connected devices.
*/
private final long mShutdownTimeoutMillis;
/**
* THe definition of security type OPEN.
*/
public static final int SECURITY_TYPE_OPEN = 0;
/**
* The definition of security type WPA2-PSK.
*/
public static final int SECURITY_TYPE_WPA2_PSK = 1;
/**
* The definition of security type WPA3-SAE Transition mode.
*/
public static final int SECURITY_TYPE_WPA3_SAE_TRANSITION = 2;
/**
* The definition of security type WPA3-SAE.
*/
public static final int SECURITY_TYPE_WPA3_SAE = 3;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = { "SECURITY_TYPE_" }, value = {
SECURITY_TYPE_OPEN,
SECURITY_TYPE_WPA2_PSK,
SECURITY_TYPE_WPA3_SAE_TRANSITION,
SECURITY_TYPE_WPA3_SAE,
})
public @interface SecurityType {}
/** Private constructor for Builder and Parcelable implementation. */
private SoftApConfiguration(@Nullable String ssid, @Nullable MacAddress bssid,
@Nullable String passphrase, boolean hiddenSsid, @BandType int band, int channel,
@SecurityType int securityType, int maxNumberOfClients, boolean shutdownTimeoutEnabled,
long shutdownTimeoutMillis, boolean clientControlByUser,
@NonNull List<MacAddress> blockedList, @NonNull List<MacAddress> allowedList) {
mSsid = ssid;
mBssid = bssid;
mPassphrase = passphrase;
mHiddenSsid = hiddenSsid;
mBand = band;
mChannel = channel;
mSecurityType = securityType;
mMaxNumberOfClients = maxNumberOfClients;
mAutoShutdownEnabled = shutdownTimeoutEnabled;
mShutdownTimeoutMillis = shutdownTimeoutMillis;
mClientControlByUser = clientControlByUser;
mBlockedClientList = new ArrayList<>(blockedList);
mAllowedClientList = new ArrayList<>(allowedList);
}
@Override
public boolean equals(Object otherObj) {
if (this == otherObj) {
return true;
}
if (!(otherObj instanceof SoftApConfiguration)) {
return false;
}
SoftApConfiguration other = (SoftApConfiguration) otherObj;
return Objects.equals(mSsid, other.mSsid)
&& Objects.equals(mBssid, other.mBssid)
&& Objects.equals(mPassphrase, other.mPassphrase)
&& mHiddenSsid == other.mHiddenSsid
&& mBand == other.mBand
&& mChannel == other.mChannel
&& mSecurityType == other.mSecurityType
&& mMaxNumberOfClients == other.mMaxNumberOfClients
&& mAutoShutdownEnabled == other.mAutoShutdownEnabled
&& mShutdownTimeoutMillis == other.mShutdownTimeoutMillis
&& mClientControlByUser == other.mClientControlByUser
&& Objects.equals(mBlockedClientList, other.mBlockedClientList)
&& Objects.equals(mAllowedClientList, other.mAllowedClientList);
}
@Override
public int hashCode() {
return Objects.hash(mSsid, mBssid, mPassphrase, mHiddenSsid,
mBand, mChannel, mSecurityType, mMaxNumberOfClients, mAutoShutdownEnabled,
mShutdownTimeoutMillis, mClientControlByUser, mBlockedClientList,
mAllowedClientList);
}
@Override
public String toString() {
StringBuilder sbuf = new StringBuilder();
sbuf.append("ssid=").append(mSsid);
if (mBssid != null) sbuf.append(" \n bssid=").append(mBssid.toString());
sbuf.append(" \n Passphrase =").append(
TextUtils.isEmpty(mPassphrase) ? "<empty>" : "<non-empty>");
sbuf.append(" \n HiddenSsid =").append(mHiddenSsid);
sbuf.append(" \n Band =").append(mBand);
sbuf.append(" \n Channel =").append(mChannel);
sbuf.append(" \n SecurityType=").append(getSecurityType());
sbuf.append(" \n MaxClient=").append(mMaxNumberOfClients);
sbuf.append(" \n AutoShutdownEnabled=").append(mAutoShutdownEnabled);
sbuf.append(" \n ShutdownTimeoutMillis=").append(mShutdownTimeoutMillis);
sbuf.append(" \n ClientControlByUser=").append(mClientControlByUser);
sbuf.append(" \n BlockedClientList=").append(mBlockedClientList);
sbuf.append(" \n AllowedClientList=").append(mAllowedClientList);
return sbuf.toString();
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(mSsid);
dest.writeParcelable(mBssid, flags);
dest.writeString(mPassphrase);
dest.writeBoolean(mHiddenSsid);
dest.writeInt(mBand);
dest.writeInt(mChannel);
dest.writeInt(mSecurityType);
dest.writeInt(mMaxNumberOfClients);
dest.writeBoolean(mAutoShutdownEnabled);
dest.writeLong(mShutdownTimeoutMillis);
dest.writeBoolean(mClientControlByUser);
dest.writeTypedList(mBlockedClientList);
dest.writeTypedList(mAllowedClientList);
}
@Override
public int describeContents() {
return 0;
}
@NonNull
public static final Creator<SoftApConfiguration> CREATOR = new Creator<SoftApConfiguration>() {
@Override
public SoftApConfiguration createFromParcel(Parcel in) {
return new SoftApConfiguration(
in.readString(),
in.readParcelable(MacAddress.class.getClassLoader()),
in.readString(), in.readBoolean(), in.readInt(), in.readInt(), in.readInt(),
in.readInt(), in.readBoolean(), in.readLong(), in.readBoolean(),
in.createTypedArrayList(MacAddress.CREATOR),
in.createTypedArrayList(MacAddress.CREATOR));
}
@Override
public SoftApConfiguration[] newArray(int size) {
return new SoftApConfiguration[size];
}
};
/**
* Return String set to be the SSID for the AP.
* {@link Builder#setSsid(String)}.
*/
@Nullable
public String getSsid() {
return mSsid;
}
/**
* Returns MAC address set to be BSSID for the AP.
* {@link Builder#setBssid(MacAddress)}.
*/
@Nullable
public MacAddress getBssid() {
return mBssid;
}
/**
* Returns String set to be passphrase for current AP.
* {@link Builder#setPassphrase(String, int)}.
*/
@Nullable
public String getPassphrase() {
return mPassphrase;
}
/**
* Returns Boolean set to be indicate hidden (true: doesn't broadcast its SSID) or
* not (false: broadcasts its SSID) for the AP.
* {@link Builder#setHiddenSsid(boolean)}.
*/
public boolean isHiddenSsid() {
return mHiddenSsid;
}
/**
* Returns band type set to be the band for the AP.
*
* One or combination of the following band type:
* {@link #BAND_2GHZ}, {@link #BAND_5GHZ}, {@link #BAND_6GHZ}.
*
* {@link Builder#setBand(int)}.
*
* @hide
*/
@SystemApi
public @BandType int getBand() {
return mBand;
}
/**
* Returns Integer set to be the channel for the AP.
* {@link Builder#setChannel(int)}.
*
* @hide
*/
@SystemApi
public int getChannel() {
return mChannel;
}
/**
* Get security type params which depends on which security passphrase to set.
*
* @return One of:
* {@link #SECURITY_TYPE_OPEN},
* {@link #SECURITY_TYPE_WPA2_PSK},
* {@link #SECURITY_TYPE_WPA3_SAE_TRANSITION},
* {@link #SECURITY_TYPE_WPA3_SAE}
*/
public @SecurityType int getSecurityType() {
return mSecurityType;
}
/**
* Returns the maximum number of clients that can associate to the AP.
* {@link Builder#setMaxNumberOfClients(int)}.
*
* @hide
*/
@SystemApi
public int getMaxNumberOfClients() {
return mMaxNumberOfClients;
}
/**
* Returns whether auto shutdown is enabled or not.
* The Soft AP will shutdown when there are no devices associated to it for
* the timeout duration. See {@link Builder#setAutoShutdownEnabled(boolean)}.
*
* @hide
*/
@SystemApi
public boolean isAutoShutdownEnabled() {
return mAutoShutdownEnabled;
}
/**
* Returns the shutdown timeout in milliseconds.
* The Soft AP will shutdown when there are no devices associated to it for
* the timeout duration. See {@link Builder#setShutdownTimeoutMillis(long)}.
*
* @hide
*/
@SystemApi
public long getShutdownTimeoutMillis() {
return mShutdownTimeoutMillis;
}
/**
* Returns a flag indicating whether clients need to be pre-approved by the user.
* (true: authorization required) or not (false: not required).
* {@link Builder#setClientControlByUserEnabled(Boolean)}.
*
* @hide
*/
@SystemApi
public boolean isClientControlByUserEnabled() {
return mClientControlByUser;
}
/**
* Returns List of clients which aren't allowed to associate to the AP.
*
* Clients are configured using {@link Builder#setBlockedClientList(List)}
*
* @hide
*/
@NonNull
@SystemApi
public List<MacAddress> getBlockedClientList() {
return mBlockedClientList;
}
/**
* List of clients which are allowed to associate to the AP.
* Clients are configured using {@link Builder#setAllowedClientList(List)}
*
* @hide
*/
@NonNull
@SystemApi
public List<MacAddress> getAllowedClientList() {
return mAllowedClientList;
}
/**
* Returns a {@link WifiConfiguration} representation of this {@link SoftApConfiguration}.
* Note that SoftApConfiguration may contain configuration which is cannot be represented
* by the legacy WifiConfiguration, in such cases a null will be returned.
*
* <li> SoftAp band in {@link WifiConfiguration.apBand} only supports
* 2GHz, 5GHz, 2GHz+5GHz bands, so conversion is limited to these bands. </li>
*
* <li> SoftAp security type in {@link WifiConfiguration.KeyMgmt} only supports
* NONE, WPA2_PSK, so conversion is limited to these security type.</li>
* @hide
*/
@Nullable
@SystemApi
public WifiConfiguration toWifiConfiguration() {
WifiConfiguration wifiConfig = new WifiConfiguration();
wifiConfig.SSID = mSsid;
wifiConfig.preSharedKey = mPassphrase;
wifiConfig.hiddenSSID = mHiddenSsid;
wifiConfig.apChannel = mChannel;
switch (mSecurityType) {
case SECURITY_TYPE_OPEN:
wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
break;
case SECURITY_TYPE_WPA2_PSK:
case SECURITY_TYPE_WPA3_SAE_TRANSITION:
wifiConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA2_PSK);
break;
default:
Log.e(TAG, "Convert fail, unsupported security type :" + mSecurityType);
return null;
}
switch (mBand) {
case BAND_2GHZ:
wifiConfig.apBand = WifiConfiguration.AP_BAND_2GHZ;
break;
case BAND_5GHZ:
wifiConfig.apBand = WifiConfiguration.AP_BAND_5GHZ;
break;
case BAND_2GHZ | BAND_5GHZ:
wifiConfig.apBand = WifiConfiguration.AP_BAND_ANY;
break;
case BAND_ANY:
wifiConfig.apBand = WifiConfiguration.AP_BAND_ANY;
break;
default:
Log.e(TAG, "Convert fail, unsupported band setting :" + mBand);
return null;
}
return wifiConfig;
}
/**
* Builds a {@link SoftApConfiguration}, which allows an app to configure various aspects of a
* Soft AP.
*
* All fields are optional. By default, SSID and BSSID are automatically chosen by the
* framework, and an open network is created.
*
* @hide
*/
@SystemApi
public static final class Builder {
private String mSsid;
private MacAddress mBssid;
private String mPassphrase;
private boolean mHiddenSsid;
private int mBand;
private int mChannel;
private int mMaxNumberOfClients;
private int mSecurityType;
private boolean mAutoShutdownEnabled;
private long mShutdownTimeoutMillis;
private boolean mClientControlByUser;
private List<MacAddress> mBlockedClientList;
private List<MacAddress> mAllowedClientList;
/**
* Constructs a Builder with default values (see {@link Builder}).
*/
public Builder() {
mSsid = null;
mBssid = null;
mPassphrase = null;
mHiddenSsid = false;
mBand = BAND_2GHZ;
mChannel = 0;
mMaxNumberOfClients = 0;
mSecurityType = SECURITY_TYPE_OPEN;
mAutoShutdownEnabled = true; // enabled by default.
mShutdownTimeoutMillis = 0;
mClientControlByUser = false;
mBlockedClientList = new ArrayList<>();
mAllowedClientList = new ArrayList<>();
}
/**
* Constructs a Builder initialized from an existing {@link SoftApConfiguration} instance.
*/
public Builder(@NonNull SoftApConfiguration other) {
Objects.requireNonNull(other);
mSsid = other.mSsid;
mBssid = other.mBssid;
mPassphrase = other.mPassphrase;
mHiddenSsid = other.mHiddenSsid;
mBand = other.mBand;
mChannel = other.mChannel;
mMaxNumberOfClients = other.mMaxNumberOfClients;
mSecurityType = other.mSecurityType;
mAutoShutdownEnabled = other.mAutoShutdownEnabled;
mShutdownTimeoutMillis = other.mShutdownTimeoutMillis;
mClientControlByUser = other.mClientControlByUser;
mBlockedClientList = new ArrayList<>(other.mBlockedClientList);
mAllowedClientList = new ArrayList<>(other.mAllowedClientList);
}
/**
* Builds the {@link SoftApConfiguration}.
*
* @return A new {@link SoftApConfiguration}, as configured by previous method calls.
*/
@NonNull
public SoftApConfiguration build() {
for (MacAddress client : mAllowedClientList) {
if (mBlockedClientList.contains(client)) {
throw new IllegalArgumentException("A MacAddress exist in both client list");
}
}
return new SoftApConfiguration(mSsid, mBssid, mPassphrase,
mHiddenSsid, mBand, mChannel, mSecurityType, mMaxNumberOfClients,
mAutoShutdownEnabled, mShutdownTimeoutMillis, mClientControlByUser,
mBlockedClientList, mAllowedClientList);
}
/**
* Specifies an SSID for the AP.
* <p>
* Null SSID only support when configure a local-only hotspot.
* <p>
* <li>If not set, defaults to null.</li>
*
* @param ssid SSID of valid Unicode characters, or null to have the SSID automatically
* chosen by the framework.
* @return Builder for chaining.
* @throws IllegalArgumentException when the SSID is empty or not valid Unicode.
*/
@NonNull
public Builder setSsid(@Nullable String ssid) {
if (ssid != null) {
Preconditions.checkStringNotEmpty(ssid);
Preconditions.checkArgument(StandardCharsets.UTF_8.newEncoder().canEncode(ssid));
}
mSsid = ssid;
return this;
}
/**
* Specifies a BSSID for the AP.
* <p>
* <li>If not set, defaults to null.</li>
* @param bssid BSSID, or null to have the BSSID chosen by the framework. The caller is
* responsible for avoiding collisions.
* @return Builder for chaining.
* @throws IllegalArgumentException when the given BSSID is the all-zero or broadcast MAC
* address.
*/
@NonNull
public Builder setBssid(@Nullable MacAddress bssid) {
if (bssid != null) {
Preconditions.checkArgument(!bssid.equals(WifiManager.ALL_ZEROS_MAC_ADDRESS));
Preconditions.checkArgument(!bssid.equals(MacAddress.BROADCAST_ADDRESS));
}
mBssid = bssid;
return this;
}
/**
* Specifies that this AP should use specific security type with the given ASCII passphrase.
*
* @param securityType One of the following security types:
* {@link #SECURITY_TYPE_OPEN},
* {@link #SECURITY_TYPE_WPA2_PSK},
* {@link #SECURITY_TYPE_WPA3_SAE_TRANSITION},
* {@link #SECURITY_TYPE_WPA3_SAE}.
* @param passphrase The passphrase to use for sepcific {@code securityType} configuration
* or null with {@link #SECURITY_TYPE_OPEN}.
*
* @return Builder for chaining.
* @throws IllegalArgumentException when the passphrase length is invalid and
* {@code securityType} is not {@link #SECURITY_TYPE_OPEN}
* or non-null passphrase and {@code securityType} is
* {@link #SECURITY_TYPE_OPEN}.
*/
@NonNull
public Builder setPassphrase(@Nullable String passphrase, @SecurityType int securityType) {
if (securityType == SECURITY_TYPE_OPEN) {
if (passphrase != null) {
throw new IllegalArgumentException(
"passphrase should be null when security type is open");
}
} else {
Preconditions.checkStringNotEmpty(passphrase);
final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
if (!asciiEncoder.canEncode(passphrase)) {
throw new IllegalArgumentException("passphrase not ASCII encodable");
}
if (securityType == SECURITY_TYPE_WPA2_PSK
|| securityType == SECURITY_TYPE_WPA3_SAE_TRANSITION) {
if (passphrase.length() < PSK_MIN_LEN || passphrase.length() > PSK_MAX_LEN) {
throw new IllegalArgumentException(
"Password size must be at least " + PSK_MIN_LEN
+ " and no more than " + PSK_MAX_LEN
+ " for WPA2_PSK and WPA3_SAE_TRANSITION Mode");
}
}
}
mSecurityType = securityType;
mPassphrase = passphrase;
return this;
}
/**
* Specifies whether the AP is hidden (doesn't broadcast its SSID) or
* not (broadcasts its SSID).
* <p>
* <li>If not set, defaults to false (i.e not a hidden network).</li>
*
* @param hiddenSsid true for a hidden SSID, false otherwise.
* @return Builder for chaining.
*/
@NonNull
public Builder setHiddenSsid(boolean hiddenSsid) {
mHiddenSsid = hiddenSsid;
return this;
}
/**
* Specifies the band for the AP.
* <p>
* <li>If not set, defaults to {@link #BAND_2GHZ}.</li>
*
* @param band One or combination of the following band type:
* {@link #BAND_2GHZ}, {@link #BAND_5GHZ}, {@link #BAND_6GHZ}.
* @return Builder for chaining.
*/
@NonNull
public Builder setBand(@BandType int band) {
if (!isBandValid(band)) {
throw new IllegalArgumentException("Invalid band type");
}
mBand = band;
// Since band preference is specified, no specific channel is selected.
mChannel = 0;
return this;
}
/**
* Specifies the channel and associated band for the AP.
*
* The channel which AP resides on. Valid channels are country dependent.
* <p>
* The default for the channel is a the special value 0 to have the framework
* auto-select a valid channel from the band configured with
* {@link #setBand(int)}.
*
* The channel auto selection will offload to driver when
* {@link SoftApCapability#areFeaturesSupported(
* SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD)}
* return true. Driver will auto select best channel which based on environment
* interference to get best performance. Check {@link SoftApCapability} to get more detail.
*
* Note, since 6GHz band use the same channel numbering of 2.4GHz and 5GHZ bands,
* the caller needs to pass the band containing the selected channel.
*
* <p>
* <li>If not set, defaults to 0.</li>
* @param channel operating channel of the AP.
* @param band containing this channel.
* @return Builder for chaining.
*/
@NonNull
public Builder setChannel(int channel, @BandType int band) {
if (!isChannelBandPairValid(channel, band)) {
throw new IllegalArgumentException("Invalid band type");
}
mBand = band;
mChannel = channel;
return this;
}
/**
* Specifies the maximum number of clients that can associate to the AP.
*
* The maximum number of clients (STAs) which can associate to the AP.
* The AP will reject association from any clients above this number.
* Specify a value of 0 to have the framework automatically use the maximum number
* which the device can support (based on hardware and carrier constraints).
* <p>
* Use {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and
* {@link SoftApCapability#getMaxSupportedClients} to get the maximum number of clients
* which the device supports (based on hardware and carrier constraints).
*
* <p>
* <li>If not set, defaults to 0.</li>
*
* This method requires hardware support. If the method is used to set a
* non-zero {@code maxNumberOfClients} value then
* {@link WifiManager#startTetheredHotspot} will report error code
* {@link WifiManager#SAP_START_FAILURE_UNSUPPORTED_CONFIGURATION}.
*
* <p>
* Use {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and
* {@link SoftApCapability#areFeaturesSupported(int)}
* with {@link SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT} to determine whether
* or not this feature is supported.
*
* @param maxNumberOfClients maximum client number of the AP.
* @return Builder for chaining.
*/
@NonNull
public Builder setMaxNumberOfClients(@IntRange(from = 0) int maxNumberOfClients) {
if (maxNumberOfClients < 0) {
throw new IllegalArgumentException("maxNumberOfClients should be not negative");
}
mMaxNumberOfClients = maxNumberOfClients;
return this;
}
/**
* Specifies whether auto shutdown is enabled or not.
* The Soft AP will shut down when there are no devices connected to it for
* the timeout duration.
*
* <p>
* <li>If not set, defaults to true</li>
*
* @param enable true to enable, false to disable.
* @return Builder for chaining.
*
* @see #setShutdownTimeoutMillis(long)
*/
@NonNull
public Builder setAutoShutdownEnabled(boolean enable) {
mAutoShutdownEnabled = enable;
return this;
}
/**
* Specifies the shutdown timeout in milliseconds.
* The Soft AP will shut down when there are no devices connected to it for
* the timeout duration.
*
* Specify a value of 0 to have the framework automatically use default timeout
* setting which defined in {@link R.integer.config_wifi_framework_soft_ap_timeout_delay}
*
* <p>
* <li>If not set, defaults to 0</li>
* <li>The shut down timeout will apply when {@link #setAutoShutdownEnabled(boolean)} is
* set to true</li>
*
* @param timeoutMillis milliseconds of the timeout delay.
* @return Builder for chaining.
*
* @see #setAutoShutdownEnabled(boolean)
*/
@NonNull
public Builder setShutdownTimeoutMillis(@IntRange(from = 0) long timeoutMillis) {
if (timeoutMillis < 0) {
throw new IllegalArgumentException("Invalid timeout value");
}
mShutdownTimeoutMillis = timeoutMillis;
return this;
}
/**
* Configure the Soft AP to require manual user control of client association.
* If disabled (the default) then any client which isn't in the blocked list
* {@link #getBlockedClientList()} can associate to this Soft AP using the
* correct credentials until the Soft AP capacity is reached (capacity is hardware, carrier,
* or user limited - using {@link #setMaxNumberOfClients(int)}).
*
* If manual user control is enabled then clients will be accepted, rejected, or require
* a user approval based on the configuration provided by
* {@link #setBlockedClientList(List)} and {@link #setAllowedClientList(List)}.
*
* <p>
* This method requires hardware support. Hardware support can be determined using
* {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and
* {@link SoftApCapability#areFeaturesSupported(int)}
* with {@link SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT}
*
* <p>
* If the method is called on a device without hardware support then starting the soft AP
* using {@link WifiManager#startTetheredHotspot(SoftApConfiguration)} will fail with
* {@link WifiManager#SAP_START_FAILURE_UNSUPPORTED_CONFIGURATION}.
*
* <p>
* <li>If not set, defaults to false (i.e The authoriztion is not required).</li>
*
* @param enabled true for enabling the control by user, false otherwise.
* @return Builder for chaining.
*/
@NonNull
public Builder setClientControlByUserEnabled(boolean enabled) {
mClientControlByUser = enabled;
return this;
}
/**
* This method together with {@link setClientControlByUserEnabled(boolean)} control client
* connections to the AP. If client control by user is disabled using the above method then
* this API has no effect and clients are allowed to associate to the AP (within limit of
* max number of clients).
*
* If client control by user is enabled then this API configures the list of clients
* which are explicitly allowed. These are auto-accepted.
*
* All other clients which attempt to associate, whose MAC addresses are on neither list,
* are:
* <ul>
* <li>Rejected</li>
* <li>A callback {@link WifiManager.SoftApCallback#onBlockedClientConnecting(WifiClient)}
* is issued (which allows the user to add them to the allowed client list if desired).<li>
* </ul>
*
* @param allowedClientList list of clients which are allowed to associate to the AP
* without user pre-approval.
* @return Builder for chaining.
*/
@NonNull
public Builder setAllowedClientList(@NonNull List<MacAddress> allowedClientList) {
mAllowedClientList = new ArrayList<>(allowedClientList);
return this;
}
/**
* This API configures the list of clients which are blocked and cannot associate
* to the Soft AP.
*
* <p>
* This method requires hardware support. Hardware support can be determined using
* {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and
* {@link SoftApCapability#areFeaturesSupported(int)}
* with {@link SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT}
*
* <p>
* If the method is called on a device without hardware support then starting the soft AP
* using {@link WifiManager#startTetheredHotspot(SoftApConfiguration)} will fail with
* {@link WifiManager#SAP_START_FAILURE_UNSUPPORTED_CONFIGURATION}.
*
* @param blockedClientList list of clients which are not allowed to associate to the AP.
* @return Builder for chaining.
*/
@NonNull
public Builder setBlockedClientList(@NonNull List<MacAddress> blockedClientList) {
mBlockedClientList = new ArrayList<>(blockedClientList);
return this;
}
}
}

View File

@@ -1,194 +0,0 @@
/*
* 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.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/**
* A class representing information about SoftAp.
* {@see WifiManager}
*
* @hide
*/
@SystemApi
public final class SoftApInfo implements Parcelable {
/**
* AP Channel bandwidth is invalid.
*
* @see #getBandwidth()
*/
public static final int CHANNEL_WIDTH_INVALID = 0;
/**
* AP Channel bandwidth is 20 MHZ but no HT.
*
* @see #getBandwidth()
*/
public static final int CHANNEL_WIDTH_20MHZ_NOHT = 1;
/**
* AP Channel bandwidth is 20 MHZ.
*
* @see #getBandwidth()
*/
public static final int CHANNEL_WIDTH_20MHZ = 2;
/**
* AP Channel bandwidth is 40 MHZ.
*
* @see #getBandwidth()
*/
public static final int CHANNEL_WIDTH_40MHZ = 3;
/**
* AP Channel bandwidth is 80 MHZ.
*
* @see #getBandwidth()
*/
public static final int CHANNEL_WIDTH_80MHZ = 4;
/**
* AP Channel bandwidth is 160 MHZ, but 80MHZ + 80MHZ.
*
* @see #getBandwidth()
*/
public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 5;
/**
* AP Channel bandwidth is 160 MHZ.
*
* @see #getBandwidth()
*/
public static final int CHANNEL_WIDTH_160MHZ = 6;
/** The frequency which AP resides on. */
private int mFrequency = 0;
@WifiAnnotations.Bandwidth
private int mBandwidth = CHANNEL_WIDTH_INVALID;
/**
* Get the frequency which AP resides on.
*/
public int getFrequency() {
return mFrequency;
}
/**
* Set the frequency which AP resides on.
* @hide
*/
public void setFrequency(int freq) {
mFrequency = freq;
}
/**
* Get AP Channel bandwidth.
*
* @return One of {@link #CHANNEL_WIDTH_20MHZ}, {@link #CHANNEL_WIDTH_40MHZ},
* {@link #CHANNEL_WIDTH_80MHZ}, {@link #CHANNEL_WIDTH_160MHZ},
* {@link #CHANNEL_WIDTH_80MHZ_PLUS_MHZ} or {@link #CHANNEL_WIDTH_INVALID}.
*/
@WifiAnnotations.Bandwidth
public int getBandwidth() {
return mBandwidth;
}
/**
* Set AP Channel bandwidth.
* @hide
*/
public void setBandwidth(@WifiAnnotations.Bandwidth int bandwidth) {
mBandwidth = bandwidth;
}
/**
* @hide
*/
public SoftApInfo(@Nullable SoftApInfo source) {
if (source != null) {
mFrequency = source.mFrequency;
mBandwidth = source.mBandwidth;
}
}
/**
* @hide
*/
public SoftApInfo() {
}
@Override
/** Implement the Parcelable interface. */
public int describeContents() {
return 0;
}
@Override
/** Implement the Parcelable interface */
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeInt(mFrequency);
dest.writeInt(mBandwidth);
}
@NonNull
/** Implement the Parcelable interface */
public static final Creator<SoftApInfo> CREATOR = new Creator<SoftApInfo>() {
public SoftApInfo createFromParcel(Parcel in) {
SoftApInfo info = new SoftApInfo();
info.mFrequency = in.readInt();
info.mBandwidth = in.readInt();
return info;
}
public SoftApInfo[] newArray(int size) {
return new SoftApInfo[size];
}
};
@NonNull
@Override
public String toString() {
return "SoftApInfo{"
+ "bandwidth= " + mBandwidth
+ ",frequency= " + mFrequency
+ '}';
}
@Override
public boolean equals(@NonNull Object o) {
if (this == o) return true;
if (!(o instanceof SoftApInfo)) return false;
SoftApInfo softApInfo = (SoftApInfo) o;
return mFrequency == softApInfo.mFrequency
&& mBandwidth == softApInfo.mBandwidth;
}
@Override
public int hashCode() {
return Objects.hash(mFrequency, mBandwidth);
}
}

View File

@@ -1,265 +0,0 @@
/*
* Copyright (C) 2008 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.os.Parcel;
import android.os.Parcelable;
/**
* From <code>defs.h</code> in <code>wpa_supplicant</code>.
* <p/>
* These enumeration values are used to indicate the current wpa_supplicant
* state. This is more fine-grained than most users will be interested in.
* In general, it is better to use
* {@link android.net.NetworkInfo.State NetworkInfo.State}.
* <p/>
* Note, the order of these enum constants must match the numerical values of the
* state constants in <code>defs.h</code> in <code>wpa_supplicant</code>.
*/
public enum SupplicantState implements Parcelable {
/**
* This state indicates that client is not associated, but is likely to
* start looking for an access point. This state is entered when a
* connection is lost.
*/
DISCONNECTED,
/**
* Interface is disabled
* <p/>
* This state is entered if the network interface is disabled.
* wpa_supplicant refuses any new operations that would
* use the radio until the interface has been enabled.
*/
INTERFACE_DISABLED,
/**
* Inactive state (wpa_supplicant disabled).
* <p/>
* This state is entered if there are no enabled networks in the
* configuration. wpa_supplicant is not trying to associate with a new
* network and external interaction (e.g., ctrl_iface call to add or
* enable a network) is needed to start association.
*/
INACTIVE,
/**
* Scanning for a network.
* <p/>
* This state is entered when wpa_supplicant starts scanning for a
* network.
*/
SCANNING,
/**
* Trying to authenticate with a BSS/SSID
* <p/>
* This state is entered when wpa_supplicant has found a suitable BSS
* to authenticate with and the driver is configured to try to
* authenticate with this BSS.
*/
AUTHENTICATING,
/**
* Trying to associate with a BSS/SSID.
* <p/>
* This state is entered when wpa_supplicant has found a suitable BSS
* to associate with and the driver is configured to try to associate
* with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
* state is entered when the driver is configured to try to associate
* with a network using the configured SSID and security policy.
*/
ASSOCIATING,
/**
* Association completed.
* <p/>
* This state is entered when the driver reports that association has
* been successfully completed with an AP. If IEEE 802.1X is used
* (with or without WPA/WPA2), wpa_supplicant remains in this state
* until the IEEE 802.1X/EAPOL authentication has been completed.
*/
ASSOCIATED,
/**
* WPA 4-Way Key Handshake in progress.
* <p/>
* This state is entered when WPA/WPA2 4-Way Handshake is started. In
* case of WPA-PSK, this happens when receiving the first EAPOL-Key
* frame after association. In case of WPA-EAP, this state is entered
* when the IEEE 802.1X/EAPOL authentication has been completed.
*/
FOUR_WAY_HANDSHAKE,
/**
* WPA Group Key Handshake in progress.
* <p/>
* This state is entered when 4-Way Key Handshake has been completed
* (i.e., when the supplicant sends out message 4/4) and when Group
* Key rekeying is started by the AP (i.e., when supplicant receives
* message 1/2).
*/
GROUP_HANDSHAKE,
/**
* All authentication completed.
* <p/>
* This state is entered when the full authentication process is
* completed. In case of WPA2, this happens when the 4-Way Handshake is
* successfully completed. With WPA, this state is entered after the
* Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
* completed after dynamic keys are received (or if not used, after
* the EAP authentication has been completed). With static WEP keys and
* plaintext connections, this state is entered when an association
* has been completed.
* <p/>
* This state indicates that the supplicant has completed its
* processing for the association phase and that data connection is
* fully configured. Note, however, that there may not be any IP
* address associated with the connection yet. Typically, a DHCP
* request needs to be sent at this point to obtain an address.
*/
COMPLETED,
/**
* An Android-added state that is reported when a client issues an
* explicit DISCONNECT command. In such a case, the supplicant is
* not only dissociated from the current access point (as for the
* DISCONNECTED state above), but it also does not attempt to connect
* to any access point until a RECONNECT or REASSOCIATE command
* is issued by the client.
*/
DORMANT,
/**
* No connection to wpa_supplicant.
* <p/>
* This is an additional pseudo-state to handle the case where
* wpa_supplicant is not running and/or we have not been able
* to establish a connection to it.
*/
UNINITIALIZED,
/**
* A pseudo-state that should normally never be seen.
*/
INVALID;
/**
* Returns {@code true} if the supplicant state is valid and {@code false}
* otherwise.
* @param state The supplicant state
* @return {@code true} if the supplicant state is valid and {@code false}
* otherwise.
*/
public static boolean isValidState(SupplicantState state) {
return state != UNINITIALIZED && state != INVALID;
}
/** Supplicant associating or authenticating is considered a handshake state {@hide} */
public static boolean isHandshakeState(SupplicantState state) {
switch(state) {
case AUTHENTICATING:
case ASSOCIATING:
case ASSOCIATED:
case FOUR_WAY_HANDSHAKE:
case GROUP_HANDSHAKE:
return true;
case COMPLETED:
case DISCONNECTED:
case INTERFACE_DISABLED:
case INACTIVE:
case SCANNING:
case DORMANT:
case UNINITIALIZED:
case INVALID:
return false;
default:
throw new IllegalArgumentException("Unknown supplicant state");
}
}
/** @hide */
public static boolean isConnecting(SupplicantState state) {
switch(state) {
case AUTHENTICATING:
case ASSOCIATING:
case ASSOCIATED:
case FOUR_WAY_HANDSHAKE:
case GROUP_HANDSHAKE:
case COMPLETED:
return true;
case DISCONNECTED:
case INTERFACE_DISABLED:
case INACTIVE:
case SCANNING:
case DORMANT:
case UNINITIALIZED:
case INVALID:
return false;
default:
throw new IllegalArgumentException("Unknown supplicant state");
}
}
/** @hide */
public static boolean isDriverActive(SupplicantState state) {
switch(state) {
case DISCONNECTED:
case DORMANT:
case INACTIVE:
case AUTHENTICATING:
case ASSOCIATING:
case ASSOCIATED:
case SCANNING:
case FOUR_WAY_HANDSHAKE:
case GROUP_HANDSHAKE:
case COMPLETED:
return true;
case INTERFACE_DISABLED:
case UNINITIALIZED:
case INVALID:
return false;
default:
throw new IllegalArgumentException("Unknown supplicant state");
}
}
/** Implement the Parcelable interface {@hide} */
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface {@hide} */
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name());
}
/** Implement the Parcelable interface {@hide} */
public static final @android.annotation.NonNull Creator<SupplicantState> CREATOR =
new Creator<SupplicantState>() {
public SupplicantState createFromParcel(Parcel in) {
return SupplicantState.valueOf(in.readString());
}
public SupplicantState[] newArray(int size) {
return new SupplicantState[size];
}
};
}

View File

@@ -1,29 +0,0 @@
/*
* 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 java.util.concurrent.Executor;
/**
* An executor implementation that runs synchronously on the current thread.
* @hide
*/
public class SynchronousExecutor implements Executor {
@Override
public void execute(Runnable r) {
r.run();
}
}

View File

@@ -1,124 +0,0 @@
/*
* 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 {}
@IntDef(prefix = { "CHANNEL_WIDTH_" }, value = {
SoftApInfo.CHANNEL_WIDTH_INVALID,
SoftApInfo.CHANNEL_WIDTH_20MHZ_NOHT,
SoftApInfo.CHANNEL_WIDTH_20MHZ,
SoftApInfo.CHANNEL_WIDTH_40MHZ,
SoftApInfo.CHANNEL_WIDTH_80MHZ,
SoftApInfo.CHANNEL_WIDTH_80MHZ_PLUS_MHZ,
SoftApInfo.CHANNEL_WIDTH_160MHZ,
})
@Retention(RetentionPolicy.SOURCE)
public @interface Bandwidth {}
@IntDef(prefix = { "CHANNEL_WIDTH_" }, value = {
ScanResult.CHANNEL_WIDTH_20MHZ,
ScanResult.CHANNEL_WIDTH_40MHZ,
ScanResult.CHANNEL_WIDTH_80MHZ,
ScanResult.CHANNEL_WIDTH_160MHZ,
ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ChannelWidth{}
@IntDef(prefix = { "WIFI_STANDARD_" }, value = {
ScanResult.WIFI_STANDARD_UNKNOWN,
ScanResult.WIFI_STANDARD_LEGACY,
ScanResult.WIFI_STANDARD_11N,
ScanResult.WIFI_STANDARD_11AC,
ScanResult.WIFI_STANDARD_11AX,
})
@Retention(RetentionPolicy.SOURCE)
public @interface WifiStandard{}
@IntDef(prefix = { "PROTOCOL_" }, value = {
ScanResult.PROTOCOL_NONE,
ScanResult.PROTOCOL_WPA,
ScanResult.PROTOCOL_RSN,
ScanResult.PROTOCOL_OSEN,
ScanResult.PROTOCOL_WAPI
})
@Retention(RetentionPolicy.SOURCE)
public @interface Protocol {}
@IntDef(prefix = { "KEY_MGMT_" }, value = {
ScanResult.KEY_MGMT_NONE,
ScanResult.KEY_MGMT_PSK,
ScanResult.KEY_MGMT_EAP,
ScanResult.KEY_MGMT_FT_PSK,
ScanResult.KEY_MGMT_FT_EAP,
ScanResult.KEY_MGMT_PSK_SHA256,
ScanResult.KEY_MGMT_EAP_SHA256,
ScanResult.KEY_MGMT_OSEN,
ScanResult.KEY_MGMT_SAE,
ScanResult.KEY_MGMT_OWE,
ScanResult.KEY_MGMT_EAP_SUITE_B_192,
ScanResult.KEY_MGMT_FT_SAE,
ScanResult.KEY_MGMT_OWE_TRANSITION,
ScanResult.KEY_MGMT_WAPI_PSK,
ScanResult.KEY_MGMT_WAPI_CERT
})
@Retention(RetentionPolicy.SOURCE)
public @interface KeyMgmt {}
@IntDef(prefix = { "CIPHER_" }, value = {
ScanResult.CIPHER_NONE,
ScanResult.CIPHER_NO_GROUP_ADDRESSED,
ScanResult.CIPHER_TKIP,
ScanResult.CIPHER_CCMP,
ScanResult.CIPHER_GCMP_256,
ScanResult.CIPHER_SMS4
})
@Retention(RetentionPolicy.SOURCE)
public @interface Cipher {}
}

View File

@@ -1,95 +0,0 @@
/*
* 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.NonNull;
import android.annotation.SystemApi;
import android.net.MacAddress;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/** @hide */
@SystemApi
public final class WifiClient implements Parcelable {
private final MacAddress mMacAddress;
/**
* The mac address of this client.
*/
@NonNull
public MacAddress getMacAddress() {
return mMacAddress;
}
private WifiClient(Parcel in) {
mMacAddress = in.readParcelable(null);
}
/** @hide */
public WifiClient(@NonNull MacAddress macAddress) {
Objects.requireNonNull(macAddress, "mMacAddress must not be null.");
this.mMacAddress = macAddress;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeParcelable(mMacAddress, flags);
}
@NonNull
public static final Creator<WifiClient> CREATOR = new Creator<WifiClient>() {
public WifiClient createFromParcel(Parcel in) {
return new WifiClient(in);
}
public WifiClient[] newArray(int size) {
return new WifiClient[size];
}
};
@NonNull
@Override
public String toString() {
return "WifiClient{"
+ "mMacAddress=" + mMacAddress
+ '}';
}
@Override
public boolean equals(@NonNull Object o) {
if (this == o) return true;
if (!(o instanceof WifiClient)) return false;
WifiClient client = (WifiClient) o;
return mMacAddress.equals(client.mMacAddress);
}
@Override
public int hashCode() {
return Objects.hash(mMacAddress);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,121 +0,0 @@
/*
* 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.SystemApi;
import android.app.SystemServiceRegistry;
import android.content.Context;
import android.net.wifi.aware.IWifiAwareManager;
import android.net.wifi.aware.WifiAwareManager;
import android.net.wifi.p2p.IWifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager;
import android.net.wifi.rtt.IWifiRttManager;
import android.net.wifi.rtt.WifiRttManager;
import android.os.HandlerThread;
import android.os.Looper;
/**
* Class for performing registration for all Wifi services.
*
* @hide
*/
@SystemApi
public class WifiFrameworkInitializer {
/**
* A class implementing the lazy holder idiom: the unique static instance
* of {@link #INSTANCE} is instantiated in a thread-safe way (guaranteed by
* the language specs) the first time that NoPreloadHolder is referenced in getInstanceLooper().
*
* This is necessary because we can't spawn a new thread in {@link #registerServiceWrappers()}.
* {@link #registerServiceWrappers()} is called during the Zygote phase, which disallows
* spawning new threads. Naming the class "NoPreloadHolder" ensures that the classloader will
* not preload this class, inadvertently spawning the thread too early.
*/
private static class NoPreloadHolder {
private static final HandlerThread INSTANCE = createInstance();
private static HandlerThread createInstance() {
HandlerThread thread = new HandlerThread("WifiManagerThread");
thread.start();
return thread;
}
}
private static Looper getInstanceLooper() {
return NoPreloadHolder.INSTANCE.getLooper();
}
private WifiFrameworkInitializer() {}
/**
* Called by {@link SystemServiceRegistry}'s static initializer and registers all Wifi services
* to {@link Context}, so that {@link Context#getSystemService} can return them.
*
* @throws IllegalStateException if this is called from anywhere besides
* {@link SystemServiceRegistry}
*/
public static void registerServiceWrappers() {
SystemServiceRegistry.registerContextAwareService(
Context.WIFI_SERVICE,
WifiManager.class,
(context, serviceBinder) -> {
IWifiManager service = IWifiManager.Stub.asInterface(serviceBinder);
return new WifiManager(context, service, getInstanceLooper());
}
);
SystemServiceRegistry.registerStaticService(
Context.WIFI_P2P_SERVICE,
WifiP2pManager.class,
serviceBinder -> {
IWifiP2pManager service = IWifiP2pManager.Stub.asInterface(serviceBinder);
return new WifiP2pManager(service);
}
);
SystemServiceRegistry.registerContextAwareService(
Context.WIFI_AWARE_SERVICE,
WifiAwareManager.class,
(context, serviceBinder) -> {
IWifiAwareManager service = IWifiAwareManager.Stub.asInterface(serviceBinder);
return new WifiAwareManager(context, service);
}
);
SystemServiceRegistry.registerContextAwareService(
Context.WIFI_SCANNING_SERVICE,
WifiScanner.class,
(context, serviceBinder) -> {
IWifiScanner service = IWifiScanner.Stub.asInterface(serviceBinder);
return new WifiScanner(context, service, getInstanceLooper());
}
);
SystemServiceRegistry.registerContextAwareService(
Context.WIFI_RTT_RANGING_SERVICE,
WifiRttManager.class,
(context, serviceBinder) -> {
IWifiRttManager service = IWifiRttManager.Stub.asInterface(serviceBinder);
return new WifiRttManager(context, service);
}
);
SystemServiceRegistry.registerContextAwareService(
Context.WIFI_RTT_SERVICE,
RttManager.class,
context -> {
WifiRttManager wifiRttManager = context.getSystemService(WifiRttManager.class);
return new RttManager(context, wifiRttManager);
}
);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,163 +0,0 @@
/*
* Copyright (C) 2018 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 static com.android.internal.util.Preconditions.checkNotNull;
import static com.android.internal.util.Preconditions.checkState;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.MacAddress;
import android.net.MatchAllNetworkSpecifier;
import android.net.NetworkRequest;
import android.net.NetworkSpecifier;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/**
* Network specifier object used by wifi's {@link android.net.NetworkAgent}.
* @hide
*/
public final class WifiNetworkAgentSpecifier extends NetworkSpecifier implements Parcelable {
/**
* Security credentials for the currently connected network.
*/
private final WifiConfiguration mWifiConfiguration;
public WifiNetworkAgentSpecifier(@NonNull WifiConfiguration wifiConfiguration) {
checkNotNull(wifiConfiguration);
mWifiConfiguration = wifiConfiguration;
}
/**
* @hide
*/
public static final @android.annotation.NonNull Creator<WifiNetworkAgentSpecifier> CREATOR =
new Creator<WifiNetworkAgentSpecifier>() {
@Override
public WifiNetworkAgentSpecifier createFromParcel(@NonNull Parcel in) {
WifiConfiguration wifiConfiguration = in.readParcelable(null);
return new WifiNetworkAgentSpecifier(wifiConfiguration);
}
@Override
public WifiNetworkAgentSpecifier[] newArray(int size) {
return new WifiNetworkAgentSpecifier[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeParcelable(mWifiConfiguration, flags);
}
@Override
public boolean canBeSatisfiedBy(@Nullable NetworkSpecifier other) {
if (this == other) {
return true;
}
// Any generic requests should be satisifed by a specific wifi network.
if (other == null || other instanceof MatchAllNetworkSpecifier) {
return true;
}
if (other instanceof WifiNetworkSpecifier) {
return satisfiesNetworkSpecifier((WifiNetworkSpecifier) other);
}
return equals(other);
}
/**
* Match {@link WifiNetworkSpecifier} in app's {@link NetworkRequest} with the
* {@link WifiNetworkAgentSpecifier} in wifi platform's {@link android.net.NetworkAgent}.
*/
public boolean satisfiesNetworkSpecifier(@NonNull WifiNetworkSpecifier ns) {
// None of these should be null by construction.
// {@link WifiNetworkSpecifier.Builder} enforces non-null in {@link WifiNetworkSpecifier}.
// {@link WifiNetworkFactory} ensures non-null in {@link WifiNetworkAgentSpecifier}.
checkNotNull(ns);
checkNotNull(ns.ssidPatternMatcher);
checkNotNull(ns.bssidPatternMatcher);
checkNotNull(ns.wifiConfiguration.allowedKeyManagement);
checkNotNull(this.mWifiConfiguration.SSID);
checkNotNull(this.mWifiConfiguration.BSSID);
checkNotNull(this.mWifiConfiguration.allowedKeyManagement);
final String ssidWithQuotes = this.mWifiConfiguration.SSID;
checkState(ssidWithQuotes.startsWith("\"") && ssidWithQuotes.endsWith("\""));
final String ssidWithoutQuotes = ssidWithQuotes.substring(1, ssidWithQuotes.length() - 1);
if (!ns.ssidPatternMatcher.match(ssidWithoutQuotes)) {
return false;
}
final MacAddress bssid = MacAddress.fromString(this.mWifiConfiguration.BSSID);
final MacAddress matchBaseAddress = ns.bssidPatternMatcher.first;
final MacAddress matchMask = ns.bssidPatternMatcher.second;
if (!bssid.matches(matchBaseAddress, matchMask)) {
return false;
}
if (!ns.wifiConfiguration.allowedKeyManagement.equals(
this.mWifiConfiguration.allowedKeyManagement)) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash(
mWifiConfiguration.SSID,
mWifiConfiguration.BSSID,
mWifiConfiguration.allowedKeyManagement);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WifiNetworkAgentSpecifier)) {
return false;
}
WifiNetworkAgentSpecifier lhs = (WifiNetworkAgentSpecifier) obj;
return Objects.equals(this.mWifiConfiguration.SSID, lhs.mWifiConfiguration.SSID)
&& Objects.equals(this.mWifiConfiguration.BSSID, lhs.mWifiConfiguration.BSSID)
&& Objects.equals(this.mWifiConfiguration.allowedKeyManagement,
lhs.mWifiConfiguration.allowedKeyManagement);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("WifiNetworkAgentSpecifier [");
sb.append("WifiConfiguration=")
.append(", SSID=").append(mWifiConfiguration.SSID)
.append(", BSSID=").append(mWifiConfiguration.BSSID)
.append("]");
return sb.toString();
}
@Override
public NetworkSpecifier redact() {
return null;
}
}

View File

@@ -1,85 +0,0 @@
/*
* Copyright (C) 2014 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.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Connection Statistics For a WiFi Network.
* @hide
*/
@SystemApi
public class WifiNetworkConnectionStatistics implements Parcelable {
private static final String TAG = "WifiNetworkConnnectionStatistics";
public int numConnection;
public int numUsage;
public WifiNetworkConnectionStatistics(int connection, int usage) {
numConnection = connection;
numUsage = usage;
}
public WifiNetworkConnectionStatistics() { }
@NonNull
@Override
public String toString() {
StringBuilder sbuf = new StringBuilder();
sbuf.append("c=").append(numConnection);
sbuf.append(" u=").append(numUsage);
return sbuf.toString();
}
/** copy constructor*/
public WifiNetworkConnectionStatistics(WifiNetworkConnectionStatistics source) {
numConnection = source.numConnection;
numUsage = source.numUsage;
}
/** Implement the Parcelable interface */
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(numConnection);
dest.writeInt(numUsage);
}
/** Implement the Parcelable interface */
public static final @android.annotation.NonNull Creator<WifiNetworkConnectionStatistics> CREATOR =
new Creator<WifiNetworkConnectionStatistics>() {
public WifiNetworkConnectionStatistics createFromParcel(Parcel in) {
int numConnection = in.readInt();
int numUsage = in.readInt();
WifiNetworkConnectionStatistics stats =
new WifiNetworkConnectionStatistics(numConnection, numUsage);
return stats;
}
public WifiNetworkConnectionStatistics[] newArray(int size) {
return new WifiNetworkConnectionStatistics[size];
}
};
}

View File

@@ -1,584 +0,0 @@
/*
* Copyright (C) 2018 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 static com.android.internal.util.Preconditions.checkNotNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.MacAddress;
import android.net.NetworkRequest;
import android.net.NetworkSpecifier;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PatternMatcher;
import android.text.TextUtils;
import android.util.Pair;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
/**
* Network specifier object used to request a local Wi-Fi network. Apps should use the
* {@link WifiNetworkSpecifier.Builder} class to create an instance.
*/
public final class WifiNetworkSpecifier extends NetworkSpecifier implements Parcelable {
private static final String TAG = "WifiNetworkSpecifier";
/**
* Builder used to create {@link WifiNetworkSpecifier} objects.
*/
public static final class Builder {
private static final String MATCH_ALL_SSID_PATTERN_PATH = ".*";
private static final String MATCH_EMPTY_SSID_PATTERN_PATH = "";
private static final Pair<MacAddress, MacAddress> MATCH_NO_BSSID_PATTERN1 =
new Pair<>(MacAddress.BROADCAST_ADDRESS, MacAddress.BROADCAST_ADDRESS);
private static final Pair<MacAddress, MacAddress> MATCH_NO_BSSID_PATTERN2 =
new Pair<>(WifiManager.ALL_ZEROS_MAC_ADDRESS, MacAddress.BROADCAST_ADDRESS);
private static final Pair<MacAddress, MacAddress> MATCH_ALL_BSSID_PATTERN =
new Pair<>(WifiManager.ALL_ZEROS_MAC_ADDRESS, WifiManager.ALL_ZEROS_MAC_ADDRESS);
private static final MacAddress MATCH_EXACT_BSSID_PATTERN_MASK =
MacAddress.BROADCAST_ADDRESS;
/**
* SSID pattern match specified by the app.
*/
private @Nullable PatternMatcher mSsidPatternMatcher;
/**
* BSSID pattern match specified by the app.
* Pair of <BaseAddress, Mask>.
*/
private @Nullable Pair<MacAddress, MacAddress> mBssidPatternMatcher;
/**
* Whether this is an OWE network or not.
*/
private boolean mIsEnhancedOpen;
/**
* Pre-shared key for use with WPA-PSK networks.
*/
private @Nullable String mWpa2PskPassphrase;
/**
* Pre-shared key for use with WPA3-SAE networks.
*/
private @Nullable String mWpa3SaePassphrase;
/**
* The enterprise configuration details specifying the EAP method,
* certificates and other settings associated with the WPA/WPA2-Enterprise networks.
*/
private @Nullable WifiEnterpriseConfig mWpa2EnterpriseConfig;
/**
* The enterprise configuration details specifying the EAP method,
* certificates and other settings associated with the WPA3-Enterprise networks.
*/
private @Nullable WifiEnterpriseConfig mWpa3EnterpriseConfig;
/**
* This is a network that does not broadcast its SSID, so an
* SSID-specific probe request must be used for scans.
*/
private boolean mIsHiddenSSID;
public Builder() {
mSsidPatternMatcher = null;
mBssidPatternMatcher = null;
mIsEnhancedOpen = false;
mWpa2PskPassphrase = null;
mWpa3SaePassphrase = null;
mWpa2EnterpriseConfig = null;
mWpa3EnterpriseConfig = null;
mIsHiddenSSID = false;
}
/**
* Set the unicode SSID match pattern to use for filtering networks from scan results.
* <p>
* <li>Overrides any previous value set using {@link #setSsid(String)} or
* {@link #setSsidPattern(PatternMatcher)}.</li>
*
* @param ssidPattern Instance of {@link PatternMatcher} containing the UTF-8 encoded
* string pattern to use for matching the network's SSID.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setSsidPattern(@NonNull PatternMatcher ssidPattern) {
checkNotNull(ssidPattern);
mSsidPatternMatcher = ssidPattern;
return this;
}
/**
* Set the unicode SSID for the network.
* <p>
* <li>Sets the SSID to use for filtering networks from scan results. Will only match
* networks whose SSID is identical to the UTF-8 encoding of the specified value.</li>
* <li>Overrides any previous value set using {@link #setSsid(String)} or
* {@link #setSsidPattern(PatternMatcher)}.</li>
*
* @param ssid The SSID of the network. It must be valid Unicode.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the SSID is not valid unicode.
*/
public @NonNull Builder setSsid(@NonNull String ssid) {
checkNotNull(ssid);
final CharsetEncoder unicodeEncoder = StandardCharsets.UTF_8.newEncoder();
if (!unicodeEncoder.canEncode(ssid)) {
throw new IllegalArgumentException("SSID is not a valid unicode string");
}
mSsidPatternMatcher = new PatternMatcher(ssid, PatternMatcher.PATTERN_LITERAL);
return this;
}
/**
* Set the BSSID match pattern to use for filtering networks from scan results.
* Will match all networks with BSSID which satisfies the following:
* {@code BSSID & mask == baseAddress}.
* <p>
* <li>Overrides any previous value set using {@link #setBssid(MacAddress)} or
* {@link #setBssidPattern(MacAddress, MacAddress)}.</li>
*
* @param baseAddress Base address for BSSID pattern.
* @param mask Mask for BSSID pattern.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setBssidPattern(
@NonNull MacAddress baseAddress, @NonNull MacAddress mask) {
checkNotNull(baseAddress);
checkNotNull(mask);
mBssidPatternMatcher = Pair.create(baseAddress, mask);
return this;
}
/**
* Set the BSSID to use for filtering networks from scan results. Will only match network
* whose BSSID is identical to the specified value.
* <p>
* <li>Sets the BSSID to use for filtering networks from scan results. Will only match
* networks whose BSSID is identical to specified value.</li>
* <li>Overrides any previous value set using {@link #setBssid(MacAddress)} or
* {@link #setBssidPattern(MacAddress, MacAddress)}.</li>
*
* @param bssid BSSID of the network.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setBssid(@NonNull MacAddress bssid) {
checkNotNull(bssid);
mBssidPatternMatcher = Pair.create(bssid, MATCH_EXACT_BSSID_PATTERN_MASK);
return this;
}
/**
* Specifies whether this represents an Enhanced Open (OWE) network.
*
* @param isEnhancedOpen {@code true} to indicate that the network uses enhanced open,
* {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsEnhancedOpen(boolean isEnhancedOpen) {
mIsEnhancedOpen = isEnhancedOpen;
return this;
}
/**
* Set the ASCII WPA2 passphrase for this network. Needed for authenticating to
* WPA2-PSK networks.
*
* @param passphrase passphrase of the network.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the passphrase is not ASCII encodable.
*/
public @NonNull Builder setWpa2Passphrase(@NonNull String passphrase) {
checkNotNull(passphrase);
final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
if (!asciiEncoder.canEncode(passphrase)) {
throw new IllegalArgumentException("passphrase not ASCII encodable");
}
mWpa2PskPassphrase = passphrase;
return this;
}
/**
* Set the ASCII WPA3 passphrase for this network. Needed for authenticating to WPA3-SAE
* networks.
*
* @param passphrase passphrase of the network.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the passphrase is not ASCII encodable.
*/
public @NonNull Builder setWpa3Passphrase(@NonNull String passphrase) {
checkNotNull(passphrase);
final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
if (!asciiEncoder.canEncode(passphrase)) {
throw new IllegalArgumentException("passphrase not ASCII encodable");
}
mWpa3SaePassphrase = passphrase;
return this;
}
/**
* Set the associated enterprise configuration for this network. Needed for authenticating
* to WPA2-EAP networks. See {@link WifiEnterpriseConfig} for description.
*
* @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setWpa2EnterpriseConfig(
@NonNull WifiEnterpriseConfig enterpriseConfig) {
checkNotNull(enterpriseConfig);
mWpa2EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
return this;
}
/**
* Set the associated enterprise configuration for this network. Needed for authenticating
* to WPA3-Enterprise networks (standard and 192-bit security). See
* {@link WifiEnterpriseConfig} for description. For 192-bit security networks, both the
* client and CA certificates must be provided, and must be of type of either
* sha384WithRSAEncryption (OID 1.2.840.113549.1.1.12) or ecdsa-with-SHA384
* (OID 1.2.840.10045.4.3.3).
*
* @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setWpa3EnterpriseConfig(
@NonNull WifiEnterpriseConfig enterpriseConfig) {
checkNotNull(enterpriseConfig);
mWpa3EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
return this;
}
/**
* Specifies whether this represents a hidden network.
* <p>
* <li>Setting this disallows the usage of {@link #setSsidPattern(PatternMatcher)} since
* hidden networks need to be explicitly probed for.</li>
* <li>If not set, defaults to false (i.e not a hidden network).</li>
*
* @param isHiddenSsid {@code true} to indicate that the network is hidden, {@code false}
* otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsHiddenSsid(boolean isHiddenSsid) {
mIsHiddenSSID = isHiddenSsid;
return this;
}
private void setSecurityParamsInWifiConfiguration(
@NonNull WifiConfiguration configuration) {
if (!TextUtils.isEmpty(mWpa2PskPassphrase)) { // WPA-PSK network.
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_PSK);
// WifiConfiguration.preSharedKey needs quotes around ASCII password.
configuration.preSharedKey = "\"" + mWpa2PskPassphrase + "\"";
} else if (!TextUtils.isEmpty(mWpa3SaePassphrase)) { // WPA3-SAE network.
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_SAE);
// WifiConfiguration.preSharedKey needs quotes around ASCII password.
configuration.preSharedKey = "\"" + mWpa3SaePassphrase + "\"";
} else if (mWpa2EnterpriseConfig != null) { // WPA-EAP network
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
configuration.enterpriseConfig = mWpa2EnterpriseConfig;
} else if (mWpa3EnterpriseConfig != null) { // WPA3-Enterprise
if (mWpa3EnterpriseConfig.getEapMethod() == WifiEnterpriseConfig.Eap.TLS
&& WifiEnterpriseConfig.isSuiteBCipherCert(
mWpa3EnterpriseConfig.getClientCertificate())
&& WifiEnterpriseConfig.isSuiteBCipherCert(
mWpa3EnterpriseConfig.getCaCertificate())) {
// WPA3-Enterprise in 192-bit security mode (Suite-B)
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
} else {
// WPA3-Enterprise
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
configuration.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
configuration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
configuration.allowedPairwiseCiphers.set(
WifiConfiguration.PairwiseCipher.GCMP_256);
configuration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
configuration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
configuration.requirePmf = true;
}
configuration.enterpriseConfig = mWpa3EnterpriseConfig;
} else if (mIsEnhancedOpen) { // OWE network
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OWE);
} else { // Open network
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OPEN);
}
}
/**
* Helper method to build WifiConfiguration object from the builder.
* @return Instance of {@link WifiConfiguration}.
*/
private WifiConfiguration buildWifiConfiguration() {
final WifiConfiguration wifiConfiguration = new WifiConfiguration();
// WifiConfiguration.SSID needs quotes around unicode SSID.
if (mSsidPatternMatcher.getType() == PatternMatcher.PATTERN_LITERAL) {
wifiConfiguration.SSID = "\"" + mSsidPatternMatcher.getPath() + "\"";
}
if (mBssidPatternMatcher.second == MATCH_EXACT_BSSID_PATTERN_MASK) {
wifiConfiguration.BSSID = mBssidPatternMatcher.first.toString();
}
setSecurityParamsInWifiConfiguration(wifiConfiguration);
wifiConfiguration.hiddenSSID = mIsHiddenSSID;
return wifiConfiguration;
}
private boolean hasSetAnyPattern() {
return mSsidPatternMatcher != null || mBssidPatternMatcher != null;
}
private void setMatchAnyPatternIfUnset() {
if (mSsidPatternMatcher == null) {
mSsidPatternMatcher = new PatternMatcher(MATCH_ALL_SSID_PATTERN_PATH,
PatternMatcher.PATTERN_SIMPLE_GLOB);
}
if (mBssidPatternMatcher == null) {
mBssidPatternMatcher = MATCH_ALL_BSSID_PATTERN;
}
}
private boolean hasSetMatchNonePattern() {
if (mSsidPatternMatcher.getType() != PatternMatcher.PATTERN_PREFIX
&& mSsidPatternMatcher.getPath().equals(MATCH_EMPTY_SSID_PATTERN_PATH)) {
return true;
}
if (mBssidPatternMatcher.equals(MATCH_NO_BSSID_PATTERN1)) {
return true;
}
if (mBssidPatternMatcher.equals(MATCH_NO_BSSID_PATTERN2)) {
return true;
}
return false;
}
private boolean hasSetMatchAllPattern() {
if ((mSsidPatternMatcher.match(MATCH_EMPTY_SSID_PATTERN_PATH))
&& mBssidPatternMatcher.equals(MATCH_ALL_BSSID_PATTERN)) {
return true;
}
return false;
}
private void validateSecurityParams() {
int numSecurityTypes = 0;
numSecurityTypes += mIsEnhancedOpen ? 1 : 0;
numSecurityTypes += !TextUtils.isEmpty(mWpa2PskPassphrase) ? 1 : 0;
numSecurityTypes += !TextUtils.isEmpty(mWpa3SaePassphrase) ? 1 : 0;
numSecurityTypes += mWpa2EnterpriseConfig != null ? 1 : 0;
numSecurityTypes += mWpa3EnterpriseConfig != null ? 1 : 0;
if (numSecurityTypes > 1) {
throw new IllegalStateException("only one of setIsEnhancedOpen, setWpa2Passphrase,"
+ "setWpa3Passphrase, setWpa2EnterpriseConfig or setWpa3EnterpriseConfig"
+ " can be invoked for network specifier");
}
}
/**
* Create a specifier object used to request a local Wi-Fi network. The generated
* {@link NetworkSpecifier} should be used in
* {@link NetworkRequest.Builder#setNetworkSpecifier(NetworkSpecifier)} when building
* the {@link NetworkRequest}. These specifiers can only be used to request a local wifi
* network (i.e no internet capability). So, the device will not switch it's default route
* to wifi if there are other transports (cellular for example) available.
*<p>
* Note: Apps can set a combination of network match params:
* <li> SSID Pattern using {@link #setSsidPattern(PatternMatcher)} OR Specific SSID using
* {@link #setSsid(String)}. </li>
* AND/OR
* <li> BSSID Pattern using {@link #setBssidPattern(MacAddress, MacAddress)} OR Specific
* BSSID using {@link #setBssid(MacAddress)} </li>
* to trigger connection to a network that matches the set params.
* The system will find the set of networks matching the request and present the user
* with a system dialog which will allow the user to select a specific Wi-Fi network to
* connect to or to deny the request.
*</p>
*
* For example:
* To connect to an open network with a SSID prefix of "test" and a BSSID OUI of "10:03:23":
*
* <pre>{@code
* final NetworkSpecifier specifier =
* new Builder()
* .setSsidPattern(new PatternMatcher("test", PatterMatcher.PATTERN_PREFIX))
* .setBssidPattern(MacAddress.fromString("10:03:23:00:00:00"),
* MacAddress.fromString("ff:ff:ff:00:00:00"))
* .build()
* final NetworkRequest request =
* new NetworkRequest.Builder()
* .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
* .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
* .setNetworkSpecifier(specifier)
* .build();
* final ConnectivityManager connectivityManager =
* context.getSystemService(Context.CONNECTIVITY_SERVICE);
* final NetworkCallback networkCallback = new NetworkCallback() {
* ...
* {@literal @}Override
* void onAvailable(...) {}
* // etc.
* };
* connectivityManager.requestNetwork(request, networkCallback);
* }</pre>
*
* @return Instance of {@link NetworkSpecifier}.
* @throws IllegalStateException on invalid params set.
*/
public @NonNull WifiNetworkSpecifier build() {
if (!hasSetAnyPattern()) {
throw new IllegalStateException("one of setSsidPattern/setSsid/setBssidPattern/"
+ "setBssid should be invoked for specifier");
}
setMatchAnyPatternIfUnset();
if (hasSetMatchNonePattern()) {
throw new IllegalStateException("cannot set match-none pattern for specifier");
}
if (hasSetMatchAllPattern()) {
throw new IllegalStateException("cannot set match-all pattern for specifier");
}
if (mIsHiddenSSID && mSsidPatternMatcher.getType() != PatternMatcher.PATTERN_LITERAL) {
throw new IllegalStateException("setSsid should also be invoked when "
+ "setIsHiddenSsid is invoked for network specifier");
}
validateSecurityParams();
return new WifiNetworkSpecifier(
mSsidPatternMatcher,
mBssidPatternMatcher,
buildWifiConfiguration());
}
}
/**
* SSID pattern match specified by the app.
* @hide
*/
public final PatternMatcher ssidPatternMatcher;
/**
* BSSID pattern match specified by the app.
* Pair of <BaseAddress, Mask>.
* @hide
*/
public final Pair<MacAddress, MacAddress> bssidPatternMatcher;
/**
* Security credentials for the network.
* <p>
* Note: {@link WifiConfiguration#SSID} & {@link WifiConfiguration#BSSID} fields from
* WifiConfiguration are not used. Instead we use the {@link #ssidPatternMatcher} &
* {@link #bssidPatternMatcher} fields embedded directly
* within {@link WifiNetworkSpecifier}.
* @hide
*/
public final WifiConfiguration wifiConfiguration;
/** @hide */
public WifiNetworkSpecifier() throws IllegalAccessException {
throw new IllegalAccessException("Use the builder to create an instance");
}
/** @hide */
public WifiNetworkSpecifier(@NonNull PatternMatcher ssidPatternMatcher,
@NonNull Pair<MacAddress, MacAddress> bssidPatternMatcher,
@NonNull WifiConfiguration wifiConfiguration) {
checkNotNull(ssidPatternMatcher);
checkNotNull(bssidPatternMatcher);
checkNotNull(wifiConfiguration);
this.ssidPatternMatcher = ssidPatternMatcher;
this.bssidPatternMatcher = bssidPatternMatcher;
this.wifiConfiguration = wifiConfiguration;
}
public static final @NonNull Creator<WifiNetworkSpecifier> CREATOR =
new Creator<WifiNetworkSpecifier>() {
@Override
public WifiNetworkSpecifier createFromParcel(Parcel in) {
PatternMatcher ssidPatternMatcher = in.readParcelable(/* classLoader */null);
MacAddress baseAddress = in.readParcelable(null);
MacAddress mask = in.readParcelable(null);
Pair<MacAddress, MacAddress> bssidPatternMatcher =
Pair.create(baseAddress, mask);
WifiConfiguration wifiConfiguration = in.readParcelable(null);
return new WifiNetworkSpecifier(ssidPatternMatcher, bssidPatternMatcher,
wifiConfiguration);
}
@Override
public WifiNetworkSpecifier[] newArray(int size) {
return new WifiNetworkSpecifier[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(ssidPatternMatcher, flags);
dest.writeParcelable(bssidPatternMatcher.first, flags);
dest.writeParcelable(bssidPatternMatcher.second, flags);
dest.writeParcelable(wifiConfiguration, flags);
}
@Override
public int hashCode() {
return Objects.hash(
ssidPatternMatcher.getPath(), ssidPatternMatcher.getType(), bssidPatternMatcher,
wifiConfiguration.allowedKeyManagement);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WifiNetworkSpecifier)) {
return false;
}
WifiNetworkSpecifier lhs = (WifiNetworkSpecifier) obj;
return Objects.equals(this.ssidPatternMatcher.getPath(),
lhs.ssidPatternMatcher.getPath())
&& Objects.equals(this.ssidPatternMatcher.getType(),
lhs.ssidPatternMatcher.getType())
&& Objects.equals(this.bssidPatternMatcher,
lhs.bssidPatternMatcher)
&& Objects.equals(this.wifiConfiguration.allowedKeyManagement,
lhs.wifiConfiguration.allowedKeyManagement);
}
@Override
public String toString() {
return new StringBuilder()
.append("WifiNetworkSpecifier [")
.append(", SSID Match pattern=").append(ssidPatternMatcher)
.append(", BSSID Match pattern=").append(bssidPatternMatcher)
.append(", SSID=").append(wifiConfiguration.SSID)
.append(", BSSID=").append(wifiConfiguration.BSSID)
.append("]")
.toString();
}
/** @hide */
@Override
public boolean canBeSatisfiedBy(NetworkSpecifier other) {
if (other instanceof WifiNetworkAgentSpecifier) {
return ((WifiNetworkAgentSpecifier) other).satisfiesNetworkSpecifier(this);
}
// Specific requests are checked for equality although testing for equality of 2 patterns do
// not make much sense!
return equals(other);
}
}

View File

@@ -1,986 +0,0 @@
/*
* Copyright (C) 2018 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 static com.android.internal.util.Preconditions.checkNotNull;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.net.MacAddress;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;
/**
* The Network Suggestion object is used to provide a Wi-Fi network for consideration when
* auto-connecting to networks. Apps cannot directly create this object, they must use
* {@link WifiNetworkSuggestion.Builder#build()} to obtain an instance of this object.
*<p>
* Apps can provide a list of such networks to the platform using
* {@link WifiManager#addNetworkSuggestions(List)}.
*/
public final class WifiNetworkSuggestion implements Parcelable {
/**
* Builder used to create {@link WifiNetworkSuggestion} objects.
*/
public static final class Builder {
private static final int UNASSIGNED_PRIORITY = -1;
/**
* SSID of the network.
*/
private String mSsid;
/**
* Optional BSSID within the network.
*/
private MacAddress mBssid;
/**
* Whether this is an OWE network or not.
*/
private boolean mIsEnhancedOpen;
/**
* Pre-shared key for use with WPA-PSK networks.
*/
private @Nullable String mWpa2PskPassphrase;
/**
* Pre-shared key for use with WPA3-SAE networks.
*/
private @Nullable String mWpa3SaePassphrase;
/**
* The enterprise configuration details specifying the EAP method,
* certificates and other settings associated with the WPA/WPA2-Enterprise networks.
*/
private @Nullable WifiEnterpriseConfig mWpa2EnterpriseConfig;
/**
* The enterprise configuration details specifying the EAP method,
* certificates and other settings associated with the WPA3-Enterprise networks.
*/
private @Nullable WifiEnterpriseConfig mWpa3EnterpriseConfig;
/**
* The passpoint config for use with Hotspot 2.0 network
*/
private @Nullable PasspointConfiguration mPasspointConfiguration;
/**
* This is a network that does not broadcast its SSID, so an
* SSID-specific probe request must be used for scans.
*/
private boolean mIsHiddenSSID;
/**
* Whether app needs to log in to captive portal to obtain Internet access.
*/
private boolean mIsAppInteractionRequired;
/**
* Whether user needs to log in to captive portal to obtain Internet access.
*/
private boolean mIsUserInteractionRequired;
/**
* Whether this network is metered or not.
*/
private int mMeteredOverride;
/**
* Priority of this network among other network suggestions provided by the app.
* The lower the number, the higher the priority (i.e value of 0 = highest priority).
*/
private int mPriority;
/**
* The carrier ID identifies the operator who provides this network configuration.
* see {@link TelephonyManager#getSimCarrierId()}
*/
private int mCarrierId;
/**
* Whether this network is shared credential with user to allow user manually connect.
*/
private boolean mIsSharedWithUser;
/**
* Whether the setCredentialSharedWithUser have been called.
*/
private boolean mIsSharedWithUserSet;
/**
* Whether this network is initialized with auto-join enabled (the default) or not.
*/
private boolean mIsInitialAutojoinEnabled;
/**
* Pre-shared key for use with WAPI-PSK networks.
*/
private @Nullable String mWapiPskPassphrase;
/**
* The enterprise configuration details specifying the EAP method,
* certificates and other settings associated with the WAPI networks.
*/
private @Nullable WifiEnterpriseConfig mWapiEnterpriseConfig;
/**
* Whether this network will be brought up as untrusted (TRUSTED capability bit removed).
*/
private boolean mIsNetworkUntrusted;
public Builder() {
mSsid = null;
mBssid = null;
mIsEnhancedOpen = false;
mWpa2PskPassphrase = null;
mWpa3SaePassphrase = null;
mWpa2EnterpriseConfig = null;
mWpa3EnterpriseConfig = null;
mPasspointConfiguration = null;
mIsHiddenSSID = false;
mIsAppInteractionRequired = false;
mIsUserInteractionRequired = false;
mMeteredOverride = WifiConfiguration.METERED_OVERRIDE_NONE;
mIsSharedWithUser = true;
mIsSharedWithUserSet = false;
mIsInitialAutojoinEnabled = true;
mPriority = UNASSIGNED_PRIORITY;
mCarrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
mWapiPskPassphrase = null;
mWapiEnterpriseConfig = null;
mIsNetworkUntrusted = false;
}
/**
* Set the unicode SSID for the network.
* <p>
* <li>Overrides any previous value set using {@link #setSsid(String)}.</li>
*
* @param ssid The SSID of the network. It must be valid Unicode.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the SSID is not valid unicode.
*/
public @NonNull Builder setSsid(@NonNull String ssid) {
checkNotNull(ssid);
final CharsetEncoder unicodeEncoder = StandardCharsets.UTF_8.newEncoder();
if (!unicodeEncoder.canEncode(ssid)) {
throw new IllegalArgumentException("SSID is not a valid unicode string");
}
mSsid = new String(ssid);
return this;
}
/**
* Set the BSSID to use for filtering networks from scan results. Will only match network
* whose BSSID is identical to the specified value.
* <p>
* <li Sets a specific BSSID for the network suggestion. If set, only the specified BSSID
* with the specified SSID will be considered for connection.
* <li>If set, only the specified BSSID with the specified SSID will be considered for
* connection.</li>
* <li>If not set, all BSSIDs with the specified SSID will be considered for connection.
* </li>
* <li>Overrides any previous value set using {@link #setBssid(MacAddress)}.</li>
*
* @param bssid BSSID of the network.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setBssid(@NonNull MacAddress bssid) {
checkNotNull(bssid);
mBssid = MacAddress.fromBytes(bssid.toByteArray());
return this;
}
/**
* Specifies whether this represents an Enhanced Open (OWE) network.
*
* @param isEnhancedOpen {@code true} to indicate that the network used enhanced open,
* {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsEnhancedOpen(boolean isEnhancedOpen) {
mIsEnhancedOpen = isEnhancedOpen;
return this;
}
/**
* Set the ASCII WPA2 passphrase for this network. Needed for authenticating to
* WPA2-PSK networks.
*
* @param passphrase passphrase of the network.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the passphrase is not ASCII encodable.
*/
public @NonNull Builder setWpa2Passphrase(@NonNull String passphrase) {
checkNotNull(passphrase);
final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
if (!asciiEncoder.canEncode(passphrase)) {
throw new IllegalArgumentException("passphrase not ASCII encodable");
}
mWpa2PskPassphrase = passphrase;
return this;
}
/**
* Set the ASCII WPA3 passphrase for this network. Needed for authenticating to WPA3-SAE
* networks.
*
* @param passphrase passphrase of the network.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the passphrase is not ASCII encodable.
*/
public @NonNull Builder setWpa3Passphrase(@NonNull String passphrase) {
checkNotNull(passphrase);
final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
if (!asciiEncoder.canEncode(passphrase)) {
throw new IllegalArgumentException("passphrase not ASCII encodable");
}
mWpa3SaePassphrase = passphrase;
return this;
}
/**
* Set the associated enterprise configuration for this network. Needed for authenticating
* to WPA2 enterprise networks. See {@link WifiEnterpriseConfig} for description.
*
* @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if configuration CA certificate or
* AltSubjectMatch/DomainSuffixMatch is not set.
*/
public @NonNull Builder setWpa2EnterpriseConfig(
@NonNull WifiEnterpriseConfig enterpriseConfig) {
checkNotNull(enterpriseConfig);
if (enterpriseConfig.isInsecure()) {
throw new IllegalArgumentException("Enterprise configuration is insecure");
}
mWpa2EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
return this;
}
/**
* Set the associated enterprise configuration for this network. Needed for authenticating
* to WPA3-Enterprise networks (standard and 192-bit security). See
* {@link WifiEnterpriseConfig} for description. For 192-bit security networks, both the
* client and CA certificates must be provided, and must be of type of either
* sha384WithRSAEncryption (OID 1.2.840.113549.1.1.12) or ecdsa-with-SHA384
* (OID 1.2.840.10045.4.3.3).
*
* @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if configuration CA certificate or
* AltSubjectMatch/DomainSuffixMatch is not set.
*/
public @NonNull Builder setWpa3EnterpriseConfig(
@NonNull WifiEnterpriseConfig enterpriseConfig) {
checkNotNull(enterpriseConfig);
if (enterpriseConfig.isInsecure()) {
throw new IllegalArgumentException("Enterprise configuration is insecure");
}
mWpa3EnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
return this;
}
/**
* Set the associated Passpoint configuration for this network. Needed for authenticating
* to Hotspot 2.0 networks. See {@link PasspointConfiguration} for description.
*
* @param passpointConfig Instance of {@link PasspointConfiguration}.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if passpoint configuration is invalid.
*/
public @NonNull Builder setPasspointConfig(
@NonNull PasspointConfiguration passpointConfig) {
checkNotNull(passpointConfig);
if (!passpointConfig.validate()) {
throw new IllegalArgumentException("Passpoint configuration is invalid");
}
mPasspointConfiguration = passpointConfig;
return this;
}
/**
* Set the carrier ID of the network operator. The carrier ID associates a Suggested
* network with a specific carrier (and therefore SIM). The carrier ID must be provided
* for any network which uses the SIM-based authentication: e.g. EAP-SIM, EAP-AKA,
* EAP-AKA', and EAP-PEAP with SIM-based phase 2 authentication.
* @param carrierId see {@link TelephonyManager#getSimCarrierId()}.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.NETWORK_CARRIER_PROVISIONING)
public @NonNull Builder setCarrierId(int carrierId) {
mCarrierId = carrierId;
return this;
}
/**
* Set the ASCII WAPI passphrase for this network. Needed for authenticating to
* WAPI-PSK networks.
*
* @param passphrase passphrase of the network.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the passphrase is not ASCII encodable.
*
*/
public @NonNull Builder setWapiPassphrase(@NonNull String passphrase) {
checkNotNull(passphrase);
final CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder();
if (!asciiEncoder.canEncode(passphrase)) {
throw new IllegalArgumentException("passphrase not ASCII encodable");
}
mWapiPskPassphrase = passphrase;
return this;
}
/**
* Set the associated enterprise configuration for this network. Needed for authenticating
* to WAPI-CERT networks. See {@link WifiEnterpriseConfig} for description.
*
* @param enterpriseConfig Instance of {@link WifiEnterpriseConfig}.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setWapiEnterpriseConfig(
@NonNull WifiEnterpriseConfig enterpriseConfig) {
checkNotNull(enterpriseConfig);
mWapiEnterpriseConfig = new WifiEnterpriseConfig(enterpriseConfig);
return this;
}
/**
* Specifies whether this represents a hidden network.
* <p>
* <li>If not set, defaults to false (i.e not a hidden network).</li>
*
* @param isHiddenSsid {@code true} to indicate that the network is hidden, {@code false}
* otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsHiddenSsid(boolean isHiddenSsid) {
mIsHiddenSSID = isHiddenSsid;
return this;
}
/**
* Specifies whether the app needs to log in to a captive portal to obtain Internet access.
* <p>
* This will dictate if the directed broadcast
* {@link WifiManager#ACTION_WIFI_NETWORK_SUGGESTION_POST_CONNECTION} will be sent to the
* app after successfully connecting to the network.
* Use this for captive portal type networks where the app needs to authenticate the user
* before the device can access the network.
* <p>
* <li>If not set, defaults to false (i.e no app interaction required).</li>
*
* @param isAppInteractionRequired {@code true} to indicate that app interaction is
* required, {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsAppInteractionRequired(boolean isAppInteractionRequired) {
mIsAppInteractionRequired = isAppInteractionRequired;
return this;
}
/**
* Specifies whether the user needs to log in to a captive portal to obtain Internet access.
* <p>
* <li>If not set, defaults to false (i.e no user interaction required).</li>
*
* @param isUserInteractionRequired {@code true} to indicate that user interaction is
* required, {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsUserInteractionRequired(boolean isUserInteractionRequired) {
mIsUserInteractionRequired = isUserInteractionRequired;
return this;
}
/**
* Specify the priority of this network among other network suggestions provided by the same
* app (priorities have no impact on suggestions by different apps). The higher the number,
* the higher the priority (i.e value of 0 = lowest priority).
* <p>
* <li>If not set, defaults a lower priority than any assigned priority.</li>
*
* @param priority Integer number representing the priority among suggestions by the app.
* @return Instance of {@link Builder} to enable chaining of the builder method.
* @throws IllegalArgumentException if the priority value is negative.
*/
public @NonNull Builder setPriority(@IntRange(from = 0) int priority) {
if (priority < 0) {
throw new IllegalArgumentException("Invalid priority value " + priority);
}
mPriority = priority;
return this;
}
/**
* Specifies whether this network is metered.
* <p>
* <li>If not set, defaults to detect automatically.</li>
*
* @param isMetered {@code true} to indicate that the network is metered, {@code false}
* for not metered.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsMetered(boolean isMetered) {
if (isMetered) {
mMeteredOverride = WifiConfiguration.METERED_OVERRIDE_METERED;
} else {
mMeteredOverride = WifiConfiguration.METERED_OVERRIDE_NOT_METERED;
}
return this;
}
/**
* Specifies whether the network credentials provided with this suggestion can be used by
* the user to explicitly (manually) connect to this network. If true this network will
* appear in the Wi-Fi Picker (in Settings) and the user will be able to select and connect
* to it with the provided credentials. If false, the user will need to enter network
* credentials and the resulting configuration will become a user saved network.
* <p>
* <li>Note: Only valid for secure (non-open) networks.
* <li>If not set, defaults to true (i.e. allow user to manually connect) for secure
* networks and false for open networks.</li>
*
* @param isShared {@code true} to indicate that the credentials may be used by the user to
* manually connect to the network, {@code false} otherwise.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setCredentialSharedWithUser(boolean isShared) {
mIsSharedWithUser = isShared;
mIsSharedWithUserSet = true;
return this;
}
/**
* Specifies whether the suggestion is created with auto-join enabled or disabled. The
* user may modify the auto-join configuration of a suggestion directly once the device
* associates to the network.
* <p>
* If auto-join is initialized as disabled the user may still be able to manually connect
* to the network. Therefore, disabling auto-join only makes sense if
* {@link #setCredentialSharedWithUser(boolean)} is set to true (the default) which
* itself implies a secure (non-open) network.
* <p>
* If not set, defaults to true (i.e. auto-join is initialized as enabled).
*
* @param enabled true for initializing with auto-join enabled (the default), false to
* initializing with auto-join disabled.
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setIsInitialAutojoinEnabled(boolean enabled) {
mIsInitialAutojoinEnabled = enabled;
return this;
}
/**
* Specifies whether the system will bring up the network (if selected) as untrusted. An
* untrusted network has its {@link android.net.NetworkCapabilities#NET_CAPABILITY_TRUSTED}
* capability removed. The Wi-Fi network selection process may use this information to
* influence priority of the suggested network for Wi-Fi network selection (most likely to
* reduce it). The connectivity service may use this information to influence the overall
* network configuration of the device.
* <p>
* <li> An untrusted network's credentials may not be shared with the user using
* {@link #setCredentialSharedWithUser(boolean)}.</li>
* <li> If not set, defaults to false (i.e. network is trusted).</li>
*
* @param isUntrusted Boolean indicating whether the network should be brought up untrusted
* (if true) or trusted (if false).
* @return Instance of {@link Builder} to enable chaining of the builder method.
*/
public @NonNull Builder setUntrusted(boolean isUntrusted) {
mIsNetworkUntrusted = isUntrusted;
return this;
}
private void setSecurityParamsInWifiConfiguration(
@NonNull WifiConfiguration configuration) {
if (!TextUtils.isEmpty(mWpa2PskPassphrase)) { // WPA-PSK network.
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_PSK);
// WifiConfiguration.preSharedKey needs quotes around ASCII password.
configuration.preSharedKey = "\"" + mWpa2PskPassphrase + "\"";
} else if (!TextUtils.isEmpty(mWpa3SaePassphrase)) { // WPA3-SAE network.
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_SAE);
// WifiConfiguration.preSharedKey needs quotes around ASCII password.
configuration.preSharedKey = "\"" + mWpa3SaePassphrase + "\"";
} else if (mWpa2EnterpriseConfig != null) { // WPA-EAP network
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
configuration.enterpriseConfig = mWpa2EnterpriseConfig;
} else if (mWpa3EnterpriseConfig != null) { // WPA3-Enterprise
if (mWpa3EnterpriseConfig.getEapMethod() == WifiEnterpriseConfig.Eap.TLS
&& WifiEnterpriseConfig.isSuiteBCipherCert(
mWpa3EnterpriseConfig.getClientCertificate())
&& WifiEnterpriseConfig.isSuiteBCipherCert(
mWpa3EnterpriseConfig.getCaCertificate())) {
// WPA3-Enterprise in 192-bit security mode (Suite-B)
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);
} else {
// WPA3-Enterprise
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP);
configuration.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
configuration.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
configuration.allowedPairwiseCiphers.set(
WifiConfiguration.PairwiseCipher.GCMP_256);
configuration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
configuration.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
configuration.requirePmf = true;
}
configuration.enterpriseConfig = mWpa3EnterpriseConfig;
} else if (mIsEnhancedOpen) { // OWE network
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OWE);
} else if (!TextUtils.isEmpty(mWapiPskPassphrase)) { // WAPI-PSK network.
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_WAPI_PSK);
// WifiConfiguration.preSharedKey needs quotes around ASCII password.
configuration.preSharedKey = "\"" + mWapiPskPassphrase + "\"";
} else if (mWapiEnterpriseConfig != null) { // WAPI-CERT network
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_WAPI_CERT);
configuration.enterpriseConfig = mWapiEnterpriseConfig;
} else { // Open network
configuration.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OPEN);
}
}
/**
* Helper method to build WifiConfiguration object from the builder.
* @return Instance of {@link WifiConfiguration}.
*/
private WifiConfiguration buildWifiConfiguration() {
final WifiConfiguration wifiConfiguration = new WifiConfiguration();
// WifiConfiguration.SSID needs quotes around unicode SSID.
wifiConfiguration.SSID = "\"" + mSsid + "\"";
if (mBssid != null) {
wifiConfiguration.BSSID = mBssid.toString();
}
setSecurityParamsInWifiConfiguration(wifiConfiguration);
wifiConfiguration.hiddenSSID = mIsHiddenSSID;
wifiConfiguration.priority = mPriority;
wifiConfiguration.meteredOverride = mMeteredOverride;
wifiConfiguration.carrierId = mCarrierId;
wifiConfiguration.trusted = !mIsNetworkUntrusted;
return wifiConfiguration;
}
private void validateSecurityParams() {
int numSecurityTypes = 0;
numSecurityTypes += mIsEnhancedOpen ? 1 : 0;
numSecurityTypes += !TextUtils.isEmpty(mWpa2PskPassphrase) ? 1 : 0;
numSecurityTypes += !TextUtils.isEmpty(mWpa3SaePassphrase) ? 1 : 0;
numSecurityTypes += !TextUtils.isEmpty(mWapiPskPassphrase) ? 1 : 0;
numSecurityTypes += mWpa2EnterpriseConfig != null ? 1 : 0;
numSecurityTypes += mWpa3EnterpriseConfig != null ? 1 : 0;
numSecurityTypes += mWapiEnterpriseConfig != null ? 1 : 0;
numSecurityTypes += mPasspointConfiguration != null ? 1 : 0;
if (numSecurityTypes > 1) {
throw new IllegalStateException("only one of setIsEnhancedOpen, setWpa2Passphrase,"
+ " setWpa3Passphrase, setWpa2EnterpriseConfig, setWpa3EnterpriseConfig"
+ " setWapiPassphrase, setWapiCertSuite, setIsWapiCertSuiteAuto"
+ " or setPasspointConfig can be invoked for network suggestion");
}
}
private WifiConfiguration buildWifiConfigurationForPasspoint() {
WifiConfiguration wifiConfiguration = new WifiConfiguration();
wifiConfiguration.FQDN = mPasspointConfiguration.getHomeSp().getFqdn();
wifiConfiguration.setPasspointUniqueId(mPasspointConfiguration.getUniqueId());
wifiConfiguration.priority = mPriority;
wifiConfiguration.meteredOverride = mMeteredOverride;
wifiConfiguration.trusted = !mIsNetworkUntrusted;
mPasspointConfiguration.setCarrierId(mCarrierId);
mPasspointConfiguration.setMeteredOverride(wifiConfiguration.meteredOverride);
return wifiConfiguration;
}
/**
* Create a network suggestion object for use in
* {@link WifiManager#addNetworkSuggestions(List)}.
*
*<p class="note">
* <b>Note:</b> Apps can set a combination of SSID using {@link #setSsid(String)} and BSSID
* using {@link #setBssid(MacAddress)} to provide more fine grained network suggestions to
* the platform.
* </p>
*
* For example:
* To provide credentials for one open, one WPA2, one WPA3 network with their
* corresponding SSID's and one with Passpoint config:
*
* <pre>{@code
* final WifiNetworkSuggestion suggestion1 =
* new Builder()
* .setSsid("test111111")
* .build();
* final WifiNetworkSuggestion suggestion2 =
* new Builder()
* .setSsid("test222222")
* .setWpa2Passphrase("test123456")
* .build();
* final WifiNetworkSuggestion suggestion3 =
* new Builder()
* .setSsid("test333333")
* .setWpa3Passphrase("test6789")
* .build();
* final PasspointConfiguration passpointConfig= new PasspointConfiguration();
* // configure passpointConfig to include a valid Passpoint configuration
* final WifiNetworkSuggestion suggestion4 =
* new Builder()
* .setPasspointConfig(passpointConfig)
* .build();
* final List<WifiNetworkSuggestion> suggestionsList =
* new ArrayList<WifiNetworkSuggestion> { {
* add(suggestion1);
* add(suggestion2);
* add(suggestion3);
* add(suggestion4);
* } };
* final WifiManager wifiManager =
* context.getSystemService(Context.WIFI_SERVICE);
* wifiManager.addNetworkSuggestions(suggestionsList);
* // ...
* }</pre>
*
* @return Instance of {@link WifiNetworkSuggestion}
* @throws IllegalStateException on invalid params set
* @see WifiNetworkSuggestion
*/
public @NonNull WifiNetworkSuggestion build() {
validateSecurityParams();
WifiConfiguration wifiConfiguration;
if (mPasspointConfiguration != null) {
if (mSsid != null) {
throw new IllegalStateException("setSsid should not be invoked for suggestion "
+ "with Passpoint configuration");
}
if (mIsHiddenSSID) {
throw new IllegalStateException("setIsHiddenSsid should not be invoked for "
+ "suggestion with Passpoint configuration");
}
wifiConfiguration = buildWifiConfigurationForPasspoint();
} else {
if (mSsid == null) {
throw new IllegalStateException("setSsid should be invoked for suggestion");
}
if (TextUtils.isEmpty(mSsid)) {
throw new IllegalStateException("invalid ssid for suggestion");
}
if (mBssid != null
&& (mBssid.equals(MacAddress.BROADCAST_ADDRESS)
|| mBssid.equals(WifiManager.ALL_ZEROS_MAC_ADDRESS))) {
throw new IllegalStateException("invalid bssid for suggestion");
}
wifiConfiguration = buildWifiConfiguration();
if (wifiConfiguration.isOpenNetwork()) {
if (mIsSharedWithUserSet && mIsSharedWithUser) {
throw new IllegalStateException("Open network should not be "
+ "setCredentialSharedWithUser to true");
}
mIsSharedWithUser = false;
}
}
if (!mIsSharedWithUser && !mIsInitialAutojoinEnabled) {
throw new IllegalStateException("Should have not a network with both "
+ "setCredentialSharedWithUser and "
+ "setIsAutojoinEnabled set to false");
}
if (mIsNetworkUntrusted) {
if (mIsSharedWithUserSet && mIsSharedWithUser) {
throw new IllegalStateException("Should not be both"
+ "setCredentialSharedWithUser and +"
+ "setIsNetworkAsUntrusted to true");
}
mIsSharedWithUser = false;
}
return new WifiNetworkSuggestion(
wifiConfiguration,
mPasspointConfiguration,
mIsAppInteractionRequired,
mIsUserInteractionRequired,
mIsSharedWithUser,
mIsInitialAutojoinEnabled);
}
}
/**
* Network configuration for the provided network.
* @hide
*/
@NonNull
public final WifiConfiguration wifiConfiguration;
/**
* Passpoint configuration for the provided network.
* @hide
*/
@Nullable
public final PasspointConfiguration passpointConfiguration;
/**
* Whether app needs to log in to captive portal to obtain Internet access.
* @hide
*/
public final boolean isAppInteractionRequired;
/**
* Whether user needs to log in to captive portal to obtain Internet access.
* @hide
*/
public final boolean isUserInteractionRequired;
/**
* Whether app share credential with the user, allow user use provided credential to
* connect network manually.
* @hide
*/
public final boolean isUserAllowedToManuallyConnect;
/**
* Whether the suggestion will be initialized as auto-joined or not.
* @hide
*/
public final boolean isInitialAutoJoinEnabled;
/** @hide */
public WifiNetworkSuggestion() {
this.wifiConfiguration = new WifiConfiguration();
this.passpointConfiguration = null;
this.isAppInteractionRequired = false;
this.isUserInteractionRequired = false;
this.isUserAllowedToManuallyConnect = true;
this.isInitialAutoJoinEnabled = true;
}
/** @hide */
public WifiNetworkSuggestion(@NonNull WifiConfiguration networkConfiguration,
@Nullable PasspointConfiguration passpointConfiguration,
boolean isAppInteractionRequired,
boolean isUserInteractionRequired,
boolean isUserAllowedToManuallyConnect,
boolean isInitialAutoJoinEnabled) {
checkNotNull(networkConfiguration);
this.wifiConfiguration = networkConfiguration;
this.passpointConfiguration = passpointConfiguration;
this.isAppInteractionRequired = isAppInteractionRequired;
this.isUserInteractionRequired = isUserInteractionRequired;
this.isUserAllowedToManuallyConnect = isUserAllowedToManuallyConnect;
this.isInitialAutoJoinEnabled = isInitialAutoJoinEnabled;
}
public static final @NonNull Creator<WifiNetworkSuggestion> CREATOR =
new Creator<WifiNetworkSuggestion>() {
@Override
public WifiNetworkSuggestion createFromParcel(Parcel in) {
return new WifiNetworkSuggestion(
in.readParcelable(null), // wifiConfiguration
in.readParcelable(null), // PasspointConfiguration
in.readBoolean(), // isAppInteractionRequired
in.readBoolean(), // isUserInteractionRequired
in.readBoolean(), // isSharedCredentialWithUser
in.readBoolean() // isAutojoinEnabled
);
}
@Override
public WifiNetworkSuggestion[] newArray(int size) {
return new WifiNetworkSuggestion[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(wifiConfiguration, flags);
dest.writeParcelable(passpointConfiguration, flags);
dest.writeBoolean(isAppInteractionRequired);
dest.writeBoolean(isUserInteractionRequired);
dest.writeBoolean(isUserAllowedToManuallyConnect);
dest.writeBoolean(isInitialAutoJoinEnabled);
}
@Override
public int hashCode() {
return Objects.hash(wifiConfiguration.SSID, wifiConfiguration.BSSID,
wifiConfiguration.allowedKeyManagement, wifiConfiguration.getKey());
}
/**
* Equals for network suggestions.
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WifiNetworkSuggestion)) {
return false;
}
WifiNetworkSuggestion lhs = (WifiNetworkSuggestion) obj;
if (this.passpointConfiguration == null ^ lhs.passpointConfiguration == null) {
return false;
}
return TextUtils.equals(this.wifiConfiguration.SSID, lhs.wifiConfiguration.SSID)
&& TextUtils.equals(this.wifiConfiguration.BSSID, lhs.wifiConfiguration.BSSID)
&& Objects.equals(this.wifiConfiguration.allowedKeyManagement,
lhs.wifiConfiguration.allowedKeyManagement)
&& TextUtils.equals(this.wifiConfiguration.getKey(),
lhs.wifiConfiguration.getKey());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("WifiNetworkSuggestion[ ")
.append("SSID=").append(wifiConfiguration.SSID)
.append(", BSSID=").append(wifiConfiguration.BSSID)
.append(", FQDN=").append(wifiConfiguration.FQDN)
.append(", isAppInteractionRequired=").append(isAppInteractionRequired)
.append(", isUserInteractionRequired=").append(isUserInteractionRequired)
.append(", isCredentialSharedWithUser=").append(isUserAllowedToManuallyConnect)
.append(", isInitialAutoJoinEnabled=").append(isInitialAutoJoinEnabled)
.append(", isUnTrusted=").append(!wifiConfiguration.trusted)
.append(" ]");
return sb.toString();
}
/**
* Get the {@link WifiConfiguration} associated with this Suggestion.
* @hide
*/
@SystemApi
@NonNull
public WifiConfiguration getWifiConfiguration() {
return wifiConfiguration;
}
/**
* Get the BSSID, or null if unset.
* @see Builder#setBssid(MacAddress)
*/
@Nullable
public MacAddress getBssid() {
if (wifiConfiguration.BSSID == null) {
return null;
}
return MacAddress.fromString(wifiConfiguration.BSSID);
}
/** @see Builder#setCredentialSharedWithUser(boolean) */
public boolean isCredentialSharedWithUser() {
return isUserAllowedToManuallyConnect;
}
/** @see Builder#setIsAppInteractionRequired(boolean) */
public boolean isAppInteractionRequired() {
return isAppInteractionRequired;
}
/** @see Builder#setIsEnhancedOpen(boolean) */
public boolean isEnhancedOpen() {
return wifiConfiguration.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.OWE);
}
/** @see Builder#setIsHiddenSsid(boolean) */
public boolean isHiddenSsid() {
return wifiConfiguration.hiddenSSID;
}
/** @see Builder#setIsInitialAutojoinEnabled(boolean) */
public boolean isInitialAutojoinEnabled() {
return isInitialAutoJoinEnabled;
}
/** @see Builder#setIsMetered(boolean) */
public boolean isMetered() {
return wifiConfiguration.meteredOverride == WifiConfiguration.METERED_OVERRIDE_METERED;
}
/** @see Builder#setIsUserInteractionRequired(boolean) */
public boolean isUserInteractionRequired() {
return isUserInteractionRequired;
}
/**
* Get the {@link PasspointConfiguration} associated with this Suggestion, or null if this
* Suggestion is not for a Passpoint network.
*/
@Nullable
public PasspointConfiguration getPasspointConfig() {
return passpointConfiguration;
}
/** @see Builder#setPriority(int) */
@IntRange(from = 0)
public int getPriority() {
return wifiConfiguration.priority;
}
/**
* Return the SSID of the network, or null if this is a Passpoint network.
* @see Builder#setSsid(String)
*/
@Nullable
public String getSsid() {
if (wifiConfiguration.SSID == null) {
return null;
}
return WifiInfo.sanitizeSsid(wifiConfiguration.SSID);
}
/** @see Builder#setUntrusted(boolean) */
public boolean isUntrusted() {
return !wifiConfiguration.trusted;
}
/**
* Get the WifiEnterpriseConfig, or null if unset.
* @see Builder#setWapiEnterpriseConfig(WifiEnterpriseConfig)
* @see Builder#setWpa2EnterpriseConfig(WifiEnterpriseConfig)
* @see Builder#setWpa3EnterpriseConfig(WifiEnterpriseConfig)
*/
@Nullable
public WifiEnterpriseConfig getEnterpriseConfig() {
if (!wifiConfiguration.isEnterprise()) {
return null;
}
return wifiConfiguration.enterpriseConfig;
}
/**
* Get the passphrase, or null if unset.
* @see Builder#setWapiPassphrase(String)
* @see Builder#setWpa2Passphrase(String)
* @see Builder#setWpa3Passphrase(String)
*/
@Nullable
public String getPassphrase() {
if (wifiConfiguration.preSharedKey == null) {
return null;
}
return WifiInfo.removeDoubleQuotes(wifiConfiguration.preSharedKey);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,288 +0,0 @@
/*
* Copyright (C) 2012 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.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.util.Arrays;
import java.util.Locale;
/**
* Stores SSID octets and handles conversion.
*
* For Ascii encoded string, any octet < 32 or > 127 is encoded as
* a "\x" followed by the hex representation of the octet.
* Exception chars are ", \, \e, \n, \r, \t which are escaped by a \
* See src/utils/common.c for the implementation in the supplicant.
*
* @hide
*/
public final class WifiSsid implements Parcelable {
private static final String TAG = "WifiSsid";
@UnsupportedAppUsage
public final ByteArrayOutputStream octets = new ByteArrayOutputStream(32);
private static final int HEX_RADIX = 16;
@UnsupportedAppUsage
public static final String NONE = WifiManager.UNKNOWN_SSID;
private WifiSsid() {
}
/**
* Create a WifiSsid from a raw byte array. If the byte array is null, return an empty WifiSsid
* object.
*/
@NonNull
public static WifiSsid createFromByteArray(@Nullable byte[] ssid) {
WifiSsid wifiSsid = new WifiSsid();
if (ssid != null) {
wifiSsid.octets.write(ssid, 0 /* the start offset */, ssid.length);
}
return wifiSsid;
}
@UnsupportedAppUsage
public static WifiSsid createFromAsciiEncoded(String asciiEncoded) {
WifiSsid a = new WifiSsid();
a.convertToBytes(asciiEncoded);
return a;
}
public static WifiSsid createFromHex(String hexStr) {
WifiSsid a = new WifiSsid();
if (hexStr == null) return a;
if (hexStr.startsWith("0x") || hexStr.startsWith("0X")) {
hexStr = hexStr.substring(2);
}
for (int i = 0; i < hexStr.length()-1; i += 2) {
int val;
try {
val = Integer.parseInt(hexStr.substring(i, i + 2), HEX_RADIX);
} catch(NumberFormatException e) {
val = 0;
}
a.octets.write(val);
}
return a;
}
/* This function is equivalent to printf_decode() at src/utils/common.c in
* the supplicant */
private void convertToBytes(String asciiEncoded) {
int i = 0;
int val = 0;
while (i< asciiEncoded.length()) {
char c = asciiEncoded.charAt(i);
switch (c) {
case '\\':
i++;
switch(asciiEncoded.charAt(i)) {
case '\\':
octets.write('\\');
i++;
break;
case '"':
octets.write('"');
i++;
break;
case 'n':
octets.write('\n');
i++;
break;
case 'r':
octets.write('\r');
i++;
break;
case 't':
octets.write('\t');
i++;
break;
case 'e':
octets.write(27); //escape char
i++;
break;
case 'x':
i++;
try {
val = Integer.parseInt(asciiEncoded.substring(i, i + 2), HEX_RADIX);
} catch (NumberFormatException e) {
val = -1;
} catch (StringIndexOutOfBoundsException e) {
val = -1;
}
if (val < 0) {
val = Character.digit(asciiEncoded.charAt(i), HEX_RADIX);
if (val < 0) break;
octets.write(val);
i++;
} else {
octets.write(val);
i += 2;
}
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
val = asciiEncoded.charAt(i) - '0';
i++;
if (asciiEncoded.charAt(i) >= '0' && asciiEncoded.charAt(i) <= '7') {
val = val * 8 + asciiEncoded.charAt(i) - '0';
i++;
}
if (asciiEncoded.charAt(i) >= '0' && asciiEncoded.charAt(i) <= '7') {
val = val * 8 + asciiEncoded.charAt(i) - '0';
i++;
}
octets.write(val);
break;
default:
break;
}
break;
default:
octets.write(c);
i++;
break;
}
}
}
/**
* Converts this SSID to an unquoted UTF-8 String representation.
* @return the SSID string, or {@link WifiManager#UNKNOWN_SSID} if there was an error.
*/
@Override
public String toString() {
byte[] ssidBytes = octets.toByteArray();
// Supplicant returns \x00\x00\x00\x00\x00\x00\x00\x00 hex string
// for a hidden access point. Make sure we maintain the previous
// behavior of returning empty string for this case.
if (octets.size() <= 0 || isArrayAllZeroes(ssidBytes)) return "";
// TODO: Handle conversion to other charsets upon failure
Charset charset = Charset.forName("UTF-8");
CharsetDecoder decoder = charset.newDecoder()
.onMalformedInput(CodingErrorAction.REPLACE)
.onUnmappableCharacter(CodingErrorAction.REPLACE);
CharBuffer out = CharBuffer.allocate(32);
CoderResult result = decoder.decode(ByteBuffer.wrap(ssidBytes), out, true);
out.flip();
if (result.isError()) {
return WifiManager.UNKNOWN_SSID;
}
return out.toString();
}
@Override
public boolean equals(Object thatObject) {
if (this == thatObject) {
return true;
}
if (!(thatObject instanceof WifiSsid)) {
return false;
}
WifiSsid that = (WifiSsid) thatObject;
return Arrays.equals(octets.toByteArray(), that.octets.toByteArray());
}
@Override
public int hashCode() {
return Arrays.hashCode(octets.toByteArray());
}
private boolean isArrayAllZeroes(byte[] ssidBytes) {
for (int i = 0; i< ssidBytes.length; i++) {
if (ssidBytes[i] != 0) return false;
}
return true;
}
/** @hide */
public boolean isHidden() {
return isArrayAllZeroes(octets.toByteArray());
}
/** @hide */
@UnsupportedAppUsage
public byte[] getOctets() {
return octets.toByteArray();
}
/** @hide */
public String getHexString() {
String out = "0x";
byte[] ssidbytes = getOctets();
for (int i = 0; i < octets.size(); i++) {
out += String.format(Locale.US, "%02x", ssidbytes[i]);
}
return (octets.size() > 0) ? out : null;
}
/** Implement the Parcelable interface */
@Override
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeInt(octets.size());
dest.writeByteArray(octets.toByteArray());
}
/** Implement the Parcelable interface */
@UnsupportedAppUsage
public static final @NonNull Creator<WifiSsid> CREATOR =
new Creator<WifiSsid>() {
@Override
public WifiSsid createFromParcel(Parcel in) {
WifiSsid ssid = new WifiSsid();
int length = in.readInt();
byte[] b = new byte[length];
in.readByteArray(b);
ssid.octets.write(b, 0, length);
return ssid;
}
@Override
public WifiSsid[] newArray(int size) {
return new WifiSsid[size];
}
};
}

View File

@@ -1,351 +0,0 @@
/*
* 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.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.Annotation.NetworkType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* This class makes a subset of
* com.android.server.wifi.nano.WifiMetricsProto.WifiUsabilityStatsEntry parcelable.
*
* @hide
*/
@SystemApi
public final class WifiUsabilityStatsEntry implements Parcelable {
/** {@hide} */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"PROBE_STATUS_"}, value = {
PROBE_STATUS_UNKNOWN,
PROBE_STATUS_NO_PROBE,
PROBE_STATUS_SUCCESS,
PROBE_STATUS_FAILURE})
public @interface ProbeStatus {}
/** Link probe status is unknown */
public static final int PROBE_STATUS_UNKNOWN = 0;
/** Link probe is not triggered */
public static final int PROBE_STATUS_NO_PROBE = 1;
/** Link probe is triggered and the result is success */
public static final int PROBE_STATUS_SUCCESS = 2;
/** Link probe is triggered and the result is failure */
public static final int PROBE_STATUS_FAILURE = 3;
/** Absolute milliseconds from device boot when these stats were sampled */
private final long mTimeStampMillis;
/** The RSSI (in dBm) at the sample time */
private final int mRssi;
/** Link speed at the sample time in Mbps */
private final int mLinkSpeedMbps;
/** The total number of tx success counted from the last radio chip reset */
private final long mTotalTxSuccess;
/** The total number of MPDU data packet retries counted from the last radio chip reset */
private final long mTotalTxRetries;
/** The total number of tx bad counted from the last radio chip reset */
private final long mTotalTxBad;
/** The total number of rx success counted from the last radio chip reset */
private final long mTotalRxSuccess;
/** The total time the wifi radio is on in ms counted from the last radio chip reset */
private final long mTotalRadioOnTimeMillis;
/** The total time the wifi radio is doing tx in ms counted from the last radio chip reset */
private final long mTotalRadioTxTimeMillis;
/** The total time the wifi radio is doing rx in ms counted from the last radio chip reset */
private final long mTotalRadioRxTimeMillis;
/** The total time spent on all types of scans in ms counted from the last radio chip reset */
private final long mTotalScanTimeMillis;
/** The total time spent on nan scans in ms counted from the last radio chip reset */
private final long mTotalNanScanTimeMillis;
/** The total time spent on background scans in ms counted from the last radio chip reset */
private final long mTotalBackgroundScanTimeMillis;
/** The total time spent on roam scans in ms counted from the last radio chip reset */
private final long mTotalRoamScanTimeMillis;
/** The total time spent on pno scans in ms counted from the last radio chip reset */
private final long mTotalPnoScanTimeMillis;
/** The total time spent on hotspot2.0 scans and GAS exchange in ms counted from the last radio
* chip reset */
private final long mTotalHotspot2ScanTimeMillis;
/** The total time CCA is on busy status on the current frequency in ms counted from the last
* radio chip reset */
private final long mTotalCcaBusyFreqTimeMillis;
/** The total radio on time on the current frequency from the last radio chip reset */
private final long mTotalRadioOnFreqTimeMillis;
/** The total number of beacons received from the last radio chip reset */
private final long mTotalBeaconRx;
/** The status of link probe since last stats update */
@ProbeStatus private final int mProbeStatusSinceLastUpdate;
/** The elapsed time of the most recent link probe since last stats update */
private final int mProbeElapsedTimeSinceLastUpdateMillis;
/** The MCS rate of the most recent link probe since last stats update */
private final int mProbeMcsRateSinceLastUpdate;
/** Rx link speed at the sample time in Mbps */
private final int mRxLinkSpeedMbps;
private final @NetworkType int mCellularDataNetworkType;
private final int mCellularSignalStrengthDbm;
private final int mCellularSignalStrengthDb;
private final boolean mIsSameRegisteredCell;
/** Constructor function {@hide} */
public WifiUsabilityStatsEntry(long timeStampMillis, int rssi, int linkSpeedMbps,
long totalTxSuccess, long totalTxRetries, long totalTxBad, long totalRxSuccess,
long totalRadioOnTimeMillis, long totalRadioTxTimeMillis, long totalRadioRxTimeMillis,
long totalScanTimeMillis, long totalNanScanTimeMillis,
long totalBackgroundScanTimeMillis,
long totalRoamScanTimeMillis, long totalPnoScanTimeMillis,
long totalHotspot2ScanTimeMillis,
long totalCcaBusyFreqTimeMillis, long totalRadioOnFreqTimeMillis, long totalBeaconRx,
@ProbeStatus int probeStatusSinceLastUpdate, int probeElapsedTimeSinceLastUpdateMillis,
int probeMcsRateSinceLastUpdate, int rxLinkSpeedMbps,
@NetworkType int cellularDataNetworkType,
int cellularSignalStrengthDbm, int cellularSignalStrengthDb,
boolean isSameRegisteredCell) {
mTimeStampMillis = timeStampMillis;
mRssi = rssi;
mLinkSpeedMbps = linkSpeedMbps;
mTotalTxSuccess = totalTxSuccess;
mTotalTxRetries = totalTxRetries;
mTotalTxBad = totalTxBad;
mTotalRxSuccess = totalRxSuccess;
mTotalRadioOnTimeMillis = totalRadioOnTimeMillis;
mTotalRadioTxTimeMillis = totalRadioTxTimeMillis;
mTotalRadioRxTimeMillis = totalRadioRxTimeMillis;
mTotalScanTimeMillis = totalScanTimeMillis;
mTotalNanScanTimeMillis = totalNanScanTimeMillis;
mTotalBackgroundScanTimeMillis = totalBackgroundScanTimeMillis;
mTotalRoamScanTimeMillis = totalRoamScanTimeMillis;
mTotalPnoScanTimeMillis = totalPnoScanTimeMillis;
mTotalHotspot2ScanTimeMillis = totalHotspot2ScanTimeMillis;
mTotalCcaBusyFreqTimeMillis = totalCcaBusyFreqTimeMillis;
mTotalRadioOnFreqTimeMillis = totalRadioOnFreqTimeMillis;
mTotalBeaconRx = totalBeaconRx;
mProbeStatusSinceLastUpdate = probeStatusSinceLastUpdate;
mProbeElapsedTimeSinceLastUpdateMillis = probeElapsedTimeSinceLastUpdateMillis;
mProbeMcsRateSinceLastUpdate = probeMcsRateSinceLastUpdate;
mRxLinkSpeedMbps = rxLinkSpeedMbps;
mCellularDataNetworkType = cellularDataNetworkType;
mCellularSignalStrengthDbm = cellularSignalStrengthDbm;
mCellularSignalStrengthDb = cellularSignalStrengthDb;
mIsSameRegisteredCell = isSameRegisteredCell;
}
/** Implement the Parcelable interface */
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(mTimeStampMillis);
dest.writeInt(mRssi);
dest.writeInt(mLinkSpeedMbps);
dest.writeLong(mTotalTxSuccess);
dest.writeLong(mTotalTxRetries);
dest.writeLong(mTotalTxBad);
dest.writeLong(mTotalRxSuccess);
dest.writeLong(mTotalRadioOnTimeMillis);
dest.writeLong(mTotalRadioTxTimeMillis);
dest.writeLong(mTotalRadioRxTimeMillis);
dest.writeLong(mTotalScanTimeMillis);
dest.writeLong(mTotalNanScanTimeMillis);
dest.writeLong(mTotalBackgroundScanTimeMillis);
dest.writeLong(mTotalRoamScanTimeMillis);
dest.writeLong(mTotalPnoScanTimeMillis);
dest.writeLong(mTotalHotspot2ScanTimeMillis);
dest.writeLong(mTotalCcaBusyFreqTimeMillis);
dest.writeLong(mTotalRadioOnFreqTimeMillis);
dest.writeLong(mTotalBeaconRx);
dest.writeInt(mProbeStatusSinceLastUpdate);
dest.writeInt(mProbeElapsedTimeSinceLastUpdateMillis);
dest.writeInt(mProbeMcsRateSinceLastUpdate);
dest.writeInt(mRxLinkSpeedMbps);
dest.writeInt(mCellularDataNetworkType);
dest.writeInt(mCellularSignalStrengthDbm);
dest.writeInt(mCellularSignalStrengthDb);
dest.writeBoolean(mIsSameRegisteredCell);
}
/** Implement the Parcelable interface */
public static final @android.annotation.NonNull Creator<WifiUsabilityStatsEntry> CREATOR =
new Creator<WifiUsabilityStatsEntry>() {
public WifiUsabilityStatsEntry createFromParcel(Parcel in) {
return new WifiUsabilityStatsEntry(
in.readLong(), in.readInt(),
in.readInt(), in.readLong(), in.readLong(),
in.readLong(), in.readLong(), in.readLong(),
in.readLong(), in.readLong(), in.readLong(),
in.readLong(), in.readLong(), in.readLong(),
in.readLong(), in.readLong(), in.readLong(),
in.readLong(), in.readLong(), in.readInt(),
in.readInt(), in.readInt(), in.readInt(),
in.readInt(), in.readInt(), in.readInt(),
in.readBoolean()
);
}
public WifiUsabilityStatsEntry[] newArray(int size) {
return new WifiUsabilityStatsEntry[size];
}
};
/** Absolute milliseconds from device boot when these stats were sampled */
public long getTimeStampMillis() {
return mTimeStampMillis;
}
/** The RSSI (in dBm) at the sample time */
public int getRssi() {
return mRssi;
}
/** Link speed at the sample time in Mbps */
public int getLinkSpeedMbps() {
return mLinkSpeedMbps;
}
/** The total number of tx success counted from the last radio chip reset */
public long getTotalTxSuccess() {
return mTotalTxSuccess;
}
/** The total number of MPDU data packet retries counted from the last radio chip reset */
public long getTotalTxRetries() {
return mTotalTxRetries;
}
/** The total number of tx bad counted from the last radio chip reset */
public long getTotalTxBad() {
return mTotalTxBad;
}
/** The total number of rx success counted from the last radio chip reset */
public long getTotalRxSuccess() {
return mTotalRxSuccess;
}
/** The total time the wifi radio is on in ms counted from the last radio chip reset */
public long getTotalRadioOnTimeMillis() {
return mTotalRadioOnTimeMillis;
}
/** The total time the wifi radio is doing tx in ms counted from the last radio chip reset */
public long getTotalRadioTxTimeMillis() {
return mTotalRadioTxTimeMillis;
}
/** The total time the wifi radio is doing rx in ms counted from the last radio chip reset */
public long getTotalRadioRxTimeMillis() {
return mTotalRadioRxTimeMillis;
}
/** The total time spent on all types of scans in ms counted from the last radio chip reset */
public long getTotalScanTimeMillis() {
return mTotalScanTimeMillis;
}
/** The total time spent on nan scans in ms counted from the last radio chip reset */
public long getTotalNanScanTimeMillis() {
return mTotalNanScanTimeMillis;
}
/** The total time spent on background scans in ms counted from the last radio chip reset */
public long getTotalBackgroundScanTimeMillis() {
return mTotalBackgroundScanTimeMillis;
}
/** The total time spent on roam scans in ms counted from the last radio chip reset */
public long getTotalRoamScanTimeMillis() {
return mTotalRoamScanTimeMillis;
}
/** The total time spent on pno scans in ms counted from the last radio chip reset */
public long getTotalPnoScanTimeMillis() {
return mTotalPnoScanTimeMillis;
}
/** The total time spent on hotspot2.0 scans and GAS exchange in ms counted from the last radio
* chip reset */
public long getTotalHotspot2ScanTimeMillis() {
return mTotalHotspot2ScanTimeMillis;
}
/** The total time CCA is on busy status on the current frequency in ms counted from the last
* radio chip reset */
public long getTotalCcaBusyFreqTimeMillis() {
return mTotalCcaBusyFreqTimeMillis;
}
/** The total radio on time on the current frequency from the last radio chip reset */
public long getTotalRadioOnFreqTimeMillis() {
return mTotalRadioOnFreqTimeMillis;
}
/** The total number of beacons received from the last radio chip reset */
public long getTotalBeaconRx() {
return mTotalBeaconRx;
}
/** The status of link probe since last stats update */
@ProbeStatus public int getProbeStatusSinceLastUpdate() {
return mProbeStatusSinceLastUpdate;
}
/** The elapsed time of the most recent link probe since last stats update */
public int getProbeElapsedTimeSinceLastUpdateMillis() {
return mProbeElapsedTimeSinceLastUpdateMillis;
}
/** The MCS rate of the most recent link probe since last stats update */
public int getProbeMcsRateSinceLastUpdate() {
return mProbeMcsRateSinceLastUpdate;
}
/** Rx link speed at the sample time in Mbps */
public int getRxLinkSpeedMbps() {
return mRxLinkSpeedMbps;
}
/** Cellular data network type currently in use on the device for data transmission */
@NetworkType public int getCellularDataNetworkType() {
return mCellularDataNetworkType;
}
/**
* Cellular signal strength in dBm, NR: CsiRsrp, LTE: Rsrp, WCDMA/TDSCDMA: Rscp,
* CDMA: Rssi, EVDO: Rssi, GSM: Rssi
*/
public int getCellularSignalStrengthDbm() {
return mCellularSignalStrengthDbm;
}
/**
* Cellular signal strength in dB, NR: CsiSinr, LTE: Rsrq, WCDMA: EcNo, TDSCDMA: invalid,
* CDMA: Ecio, EVDO: SNR, GSM: invalid
*/
public int getCellularSignalStrengthDb() {
return mCellularSignalStrengthDb;
}
/** Whether the primary registered cell of current entry is same as that of previous entry */
public boolean isSameRegisteredCell() {
return mIsSameRegisteredCell;
}
}

View File

@@ -1,102 +0,0 @@
/*
* Copyright (C) 2011 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.os.Parcel;
import android.os.Parcelable;
/**
* A class representing Wi-Fi Protected Setup
*
* {@see android.net.wifi.p2p.WifiP2pConfig}
*/
public class WpsInfo implements Parcelable {
/** Push button configuration */
public static final int PBC = 0;
/** Display pin method configuration - pin is generated and displayed on device */
public static final int DISPLAY = 1;
/** Keypad pin method configuration - pin is entered on device */
public static final int KEYPAD = 2;
/** Label pin method configuration - pin is labelled on device */
public static final int LABEL = 3;
/** Invalid configuration */
public static final int INVALID = 4;
/** Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details */
public int setup;
/** Passed with pin method KEYPAD */
public String BSSID;
/** Passed with pin method configuration */
public String pin;
public WpsInfo() {
setup = INVALID;
BSSID = null;
pin = null;
}
public String toString() {
StringBuffer sbuf = new StringBuffer();
sbuf.append(" setup: ").append(setup);
sbuf.append('\n');
sbuf.append(" BSSID: ").append(BSSID);
sbuf.append('\n');
sbuf.append(" pin: ").append(pin);
sbuf.append('\n');
return sbuf.toString();
}
/** Implement the Parcelable interface */
public int describeContents() {
return 0;
}
/* Copy constructor */
public WpsInfo(WpsInfo source) {
if (source != null) {
setup = source.setup;
BSSID = source.BSSID;
pin = source.pin;
}
}
/** Implement the Parcelable interface */
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(setup);
dest.writeString(BSSID);
dest.writeString(pin);
}
/** Implement the Parcelable interface */
public static final @android.annotation.NonNull Creator<WpsInfo> CREATOR =
new Creator<WpsInfo>() {
public WpsInfo createFromParcel(Parcel in) {
WpsInfo config = new WpsInfo();
config.setup = in.readInt();
config.BSSID = in.readString();
config.pin = in.readString();
return config;
}
public WpsInfo[] newArray(int size) {
return new WpsInfo[size];
}
};
}

View File

@@ -1,45 +0,0 @@
/*
* Copyright (C) 2016 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.aware;
/**
* Base class for Aware attach callbacks. Should be extended by applications and set when calling
* {@link WifiAwareManager#attach(AttachCallback, android.os.Handler)}. These are callbacks
* applying to the Aware connection as a whole - not to specific publish or subscribe sessions -
* for that see {@link DiscoverySessionCallback}.
*/
public class AttachCallback {
/**
* Called when Aware attach operation
* {@link WifiAwareManager#attach(AttachCallback, android.os.Handler)}
* is completed and that we can now start discovery sessions or connections.
*
* @param session The Aware object on which we can execute further Aware operations - e.g.
* discovery, connections.
*/
public void onAttached(WifiAwareSession session) {
/* empty */
}
/**
* Called when Aware attach operation
* {@link WifiAwareManager#attach(AttachCallback, android.os.Handler)} failed.
*/
public void onAttachFailed() {
/* empty */
}
}

View File

@@ -1,138 +0,0 @@
/*
* Copyright (C) 2016 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.aware;
import android.annotation.IntDef;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* The characteristics of the Wi-Fi Aware implementation.
*/
public final class Characteristics implements Parcelable {
/** @hide */
public static final String KEY_MAX_SERVICE_NAME_LENGTH = "key_max_service_name_length";
/** @hide */
public static final String KEY_MAX_SERVICE_SPECIFIC_INFO_LENGTH =
"key_max_service_specific_info_length";
/** @hide */
public static final String KEY_MAX_MATCH_FILTER_LENGTH = "key_max_match_filter_length";
/** @hide */
public static final String KEY_SUPPORTED_CIPHER_SUITES = "key_supported_cipher_suites";
private Bundle mCharacteristics = new Bundle();
/** @hide : should not be created by apps */
public Characteristics(Bundle characteristics) {
mCharacteristics = characteristics;
}
/**
* Returns the maximum string length that can be used to specify a Aware service name. Restricts
* the parameters of the {@link PublishConfig.Builder#setServiceName(String)} and
* {@link SubscribeConfig.Builder#setServiceName(String)}.
*
* @return A positive integer, maximum string length of Aware service name.
*/
public int getMaxServiceNameLength() {
return mCharacteristics.getInt(KEY_MAX_SERVICE_NAME_LENGTH);
}
/**
* Returns the maximum length of byte array that can be used to specify a Aware service specific
* information field: the arbitrary load used in discovery or the message length of Aware
* message exchange. Restricts the parameters of the
* {@link PublishConfig.Builder#setServiceSpecificInfo(byte[])},
* {@link SubscribeConfig.Builder#setServiceSpecificInfo(byte[])}, and
* {@link DiscoverySession#sendMessage(PeerHandle, int, byte[])}
* variants.
*
* @return A positive integer, maximum length of byte array for Aware messaging.
*/
public int getMaxServiceSpecificInfoLength() {
return mCharacteristics.getInt(KEY_MAX_SERVICE_SPECIFIC_INFO_LENGTH);
}
/**
* Returns the maximum length of byte array that can be used to specify a Aware match filter.
* Restricts the parameters of the
* {@link PublishConfig.Builder#setMatchFilter(java.util.List)} and
* {@link SubscribeConfig.Builder#setMatchFilter(java.util.List)}.
*
* @return A positive integer, maximum length of byte array for Aware discovery match filter.
*/
public int getMaxMatchFilterLength() {
return mCharacteristics.getInt(KEY_MAX_MATCH_FILTER_LENGTH);
}
/** @hide */
@IntDef(flag = true, prefix = { "WIFI_AWARE_CIPHER_SUITE_" }, value = {
WIFI_AWARE_CIPHER_SUITE_NCS_SK_128,
WIFI_AWARE_CIPHER_SUITE_NCS_SK_256,
})
@Retention(RetentionPolicy.SOURCE)
public @interface WifiAwareCipherSuites {}
/**
* Wi-Fi Aware supported ciphier suite representing NCS SK 128: 128 bit shared-key.
*/
public static final int WIFI_AWARE_CIPHER_SUITE_NCS_SK_128 = 1 << 0;
/**
* Wi-Fi Aware supported ciphier suite representing NCS SK 256: 256 bit shared-key.
*/
public static final int WIFI_AWARE_CIPHER_SUITE_NCS_SK_256 = 1 << 1;
/**
* Returns the set of cipher suites supported by the device for use in Wi-Fi Aware data-paths.
* The device automatically picks the strongest cipher suite when initiating a data-path setup.
*
* @return A set of flags from {@link #WIFI_AWARE_CIPHER_SUITE_NCS_SK_128}, or
* {@link #WIFI_AWARE_CIPHER_SUITE_NCS_SK_256}.
*/
public @WifiAwareCipherSuites int getSupportedCipherSuites() {
return mCharacteristics.getInt(KEY_SUPPORTED_CIPHER_SUITES);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeBundle(mCharacteristics);
}
@Override
public int describeContents() {
return 0;
}
public static final @android.annotation.NonNull Creator<Characteristics> CREATOR =
new Creator<Characteristics>() {
@Override
public Characteristics createFromParcel(Parcel in) {
Characteristics c = new Characteristics(in.readBundle());
return c;
}
@Override
public Characteristics[] newArray(int size) {
return new Characteristics[size];
}
};
}

View File

@@ -1,19 +0,0 @@
/*
* Copyright (C) 2016 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.aware;
parcelable ConfigRequest;

Some files were not shown because too many files have changed in this diff Show More