RN: Simplify Context Creation (Android)

Summary:
Every call site is either already using `createReactContextInBackground` correctly or guarding the invocation using `hasStartedCreatingInitialContext`. This is an unnecessary and overly complex dance that can be simplified.

This revision simplifies the use of `createReactContextInBackground` by integrating the check. This is not a breaking change.

Reviewed By: zackargyle, mdvacca

Differential Revision: D15566632

fbshipit-source-id: 7b50285c9ac6776d1297d2c9c53dff208851b722
This commit is contained in:
Tim Yung
2019-05-30 18:47:10 -07:00
committed by Facebook Github Bot
parent 060a3ea3bf
commit 739651afa1
3 changed files with 7 additions and 17 deletions
@@ -108,9 +108,7 @@ public abstract class HeadlessJsTaskService extends Service implements HeadlessJ
reactInstanceManager.removeReactInstanceEventListener(this);
}
});
if (!reactInstanceManager.hasStartedCreatingInitialContext()) {
reactInstanceManager.createReactContextInBackground();
}
reactInstanceManager.createReactContextInBackground();
} else {
invokeStartTask(reactContext, taskConfig);
}