From abe2a94853108dc522072a20ae1995c58587c775 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 30 May 2017 13:17:25 -0700 Subject: [PATCH] Fix issue #62196301: Pre-O background restrictions allow starts... ...from background apps The check for whether a calling app was in the foreground was way too lose, treating anything better than a receive as foreground. Now we use the same foreground state check as elsewhere. Test: manual Change-Id: I6bb621f207204d14abfadc0d425297e7d5efe0f6 --- .../java/com/android/server/am/ActivityManagerService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index fbab26aa03398..60c0f61afa08b 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -8447,8 +8447,8 @@ public class ActivityManagerService extends IActivityManager.Stub synchronized (mPidsSelfLocked) { proc = mPidsSelfLocked.get(callingPid); } - if (proc != null && proc.curProcState - < ActivityManager.PROCESS_STATE_RECEIVER) { + if (proc != null && + !ActivityManager.isProcStateBackground(proc.curProcState)) { // Whoever is instigating this is in the foreground, so we will allow it // to go through. return ActivityManager.APP_START_MODE_NORMAL;