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

Commit ffd77c64 authored by Kweku Adams's avatar Kweku Adams
Browse files

Remove duplicate dump method.

Switch to TimeUtils.dumpTime since it does the exact same thing as
the one in TareUtils, which allows us to remove an object that was
only used for log dumps.

Bug: 239951405
Test: adb shell dumpsys tare
Change-Id: I4327fab589b79c77a5987505e64371d8b8368254
parent 826ebae0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
package com.android.server.tare;

import static android.text.format.DateUtils.HOUR_IN_MILLIS;
import static android.util.TimeUtils.dumpTime;

import static com.android.server.tare.TareUtils.cakeToString;
import static com.android.server.tare.TareUtils.dumpTime;
import static com.android.server.tare.TareUtils.getCurrentTimeMillis;

import android.annotation.NonNull;
+0 −11
Original line number Diff line number Diff line
@@ -19,26 +19,15 @@ package com.android.server.tare;
import static android.app.tare.EconomyManager.CAKE_IN_ARC;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.util.IndentingPrintWriter;

import com.android.internal.annotations.VisibleForTesting;

import java.text.SimpleDateFormat;
import java.time.Clock;

class TareUtils {
    @SuppressLint("SimpleDateFormat")
    private static final SimpleDateFormat sDumpDateFormat =
            new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

    @VisibleForTesting
    static Clock sSystemClock = Clock.systemUTC();

    static void dumpTime(IndentingPrintWriter pw, long time) {
        pw.print(sDumpDateFormat.format(time));
    }

    static long getCurrentTimeMillis() {
        return sSystemClock.millis();
    }