From efcd3258e9dbfa92f2d3ac0c407c14d906623dc3 Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Mon, 10 May 2021 10:10:34 -0700 Subject: [PATCH] [am] check if codePath is null before checking incremental BUG: 187653672 Test: builds Change-Id: I12eb18e085660a20508a8407b2643ecbcddf1b54 --- .../java/com/android/server/am/ActivityManagerService.java | 7 ++++--- .../com/android/server/am/ProcessErrorStateRecord.java | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 3a8b547fad369..70538bb519a07 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -7726,16 +7726,17 @@ public class ActivityManagerService extends IActivityManager.Stub ApplicationErrorReport.CrashInfo crashInfo) { float loadingProgress = 1; 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) { - final String codePath = r.info.getCodePath(); IncrementalStatesInfo incrementalStatesInfo = mPackageManagerInt.getIncrementalStatesInfo(r.info.packageName, r.uid, r.userId); if (incrementalStatesInfo != null) { 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 Slog.e(TAG, "App crashed on incremental package " + r.info.packageName + " which is " + ((int) (loadingProgress * 100)) + "% loaded."); diff --git a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java index 5a7e14a6907a6..88bd010806b68 100644 --- a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java +++ b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java @@ -400,7 +400,8 @@ class ProcessErrorStateRecord { loadingProgress = incrementalStatesInfo.getProgress(); } 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 Slog.e(TAG, "App ANR on incremental package " + mApp.info.packageName + " which is " + ((int) (loadingProgress * 100)) + "% loaded.");