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

Commit e3176776 authored by Amith Yamasani's avatar Amith Yamasani Committed by android-build-merger
Browse files

Merge "Avoid calling updateOomAdj an extra time" into pi-dev

am: e5c8e375

Change-Id: I37d9c6ca73f7151805266caf5b6eec5fa55ab075
parents 694d77c8 e5c8e375
Loading
Loading
Loading
Loading
+37 −33
Original line number Diff line number Diff line
@@ -21890,12 +21890,13 @@ public class ActivityManagerService extends IActivityManager.Stub
                    doNext = r.queue.finishReceiverLocked(r, resultCode,
                        resultData, resultExtras, resultAbort, true);
                }
            }
                if (doNext) {
                r.queue.processNextBroadcast(false);
                    r.queue.processNextBroadcastLocked(/*fromMsg=*/ false, /*skipOomAdj=*/ true);
                }
            trimApplications();
                // updateOomAdjLocked() will be done here
                trimApplicationsLocked();
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
@@ -25626,11 +25627,14 @@ public class ActivityManagerService extends IActivityManager.Stub
    final void trimApplications() {
        synchronized (this) {
            int i;
            trimApplicationsLocked();
        }
    }
    final void trimApplicationsLocked() {
        // First remove any unused application processes whose package
        // has been removed.
            for (i=mRemovedProcesses.size()-1; i>=0; i--) {
        for (int i=mRemovedProcesses.size()-1; i>=0; i--) {
            final ProcessRecord app = mRemovedProcesses.get(i);
            if (app.activities.size() == 0 && app.recentTasks.size() == 0
                    && app.curReceivers.isEmpty() && app.services.size() == 0) {
@@ -25657,10 +25661,10 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
        }
            // Now update the oom adj for all processes.
        // Now update the oom adj for all processes. Don't skip this, since other callers
        // might be depending on it.
        updateOomAdjLocked();
    }
    }
    /** This method sends the specified signal to each of the persistent apps */
    public void signalPersistentProcesses(int sig) throws RemoteException {
+517 −511
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ public final class BroadcastQueue {
    }

    private final void processCurBroadcastLocked(BroadcastRecord r,
            ProcessRecord app) throws RemoteException {
            ProcessRecord app, boolean skipOomAdj) throws RemoteException {
        if (DEBUG_BROADCAST)  Slog.v(TAG_BROADCAST,
                "Process cur broadcast " + r + " for app " + app);
        if (app.thread == null) {
@@ -287,7 +287,9 @@ public final class BroadcastQueue {
        app.curReceivers.add(r);
        app.forceProcessStateUpTo(ActivityManager.PROCESS_STATE_RECEIVER);
        mService.updateLruProcessLocked(app, false, null);
        if (!skipOomAdj) {
            mService.updateOomAdjLocked();
        }

        // Tell the application to launch this receiver.
        r.intent.setComponent(r.curComponent);
@@ -328,7 +330,7 @@ public final class BroadcastQueue {
            }
            try {
                mPendingBroadcast = null;
                processCurBroadcastLocked(br, app);
                processCurBroadcastLocked(br, app, false);
                didSomething = true;
            } catch (Exception e) {
                Slog.w(TAG, "Exception in new application when starting receiver "
@@ -820,6 +822,11 @@ public final class BroadcastQueue {

    final void processNextBroadcast(boolean fromMsg) {
        synchronized (mService) {
            processNextBroadcastLocked(fromMsg, false);
        }
    }

    final void processNextBroadcastLocked(boolean fromMsg, boolean skipOomAdj) {
        BroadcastRecord r;

        if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "processNextBroadcast ["
@@ -1337,7 +1344,7 @@ public final class BroadcastQueue {
            try {
                app.addPackage(info.activityInfo.packageName,
                        info.activityInfo.applicationInfo.versionCode, mService.mProcessStats);
                    processCurBroadcastLocked(r, app);
                processCurBroadcastLocked(r, app, skipOomAdj);
                return;
            } catch (RemoteException e) {
                Slog.w(TAG, "Exception when sending broadcast to "
@@ -1390,7 +1397,6 @@ public final class BroadcastQueue {
        mPendingBroadcast = r;
        mPendingBroadcastRecvIndex = recIdx;
    }
    }

    final void setBroadcastTimeoutLocked(long timeoutTime) {
        if (! mPendingBroadcastTimeoutMessage) {