Do not log boot times for secondary users and upgrades
Do not log framework_boot_completed/framework_locked_boot_completed
for secondary users, runtime restarts or first boot/upgrade.
First boot/upgrade also applies to boot_system_server_ready/
boot_package_manager_init_ready
Test: Manual update with fingerprint change
Test: runtime restart - not logged
Bug: 34516002
Bug: 32807863
Change-Id: I2e4237bf49e82101f483df6190111f4541328d19
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index b6c518b..2a5245d 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -280,7 +280,7 @@
Slog.i(TAG, "Entered the Android system server!");
int uptimeMillis = (int) SystemClock.elapsedRealtime();
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, uptimeMillis);
- if (!mRuntimeRestart && !mFirstBoot) {
+ if (!mRuntimeRestart) {
MetricsLogger.histogram(null, "boot_system_server_init", uptimeMillis);
}
@@ -349,7 +349,6 @@
// Create the system service manager.
mSystemServiceManager = new SystemServiceManager(mSystemContext);
mSystemServiceManager.setRuntimeRestarted(mRuntimeRestart);
- mSystemServiceManager.setFirstBoot(mFirstBoot);
LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);
// Prepare the thread pool for init tasks that can be parallelized
SystemServerInitThreadPool.get();
@@ -376,7 +375,7 @@
if (StrictMode.conditionallyEnableDebugLogging()) {
Slog.i(TAG, "Enabled StrictMode for system server main thread.");
}
- if (!mRuntimeRestart && !mFirstBoot) {
+ if (!mRuntimeRestart && !isFirstBootOrUpgrade()) {
int uptimeMillis = (int) SystemClock.elapsedRealtime();
MetricsLogger.histogram(null, "boot_system_server_ready", uptimeMillis);
final int MAX_UPTIME_MILLIS = 60 * 1000;
@@ -391,6 +390,10 @@
throw new RuntimeException("Main thread loop unexpectedly exited");
}
+ private boolean isFirstBootOrUpgrade() {
+ return mPackageManagerService.isFirstBoot() || mPackageManagerService.isUpgrade();
+ }
+
private void reportWtf(String msg, Throwable e) {
Slog.w(TAG, "***********************************************");
Slog.wtf(TAG, "BOOT FAILURE " + msg, e);
@@ -523,7 +526,7 @@
mFirstBoot = mPackageManagerService.isFirstBoot();
mPackageManager = mSystemContext.getPackageManager();
traceEnd();
- if (!mRuntimeRestart && !mFirstBoot) {
+ if (!mRuntimeRestart && !isFirstBootOrUpgrade()) {
MetricsLogger.histogram(null, "boot_package_manager_init_ready",
(int) SystemClock.elapsedRealtime());
}