Merge "[DO NOT MERGE] Do not report boot timings on first boot or runtime restart" into nyc-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1dcfc423cd
@@ -35,6 +35,8 @@ public class SystemServiceManager {
|
|||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private boolean mSafeMode;
|
private boolean mSafeMode;
|
||||||
|
private boolean mRuntimeRestarted;
|
||||||
|
private boolean mFirstBoot;
|
||||||
|
|
||||||
// Services that should receive lifecycle events.
|
// Services that should receive lifecycle events.
|
||||||
private final ArrayList<SystemService> mServices = new ArrayList<SystemService>();
|
private final ArrayList<SystemService> mServices = new ArrayList<SystemService>();
|
||||||
@@ -245,6 +247,28 @@ public class SystemServiceManager {
|
|||||||
return mSafeMode;
|
return mSafeMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if runtime was restarted, false if it's normal boot
|
||||||
|
*/
|
||||||
|
public boolean isRuntimeRestarted() {
|
||||||
|
return mRuntimeRestarted;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRuntimeRestarted(boolean runtimeRestarted) {
|
||||||
|
mRuntimeRestarted = runtimeRestarted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if it's first boot after OTA
|
||||||
|
*/
|
||||||
|
public boolean isFirstBoot() {
|
||||||
|
return mFirstBoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFirstBoot(boolean firstBoot) {
|
||||||
|
mFirstBoot = firstBoot;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the state of this manager to the System log.
|
* Outputs the state of this manager to the System log.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -239,11 +239,12 @@ final class UserController {
|
|||||||
// storage is already unlocked.
|
// storage is already unlocked.
|
||||||
if (uss.setState(STATE_BOOTING, STATE_RUNNING_LOCKED)) {
|
if (uss.setState(STATE_BOOTING, STATE_RUNNING_LOCKED)) {
|
||||||
getUserManagerInternal().setUserState(userId, uss.state);
|
getUserManagerInternal().setUserState(userId, uss.state);
|
||||||
|
if (!mService.mSystemServiceManager.isRuntimeRestarted()
|
||||||
|
&& !mService.mSystemServiceManager.isFirstBoot()) {
|
||||||
int uptimeSeconds = (int)(SystemClock.elapsedRealtime() / 1000);
|
int uptimeSeconds = (int)(SystemClock.elapsedRealtime() / 1000);
|
||||||
MetricsLogger.histogram(mService.mContext, "framework_locked_boot_completed",
|
MetricsLogger.histogram(mService.mContext, "framework_locked_boot_completed",
|
||||||
uptimeSeconds);
|
uptimeSeconds);
|
||||||
|
}
|
||||||
Intent intent = new Intent(Intent.ACTION_LOCKED_BOOT_COMPLETED, null);
|
Intent intent = new Intent(Intent.ACTION_LOCKED_BOOT_COMPLETED, null);
|
||||||
intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
||||||
intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
||||||
@@ -415,8 +416,13 @@ final class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Slog.d(TAG, "Sending BOOT_COMPLETE user #" + userId);
|
Slog.d(TAG, "Sending BOOT_COMPLETE user #" + userId);
|
||||||
int uptimeSeconds = (int)(SystemClock.elapsedRealtime() / 1000);
|
if (!mService.mSystemServiceManager.isRuntimeRestarted()
|
||||||
MetricsLogger.histogram(mService.mContext, "framework_boot_completed", uptimeSeconds);
|
&& !mService.mSystemServiceManager.isFirstBoot()) {
|
||||||
|
|
||||||
|
int uptimeSeconds = (int) (SystemClock.elapsedRealtime() / 1000);
|
||||||
|
MetricsLogger
|
||||||
|
.histogram(mService.mContext, "framework_boot_completed", uptimeSeconds);
|
||||||
|
}
|
||||||
final Intent bootIntent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
|
final Intent bootIntent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
|
||||||
bootIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
bootIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
||||||
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ public final class SystemServer {
|
|||||||
|
|
||||||
private boolean mOnlyCore;
|
private boolean mOnlyCore;
|
||||||
private boolean mFirstBoot;
|
private boolean mFirstBoot;
|
||||||
|
private final boolean mRuntimeRestart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the sensor service.
|
* Start the sensor service.
|
||||||
@@ -224,6 +225,8 @@ public final class SystemServer {
|
|||||||
public SystemServer() {
|
public SystemServer() {
|
||||||
// Check for factory test mode.
|
// Check for factory test mode.
|
||||||
mFactoryTestMode = FactoryTest.getMode();
|
mFactoryTestMode = FactoryTest.getMode();
|
||||||
|
// Remember if it's runtime restart(when sys.boot_completed is already set) or reboot
|
||||||
|
mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void run() {
|
private void run() {
|
||||||
@@ -323,6 +326,8 @@ public final class SystemServer {
|
|||||||
|
|
||||||
// Create the system service manager.
|
// Create the system service manager.
|
||||||
mSystemServiceManager = new SystemServiceManager(mSystemContext);
|
mSystemServiceManager = new SystemServiceManager(mSystemContext);
|
||||||
|
mSystemServiceManager.setRuntimeRestarted(mRuntimeRestart);
|
||||||
|
mSystemServiceManager.setFirstBoot(mFirstBoot);
|
||||||
LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);
|
LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);
|
||||||
} finally {
|
} finally {
|
||||||
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
||||||
|
|||||||
Reference in New Issue
Block a user