summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Corina Grigoras <corinac@google.com> 2020-06-08 14:16:40 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-06-08 14:16:40 +0000
commitcdde51eae70a6ac54142168c84e05c94607b2f7d (patch)
tree3bd604ce3ad76e2dd4a65fc7d0d010157c1d1834
parentf909d9f0efb4b925bc5fe489579298a5d9d07715 (diff)
parent63f037cd2f35cddf76714fa2140f4233d371f3a4 (diff)
Merge "Keep lock while binding the storage service" into rvc-dev
-rw-r--r--services/core/java/com/android/server/storage/StorageUserConnection.java20
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);
}
}
}