Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d288fe1 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Migrate several PowerStats tests to Ravenwood

Bug: 314797745
Test: atest PowerStatsTestsRavenwood
Test: atest PowerStatsTests

Change-Id: I4af6e9c532285dc935f6d2156cc9cb3531d9aeaa
parent aa03774d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1657,6 +1657,7 @@ public abstract class BatteryStats {
     */
    public abstract CpuScalingPolicies getCpuScalingPolicies();

    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public final static class HistoryTag {
        public static final int HISTORY_TAG_POOL_OVERFLOW = -1;

@@ -1713,6 +1714,7 @@ public abstract class BatteryStats {
     * Optional detailed information that can go into a history step.  This is typically
     * generated each time the battery level changes.
     */
    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public final static class HistoryStepDetails {
        // Time (in 1/100 second) spent in user space and the kernel since the last step.
        public int userTime;
@@ -1797,6 +1799,7 @@ public abstract class BatteryStats {
    /**
     * An extension to the history item describing a proc state change for a UID.
     */
    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public static final class ProcessStateChange {
        public int uid;
        public @BatteryConsumer.ProcessState int processState;
@@ -1850,6 +1853,7 @@ public abstract class BatteryStats {
    /**
     * Battery history record.
     */
    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public static final class HistoryItem {
        @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
        public HistoryItem next;
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ package android.os;
 * This class uses itself as the object to wait on, so if you wait()
 * or notify() on a ConditionVariable, the results are undefined.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class ConditionVariable
{
    private volatile boolean mCondition;
+12 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import java.util.concurrent.locks.ReentrantLock;
 * All interfaces in BatteryStatsHistory should only be called by BatteryStatsImpl and protected by
 * locks on BatteryStatsImpl object.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class BatteryStatsHistory {
    private static final boolean DEBUG = false;
    private static final String TAG = "BatteryStatsHistory";
@@ -259,6 +260,7 @@ public class BatteryStatsHistory {
     * until the first change occurs.
     */
    @VisibleForTesting
    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public static class TraceDelegate {
        // Note: certain tests currently run as platform_app which is not allowed
        // to set debug system properties. To ensure that system properties are set
@@ -391,10 +393,18 @@ public class BatteryStatsHistory {
    public BatteryStatsHistory(int maxHistoryFiles, int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
            MonotonicClock monotonicClock) {
        this(maxHistoryFiles, maxHistoryBufferSize, stepDetailsCalculator, clock, monotonicClock,
                new TraceDelegate());
    }

    @VisibleForTesting
    public BatteryStatsHistory(int maxHistoryFiles, int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
            MonotonicClock monotonicClock, TraceDelegate traceDelegate) {
        mMaxHistoryFiles = maxHistoryFiles;
        mMaxHistoryBufferSize = maxHistoryBufferSize;
        mStepDetailsCalculator = stepDetailsCalculator;
        mTracer = new TraceDelegate();
        mTracer = traceDelegate;
        mClock = clock;
        mMonotonicClock = monotonicClock;

@@ -2096,6 +2106,7 @@ public class BatteryStatsHistory {
     * fewer bytes.  It is a bit more expensive than just writing the long into the parcel,
     * but at scale saves a lot of storage and allows recording of longer battery history.
     */
    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public static final class VarintParceler {
        /**
         * Writes an array of longs into Parcel using the varint format, see
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import java.util.Iterator;
/**
 * An iterator for {@link BatteryStats.HistoryItem}'s.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public class BatteryStatsHistoryIterator implements Iterator<BatteryStats.HistoryItem>,
        AutoCloseable {
    private static final boolean DEBUG = false;
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import java.util.Objects;
 * Container for power stats, acquired by various PowerStatsCollector classes. See subclasses for
 * details.
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public final class PowerStats {
    private static final String TAG = "PowerStats";

@@ -67,6 +68,7 @@ public final class PowerStats {
     * This descriptor is used for storing PowerStats and can also be used by power models
     * to adjust the algorithm in accordance with the stats available on the device.
     */
    @android.ravenwood.annotation.RavenwoodKeepWholeClass
    public static class Descriptor {
        public static final String XML_TAG_DESCRIPTOR = "descriptor";
        private static final String XML_ATTR_ID = "id";
Loading