Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ce7ed95 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Frameworks: Annotate trivial @GuardedBy in services

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)$").

Derived by errorprone.

Bug: 73000847
Test: m
Change-Id: If70bb03313388af34d547efca20fb5115de95bf1
parent 22f9af73
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2954,11 +2954,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
        mMetricsLogger.write(newLogMaker(category));
    }

    @GuardedBy("mLock")
    private void logAuthenticationStatusLocked(int requestId, int status) {
        addTaggedDataToRequestLogLocked(requestId,
                MetricsEvent.FIELD_AUTOFILL_AUTHENTICATION_STATUS, status);
    }

    @GuardedBy("mLock")
    private void addTaggedDataToRequestLogLocked(int requestId, int tag, @Nullable Object value) {
        final LogMaker requestLog = mRequestLogs.get(requestId);
        if (requestLog == null) {
+1 −1
Original line number Diff line number Diff line
@@ -8579,7 +8579,7 @@ public class PackageManagerService extends IPackageManager.Stub
     *  Traces a package scan.
     *  @see #scanPackageLI(File, int, int, long, UserHandle)
     */
    @GuardedBy("mInstallLock")
    @GuardedBy({"mInstallLock", "mPackages"})
    private PackageParser.Package scanPackageTracedLI(File scanFile, final int parseFlags,
            int scanFlags, long currentTime, UserHandle user) throws PackageManagerException {
        Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "scanPackage [" + scanFile.toString() + "]");
+5 −0
Original line number Diff line number Diff line
@@ -2203,6 +2203,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
     * @return the user password metrics, or {@code null} if none have been associated with
     * the user yet (for example, if the device has booted but not been unlocked).
     */
    @GuardedBy("getLockObject()")
    PasswordMetrics getUserPasswordMetricsLocked(int userHandle) {
        return mUserPasswordMetrics.get(userHandle);
    }
@@ -3972,6 +3973,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
     * be the correct one upon boot.
     * This should be called whenever the password or the admin policies have changed.
     */
    @GuardedBy("getLockObject()")
    private void updatePasswordValidityCheckpointLocked(int userHandle, boolean parent) {
        final int credentialOwner = getCredentialOwner(userHandle, parent);
        DevicePolicyData policy = getUserData(credentialOwner);
@@ -12313,6 +12315,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    /** Pauses security and network logging if there are unaffiliated users on the device */
    @GuardedBy("getLockObject()")
    private void maybePauseDeviceWideLoggingLocked() {
        if (!areAllUsersAffiliatedWithDeviceLocked()) {
            Slog.i(LOG_TAG, "There are unaffiliated users, security and network logging will be "
@@ -12325,6 +12328,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    /** Resumes security and network logging (if they are enabled) if all users are affiliated */
    @GuardedBy("getLockObject()")
    private void maybeResumeDeviceWideLoggingLocked() {
        if (areAllUsersAffiliatedWithDeviceLocked()) {
            final long ident = mInjector.binderClearCallingIdentity();
@@ -12340,6 +12344,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    /** Deletes any security and network logs that might have been collected so far */
    @GuardedBy("getLockObject()")
    private void discardDeviceWideLogsLocked() {
        mSecurityLogMonitor.discardLogs();
        if (mNetworkLogger != null) {
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ public class AppTimeLimitController {
    }

    /** Returns an existing UserData object for the given userId, or creates one */
    @GuardedBy("mLock")
    private UserData getOrCreateUserDataLocked(int userId) {
        UserData userData = mUsers.get(userId);
        if (userData == null) {
+1 −0
Original line number Diff line number Diff line
@@ -670,6 +670,7 @@ public class SoundTriggerService extends SystemService {
        /**
         * Disconnect from the service, but allow to re-connect when new operations are triggered.
         */
        @GuardedBy("mRemoteServiceLock")
        private void disconnectLocked() {
            if (mService != null) {
                try {