Frameworks: Annotate trivial @GuardedBy in services/core
Add @GuardedBy for simple functions that require locks and have a name in
one of the frameworks naming styles for locks ("^.*(Locked|LPw|LPr|L[a-zA-Z]|UL|AL|NL)$").
Changelist for power manager.
Derived by errorprone.
Bug: 73000847
Test: m
Change-Id: Id9c744a45d5f1580b6667e4c7f2df7857de44591
This commit is contained in:
@@ -196,6 +196,7 @@ public class BatterySaverStateMachine {
|
||||
h.postDelayed(r, delayMillis);
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
void refreshSettingsLocked() {
|
||||
final boolean lowPowerModeEnabled = getGlobalSetting(
|
||||
Settings.Global.LOW_POWER_MODE, 0) != 0;
|
||||
@@ -214,6 +215,7 @@ public class BatterySaverStateMachine {
|
||||
*
|
||||
* Note this will be called before {@link #onBootCompleted} too.
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
@VisibleForTesting
|
||||
void setSettingsLocked(boolean batterySaverEnabled, boolean batterySaverEnabledSticky,
|
||||
int batterySaverTriggerThreshold) {
|
||||
@@ -288,6 +290,7 @@ public class BatterySaverStateMachine {
|
||||
/**
|
||||
* Decide whether to auto-start / stop battery saver.
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
private void doAutoBatterySaverLocked() {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "doAutoBatterySaverLocked: mBootCompleted=" + mBootCompleted
|
||||
@@ -351,6 +354,7 @@ public class BatterySaverStateMachine {
|
||||
* Actually enable / disable battery saver. Write the new state to the global settings
|
||||
* and propagate it to {@link #mBatterySaverController}.
|
||||
*/
|
||||
@GuardedBy("mLock")
|
||||
private void enableBatterySaverLocked(boolean enable, boolean manual, int intReason,
|
||||
String strReason) {
|
||||
if (DEBUG) {
|
||||
@@ -402,6 +406,7 @@ public class BatterySaverStateMachine {
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
private void updateSnoozingLocked(boolean snoozing, String reason) {
|
||||
if (mBatterySaverSnoozing == snoozing) {
|
||||
return;
|
||||
|
||||
@@ -484,6 +484,7 @@ public class BatterySavingStats {
|
||||
(BatterySaverState.MASK << BatterySaverState.SHIFT) |
|
||||
(InteractiveState.MASK << InteractiveState.SHIFT);
|
||||
|
||||
@GuardedBy("BatterySavingStats.this.mLock")
|
||||
public void transitionStateLocked(
|
||||
int newState, long now, int batteryLevel, int batteryPercent) {
|
||||
final boolean stateChanging =
|
||||
@@ -503,6 +504,7 @@ public class BatterySavingStats {
|
||||
mLastState = newState;
|
||||
}
|
||||
|
||||
@GuardedBy("BatterySavingStats.this.mLock")
|
||||
void reportLocked(int state, long deltaTimeMs,
|
||||
int startBatteryLevelUa, int startBatteryLevelPercent,
|
||||
int endBatteryLevelUa, int endBatteryLevelPercent) {
|
||||
|
||||
Reference in New Issue
Block a user