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

Commit 41283939 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "bug340482112" into main

* changes:
  Revert "AlarmManager: Store time offset system property"
  Revert "AlarmManager: Store the next dst transition in system properties"
parents 525c99b5 56b0953a
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ import android.os.ServiceManager;
import android.os.ShellCallback;
import android.os.ShellCommand;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.ThreadLocalWorkSource;
import android.os.Trace;
import android.os.UserHandle;
@@ -179,9 +178,6 @@ import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.zone.ZoneOffsetTransition;
import java.time.zone.ZoneRules;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -193,7 +189,6 @@ import java.util.Set;
import java.util.TimeZone;
import java.util.TreeSet;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;

/**
@@ -233,13 +228,6 @@ public class AlarmManagerService extends SystemService {

    private static final long TEMPORARY_QUOTA_DURATION = INTERVAL_DAY;

    // System properties read on some device configurations to initialize time properly and
    // perform DST transitions at the bootloader level.
    private static final String TIMEOFFSET_PROPERTY = "persist.sys.time.offset";
    private static final String DST_TRANSITION_PROPERTY = "persist.sys.time.dst_transition";
    private static final String DST_OFFSET_PROPERTY = "persist.sys.time.dst_offset";


    private final Intent mBackgroundIntent
            = new Intent().addFlags(Intent.FLAG_FROM_BACKGROUND);

@@ -2127,22 +2115,6 @@ public class AlarmManagerService extends SystemService {
            // "GMT" if the ID is unrecognized). The parameter ID is used here rather than
            // newZone.getId(). It will be rejected if it is invalid.
            timeZoneWasChanged = SystemTimeZone.setTimeZoneId(tzId, confidence, logInfo);

            final int gmtOffset = newZone.getOffset(mInjector.getCurrentTimeMillis());
            SystemProperties.set(TIMEOFFSET_PROPERTY, String.valueOf(gmtOffset));

            final ZoneRules rules = newZone.toZoneId().getRules();
            final ZoneOffsetTransition transition = rules.nextTransition(Instant.now());
            if (null != transition) {
                // Get the offset between the time after the DST transition and before.
                final long transitionOffset = TimeUnit.SECONDS.toMillis((
                        transition.getOffsetAfter().getTotalSeconds()
                        - transition.getOffsetBefore().getTotalSeconds()));
                // Time when the next DST transition is programmed.
                final long nextTransition = TimeUnit.SECONDS.toMillis(transition.toEpochSecond());
                SystemProperties.set(DST_TRANSITION_PROPERTY, String.valueOf(nextTransition));
                SystemProperties.set(DST_OFFSET_PROPERTY, String.valueOf(transitionOffset));
            }
        }

        // Clear the default time zone in the system server process. This forces the next call