Merge "Reduce calls to updateOomAdj() during unbind" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
76236ec313
@@ -1946,8 +1946,6 @@ public final class ActiveServices {
|
|||||||
r.binding.service.app.hasClientActivities()
|
r.binding.service.app.hasClientActivities()
|
||||||
|| r.binding.service.app.treatLikeActivity, null);
|
|| r.binding.service.app.treatLikeActivity, null);
|
||||||
}
|
}
|
||||||
mAm.updateOomAdjLocked(r.binding.service.app, false,
|
|
||||||
OomAdjuster.OOM_ADJ_REASON_UNBIND_SERVICE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2906,15 +2904,15 @@ public final class ActiveServices {
|
|||||||
|
|
||||||
// Tell the service that it has been unbound.
|
// Tell the service that it has been unbound.
|
||||||
if (r.app != null && r.app.thread != null) {
|
if (r.app != null && r.app.thread != null) {
|
||||||
for (int i=r.bindings.size()-1; i>=0; i--) {
|
boolean needOomAdj = false;
|
||||||
|
for (int i = r.bindings.size() - 1; i >= 0; i--) {
|
||||||
IntentBindRecord ibr = r.bindings.valueAt(i);
|
IntentBindRecord ibr = r.bindings.valueAt(i);
|
||||||
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "Bringing down binding " + ibr
|
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "Bringing down binding " + ibr
|
||||||
+ ": hasBound=" + ibr.hasBound);
|
+ ": hasBound=" + ibr.hasBound);
|
||||||
if (ibr.hasBound) {
|
if (ibr.hasBound) {
|
||||||
try {
|
try {
|
||||||
bumpServiceExecutingLocked(r, false, "bring down unbind");
|
bumpServiceExecutingLocked(r, false, "bring down unbind");
|
||||||
mAm.updateOomAdjLocked(r.app, true,
|
needOomAdj = true;
|
||||||
OomAdjuster.OOM_ADJ_REASON_UNBIND_SERVICE);
|
|
||||||
ibr.hasBound = false;
|
ibr.hasBound = false;
|
||||||
ibr.requested = false;
|
ibr.requested = false;
|
||||||
r.app.thread.scheduleUnbindService(r,
|
r.app.thread.scheduleUnbindService(r,
|
||||||
@@ -2926,6 +2924,10 @@ public final class ActiveServices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (needOomAdj) {
|
||||||
|
mAm.updateOomAdjLocked(r.app, true,
|
||||||
|
OomAdjuster.OOM_ADJ_REASON_UNBIND_SERVICE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if the service had been started as foreground, but being
|
// Check to see if the service had been started as foreground, but being
|
||||||
|
|||||||
Reference in New Issue
Block a user