Merge "Statsd atom: Add WifiLock type"

This commit is contained in:
Ahmed ElArabawy
2019-02-07 23:25:45 +00:00
committed by Android (Google) Code Review
4 changed files with 61 additions and 16 deletions

View File

@@ -41,12 +41,13 @@ import "frameworks/base/core/proto/android/service/procstats_enum.proto";
import "frameworks/base/core/proto/android/service/usb.proto";
import "frameworks/base/core/proto/android/stats/enums.proto";
import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
import "frameworks/base/core/proto/android/telecomm/enums.proto";
import "frameworks/base/core/proto/android/telephony/enums.proto";
import "frameworks/base/core/proto/android/view/enums.proto";
import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
import "frameworks/base/core/proto/android/wifi/enums.proto";
/**
* The master atom class. This message defines all of the available
@@ -994,6 +995,9 @@ message WifiLockStateChanged {
ON = 1;
}
optional State state = 2;
// WifiLock type, from frameworks/base/core/proto/android/wifi/enums.proto.
optional android.net.wifi.WifiModeEnum mode = 3;
}
/**

View File

@@ -6117,8 +6117,6 @@ public class BatteryStatsImpl extends BatteryStats {
for (int i=0; i<N; i++) {
final int uid = mapUid(ws.get(i));
noteFullWifiLockAcquiredLocked(uid);
StatsLog.write_non_chained(StatsLog.WIFI_LOCK_STATE_CHANGED, ws.get(i), ws.getName(i),
StatsLog.WIFI_LOCK_STATE_CHANGED__STATE__ON);
}
final List<WorkChain> workChains = ws.getWorkChains();
@@ -6127,9 +6125,6 @@ public class BatteryStatsImpl extends BatteryStats {
final WorkChain workChain = workChains.get(i);
final int uid = mapUid(workChain.getAttributionUid());
noteFullWifiLockAcquiredLocked(uid);
StatsLog.write(StatsLog.WIFI_LOCK_STATE_CHANGED,
workChain.getUids(), workChain.getTags(),
StatsLog.WIFI_LOCK_STATE_CHANGED__STATE__ON);
}
}
}
@@ -6139,8 +6134,6 @@ public class BatteryStatsImpl extends BatteryStats {
for (int i=0; i<N; i++) {
final int uid = mapUid(ws.get(i));
noteFullWifiLockReleasedLocked(uid);
StatsLog.write_non_chained(StatsLog.WIFI_LOCK_STATE_CHANGED, ws.get(i), ws.getName(i),
StatsLog.WIFI_LOCK_STATE_CHANGED__STATE__OFF);
}
final List<WorkChain> workChains = ws.getWorkChains();
@@ -6149,9 +6142,6 @@ public class BatteryStatsImpl extends BatteryStats {
final WorkChain workChain = workChains.get(i);
final int uid = mapUid(workChain.getAttributionUid());
noteFullWifiLockReleasedLocked(uid);
StatsLog.write(StatsLog.WIFI_LOCK_STATE_CHANGED,
workChain.getUids(), workChain.getTags(),
StatsLog.WIFI_LOCK_STATE_CHANGED__STATE__OFF);
}
}
}

View File

@@ -0,0 +1,50 @@
/*
* 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.
*/
syntax = "proto2";
package android.net.wifi;
option java_outer_classname = "WifiProtoEnums";
option java_multiple_files = true;
/**
* Wifi Lock modes, primarily used in
* frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiLockManager.java.
*/
enum WifiModeEnum {
/**
* Deprecated.
* Wi-Fi will be kept active, and will behave normally.
*/
WIFI_MODE_FULL = 1 [deprecated=true];
/**
* Deprecated.
* Wi-Fi will be kept active, but the only operation that will be supported is initiation of
* scans, and the subsequent reporting of scan results.
*/
WIFI_MODE_SCAN_ONLY = 2 [deprecated=true];
/**
* Wi-Fi will not go to power save.
*/
WIFI_MODE_FULL_HIGH_PERF = 3;
/**
* Wi-Fi will operate with a priority to achieve low latency.
*/
WIFI_MODE_FULL_LOW_LATENCY = 4;
}

View File

@@ -981,7 +981,7 @@ public class WifiManager {
* @deprecated This API is non-functional and will have no impact.
*/
@Deprecated
public static final int WIFI_MODE_FULL = 1;
public static final int WIFI_MODE_FULL = WifiProtoEnums.WIFI_MODE_FULL; // 1
/**
* In this Wi-Fi lock mode, Wi-Fi will be kept active,
@@ -995,7 +995,7 @@ public class WifiManager {
* @deprecated This API is non-functional and will have no impact.
*/
@Deprecated
public static final int WIFI_MODE_SCAN_ONLY = 2;
public static final int WIFI_MODE_SCAN_ONLY = WifiProtoEnums.WIFI_MODE_SCAN_ONLY; // 2
/**
* In this Wi-Fi lock mode, Wi-Fi will not go to power save.
@@ -1013,7 +1013,7 @@ public class WifiManager {
* When there is no support from the hardware, the {@link #WIFI_MODE_FULL_HIGH_PERF}
* lock will have no impact.
*/
public static final int WIFI_MODE_FULL_HIGH_PERF = 3;
public static final int WIFI_MODE_FULL_HIGH_PERF = WifiProtoEnums.WIFI_MODE_FULL_HIGH_PERF; // 3
/**
* In this Wi-Fi lock mode, Wi-Fi will operate with a priority to achieve low latency.
@@ -1045,7 +1045,8 @@ public class WifiManager {
* lock will be effective when app is running in foreground and screen is on,
* while the {@link #WIFI_MODE_FULL_HIGH_PERF} lock will take effect otherwise.
*/
public static final int WIFI_MODE_FULL_LOW_LATENCY = 4;
public static final int WIFI_MODE_FULL_LOW_LATENCY =
WifiProtoEnums.WIFI_MODE_FULL_LOW_LATENCY; // 4
/** Anything worse than or equal to this will show 0 bars. */
@UnsupportedAppUsage