Merge "Add a method to note waking network packets to BatteryStats"

This commit is contained in:
Treehugger Robot 2023-01-28 11:12:42 +00:00 committed by Gerrit Code Review
commit b3238fc8a4
2 changed files with 16 additions and 0 deletions

View File

@ -16,6 +16,8 @@
package android.os;
import android.net.Network;
import com.android.internal.os.BinderCallsStats;
import com.android.internal.os.SystemServerCpuThreadReader.SystemServiceCpuThreadTimes;
@ -62,6 +64,15 @@ public abstract class BatteryStatsInternal {
*/
public abstract void noteJobsDeferred(int uid, int numDeferred, long sinceLast);
/**
* Informs battery stats of a data packet that woke up the CPU.
*
* @param network The network over which the packet arrived.
* @param elapsedMillis The time of the packet's arrival in elapsed timebase.
* @param uid The uid that received the packet.
*/
public abstract void noteCpuWakingNetworkPacket(Network network, long elapsedMillis, int uid);
/**
* Informs battery stats of binder stats for the given work source UID.
*/

View File

@ -440,6 +440,11 @@ public final class BatteryStatsService extends IBatteryStats.Stub
BatteryStatsService.this.noteJobsDeferred(uid, numDeferred, sinceLast);
}
@Override
public void noteCpuWakingNetworkPacket(Network network, long elapsedMillis, int uid) {
Slog.d(TAG, "Wakeup due to incoming packet on network " + network + " to uid " + uid);
}
@Override
public void noteBinderCallStats(int workSourceUid, long incrementatCallCount,
Collection<BinderCallsStats.CallStat> callStats) {