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

Commit 307edcd9 authored by Ahmed ElArabawy's avatar Ahmed ElArabawy
Browse files

Fix format of subsystem power stats



The Subsystem power stats string in batteryStats dumpsys has an extra
newline that is causing PowerBug to skip the line when parsing the
history information.
Also, the string for subsystem power stats is missing a heading title
and has some redundant text

This commit fixes these format errors so powerbug can read and parse that
line successfully

Bug: 63447034
Test: Manual testing + Read the bugreport by historian and verify output

Change-Id: Idf971823dd5f769e653b4788b00fc025593d0d3d
Signed-off-by: default avatarAhmed ElArabawy <arabawy@google.com>
parent dc7b2bc5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5606,8 +5606,10 @@ public abstract class BatteryStats implements Parcelable {
                        pw.print(',');
                        if (rec.stepDetails.statPlatformIdleState != null) {
                            pw.print(rec.stepDetails.statPlatformIdleState);
                            if (rec.stepDetails.statSubsystemPowerState != null) {
                                pw.print(',');
                            }
                        }
                        pw.println();

                        if (rec.stepDetails.statSubsystemPowerState != null) {
                            pw.print(rec.stepDetails.statSubsystemPowerState);
+32 −26
Original line number Diff line number Diff line
@@ -301,8 +301,13 @@ static jint getSubsystemLowPowerStats(JNIEnv* env, jobject /* clazz */, jobject
            if (status != Status::SUCCESS)
                return;

            if (subsystems.size() > 0) {
                int added = snprintf(offset, remaining, "SubsystemPowerState ");
                offset += added;
                remaining -= added;
                total_added += added;

                for (size_t i = 0; i < subsystems.size(); i++) {
                int added;
                    const PowerStateSubsystem &subsystem = subsystems[i];

                    added = snprintf(offset, remaining,
@@ -322,7 +327,7 @@ static jint getSubsystemLowPowerStats(JNIEnv* env, jobject /* clazz */, jobject
                    for (size_t j = 0; j < subsystem.states.size(); j++) {
                        const PowerStateSubsystemSleepState& state = subsystem.states[j];
                        added = snprintf(offset, remaining,
                                     "state_%zu name=%s time=%" PRIu64 " count=%" PRIu64 " last entry TS(ms)=%" PRIu64 " ",
                                         "state_%zu name=%s time=%" PRIu64 " count=%" PRIu64 " last entry=%" PRIu64 " ",
                                         j + 1, state.name.c_str(), state.residencyInMsecSinceBoot,
                                         state.totalTransitions, state.lastEntryTimestampMs);
                        if (added < 0) {
@@ -347,6 +352,7 @@ static jint getSubsystemLowPowerStats(JNIEnv* env, jobject /* clazz */, jobject
                    }
                }
            }
        }
        );

        if (!ret.isOk()) {