Fix FrescoControllerImpl#onAttach instrumentation
@@ -204,6 +204,7 @@ public class FrescoControllerImpl implements FrescoController {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("FrescoControllerImpl#onAttach");
}
+ try {
frescoState.setAttached(true);
final FrescoExperiments experiments = mFrescoContext.getExperiments();
@@ -276,7 +277,8 @@ public class FrescoControllerImpl implements FrescoController {
placeholderDrawable =
mFrescoContext
.getHierarcher()
- .buildPlaceholderDrawable(frescoState.getResources(), frescoState.getImageOptions());
+ .buildPlaceholderDrawable(
+ frescoState.getResources(), frescoState.getImageOptions());
}
frescoState.getFrescoDrawable().setImageDrawable(placeholderDrawable);
@@ -290,20 +292,24 @@ public class FrescoControllerImpl implements FrescoController {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("FrescoControllerImpl#onAttach->fetch");
}
+ try {
DataSource<CloseableReference<CloseableImage>> dataSource = fireOffRequest(frescoState);
dataSource.subscribe(frescoState, mFrescoContext.getUiThreadExecutorService());
if (experiments.keepRefToMainFetchDatasouce()) {
frescoState.setMainFetchDatasource(dataSource);
}
+ } finally {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
-
+ }
+ } finally {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
+ }
protected DataSource<CloseableReference<CloseableImage>> fireOffRequest(FrescoState frescoState) {
if (FrescoSystrace.isTracing()) {
