diff options
author | 2025-02-20 02:44:51 -0800 | |
---|---|---|
committer | 2025-02-20 02:44:51 -0800 | |
commit | eccb3eed455e5d6fb93707f6d9430e6fcfc48929 (patch) | |
tree | 1aa366de0ed574fa42444baab1f6fff1817a9f1b /services | |
parent | 6e634c9ae9e6ecc4706311ffdf32215888307368 (diff) | |
parent | d8181994c4eb1d010404c915b5e388319d48bc26 (diff) |
Merge "Don't hold lock when calling into ExternalStorageService" into main
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/storage/StorageSessionController.java | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/services/core/java/com/android/server/storage/StorageSessionController.java b/services/core/java/com/android/server/storage/StorageSessionController.java index 342b864c6473..281aeb68f224 100644 --- a/services/core/java/com/android/server/storage/StorageSessionController.java +++ b/services/core/java/com/android/server/storage/StorageSessionController.java @@ -156,14 +156,15 @@ public final class StorageSessionController { StorageUserConnection connection = null; synchronized (mLock) { connection = mConnections.get(connectionUserId); - if (connection != null) { - Slog.i(TAG, "Notifying volume state changed for session with id: " + sessionId); - connection.notifyVolumeStateChanged(sessionId, - vol.buildStorageVolume(mContext, vol.getMountUserId(), false)); - } else { - Slog.w(TAG, "No available storage user connection for userId : " - + connectionUserId); - } + } + + if (connection != null) { + Slog.i(TAG, "Notifying volume state changed for session with id: " + sessionId); + connection.notifyVolumeStateChanged(sessionId, + vol.buildStorageVolume(mContext, vol.getMountUserId(), false)); + } else { + Slog.w(TAG, "No available storage user connection for userId : " + + connectionUserId); } } @@ -225,16 +226,18 @@ public final class StorageSessionController { String sessionId = vol.getId(); int userId = getConnectionUserIdForVolume(vol); + StorageUserConnection connection = null; synchronized (mLock) { - StorageUserConnection connection = mConnections.get(userId); - if (connection != null) { - Slog.i(TAG, "Removed session for vol with id: " + sessionId); - connection.removeSession(sessionId); - return connection; - } else { - Slog.w(TAG, "Session already removed for vol with id: " + sessionId); - return null; - } + connection = mConnections.get(userId); + } + + if (connection != null) { + Slog.i(TAG, "Removed session for vol with id: " + sessionId); + connection.removeSession(sessionId); + return connection; + } else { + Slog.w(TAG, "Session already removed for vol with id: " + sessionId); + return null; } } |