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

Commit 8665cf17 authored by Neil Fuller's avatar Neil Fuller
Browse files

Keep internal/aosp code in sync

SystemClock.elapsedRealtimeClock() could not be used in aosp/master
when the code was cherry-picked outside.

The method is also marked as @Removed. This change makes the
goog/master code the same as aosp/master code to avoid conflicts in
future.

Bug: 78217059
Test: build
Change-Id: Iaa68baf71f9339705b0a7db00cbcdc6da512b79b
parent 24836bfb
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import android.os.SystemClock;
import android.util.Slog;
import android.util.TimestampedValue;

import java.time.Clock;

/**
 * The real implementation of {@link TimeDetectorStrategy.Callback} used on device.
 */
@@ -35,7 +33,6 @@ public class TimeDetectorStrategyCallbackImpl implements TimeDetectorStrategy.Ca

    @NonNull private PowerManager.WakeLock mWakeLock;
    @NonNull private AlarmManager mAlarmManager;
    @NonNull private Clock mElapsedRealtimeClock;

    public TimeDetectorStrategyCallbackImpl(Context context) {
        PowerManager powerManager = context.getSystemService(PowerManager.class);
@@ -43,14 +40,13 @@ public class TimeDetectorStrategyCallbackImpl implements TimeDetectorStrategy.Ca
        mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);

        mAlarmManager = context.getSystemService(AlarmManager.class);
        mElapsedRealtimeClock = SystemClock.elapsedRealtimeClock();
    }

    @Override
    public void setTime(TimestampedValue<Long> time) {
        mWakeLock.acquire();
        try {
            long elapsedRealtimeMillis = mElapsedRealtimeClock.millis();
            long elapsedRealtimeMillis = SystemClock.elapsedRealtime();
            long currentTimeMillis = TimeDetectorStrategy.getTimeAt(time, elapsedRealtimeMillis);
            Slog.d(TAG, "Setting system clock using time=" + time
                    + ", elapsedRealtimeMillis=" + elapsedRealtimeMillis);