Skip to content

Commit 7f20874

Browse files
joshbartelGarmin Android technology group
authored andcommitted
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
1 parent e3491b6 commit 7f20874

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,7 +3566,7 @@ private final int startActivityUncheckedLocked(HistoryRecord r,
35663566
if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r
35673567
+ " in new task " + r.task);
35683568
newTask = true;
3569-
addRecentTask(r.task);
3569+
addRecentTaskLocked(r.task);
35703570

35713571
} else if (sourceRecord != null) {
35723572
if (!addingToTask &&
@@ -3855,7 +3855,7 @@ public final int startActivityInPackage(int uid,
38553855
}
38563856
}
38573857

3858-
private final void addRecentTask(TaskRecord task) {
3858+
private final void addRecentTaskLocked(TaskRecord task) {
38593859
// Remove any existing entries that are the same kind of task.
38603860
int N = mRecentTasks.size();
38613861
for (int i=0; i<N; i++) {
@@ -6887,7 +6887,7 @@ private final HistoryRecord resetTaskIfNeededLocked(HistoryRecord taskTop,
68876887
taskTopI = -1;
68886888
}
68896889
replyChainEnd = -1;
6890-
addRecentTask(target.task);
6890+
addRecentTaskLocked(target.task);
68916891
} else if (forceReset || finishOnTaskLaunch
68926892
|| clearWhenTaskReset) {
68936893
// If the activity should just be removed -- either
@@ -7109,7 +7109,7 @@ private final void moveTaskToFrontLocked(TaskRecord tr, HistoryRecord reason) {
71097109
moved.add(0, r);
71107110
top--;
71117111
if (first) {
7112-
addRecentTask(r.task);
7112+
addRecentTaskLocked(r.task);
71137113
first = false;
71147114
}
71157115
}
@@ -7134,11 +7134,11 @@ private final void moveTaskToFrontLocked(TaskRecord tr, HistoryRecord reason) {
71347134
mWindowManager.validateAppTokens(mHistory);
71357135
}
71367136

7137-
finishTaskMove(task);
7137+
finishTaskMoveLocked(task);
71387138
EventLog.writeEvent(LOG_TASK_TO_FRONT, task);
71397139
}
71407140

7141-
private final void finishTaskMove(int task) {
7141+
private final void finishTaskMoveLocked(int task) {
71427142
resumeTopActivityLocked(null);
71437143
}
71447144

@@ -7256,7 +7256,7 @@ private final boolean moveTaskToBackLocked(int task, HistoryRecord reason) {
72567256
mWindowManager.validateAppTokens(mHistory);
72577257
}
72587258

7259-
finishTaskMove(task);
7259+
finishTaskMoveLocked(task);
72607260
return true;
72617261
}
72627262

@@ -11564,7 +11564,7 @@ public void unbindBackupAgent(ApplicationInfo appInfo) {
1156411564
// BROADCASTS
1156511565
// =========================================================
1156611566

11567-
private final List getStickies(String action, IntentFilter filter,
11567+
private final List getStickiesLocked(String action, IntentFilter filter,
1156811568
List cur) {
1156911569
final ContentResolver resolver = mContext.getContentResolver();
1157011570
final ArrayList<Intent> list = mStickyBroadcasts.get(action);
@@ -11616,10 +11616,10 @@ public Intent registerReceiver(IApplicationThread caller,
1161611616
if (actions != null) {
1161711617
while (actions.hasNext()) {
1161811618
String action = (String)actions.next();
11619-
allSticky = getStickies(action, filter, allSticky);
11619+
allSticky = getStickiesLocked(action, filter, allSticky);
1162011620
}
1162111621
} else {
11622-
allSticky = getStickies(null, filter, allSticky);
11622+
allSticky = getStickiesLocked(null, filter, allSticky);
1162311623
}
1162411624

1162511625
// The first sticky in the list is returned directly back to
@@ -13357,7 +13357,7 @@ final void performAppGcLocked(ProcessRecord app) {
1335713357
/**
1335813358
* Returns true if things are idle enough to perform GCs.
1335913359
*/
13360-
private final boolean canGcNow() {
13360+
private final boolean canGcNowLocked() {
1336113361
return mParallelBroadcasts.size() == 0
1336213362
&& mOrderedBroadcasts.size() == 0
1336313363
&& (mSleeping || (mResumedActivity != null &&
@@ -13373,7 +13373,7 @@ final void performAppGcsLocked() {
1337313373
if (N <= 0) {
1337413374
return;
1337513375
}
13376-
if (canGcNow()) {
13376+
if (canGcNowLocked()) {
1337713377
while (mProcessesToGc.size() > 0) {
1337813378
ProcessRecord proc = mProcessesToGc.remove(0);
1337913379
if (proc.curRawAdj > VISIBLE_APP_ADJ || proc.reportLowMemory) {
@@ -13401,7 +13401,7 @@ final void performAppGcsLocked() {
1340113401
* If all looks good, perform GCs on all processes waiting for them.
1340213402
*/
1340313403
final void performAppGcsIfAppropriateLocked() {
13404-
if (canGcNow()) {
13404+
if (canGcNowLocked()) {
1340513405
performAppGcsLocked();
1340613406
return;
1340713407
}

0 commit comments

Comments
 (0)