Merge "Ensure the system boots with a halfway sane time/date" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
45fe7eef89
@@ -36,6 +36,7 @@ import android.database.ContentObserver;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -949,6 +950,16 @@ 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) {
|
||||||
|
final long systemBuildTime = Environment.getRootDirectory().lastModified();
|
||||||
|
if (System.currentTimeMillis() < systemBuildTime) {
|
||||||
|
Slog.i(TAG, "Current time only " + System.currentTimeMillis()
|
||||||
|
+ ", advancing to build time " + systemBuildTime);
|
||||||
|
setKernelTime(mNativeData, systemBuildTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PowerManager pm = (PowerManager) getContext().getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager) getContext().getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "*alarm*");
|
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "*alarm*");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user