Loading services/core/java/com/android/server/Watchdog.java +3 −3 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ import android.os.ServiceDebugInfo; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.sysprop.WatchdogProperties; import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.sysprop.WatchdogProperties; import com.android.internal.os.ProcessCpuTracker; import com.android.internal.os.ZygoteConnectionConstants; Loading @@ -56,9 +56,9 @@ import java.io.IOException; import java.io.StringWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.concurrent.TimeUnit; import java.util.HashSet; import java.util.List; import java.util.concurrent.TimeUnit; /** This class calls its monitor every minute. Killing this process if they don't return **/ public class Watchdog { Loading Loading @@ -688,7 +688,7 @@ public class Watchdog { if (mActivity != null) { mActivity.addErrorToDropBox( "watchdog", null, "system_server", null, null, null, subject, report.toString(), stack, null); subject, report.toString(), stack, null, null, null); } FrameworkStatsLog.write(FrameworkStatsLog.SYSTEM_SERVER_WATCHDOG_OCCURRED, subject); Loading services/core/java/com/android/server/am/ActivityManagerService.java +27 −11 Original line number Diff line number Diff line Loading @@ -7706,9 +7706,8 @@ public class ActivityManagerService extends IActivityManager.Stub */ void handleApplicationCrashInner(String eventType, ProcessRecord r, String processName, ApplicationErrorReport.CrashInfo crashInfo) { boolean isIncremental = false; float loadingProgress = 1; long millisSinceOldestPendingRead = 0; IncrementalMetrics incrementalMetrics = null; // Notify package manager service to possibly update package state if (r != null && r.info != null && r.info.packageName != null) { final String codePath = r.info.getCodePath(); Loading @@ -7719,8 +7718,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (incrementalStatesInfo != null) { loadingProgress = incrementalStatesInfo.getProgress(); } isIncremental = IncrementalManager.isIncrementalPath(codePath); if (isIncremental) { if (IncrementalManager.isIncrementalPath(codePath)) { // Report in the main log about the incremental package Slog.e(TAG, "App crashed on incremental package " + r.info.packageName + " which is " + ((int) (loadingProgress * 100)) + "% loaded."); Loading @@ -7729,8 +7727,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (incrementalService != null) { final IncrementalManager incrementalManager = new IncrementalManager( IIncrementalService.Stub.asInterface(incrementalService)); IncrementalMetrics metrics = incrementalManager.getMetrics(codePath); millisSinceOldestPendingRead = metrics.getMillisSinceOldestPendingRead(); incrementalMetrics = incrementalManager.getMetrics(codePath); } } } Loading Loading @@ -7760,7 +7757,9 @@ public class ActivityManagerService extends IActivityManager.Stub processName.equals("system_server") ? ServerProtoEnums.SYSTEM_SERVER : (r != null) ? r.getProcessClassEnum() : ServerProtoEnums.ERROR_SOURCE_UNKNOWN, isIncremental, loadingProgress, millisSinceOldestPendingRead incrementalMetrics != null /* isIncremental */, loadingProgress, incrementalMetrics != null ? incrementalMetrics.getMillisSinceOldestPendingRead() : -1 ); final int relaunchReason = r == null ? RELAUNCH_REASON_NONE Loading @@ -7773,7 +7772,8 @@ public class ActivityManagerService extends IActivityManager.Stub } addErrorToDropBox( eventType, r, processName, null, null, null, null, null, null, crashInfo); eventType, r, processName, null, null, null, null, null, null, crashInfo, new Float(loadingProgress), incrementalMetrics); mAppErrors.crashApplication(r, crashInfo); } Loading Loading @@ -7955,7 +7955,8 @@ public class ActivityManagerService extends IActivityManager.Stub FrameworkStatsLog.write(FrameworkStatsLog.WTF_OCCURRED, callingUid, tag, processName, callingPid, (r != null) ? r.getProcessClassEnum() : 0); addErrorToDropBox("wtf", r, processName, null, null, null, tag, null, null, crashInfo); addErrorToDropBox("wtf", r, processName, null, null, null, tag, null, null, crashInfo, null, null); return r; } Loading @@ -7980,7 +7981,7 @@ public class ActivityManagerService extends IActivityManager.Stub for (Pair<String, ApplicationErrorReport.CrashInfo> p = list.poll(); p != null; p = list.poll()) { addErrorToDropBox("wtf", proc, "system_server", null, null, null, p.first, null, null, p.second); p.second, null, null); } } Loading Loading @@ -8069,12 +8070,15 @@ public class ActivityManagerService extends IActivityManager.Stub * @param report in long form describing the error, null if absent * @param dataFile text file to include in the report, null if none * @param crashInfo giving an application stack trace, null if absent * @param loadingProgress the loading progress of an installed package, range in [0, 1]. * @param incrementalMetrics metrics for apps installed on Incremental. */ public void addErrorToDropBox(String eventType, ProcessRecord process, String processName, String activityShortComponentName, String parentShortComponentName, ProcessRecord parentProcess, String subject, final String report, final File dataFile, final ApplicationErrorReport.CrashInfo crashInfo) { final ApplicationErrorReport.CrashInfo crashInfo, @Nullable Float loadingProgress, @Nullable IncrementalMetrics incrementalMetrics) { // NOTE -- this must never acquire the ActivityManagerService lock, // otherwise the watchdog may be prevented from resetting the system. Loading Loading @@ -8135,6 +8139,18 @@ public class ActivityManagerService extends IActivityManager.Stub if (crashInfo != null && crashInfo.crashTag != null && !crashInfo.crashTag.isEmpty()) { sb.append("Crash-Tag: ").append(crashInfo.crashTag).append("\n"); } if (loadingProgress != null) { sb.append("Loading-Progress: ").append(loadingProgress.floatValue()).append("\n"); } if (incrementalMetrics != null) { sb.append("Incremental: Yes").append("\n"); final long millisSinceOldestPendingRead = incrementalMetrics.getMillisSinceOldestPendingRead(); if (millisSinceOldestPendingRead > 0) { sb.append("Millis-Since-Oldest-Pending-Read: ").append( millisSinceOldestPendingRead).append("\n"); } } sb.append("\n"); // Do the rest in a worker thread to avoid blocking the caller on I/O Loading services/core/java/com/android/server/am/AppProfiler.java +1 −1 Original line number Diff line number Diff line Loading @@ -1627,7 +1627,7 @@ public class AppProfiler { dropBuilder.append(catSw.toString()); FrameworkStatsLog.write(FrameworkStatsLog.LOW_MEM_REPORTED); mService.addErrorToDropBox("lowmem", null, "system_server", null, null, null, tag.toString(), dropBuilder.toString(), null, null); null, null, tag.toString(), dropBuilder.toString(), null, null, null, null); synchronized (mService) { long now = SystemClock.uptimeMillis(); if (mLastMemUsageReportTime < now) { Loading services/core/java/com/android/server/am/ProcessErrorStateRecord.java +8 −9 Original line number Diff line number Diff line Loading @@ -300,9 +300,8 @@ class ProcessErrorStateRecord { } // Check if package is still being loaded boolean isIncremental = false; float loadingProgress = 1; long millisSinceOldestPendingRead = 0; IncrementalMetrics incrementalMetrics = null; final PackageManagerInternal packageManagerInternal = mService.getPackageManagerInternal(); if (aInfo != null && aInfo.packageName != null) { IncrementalStatesInfo incrementalStatesInfo = Loading @@ -312,8 +311,7 @@ class ProcessErrorStateRecord { loadingProgress = incrementalStatesInfo.getProgress(); } final String codePath = aInfo.getCodePath(); isIncremental = IncrementalManager.isIncrementalPath(codePath); if (isIncremental) { if (IncrementalManager.isIncrementalPath(codePath)) { // Report in the main log that the incremental package is still loading Slog.e(TAG, "App crashed on incremental package " + aInfo.packageName + " which is " + ((int) (loadingProgress * 100)) + "% loaded."); Loading @@ -322,8 +320,7 @@ class ProcessErrorStateRecord { if (incrementalService != null) { final IncrementalManager incrementalManager = new IncrementalManager( IIncrementalService.Stub.asInterface(incrementalService)); IncrementalMetrics metrics = incrementalManager.getMetrics(codePath); millisSinceOldestPendingRead = metrics.getMillisSinceOldestPendingRead(); incrementalMetrics = incrementalManager.getMetrics(codePath); } } } Loading @@ -345,7 +342,7 @@ class ProcessErrorStateRecord { info.append("Parent: ").append(parentShortComponentName).append("\n"); } if (isIncremental) { if (incrementalMetrics != null) { // Report in the main log about the incremental package info.append("Package is ").append((int) (loadingProgress * 100)).append("% loaded.\n"); } Loading Loading @@ -434,12 +431,14 @@ class ProcessErrorStateRecord { : FrameworkStatsLog.ANROCCURRED__FOREGROUND_STATE__BACKGROUND, mApp.getProcessClassEnum(), (mApp.info != null) ? mApp.info.packageName : "", isIncremental, loadingProgress, millisSinceOldestPendingRead); incrementalMetrics != null /* isIncremental */, loadingProgress, incrementalMetrics != null ? incrementalMetrics.getMillisSinceOldestPendingRead() : -1); final ProcessRecord parentPr = parentProcess != null ? (ProcessRecord) parentProcess.mOwner : null; mService.addErrorToDropBox("anr", mApp, mApp.processName, activityShortComponentName, parentShortComponentName, parentPr, annotation, report.toString(), tracesFile, null); null, new Float(loadingProgress), incrementalMetrics); if (mApp.getWindowProcessController().appNotResponding(info.toString(), () -> { Loading Loading
services/core/java/com/android/server/Watchdog.java +3 −3 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ import android.os.ServiceDebugInfo; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.sysprop.WatchdogProperties; import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.sysprop.WatchdogProperties; import com.android.internal.os.ProcessCpuTracker; import com.android.internal.os.ZygoteConnectionConstants; Loading @@ -56,9 +56,9 @@ import java.io.IOException; import java.io.StringWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.concurrent.TimeUnit; import java.util.HashSet; import java.util.List; import java.util.concurrent.TimeUnit; /** This class calls its monitor every minute. Killing this process if they don't return **/ public class Watchdog { Loading Loading @@ -688,7 +688,7 @@ public class Watchdog { if (mActivity != null) { mActivity.addErrorToDropBox( "watchdog", null, "system_server", null, null, null, subject, report.toString(), stack, null); subject, report.toString(), stack, null, null, null); } FrameworkStatsLog.write(FrameworkStatsLog.SYSTEM_SERVER_WATCHDOG_OCCURRED, subject); Loading
services/core/java/com/android/server/am/ActivityManagerService.java +27 −11 Original line number Diff line number Diff line Loading @@ -7706,9 +7706,8 @@ public class ActivityManagerService extends IActivityManager.Stub */ void handleApplicationCrashInner(String eventType, ProcessRecord r, String processName, ApplicationErrorReport.CrashInfo crashInfo) { boolean isIncremental = false; float loadingProgress = 1; long millisSinceOldestPendingRead = 0; IncrementalMetrics incrementalMetrics = null; // Notify package manager service to possibly update package state if (r != null && r.info != null && r.info.packageName != null) { final String codePath = r.info.getCodePath(); Loading @@ -7719,8 +7718,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (incrementalStatesInfo != null) { loadingProgress = incrementalStatesInfo.getProgress(); } isIncremental = IncrementalManager.isIncrementalPath(codePath); if (isIncremental) { if (IncrementalManager.isIncrementalPath(codePath)) { // Report in the main log about the incremental package Slog.e(TAG, "App crashed on incremental package " + r.info.packageName + " which is " + ((int) (loadingProgress * 100)) + "% loaded."); Loading @@ -7729,8 +7727,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (incrementalService != null) { final IncrementalManager incrementalManager = new IncrementalManager( IIncrementalService.Stub.asInterface(incrementalService)); IncrementalMetrics metrics = incrementalManager.getMetrics(codePath); millisSinceOldestPendingRead = metrics.getMillisSinceOldestPendingRead(); incrementalMetrics = incrementalManager.getMetrics(codePath); } } } Loading Loading @@ -7760,7 +7757,9 @@ public class ActivityManagerService extends IActivityManager.Stub processName.equals("system_server") ? ServerProtoEnums.SYSTEM_SERVER : (r != null) ? r.getProcessClassEnum() : ServerProtoEnums.ERROR_SOURCE_UNKNOWN, isIncremental, loadingProgress, millisSinceOldestPendingRead incrementalMetrics != null /* isIncremental */, loadingProgress, incrementalMetrics != null ? incrementalMetrics.getMillisSinceOldestPendingRead() : -1 ); final int relaunchReason = r == null ? RELAUNCH_REASON_NONE Loading @@ -7773,7 +7772,8 @@ public class ActivityManagerService extends IActivityManager.Stub } addErrorToDropBox( eventType, r, processName, null, null, null, null, null, null, crashInfo); eventType, r, processName, null, null, null, null, null, null, crashInfo, new Float(loadingProgress), incrementalMetrics); mAppErrors.crashApplication(r, crashInfo); } Loading Loading @@ -7955,7 +7955,8 @@ public class ActivityManagerService extends IActivityManager.Stub FrameworkStatsLog.write(FrameworkStatsLog.WTF_OCCURRED, callingUid, tag, processName, callingPid, (r != null) ? r.getProcessClassEnum() : 0); addErrorToDropBox("wtf", r, processName, null, null, null, tag, null, null, crashInfo); addErrorToDropBox("wtf", r, processName, null, null, null, tag, null, null, crashInfo, null, null); return r; } Loading @@ -7980,7 +7981,7 @@ public class ActivityManagerService extends IActivityManager.Stub for (Pair<String, ApplicationErrorReport.CrashInfo> p = list.poll(); p != null; p = list.poll()) { addErrorToDropBox("wtf", proc, "system_server", null, null, null, p.first, null, null, p.second); p.second, null, null); } } Loading Loading @@ -8069,12 +8070,15 @@ public class ActivityManagerService extends IActivityManager.Stub * @param report in long form describing the error, null if absent * @param dataFile text file to include in the report, null if none * @param crashInfo giving an application stack trace, null if absent * @param loadingProgress the loading progress of an installed package, range in [0, 1]. * @param incrementalMetrics metrics for apps installed on Incremental. */ public void addErrorToDropBox(String eventType, ProcessRecord process, String processName, String activityShortComponentName, String parentShortComponentName, ProcessRecord parentProcess, String subject, final String report, final File dataFile, final ApplicationErrorReport.CrashInfo crashInfo) { final ApplicationErrorReport.CrashInfo crashInfo, @Nullable Float loadingProgress, @Nullable IncrementalMetrics incrementalMetrics) { // NOTE -- this must never acquire the ActivityManagerService lock, // otherwise the watchdog may be prevented from resetting the system. Loading Loading @@ -8135,6 +8139,18 @@ public class ActivityManagerService extends IActivityManager.Stub if (crashInfo != null && crashInfo.crashTag != null && !crashInfo.crashTag.isEmpty()) { sb.append("Crash-Tag: ").append(crashInfo.crashTag).append("\n"); } if (loadingProgress != null) { sb.append("Loading-Progress: ").append(loadingProgress.floatValue()).append("\n"); } if (incrementalMetrics != null) { sb.append("Incremental: Yes").append("\n"); final long millisSinceOldestPendingRead = incrementalMetrics.getMillisSinceOldestPendingRead(); if (millisSinceOldestPendingRead > 0) { sb.append("Millis-Since-Oldest-Pending-Read: ").append( millisSinceOldestPendingRead).append("\n"); } } sb.append("\n"); // Do the rest in a worker thread to avoid blocking the caller on I/O Loading
services/core/java/com/android/server/am/AppProfiler.java +1 −1 Original line number Diff line number Diff line Loading @@ -1627,7 +1627,7 @@ public class AppProfiler { dropBuilder.append(catSw.toString()); FrameworkStatsLog.write(FrameworkStatsLog.LOW_MEM_REPORTED); mService.addErrorToDropBox("lowmem", null, "system_server", null, null, null, tag.toString(), dropBuilder.toString(), null, null); null, null, tag.toString(), dropBuilder.toString(), null, null, null, null); synchronized (mService) { long now = SystemClock.uptimeMillis(); if (mLastMemUsageReportTime < now) { Loading
services/core/java/com/android/server/am/ProcessErrorStateRecord.java +8 −9 Original line number Diff line number Diff line Loading @@ -300,9 +300,8 @@ class ProcessErrorStateRecord { } // Check if package is still being loaded boolean isIncremental = false; float loadingProgress = 1; long millisSinceOldestPendingRead = 0; IncrementalMetrics incrementalMetrics = null; final PackageManagerInternal packageManagerInternal = mService.getPackageManagerInternal(); if (aInfo != null && aInfo.packageName != null) { IncrementalStatesInfo incrementalStatesInfo = Loading @@ -312,8 +311,7 @@ class ProcessErrorStateRecord { loadingProgress = incrementalStatesInfo.getProgress(); } final String codePath = aInfo.getCodePath(); isIncremental = IncrementalManager.isIncrementalPath(codePath); if (isIncremental) { if (IncrementalManager.isIncrementalPath(codePath)) { // Report in the main log that the incremental package is still loading Slog.e(TAG, "App crashed on incremental package " + aInfo.packageName + " which is " + ((int) (loadingProgress * 100)) + "% loaded."); Loading @@ -322,8 +320,7 @@ class ProcessErrorStateRecord { if (incrementalService != null) { final IncrementalManager incrementalManager = new IncrementalManager( IIncrementalService.Stub.asInterface(incrementalService)); IncrementalMetrics metrics = incrementalManager.getMetrics(codePath); millisSinceOldestPendingRead = metrics.getMillisSinceOldestPendingRead(); incrementalMetrics = incrementalManager.getMetrics(codePath); } } } Loading @@ -345,7 +342,7 @@ class ProcessErrorStateRecord { info.append("Parent: ").append(parentShortComponentName).append("\n"); } if (isIncremental) { if (incrementalMetrics != null) { // Report in the main log about the incremental package info.append("Package is ").append((int) (loadingProgress * 100)).append("% loaded.\n"); } Loading Loading @@ -434,12 +431,14 @@ class ProcessErrorStateRecord { : FrameworkStatsLog.ANROCCURRED__FOREGROUND_STATE__BACKGROUND, mApp.getProcessClassEnum(), (mApp.info != null) ? mApp.info.packageName : "", isIncremental, loadingProgress, millisSinceOldestPendingRead); incrementalMetrics != null /* isIncremental */, loadingProgress, incrementalMetrics != null ? incrementalMetrics.getMillisSinceOldestPendingRead() : -1); final ProcessRecord parentPr = parentProcess != null ? (ProcessRecord) parentProcess.mOwner : null; mService.addErrorToDropBox("anr", mApp, mApp.processName, activityShortComponentName, parentShortComponentName, parentPr, annotation, report.toString(), tracesFile, null); null, new Float(loadingProgress), incrementalMetrics); if (mApp.getWindowProcessController().appNotResponding(info.toString(), () -> { Loading