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

Commit d6d42067 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

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

Derived by errorprone.

Bug: 73000847
Test: m
Change-Id: Ic48bbb2f95c686fb44b6e3169c67fa52d6df80b4
parent edef60ed
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1913,6 +1913,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        return startInputInnerLocked();
    }

    @GuardedBy("mMethodMap")
    InputBindResult startInputInnerLocked() {
        if (mCurMethodId == null) {
            return InputBindResult.NO_IME;
@@ -2549,6 +2550,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
    }

    @GuardedBy("mMethodMap")
    boolean showCurrentInputLocked(int flags, ResultReceiver resultReceiver) {
        mShowRequested = true;
        if (mAccessibilityRequestingNoSoftKeyboard) {
+2 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
        mMonitor.register(context, null, UserHandle.ALL, true);
    }

    @GuardedBy("mLock")
    private void initializeInternalStateLocked(@UserIdInt int userId) {
        // When DISABLE_PER_PROFILE_SPELL_CHECKER is true, we make sure here that work profile users
        // will never have non-null TextServicesData for their user ID.
@@ -756,6 +757,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
     * @return {@link TextServicesData} for the given user.  {@code null} if spell checker is not
     *         temporarily / permanently available for the specified user
     */
    @GuardedBy("mLock")
    @Nullable
    private TextServicesData getDataFromCallingUserIdLocked(@UserIdInt int callingUserId) {
        final int spellCheckerOwnerUserId = mSpellCheckerOwnerUserIdMap.get(callingUserId);
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.AtomicFile;
import android.util.Slog;
import android.util.Xml;

import com.android.internal.annotations.GuardedBy;
import com.android.server.biometrics.common.BiometricUserState;

import libcore.io.IoUtils;
@@ -133,6 +134,7 @@ public class FaceUserState extends BiometricUserState {
        }
    }

    @GuardedBy("this")
    @Override
    protected void parseBiometricsLocked(XmlPullParser parser)
            throws IOException, XmlPullParserException {
+5 −0
Original line number Diff line number Diff line
@@ -249,10 +249,12 @@ public final class TextClassificationManagerService extends ITextClassifierServi
        }
    }

    @GuardedBy("mLock")
    private UserState getCallingUserStateLocked() {
        return getUserStateLocked(UserHandle.getCallingUserId());
    }

    @GuardedBy("mLock")
    private UserState getUserStateLocked(int userId) {
        UserState result = mUserStates.get(userId);
        if (result == null) {
@@ -262,6 +264,7 @@ public final class TextClassificationManagerService extends ITextClassifierServi
        return result;
    }

    @GuardedBy("mLock")
    UserState peekUserStateLocked(int userId) {
        return mUserStates.get(userId);
    }
@@ -389,6 +392,7 @@ public final class TextClassificationManagerService extends ITextClassifierServi
            }
        }

        @GuardedBy("mLock")
        private boolean bindIfHasPendingRequestsLocked() {
            return !mPendingRequests.isEmpty() && bindLocked();
        }
@@ -397,6 +401,7 @@ public final class TextClassificationManagerService extends ITextClassifierServi
         * @return true if the service is bound or in the process of being bound.
         *      Returns false otherwise.
         */
        @GuardedBy("mLock")
        private boolean bindLocked() {
            if (isBoundLocked() || mBinding) {
                return true;