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

Commit e7bca94d authored by Guliz Tuncay's avatar Guliz Tuncay
Browse files

Rename resetInternalState to resetInternalStateLocked

resetInternalState method is almost always called within a synchronized
block (except in the constructor of TSMS ) and it also calls several
methods that require a lock. Hence, to keep consistency, we rename this
method to resetInternalStateLocked.
This is a preparation CL for Bug 63041121.

Bug: 63041121
Test: None
Change-Id: I92a81adb10da58ab81cfef8a995cfd9e37020825
parent 62bf2b96
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -128,14 +128,14 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
        synchronized (mLock) {
            if (!mSystemReady) {
                mSystemReady = true;
                resetInternalState(mSettings.getCurrentUserId());
                resetInternalStateLocked(mSettings.getCurrentUserId());
            }
        }
    }

    void onSwitchUser(@UserIdInt int userId) {
        synchronized (mLock) {
            resetInternalState(userId);
            resetInternalStateLocked(userId);
        }
    }

@@ -145,7 +145,7 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
            if (userId != currentUserId) {
                return;
            }
            resetInternalState(currentUserId);
            resetInternalStateLocked(currentUserId);
        }
    }

@@ -173,11 +173,11 @@ public class TextServicesManagerService extends ITextServicesManager.Stub {
        mSettings = new TextServicesSettings(context.getContentResolver(), userId,
                useCopyOnWriteSettings);

        // "resetInternalState" initializes the states for the foreground user
        resetInternalState(userId);
        // "resetInternalStateLocked" initializes the states for the foreground user
        resetInternalStateLocked(userId);
    }

    private void resetInternalState(@UserIdInt int userId) {
    private void resetInternalStateLocked(@UserIdInt int userId) {
        final boolean useCopyOnWriteSettings =
                !mSystemReady || !mUserManager.isUserUnlockingOrUnlocked(userId);
        mSettings.switchCurrentUser(userId, useCopyOnWriteSettings);