Delete WifiManager API - getConnectionStatistics
Bug: 70901977 Test: compie, run ./frameworks/base/wifi/tests/runtests.sh Change-Id: If425576642e1a2a055ea5459d1f4440bdde48f9f
This commit is contained in:
@@ -126,25 +126,6 @@ package android.net.wifi {
|
||||
field public boolean untrusted;
|
||||
}
|
||||
|
||||
public class WifiConnectionStatistics implements android.os.Parcelable {
|
||||
ctor public WifiConnectionStatistics();
|
||||
ctor public WifiConnectionStatistics(android.net.wifi.WifiConnectionStatistics);
|
||||
method public int describeContents();
|
||||
method public void incrementOrAddUntrusted(java.lang.String, int, int);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.net.wifi.WifiConnectionStatistics> CREATOR;
|
||||
field public int num24GhzConnected;
|
||||
field public int num5GhzConnected;
|
||||
field public int numAutoJoinAttempt;
|
||||
field public int numAutoRoamAttempt;
|
||||
field public int numWifiManagerJoinAttempt;
|
||||
field public java.util.HashMap<java.lang.String, android.net.wifi.WifiNetworkConnectionStatistics> untrustedNetworkHistory;
|
||||
}
|
||||
|
||||
public class WifiManager {
|
||||
method public android.net.wifi.WifiConnectionStatistics getConnectionStatistics();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.os {
|
||||
|
||||
@@ -28,7 +28,6 @@ import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.ScanSettings;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.PasspointManagementObjectDefinition;
|
||||
import android.net.wifi.WifiConnectionStatistics;
|
||||
import android.net.wifi.WifiActivityEnergyInfo;
|
||||
import android.net.Network;
|
||||
|
||||
@@ -166,8 +165,6 @@ interface IWifiManager
|
||||
|
||||
void enableWifiConnectivityManager(boolean enabled);
|
||||
|
||||
WifiConnectionStatistics getConnectionStatistics();
|
||||
|
||||
void disableEphemeralNetwork(String SSID);
|
||||
|
||||
void factoryReset();
|
||||
|
||||
@@ -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 WifiConnectionStatistics;
|
||||
@@ -1,158 +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.SystemApi;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Wifi Connection Statistics: gather various stats regarding WiFi connections,
|
||||
* connection requests, auto-join
|
||||
* and WiFi usage.
|
||||
* @hide
|
||||
* @removed
|
||||
*/
|
||||
@SystemApi
|
||||
public class WifiConnectionStatistics implements Parcelable {
|
||||
private static final String TAG = "WifiConnnectionStatistics";
|
||||
|
||||
/**
|
||||
* history of past connection to untrusted SSID
|
||||
* Key = SSID
|
||||
* Value = num connection
|
||||
*/
|
||||
public HashMap<String, WifiNetworkConnectionStatistics> untrustedNetworkHistory;
|
||||
|
||||
// Number of time we polled the chip and were on 5GHz
|
||||
public int num5GhzConnected;
|
||||
|
||||
// Number of time we polled the chip and were on 2.4GHz
|
||||
public int num24GhzConnected;
|
||||
|
||||
// Number autojoin attempts
|
||||
public int numAutoJoinAttempt;
|
||||
|
||||
// Number auto-roam attempts
|
||||
public int numAutoRoamAttempt;
|
||||
|
||||
// Number wifimanager join attempts
|
||||
public int numWifiManagerJoinAttempt;
|
||||
|
||||
public WifiConnectionStatistics() {
|
||||
untrustedNetworkHistory = new HashMap<String, WifiNetworkConnectionStatistics>();
|
||||
}
|
||||
|
||||
public void incrementOrAddUntrusted(String SSID, int connection, int usage) {
|
||||
WifiNetworkConnectionStatistics stats;
|
||||
if (TextUtils.isEmpty(SSID))
|
||||
return;
|
||||
if (untrustedNetworkHistory.containsKey(SSID)) {
|
||||
stats = untrustedNetworkHistory.get(SSID);
|
||||
if (stats != null){
|
||||
stats.numConnection = connection + stats.numConnection;
|
||||
stats.numUsage = usage + stats.numUsage;
|
||||
}
|
||||
} else {
|
||||
stats = new WifiNetworkConnectionStatistics(connection, usage);
|
||||
}
|
||||
if (stats != null) {
|
||||
untrustedNetworkHistory.put(SSID, stats);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sbuf = new StringBuilder();
|
||||
sbuf.append("Connected on: 2.4Ghz=").append(num24GhzConnected);
|
||||
sbuf.append(" 5Ghz=").append(num5GhzConnected).append("\n");
|
||||
sbuf.append(" join=").append(numWifiManagerJoinAttempt);
|
||||
sbuf.append("\\").append(numAutoJoinAttempt).append("\n");
|
||||
sbuf.append(" roam=").append(numAutoRoamAttempt).append("\n");
|
||||
|
||||
for (String Key : untrustedNetworkHistory.keySet()) {
|
||||
WifiNetworkConnectionStatistics stats = untrustedNetworkHistory.get(Key);
|
||||
if (stats != null) {
|
||||
sbuf.append(Key).append(" ").append(stats.toString()).append("\n");
|
||||
}
|
||||
}
|
||||
return sbuf.toString();
|
||||
}
|
||||
|
||||
/** copy constructor*/
|
||||
public WifiConnectionStatistics(WifiConnectionStatistics source) {
|
||||
untrustedNetworkHistory = new HashMap<String, WifiNetworkConnectionStatistics>();
|
||||
if (source != null) {
|
||||
untrustedNetworkHistory.putAll(source.untrustedNetworkHistory);
|
||||
}
|
||||
}
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(num24GhzConnected);
|
||||
dest.writeInt(num5GhzConnected);
|
||||
dest.writeInt(numAutoJoinAttempt);
|
||||
dest.writeInt(numAutoRoamAttempt);
|
||||
dest.writeInt(numWifiManagerJoinAttempt);
|
||||
|
||||
dest.writeInt(untrustedNetworkHistory.size());
|
||||
for (String Key : untrustedNetworkHistory.keySet()) {
|
||||
WifiNetworkConnectionStatistics num = untrustedNetworkHistory.get(Key);
|
||||
dest.writeString(Key);
|
||||
dest.writeInt(num.numConnection);
|
||||
dest.writeInt(num.numUsage);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
public static final Creator<WifiConnectionStatistics> CREATOR =
|
||||
new Creator<WifiConnectionStatistics>() {
|
||||
public WifiConnectionStatistics createFromParcel(Parcel in) {
|
||||
WifiConnectionStatistics stats = new WifiConnectionStatistics();
|
||||
stats.num24GhzConnected = in.readInt();
|
||||
stats.num5GhzConnected = in.readInt();
|
||||
stats.numAutoJoinAttempt = in.readInt();
|
||||
stats.numAutoRoamAttempt = in.readInt();
|
||||
stats.numWifiManagerJoinAttempt = in.readInt();
|
||||
int n = in.readInt();
|
||||
while (n-- > 0) {
|
||||
String Key = in.readString();
|
||||
int numConnection = in.readInt();
|
||||
int numUsage = in.readInt();
|
||||
WifiNetworkConnectionStatistics st =
|
||||
new WifiNetworkConnectionStatistics(numConnection, numUsage);
|
||||
stats.untrustedNetworkHistory.put(Key, st);
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
|
||||
public WifiConnectionStatistics[] newArray(int size) {
|
||||
return new WifiConnectionStatistics[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -998,20 +998,6 @@ public class WifiManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* @removed
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_WIFI_CREDENTIAL)
|
||||
public WifiConnectionStatistics getConnectionStatistics() {
|
||||
try {
|
||||
return mService.getConnectionStatistics();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a WifiConfiguration matching this ScanResult
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user