diff options
| author | 2023-02-25 00:45:29 +0000 | |
|---|---|---|
| committer | 2023-02-25 00:45:29 +0000 | |
| commit | 99a1d5b200f7128abd16b37ca26f1282be5b9c10 (patch) | |
| tree | 5ce4fe71deb43399dd1b8f32abd72ef1df0a3db5 | |
| parent | 48930ee4e77aef39a4eef1d7bdea771acd7cf015 (diff) | |
| parent | 7f958bd4bb69ad5e85835a2cd37a8f1587925ce9 (diff) | |
Merge "Fix NPE." into udc-dev am: 7f958bd4bb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21574322
Change-Id: I89d5f3214e6225c84ef343b4da1a6e843feb54a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 1 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerShellCommand.java | 11 | 
2 files changed, 9 insertions, 3 deletions
| diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 74f799060b46..4a134eef8532 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -16353,6 +16353,7 @@ public class ActivityManagerService extends IActivityManager.Stub      // TODO(b/111541062): This method is only used for updating OOM adjustments. We need to update      // the logic there and in mBatteryStatsService to make them aware of multiple resumed activities +    @Nullable      ProcessRecord getTopApp() {          final WindowProcessController wpc = mAtmInternal != null ? mAtmInternal.getTopApp() : null;          final ProcessRecord r = wpc != null ? (ProcessRecord) wpc.mOwner : null; diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java index aa9d4ccc61ab..72d6ca9fd761 100644 --- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java +++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java @@ -3531,9 +3531,14 @@ final class ActivityManagerShellCommand extends ShellCommand {              if (foregroundActivities) {                  try {                      int prcState = mIam.getUidProcessState(uid, "android"); -                    int topPid = mInternal.getTopApp().getPid(); -                    if (prcState == ProcessStateEnum.TOP && topPid == pid) { -                        mPw.println("New foreground process: " + pid); +                    ProcessRecord topApp = mInternal.getTopApp(); +                    if (topApp == null) { +                        mPw.println("No top app found"); +                    } else { +                        int topPid = topApp.getPid(); +                        if (prcState == ProcessStateEnum.TOP && topPid == pid) { +                            mPw.println("New foreground process: " + pid); +                        }                      }                      mPw.flush();                  } catch (RemoteException e) { |