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

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

Change-Id: I8e54b9a01ef3d49c3afd76eac6458db9a5bc8bc7
This commit is contained in:
Corina Grigoras
2020-06-08 14:51:22 +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);
}
}
}