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

Commit 7402191a authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Don't delay starting sessions.

It used to be the case that a volume could be mounted before its
corresponding user was unlocked, and in that case we needed to hold off
on starting sessions. That is however no longer the case, so we should
be able to start all sessions immediately.

Bug: 137890172
Test: atest AdoptableHostTest
Change-Id: Id4ea069631e58b244e401609c22aef485133578c
parent 7084c6a9
Loading
Loading
Loading
Loading
+2 −24
Original line number Diff line number Diff line
@@ -105,13 +105,7 @@ public final class StorageSessionController {
                    vol.getPath().getPath(), vol.getInternalPath().getPath());
        }

        // At boot, a volume can be mounted before user is unlocked, in that case, we create it
        // above and save it so that we can restart all sessions when the user is unlocked
        if (mExternalStorageServiceComponent != null) {
        connection.startSession(sessionId);
        } else {
            Slog.i(TAG, "Controller not initialised, session not started " + sessionId);
        }
    }

    /**
@@ -178,26 +172,10 @@ public final class StorageSessionController {
     * a session will be ignored.
     */
    public void onUnlockUser(int userId) throws ExternalStorageServiceException {
        if (!shouldHandle(null)) {
            return;
        }

        Slog.i(TAG, "On user unlock " + userId);
        if (userId == 0) {
        if (shouldHandle(null) && userId == 0) {
            initExternalStorageServiceComponent();
        }

        StorageUserConnection connection = null;
        synchronized (mLock) {
            connection = mConnections.get(userId);
        }

        if (connection != null) {
            Slog.i(TAG, "Restarting all sessions for user: " + userId);
            connection.startAllSessions();
        } else {
            Slog.w(TAG, "No connection found for user: " + userId);
        }
    }

    /**