Merge "[am] check if codePath is null before checking incremental" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-05-11 00:13:09 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 4 deletions

View File

@@ -7726,16 +7726,17 @@ public class ActivityManagerService extends IActivityManager.Stub
ApplicationErrorReport.CrashInfo crashInfo) { ApplicationErrorReport.CrashInfo crashInfo) {
float loadingProgress = 1; float loadingProgress = 1;
IncrementalMetrics incrementalMetrics = null; IncrementalMetrics incrementalMetrics = null;
// Notify package manager service to possibly update package state // Obtain Incremental information if available
if (r != null && r.info != null && r.info.packageName != null) { if (r != null && r.info != null && r.info.packageName != null) {
final String codePath = r.info.getCodePath();
IncrementalStatesInfo incrementalStatesInfo = IncrementalStatesInfo incrementalStatesInfo =
mPackageManagerInt.getIncrementalStatesInfo(r.info.packageName, r.uid, mPackageManagerInt.getIncrementalStatesInfo(r.info.packageName, r.uid,
r.userId); r.userId);
if (incrementalStatesInfo != null) { if (incrementalStatesInfo != null) {
loadingProgress = incrementalStatesInfo.getProgress(); loadingProgress = incrementalStatesInfo.getProgress();
} }
if (IncrementalManager.isIncrementalPath(codePath)) { final String codePath = r.info.getCodePath();
if (codePath != null && !codePath.isEmpty()
&& IncrementalManager.isIncrementalPath(codePath)) {
// Report in the main log about the incremental package // Report in the main log about the incremental package
Slog.e(TAG, "App crashed on incremental package " + r.info.packageName Slog.e(TAG, "App crashed on incremental package " + r.info.packageName
+ " which is " + ((int) (loadingProgress * 100)) + "% loaded."); + " which is " + ((int) (loadingProgress * 100)) + "% loaded.");

View File

@@ -400,7 +400,8 @@ class ProcessErrorStateRecord {
loadingProgress = incrementalStatesInfo.getProgress(); loadingProgress = incrementalStatesInfo.getProgress();
} }
final String codePath = mApp.info.getCodePath(); final String codePath = mApp.info.getCodePath();
if (IncrementalManager.isIncrementalPath(codePath)) { if (codePath != null && !codePath.isEmpty()
&& IncrementalManager.isIncrementalPath(codePath)) {
// Report in the main log that the incremental package is still loading // Report in the main log that the incremental package is still loading
Slog.e(TAG, "App ANR on incremental package " + mApp.info.packageName Slog.e(TAG, "App ANR on incremental package " + mApp.info.packageName
+ " which is " + ((int) (loadingProgress * 100)) + "% loaded."); + " which is " + ((int) (loadingProgress * 100)) + "% loaded.");