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

Commit 54459e48 authored by Matías Hernández's avatar Matías Hernández
Browse files

Add "overload" of currentTimeMillis() returning Instant

Bug: 421885727
Test: N/A
Flag: EXEMPT Bugfix
Change-Id: I60259daa0dbecf174ffe94ce58c5c6a4fa88f53a
parent 0e8f3fd3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -702,6 +702,9 @@ java_library {
        "tests/utils/src/com/android/systemui/util/concurrency/FakeExecutor.java",
        "tests/utils/src/com/android/systemui/util/time/FakeSystemClock.java",
    ],
    libs: [
        "androidx.annotation_annotation",
    ],
    jarjar_rules: ":jarjar-rules-shared",
}

+3 −0
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@ java_library {
        "*.java",
        "*.kt",
    ],
    libs: [
        "androidx.annotation_annotation",
    ],
    defaults: [
        "SystemUI_pod_defaults_api",
    ],
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@

package com.android.systemui.util.time;

import androidx.annotation.NonNull;

import java.time.Instant;

/**
 * Testable wrapper around {@link android.os.SystemClock}.
 *
@@ -40,4 +44,10 @@ public interface SystemClock {

    /** @see System#currentTimeMillis()  */
    long currentTimeMillis();

    /** @see System#currentTimeMillis()  */
    @NonNull
    default Instant currentTime() {
        return Instant.ofEpochMilli(currentTimeMillis());
    }
}