/** * Fetches {@link RepoManager} set up to interact with android SDK repositories. It should not * cached by callers of this method, since any changes to the fundamental properties of the * manager (fallback loaders, local path) will cause a new instance to be created. */ @NonNull public RepoManager getSdkManager(@NonNull ProgressIndicator progress) { RepoManager result = mRepoManager; synchronized (MANAGER_LOCK) { if (result == null) { mSystemImageManager = null; mAndroidTargetManager = null; mLatestBuildTool = null; result = getRepoConfig(progress) .createRepoManager(progress, mLocation, getUserSourceProvider(progress), mFop); // Invalidate system images, targets, the latest build tool, and the legacy local // package manager when local packages change result.registerLocalChangeListener(packages -> { mSystemImageManager = null; mAndroidTargetManager = null; mLatestBuildTool = null; }); mRepoManager = result; } } return mRepoManager; }