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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user