Merge "Avoid calling updateOomAdj an extra time" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e5c8e375e1
@@ -22011,12 +22011,13 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
doNext = r.queue.finishReceiverLocked(r, resultCode,
|
doNext = r.queue.finishReceiverLocked(r, resultCode,
|
||||||
resultData, resultExtras, resultAbort, true);
|
resultData, resultExtras, resultAbort, true);
|
||||||
}
|
}
|
||||||
|
if (doNext) {
|
||||||
|
r.queue.processNextBroadcastLocked(/*fromMsg=*/ false, /*skipOomAdj=*/ true);
|
||||||
|
}
|
||||||
|
// updateOomAdjLocked() will be done here
|
||||||
|
trimApplicationsLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doNext) {
|
|
||||||
r.queue.processNextBroadcast(false);
|
|
||||||
}
|
|
||||||
trimApplications();
|
|
||||||
} finally {
|
} finally {
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
}
|
}
|
||||||
@@ -25747,40 +25748,43 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
|
|
||||||
final void trimApplications() {
|
final void trimApplications() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
int i;
|
trimApplicationsLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// First remove any unused application processes whose package
|
final void trimApplicationsLocked() {
|
||||||
// has been removed.
|
// First remove any unused application processes whose package
|
||||||
for (i=mRemovedProcesses.size()-1; i>=0; i--) {
|
// has been removed.
|
||||||
final ProcessRecord app = mRemovedProcesses.get(i);
|
for (int i=mRemovedProcesses.size()-1; i>=0; i--) {
|
||||||
if (app.activities.size() == 0 && app.recentTasks.size() == 0
|
final ProcessRecord app = mRemovedProcesses.get(i);
|
||||||
&& app.curReceivers.isEmpty() && app.services.size() == 0) {
|
if (app.activities.size() == 0 && app.recentTasks.size() == 0
|
||||||
Slog.i(
|
&& app.curReceivers.isEmpty() && app.services.size() == 0) {
|
||||||
TAG, "Exiting empty application process "
|
Slog.i(
|
||||||
+ app.toShortString() + " ("
|
TAG, "Exiting empty application process "
|
||||||
+ (app.thread != null ? app.thread.asBinder() : null)
|
+ app.toShortString() + " ("
|
||||||
+ ")\n");
|
+ (app.thread != null ? app.thread.asBinder() : null)
|
||||||
if (app.pid > 0 && app.pid != MY_PID) {
|
+ ")\n");
|
||||||
app.kill("empty", false);
|
if (app.pid > 0 && app.pid != MY_PID) {
|
||||||
} else if (app.thread != null) {
|
app.kill("empty", false);
|
||||||
try {
|
} else if (app.thread != null) {
|
||||||
app.thread.scheduleExit();
|
try {
|
||||||
} catch (Exception e) {
|
app.thread.scheduleExit();
|
||||||
// Ignore exceptions.
|
} catch (Exception e) {
|
||||||
}
|
// Ignore exceptions.
|
||||||
}
|
|
||||||
cleanUpApplicationRecordLocked(app, false, true, -1, false /*replacingPid*/);
|
|
||||||
mRemovedProcesses.remove(i);
|
|
||||||
|
|
||||||
if (app.persistent) {
|
|
||||||
addAppLocked(app.info, null, false, null /* ABI override */);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
cleanUpApplicationRecordLocked(app, false, true, -1, false /*replacingPid*/);
|
||||||
|
mRemovedProcesses.remove(i);
|
||||||
|
|
||||||
// Now update the oom adj for all processes.
|
if (app.persistent) {
|
||||||
updateOomAdjLocked();
|
addAppLocked(app.info, null, false, null /* ABI override */);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 */
|
/** This method sends the specified signal to each of the persistent apps */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user