DO NOT MERGE -- Merge PPRL.190405.003 into master

Bug: 130175407
Change-Id: I0f7d294680477f7ee8b25d2b8622f3ff05bc4f41
This commit is contained in:
Xin Li
2019-04-08 18:56:15 -07:00

View File

@@ -48,6 +48,7 @@ import android.content.pm.PermissionInfo;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.net.Uri; import android.net.Uri;
import android.os.Binder; import android.os.Binder;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Handler; import android.os.Handler;
@@ -1288,9 +1289,13 @@ class AlarmManagerService extends SystemService {
// because kernel doesn't keep this after reboot // because kernel doesn't keep this after reboot
setTimeZoneImpl(SystemProperties.get(TIMEZONE_PROPERTY)); setTimeZoneImpl(SystemProperties.get(TIMEZONE_PROPERTY));
// Also sure that we're booting with a halfway sensible current time
if (mNativeData != 0) { if (mNativeData != 0) {
final long systemBuildTime = Environment.getRootDirectory().lastModified(); // Ensure that we're booting with a halfway sensible current time. Use the
// most recent of Build.TIME, the root file system's timestamp, and the
// value of the ro.build.date.utc system property (which is in seconds).
final long systemBuildTime = Long.max(
1000L * SystemProperties.getLong("ro.build.date.utc", -1L),
Long.max(Environment.getRootDirectory().lastModified(), Build.TIME));
if (System.currentTimeMillis() < systemBuildTime) { if (System.currentTimeMillis() < systemBuildTime) {
Slog.i(TAG, "Current time only " + System.currentTimeMillis() Slog.i(TAG, "Current time only " + System.currentTimeMillis()
+ ", advancing to build time " + systemBuildTime); + ", advancing to build time " + systemBuildTime);