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

Commit 63f037cd authored by Corina's avatar Corina
Browse files

Keep lock while binding the storage service

Test: atest ManagedProfileLifecycleStressTest; atest --iterations 100 AdoptableHostTest
BUG: 156533724
Change-Id: I007a406daaeaf2637ce472ee3d7e97ebeebed35f

Change-Id: Ie8c15c7e1c4bc6065e1ccdfad3d56e1a6d631360
parent df98b270
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -413,7 +413,6 @@ public final class StorageUserConnection {
                        resetUserSessions();
                    }
                };
            }

                Slog.i(TAG, "Binding to the ExternalStorageService for user " + mUserId);
                if (mContext.bindServiceAsUser(new Intent().setComponent(name), mServiceConnection,
@@ -422,14 +421,13 @@ public final class StorageUserConnection {
                    Slog.i(TAG, "Bound to the ExternalStorageService for user " + mUserId);
                    return mLatch;
                } else {
                synchronized (mLock) {
                    mIsConnecting = false;
                }
                    throw new ExternalStorageServiceException(
                            "Failed to bind to the ExternalStorageService for user " + mUserId);
                }
            }
        }
    }

    private static final class Session {
        public final String sessionId;