summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-02-14 16:26:11 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-02-14 16:26:11 +0000
commit1b1681a8b0a3f95062c8f6f7fe31890629264e37 (patch)
tree77cc6f926a9b7b2fbae0a6f8ae1d798725e5f7c8
parent988624eda2c566551f75b48231cdeff2b0142d93 (diff)
parent21863a0cb74c7a4b5d2ace787d3dc979e11e3dd0 (diff)
downloadbase-pie-qpr2-release.tar.gz
Merge cherrypicks of [6391991, 6392011, 6391992, 6391993, 6392031, 6392051, 6392052, 6392091, 6392111, 6392032, 6391994, 6391995, 6391996, 6391997, 6391998, 6391999, 6392000, 6392001, 6392002, 6392003, 6392004, 6392005, 6392006, 6392112, 6392113, 6392151, 6392152] into pi-qpr2-releaseandroid-9.0.0_r35pie-qpr2-release
Change-Id: I3808395b49e1416d2f5107d926b1b713e17828b7
-rw-r--r--services/core/java/com/android/server/AlarmManagerService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index f79a51b13afd..47b646c1a667 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -48,6 +48,7 @@ import android.content.pm.PermissionInfo;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Binder;
+import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
@@ -1288,9 +1289,13 @@ class AlarmManagerService extends SystemService {
// because kernel doesn't keep this after reboot
setTimeZoneImpl(SystemProperties.get(TIMEZONE_PROPERTY));
- // Also sure that we're booting with a halfway sensible current time
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) {
Slog.i(TAG, "Current time only " + System.currentTimeMillis()
+ ", advancing to build time " + systemBuildTime);