diff options
| author | 2016-12-07 22:56:57 +0000 | |
|---|---|---|
| committer | 2016-12-07 22:56:58 +0000 | |
| commit | 2007ee8de375cc69ebdf57815f2ede0a35a227ca (patch) | |
| tree | 2887e7871fe47c54b5db2df5fb41c506d2f2fcb2 | |
| parent | c69b210ec812772be12a819d26241ad0e4be42bd (diff) | |
| parent | 1ff5bd2646b5876121374f13deb96d3c1a21145e (diff) | |
Merge "Remove user-triggered disconnect counters"
| -rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 75 | ||||
| -rw-r--r-- | wifi/tests/src/android/net/wifi/WifiConfigurationTest.java | 69 |
2 files changed, 69 insertions, 75 deletions
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index 69e9fcdbd1e6..43e624667644 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -746,50 +746,6 @@ public class WifiConfiguration implements Parcelable { @SystemApi public int numAssociation; - /** - * @hide - * Number of time user disabled WiFi while associated to this configuration with Low RSSI. - */ - public int numUserTriggeredWifiDisableLowRSSI; - - /** - * @hide - * Number of time user disabled WiFi while associated to this configuration with Bad RSSI. - */ - public int numUserTriggeredWifiDisableBadRSSI; - - /** - * @hide - * Number of time user disabled WiFi while associated to this configuration - * and RSSI was not HIGH. - */ - public int numUserTriggeredWifiDisableNotHighRSSI; - - /** - * @hide - * Number of ticks associated to this configuration with Low RSSI. - */ - public int numTicksAtLowRSSI; - - /** - * @hide - * Number of ticks associated to this configuration with Bad RSSI. - */ - public int numTicksAtBadRSSI; - - /** - * @hide - * Number of ticks associated to this configuration - * and RSSI was not HIGH. - */ - public int numTicksAtNotHighRSSI; - /** - * @hide - * Number of time user (WifiManager) triggered association to this configuration. - * TODO: count this only for Wifi Settings uuid, so as to not count 3rd party apps - */ - public int numUserTriggeredJoinAttempts; - /** @hide * Boost given to RSSI on a home network for the purpose of calculating the score * This adds stickiness to home networks, as defined by: @@ -1630,16 +1586,6 @@ public class WifiConfiguration implements Parcelable { sbuf.append('\n'); } } - sbuf.append("triggeredLow: ").append(this.numUserTriggeredWifiDisableLowRSSI); - sbuf.append(" triggeredBad: ").append(this.numUserTriggeredWifiDisableBadRSSI); - sbuf.append(" triggeredNotHigh: ").append(this.numUserTriggeredWifiDisableNotHighRSSI); - sbuf.append('\n'); - sbuf.append("ticksLow: ").append(this.numTicksAtLowRSSI); - sbuf.append(" ticksBad: ").append(this.numTicksAtBadRSSI); - sbuf.append(" ticksNotHigh: ").append(this.numTicksAtNotHighRSSI); - sbuf.append('\n'); - sbuf.append("triggeredJoin: ").append(this.numUserTriggeredJoinAttempts); - sbuf.append('\n'); return sbuf.toString(); } @@ -1946,13 +1892,6 @@ public class WifiConfiguration implements Parcelable { numScorerOverride = source.numScorerOverride; numScorerOverrideAndSwitchedNetwork = source.numScorerOverrideAndSwitchedNetwork; numAssociation = source.numAssociation; - numUserTriggeredWifiDisableLowRSSI = source.numUserTriggeredWifiDisableLowRSSI; - numUserTriggeredWifiDisableBadRSSI = source.numUserTriggeredWifiDisableBadRSSI; - numUserTriggeredWifiDisableNotHighRSSI = source.numUserTriggeredWifiDisableNotHighRSSI; - numTicksAtLowRSSI = source.numTicksAtLowRSSI; - numTicksAtBadRSSI = source.numTicksAtBadRSSI; - numTicksAtNotHighRSSI = source.numTicksAtNotHighRSSI; - numUserTriggeredJoinAttempts = source.numUserTriggeredJoinAttempts; userApproved = source.userApproved; numNoInternetAccessReports = source.numNoInternetAccessReports; noInternetAccessExpected = source.noInternetAccessExpected; @@ -2018,13 +1957,6 @@ public class WifiConfiguration implements Parcelable { dest.writeInt(numScorerOverride); dest.writeInt(numScorerOverrideAndSwitchedNetwork); dest.writeInt(numAssociation); - dest.writeInt(numUserTriggeredWifiDisableLowRSSI); - dest.writeInt(numUserTriggeredWifiDisableBadRSSI); - dest.writeInt(numUserTriggeredWifiDisableNotHighRSSI); - dest.writeInt(numTicksAtLowRSSI); - dest.writeInt(numTicksAtBadRSSI); - dest.writeInt(numTicksAtNotHighRSSI); - dest.writeInt(numUserTriggeredJoinAttempts); dest.writeInt(userApproved); dest.writeInt(numNoInternetAccessReports); dest.writeInt(noInternetAccessExpected ? 1 : 0); @@ -2090,13 +2022,6 @@ public class WifiConfiguration implements Parcelable { config.numScorerOverride = in.readInt(); config.numScorerOverrideAndSwitchedNetwork = in.readInt(); config.numAssociation = in.readInt(); - config.numUserTriggeredWifiDisableLowRSSI = in.readInt(); - config.numUserTriggeredWifiDisableBadRSSI = in.readInt(); - config.numUserTriggeredWifiDisableNotHighRSSI = in.readInt(); - config.numTicksAtLowRSSI = in.readInt(); - config.numTicksAtBadRSSI = in.readInt(); - config.numTicksAtNotHighRSSI = in.readInt(); - config.numUserTriggeredJoinAttempts = in.readInt(); config.userApproved = in.readInt(); config.numNoInternetAccessReports = in.readInt(); config.noInternetAccessExpected = in.readInt() != 0; diff --git a/wifi/tests/src/android/net/wifi/WifiConfigurationTest.java b/wifi/tests/src/android/net/wifi/WifiConfigurationTest.java new file mode 100644 index 000000000000..5f9497474a77 --- /dev/null +++ b/wifi/tests/src/android/net/wifi/WifiConfigurationTest.java @@ -0,0 +1,69 @@ +/* + * 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 static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import android.os.Parcel; + +import org.junit.Before; +import org.junit.Test; + +/** + * Unit tests for {@link android.net.wifi.WifiConfiguration}. + */ +public class WifiConfigurationTest { + + @Before + public void setUp() { + } + + /** + * Check that parcel marshalling/unmarshalling works + * + * Create and populate a WifiConfiguration. + * Marshall and unmashall it, and expect to recover a copy of the original. + * Marshall the resulting object, and expect the bytes to match the + * first marshall result. + */ + @Test + public void testWifiConfigurationParcel() { + String cookie = "C O.o |<IE"; + WifiConfiguration config = new WifiConfiguration(); + config.setPasspointManagementObjectTree(cookie); + Parcel parcelW = Parcel.obtain(); + config.writeToParcel(parcelW, 0); + byte[] bytes = parcelW.marshall(); + parcelW.recycle(); + + Parcel parcelR = Parcel.obtain(); + parcelR.unmarshall(bytes, 0, bytes.length); + parcelR.setDataPosition(0); + WifiConfiguration reconfig = WifiConfiguration.CREATOR.createFromParcel(parcelR); + + // lacking a useful config.equals, check one field near the end. + assertEquals(cookie, reconfig.getMoTree()); + + Parcel parcelWW = Parcel.obtain(); + reconfig.writeToParcel(parcelWW, 0); + byte[] rebytes = parcelWW.marshall(); + parcelWW.recycle(); + + assertArrayEquals(bytes, rebytes); + } +} |