[DO NOT MERGE] Do not report boot timings on first boot or runtime restart
am: 83a218c416
Change-Id: Ib503ffb8d0d718aa6af4b420cc71e32a033e658b
This commit is contained in:
@@ -35,6 +35,8 @@ public class SystemServiceManager {
|
||||
|
||||
private final Context mContext;
|
||||
private boolean mSafeMode;
|
||||
private boolean mRuntimeRestarted;
|
||||
private boolean mFirstBoot;
|
||||
|
||||
// Services that should receive lifecycle events.
|
||||
private final ArrayList<SystemService> mServices = new ArrayList<SystemService>();
|
||||
@@ -245,6 +247,28 @@ public class SystemServiceManager {
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -239,11 +239,12 @@ final class UserController {
|
||||
// storage is already unlocked.
|
||||
if (uss.setState(STATE_BOOTING, STATE_RUNNING_LOCKED)) {
|
||||
getUserManagerInternal().setUserState(userId, uss.state);
|
||||
|
||||
int uptimeSeconds = (int)(SystemClock.elapsedRealtime() / 1000);
|
||||
MetricsLogger.histogram(mService.mContext, "framework_locked_boot_completed",
|
||||
uptimeSeconds);
|
||||
|
||||
if (!mService.mSystemServiceManager.isRuntimeRestarted()
|
||||
&& !mService.mSystemServiceManager.isFirstBoot()) {
|
||||
int uptimeSeconds = (int)(SystemClock.elapsedRealtime() / 1000);
|
||||
MetricsLogger.histogram(mService.mContext, "framework_locked_boot_completed",
|
||||
uptimeSeconds);
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_LOCKED_BOOT_COMPLETED, null);
|
||||
intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
||||
@@ -415,8 +416,13 @@ final class UserController {
|
||||
}
|
||||
|
||||
Slog.d(TAG, "Sending BOOT_COMPLETE user #" + userId);
|
||||
int uptimeSeconds = (int)(SystemClock.elapsedRealtime() / 1000);
|
||||
MetricsLogger.histogram(mService.mContext, "framework_boot_completed", uptimeSeconds);
|
||||
if (!mService.mSystemServiceManager.isRuntimeRestarted()
|
||||
&& !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);
|
||||
bootIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
|
||||
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
|
||||
|
||||
@@ -208,6 +208,7 @@ public final class SystemServer {
|
||||
|
||||
private boolean mOnlyCore;
|
||||
private boolean mFirstBoot;
|
||||
private final boolean mRuntimeRestart;
|
||||
|
||||
/**
|
||||
* Start the sensor service.
|
||||
@@ -224,6 +225,8 @@ public final class SystemServer {
|
||||
public SystemServer() {
|
||||
// Check for factory test mode.
|
||||
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() {
|
||||
@@ -323,6 +326,8 @@ public final class SystemServer {
|
||||
|
||||
// Create the system service manager.
|
||||
mSystemServiceManager = new SystemServiceManager(mSystemContext);
|
||||
mSystemServiceManager.setRuntimeRestarted(mRuntimeRestart);
|
||||
mSystemServiceManager.setFirstBoot(mFirstBoot);
|
||||
LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);
|
||||
} finally {
|
||||
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
||||
|
||||
Reference in New Issue
Block a user