Merge "Add dumpsys to PowerStatsService"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5a6e438be5
@@ -18,6 +18,7 @@ package com.android.server.powerstats;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.hardware.power.stats.ChannelInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.Environment;
|
||||
import android.os.UserHandle;
|
||||
@@ -28,6 +29,8 @@ import com.android.internal.util.DumpUtils;
|
||||
import com.android.server.SystemService;
|
||||
import com.android.server.powerstats.PowerStatsHALWrapper.IPowerStatsHALWrapper;
|
||||
import com.android.server.powerstats.PowerStatsHALWrapper.PowerStatsHALWrapperImpl;
|
||||
import com.android.server.powerstats.ProtoStreamUtils.ChannelInfoUtils;
|
||||
import com.android.server.powerstats.ProtoStreamUtils.EnergyConsumerIdUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
@@ -106,6 +109,14 @@ public class PowerStatsService extends SystemService {
|
||||
} else if ("meter".equals(args[1])) {
|
||||
mPowerStatsLogger.writeMeterDataToFile(fd);
|
||||
}
|
||||
} else if (args.length == 0) {
|
||||
pw.println("PowerStatsService dumpsys: available ChannelInfos");
|
||||
ChannelInfo[] channelInfo = mPowerStatsHALWrapper.getEnergyMeterInfo();
|
||||
ChannelInfoUtils.dumpsys(channelInfo, pw);
|
||||
|
||||
pw.println("PowerStatsService dumpsys: available EnergyConsumerIds");
|
||||
int[] energyConsumerId = mPowerStatsHALWrapper.getEnergyConsumerInfo();
|
||||
EnergyConsumerIdUtils.dumpsys(energyConsumerId, pw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.util.proto.WireTypeMismatchException;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -60,6 +61,13 @@ public class ProtoStreamUtils {
|
||||
+ ", ChannelName = " + channelInfo[i].channelName);
|
||||
}
|
||||
}
|
||||
|
||||
public static void dumpsys(ChannelInfo[] channelInfo, PrintWriter pw) {
|
||||
for (int i = 0; i < channelInfo.length; i++) {
|
||||
pw.println("ChannelId = " + channelInfo[i].channelId
|
||||
+ ", ChannelName = " + channelInfo[i].channelName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class EnergyMeasurementUtils {
|
||||
@@ -172,6 +180,12 @@ public class ProtoStreamUtils {
|
||||
Slog.d(TAG, "EnergyConsumerId = " + energyConsumerId[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void dumpsys(int[] energyConsumerId, PrintWriter pw) {
|
||||
for (int i = 0; i < energyConsumerId.length; i++) {
|
||||
pw.println("EnergyConsumerId = " + energyConsumerId[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class EnergyConsumerResultUtils {
|
||||
|
||||
Reference in New Issue
Block a user