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

Commit 2a1a1a61 authored by Ash Hunter's avatar Ash Hunter Committed by Elemag
Browse files

Fix potential divide-by-zero, can result in "soft bootloop" for some devices

Change-Id: I4942f2e708b93d21412f98c5cd2ed4fbd364edae
parent 0e6175ff
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -701,12 +701,14 @@ public class ProcessStats {

        long sampleTime = mCurrentSampleTime - mLastSampleTime;
        long sampleRealTime = mCurrentSampleRealTime - mLastSampleRealTime;
        if (sampleRealTime > 0) {
            long percAwake = (sampleTime*100) / sampleRealTime;
            if (percAwake != 100) {
                pw.print(" with ");
                pw.print(percAwake);
                pw.print("% awake");
            }
        }
        pw.println(":");
        
        final int totalTime = mRelUserTime + mRelSystemTime + mRelIoWaitTime