Rename functions which ought to be named *Locked()
Several functions operate on variables to which access needs to be synchronized. However, it happens that the functions in question are only ever called from places which have already synchronized. Therefore, nothing is really wrong, but the functions ought to have 'Locked' appended to their names, to indicate that it is the caller's responsibility to synchronize before calling them. Change-Id: I44e7dc0dff6da9436677cb10908dce41ffeba195
This commit is contained in:
committed by
Garmin Android technology group
parent
e3491b6b5f
commit
7f2087435e
@@ -3566,7 +3566,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r
|
||||
+ " in new task " + r.task);
|
||||
newTask = true;
|
||||
addRecentTask(r.task);
|
||||
addRecentTaskLocked(r.task);
|
||||
|
||||
} else if (sourceRecord != null) {
|
||||
if (!addingToTask &&
|
||||
@@ -3855,7 +3855,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
}
|
||||
}
|
||||
|
||||
private final void addRecentTask(TaskRecord task) {
|
||||
private final void addRecentTaskLocked(TaskRecord task) {
|
||||
// Remove any existing entries that are the same kind of task.
|
||||
int N = mRecentTasks.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
@@ -6887,7 +6887,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
taskTopI = -1;
|
||||
}
|
||||
replyChainEnd = -1;
|
||||
addRecentTask(target.task);
|
||||
addRecentTaskLocked(target.task);
|
||||
} else if (forceReset || finishOnTaskLaunch
|
||||
|| clearWhenTaskReset) {
|
||||
// If the activity should just be removed -- either
|
||||
@@ -7109,7 +7109,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
moved.add(0, r);
|
||||
top--;
|
||||
if (first) {
|
||||
addRecentTask(r.task);
|
||||
addRecentTaskLocked(r.task);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
@@ -7134,11 +7134,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
mWindowManager.validateAppTokens(mHistory);
|
||||
}
|
||||
|
||||
finishTaskMove(task);
|
||||
finishTaskMoveLocked(task);
|
||||
EventLog.writeEvent(LOG_TASK_TO_FRONT, task);
|
||||
}
|
||||
|
||||
private final void finishTaskMove(int task) {
|
||||
private final void finishTaskMoveLocked(int task) {
|
||||
resumeTopActivityLocked(null);
|
||||
}
|
||||
|
||||
@@ -7256,7 +7256,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
mWindowManager.validateAppTokens(mHistory);
|
||||
}
|
||||
|
||||
finishTaskMove(task);
|
||||
finishTaskMoveLocked(task);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11564,7 +11564,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
// BROADCASTS
|
||||
// =========================================================
|
||||
|
||||
private final List getStickies(String action, IntentFilter filter,
|
||||
private final List getStickiesLocked(String action, IntentFilter filter,
|
||||
List cur) {
|
||||
final ContentResolver resolver = mContext.getContentResolver();
|
||||
final ArrayList<Intent> list = mStickyBroadcasts.get(action);
|
||||
@@ -11616,10 +11616,10 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
if (actions != null) {
|
||||
while (actions.hasNext()) {
|
||||
String action = (String)actions.next();
|
||||
allSticky = getStickies(action, filter, allSticky);
|
||||
allSticky = getStickiesLocked(action, filter, allSticky);
|
||||
}
|
||||
} else {
|
||||
allSticky = getStickies(null, filter, allSticky);
|
||||
allSticky = getStickiesLocked(null, filter, allSticky);
|
||||
}
|
||||
|
||||
// The first sticky in the list is returned directly back to
|
||||
@@ -13357,7 +13357,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
/**
|
||||
* Returns true if things are idle enough to perform GCs.
|
||||
*/
|
||||
private final boolean canGcNow() {
|
||||
private final boolean canGcNowLocked() {
|
||||
return mParallelBroadcasts.size() == 0
|
||||
&& mOrderedBroadcasts.size() == 0
|
||||
&& (mSleeping || (mResumedActivity != null &&
|
||||
@@ -13373,7 +13373,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
if (N <= 0) {
|
||||
return;
|
||||
}
|
||||
if (canGcNow()) {
|
||||
if (canGcNowLocked()) {
|
||||
while (mProcessesToGc.size() > 0) {
|
||||
ProcessRecord proc = mProcessesToGc.remove(0);
|
||||
if (proc.curRawAdj > VISIBLE_APP_ADJ || proc.reportLowMemory) {
|
||||
@@ -13401,7 +13401,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
||||
* If all looks good, perform GCs on all processes waiting for them.
|
||||
*/
|
||||
final void performAppGcsIfAppropriateLocked() {
|
||||
if (canGcNow()) {
|
||||
if (canGcNowLocked()) {
|
||||
performAppGcsLocked();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user