Merge "Keep lock while binding the storage service" into rvc-dev am: cdde51eae7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11712602

Change-Id: Ia6b17e12db534a4d7bad5477590f74b36bb168e8
This commit is contained in:
Corina Grigoras
2020-06-08 14:32:15 +00:00
committed by Automerger Merge Worker

View File

@@ -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);
}
}
}