summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2018-10-10 16:49:03 -0700
committerDavid Su <dysu@google.com>2018-10-10 16:58:25 -0700
commitf2f61212b1025e2e19148d5d5f08fdce64b16799 (patch)
tree1af0ef65829c1740f7b5847dfc694c71afc89b56 /service
parent1223e9aa52466139b4de0637c4f9dd3d00b8b20b (diff)
Moved WifiWakeReasonAndCounts into opt/net/wifi
Moved WifiWakeReasonAndCounts from base/wifi into opt/net/wifi and renamed it to WlanWakeReasonAndCounts. This class is only used internally and not exposed in the public API, so it did not make sense to leave it in base/wifi. Renamed it to WlanWakeReasonAndCounts to reduce confusion between this class and the "Wifi Wake" feature. Bug: 73503971 Change-Id: Ie1a1c9f742a5104e5fba943d8ea8186438349b37 Fix: 73503971 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java5
-rw-r--r--service/java/com/android/server/wifi/WifiVendorHal.java9
-rw-r--r--service/java/com/android/server/wifi/WlanWakeReasonAndCounts.java164
3 files changed, 170 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index 29b38aed7..ab5b7f08f 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -25,7 +25,6 @@ import android.net.apf.ApfCapabilities;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiScanner;
-import android.net.wifi.WifiWakeReasonAndCounts;
import android.os.INetworkManagementService;
import android.os.RemoteException;
import android.os.SystemClock;
@@ -2793,9 +2792,9 @@ public class WifiNative {
/**
* Fetch the host wakeup reasons stats from wlan driver.
*
- * @return the |WifiWakeReasonAndCounts| object retrieved from the wlan driver.
+ * @return the |WlanWakeReasonAndCounts| object retrieved from the wlan driver.
*/
- public WifiWakeReasonAndCounts getWlanWakeReasonCount() {
+ public WlanWakeReasonAndCounts getWlanWakeReasonCount() {
return mWifiVendorHal.getWlanWakeReasonCount();
}
diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java
index 77da7667f..25b6fc4ea 100644
--- a/service/java/com/android/server/wifi/WifiVendorHal.java
+++ b/service/java/com/android/server/wifi/WifiVendorHal.java
@@ -52,7 +52,6 @@ import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiScanner;
import android.net.wifi.WifiSsid;
-import android.net.wifi.WifiWakeReasonAndCounts;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
@@ -1963,10 +1962,10 @@ public class WifiVendorHal {
* @param h - Hal version of wake reason stats
* @return framework version of same
*/
- private static WifiWakeReasonAndCounts halToFrameworkWakeReasons(
+ private static WlanWakeReasonAndCounts halToFrameworkWakeReasons(
WifiDebugHostWakeReasonStats h) {
if (h == null) return null;
- WifiWakeReasonAndCounts ans = new WifiWakeReasonAndCounts();
+ WlanWakeReasonAndCounts ans = new WlanWakeReasonAndCounts();
ans.totalCmdEventWake = h.totalCmdEventWakeCnt;
ans.totalDriverFwLocalWake = h.totalDriverFwLocalWakeCnt;
ans.totalRxDataWake = h.totalRxPacketWakeCnt;
@@ -1989,9 +1988,9 @@ public class WifiVendorHal {
/**
* Fetch the host wakeup reasons stats from wlan driver.
*
- * @return the |WifiWakeReasonAndCounts| from the wlan driver, or null on failure.
+ * @return the |WlanWakeReasonAndCounts| from the wlan driver, or null on failure.
*/
- public WifiWakeReasonAndCounts getWlanWakeReasonCount() {
+ public WlanWakeReasonAndCounts getWlanWakeReasonCount() {
class AnswerBox {
public WifiDebugHostWakeReasonStats value = null;
}
diff --git a/service/java/com/android/server/wifi/WlanWakeReasonAndCounts.java b/service/java/com/android/server/wifi/WlanWakeReasonAndCounts.java
new file mode 100644
index 000000000..3311ec7d6
--- /dev/null
+++ b/service/java/com/android/server/wifi/WlanWakeReasonAndCounts.java
@@ -0,0 +1,164 @@
+/*
+ * 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 com.android.server.wifi;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A class representing WLAN wake reason accounting.
+ */
+
+/** @hide */
+public class WlanWakeReasonAndCounts implements Parcelable {
+ private static final String TAG = "WlanWakeReasonAndCounts";
+ /**
+ * Wlan can wake host, only when it is cmd/event, local driver-fw
+ * functions(non-data, non cmd/event) and rx data.The first packet
+ * from wlan that woke up a sleep host is what is accounted here.
+ * Total wlan wake to application processor would be:
+ * [cmdEventWake + driverFwLocalWake + totalRxDataWake]
+ * A further classification is provided for identifying the reasons
+ * for wakeup.
+ */
+ public int totalCmdEventWake;
+ public int totalDriverFwLocalWake;
+ public int totalRxDataWake;
+
+ public int rxUnicast;
+ public int rxMulticast;
+ public int rxBroadcast;
+
+ public int icmp;
+ public int icmp6;
+ public int icmp6Ra;
+ public int icmp6Na;
+ public int icmp6Ns;
+
+ public int ipv4RxMulticast;
+ public int ipv6Multicast;
+ public int otherRxMulticast;
+ public int[] cmdEventWakeCntArray;
+ public int[] driverFWLocalWakeCntArray;
+
+ /* {@hide} */
+ public WlanWakeReasonAndCounts() {
+ }
+
+ @Override
+ /* {@hide} */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(" totalCmdEventWake ").append(totalCmdEventWake);
+ sb.append(" totalDriverFwLocalWake ").append(totalDriverFwLocalWake);
+ sb.append(" totalRxDataWake ").append(totalRxDataWake);
+
+ sb.append(" rxUnicast ").append(rxUnicast);
+ sb.append(" rxMulticast ").append(rxMulticast);
+ sb.append(" rxBroadcast ").append(rxBroadcast);
+
+ sb.append(" icmp ").append(icmp);
+ sb.append(" icmp6 ").append(icmp6);
+ sb.append(" icmp6Ra ").append(icmp6Ra);
+ sb.append(" icmp6Na ").append(icmp6Na);
+ sb.append(" icmp6Ns ").append(icmp6Ns);
+
+ sb.append(" ipv4RxMulticast ").append(ipv4RxMulticast);
+ sb.append(" ipv6Multicast ").append(ipv6Multicast);
+ sb.append(" otherRxMulticast ").append(otherRxMulticast);
+ for (int i = 0; i < cmdEventWakeCntArray.length; i++) {
+ sb.append(" cmdEventWakeCntArray[" + i + "] " + cmdEventWakeCntArray[i]);
+ }
+ for (int i = 0; i < driverFWLocalWakeCntArray.length; i++) {
+ sb.append(" driverFWLocalWakeCntArray[" + i + "] " + driverFWLocalWakeCntArray[i]);
+ }
+
+ return sb.toString();
+ }
+
+ /* Implement the Parcelable interface
+ * {@hide}
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /* Implement the Parcelable interface
+ * {@hide}
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(totalCmdEventWake);
+ dest.writeInt(totalDriverFwLocalWake);
+ dest.writeInt(totalRxDataWake);
+
+ dest.writeInt(rxUnicast);
+ dest.writeInt(rxMulticast);
+ dest.writeInt(rxBroadcast);
+
+ dest.writeInt(icmp);
+ dest.writeInt(icmp6);
+ dest.writeInt(icmp6Ra);
+ dest.writeInt(icmp6Na);
+ dest.writeInt(icmp6Ns);
+
+ dest.writeInt(ipv4RxMulticast);
+ dest.writeInt(ipv6Multicast);
+ dest.writeInt(otherRxMulticast);
+ dest.writeIntArray(cmdEventWakeCntArray);
+ dest.writeIntArray(driverFWLocalWakeCntArray);
+ }
+
+ /* Implement the Parcelable interface
+ * {@hide}
+ */
+ public static final Creator<WlanWakeReasonAndCounts> CREATOR =
+ new Creator<WlanWakeReasonAndCounts>() {
+ public WlanWakeReasonAndCounts createFromParcel(Parcel in) {
+ WlanWakeReasonAndCounts counts = new WlanWakeReasonAndCounts();
+ counts.totalCmdEventWake = in.readInt();
+ counts.totalDriverFwLocalWake = in.readInt();
+ counts.totalRxDataWake = in.readInt();
+
+ counts.rxUnicast = in.readInt();
+ counts.rxMulticast = in.readInt();
+ counts.rxBroadcast = in.readInt();
+
+ counts.icmp = in.readInt();
+ counts.icmp6 = in.readInt();
+ counts.icmp6Ra = in.readInt();
+ counts.icmp6Na = in.readInt();
+ counts.icmp6Ns = in.readInt();
+
+ counts.ipv4RxMulticast = in.readInt();
+ counts.ipv6Multicast = in.readInt();
+ counts.otherRxMulticast = in.readInt();
+ in.readIntArray(counts.cmdEventWakeCntArray);
+ in.readIntArray(counts.driverFWLocalWakeCntArray);
+ return counts;
+ }
+
+ /* Implement the Parcelable interface
+ * {@hide}
+ */
+ @Override
+ public WlanWakeReasonAndCounts[] newArray(int size) {
+ return new WlanWakeReasonAndCounts[size];
+ }
+ };
+}