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

Commit 3e792551 authored by Doris Ling's avatar Doris Ling
Browse files

Change formatting for device up time.

- formatDuration() was changed to return only the largest meaningful
unit of time. For example, for 4 hours 35 mins, it will be formatted to
5 hours. Changing to use formatElapsedTime() instead to show the more
precise duration for the device up time.

Bug: 111828610
Test: make RunSettingsLibRoboTests
Change-Id: I9f9194ac179859b35b9eda6ca49f9eee9f11fe70
parent ddc0f7ee
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ public abstract class AbstractUptimePreferenceController extends AbstractPrefere
    }

    private void updateTimes() {
        mUptime.setSummary(DateUtils.formatDuration(SystemClock.elapsedRealtime()));
        mUptime.setSummary(DateUtils.formatElapsedTime(SystemClock.elapsedRealtime() / 1000));
    }

    private static class MyHandler extends Handler {
+2 −1
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ public class UptimePreferenceControllerTest {
        uptimePreferenceController.displayPreference(mScreen);

        // SystemClock is shadowed so it shouldn't advance unexpectedly while the test is running
        verify(mPreference).setSummary(DateUtils.formatDuration(SystemClock.elapsedRealtime()));
        verify(mPreference).setSummary(
                DateUtils.formatElapsedTime(SystemClock.elapsedRealtime() / 1000));
    }

    @Test