Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bce0a3a4 authored by Hui Yu's avatar Hui Yu
Browse files

Check PendingStartActivityUids in getAppStartModeLocked.

While starting activity, WindowManager posts a runnable to DisplayThread to updateOomAdj.
The UidRecord update could be delayed.

In getAppStartModeLocked(), before checking UidRecord, check PendingStartActivityUids
 to determine if the uid is in foreground state.

Bug: 160213874
Test: Reproduce steps in b/160213874, launch GCA and take a photo immediately.
Change-Id: Ieb984d2f629d607abfbda89ca00f8785cf5923fd
parent 413150f2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6341,6 +6341,9 @@ public class ActivityManagerService extends IActivityManager.Stub
    int getAppStartModeLocked(int uid, String packageName, int packageTargetSdk,
            int callingPid, boolean alwaysRestrict, boolean disabledOnly, boolean forcedStandby) {
        if (mInternal.isPendingTopUid(uid)) {
            return ActivityManager.APP_START_MODE_NORMAL;
        }
        UidRecord uidRec = mProcessList.getUidRecordLocked(uid);
        if (DEBUG_BACKGROUND_CHECK) Slog.d(TAG, "checkAllowBackground: uid=" + uid + " pkg="
                + packageName + " rec=" + uidRec + " always=" + alwaysRestrict + " idle="