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

Commit db4b18d9 authored by Neil Fuller's avatar Neil Fuller
Browse files

Remove usages of TimestampedValue<Long>

Track changes in frameworks/base/

Remove usages of TimestampedValue<Long> now we have UnixEpochTime, which
is the same thing but intended to be an SDK API.

Bug: 236612872
Test: Build only
Change-Id: I6a7b40acfb880af6acdbcb13d8c169098018bc19
parent 76fd34ed
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package com.android.internal.telephony;
import android.annotation.DurationMillisLong;
import android.annotation.ElapsedRealtimeLong;
import android.annotation.NonNull;
import android.os.TimestampedValue;
import android.app.time.UnixEpochTime;

import java.time.Duration;
import java.util.Objects;
@@ -88,13 +88,12 @@ public final class NitzSignal {
    }

    /**
     * Creates a {@link android.os.TimestampedValue} containing the UTC time as the number of
     * milliseconds since the start of the Unix epoch. The reference time is the time according to
     * the elapsed realtime clock when that would have been the time, accounting for receipt time
     * and age.
     * Creates a {@link UnixEpochTime} containing the UTC time as the number of milliseconds since
     * the start of the Unix epoch. The reference time is the time according to the elapsed realtime
     * clock when that would have been the time, accounting for receipt time and age.
     */
    public TimestampedValue<Long> createTimeSignal() {
        return new TimestampedValue<>(
    public UnixEpochTime createTimeSignal() {
        return new UnixEpochTime(
                getAgeAdjustedElapsedRealtimeMillis(),
                getNitzData().getCurrentTimeInMillis());
    }
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony.nitz;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.time.UnixEpochTime;
import android.app.timedetector.TelephonyTimeSuggestion;
import android.app.timezonedetector.TelephonyTimeZoneSuggestion;
import android.content.Context;
@@ -372,7 +373,7 @@ public final class NitzStateMachineImpl implements NitzStateMachine {
                builder.addDebugInfo("Clearing time suggestion"
                        + " reason=" + reason);
            } else {
                TimestampedValue<Long> newNitzTime = nitzSignal.createTimeSignal();
                UnixEpochTime newNitzTime = nitzSignal.createTimeSignal();
                builder.setUnixEpochTime(newNitzTime);
                builder.addDebugInfo("Sending new time suggestion"
                        + " nitzSignal=" + nitzSignal
+4 −3
Original line number Diff line number Diff line
@@ -18,13 +18,13 @@ package com.android.internal.telephony.nitz;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.time.UnixEpochTime;
import android.app.timedetector.TelephonyTimeSuggestion;
import android.app.timedetector.TimeDetector;
import android.app.timezonedetector.TelephonyTimeZoneSuggestion;
import android.app.timezonedetector.TimeZoneDetector;
import android.content.Context;
import android.os.SystemClock;
import android.os.TimestampedValue;
import android.util.LocalLog;

import com.android.internal.telephony.Phone;
@@ -69,8 +69,9 @@ public final class TimeServiceHelperImpl implements TimeServiceHelper {
        Objects.requireNonNull(timeSuggestion);

        if (timeSuggestion.getUnixEpochTime() != null) {
            TimestampedValue<Long> unixEpochTime = timeSuggestion.getUnixEpochTime();
            TelephonyMetrics.getInstance().writeNITZEvent(mSlotIndex, unixEpochTime.getValue());
            UnixEpochTime unixEpochTime = timeSuggestion.getUnixEpochTime();
            TelephonyMetrics.getInstance().writeNITZEvent(
                    mSlotIndex, unixEpochTime.getUnixEpochTimeMillis());
        }
        mTimeDetector.suggestTelephonyTime(timeSuggestion);
    }
+2 −1
Original line number Diff line number Diff line
@@ -910,7 +910,8 @@ public class NitzStateMachineImplTest {
            suggestedTimes.set(timeSuggestion);
            if (timeSuggestion.getUnixEpochTime() != null) {
                // The fake time service just uses the latest suggestion.
                mFakeDeviceState.currentTimeMillis = timeSuggestion.getUnixEpochTime().getValue();
                mFakeDeviceState.currentTimeMillis =
                        timeSuggestion.getUnixEpochTime().getUnixEpochTimeMillis();
            }
        }