In WorkManager 2 methods can be used to start a fragment executor:
- startFragmentPendingRemote(FragmentManager) will start running a fragment by calling executor.execute(fragment)
- addFragmentRunner(FragmentExecutor) will add the fragment to runningFragments and start a fragment after wrapping it inside a SelfCleanableRunner to make sure it's manager is removed from the WorkEventBus once finished.
Looking at how both methods are called it seems that we are actually calling startFragmentPendingRemote() for fragments that were added to the WorkEventBus and we call addFragmentRunner() for fragment that were not added to the workBus!!! For example in Foreman.setupRootFragment() we have the following:
The names of the methods are correct, but we need to switch their implementations