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

Commit bba3f348 authored by Neil Fuller's avatar Neil Fuller Committed by android-build-merger
Browse files

Merge "Track service changes in TimeDetectionService"

am: 055c6b44

Change-Id: I479e9d45f732cc02405d4ccea4dc75b8f001d3b4
parents 3048314d 055c6b44
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony;

import android.app.timedetector.PhoneTimeSuggestion;
import android.content.Context;
import android.os.PowerManager;
import android.telephony.Rlog;
@@ -428,7 +429,11 @@ public final class NitzStateMachineImpl implements NitzStateMachine {
                Rlog.d(LOG_TAG, logMsg);
            }
            mTimeLog.log(logMsg);
            mTimeServiceHelper.suggestDeviceTime(newNitzTime);
            PhoneTimeSuggestion phoneTimeSuggestion =
                    new PhoneTimeSuggestion(mPhone.getPhoneId(), newNitzTime);
            phoneTimeSuggestion.addDebugInfo(logMsg);
            mTimeServiceHelper.suggestDeviceTime(phoneTimeSuggestion);

            TelephonyMetrics.getInstance().writeNITZEvent(
                    mPhone.getPhoneId(), newNitzTime.getValue());

+3 −3
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

package com.android.internal.telephony;

import android.app.timedetector.PhoneTimeSuggestion;
import android.app.timedetector.TimeDetector;
import android.util.TimestampedValue;

/**
 * An interface to various time / time zone detection behaviors that should be centralized into a
@@ -62,8 +62,8 @@ public interface TimeServiceHelper {
    /**
     * Suggest the time to the {@link TimeDetector}.
     *
     * @param signalTimeMillis the signal time as received from the network
     * @param phoneTimeSuggestion the suggested time
     */
    void suggestDeviceTime(TimestampedValue<Long> signalTimeMillis);
    void suggestDeviceTime(PhoneTimeSuggestion phoneTimeSuggestion);

}
+3 −5
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@
package com.android.internal.telephony;

import android.app.AlarmManager;
import android.app.timedetector.PhoneTimeSuggestion;
import android.app.timedetector.TimeDetector;
import android.app.timedetector.TimeSignal;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -27,7 +27,6 @@ import android.os.Handler;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.TimestampedValue;

/**
 * An interface to various time / time zone detection behaviors that should be centralized into a
@@ -89,9 +88,8 @@ public final class TimeServiceHelperImpl implements TimeServiceHelper {
    }

    @Override
    public void suggestDeviceTime(TimestampedValue<Long> signalTimeMillis) {
        TimeSignal timeSignal = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, signalTimeMillis);
        mTimeDetector.suggestTime(timeSignal);
    public void suggestDeviceTime(PhoneTimeSuggestion phoneTimeSuggestion) {
        mTimeDetector.suggestPhoneTime(phoneTimeSuggestion);
    }

    /**
+132 −92

File changed.

Preview size limit exceeded, changes collapsed.

+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;

import static org.junit.Assert.fail;

import android.app.timedetector.PhoneTimeSuggestion;
import android.icu.util.Calendar;
import android.icu.util.GregorianCalendar;
import android.icu.util.TimeZone;
@@ -260,6 +261,13 @@ public final class NitzStateMachineTestSupport {
        return cal.getTimeInMillis();
    }

    public static PhoneTimeSuggestion createTimeSuggestionFromNitzSignal(
            int phoneId, TimestampedValue<NitzData> nitzSignal) {
        PhoneTimeSuggestion timeSuggestion =
                new PhoneTimeSuggestion(phoneId, createTimeSignalFromNitzSignal(nitzSignal));
        return timeSuggestion;
    }

    public static TimestampedValue<Long> createTimeSignalFromNitzSignal(
            TimestampedValue<NitzData> nitzSignal) {
        return new TimestampedValue<>(