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,
|
||||
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 {
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
}
|
||||
@@ -25747,40 +25748,43 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
|
||||
final void trimApplications() {
|
||||
synchronized (this) {
|
||||
int i;
|
||||
trimApplicationsLocked();
|
||||
}
|
||||
}
|
||||
|
||||
// First remove any unused application processes whose package
|
||||
// has been removed.
|
||||
for (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) {
|
||||
Slog.i(
|
||||
TAG, "Exiting empty application process "
|
||||
+ app.toShortString() + " ("
|
||||
+ (app.thread != null ? app.thread.asBinder() : null)
|
||||
+ ")\n");
|
||||
if (app.pid > 0 && app.pid != MY_PID) {
|
||||
app.kill("empty", false);
|
||||
} else if (app.thread != null) {
|
||||
try {
|
||||
app.thread.scheduleExit();
|
||||
} 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 */);
|
||||
final void trimApplicationsLocked() {
|
||||
// First remove any unused application processes whose package
|
||||
// has been removed.
|
||||
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) {
|
||||
Slog.i(
|
||||
TAG, "Exiting empty application process "
|
||||
+ app.toShortString() + " ("
|
||||
+ (app.thread != null ? app.thread.asBinder() : null)
|
||||
+ ")\n");
|
||||
if (app.pid > 0 && app.pid != MY_PID) {
|
||||
app.kill("empty", false);
|
||||
} else if (app.thread != null) {
|
||||
try {
|
||||
app.thread.scheduleExit();
|
||||
} catch (Exception e) {
|
||||
// Ignore exceptions.
|
||||
}
|
||||
}
|
||||
}
|
||||
cleanUpApplicationRecordLocked(app, false, true, -1, false /*replacingPid*/);
|
||||
mRemovedProcesses.remove(i);
|
||||
|
||||
// Now update the oom adj for all processes.
|
||||
updateOomAdjLocked();
|
||||
if (app.persistent) {
|
||||
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 */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user