diff options
| -rw-r--r-- | services/core/java/com/android/server/storage/StorageUserConnection.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/storage/StorageUserConnection.java b/services/core/java/com/android/server/storage/StorageUserConnection.java index c18a6ebc32ef..94a250236200 100644 --- a/services/core/java/com/android/server/storage/StorageUserConnection.java +++ b/services/core/java/com/android/server/storage/StorageUserConnection.java @@ -413,20 +413,18 @@ public final class StorageUserConnection { resetUserSessions(); } }; - } - Slog.i(TAG, "Binding to the ExternalStorageService for user " + mUserId); - if (mContext.bindServiceAsUser(new Intent().setComponent(name), mServiceConnection, - Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT, - UserHandle.of(mUserId))) { - Slog.i(TAG, "Bound to the ExternalStorageService for user " + mUserId); - return mLatch; - } else { - synchronized (mLock) { + Slog.i(TAG, "Binding to the ExternalStorageService for user " + mUserId); + if (mContext.bindServiceAsUser(new Intent().setComponent(name), mServiceConnection, + Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT, + UserHandle.of(mUserId))) { + Slog.i(TAG, "Bound to the ExternalStorageService for user " + mUserId); + return mLatch; + } else { mIsConnecting = false; + throw new ExternalStorageServiceException( + "Failed to bind to the ExternalStorageService for user " + mUserId); } - throw new ExternalStorageServiceException( - "Failed to bind to the ExternalStorageService for user " + mUserId); } } } |