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

Commit 87fb335e authored by Christine Hallstrom's avatar Christine Hallstrom Committed by Android (Google) Code Review
Browse files

Merge "[DO NOT MERGE] Update kernel timezone if call to setTime causes DST offset to change"

parents eb811882 f5d585ae
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -1388,7 +1388,19 @@ class AlarmManagerService extends SystemService {
        }
        }


        synchronized (mLock) {
        synchronized (mLock) {
            return setKernelTime(mNativeData, millis) == 0;
            final long currentTimeMillis = System.currentTimeMillis();
            setKernelTime(mNativeData, millis);
            final TimeZone timeZone = TimeZone.getDefault();
            final int currentTzOffset = timeZone.getOffset(currentTimeMillis);
            final int newTzOffset = timeZone.getOffset(millis);
            if (currentTzOffset != newTzOffset) {
                Slog.i(TAG, "Timezone offset has changed, updating kernel timezone");
                setKernelTimezone(mNativeData, -(newTzOffset / 60000));
            }
            // The native implementation of setKernelTime can return -1 even when the kernel
            // time was set correctly, so assume setting kernel time was successful and always
            // return true.
            return true;
        }
        }
    }
    }