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

Commit 5da1969b authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Fix foreground service evaluation"

parents 688dc529 ca97e212
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1478,7 +1478,6 @@ public final class ActiveServices {
            if (sr.isForeground || sr.fgRequired) {
                anyForeground = true;
                fgServiceTypes |= sr.foregroundServiceType;
                break;
            }
        }
        mAm.updateProcessForegroundLocked(proc, anyForeground, fgServiceTypes, oomAdj);
+6 −9
Original line number Diff line number Diff line
@@ -16389,12 +16389,10 @@ public class ActivityManagerService extends IActivityManager.Stub
    @GuardedBy("this")
    final void updateProcessForegroundLocked(ProcessRecord proc, boolean isForeground,
            int fgServiceTypes, boolean oomAdj) {
        proc.setHasForegroundServices(isForeground, fgServiceTypes);
        final boolean hasFgServiceLocationType =
                (fgServiceTypes & ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION) != 0;
        if (isForeground != proc.hasForegroundServices()
                || proc.hasLocationForegroundServices() != hasFgServiceLocationType) {
                || proc.getForegroundServiceTypes() != fgServiceTypes) {
            proc.setHasForegroundServices(isForeground, fgServiceTypes);
            ArrayList<ProcessRecord> curProcs = mForegroundPackages.get(proc.info.packageName,
                    proc.info.uid);
            if (isForeground) {
@@ -16419,16 +16417,15 @@ public class ActivityManagerService extends IActivityManager.Stub
                    }
                }
            }
            if (oomAdj) {
                updateOomAdjLocked();
            }
        }
        if (proc.getForegroundServiceTypes() != fgServiceTypes) {
            proc.setReportedForegroundServiceTypes(fgServiceTypes);
            ProcessChangeItem item = enqueueProcessChangeItemLocked(proc.info.uid, proc.pid);
            item.changes = ProcessChangeItem.CHANGE_FOREGROUND_SERVICES;
            item.foregroundServiceTypes = fgServiceTypes;
            if (oomAdj) {
                updateOomAdjLocked();
            }
        }
    }