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

Commit f5f71807 authored by Neil Fuller's avatar Neil Fuller Committed by Android (Google) Code Review
Browse files

Merge "Remove usages of TimestampedValue<Long>"

parents bba64410 e932ab9a
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.app.timedetector.TimeSuggestionHelper;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.ShellCommand;
import android.os.TimestampedValue;

import java.io.PrintWriter;
import java.util.List;
@@ -48,9 +47,9 @@ import java.util.Objects;
 *
 * <p>The creator of an external suggestion is expected to be separate Android process, e.g. a
 * process integrating with the external time source via a HAL or local network. The creator must
 * capture the elapsed realtime reference clock, e.g. via {@link SystemClock#elapsedRealtime()},
 * when the Unix epoch time is first obtained (usually under a wakelock). This enables Android to
 * adjust for latency introduced between suggestion creation and eventual use. Adjustments for other
 * capture the elapsed realtime clock value, e.g. via {@link SystemClock#elapsedRealtime()}, when
 * the Unix epoch time is first obtained (usually under a wakelock). This enables Android to adjust
 * for latency introduced between suggestion creation and eventual use. Adjustments for other
 * sources of latency, i.e. those before the external time suggestion is created, must be handled by
 * the creator.
 *
@@ -97,7 +96,7 @@ public final class ExternalTimeSuggestion implements Parcelable {
    public ExternalTimeSuggestion(@ElapsedRealtimeLong long elapsedRealtimeMillis,
            @CurrentTimeMillisLong long suggestionMillis) {
        mTimeSuggestionHelper = new TimeSuggestionHelper(ExternalTimeSuggestion.class,
                new TimestampedValue<>(elapsedRealtimeMillis, suggestionMillis));
                new UnixEpochTime(elapsedRealtimeMillis, suggestionMillis));
    }

    private ExternalTimeSuggestion(@NonNull TimeSuggestionHelper helper) {
@@ -118,7 +117,7 @@ public final class ExternalTimeSuggestion implements Parcelable {
     * {@hide}
     */
    @NonNull
    public TimestampedValue<Long> getUnixEpochTime() {
    public UnixEpochTime getUnixEpochTime() {
        return mTimeSuggestionHelper.getUnixEpochTime();
    }

+1 −5
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.os.TimestampedValue;
import android.util.ArrayMap;
import android.util.Log;

@@ -339,10 +338,7 @@ public final class TimeManager {
            Log.d(TAG, "setTime called: " + unixEpochTime);
        }
        try {
            TimestampedValue<Long> manualTime = new TimestampedValue<>(
                    unixEpochTime.getElapsedRealtimeMillis(),
                    unixEpochTime.getUnixEpochTimeMillis());
            ManualTimeSuggestion manualTimeSuggestion = new ManualTimeSuggestion(manualTime);
            ManualTimeSuggestion manualTimeSuggestion = new ManualTimeSuggestion(unixEpochTime);
            manualTimeSuggestion.addDebugInfo("TimeManager.setTime()");
            manualTimeSuggestion.addDebugInfo("UID: " + android.os.Process.myUid());
            manualTimeSuggestion.addDebugInfo("UserHandle: " + android.os.Process.myUserHandle());
+8 −9
Original line number Diff line number Diff line
@@ -41,8 +41,7 @@ import java.util.Objects;
@SystemApi
public final class TimeZoneCapabilities implements Parcelable {

    public static final @NonNull Creator<TimeZoneCapabilities> CREATOR =
            new Creator<TimeZoneCapabilities>() {
    public static final @NonNull Creator<TimeZoneCapabilities> CREATOR = new Creator<>() {
        public TimeZoneCapabilities createFromParcel(Parcel in) {
            return TimeZoneCapabilities.createFromParcel(in);
        }
+0 −7
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.ShellCommand;
import android.os.SystemClock;
import android.os.TimestampedValue;

import java.io.PrintWriter;
import java.util.Objects;
@@ -181,10 +180,4 @@ public final class UnixEpochTime implements Parcelable {
            @NonNull UnixEpochTime one, @NonNull UnixEpochTime two) {
        return one.mElapsedRealtimeMillis - two.mElapsedRealtimeMillis;
    }

    // TODO(b/246256335) Switch to using UnixEpochTime where possible and remove this method.
    /** @hide */
    public TimestampedValue<Long> toTimestampedValue() {
        return new TimestampedValue<>(mElapsedRealtimeMillis, mUnixEpochTimeMillis);
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -18,10 +18,10 @@ package android.app.timedetector;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.time.UnixEpochTime;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.ShellCommand;
import android.os.TimestampedValue;

import java.io.PrintWriter;
import java.util.List;
@@ -51,7 +51,7 @@ public final class ManualTimeSuggestion implements Parcelable {

    @NonNull private final TimeSuggestionHelper mTimeSuggestionHelper;

    public ManualTimeSuggestion(@NonNull TimestampedValue<Long> unixEpochTime) {
    public ManualTimeSuggestion(@NonNull UnixEpochTime unixEpochTime) {
        mTimeSuggestionHelper = new TimeSuggestionHelper(ManualTimeSuggestion.class, unixEpochTime);
    }

@@ -70,7 +70,7 @@ public final class ManualTimeSuggestion implements Parcelable {
    }

    @NonNull
    public TimestampedValue<Long> getUnixEpochTime() {
    public UnixEpochTime getUnixEpochTime() {
        return mTimeSuggestionHelper.getUnixEpochTime();
    }

Loading