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

Commit 9d517742 authored by Treehugger Robot's avatar Treehugger Robot
Browse files

Merge "Use design capacity instead of full charge capacity" am: 25c2de29 am:...

Merge "Use design capacity instead of full charge capacity" am: 25c2de29 am: a4931f9b am: 979a72be

Change-Id: I5f31eef0aa684e23773980b3121c8a5a6ae00922
parents afcd210a 979a72be
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -659,7 +659,7 @@ ba5ac712b2a656dc07c83ab4a7a2c2f3bee1bbcb752e8b8ffa9b672f3b5b0728 android.hardwar
a3f439b782a6a92aaf3c0250f3526e94e8bf8844c3d578f0815e21b12c431346 android.hardware.gnss.measurement_corrections@1.1::types
ce8dbe76eb9ee94b46ef98f725be992e760a5751073d4f4912484026541371f3 android.hardware.health@2.1::IHealth
26f04510a0b57aba5167c5c0a7c2f077c2acbb98b81902a072517829fd9fd67f android.hardware.health@2.1::IHealthInfoCallback
db47f4ceceb1f06c656f39caa70c557b0f8471ef59fd58611bea667ffca20101 android.hardware.health@2.1::types
30e5d878099aeca710420dfc438d115bbbdcdbe84ad1b05a0f5e01debc3ef3af android.hardware.health@2.1::types
0589e410f519e36514e7ece18f283f022df0f70efd2c12821d822f67f74aba98 android.hardware.identity@1.0::types
bbeee9604128ede83ee755b67e73b5ad29e6e1dbac9ec41fea6ffe2745b0c50a android.hardware.identity@1.0::IIdentityCredential
96ce8aad80f4c476f25261f790d357c117e79e18474c7dadd850dac704bbe65e android.hardware.identity@1.0::IIdentityCredentialStore
+4 −4
Original line number Diff line number Diff line
@@ -84,12 +84,12 @@ struct HealthInfo {
    int64_t batteryChargeTimeToFullNowSeconds;

    /**
     * Estimated battery full capacity (in microamp hours, uAh).
     * Estimated battery full charge design capacity (in microamp hours, uAh).
     * batteryFullCharge must be less than (value * 1000).
     * Value must be 0 if unknown.
     * Value must be positive if known, and must be between [50%, 120%] of
     * batteryFullCharge (the designed capacity).
     * Value must be positive if known.
     */
    int32_t batteryFullCapacityUah;
    int32_t batteryFullChargeDesignCapacityUah;
};

/**
+7 −6
Original line number Diff line number Diff line
@@ -228,17 +228,18 @@ TEST_P(HealthHidlTest, getHealthInfo_2_1) {
            return;
        }
        ASSERT_EQ(Result::SUCCESS, result);
        const auto& legacy = value.legacy.legacy;

        EXPECT_TRUE(IsEnum(value.batteryCapacityLevel)) << " BatteryCapacityLevel";
        EXPECT_GE(value.batteryChargeTimeToFullNowSeconds, 0);

        EXPECT_GE(value.batteryFullCapacityUah, 0)
                << "batteryFullCapacityUah should not be negative";
        EXPECT_GE(value.batteryFullChargeDesignCapacityUah, 0)
                << "batteryFullChargeDesignCapacityUah should not be negative";

        if (value.batteryFullCapacityUah > 0) {
            EXPECT_GE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 0.50);
            EXPECT_LE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 1.20);
        // Check for extreme outliers
        const auto& legacy = value.legacy.legacy;
        if (value.batteryFullChargeDesignCapacityUah > 0) {
            EXPECT_LT((long)legacy.batteryFullCharge,
                      ((long)value.batteryFullChargeDesignCapacityUah * 1000));
        }
    })));
}
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ void InitHealthdConfig(struct healthd_config* healthd_config) {
            .batteryCycleCountPath = String8(String8::kEmptyString),
            .batteryCapacityLevelPath = String8(String8::kEmptyString),
            .batteryChargeTimeToFullNowPath = String8(String8::kEmptyString),
            .batteryFullChargeDesignCapacityUahPath = String8(String8::kEmptyString),
            .energyCounter = NULL,
            .boot_min_cap = 0,
            .screen_on = NULL,